@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.
Files changed (26) hide show
  1. package/dist/index.cjs +209 -36
  2. package/dist/index.js +255 -81
  3. package/dist/styles.css +46 -19
  4. package/dist/types/packages/react/src/button.d.cts +2 -0
  5. package/dist/types/packages/react/src/button.d.ts +2 -0
  6. package/dist/types/packages/react/src/display.d.cts +4 -1
  7. package/dist/types/packages/react/src/display.d.ts +4 -1
  8. package/dist/types/packages/react/src/drawer.d.cts +7 -1
  9. package/dist/types/packages/react/src/drawer.d.ts +7 -1
  10. package/dist/types/packages/react/src/floating-panel.d.cts +3 -1
  11. package/dist/types/packages/react/src/floating-panel.d.ts +3 -1
  12. package/dist/types/packages/react/src/input.d.cts +5 -1
  13. package/dist/types/packages/react/src/input.d.ts +5 -1
  14. package/dist/types/packages/react/src/popover.d.cts +9 -2
  15. package/dist/types/packages/react/src/popover.d.ts +9 -2
  16. package/dist/types/packages/react/src/select-control.d.cts +5 -1
  17. package/dist/types/packages/react/src/select-control.d.ts +5 -1
  18. package/dist/types/shared/package-runtime/alert-live.d.cts +3 -0
  19. package/dist/types/shared/package-runtime/alert-live.d.ts +3 -0
  20. package/dist/types/shared/package-runtime/aria-ids.d.cts +4 -0
  21. package/dist/types/shared/package-runtime/aria-ids.d.ts +4 -0
  22. package/dist/types/shared/package-runtime/drawer-geometry.d.cts +36 -0
  23. package/dist/types/shared/package-runtime/drawer-geometry.d.ts +36 -0
  24. package/dist/types/shared/package-runtime/popover-nonmodal.d.cts +12 -0
  25. package/dist/types/shared/package-runtime/popover-nonmodal.d.ts +12 -0
  26. package/package.json +3 -3
