@nation-a/ui 0.10.8 → 0.11.1

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.js CHANGED
@@ -3539,11 +3539,42 @@ const getPortalNode = (cb) => {
3539
3539
  };
3540
3540
  const subscribe = () => () => {
3541
3541
  };
3542
+ function useDebounce(value, delay2) {
3543
+ const [debouncedValue, setDebouncedValue] = useState(value);
3544
+ useEffect(() => {
3545
+ const timer = setTimeout(() => {
3546
+ setDebouncedValue(value);
3547
+ }, delay2);
3548
+ return () => {
3549
+ clearTimeout(timer);
3550
+ };
3551
+ }, [value, delay2]);
3552
+ return debouncedValue;
3553
+ }
3542
3554
  const [TabsProvider, useTabsContext] = createContext({
3543
3555
  name: "TabsContext",
3544
3556
  hookName: "useTabsContext",
3545
3557
  providerName: "<TabsProvider />"
3546
3558
  });
3559
+ const TabContent = forwardRef((props, ref) => {
3560
+ const [contentProps, localProps] = createSplitProps()(props, ["value"]);
3561
+ const tabs = useTabsContext();
3562
+ const renderStrategyProps = useRenderStrategyPropsContext();
3563
+ const presence = usePresence({
3564
+ ...renderStrategyProps,
3565
+ present: useDebounce(tabs.value === props.value, 0),
3566
+ immediate: true
3567
+ });
3568
+ const mergedProps = mergeProps(tabs.getContentProps(contentProps), presence.getPresenceProps(), localProps);
3569
+ return /* @__PURE__ */ jsx(PresenceProvider, { value: presence, children: presence.unmounted ? null : /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref: composeRefs(presence.ref, ref) }) });
3570
+ });
3571
+ TabContent.displayName = "TabContent";
3572
+ const TabIndicator = forwardRef((props, ref) => {
3573
+ const tabs = useTabsContext();
3574
+ const mergedProps = mergeProps(tabs.getIndicatorProps(), props);
3575
+ return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref });
3576
+ });
3577
+ TabIndicator.displayName = "TabIndicator";
3547
3578
  const TabList = forwardRef((props, ref) => {
3548
3579
  const tabs = useTabsContext();
3549
3580
  const mergedProps = mergeProps(tabs.getListProps(), props);
@@ -5943,16 +5974,16 @@ const dialogRecipe = sva({
5943
5974
  }
5944
5975
  }
5945
5976
  });
