@nurihaus/web-design-system 3.19.0 → 3.20.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.
@@ -2740,6 +2740,8 @@ import { BottomNav } from '@nurihaus/web-design-system'; // 루트.
2740
2740
 
2741
2741
  링크는 기본으로 `<a>` 다. 라우터의 링크로 바꾸려면 `linkComponent` 에 넘긴다. 받는 props 는 `href`·`className`·`children`·`aria-current`·`onClick` 이고, 그대로 링크에 전달하면 된다. `onClick` 을 빠뜨리면 `track` 로그가 나가지 않는다.
2742
2742
 
2743
+ `image` 에 사진 주소를 주면 아이콘 자리에 아이콘과 같은 크기(24px)의 원형 사진을 그린다(내 정보 탭의 프로필 사진 등). 옅은 테두리 링이 있고 지금 탭이면 진한 링이 된다. 주소가 없거나 사진을 못 불러오면 `icon` 을 그린다. 사진의 `alt` 는 빈 값이다 — 탭 이름은 `label` 이 읽는다.
2744
+
2743
2745
  배지는 `badge` 로 단다. `count` 가 없으면 점, 있으면 숫자(99 넘으면 99+)다. `label` 은 화면 낭독기가 읽는 말이다.
2744
2746
 
2745
2747
  - `pressEffect`: 탭을 누르는 동안 살짝 작아진다. 기본 `true`, `false` 면 끈다.
@@ -2788,7 +2790,7 @@ import Link from 'next/link';
2788
2790
  { id: 'home', label: '홈', icon: 'house', href: '/', badge: { label: '새 소식' } },
2789
2791
  { id: 'campaigns', label: '캠페인', icon: 'megaphone-simple', href: '/campaigns' },
2790
2792
  { id: 'community', label: '커뮤니티', icon: 'chats-circle', href: '/community' },
2791
- { id: 'me', label: '내 정보', icon: 'user-circle', href: '/me', badge: { count: 3, label: '알림 3개' } },
2793
+ { id: 'me', label: '내 정보', icon: 'user-circle', image: '/me/photo.jpg', href: '/me', badge: { count: 3, label: '알림 3개' } },
2792
2794
  ]}
2793
2795
  />
