@kjun-ui/react 0.9.0 → 0.11.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 +209 -36
- package/dist/index.js +255 -81
- package/dist/styles.css +46 -19
- package/dist/types/packages/react/src/button.d.cts +2 -0
- package/dist/types/packages/react/src/button.d.ts +2 -0
- package/dist/types/packages/react/src/display.d.cts +4 -1
- package/dist/types/packages/react/src/display.d.ts +4 -1
- package/dist/types/packages/react/src/drawer.d.cts +7 -1
- package/dist/types/packages/react/src/drawer.d.ts +7 -1
- package/dist/types/packages/react/src/floating-panel.d.cts +3 -1
- package/dist/types/packages/react/src/floating-panel.d.ts +3 -1
- package/dist/types/packages/react/src/input.d.cts +5 -1
- package/dist/types/packages/react/src/input.d.ts +5 -1
- package/dist/types/packages/react/src/popover.d.cts +9 -2
- package/dist/types/packages/react/src/popover.d.ts +9 -2
- package/dist/types/packages/react/src/select-control.d.cts +5 -1
- package/dist/types/packages/react/src/select-control.d.ts +5 -1
- package/dist/types/shared/package-runtime/alert-live.d.cts +3 -0
- package/dist/types/shared/package-runtime/alert-live.d.ts +3 -0
- package/dist/types/shared/package-runtime/aria-ids.d.cts +4 -0
- package/dist/types/shared/package-runtime/aria-ids.d.ts +4 -0
- package/dist/types/shared/package-runtime/drawer-geometry.d.cts +36 -0
- package/dist/types/shared/package-runtime/drawer-geometry.d.ts +36 -0
- package/dist/types/shared/package-runtime/popover-nonmodal.d.cts +12 -0
- package/dist/types/shared/package-runtime/popover-nonmodal.d.ts +12 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -26,9 +26,23 @@ function mergeIcons(parent, own) {
|
|
|
26
26
|
function withFallbackIcons(registry, fallbacks) {
|
|
27
27
|
return mergeIcons(fallbacks, registry);
|
|
28
28
|
}
|
|
29
|
+
var warnedIcons = /* @__PURE__ */ new Set();
|
|
30
|
+
function developmentMode() {
|
|
31
|
+
try {
|
|
32
|
+
return true;
|
|
33
|
+
} catch (e) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function warnMissingIcon(name) {
|
|
38
|
+
if (!developmentMode() || warnedIcons.has(name)) return;
|
|
39
|
+
warnedIcons.add(name);
|
|
40
|
+
console.warn(`KJUN Icon: "${name}" \uC544\uC774\uCF58\uC774 \uB4F1\uB85D\uB418\uC9C0 \uC54A\uC544 help-circle\uB85C \uB300\uC2E0\uD569\uB2C8\uB2E4. @kjun-ui/icons/icons/${name}\uB97C import\uD574 KjunProvider\uC758 icons\uC5D0 \uB4F1\uB85D\uD558\uC138\uC694.`);
|
|
41
|
+
}
|
|
29
42
|
function resolveIcon(registry, name, filled = false) {
|
|
30
43
|
var _a;
|
|
31
44
|
const definition = Object.prototype.hasOwnProperty.call(registry, name) ? registry[name] : void 0;
|
|
45
|
+
if (!definition && name) warnMissingIcon(name);
|
|
32
46
|
const filledNodes = filled && (definition == null ? void 0 : definition.filled);
|
|
33
47
|
return { nodes: filledNodes || (definition == null ? void 0 : definition.outline) || ((_a = registry["help-circle"]) == null ? void 0 : _a.outline) || defaultIcons["help-circle"].outline, filled: !!filledNodes };
|
|
34
48
|
}
|
|
@@ -588,6 +602,7 @@ var KjunButton = forwardRef(
|
|
|
588
602
|
style,
|
|
589
603
|
onClick,
|
|
590
604
|
type = "button",
|
|
605
|
+
wrap = false,
|
|
591
606
|
...rest
|
|
592
607
|
} = props;
|
|
593
608
|
const size = useActionSize(props.size, declaredSize);
|
|
@@ -616,6 +631,7 @@ var KjunButton = forwardRef(
|
|
|
616
631
|
"data-variant": variant,
|
|
617
632
|
"data-size": size,
|
|
618
633
|
"data-disabled": disabled,
|
|
634
|
+
"data-wrap": wrap || void 0,
|
|
619
635
|
"aria-label": ariaLabel || rest["aria-label"],
|
|
620
636
|
disabled: disabled || busy,
|
|
621
637
|
"aria-busy": busy || void 0,
|
|
@@ -629,7 +645,7 @@ var KjunButton = forwardRef(
|
|
|
629
645
|
...typeStyle(tokens3.button.typography[size]),
|
|
630
646
|
borderRadius: tokens3.button.radii[size],
|
|
631
647
|
gap: hasContent2 ? tokens3.button.contentGaps[size] : 0,
|
|
632
|
-
...navigation ? {
|
|
648
|
+
...navigation || wrap ? {
|
|
633
649
|
height: "auto",
|
|
634
650
|
maxWidth: "100%",
|
|
635
651
|
paddingBlock: Math.max(0, (height - contentHeight) / 2)
|
|
@@ -670,6 +686,14 @@ var KjunButton = forwardRef(
|
|
|
670
686
|
|
|
671
687
|
// packages/react/src/input.tsx
|
|
672
688
|
import { tokens as tokens4 } from "@kjun-ui/tokens";
|
|
689
|
+
|
|
690
|
+
// shared/package-runtime/aria-ids.ts
|
|
691
|
+
function mergeIds(...lists) {
|
|
692
|
+
const ids = [...new Set(lists.flatMap((list) => (list != null ? list : "").split(/\s+/)).filter(Boolean))];
|
|
693
|
+
return ids.length ? ids.join(" ") : void 0;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
// packages/react/src/input.tsx
|
|
673
697
|
import {
|
|
674
698
|
createContext as createContext6,
|
|
675
699
|
forwardRef as forwardRef2,
|
|
@@ -707,26 +731,30 @@ function KjunFormGroup({
|
|
|
707
731
|
required = false,
|
|
708
732
|
error = "",
|
|
709
733
|
hint = "",
|
|
734
|
+
labelHidden = false,
|
|
710
735
|
children
|
|
711
736
|
}) {
|
|
712
737
|
const uid = useId2().replace(/:/g, "");
|
|
713
738
|
const fieldId = id || "kjun-field-" + uid;
|
|
714
739
|
const labelId = label ? fieldId + "-label" : void 0;
|
|
715
|
-
const
|
|
740
|
+
const hintId = hint ? fieldId + "-hint" : void 0, errorId = error ? fieldId + "-error" : void 0;
|
|
741
|
+
const describedBy = mergeIds(hintId, errorId);
|
|
742
|
+
const [controlId, setControlId] = useState4();
|
|
716
743
|
return /* @__PURE__ */ jsx5(
|
|
717
744
|
FieldContext.Provider,
|
|
718
745
|
{
|
|
719
|
-
value: { id: fieldId, labelId, describedBy, error, required },
|
|
746
|
+
value: { id: fieldId, labelId, describedBy, error, required, setControlId },
|
|
720
747
|
children: /* @__PURE__ */ jsxs3("div", { className: "kjun-form-group", children: [
|
|
721
|
-
label && /* @__PURE__ */ jsxs3("label", { className: "kjun-form-label", id: labelId, htmlFor: fieldId, children: [
|
|
748
|
+
label && /* @__PURE__ */ jsxs3("label", { className: "kjun-form-label" + (labelHidden ? " kjun-sr-only" : ""), id: labelId, htmlFor: controlId || fieldId, children: [
|
|
722
749
|
label,
|
|
723
750
|
required && /* @__PURE__ */ jsx5("span", { style: { color: "var(--_kjun-color-danger)" }, children: " *" })
|
|
724
751
|
] }),
|
|
725
752
|
children,
|
|
726
|
-
|
|
753
|
+
hint && /* @__PURE__ */ jsx5("p", { id: hintId, className: "kjun-form-hint", children: hint }),
|
|
754
|
+
error && /* @__PURE__ */ jsxs3("p", { id: errorId, className: "kjun-form-error", role: "alert", children: [
|
|
727
755
|
/* @__PURE__ */ jsx5(KjunIcon, { name: "alert-circle", size: tokens4.extensions.form.messageIconSize }),
|
|
728
756
|
error
|
|
729
|
-
] })
|
|
757
|
+
] })
|
|
730
758
|
] })
|
|
731
759
|
}
|
|
732
760
|
);
|
|
@@ -784,11 +812,7 @@ var KjunInput = forwardRef2(
|
|
|
784
812
|
const showError = !!errorMessage && !(field == null ? void 0 : field.error);
|
|
785
813
|
const invalid = !!(error || errorMessage || (field == null ? void 0 : field.error));
|
|
786
814
|
const ownErrorId = "kjun-input-error-" + uid;
|
|
787
|
-
const describedBy = [
|
|
788
|
-
props["aria-describedby"],
|
|
789
|
-
field == null ? void 0 : field.describedBy,
|
|
790
|
-
showError ? ownErrorId : void 0
|
|
791
|
-
].filter(Boolean).join(" ") || void 0;
|
|
815
|
+
const describedBy = mergeIds(props["aria-describedby"], field == null ? void 0 : field.describedBy, showError ? ownErrorId : void 0);
|
|
792
816
|
return /* @__PURE__ */ jsxs3("div", { style: { minWidth: 0 }, children: [
|
|
793
817
|
/* @__PURE__ */ jsxs3("div", { className: "kjun-input-wrap", "data-disabled": disabled || void 0, children: [
|
|
794
818
|
(prefix || prefixIcon) && /* @__PURE__ */ jsx5(
|
|
@@ -1196,6 +1220,13 @@ function hasContent(node) {
|
|
|
1196
1220
|
return true;
|
|
1197
1221
|
}
|
|
1198
1222
|
|
|
1223
|
+
// shared/package-runtime/alert-live.ts
|
|
1224
|
+
function alertRole(tone, live) {
|
|
1225
|
+
if (live === "off") return void 0;
|
|
1226
|
+
if (live) return live === "assertive" ? "alert" : "status";
|
|
1227
|
+
return tone === "danger" ? "alert" : "status";
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1199
1230
|
// packages/react/src/display.tsx
|
|
1200
1231
|
import { tokens as tokens7 } from "@kjun-ui/tokens";
|
|
1201
1232
|
import {
|
|
@@ -1353,6 +1384,7 @@ function KjunAlert({
|
|
|
1353
1384
|
size = "md",
|
|
1354
1385
|
title,
|
|
1355
1386
|
closable = false,
|
|
1387
|
+
live,
|
|
1356
1388
|
children,
|
|
1357
1389
|
actions,
|
|
1358
1390
|
onClose
|
|
@@ -1363,7 +1395,7 @@ function KjunAlert({
|
|
|
1363
1395
|
return /* @__PURE__ */ jsxs6(
|
|
1364
1396
|
"div",
|
|
1365
1397
|
{
|
|
1366
|
-
role: tone
|
|
1398
|
+
role: alertRole(tone, live),
|
|
1367
1399
|
className: "kjun-alert",
|
|
1368
1400
|
"data-size": small ? "sm" : "md",
|
|
1369
1401
|
style: {
|
|
@@ -1972,6 +2004,7 @@ import { tokens as tokens12 } from "@kjun-ui/tokens";
|
|
|
1972
2004
|
import {
|
|
1973
2005
|
createContext as createContext9,
|
|
1974
2006
|
forwardRef as forwardRef3,
|
|
2007
|
+
useCallback as useCallback2,
|
|
1975
2008
|
useContext as useContext9,
|
|
1976
2009
|
useId as useId5
|
|
1977
2010
|
} from "react";
|
|
@@ -2100,12 +2133,17 @@ function KjunCheckbox({
|
|
|
2100
2133
|
onChange
|
|
2101
2134
|
}) {
|
|
2102
2135
|
const checked = Array.isArray(value) ? value.includes(val) : value;
|
|
2136
|
+
const field = useKjunField();
|
|
2103
2137
|
return /* @__PURE__ */ jsxs9(
|
|
2104
2138
|
AriaCheckbox,
|
|
2105
2139
|
{
|
|
2106
2140
|
isSelected: checked,
|
|
2107
2141
|
isDisabled: disabled,
|
|
2108
2142
|
"aria-label": ariaLabel,
|
|
2143
|
+
"aria-describedby": field == null ? void 0 : field.describedBy,
|
|
2144
|
+
isInvalid: !!(field == null ? void 0 : field.error),
|
|
2145
|
+
isRequired: field == null ? void 0 : field.required,
|
|
2146
|
+
validationBehavior: "aria",
|
|
2109
2147
|
className: "kjun-choice" + (disabled ? " kjun-choice--disabled" : ""),
|
|
2110
2148
|
onChange: (next) => {
|
|
2111
2149
|
const result = Array.isArray(value) ? next ? [...value, val] : value.filter((v) => v !== val) : next;
|
|
@@ -2135,12 +2173,23 @@ function KjunSwitch({
|
|
|
2135
2173
|
onValueChange,
|
|
2136
2174
|
onChange
|
|
2137
2175
|
}) {
|
|
2176
|
+
const field = useKjunField();
|
|
2177
|
+
const invalid = !!(field == null ? void 0 : field.error), required = !!(field == null ? void 0 : field.required);
|
|
2178
|
+
const markInput = useCallback2((input) => {
|
|
2179
|
+
if (!input) return;
|
|
2180
|
+
if (invalid) input.setAttribute("aria-invalid", "true");
|
|
2181
|
+
else input.removeAttribute("aria-invalid");
|
|
2182
|
+
if (required) input.setAttribute("aria-required", "true");
|
|
2183
|
+
else input.removeAttribute("aria-required");
|
|
2184
|
+
}, [invalid, required]);
|
|
2138
2185
|
return /* @__PURE__ */ jsxs9(
|
|
2139
2186
|
AriaSwitch,
|
|
2140
2187
|
{
|
|
2141
2188
|
isSelected: value,
|
|
2142
2189
|
isDisabled: disabled,
|
|
2143
2190
|
"aria-label": ariaLabel || label,
|
|
2191
|
+
"aria-describedby": field == null ? void 0 : field.describedBy,
|
|
2192
|
+
inputRef: markInput,
|
|
2144
2193
|
className: "kjun-choice" + (disabled ? " kjun-choice--disabled" : ""),
|
|
2145
2194
|
onChange: (next) => {
|
|
2146
2195
|
onValueChange == null ? void 0 : onValueChange(next);
|
|
@@ -2276,7 +2325,7 @@ var KjunTextarea = forwardRef3(
|
|
|
2276
2325
|
required: (_a = props.required) != null ? _a : field == null ? void 0 : field.required,
|
|
2277
2326
|
"aria-label": ariaLabel || props["aria-label"],
|
|
2278
2327
|
"aria-labelledby": props["aria-labelledby"] || (field == null ? void 0 : field.labelId),
|
|
2279
|
-
"aria-describedby": props["aria-describedby"]
|
|
2328
|
+
"aria-describedby": mergeIds(props["aria-describedby"], field == null ? void 0 : field.describedBy),
|
|
2280
2329
|
"aria-invalid": error || !!(field == null ? void 0 : field.error) || void 0,
|
|
2281
2330
|
className: "kjun-input kjun-textarea " + className,
|
|
2282
2331
|
style: {
|
|
@@ -2437,6 +2486,7 @@ function FloatingPanel({
|
|
|
2437
2486
|
field = false,
|
|
2438
2487
|
flip = true,
|
|
2439
2488
|
nonModal = false,
|
|
2489
|
+
ownsDismiss = false,
|
|
2440
2490
|
returnFocus
|
|
2441
2491
|
}) {
|
|
2442
2492
|
const motion = usePresence(open, useReducedMotion(), tokens13.motion.popupExit);
|
|
@@ -2468,7 +2518,9 @@ function FloatingPanel({
|
|
|
2468
2518
|
isNonModal: nonModal,
|
|
2469
2519
|
isKeyboardDismissDisabled: layer.keyboardManaged,
|
|
2470
2520
|
isOpen: motion.present,
|
|
2471
|
-
onOpenChange
|
|
2521
|
+
onOpenChange: ownsDismiss && layer.keyboardManaged ? (next) => {
|
|
2522
|
+
if (next) onOpenChange(next);
|
|
2523
|
+
} : onOpenChange,
|
|
2472
2524
|
triggerRef,
|
|
2473
2525
|
UNSTABLE_portalContainer: container,
|
|
2474
2526
|
placement: placement.replace("-", " "),
|
|
@@ -2491,8 +2543,69 @@ function FloatingPanel({
|
|
|
2491
2543
|
|
|
2492
2544
|
// packages/react/src/popover.tsx
|
|
2493
2545
|
import { tokens as tokens14 } from "@kjun-ui/tokens";
|
|
2494
|
-
import { useCallback as
|
|
2546
|
+
import { useCallback as useCallback3, useEffect as useEffect6, useId as useId6, useRef as useRef14, useState as useState10 } from "react";
|
|
2495
2547
|
import { Dialog as Dialog2, Focusable, OverlayArrow, Tooltip, TooltipTrigger } from "react-aria-components";
|
|
2548
|
+
|
|
2549
|
+
// shared/package-runtime/popover-nonmodal.ts
|
|
2550
|
+
var tabbableSelector = 'button,input,select,textarea,[href],[tabindex]:not([tabindex="-1"])';
|
|
2551
|
+
function tabbable(element) {
|
|
2552
|
+
return element.tabIndex >= 0 && !element.disabled && element.getClientRects().length > 0 && !element.closest("[inert]");
|
|
2553
|
+
}
|
|
2554
|
+
function tabbables(root) {
|
|
2555
|
+
return [...root.querySelectorAll(tabbableSelector)].filter(tabbable);
|
|
2556
|
+
}
|
|
2557
|
+
function nextTabbableAfter(trigger, skip) {
|
|
2558
|
+
var _a;
|
|
2559
|
+
return (_a = tabbables(trigger.ownerDocument).find((element) => !trigger.contains(element) && !(skip == null ? void 0 : skip.contains(element)) && !!(trigger.compareDocumentPosition(element) & Node.DOCUMENT_POSITION_FOLLOWING))) != null ? _a : null;
|
|
2560
|
+
}
|
|
2561
|
+
function installNonModalPopover({ panel, trigger, close }) {
|
|
2562
|
+
var _a, _b;
|
|
2563
|
+
const doc = (_a = trigger()) == null ? void 0 : _a.ownerDocument;
|
|
2564
|
+
if (!doc) return () => {
|
|
2565
|
+
};
|
|
2566
|
+
const inside = (node) => {
|
|
2567
|
+
var _a2, _b2;
|
|
2568
|
+
if (!(node instanceof Node)) return false;
|
|
2569
|
+
const element = node instanceof Element ? node : node.parentElement;
|
|
2570
|
+
return !!(((_a2 = panel()) == null ? void 0 : _a2.contains(node)) || ((_b2 = trigger()) == null ? void 0 : _b2.contains(node)) || (element == null ? void 0 : element.closest(".kjun-floating")));
|
|
2571
|
+
};
|
|
2572
|
+
const onKeyDown = (event) => {
|
|
2573
|
+
var _a2, _b2, _c;
|
|
2574
|
+
const root = panel(), opener = trigger();
|
|
2575
|
+
if (event.key !== "Tab" || !root || !opener || !root.contains(event.target)) return;
|
|
2576
|
+
const items = tabbables(root), first = items[0], last = items.at(-1);
|
|
2577
|
+
if (event.shiftKey && (event.target === first || event.target === root || !first)) {
|
|
2578
|
+
event.preventDefault();
|
|
2579
|
+
event.stopPropagation();
|
|
2580
|
+
((_a2 = tabbables(opener)[0]) != null ? _a2 : opener).focus();
|
|
2581
|
+
} else if (!event.shiftKey && (event.target === last || !last)) {
|
|
2582
|
+
event.preventDefault();
|
|
2583
|
+
event.stopPropagation();
|
|
2584
|
+
const next = (_c = (_b2 = nextTabbableAfter(opener, root)) != null ? _b2 : tabbables(opener)[0]) != null ? _c : opener;
|
|
2585
|
+
close();
|
|
2586
|
+
let frames = 0;
|
|
2587
|
+
const moveOn = () => {
|
|
2588
|
+
if (root.isConnected && frames++ < 60) requestAnimationFrame(moveOn);
|
|
2589
|
+
else next.focus();
|
|
2590
|
+
};
|
|
2591
|
+
moveOn();
|
|
2592
|
+
}
|
|
2593
|
+
};
|
|
2594
|
+
const onOutside = (event) => {
|
|
2595
|
+
if (!inside(event.target)) close();
|
|
2596
|
+
};
|
|
2597
|
+
const view = (_b = doc.defaultView) != null ? _b : window;
|
|
2598
|
+
view.addEventListener("keydown", onKeyDown, true);
|
|
2599
|
+
doc.addEventListener("focusin", onOutside, true);
|
|
2600
|
+
doc.addEventListener("pointerdown", onOutside, true);
|
|
2601
|
+
return () => {
|
|
2602
|
+
view.removeEventListener("keydown", onKeyDown, true);
|
|
2603
|
+
doc.removeEventListener("focusin", onOutside, true);
|
|
2604
|
+
doc.removeEventListener("pointerdown", onOutside, true);
|
|
2605
|
+
};
|
|
2606
|
+
}
|
|
2607
|
+
|
|
2608
|
+
// packages/react/src/popover.tsx
|
|
2496
2609
|
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2497
2610
|
function KjunPopover({
|
|
2498
2611
|
noPadding = false,
|
|
@@ -2506,6 +2619,8 @@ function KjunPopover({
|
|
|
2506
2619
|
ariaLabel,
|
|
2507
2620
|
placement = "bottom",
|
|
2508
2621
|
returnFocus,
|
|
2622
|
+
header,
|
|
2623
|
+
modal = true,
|
|
2509
2624
|
trigger,
|
|
2510
2625
|
children
|
|
2511
2626
|
}) {
|
|
@@ -2513,7 +2628,7 @@ function KjunPopover({
|
|
|
2513
2628
|
const expanded = usePopupExpanded(open, ref);
|
|
2514
2629
|
const focusOnMount = useRef14(focusOnOpen);
|
|
2515
2630
|
focusOnMount.current = focusOnOpen;
|
|
2516
|
-
const focusContent =
|
|
2631
|
+
const focusContent = useCallback3((node) => {
|
|
2517
2632
|
if (node && focusOnMount.current) node.focus();
|
|
2518
2633
|
}, []);
|
|
2519
2634
|
const resolveReturn = returnFocus === void 0 ? void 0 : () => typeof returnFocus === "function" ? returnFocus() : returnFocus instanceof HTMLElement ? returnFocus : returnFocus.current;
|
|
@@ -2521,6 +2636,23 @@ function KjunPopover({
|
|
|
2521
2636
|
setInternal(v);
|
|
2522
2637
|
onOpenChange == null ? void 0 : onOpenChange(v);
|
|
2523
2638
|
};
|
|
2639
|
+
const skipReturn = useRef14(false);
|
|
2640
|
+
useEffect6(() => {
|
|
2641
|
+
if (!open || modal) return;
|
|
2642
|
+
skipReturn.current = false;
|
|
2643
|
+
return installNonModalPopover({
|
|
2644
|
+
panel: () => {
|
|
2645
|
+
var _a, _b;
|
|
2646
|
+
return (_b = (_a = document.getElementById(id)) == null ? void 0 : _a.closest(".kjun-floating")) != null ? _b : null;
|
|
2647
|
+
},
|
|
2648
|
+
trigger: () => ref.current,
|
|
2649
|
+
close: () => {
|
|
2650
|
+
skipReturn.current = true;
|
|
2651
|
+
change(false);
|
|
2652
|
+
}
|
|
2653
|
+
});
|
|
2654
|
+
});
|
|
2655
|
+
const content = /* @__PURE__ */ jsx14("div", { className: "kjun-popover-content", "data-no-padding": noPadding, children: typeof children === "function" ? children(() => change(false)) : children });
|
|
2524
2656
|
return /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2525
2657
|
/* @__PURE__ */ jsx14(
|
|
2526
2658
|
"div",
|
|
@@ -2548,26 +2680,29 @@ function KjunPopover({
|
|
|
2548
2680
|
open,
|
|
2549
2681
|
onOpenChange: change,
|
|
2550
2682
|
triggerRef: ref,
|
|
2551
|
-
className: "kjun-content-popover",
|
|
2683
|
+
className: "kjun-content-popover" + (header != null ? " kjun-popover-has-header" : ""),
|
|
2552
2684
|
placement,
|
|
2553
2685
|
matchTriggerWidth,
|
|
2554
2686
|
maxHeight,
|
|
2555
2687
|
flip,
|
|
2556
|
-
returnFocus: resolveReturn,
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2688
|
+
returnFocus: () => skipReturn.current ? false : resolveReturn == null ? void 0 : resolveReturn(),
|
|
2689
|
+
nonModal: !modal,
|
|
2690
|
+
ownsDismiss: !modal,
|
|
2691
|
+
children: (() => {
|
|
2692
|
+
const dialogProps = {
|
|
2560
2693
|
id,
|
|
2561
|
-
"aria-label": ariaLabel || "\uC0C1\uC138 \uC815\uBCF4",
|
|
2694
|
+
"aria-label": header != null && !ariaLabel ? void 0 : ariaLabel || "\uC0C1\uC138 \uC815\uBCF4",
|
|
2695
|
+
"aria-labelledby": header != null && !ariaLabel ? id + "-header" : void 0,
|
|
2562
2696
|
className: "kjun-popover-dialog",
|
|
2563
|
-
style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${tokens14.extensions.floating.maxHeight}px)`, overflowY: "auto" }
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
}
|
|
2570
|
-
|
|
2697
|
+
style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${tokens14.extensions.floating.maxHeight}px)`, overflowY: header != null ? void 0 : "auto" }
|
|
2698
|
+
};
|
|
2699
|
+
const body = /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2700
|
+
header != null && /* @__PURE__ */ jsx14("div", { id: id + "-header", className: "kjun-popover-header", children: header }),
|
|
2701
|
+
header != null ? /* @__PURE__ */ jsx14("div", { className: "kjun-popover-body", children: content }) : content,
|
|
2702
|
+
/* @__PURE__ */ jsx14(FeedbackLayerOutlet, {})
|
|
2703
|
+
] });
|
|
2704
|
+
return modal ? /* @__PURE__ */ jsx14(Dialog2, { ...dialogProps, ref: focusContent, children: body }) : /* @__PURE__ */ jsx14("section", { ...dialogProps, role: "dialog", tabIndex: -1, ref: focusContent, children: body });
|
|
2705
|
+
})()
|
|
2571
2706
|
}
|
|
2572
2707
|
)
|
|
2573
2708
|
] });
|
|
@@ -2576,10 +2711,16 @@ function KjunTooltip({
|
|
|
2576
2711
|
content = "",
|
|
2577
2712
|
placement = "top",
|
|
2578
2713
|
delay = 0,
|
|
2714
|
+
open: controlled,
|
|
2715
|
+
onOpenChange,
|
|
2579
2716
|
children
|
|
2580
2717
|
}) {
|
|
2581
2718
|
const container = useKjunPortalContainer();
|
|
2582
|
-
const [
|
|
2719
|
+
const [internal, setInternal] = useState10(false), open = controlled != null ? controlled : internal;
|
|
2720
|
+
const setOpen = (value) => {
|
|
2721
|
+
setInternal(value);
|
|
2722
|
+
onOpenChange == null ? void 0 : onOpenChange(value);
|
|
2723
|
+
};
|
|
2583
2724
|
const layer = useLayer(open, open, "tooltip", () => setOpen(false));
|
|
2584
2725
|
return /* @__PURE__ */ jsxs10(TooltipTrigger, { isOpen: open && !layer.blocked, onOpenChange: setOpen, delay, closeDelay: 0, isDisabled: !content || !layer.scopeActive, children: [
|
|
2585
2726
|
/* @__PURE__ */ jsx14(Focusable, { children }),
|
|
@@ -2602,7 +2743,7 @@ function KjunTooltip({
|
|
|
2602
2743
|
|
|
2603
2744
|
// packages/react/src/dropdown.tsx
|
|
2604
2745
|
import { tokens as tokens15 } from "@kjun-ui/tokens";
|
|
2605
|
-
import { cloneElement, createContext as createContext10, isValidElement as isValidElement2, useCallback as
|
|
2746
|
+
import { cloneElement, createContext as createContext10, isValidElement as isValidElement2, useCallback as useCallback4, useContext as useContext10, useEffect as useEffect7, useId as useId7, useRef as useRef15, useState as useState11 } from "react";
|
|
2606
2747
|
import { Menu, MenuItem, Separator } from "react-aria-components";
|
|
2607
2748
|
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2608
2749
|
var DropdownContext = createContext10(null);
|
|
@@ -2620,7 +2761,7 @@ function KjunDropdown({
|
|
|
2620
2761
|
const [open, setOpen] = useState11(false), currentOpen = useRef15(false), ref = useRef15(null), id = "kjun-" + useId7();
|
|
2621
2762
|
const menuFocusCleanup = useRef15(() => {
|
|
2622
2763
|
});
|
|
2623
|
-
const bindMenu =
|
|
2764
|
+
const bindMenu = useCallback4((menu) => {
|
|
2624
2765
|
menuFocusCleanup.current();
|
|
2625
2766
|
menuFocusCleanup.current = () => {
|
|
2626
2767
|
};
|
|
@@ -2630,7 +2771,7 @@ function KjunDropdown({
|
|
|
2630
2771
|
cancelAnimationFrame(frame);
|
|
2631
2772
|
frame = requestAnimationFrame(() => {
|
|
2632
2773
|
if (!currentOpen.current || !menu.isConnected || menu.ownerDocument.activeElement !== menu || menu.closest('[inert], [aria-hidden="true"]')) return;
|
|
2633
|
-
const item = menu.querySelector('[data-focused="true"]:not([data-disabled])') || menu.querySelector('[role="menuitem"]:not([data-disabled])');
|
|
2774
|
+
const item = menu.querySelector('[data-focused="true"]:not([data-disabled])') || menu.querySelector(':is([role="menuitem"], [role="menuitemradio"]):not([data-disabled])');
|
|
2634
2775
|
item == null ? void 0 : item.focus({ preventScroll: true });
|
|
2635
2776
|
});
|
|
2636
2777
|
};
|
|
@@ -2671,7 +2812,7 @@ function KjunDropdown({
|
|
|
2671
2812
|
if (value) onOpen == null ? void 0 : onOpen();
|
|
2672
2813
|
else onClose == null ? void 0 : onClose();
|
|
2673
2814
|
};
|
|
2674
|
-
|
|
2815
|
+
useEffect7(() => {
|
|
2675
2816
|
if (unavailable) change(false);
|
|
2676
2817
|
}, [unavailable]);
|
|
2677
2818
|
return /* @__PURE__ */ jsxs11(DropdownContext.Provider, { value: () => change(false), children: [
|
|
@@ -2725,9 +2866,20 @@ function KjunDropdownItem({
|
|
|
2725
2866
|
onClick
|
|
2726
2867
|
}) {
|
|
2727
2868
|
const close = useContext10(DropdownContext);
|
|
2869
|
+
const node = useCallback4((element) => {
|
|
2870
|
+
if (!element) return;
|
|
2871
|
+
if (selected === null) {
|
|
2872
|
+
element.setAttribute("role", "menuitem");
|
|
2873
|
+
element.removeAttribute("aria-checked");
|
|
2874
|
+
return;
|
|
2875
|
+
}
|
|
2876
|
+
element.setAttribute("role", "menuitemradio");
|
|
2877
|
+
element.setAttribute("aria-checked", String(selected));
|
|
2878
|
+
}, [selected]);
|
|
2728
2879
|
return /* @__PURE__ */ jsxs11(
|
|
2729
2880
|
MenuItem,
|
|
2730
2881
|
{
|
|
2882
|
+
ref: node,
|
|
2731
2883
|
id,
|
|
2732
2884
|
textValue: textValue || (typeof children === "string" ? children : void 0),
|
|
2733
2885
|
isDisabled: disabled,
|
|
@@ -2813,6 +2965,17 @@ function KjunMenuButton({
|
|
|
2813
2965
|
|
|
2814
2966
|
// packages/react/src/drawer.tsx
|
|
2815
2967
|
import { tokens as tokens16 } from "@kjun-ui/tokens";
|
|
2968
|
+
|
|
2969
|
+
// shared/package-runtime/drawer-geometry.ts
|
|
2970
|
+
function drawerOverlayVars({ safeAreaTop = 0, safeAreaBottom = 0, maxHeight }) {
|
|
2971
|
+
return {
|
|
2972
|
+
"--_kjun-drawer-safe-top": Math.max(0, safeAreaTop) + "px",
|
|
2973
|
+
"--_kjun-drawer-safe-bottom": Math.max(0, safeAreaBottom) + "px",
|
|
2974
|
+
...maxHeight === void 0 ? {} : { "--_kjun-drawer-max-height": `min(${maxHeight}px, 100dvh)` }
|
|
2975
|
+
};
|
|
2976
|
+
}
|
|
2977
|
+
|
|
2978
|
+
// packages/react/src/drawer.tsx
|
|
2816
2979
|
import { Dialog as Dialog3, Modal as Modal2, ModalOverlay as ModalOverlay2 } from "react-aria-components";
|
|
2817
2980
|
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2818
2981
|
function KjunDrawer({
|
|
@@ -2829,7 +2992,10 @@ function KjunDrawer({
|
|
|
2829
2992
|
footer,
|
|
2830
2993
|
children,
|
|
2831
2994
|
onClose,
|
|
2832
|
-
ariaLabel
|
|
2995
|
+
ariaLabel,
|
|
2996
|
+
safeAreaTop = 0,
|
|
2997
|
+
safeAreaBottom = 0,
|
|
2998
|
+
maxHeight
|
|
2833
2999
|
}) {
|
|
2834
3000
|
const motion = usePresence(open, useReducedMotion(), tokens16.motion.layerExit);
|
|
2835
3001
|
const container = useKjunPortalContainer();
|
|
@@ -2845,7 +3011,7 @@ function KjunDrawer({
|
|
|
2845
3011
|
return /* @__PURE__ */ jsx16(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ jsx16(
|
|
2846
3012
|
ModalOverlay2,
|
|
2847
3013
|
{
|
|
2848
|
-
style: { zIndex: layer.zIndex },
|
|
3014
|
+
style: { zIndex: layer.zIndex, ...drawerOverlayVars({ safeAreaTop, safeAreaBottom, maxHeight }) },
|
|
2849
3015
|
isOpen: motion.present && layer.active,
|
|
2850
3016
|
isExiting: motion.present && !layer.active,
|
|
2851
3017
|
onOpenChange: (v) => {
|
|
@@ -2911,7 +3077,7 @@ function KjunDrawer({
|
|
|
2911
3077
|
}
|
|
2912
3078
|
|
|
2913
3079
|
// shared/package-runtime/combobox.ts
|
|
2914
|
-
import { useEffect as
|
|
3080
|
+
import { useEffect as useEffect8, useState as useState12 } from "react";
|
|
2915
3081
|
|
|
2916
3082
|
// shared/package-runtime/options.ts
|
|
2917
3083
|
var optionValue = (option, key = "value") => typeof option === "object" ? option[key] : option;
|
|
@@ -2990,8 +3156,8 @@ function useComboboxModel({
|
|
|
2990
3156
|
const selectedLabel = selected !== void 0 ? optionLabel(selected, labelKey) : "";
|
|
2991
3157
|
const [query2, setQuery] = useState12(selectedLabel);
|
|
2992
3158
|
const [open, setOpen] = useState12(false);
|
|
2993
|
-
|
|
2994
|
-
|
|
3159
|
+
useEffect8(() => setQuery(selectedLabel), [value, selectedLabel]);
|
|
3160
|
+
useEffect8(() => {
|
|
2995
3161
|
if (disabled) setOpen(false);
|
|
2996
3162
|
}, [disabled]);
|
|
2997
3163
|
const change = (next) => {
|
|
@@ -3025,7 +3191,7 @@ function useComboboxModel({
|
|
|
3025
3191
|
|
|
3026
3192
|
// packages/react/src/combobox.tsx
|
|
3027
3193
|
import {
|
|
3028
|
-
useEffect as
|
|
3194
|
+
useEffect as useEffect9,
|
|
3029
3195
|
useId as useId8,
|
|
3030
3196
|
useRef as useRef16,
|
|
3031
3197
|
useState as useState13
|
|
@@ -3113,8 +3279,8 @@ function SearchField({
|
|
|
3113
3279
|
const ref = useRef16(null), [highlighted, setActive] = useState13(-1), id = "kjun-" + useId8();
|
|
3114
3280
|
const focusGuard = usePopupFocusGuard(ref);
|
|
3115
3281
|
const active = !disabled && !loading && highlighted >= 0 && highlighted < options.length && !optionDisabled(options[highlighted]) ? highlighted : -1;
|
|
3116
|
-
|
|
3117
|
-
|
|
3282
|
+
useEffect9(() => setActive(-1), [value, options.length]);
|
|
3283
|
+
useEffect9(() => {
|
|
3118
3284
|
if (!open) return;
|
|
3119
3285
|
const leaveField = (event) => {
|
|
3120
3286
|
var _a, _b, _c;
|
|
@@ -3124,7 +3290,7 @@ function SearchField({
|
|
|
3124
3290
|
document.addEventListener("focusin", leaveField);
|
|
3125
3291
|
return () => document.removeEventListener("focusin", leaveField);
|
|
3126
3292
|
}, [open, onOpenChange, id]);
|
|
3127
|
-
|
|
3293
|
+
useEffect9(() => {
|
|
3128
3294
|
if (highlighted !== active) setActive(-1);
|
|
3129
3295
|
}, [highlighted, active]);
|
|
3130
3296
|
const available = options.map((o, i) => optionDisabled(o) ? -1 : i).filter((i) => i >= 0);
|
|
@@ -3325,7 +3491,7 @@ function KjunDatePicker({
|
|
|
3325
3491
|
import { useState as useState16 } from "react";
|
|
3326
3492
|
|
|
3327
3493
|
// shared/package-runtime/search-input.ts
|
|
3328
|
-
import { useEffect as
|
|
3494
|
+
import { useEffect as useEffect10, useLayoutEffect as useLayoutEffect10, useRef as useRef17, useState as useState15 } from "react";
|
|
3329
3495
|
function useSearchInputModel({
|
|
3330
3496
|
value,
|
|
3331
3497
|
disabled = false,
|
|
@@ -3348,7 +3514,7 @@ function useSearchInputModel({
|
|
|
3348
3514
|
clearTimeout(timer.current);
|
|
3349
3515
|
return () => clearTimeout(timer.current);
|
|
3350
3516
|
}, [disabled, debounce, !!loadOptions]);
|
|
3351
|
-
|
|
3517
|
+
useEffect10(() => {
|
|
3352
3518
|
const current = ++version.current, abort = new AbortController();
|
|
3353
3519
|
setFailed(false);
|
|
3354
3520
|
if (!loadOptions || !open || disabled || query2.length < minChars) {
|
|
@@ -3502,12 +3668,12 @@ import {
|
|
|
3502
3668
|
useId as useId9,
|
|
3503
3669
|
useContext as useContext11,
|
|
3504
3670
|
useRef as useRef19,
|
|
3505
|
-
useEffect as
|
|
3671
|
+
useEffect as useEffect12
|
|
3506
3672
|
} from "react";
|
|
3507
3673
|
import { ListBox, ListBoxItem } from "react-aria-components";
|
|
3508
3674
|
|
|
3509
3675
|
// shared/package-runtime/select.ts
|
|
3510
|
-
import { useEffect as
|
|
3676
|
+
import { useEffect as useEffect11, useRef as useRef18, useState as useState17 } from "react";
|
|
3511
3677
|
function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
3512
3678
|
const [internal, setInternal] = useState17(false);
|
|
3513
3679
|
const [query2, setQuery] = useState17("");
|
|
@@ -3516,7 +3682,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
3516
3682
|
const isControlled = typeof controlled === "boolean";
|
|
3517
3683
|
const open = !disabled && (isControlled ? controlled : internal);
|
|
3518
3684
|
const previousOpen = useRef18(open);
|
|
3519
|
-
|
|
3685
|
+
useEffect11(() => {
|
|
3520
3686
|
if (disabled && !isControlled) setInternal(false);
|
|
3521
3687
|
if (previousOpen.current && !open) {
|
|
3522
3688
|
setQuery("");
|
|
@@ -3525,7 +3691,7 @@ function useSelectState(controlled, disabled, pageSize, onOpenChange) {
|
|
|
3525
3691
|
}
|
|
3526
3692
|
previousOpen.current = open;
|
|
3527
3693
|
}, [open, disabled, isControlled, pageSize]);
|
|
3528
|
-
|
|
3694
|
+
useEffect11(() => {
|
|
3529
3695
|
setLimit(pageSize);
|
|
3530
3696
|
}, [pageSize]);
|
|
3531
3697
|
const changeOpen = (next) => {
|
|
@@ -3552,6 +3718,8 @@ function KjunSelect({
|
|
|
3552
3718
|
placeholder = "\uC120\uD0DD",
|
|
3553
3719
|
ariaLabel,
|
|
3554
3720
|
labelKey = "label",
|
|
3721
|
+
id: triggerId,
|
|
3722
|
+
ariaDescribedBy,
|
|
3555
3723
|
valueKey = "value",
|
|
3556
3724
|
size = "md",
|
|
3557
3725
|
disabled = false,
|
|
@@ -3580,7 +3748,13 @@ function KjunSelect({
|
|
|
3580
3748
|
const segment = useContext11(CompoundControlContext) !== null;
|
|
3581
3749
|
const spec = tokens18.input[size];
|
|
3582
3750
|
const expanded = usePopupExpanded(open, ref);
|
|
3583
|
-
|
|
3751
|
+
const registerControl = field == null ? void 0 : field.setControlId;
|
|
3752
|
+
useEffect12(() => {
|
|
3753
|
+
if (!registerControl || !triggerId) return;
|
|
3754
|
+
registerControl(triggerId);
|
|
3755
|
+
return () => registerControl(void 0);
|
|
3756
|
+
}, [registerControl, triggerId]);
|
|
3757
|
+
useEffect12(() => {
|
|
3584
3758
|
var _a, _b;
|
|
3585
3759
|
if (open && searchable) (_b = (_a = menu.current) == null ? void 0 : _a.querySelector("input")) == null ? void 0 : _b.focus({ preventScroll: true });
|
|
3586
3760
|
if (!open) composition.onCompositionEnd();
|
|
@@ -3608,7 +3782,7 @@ function KjunSelect({
|
|
|
3608
3782
|
"button",
|
|
3609
3783
|
{
|
|
3610
3784
|
ref,
|
|
3611
|
-
id: field == null ? void 0 : field.id,
|
|
3785
|
+
id: triggerId != null ? triggerId : field == null ? void 0 : field.id,
|
|
3612
3786
|
type: "button",
|
|
3613
3787
|
className: "kjun-input kjun-select-trigger",
|
|
3614
3788
|
"data-time-segment": segment || void 0,
|
|
@@ -3616,9 +3790,9 @@ function KjunSelect({
|
|
|
3616
3790
|
"aria-haspopup": "listbox",
|
|
3617
3791
|
"aria-controls": expanded ? id : void 0,
|
|
3618
3792
|
"aria-expanded": expanded,
|
|
3619
|
-
"aria-label": ariaLabel || placeholder,
|
|
3793
|
+
"aria-label": ariaLabel || (triggerId || field ? void 0 : placeholder),
|
|
3620
3794
|
"aria-labelledby": field == null ? void 0 : field.labelId,
|
|
3621
|
-
"aria-describedby": field == null ? void 0 : field.describedBy,
|
|
3795
|
+
"aria-describedby": mergeIds(ariaDescribedBy, field == null ? void 0 : field.describedBy),
|
|
3622
3796
|
"aria-invalid": error || !!(field == null ? void 0 : field.error) || void 0,
|
|
3623
3797
|
style: {
|
|
3624
3798
|
height: spec.height,
|
|
@@ -3835,10 +4009,10 @@ function Collapse({ open, children }) {
|
|
|
3835
4009
|
}
|
|
3836
4010
|
|
|
3837
4011
|
// shared/package-runtime/navigation.ts
|
|
3838
|
-
import { useEffect as
|
|
4012
|
+
import { useEffect as useEffect13, useRef as useRef21, useState as useState19 } from "react";
|
|
3839
4013
|
function useInitialTab(value, candidate, change) {
|
|
3840
4014
|
const requested = useRef21(/* @__PURE__ */ new Set());
|
|
3841
|
-
|
|
4015
|
+
useEffect13(() => {
|
|
3842
4016
|
if (value !== "") {
|
|
3843
4017
|
requested.current.clear();
|
|
3844
4018
|
return;
|
|
@@ -3850,7 +4024,7 @@ function useInitialTab(value, candidate, change) {
|
|
|
3850
4024
|
}
|
|
3851
4025
|
function useAccordionState(multiple) {
|
|
3852
4026
|
const [opened, setOpened] = useState19(/* @__PURE__ */ new Set());
|
|
3853
|
-
|
|
4027
|
+
useEffect13(() => {
|
|
3854
4028
|
if (!multiple) setOpened((previous) => previous.size > 1 ? new Set([...previous].slice(-1)) : previous);
|
|
3855
4029
|
}, [multiple]);
|
|
3856
4030
|
return {
|
|
@@ -3940,7 +4114,7 @@ import {
|
|
|
3940
4114
|
Fragment as Fragment6,
|
|
3941
4115
|
isValidElement as isValidElement3,
|
|
3942
4116
|
useContext as useContext12,
|
|
3943
|
-
useEffect as
|
|
4117
|
+
useEffect as useEffect14,
|
|
3944
4118
|
useLayoutEffect as useLayoutEffect12,
|
|
3945
4119
|
useId as useId10,
|
|
3946
4120
|
useRef as useRef22,
|
|
@@ -3987,7 +4161,7 @@ function KjunTabs({
|
|
|
3987
4161
|
clearTimeout(timer.current);
|
|
3988
4162
|
press.current = null;
|
|
3989
4163
|
};
|
|
3990
|
-
|
|
4164
|
+
useEffect14(() => clear, []);
|
|
3991
4165
|
useLayoutEffect12(() => {
|
|
3992
4166
|
if (press.current && !canOpenMenu(press.current.name)) clear();
|
|
3993
4167
|
}, [tabs, onTabMenu]);
|
|
@@ -4108,7 +4282,7 @@ function KjunAccordionItem({
|
|
|
4108
4282
|
children
|
|
4109
4283
|
}) {
|
|
4110
4284
|
const group = useContext12(AccordionContext), id = "kjun-" + useId10(), [own, setOwn] = useState20(defaultOpen), open = group ? group.opened.has(id) : own;
|
|
4111
|
-
|
|
4285
|
+
useEffect14(() => {
|
|
4112
4286
|
return group == null ? void 0 : group.register(id, defaultOpen);
|
|
4113
4287
|
}, []);
|
|
4114
4288
|
return /* @__PURE__ */ jsxs16("div", { className: "kjun-accordion-item", children: [
|
|
@@ -4270,7 +4444,7 @@ function KjunPagination({
|
|
|
4270
4444
|
import { tokens as tokens21 } from "@kjun-ui/tokens";
|
|
4271
4445
|
import {
|
|
4272
4446
|
useContext as useContext13,
|
|
4273
|
-
useEffect as
|
|
4447
|
+
useEffect as useEffect15,
|
|
4274
4448
|
useRef as useRef23,
|
|
4275
4449
|
useState as useState21
|
|
4276
4450
|
} from "react";
|
|
@@ -4354,7 +4528,7 @@ function KjunCopyButton({
|
|
|
4354
4528
|
}) {
|
|
4355
4529
|
const feedback = useOptionalKjunFeedback();
|
|
4356
4530
|
const [copied, setCopied] = useState21(false), [failed, setFailed] = useState21(false), busy = useRef23(false), timer = useRef23(void 0), mounted = useRef23(true);
|
|
4357
|
-
|
|
4531
|
+
useEffect15(() => {
|
|
4358
4532
|
mounted.current = true;
|
|
4359
4533
|
return () => {
|
|
4360
4534
|
mounted.current = false;
|
|
@@ -4494,7 +4668,7 @@ function KjunScrollFade({ children }) {
|
|
|
4494
4668
|
return prev.left === next.left && prev.right === next.right ? prev : next;
|
|
4495
4669
|
});
|
|
4496
4670
|
};
|
|
4497
|
-
|
|
4671
|
+
useEffect15(() => {
|
|
4498
4672
|
update();
|
|
4499
4673
|
const observer = new ResizeObserver(update);
|
|
4500
4674
|
if (ref.current) {
|
|
@@ -4526,10 +4700,10 @@ import {
|
|
|
4526
4700
|
import { Component, useState as useState23 } from "react";
|
|
4527
4701
|
|
|
4528
4702
|
// shared/package-runtime/use-loading-reveal.ts
|
|
4529
|
-
import { useEffect as
|
|
4703
|
+
import { useEffect as useEffect16, useState as useState22 } from "react";
|
|
4530
4704
|
function useLoadingReveal(active, delay = 0) {
|
|
4531
4705
|
const [revealed, setRevealed] = useState22(false);
|
|
4532
|
-
|
|
4706
|
+
useEffect16(() => {
|
|
4533
4707
|
setRevealed(false);
|
|
4534
4708
|
if (!active || delay <= 0) return;
|
|
4535
4709
|
const timer = setTimeout(() => setRevealed(true), delay);
|
|
@@ -5253,7 +5427,7 @@ function KjunSparkline({
|
|
|
5253
5427
|
|
|
5254
5428
|
// shared/package-runtime/table.ts
|
|
5255
5429
|
import { nextTableSort } from "@kjun-ui/tokens";
|
|
5256
|
-
import { useEffect as
|
|
5430
|
+
import { useEffect as useEffect17, useRef as useRef25, useState as useState25 } from "react";
|
|
5257
5431
|
|
|
5258
5432
|
// shared/package-runtime/table-model.ts
|
|
5259
5433
|
function getValue(row, key) {
|
|
@@ -5301,7 +5475,7 @@ function useTableModel(props) {
|
|
|
5301
5475
|
key: "",
|
|
5302
5476
|
order: "asc"
|
|
5303
5477
|
}), [internalExpanded, setExpanded] = useState25([]), [search, setSearch] = useState25(""), timer = useRef25(void 0);
|
|
5304
|
-
|
|
5478
|
+
useEffect17(() => () => clearTimeout(timer.current), []);
|
|
5305
5479
|
const sort = props.sort === void 0 ? internalSort : (_a = props.sort) != null ? _a : { key: "", order: "asc" };
|
|
5306
5480
|
const rows = sortTableRows(data, sort, { sortable, sortMode });
|
|
5307
5481
|
const key = (row, index = 0) => tableRowKey(row, rowKey, index);
|
|
@@ -5408,7 +5582,7 @@ function TableToolbar({
|
|
|
5408
5582
|
selectable && selected.length > 0 && /* @__PURE__ */ jsxs24(
|
|
5409
5583
|
"div",
|
|
5410
5584
|
{
|
|
5411
|
-
role: "
|
|
5585
|
+
role: "group",
|
|
5412
5586
|
"aria-label": "\uC120\uD0DD \uC791\uC5C5",
|
|
5413
5587
|
className: "kjun-table-selection",
|
|
5414
5588
|
children: [
|
|
@@ -5696,7 +5870,7 @@ function TableCards({
|
|
|
5696
5870
|
}
|
|
5697
5871
|
|
|
5698
5872
|
// packages/react/src/table-view.tsx
|
|
5699
|
-
import { useEffect as
|
|
5873
|
+
import { useEffect as useEffect18, useState as useState26 } from "react";
|
|
5700
5874
|
import { isComposingKey as isComposingKey4, tokens as tokens32 } from "@kjun-ui/tokens";
|
|
5701
5875
|
import { jsx as jsx34, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
5702
5876
|
function KjunTable(props) {
|
|
@@ -5727,7 +5901,7 @@ function KjunTable(props) {
|
|
|
5727
5901
|
onRetry
|
|
5728
5902
|
} = props;
|
|
5729
5903
|
const state = useTableModel2(props), query2 = useQueryDisplay(props), revealed = useLoadingReveal(query2.initialLoading, skeleton ? loadingDelay : 0), [mobile, setMobile] = useState26(false);
|
|
5730
|
-
|
|
5904
|
+
useEffect18(() => {
|
|
5731
5905
|
const media = matchMedia(`(width < ${tokens32.table.mobileBreakpoint}px)`);
|
|
5732
5906
|
const update = () => setMobile(media.matches);
|
|
5733
5907
|
update();
|
|
@@ -6093,7 +6267,7 @@ function KjunKpiRow({
|
|
|
6093
6267
|
import { tokens as tokens34 } from "@kjun-ui/tokens";
|
|
6094
6268
|
|
|
6095
6269
|
// shared/package-runtime/market-cards.ts
|
|
6096
|
-
import { useEffect as
|
|
6270
|
+
import { useEffect as useEffect19, useRef as useRef26, useState as useState27 } from "react";
|
|
6097
6271
|
function useMarketCardsModel(props, persistence) {
|
|
6098
6272
|
const {
|
|
6099
6273
|
columns,
|
|
@@ -6118,7 +6292,7 @@ function useMarketCardsModel(props, persistence) {
|
|
|
6118
6292
|
} catch (e) {
|
|
6119
6293
|
}
|
|
6120
6294
|
};
|
|
6121
|
-
|
|
6295
|
+
useEffect19(() => {
|
|
6122
6296
|
var _a, _b;
|
|
6123
6297
|
if (mounted.current === restoreSignature) return;
|
|
6124
6298
|
mounted.current = restoreSignature;
|
|
@@ -6454,7 +6628,7 @@ function watchTrailingOverflow(element, onChange) {
|
|
|
6454
6628
|
}
|
|
6455
6629
|
|
|
6456
6630
|
// packages/react/src/market-table.tsx
|
|
6457
|
-
import { useEffect as
|
|
6631
|
+
import { useEffect as useEffect20, useRef as useRef27, useState as useState28 } from "react";
|
|
6458
6632
|
import { jsx as jsx40, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
6459
6633
|
function KjunMarketTable(props) {
|
|
6460
6634
|
const {
|
|
@@ -6476,7 +6650,7 @@ function KjunMarketTable(props) {
|
|
|
6476
6650
|
renderCell
|
|
6477
6651
|
} = props;
|
|
6478
6652
|
const scroller = useRef27(null), [fadeEnd, setFadeEnd] = useState28(false);
|
|
6479
|
-
|
|
6653
|
+
useEffect20(() => scroller.current ? watchTrailingOverflow(scroller.current, setFadeEnd) : void 0, [rows, columns]);
|
|
6480
6654
|
const render = (row, col) => {
|
|
6481
6655
|
const value = getValue(row, col.key), stale = !!getValue(row, "stale");
|
|
6482
6656
|
if (cellLoading(row, col))
|
|
@@ -6785,7 +6959,7 @@ function KjunChip({ label, icon, removable = false, disabled = false, size = "md
|
|
|
6785
6959
|
}
|
|
6786
6960
|
|
|
6787
6961
|
// packages/react/src/range-input.tsx
|
|
6788
|
-
import { useEffect as
|
|
6962
|
+
import { useEffect as useEffect21, useRef as useRef29 } from "react";
|
|
6789
6963
|
import { Slider, SliderTrack, SliderThumb, Label, SliderOutput } from "react-aria-components";
|
|
6790
6964
|
import { createSliderDomain } from "@kjun-ui/tokens";
|
|
6791
6965
|
import { Fragment as Fragment18, jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
@@ -6797,7 +6971,7 @@ function RangeInput({ value, min = 0, max = 100, step = 1, disabled = false, lab
|
|
|
6797
6971
|
const latest = useRef29(value);
|
|
6798
6972
|
latest.current = value;
|
|
6799
6973
|
const active = useRef29(false);
|
|
6800
|
-
|
|
6974
|
+
useEffect21(() => {
|
|
6801
6975
|
if (!valid) console.warn("KJUN Slider: \uBC94\uC704\xB7step\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
6802
6976
|
}, [valid]);
|
|
6803
6977
|
const change = (next) => {
|
|
@@ -6834,7 +7008,7 @@ function KjunRangeSlider(props) {
|
|
|
6834
7008
|
}
|
|
6835
7009
|
|
|
6836
7010
|
// packages/react/src/quantity-stepper.tsx
|
|
6837
|
-
import { useEffect as
|
|
7011
|
+
import { useEffect as useEffect22, useRef as useRef30, useState as useState30 } from "react";
|
|
6838
7012
|
import { createNumberDomain, quantityKeyAction, tokens as tokens41 } from "@kjun-ui/tokens";
|
|
6839
7013
|
import { jsx as jsx46, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
6840
7014
|
function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, disabled = false, error = false, size = "md", block = false, id, ariaLabel, onValueChange, onChangeCommit, onInvalidInput }) {
|
|
@@ -6845,12 +7019,12 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
6845
7019
|
const [draft, setDraft] = useState30(String(value));
|
|
6846
7020
|
const field = useKjunField();
|
|
6847
7021
|
const composing = useRef30(false), dirty = useRef30(false), accepted = useRef30(value);
|
|
6848
|
-
|
|
7022
|
+
useEffect22(() => {
|
|
6849
7023
|
setDraft(String(value));
|
|
6850
7024
|
accepted.current = value;
|
|
6851
7025
|
dirty.current = false;
|
|
6852
7026
|
}, [value, precision, min, max, step]);
|
|
6853
|
-
|
|
7027
|
+
useEffect22(() => {
|
|
6854
7028
|
if (!valid) console.warn("KJUN QuantityStepper: \uBC94\uC704\xB7step\xB7\uC815\uBC00\uB3C4\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
6855
7029
|
}, [valid]);
|
|
6856
7030
|
const emit = (next) => {
|
|
@@ -6925,7 +7099,7 @@ function KjunQuantityStepper({ value, min = 0, max, step = 1, precision = 0, dis
|
|
|
6925
7099
|
}
|
|
6926
7100
|
|
|
6927
7101
|
// packages/react/src/time-picker.tsx
|
|
6928
|
-
import { Fragment as Fragment19, useEffect as
|
|
7102
|
+
import { Fragment as Fragment19, useEffect as useEffect23, useId as useId13, useMemo as useMemo2, useRef as useRef31 } from "react";
|
|
6929
7103
|
import { createTimeDomain } from "@kjun-ui/tokens";
|
|
6930
7104
|
import { jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
6931
7105
|
function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1, secondStep = 1, disabled = false, error = false, clearable = true, size = "md", ariaLabel = "\uC2DC\uAC04", onValueChange, onChangeCommit }) {
|
|
@@ -6934,7 +7108,7 @@ function KjunTimePicker({ value, precision = "minute", min, max, minuteStep = 1,
|
|
|
6934
7108
|
const fieldId = (field == null ? void 0 : field.id) || `kjun-time-${uid}`;
|
|
6935
7109
|
const domain = useMemo2(() => createTimeDomain({ precision, min, max, minuteStep, secondStep }), [precision, min, max, minuteStep, secondStep]);
|
|
6936
7110
|
const valid = domain.valid && domain.accepts(value);
|
|
6937
|
-
|
|
7111
|
+
useEffect23(() => {
|
|
6938
7112
|
if (!valid) console.warn("KJUN TimePicker: \uC2DC\uAC01 \uBC94\uC704\xB7\uAC04\uACA9\xB7\uAC12\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
6939
7113
|
}, [valid]);
|
|
6940
7114
|
const change = (next) => {
|