5946
- const { withRootProvider: withRootProvider$1, withContext: withContext$2 } = createStyleContext(dialogRecipe);
5947
- const Root$2 = withRootProvider$1(DialogRoot);
5948
- const Backdrop$1 = withContext$2(DialogBackdrop, "backdrop");
5949
- const Trigger$1 = withContext$2(DialogTrigger, "trigger");
5950
- const Content$1 = withContext$2(DialogContent, "content");
5951
- const Title = withContext$2(DialogTitle, "title");
5952
- const Description$1 = withContext$2(DialogDescription, "description");
5953
- const Positioner = withContext$2(DialogPositioner, "positioner");
5954
- const Header = withContext$2(ark.header, "header");
5955
- const Footer = withContext$2(
5977
+ const { withRootProvider: withRootProvider$2, withContext: withContext$3 } = createStyleContext(dialogRecipe);
5978
+ const Root$3 = withRootProvider$2(DialogRoot);
5979
+ const Backdrop$1 = withContext$3(DialogBackdrop, "backdrop");
5980
+ const Trigger$2 = withContext$3(DialogTrigger, "trigger");
5981
+ const Content$2 = withContext$3(DialogContent, "content");
5982
+ const Title = withContext$3(DialogTitle, "title");
5983
+ const Description$1 = withContext$3(DialogDescription, "description");
5984
+ const Positioner = withContext$3(DialogPositioner, "positioner");
5985
+ const Header = withContext$3(ark.header, "header");
5986
+ const Footer = withContext$3(
5956
5987
  ({ orientation = "horizontal", className, ...props }) => {
5957
5988
  return /* @__PURE__ */ jsx(
5958
5989
  ark.footer,
@@ -5970,13 +6001,13 @@ const Footer = withContext$2(
5970
6001
  },
5971
6002
  "footer"
5972
6003
  );
5973
- const Body = withContext$2(ark.main, "body");
5974
- const CloseTrigger = withContext$2(DialogCloseTrigger, "closeTrigger");
6004
+ const Body = withContext$3(ark.main, "body");
6005
+ const CloseTrigger = withContext$3(DialogCloseTrigger, "closeTrigger");
5975
6006
  const Dialog = {
5976
- Root: Root$2,
6007
+ Root: Root$3,
5977
6008
  Backdrop: Backdrop$1,
5978
- Trigger: Trigger$1,
5979
- Content: Content$1,
6009
+ Trigger: Trigger$2,
6010
+ Content: Content$2,
5980
6011
  Title,
5981
6012
  Description: Description$1,
5982
6013
  Positioner,
@@ -9723,7 +9754,7 @@ const DEFAULT_MIN_SNAP = 0;
9723
9754
  const DEFAULT_MAX_SNAP = "INNER_HEIGHT";
9724
9755
  const DEFAULT_BACKDROP_OPACITY = 0.5;
9725
9756
  const BottomSheetFrame = forwardRef(
9726
- ({ children, className, initialOpenHeightPx, springs }, ref) => {
9757
+ ({ children, className, initialOpenHeightPx, springs, style: styleProp, css: cssProp }, ref) => {
9727
9758
  return /* @__PURE__ */ jsx(
9728
9759
  animated.section,
9729
9760
  {
@@ -9743,13 +9774,15 @@ const BottomSheetFrame = forwardRef(
9743
9774
  zIndex: "modal",
9744
9775
  backgroundColor: "surface.layer_1",
9745
9776
  shadow: "0 -15px 15px 0px rgba(0, 0, 0, 0.05)",
9746
- willChange: "auto"
9777
+ willChange: "auto",
9778
+ ...cssProp
9747
9779
  }),
9748
9780
  className
9749
9781
  ),
9750
9782
  style: {
9751
9783
  bottom: `calc(${initialOpenHeightPx}px - 100dvh)`,
9752
- transform: springs.transform
9784
+ transform: springs.transform,
9785
+ ...styleProp
9753
9786
  },
9754
9787
  children
9755
9788
  }
@@ -9818,7 +9851,9 @@ const BottomSheet = (props) => {
9818
9851
  bgBlocking = true,
9819
9852
  backdropOpacity = DEFAULT_BACKDROP_OPACITY,
9820
9853
  hideHandle = false,
9821
- expendOnContentDrag = false
9854
+ expendOnContentDrag = false,
9855
+ css: cssProp,
9856
+ style: styleProp
9822
9857
  } = props;
9823
9858
  const { bottomSheetRef, contentRef, snapToMin, springs } = useBottomSheet({
9824
9859
  isOpen,
@@ -9834,13 +9869,15 @@ const BottomSheet = (props) => {
9834
9869
  useEffect(() => {
9835
9870
  if (snapPercent == null ? void 0 : snapPercent.min) setInitialOpenHeightPx(window.innerHeight * (snapPercent == null ? void 0 : snapPercent.min));
9836
9871
  }, [snapPercent == null ? void 0 : snapPercent.min]);
9837
- return /* @__PURE__ */ jsxs(animated.div, { children: [
9872
+ return /* @__PURE__ */ jsxs(animated.div, { className: css$1({ width: "100%" }), children: [
9838
9873
  bgBlocking && /* @__PURE__ */ jsx(Backdrop, { isBackdropOpen: isOpen, opacity: backdropOpacity, onBackdropClick: () => snapToMin() }),
9839
9874
  /* @__PURE__ */ jsxs(
9840
9875
  BottomSheetFrame,
9841
9876
  {
9842
9877
  ref: bottomSheetRef,
9843
9878
  className,
9879
+ style: styleProp,
9880
+ css: cssProp,
9844
9881
  springs,
9845
9882
  initialOpenHeightPx,
9846
9883
  children: [
@@ -9896,20 +9933,20 @@ const navigationRecipe = sva({
9896
9933
  }
9897
9934
  }
9898
9935
  });
9899
- const { withRootProvider, withContext: withContext$1 } = createStyleContext(navigationRecipe);
9900
- const Root$1 = withRootProvider(TabsRoot);
9901
- const Trigger = withContext$1(
9936
+ const { withRootProvider: withRootProvider$1, withContext: withContext$2 } = createStyleContext(navigationRecipe);
9937
+ const Root$2 = withRootProvider$1(TabsRoot);
9938
+ const Trigger$1 = withContext$2(
9902
9939
  ({ icon, label, ...props }) => /* @__PURE__ */ jsxs(TabTrigger, { ...props, children: [
9903
9940
  icon,
9904
9941
  label
9905
9942
  ] }),
9906
9943
  "trigger"
9907
9944
  );
9908
- const List = withContext$1(TabList, "list");
9945
+ const List$1 = withContext$2(TabList, "list");
9909
9946
  const Navigation = {
9910
- Root: Root$1,
9911
- Item: Trigger,
9912
- List
9947
+ Root: Root$2,
9948
+ Item: Trigger$1,
9949
+ List: List$1
9913
9950
  };
9914
9951
  const tagRecipe = cva({
9915
9952
  base: {
@@ -10430,6 +10467,169 @@ const Textarea = forwardRef(
10430
10467
  );
10431
10468
  Textarea.displayName = "Textarea";
10432
10469
  const index = memo$1(Textarea);
10470
+ const tabsRecipe = sva({
10471
+ className: "tabs",
10472
+ slots: anatomy$1.keys(),
10473
+ base: {
10474
+ root: {
10475
+ display: "flex",
10476
+ width: "full",
10477
+ flexDirection: "column"
10478
+ },
10479
+ list: {
10480
+ display: "flex",
10481
+ flexShrink: "0",
10482
+ flexDirection: "row",
10483
+ overflowX: "auto",
10484
+ position: "relative",
10485
+ scrollbarWidth: "none",
10486
+ "&::-webkit-scrollbar": {
10487
+ display: "none"
10488
+ }
10489
+ },
10490
+ trigger: {
10491
+ alignItems: "center",
10492
+ color: "content.neutral.subtlest",
10493
+ cursor: "pointer",
10494
+ display: "inline-flex",
10495
+ flexShrink: "0",
10496
+ gap: "2",
10497
+ justifyContent: "center",
10498
+ px: "4",
10499
+ py: "2",
10500
+ textStyle: "label.md",
10501
+ transition: "all",
10502
+ transitionDuration: "normal",
10503
+ transitionTimingFunction: "default",
10504
+ whiteSpace: "nowrap",
10505
+ _disabled: {
10506
+ color: "content.neutral.disabled",
10507
+ cursor: "not-allowed"
10508
+ },
10509
+ _hover: {
10510
+ color: "content.neutral.hovered"
10511
+ },
10512
+ _selected: {
10513
+ color: "content.neutral.bold"
10514
+ }
10515
+ },
10516
+ content: {
10517
+ pt: "4"
10518
+ },
10519
+ indicator: {
10520
+ width: "var(--width)",
10521
+ height: "2px",
10522
+ borderRadius: "xs",
10523
+ background: "content.neutral.bold",
10524
+ bottom: "0px"
10525
+ }
10526
+ },
10527
+ variants: {
10528
+ variant: {
10529
+ line: {
10530
+ list: {
10531
+ borderBottomWidth: "1px",
10532
+ borderColor: "background.neutral.selected"
10533
+ }
10534
+ },
10535
+ enclosed: {
10536
+ list: {
10537
+ p: "16px 0 0 16px",
10538
+ borderRadius: "md",
10539
+ gap: "16"
10540
+ },
10541
+ trigger: {
10542
+ borderRadius: "full",
10543
+ _selected: {
10544
+ background: "background.neutral.selected"
10545
+ }
10546
+ },
10547
+ indicator: {
10548
+ display: "none"
10549
+ }
10550
+ }
10551
+ },
10552
+ fitted: {
10553
+ true: {
10554
+ root: {
10555
+ width: "100%"
10556
+ },
10557
+ list: {
10558
+ width: "100%",
10559
+ p: 1,
10560
+ overflowX: "visible"
10561
+ },
10562
+ trigger: {
10563
+ flex: 1,
10564
+ justifyContent: "center",
10565
+ overflow: "hidden",
10566
+ textOverflow: "ellipsis",
10567
+ whiteSpace: "nowrap"
10568
+ }
10569
+ }
10570
+ },
10571
+ bottomLine: {
10572
+ true: {
10573
+ list: {
10574
+ borderBottomWidth: "1px",
10575
+ borderColor: "background.neutral.selected"
10576
+ }
10577
+ },
10578
+ false: {
10579
+ list: {
10580
+ borderBottomWidth: "0px"
10581
+ }
10582
+ }
10583
+ },
10584
+ shadow: {
10585
+ true: {
10586
+ list: {
10587
+ boxShadow: "0px 8px 12px 0px var(--colors-semantic-shadow-overlay, rgba(0, 0, 0, 0.08))"
10588
+ }
10589
+ }
10590
+ }
10591
+ },
10592
+ compoundVariants: [
10593
+ {
10594
+ variant: "enclosed",
10595
+ fitted: true,
10596
+ css: {
10597
+ list: {
10598
+ background: "background.neutral.default",
10599
+ borderRadius: "full"
10600
+ }
10601
+ }
10602
+ },
10603
+ {
10604
+ variant: "enclosed",
10605
+ bottomLine: true,
10606
+ css: {
10607
+ list: {
10608
+ borderBottomWidth: "0px"
10609
+ }
10610
+ }
10611
+ }
10612
+ ],
10613
+ defaultVariants: {
10614
+ variant: "line",
10615
+ fitted: false,
10616
+ bottomLine: true,
10617
+ shadow: false
10618
+ }
10619
+ });
10620
+ const { withRootProvider, withContext: withContext$1 } = createStyleContext(tabsRecipe);
10621
+ const Root$1 = withRootProvider(TabsRoot);
10622
+ const List = withContext$1(TabList, "list");
10623
+ const Trigger = withContext$1(TabTrigger, "trigger");
10624
+ const Content$1 = withContext$1(TabContent, "content");
10625
+ const Indicator = withContext$1(TabIndicator, "indicator");
10626
+ const Tabs = Object.assign(Root$1, {
10627
+ Root: Root$1,
10628
+ List,
10629
+ Trigger,
10630
+ Content: Content$1,
10631
+ Indicator
10632
+ });
10433
10633
  function definePreset(preset2) {
10434
10634
  return preset2;
10435
10635
  }
@@ -10885,8 +11085,32 @@ const toast = {
10885
11085
  toast.queue = [];
10886
11086
  return queue;
10887
11087
  },
11088
+ /**
11089
+ * ToastProvider가 준비되었는지 확인하는 상태
11090
+ */
11091
+ isReady: false,
11092
+ /**
11093
+ * 대기 중인 토스트 메시지 큐
11094
+ */
11095
+ pendingToasts: [],
11096
+ /**
11097
+ * ToastProvider에서 호출하여 준비 상태를 설정
11098
+ */
11099
+ _setReady: () => {
11100
+ toast.isReady = true;
11101
+ if (toast.pendingToasts.length > 0) {
11102
+ toast.pendingToasts.forEach((args) => {
11103
+ toast.show(args[0], args[1]);
11104
+ });
11105
+ toast.pendingToasts = [];
11106
+ }
11107
+ },
10888
11108
  // render toast
10889
11109
  show: (message, options) => {
11110
+ if (!toast.isReady) {
11111
+ toast.pendingToasts.push([message, options]);
11112
+ return;
11113
+ }
10890
11114
  const toastData = {
10891
11115
  description: message,
10892
11116
  action: (options == null ? void 0 : options.actionLabel) ? {
@@ -10931,6 +11155,11 @@ const ToastProvider = ({ children }) => {
10931
11155
  },
10932
11156
  overlap: true
10933
11157
  });
11158
+ useEffect(() => {
11159
+ toast._setReady();
11160
+ return () => {
11161
+ };
11162
+ }, []);
10934
11163
  useEffect(() => {
10935
11164
  let currentZIndexCounter = 1300;
10936
11165
  const showToasts = () => {
@@ -10959,13 +11188,14 @@ const ToastProvider = ({ children }) => {
10959
11188
  if (toastData.duration) {
10960
11189
  options.duration = toastData.duration;
10961
11190
  }
10962
- toaster.create(options);
11191
+ setTimeout(() => {
11192
+ toaster.create(options);
11193
+ }, 0);
10963
11194
  } catch (error) {
10964
11195
  console.error("Error creating toast:", error);
10965
11196
  }
10966
11197
  });
10967
11198
  };
10968
- showToasts();
10969
11199
  const handleToastQueue = () => showToasts();
10970
11200
  window.addEventListener("toast-queue-updated", handleToastQueue);
10971
11201
  return () => {
@@ -11010,6 +11240,7 @@ export {
11010
11240
  Portal,
11011
11241
  Spinner,
11012
11242
  Stack2 as Stack,
11243
+ Tabs,
11013
11244
  index$2 as Tag,
11014
11245
  Text,
11015
11246
  index as TextArea,