@bigtablet/design-system 3.25.0 → 3.26.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.css CHANGED
@@ -554,6 +554,7 @@ select:-webkit-autofill:disabled {
554
554
  letter-spacing: 0px;
555
555
  font-variant-numeric: tabular-nums;
556
556
  overflow-wrap: anywhere;
557
+ word-break: keep-all;
557
558
  }
558
559
  .description_list_layout_row .description_list_item {
559
560
  grid-template-columns: minmax(6rem, 10rem) minmax(0, 1fr);
@@ -726,6 +727,7 @@ select:-webkit-autofill:disabled {
726
727
  line-height: 20px;
727
728
  letter-spacing: 0px;
728
729
  overflow-wrap: anywhere;
730
+ word-break: keep-all;
729
731
  }
730
732
  .timeline_item_done .timeline_indicator {
731
733
  background: var(--bt-color-status-success-container);
@@ -1814,6 +1816,7 @@ body:has(.bottom_nav) {
1814
1816
  line-height: 22.5px;
1815
1817
  letter-spacing: 0px;
1816
1818
  overflow-wrap: anywhere;
1819
+ word-break: keep-all;
1817
1820
  }
1818
1821
  .stepper_description {
1819
1822
  color: var(--bt-color-text-caption);
@@ -1822,6 +1825,7 @@ body:has(.bottom_nav) {
1822
1825
  line-height: 20px;
1823
1826
  letter-spacing: 0px;
1824
1827
  overflow-wrap: anywhere;
1828
+ word-break: keep-all;
1825
1829
  }
1826
1830
  .stepper_sr_only {
1827
1831
  position: absolute;
package/dist/index.d.ts CHANGED
@@ -3245,6 +3245,12 @@ interface DrawerProps extends Omit<SafeHTMLProps<React$1.HTMLAttributes<HTMLDivE
3245
3245
  * `open` 을 끈 직후가 아니라 이 시점에 상세 데이터를 비워야 본문만 먼저 사라지지 않는다.
3246
3246
  */
3247
3247
  onExited?: () => void;
3248
+ /**
3249
+ * 슬라이드·페이드 모션을 끄고 즉시 열고 닫는다. 기본값 `false`.
3250
+ * 화면 전체를 덮는 메뉴처럼 슬라이드가 디자인에 맞지 않는 곳에서 쓴다.
3251
+ * OS 의 reduced-motion 설정은 이 값과 상관없이 항상 모션을 끈다.
3252
+ */
3253
+ disableAnimation?: boolean;
3248
3254
  }
3249
3255
  /**
3250
3256
  * 화면 가장자리에서 미끄러져 들어오는 패널(Drawer)을 렌더링한다.
@@ -3254,7 +3260,7 @@ interface DrawerProps extends Omit<SafeHTMLProps<React$1.HTMLAttributes<HTMLDivE
3254
3260
  * @returns 열림 상태일 때 렌더링된 드로어, 닫힘 상태면 null
3255
3261
  */
3256
3262
  declare const Drawer: {
3257
- ({ open, onClose, placement, size, title, footer, closeOnOverlay, dismissible, showCloseIcon, closeLabel: closeLabelProp, ariaLabel, initialFocusRef, onExited, children, className, ...props }: DrawerProps): React$1.ReactPortal | null;
3263
+ ({ open, onClose, placement, size, title, footer, closeOnOverlay, dismissible, showCloseIcon, closeLabel: closeLabelProp, ariaLabel, initialFocusRef, onExited, disableAnimation, children, className, ...props }: DrawerProps): React$1.ReactPortal | null;
3258
3264
  displayName: string;
3259
3265
  };
3260
3266
 
package/dist/index.js CHANGED
@@ -402,12 +402,12 @@ function useFocusTrap(containerRef, isActive, options) {
402
402
  const handleKeyDown2 = (e) => {
403
403
  if (e.key !== "Tab") return;
404
404
  const focusableElements2 = getFocusableElements();
405
- if (focusableElements2.length === 0) {
405
+ const firstElement = focusableElements2[0];
406
+ const lastElement = focusableElements2[focusableElements2.length - 1];
407
+ if (!firstElement || !lastElement) {
406
408
  e.preventDefault();
407
409
  return;
408
410
  }
409
- const firstElement = focusableElements2[0];
410
- const lastElement = focusableElements2[focusableElements2.length - 1];
411
411
  if (e.shiftKey) {
412
412
  if (document.activeElement === firstElement) {
413
413
  e.preventDefault();
@@ -566,7 +566,8 @@ function useListboxPopup({
566
566
  const len = items.length;
567
567
  for (let step = 0; step < len; step++) {
568
568
  i = (i + dir + len) % len;
569
- if (!items[i].disabled) {
569
+ const item = items[i];
570
+ if (item && !item.disabled) {
570
571
  setActiveIndex(i);
571
572
  break;
572
573
  }
@@ -575,15 +576,15 @@ function useListboxPopup({
575
576
  [items, isOpen, activeIndex]
576
577
  );
577
578
  const commitActive = useCallback(() => {
578
- if (activeIndex < 0 || activeIndex >= items.length) return;
579
579
  const item = items[activeIndex];
580
- if (item.disabled) return;
580
+ if (!item || item.disabled) return;
581
581
  onCommit(item);
582
582
  }, [activeIndex, items, onCommit]);
583
583
  const firstEnabled = useCallback(() => items.findIndex((o) => !o.disabled), [items]);
584
584
  const lastEnabled = useCallback(() => {
585
585
  for (let i = items.length - 1; i >= 0; i--) {
586
- if (!items[i].disabled) return i;
586
+ const item = items[i];
587
+ if (item && !item.disabled) return i;
587
588
  }
588
589
  return -1;
589
590
  }, [items]);
@@ -798,9 +799,9 @@ var Accordion = ({
798
799
  };
799
800
  function getInitials(name) {
800
801
  const parts = name.trim().split(/\s+/);
801
- if (parts.length === 0) return "";
802
- if (parts.length === 1) return parts[0].charAt(0).toUpperCase();
803
- return (parts[0].charAt(0) + parts[parts.length - 1].charAt(0)).toUpperCase();
802
+ const first = parts[0] ?? "";
803
+ const last = parts.length > 1 ? parts.at(-1) ?? "" : "";
804
+ return (first.charAt(0) + last.charAt(0)).toUpperCase();
804
805
  }
805
806
  var Avatar = ({
806
807
  src,
@@ -1349,12 +1350,14 @@ var Menu = ({ items, trigger, align = "start" }) => {
1349
1350
  }, [open, items]);
1350
1351
  const moveFocus = (dir) => {
1351
1352
  const enabled = items.flatMap((it, i) => it.disabled ? [] : [i]);
1352
- if (enabled.length === 0) return;
1353
- if (dir === "first") return void itemRefs.current[enabled[0]]?.focus();
1354
- if (dir === "last") return void itemRefs.current[enabled[enabled.length - 1]]?.focus();
1353
+ const focusAt = (i) => {
1354
+ if (i !== void 0) itemRefs.current[i]?.focus();
1355
+ };
1356
+ if (dir === "first") return focusAt(enabled[0]);
1357
+ if (dir === "last") return focusAt(enabled.at(-1));
1355
1358
  const pos2 = enabled.findIndex((i) => itemRefs.current[i] === document.activeElement);
1356
1359
  const next = pos2 < 0 ? dir === 1 ? 0 : enabled.length - 1 : (pos2 + dir + enabled.length) % enabled.length;
1357
- itemRefs.current[enabled[next]]?.focus();
1360
+ focusAt(enabled[next]);
1358
1361
  };
1359
1362
  const handleMenuKeyDown = (e) => {
1360
1363
  if (["ArrowDown", "ArrowUp", "Home", "End", "Escape"].includes(e.key)) {
@@ -1992,10 +1995,11 @@ var Tab = ({ value, className, children, onClick, onKeyDown, ...props }) => {
1992
1995
  else if (e.key === "ArrowLeft") next = (currentIndex - 1 + tabs.length) % tabs.length;
1993
1996
  else if (e.key === "Home") next = 0;
1994
1997
  else if (e.key === "End") next = tabs.length - 1;
1995
- const targetValue = tabs[next].dataset.value;
1996
- if (targetValue) {
1998
+ const target = tabs[next];
1999
+ const targetValue = target?.dataset.value;
2000
+ if (target && targetValue !== void 0) {
1997
2001
  ctx.setValue(targetValue);
1998
- tabs[next].focus();
2002
+ target.focus();
1999
2003
  }
2000
2004
  };
2001
2005
  return /* @__PURE__ */ jsx(
@@ -5301,8 +5305,9 @@ var FileInput = ({
5301
5305
  const urls = [];
5302
5306
  const limit = isPreviewVariant ? Math.min(1, files.length) : files.length;
5303
5307
  for (let i = 0; i < limit; i++) {
5304
- if (files[i].type.startsWith("image/")) {
5305
- urls.push(URL.createObjectURL(files[i]));
5308
+ const file = files[i];
5309
+ if (file?.type.startsWith("image/")) {
5310
+ urls.push(URL.createObjectURL(file));
5306
5311
  }
5307
5312
  }
5308
5313
  setPreviewUrls(urls);
@@ -5761,7 +5766,7 @@ var OtpInput = ({
5761
5766
  const filled = nextDigit.replace(/\D/g, "").slice(0, length);
5762
5767
  if (!filled) return;
5763
5768
  const newDigits2 = [...digits];
5764
- for (let i = 0; i < filled.length; i++) newDigits2[i] = filled[i];
5769
+ newDigits2.splice(0, filled.length, ...filled);
5765
5770
  updateValue(newDigits2);
5766
5771
  focusInput(Math.min(filled.length, length - 1));
5767
5772
  return;
@@ -5815,9 +5820,7 @@ var OtpInput = ({
5815
5820
  const pasted = e.clipboardData.getData("text").replace(/\D/g, "").slice(0, length);
5816
5821
  if (!pasted) return;
5817
5822
  const newDigits = [...digits];
5818
- for (let i = 0; i < pasted.length; i++) {
5819
- newDigits[i] = pasted[i];
5820
- }
5823
+ newDigits.splice(0, pasted.length, ...pasted);
5821
5824
  updateValue(newDigits);
5822
5825
  const nextIndex = Math.min(pasted.length, length - 1);
5823
5826
  focusInput(nextIndex);
@@ -6065,6 +6068,7 @@ var TagInput = ({
6065
6068
  };
6066
6069
  const removeAt = (index) => {
6067
6070
  const removed = tags[index];
6071
+ if (removed === void 0) return;
6068
6072
  setTags(tags.filter((_, i) => i !== index));
6069
6073
  setAnnouncement(t("tagInput.removed", { name: removed }));
6070
6074
  };
@@ -6275,7 +6279,7 @@ var Textarea = ({
6275
6279
  Textarea.displayName = "Textarea";
6276
6280
  var toMinutes = (value) => {
6277
6281
  if (!value) return null;
6278
- const [h, m] = value.split(":").map(Number);
6282
+ const [h = Number.NaN, m = Number.NaN] = value.split(":").map(Number);
6279
6283
  if (!Number.isInteger(h) || !Number.isInteger(m)) return null;
6280
6284
  if (h < 0 || h > 23 || m < 0 || m > 59) return null;
6281
6285
  return h * 60 + m;
@@ -6327,8 +6331,9 @@ var TimePicker = ({
6327
6331
  const candidates = Array.from({ length: Math.ceil(60 / step) }, (_, i) => i * step).filter(
6328
6332
  (m) => m < 60 && h * 60 + m >= min && h * 60 + m <= max
6329
6333
  );
6330
- if (candidates.length === 0) return;
6331
- const keep = minute !== null && candidates.includes(minute) ? minute : candidates[0];
6334
+ const firstCandidate = candidates[0];
6335
+ if (firstCandidate === void 0) return;
6336
+ const keep = minute !== null && candidates.includes(minute) ? minute : firstCandidate;
6332
6337
  emit(h, keep);
6333
6338
  };
6334
6339
  const handleMinuteChange = (raw) => {
@@ -6477,6 +6482,7 @@ var Drawer = ({
6477
6482
  ariaLabel,
6478
6483
  initialFocusRef,
6479
6484
  onExited,
6485
+ disableAnimation = false,
6480
6486
  children,
6481
6487
  className,
6482
6488
  ...props
@@ -6493,7 +6499,7 @@ var Drawer = ({
6493
6499
  const pressedOverlayRef = React20.useRef(false);
6494
6500
  const titleId = React20.useId();
6495
6501
  const [shouldRender, setShouldRender] = React20.useState(open);
6496
- const reduced = useReducedMotion();
6502
+ const instant = useReducedMotion() || disableAnimation;
6497
6503
  const isMounted = useIsMounted();
6498
6504
  useFocusTrap(panelRef, open && isMounted, {
6499
6505
  preferWithin: bodyRef,
@@ -6503,24 +6509,43 @@ var Drawer = ({
6503
6509
  if (escapeDismissible) onClose?.();
6504
6510
  });
6505
6511
  if (open && !shouldRender) setShouldRender(true);
6512
+ const renderingRef = React20.useRef(shouldRender);
6513
+ const onExitedRef = React20.useRef(onExited);
6514
+ useSafeLayoutEffect(() => {
6515
+ renderingRef.current = shouldRender;
6516
+ onExitedRef.current = onExited;
6517
+ });
6518
+ const finishExit = React20.useCallback(() => {
6519
+ if (!renderingRef.current) return;
6520
+ renderingRef.current = false;
6521
+ setShouldRender(false);
6522
+ onExitedRef.current?.();
6523
+ }, []);
6506
6524
  const overlayStyle = useSpring({
6507
- ...springEnterFrom(reduced),
6525
+ ...springEnterFrom(instant),
6508
6526
  to: { opacity: open ? 1 : 0 },
6509
- immediate: reduced,
6527
+ immediate: instant,
6510
6528
  config: OVERLAY_SPRING_CONFIG,
6511
6529
  onRest: (result) => {
6512
6530
  if (open || !result.finished) return;
6513
- setShouldRender(false);
6514
- onExited?.();
6531
+ finishExit();
6515
6532
  }
6516
6533
  });
6534
+ const overlayOpacity = overlayStyle.opacity;
6535
+ React20.useEffect(() => {
6536
+ if (open || !shouldRender) return;
6537
+ const frame = requestAnimationFrame(() => {
6538
+ if (!overlayOpacity.isAnimating && overlayOpacity.get() === 0) finishExit();
6539
+ });
6540
+ return () => cancelAnimationFrame(frame);
6541
+ }, [open, shouldRender, overlayOpacity, finishExit]);
6517
6542
  const slideFrom = SLIDE_FROM[placement];
6518
6543
  const slideRest = placement === "bottom" ? "translateY(0%)" : "translateX(0%)";
6519
6544
  const panelStyle = useSpring({
6520
- from: { transform: slideFrom },
6545
+ ...instant ? {} : { from: { transform: slideFrom } },
6521
6546
  to: { transform: open ? slideRest : slideFrom },
6522
- immediate: reduced,
6523
- config: { tension: 280, friction: 28, clamp: !open }
6547
+ immediate: instant,
6548
+ config: OVERLAY_SPRING_CONFIG
6524
6549
  });
6525
6550
  React20.useEffect(() => {
6526
6551
  if (!shouldRender) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigtablet/design-system",
3
- "version": "3.25.0",
3
+ "version": "3.26.0",
4
4
  "description": "Bigtablet Design System UI Components",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",