@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.cjs CHANGED
@@ -3557,11 +3557,42 @@ const getPortalNode = (cb) => {
3557
3557
  };
3558
3558
  const subscribe = () => () => {
3559
3559
  };
3560
+ function useDebounce(value, delay2) {
3561
+ const [debouncedValue, setDebouncedValue] = React.useState(value);
3562
+ React.useEffect(() => {
3563
+ const timer = setTimeout(() => {
3564
+ setDebouncedValue(value);
3565
+ }, delay2);
3566
+ return () => {
3567
+ clearTimeout(timer);
3568
+ };
3569
+ }, [value, delay2]);
3570
+ return debouncedValue;
3571
+ }
3560
3572
  const [TabsProvider, useTabsContext] = createContext({
3561
3573
  name: "TabsContext",
3562
3574
  hookName: "useTabsContext",
3563
3575
  providerName: "<TabsProvider />"
3564
3576
  });
3577
+ const TabContent = React.forwardRef((props, ref) => {
3578
+ const [contentProps, localProps] = createSplitProps()(props, ["value"]);
3579
+ const tabs = useTabsContext();
3580
+ const renderStrategyProps = useRenderStrategyPropsContext();
3581
+ const presence = usePresence({
3582
+ ...renderStrategyProps,
3583
+ present: useDebounce(tabs.value === props.value, 0),
3584
+ immediate: true
3585
+ });
3586
+ const mergedProps = mergeProps(tabs.getContentProps(contentProps), presence.getPresenceProps(), localProps);
3587
+ return /* @__PURE__ */ jsxRuntime.jsx(PresenceProvider, { value: presence, children: presence.unmounted ? null : /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref: composeRefs(presence.ref, ref) }) });
3588
+ });
3589
+ TabContent.displayName = "TabContent";
3590
+ const TabIndicator = React.forwardRef((props, ref) => {
3591
+ const tabs = useTabsContext();
3592
+ const mergedProps = mergeProps(tabs.getIndicatorProps(), props);
3593
+ return /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref });
3594
+ });
3595
+ TabIndicator.displayName = "TabIndicator";
3565
3596
  const TabList = React.forwardRef((props, ref) => {
3566
3597
  const tabs = useTabsContext();
3567
3598
  const mergedProps = mergeProps(tabs.getListProps(), props);
@@ -5961,16 +5992,16 @@ const dialogRecipe = sva({
5961
5992
  }
5962
5993
  }
5963
5994
  });
