@highpixel-co/palda-design-system 0.5.0 → 0.8.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/ui.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { HTMLAttributes, ReactNode, ButtonHTMLAttributes, InputHTMLAttributes, AnchorHTMLAttributes, ReactElement } from 'react';
2
+ import { HTMLAttributes, ReactNode, ButtonHTMLAttributes, InputHTMLAttributes, AnchorHTMLAttributes, ImgHTMLAttributes, ReactElement } from 'react';
3
3
 
4
4
  type AlertVariant = 'neutral' | 'accent' | 'warning' | 'danger';
5
5
  interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
@@ -141,14 +141,29 @@ interface ModalProps {
141
141
  }
142
142
  declare function Modal({ children, className, closeLabel, footer, onClose, open, showCloseButton, title, }: ModalProps): react.ReactPortal | null;
143
143
 
144
- interface NavigationButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
144
+ type NavigationButtonSize = 'md' | 'sm';
145
+ interface NavigationButtonOwnProps {
145
146
  children: ReactNode;
146
- /** 라벨 앞 아이콘. 시안 기준 24px 고정이다. */
147
+ /** 라벨 앞 아이콘. md는 24px, sm은 20px 고정이다. */
147
148
  icon?: ReactNode;
148
149
  /** 지금 보고 있는 화면. `aria-current="page"`로 함께 노출된다. */
149
150
  selected?: boolean;
151
+ /**
152
+ * `md`는 사이드바 항목(48px · 아이콘 24 · semibold · 부모 폭을 채움),
153
+ * `sm`은 상단 행 항목(36px · 아이콘 20 · medium · 내용만큼)이다.
154
+ */
155
+ size?: NavigationButtonSize;
150
156
  }
151
- declare function NavigationButton({ children, className, icon, selected, ...props }: NavigationButtonProps): react.JSX.Element;
157
+ /**
158
+ * 내비게이션은 폼 제출에 쓰지 않는다. 그래서 button일 때 `type`은 노출하지 않고 button으로
159
+ * 고정하고, anchor일 때 `href`는 이 union이 필수로 만든다.
160
+ */
161
+ type NavigationButtonProps = (NavigationButtonOwnProps & Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type'> & {
162
+ href?: undefined;
163
+ }) | (NavigationButtonOwnProps & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> & {
164
+ href: string;
165
+ });
166
+ declare function NavigationButton(props: NavigationButtonProps): react.JSX.Element;
152
167
 
153
168
  interface ProgressBarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'role'> {
154
169
  /** 0~100. 범위를 벗어난 값은 잘라서 그린다. */
@@ -164,6 +179,38 @@ interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'>
164
179
  }
165
180
  declare function Radio({ children, className, disabled, ...props }: RadioProps): react.JSX.Element;
166
181
 
182
+ type SkeletonShape = 'text' | 'block';
183
+ type SkeletonText = 'body1' | 'body2' | 'label';
184
+ type SkeletonWidth = 'full' | 'wide' | 'narrow';
185
+ /**
186
+ * `children`을 받지 않는다. 뼈대 안에 든 것은 읽히지 않는데 DOM에는 남아서, 넣을 수 있게 두면
187
+ * 실제 내용이 숨겨진 채 그려진다.
188
+ */
189
+ interface SkeletonProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
190
+ shape?: SkeletonShape;
191
+ /** `shape="text"`에서만 쓴다. */
192
+ text?: SkeletonText;
193
+ /** `shape="text"`에서만 쓴다. */
194
+ width?: SkeletonWidth;
195
+ }
196
+ /**
197
+ * 값이 오기 전 자리를 잡아 두는 뼈대다.
198
+ *
199
+ * **뼈대는 자리를 잡는 것이 목적이다.** 대신할 것과 크기가 갈리면 값이 도착할 때 화면이 튀어서,
200
+ * 깜빡임을 막으려고 쓴 것이 다른 깜빡임을 만든다. 그래서 `text`의 높이는 그 텍스트 스타일의 글자
201
+ * 크기이고, `block`은 크기를 스스로 갖지 않고 놓인 자리를 채운다 — 카드도 썸네일도 크기는 그
202
+ * 자리가 정한다.
203
+ *
204
+ * **폭을 값으로 받지 않는다.** 글자 폭을 흉내 내는 자리라 정확한 값이 있을 수 없고, 자리마다 다른
205
+ * 값이 들어가면 같은 목록의 뼈대가 서로 갈린다. `full`·`wide`·`narrow` 셋으로 닫는다.
206
+ *
207
+ * **여러 줄은 화면이 조립한다.** `lines` 같은 prop을 두지 않는다 — 줄 사이 간격은 그 자리의
208
+ * 레이아웃이고, 컴포넌트가 들면 자리마다 어긋난다.
209
+ *
210
+ * 읽을 내용이 없으므로 스크린리더에서 뺀다. **진행 중이라는 사실은 이것을 놓은 자리가 알린다.**
211
+ */
212
+ declare function Skeleton({ className, shape, text, width, ...props }: SkeletonProps): react.JSX.Element;
213
+
167
214
  type SwitchSize = 'md' | 'sm';
168
215
  interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {
169
216
  size?: SwitchSize;
@@ -174,10 +221,15 @@ interface TabProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'role'
174
221
  children: ReactNode;
175
222
  /** 라벨 앞 아이콘. 시안 기준 24px 고정이다. */
176
223
  icon?: ReactNode;
224
+ /**
225
+ * 라벨 뒤 배지. 그룹별 개수처럼 탭을 열지 않고도 보여야 하는 수를 싣는다.
226
+ * `Badge`를 넣는 자리이며 크기는 `sm`을 쓴다 — 라벨이 Body2(14px)라 md(28px)는 라벨보다 커진다.
227
+ */
228
+ badge?: ReactNode;
177
229
  /** 지금 보고 있는 탭. `aria-selected`로 함께 노출된다. */
178
230
  selected?: boolean;
179
231
  }
