@kjun-ui/react 0.22.0 → 0.23.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 +633 -256
- package/dist/index.js +741 -363
- package/dist/styles.css +140 -40
- package/dist/types/packages/react/src/app-navigation.d.cts +9 -3
- package/dist/types/packages/react/src/app-navigation.d.ts +9 -3
- package/dist/types/packages/react/src/button.d.cts +2 -1
- package/dist/types/packages/react/src/button.d.ts +2 -1
- package/dist/types/packages/react/src/display.d.cts +9 -4
- package/dist/types/packages/react/src/display.d.ts +9 -4
- package/dist/types/packages/react/src/dropdown.d.cts +2 -1
- package/dist/types/packages/react/src/dropdown.d.ts +2 -1
- package/dist/types/packages/react/src/input.d.cts +14 -1
- package/dist/types/packages/react/src/input.d.ts +14 -1
- package/dist/types/packages/react/src/list.d.cts +12 -6
- package/dist/types/packages/react/src/list.d.ts +12 -6
- package/dist/types/packages/react/src/market-model.d.cts +2 -0
- package/dist/types/packages/react/src/market-model.d.ts +2 -0
- package/dist/types/packages/react/src/number-input.d.cts +1 -1
- package/dist/types/packages/react/src/number-input.d.ts +1 -1
- package/dist/types/packages/react/src/side-navigation-layout-spaces.d.cts +31 -0
- package/dist/types/packages/react/src/side-navigation-layout-spaces.d.ts +31 -0
- package/dist/types/packages/react/src/side-navigation-layout.d.cts +17 -1
- package/dist/types/packages/react/src/side-navigation-layout.d.ts +17 -1
- package/dist/types/packages/react/src/split-pane.d.cts +3 -1
- package/dist/types/packages/react/src/split-pane.d.ts +3 -1
- package/dist/types/packages/react/src/steps.d.cts +3 -2
- package/dist/types/packages/react/src/steps.d.ts +3 -2
- package/dist/types/packages/react/src/table-grid.d.cts +1 -1
- package/dist/types/packages/react/src/table-grid.d.ts +1 -1
- package/dist/types/shared/package-runtime/bottom-navigation.d.cts +5 -0
- package/dist/types/shared/package-runtime/bottom-navigation.d.ts +5 -0
- package/dist/types/shared/package-runtime/field-group.d.cts +17 -0
- package/dist/types/shared/package-runtime/field-group.d.ts +17 -0
- package/dist/types/shared/package-runtime/list-row.d.cts +28 -2
- package/dist/types/shared/package-runtime/list-row.d.ts +28 -2
- package/dist/types/shared/package-runtime/menu-button.d.cts +2 -2
- package/dist/types/shared/package-runtime/menu-button.d.ts +2 -2
- package/dist/types/shared/package-runtime/messages/ko.d.cts +3 -0
- package/dist/types/shared/package-runtime/messages/ko.d.ts +3 -0
- package/dist/types/shared/package-runtime/messages-context.d.cts +3 -0
- package/dist/types/shared/package-runtime/messages-context.d.ts +3 -0
- package/dist/types/shared/package-runtime/node-text.d.cts +1 -0
- package/dist/types/shared/package-runtime/node-text.d.ts +1 -0
- package/dist/types/shared/package-runtime/number-input.d.cts +10 -0
- package/dist/types/shared/package-runtime/number-input.d.ts +10 -0
- package/dist/types/shared/package-runtime/progress-tone.d.cts +6 -0
- package/dist/types/shared/package-runtime/progress-tone.d.ts +6 -0
- package/dist/types/shared/package-runtime/side-navigation-layout.d.cts +24 -0
- package/dist/types/shared/package-runtime/side-navigation-layout.d.ts +24 -0
- package/dist/types/shared/package-runtime/steps.d.cts +18 -4
- package/dist/types/shared/package-runtime/steps.d.ts +18 -4
- package/dist/types/shared/package-runtime/table-presentation.d.cts +1 -0
- package/dist/types/shared/package-runtime/table-presentation.d.ts +1 -0
- package/dist/types/shared/package-runtime/table.d.cts +2 -0
- package/dist/types/shared/package-runtime/table.d.ts +2 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -226,6 +226,9 @@ var kjunMessagesEn = {
|
|
|
226
226
|
mainNavigation: "Main navigation",
|
|
227
227
|
collapseNavigation: "Collapse menu",
|
|
228
228
|
expandNavigation: "Expand menu",
|
|
229
|
+
spacesPanel: "Menu panel",
|
|
230
|
+
collapseSpacesPanel: "Collapse menu panel",
|
|
231
|
+
expandSpacesPanel: "Expand menu panel",
|
|
229
232
|
// The row after a side navigation group's first rows, and the row that folds them again.
|
|
230
233
|
showMoreItems: (count) => `Show ${count} more`,
|
|
231
234
|
showFewerItems: "Show less",
|
|
@@ -510,6 +513,9 @@ var kjunMessagesKo = {
|
|
|
510
513
|
mainNavigation: "\uC8FC\uC694 \uD0D0\uC0C9",
|
|
511
514
|
collapseNavigation: "\uBA54\uB274 \uC811\uAE30",
|
|
512
515
|
expandNavigation: "\uBA54\uB274 \uD3BC\uCE58\uAE30",
|
|
516
|
+
spacesPanel: "\uBA54\uB274 \uD328\uB110",
|
|
517
|
+
collapseSpacesPanel: "\uBA54\uB274 \uD328\uB110 \uC811\uAE30",
|
|
518
|
+
expandSpacesPanel: "\uBA54\uB274 \uD328\uB110 \uD3BC\uCE58\uAE30",
|
|
513
519
|
// 사이드 내비게이션 묶음의 처음 행 다음에 오는 행과, 다시 접는 행.
|
|
514
520
|
showMoreItems: (count) => `${count}\uAC1C \uB354 \uBCF4\uAE30`,
|
|
515
521
|
showFewerItems: "\uC811\uAE30",
|
|
@@ -1348,6 +1354,7 @@ var KjunButton = forwardRef(
|
|
|
1348
1354
|
const prefixNode = prefix != null && prefix !== false, suffixNode = suffix != null && suffix !== false;
|
|
1349
1355
|
const prefixIcon = prefixNode || !!prefixName, suffixIcon = suffixNode || !!suffixName;
|
|
1350
1356
|
const iconOnly = !hasContent2 && !!(prefixIcon || suffixIcon || busy);
|
|
1357
|
+
const roundLabel = shape === "circle" && hasContent2 && !prefixIcon && !suffixIcon && !block && variant !== "link";
|
|
1351
1358
|
const navigation = useContext6(TopNavigationContext);
|
|
1352
1359
|
const height = Math.max(tokens6.button.heights[size], (_a = navigation == null ? void 0 : navigation.controlSize) != null ? _a : 0);
|
|
1353
1360
|
const iconSize = (_b = navigation == null ? void 0 : navigation.iconSize) != null ? _b : tokens6.button.iconSizes[size];
|
|
@@ -1382,12 +1389,12 @@ var KjunButton = forwardRef(
|
|
|
1382
1389
|
minHeight: height,
|
|
1383
1390
|
width: block ? "100%" : iconOnly || shape === "circle" ? height : void 0,
|
|
1384
1391
|
// A width set by the caller (fixed square controls) wins over the label minimum.
|
|
1385
|
-
minWidth: hasContent2 && !block && (style == null ? void 0 : style.width) == null ? tokens6.button.minWidths[size] : void 0,
|
|
1386
|
-
padding: iconOnly ? 0 : `0 ${suffixIcon ? iconSide : paddingX}px 0 ${prefixIcon ? iconSide : paddingX}px`,
|
|
1392
|
+
minWidth: hasContent2 && !block && !roundLabel && (style == null ? void 0 : style.width) == null ? tokens6.button.minWidths[size] : void 0,
|
|
1393
|
+
padding: iconOnly || roundLabel ? 0 : `0 ${suffixIcon ? iconSide : paddingX}px 0 ${prefixIcon ? iconSide : paddingX}px`,
|
|
1387
1394
|
...typeStyle(tokens6.button.typography[size]),
|
|
1388
1395
|
borderRadius: pill ? tokens6.shape.pill : tokens6.button.radii[size],
|
|
1389
1396
|
gap: hasContent2 ? tokens6.button.contentGaps[size] : 0,
|
|
1390
|
-
...navigation || wrap ? {
|
|
1397
|
+
...(navigation || wrap) && !roundLabel ? {
|
|
1391
1398
|
height: "auto",
|
|
1392
1399
|
maxWidth: "100%",
|
|
1393
1400
|
paddingBlock: Math.max(0, (height - contentHeight) / 2)
|
|
@@ -1493,6 +1500,28 @@ function inputCount(value, maxLength) {
|
|
|
1493
1500
|
}
|
|
1494
1501
|
var searchLoadDelay = 300;
|
|
1495
1502
|
|
|
1503
|
+
// shared/package-runtime/field-group.ts
|
|
1504
|
+
function claimGroupField(claims, key, disabled) {
|
|
1505
|
+
const at = claims.findIndex((claim) => claim.key === key);
|
|
1506
|
+
if (at < 0) return [...claims, { key, disabled }];
|
|
1507
|
+
if (claims[at].disabled === disabled) return claims;
|
|
1508
|
+
const next = claims.slice();
|
|
1509
|
+
next[at] = { key, disabled };
|
|
1510
|
+
return next;
|
|
1511
|
+
}
|
|
1512
|
+
function releaseGroupField(claims, key) {
|
|
1513
|
+
return claims.some((claim) => claim.key === key) ? claims.filter((claim) => claim.key !== key) : claims;
|
|
1514
|
+
}
|
|
1515
|
+
function groupFieldOwner(claims) {
|
|
1516
|
+
var _a, _b;
|
|
1517
|
+
return (_b = (_a = claims.find((claim) => !claim.disabled)) != null ? _a : claims[0]) == null ? void 0 : _b.key;
|
|
1518
|
+
}
|
|
1519
|
+
function firstEnabledIndex(options, groupDisabled = false) {
|
|
1520
|
+
if (groupDisabled) return options.length ? 0 : -1;
|
|
1521
|
+
const at = options.findIndex((option) => !option.disabled);
|
|
1522
|
+
return at < 0 && options.length ? 0 : at;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1496
1525
|
// packages/react/src/input.tsx
|
|
1497
1526
|
import {
|
|
1498
1527
|
createContext as createContext8,
|
|
@@ -1522,9 +1551,22 @@ function useCompositionGuard() {
|
|
|
1522
1551
|
}
|
|
1523
1552
|
|
|
1524
1553
|
// packages/react/src/input.tsx
|
|
1525
|
-
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1554
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1526
1555
|
var FieldContext = createContext8(null);
|
|
1527
1556
|
var useKjunField = () => useContext7(FieldContext);
|
|
1557
|
+
function useGroupFieldId(disabled, own) {
|
|
1558
|
+
const field = useContext7(FieldContext), key = "kjun-choice-" + useId2(), group = own == null ? field == null ? void 0 : field.group : void 0;
|
|
1559
|
+
const claim = group == null ? void 0 : group.claim, release = group == null ? void 0 : group.release;
|
|
1560
|
+
useLayoutEffect3(() => {
|
|
1561
|
+
if (!claim || !release) return;
|
|
1562
|
+
claim(key, disabled);
|
|
1563
|
+
return () => release(key);
|
|
1564
|
+
}, [claim, release, key]);
|
|
1565
|
+
useLayoutEffect3(() => {
|
|
1566
|
+
claim == null ? void 0 : claim(key, disabled);
|
|
1567
|
+
}, [claim, key, disabled]);
|
|
1568
|
+
return group && group.owner === key ? field.id : own;
|
|
1569
|
+
}
|
|
1528
1570
|
function KjunFormGroup({
|
|
1529
1571
|
label,
|
|
1530
1572
|
id,
|
|
@@ -1535,6 +1577,7 @@ function KjunFormGroup({
|
|
|
1535
1577
|
labelHidden = false,
|
|
1536
1578
|
labelEnd,
|
|
1537
1579
|
className,
|
|
1580
|
+
as = "div",
|
|
1538
1581
|
children
|
|
1539
1582
|
}) {
|
|
1540
1583
|
const m = useKjunMessages();
|
|
@@ -1551,21 +1594,48 @@ function KjunFormGroup({
|
|
|
1551
1594
|
const hintId = shownHint ? fieldId + "-hint" : void 0, errorId = shownError ? fieldId + "-error" : void 0;
|
|
1552
1595
|
const describedBy = mergeIds(hintId, errorId);
|
|
1553
1596
|
const [controlId, setControlId] = useState6();
|
|
1554
|
-
const
|
|
1555
|
-
|
|
1597
|
+
const grouped = as === "fieldset", hasEnd = labelEnd != null && labelEnd !== false;
|
|
1598
|
+
const [claims, setClaims] = useState6([]);
|
|
1599
|
+
const [groupApi] = useState6(() => ({
|
|
1600
|
+
claim: (key, disabled) => setClaims((old) => claimGroupField(old, key, disabled)),
|
|
1601
|
+
release: (key) => setClaims((old) => releaseGroupField(old, key))
|
|
1602
|
+
}));
|
|
1603
|
+
const marks = /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1556
1604
|
required && /* @__PURE__ */ jsx7("span", { className: "kjun-form-required", "aria-hidden": "true", children: " *" }),
|
|
1557
1605
|
optional && !required && /* @__PURE__ */ jsxs4("span", { className: "kjun-form-optional", children: [
|
|
1558
1606
|
" ",
|
|
1559
1607
|
m.optional
|
|
1560
1608
|
] })
|
|
1561
1609
|
] });
|
|
1610
|
+
const labelNode = label && (grouped ? /* @__PURE__ */ jsxs4("legend", { className: "kjun-form-label" + (labelHidden || hasEnd ? " kjun-sr-only" : ""), id: labelId, children: [
|
|
1611
|
+
label,
|
|
1612
|
+
marks
|
|
1613
|
+
] }) : /* @__PURE__ */ jsxs4("label", { className: "kjun-form-label" + (labelHidden ? " kjun-sr-only" : ""), id: labelId, htmlFor: controlId || fieldId, children: [
|
|
1614
|
+
label,
|
|
1615
|
+
marks
|
|
1616
|
+
] }));
|
|
1617
|
+
const shownLabel = grouped && hasEnd ? label && !labelHidden && /* @__PURE__ */ jsxs4("span", { className: "kjun-form-label", "aria-hidden": "true", children: [
|
|
1618
|
+
label,
|
|
1619
|
+
marks
|
|
1620
|
+
] }) : labelNode;
|
|
1621
|
+
const Root = grouped ? "fieldset" : "div";
|
|
1562
1622
|
return /* @__PURE__ */ jsx7(
|
|
1563
1623
|
FieldContext.Provider,
|
|
1564
1624
|
{
|
|
1565
|
-
value: {
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1625
|
+
value: {
|
|
1626
|
+
id: fieldId,
|
|
1627
|
+
labelId,
|
|
1628
|
+
describedBy,
|
|
1629
|
+
error,
|
|
1630
|
+
required,
|
|
1631
|
+
setControlId,
|
|
1632
|
+
reportError,
|
|
1633
|
+
group: grouped ? { ...groupApi, owner: groupFieldOwner(claims) } : void 0
|
|
1634
|
+
},
|
|
1635
|
+
children: /* @__PURE__ */ jsxs4(Root, { className: className ? "kjun-form-group " + className : "kjun-form-group", "aria-describedby": grouped ? describedBy : void 0, children: [
|
|
1636
|
+
grouped && hasEnd && labelNode,
|
|
1637
|
+
hasEnd ? /* @__PURE__ */ jsxs4("div", { className: "kjun-form-label-row", children: [
|
|
1638
|
+
shownLabel,
|
|
1569
1639
|
/* @__PURE__ */ jsx7("span", { className: "kjun-form-label-end", children: labelEnd })
|
|
1570
1640
|
] }) : labelNode,
|
|
1571
1641
|
children,
|
|
@@ -1991,12 +2061,12 @@ function FloatingPanel({
|
|
|
1991
2061
|
var resolveFocusReturn = (target) => target === void 0 ? void 0 : () => typeof target === "function" ? target() : target instanceof HTMLElement ? target : target.current;
|
|
1992
2062
|
|
|
1993
2063
|
// shared/package-runtime/content-presence.ts
|
|
1994
|
-
import { Fragment as
|
|
2064
|
+
import { Fragment as Fragment3, isValidElement } from "react";
|
|
1995
2065
|
function hasContent(node) {
|
|
1996
2066
|
if (node == null || typeof node === "boolean") return false;
|
|
1997
2067
|
if (typeof node === "string") return node.trim().length > 0;
|
|
1998
2068
|
if (Array.isArray(node)) return node.some(hasContent);
|
|
1999
|
-
if (isValidElement(node) && node.type ===
|
|
2069
|
+
if (isValidElement(node) && node.type === Fragment3)
|
|
2000
2070
|
return hasContent(node.props.children);
|
|
2001
2071
|
return true;
|
|
2002
2072
|
}
|
|
@@ -2418,6 +2488,7 @@ var progressMarkerInset = (percent2) => percent2 / 100 * tokens19.extensions.pro
|
|
|
2418
2488
|
// packages/react/src/display.tsx
|
|
2419
2489
|
import {
|
|
2420
2490
|
forwardRef as forwardRef3,
|
|
2491
|
+
useCallback as useCallback2,
|
|
2421
2492
|
useId as useId5,
|
|
2422
2493
|
useLayoutEffect as useLayoutEffect7,
|
|
2423
2494
|
useRef as useRef11,
|
|
@@ -2435,6 +2506,14 @@ function useSkeletonPhase(active = true) {
|
|
|
2435
2506
|
return ref;
|
|
2436
2507
|
}
|
|
2437
2508
|
|
|
2509
|
+
// shared/package-runtime/progress-tone.ts
|
|
2510
|
+
function progressColorKey(variant) {
|
|
2511
|
+
return variant === "primary" ? "brand" : variant === "neutral" ? "textTertiary" : variant;
|
|
2512
|
+
}
|
|
2513
|
+
function progressColorRole(variant) {
|
|
2514
|
+
return variant === "neutral" ? "text-tertiary" : progressColorKey(variant);
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2438
2517
|
// shared/package-runtime/nested-controls.ts
|
|
2439
2518
|
var interactive = 'button, a[href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
|
|
2440
2519
|
function developmentMode3() {
|
|
@@ -2550,11 +2629,16 @@ function warnListSelection({ mode, value, handled }) {
|
|
|
2550
2629
|
warnOnce("selection-single", mode === "single" && Array.isArray(value), 'selectionMode "single" takes one value (or null); a list reads as nothing chosen.', "ListSection");
|
|
2551
2630
|
warnOnce("selection-handler", mode !== "none" && !handled, "value is given without onValueChange, so pressing a row never changes the choice; pass onValueChange.", "ListSection");
|
|
2552
2631
|
}
|
|
2553
|
-
function
|
|
2632
|
+
function listSectionSurface(surface = true) {
|
|
2633
|
+
const muted = surface === "muted", painted = muted || surface === true;
|
|
2634
|
+
return { painted, muted, attribute: muted ? "muted" : painted ? void 0 : "false" };
|
|
2635
|
+
}
|
|
2636
|
+
function listSectionShape({ radius, group, variant, title, description, titleVariant, bleed: wantsBleed = false }) {
|
|
2554
2637
|
const resolved = variant != null ? variant : group === "open" ? "open" : "default", open = resolved === "open", details = resolved === "details";
|
|
2555
|
-
const
|
|
2638
|
+
const bleed = wantsBleed && !open;
|
|
2639
|
+
const corner = open || bleed ? "none" : radius != null ? radius : group === "inset" ? "lg" : "none";
|
|
2556
2640
|
const bare = !!title && (titleVariant ? titleVariant === "label" : !description);
|
|
2557
|
-
return { open, details, corner, bare, outside: corner !== "none" };
|
|
2641
|
+
return { open, details, corner, bare, outside: corner !== "none", bleed };
|
|
2558
2642
|
}
|
|
2559
2643
|
function observeListHeadingActions(actions) {
|
|
2560
2644
|
const heading = actions.parentElement;
|
|
@@ -2571,7 +2655,7 @@ function observeListHeadingActions(actions) {
|
|
|
2571
2655
|
}
|
|
2572
2656
|
|
|
2573
2657
|
// packages/react/src/card.tsx
|
|
2574
|
-
import { Fragment as
|
|
2658
|
+
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2575
2659
|
function KjunCard({
|
|
2576
2660
|
title,
|
|
2577
2661
|
subtitle,
|
|
@@ -2604,6 +2688,7 @@ function KjunCard({
|
|
|
2604
2688
|
onKeyUp,
|
|
2605
2689
|
...props
|
|
2606
2690
|
}) {
|
|
2691
|
+
var _a;
|
|
2607
2692
|
const root = useRef10(null);
|
|
2608
2693
|
const link = href !== void 0;
|
|
2609
2694
|
useEffect6(() => {
|
|
@@ -2635,7 +2720,8 @@ function KjunCard({
|
|
|
2635
2720
|
onKeyDown,
|
|
2636
2721
|
onKeyUp
|
|
2637
2722
|
} : pressable ? {
|
|
2638
|
-
role
|
|
2723
|
+
// A caller's role (radio, checkbox, switch, as in a card picker) stays; the card still presses like a button.
|
|
2724
|
+
role: (_a = props.role) != null ? _a : "button",
|
|
2639
2725
|
tabIndex: disabled ? -1 : 0,
|
|
2640
2726
|
"aria-disabled": disabled || void 0,
|
|
2641
2727
|
"aria-label": name,
|
|
@@ -2695,7 +2781,7 @@ function KjunCard({
|
|
|
2695
2781
|
}
|
|
2696
2782
|
),
|
|
2697
2783
|
layout.header && /* @__PURE__ */ jsxs6("div", { className: "kjun-card-header", "data-description": !parts2.header && parts2.subtitle, "data-titled": layout.titled || void 0, children: [
|
|
2698
|
-
layout.heading && /* @__PURE__ */ jsx10("div", { className: "kjun-card-heading", "data-title": layout.titled ? "" : void 0, children: parts2.header ? header : /* @__PURE__ */ jsxs6(
|
|
2784
|
+
layout.heading && /* @__PURE__ */ jsx10("div", { className: "kjun-card-heading", "data-title": layout.titled ? "" : void 0, children: parts2.header ? header : /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
2699
2785
|
parts2.title && /* @__PURE__ */ jsx10(Title, { className: "kjun-card-title", children: title }),
|
|
2700
2786
|
parts2.subtitle && /* @__PURE__ */ jsx10("p", { className: "kjun-card-subtitle", children: subtitle })
|
|
2701
2787
|
] }) }),
|
|
@@ -2710,7 +2796,7 @@ function KjunCard({
|
|
|
2710
2796
|
}
|
|
2711
2797
|
|
|
2712
2798
|
// packages/react/src/display.tsx
|
|
2713
|
-
import { Fragment as
|
|
2799
|
+
import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2714
2800
|
var role = (name) => `var(--_kjun-color-${name})`;
|
|
2715
2801
|
var KjunBadge = forwardRef3(function KjunBadge2({
|
|
2716
2802
|
variant = "default",
|
|
@@ -2755,7 +2841,7 @@ var KjunBadge = forwardRef3(function KjunBadge2({
|
|
|
2755
2841
|
},
|
|
2756
2842
|
children: [
|
|
2757
2843
|
dot && /* @__PURE__ */ jsx11("span", { className: "kjun-badge-dot", style: { background: role(paint.dot) } }),
|
|
2758
|
-
label ? /* @__PURE__ */ jsxs7(
|
|
2844
|
+
label ? /* @__PURE__ */ jsxs7(Fragment5, { children: [
|
|
2759
2845
|
/* @__PURE__ */ jsx11("span", { className: "kjun-sr-only", children: label }),
|
|
2760
2846
|
!dotOnly && /* @__PURE__ */ jsx11("span", { "aria-hidden": "true", children: body })
|
|
2761
2847
|
] }) : body
|
|
@@ -2795,7 +2881,7 @@ function KjunSpinner({ size = "md", text }) {
|
|
|
2795
2881
|
] })
|
|
2796
2882
|
);
|
|
2797
2883
|
}
|
|
2798
|
-
|
|
2884
|
+
var KjunAlert = forwardRef3(function KjunAlert2({
|
|
2799
2885
|
type = "info",
|
|
2800
2886
|
variant,
|
|
2801
2887
|
size = "md",
|
|
@@ -2806,12 +2892,19 @@ function KjunAlert({
|
|
|
2806
2892
|
children,
|
|
2807
2893
|
actions,
|
|
2808
2894
|
className,
|
|
2809
|
-
onClose
|
|
2810
|
-
|
|
2895
|
+
onClose,
|
|
2896
|
+
style,
|
|
2897
|
+
...rest
|
|
2898
|
+
}, forward) {
|
|
2811
2899
|
const m = useKjunMessages();
|
|
2812
2900
|
const [visible, setVisible] = useState8(true);
|
|
2813
2901
|
const root = useRef11(null), body = useRef11(null), closing = useRef11(false);
|
|
2814
2902
|
const reduced = useReducedMotion();
|
|
2903
|
+
const attach = useCallback2((node) => {
|
|
2904
|
+
root.current = node;
|
|
2905
|
+
if (typeof forward === "function") forward(node);
|
|
2906
|
+
else if (forward) forward.current = node;
|
|
2907
|
+
}, [forward]);
|
|
2815
2908
|
const beside = !hasContent(title) && hasContent(actions);
|
|
2816
2909
|
const [wrapped, setWrapped] = useState8(false);
|
|
2817
2910
|
useLayoutEffect7(() => beside && visible ? observeAlertActions(body.current, setWrapped) : void 0, [beside, visible]);
|
|
@@ -2822,17 +2915,18 @@ function KjunAlert({
|
|
|
2822
2915
|
return /* @__PURE__ */ jsxs7(
|
|
2823
2916
|
"div",
|
|
2824
2917
|
{
|
|
2825
|
-
|
|
2918
|
+
...rest,
|
|
2919
|
+
ref: attach,
|
|
2826
2920
|
role: alertRole(tone, live),
|
|
2827
2921
|
className: className ? "kjun-alert " + className : "kjun-alert",
|
|
2828
2922
|
"data-size": scale,
|
|
2829
2923
|
"data-tone": tone,
|
|
2830
|
-
style: paint.bg ? { background: role(paint.bg) } :
|
|
2924
|
+
style: paint.bg ? { background: role(paint.bg), ...style } : style,
|
|
2831
2925
|
children: [
|
|
2832
2926
|
icon2 !== false && /* @__PURE__ */ jsx11("span", { className: "kjun-alert-icon", "data-icon": icon2 ? "custom" : void 0, style: { color: role(paint.icon) }, children: /* @__PURE__ */ jsx11(KjunIcon, { name: icon2 || alertIcons[tone], filled: true, size: tokens23.extensions.alert.iconSizes[scale] }) }),
|
|
2833
2927
|
/* @__PURE__ */ jsxs7("div", { ref: body, className: "kjun-alert-content", children: [
|
|
2834
|
-
titled && /* @__PURE__ */ jsx11("div", { className: "kjun-alert-title", children: title }),
|
|
2835
|
-
hasContent(children) && /* @__PURE__ */ jsx11("div", { className: "kjun-alert-description", children }),
|
|
2928
|
+
titled && /* @__PURE__ */ jsx11("div", { className: "kjun-alert-title", "data-kjun-content": "", children: title }),
|
|
2929
|
+
hasContent(children) && /* @__PURE__ */ jsx11("div", { className: "kjun-alert-description", "data-kjun-content": "", children }),
|
|
2836
2930
|
actionBox
|
|
2837
2931
|
] }),
|
|
2838
2932
|
closable && /* @__PURE__ */ jsx11(
|
|
@@ -2855,7 +2949,7 @@ function KjunAlert({
|
|
|
2855
2949
|
]
|
|
2856
2950
|
}
|
|
2857
2951
|
);
|
|
2858
|
-
}
|
|
2952
|
+
});
|
|
2859
2953
|
function KjunProgress({
|
|
2860
2954
|
value = 0,
|
|
2861
2955
|
indeterminate = false,
|
|
@@ -2867,15 +2961,16 @@ function KjunProgress({
|
|
|
2867
2961
|
marker,
|
|
2868
2962
|
markerLabel,
|
|
2869
2963
|
label,
|
|
2964
|
+
ariaLabel,
|
|
2870
2965
|
subLabel,
|
|
2871
2966
|
shape = "bar"
|
|
2872
2967
|
}) {
|
|
2873
2968
|
const m = useKjunMessages(), baseId = "kjun-progress-" + useId5().replace(/:/g, ""), markerId = baseId + "-marker";
|
|
2874
|
-
const labelId = label && typeof label !== "string" ? baseId + "-label" : void 0, noDataId = baseId + "-nodata";
|
|
2969
|
+
const labelId = !ariaLabel && label && typeof label !== "string" ? baseId + "-label" : void 0, noDataId = baseId + "-nodata";
|
|
2875
2970
|
const state = progressState(value, max, indeterminate);
|
|
2876
2971
|
const percentage = state === "determinate" ? progressPercent(value, max) : 0;
|
|
2877
2972
|
const text = state === "indeterminate" ? m.loadingEllipsis : state === "missing" ? "\u2014" : valueText != null ? valueText : `${percentage}%`;
|
|
2878
|
-
const name = typeof label === "string" ? label : m.progress, color = role(variant
|
|
2973
|
+
const name = ariaLabel || (typeof label === "string" ? label : m.progress), color = role(progressColorRole(variant));
|
|
2879
2974
|
const accessibility = {
|
|
2880
2975
|
role: state === "missing" ? "img" : "progressbar",
|
|
2881
2976
|
"aria-label": labelId ? void 0 : state === "missing" ? `${name}: ${m.noData}` : name,
|
|
@@ -3027,11 +3122,11 @@ function KjunSkeleton({
|
|
|
3027
3122
|
// packages/react/src/layout-primitives.tsx
|
|
3028
3123
|
import {
|
|
3029
3124
|
Children,
|
|
3030
|
-
Fragment as
|
|
3125
|
+
Fragment as Fragment6,
|
|
3031
3126
|
cloneElement,
|
|
3032
3127
|
createElement as createElement2,
|
|
3033
3128
|
isValidElement as isValidElement2,
|
|
3034
|
-
useCallback as
|
|
3129
|
+
useCallback as useCallback3,
|
|
3035
3130
|
useEffect as useEffect7,
|
|
3036
3131
|
useId as useId6,
|
|
3037
3132
|
useLayoutEffect as useLayoutEffect8,
|
|
@@ -3165,7 +3260,7 @@ function KjunText({
|
|
|
3165
3260
|
const autoId = "kjun-text-" + useId6().replace(/[^\w-]/g, ""), id = toggle ? (_a = rest.id) != null ? _a : autoId : rest.id;
|
|
3166
3261
|
const [element, setElement] = useState9(null);
|
|
3167
3262
|
const forward = rest.ref;
|
|
3168
|
-
const ref =
|
|
3263
|
+
const ref = useCallback3((node) => {
|
|
3169
3264
|
setElement(node);
|
|
3170
3265
|
if (typeof forward === "function") forward(node);
|
|
3171
3266
|
else if (forward) forward.current = node;
|
|
@@ -3223,7 +3318,7 @@ function useContainerWidth(enabled2, outer) {
|
|
|
3223
3318
|
observer.observe(node);
|
|
3224
3319
|
return () => observer.disconnect();
|
|
3225
3320
|
}, [node, enabled2]);
|
|
3226
|
-
const ref =
|
|
3321
|
+
const ref = useCallback3((element) => {
|
|
3227
3322
|
setNode(element);
|
|
3228
3323
|
if (typeof outer === "function") outer(element);
|
|
3229
3324
|
else if (outer) outer.current = element;
|
|
@@ -3233,7 +3328,7 @@ function useContainerWidth(enabled2, outer) {
|
|
|
3233
3328
|
function flatten(children, path = "") {
|
|
3234
3329
|
return Children.toArray(children).flatMap((child) => {
|
|
3235
3330
|
if (!isValidElement2(child)) return [child];
|
|
3236
|
-
if (child.type ===
|
|
3331
|
+
if (child.type === Fragment6) return flatten(child.props.children, path + child.key + "/");
|
|
3237
3332
|
return [path ? cloneElement(child, { key: path + child.key }) : child];
|
|
3238
3333
|
});
|
|
3239
3334
|
}
|
|
@@ -3312,11 +3407,11 @@ var tilesProps = (gap, minItem, maxColumns) => {
|
|
|
3312
3407
|
};
|
|
3313
3408
|
|
|
3314
3409
|
// shared/package-runtime/tiles-children.ts
|
|
3315
|
-
import { Children as Children2, Fragment as
|
|
3410
|
+
import { Children as Children2, Fragment as Fragment7, isValidElement as isValidElement3 } from "react";
|
|
3316
3411
|
function tileItems(children, path = "") {
|
|
3317
3412
|
return Children2.toArray(children).flatMap((child, i) => {
|
|
3318
3413
|
const key = path + (isValidElement3(child) && child.key != null ? child.key : "#" + i);
|
|
3319
|
-
if (isValidElement3(child) && child.type ===
|
|
3414
|
+
if (isValidElement3(child) && child.type === Fragment7) return tileItems(child.props.children, key + "/");
|
|
3320
3415
|
return typeof child === "string" && !child.trim() ? [] : [[key, child]];
|
|
3321
3416
|
});
|
|
3322
3417
|
}
|
|
@@ -4022,7 +4117,7 @@ import {
|
|
|
4022
4117
|
tokens as tokens35
|
|
4023
4118
|
} from "@kjun-ui/tokens";
|
|
4024
4119
|
import {
|
|
4025
|
-
useCallback as
|
|
4120
|
+
useCallback as useCallback5,
|
|
4026
4121
|
useEffect as useEffect12,
|
|
4027
4122
|
useId as useId8,
|
|
4028
4123
|
useRef as useRef18,
|
|
@@ -4048,7 +4143,7 @@ function growTextarea(element, minimum, maximum) {
|
|
|
4048
4143
|
|
|
4049
4144
|
// packages/react/src/textarea.tsx
|
|
4050
4145
|
import { tokens as tokens34 } from "@kjun-ui/tokens";
|
|
4051
|
-
import { forwardRef as forwardRef4, useCallback as
|
|
4146
|
+
import { forwardRef as forwardRef4, useCallback as useCallback4, useId as useId7, useLayoutEffect as useLayoutEffect11, useRef as useRef17 } from "react";
|
|
4052
4147
|
import { jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4053
4148
|
var KjunTextarea = forwardRef4(
|
|
4054
4149
|
function KjunTextarea2({
|
|
@@ -4078,7 +4173,7 @@ var KjunTextarea = forwardRef4(
|
|
|
4078
4173
|
const spec = tokens34.input[size];
|
|
4079
4174
|
const countId = "kjun-count-" + useId7();
|
|
4080
4175
|
const element = useRef17(null);
|
|
4081
|
-
const setRef =
|
|
4176
|
+
const setRef = useCallback4((node) => {
|
|
4082
4177
|
element.current = node;
|
|
4083
4178
|
if (typeof ref === "function") ref(node);
|
|
4084
4179
|
else if (ref) ref.current = node;
|
|
@@ -4167,7 +4262,7 @@ var KjunTextarea = forwardRef4(
|
|
|
4167
4262
|
|
|
4168
4263
|
// packages/react/src/feedback.tsx
|
|
4169
4264
|
import { createKjunFeedback } from "@kjun-ui/tokens";
|
|
4170
|
-
import { Fragment as
|
|
4265
|
+
import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4171
4266
|
function useKjunFeedback() {
|
|
4172
4267
|
const value = useOptionalKjunFeedback();
|
|
4173
4268
|
if (!value) throw Error("useKjunFeedback requires KjunFeedbackProvider.");
|
|
@@ -4175,7 +4270,7 @@ function useKjunFeedback() {
|
|
|
4175
4270
|
}
|
|
4176
4271
|
function RequiredLabel({ text, value }) {
|
|
4177
4272
|
const [before, quoted, after] = splitAround(text, value);
|
|
4178
|
-
return /* @__PURE__ */ jsxs12(
|
|
4273
|
+
return /* @__PURE__ */ jsxs12(Fragment8, { children: [
|
|
4179
4274
|
before,
|
|
4180
4275
|
/* @__PURE__ */ jsx17("strong", { children: quoted }),
|
|
4181
4276
|
after
|
|
@@ -4235,7 +4330,7 @@ function FeedbackDialog({
|
|
|
4235
4330
|
options.maxLength
|
|
4236
4331
|
] })
|
|
4237
4332
|
] }),
|
|
4238
|
-
options.multiline ? /* @__PURE__ */ jsxs12(
|
|
4333
|
+
options.multiline ? /* @__PURE__ */ jsxs12(Fragment8, { children: [
|
|
4239
4334
|
/* @__PURE__ */ jsx17(
|
|
4240
4335
|
KjunTextarea,
|
|
4241
4336
|
{
|
|
@@ -4281,7 +4376,7 @@ function KjunFeedbackProvider({ children, controller: controllerProp, placement
|
|
|
4281
4376
|
};
|
|
4282
4377
|
}, [controller]);
|
|
4283
4378
|
const [layers, setLayers] = useState13([]);
|
|
4284
|
-
const register =
|
|
4379
|
+
const register = useCallback5((id, order) => {
|
|
4285
4380
|
setLayers((current) => [...current, { id, order }]);
|
|
4286
4381
|
return () => setLayers((current) => current.filter((value) => value.id !== id));
|
|
4287
4382
|
}, []);
|
|
@@ -4338,7 +4433,7 @@ var anchorStyle = { position: "fixed", pointerEvents: "none", visibility: "hidde
|
|
|
4338
4433
|
|
|
4339
4434
|
// packages/react/src/popover.tsx
|
|
4340
4435
|
import { tokens as tokens36 } from "@kjun-ui/tokens";
|
|
4341
|
-
import { Children as Children3, Fragment as
|
|
4436
|
+
import { Children as Children3, Fragment as Fragment9, cloneElement as cloneElement2, isValidElement as isValidElement4, useCallback as useCallback6, useContext as useContext10, useEffect as useEffect13, useId as useId9, useLayoutEffect as useLayoutEffect12, useRef as useRef19, useState as useState14 } from "react";
|
|
4342
4437
|
import { Dialog as Dialog2, Focusable, OverlayArrow, Tooltip, TooltipTrigger, TooltipTriggerStateContext } from "react-aria-components";
|
|
4343
4438
|
|
|
4344
4439
|
// shared/package-runtime/popover-nonmodal.ts
|
|
@@ -4418,12 +4513,12 @@ function trackPopoverScroll(body) {
|
|
|
4418
4513
|
}
|
|
4419
4514
|
|
|
4420
4515
|
// packages/react/src/popover.tsx
|
|
4421
|
-
import { Fragment as
|
|
4516
|
+
import { Fragment as Fragment10, jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4422
4517
|
function bindPopoverTrigger(node, props) {
|
|
4423
4518
|
if (!isValidElement4(node)) return node;
|
|
4424
4519
|
if (node.type === KjunTooltip)
|
|
4425
4520
|
return cloneElement2(node, {}, bindPopoverTrigger(node.props.children, props));
|
|
4426
|
-
if (node.type ===
|
|
4521
|
+
if (node.type === Fragment9 || typeof node.type === "string" && !["button", "a", "input", "summary"].includes(node.type) && node.props.role !== "button" && node.props.tabIndex == null) {
|
|
4427
4522
|
return cloneElement2(node, {}, Children3.map(node.props.children, (child) => bindPopoverTrigger(child, props)));
|
|
4428
4523
|
}
|
|
4429
4524
|
return cloneElement2(node, props);
|
|
@@ -4453,11 +4548,11 @@ function KjunPopover({
|
|
|
4453
4548
|
const expanded = usePopupExpanded(open, ref);
|
|
4454
4549
|
const focusOnMount = useRef19(focusOnOpen);
|
|
4455
4550
|
focusOnMount.current = focusOnOpen;
|
|
4456
|
-
const focusContent =
|
|
4551
|
+
const focusContent = useCallback6((node) => {
|
|
4457
4552
|
if (node && focusOnMount.current) node.focus();
|
|
4458
4553
|
}, []);
|
|
4459
4554
|
const stopScroll = useRef19(void 0);
|
|
4460
|
-
const trackBody =
|
|
4555
|
+
const trackBody = useCallback6((node) => {
|
|
4461
4556
|
var _a;
|
|
4462
4557
|
(_a = stopScroll.current) == null ? void 0 : _a.call(stopScroll);
|
|
4463
4558
|
stopScroll.current = node ? trackPopoverScroll(node) : void 0;
|
|
@@ -4497,7 +4592,7 @@ function KjunPopover({
|
|
|
4497
4592
|
});
|
|
4498
4593
|
}, [open, modal, id]);
|
|
4499
4594
|
const content = /* @__PURE__ */ jsx18("div", { className: "kjun-popover-content", "data-no-padding": noPadding, children: /* @__PURE__ */ jsx18(ActionSizeContext.Provider, { value: popoverActionSize, children: typeof children === "function" ? children(() => change(false)) : children }) });
|
|
4500
|
-
return /* @__PURE__ */ jsxs13(
|
|
4595
|
+
return /* @__PURE__ */ jsxs13(Fragment10, { children: [
|
|
4501
4596
|
anchored && /* @__PURE__ */ jsx18("div", { ref: anchor, "aria-hidden": "true", style: anchorStyle }),
|
|
4502
4597
|
(!anchored || trigger != null) && /* @__PURE__ */ jsx18(
|
|
4503
4598
|
"div",
|
|
@@ -4549,7 +4644,7 @@ function KjunPopover({
|
|
|
4549
4644
|
// maxHeight covers the whole panel, so the dialog inside its border gets that height less the border.
|
|
4550
4645
|
style: { maxHeight: `calc(${typeof maxHeight === "number" ? maxHeight + "px" : maxHeight != null ? maxHeight : `min(60vh, ${tokens36.extensions.floating.maxHeight}px)`} - 2 * var(--_kjun-border-default-width))`, overflowY: header != null || footer != null ? void 0 : "auto" }
|
|
4551
4646
|
};
|
|
4552
|
-
const body = /* @__PURE__ */ jsxs13(
|
|
4647
|
+
const body = /* @__PURE__ */ jsxs13(Fragment10, { children: [
|
|
4553
4648
|
header != null && /* @__PURE__ */ jsx18("div", { id: id + "-header", className: "kjun-popover-header", children: typeof header === "function" ? header(() => change(false)) : header }),
|
|
4554
4649
|
header != null || footer != null ? /* @__PURE__ */ jsx18("div", { className: "kjun-popover-body", ref: trackBody, children: content }) : content,
|
|
4555
4650
|
footer != null && /* @__PURE__ */ jsx18("div", { className: "kjun-popover-footer", children: /* @__PURE__ */ jsx18(ActionSizeContext.Provider, { value: popoverActionSize, children: typeof footer === "function" ? footer(() => change(false)) : footer }) }),
|
|
@@ -4566,6 +4661,27 @@ function TooltipPanel(props) {
|
|
|
4566
4661
|
if (state && !state.isOpen && state.shouldSkipAnimation) return null;
|
|
4567
4662
|
return /* @__PURE__ */ jsx18(Tooltip, { ...props });
|
|
4568
4663
|
}
|
|
4664
|
+
function useTriggerShown() {
|
|
4665
|
+
const ref = useRef19(null);
|
|
4666
|
+
const [shown, setShown] = useState14(false);
|
|
4667
|
+
useLayoutEffect12(() => {
|
|
4668
|
+
const element = ref.current;
|
|
4669
|
+
const visible = () => !element || element.getClientRects().length > 0;
|
|
4670
|
+
if (visible() || typeof ResizeObserver === "undefined") {
|
|
4671
|
+
setShown(true);
|
|
4672
|
+
return;
|
|
4673
|
+
}
|
|
4674
|
+
const observer = new ResizeObserver(() => {
|
|
4675
|
+
if (visible()) {
|
|
4676
|
+
observer.disconnect();
|
|
4677
|
+
setShown(true);
|
|
4678
|
+
}
|
|
4679
|
+
});
|
|
4680
|
+
observer.observe(element);
|
|
4681
|
+
return () => observer.disconnect();
|
|
4682
|
+
}, []);
|
|
4683
|
+
return [ref, shown];
|
|
4684
|
+
}
|
|
4569
4685
|
function KjunTooltip({
|
|
4570
4686
|
content = "",
|
|
4571
4687
|
title,
|
|
@@ -4588,8 +4704,9 @@ function KjunTooltip({
|
|
|
4588
4704
|
onOpenChange == null ? void 0 : onOpenChange(value);
|
|
4589
4705
|
};
|
|
4590
4706
|
const layer = useLayer(open, open, "tooltip", () => setOpen(false));
|
|
4707
|
+
const [trigger, shown] = useTriggerShown();
|
|
4591
4708
|
return /* @__PURE__ */ jsxs13(TooltipTrigger, { isOpen: open && !layer.blocked, onOpenChange: setOpen, delay, closeDelay: 0, isDisabled: !hasContent2 || !layer.scopeActive, children: [
|
|
4592
|
-
/* @__PURE__ */ jsx18(Focusable, { children }),
|
|
4709
|
+
/* @__PURE__ */ jsx18(Focusable, { ref: trigger, isDisabled: !shown, children }),
|
|
4593
4710
|
container !== null && hasContent2 && /* @__PURE__ */ jsxs13(
|
|
4594
4711
|
TooltipPanel,
|
|
4595
4712
|
{
|
|
@@ -4601,7 +4718,7 @@ function KjunTooltip({
|
|
|
4601
4718
|
className: "kjun-scope kjun-tooltip",
|
|
4602
4719
|
children: [
|
|
4603
4720
|
/* @__PURE__ */ jsx18(OverlayArrow, { children: /* @__PURE__ */ jsx18("svg", { width: tokens36.extensions.tooltip.arrowSize, height: tokens36.extensions.tooltip.arrowSize, viewBox: "0 0 8 8", children: /* @__PURE__ */ jsx18("path", { d: "M0 0L4 4L8 0", fill: "currentColor" }) }) }),
|
|
4604
|
-
title ? /* @__PURE__ */ jsxs13(
|
|
4721
|
+
title ? /* @__PURE__ */ jsxs13(Fragment10, { children: [
|
|
4605
4722
|
/* @__PURE__ */ jsx18("span", { className: "kjun-tooltip-title", children: title }),
|
|
4606
4723
|
content && /* @__PURE__ */ jsx18("span", { className: "kjun-tooltip-body", children: content })
|
|
4607
4724
|
] }) : content
|
|
@@ -4895,7 +5012,7 @@ function useFilterScroll(scroll, multiple, value) {
|
|
|
4895
5012
|
import { tokens as tokens39 } from "@kjun-ui/tokens";
|
|
4896
5013
|
import {
|
|
4897
5014
|
createContext as createContext11,
|
|
4898
|
-
useCallback as
|
|
5015
|
+
useCallback as useCallback7,
|
|
4899
5016
|
useContext as useContext11,
|
|
4900
5017
|
useId as useId10
|
|
4901
5018
|
} from "react";
|
|
@@ -4951,7 +5068,7 @@ function KjunCheckbox({
|
|
|
4951
5068
|
onChange
|
|
4952
5069
|
}) {
|
|
4953
5070
|
const checked = Array.isArray(value) ? value.includes(val) : value;
|
|
4954
|
-
const field = useKjunField(), descriptionId = useDescriptionId();
|
|
5071
|
+
const field = useKjunField(), descriptionId = useDescriptionId(), inputId = useGroupFieldId(disabled, id);
|
|
4955
5072
|
return /* @__PURE__ */ jsxs14(
|
|
4956
5073
|
AriaCheckbox,
|
|
4957
5074
|
{
|
|
@@ -4960,7 +5077,7 @@ function KjunCheckbox({
|
|
|
4960
5077
|
isDisabled: disabled,
|
|
4961
5078
|
name,
|
|
4962
5079
|
value: formValue,
|
|
4963
|
-
id,
|
|
5080
|
+
id: inputId,
|
|
4964
5081
|
inputRef,
|
|
4965
5082
|
"aria-label": ariaLabel,
|
|
4966
5083
|
"aria-labelledby": namedBy(description, children || label, ariaLabel, descriptionId),
|
|
@@ -5006,10 +5123,10 @@ function KjunSwitch({
|
|
|
5006
5123
|
onValueChange,
|
|
5007
5124
|
onChange
|
|
5008
5125
|
}) {
|
|
5009
|
-
const field = useKjunField(), m = useKjunMessages();
|
|
5126
|
+
const field = useKjunField(), m = useKjunMessages(), inputId = useGroupFieldId(disabled, id);
|
|
5010
5127
|
const descriptionId = useDescriptionId(), savingId = descriptionId.replace(/-description$/, "-saving");
|
|
5011
5128
|
const invalid = !!(field == null ? void 0 : field.error), required = !!(field == null ? void 0 : field.required);
|
|
5012
|
-
const markInput =
|
|
5129
|
+
const markInput = useCallback7((input) => {
|
|
5013
5130
|
if (!input) return;
|
|
5014
5131
|
if (invalid) input.setAttribute("aria-invalid", "true");
|
|
5015
5132
|
else input.removeAttribute("aria-invalid");
|
|
@@ -5028,7 +5145,7 @@ function KjunSwitch({
|
|
|
5028
5145
|
"data-loading": loading || void 0,
|
|
5029
5146
|
name,
|
|
5030
5147
|
value: formValue,
|
|
5031
|
-
id,
|
|
5148
|
+
id: inputId,
|
|
5032
5149
|
autoFocus,
|
|
5033
5150
|
onFocus,
|
|
5034
5151
|
onBlur,
|
|
@@ -5074,14 +5191,14 @@ function KjunRadio({
|
|
|
5074
5191
|
}) {
|
|
5075
5192
|
const group = useContext11(RadioContext), field = useKjunField(), descriptionId = useDescriptionId();
|
|
5076
5193
|
const selected = (group ? group.value : value) === val;
|
|
5077
|
-
const blocked = disabled || !!(group == null ? void 0 : group.disabled), scale = size || (group == null ? void 0 : group.size) || "md";
|
|
5194
|
+
const blocked = disabled || !!(group == null ? void 0 : group.disabled), scale = size || (group == null ? void 0 : group.size) || "md", inputId = useGroupFieldId(blocked, id);
|
|
5078
5195
|
const own = group ? null : field, invalid = group ? group.invalid : !!(field == null ? void 0 : field.error);
|
|
5079
5196
|
return /* @__PURE__ */ jsxs14("label", { className: choiceClass(blocked), "data-invalid": invalid || void 0, children: [
|
|
5080
5197
|
/* @__PURE__ */ jsx19(
|
|
5081
5198
|
"input",
|
|
5082
5199
|
{
|
|
5083
5200
|
ref: inputRef,
|
|
5084
|
-
id,
|
|
5201
|
+
id: inputId,
|
|
5085
5202
|
type: "radio",
|
|
5086
5203
|
className: "kjun-sr-only",
|
|
5087
5204
|
name: (group == null ? void 0 : group.name) || name,
|
|
@@ -5179,7 +5296,9 @@ function KjunButtonGroup({
|
|
|
5179
5296
|
onValueChange,
|
|
5180
5297
|
onChange
|
|
5181
5298
|
}) {
|
|
5299
|
+
var _a;
|
|
5182
5300
|
const { group, indicator } = useSelectionIndicator();
|
|
5301
|
+
const first = firstEnabledIndex(options, disabled), groupId = useGroupFieldId(first < 0 || disabled || !!((_a = options[first]) == null ? void 0 : _a.disabled));
|
|
5183
5302
|
return /* @__PURE__ */ jsxs15(
|
|
5184
5303
|
"div",
|
|
5185
5304
|
{
|
|
@@ -5205,11 +5324,12 @@ function KjunButtonGroup({
|
|
|
5205
5324
|
style: { borderRadius: tokens40.buttonGroup.itemRadii[size] }
|
|
5206
5325
|
}
|
|
5207
5326
|
),
|
|
5208
|
-
options.map((option) => {
|
|
5327
|
+
options.map((option, index) => {
|
|
5209
5328
|
const iconOnly = !!(option.iconOnly && option.icon), blocked = disabled || option.disabled;
|
|
5210
5329
|
const segment = /* @__PURE__ */ jsxs15(
|
|
5211
5330
|
"button",
|
|
5212
5331
|
{
|
|
5332
|
+
id: index === first ? groupId : void 0,
|
|
5213
5333
|
type: "button",
|
|
5214
5334
|
"aria-pressed": value === option.value,
|
|
5215
5335
|
"aria-label": iconOnly ? option.label : void 0,
|
|
@@ -5255,8 +5375,10 @@ function KjunFilterGroup({
|
|
|
5255
5375
|
onValueChange,
|
|
5256
5376
|
onChange
|
|
5257
5377
|
}) {
|
|
5378
|
+
var _a;
|
|
5258
5379
|
const m = useKjunMessages();
|
|
5259
5380
|
const root = useFilterScroll(scroll, multiple, value);
|
|
5381
|
+
const first = firstEnabledIndex(options, disabled), groupId = useGroupFieldId(first < 0 || disabled || !!((_a = options[first]) == null ? void 0 : _a.disabled));
|
|
5260
5382
|
return /* @__PURE__ */ jsx20(
|
|
5261
5383
|
"div",
|
|
5262
5384
|
{
|
|
@@ -5266,11 +5388,12 @@ function KjunFilterGroup({
|
|
|
5266
5388
|
className: className ? "kjun-filter-group " + className : "kjun-filter-group",
|
|
5267
5389
|
"data-scroll": scroll,
|
|
5268
5390
|
onKeyDown: groupKeydown,
|
|
5269
|
-
children: options.map((option) => {
|
|
5391
|
+
children: options.map((option, index) => {
|
|
5270
5392
|
const on = filterSelected(value, option.value, multiple), counted = option.count != null && option.count !== "";
|
|
5271
5393
|
return /* @__PURE__ */ jsx20(
|
|
5272
5394
|
"button",
|
|
5273
5395
|
{
|
|
5396
|
+
id: index === first ? groupId : void 0,
|
|
5274
5397
|
type: "button",
|
|
5275
5398
|
className: "kjun-filter-chip",
|
|
5276
5399
|
style: { borderRadius: tokens40.button.radii[size] },
|
|
@@ -5319,9 +5442,9 @@ function menuButtonChevron(chevron, compact, label, open) {
|
|
|
5319
5442
|
|
|
5320
5443
|
// packages/react/src/dropdown.tsx
|
|
5321
5444
|
import { tokens as tokens41 } from "@kjun-ui/tokens";
|
|
5322
|
-
import { cloneElement as cloneElement3, createContext as createContext12, isValidElement as isValidElement5, useCallback as
|
|
5445
|
+
import { cloneElement as cloneElement3, createContext as createContext12, isValidElement as isValidElement5, useCallback as useCallback8, useContext as useContext12, useEffect as useEffect14, useId as useId11, useRef as useRef22, useState as useState15 } from "react";
|
|
5323
5446
|
import { Header, Menu, MenuItem, MenuSection, Separator } from "react-aria-components";
|
|
5324
|
-
import { Fragment as
|
|
5447
|
+
import { Fragment as Fragment11, jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5325
5448
|
var DropdownContext = createContext12(null);
|
|
5326
5449
|
var MenuViewContext = createContext12({ view: "", open: () => {
|
|
5327
5450
|
}, back: () => {
|
|
@@ -5352,7 +5475,7 @@ function KjunDropdown({
|
|
|
5352
5475
|
const view = (_a = stack[stack.length - 1]) != null ? _a : "";
|
|
5353
5476
|
const menuFocusCleanup = useRef22(() => {
|
|
5354
5477
|
});
|
|
5355
|
-
const bindMenu =
|
|
5478
|
+
const bindMenu = useCallback8((menu) => {
|
|
5356
5479
|
menuFocusCleanup.current();
|
|
5357
5480
|
menuFocusCleanup.current = () => {
|
|
5358
5481
|
};
|
|
@@ -5504,7 +5627,7 @@ function KjunDropdown({
|
|
|
5504
5627
|
}
|
|
5505
5628
|
function MenuItemBody({ icon: icon2, check, children, description, shortcut, chevron }) {
|
|
5506
5629
|
const size = tokens41.extensions.menu.iconSize;
|
|
5507
|
-
return /* @__PURE__ */ jsxs16(
|
|
5630
|
+
return /* @__PURE__ */ jsxs16(Fragment11, { children: [
|
|
5508
5631
|
check != null && /* @__PURE__ */ jsx21(KjunIcon, { name: "check", className: "kjun-menu-check", size, style: { visibility: check ? "visible" : "hidden" } }),
|
|
5509
5632
|
icon2 && /* @__PURE__ */ jsx21(KjunIcon, { name: icon2, className: "kjun-menu-icon", size }),
|
|
5510
5633
|
/* @__PURE__ */ jsxs16("span", { className: "kjun-menu-label", children: [
|
|
@@ -5535,7 +5658,7 @@ function KjunDropdownItem({
|
|
|
5535
5658
|
const close = useContext12(DropdownContext), choice = useContext12(ChoiceContext);
|
|
5536
5659
|
const shown = useShown();
|
|
5537
5660
|
if (choice && value !== void 0) selected = choice.value === value;
|
|
5538
|
-
const node =
|
|
5661
|
+
const node = useCallback8((element) => {
|
|
5539
5662
|
if (!element) return;
|
|
5540
5663
|
const state = selected != null ? selected : checked;
|
|
5541
5664
|
element.setAttribute("role", selected !== null ? "menuitemradio" : checked !== null ? "menuitemcheckbox" : "menuitem");
|
|
@@ -5580,8 +5703,8 @@ function KjunDropdownSubmenu({ id, label, icon: icon2, disabled = false, childre
|
|
|
5580
5703
|
const menu = useContext12(MenuViewContext), level = useContext12(MenuLevelContext);
|
|
5581
5704
|
const key = (level ? level + "/" : "") + (id != null ? id : label);
|
|
5582
5705
|
const m = useKjunMessages();
|
|
5583
|
-
const popup =
|
|
5584
|
-
return /* @__PURE__ */ jsxs16(
|
|
5706
|
+
const popup = useCallback8((element) => element == null ? void 0 : element.setAttribute("aria-haspopup", "menu"), []);
|
|
5707
|
+
return /* @__PURE__ */ jsxs16(Fragment11, { children: [
|
|
5585
5708
|
menu.view === level && /* @__PURE__ */ jsx21(MenuItem, { ref: popup, className: "kjun-menu-item", textValue: label, isDisabled: disabled, "data-submenu": key, onAction: () => menu.open(key), children: /* @__PURE__ */ jsx21(MenuItemBody, { icon: icon2, chevron: true, children: label }) }),
|
|
5586
5709
|
menu.view === key && /* @__PURE__ */ jsxs16(MenuItem, { className: "kjun-menu-item kjun-menu-back", textValue: label, "aria-label": m.back + ", " + label, onAction: menu.back, children: [
|
|
5587
5710
|
/* @__PURE__ */ jsx21(KjunIcon, { name: "chevron-left", className: "kjun-menu-icon", size: tokens41.extensions.menu.iconSize }),
|
|
@@ -5621,7 +5744,7 @@ function KjunMenuButton({
|
|
|
5621
5744
|
loading,
|
|
5622
5745
|
prefixIcon: menuButtonIcon(icon2, compact, label),
|
|
5623
5746
|
suffixIcon: menuButtonChevron(chevron, compact, label, open),
|
|
5624
|
-
ariaLabel: ariaLabel || label || tooltip || m.menu,
|
|
5747
|
+
ariaLabel: ariaLabel || (typeof label === "string" ? label : void 0) || (hasContent(label) && !compact ? void 0 : tooltip || m.menu),
|
|
5625
5748
|
children: compact ? void 0 : label
|
|
5626
5749
|
}
|
|
5627
5750
|
);
|
|
@@ -5733,7 +5856,7 @@ function sheetDragStart(target) {
|
|
|
5733
5856
|
}
|
|
5734
5857
|
|
|
5735
5858
|
// packages/react/src/drawer.tsx
|
|
5736
|
-
import { useCallback as
|
|
5859
|
+
import { useCallback as useCallback9, useId as useId12, useRef as useRef23 } from "react";
|
|
5737
5860
|
import { Dialog as Dialog3, Modal as Modal2, ModalOverlay as ModalOverlay2 } from "react-aria-components";
|
|
5738
5861
|
import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5739
5862
|
function KjunDrawer({
|
|
@@ -5773,7 +5896,7 @@ function KjunDrawer({
|
|
|
5773
5896
|
}, void 0, resolveFocusReturn(returnFocus));
|
|
5774
5897
|
const titleId = "kjun-" + useId12();
|
|
5775
5898
|
const overlayRef = useRef23(null), panelRef = useRef23(null);
|
|
5776
|
-
const overlayNode =
|
|
5899
|
+
const overlayNode = useCallback9((node) => {
|
|
5777
5900
|
overlayRef.current = node;
|
|
5778
5901
|
afterCloseRef(node);
|
|
5779
5902
|
}, [afterCloseRef]);
|
|
@@ -6019,7 +6142,7 @@ import {
|
|
|
6019
6142
|
useRef as useRef24,
|
|
6020
6143
|
useState as useState17
|
|
6021
6144
|
} from "react";
|
|
6022
|
-
import { Fragment as
|
|
6145
|
+
import { Fragment as Fragment12, jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
6023
6146
|
function KjunCombobox({
|
|
6024
6147
|
value,
|
|
6025
6148
|
options = [],
|
|
@@ -6151,7 +6274,7 @@ function SearchField({
|
|
|
6151
6274
|
onOpenChange(false);
|
|
6152
6275
|
(_b = (_a = returnFocus == null ? void 0 : returnFocus()) != null ? _a : ref.current) == null ? void 0 : _b.focus();
|
|
6153
6276
|
};
|
|
6154
|
-
return /* @__PURE__ */ jsxs18(
|
|
6277
|
+
return /* @__PURE__ */ jsxs18(Fragment12, { children: [
|
|
6155
6278
|
/* @__PURE__ */ jsx23(
|
|
6156
6279
|
KjunInput,
|
|
6157
6280
|
{
|
|
@@ -6604,7 +6727,7 @@ function slideNext(state) {
|
|
|
6604
6727
|
// packages/react/src/calendar.tsx
|
|
6605
6728
|
import { tokens as tokens46 } from "@kjun-ui/tokens";
|
|
6606
6729
|
import { useEffect as useEffect17, useId as useId14, useRef as useRef25, useState as useState19 } from "react";
|
|
6607
|
-
import { Fragment as
|
|
6730
|
+
import { Fragment as Fragment13, jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6608
6731
|
function CalendarView({
|
|
6609
6732
|
value,
|
|
6610
6733
|
range: range2,
|
|
@@ -6768,14 +6891,14 @@ function CalendarView({
|
|
|
6768
6891
|
day.iso
|
|
6769
6892
|
);
|
|
6770
6893
|
}),
|
|
6771
|
-
range2 && /* @__PURE__ */ jsxs19(
|
|
6894
|
+
range2 && /* @__PURE__ */ jsxs19(Fragment13, { children: [
|
|
6772
6895
|
/* @__PURE__ */ jsx24("span", { id: uid + "-start", hidden: true, children: m.rangeStartDay }),
|
|
6773
6896
|
/* @__PURE__ */ jsx24("span", { id: uid + "-end", hidden: true, children: m.rangeEndDay }),
|
|
6774
6897
|
/* @__PURE__ */ jsx24("span", { id: uid + "-between", hidden: true, children: m.inRangeDay })
|
|
6775
6898
|
] })
|
|
6776
6899
|
]
|
|
6777
6900
|
}
|
|
6778
|
-
) : mode === "months" ? /* @__PURE__ */ jsx24(
|
|
6901
|
+
) : mode === "months" ? /* @__PURE__ */ jsx24(Fragment13, { children: /* @__PURE__ */ jsx24("div", { ref: months2, className: "kjun-calendar-months", children: names.months.map((name, month) => {
|
|
6779
6902
|
const selected = (selectedMonth == null ? void 0 : selectedMonth.year) === shown.year && selectedMonth.month === month;
|
|
6780
6903
|
const current = today.startsWith(toIsoDate(shown.year, month, 1).slice(0, 7));
|
|
6781
6904
|
return /* @__PURE__ */ jsx24(
|
|
@@ -6831,13 +6954,13 @@ function CalendarView({
|
|
|
6831
6954
|
}
|
|
6832
6955
|
|
|
6833
6956
|
// packages/react/src/date-picker.tsx
|
|
6834
|
-
import { Fragment as
|
|
6957
|
+
import { Fragment as Fragment14, jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6835
6958
|
function DateField({ size = "md", clearable, placeholder, ariaLabel, error, disabled, readOnly, id, name, text, spoken, submitted, clearLabel, open, setOpen, onClear, children }) {
|
|
6836
6959
|
const field = useKjunField(), spec = tokens47.input[size];
|
|
6837
6960
|
const trigger = useRef26(null), valueId = "kjun-date-" + useId15();
|
|
6838
6961
|
const label = ariaLabel || placeholder;
|
|
6839
6962
|
const clear = !!clearable && !!text && !disabled && !readOnly;
|
|
6840
|
-
return /* @__PURE__ */ jsxs20(
|
|
6963
|
+
return /* @__PURE__ */ jsxs20(Fragment14, { children: [
|
|
6841
6964
|
/* @__PURE__ */ jsxs20("div", { className: "kjun-select-shell kjun-date-picker", children: [
|
|
6842
6965
|
/* @__PURE__ */ jsxs20(
|
|
6843
6966
|
"button",
|
|
@@ -7284,7 +7407,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
7284
7407
|
}
|
|
7285
7408
|
|
|
7286
7409
|
// packages/react/src/select-control.tsx
|
|
7287
|
-
import { Fragment as
|
|
7410
|
+
import { Fragment as Fragment15, jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7288
7411
|
function KjunSelect({
|
|
7289
7412
|
value,
|
|
7290
7413
|
options = [],
|
|
@@ -7396,7 +7519,7 @@ function KjunSelect({
|
|
|
7396
7519
|
},
|
|
7397
7520
|
key
|
|
7398
7521
|
);
|
|
7399
|
-
return /* @__PURE__ */ jsxs21(
|
|
7522
|
+
return /* @__PURE__ */ jsxs21(Fragment15, { children: [
|
|
7400
7523
|
/* @__PURE__ */ jsxs21("div", { className: "kjun-select-shell", children: [
|
|
7401
7524
|
/* @__PURE__ */ jsxs21(
|
|
7402
7525
|
"button",
|
|
@@ -7430,7 +7553,7 @@ function KjunSelect({
|
|
|
7430
7553
|
}
|
|
7431
7554
|
},
|
|
7432
7555
|
children: [
|
|
7433
|
-
/* @__PURE__ */ jsx27("span", { className: !custom && !label ? "kjun-placeholder" : listed && !custom ? "kjun-select-values" : void 0, style: { flex: 1, paddingRight: showClear ? spec.clearSize + spec.affixGap : void 0 }, children: custom || (listed ? /* @__PURE__ */ jsxs21(
|
|
7556
|
+
/* @__PURE__ */ jsx27("span", { className: !custom && !label ? "kjun-placeholder" : listed && !custom ? "kjun-select-values" : void 0, style: { flex: 1, paddingRight: showClear ? spec.clearSize + spec.affixGap : void 0 }, children: custom || (listed ? /* @__PURE__ */ jsxs21(Fragment15, { children: [
|
|
7434
7557
|
/* @__PURE__ */ jsx27("span", { ref: valuesText, className: "kjun-select-values-text", children: labels.map((text, index) => /* @__PURE__ */ jsxs21("span", { children: [
|
|
7435
7558
|
index ? ", " : "",
|
|
7436
7559
|
text
|
|
@@ -7745,7 +7868,7 @@ function collapseBreadcrumb(items, maxItems) {
|
|
|
7745
7868
|
// packages/react/src/navigation.tsx
|
|
7746
7869
|
import {
|
|
7747
7870
|
createContext as createContext14,
|
|
7748
|
-
Fragment as
|
|
7871
|
+
Fragment as Fragment17,
|
|
7749
7872
|
useContext as useContext14,
|
|
7750
7873
|
useEffect as useEffect23,
|
|
7751
7874
|
useId as useId17,
|
|
@@ -7785,7 +7908,7 @@ import {
|
|
|
7785
7908
|
useRef as useRef32
|
|
7786
7909
|
} from "react";
|
|
7787
7910
|
import { Tab, TabList, TabPanel, Tabs, TabListStateContext } from "react-aria-components";
|
|
7788
|
-
import { Fragment as
|
|
7911
|
+
import { Fragment as Fragment16, jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
7789
7912
|
var TabsLazyContext = createContext13({ lazy: false, seen: /* @__PURE__ */ new Set() });
|
|
7790
7913
|
function TabActions({ children }) {
|
|
7791
7914
|
return useContext13(TabListStateContext) ? children : null;
|
|
@@ -7934,7 +8057,7 @@ function KjunTabs({
|
|
|
7934
8057
|
tab.icon && /* @__PURE__ */ jsx29(KjunIcon, { name: tab.icon, size: tokens51.extensions.tabs.iconSize }),
|
|
7935
8058
|
" ",
|
|
7936
8059
|
/* @__PURE__ */ jsx29("span", { className: "kjun-motion-label", "data-label": tab.label, children: /* @__PURE__ */ jsx29("span", { children: tab.label }) }),
|
|
7937
|
-
navigationBadge(tab.badge) && /* @__PURE__ */ jsx29(
|
|
8060
|
+
navigationBadge(tab.badge) && /* @__PURE__ */ jsx29(Fragment16, { children: /* @__PURE__ */ jsx29(KjunBadge, { className: "kjun-tab-badge", size: "xs", variant: (_a2 = tab.badgeVariant) != null ? _a2 : "default", "aria-hidden": "true", children: navigationBadge(tab.badge).text }) })
|
|
7938
8061
|
]
|
|
7939
8062
|
},
|
|
7940
8063
|
tab.name
|
|
@@ -7966,7 +8089,7 @@ function KjunTabPane({ name, children }) {
|
|
|
7966
8089
|
}
|
|
7967
8090
|
|
|
7968
8091
|
// packages/react/src/navigation.tsx
|
|
7969
|
-
import { Fragment as
|
|
8092
|
+
import { Fragment as Fragment18, jsx as jsx30, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7970
8093
|
var AccordionContext = createContext14(null);
|
|
7971
8094
|
var AccordionLayoutContext = createContext14({ headingLevel: 3, region: true });
|
|
7972
8095
|
function KjunAccordion({
|
|
@@ -8032,7 +8155,7 @@ function KjunAccordionItem({
|
|
|
8032
8155
|
children
|
|
8033
8156
|
}) {
|
|
8034
8157
|
const layout = useContext14(AccordionLayoutContext);
|
|
8035
|
-
const Heading2 = layout.headingLevel ? `h${layout.headingLevel}` :
|
|
8158
|
+
const Heading2 = layout.headingLevel ? `h${layout.headingLevel}` : Fragment17;
|
|
8036
8159
|
const controlled = openProp !== void 0, context = useContext14(AccordionContext), group = controlled ? null : context, id = "kjun-" + useId17(), key = value != null ? value : id, [own, setOwn] = useState28(defaultOpen), open = controlled ? openProp : group ? group.opened.has(key) : own;
|
|
8037
8160
|
useEffect23(() => {
|
|
8038
8161
|
return group == null ? void 0 : group.register(key, defaultOpen);
|
|
@@ -8115,12 +8238,12 @@ function KjunBreadcrumb({
|
|
|
8115
8238
|
const separator = /* @__PURE__ */ jsx30(KjunIcon, { name: "chevron-right", size: tokens52.extensions.breadcrumb.separatorSize });
|
|
8116
8239
|
const step = ({ item, index }, position) => {
|
|
8117
8240
|
const current = breadcrumbCurrent(item, index, items.length);
|
|
8118
|
-
const label = /* @__PURE__ */ jsxs23(
|
|
8241
|
+
const label = /* @__PURE__ */ jsxs23(Fragment18, { children: [
|
|
8119
8242
|
item.icon && /* @__PURE__ */ jsx30(KjunIcon, { name: item.icon, size: tokens52.extensions.breadcrumb.iconSize }),
|
|
8120
8243
|
/* @__PURE__ */ jsx30("span", { className: "kjun-breadcrumb-label", children: item.label })
|
|
8121
8244
|
] });
|
|
8122
8245
|
const link = item.to ? (renderLink == null ? void 0 : renderLink(item, label)) || /* @__PURE__ */ jsx30("a", { href: item.to, "aria-current": current ? "page" : void 0, onClick: onNavigate && ((event) => onNavigate(item, event)), children: label }) : null;
|
|
8123
|
-
return /* @__PURE__ */ jsxs23(
|
|
8246
|
+
return /* @__PURE__ */ jsxs23(Fragment17, { children: [
|
|
8124
8247
|
position === at && /* @__PURE__ */ jsxs23("li", { className: "kjun-breadcrumb-item", children: [
|
|
8125
8248
|
separator,
|
|
8126
8249
|
/* @__PURE__ */ jsx30(KjunDropdown, { trigger: /* @__PURE__ */ jsx30(KjunButton, { size: "xs", variant: "ghost", prefixIcon: "dots", ariaLabel: m.showPath }), children: hidden.map(({ item: folded, index: key }) => /* @__PURE__ */ jsx30(KjunDropdownItem, { href: onNavigate ? void 0 : folded.to, icon: folded.icon, onClick: onNavigate && (() => onNavigate(folded)), children: folded.label }, key)) })
|
|
@@ -8229,7 +8352,7 @@ function KjunPagination({
|
|
|
8229
8352
|
import { tokens as tokens54 } from "@kjun-ui/tokens";
|
|
8230
8353
|
import {
|
|
8231
8354
|
forwardRef as forwardRef6,
|
|
8232
|
-
useCallback as
|
|
8355
|
+
useCallback as useCallback12,
|
|
8233
8356
|
useContext as useContext15,
|
|
8234
8357
|
useEffect as useEffect26,
|
|
8235
8358
|
useImperativeHandle as useImperativeHandle3,
|
|
@@ -8262,7 +8385,7 @@ function isPending(result) {
|
|
|
8262
8385
|
}
|
|
8263
8386
|
|
|
8264
8387
|
// shared/package-runtime/use-copy-feedback.ts
|
|
8265
|
-
import { useCallback as
|
|
8388
|
+
import { useCallback as useCallback10, useEffect as useEffect24, useRef as useRef34, useState as useState29 } from "react";
|
|
8266
8389
|
function useCopyFeedback(copyText, handlers) {
|
|
8267
8390
|
const [copied, setCopied] = useState29(false), [failed, setFailed] = useState29(false), busy = useRef34(false), timer = useRef34(void 0), mounted = useRef34(true), latest = useRef34({ copyText, handlers, copied });
|
|
8268
8391
|
latest.current = { copyText, handlers, copied };
|
|
@@ -8273,7 +8396,7 @@ function useCopyFeedback(copyText, handlers) {
|
|
|
8273
8396
|
clearTimeout(timer.current);
|
|
8274
8397
|
};
|
|
8275
8398
|
}, []);
|
|
8276
|
-
const copy =
|
|
8399
|
+
const copy = useCallback10(async (value) => {
|
|
8277
8400
|
if (latest.current.copied || busy.current) return;
|
|
8278
8401
|
busy.current = true;
|
|
8279
8402
|
try {
|
|
@@ -8309,7 +8432,7 @@ function copyButtonGeometry(size, labelled) {
|
|
|
8309
8432
|
}
|
|
8310
8433
|
|
|
8311
8434
|
// shared/package-runtime/use-pending-action.ts
|
|
8312
|
-
import { useCallback as
|
|
8435
|
+
import { useCallback as useCallback11, useEffect as useEffect25, useRef as useRef35, useState as useState30 } from "react";
|
|
8313
8436
|
function usePendingAction() {
|
|
8314
8437
|
const [pending, setPending] = useState30(false), mounted = useRef35(true), runs = useRef35(0);
|
|
8315
8438
|
useEffect25(() => {
|
|
@@ -8318,7 +8441,7 @@ function usePendingAction() {
|
|
|
8318
8441
|
mounted.current = false;
|
|
8319
8442
|
};
|
|
8320
8443
|
}, []);
|
|
8321
|
-
const run =
|
|
8444
|
+
const run = useCallback11((action) => {
|
|
8322
8445
|
const result = action == null ? void 0 : action();
|
|
8323
8446
|
if (!isPending(result)) return;
|
|
8324
8447
|
const id = ++runs.current;
|
|
@@ -8348,11 +8471,11 @@ function externalLinkIconName(label, fallback2) {
|
|
|
8348
8471
|
}
|
|
8349
8472
|
|
|
8350
8473
|
// packages/react/src/actions.tsx
|
|
8351
|
-
import { Fragment as
|
|
8474
|
+
import { Fragment as Fragment19, jsx as jsx31, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
8352
8475
|
function useLabelledByText(button, label, labelledBy) {
|
|
8353
8476
|
const [text, setText] = useState31("");
|
|
8354
8477
|
const warned4 = useRef36(false);
|
|
8355
|
-
const refresh =
|
|
8478
|
+
const refresh = useCallback12(() => {
|
|
8356
8479
|
var _a, _b;
|
|
8357
8480
|
const doc = (_a = button.current) == null ? void 0 : _a.ownerDocument;
|
|
8358
8481
|
const labels = (labelledBy != null ? labelledBy : "").trim().split(/\s+/).filter(Boolean).map((id) => doc == null ? void 0 : doc.getElementById(id)).filter((node) => !!node);
|
|
@@ -8468,7 +8591,7 @@ function KjunCopyButton({
|
|
|
8468
8591
|
onCopyError == null ? void 0 : onCopyError(error);
|
|
8469
8592
|
}
|
|
8470
8593
|
});
|
|
8471
|
-
return /* @__PURE__ */ jsxs24(
|
|
8594
|
+
return /* @__PURE__ */ jsxs24(Fragment19, { children: [
|
|
8472
8595
|
/* @__PURE__ */ jsxs24(
|
|
8473
8596
|
"button",
|
|
8474
8597
|
{
|
|
@@ -9729,7 +9852,7 @@ function ColorInputs({ fields, value, alpha, alphaPercent, clearable, hexLabel,
|
|
|
9729
9852
|
}
|
|
9730
9853
|
|
|
9731
9854
|
// packages/react/src/color-picker.tsx
|
|
9732
|
-
import { Fragment as
|
|
9855
|
+
import { Fragment as Fragment20, jsx as jsx34, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
9733
9856
|
var pct = (a) => Math.round(a * 100);
|
|
9734
9857
|
function TriggerDetail({ summary }) {
|
|
9735
9858
|
const percent2 = summary.percent !== void 0 && summary.percent < 100 ? summary.percent + "%" : "";
|
|
@@ -9816,7 +9939,7 @@ function KjunColorPicker({
|
|
|
9816
9939
|
});
|
|
9817
9940
|
return () => cancelAnimationFrame(frame);
|
|
9818
9941
|
}, [open]);
|
|
9819
|
-
const body = /* @__PURE__ */ jsxs27(
|
|
9942
|
+
const body = /* @__PURE__ */ jsxs27(Fragment20, { children: [
|
|
9820
9943
|
custom && /* @__PURE__ */ jsx34(
|
|
9821
9944
|
ColorArea,
|
|
9822
9945
|
{
|
|
@@ -9904,14 +10027,14 @@ function KjunColorPicker({
|
|
|
9904
10027
|
}
|
|
9905
10028
|
);
|
|
9906
10029
|
const chip = tokens56.extensions.colorPicker.triggerSwatch[size], swatch = variant === "swatch";
|
|
9907
|
-
const content = renderTrigger ? /* @__PURE__ */ jsxs27(
|
|
10030
|
+
const content = renderTrigger ? /* @__PURE__ */ jsxs27(Fragment20, { children: [
|
|
9908
10031
|
renderTrigger({ value: current, open }),
|
|
9909
10032
|
/* @__PURE__ */ jsx34("span", { id: valueId, className: "kjun-sr-only", children: summary.spoken })
|
|
9910
10033
|
] }) : swatch && icon2 ? /* @__PURE__ */ jsxs27("span", { className: "kjun-color-tool", "aria-hidden": "true", children: [
|
|
9911
10034
|
/* @__PURE__ */ jsx34(KjunIcon, { name: icon2, size: spec.iconSize }),
|
|
9912
10035
|
/* @__PURE__ */ jsx34("span", { className: "kjun-color-indicator" + (current ? " kjun-color-checker" : ""), "data-none": current ? void 0 : "", children: /* @__PURE__ */ jsx34("span", { style: current ? { background: summary.hex, opacity: summary.opacity } : void 0 }) }),
|
|
9913
10036
|
/* @__PURE__ */ jsx34("span", { id: valueId, className: "kjun-sr-only", children: summary.spoken })
|
|
9914
|
-
] }) : /* @__PURE__ */ jsxs27(
|
|
10037
|
+
] }) : /* @__PURE__ */ jsxs27(Fragment20, { children: [
|
|
9915
10038
|
/* @__PURE__ */ jsx34("span", { className: "kjun-color-chip" + (current ? " kjun-color-checker" : ""), "data-none": current ? void 0 : "", "aria-hidden": "true", style: { width: chip, height: chip }, children: /* @__PURE__ */ jsx34("span", { style: current ? { background: summary.hex, opacity: summary.opacity } : void 0 }) }),
|
|
9916
10039
|
swatch ? /* @__PURE__ */ jsx34("span", { id: valueId, className: "kjun-sr-only", children: summary.spoken }) : /* @__PURE__ */ jsxs27("span", { id: valueId, className: current ? void 0 : "kjun-placeholder", children: [
|
|
9917
10040
|
current ? /* @__PURE__ */ jsxs27("span", { "aria-hidden": "true", children: [
|
|
@@ -9922,7 +10045,7 @@ function KjunColorPicker({
|
|
|
9922
10045
|
] }),
|
|
9923
10046
|
!swatch && /* @__PURE__ */ jsx34(KjunIcon, { name: "chevron-down", size: spec.iconSize, style: { flexShrink: 0, color: disabled ? "var(--_kjun-color-text-disabled)" : "var(--_kjun-color-text-tertiary)" } })
|
|
9924
10047
|
] });
|
|
9925
|
-
return /* @__PURE__ */ jsxs27(
|
|
10048
|
+
return /* @__PURE__ */ jsxs27(Fragment20, { children: [
|
|
9926
10049
|
/* @__PURE__ */ jsxs27("div", { className: "kjun-select-shell kjun-color-picker" + (className ? " " + className : ""), "data-variant": swatch ? "swatch" : void 0, style, children: [
|
|
9927
10050
|
/* @__PURE__ */ jsx34(
|
|
9928
10051
|
"button",
|
|
@@ -10100,14 +10223,14 @@ function tileLabel(m, file) {
|
|
|
10100
10223
|
}
|
|
10101
10224
|
|
|
10102
10225
|
// packages/react/src/file-upload-row.tsx
|
|
10103
|
-
import { Fragment as
|
|
10226
|
+
import { Fragment as Fragment21, jsx as jsx35, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
10104
10227
|
var g = tokens57.extensions.fileUpload;
|
|
10105
10228
|
var icon = g.iconSize;
|
|
10106
10229
|
var hideBroken = (event) => {
|
|
10107
10230
|
event.currentTarget.hidden = true;
|
|
10108
10231
|
};
|
|
10109
10232
|
function Thumb({ file }) {
|
|
10110
|
-
return /* @__PURE__ */ jsxs28(
|
|
10233
|
+
return /* @__PURE__ */ jsxs28(Fragment21, { children: [
|
|
10111
10234
|
/* @__PURE__ */ jsx35("span", { className: "kjun-file-upload-ext", children: extensionLabel(file.name, file.type) }),
|
|
10112
10235
|
file.previewUrl && /* @__PURE__ */ jsx35("img", { src: file.previewUrl, alt: "", onError: hideBroken }, file.previewUrl)
|
|
10113
10236
|
] });
|
|
@@ -10124,7 +10247,7 @@ function FileUploadRow({ file, m, intl, disabled, onRemove, onRetry, onReplace }
|
|
|
10124
10247
|
/* @__PURE__ */ jsx35("span", { className: "kjun-file-upload-name-head", children: head }),
|
|
10125
10248
|
/* @__PURE__ */ jsx35("span", { className: "kjun-file-upload-name-tail", children: tail })
|
|
10126
10249
|
] }),
|
|
10127
|
-
/* @__PURE__ */ jsx35("div", { className: "kjun-file-upload-meta", children: file.status === "uploading" && progress !== void 0 ? /* @__PURE__ */ jsxs28(
|
|
10250
|
+
/* @__PURE__ */ jsx35("div", { className: "kjun-file-upload-meta", children: file.status === "uploading" && progress !== void 0 ? /* @__PURE__ */ jsxs28(Fragment21, { children: [
|
|
10128
10251
|
/* @__PURE__ */ jsxs28("span", { className: "kjun-file-upload-num", children: [
|
|
10129
10252
|
formatBytes(file.size * progress / 100, intl),
|
|
10130
10253
|
" / ",
|
|
@@ -10135,7 +10258,7 @@ function FileUploadRow({ file, m, intl, disabled, onRemove, onRetry, onReplace }
|
|
|
10135
10258
|
Math.round(progress),
|
|
10136
10259
|
"%"
|
|
10137
10260
|
] })
|
|
10138
|
-
] }) : /* @__PURE__ */ jsxs28(
|
|
10261
|
+
] }) : /* @__PURE__ */ jsxs28(Fragment21, { children: [
|
|
10139
10262
|
/* @__PURE__ */ jsx35("span", { className: "kjun-file-upload-num", children: size }),
|
|
10140
10263
|
file.status !== "uploading" && /* @__PURE__ */ jsx35("span", { "aria-hidden": "true", children: "\xB7" }),
|
|
10141
10264
|
file.status === "queued" && /* @__PURE__ */ jsx35("span", { className: "kjun-file-upload-status", children: m.uploadQueued }),
|
|
@@ -10232,7 +10355,7 @@ function FileUploadTile({ file, m, disabled, onRemove, onRetry }) {
|
|
|
10232
10355
|
}
|
|
10233
10356
|
|
|
10234
10357
|
// packages/react/src/file-upload.tsx
|
|
10235
|
-
import { Fragment as
|
|
10358
|
+
import { Fragment as Fragment22, jsx as jsx36, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
10236
10359
|
function KjunFileUpload({
|
|
10237
10360
|
files = [],
|
|
10238
10361
|
accept,
|
|
@@ -10456,7 +10579,7 @@ function KjunFileUpload({
|
|
|
10456
10579
|
}
|
|
10457
10580
|
),
|
|
10458
10581
|
empty3,
|
|
10459
|
-
filled && /* @__PURE__ */ jsxs29(
|
|
10582
|
+
filled && /* @__PURE__ */ jsxs29(Fragment22, { children: [
|
|
10460
10583
|
(files.length > 1 || summary.failed > 0) && /* @__PURE__ */ jsxs29("div", { className: "kjun-file-upload-head", children: [
|
|
10461
10584
|
/* @__PURE__ */ jsx36("span", { className: "kjun-file-upload-head-title", children: m.uploadFiles }),
|
|
10462
10585
|
/* @__PURE__ */ jsx36("span", { className: "kjun-file-upload-num", children: multiple && maxFiles != null ? `${files.length}/${maxFiles}` : files.length }),
|
|
@@ -10515,16 +10638,28 @@ function clampCurrent(current, count) {
|
|
|
10515
10638
|
if (!Number.isFinite(current)) return 0;
|
|
10516
10639
|
return Math.min(Math.max(0, count), Math.max(0, Math.floor(current)));
|
|
10517
10640
|
}
|
|
10518
|
-
function
|
|
10641
|
+
function stepsCurrent(items, current) {
|
|
10642
|
+
if (current !== void 0 && current !== null) return clampCurrent(current, items.length);
|
|
10643
|
+
const marked = items.findIndex((item) => item.status === "current" || item.status === "error");
|
|
10644
|
+
if (marked >= 0) return marked;
|
|
10645
|
+
const open = items.findIndex((item) => item.status !== "complete");
|
|
10646
|
+
return open < 0 ? items.length : open;
|
|
10647
|
+
}
|
|
10648
|
+
function stepStatus(index, current, currentStatus, item) {
|
|
10649
|
+
if (item == null ? void 0 : item.status) return item.status;
|
|
10519
10650
|
if (index < current) return "complete";
|
|
10520
10651
|
if (index === current) return currentStatus === "error" ? "error" : "current";
|
|
10521
10652
|
return "upcoming";
|
|
10522
10653
|
}
|
|
10523
|
-
function
|
|
10524
|
-
|
|
10525
|
-
return currentStatus === "error" ? "error" : "current";
|
|
10654
|
+
function stepsStatuses(items, current, currentStatus) {
|
|
10655
|
+
return items.map((item, i) => stepStatus(i, current, currentStatus, item));
|
|
10526
10656
|
}
|
|
10527
|
-
function
|
|
10657
|
+
function stepsRootStatus(statuses) {
|
|
10658
|
+
if (statuses.every((status) => status === "complete")) return "complete";
|
|
10659
|
+
return statuses.includes("error") ? "error" : "current";
|
|
10660
|
+
}
|
|
10661
|
+
function stepSelectable(status, selectable = "complete", disabled = false) {
|
|
10662
|
+
if (disabled) return false;
|
|
10528
10663
|
return selectable === "all" ? status === "complete" || status === "upcoming" : status === "complete";
|
|
10529
10664
|
}
|
|
10530
10665
|
function stepDetail(item, vertical) {
|
|
@@ -10547,7 +10682,7 @@ function stepsHead(m, items, at) {
|
|
|
10547
10682
|
|
|
10548
10683
|
// packages/react/src/steps.tsx
|
|
10549
10684
|
import { useEffect as useEffect32 } from "react";
|
|
10550
|
-
import { Fragment as
|
|
10685
|
+
import { Fragment as Fragment23, jsx as jsx37, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
10551
10686
|
function KjunSteps({
|
|
10552
10687
|
items,
|
|
10553
10688
|
current,
|
|
@@ -10567,7 +10702,7 @@ function KjunSteps({
|
|
|
10567
10702
|
useEffect32(() => {
|
|
10568
10703
|
if (count < 2 && developmentMode9()) console.warn("[KJUN] KjunSteps expects two or more items.");
|
|
10569
10704
|
}, [count]);
|
|
10570
|
-
const at =
|
|
10705
|
+
const at = stepsCurrent(items, current), statuses = stepsStatuses(items, at, currentStatus);
|
|
10571
10706
|
const vertical = orientation === "vertical";
|
|
10572
10707
|
const head = stepsHead(m, items, at);
|
|
10573
10708
|
return /* @__PURE__ */ jsxs30(
|
|
@@ -10580,7 +10715,7 @@ function KjunSteps({
|
|
|
10580
10715
|
"data-orientation": orientation,
|
|
10581
10716
|
"data-layout": layout,
|
|
10582
10717
|
"data-count": count,
|
|
10583
|
-
"data-status": stepsRootStatus(
|
|
10718
|
+
"data-status": stepsRootStatus(statuses),
|
|
10584
10719
|
children: [
|
|
10585
10720
|
!vertical && head.item && /* @__PURE__ */ jsxs30("div", { className: "kjun-steps-head", "aria-hidden": "true", children: [
|
|
10586
10721
|
/* @__PURE__ */ jsx37("span", { className: "kjun-steps-head-title", "aria-hidden": "true", children: head.item.label }),
|
|
@@ -10596,9 +10731,9 @@ function KjunSteps({
|
|
|
10596
10731
|
] }),
|
|
10597
10732
|
/* @__PURE__ */ jsx37("ol", { className: "kjun-steps-list", "aria-label": ariaLabel != null ? ariaLabel : m.steps, children: items.map((item, i) => {
|
|
10598
10733
|
var _a;
|
|
10599
|
-
const status =
|
|
10734
|
+
const status = statuses[i];
|
|
10600
10735
|
const detail = stepDetail(item, vertical), spoken = stepSpoken(m, i, item, status, detail);
|
|
10601
|
-
const body = /* @__PURE__ */ jsxs30(
|
|
10736
|
+
const body = /* @__PURE__ */ jsxs30(Fragment23, { children: [
|
|
10602
10737
|
/* @__PURE__ */ jsx37("span", { className: "kjun-steps-marker", "aria-hidden": "true", children: status === "complete" ? /* @__PURE__ */ jsx37(KjunIcon, { name: "check" }) : status === "error" ? /* @__PURE__ */ jsx37(KjunIcon, { name: "exclamation-mark" }) : i + 1 }),
|
|
10603
10738
|
/* @__PURE__ */ jsx37("span", { className: "kjun-steps-label", title: item.label, "aria-hidden": "true", children: item.label }),
|
|
10604
10739
|
detail && /* @__PURE__ */ jsxs30("span", { className: "kjun-steps-detail", "aria-hidden": "true", children: [
|
|
@@ -10607,12 +10742,12 @@ function KjunSteps({
|
|
|
10607
10742
|
item.description
|
|
10608
10743
|
] })
|
|
10609
10744
|
] });
|
|
10610
|
-
return /* @__PURE__ */ jsxs30("li", { className: "kjun-steps-item", "data-status": status, "aria-current": status === "current" || status === "error" ? "step" : void 0, children: [
|
|
10745
|
+
return /* @__PURE__ */ jsxs30("li", { className: "kjun-steps-item", "data-status": status, "data-disabled": item.disabled || void 0, "aria-current": status === "current" || status === "error" ? "step" : void 0, children: [
|
|
10611
10746
|
/* @__PURE__ */ jsxs30("span", { className: "kjun-steps-static", children: [
|
|
10612
10747
|
body,
|
|
10613
10748
|
/* @__PURE__ */ jsx37("span", { className: "kjun-sr-only", children: spoken })
|
|
10614
10749
|
] }),
|
|
10615
|
-
onStepSelect && stepSelectable(status, selectable) && /* @__PURE__ */ jsx37("button", { type: "button", className: "kjun-steps-hit", "aria-label": spoken, onClick: () => onStepSelect(i), children: body })
|
|
10750
|
+
onStepSelect && stepSelectable(status, selectable, item.disabled) && /* @__PURE__ */ jsx37("button", { type: "button", className: "kjun-steps-hit", "aria-label": spoken, onClick: () => onStepSelect(i), children: body })
|
|
10616
10751
|
] }, (_a = item.key) != null ? _a : i);
|
|
10617
10752
|
}) })
|
|
10618
10753
|
]
|
|
@@ -10968,6 +11103,7 @@ function KjunSplitPane({
|
|
|
10968
11103
|
collapsed,
|
|
10969
11104
|
defaultCollapsed = false,
|
|
10970
11105
|
onCollapsedChange,
|
|
11106
|
+
secondHidden = false,
|
|
10971
11107
|
onSizeChange,
|
|
10972
11108
|
onChangeCommit,
|
|
10973
11109
|
first,
|
|
@@ -10990,7 +11126,7 @@ function KjunSplitPane({
|
|
|
10990
11126
|
foldedNow.current = folded;
|
|
10991
11127
|
const measure = () => {
|
|
10992
11128
|
const el = root.current, bar = handle.current;
|
|
10993
|
-
return el && bar ? { total: vertical ? el.clientHeight : el.clientWidth, hit: vertical ? bar.offsetHeight : bar.offsetWidth } : null;
|
|
11129
|
+
return el && bar && !secondHidden ? { total: vertical ? el.clientHeight : el.clientWidth, hit: vertical ? bar.offsetHeight : bar.offsetWidth } : null;
|
|
10994
11130
|
};
|
|
10995
11131
|
useLayoutEffect23(() => {
|
|
10996
11132
|
const el = root.current;
|
|
@@ -11004,7 +11140,7 @@ function KjunSplitPane({
|
|
|
11004
11140
|
const observer = new ResizeObserver(read);
|
|
11005
11141
|
observer.observe(el);
|
|
11006
11142
|
return () => observer.disconnect();
|
|
11007
|
-
}, [vertical]);
|
|
11143
|
+
}, [vertical, secondHidden]);
|
|
11008
11144
|
const limits = box ? splitLimits(box.total, box.hit, minSize, maxSize) : null;
|
|
11009
11145
|
const at = (now, range2 = splitLimits(now.total, now.hit, minSize, maxSize)) => foldedNow.current ? splitFoldedPx(collapsedSize, now.total, now.hit) : splitClamp(splitWantedPx(latest.current, sizeUnit, now.total, now.hit), range2);
|
|
11010
11146
|
const px = box && limits ? at(box, limits) : null;
|
|
@@ -11079,7 +11215,7 @@ function KjunSplitPane({
|
|
|
11079
11215
|
moveTo(resetPx(now), now);
|
|
11080
11216
|
commit();
|
|
11081
11217
|
};
|
|
11082
|
-
const hidden = folded && px !== null ? px === 0 : folded && splitFoldedPx(collapsedSize, Infinity, 0) === 0;
|
|
11218
|
+
const hidden = !secondHidden && (folded && px !== null ? px === 0 : folded && splitFoldedPx(collapsedSize, Infinity, 0) === 0);
|
|
11083
11219
|
return /* @__PURE__ */ jsxs32(
|
|
11084
11220
|
"div",
|
|
11085
11221
|
{
|
|
@@ -11089,6 +11225,7 @@ function KjunSplitPane({
|
|
|
11089
11225
|
"data-direction": direction,
|
|
11090
11226
|
"data-dragging": dragging || void 0,
|
|
11091
11227
|
"data-collapsed": folded || void 0,
|
|
11228
|
+
"data-second-hidden": secondHidden || void 0,
|
|
11092
11229
|
style: { ...style, "--_kjun-split-pane-size": share, ...basis ? { "--_kjun-split-pane-basis": basis } : {} },
|
|
11093
11230
|
children: [
|
|
11094
11231
|
/* @__PURE__ */ jsx39("div", { id: firstId, className: "kjun-split-pane-first", inert: hidden || void 0, "aria-hidden": hidden || void 0, children: first }),
|
|
@@ -11098,7 +11235,7 @@ function KjunSplitPane({
|
|
|
11098
11235
|
ref: handle,
|
|
11099
11236
|
className: "kjun-split-pane-handle",
|
|
11100
11237
|
role: "separator",
|
|
11101
|
-
tabIndex: disabled ? void 0 : 0,
|
|
11238
|
+
tabIndex: disabled || secondHidden ? void 0 : 0,
|
|
11102
11239
|
"aria-label": ariaLabel,
|
|
11103
11240
|
"aria-controls": firstId,
|
|
11104
11241
|
"aria-orientation": vertical ? "horizontal" : "vertical",
|
|
@@ -11118,7 +11255,7 @@ function KjunSplitPane({
|
|
|
11118
11255
|
children: /* @__PURE__ */ jsx39("span", { className: "kjun-split-pane-bar" })
|
|
11119
11256
|
}
|
|
11120
11257
|
),
|
|
11121
|
-
/* @__PURE__ */ jsx39("div", { className: "kjun-split-pane-second", children: second })
|
|
11258
|
+
/* @__PURE__ */ jsx39("div", { className: "kjun-split-pane-second", inert: secondHidden || void 0, children: second })
|
|
11122
11259
|
]
|
|
11123
11260
|
}
|
|
11124
11261
|
);
|
|
@@ -11824,10 +11961,10 @@ function splitNumberSign(value) {
|
|
|
11824
11961
|
}
|
|
11825
11962
|
|
|
11826
11963
|
// packages/react/src/number-display.tsx
|
|
11827
|
-
import { Fragment as
|
|
11964
|
+
import { Fragment as Fragment24, jsx as jsx43, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
11828
11965
|
function signedText(value) {
|
|
11829
11966
|
const parts2 = splitNumberSign(value);
|
|
11830
|
-
return parts2 ? /* @__PURE__ */ jsxs36(
|
|
11967
|
+
return parts2 ? /* @__PURE__ */ jsxs36(Fragment24, { children: [
|
|
11831
11968
|
/* @__PURE__ */ jsx43("span", { className: "kjun-number-sign", children: parts2[0] }),
|
|
11832
11969
|
parts2[1]
|
|
11833
11970
|
] }) : value;
|
|
@@ -11878,7 +12015,7 @@ function KjunPriceCell({
|
|
|
11878
12015
|
}) {
|
|
11879
12016
|
var _a;
|
|
11880
12017
|
const m = useKjunMessages(), [flashing, endFlash] = usePriceFlash(value, flash);
|
|
11881
|
-
if (value == null) return hasContent(status) ? /* @__PURE__ */ jsxs36(
|
|
12018
|
+
if (value == null) return hasContent(status) ? /* @__PURE__ */ jsxs36(Fragment24, { children: [
|
|
11882
12019
|
/* @__PURE__ */ jsx43("span", { className: "kjun-price-cell", "data-missing": "", children: "\u2014" }),
|
|
11883
12020
|
/* @__PURE__ */ jsx43(PriceStatus, { status })
|
|
11884
12021
|
] }) : /* @__PURE__ */ jsxs36("span", { className: "kjun-price-loading", children: [
|
|
@@ -11886,7 +12023,7 @@ function KjunPriceCell({
|
|
|
11886
12023
|
/* @__PURE__ */ jsx43("span", { className: "kjun-sr-only", children: m.loading })
|
|
11887
12024
|
] });
|
|
11888
12025
|
const className = ["kjun-price-cell", flashClass, flashing].filter(Boolean).join(" ");
|
|
11889
|
-
return /* @__PURE__ */ jsxs36(
|
|
12026
|
+
return /* @__PURE__ */ jsxs36(Fragment24, { children: [
|
|
11890
12027
|
/* @__PURE__ */ jsx43(
|
|
11891
12028
|
"span",
|
|
11892
12029
|
{
|
|
@@ -11940,7 +12077,7 @@ function KjunSignedValue({
|
|
|
11940
12077
|
}
|
|
11941
12078
|
|
|
11942
12079
|
// packages/react/src/financial-display.tsx
|
|
11943
|
-
import { Fragment as
|
|
12080
|
+
import { Fragment as Fragment25, jsx as jsx44, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
11944
12081
|
var deviationFill = { neutral: 1, low: tokens68.states.opacity.deviationLow, medium: tokens68.states.opacity.deviationMedium, strong: tokens68.states.opacity.deviationStrong };
|
|
11945
12082
|
function KjunDeviation({
|
|
11946
12083
|
value,
|
|
@@ -12152,7 +12289,7 @@ function KjunSparkline({
|
|
|
12152
12289
|
children: [
|
|
12153
12290
|
g2.empty && /* @__PURE__ */ jsx44("line", { x1: 0, x2: width, y1: height / 2, y2: height / 2, stroke: "var(--_kjun-color-border)", strokeWidth, strokeDasharray: dash, strokeLinecap: "round", vectorEffect: scale }),
|
|
12154
12291
|
g2.bars.map((bar, i) => /* @__PURE__ */ jsx44("rect", { x: bar.x, y: bar.y, width: bar.width, height: bar.height, rx: stretch ? 0 : Math.min(spec.sparklineBarGap, bar.width / 2), fill: bar.last ? line : "var(--_kjun-color-border)" }, i)),
|
|
12155
|
-
fill && g2.areas.length > 0 && /* @__PURE__ */ jsxs37(
|
|
12292
|
+
fill && g2.areas.length > 0 && /* @__PURE__ */ jsxs37(Fragment25, { children: [
|
|
12156
12293
|
/* @__PURE__ */ jsx44("defs", { children: /* @__PURE__ */ jsxs37("linearGradient", { id: gradient, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
12157
12294
|
/* @__PURE__ */ jsx44("stop", { offset: "0%", stopColor: line, stopOpacity: tokens68.states.opacity.sparklineFill }),
|
|
12158
12295
|
/* @__PURE__ */ jsx44("stop", { offset: "100%", stopColor: line, stopOpacity: 0 })
|
|
@@ -12214,7 +12351,7 @@ function KjunMarketTableSkeleton({ columns = [], rows = 8, showActions = false,
|
|
|
12214
12351
|
}
|
|
12215
12352
|
|
|
12216
12353
|
// packages/react/src/skeletons.tsx
|
|
12217
|
-
import { Fragment as
|
|
12354
|
+
import { Fragment as Fragment26, jsx as jsx47, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
12218
12355
|
function KjunListSkeleton({
|
|
12219
12356
|
rows = 8,
|
|
12220
12357
|
variant = "market",
|
|
@@ -12337,7 +12474,7 @@ function KjunChartSkeleton({
|
|
|
12337
12474
|
children: !skeleton ? /* @__PURE__ */ jsxs40("div", { className: "kjun-data-loading", "data-kjun-chart-part": "loading", role: status, children: [
|
|
12338
12475
|
/* @__PURE__ */ jsx47("span", { "aria-hidden": "true", children: /* @__PURE__ */ jsx47(KjunSpinner, { size: "md" }) }),
|
|
12339
12476
|
loadingText && /* @__PURE__ */ jsx47("p", { children: loadingText })
|
|
12340
|
-
] }) : /* @__PURE__ */ jsxs40(
|
|
12477
|
+
] }) : /* @__PURE__ */ jsxs40(Fragment26, { children: [
|
|
12341
12478
|
/* @__PURE__ */ jsx47("div", { className: "kjun-chart-skeleton-area", "aria-hidden": "true", children: kind === "donut" ? /* @__PURE__ */ jsx47("div", { className: "kjun-chart-skeleton-donut", "data-kjun-chart-part": "donut" }) : kind === "matrix" ? /* @__PURE__ */ jsx47(
|
|
12342
12479
|
"div",
|
|
12343
12480
|
{
|
|
@@ -12819,7 +12956,7 @@ function useTableGroupExpansion(groups, groupBy, expanded, onChange) {
|
|
|
12819
12956
|
|
|
12820
12957
|
// packages/react/src/table-toolbar.tsx
|
|
12821
12958
|
import { tokens as tokens71 } from "@kjun-ui/tokens";
|
|
12822
|
-
import { Fragment as
|
|
12959
|
+
import { Fragment as Fragment27, jsx as jsx48, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
12823
12960
|
function TableToolbar({
|
|
12824
12961
|
selectable,
|
|
12825
12962
|
selected,
|
|
@@ -12838,7 +12975,7 @@ function TableToolbar({
|
|
|
12838
12975
|
}) {
|
|
12839
12976
|
const m = useKjunMessages();
|
|
12840
12977
|
const sorting = sortOptions.length > 0;
|
|
12841
|
-
return /* @__PURE__ */ jsx48(
|
|
12978
|
+
return /* @__PURE__ */ jsx48(Fragment27, { children: selectable && selected.length > 0 ? /* @__PURE__ */ jsxs41(
|
|
12842
12979
|
"div",
|
|
12843
12980
|
{
|
|
12844
12981
|
role: "group",
|
|
@@ -12873,7 +13010,7 @@ function TableToolbar({
|
|
|
12873
13010
|
|
|
12874
13011
|
// packages/react/src/table-grid.tsx
|
|
12875
13012
|
import { tokens as tokens73 } from "@kjun-ui/tokens";
|
|
12876
|
-
import { Fragment as
|
|
13013
|
+
import { Fragment as Fragment28, useEffect as useEffect40, useRef as useRef48, useState as useState45 } from "react";
|
|
12877
13014
|
|
|
12878
13015
|
// packages/react/src/table-check.tsx
|
|
12879
13016
|
import { forwardRef as forwardRef7 } from "react";
|
|
@@ -12891,15 +13028,15 @@ var TableCheck = forwardRef7(
|
|
|
12891
13028
|
);
|
|
12892
13029
|
|
|
12893
13030
|
// packages/react/src/table-grid.tsx
|
|
12894
|
-
import { Fragment as
|
|
13031
|
+
import { Fragment as Fragment29, jsx as jsx50, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
12895
13032
|
import { createElement as createElement3 } from "react";
|
|
12896
|
-
function TableGrid({ columnGroups, cellSpan, mover, initialLoading, skeletonRows, skeletonHidden, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, visible, maxHeight, stickyHeader, sortable, compact, striped, hoverable, ariaLabel, customClass, rowKeyDown, groups, collapsed, toggleGroup, groupLabel, summary, edgeInset, stickyOffset = 0 }) {
|
|
13033
|
+
function TableGrid({ columnGroups, cellSpan, mover, initialLoading, skeletonRows, skeletonHidden, state, onRowClick, selectable, checkbox, cell, expandable, expand, renderExpand, emptyContent, emptyText, visible, maxHeight, stickyHeader, sortable, compact, striped, hoverable, ariaLabel, customClass, rowKeyDown, groups, collapsed, toggleGroup, groupLabel, summary, edgeInset, layout, stickyOffset = 0 }) {
|
|
12897
13034
|
const m = useKjunMessages();
|
|
12898
13035
|
const span = visible.length + Number(selectable) + Number(expandable) + Number(!!mover);
|
|
12899
13036
|
const headerRows = tableHeaderRows(visible, columnGroups), lone = headerRows ? 2 : void 0;
|
|
12900
13037
|
const bodyRow = (row, i) => {
|
|
12901
13038
|
const spans = tableSpans(visible, cellSpan ? (column) => cellSpan(row, column) : null);
|
|
12902
|
-
return /* @__PURE__ */ jsxs43(
|
|
13039
|
+
return /* @__PURE__ */ jsxs43(Fragment28, { children: [
|
|
12903
13040
|
/* @__PURE__ */ jsxs43(
|
|
12904
13041
|
"tr",
|
|
12905
13042
|
{
|
|
@@ -12965,9 +13102,9 @@ function TableGrid({ columnGroups, cellSpan, mover, initialLoading, skeletonRows
|
|
|
12965
13102
|
selectable && /* @__PURE__ */ jsx50("td", { className: "kjun-table-action-cell" }),
|
|
12966
13103
|
visible.map((col, c) => {
|
|
12967
13104
|
const value = summary(col, rows), shown = value !== null && value !== void 0 && value !== "" && value !== false;
|
|
12968
|
-
return /* @__PURE__ */ jsx50("td", { style: { textAlign: col.align }, "data-numeric": col.type === "number" || col.align === "right" || void 0, "data-date": col.type === "date" || col.type === "datetime" || void 0, children: c === 0 ? /* @__PURE__ */ jsxs43(
|
|
13105
|
+
return /* @__PURE__ */ jsx50("td", { style: { textAlign: col.align }, "data-numeric": col.type === "number" || col.align === "right" || void 0, "data-date": col.type === "date" || col.type === "datetime" || void 0, children: c === 0 ? /* @__PURE__ */ jsxs43(Fragment29, { children: [
|
|
12969
13106
|
/* @__PURE__ */ jsx50("span", { className: "kjun-table-summary-label", children: kind === "total" ? m.tableTotal : m.tableSubtotal }),
|
|
12970
|
-
shown && /* @__PURE__ */ jsxs43(
|
|
13107
|
+
shown && /* @__PURE__ */ jsxs43(Fragment29, { children: [
|
|
12971
13108
|
" ",
|
|
12972
13109
|
value
|
|
12973
13110
|
] })
|
|
@@ -13026,7 +13163,14 @@ function TableGrid({ columnGroups, cellSpan, mover, initialLoading, skeletonRows
|
|
|
13026
13163
|
"data-hoverable": hoverable,
|
|
13027
13164
|
"data-striped": striped,
|
|
13028
13165
|
"data-edge-inset": edgeInset === "none" ? "none" : void 0,
|
|
13166
|
+
"data-layout": layout === "fixed" ? "fixed" : void 0,
|
|
13029
13167
|
children: [
|
|
13168
|
+
layout === "fixed" && /* @__PURE__ */ jsxs43("colgroup", { children: [
|
|
13169
|
+
selectable && /* @__PURE__ */ jsx50("col", { className: "kjun-table-action-cell" }),
|
|
13170
|
+
visible.map((col) => /* @__PURE__ */ jsx50("col", { style: { width: col.width } }, col.key)),
|
|
13171
|
+
expandable && /* @__PURE__ */ jsx50("col", { className: "kjun-table-action-cell" }),
|
|
13172
|
+
mover && /* @__PURE__ */ jsx50("col", { className: "kjun-table-action-cell kjun-table-reorder-cell" })
|
|
13173
|
+
] }),
|
|
13030
13174
|
/* @__PURE__ */ jsxs43("thead", { "data-sticky": stickyHeader || void 0, style: stickyHeader ? { top: pageSticky ? stickyOffset : 0 } : void 0, children: [
|
|
13031
13175
|
/* @__PURE__ */ jsxs43("tr", { children: [
|
|
13032
13176
|
selectable && /* @__PURE__ */ jsx50("th", { scope: "col", className: "kjun-table-action-cell", rowSpan: lone, children: /* @__PURE__ */ jsx50(
|
|
@@ -13091,13 +13235,13 @@ function TableTotals({ totals }) {
|
|
|
13091
13235
|
}
|
|
13092
13236
|
|
|
13093
13237
|
// packages/react/src/table-groups.tsx
|
|
13094
|
-
import { Fragment as
|
|
13238
|
+
import { Fragment as Fragment30, jsx as jsx52, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
13095
13239
|
function TableGroupHeader({ label, count, totals, toggle }) {
|
|
13096
13240
|
return /* @__PURE__ */ jsxs45("div", { className: "kjun-table-card-group", children: [
|
|
13097
13241
|
toggle,
|
|
13098
13242
|
/* @__PURE__ */ jsx52("span", { children: label }),
|
|
13099
13243
|
/* @__PURE__ */ jsx52("span", { className: "kjun-table-card-group-count", children: count }),
|
|
13100
|
-
totals.length > 0 && /* @__PURE__ */ jsx52("span", { className: "kjun-table-card-group-total", children: totals.map((total) => /* @__PURE__ */ jsx52("span", { children: totals.length > 1 ? /* @__PURE__ */ jsxs45(
|
|
13244
|
+
totals.length > 0 && /* @__PURE__ */ jsx52("span", { className: "kjun-table-card-group-total", children: totals.map((total) => /* @__PURE__ */ jsx52("span", { children: totals.length > 1 ? /* @__PURE__ */ jsxs45(Fragment30, { children: [
|
|
13101
13245
|
total.label,
|
|
13102
13246
|
" ",
|
|
13103
13247
|
total.value
|
|
@@ -13136,7 +13280,7 @@ function useTableGroups({ groupLabel, groupTotals, state, collapsed, toggleGroup
|
|
|
13136
13280
|
}
|
|
13137
13281
|
|
|
13138
13282
|
// packages/react/src/table-cards.tsx
|
|
13139
|
-
import { Fragment as
|
|
13283
|
+
import { Fragment as Fragment31, jsx as jsx53, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
13140
13284
|
function TableCards(props) {
|
|
13141
13285
|
const {
|
|
13142
13286
|
mover,
|
|
@@ -13183,7 +13327,7 @@ function TableCards(props) {
|
|
|
13183
13327
|
onClick: (event) => {
|
|
13184
13328
|
if (!fromNestedControl(event)) onRowClick == null ? void 0 : onRowClick(row, i);
|
|
13185
13329
|
},
|
|
13186
|
-
children: tiles ? /* @__PURE__ */ jsxs46(
|
|
13330
|
+
children: tiles ? /* @__PURE__ */ jsxs46(Fragment31, { children: [
|
|
13187
13331
|
(selectable || badges.length > 0) && /* @__PURE__ */ jsxs46("div", { className: "kjun-table-card-header", children: [
|
|
13188
13332
|
selectable && checkbox(row, i),
|
|
13189
13333
|
badgeList(row, i)
|
|
@@ -13197,7 +13341,7 @@ function TableCards(props) {
|
|
|
13197
13341
|
] }),
|
|
13198
13342
|
/* @__PURE__ */ jsx53("span", { className: "kjun-table-card-value", children: cell(highlight, row, i) })
|
|
13199
13343
|
] })
|
|
13200
|
-
] }) : /* @__PURE__ */ jsxs46(
|
|
13344
|
+
] }) : /* @__PURE__ */ jsxs46(Fragment31, { children: [
|
|
13201
13345
|
/* @__PURE__ */ jsxs46("div", { className: "kjun-table-card-header", children: [
|
|
13202
13346
|
/* @__PURE__ */ jsxs46("div", { className: "kjun-table-card-header-left", children: [
|
|
13203
13347
|
selectable && checkbox(row, i),
|
|
@@ -13234,7 +13378,7 @@ function TableCards(props) {
|
|
|
13234
13378
|
};
|
|
13235
13379
|
const groupSections = useTableGroups(props, "kjun-table-card-group-section", "kjun-table-card-items", card);
|
|
13236
13380
|
const grouped = !!groups && !initialLoading && state.rows.length > 0, listed = !initialLoading && !grouped && state.rows.length > 0;
|
|
13237
|
-
return /* @__PURE__ */ jsxs46(
|
|
13381
|
+
return /* @__PURE__ */ jsxs46(Fragment31, { children: [
|
|
13238
13382
|
/* @__PURE__ */ jsxs46(
|
|
13239
13383
|
"div",
|
|
13240
13384
|
{
|
|
@@ -13270,7 +13414,7 @@ function CardSkeleton({ layout }) {
|
|
|
13270
13414
|
] }) }),
|
|
13271
13415
|
highlight && /* @__PURE__ */ jsxs46("div", { className: "kjun-table-card-highlight", children: [
|
|
13272
13416
|
/* @__PURE__ */ jsx53(KjunSkeleton, { type: "line", role: "caption", width: "20%" }),
|
|
13273
|
-
/* @__PURE__ */ jsx53(KjunSkeleton, { type: "line", role: "
|
|
13417
|
+
/* @__PURE__ */ jsx53(KjunSkeleton, { type: "line", role: "numberLg", width: "45%" })
|
|
13274
13418
|
] }),
|
|
13275
13419
|
/* @__PURE__ */ jsx53("div", { className: "kjun-table-card-section", children: /* @__PURE__ */ jsx53("div", { className: "kjun-table-card-body" + (rows ? " kjun-table-card-body--rows" : ""), children: [0, 1, 2, 3].map((field) => /* @__PURE__ */ jsxs46("div", { className: "kjun-table-card-field", children: [
|
|
13276
13420
|
/* @__PURE__ */ jsx53(KjunSkeleton, { type: "line", role: "caption", width: rows ? "25%" : "50%" }),
|
|
@@ -13281,7 +13425,7 @@ function CardSkeleton({ layout }) {
|
|
|
13281
13425
|
|
|
13282
13426
|
// packages/react/src/table-list.tsx
|
|
13283
13427
|
import { tokens as tokens75 } from "@kjun-ui/tokens";
|
|
13284
|
-
import { Fragment as
|
|
13428
|
+
import { Fragment as Fragment32, jsx as jsx54, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
13285
13429
|
function TableList(props) {
|
|
13286
13430
|
const {
|
|
13287
13431
|
mover,
|
|
@@ -13336,7 +13480,7 @@ function TableList(props) {
|
|
|
13336
13480
|
] }, state.key(row, i));
|
|
13337
13481
|
const groupSections = useTableGroups(props, "kjun-table-list-group", void 0, item);
|
|
13338
13482
|
const grouped = !!groups && !initialLoading && state.rows.length > 0, listed = !initialLoading && !grouped && state.rows.length > 0;
|
|
13339
|
-
return /* @__PURE__ */ jsxs47(
|
|
13483
|
+
return /* @__PURE__ */ jsxs47(Fragment32, { children: [
|
|
13340
13484
|
/* @__PURE__ */ jsxs47(
|
|
13341
13485
|
"div",
|
|
13342
13486
|
{
|
|
@@ -13365,7 +13509,7 @@ function TableList(props) {
|
|
|
13365
13509
|
}
|
|
13366
13510
|
|
|
13367
13511
|
// packages/react/src/table-view.tsx
|
|
13368
|
-
import { useCallback as
|
|
13512
|
+
import { useCallback as useCallback13, useId as useId24, useMemo as useMemo5, useState as useState47, useSyncExternalStore as useSyncExternalStore5 } from "react";
|
|
13369
13513
|
|
|
13370
13514
|
// packages/react/src/reorder-controls.tsx
|
|
13371
13515
|
import { createContext as createContext16, useContext as useContext17, useEffect as useEffect41, useMemo as useMemo4, useRef as useRef49, useState as useState46 } from "react";
|
|
@@ -13864,7 +14008,7 @@ function KjunTable(props) {
|
|
|
13864
14008
|
});
|
|
13865
14009
|
const mover = reorderable ? (row, i) => /* @__PURE__ */ jsx56(ReorderControls, { value: state.key(row, i), name: String(rowName(row, i)) }) : void 0;
|
|
13866
14010
|
const painted = !query2.initialLoading && state.rows.length > 0 && props.columns.some((column) => column.pill);
|
|
13867
|
-
const rootRef =
|
|
14011
|
+
const rootRef = useCallback13((node) => {
|
|
13868
14012
|
var _a2;
|
|
13869
14013
|
setRoot(node);
|
|
13870
14014
|
(_a2 = domainColorRef(painted)) == null ? void 0 : _a2(node);
|
|
@@ -13948,6 +14092,7 @@ function KjunTable(props) {
|
|
|
13948
14092
|
hoverable,
|
|
13949
14093
|
...grouping,
|
|
13950
14094
|
edgeInset: props.edgeInset,
|
|
14095
|
+
layout: props.layout,
|
|
13951
14096
|
stickyOffset: props.stickyOffset,
|
|
13952
14097
|
sortable: props.sortable
|
|
13953
14098
|
}
|
|
@@ -14071,9 +14216,9 @@ var kpiCssColor = (tone, neutral = "text") => tone === "up" || tone === 1 ? "var
|
|
|
14071
14216
|
var kpiCssTint = (direction) => direction === 0 ? "var(--_kjun-color-secondary)" : `var(--_kjun-color-price-${direction > 0 ? "up" : "down"}-bg)`;
|
|
14072
14217
|
|
|
14073
14218
|
// packages/react/src/kpi-hero.tsx
|
|
14074
|
-
import { Fragment as
|
|
14219
|
+
import { Fragment as Fragment33, jsx as jsx57, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
14075
14220
|
function KpiMasked({ label }) {
|
|
14076
|
-
return /* @__PURE__ */ jsxs50(
|
|
14221
|
+
return /* @__PURE__ */ jsxs50(Fragment33, { children: [
|
|
14077
14222
|
/* @__PURE__ */ jsx57("span", { "aria-hidden": "true", children: KPI_MASK }),
|
|
14078
14223
|
/* @__PURE__ */ jsx57("span", { className: "kjun-sr-only", children: label })
|
|
14079
14224
|
] });
|
|
@@ -14110,10 +14255,10 @@ function KjunKpiHero(props) {
|
|
|
14110
14255
|
if (masked) return hidden;
|
|
14111
14256
|
const { direction: direction2, sign, number } = kpiDelta(v, kind, deltaOptions);
|
|
14112
14257
|
const icon2 = kpiDeltaIcon(deltaIcon, direction2, kind, absolute !== null);
|
|
14113
|
-
return /* @__PURE__ */ jsxs50(
|
|
14258
|
+
return /* @__PURE__ */ jsxs50(Fragment33, { children: [
|
|
14114
14259
|
icon2 && /* @__PURE__ */ jsx57(KjunIcon, { name: "caret-up", filled: true, className: "kjun-kpi-hero__delta-icon", "data-direction": direction2 > 0 ? "up" : "down", "aria-hidden": "true" }),
|
|
14115
14260
|
icon2 && !deltaFormatter && /* @__PURE__ */ jsx57("span", { className: "kjun-sr-only", children: sign }),
|
|
14116
|
-
deltaFormatter ? deltaFormatter(v, kind) : /* @__PURE__ */ jsxs50(
|
|
14261
|
+
deltaFormatter ? deltaFormatter(v, kind) : /* @__PURE__ */ jsxs50(Fragment33, { children: [
|
|
14117
14262
|
!icon2 && sign,
|
|
14118
14263
|
kind === "absolute" && prefix && /* @__PURE__ */ jsx57("span", { className: "kjun-number-affix", "data-side": "prefix", children: prefix }),
|
|
14119
14264
|
number,
|
|
@@ -14138,7 +14283,7 @@ function KjunKpiHero(props) {
|
|
|
14138
14283
|
label,
|
|
14139
14284
|
hasContent(labelAside) && /* @__PURE__ */ jsx57("span", { className: "kjun-kpi-hero__label-aside", children: labelAside })
|
|
14140
14285
|
] }),
|
|
14141
|
-
/* @__PURE__ */ jsx57("div", { className: "kjun-kpi-hero__value", children: loading ? /* @__PURE__ */ jsx57(KjunSkeleton, { type: "line", width: "7ch" }) : masked && kpiPresent(value) ? hidden : !kpiPresent(value) ? missingText != null ? missingText : KPI_MISSING : /* @__PURE__ */ jsxs50(
|
|
14286
|
+
/* @__PURE__ */ jsx57("div", { className: "kjun-kpi-hero__value", children: loading ? /* @__PURE__ */ jsx57(KjunSkeleton, { type: "line", width: "7ch" }) : masked && kpiPresent(value) ? hidden : !kpiPresent(value) ? missingText != null ? missingText : KPI_MISSING : /* @__PURE__ */ jsxs50(Fragment33, { children: [
|
|
14142
14287
|
prefix && /* @__PURE__ */ jsx57("span", { className: "kjun-kpi-hero__affix", children: prefix }),
|
|
14143
14288
|
/* @__PURE__ */ jsx57(KjunAnimatedNumber, { value, decimals: decimals2, animated, formatter: formatter != null ? formatter : ((n) => kpiNumber(n, decimals2, locale)) }),
|
|
14144
14289
|
suffix && /* @__PURE__ */ jsx57("span", { className: "kjun-kpi-hero__affix", children: suffix })
|
|
@@ -14146,7 +14291,7 @@ function KjunKpiHero(props) {
|
|
|
14146
14291
|
showDelta && /* @__PURE__ */ jsx57("div", { className: "kjun-kpi-hero__delta-line", children: loading ? (
|
|
14147
14292
|
// The placeholder takes the delta numbers' line height, like Vue, so the hero keeps its loaded height.
|
|
14148
14293
|
/* @__PURE__ */ jsx57("span", { className: "kjun-kpi-hero__delta-abs", children: /* @__PURE__ */ jsx57(KjunSkeleton, { type: "line", width: tokens77.extensions.kpiHero.deltaSkeletonWidth }) })
|
|
14149
|
-
) : /* @__PURE__ */ jsxs50(
|
|
14294
|
+
) : /* @__PURE__ */ jsxs50(Fragment33, { children: [
|
|
14150
14295
|
absolute !== null && /* @__PURE__ */ jsx57("span", { className: "kjun-kpi-hero__delta-abs", style: { color: kpiCssColor(direction(absolute, "absolute"), "text-tertiary") }, children: delta(absolute, "absolute") }),
|
|
14151
14296
|
percent2 !== null && /* @__PURE__ */ jsx57(
|
|
14152
14297
|
"span",
|
|
@@ -14170,7 +14315,7 @@ function KjunKpiHero(props) {
|
|
|
14170
14315
|
{
|
|
14171
14316
|
className: "kjun-kpi-hero__sec-value " + (item.valueClass || ""),
|
|
14172
14317
|
style: { color: item.valueClass ? void 0 : kpiCssColor(masked ? null : kpiTone(item)) },
|
|
14173
|
-
children: loading ? /* @__PURE__ */ jsx57(KjunSkeleton, { type: "line", width: "5ch" }) : masked && present2 ? hidden : hasContent(custom) ? custom : present2 ? /* @__PURE__ */ jsxs50(
|
|
14318
|
+
children: loading ? /* @__PURE__ */ jsx57(KjunSkeleton, { type: "line", width: "5ch" }) : masked && present2 ? hidden : hasContent(custom) ? custom : present2 ? /* @__PURE__ */ jsxs50(Fragment33, { children: [
|
|
14174
14319
|
item.prefix && /* @__PURE__ */ jsx57("span", { className: "kjun-kpi-hero__sec-affix", children: item.prefix }),
|
|
14175
14320
|
/* @__PURE__ */ jsx57("span", { children: kpiFormat(item, item.value, locale) }),
|
|
14176
14321
|
item.suffix && /* @__PURE__ */ jsx57("span", { className: "kjun-kpi-hero__sec-affix", children: item.suffix })
|
|
@@ -14195,7 +14340,7 @@ function KjunKpiHero(props) {
|
|
|
14195
14340
|
|
|
14196
14341
|
// packages/react/src/kpi-row.tsx
|
|
14197
14342
|
import { tokens as tokens78 } from "@kjun-ui/tokens";
|
|
14198
|
-
import { Fragment as
|
|
14343
|
+
import { Fragment as Fragment34, jsx as jsx58, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
14199
14344
|
function KjunKpiRow({
|
|
14200
14345
|
loading = false,
|
|
14201
14346
|
items,
|
|
@@ -14232,7 +14377,7 @@ function KjunKpiRow({
|
|
|
14232
14377
|
if (action === "activate" && !busy) onItemClick == null ? void 0 : onItemClick(item, i, event);
|
|
14233
14378
|
};
|
|
14234
14379
|
const custom = busy || hide || item.valueSegments ? null : renderValue == null ? void 0 : renderValue(item, i);
|
|
14235
|
-
const content = /* @__PURE__ */ jsxs51(
|
|
14380
|
+
const content = /* @__PURE__ */ jsxs51(Fragment34, { children: [
|
|
14236
14381
|
/* @__PURE__ */ jsxs51("div", { className: "kjun-kpi-row__label-row", children: [
|
|
14237
14382
|
/* @__PURE__ */ jsx58("div", { className: "kjun-kpi-row__label", children: busy && !item.label ? /* @__PURE__ */ jsx58(KjunSkeleton, { type: "line", width: tokens78.extensions.kpiRow.labelSkeletonWidth }) : item.label }),
|
|
14238
14383
|
hasContent(item.labelAside) && // The aside is its own control: its clicks and keys never open the cell (nor follow a link cell).
|
|
@@ -14268,7 +14413,7 @@ function KjunKpiRow({
|
|
|
14268
14413
|
]
|
|
14269
14414
|
},
|
|
14270
14415
|
j
|
|
14271
|
-
)) : hasContent(custom) ? custom : present2 ? /* @__PURE__ */ jsxs51(
|
|
14416
|
+
)) : hasContent(custom) ? custom : present2 ? /* @__PURE__ */ jsxs51(Fragment34, { children: [
|
|
14272
14417
|
item.prefix && /* @__PURE__ */ jsx58("span", { className: "kjun-kpi-row__affix", "data-side": "prefix", children: item.prefix }),
|
|
14273
14418
|
item.animated && typeof value === "number" ? /* @__PURE__ */ jsx58(KjunAnimatedNumber, { fromPrevious: true, value, formatter: format2 }) : format2(value),
|
|
14274
14419
|
item.suffix && /* @__PURE__ */ jsx58("span", { className: "kjun-kpi-row__affix", "data-side": "suffix", children: item.suffix })
|
|
@@ -14405,14 +14550,14 @@ function useMarketCards(props) {
|
|
|
14405
14550
|
}
|
|
14406
14551
|
|
|
14407
14552
|
// packages/react/src/market-parts.tsx
|
|
14408
|
-
import { Fragment as
|
|
14553
|
+
import { Fragment as Fragment35, jsx as jsx59, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
14409
14554
|
function MarketIdentity({
|
|
14410
14555
|
row,
|
|
14411
14556
|
props
|
|
14412
14557
|
}) {
|
|
14413
14558
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
14414
14559
|
const label = (_c = (_a = props.primaryLabel) == null ? void 0 : _a.call(props, row)) != null ? _c : String((_b = getValue(row, "name")) != null ? _b : ""), meta = ((_d = props.subMeta) == null ? void 0 : _d.call(props, row)) || "", id = getValue(row, props.rowKey || "id");
|
|
14415
|
-
const body = /* @__PURE__ */ jsxs52(
|
|
14560
|
+
const body = /* @__PURE__ */ jsxs52(Fragment35, { children: [
|
|
14416
14561
|
(_e = props.renderNamePrefix) == null ? void 0 : _e.call(props, row),
|
|
14417
14562
|
/* @__PURE__ */ jsxs52("div", { className: "kjun-market-identity-text", children: [
|
|
14418
14563
|
/* @__PURE__ */ jsxs52("div", { className: "kjun-market-name", children: [
|
|
@@ -14470,7 +14615,7 @@ function MarketFooter({
|
|
|
14470
14615
|
footerNote,
|
|
14471
14616
|
unitLabel = m.unitLabel
|
|
14472
14617
|
} = props;
|
|
14473
|
-
return /* @__PURE__ */ jsxs52(
|
|
14618
|
+
return /* @__PURE__ */ jsxs52(Fragment35, { children: [
|
|
14474
14619
|
pagination && !hidden && /* @__PURE__ */ jsx59(
|
|
14475
14620
|
KjunPagination,
|
|
14476
14621
|
{
|
|
@@ -14490,7 +14635,7 @@ function MarketFooter({
|
|
|
14490
14635
|
}
|
|
14491
14636
|
|
|
14492
14637
|
// packages/react/src/market-cards.tsx
|
|
14493
|
-
import { Fragment as
|
|
14638
|
+
import { Fragment as Fragment36, jsx as jsx60, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
14494
14639
|
function KjunMarketCards(props) {
|
|
14495
14640
|
const m = useKjunMessages();
|
|
14496
14641
|
const {
|
|
@@ -14536,7 +14681,7 @@ function KjunMarketCards(props) {
|
|
|
14536
14681
|
selectedKey: state.key,
|
|
14537
14682
|
selectedPill: state.pill,
|
|
14538
14683
|
metricDisplay: display
|
|
14539
|
-
}) : /* @__PURE__ */ jsxs53(
|
|
14684
|
+
}) : /* @__PURE__ */ jsxs53(Fragment36, { children: [
|
|
14540
14685
|
/* @__PURE__ */ jsx60(
|
|
14541
14686
|
KjunDataState,
|
|
14542
14687
|
{
|
|
@@ -14564,7 +14709,7 @@ function KjunMarketCards(props) {
|
|
|
14564
14709
|
width: tokens79.extensions.marketTable.sparklineWidth,
|
|
14565
14710
|
height: tokens79.extensions.marketTable.sparklineHeight
|
|
14566
14711
|
}
|
|
14567
|
-
) : state.pill ? /* @__PURE__ */ jsx60(
|
|
14712
|
+
) : state.pill ? /* @__PURE__ */ jsx60(Fragment36, { children: metricLoading(row, state.key) ? /* @__PURE__ */ jsx60(KjunSkeleton, { type: "line", width: tokens79.extensions.marketTable.valueSkeletonWidth }) : isChange && getValue(row, state.key) != null ? /* @__PURE__ */ jsx60(
|
|
14568
14713
|
KjunSignedValue,
|
|
14569
14714
|
{
|
|
14570
14715
|
value: finiteNumber(getValue(row, state.key)),
|
|
@@ -14734,6 +14879,7 @@ function KjunMarketTable(props) {
|
|
|
14734
14879
|
if (cellLoading(row, col))
|
|
14735
14880
|
return /* @__PURE__ */ jsx63(KjunSkeleton, { type: "line", width: tokens81.extensions.marketTable.valueSkeletonWidth });
|
|
14736
14881
|
if (renderCell) return renderCell(row, col);
|
|
14882
|
+
if (col.render) return col.render(row, col);
|
|
14737
14883
|
const kind = marketCellKind(col), context = { currency, row, column: col };
|
|
14738
14884
|
if (kind === "identity") return /* @__PURE__ */ jsx63(MarketIdentity, { row, props });
|
|
14739
14885
|
if (kind === "sparkline")
|
|
@@ -14887,6 +15033,22 @@ function KjunMarketTable(props) {
|
|
|
14887
15033
|
import { tokens as tokens83 } from "@kjun-ui/tokens";
|
|
14888
15034
|
import { createContext as createContext17, useContext as useContext18, useEffect as useEffect44, useId as useId25, useMemo as useMemo6, useRef as useRef52, useState as useState50 } from "react";
|
|
14889
15035
|
|
|
15036
|
+
// shared/package-runtime/node-text.ts
|
|
15037
|
+
function nodeText(node) {
|
|
15038
|
+
var _a;
|
|
15039
|
+
if (typeof node === "string") return node.trim() || void 0;
|
|
15040
|
+
if (typeof node === "number") return String(node);
|
|
15041
|
+
if (Array.isArray(node)) return node.map(nodeText).filter(Boolean).join(" ") || void 0;
|
|
15042
|
+
if (!node || typeof node !== "object" || !("props" in node)) return void 0;
|
|
15043
|
+
const props = (_a = node.props) != null ? _a : {};
|
|
15044
|
+
for (const name of [props.ariaLabel, props.label]) if (typeof name === "string" && name.trim()) return name.trim();
|
|
15045
|
+
if (typeof props.count === "number") {
|
|
15046
|
+
const max = typeof props.max === "number" ? props.max : 99;
|
|
15047
|
+
return props.count > 0 ? props.count > max ? max + "+" : String(props.count) : void 0;
|
|
15048
|
+
}
|
|
15049
|
+
return nodeText(props.children);
|
|
15050
|
+
}
|
|
15051
|
+
|
|
14890
15052
|
// shared/package-runtime/list-leading.ts
|
|
14891
15053
|
import { tokens as tokens82 } from "@kjun-ui/tokens";
|
|
14892
15054
|
function listLeadingGeometry({ size, custom, background, open = false }) {
|
|
@@ -14907,7 +15069,7 @@ function listLeadingGeometry({ size, custom, background, open = false }) {
|
|
|
14907
15069
|
}
|
|
14908
15070
|
|
|
14909
15071
|
// packages/react/src/list.tsx
|
|
14910
|
-
import { Fragment as
|
|
15072
|
+
import { Fragment as Fragment37, jsx as jsx64, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
14911
15073
|
var ListSelectionContext = createContext17({ mode: "none" });
|
|
14912
15074
|
function KjunListRow({ title, description, badge, icon: icon2, leadingSize, iconColor, iconBackground, leading, trailing, trailingPosition = "side", actions, href, target, rel, disabled = false, destructive = false, emphasized = false, chevron = false, current = false, selected: ownSelected, checked, onCheckedChange, busy = false, value, onClick: ownClick, ariaLabel, children, titleLines, descriptionLines, expanded, onExpandedChange, expandedContent }) {
|
|
14913
15075
|
const selection = useContext18(ListSelectionContext), { open, details } = useContext18(ListShapeContext), choice = listRowChoice(selection, value, ownSelected), selected = choice.selected;
|
|
@@ -14946,7 +15108,7 @@ function KjunListRow({ title, description, badge, icon: icon2, leadingSize, icon
|
|
|
14946
15108
|
/* @__PURE__ */ jsx64("span", { id: id + "-badge", className: "kjun-list-badge", children: badge })
|
|
14947
15109
|
] }) : titleText;
|
|
14948
15110
|
const endValue = hasTrailing && /* @__PURE__ */ jsx64("span", { id: id + "-trailing", className: "kjun-list-trailing", children: trailing }), onTitle = hasTrailing && trailingPosition === "title", below = hasTrailing && trailingPosition === "below";
|
|
14949
|
-
const contents = /* @__PURE__ */ jsxs57(
|
|
15111
|
+
const contents = /* @__PURE__ */ jsxs57(Fragment37, { children: [
|
|
14950
15112
|
front && /* @__PURE__ */ jsx64("span", { className: "kjun-list-leading", children: front }),
|
|
14951
15113
|
/* @__PURE__ */ jsxs57("span", { className: "kjun-list-body", children: [
|
|
14952
15114
|
onTitle ? /* @__PURE__ */ jsxs57("span", { className: "kjun-list-value-line", children: [
|
|
@@ -14971,14 +15133,14 @@ function KjunListRow({ title, description, badge, icon: icon2, leadingSize, icon
|
|
|
14971
15133
|
main,
|
|
14972
15134
|
(hasContent(actions) || movable) && /* @__PURE__ */ jsxs57("div", { className: "kjun-list-actions", "data-disabled": disabled || void 0, inert: disabled || void 0, children: [
|
|
14973
15135
|
actions,
|
|
14974
|
-
movable && /* @__PURE__ */ jsx64(ReorderControls, { value, name: title })
|
|
15136
|
+
movable && /* @__PURE__ */ jsx64(ReorderControls, { value, name: nodeText(title) || ariaLabel || "" })
|
|
14975
15137
|
] }),
|
|
14976
15138
|
expandable && /* @__PURE__ */ jsx64("div", { id: id + "-expanded", className: "kjun-list-expanded", children: /* @__PURE__ */ jsx64(Collapse, { open: !!expanded, children: /* @__PURE__ */ jsx64("div", { className: "kjun-list-expanded-body", children: expandedContent }) }) })
|
|
14977
15139
|
] });
|
|
14978
15140
|
}
|
|
14979
15141
|
var ListGroupContext = createContext17(null);
|
|
14980
|
-
function KjunListSection({ title, description, badge, id: rootId, className, style, actions, children, ariaLabel, surface = true, divider: dividerProp, density = "default", radius, titleVariant, headingLevel = 3, empty: empty3, footer, loading, selectionMode = "none", value, onValueChange, variant, reorderable = false, order, onOrderChange, onReorder, reorderControls = "buttons", reorderDisabled = false, reorderDisabledText }) {
|
|
14981
|
-
const { open, details, corner, bare, outside } = listSectionShape({ radius, group: useContext18(ListGroupContext), variant, title, description, titleVariant });
|
|
15142
|
+
function KjunListSection({ title, description, badge, id: rootId, className, style, actions, children, ariaLabel, surface = true, bleed: bleedProp = false, divider: dividerProp, density = "default", radius, titleVariant, headingLevel = 3, empty: empty3, footer, loading, selectionMode = "none", value, onValueChange, variant, reorderable = false, order, onOrderChange, onReorder, reorderControls = "buttons", reorderDisabled = false, reorderDisabledText }) {
|
|
15143
|
+
const { open, details, corner, bare, outside, bleed } = listSectionShape({ radius, group: useContext18(ListGroupContext), variant, title, description, titleVariant, bleed: bleedProp });
|
|
14982
15144
|
const divider = dividerProp != null ? dividerProp : !details;
|
|
14983
15145
|
useEffect44(() => warnListSectionProps({ open, divider: dividerProp, details, compact: density === "compact" }), [open, dividerProp, details, density]);
|
|
14984
15146
|
useEffect44(() => warnListSelection({ mode: selectionMode, value, handled: !!onValueChange }), [selectionMode, Array.isArray(value), value === void 0, !!onValueChange]);
|
|
@@ -14994,7 +15156,7 @@ function KjunListSection({ title, description, badge, id: rootId, className, sty
|
|
|
14994
15156
|
const shape = useMemo6(() => ({ open, details, compact: !!compact }), [open, details, compact]);
|
|
14995
15157
|
const selection = useMemo6(() => ({ mode: selectionMode, value, onValueChange }), [selectionMode, value, onValueChange]);
|
|
14996
15158
|
const rows = hasContent(loading) ? /* @__PURE__ */ jsx64("div", { className: "kjun-list-loading", children: loading }) : hasContent(children) ? /* @__PURE__ */ jsx64("ul", { ref: setList, className: "kjun-list", role: choice ? "radiogroup" : void 0, "aria-label": ariaLabel || void 0, "aria-labelledby": ariaLabel || !title ? void 0 : hasBadge ? id + " " + id + "-badge" : id, "aria-describedby": describedBy, "data-divider": divider ? void 0 : "false", "data-density": compact, "data-variant": look, children: /* @__PURE__ */ jsx64(ListSelectionContext.Provider, { value: selection, children: /* @__PURE__ */ jsx64(ReorderContext.Provider, { value: reorder.context, children }) }) }) : hasContent(empty3) ? /* @__PURE__ */ jsx64("div", { className: "kjun-list-empty", "data-density": compact, children: empty3 }) : null;
|
|
14997
|
-
return /* @__PURE__ */ jsx64(ListShapeContext.Provider, { value: shape, children: /* @__PURE__ */ jsxs57("section", { id: rootId, className: "kjun-list-section" + (className ? " " + className : ""), style, "data-surface": surface
|
|
15159
|
+
return /* @__PURE__ */ jsx64(ListShapeContext.Provider, { value: shape, children: /* @__PURE__ */ jsxs57("section", { id: rootId, className: "kjun-list-section" + (className ? " " + className : ""), style, "data-surface": listSectionSurface(surface).attribute, "data-outside": outside || void 0, "data-bleed": bleed || void 0, "data-variant": look, children: [
|
|
14998
15160
|
(title || description || hasContent(actions)) && /* @__PURE__ */ jsxs57("div", { className: "kjun-list-heading", "data-bare": bare ? "" : void 0, children: [
|
|
14999
15161
|
/* @__PURE__ */ jsxs57("div", { children: [
|
|
15000
15162
|
hasBadge ? /* @__PURE__ */ jsxs57("div", { className: "kjun-list-heading-title", children: [
|
|
@@ -15005,7 +15167,7 @@ function KjunListSection({ title, description, badge, id: rootId, className, sty
|
|
|
15005
15167
|
] }),
|
|
15006
15168
|
hasContent(actions) && /* @__PURE__ */ jsx64("div", { ref: setActionsBox, className: "kjun-list-heading-actions", children: actions })
|
|
15007
15169
|
] }),
|
|
15008
|
-
outside ? /* @__PURE__ */ jsx64("div", { className: "kjun-list-panel", "data-surface": surface
|
|
15170
|
+
outside ? /* @__PURE__ */ jsx64("div", { className: "kjun-list-panel", "data-surface": listSectionSurface(surface).attribute, style: rounded, children: rows }) : rows,
|
|
15009
15171
|
note && /* @__PURE__ */ jsx64("div", { id: note, className: "kjun-list-footer", children: reorderDisabledText }),
|
|
15010
15172
|
hasFooter && /* @__PURE__ */ jsx64("div", { id: id + "-footer", className: "kjun-list-footer", children: footer }),
|
|
15011
15173
|
reorderable && /* @__PURE__ */ jsx64("span", { className: "kjun-sr-only", role: "status", children: reorder.said })
|
|
@@ -15036,6 +15198,7 @@ function revealDelta(itemStart, itemEnd, viewStart, viewEnd) {
|
|
|
15036
15198
|
if (itemEnd > viewEnd) return itemEnd - viewEnd;
|
|
15037
15199
|
return 0;
|
|
15038
15200
|
}
|
|
15201
|
+
var floatingBarEdge = (offset, safeBottom) => `calc(${offset}px + ${safeBottom})`;
|
|
15039
15202
|
|
|
15040
15203
|
// shared/package-runtime/side-navigation.ts
|
|
15041
15204
|
var isSideGroup = (entry) => "items" in entry;
|
|
@@ -15314,12 +15477,12 @@ function useBottomBar() {
|
|
|
15314
15477
|
useLayoutEffect25(() => trackBottomBar(bar), [bar]);
|
|
15315
15478
|
return [setBar, bar];
|
|
15316
15479
|
}
|
|
15317
|
-
function KjunBottomNavigation({ items, value, ariaLabel, safeArea = true, keyboardVisible = false, hideOnKeyboard = true, onNavigate, onReselect, surface = true, iconStyle = "auto", showLabels = true }) {
|
|
15480
|
+
function KjunBottomNavigation({ items, value, ariaLabel, safeArea = true, keyboardVisible = false, hideOnKeyboard = true, onNavigate, onReselect, surface = true, iconStyle = "auto", showLabels = true, sticky = false }) {
|
|
15318
15481
|
const m = useKjunMessages();
|
|
15319
15482
|
ariaLabel != null ? ariaLabel : ariaLabel = m.mainNavigation;
|
|
15320
15483
|
const layout = bottomNavigationLayout(items, showLabels), [bar] = useBottomBar();
|
|
15321
15484
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
15322
|
-
return /* @__PURE__ */ jsx65("nav", { ref: bar, className: "kjun-bottom-navigation", "data-icons": layout.hasIcons || void 0, "data-icon-style": iconStyle, "data-labels": layout.iconOnly ? "false" : void 0, "data-surface": surface ? void 0 : "false", "aria-label": ariaLabel, style: { paddingBottom: webSafeBottom(safeArea) }, children: items.map((item) => {
|
|
15485
|
+
return /* @__PURE__ */ jsx65("nav", { ref: bar, className: "kjun-bottom-navigation", "data-icons": layout.hasIcons || void 0, "data-icon-style": iconStyle, "data-labels": layout.iconOnly ? "false" : void 0, "data-surface": surface ? void 0 : "false", "data-sticky": sticky || void 0, "aria-label": ariaLabel, style: { paddingBottom: webSafeBottom(safeArea) }, children: items.map((item) => {
|
|
15323
15486
|
const selected = value === item.key, parts2 = layout.parts(item);
|
|
15324
15487
|
const badge = /* @__PURE__ */ jsx65(NavigationBadgeMark, { badge: item.badge });
|
|
15325
15488
|
return /* @__PURE__ */ jsxs58(Destination, { item, selected, onNavigate, onReselect, children: [
|
|
@@ -15334,7 +15497,7 @@ function KjunBottomNavigation({ items, value, ariaLabel, safeArea = true, keyboa
|
|
|
15334
15497
|
] }, item.key);
|
|
15335
15498
|
}) });
|
|
15336
15499
|
}
|
|
15337
|
-
function KjunFloatingNavigation({ items, value, ariaLabel, safeArea = true, keyboardVisible = false, hideOnKeyboard = true, onNavigate, onReselect }) {
|
|
15500
|
+
function KjunFloatingNavigation({ items, value, ariaLabel, safeArea = true, keyboardVisible = false, hideOnKeyboard = true, onNavigate, onReselect, sticky = false }) {
|
|
15338
15501
|
const m = useKjunMessages();
|
|
15339
15502
|
ariaLabel != null ? ariaLabel : ariaLabel = m.mainNavigation;
|
|
15340
15503
|
const geometry = tokens84.extensions.floatingNavigation;
|
|
@@ -15347,7 +15510,8 @@ function KjunFloatingNavigation({ items, value, ariaLabel, safeArea = true, keyb
|
|
|
15347
15510
|
if (delta) nav.scrollLeft += delta;
|
|
15348
15511
|
}, [nav, value, items.map((item) => item.key).join("\n")]);
|
|
15349
15512
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
15350
|
-
|
|
15513
|
+
const edge2 = floatingBarEdge(geometry.offset, webSafeBottom(safeArea));
|
|
15514
|
+
return /* @__PURE__ */ jsx65("nav", { ref: bar, className: "kjun-floating-navigation", "data-sticky": sticky || void 0, "aria-label": ariaLabel, style: { marginBottom: edge2, bottom: sticky ? edge2 : void 0 }, children: items.map((item) => {
|
|
15351
15515
|
const selected = value === item.key;
|
|
15352
15516
|
const badge = /* @__PURE__ */ jsx65(NavigationBadgeMark, { badge: item.badge });
|
|
15353
15517
|
return /* @__PURE__ */ jsx65(Destination, { item, selected, onNavigate, onReselect, children: item.icon ? /* @__PURE__ */ jsxs58("span", { className: "kjun-navigation-icon", children: [
|
|
@@ -15359,12 +15523,12 @@ function KjunFloatingNavigation({ items, value, ariaLabel, safeArea = true, keyb
|
|
|
15359
15523
|
] }) }, item.key);
|
|
15360
15524
|
}) });
|
|
15361
15525
|
}
|
|
15362
|
-
function KjunBottomActionBar({ description, children, safeArea = true, keyboardVisible = false, hideOnKeyboard = false, surface = true, variant = "docked", ariaLabel }) {
|
|
15526
|
+
function KjunBottomActionBar({ description, children, safeArea = true, keyboardVisible = false, hideOnKeyboard = false, surface = true, variant = "docked", ariaLabel, sticky = false }) {
|
|
15363
15527
|
const [bar] = useBottomBar();
|
|
15364
15528
|
if (keyboardVisible && hideOnKeyboard) return null;
|
|
15365
15529
|
const floating = variant === "floating", inset = floating ? tokens84.extensions.floatingNavigation.offset : tokens84.extensions.navigation.padding;
|
|
15366
15530
|
const actions = /* @__PURE__ */ jsx65("div", { className: "kjun-navigation-actions", children });
|
|
15367
|
-
return /* @__PURE__ */ jsx65("div", { ref: bar, className: "kjun-bottom-action-bar", role: ariaLabel ? "region" : void 0, "aria-label": ariaLabel, "data-variant": floating ? "floating" : void 0, "data-surface": surface ? void 0 : "false", style: { paddingBottom: `calc(${inset}px + ${webSafeBottom(safeArea)})` }, children: /* @__PURE__ */ jsxs58("div", { className: "kjun-bottom-action-content", children: [
|
|
15531
|
+
return /* @__PURE__ */ jsx65("div", { ref: bar, className: "kjun-bottom-action-bar", role: ariaLabel ? "region" : void 0, "aria-label": ariaLabel, "data-variant": floating ? "floating" : void 0, "data-surface": surface ? void 0 : "false", "data-sticky": sticky || void 0, style: { paddingBottom: `calc(${inset}px + ${webSafeBottom(safeArea)})` }, children: /* @__PURE__ */ jsxs58("div", { className: "kjun-bottom-action-content", children: [
|
|
15368
15532
|
description && /* @__PURE__ */ jsx65("p", { children: description }),
|
|
15369
15533
|
floating ? /* @__PURE__ */ jsx65(ActionSizeContext.Provider, { value: "lg", children: /* @__PURE__ */ jsx65(ActionShapeContext.Provider, { value: "pill", children: actions }) }) : actions
|
|
15370
15534
|
] }) });
|
|
@@ -15486,7 +15650,7 @@ function useSideNavigationState(items, value, lists) {
|
|
|
15486
15650
|
// packages/react/src/side-navigation.tsx
|
|
15487
15651
|
import { tokens as tokens85 } from "@kjun-ui/tokens";
|
|
15488
15652
|
import { useEffect as useEffect46, useId as useId26, useMemo as useMemo8, useRef as useRef54, useState as useState53 } from "react";
|
|
15489
|
-
import { Fragment as
|
|
15653
|
+
import { Fragment as Fragment38, jsx as jsx66, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
15490
15654
|
var FLYOUT = { collapsed: false, labelled: false, flyout: true };
|
|
15491
15655
|
var actionCount = (count) => ({ ["--_kjun-side-navigation-action-count"]: count });
|
|
15492
15656
|
function KjunSideNavigation({
|
|
@@ -15699,7 +15863,7 @@ function KjunSideNavigation({
|
|
|
15699
15863
|
onClick: flies || item.disabled ? void 0 : () => mode.collapsed ? reveal(item.key) : setParent(item.key, !state.shown),
|
|
15700
15864
|
"data-current-within": state.within ? "" : void 0,
|
|
15701
15865
|
children: [
|
|
15702
|
-
glyph(mode, item.icon, item.label, false, /* @__PURE__ */ jsxs59(
|
|
15866
|
+
glyph(mode, item.icon, item.label, false, /* @__PURE__ */ jsxs59(Fragment38, { children: [
|
|
15703
15867
|
state.dot && badge("", true, state.tone),
|
|
15704
15868
|
!item.disabled && opens
|
|
15705
15869
|
] })),
|
|
@@ -15750,7 +15914,7 @@ function KjunSideNavigation({
|
|
|
15750
15914
|
const set = (next) => {
|
|
15751
15915
|
if (shown !== next) updateGroups(toggleSideParent(openGroups, section2.key));
|
|
15752
15916
|
};
|
|
15753
|
-
return /* @__PURE__ */ jsxs59(
|
|
15917
|
+
return /* @__PURE__ */ jsxs59(Fragment38, { children: [
|
|
15754
15918
|
heading(section2, /* @__PURE__ */ jsx66(Heading2, { className: "kjun-side-navigation-title-heading", children: /* @__PURE__ */ jsxs59(
|
|
15755
15919
|
"button",
|
|
15756
15920
|
{
|
|
@@ -15779,7 +15943,7 @@ function KjunSideNavigation({
|
|
|
15779
15943
|
const rows = groupRows(base, entry);
|
|
15780
15944
|
if (!isTitledSection(entry)) return /* @__PURE__ */ jsx66("ul", { children: rows }, "loose:" + ((_b = (_a = entry.items[0]) == null ? void 0 : _a.key) != null ? _b : index));
|
|
15781
15945
|
const toggled = !collapsed && sideSectionToggles(entry, collapsibleGroups);
|
|
15782
|
-
return /* @__PURE__ */ jsx66("div", { className: "kjun-side-navigation-section", role: "group", "aria-labelledby": titleId(entry.key), "data-toggles": toggled ? "" : void 0, children: toggled ? groupToggle(entry, rows) : /* @__PURE__ */ jsxs59(
|
|
15946
|
+
return /* @__PURE__ */ jsx66("div", { className: "kjun-side-navigation-section", role: "group", "aria-labelledby": titleId(entry.key), "data-toggles": toggled ? "" : void 0, children: toggled ? groupToggle(entry, rows) : /* @__PURE__ */ jsxs59(Fragment38, { children: [
|
|
15783
15947
|
heading(entry, /* @__PURE__ */ jsx66(Heading2, { id: titleId(entry.key), className: "kjun-side-navigation-title" + (collapsed ? " kjun-sr-only" : ""), children: entry.title })),
|
|
15784
15948
|
/* @__PURE__ */ jsx66("ul", { children: rows })
|
|
15785
15949
|
] }) }, "group:" + entry.key);
|
|
@@ -15797,7 +15961,7 @@ function KjunSideNavigation({
|
|
|
15797
15961
|
onKeyDown: flyoutMode ? openOnArrow(key) : void 0,
|
|
15798
15962
|
onClick: flyoutMode ? void 0 : () => revealGroup(group.key),
|
|
15799
15963
|
children: [
|
|
15800
|
-
glyph(base, group.icon, group.title, false, /* @__PURE__ */ jsxs59(
|
|
15964
|
+
glyph(base, group.icon, group.title, false, /* @__PURE__ */ jsxs59(Fragment38, { children: [
|
|
15801
15965
|
dot && badge("", true, tone),
|
|
15802
15966
|
opens
|
|
15803
15967
|
] })),
|
|
@@ -15839,9 +16003,135 @@ function KjunSideNavigation({
|
|
|
15839
16003
|
}
|
|
15840
16004
|
|
|
15841
16005
|
// packages/react/src/side-navigation-layout.tsx
|
|
16006
|
+
import { tokens as tokens87 } from "@kjun-ui/tokens";
|
|
16007
|
+
import { useCallback as useCallback14, useEffect as useEffect48, useRef as useRef56, useSyncExternalStore as useSyncExternalStore6 } from "react";
|
|
16008
|
+
|
|
16009
|
+
// shared/package-runtime/side-navigation-layout.ts
|
|
16010
|
+
function spacesRailCellWidth(geometry) {
|
|
16011
|
+
return geometry.paddingX * 2 + geometry.iconSize + geometry.spacesRailPaddingX * 2;
|
|
16012
|
+
}
|
|
16013
|
+
function spacesColumnWidth(geometry, surface, panelCollapsed) {
|
|
16014
|
+
const rail = spacesRailCellWidth(geometry);
|
|
16015
|
+
if (panelCollapsed) return rail;
|
|
16016
|
+
return rail + geometry.spacesPanelWidth + (surface === "card" ? geometry.spacesPanelInset : 0);
|
|
16017
|
+
}
|
|
16018
|
+
function spacesFocusAfterChange(nextCollapsed, focusInPanel, byButton) {
|
|
16019
|
+
if (nextCollapsed) return focusInPanel || byButton ? "expand" : null;
|
|
16020
|
+
return byButton ? "collapse" : null;
|
|
16021
|
+
}
|
|
16022
|
+
function spacesIgnoredProps(props) {
|
|
16023
|
+
const ignored = [];
|
|
16024
|
+
if (props.collapsed) ignored.push("collapsed");
|
|
16025
|
+
if (props.railLabels) ignored.push("railLabels");
|
|
16026
|
+
if (props.width !== void 0 && props.width !== "md") ignored.push("width");
|
|
16027
|
+
return ignored;
|
|
16028
|
+
}
|
|
16029
|
+
|
|
16030
|
+
// packages/react/src/side-navigation-layout-spaces.tsx
|
|
15842
16031
|
import { tokens as tokens86 } from "@kjun-ui/tokens";
|
|
15843
|
-
import {
|
|
15844
|
-
import { jsx as jsx67, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
16032
|
+
import { useEffect as useEffect47, useId as useId27, useRef as useRef55, useState as useState54 } from "react";
|
|
16033
|
+
import { Fragment as Fragment39, jsx as jsx67, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
16034
|
+
function SpacesLayout(p) {
|
|
16035
|
+
var _a;
|
|
16036
|
+
const m = useKjunMessages(), reduced = useReducedMotion(), panelId = "kjun-side-panel-" + useId27().replace(/[^\w-]/g, "");
|
|
16037
|
+
const panel = useRef55(null), expand = useRef55(null), collapse = useRef55(null);
|
|
16038
|
+
const [settled, setSettled] = useState54(p.panelCollapsed);
|
|
16039
|
+
const byButton = useRef55(false), first = useRef55(true);
|
|
16040
|
+
useEffect47(() => {
|
|
16041
|
+
var _a2, _b;
|
|
16042
|
+
if (first.current) {
|
|
16043
|
+
first.current = false;
|
|
16044
|
+
return;
|
|
16045
|
+
}
|
|
16046
|
+
const inPanel = !!panel.current && panel.current.contains(document.activeElement);
|
|
16047
|
+
const target = spacesFocusAfterChange(p.panelCollapsed, inPanel, byButton.current);
|
|
16048
|
+
byButton.current = false;
|
|
16049
|
+
if (target === "expand") (_a2 = expand.current) == null ? void 0 : _a2.focus();
|
|
16050
|
+
else if (target === "collapse") (_b = collapse.current) == null ? void 0 : _b.focus();
|
|
16051
|
+
if (!p.panelCollapsed) {
|
|
16052
|
+
setSettled(false);
|
|
16053
|
+
return;
|
|
16054
|
+
}
|
|
16055
|
+
const timer = setTimeout(() => setSettled(true), reduced ? 0 : tokens86.motion.collapse);
|
|
16056
|
+
return () => clearTimeout(timer);
|
|
16057
|
+
}, [p.panelCollapsed]);
|
|
16058
|
+
const request = (next) => {
|
|
16059
|
+
var _a2;
|
|
16060
|
+
byButton.current = true;
|
|
16061
|
+
(_a2 = p.onPanelCollapsedChange) == null ? void 0 : _a2.call(p, next);
|
|
16062
|
+
};
|
|
16063
|
+
const render = (slot, state) => typeof slot === "function" ? slot(state) : slot;
|
|
16064
|
+
const toggle = (next, ref) => {
|
|
16065
|
+
const label = next ? m.collapseSpacesPanel : m.expandSpacesPanel;
|
|
16066
|
+
return /* @__PURE__ */ jsx67(KjunTooltip, { content: label, placement: "right", children: /* @__PURE__ */ jsx67(
|
|
16067
|
+
"button",
|
|
16068
|
+
{
|
|
16069
|
+
ref,
|
|
16070
|
+
type: "button",
|
|
16071
|
+
className: "kjun-side-navigation-toggle kjun-side-navigation-layout-panel-toggle",
|
|
16072
|
+
"aria-label": label,
|
|
16073
|
+
"aria-expanded": !p.panelCollapsed,
|
|
16074
|
+
"aria-controls": panelId,
|
|
16075
|
+
onClick: () => request(next),
|
|
16076
|
+
children: /* @__PURE__ */ jsx67(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ jsx67(KjunIcon, { name: next ? "layout-sidebar-left-collapse" : "layout-sidebar-left-expand", size: tokens86.extensions.sideNavigation.iconSize }) })
|
|
16077
|
+
}
|
|
16078
|
+
) });
|
|
16079
|
+
};
|
|
16080
|
+
const band = (drawer) => {
|
|
16081
|
+
var _a2;
|
|
16082
|
+
const closed = !drawer && p.panelCollapsed;
|
|
16083
|
+
return /* @__PURE__ */ jsxs60(Fragment39, { children: [
|
|
16084
|
+
/* @__PURE__ */ jsxs60("div", { className: "kjun-side-navigation-layout-spaces", children: [
|
|
16085
|
+
/* @__PURE__ */ jsx67("div", { className: "kjun-side-navigation-layout-spaces-top", children: closed && toggle(false, expand) }),
|
|
16086
|
+
render(p.spaces, { collapsed: true, drawer, closeDrawer: p.closeDrawer })
|
|
16087
|
+
] }),
|
|
16088
|
+
/* @__PURE__ */ jsxs60("section", { ref: panel, id: panelId, className: "kjun-side-navigation-layout-panel", "aria-label": (_a2 = p.panelLabel) != null ? _a2 : m.spacesPanel, hidden: closed && settled, children: [
|
|
16089
|
+
/* @__PURE__ */ jsxs60("div", { className: "kjun-side-navigation-layout-panel-head", children: [
|
|
16090
|
+
p.spacesTitle != null && p.spacesTitle !== false && p.spacesTitle !== "" && /* @__PURE__ */ jsx67("div", { className: "kjun-side-navigation-layout-panel-title", children: p.spacesTitle }),
|
|
16091
|
+
drawer ? /* @__PURE__ */ jsx67("button", { type: "button", className: "kjun-side-navigation-toggle kjun-side-navigation-layout-panel-toggle", "aria-label": m.close, onClick: p.closeDrawer, children: /* @__PURE__ */ jsx67(KjunIcon, { name: "x", size: tokens86.extensions.sideNavigation.iconSize }) }) : (!closed || !settled) && toggle(true, collapse)
|
|
16092
|
+
] }),
|
|
16093
|
+
render(p.nav, { collapsed: false, drawer, closeDrawer: p.closeDrawer })
|
|
16094
|
+
] })
|
|
16095
|
+
] });
|
|
16096
|
+
};
|
|
16097
|
+
if (p.narrow) return /* @__PURE__ */ jsxs60("div", { className: p.classes, "data-drawer": "", children: [
|
|
16098
|
+
/* @__PURE__ */ jsx67("div", { className: "kjun-side-navigation-layout-main", children: p.children }),
|
|
16099
|
+
/* @__PURE__ */ jsx67(
|
|
16100
|
+
KjunDrawer,
|
|
16101
|
+
{
|
|
16102
|
+
open: p.navOpen,
|
|
16103
|
+
onOpenChange: (next) => {
|
|
16104
|
+
var _a2;
|
|
16105
|
+
return (_a2 = p.onNavOpenChange) == null ? void 0 : _a2.call(p, next);
|
|
16106
|
+
},
|
|
16107
|
+
position: "left",
|
|
16108
|
+
ariaLabel: (_a = p.drawerLabel) != null ? _a : m.mainNavigation,
|
|
16109
|
+
width: spacesColumnWidth(tokens86.extensions.sideNavigation, p.panelSurface, false),
|
|
16110
|
+
closable: false,
|
|
16111
|
+
noPadding: true,
|
|
16112
|
+
children: /* @__PURE__ */ jsx67("div", { className: "kjun-side-navigation-layout-band", "data-panel-surface": p.panelSurface, children: band(true) })
|
|
16113
|
+
}
|
|
16114
|
+
)
|
|
16115
|
+
] });
|
|
16116
|
+
return /* @__PURE__ */ jsxs60(
|
|
16117
|
+
"div",
|
|
16118
|
+
{
|
|
16119
|
+
className: p.classes,
|
|
16120
|
+
"data-spaces": "",
|
|
16121
|
+
"data-panel-surface": p.panelSurface,
|
|
16122
|
+
"data-panel-collapsed": p.panelCollapsed ? "" : void 0,
|
|
16123
|
+
"data-sticky": p.sticky ? void 0 : "false",
|
|
16124
|
+
style: p.offset,
|
|
16125
|
+
children: [
|
|
16126
|
+
/* @__PURE__ */ jsx67("div", { className: "kjun-side-navigation-layout-nav", children: band(false) }),
|
|
16127
|
+
/* @__PURE__ */ jsx67("div", { className: "kjun-side-navigation-layout-main", children: p.children })
|
|
16128
|
+
]
|
|
16129
|
+
}
|
|
16130
|
+
);
|
|
16131
|
+
}
|
|
16132
|
+
|
|
16133
|
+
// packages/react/src/side-navigation-layout.tsx
|
|
16134
|
+
import { jsx as jsx68, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
15845
16135
|
var subscribeTo = (query2) => (notify) => {
|
|
15846
16136
|
if (typeof matchMedia !== "function") return () => {
|
|
15847
16137
|
};
|
|
@@ -15851,7 +16141,7 @@ var subscribeTo = (query2) => (notify) => {
|
|
|
15851
16141
|
};
|
|
15852
16142
|
function useNarrow(breakpoint) {
|
|
15853
16143
|
const query2 = `(width < ${breakpoint}px)`;
|
|
15854
|
-
const subscribe2 =
|
|
16144
|
+
const subscribe2 = useCallback14(subscribeTo(query2), [query2]);
|
|
15855
16145
|
return useSyncExternalStore6(subscribe2, () => breakpoint > 0 && typeof matchMedia === "function" && matchMedia(query2).matches, () => false);
|
|
15856
16146
|
}
|
|
15857
16147
|
function KjunSideNavigationLayout({
|
|
@@ -15864,23 +16154,40 @@ function KjunSideNavigationLayout({
|
|
|
15864
16154
|
width = "md",
|
|
15865
16155
|
sticky = true,
|
|
15866
16156
|
stickyOffset = 0,
|
|
15867
|
-
breakpoint =
|
|
16157
|
+
breakpoint = tokens87.responsive.sideNavigationLayout,
|
|
15868
16158
|
navOpen = false,
|
|
15869
16159
|
onNavOpenChange,
|
|
15870
16160
|
drawerLabel,
|
|
16161
|
+
spaces,
|
|
16162
|
+
spacesTitle,
|
|
16163
|
+
panelSurface = "card",
|
|
16164
|
+
panelCollapsed = false,
|
|
16165
|
+
onPanelCollapsedChange,
|
|
16166
|
+
panelLabel,
|
|
15871
16167
|
className
|
|
15872
16168
|
}) {
|
|
15873
16169
|
const m = useKjunMessages(), narrow = useNarrow(breakpoint), below = useNarrow(railBreakpoint);
|
|
15874
|
-
const
|
|
15875
|
-
|
|
15876
|
-
const
|
|
15877
|
-
|
|
16170
|
+
const spaced = spaces != null && spaces !== false;
|
|
16171
|
+
const folded = spaced ? panelCollapsed : collapsed, onFold = spaced ? onPanelCollapsedChange : onCollapsedChange;
|
|
16172
|
+
const latest = useRef56({ collapsed: folded, navOpen, onCollapsedChange: onFold, onNavOpenChange });
|
|
16173
|
+
latest.current = { collapsed: folded, navOpen, onCollapsedChange: onFold, onNavOpenChange };
|
|
16174
|
+
const warned4 = useRef56(false);
|
|
16175
|
+
useEffect48(() => {
|
|
16176
|
+
if (!spaced || warned4.current || !developmentMode9()) return;
|
|
16177
|
+
const ignored = spacesIgnoredProps({ collapsed, railLabels, width });
|
|
16178
|
+
if (ignored.length > 0) {
|
|
16179
|
+
warned4.current = true;
|
|
16180
|
+
console.warn(`KjunSideNavigationLayout: ${ignored.join(", ")} do not apply with spaces.`);
|
|
16181
|
+
}
|
|
16182
|
+
}, [spaced, collapsed, railLabels, width]);
|
|
16183
|
+
const wasNarrow = useRef56(narrow);
|
|
16184
|
+
useEffect48(() => {
|
|
15878
16185
|
var _a, _b;
|
|
15879
16186
|
if (wasNarrow.current && !narrow && latest.current.navOpen) (_b = (_a = latest.current).onNavOpenChange) == null ? void 0 : _b.call(_a, false);
|
|
15880
16187
|
wasNarrow.current = narrow;
|
|
15881
16188
|
}, [narrow]);
|
|
15882
|
-
const wasBelow =
|
|
15883
|
-
|
|
16189
|
+
const wasBelow = useRef56(null);
|
|
16190
|
+
useEffect48(() => {
|
|
15884
16191
|
var _a, _b;
|
|
15885
16192
|
if (railBreakpoint <= 0) {
|
|
15886
16193
|
wasBelow.current = null;
|
|
@@ -15896,22 +16203,43 @@ function KjunSideNavigationLayout({
|
|
|
15896
16203
|
};
|
|
15897
16204
|
const menu = (state) => typeof nav === "function" ? nav({ ...state, closeDrawer }) : nav;
|
|
15898
16205
|
const classes = "kjun-side-navigation-layout" + (className ? " " + className : "");
|
|
15899
|
-
|
|
15900
|
-
|
|
15901
|
-
|
|
16206
|
+
const offset = sticky && stickyOffset > 0 ? { ["--_kjun-side-navigation-layout-top"]: stickyOffset + "px" } : void 0;
|
|
16207
|
+
if (spaced) return /* @__PURE__ */ jsx68(
|
|
16208
|
+
SpacesLayout,
|
|
16209
|
+
{
|
|
16210
|
+
spaces,
|
|
16211
|
+
nav,
|
|
16212
|
+
spacesTitle,
|
|
16213
|
+
panelSurface,
|
|
16214
|
+
panelCollapsed,
|
|
16215
|
+
onPanelCollapsedChange,
|
|
16216
|
+
panelLabel,
|
|
16217
|
+
narrow,
|
|
16218
|
+
navOpen,
|
|
16219
|
+
onNavOpenChange,
|
|
16220
|
+
closeDrawer,
|
|
16221
|
+
drawerLabel,
|
|
16222
|
+
sticky,
|
|
16223
|
+
offset,
|
|
16224
|
+
classes,
|
|
16225
|
+
children
|
|
16226
|
+
}
|
|
16227
|
+
);
|
|
16228
|
+
if (narrow) return /* @__PURE__ */ jsxs61("div", { className: classes, "data-drawer": "", children: [
|
|
16229
|
+
/* @__PURE__ */ jsx68("div", { className: "kjun-side-navigation-layout-main", children }),
|
|
16230
|
+
/* @__PURE__ */ jsx68(
|
|
15902
16231
|
KjunDrawer,
|
|
15903
16232
|
{
|
|
15904
16233
|
open: navOpen,
|
|
15905
16234
|
onOpenChange: (next) => onNavOpenChange == null ? void 0 : onNavOpenChange(next),
|
|
15906
16235
|
position: "left",
|
|
15907
16236
|
ariaLabel: drawerLabel != null ? drawerLabel : m.mainNavigation,
|
|
15908
|
-
width:
|
|
16237
|
+
width: tokens87.extensions.sideNavigation.width[width],
|
|
15909
16238
|
children: menu({ collapsed: false, drawer: true })
|
|
15910
16239
|
}
|
|
15911
16240
|
)
|
|
15912
16241
|
] });
|
|
15913
|
-
|
|
15914
|
-
return /* @__PURE__ */ jsxs60(
|
|
16242
|
+
return /* @__PURE__ */ jsxs61(
|
|
15915
16243
|
"div",
|
|
15916
16244
|
{
|
|
15917
16245
|
className: classes,
|
|
@@ -15921,8 +16249,8 @@ function KjunSideNavigationLayout({
|
|
|
15921
16249
|
"data-sticky": sticky ? void 0 : "false",
|
|
15922
16250
|
style: offset,
|
|
15923
16251
|
children: [
|
|
15924
|
-
/* @__PURE__ */
|
|
15925
|
-
/* @__PURE__ */
|
|
16252
|
+
/* @__PURE__ */ jsx68("div", { className: "kjun-side-navigation-layout-nav", children: menu({ collapsed, drawer: false }) }),
|
|
16253
|
+
/* @__PURE__ */ jsx68("div", { className: "kjun-side-navigation-layout-main", children })
|
|
15926
16254
|
]
|
|
15927
16255
|
}
|
|
15928
16256
|
);
|
|
@@ -15930,10 +16258,10 @@ function KjunSideNavigationLayout({
|
|
|
15930
16258
|
|
|
15931
16259
|
// packages/react/src/pressable.tsx
|
|
15932
16260
|
import { forwardRef as forwardRef8 } from "react";
|
|
15933
|
-
import { jsx as
|
|
16261
|
+
import { jsx as jsx69 } from "react/jsx-runtime";
|
|
15934
16262
|
var KjunPressable = forwardRef8(function KjunPressable2({ ariaLabel, disabled = false, pressEffect = "overlay", focusRingInset = false, className, children, onClick, onKeyDown, onKeyUp, ...props }, ref) {
|
|
15935
16263
|
var _a;
|
|
15936
|
-
return /* @__PURE__ */
|
|
16264
|
+
return /* @__PURE__ */ jsx69(
|
|
15937
16265
|
"div",
|
|
15938
16266
|
{
|
|
15939
16267
|
role: "button",
|
|
@@ -15966,14 +16294,14 @@ var KjunPressable = forwardRef8(function KjunPressable2({ ariaLabel, disabled =
|
|
|
15966
16294
|
});
|
|
15967
16295
|
|
|
15968
16296
|
// packages/react/src/media.tsx
|
|
15969
|
-
import { useRef as
|
|
15970
|
-
import { tokens as
|
|
15971
|
-
import { Fragment as
|
|
16297
|
+
import { useRef as useRef57, useState as useState55 } from "react";
|
|
16298
|
+
import { tokens as tokens88 } from "@kjun-ui/tokens";
|
|
16299
|
+
import { Fragment as Fragment40, jsx as jsx70, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
15972
16300
|
function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover", shape = "square", fallback: fallback2, lazy = true, onLoad, onError }) {
|
|
15973
|
-
const current =
|
|
16301
|
+
const current = useRef57({ src, version: 0 });
|
|
15974
16302
|
if (current.current.src !== src) current.current = { src, version: current.current.version + 1 };
|
|
15975
16303
|
const version = current.current.version;
|
|
15976
|
-
const [result, setResult] =
|
|
16304
|
+
const [result, setResult] = useState55({ version, state: "loading" });
|
|
15977
16305
|
const state = result.version === version ? result.state : "loading";
|
|
15978
16306
|
const failed = !src || state === "error";
|
|
15979
16307
|
const auto = aspectRatio === "auto";
|
|
@@ -15983,7 +16311,7 @@ function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover
|
|
|
15983
16311
|
if (next === "loaded") onLoad == null ? void 0 : onLoad();
|
|
15984
16312
|
else onError == null ? void 0 : onError();
|
|
15985
16313
|
};
|
|
15986
|
-
const settled =
|
|
16314
|
+
const settled = useRef57(-1);
|
|
15987
16315
|
const seen = (img) => {
|
|
15988
16316
|
if (!img || !img.complete || settled.current === version) return;
|
|
15989
16317
|
settled.current = version;
|
|
@@ -15995,7 +16323,7 @@ function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover
|
|
|
15995
16323
|
settle(next);
|
|
15996
16324
|
};
|
|
15997
16325
|
const textual = typeof fallback2 === "string" || typeof fallback2 === "number";
|
|
15998
|
-
return /* @__PURE__ */
|
|
16326
|
+
return /* @__PURE__ */ jsxs62(
|
|
15999
16327
|
"span",
|
|
16000
16328
|
{
|
|
16001
16329
|
className: "kjun-image",
|
|
@@ -16005,20 +16333,20 @@ function KjunImage({ src, alt, decorative = false, aspectRatio = 1, fit = "cover
|
|
|
16005
16333
|
"data-ratio": auto ? "auto" : void 0,
|
|
16006
16334
|
"data-fallback": failed && textual ? "text" : void 0,
|
|
16007
16335
|
children: [
|
|
16008
|
-
!failed && /* @__PURE__ */
|
|
16009
|
-
failed && /* @__PURE__ */
|
|
16010
|
-
/* @__PURE__ */
|
|
16011
|
-
/* @__PURE__ */
|
|
16012
|
-
] }) : fallback2 != null ? fallback2 : /* @__PURE__ */
|
|
16336
|
+
!failed && /* @__PURE__ */ jsx70("img", { ref: seen, src, alt: decorative ? "" : alt, loading: lazy ? "lazy" : "eager", style: { objectFit: fit }, onLoad: () => load("loaded"), onError: () => load("error") }, version),
|
|
16337
|
+
failed && /* @__PURE__ */ jsx70("span", { className: "kjun-image-fallback", "data-text": textual ? "" : void 0, role: decorative ? void 0 : "img", "aria-label": decorative ? void 0 : alt, "aria-hidden": decorative || void 0, children: textual ? /* @__PURE__ */ jsxs62(Fragment40, { children: [
|
|
16338
|
+
/* @__PURE__ */ jsx70(KjunIcon, { name: "photo", size: tokens88.extensions.image.fallbackIconSize }),
|
|
16339
|
+
/* @__PURE__ */ jsx70("span", { className: "kjun-image-fallback-text", children: fallback2 })
|
|
16340
|
+
] }) : fallback2 != null ? fallback2 : /* @__PURE__ */ jsx70(KjunIcon, { name: "photo", size: tokens88.extensions.image.fallbackIconSize }) })
|
|
16013
16341
|
]
|
|
16014
16342
|
}
|
|
16015
16343
|
);
|
|
16016
16344
|
}
|
|
16017
16345
|
function KjunAvatar({ src, name = "", alt, decorative = false, size = "md", shape = "circle", color, textColor, fallback: fallback2, onLoad, onError }) {
|
|
16018
16346
|
const m = useKjunMessages();
|
|
16019
|
-
return /* @__PURE__ */
|
|
16347
|
+
return /* @__PURE__ */ jsx70("span", { className: "kjun-avatar", "data-shape": shape, "data-size": size, style: { width: tokens88.extensions.avatar[size], height: tokens88.extensions.avatar[size], ["--_kjun-avatar-color"]: color, ["--_kjun-avatar-text-color"]: textColor }, children: /* @__PURE__ */ jsx70(KjunImage, { src, alt: alt || name || m.user, decorative, fallback: (
|
|
16020
16348
|
/* A span, so the image does not treat initials as a text caption. */
|
|
16021
|
-
/* @__PURE__ */
|
|
16349
|
+
/* @__PURE__ */ jsx70("span", { children: fallback2 != null ? fallback2 : Array.from(name.trim())[0] || /* @__PURE__ */ jsx70(KjunIcon, { name: "user", size: tokens88.extensions.avatar.fallbackIconSizes[size] }) })
|
|
16022
16350
|
), onLoad, onError }) });
|
|
16023
16351
|
}
|
|
16024
16352
|
|
|
@@ -16039,54 +16367,54 @@ function avatarGroupModel({ count, max = DEFAULT_MAX, total, size }) {
|
|
|
16039
16367
|
}
|
|
16040
16368
|
|
|
16041
16369
|
// packages/react/src/avatar-group.tsx
|
|
16042
|
-
import { Fragment as
|
|
16370
|
+
import { Fragment as Fragment41, jsx as jsx71, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
16043
16371
|
var KjunAvatarGroup = forwardRef9(function KjunAvatarGroup2({ items, max, total, size = "md", shape = "circle", ariaLabel, ringColor, pressable = false, disabled = false, onClick, className, style, id, "aria-describedby": describedBy }, ref) {
|
|
16044
16372
|
const m = useKjunMessages();
|
|
16045
16373
|
const { visible, overflowText, totalCount } = avatarGroupModel({ count: items.length, max, total, size });
|
|
16046
16374
|
const label = ariaLabel != null ? ariaLabel : m.avatarGroupCount(totalCount);
|
|
16047
16375
|
const rootStyle = ringColor === void 0 ? style : { ...style, ["--_kjun-avatar-group-ring"]: ringColor };
|
|
16048
|
-
const content = /* @__PURE__ */
|
|
16049
|
-
items.slice(0, visible).map(({ key, ...item }, index) => /* @__PURE__ */
|
|
16050
|
-
overflowText && /* @__PURE__ */
|
|
16376
|
+
const content = /* @__PURE__ */ jsxs63(Fragment41, { children: [
|
|
16377
|
+
items.slice(0, visible).map(({ key, ...item }, index) => /* @__PURE__ */ jsx71("span", { className: "kjun-avatar-group-item", "aria-hidden": "true", style: { zIndex: visible + 1 - index }, children: /* @__PURE__ */ jsx71(KjunAvatar, { ...item, size, shape, decorative: true }) }, key)),
|
|
16378
|
+
overflowText && /* @__PURE__ */ jsx71("span", { className: "kjun-avatar-group-item kjun-avatar-group-overflow", "aria-hidden": "true", "data-digits": overflowText.length - 1, style: { zIndex: 0 }, children: overflowText })
|
|
16051
16379
|
] });
|
|
16052
16380
|
const classes = className ? `kjun-avatar-group ${className}` : "kjun-avatar-group";
|
|
16053
|
-
return pressable ? /* @__PURE__ */
|
|
16381
|
+
return pressable ? /* @__PURE__ */ jsx71("button", { ref, id, "aria-describedby": describedBy, type: "button", className: classes, "data-pressable": "", "data-size": size, "data-shape": shape, "aria-label": label, disabled, onClick, style: rootStyle, children: content }) : /* @__PURE__ */ jsx71("div", { ref, id, "aria-describedby": describedBy, className: classes, role: "img", "data-size": size, "data-shape": shape, "aria-label": label, style: rootStyle, children: content });
|
|
16054
16382
|
});
|
|
16055
16383
|
|
|
16056
16384
|
// packages/react/src/chip.tsx
|
|
16057
16385
|
import { forwardRef as forwardRef10 } from "react";
|
|
16058
16386
|
|
|
16059
16387
|
// shared/package-runtime/chip-size.ts
|
|
16060
|
-
import { tokens as
|
|
16388
|
+
import { tokens as tokens89 } from "@kjun-ui/tokens";
|
|
16061
16389
|
function chipSize(size) {
|
|
16062
|
-
return typeof size === "string" && Object.prototype.hasOwnProperty.call(
|
|
16390
|
+
return typeof size === "string" && Object.prototype.hasOwnProperty.call(tokens89.extensions.chip.typography, size) ? size : "md";
|
|
16063
16391
|
}
|
|
16064
16392
|
|
|
16065
16393
|
// packages/react/src/chip.tsx
|
|
16066
|
-
import { tokens as
|
|
16067
|
-
import { jsx as
|
|
16394
|
+
import { tokens as tokens90 } from "@kjun-ui/tokens";
|
|
16395
|
+
import { jsx as jsx72, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
16068
16396
|
var KjunChip = forwardRef10(function KjunChip2({ label, icon: icon2, removable = false, disabled = false, size: requested = "md", removeLabel: removeLabel2, onRemove, className, ...props }, ref) {
|
|
16069
16397
|
const m = useKjunMessages(), size = chipSize(requested);
|
|
16070
|
-
return /* @__PURE__ */
|
|
16071
|
-
icon2 && /* @__PURE__ */
|
|
16072
|
-
/* @__PURE__ */
|
|
16073
|
-
removable && /* @__PURE__ */
|
|
16398
|
+
return /* @__PURE__ */ jsxs64("span", { ...props, className: "kjun-chip" + (className ? " " + className : ""), "data-size": size, "data-disabled": disabled, "data-removable": removable, "aria-disabled": disabled && !removable ? true : void 0, children: [
|
|
16399
|
+
icon2 && /* @__PURE__ */ jsx72(KjunIcon, { name: icon2, size: tokens90.extensions.chip.iconSizes[size] }),
|
|
16400
|
+
/* @__PURE__ */ jsx72("span", { title: label, children: label }),
|
|
16401
|
+
removable && /* @__PURE__ */ jsx72("button", { ref, type: "button", "aria-label": removeLabel2 || m.remove(label), disabled, onClick: () => onRemove == null ? void 0 : onRemove(), children: /* @__PURE__ */ jsx72(KjunIcon, { name: "x", size: tokens90.extensions.chip.removeIconSizes[size] }) })
|
|
16074
16402
|
] });
|
|
16075
16403
|
});
|
|
16076
16404
|
|
|
16077
16405
|
// packages/react/src/fab.tsx
|
|
16078
|
-
import { tokens as
|
|
16079
|
-
import { forwardRef as forwardRef11, useEffect as
|
|
16080
|
-
import { jsx as
|
|
16406
|
+
import { tokens as tokens91 } from "@kjun-ui/tokens";
|
|
16407
|
+
import { forwardRef as forwardRef11, useEffect as useEffect49 } from "react";
|
|
16408
|
+
import { jsx as jsx73, jsxs as jsxs65 } from "react/jsx-runtime";
|
|
16081
16409
|
var KjunFab = forwardRef11(function KjunFab2({ icon: icon2, label, collapsed = false, ariaLabel, size = "md", loading = false, disabled = false, safeArea = true, avoidBottomBar = true, offsetBottom = 0, onClick, className = "", style, ...rest }, ref) {
|
|
16082
16410
|
const busy = useMinimumLoading(loading), offset = fabOffset(offsetBottom);
|
|
16083
|
-
const iconSize = size === "sm" ?
|
|
16411
|
+
const iconSize = size === "sm" ? tokens91.extensions.fab.smallIconSize : tokens91.extensions.fab.iconSize;
|
|
16084
16412
|
const name = ariaLabel || rest["aria-label"];
|
|
16085
|
-
|
|
16413
|
+
useEffect49(() => {
|
|
16086
16414
|
const warning = developmentMode9() && fabNameWarning(label, name);
|
|
16087
16415
|
if (warning) console.warn(warning);
|
|
16088
16416
|
}, [label, name]);
|
|
16089
|
-
return /* @__PURE__ */
|
|
16417
|
+
return /* @__PURE__ */ jsxs65(
|
|
16090
16418
|
"button",
|
|
16091
16419
|
{
|
|
16092
16420
|
...rest,
|
|
@@ -16106,8 +16434,8 @@ var KjunFab = forwardRef11(function KjunFab2({ icon: icon2, label, collapsed = f
|
|
|
16106
16434
|
},
|
|
16107
16435
|
style: { ...offset ? { "--_kjun-fab-offset": offset + "px" } : {}, ...style },
|
|
16108
16436
|
children: [
|
|
16109
|
-
busy ? /* @__PURE__ */
|
|
16110
|
-
label && /* @__PURE__ */
|
|
16437
|
+
busy ? /* @__PURE__ */ jsx73(KjunSpinnerGlyph, { size: iconSize }) : /* @__PURE__ */ jsx73(KjunIcon, { name: icon2, size: iconSize }),
|
|
16438
|
+
label && /* @__PURE__ */ jsx73("span", { className: "kjun-fab-label", children: /* @__PURE__ */ jsx73("span", { children: label }) })
|
|
16111
16439
|
]
|
|
16112
16440
|
}
|
|
16113
16441
|
);
|
|
@@ -16293,14 +16621,14 @@ function createSliderSession(initial, options) {
|
|
|
16293
16621
|
}
|
|
16294
16622
|
|
|
16295
16623
|
// packages/react/src/range-input.tsx
|
|
16296
|
-
import { useContext as useContext19, useEffect as
|
|
16624
|
+
import { useContext as useContext19, useEffect as useEffect50, useLayoutEffect as useLayoutEffect26, useRef as useRef58, useState as useState56 } from "react";
|
|
16297
16625
|
import { Slider, SliderTrack, SliderThumb, Label, SliderOutput, SliderStateContext, useLocale as useLocale2 } from "react-aria-components";
|
|
16298
16626
|
import { createSliderDomain } from "@kjun-ui/tokens";
|
|
16299
|
-
import { Fragment as
|
|
16627
|
+
import { Fragment as Fragment42, jsx as jsx74, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
16300
16628
|
var edge = "calc(var(--_kjun-slider-thumb) / -2)";
|
|
16301
16629
|
function RangeThumb({ index, label, name, format: format2, front, dragging, bubble, inputs }) {
|
|
16302
16630
|
const state = useContext19(SliderStateContext);
|
|
16303
|
-
const input =
|
|
16631
|
+
const input = useRef58(null), thumb2 = useRef58(null);
|
|
16304
16632
|
const text = format2(state.values[index]);
|
|
16305
16633
|
useLayoutEffect26(() => {
|
|
16306
16634
|
var _a, _b;
|
|
@@ -16308,7 +16636,7 @@ function RangeThumb({ index, label, name, format: format2, front, dragging, bubb
|
|
|
16308
16636
|
inputs[index] = input.current;
|
|
16309
16637
|
(_b = thumb2.current) == null ? void 0 : _b.toggleAttribute("data-dragging", dragging || state.isThumbDragging(index));
|
|
16310
16638
|
});
|
|
16311
|
-
return /* @__PURE__ */
|
|
16639
|
+
return /* @__PURE__ */ jsx74(SliderThumb, { ref: thumb2, index, inputRef: input, name, className: "kjun-slider-thumb", "aria-label": label, "data-front": front || void 0, children: bubble && /* @__PURE__ */ jsx74("span", { className: "kjun-tooltip kjun-slider-value-label", "aria-hidden": "true", children: text }) });
|
|
16312
16640
|
}
|
|
16313
16641
|
function RangeInput(props) {
|
|
16314
16642
|
const {
|
|
@@ -16341,13 +16669,13 @@ function RangeInput(props) {
|
|
|
16341
16669
|
const domain = createSliderDomain(min, max, step);
|
|
16342
16670
|
const list = Array.isArray(value) ? value : [value];
|
|
16343
16671
|
const valid = domain.valid && (!Array.isArray(value) || value.length === 2) && list.every((v) => domain.accepts(v)) && (list.length === 1 || list[0] <= list[1]);
|
|
16344
|
-
const latest =
|
|
16672
|
+
const latest = useRef58(value);
|
|
16345
16673
|
latest.current = value;
|
|
16346
|
-
const active =
|
|
16347
|
-
const inputs =
|
|
16348
|
-
const track =
|
|
16349
|
-
const [ownDrag, setOwnDrag] =
|
|
16350
|
-
|
|
16674
|
+
const active = useRef58(false);
|
|
16675
|
+
const inputs = useRef58([]);
|
|
16676
|
+
const track = useRef58(null);
|
|
16677
|
+
const [ownDrag, setOwnDrag] = useState56(null);
|
|
16678
|
+
useEffect50(() => {
|
|
16351
16679
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
16352
16680
|
}, [valid]);
|
|
16353
16681
|
const emit = (result) => {
|
|
@@ -16392,7 +16720,7 @@ function RangeInput(props) {
|
|
|
16392
16720
|
return sliderValueAt(vertical ? event.clientY - box.top : event.clientX - box.left, vertical ? box.height : box.width, min, top, layout);
|
|
16393
16721
|
};
|
|
16394
16722
|
const collapsed = valid && !disabled && list.length === 2 && list[0] === list[1];
|
|
16395
|
-
|
|
16723
|
+
useEffect50(() => {
|
|
16396
16724
|
const element = track.current;
|
|
16397
16725
|
if (!element || !collapsed) return;
|
|
16398
16726
|
const down = (event) => {
|
|
@@ -16427,7 +16755,7 @@ function RangeInput(props) {
|
|
|
16427
16755
|
const dots = valid ? sliderMarks(marks, min, top, step, list, layout, fillOrigin) : [];
|
|
16428
16756
|
const fill = sliderFillBox(fractions, layout, valid ? sliderOriginFraction(fillOrigin, min, top) : void 0);
|
|
16429
16757
|
const [lead, trail] = vertical ? ["top", "bottom"] : ["left", "right"];
|
|
16430
|
-
return /* @__PURE__ */
|
|
16758
|
+
return /* @__PURE__ */ jsxs66(
|
|
16431
16759
|
Slider,
|
|
16432
16760
|
{
|
|
16433
16761
|
id,
|
|
@@ -16452,15 +16780,15 @@ function RangeInput(props) {
|
|
|
16452
16780
|
}
|
|
16453
16781
|
},
|
|
16454
16782
|
children: [
|
|
16455
|
-
(label || showValue) && /* @__PURE__ */
|
|
16456
|
-
label && /* @__PURE__ */
|
|
16457
|
-
showValue && /* @__PURE__ */
|
|
16783
|
+
(label || showValue) && /* @__PURE__ */ jsxs66("div", { className: "kjun-slider-caption", children: [
|
|
16784
|
+
label && /* @__PURE__ */ jsx74(Label, { className: "kjun-slider-label", children: label }),
|
|
16785
|
+
showValue && /* @__PURE__ */ jsx74(SliderOutput, { className: "kjun-slider-value", children: ({ state }) => sliderValueText(valid ? state.values : list, format2, formatRange2) })
|
|
16458
16786
|
] }),
|
|
16459
|
-
/* @__PURE__ */
|
|
16460
|
-
/* @__PURE__ */
|
|
16461
|
-
/* @__PURE__ */
|
|
16462
|
-
dots.filter((dot) => dot.dot).map((dot) => /* @__PURE__ */
|
|
16463
|
-
list.map((_, i) => /* @__PURE__ */
|
|
16787
|
+
/* @__PURE__ */ jsx74(SliderTrack, { ref: track, className: "kjun-slider-track", children: () => /* @__PURE__ */ jsxs66(Fragment42, { children: [
|
|
16788
|
+
/* @__PURE__ */ jsx74("div", { className: "kjun-slider-rail" }),
|
|
16789
|
+
/* @__PURE__ */ jsx74("div", { className: "kjun-slider-fill", "data-origin": dots.some((dot) => dot.origin) || void 0, style: { [lead]: fill.lead === null ? edge : fill.lead + "%", [trail]: fill.trail === null ? edge : fill.trail + "%" } }),
|
|
16790
|
+
dots.filter((dot) => dot.dot).map((dot) => /* @__PURE__ */ jsx74("span", { className: "kjun-slider-mark", "data-active": dot.active || void 0, "data-origin": dot.origin || void 0, style: { [lead]: dot.position * 100 + "%" } }, dot.value)),
|
|
16791
|
+
list.map((_, i) => /* @__PURE__ */ jsx74(
|
|
16464
16792
|
RangeThumb,
|
|
16465
16793
|
{
|
|
16466
16794
|
index: i,
|
|
@@ -16475,7 +16803,7 @@ function RangeInput(props) {
|
|
|
16475
16803
|
i
|
|
16476
16804
|
))
|
|
16477
16805
|
] }) }),
|
|
16478
|
-
dots.some((dot) => dot.label) && /* @__PURE__ */
|
|
16806
|
+
dots.some((dot) => dot.label) && /* @__PURE__ */ jsx74("div", { className: "kjun-slider-marks", "aria-hidden": "true", children: dots.filter((dot) => dot.label).map((dot) => /* @__PURE__ */ jsx74(
|
|
16479
16807
|
"span",
|
|
16480
16808
|
{
|
|
16481
16809
|
className: "kjun-slider-mark-label",
|
|
@@ -16491,15 +16819,15 @@ function RangeInput(props) {
|
|
|
16491
16819
|
);
|
|
16492
16820
|
}
|
|
16493
16821
|
function KjunSlider(props) {
|
|
16494
|
-
return /* @__PURE__ */
|
|
16822
|
+
return /* @__PURE__ */ jsx74(RangeInput, { ...props });
|
|
16495
16823
|
}
|
|
16496
16824
|
function KjunRangeSlider(props) {
|
|
16497
|
-
return /* @__PURE__ */
|
|
16825
|
+
return /* @__PURE__ */ jsx74(RangeInput, { ...props });
|
|
16498
16826
|
}
|
|
16499
16827
|
|
|
16500
16828
|
// packages/react/src/quantity-stepper.tsx
|
|
16501
|
-
import { useEffect as
|
|
16502
|
-
import { createNumberDomain, quantityKeyAction, tokens as
|
|
16829
|
+
import { useEffect as useEffect51, useRef as useRef59, useState as useState57 } from "react";
|
|
16830
|
+
import { createNumberDomain, quantityKeyAction, tokens as tokens92 } from "@kjun-ui/tokens";
|
|
16503
16831
|
|
|
16504
16832
|
// shared/package-runtime/number-input.ts
|
|
16505
16833
|
var presets = {
|
|
@@ -16523,9 +16851,48 @@ function resolveNumberInput(options) {
|
|
|
16523
16851
|
min: finite2(options.min),
|
|
16524
16852
|
max: finite2(options.max),
|
|
16525
16853
|
suffix: options.suffix === void 0 ? preset.suffix : typeof options.suffix === "string" ? options.suffix : void 0,
|
|
16526
|
-
maxIntegerDigits: totalDigits - decimals2
|
|
16854
|
+
maxIntegerDigits: totalDigits - decimals2,
|
|
16855
|
+
step: resolveStep(finite2(options.step), decimals2)
|
|
16527
16856
|
};
|
|
16528
16857
|
}
|
|
16858
|
+
function resolveStep(step, decimals2) {
|
|
16859
|
+
if (step === void 0 || step <= 0) return void 0;
|
|
16860
|
+
const rounded = Number(step.toFixed(decimals2));
|
|
16861
|
+
return rounded > 0 ? rounded : void 0;
|
|
16862
|
+
}
|
|
16863
|
+
function written(value, o) {
|
|
16864
|
+
const text = value.toFixed(o.decimals);
|
|
16865
|
+
return /^-0(\.0*)?$/.test(text) ? text.slice(1) : text;
|
|
16866
|
+
}
|
|
16867
|
+
var stepBase = (o) => {
|
|
16868
|
+
var _a;
|
|
16869
|
+
return (_a = o.min) != null ? _a : 0;
|
|
16870
|
+
};
|
|
16871
|
+
function snapNumber(raw, o) {
|
|
16872
|
+
const value = Number(raw);
|
|
16873
|
+
if (o.step === void 0 || raw === "" || !Number.isFinite(value)) return raw;
|
|
16874
|
+
const base = stepBase(o);
|
|
16875
|
+
let snapped = base + Math.round((value - base) / o.step) * o.step;
|
|
16876
|
+
if (!o.allowNegative && snapped < 0) snapped += o.step;
|
|
16877
|
+
return written(snapped, o);
|
|
16878
|
+
}
|
|
16879
|
+
function stepNumber(raw, direction, o) {
|
|
16880
|
+
var _a;
|
|
16881
|
+
if (o.step === void 0) return null;
|
|
16882
|
+
const base = stepBase(o), value = Number(raw);
|
|
16883
|
+
const empty3 = /^-?\.?$/.test(raw) || !Number.isFinite(value);
|
|
16884
|
+
let next;
|
|
16885
|
+
if (empty3) next = base;
|
|
16886
|
+
else {
|
|
16887
|
+
const units = (value - base) / o.step, near = Math.round(units);
|
|
16888
|
+
const onGrid = Math.abs(units - near) < 1e-9;
|
|
16889
|
+
next = base + (onGrid ? near + direction : direction > 0 ? Math.ceil(units) : Math.floor(units)) * o.step;
|
|
16890
|
+
}
|
|
16891
|
+
const low = o.allowNegative ? o.min : Math.max((_a = o.min) != null ? _a : 0, 0);
|
|
16892
|
+
if (o.max !== void 0 && next > o.max) next = o.max;
|
|
16893
|
+
if (low !== void 0 && next < low) next = low;
|
|
16894
|
+
return written(next, o);
|
|
16895
|
+
}
|
|
16529
16896
|
var minus2 = /[-\u2212\u2013]/;
|
|
16530
16897
|
function parts(text, o, options) {
|
|
16531
16898
|
const negative = o.allowNegative && minus2.test(text);
|
|
@@ -16671,22 +17038,22 @@ function createPressRepeat(step, delay, interval) {
|
|
|
16671
17038
|
}
|
|
16672
17039
|
|
|
16673
17040
|
// packages/react/src/quantity-stepper.tsx
|
|
16674
|
-
import { jsx as
|
|
17041
|
+
import { jsx as jsx75, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
16675
17042
|
function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, name, onValueChange, onChangeCommit, onInvalidInput }) {
|
|
16676
17043
|
const m = useKjunMessages();
|
|
16677
|
-
const buttonStyle = { width:
|
|
17044
|
+
const buttonStyle = { width: tokens92.input[size].height, padding: 0 };
|
|
16678
17045
|
const domain = createNumberDomain({ min, max, step, precision });
|
|
16679
17046
|
const usable = domain.fits(value), blocked = disabled || !usable, outside = usable && !domain.inRange(value);
|
|
16680
|
-
const [draft, setDraft] =
|
|
17047
|
+
const [draft, setDraft] = useState57(String(value));
|
|
16681
17048
|
const field = useKjunField();
|
|
16682
17049
|
const invalid = error || !!(field == null ? void 0 : field.error) || outside;
|
|
16683
|
-
const composing =
|
|
16684
|
-
|
|
17050
|
+
const composing = useRef59(false), dirty = useRef59(false), accepted = useRef59(value);
|
|
17051
|
+
useEffect51(() => {
|
|
16685
17052
|
setDraft(String(value));
|
|
16686
17053
|
accepted.current = value;
|
|
16687
17054
|
dirty.current = false;
|
|
16688
17055
|
}, [value, precision, min, max, step]);
|
|
16689
|
-
|
|
17056
|
+
useEffect51(() => {
|
|
16690
17057
|
if (!usable) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
16691
17058
|
}, [usable]);
|
|
16692
17059
|
const emit = (next) => {
|
|
@@ -16711,11 +17078,11 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
16711
17078
|
emit(next);
|
|
16712
17079
|
return next !== accepted.current;
|
|
16713
17080
|
};
|
|
16714
|
-
const latest =
|
|
17081
|
+
const latest = useRef59(move);
|
|
16715
17082
|
latest.current = move;
|
|
16716
|
-
const [decrease] =
|
|
16717
|
-
const [increase] =
|
|
16718
|
-
|
|
17083
|
+
const [decrease] = useState57(() => createPressRepeat(() => latest.current(-1), tokens92.extensions.compound.repeatDelay, tokens92.extensions.compound.repeatInterval));
|
|
17084
|
+
const [increase] = useState57(() => createPressRepeat(() => latest.current(1), tokens92.extensions.compound.repeatDelay, tokens92.extensions.compound.repeatInterval));
|
|
17085
|
+
useEffect51(() => () => {
|
|
16719
17086
|
decrease.stop();
|
|
16720
17087
|
increase.stop();
|
|
16721
17088
|
}, []);
|
|
@@ -16737,8 +17104,8 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
16737
17104
|
repeat.start((_a = event.currentTarget.ownerDocument.defaultView) != null ? _a : void 0);
|
|
16738
17105
|
};
|
|
16739
17106
|
const atMin = value <= min, atMax = max !== void 0 && value >= max;
|
|
16740
|
-
return /* @__PURE__ */
|
|
16741
|
-
/* @__PURE__ */
|
|
17107
|
+
return /* @__PURE__ */ jsx75(IconFallbacks, { icons: componentIcons, children: /* @__PURE__ */ jsxs67("div", { className: "kjun-quantity", "data-size": size, "data-block": block, "data-error": invalid, children: [
|
|
17108
|
+
/* @__PURE__ */ jsx75(
|
|
16742
17109
|
KjunButton,
|
|
16743
17110
|
{
|
|
16744
17111
|
size,
|
|
@@ -16754,7 +17121,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
16754
17121
|
prefixIcon: "minus"
|
|
16755
17122
|
}
|
|
16756
17123
|
),
|
|
16757
|
-
/* @__PURE__ */
|
|
17124
|
+
/* @__PURE__ */ jsx75(
|
|
16758
17125
|
"input",
|
|
16759
17126
|
{
|
|
16760
17127
|
className: "kjun-input",
|
|
@@ -16788,7 +17155,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
16788
17155
|
"aria-required": (field == null ? void 0 : field.required) || void 0
|
|
16789
17156
|
}
|
|
16790
17157
|
),
|
|
16791
|
-
/* @__PURE__ */
|
|
17158
|
+
/* @__PURE__ */ jsx75(
|
|
16792
17159
|
KjunButton,
|
|
16793
17160
|
{
|
|
16794
17161
|
size,
|
|
@@ -16804,14 +17171,14 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
16804
17171
|
prefixIcon: "plus"
|
|
16805
17172
|
}
|
|
16806
17173
|
),
|
|
16807
|
-
name && /* @__PURE__ */
|
|
17174
|
+
name && /* @__PURE__ */ jsx75("input", { type: "hidden", name, value: String(value), disabled })
|
|
16808
17175
|
] }) });
|
|
16809
17176
|
}
|
|
16810
17177
|
|
|
16811
17178
|
// packages/react/src/number-input.tsx
|
|
16812
|
-
import { useEffect as
|
|
17179
|
+
import { useEffect as useEffect52, useId as useId28, useLayoutEffect as useLayoutEffect27, useMemo as useMemo9, useRef as useRef60, useState as useState58 } from "react";
|
|
16813
17180
|
import { isComposingKey as isComposingKey6 } from "@kjun-ui/tokens";
|
|
16814
|
-
import { jsx as
|
|
17181
|
+
import { jsx as jsx76, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
16815
17182
|
function KjunNumberInput({
|
|
16816
17183
|
value,
|
|
16817
17184
|
format: format2,
|
|
@@ -16820,6 +17187,7 @@ function KjunNumberInput({
|
|
|
16820
17187
|
allowNegative,
|
|
16821
17188
|
min,
|
|
16822
17189
|
max,
|
|
17190
|
+
step,
|
|
16823
17191
|
prefix,
|
|
16824
17192
|
suffix,
|
|
16825
17193
|
readingAid: readingAid2 = false,
|
|
@@ -16841,19 +17209,19 @@ function KjunNumberInput({
|
|
|
16841
17209
|
const field = useKjunField();
|
|
16842
17210
|
const suffixText = suffix === void 0 || typeof suffix === "string" ? suffix : null;
|
|
16843
17211
|
const o = useMemo9(
|
|
16844
|
-
() => resolveNumberInput({ format: format2, decimals: decimals2, grouping, allowNegative, min, max, suffix: suffixText }),
|
|
16845
|
-
[format2, decimals2, grouping, allowNegative, min, max, suffixText]
|
|
17212
|
+
() => resolveNumberInput({ format: format2, decimals: decimals2, grouping, allowNegative, min, max, step, suffix: suffixText }),
|
|
17213
|
+
[format2, decimals2, grouping, allowNegative, min, max, step, suffixText]
|
|
16846
17214
|
);
|
|
16847
17215
|
const shown = (raw2) => formatNumber(sanitizeNumber(raw2, o), o);
|
|
16848
17216
|
const outOfRange = (raw2) => rangeIssue(sanitizeNumber(raw2, o), o);
|
|
16849
|
-
const [view, setView] =
|
|
16850
|
-
const [issue, setIssue] =
|
|
16851
|
-
const input =
|
|
16852
|
-
const composing =
|
|
16853
|
-
const composedFrom =
|
|
16854
|
-
const emitted =
|
|
16855
|
-
const aidId = "kjun-number-reading-" +
|
|
16856
|
-
|
|
17217
|
+
const [view, setView] = useState58(() => ({ text: shown(value), caret: null }));
|
|
17218
|
+
const [issue, setIssue] = useState58(null);
|
|
17219
|
+
const input = useRef60(null);
|
|
17220
|
+
const composing = useRef60(false), dirty = useRef60(false);
|
|
17221
|
+
const composedFrom = useRef60("");
|
|
17222
|
+
const emitted = useRef60(value), accepted = useRef60(value), acceptedIssue = useRef60(null);
|
|
17223
|
+
const aidId = "kjun-number-reading-" + useId28().replace(/:/g, "");
|
|
17224
|
+
useEffect52(() => {
|
|
16857
17225
|
if (value === emitted.current || dirty.current && sameNumber(value, emitted.current)) return;
|
|
16858
17226
|
dirty.current = false;
|
|
16859
17227
|
emitted.current = accepted.current = value;
|
|
@@ -16863,8 +17231,8 @@ function KjunNumberInput({
|
|
|
16863
17231
|
const text = shown(value);
|
|
16864
17232
|
setView({ text, caret: text.length });
|
|
16865
17233
|
}, [value]);
|
|
16866
|
-
const options =
|
|
16867
|
-
|
|
17234
|
+
const options = useRef60(o);
|
|
17235
|
+
useEffect52(() => {
|
|
16868
17236
|
if (options.current === o) return;
|
|
16869
17237
|
options.current = o;
|
|
16870
17238
|
const found = outOfRange(accepted.current);
|
|
@@ -16912,10 +17280,13 @@ function KjunNumberInput({
|
|
|
16912
17280
|
};
|
|
16913
17281
|
const commit = (text = view.text) => {
|
|
16914
17282
|
if (composing.current || !dirty.current || disabled || readOnly) return;
|
|
17283
|
+
accept(snapNumber(commitNumber(sanitizeNumber(text, o), o), o), null);
|
|
17284
|
+
};
|
|
17285
|
+
const accept = (next, caret) => {
|
|
16915
17286
|
dirty.current = false;
|
|
16916
|
-
const next = commitNumber(sanitizeNumber(text, o), o);
|
|
16917
17287
|
const found = rangeIssue(next, o);
|
|
16918
|
-
|
|
17288
|
+
const text = formatNumber(next, o);
|
|
17289
|
+
setView({ text, caret: caret === "end" ? text.length : null });
|
|
16919
17290
|
setIssue(found);
|
|
16920
17291
|
acceptedIssue.current = found;
|
|
16921
17292
|
report(next);
|
|
@@ -16936,6 +17307,13 @@ function KjunNumberInput({
|
|
|
16936
17307
|
report(accepted.current);
|
|
16937
17308
|
return;
|
|
16938
17309
|
}
|
|
17310
|
+
if ((event.key === "ArrowUp" || event.key === "ArrowDown") && o.step !== void 0 && !event.altKey && !event.ctrlKey && !event.metaKey) {
|
|
17311
|
+
const next = stepNumber(sanitizeNumber(event.currentTarget.value, o), event.key === "ArrowUp" ? 1 : -1, o);
|
|
17312
|
+
if (next === null) return;
|
|
17313
|
+
event.preventDefault();
|
|
17314
|
+
accept(next, "end");
|
|
17315
|
+
return;
|
|
17316
|
+
}
|
|
16939
17317
|
if (event.key !== "Backspace" && event.key !== "Delete" || event.altKey || event.ctrlKey || event.metaKey) return;
|
|
16940
17318
|
const el = event.currentTarget;
|
|
16941
17319
|
const removed = deleteAcrossSeparator(el.value, (_a = el.selectionStart) != null ? _a : 0, (_b = el.selectionEnd) != null ? _b : 0, event.key);
|
|
@@ -16947,13 +17325,13 @@ function KjunNumberInput({
|
|
|
16947
17325
|
const raw = sanitizeNumber(view.text, o);
|
|
16948
17326
|
const aid = readingAid2 ? readingAid(raw, o, scope) : "";
|
|
16949
17327
|
const message = issue && !error && !(field == null ? void 0 : field.error) ? rangeMessage(issue, o, scope) : "";
|
|
16950
|
-
const owner = "kjun-number-" +
|
|
16951
|
-
|
|
17328
|
+
const owner = "kjun-number-" + useId28(), toGroup = field == null ? void 0 : field.reportError;
|
|
17329
|
+
useEffect52(() => {
|
|
16952
17330
|
toGroup == null ? void 0 : toGroup(owner, message);
|
|
16953
17331
|
}, [toGroup, message]);
|
|
16954
|
-
|
|
16955
|
-
return /* @__PURE__ */
|
|
16956
|
-
/* @__PURE__ */
|
|
17332
|
+
useEffect52(() => () => toGroup == null ? void 0 : toGroup(owner, ""), [toGroup]);
|
|
17333
|
+
return /* @__PURE__ */ jsxs68("div", { className: "kjun-number-input" + (className ? " " + className : ""), "data-format": o.format, "data-align": align, style, children: [
|
|
17334
|
+
/* @__PURE__ */ jsx76(
|
|
16957
17335
|
KjunInput,
|
|
16958
17336
|
{
|
|
16959
17337
|
ref: input,
|
|
@@ -16988,8 +17366,8 @@ function KjunNumberInput({
|
|
|
16988
17366
|
}
|
|
16989
17367
|
}
|
|
16990
17368
|
),
|
|
16991
|
-
aid && /* @__PURE__ */
|
|
16992
|
-
name && /* @__PURE__ */
|
|
17369
|
+
aid && /* @__PURE__ */ jsx76("p", { id: aidId, className: "kjun-form-hint kjun-number-input-reading", children: aid }),
|
|
17370
|
+
name && /* @__PURE__ */ jsx76("input", { type: "hidden", name, value: commitNumber(raw, o), disabled })
|
|
16993
17371
|
] });
|
|
16994
17372
|
}
|
|
16995
17373
|
|
|
@@ -17179,26 +17557,26 @@ var wheelItemAt = (column, row) => {
|
|
|
17179
17557
|
};
|
|
17180
17558
|
|
|
17181
17559
|
// packages/react/src/time-picker.tsx
|
|
17182
|
-
import { Fragment as
|
|
17183
|
-
import { createTimeDomain, tokens as
|
|
17560
|
+
import { Fragment as Fragment44, useEffect as useEffect54, useId as useId29, useMemo as useMemo10, useRef as useRef62, useState as useState59, useSyncExternalStore as useSyncExternalStore7 } from "react";
|
|
17561
|
+
import { createTimeDomain, tokens as tokens94 } from "@kjun-ui/tokens";
|
|
17184
17562
|
|
|
17185
17563
|
// packages/react/src/time-wheel.tsx
|
|
17186
|
-
import { tokens as
|
|
17187
|
-
import { Fragment as
|
|
17188
|
-
import { jsx as
|
|
17189
|
-
var rowHeight =
|
|
17564
|
+
import { tokens as tokens93 } from "@kjun-ui/tokens";
|
|
17565
|
+
import { Fragment as Fragment43, useEffect as useEffect53, useLayoutEffect as useLayoutEffect28, useRef as useRef61 } from "react";
|
|
17566
|
+
import { jsx as jsx77, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
17567
|
+
var rowHeight = tokens93.extensions.timePicker.wheelRowHeight;
|
|
17190
17568
|
var settleDelay = 120;
|
|
17191
17569
|
var travelLimit = 1e3;
|
|
17192
17570
|
function WheelColumnView({ column, disabled, readOnly, autoFocus, onPick, onEnter, onFocus }) {
|
|
17193
|
-
const scroller =
|
|
17194
|
-
const travel =
|
|
17571
|
+
const scroller = useRef61(null), held = useRef61(false), timer = useRef61(void 0), mounted = useRef61(false);
|
|
17572
|
+
const travel = useRef61(null);
|
|
17195
17573
|
const go = (element, top, smooth) => {
|
|
17196
17574
|
travel.current = { top, until: Date.now() + travelLimit };
|
|
17197
17575
|
element.scrollTo({ top, behavior: smooth ? "smooth" : "instant" });
|
|
17198
17576
|
};
|
|
17199
17577
|
const reduced = useReducedMotion();
|
|
17200
17578
|
const item = column.items[column.index];
|
|
17201
|
-
const latest =
|
|
17579
|
+
const latest = useRef61({ column, onPick });
|
|
17202
17580
|
latest.current = { column, onPick };
|
|
17203
17581
|
useLayoutEffect28(() => {
|
|
17204
17582
|
const element = scroller.current;
|
|
@@ -17208,11 +17586,11 @@ function WheelColumnView({ column, disabled, readOnly, autoFocus, onPick, onEnte
|
|
|
17208
17586
|
if (current === null || Math.abs(current - row) > 0.01) go(element, row * rowHeight, mounted.current && !reduced);
|
|
17209
17587
|
mounted.current = true;
|
|
17210
17588
|
}, [column.index, column.items.length, column.loop, reduced]);
|
|
17211
|
-
|
|
17589
|
+
useEffect53(() => {
|
|
17212
17590
|
var _a;
|
|
17213
17591
|
if (autoFocus) (_a = scroller.current) == null ? void 0 : _a.focus({ preventScroll: true });
|
|
17214
17592
|
}, [autoFocus]);
|
|
17215
|
-
|
|
17593
|
+
useEffect53(() => () => clearTimeout(timer.current), []);
|
|
17216
17594
|
const settle = () => {
|
|
17217
17595
|
const element = scroller.current, { column: column2, onPick: onPick2 } = latest.current;
|
|
17218
17596
|
if (!element || held.current) return;
|
|
@@ -17234,7 +17612,7 @@ function WheelColumnView({ column, disabled, readOnly, autoFocus, onPick, onEnte
|
|
|
17234
17612
|
timer.current = setTimeout(settle, settleDelay);
|
|
17235
17613
|
};
|
|
17236
17614
|
const locked = disabled || readOnly;
|
|
17237
|
-
return /* @__PURE__ */
|
|
17615
|
+
return /* @__PURE__ */ jsx77("div", { className: "kjun-time-wheel-column", "data-key": column.key, children: /* @__PURE__ */ jsx77(
|
|
17238
17616
|
"div",
|
|
17239
17617
|
{
|
|
17240
17618
|
ref: scroller,
|
|
@@ -17296,7 +17674,7 @@ function WheelColumnView({ column, disabled, readOnly, autoFocus, onPick, onEnte
|
|
|
17296
17674
|
const value = wheelKey(column, event.key);
|
|
17297
17675
|
if (value !== null) onPick(value);
|
|
17298
17676
|
},
|
|
17299
|
-
children: Array.from({ length: wheelCopies(column) }, (_, copy) => column.items.map((entry, index) => /* @__PURE__ */
|
|
17677
|
+
children: Array.from({ length: wheelCopies(column) }, (_, copy) => column.items.map((entry, index) => /* @__PURE__ */ jsx77(
|
|
17300
17678
|
"div",
|
|
17301
17679
|
{
|
|
17302
17680
|
className: "kjun-time-wheel-row",
|
|
@@ -17314,7 +17692,7 @@ function WheelColumnView({ column, disabled, readOnly, autoFocus, onPick, onEnte
|
|
|
17314
17692
|
) });
|
|
17315
17693
|
}
|
|
17316
17694
|
function TimeWheel({ columns, label, labelledBy, inline = false, disabled = false, readOnly = false, focusColumn = null, onFocusColumn, onPick, onEnter }) {
|
|
17317
|
-
return /* @__PURE__ */
|
|
17695
|
+
return /* @__PURE__ */ jsxs69(
|
|
17318
17696
|
"div",
|
|
17319
17697
|
{
|
|
17320
17698
|
className: "kjun-time-wheel",
|
|
@@ -17324,10 +17702,10 @@ function TimeWheel({ columns, label, labelledBy, inline = false, disabled = fals
|
|
|
17324
17702
|
"data-inline": inline || void 0,
|
|
17325
17703
|
"data-disabled": disabled || void 0,
|
|
17326
17704
|
children: [
|
|
17327
|
-
/* @__PURE__ */
|
|
17328
|
-
columns.map((column, index) => /* @__PURE__ */
|
|
17329
|
-
wheelSeparated(columns, index) && /* @__PURE__ */
|
|
17330
|
-
/* @__PURE__ */
|
|
17705
|
+
/* @__PURE__ */ jsx77("div", { className: "kjun-time-wheel-band", "aria-hidden": "true" }),
|
|
17706
|
+
columns.map((column, index) => /* @__PURE__ */ jsxs69(Fragment43, { children: [
|
|
17707
|
+
wheelSeparated(columns, index) && /* @__PURE__ */ jsx77("span", { className: "kjun-time-wheel-separator", "aria-hidden": "true", children: ":" }),
|
|
17708
|
+
/* @__PURE__ */ jsx77(
|
|
17331
17709
|
WheelColumnView,
|
|
17332
17710
|
{
|
|
17333
17711
|
column,
|
|
@@ -17349,7 +17727,7 @@ function TimeWheel({ columns, label, labelledBy, inline = false, disabled = fals
|
|
|
17349
17727
|
}
|
|
17350
17728
|
|
|
17351
17729
|
// packages/react/src/time-picker.tsx
|
|
17352
|
-
import { Fragment as
|
|
17730
|
+
import { Fragment as Fragment45, jsx as jsx78, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
17353
17731
|
var subscribeCoarse = (notify) => {
|
|
17354
17732
|
if (typeof matchMedia !== "function") return () => {
|
|
17355
17733
|
};
|
|
@@ -17385,15 +17763,15 @@ function KjunTimePicker({
|
|
|
17385
17763
|
}) {
|
|
17386
17764
|
const scope = useKjunMessageScope(), m = scope.messages;
|
|
17387
17765
|
ariaLabel != null ? ariaLabel : ariaLabel = m.time;
|
|
17388
|
-
const root =
|
|
17389
|
-
const field = useKjunField(), uid =
|
|
17766
|
+
const root = useRef62(null), opener = useRef62(null);
|
|
17767
|
+
const field = useKjunField(), uid = useId29();
|
|
17390
17768
|
const fieldId = id || (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
17391
|
-
const [typing] =
|
|
17769
|
+
const [typing] = useState59(createSegmentTyping);
|
|
17392
17770
|
const coarse = useSyncExternalStore7(subscribeCoarse, coarsePointer, () => false);
|
|
17393
17771
|
const layout = resolveTimeLayout(layoutProp, coarse), trigger = resolveTimeTrigger(triggerProp, layout === "inline" ? "popover" : layout);
|
|
17394
17772
|
const domain = useMemo10(() => createTimeDomain({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
|
|
17395
17773
|
const accepted = domain.accepts(value);
|
|
17396
|
-
|
|
17774
|
+
useEffect54(() => {
|
|
17397
17775
|
if (!domain.valid) warnPicker("TimePicker: check min, max, minuteStep and secondStep.");
|
|
17398
17776
|
else if (!accepted) warnPicker(`TimePicker: ${value} is outside the step or bounds.`);
|
|
17399
17777
|
}, [domain, accepted, value]);
|
|
@@ -17405,7 +17783,7 @@ function KjunTimePicker({
|
|
|
17405
17783
|
}
|
|
17406
17784
|
};
|
|
17407
17785
|
const shape = { precision, hourCycle, minuteStep, secondStep, messages: m, periodFirst: periodLeads(scope.language) };
|
|
17408
|
-
const [open, setOpen] =
|
|
17786
|
+
const [open, setOpen] = useState59(false), [draft, setDraft] = useState59(() => wheelStart(domain, value)), [focusColumn, setFocusColumn] = useState59(null), [active, setActive] = useState59(null);
|
|
17409
17787
|
const openAt = (column, from) => {
|
|
17410
17788
|
if (blocked || readOnly) return;
|
|
17411
17789
|
opener.current = from;
|
|
@@ -17425,7 +17803,7 @@ function KjunTimePicker({
|
|
|
17425
17803
|
setDraft(time2);
|
|
17426
17804
|
if (layout === "inline") change(time2);
|
|
17427
17805
|
};
|
|
17428
|
-
const wheel = (inline) => /* @__PURE__ */
|
|
17806
|
+
const wheel = (inline) => /* @__PURE__ */ jsx78(
|
|
17429
17807
|
TimeWheel,
|
|
17430
17808
|
{
|
|
17431
17809
|
columns,
|
|
@@ -17440,17 +17818,17 @@ function KjunTimePicker({
|
|
|
17440
17818
|
onEnter: inline ? void 0 : confirm
|
|
17441
17819
|
}
|
|
17442
17820
|
);
|
|
17443
|
-
const now = /* @__PURE__ */
|
|
17444
|
-
const actions = /* @__PURE__ */
|
|
17445
|
-
/* @__PURE__ */
|
|
17446
|
-
/* @__PURE__ */
|
|
17821
|
+
const now = /* @__PURE__ */ jsx78(KjunButton, { size: layout === "sheet" ? "md" : "sm", variant: "ghost", onClick: () => setDraft(wheelStart(domain, null)), children: m.now });
|
|
17822
|
+
const actions = /* @__PURE__ */ jsxs70(Fragment45, { children: [
|
|
17823
|
+
/* @__PURE__ */ jsx78(KjunButton, { size: layout === "sheet" ? "md" : "sm", variant: "secondary", onClick: () => setOpen(false), children: m.cancel }),
|
|
17824
|
+
/* @__PURE__ */ jsx78(KjunButton, { size: layout === "sheet" ? "md" : "sm", variant: "primary", onClick: confirm, children: m.confirm })
|
|
17447
17825
|
] });
|
|
17448
|
-
const hidden = name && /* @__PURE__ */
|
|
17449
|
-
if (layout === "inline") return /* @__PURE__ */
|
|
17826
|
+
const hidden = name && /* @__PURE__ */ jsx78("input", { type: "hidden", name, value: value != null ? value : "" });
|
|
17827
|
+
if (layout === "inline") return /* @__PURE__ */ jsxs70("div", { className: "kjun-time-picker-inline", "data-block": block || void 0, "data-error": invalid || void 0, id: id != null ? id : field == null ? void 0 : field.id, children: [
|
|
17450
17828
|
wheel(true),
|
|
17451
17829
|
hidden
|
|
17452
17830
|
] });
|
|
17453
|
-
const panel = layout === "sheet" ? /* @__PURE__ */
|
|
17831
|
+
const panel = layout === "sheet" ? /* @__PURE__ */ jsx78(
|
|
17454
17832
|
KjunDrawer,
|
|
17455
17833
|
{
|
|
17456
17834
|
open: open && !blocked,
|
|
@@ -17462,9 +17840,9 @@ function KjunTimePicker({
|
|
|
17462
17840
|
headerActions: now,
|
|
17463
17841
|
footer: actions,
|
|
17464
17842
|
returnFocus: () => opener.current,
|
|
17465
|
-
children: /* @__PURE__ */
|
|
17843
|
+
children: /* @__PURE__ */ jsx78("div", { className: "kjun-time-sheet-body", children: wheel(false) })
|
|
17466
17844
|
}
|
|
17467
|
-
) : /* @__PURE__ */
|
|
17845
|
+
) : /* @__PURE__ */ jsxs70(
|
|
17468
17846
|
FloatingPanel,
|
|
17469
17847
|
{
|
|
17470
17848
|
field: true,
|
|
@@ -17476,22 +17854,22 @@ function KjunTimePicker({
|
|
|
17476
17854
|
labelledBy: field == null ? void 0 : field.labelId,
|
|
17477
17855
|
ariaLabel,
|
|
17478
17856
|
returnFocus: () => opener.current,
|
|
17479
|
-
maxHeight:
|
|
17857
|
+
maxHeight: tokens94.extensions.floating.maxHeight,
|
|
17480
17858
|
children: [
|
|
17481
17859
|
wheel(false),
|
|
17482
|
-
/* @__PURE__ */
|
|
17860
|
+
/* @__PURE__ */ jsxs70("div", { className: "kjun-time-panel-footer", children: [
|
|
17483
17861
|
now,
|
|
17484
|
-
/* @__PURE__ */
|
|
17862
|
+
/* @__PURE__ */ jsx78("span", { className: "kjun-time-panel-actions", children: actions })
|
|
17485
17863
|
] })
|
|
17486
17864
|
]
|
|
17487
17865
|
}
|
|
17488
17866
|
);
|
|
17489
17867
|
if (trigger === "button") {
|
|
17490
|
-
const spec =
|
|
17868
|
+
const spec = tokens94.input[size], text = timeText(domain, value, shape), valueId = `${fieldId}-value`;
|
|
17491
17869
|
const clear = clearable && value !== null && !blocked && !readOnly;
|
|
17492
|
-
return /* @__PURE__ */
|
|
17493
|
-
/* @__PURE__ */
|
|
17494
|
-
/* @__PURE__ */
|
|
17870
|
+
return /* @__PURE__ */ jsxs70(Fragment45, { children: [
|
|
17871
|
+
/* @__PURE__ */ jsxs70("div", { ref: root, className: "kjun-select-shell kjun-time-button-field", "data-block": block || void 0, children: [
|
|
17872
|
+
/* @__PURE__ */ jsxs70(
|
|
17495
17873
|
"button",
|
|
17496
17874
|
{
|
|
17497
17875
|
id: fieldId,
|
|
@@ -17506,7 +17884,7 @@ function KjunTimePicker({
|
|
|
17506
17884
|
"aria-invalid": invalid || void 0,
|
|
17507
17885
|
"aria-required": (field == null ? void 0 : field.required) || void 0,
|
|
17508
17886
|
"aria-readonly": readOnly || void 0,
|
|
17509
|
-
style: { height: spec.height, borderRadius: spec.radius, ...inputTypeStyle(size), paddingInline: spec.padding -
|
|
17887
|
+
style: { height: spec.height, borderRadius: spec.radius, ...inputTypeStyle(size), paddingInline: spec.padding - tokens94.border.controlWidth },
|
|
17510
17888
|
onClick: (event) => openAt(0, event.currentTarget),
|
|
17511
17889
|
onKeyDown: (event) => {
|
|
17512
17890
|
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
@@ -17515,12 +17893,12 @@ function KjunTimePicker({
|
|
|
17515
17893
|
}
|
|
17516
17894
|
},
|
|
17517
17895
|
children: [
|
|
17518
|
-
/* @__PURE__ */
|
|
17519
|
-
/* @__PURE__ */
|
|
17896
|
+
/* @__PURE__ */ jsx78("span", { id: valueId, className: text ? void 0 : "kjun-placeholder", style: { paddingRight: clear ? spec.clearSize + spec.affixGap : void 0 }, children: text || m.selectTime }),
|
|
17897
|
+
/* @__PURE__ */ jsx78(KjunIcon, { name: "clock", size: spec.iconSize, style: { flexShrink: 0, color: blocked ? "var(--_kjun-color-text-disabled)" : "var(--_kjun-color-text-tertiary)" } })
|
|
17520
17898
|
]
|
|
17521
17899
|
}
|
|
17522
17900
|
),
|
|
17523
|
-
clear && /* @__PURE__ */
|
|
17901
|
+
clear && /* @__PURE__ */ jsx78(
|
|
17524
17902
|
KjunButton,
|
|
17525
17903
|
{
|
|
17526
17904
|
size: "sm",
|
|
@@ -17534,7 +17912,7 @@ function KjunTimePicker({
|
|
|
17534
17912
|
change(null);
|
|
17535
17913
|
(_b = (_a = root.current) == null ? void 0 : _a.querySelector(".kjun-time-trigger")) == null ? void 0 : _b.focus();
|
|
17536
17914
|
},
|
|
17537
|
-
children: /* @__PURE__ */
|
|
17915
|
+
children: /* @__PURE__ */ jsx78("span", { className: "kjun-select-clear-mark", style: selectClearMarkStyle(spec), children: /* @__PURE__ */ jsx78(KjunIcon, { name: "x", size: spec.clearMarkIconSize }) })
|
|
17538
17916
|
}
|
|
17539
17917
|
),
|
|
17540
17918
|
hidden
|
|
@@ -17547,8 +17925,8 @@ function KjunTimePicker({
|
|
|
17547
17925
|
var _a, _b;
|
|
17548
17926
|
return Array.from((_b = (_a = root.current) == null ? void 0 : _a.querySelectorAll(".kjun-time-segment-value")) != null ? _b : []);
|
|
17549
17927
|
};
|
|
17550
|
-
return /* @__PURE__ */
|
|
17551
|
-
/* @__PURE__ */
|
|
17928
|
+
return /* @__PURE__ */ jsxs70(Fragment45, { children: [
|
|
17929
|
+
/* @__PURE__ */ jsxs70(
|
|
17552
17930
|
"div",
|
|
17553
17931
|
{
|
|
17554
17932
|
ref: root,
|
|
@@ -17564,15 +17942,15 @@ function KjunTimePicker({
|
|
|
17564
17942
|
"aria-labelledby": field == null ? void 0 : field.labelId,
|
|
17565
17943
|
"aria-describedby": field == null ? void 0 : field.describedBy,
|
|
17566
17944
|
children: [
|
|
17567
|
-
/* @__PURE__ */
|
|
17945
|
+
/* @__PURE__ */ jsx78("div", { className: "kjun-time-segments", children: segments.map((segment, index) => {
|
|
17568
17946
|
var _a;
|
|
17569
17947
|
const labelId = `${fieldId}-segment-${index}`, text = segmentText(segment);
|
|
17570
17948
|
const separated = index > 0 && segment.key !== "period" && segments[index - 1].key !== "period";
|
|
17571
|
-
return /* @__PURE__ */
|
|
17572
|
-
separated && /* @__PURE__ */
|
|
17573
|
-
/* @__PURE__ */
|
|
17574
|
-
/* @__PURE__ */
|
|
17575
|
-
/* @__PURE__ */
|
|
17949
|
+
return /* @__PURE__ */ jsxs70(Fragment44, { children: [
|
|
17950
|
+
separated && /* @__PURE__ */ jsx78("span", { className: "kjun-time-separator", "aria-hidden": true, children: ":" }),
|
|
17951
|
+
/* @__PURE__ */ jsxs70("div", { className: "kjun-time-segment", "data-period": segment.key === "period" || void 0, children: [
|
|
17952
|
+
/* @__PURE__ */ jsx78("span", { id: labelId, className: "kjun-sr-only", "aria-hidden": true, children: segment.label }),
|
|
17953
|
+
/* @__PURE__ */ jsx78(
|
|
17576
17954
|
"input",
|
|
17577
17955
|
{
|
|
17578
17956
|
id: index === 0 ? fieldId : `${fieldId}-${index}`,
|
|
@@ -17626,14 +18004,14 @@ function KjunTimePicker({
|
|
|
17626
18004
|
] })
|
|
17627
18005
|
] }, segment.key);
|
|
17628
18006
|
}) }),
|
|
17629
|
-
clearable && value !== null && !blocked && !readOnly ? /* @__PURE__ */
|
|
18007
|
+
clearable && value !== null && !blocked && !readOnly ? /* @__PURE__ */ jsx78(KjunButton, { className: "kjun-time-clear", size, variant: "ghost", prefixIcon: "x", ariaLabel: m.clearValue(ariaLabel), onClick: () => {
|
|
17630
18008
|
var _a;
|
|
17631
18009
|
change(null);
|
|
17632
18010
|
(_a = inputs()[0]) == null ? void 0 : _a.focus();
|
|
17633
|
-
} }) : /* @__PURE__ */
|
|
18011
|
+
} }) : /* @__PURE__ */ jsx78("span", { className: "kjun-time-icon", "aria-hidden": "true", onClick: () => {
|
|
17634
18012
|
var _a;
|
|
17635
18013
|
return openAt(0, (_a = inputs()[0]) != null ? _a : null);
|
|
17636
|
-
}, children: /* @__PURE__ */
|
|
18014
|
+
}, children: /* @__PURE__ */ jsx78(KjunIcon, { name: "clock", size: tokens94.input[size].iconSize }) }),
|
|
17637
18015
|
hidden
|
|
17638
18016
|
]
|
|
17639
18017
|
}
|