5964
- const { withRootProvider: withRootProvider$1, withContext: withContext$2 } = createStyleContext(dialogRecipe);
5965
- const Root$2 = withRootProvider$1(DialogRoot);
5966
- const Backdrop$1 = withContext$2(DialogBackdrop, "backdrop");
5967
- const Trigger$1 = withContext$2(DialogTrigger, "trigger");
5968
- const Content$1 = withContext$2(DialogContent, "content");
5969
- const Title = withContext$2(DialogTitle, "title");
5970
- const Description$1 = withContext$2(DialogDescription, "description");
5971
- const Positioner = withContext$2(DialogPositioner, "positioner");
5972
- const Header = withContext$2(ark.header, "header");
5973
- const Footer = withContext$2(
5995
+ const { withRootProvider: withRootProvider$2, withContext: withContext$3 } = createStyleContext(dialogRecipe);
5996
+ const Root$3 = withRootProvider$2(DialogRoot);
5997
+ const Backdrop$1 = withContext$3(DialogBackdrop, "backdrop");
5998
+ const Trigger$2 = withContext$3(DialogTrigger, "trigger");
5999
+ const Content$2 = withContext$3(DialogContent, "content");
6000
+ const Title = withContext$3(DialogTitle, "title");
6001
+ const Description$1 = withContext$3(DialogDescription, "description");
6002
+ const Positioner = withContext$3(DialogPositioner, "positioner");
6003
+ const Header = withContext$3(ark.header, "header");
6004
+ const Footer = withContext$3(
5974
6005
  ({ orientation = "horizontal", className, ...props }) => {
5975
6006
  return /* @__PURE__ */ jsxRuntime.jsx(
5976
6007
  ark.footer,
@@ -5988,13 +6019,13 @@ const Footer = withContext$2(
5988
6019
  },
5989
6020
  "footer"
5990
6021
  );
5991
- const Body = withContext$2(ark.main, "body");
5992
- const CloseTrigger = withContext$2(DialogCloseTrigger, "closeTrigger");
6022
+ const Body = withContext$3(ark.main, "body");
6023
+ const CloseTrigger = withContext$3(DialogCloseTrigger, "closeTrigger");
5993
6024
  const Dialog = {
5994
- Root: Root$2,
6025
+ Root: Root$3,
5995
6026
  Backdrop: Backdrop$1,
5996
- Trigger: Trigger$1,
5997
- Content: Content$1,
6027
+ Trigger: Trigger$2,
6028
+ Content: Content$2,
5998
6029
  Title,
5999
6030
  Description: Description$1,
6000
6031
  Positioner,
@@ -9741,7 +9772,7 @@ const DEFAULT_MIN_SNAP = 0;
9741
9772
  const DEFAULT_MAX_SNAP = "INNER_HEIGHT";
9742
9773
  const DEFAULT_BACKDROP_OPACITY = 0.5;
9743
9774
  const BottomSheetFrame = React.forwardRef(
9744
- ({ children, className, initialOpenHeightPx, springs }, ref) => {
9775
+ ({ children, className, initialOpenHeightPx, springs, style: styleProp, css: cssProp }, ref) => {
9745
9776
  return /* @__PURE__ */ jsxRuntime.jsx(
9746
9777
  animated.section,
9747
9778
  {
@@ -9761,13 +9792,15 @@ const BottomSheetFrame = React.forwardRef(
9761
9792
  zIndex: "modal",
9762
9793
  backgroundColor: "surface.layer_1",
9763
9794
  shadow: "0 -15px 15px 0px rgba(0, 0, 0, 0.05)",
9764
- willChange: "auto"
9795
+ willChange: "auto",
9796
+ ...cssProp
9765
9797
  }),
9766
9798
  className
9767
9799
  ),
9768
9800
  style: {
9769
9801
  bottom: `calc(${initialOpenHeightPx}px - 100dvh)`,
9770
- transform: springs.transform
9802
+ transform: springs.transform,
9803
+ ...styleProp
9771
9804
  },
9772
9805
  children
9773
9806
  }
@@ -9836,7 +9869,9 @@ const BottomSheet = (props) => {
9836
9869
  bgBlocking = true,
9837
9870
  backdropOpacity = DEFAULT_BACKDROP_OPACITY,
9838
9871
  hideHandle = false,
9839
- expendOnContentDrag = false
9872
+ expendOnContentDrag = false,
9873
+ css: cssProp,
9874
+ style: styleProp
9840
9875
  } = props;
9841
9876
  const { bottomSheetRef, contentRef, snapToMin, springs } = useBottomSheet({
9842
9877
  isOpen,
@@ -9852,13 +9887,15 @@ const BottomSheet = (props) => {
9852
9887
  React.useEffect(() => {
9853
9888
  if (snapPercent == null ? void 0 : snapPercent.min) setInitialOpenHeightPx(window.innerHeight * (snapPercent == null ? void 0 : snapPercent.min));
9854
9889
  }, [snapPercent == null ? void 0 : snapPercent.min]);
9855
- return /* @__PURE__ */ jsxRuntime.jsxs(animated.div, { children: [
9890
+ return /* @__PURE__ */ jsxRuntime.jsxs(animated.div, { className: css$1({ width: "100%" }), children: [
9856
9891
  bgBlocking && /* @__PURE__ */ jsxRuntime.jsx(Backdrop, { isBackdropOpen: isOpen, opacity: backdropOpacity, onBackdropClick: () => snapToMin() }),
9857
9892
  /* @__PURE__ */ jsxRuntime.jsxs(
9858
9893
  BottomSheetFrame,
9859
9894
  {
9860
9895
  ref: bottomSheetRef,
9861
9896
  className,
9897
+ style: styleProp,
9898
+ css: cssProp,
9862
9899
  springs,
9863
9900
  initialOpenHeightPx,
9864
9901
  children: [
@@ -9914,20 +9951,20 @@ const navigationRecipe = sva({
9914
9951
  }
9915
9952
  }
9916
9953
  });
9917
- const { withRootProvider, withContext: withContext$1 } = createStyleContext(navigationRecipe);
9918
- const Root$1 = withRootProvider(TabsRoot);
9919
- const Trigger = withContext$1(
9954
+ const { withRootProvider: withRootProvider$1, withContext: withContext$2 } = createStyleContext(navigationRecipe);
9955
+ const Root$2 = withRootProvider$1(TabsRoot);
9956
+ const Trigger$1 = withContext$2(
9920
9957
  ({ icon, label, ...props }) => /* @__PURE__ */ jsxRuntime.jsxs(TabTrigger, { ...props, children: [
9921
9958
  icon,
9922
9959
  label
9923
9960
  ] }),
9924
9961
  "trigger"
9925
9962
  );
9926
- const List = withContext$1(TabList, "list");
9963
+ const List$1 = withContext$2(TabList, "list");
9927
9964
  const Navigation = {
9928
- Root: Root$1,
9929
- Item: Trigger,
9930
- List
9965
+ Root: Root$2,
9966
+ Item: Trigger$1,
9967
+ List: List$1
9931
9968
  };
9932
9969
  const tagRecipe = cva({
9933
9970
  base: {
@@ -10448,6 +10485,169 @@ const Textarea = React.forwardRef(
10448
10485
  );
10449
10486
  Textarea.displayName = "Textarea";
10450
10487
  const index = React.memo(Textarea);
10488
+ const tabsRecipe = sva({
10489
+ className: "tabs",
10490
+ slots: anatomy$1.keys(),
10491
+ base: {
10492
+ root: {
10493
+ display: "flex",
10494
+ width: "full",
10495
+ flexDirection: "column"
10496
+ },
10497
+ list: {
10498
+ display: "flex",
10499
+ flexShrink: "0",
10500
+ flexDirection: "row",
10501
+ overflowX: "auto",
10502
+ position: "relative",
10503
+ scrollbarWidth: "none",
10504
+ "&::-webkit-scrollbar": {
10505
+ display: "none"
10506
+ }
10507
+ },
10508
+ trigger: {
10509
+ alignItems: "center",
10510
+ color: "content.neutral.subtlest",
10511
+ cursor: "pointer",
10512
+ display: "inline-flex",
10513
+ flexShrink: "0",
10514
+ gap: "2",
10515
+ justifyContent: "center",
10516
+ px: "4",
10517
+ py: "2",
10518
+ textStyle: "label.md",
10519
+ transition: "all",
10520
+ transitionDuration: "normal",
10521
+ transitionTimingFunction: "default",
10522
+ whiteSpace: "nowrap",
10523
+ _disabled: {
10524
+ color: "content.neutral.disabled",
10525
+ cursor: "not-allowed"
10526
+ },
10527
+ _hover: {
10528
+ color: "content.neutral.hovered"
10529
+ },
10530
+ _selected: {
10531
+ color: "content.neutral.bold"
10532
+ }
10533
+ },
10534
+ content: {
10535
+ pt: "4"
10536
+ },
10537
+ indicator: {
10538
+ width: "var(--width)",
10539
+ height: "2px",
10540
+ borderRadius: "xs",
10541
+ background: "content.neutral.bold",
10542
+ bottom: "0px"
10543
+ }
10544
+ },
10545
+ variants: {
10546
+ variant: {
10547
+ line: {
10548
+ list: {
10549
+ borderBottomWidth: "1px",
10550
+ borderColor: "background.neutral.selected"
10551
+ }
10552
+ },
10553
+ enclosed: {
10554
+ list: {
10555
+ p: "16px 0 0 16px",
10556
+ borderRadius: "md",
10557
+ gap: "16"
10558
+ },
10559
+ trigger: {
10560
+ borderRadius: "full",
10561
+ _selected: {
10562
+ background: "background.neutral.selected"
10563
+ }
10564
+ },
10565
+ indicator: {
10566
+ display: "none"
10567
+ }
10568
+ }
10569
+ },
10570
+ fitted: {
10571
+ true: {
10572
+ root: {
10573
+ width: "100%"
10574
+ },
10575
+ list: {
10576
+ width: "100%",
10577
+ p: 1,
10578
+ overflowX: "visible"
10579
+ },
10580
+ trigger: {
10581
+ flex: 1,
10582
+ justifyContent: "center",
10583
+ overflow: "hidden",
10584
+ textOverflow: "ellipsis",
10585
+ whiteSpace: "nowrap"
10586
+ }
10587
+ }
10588
+ },
10589
+ bottomLine: {
10590
+ true: {
10591
+ list: {
10592
+ borderBottomWidth: "1px",
10593
+ borderColor: "background.neutral.selected"
10594
+ }
10595
+ },
10596
+ false: {
10597
+ list: {
10598
+ borderBottomWidth: "0px"
10599
+ }
10600
+ }
10601
+ },
10602
+ shadow: {
10603
+ true: {
10604
+ list: {
10605
+ boxShadow: "0px 8px 12px 0px var(--colors-semantic-shadow-overlay, rgba(0, 0, 0, 0.08))"
10606
+ }
10607
+ }
10608
+ }
10609
+ },
10610
+ compoundVariants: [
10611
+ {
10612
+ variant: "enclosed",
10613
+ fitted: true,
10614
+ css: {
10615
+ list: {
10616
+ background: "background.neutral.default",
10617
+ borderRadius: "full"
10618
+ }
10619
+ }
10620
+ },
10621
+ {
10622
+ variant: "enclosed",
10623
+ bottomLine: true,
10624
+ css: {
10625
+ list: {
10626
+ borderBottomWidth: "0px"
10627
+ }
10628
+ }
10629
+ }
10630
+ ],
10631
+ defaultVariants: {
10632
+ variant: "line",
10633
+ fitted: false,
10634
+ bottomLine: true,
10635
+ shadow: false
10636
+ }
10637
+ });
10638
+ const { withRootProvider, withContext: withContext$1 } = createStyleContext(tabsRecipe);
10639
+ const Root$1 = withRootProvider(TabsRoot);
10640
+ const List = withContext$1(TabList, "list");
10641
+ const Trigger = withContext$1(TabTrigger, "trigger");
10642
+ const Content$1 = withContext$1(TabContent, "content");
10643
+ const Indicator = withContext$1(TabIndicator, "indicator");
10644
+ const Tabs = Object.assign(Root$1, {
10645
+ Root: Root$1,
10646
+ List,
10647
+ Trigger,
10648
+ Content: Content$1,
10649
+ Indicator
10650
+ });
10451
10651
  function definePreset(preset2) {
10452
10652
  return preset2;
10453
10653
  }
@@ -10903,8 +11103,32 @@ const toast = {
10903
11103
  toast.queue = [];
10904
11104
  return queue;
10905
11105
  },
11106
+ /**
11107
+ * ToastProvider가 준비되었는지 확인하는 상태
11108
+ */
11109
+ isReady: false,
11110
+ /**
11111
+ * 대기 중인 토스트 메시지 큐
11112
+ */
11113
+ pendingToasts: [],
11114
+ /**
11115
+ * ToastProvider에서 호출하여 준비 상태를 설정
11116
+ */
11117
+ _setReady: () => {
11118
+ toast.isReady = true;
11119
+ if (toast.pendingToasts.length > 0) {
11120
+ toast.pendingToasts.forEach((args) => {
11121
+ toast.show(args[0], args[1]);
11122
+ });
11123
+ toast.pendingToasts = [];
11124
+ }
11125
+ },
10906
11126
  // render toast
10907
11127
  show: (message, options) => {
11128
+ if (!toast.isReady) {
11129
+ toast.pendingToasts.push([message, options]);
11130
+ return;
11131
+ }
10908
11132
  const toastData = {
10909
11133
  description: message,
10910
11134
  action: (options == null ? void 0 : options.actionLabel) ? {
@@ -10949,6 +11173,11 @@ const ToastProvider = ({ children }) => {
10949
11173
  },
10950
11174
  overlap: true
10951
11175
  });
11176
+ React.useEffect(() => {
11177
+ toast._setReady();
11178
+ return () => {
11179
+ };
11180
+ }, []);
10952
11181
  React.useEffect(() => {
10953
11182
  let currentZIndexCounter = 1300;
10954
11183
  const showToasts = () => {
@@ -10977,13 +11206,14 @@ const ToastProvider = ({ children }) => {
10977
11206
  if (toastData.duration) {
10978
11207
  options.duration = toastData.duration;
10979
11208
  }
10980
- toaster.create(options);
11209
+ setTimeout(() => {
11210
+ toaster.create(options);
11211
+ }, 0);
10981
11212
  } catch (error) {
10982
11213
  console.error("Error creating toast:", error);
10983
11214
  }
10984
11215
  });
10985
11216
  };
10986
- showToasts();
10987
11217
  const handleToastQueue = () => showToasts();
10988
11218
  window.addEventListener("toast-queue-updated", handleToastQueue);
10989
11219
  return () => {
@@ -11027,6 +11257,7 @@ exports.Navigation = Navigation;
11027
11257
  exports.Portal = Portal;
11028
11258
  exports.Spinner = Spinner;
11029
11259
  exports.Stack = Stack2;
11260
+ exports.Tabs = Tabs;
11030
11261
  exports.Tag = index$2;
11031
11262
  exports.Text = Text;
11032
11263
  exports.TextArea = index;