180
- declare function Tab({ children, className, icon, selected, ...props }: TabProps): react.JSX.Element;
232
+ declare function Tab({ children, className, icon, badge, selected, ...props }: TabProps): react.JSX.Element;
181
233
 
182
234
  type TextFieldVariant = 'outline' | 'accent' | 'subtle';
183
235
  type TextFieldSize = 'md' | 'sm';
@@ -197,6 +249,21 @@ interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 're
197
249
  }
198
250
  declare function TextField({ className, defaultValue, description, disabled, error, icon, id, label, maxLength, onChange, required, size, value, variant, ...props }: TextFieldProps): react.JSX.Element;
199
251
 
252
+ type ThumbnailSize = 'md' | 'sm';
253
+ /**
254
+ * 상품·항목의 작은 사각 이미지. 원형(아바타)은 다른 것이라 여기에 넣지 않는다.
255
+ *
256
+ * `alt`를 필수로 받는다. 장식이면 빈 문자열을 **명시적으로** 넘긴다 — 빠뜨린 것과 장식인 것이
257
+ * 코드에서 갈려야 한다 (docs/ACCESSIBILITY.md).
258
+ */
259
+ interface ThumbnailProps extends Omit<ImgHTMLAttributes<HTMLImageElement>, 'alt' | 'height' | 'src' | 'width'> {
260
+ src: string;
261
+ /** 장식이면 `""`를 넘긴다. 생략할 수 없다. */
262
+ alt: string;
263
+ size?: ThumbnailSize;
264
+ }
265
+ declare function Thumbnail({ alt, className, loading, size, src, ...props }: ThumbnailProps): react.JSX.Element;
266
+
200
267
  type ToastVariant = 'primary' | 'danger';
201
268
 
202
269
  type ToasterPlacement = 'bottom-center' | 'bottom-right' | 'top-center' | 'top-right';
@@ -240,4 +307,4 @@ interface TooltipProps {
240
307
  }
241
308
  declare function Tooltip({ children, className, label, placement }: TooltipProps): react.JSX.Element;
242
309
 
243
- export { Alert, type AlertProps, type AlertVariant, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Checkbox, type CheckboxProps, Chip, type ChipProps, type ChipSize, type ChipVariant, DropdownButton, type DropdownButtonAlign, type DropdownButtonItem, type DropdownButtonProps, type DropdownButtonVariant, IconButton, type IconButtonProps, type IconButtonSize, type IconButtonVariant, Link, type LinkProps, type LinkSize, type LinkVariant, Modal, ModalActions, type ModalActionsProps, type ModalProps, NavigationButton, type NavigationButtonProps, ProgressBar, type ProgressBarProps, Radio, type RadioProps, Switch, type SwitchProps, type SwitchSize, Tab, type TabProps, TextField, type TextFieldProps, type TextFieldSize, type TextFieldVariant, type ToastOptions, type ToastVariant, Toaster, type ToasterPlacement, type ToasterProps, Tooltip, type TooltipPlacement, type TooltipProps, toast };
310
+ export { Alert, type AlertProps, type AlertVariant, Badge, type BadgeProps, type BadgeSize, type BadgeVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Checkbox, type CheckboxProps, Chip, type ChipProps, type ChipSize, type ChipVariant, DropdownButton, type DropdownButtonAlign, type DropdownButtonItem, type DropdownButtonProps, type DropdownButtonVariant, IconButton, type IconButtonProps, type IconButtonSize, type IconButtonVariant, Link, type LinkProps, type LinkSize, type LinkVariant, Modal, ModalActions, type ModalActionsProps, type ModalProps, NavigationButton, type NavigationButtonProps, type NavigationButtonSize, ProgressBar, type ProgressBarProps, Radio, type RadioProps, Skeleton, type SkeletonProps, type SkeletonShape, type SkeletonText, type SkeletonWidth, Switch, type SwitchProps, type SwitchSize, Tab, type TabProps, TextField, type TextFieldProps, type TextFieldSize, type TextFieldVariant, Thumbnail, type ThumbnailProps, type ThumbnailSize, type ToastOptions, type ToastVariant, Toaster, type ToasterPlacement, type ToasterProps, Tooltip, type TooltipPlacement, type TooltipProps, toast };
package/dist/ui.js CHANGED
@@ -13,13 +13,15 @@ import {
13
13
  NavigationButton,
14
14
  ProgressBar,
15
15
  Radio,
16
+ Skeleton,
16
17
  Switch,
17
18
  Tab,
18
19
  TextField,
20
+ Thumbnail,
19
21
  Toaster,
20
22
  Tooltip,
21
23
  toast
22
- } from "./chunk-GPCPGABI.js";
24
+ } from "./chunk-PWAQFOM3.js";
23
25
  import "./chunk-TWYJ2UTC.js";
24
26
  export {
25
27
  Alert,
@@ -35,9 +37,11 @@ export {
35
37
  NavigationButton,
36
38
  ProgressBar,
37
39
  Radio,
40
+ Skeleton,
38
41
  Switch,
39
42
  Tab,
40
43
  TextField,
44
+ Thumbnail,
41
45
  Toaster,
42
46
  Tooltip,
43
47
  toast
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@highpixel-co/palda-design-system",
3
- "version": "0.5.0",
3
+ "version": "0.8.0",
4
4
  "description": "Palda product design tokens, icons, React components, and patterns",
5
5
  "license": "MIT",
6
6
  "type": "module",