2794
2796
  ```
@@ -28,7 +28,7 @@ var classNames = __nuri_require__(3274);
28
28
  // EXTERNAL MODULE: ./helpers/utils/getMergedProps.ts
29
29
  var getMergedProps = __nuri_require__(7335);
30
30
  // EXTERNAL MODULE: ./components/icon/icon.tsx
31
- var icon = __nuri_require__(3547);
31
+ var icon_icon = __nuri_require__(3547);
32
32
  // EXTERNAL MODULE: external {"root":"RadixUI","commonjs2":"radix-ui","commonjs":"radix-ui","amd":"radix-ui","module":"radix-ui"}
33
33
  var external_root_RadixUI_commonjs2_radix_ui_commonjs_radix_ui_amd_radix_ui_module_radix_ui_ = __nuri_require__(0);
34
34
  ;// ./components/bottom-nav/base-bottom-nav.tsx
@@ -119,6 +119,30 @@ var Anchor = function Anchor(props) {
119
119
  return (0,jsx_runtime_.jsx)("a", bottom_nav_assign({}, props));
120
120
  };
121
121
  Anchor.displayName = 'BottomNavAnchor';
122
+ // 사진이 있으면 사진, 없거나 못 불러오면 아이콘. 실패한 주소를 기억해 주소가 바뀌면 다시 시도한다
123
+ var ItemGlyph = function ItemGlyph(_a) {
124
+ var icon = _a.icon,
125
+ image = _a.image,
126
+ isActive = _a.isActive;
127
+ var _b = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_module_react_.useState)(),
128
+ failedImage = _b[0],
129
+ setFailedImage = _b[1];
130
+ if (image && image !== failedImage) {
131
+ // 이름은 탭 라벨이 읽는다
132
+ return (0,jsx_runtime_.jsx)("img", {
133
+ className: 'bottom-nav-image',
134
+ src: image,
135
+ alt: '',
136
+ onError: function onError() {
137
+ return setFailedImage(image);
138
+ }
139
+ });
140
+ }
141
+ return (0,jsx_runtime_.jsx)(icon_icon/* default */.A, {
142
+ name: icon,
143
+ weight: isActive ? 'fill' : 'regular'
144
+ });
145
+ };
122
146
  var BottomNav = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_module_react_.forwardRef)(function (props, ref) {
123
147
  var _a = (0,getMergedProps/* getMergedProps */.p)(props, bottomNavProps),
124
148
  className = _a.className,
@@ -171,9 +195,10 @@ var BottomNav = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_rea
171
195
  children: item.label
172
196
  }), (0,jsx_runtime_.jsxs)("span", {
173
197
  className: 'bottom-nav-icon',
174
- children: [(0,jsx_runtime_.jsx)(icon/* default */.A, {
175
- name: item.icon,
176
- weight: isActive ? 'fill' : 'regular'
198
+ children: [(0,jsx_runtime_.jsx)(ItemGlyph, {
199
+ icon: item.icon,
200
+ image: item.image,
201
+ isActive: isActive
177
202
  }), item.badge && (0,jsx_runtime_.jsx)(base_bottom_nav.Badge, {
178
203
  className: 'bottom-nav-badge',
179
204
  count: item.badge.count,
@@ -14,6 +14,8 @@ export interface BottomNavItem {
14
14
  label: string;
15
15
  /** 꺼짐은 선, 지금 탭은 채움으로 바뀐다 */
16
16
  icon: IconName;
17
+ /** 사진 주소(예: 내 프로필 사진). 있으면 아이콘 자리에 원형 사진을 그리고, 못 불러오면 아이콘으로 돌아간다 */
18
+ image?: string;
17
19
  href: string;
18
20
  badge?: BottomNavBadge;
19
21
  }
@@ -60,6 +60,8 @@ export default meta;
60
60
  type Story = StoryObj<typeof meta>;
61
61
  /** 화면 아래에 떠 있는 하단 내비게이션이다. 현재 탭 표시와 홈·내 정보 탭에 붙은 배지를 본다. 넓은 화면에서는 480px 기둥 안 가운데에 선다. */
62
62
  export declare const Default: Story;
63
+ /** 내 정보 탭에 프로필 사진을 넣었다. 지금 탭이면 진한 링, 아니면 옅은 링이다. 주소를 못 불러오면 아이콘으로 돌아간다 */
64
+ export declare const WithImage: Story;
63
65
  /** 탭을 누르고 있으면 살짝 작아진다. 탭을 바꾸면 글자색과 아이콘 채움만 바뀐다 */
64
66
  export declare const MotionPress: Story;
65
67
  /** pressEffect 를 끈 하단 내비게이션이다. 탭을 눌러 눌림 효과가 없는지 Default 와 비교한다. */
@@ -1943,6 +1943,20 @@
1943
1943
  display: flex;
1944
1944
  }
1945
1945
 
1946
+ .bottom-nav-image {
1947
+ width: var(--icon-size-l);
1948
+ height: var(--icon-size-l);
1949
+ border-radius: var(--radius-circle);
1950
+ -o-object-fit: cover;
1951
+ object-fit: cover;
1952
+ /* 링은 그림자로 그려 사진 크기가 아이콘과 같게 둔다. 지금 탭은 진한 링 */
1953
+ box-shadow: 0 0 0 var(--hairline) var(--border-default);
1954
+ }
1955
+
1956
+ .bottom-nav-item[aria-current='page'] .bottom-nav-image {
1957
+ box-shadow: 0 0 0 var(--border-width-strong) var(--text-primary);
1958
+ }
1959
+
1946
1960
  .bottom-nav-badge {
1947
1961
  position: absolute;
1948
1962
  top: 0;
package/dist/index.js CHANGED
@@ -2627,7 +2627,7 @@ var classNames = __nuri_require__(3274);
2627
2627
  // EXTERNAL MODULE: ./helpers/utils/getMergedProps.ts
2628
2628
  var getMergedProps = __nuri_require__(7335);
2629
2629
  // EXTERNAL MODULE: ./components/icon/icon.tsx
2630
- var icon = __nuri_require__(3547);
2630
+ var icon_icon = __nuri_require__(3547);
2631
2631
  // EXTERNAL MODULE: external {"root":"RadixUI","commonjs2":"radix-ui","commonjs":"radix-ui","amd":"radix-ui","module":"radix-ui"}
2632
2632
  var external_root_RadixUI_commonjs2_radix_ui_commonjs_radix_ui_amd_radix_ui_module_radix_ui_ = __nuri_require__(0);
2633
2633
  ;// ./components/bottom-nav/base-bottom-nav.tsx
@@ -2718,6 +2718,30 @@ var Anchor = function Anchor(props) {
2718
2718
  return (0,jsx_runtime_.jsx)("a", bottom_nav_assign({}, props));
2719
2719
  };
2720
2720
  Anchor.displayName = 'BottomNavAnchor';
2721
+ // 사진이 있으면 사진, 없거나 못 불러오면 아이콘. 실패한 주소를 기억해 주소가 바뀌면 다시 시도한다
2722
+ var ItemGlyph = function ItemGlyph(_a) {
2723
+ var icon = _a.icon,
2724
+ image = _a.image,
2725
+ isActive = _a.isActive;
2726
+ var _b = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_module_react_.useState)(),
2727
+ failedImage = _b[0],
2728
+ setFailedImage = _b[1];
2729
+ if (image && image !== failedImage) {
2730
+ // 이름은 탭 라벨이 읽는다
2731
+ return (0,jsx_runtime_.jsx)("img", {
2732
+ className: 'bottom-nav-image',
2733
+ src: image,
2734
+ alt: '',
2735
+ onError: function onError() {
2736
+ return setFailedImage(image);
2737
+ }
2738
+ });
2739
+ }
2740
+ return (0,jsx_runtime_.jsx)(icon_icon/* default */.A, {
2741
+ name: icon,
2742
+ weight: isActive ? 'fill' : 'regular'
2743
+ });
2744
+ };
2721
2745
  var BottomNav = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_module_react_.forwardRef)(function (props, ref) {
2722
2746
  var _a = (0,getMergedProps/* getMergedProps */.p)(props, bottomNavProps),
2723
2747
  className = _a.className,
@@ -2770,9 +2794,10 @@ var BottomNav = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_rea
2770
2794
  children: item.label
2771
2795
  }), (0,jsx_runtime_.jsxs)("span", {
2772
2796
  className: 'bottom-nav-icon',
2773
- children: [(0,jsx_runtime_.jsx)(icon/* default */.A, {
2774
- name: item.icon,
2775
- weight: isActive ? 'fill' : 'regular'
2797
+ children: [(0,jsx_runtime_.jsx)(ItemGlyph, {
2798
+ icon: item.icon,
2799
+ image: item.image,
2800
+ isActive: isActive
2776
2801
  }), item.badge && (0,jsx_runtime_.jsx)(base_bottom_nav.Badge, {
2777
2802
  className: 'bottom-nav-badge',
2778
2803
  count: item.badge.count,
package/dist/styles.css CHANGED
@@ -2770,6 +2770,18 @@ p {
2770
2770
  position: relative;
2771
2771
  display: flex;
2772
2772
  }
2773
+ .bottom-nav-image {
2774
+ width: var(--icon-size-l);
2775
+ height: var(--icon-size-l);
2776
+ border-radius: var(--radius-circle);
2777
+ -o-object-fit: cover;
2778
+ object-fit: cover;
2779
+ /* 링은 그림자로 그려 사진 크기가 아이콘과 같게 둔다. 지금 탭은 진한 링 */
2780
+ box-shadow: 0 0 0 var(--hairline) var(--border-default);
2781
+ }
2782
+ .bottom-nav-item[aria-current='page'] .bottom-nav-image {
2783
+ box-shadow: 0 0 0 var(--border-width-strong) var(--text-primary);
2784
+ }
2773
2785
  .bottom-nav-badge {
2774
2786
  position: absolute;
2775
2787
  top: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nurihaus/web-design-system",
3
- "version": "3.19.0",
3
+ "version": "3.20.0",
4
4
  "description": "Nurihaus 디자인 시스템 — 컴포넌트와 디자인 토큰",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",