@nation-a/ui 0.16.5 → 0.16.7

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/README.md CHANGED
@@ -8,6 +8,7 @@ Nation-A 디자인 시스템의 UI 컴포넌트 라이브러리입니다. 모던
8
8
  - **접근성 중심**: Ark UI를 활용한 접근성 준수 컴포넌트
9
9
  - **테마 지원**: 다크모드와 라이트모드를 포함한 테마 지원
10
10
  - **Storybook 문서화**: 모든 컴포넌트에 대한 사용 예시와 문서
11
+ - **테스트**: 컴포넌트 테스트를 통한 품질 보장
11
12
 
12
13
  ## 설치
13
14
 
@@ -42,6 +43,33 @@ pnpm panda
42
43
  pnpm build
43
44
  ```
44
45
 
46
+ ## 테스트
47
+
48
+ ```bash
49
+ # 모든 테스트 실행
50
+ pnpm test
51
+
52
+ # 감시 모드로 테스트 실행
53
+ pnpm test:watch
54
+
55
+ # 테스트 커버리지 확인
56
+ pnpm test:coverage
57
+
58
+ # 새 컴포넌트를 위한 테스트 파일 생성
59
+ pnpm generate-tests
60
+ ```
61
+
62
+ ### 테스트 환경
63
+
64
+ 테스트 환경은 다음 도구를 사용합니다:
65
+
66
+ - Vitest - 테스트 실행기
67
+ - React Testing Library - React 컴포넌트 테스트
68
+ - Happy DOM - DOM 시뮬레이션
69
+ - Jest DOM - DOM 매처 확장
70
+
71
+ 자세한 내용은 `src/test/README.md`를 참조하세요.
72
+
45
73
  ## 의존성
46
74
 
47
75
  - React 18.x
package/dist/index.cjs CHANGED
@@ -298,7 +298,7 @@ function normalizeHTMLProps(props) {
298
298
  return Object.fromEntries(Object.entries(props).map(([key, value]) => [convert(key), value]));
299
299
  }
300
300
  normalizeHTMLProps.keys = htmlProps;
301
- const conditionsStr = "_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_complete,_incomplete,_dragging,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_grabbed,_underValue,_overValue,_atValue,_default,_optional,_open,_closed,_fullscreen,_loading,_hidden,_current,_currentPage,_currentStep,_today,_unavailable,_rangeStart,_rangeEnd,_now,_topmost,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,_icon,_starting,_collapsed,_off,_on,sm,smOnly,smDown,md,mdOnly,mdDown,lg,lgOnly,lgDown,xl,xlOnly,xlDown,2xl,2xlOnly,2xlDown,smToMd,smToLg,smToXl,smTo2xl,mdToLg,mdToXl,mdTo2xl,lgToXl,lgTo2xl,xlTo2xl,base";
301
+ const conditionsStr = "_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_complete,_incomplete,_dragging,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_grabbed,_underValue,_overValue,_atValue,_default,_optional,_open,_closed,_fullscreen,_loading,_hidden,_current,_currentPage,_currentStep,_today,_unavailable,_rangeStart,_rangeEnd,_now,_topmost,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,_icon,_starting,_collapsed,_off,_on,xs,xsOnly,xsDown,sm,smOnly,smDown,md,mdOnly,mdDown,lg,lgOnly,lgDown,xl,xlOnly,xlDown,2xl,2xlOnly,2xlDown,xsToSm,xsToMd,xsToLg,xsToXl,xsTo2xl,smToMd,smToLg,smToXl,smTo2xl,mdToLg,mdToXl,mdTo2xl,lgToXl,lgTo2xl,xlTo2xl,base";
302
302
  const conditions$1 = new Set(conditionsStr.split(","));
303
303
  const conditionRegex = /^@|&|&$/;
304
304
  function isCondition(value) {
@@ -344,7 +344,7 @@ const context = {
344
344
  conditions: {
345
345
  shift: sortConditions,
346
346
  finalize: finalizeConditions,
347
- breakpoints: { keys: ["base", "sm", "md", "lg", "xl", "2xl"] }
347
+ breakpoints: { keys: ["base", "xs", "sm", "md", "lg", "xl", "2xl"] }
348
348
  },
349
349
  utility: {
350
350
  transform: (prop, value) => {
@@ -802,7 +802,7 @@ const Spinner = React.forwardRef(({ className, size: size2, color: color2, ...pr
802
802
  setLottieComponent(() => mod.default);
803
803
  });
804
804
  }, []);
805
- return /* @__PURE__ */ jsxRuntime.jsx(Box2, { ref, ...props, className: cx(spinnerRecipe({ size: size2 }), css$1({ color: color2 }), className), children: LottieComponent && /* @__PURE__ */ jsxRuntime.jsx(
805
+ return /* @__PURE__ */ jsxRuntime.jsx(Box2, { ref, id: "spinner", ...props, className: cx(spinnerRecipe({ size: size2 }), css$1({ color: color2 }), className), children: LottieComponent && /* @__PURE__ */ jsxRuntime.jsx(
806
806
  LottieComponent,
807
807
  {
808
808
  options: {
@@ -7686,6 +7686,12 @@ const SelectContent = React.forwardRef((props, ref) => {
7686
7686
  return /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref: composeRefs(presence.ref, ref) });
7687
7687
  });
7688
7688
  SelectContent.displayName = "SelectContent";
7689
+ const SelectControl = React.forwardRef((props, ref) => {
7690
+ const select = useSelectContext();
7691
+ const mergedProps = mergeProps(select.getControlProps(), props);
7692
+ return /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref });
7693
+ });
7694
+ SelectControl.displayName = "SelectControl";
7689
7695
  const [SelectItemProvider, useSelectItemContext] = createContext({
7690
7696
  name: "SelectItemContext",
7691
7697
  hookName: "useSelectItemContext",
@@ -7710,6 +7716,16 @@ const SelectLabel = React.forwardRef((props, ref) => {
7710
7716
  return /* @__PURE__ */ jsxRuntime.jsx(ark.label, { ...mergedProps, ref });
7711
7717
  });
7712
7718
  SelectLabel.displayName = "SelectLabel";
7719
+ const SelectPositioner = React.forwardRef((props, ref) => {
7720
+ const select = useSelectContext();
7721
+ const mergedProps = mergeProps(select.getPositionerProps(), props);
7722
+ const presence = usePresenceContext();
7723
+ if (presence.unmounted) {
7724
+ return null;
7725
+ }
7726
+ return /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref });
7727
+ });
7728
+ SelectPositioner.displayName = "SelectPositioner";
7713
7729
  var anatomy$2 = createAnatomy("select").parts(
7714
7730
  "label",
7715
7731
  "positioner",
@@ -9952,7 +9968,18 @@ const TabsRoot = React.forwardRef((props, ref) => {
9952
9968
  return /* @__PURE__ */ jsxRuntime.jsx(TabsProvider, { value: tabs, children: /* @__PURE__ */ jsxRuntime.jsx(RenderStrategyPropsProvider, { value: renderStrategyProps, children: /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref }) }) });
9953
9969
  });
9954
9970
  TabsRoot.displayName = "TabsRoot";
9955
- const Button = ({ loading, disabled, loadingText, children, color: color2, variant, size: size2, radius, ...rest }) => {
9971
+ const Button = ({
9972
+ loading,
9973
+ disabled,
9974
+ loadingText,
9975
+ children,
9976
+ color: color2,
9977
+ variant,
9978
+ size: size2,
9979
+ radius,
9980
+ onClick,
9981
+ ...rest
9982
+ }) => {
9956
9983
  const StyledButton = styled(ark.button, buttonRecipe);
9957
9984
  return /* @__PURE__ */ jsxRuntime.jsx(
9958
9985
  StyledButton,
@@ -9963,6 +9990,7 @@ const Button = ({ loading, disabled, loadingText, children, color: color2, varia
9963
9990
  size: size2,
9964
9991
  radius,
9965
9992
  css: { pointerEvents: loading ? "none" : "auto" },
9993
+ onClick: disabled || loading ? void 0 : onClick,
9966
9994
  ...rest,
9967
9995
  children: loading ? loadingText || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
9968
9996
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -10203,7 +10231,7 @@ const Trigger$3 = withContext$7(DialogTrigger, "trigger");
10203
10231
  const Content$4 = withContext$7(DialogContent, "content");
10204
10232
  const Title = withContext$7(DialogTitle, "title");
10205
10233
  const Description$2 = withContext$7(DialogDescription, "description");
10206
- const Positioner = withContext$7(DialogPositioner, "positioner");
10234
+ const Positioner$1 = withContext$7(DialogPositioner, "positioner");
10207
10235
  const Header$1 = withContext$7(ark.header, "header");
10208
10236
  const Footer = withContext$7(
10209
10237
  ({ orientation = "horizontal", className, ...props }) => {
@@ -10232,7 +10260,7 @@ const Dialog = {
10232
10260
  Content: Content$4,
10233
10261
  Title,
10234
10262
  Description: Description$2,
10235
- Positioner,
10263
+ Positioner: Positioner$1,
10236
10264
  Header: Header$1,
10237
10265
  Footer,
10238
10266
  Body,
@@ -20780,7 +20808,7 @@ Toast.error = (description, option) => {
20780
20808
  };
20781
20809
  const selectRecipe = sva({
20782
20810
  className: "select",
20783
- slots: ["root", "trigger", "content", "item", "label", "valueText", "description"],
20811
+ slots: [...anatomy$2.keys(), "description"],
20784
20812
  base: {
20785
20813
  root: {
20786
20814
  display: "flex",
@@ -20789,6 +20817,7 @@ const selectRecipe = sva({
20789
20817
  width: "100%"
20790
20818
  },
20791
20819
  trigger: {
20820
+ position: "relative",
20792
20821
  display: "flex",
20793
20822
  alignItems: "center",
20794
20823
  justifyContent: "space-between",
@@ -20804,11 +20833,18 @@ const selectRecipe = sva({
20804
20833
  },
20805
20834
  content: {
20806
20835
  backgroundColor: "background.neutral.default",
20807
- mt: 2,
20808
20836
  padding: 2,
20809
20837
  borderRadius: 16,
20810
20838
  overflowY: "auto",
20811
- zIndex: "dropdown"
20839
+ zIndex: "dropdown",
20840
+ display: "flex",
20841
+ flexDirection: "column",
20842
+ _open: {
20843
+ animation: "fadeIn 0.2s ease-in"
20844
+ },
20845
+ _closed: {
20846
+ animation: "fadeOut 0.2s ease-out"
20847
+ }
20812
20848
  },
20813
20849
  item: {
20814
20850
  display: "flex",
@@ -20818,8 +20854,10 @@ const selectRecipe = sva({
20818
20854
  cursor: "pointer",
20819
20855
  color: "content.neutral.default",
20820
20856
  textStyle: "label.md",
20821
- "&:hover": {
20822
- backgroundColor: "background.neutral.hover"
20857
+ rounded: "sm",
20858
+ transition: "all 0.2s ease",
20859
+ _hover: {
20860
+ backgroundColor: "background.neutral.selected"
20823
20861
  }
20824
20862
  },
20825
20863
  label: {
@@ -20888,12 +20926,20 @@ const Trigger = withContext$4(({ description, ...props }) => {
20888
20926
  description && /* @__PURE__ */ jsxRuntime.jsx(Description, { text: description })
20889
20927
  ] });
20890
20928
  }, "trigger");
20929
+ const Control$2 = withContext$4(
20930
+ SelectControl,
20931
+ "control"
20932
+ );
20891
20933
  const ValueText = withContext$4(SelectValueText, "valueText");
20892
20934
  const Description = withContext$4(({ className, text, ...props }) => {
20893
20935
  return /* @__PURE__ */ jsxRuntime.jsx(Text, { className, ...props, children: text });
20894
20936
  }, "description");
20895
20937
  const Content = withContext$4(SelectContent, "content");
20896
20938
  const Item$2 = withContext$4(SelectItem, "item");
20939
+ const Positioner = withContext$4(
20940
+ SelectPositioner,
20941
+ "positioner"
20942
+ );
20897
20943
  const Select = {
20898
20944
  Root: Root$4,
20899
20945
  Label: Label$2,
@@ -20901,7 +20947,9 @@ const Select = {
20901
20947
  Content,
20902
20948
  Item: Item$2,
20903
20949
  ValueText,
20904
- Description
20950
+ Description,
20951
+ Positioner,
20952
+ Control: Control$2
20905
20953
  };
20906
20954
  const radioGroupRecipe = sva({
20907
20955
  className: "radioGroup",
@@ -21590,6 +21638,7 @@ const conditions = {
21590
21638
  }
21591
21639
  };
21592
21640
  const breakpoints = {
21641
+ xs: "480px",
21593
21642
  sm: "640px",
21594
21643
  md: "768px",
21595
21644
  lg: "1024px",
@@ -21627,6 +21676,9 @@ const animations = defineTokens.animations({
21627
21676
  "fade-in": {
21628
21677
  value: "fade-in 400ms {easings.emphasized-in}"
21629
21678
  },
21679
+ "fade-out": {
21680
+ value: "fade-out 200ms {easings.emphasized-out}"
21681
+ },
21630
21682
  "collapse-in": {
21631
21683
  value: "collapse-in 250ms {easings.emphasized-in}"
21632
21684
  },