package/dist/index.cjs CHANGED
@@ -140,9 +140,23 @@ function mergeIcons(parent, own) {
140
140
  function withFallbackIcons(registry, fallbacks) {
141
141
  return mergeIcons(fallbacks, registry);
142
142
  }
143
+ var warnedIcons = /* @__PURE__ */ new Set();
144
+ function developmentMode() {
145
+ try {
146
+ return true;
147
+ } catch (e) {
148
+ return false;
149
+ }
150
+ }
151
+ function warnMissingIcon(name) {
152
+ if (!developmentMode() || warnedIcons.has(name)) return;
153
+ warnedIcons.add(name);
154
+ 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.`);
155
+ }
143
156
  function resolveIcon(registry, name, filled = false) {
144
157
  var _a;
145
158
  const definition = Object.prototype.hasOwnProperty.call(registry, name) ? registry[name] : void 0;
159
+ if (!definition && name) warnMissingIcon(name);
146
160
  const filledNodes = filled && (definition == null ? void 0 : definition.filled);
147
161
  return { nodes: filledNodes || (definition == null ? void 0 : definition.outline) || ((_a = registry["help-circle"]) == null ? void 0 : _a.outline) || import_defaults.defaultIcons["help-circle"].outline, filled: !!filledNodes };
148
162
  }
@@ -689,6 +703,7 @@ var KjunButton = (0, import_react6.forwardRef)(
689
703
  style,
690
704
  onClick,
691
705
  type = "button",
706
+ wrap = false,
692
707
  ...rest
693
708
  } = props;
694
709
  const size = useActionSize(props.size, declaredSize);
@@ -717,6 +732,7 @@ var KjunButton = (0, import_react6.forwardRef)(
717
732
  "data-variant": variant,
718
733
  "data-size": size,
719
734
  "data-disabled": disabled,
735
+ "data-wrap": wrap || void 0,
720
736
  "aria-label": ariaLabel || rest["aria-label"],
721
737
  disabled: disabled || busy,
722
738
  "aria-busy": busy || void 0,
@@ -730,7 +746,7 @@ var KjunButton = (0, import_react6.forwardRef)(
730
746
  ...typeStyle(import_tokens5.tokens.button.typography[size]),
731
747
  borderRadius: import_tokens5.tokens.button.radii[size],
732
748
  gap: hasContent2 ? import_tokens5.tokens.button.contentGaps[size] : 0,
733
- ...navigation ? {
749
+ ...navigation || wrap ? {
734
750
  height: "auto",
735
751
  maxWidth: "100%",
736
752
  paddingBlock: Math.max(0, (height - contentHeight) / 2)
@@ -771,6 +787,14 @@ var KjunButton = (0, import_react6.forwardRef)(
771
787
 
772
788
  // packages/react/src/input.tsx
773
789
  var import_tokens7 = require("@kjun-ui/tokens");
790
+
791
+ // shared/package-runtime/aria-ids.ts
792
+ function mergeIds(...lists) {
793
+ const ids = [...new Set(lists.flatMap((list) => (list != null ? list : "").split(/\s+/)).filter(Boolean))];
794
+ return ids.length ? ids.join(" ") : void 0;
795
+ }
796
+
797
+ // packages/react/src/input.tsx
774
798
  var import_react8 = require("react");
775
799
 
776
800
  // packages/react/src/composition.ts
@@ -799,26 +823,30 @@ function KjunFormGroup({
799
823
  required = false,
800
824
  error = "",
801
825
  hint = "",
826
+ labelHidden = false,
802
827
  children
803
828
  }) {
804
829
  const uid = (0, import_react8.useId)().replace(/:/g, "");
805
830
  const fieldId = id || "kjun-field-" + uid;
806
831
  const labelId = label ? fieldId + "-label" : void 0;
807
- const describedBy = error ? fieldId + "-error" : hint ? fieldId + "-hint" : void 0;
832
+ const hintId = hint ? fieldId + "-hint" : void 0, errorId = error ? fieldId + "-error" : void 0;
833
+ const describedBy = mergeIds(hintId, errorId);
834
+ const [controlId, setControlId] = (0, import_react8.useState)();
808
835
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
809
836
  FieldContext.Provider,
810
837
  {
811
- value: { id: fieldId, labelId, describedBy, error, required },
838
+ value: { id: fieldId, labelId, describedBy, error, required, setControlId },
812
839
  children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kjun-form-group", children: [
813
- label && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "kjun-form-label", id: labelId, htmlFor: fieldId, children: [
840
+ label && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "kjun-form-label" + (labelHidden ? " kjun-sr-only" : ""), id: labelId, htmlFor: controlId || fieldId, children: [
814
841
  label,
815
842
  required && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { style: { color: "var(--_kjun-color-danger)" }, children: " *" })
816
843
  ] }),
817
844
  children,
818
- error ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { id: describedBy, className: "kjun-form-error", role: "alert", children: [
845
+ hint && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { id: hintId, className: "kjun-form-hint", children: hint }),
846
+ error && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { id: errorId, className: "kjun-form-error", role: "alert", children: [
819
847
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(KjunIcon, { name: "alert-circle", size: import_tokens7.tokens.extensions.form.messageIconSize }),
820
848
  error
821
- ] }) : hint ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { id: describedBy, className: "kjun-form-hint", children: hint }) : null
849
+ ] })
822
850
  ] })
823
851
  }
824
852
  );
@@ -876,11 +904,7 @@ var KjunInput = (0, import_react8.forwardRef)(
876
904
  const showError = !!errorMessage && !(field == null ? void 0 : field.error);
877
905
  const invalid = !!(error || errorMessage || (field == null ? void 0 : field.error));
878
906
  const ownErrorId = "kjun-input-error-" + uid;
879
- const describedBy = [
880
- props["aria-describedby"],
881
- field == null ? void 0 : field.describedBy,
882
- showError ? ownErrorId : void 0
883
- ].filter(Boolean).join(" ") || void 0;
907
+ const describedBy = mergeIds(props["aria-describedby"], field == null ? void 0 : field.describedBy, showError ? ownErrorId : void 0);
884
908
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { minWidth: 0 }, children: [
885
909
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "kjun-input-wrap", "data-disabled": disabled || void 0, children: [
886
910
  (prefix || prefixIcon) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
@@ -1283,6 +1307,13 @@ function hasContent(node) {
1283
1307
  return true;
1284
1308
  }
1285
1309
 
1310
+ // shared/package-runtime/alert-live.ts
1311
+ function alertRole(tone, live) {
1312
+ if (live === "off") return void 0;
1313
+ if (live) return live === "assertive" ? "alert" : "status";
1314
+ return tone === "danger" ? "alert" : "status";
1315
+ }
1316
+
1286
1317
  // packages/react/src/display.tsx
1287
1318
  var import_tokens10 = require("@kjun-ui/tokens");
1288
1319
  var import_react14 = require("react");
@@ -1438,6 +1469,7 @@ function KjunAlert({
1438
1469
  size = "md",
1439
1470
  title,
1440
1471
  closable = false,
1472
+ live,
1441
1473
  children,
1442
1474
  actions,
1443
1475
  onClose
@@ -1448,7 +1480,7 @@ function KjunAlert({
1448
1480
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1449
1481
  "div",
1450
1482
  {
1451
- role: tone === "danger" ? "alert" : "status",
1483
+ role: alertRole(tone, live),
1452
1484
  className: "kjun-alert",
1453
1485
  "data-size": small ? "sm" : "md",
1454
1486
  style: {
@@ -2169,12 +2201,17 @@ function KjunCheckbox({
2169
2201
  onChange
2170
2202
  }) {
2171
2203
  const checked = Array.isArray(value) ? value.includes(val) : value;
2204
+ const field = useKjunField();
2172
2205
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2173
2206
  import_react_aria_components2.Checkbox,
2174
2207
  {
2175
2208
  isSelected: checked,
2176
2209
  isDisabled: disabled,
2177
2210
  "aria-label": ariaLabel,
2211
+ "aria-describedby": field == null ? void 0 : field.describedBy,
2212
+ isInvalid: !!(field == null ? void 0 : field.error),
2213
+ isRequired: field == null ? void 0 : field.required,
2214
+ validationBehavior: "aria",
2178
2215
  className: "kjun-choice" + (disabled ? " kjun-choice--disabled" : ""),
2179
2216
  onChange: (next) => {
2180
2217
  const result = Array.isArray(value) ? next ? [...value, val] : value.filter((v) => v !== val) : next;
@@ -2204,12 +2241,23 @@ function KjunSwitch({
2204
2241
  onValueChange,
2205
2242
  onChange
2206
2243
  }) {
2244
+ const field = useKjunField();
2245
+ const invalid = !!(field == null ? void 0 : field.error), required = !!(field == null ? void 0 : field.required);
2246
+ const markInput = (0, import_react22.useCallback)((input) => {
2247
+ if (!input) return;
2248
+ if (invalid) input.setAttribute("aria-invalid", "true");
2249
+ else input.removeAttribute("aria-invalid");
2250
+ if (required) input.setAttribute("aria-required", "true");
2251
+ else input.removeAttribute("aria-required");
2252
+ }, [invalid, required]);
2207
2253
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
2208
2254
  import_react_aria_components2.Switch,
2209
2255
  {
2210
2256
  isSelected: value,
2211
2257
  isDisabled: disabled,
2212
2258
  "aria-label": ariaLabel || label,
2259
+ "aria-describedby": field == null ? void 0 : field.describedBy,
2260
+ inputRef: markInput,
2213
2261
  className: "kjun-choice" + (disabled ? " kjun-choice--disabled" : ""),
2214
2262
  onChange: (next) => {
2215
2263
  onValueChange == null ? void 0 : onValueChange(next);
@@ -2345,7 +2393,7 @@ var KjunTextarea = (0, import_react22.forwardRef)(
2345
2393
  required: (_a = props.required) != null ? _a : field == null ? void 0 : field.required,
2346
2394
  "aria-label": ariaLabel || props["aria-label"],
2347
2395
  "aria-labelledby": props["aria-labelledby"] || (field == null ? void 0 : field.labelId),
2348
- "aria-describedby": props["aria-describedby"] || (field == null ? void 0 : field.describedBy),
2396
+ "aria-describedby": mergeIds(props["aria-describedby"], field == null ? void 0 : field.describedBy),
2349
2397
  "aria-invalid": error || !!(field == null ? void 0 : field.error) || void 0,
2350
2398
  className: "kjun-input kjun-textarea " + className,
2351
2399
  style: {
@@ -2506,6 +2554,7 @@ function FloatingPanel({
2506
2554
  field = false,
2507
2555
  flip = true,
2508
2556
  nonModal = false,
2557
+ ownsDismiss = false,
2509
2558
  returnFocus
2510
2559
  }) {
2511
2560
  const motion = usePresence(open, useReducedMotion(), import_tokens17.tokens.motion.popupExit);
@@ -2537,7 +2586,9 @@ function FloatingPanel({
2537
2586
  isNonModal: nonModal,
2538
2587
  isKeyboardDismissDisabled: layer.keyboardManaged,
2539
2588
  isOpen: motion.present,
2540
- onOpenChange,
2589
+ onOpenChange: ownsDismiss && layer.keyboardManaged ? (next) => {
2590
+ if (next) onOpenChange(next);
2591
+ } : onOpenChange,
2541
2592
  triggerRef,
2542
2593
  UNSTABLE_portalContainer: container,
2543
2594
  placement: placement.replace("-", " "),
@@ -2562,6 +2613,67 @@ function FloatingPanel({
2562
2613
  var import_tokens18 = require("@kjun-ui/tokens");
2563
2614
  var import_react24 = require("react");
2564
2615
  var import_react_aria_components4 = require("react-aria-components");
2616
+
2617
+ // shared/package-runtime/popover-nonmodal.ts
2618
+ var tabbableSelector = 'button,input,select,textarea,[href],[tabindex]:not([tabindex="-1"])';
2619
+ function tabbable(element) {
2620
+ return element.tabIndex >= 0 && !element.disabled && element.getClientRects().length > 0 && !element.closest("[inert]");
2621
+ }
2622
+ function tabbables(root) {
2623
+ return [...root.querySelectorAll(tabbableSelector)].filter(tabbable);
2624
+ }
2625
+ function nextTabbableAfter(trigger, skip) {
2626
+ var _a;
2627
+ 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;
2628
+ }
2629
+ function installNonModalPopover({ panel, trigger, close }) {
2630
+ var _a, _b;
2631
+ const doc = (_a = trigger()) == null ? void 0 : _a.ownerDocument;
2632
+ if (!doc) return () => {
2633
+ };
2634
+ const inside = (node) => {
2635
+ var _a2, _b2;
2636
+ if (!(node instanceof Node)) return false;
2637
+ const element = node instanceof Element ? node : node.parentElement;
2638
+ 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")));
2639
+ };
2640
+ const onKeyDown = (event) => {
2641
+ var _a2, _b2, _c;
2642
+ const root = panel(), opener = trigger();
2643
+ if (event.key !== "Tab" || !root || !opener || !root.contains(event.target)) return;
2644
+ const items = tabbables(root), first = items[0], last = items.at(-1);
2645
+ if (event.shiftKey && (event.target === first || event.target === root || !first)) {
2646
+ event.preventDefault();
2647
+ event.stopPropagation();
2648
+ ((_a2 = tabbables(opener)[0]) != null ? _a2 : opener).focus();
2649
+ } else if (!event.shiftKey && (event.target === last || !last)) {
2650
+ event.preventDefault();
2651
+ event.stopPropagation();
2652
+ const next = (_c = (_b2 = nextTabbableAfter(opener, root)) != null ? _b2 : tabbables(opener)[0]) != null ? _c : opener;
2653
+ close();
2654
+ let frames = 0;
2655
+ const moveOn = () => {
2656
+ if (root.isConnected && frames++ < 60) requestAnimationFrame(moveOn);
2657
+ else next.focus();
2658
+ };
2659
+ moveOn();
2660
+ }
2661
+ };
2662
+ const onOutside = (event) => {
2663
+ if (!inside(event.target)) close();
2664
+ };
2665
+ const view = (_b = doc.defaultView) != null ? _b : window;
2666
+ view.addEventListener("keydown", onKeyDown, true);
2667
+ doc.addEventListener("focusin", onOutside, true);
2668
+ doc.addEventListener("pointerdown", onOutside, true);
2669
+ return () => {
2670
+ view.removeEventListener("keydown", onKeyDown, true);
2671
+ doc.removeEventListener("focusin", onOutside, true);
2672
+ doc.removeEventListener("pointerdown", onOutside, true);
2673
+ };
2674
+ }
2675
+
2676
+ // packages/react/src/popover.tsx
2565
2677
  var import_jsx_runtime14 = require("react/jsx-runtime");
2566
2678
  function KjunPopover({
2567
2679
  noPadding = false,
@@ -2575,6 +2687,8 @@ function KjunPopover({
2575
2687
  ariaLabel,
2576
2688
  placement = "bottom",
2577
2689
  returnFocus,
2690
+ header,
2691
+ modal = true,
2578
2692
  trigger,
2579
2693
  children
2580
2694
  }) {
@@ -2590,6 +2704,23 @@ function KjunPopover({
2590
2704
  setInternal(v);
2591
2705
  onOpenChange == null ? void 0 : onOpenChange(v);
2592
2706
  };
2707
+ const skipReturn = (0, import_react24.useRef)(false);
2708
+ (0, import_react24.useEffect)(() => {
2709
+ if (!open || modal) return;
2710
+ skipReturn.current = false;
2711
+ return installNonModalPopover({
2712
+ panel: () => {
2713
+ var _a, _b;
2714
+ return (_b = (_a = document.getElementById(id)) == null ? void 0 : _a.closest(".kjun-floating")) != null ? _b : null;
2715
+ },
2716
+ trigger: () => ref.current,
2717
+ close: () => {
2718
+ skipReturn.current = true;
2719
+ change(false);
2720
+ }
2721
+ });
2722
+ });
2723
+ const content = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "kjun-popover-content", "data-no-padding": noPadding, children: typeof children === "function" ? children(() => change(false)) : children });
2593
2724
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
2594
2725
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2595
2726
  "div",
@@ -2617,26 +2748,29 @@ function KjunPopover({
2617
2748
  open,
2618
2749
  onOpenChange: change,
2619
2750
  triggerRef: ref,
2620
- className: "kjun-content-popover",
2751
+ className: "kjun-content-popover" + (header != null ? " kjun-popover-has-header" : ""),
2621
2752
  placement,
2622
2753
  matchTriggerWidth,
2623
2754
  maxHeight,
2624
2755
  flip,
2625
- returnFocus: resolveReturn,
2626
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2627
- import_react_aria_components4.Dialog,
2628
- {
2756
+ returnFocus: () => skipReturn.current ? false : resolveReturn == null ? void 0 : resolveReturn(),
2757
+ nonModal: !modal,
2758
+ ownsDismiss: !modal,
2759
+ children: (() => {
2760
+ const dialogProps = {
2629
2761
  id,
2630
- "aria-label": ariaLabel || "\uC0C1\uC138 \uC815\uBCF4",
2762
+ "aria-label": header != null && !ariaLabel ? void 0 : ariaLabel || "\uC0C1\uC138 \uC815\uBCF4",
2763
+ "aria-labelledby": header != null && !ariaLabel ? id + "-header" : void 0,
2631
2764
  className: "kjun-popover-dialog",
2632
- style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${import_tokens18.tokens.extensions.floating.maxHeight}px)`, overflowY: "auto" },
2633
- ref: focusContent,
2634
- children: [
2635
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "kjun-popover-content", "data-no-padding": noPadding, children: typeof children === "function" ? children(() => change(false)) : children }),
2636
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FeedbackLayerOutlet, {})
2637
- ]
2638
- }
2639
- )
2765
+ style: { maxHeight: maxHeight != null ? maxHeight : `min(60vh, ${import_tokens18.tokens.extensions.floating.maxHeight}px)`, overflowY: header != null ? void 0 : "auto" }
2766
+ };
2767
+ const body = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
2768
+ header != null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { id: id + "-header", className: "kjun-popover-header", children: header }),
2769
+ header != null ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "kjun-popover-body", children: content }) : content,
2770
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FeedbackLayerOutlet, {})
2771
+ ] });
2772
+ return modal ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_aria_components4.Dialog, { ...dialogProps, ref: focusContent, children: body }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("section", { ...dialogProps, role: "dialog", tabIndex: -1, ref: focusContent, children: body });
2773
+ })()
2640
2774
  }
