@liner-fe/prism 3.4.11 → 3.5.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/lib/index.css +348 -250
- package/lib/index.d.ts +203 -33
- package/lib/index.js +1012 -464
- package/package.json +8 -5
package/lib/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { SystemKeys, TypographyCaptionPrefix, TypographyParagraphPrefix, TypographyHeadingPrefix, TypographyTitlePrefix, TypographyDisplayPrefix, BasicColorType } from '@liner-fe/design-token-primitive';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import react__default, { ButtonHTMLAttributes, HTMLAttributes, JSX, ReactNode, ComponentPropsWithoutRef, InputHTMLAttributes,
|
|
3
|
+
import react__default, { ButtonHTMLAttributes, HTMLAttributes, JSX, ReactNode, ComponentPropsWithoutRef, InputHTMLAttributes, MouseEventHandler, ReactElement } from 'react';
|
|
4
4
|
import * as cva from 'cva';
|
|
5
5
|
import { VariantProps } from 'cva';
|
|
6
6
|
import { IconProps, IconComponentType } from '@liner-fe/icon';
|
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
8
|
import * as _artsy_fresnel_dist_Media from '@artsy/fresnel/dist/Media';
|
|
9
9
|
import { breakpointOrigin } from '@liner-fe/design-token';
|
|
10
|
-
import { Popover as Popover$1, Tooltip as Tooltip$1, Checkbox as Checkbox$1, RadioGroup, Select as Select$1, Label as Label$1, AlertDialog as AlertDialog$1, Dialog as Dialog$1 } from 'radix-ui';
|
|
10
|
+
import { Popover as Popover$1, Tooltip as Tooltip$1, Checkbox as Checkbox$1, RadioGroup, Select as Select$1, Label as Label$1, Avatar as Avatar$1, AlertDialog as AlertDialog$1, Dialog as Dialog$1 } from 'radix-ui';
|
|
11
11
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
12
12
|
import { PopoverProps, PopoverPortalProps } from '@radix-ui/react-popover';
|
|
13
13
|
import { Drawer } from 'vaul';
|
|
@@ -375,48 +375,177 @@ interface TextfieldProps extends InputHTMLAttributes<HTMLInputElement>, VariantP
|
|
|
375
375
|
}
|
|
376
376
|
declare const Textfield: react.ForwardRefExoticComponent<TextfieldProps & react.RefAttributes<HTMLInputElement>>;
|
|
377
377
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
378
|
+
type RadixSelectRootProps = ComponentPropsWithoutRef<typeof Select$1.Root>;
|
|
379
|
+
type SelectTriggerType = 'select-field' | 'select-button';
|
|
380
|
+
type SelectFieldSize = 's' | 'l';
|
|
381
|
+
type SelectButtonSize = 's' | 'm';
|
|
382
|
+
interface SelectWidthOptions {
|
|
383
|
+
/** Trigger 폭 px override. 미지정 시 Figma 기본 (size별 hardcoded). */
|
|
384
|
+
trigger?: number;
|
|
385
|
+
/** Popover list 폭 px override. 미지정 시 default (field=trigger 추종, button=320). */
|
|
386
|
+
list?: number;
|
|
387
|
+
}
|
|
388
|
+
interface BaseSelectProps extends Omit<RadixSelectRootProps, 'children' | 'dir'> {
|
|
389
|
+
label?: ReactNode;
|
|
390
|
+
/**
|
|
391
|
+
* 아무것도 선택되지 않은 초기 상태에 Trigger에 노출되는 안내 텍스트.
|
|
392
|
+
* `ReactNode` — 단순 문자열 외 아이콘 + 텍스트 조합 등 가능.
|
|
393
|
+
* field trigger: Paragraph size=3 tertiary color (Figma 17113:2379).
|
|
394
|
+
* button trigger: Paragraph size=4 primary color (Figma 17228:64663).
|
|
395
|
+
*/
|
|
396
|
+
placeholder?: ReactNode;
|
|
397
|
+
error?: ReactNode;
|
|
398
|
+
/**
|
|
399
|
+
* Trigger에 표시할 커스텀 ReactNode (flat prop — 객체 안 nested 금지).
|
|
400
|
+
*
|
|
401
|
+
* **객체 prop의 React element가 아닌 flat prop으로 받는 이유**:
|
|
402
|
+
* Storybook의 react-element-to-jsx-string은 object prop 안의 React element를 parse할 때
|
|
403
|
+
* 무한 재귀(stack overflow)에 빠짐 → docs 페이지 freeze. flat prop은 정상 처리.
|
|
404
|
+
*
|
|
405
|
+
* **사용 책임**:
|
|
406
|
+
* - controlled `value` + `onValueChange`로 현재 값 알고 렌더
|
|
407
|
+
* - placeholder 분기도 consumer가 처리 (예: `value ? <Custom/> : undefined`)
|
|
408
|
+
* - ARIA accessible name 보장
|
|
409
|
+
*
|
|
410
|
+
* 미제공 시 기본 RadixSelect.Value 동작: placeholder + ItemText auto-mirror.
|
|
411
|
+
*/
|
|
412
|
+
triggerContent?: ReactNode;
|
|
413
|
+
/**
|
|
414
|
+
* Width override (px). number만 — 자동 px 변환. number는 React element가 아니라
|
|
415
|
+
* react-element-to-jsx-string 무한재귀 문제 없음 (객체 nested 안전).
|
|
416
|
+
* 미지정 필드는 Figma 기본 spec:
|
|
417
|
+
* - `trigger`: trigger × size별 hardcoded (field s=200/l=240, button s=105/m=123)
|
|
418
|
+
* - `list`: field=trigger 폭 추종, button=320px
|
|
419
|
+
*/
|
|
420
|
+
width?: SelectWidthOptions;
|
|
421
|
+
dir?: 'ltr' | 'rtl';
|
|
422
|
+
children?: ReactNode;
|
|
423
|
+
className?: string;
|
|
424
|
+
}
|
|
425
|
+
type SelectProps = (BaseSelectProps & {
|
|
426
|
+
trigger?: 'select-field';
|
|
427
|
+
size?: SelectFieldSize;
|
|
428
|
+
}) | (BaseSelectProps & {
|
|
429
|
+
trigger: 'select-button';
|
|
430
|
+
size?: SelectButtonSize;
|
|
431
|
+
});
|
|
432
|
+
interface SelectContentProps extends ComponentPropsWithoutRef<typeof Select$1.Content> {
|
|
433
|
+
/**
|
|
434
|
+
* Popover Portal의 mount 대상 element. 미지정 시 `document.body` (Radix 기본).
|
|
435
|
+
* 사용 케이스: Radix Dialog/Sheet 내부 mount로 focus trap·z-index 정상화,
|
|
436
|
+
* scroll container 안 mount, Shadow DOM 등.
|
|
437
|
+
*/
|
|
438
|
+
container?: HTMLElement | null;
|
|
390
439
|
}
|
|
391
|
-
interface SelectItemProps {
|
|
440
|
+
interface SelectItemProps extends Omit<ComponentPropsWithoutRef<typeof Select$1.Item>, 'value'> {
|
|
392
441
|
value: string;
|
|
393
|
-
|
|
442
|
+
label: ReactNode;
|
|
443
|
+
description?: ReactNode;
|
|
444
|
+
leadingSlot?: ReactNode;
|
|
445
|
+
labelEnd?: ReactNode;
|
|
446
|
+
/**
|
|
447
|
+
* 우측 영역 (chevron / IconButton / 액션 등). 미제공 + selected 시
|
|
448
|
+
* 자동으로 brand color IconCheckMark 표시 (Figma `selectItem` 스펙).
|
|
449
|
+
*/
|
|
450
|
+
trailingSlot?: ReactNode;
|
|
451
|
+
textValue?: string;
|
|
394
452
|
disabled?: boolean;
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
453
|
+
danger?: boolean;
|
|
454
|
+
/**
|
|
455
|
+
* 클릭 시 호출. 선택과 함께 navigation 등 link-like 액션을 트리거하려면
|
|
456
|
+
* 여기서 `router.push(...)` 등을 호출. RadixSelect.Item native onClick passthrough.
|
|
457
|
+
*/
|
|
458
|
+
onClick?: ComponentPropsWithoutRef<typeof Select$1.Item>['onClick'];
|
|
459
|
+
}
|
|
460
|
+
interface SelectGroupProps extends ComponentPropsWithoutRef<typeof Select$1.Group> {
|
|
461
|
+
label?: ReactNode;
|
|
462
|
+
}
|
|
463
|
+
interface BaseSelectTriggerProps {
|
|
464
|
+
label?: ReactNode;
|
|
465
|
+
placeholder?: ReactNode;
|
|
466
|
+
error?: ReactNode;
|
|
467
|
+
/** value 선택 시 표시할 ReactNode. 미제공 시 placeholder 노출. */
|
|
468
|
+
triggerContent?: ReactNode;
|
|
469
|
+
/** Trigger 폭 px override (number만). 미지정 시 Figma 기본 spec. */
|
|
470
|
+
width?: number;
|
|
471
|
+
required?: boolean;
|
|
472
|
+
disabled?: boolean;
|
|
473
|
+
className?: string;
|
|
474
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
475
|
+
/** Sheet/Dialog context용 ARIA. 기본 미설정 — consumer 책임. */
|
|
476
|
+
'aria-haspopup'?: 'dialog' | 'listbox' | 'menu' | 'tree' | 'grid';
|
|
477
|
+
'aria-expanded'?: boolean;
|
|
478
|
+
'aria-controls'?: string;
|
|
479
|
+
'aria-label'?: string;
|
|
480
|
+
id?: string;
|
|
399
481
|
}
|
|
482
|
+
type SelectTriggerProps = (BaseSelectTriggerProps & {
|
|
483
|
+
trigger?: 'select-field';
|
|
484
|
+
size?: SelectFieldSize;
|
|
485
|
+
}) | (BaseSelectTriggerProps & {
|
|
486
|
+
trigger: 'select-button';
|
|
487
|
+
size?: SelectButtonSize;
|
|
488
|
+
});
|
|
400
489
|
declare const Select: react.ForwardRefExoticComponent<SelectProps & react.RefAttributes<HTMLButtonElement>> & {
|
|
401
|
-
|
|
490
|
+
Trigger: react.ForwardRefExoticComponent<SelectTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
491
|
+
Content: react.ForwardRefExoticComponent<SelectContentProps & react.RefAttributes<HTMLDivElement>>;
|
|
492
|
+
Item: react.ForwardRefExoticComponent<SelectItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
493
|
+
Group: react.ForwardRefExoticComponent<SelectGroupProps & react.RefAttributes<HTMLDivElement>>;
|
|
402
494
|
};
|
|
403
495
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
value
|
|
407
|
-
|
|
496
|
+
type NativeLiProps$1 = Omit<ComponentPropsWithoutRef<'li'>, 'onClick' | 'role'>;
|
|
497
|
+
interface ListItemProps extends NativeLiProps$1 {
|
|
498
|
+
value: string;
|
|
499
|
+
label: ReactNode;
|
|
500
|
+
description?: ReactNode;
|
|
501
|
+
leadingSlot?: ReactNode;
|
|
502
|
+
labelEnd?: ReactNode;
|
|
503
|
+
trailingSlot?: ReactNode;
|
|
504
|
+
disabled?: boolean;
|
|
505
|
+
danger?: boolean;
|
|
506
|
+
onClick?: () => void;
|
|
408
507
|
}
|
|
409
|
-
|
|
508
|
+
/**
|
|
509
|
+
* @description Figma listItem (17159:3267) 디자인을 입힌 styled ListItem.
|
|
510
|
+
* 부모 `<CollectionProvider>`(또는 향후 `<List>`)로부터 selected 자동 매칭.
|
|
511
|
+
* 커스텀 스타일이 필요하면 `PrimitiveListItem`을 직접 wrap.
|
|
512
|
+
*/
|
|
513
|
+
declare const ListItem: react.ForwardRefExoticComponent<ListItemProps & react.RefAttributes<HTMLLIElement>>;
|
|
514
|
+
|
|
515
|
+
type NativeLiProps = Omit<ComponentPropsWithoutRef<'li'>, 'onClick' | 'role'>;
|
|
516
|
+
interface PrimitiveListItemProps extends NativeLiProps {
|
|
410
517
|
value: string;
|
|
411
|
-
|
|
518
|
+
leadingSlot?: ReactNode;
|
|
519
|
+
children: ReactNode;
|
|
520
|
+
trailingSlot?: ReactNode;
|
|
412
521
|
disabled?: boolean;
|
|
413
|
-
icon?: {
|
|
414
|
-
icon: IconComponentType;
|
|
415
|
-
} & Pick<IconProps, 'fill' | 'type' | 'fillType' | 'size'>;
|
|
416
522
|
onClick?: () => void;
|
|
523
|
+
role?: 'option' | 'menuitem' | 'menuitemcheckbox' | 'menuitemradio';
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* @description PrimitiveListItem — 커스텀 스타일용 base.
|
|
527
|
+
* 기본 사용은 `ListItem`을 권장. `role`은 wrapper(ListItem, SelectItem, ActionMenuItem 등)가 책임 — 외부 직접 지정 금지.
|
|
528
|
+
* `<CollectionProvider>` 내부에서만 사용 — 외부 사용 시 throw.
|
|
529
|
+
* `onClick`은 event 인자 없는 `() => void`. event 접근이 필요하면 spread되는 native handler(`onMouseDown` / `onKeyDown` 등) 사용.
|
|
530
|
+
*/
|
|
531
|
+
declare const PrimitiveListItem: react.ForwardRefExoticComponent<PrimitiveListItemProps & react.RefAttributes<HTMLLIElement>>;
|
|
532
|
+
|
|
533
|
+
type NativeUlProps = Omit<ComponentPropsWithoutRef<'ul'>, 'onChange' | 'role' | 'defaultValue' | 'dir'>;
|
|
534
|
+
interface ListProps extends NativeUlProps {
|
|
535
|
+
value?: string;
|
|
536
|
+
defaultValue?: string;
|
|
537
|
+
onValueChange?: (value: string) => void;
|
|
538
|
+
loop?: boolean;
|
|
539
|
+
dir?: 'ltr' | 'rtl';
|
|
540
|
+
children?: ReactNode;
|
|
417
541
|
}
|
|
418
|
-
|
|
419
|
-
|
|
542
|
+
interface ListGroupProps extends ComponentPropsWithoutRef<'div'> {
|
|
543
|
+
label?: ReactNode;
|
|
544
|
+
}
|
|
545
|
+
declare const List: react.ForwardRefExoticComponent<ListProps & react.RefAttributes<HTMLUListElement>> & {
|
|
546
|
+
Item: react.ForwardRefExoticComponent<ListItemProps & react.RefAttributes<HTMLLIElement>>;
|
|
547
|
+
PrimitiveItem: react.ForwardRefExoticComponent<PrimitiveListItemProps & react.RefAttributes<HTMLLIElement>>;
|
|
548
|
+
Group: react.ForwardRefExoticComponent<ListGroupProps & react.RefAttributes<HTMLDivElement>>;
|
|
420
549
|
};
|
|
421
550
|
|
|
422
551
|
declare const defaultLabelVariants: (props?: ({
|
|
@@ -642,6 +771,47 @@ type BadgeBaseProps = ComponentPropsWithoutRef<'span'> & {
|
|
|
642
771
|
type BadgeProps = BadgeBaseProps & BadgeVariantColorProps;
|
|
643
772
|
declare const Badge: react.ForwardRefExoticComponent<BadgeProps & react.RefAttributes<HTMLSpanElement>>;
|
|
644
773
|
|
|
774
|
+
type AvatarSize = 'small' | 'medium' | 'xlarge';
|
|
775
|
+
/**
|
|
776
|
+
* 이미지 로딩 상태(`'idle' | 'loading' | 'loaded' | 'error'`).
|
|
777
|
+
* union 을 직접 정의하지 않고 radix-ui Avatar.Image 의 타입을 그대로 파생해 재사용합니다(drift 방지).
|
|
778
|
+
*/
|
|
779
|
+
type AvatarLoadingStatus = Parameters<NonNullable<ComponentPropsWithoutRef<typeof Avatar$1.Image>['onLoadingStatusChange']>>[0];
|
|
780
|
+
type AvatarProps = ComponentPropsWithoutRef<typeof Avatar$1.Root> & {
|
|
781
|
+
/** 아바타 크기. */
|
|
782
|
+
size?: AvatarSize;
|
|
783
|
+
/**
|
|
784
|
+
* 사용자 이미지 URL. prop 전달은 필수이지만 값으로 `undefined` 를 허용합니다(`src?:` 옵셔널 아님).
|
|
785
|
+
* 호출부가 src 를 깜빡 누락하는 것은 막되, 사진이 없으면 `undefined` 를 명시적으로 넘길 수 있습니다.
|
|
786
|
+
* `undefined`/빈 문자열이거나 로드에 실패하면 fallback 이미지를 표시합니다.
|
|
787
|
+
*/
|
|
788
|
+
src: string | undefined;
|
|
789
|
+
/** 이미지 대체 텍스트(접근성). 사용자 이름 등을 전달합니다. 장식용이면 빈 문자열(`''`)을 넘기세요. */
|
|
790
|
+
alt: string;
|
|
791
|
+
/** 이미지 로딩 상태가 바뀔 때 호출됩니다. (idle → loading → loaded | error) */
|
|
792
|
+
onLoadingStatusChange?: (status: AvatarLoadingStatus) => void;
|
|
793
|
+
};
|
|
794
|
+
/**
|
|
795
|
+
* 사용자/엔티티를 원형 이미지로 표현하는 Avatar.
|
|
796
|
+
*
|
|
797
|
+
* radix-ui Avatar 를 래핑합니다. `src` 이미지가 로드되기 전·로드에 실패했을 때(빈 URL 포함)는
|
|
798
|
+
* fallback placeholder 이미지를 보여줍니다. 로딩 중 깨진 이미지가 잠깐 보이는 현상이 없습니다.
|
|
799
|
+
*/
|
|
800
|
+
declare const Avatar: react.ForwardRefExoticComponent<Omit<Avatar$1.AvatarProps & react.RefAttributes<HTMLSpanElement>, "ref"> & {
|
|
801
|
+
/** 아바타 크기. */
|
|
802
|
+
size?: AvatarSize;
|
|
803
|
+
/**
|
|
804
|
+
* 사용자 이미지 URL. prop 전달은 필수이지만 값으로 `undefined` 를 허용합니다(`src?:` 옵셔널 아님).
|
|
805
|
+
* 호출부가 src 를 깜빡 누락하는 것은 막되, 사진이 없으면 `undefined` 를 명시적으로 넘길 수 있습니다.
|
|
806
|
+
* `undefined`/빈 문자열이거나 로드에 실패하면 fallback 이미지를 표시합니다.
|
|
807
|
+
*/
|
|
808
|
+
src: string | undefined;
|
|
809
|
+
/** 이미지 대체 텍스트(접근성). 사용자 이름 등을 전달합니다. 장식용이면 빈 문자열(`''`)을 넘기세요. */
|
|
810
|
+
alt: string;
|
|
811
|
+
/** 이미지 로딩 상태가 바뀔 때 호출됩니다. (idle → loading → loaded | error) */
|
|
812
|
+
onLoadingStatusChange?: (status: AvatarLoadingStatus) => void;
|
|
813
|
+
} & react.RefAttributes<HTMLSpanElement>>;
|
|
814
|
+
|
|
645
815
|
/**
|
|
646
816
|
* AlertDialogRoot
|
|
647
817
|
*
|
|
@@ -841,4 +1011,4 @@ interface RatioProps extends react.HTMLAttributes<HTMLDivElement> {
|
|
|
841
1011
|
*/
|
|
842
1012
|
declare const Ratio: react.ForwardRefExoticComponent<RatioProps & react.RefAttributes<HTMLDivElement>>;
|
|
843
1013
|
|
|
844
|
-
export { AlertDialog, type AlertDialogAction, type AlertDialogConfirmAction, type AlertDialogContentProps, Badge, type BadgeColor, type BadgeIconProps, type BadgeProps, type BadgeSize, type BadgeVariant, BottomSheet, type BottomSheetAction, type BottomSheetConfirmAction, type BottomSheetContentProps, type BottomSheetMode, type BreakPointsKey, Button, type ButtonIconProps, type ButtonProps, type ButtonSizeType, Caption, Checkbox, CoachMark, type CoachMarkContentProps, type CommonButtonProps, CompactCoachMark, type CompactCoachMarkContentProps, DEFAULT_LEVEL_OPTIONS, DEFAULT_SIZE_OPTIONS, DefaultButton, type DefaultButtonProps, type DefaultLevelType, Dialog, type DialogAction, type DialogConfirmAction, type DialogContentProps, Display, Heading, ICON_LEVEL_OPTIONS, ICON_SIZE_OPTIONS, type ICaptionProps, type IDisplayProps, type IHeadingProps, type IPropsAccent, type IPropsAnswer, type IPropsNormal, type IPropsNormalBold, type IPropsPost, type ITitleProps, IconButton, type IconButtonProps, type
|
|
1014
|
+
export { AlertDialog, type AlertDialogAction, type AlertDialogConfirmAction, type AlertDialogContentProps, Avatar, type AvatarLoadingStatus, type AvatarProps, type AvatarSize, Badge, type BadgeColor, type BadgeIconProps, type BadgeProps, type BadgeSize, type BadgeVariant, BottomSheet, type BottomSheetAction, type BottomSheetConfirmAction, type BottomSheetContentProps, type BottomSheetMode, type BreakPointsKey, Button, type ButtonIconProps, type ButtonProps, type ButtonSizeType, Caption, Checkbox, CoachMark, type CoachMarkContentProps, type CommonButtonProps, CompactCoachMark, type CompactCoachMarkContentProps, DEFAULT_LEVEL_OPTIONS, DEFAULT_SIZE_OPTIONS, DefaultButton, type DefaultButtonProps, type DefaultLevelType, Dialog, type DialogAction, type DialogConfirmAction, type DialogContentProps, Display, Heading, ICON_LEVEL_OPTIONS, ICON_SIZE_OPTIONS, type ICaptionProps, type IDisplayProps, type IHeadingProps, type IPropsAccent, type IPropsAnswer, type IPropsNormal, type IPropsNormalBold, type IPropsPost, type ITitleProps, IconButton, type IconButtonProps, LOGOS, Label, List, type ListGroupProps, ListItem, type ListItemProps, type ListProps, Loading, type LoadingLevelType, Logo, type LogoCategory, type LogoName, type LogoProps, Media, MediaContextProvider, Paragraph, type ParagraphProps, Popover, type PopoverContentProps, PrimitiveCoachMark, type PrimitiveCoachMarkContentProps, type PrimitiveCoachMarkRootProps, PrimitiveListItem, type PrimitiveListItemProps, type PromiseToastOptions, RATIO, Radio, Ratio, type RatioProps, Select, type SelectButtonSize, type SelectContentProps, type SelectFieldSize, type SelectGroupProps, type SelectItemProps, type SelectProps, type SelectTriggerProps, type SelectTriggerType, type SelectWidthOptions, TEXT_LEVEL_OPTIONS, TEXT_SIZE_OPTIONS, Tag, TextButton, type TextButtonProps, type TextSizeType, Textfield, type TextfieldButtonProps, type TextfieldLabelType, type TextfieldProps, Title, type ToastOptions, type ToastType, Toaster, Tooltip, Typography, arrayToStyleObject, isEmptyObject, objectToArray, rootMediaStyle, toast };
|