2641
2775
  )
2642
2776
  ] });
@@ -2645,10 +2779,16 @@ function KjunTooltip({
2645
2779
  content = "",
2646
2780
  placement = "top",
2647
2781
  delay = 0,
2782
+ open: controlled,
2783
+ onOpenChange,
2648
2784
  children
2649
2785
  }) {
2650
2786
  const container = useKjunPortalContainer();
2651
- const [open, setOpen] = (0, import_react24.useState)(false);
2787
+ const [internal, setInternal] = (0, import_react24.useState)(false), open = controlled != null ? controlled : internal;
2788
+ const setOpen = (value) => {
2789
+ setInternal(value);
2790
+ onOpenChange == null ? void 0 : onOpenChange(value);
2791
+ };
2652
2792
  const layer = useLayer(open, open, "tooltip", () => setOpen(false));
2653
2793
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_aria_components4.TooltipTrigger, { isOpen: open && !layer.blocked, onOpenChange: setOpen, delay, closeDelay: 0, isDisabled: !content || !layer.scopeActive, children: [
2654
2794
  /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_aria_components4.Focusable, { children }),
@@ -2699,7 +2839,7 @@ function KjunDropdown({
2699
2839
  cancelAnimationFrame(frame);
2700
2840
  frame = requestAnimationFrame(() => {
2701
2841
  if (!currentOpen.current || !menu.isConnected || menu.ownerDocument.activeElement !== menu || menu.closest('[inert], [aria-hidden="true"]')) return;
2702
- const item = menu.querySelector('[data-focused="true"]:not([data-disabled])') || menu.querySelector('[role="menuitem"]:not([data-disabled])');
2842
+ const item = menu.querySelector('[data-focused="true"]:not([data-disabled])') || menu.querySelector(':is([role="menuitem"], [role="menuitemradio"]):not([data-disabled])');
2703
2843
  item == null ? void 0 : item.focus({ preventScroll: true });
2704
2844
  });
2705
2845
  };
@@ -2794,9 +2934,20 @@ function KjunDropdownItem({
2794
2934
  onClick
2795
2935
  }) {
2796
2936
  const close = (0, import_react25.useContext)(DropdownContext);
2937
+ const node = (0, import_react25.useCallback)((element) => {
2938
+ if (!element) return;
2939
+ if (selected === null) {
2940
+ element.setAttribute("role", "menuitem");
2941
+ element.removeAttribute("aria-checked");
2942
+ return;
2943
+ }
2944
+ element.setAttribute("role", "menuitemradio");
2945
+ element.setAttribute("aria-checked", String(selected));
2946
+ }, [selected]);
2797
2947
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
2798
2948
  import_react_aria_components5.MenuItem,
2799
2949
  {
2950
+ ref: node,
2800
2951
  id,
2801
2952
  textValue: textValue || (typeof children === "string" ? children : void 0),
2802
2953
  isDisabled: disabled,
@@ -2882,6 +3033,17 @@ function KjunMenuButton({
2882
3033
 
2883
3034
  // packages/react/src/drawer.tsx
2884
3035
  var import_tokens20 = require("@kjun-ui/tokens");
3036
+
3037
+ // shared/package-runtime/drawer-geometry.ts
3038
+ function drawerOverlayVars({ safeAreaTop = 0, safeAreaBottom = 0, maxHeight }) {
3039
+ return {
3040
+ "--_kjun-drawer-safe-top": Math.max(0, safeAreaTop) + "px",
3041
+ "--_kjun-drawer-safe-bottom": Math.max(0, safeAreaBottom) + "px",
3042
+ ...maxHeight === void 0 ? {} : { "--_kjun-drawer-max-height": `min(${maxHeight}px, 100dvh)` }
3043
+ };
3044
+ }
3045
+
3046
+ // packages/react/src/drawer.tsx
2885
3047
  var import_react_aria_components6 = require("react-aria-components");
2886
3048
  var import_jsx_runtime16 = require("react/jsx-runtime");
2887
3049
  function KjunDrawer({
@@ -2898,7 +3060,10 @@ function KjunDrawer({
2898
3060
  footer,
2899
3061
  children,
2900
3062
  onClose,
2901
- ariaLabel
3063
+ ariaLabel,
3064
+ safeAreaTop = 0,
3065
+ safeAreaBottom = 0,
3066
+ maxHeight
2902
3067
  }) {
2903
3068
  const motion = usePresence(open, useReducedMotion(), import_tokens20.tokens.motion.layerExit);
2904
3069
  const container = useKjunPortalContainer();
@@ -2914,7 +3079,7 @@ function KjunDrawer({
2914
3079
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LayerScope.Provider, { value: layer.id, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2915
3080
  import_react_aria_components6.ModalOverlay,
2916
3081
  {
2917
- style: { zIndex: layer.zIndex },
3082
+ style: { zIndex: layer.zIndex, ...drawerOverlayVars({ safeAreaTop, safeAreaBottom, maxHeight }) },
2918
3083
  isOpen: motion.present && layer.active,
2919
3084
  isExiting: motion.present && !layer.active,
2920
3085
  onOpenChange: (v) => {
@@ -3609,6 +3774,8 @@ function KjunSelect({
3609
3774
  placeholder = "\uC120\uD0DD",
3610
3775
  ariaLabel,
3611
3776
  labelKey = "label",
3777
+ id: triggerId,
3778
+ ariaDescribedBy,
3612
3779
  valueKey = "value",
3613
3780
  size = "md",
3614
3781
  disabled = false,
@@ -3637,6 +3804,12 @@ function KjunSelect({
3637
3804
  const segment = (0, import_react33.useContext)(CompoundControlContext) !== null;
3638
3805
  const spec = import_tokens22.tokens.input[size];
3639
3806
  const expanded = usePopupExpanded(open, ref);
3807
+ const registerControl = field == null ? void 0 : field.setControlId;
3808
+ (0, import_react33.useEffect)(() => {
3809
+ if (!registerControl || !triggerId) return;
3810
+ registerControl(triggerId);
3811
+ return () => registerControl(void 0);
3812
+ }, [registerControl, triggerId]);
3640
3813
  (0, import_react33.useEffect)(() => {
3641
3814
  var _a, _b;
3642
3815
  if (open && searchable) (_b = (_a = menu.current) == null ? void 0 : _a.querySelector("input")) == null ? void 0 : _b.focus({ preventScroll: true });
@@ -3665,7 +3838,7 @@ function KjunSelect({
3665
3838
  "button",
3666
3839
  {
3667
3840
  ref,
3668
- id: field == null ? void 0 : field.id,
3841
+ id: triggerId != null ? triggerId : field == null ? void 0 : field.id,
3669
3842
  type: "button",
3670
3843
  className: "kjun-input kjun-select-trigger",
3671
3844
  "data-time-segment": segment || void 0,
@@ -3673,9 +3846,9 @@ function KjunSelect({
3673
3846
  "aria-haspopup": "listbox",
3674
3847
  "aria-controls": expanded ? id : void 0,
3675
3848
  "aria-expanded": expanded,
3676
- "aria-label": ariaLabel || placeholder,
3849
+ "aria-label": ariaLabel || (triggerId || field ? void 0 : placeholder),
3677
3850
  "aria-labelledby": field == null ? void 0 : field.labelId,
3678
- "aria-describedby": field == null ? void 0 : field.describedBy,
3851
+ "aria-describedby": mergeIds(ariaDescribedBy, field == null ? void 0 : field.describedBy),
3679
3852
  "aria-invalid": error || !!(field == null ? void 0 : field.error) || void 0,
3680
3853
  style: {
3681
3854
  height: spec.height,
@@ -5442,7 +5615,7 @@ function TableToolbar({
5442
5615
  selectable && selected.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5443
5616
  "div",
5444
5617
  {
5445
- role: "toolbar",
5618
+ role: "group",
5446
5619
  "aria-label": "\uC120\uD0DD \uC791\uC5C5",
5447
5620
  className: "kjun-table-selection",
5448
5621
  children: [