sellmate-design-system-react 9.0.0-beta.2 → 9.0.0-beta.20

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.
Files changed (130) hide show
  1. package/AGENTS.md +463 -89
  2. package/README.md +101 -0
  3. package/dist/components/SBadge/README.md +24 -0
  4. package/dist/components/SBadge/SBadge.d.ts +1 -1
  5. package/dist/components/SBarcodeInput/README.md +9 -1
  6. package/dist/components/SBarcodeInput/SBarcodeInput.d.ts +7 -1
  7. package/dist/components/SButton/README.md +36 -0
  8. package/dist/components/SCalendar/README.md +13 -0
  9. package/dist/components/SCallout/README.md +15 -0
  10. package/dist/components/SCard/SCard.d.ts +1 -1
  11. package/dist/components/SCheckbox/README.md +8 -0
  12. package/dist/components/SChipFilter/README.md +288 -5
  13. package/dist/components/SChipFilter/SChipFilter.d.ts +95 -40
  14. package/dist/components/SChipFilter/index.d.ts +1 -1
  15. package/dist/components/SChipInput/README.md +15 -1
  16. package/dist/components/SChipInput/SChipInput.d.ts +7 -1
  17. package/dist/components/SCircleProgress/README.md +8 -0
  18. package/dist/components/SConfirmModal/README.md +16 -0
  19. package/dist/components/SDatePicker/README.md +60 -4
  20. package/dist/components/SDatePicker/SDatePicker.d.ts +61 -5
  21. package/dist/components/SDatePicker/index.d.ts +1 -1
  22. package/dist/components/SDateRangePicker/README.md +17 -2
  23. package/dist/components/SDateRangePicker/SDateRangePicker.d.ts +16 -3
  24. package/dist/components/SDivider/README.md +4 -0
  25. package/dist/components/SDraggableItem/README.md +37 -0
  26. package/dist/components/SDraggableItem/SDraggableItem.d.ts +2 -0
  27. package/dist/components/SDraggableList/README.md +29 -0
  28. package/dist/components/SDraggableList/SDraggableList.d.ts +10 -0
  29. package/dist/components/SDraggableList/index.d.ts +1 -1
  30. package/dist/components/SDrawer/README.md +8 -0
  31. package/dist/components/SDropdownButton/README.md +19 -0
  32. package/dist/components/SEditor/EditorBody.d.ts +40 -0
  33. package/dist/components/SEditor/EditorToolbar.d.ts +87 -0
  34. package/dist/components/SEditor/README.md +230 -0
  35. package/dist/components/SEditor/SEditor.d.ts +124 -0
  36. package/dist/components/SEditor/editor-icons.d.ts +59 -0
  37. package/dist/components/SEditor/editor.config.d.ts +85 -0
  38. package/dist/components/SEditor/index.d.ts +2 -0
  39. package/dist/components/SEditor/tiptap-api.d.ts +29 -0
  40. package/dist/components/SEditor/use-is-mobile.d.ts +14 -0
  41. package/dist/components/SExpansionItem/README.md +36 -0
  42. package/dist/components/SField/README.md +27 -2
  43. package/dist/components/SField/SField.d.ts +22 -4
  44. package/dist/components/SFilePicker/README.md +15 -1
  45. package/dist/components/SFilePicker/SFilePicker.d.ts +7 -1
  46. package/dist/components/SFooter/README.md +21 -0
  47. package/dist/components/SForm/README.md +11 -0
  48. package/dist/components/SGhostButton/README.md +20 -2
  49. package/dist/components/SGnb/README.md +45 -0
  50. package/dist/components/SGnb/gnb.config.d.ts +7 -0
  51. package/dist/components/SGuide/README.md +15 -0
  52. package/dist/components/SIcon/README.md +4 -0
  53. package/dist/components/SIcon/SIcon.d.ts +1 -1
  54. package/dist/components/SIcon/icons.gen.d.ts +2 -0
  55. package/dist/components/SImage/README.md +14 -0
  56. package/dist/components/SInput/README.md +3 -1
  57. package/dist/components/SInput/SInput.d.ts +7 -1
  58. package/dist/components/SKeyValueTable/README.md +87 -0
  59. package/dist/components/SKeyValueTable/SKeyValueTable.d.ts +14 -3
  60. package/dist/components/SLayout/README.md +16 -0
  61. package/dist/components/SLinearProgress/README.md +8 -0
  62. package/dist/components/SList/README.md +5 -1
  63. package/dist/components/SList/SList.d.ts +0 -2
  64. package/dist/components/SListItem/README.md +41 -0
  65. package/dist/components/SLoadingModal/README.md +8 -0
  66. package/dist/components/SNumberInput/README.md +9 -1
  67. package/dist/components/SNumberInput/SNumberInput.d.ts +7 -1
  68. package/dist/components/SPage/README.md +41 -1
  69. package/dist/components/SPage/SPage.d.ts +24 -2
  70. package/dist/components/SPage/index.d.ts +1 -1
  71. package/dist/components/SPage/page.config.d.ts +8 -0
  72. package/dist/components/SPopover/README.md +15 -0
  73. package/dist/components/SPopup/README.md +19 -0
  74. package/dist/components/SPortal/README.md +14 -0
  75. package/dist/components/SRadio/README.md +20 -0
  76. package/dist/components/SRadioButton/README.md +18 -0
  77. package/dist/components/SScrollArea/README.md +14 -0
  78. package/dist/components/SSearchInput/README.md +61 -0
  79. package/dist/components/SSearchInput/SSearchInput.d.ts +52 -0
  80. package/dist/components/SSearchInput/index.d.ts +1 -0
  81. package/dist/components/SSectionHeaderCard/README.md +39 -20
  82. package/dist/components/SSectionHeaderCard/SSectionHeaderCard.d.ts +21 -14
  83. package/dist/components/SSectionHeaderCard/index.d.ts +1 -1
  84. package/dist/components/SSelect/README.md +25 -3
  85. package/dist/components/SSelect/SSelect.d.ts +13 -1
  86. package/dist/components/SSplitter/README.md +15 -0
  87. package/dist/components/SStepper/README.md +26 -0
  88. package/dist/components/SSwitch/README.md +13 -0
  89. package/dist/components/STable/README.md +72 -1
  90. package/dist/components/STable/STable.d.ts +129 -11
  91. package/dist/components/STable/index.d.ts +1 -1
  92. package/dist/components/STabs/README.md +12 -1
  93. package/dist/components/STabs/STabs.d.ts +2 -4
  94. package/dist/components/STabs/index.d.ts +1 -1
  95. package/dist/components/STabs/tabs.config.d.ts +3 -4
  96. package/dist/components/STag/README.md +47 -0
  97. package/dist/components/STextLink/README.md +17 -0
  98. package/dist/components/STextLink/STextLink.d.ts +2 -0
  99. package/dist/components/STextarea/README.md +1 -1
  100. package/dist/components/STextarea/STextarea.d.ts +7 -1
  101. package/dist/components/STimePicker/README.md +15 -1
  102. package/dist/components/STimePicker/STimePicker.d.ts +7 -1
  103. package/dist/components/STimePicker/timepicker.config.d.ts +7 -0
  104. package/dist/components/STimeRangePicker/README.md +27 -1
  105. package/dist/components/STimeRangePicker/STimeRangePicker.d.ts +7 -1
  106. package/dist/components/SToast/README.md +24 -0
  107. package/dist/components/SToggle/README.md +8 -0
  108. package/dist/components/STooltip/README.md +22 -0
  109. package/dist/components/STree/README.md +41 -0
  110. package/dist/components/STree/STree.d.ts +8 -0
  111. package/dist/components/STree/index.d.ts +1 -1
  112. package/dist/index.cjs +3987 -496
  113. package/dist/index.cjs.map +1 -1
  114. package/dist/index.d.ts +3 -0
  115. package/dist/index.js +3970 -496
  116. package/dist/index.js.map +1 -1
  117. package/dist/lib/field-width.d.ts +31 -0
  118. package/dist/lib/story-docs.d.ts +19 -3
  119. package/dist/lib/truncated-value-tooltip.d.ts +18 -0
  120. package/dist/llms-full.txt +2312 -198
  121. package/dist/llms.txt +465 -91
  122. package/dist/styles.css +672 -41
  123. package/dist/theme.css +22 -6
  124. package/eslint/index.mjs +10 -0
  125. package/eslint/lib/table-column.mjs +26 -0
  126. package/eslint/rules/field-width-grade.d.mts +41 -0
  127. package/eslint/rules/field-width-grade.mjs +311 -0
  128. package/eslint/rules/table-column-width.mjs +110 -0
  129. package/eslint/scale.gen.mjs +3 -0
  130. package/package.json +13 -1
@@ -12,6 +12,7 @@
12
12
  | `supportingText?` | `SDraggableItemSlot` | — | 제목을 보조하는 텍스트 |
13
13
  | `supportingTextPosition?` | `SDraggableItemSupportingTextPosition` | `'right'` | 보조 텍스트 위치 |
14
14
  | `trailing?` | `SDraggableItemSlot` | — | 타이틀 뒤에 표시할 태그/콘텐츠 |
15
+ | `depth?` | `number` | `1` | 중첩 단계. `SListItem`·`SExpansionItem` 과 같은 들여쓰기 간격을 사용한다 |
15
16
  | `accentStripe?` | `boolean` | `false` | 아이템 왼쪽 accent stripe 표시 여부 |
16
17
  | `bordered?` | `boolean` | `false` | 외곽 테두리 사용 여부 |
17
18
  | `selected?` | `boolean` | `false` | 선택 상태 여부 |
@@ -29,6 +30,42 @@
29
30
  |-------|------|-------------|
30
31
  | `onDragHandleMouseDown` | `(event: MouseEvent<HTMLDivElement>) => void` | 드래그 핸들 mouse down 이벤트 |
31
32
 
33
+ ## Types
34
+
35
+ ### SDraggableItemSlot
36
+
37
+ ```ts
38
+ export type SDraggableItemSlot = ReactNode | SDraggableItemRenderProp;
39
+ ```
40
+
41
+ ### SDraggableItemSupportingTextPosition
42
+
43
+ ```ts
44
+ export type SDraggableItemSupportingTextPosition = 'right' | 'bottom';
45
+ ```
46
+
47
+ ### SDraggableItemSize
48
+
49
+ ```ts
50
+ export type SDraggableItemSize = 'sm' | 'md';
51
+ ```
52
+
53
+ ### SDraggableItemRenderProp
54
+
55
+ ```ts
56
+ export type SDraggableItemRenderProp = (state: SDraggableItemRenderState) => ReactNode;
57
+ ```
58
+
59
+ ### SDraggableItemRenderState
60
+
61
+ ```ts
62
+ export interface SDraggableItemRenderState {
63
+ hovered: boolean;
64
+ dragging: boolean;
65
+ disabled: boolean;
66
+ }
67
+ ```
68
+
32
69
  ## Dependencies
33
70
 
34
71
  ### Depends on
@@ -17,6 +17,8 @@ export interface SDraggableItemProps extends Omit<HTMLAttributes<HTMLDivElement>
17
17
  supportingTextPosition?: SDraggableItemSupportingTextPosition;
18
18
  /** 타이틀 뒤에 표시할 태그/콘텐츠 */
19
19
  trailing?: SDraggableItemSlot;
20
+ /** 중첩 단계. `SListItem`·`SExpansionItem` 과 같은 들여쓰기 간격을 사용한다 */
21
+ depth?: number;
20
22
  /** 아이템 왼쪽 accent stripe 표시 여부 */
21
23
  accentStripe?: boolean;
22
24
  /** 외곽 테두리 사용 여부 */
@@ -28,6 +28,10 @@
28
28
  | `selectedKey?` | `string` | — | 외부에서 제어하는 selected 아이템 key |
29
29
  | `defaultSelectedKey?` | `string` | — | 초기 selected 아이템 key |
30
30
  | `getDisabled?` | `(item: T, index: number) => boolean` | — | disabled 아이템은 선택 및 드래그에서 제외 |
31
+ | `getDepth?` | `(item: T, index: number) => number` | — | 아이템의 중첩 단계. 기본값은 1 |
32
+ | `setDepth?` | `(item: T, depth: number) => T` | — | depth 변경이 필요한 드롭에서 다음 아이템을 만드는 함수 |
33
+ | `getCanHaveChildren?` | `(item: T, index: number) => boolean` | — | 하위 depth 를 가질 수 있는 아이템인지 판정 |
34
+ | `maxDepth?` | `number` | `3` | 허용할 최대 depth |
31
35
  | `listId?` | `string` | — | Provider 안에서 사용할 리스트 식별자 |
32
36
  | `group?` | `string` | — | 같은 group 값을 가진 리스트끼리 드래그 이벤트를 공유 |
33
37
 
@@ -46,6 +50,31 @@
46
50
  |------|------|---------|-------------|
47
51
  | `children` | `ReactNode` | — | |
48
52
 
53
+ ## Types
54
+
55
+ ### SDraggableGroupMoveEvent
56
+
57
+ ```ts
58
+ export interface SDraggableGroupMoveEvent {
59
+ group: string;
60
+ itemKey: string;
61
+ fromListId: string;
62
+ fromIndex: number;
63
+ toListId: string;
64
+ toIndex: number;
65
+ }
66
+ ```
67
+
68
+ ### SDraggableListRenderState
69
+
70
+ ```ts
71
+ export interface SDraggableListRenderState {
72
+ onDragHandleMouseDown: (event: MouseEvent<HTMLDivElement>) => void;
73
+ selected: boolean;
74
+ depth: number;
75
+ }
76
+ ```
77
+
49
78
  ## Dependencies
50
79
 
51
80
  ### Depends on
@@ -3,7 +3,9 @@ import { type SListProps } from '../SList';
3
3
  export interface SDraggableListRenderState {
4
4
  onDragHandleMouseDown: (event: MouseEvent<HTMLDivElement>) => void;
5
5
  selected: boolean;
6
+ depth: number;
6
7
  }
8
+ export type SDraggableListDropIntent = 'before' | 'inside' | 'after';
7
9
  export interface SDraggableListProps<T> extends Omit<SListProps, 'children' | 'onChange'> {
8
10
  /** 현재 순서대로 렌더링할 아이템 목록 */
9
11
  items: T[];
@@ -21,6 +23,14 @@ export interface SDraggableListProps<T> extends Omit<SListProps, 'children' | 'o
21
23
  onSelectedKeyChange?: (key: string) => void;
22
24
  /** disabled 아이템은 선택 및 드래그에서 제외 */
23
25
  getDisabled?: (item: T, index: number) => boolean;
26
+ /** 아이템의 중첩 단계. 기본값은 1 */
27
+ getDepth?: (item: T, index: number) => number;
28
+ /** depth 변경이 필요한 드롭에서 다음 아이템을 만드는 함수 */
29
+ setDepth?: (item: T, depth: number) => T;
30
+ /** 하위 depth 를 가질 수 있는 아이템인지 판정 */
31
+ getCanHaveChildren?: (item: T, index: number) => boolean;
32
+ /** 허용할 최대 depth */
33
+ maxDepth?: number;
24
34
  /** Provider 안에서 사용할 리스트 식별자 */
25
35
  listId?: string;
26
36
  /** 같은 group 값을 가진 리스트끼리 드래그 이벤트를 공유 */
@@ -1,2 +1,2 @@
1
- export { SDraggableList, type SDraggableListProps, type SDraggableListRenderState, } from './SDraggableList';
1
+ export { SDraggableList, type SDraggableListDropIntent, type SDraggableListProps, type SDraggableListRenderState, } from './SDraggableList';
2
2
  export { SDraggableProvider, SDraggableGroup, type SDraggableGroupMoveEvent, type SDraggableGroupProps, type SDraggableProviderProps, } from './SDraggableGroup';
@@ -29,6 +29,14 @@
29
29
  | `onClose` | `() => void` | 닫기(X) 버튼 클릭 |
30
30
  | `onWidthChange` | `(width: number) => void` | 너비가 확정될 때(드래그를 놓거나 방향키 조작). 드래그하는 동안에는 오지 않는다 |
31
31
 
32
+ ## Types
33
+
34
+ ### SDrawerButton
35
+
36
+ ```ts
37
+ export type SDrawerButton = SFooterButton;
38
+ ```
39
+
32
40
  ## Dependencies
33
41
 
34
42
  ### Depends on
@@ -33,6 +33,25 @@
33
33
  | `open` | `() => void` | 드롭다운 열기 (sdOpen) |
34
34
  | `close` | `() => void` | 드롭다운 닫기 (sdClose) |
35
35
 
36
+ ## Types
37
+
38
+ ### SDropdownButtonSize
39
+
40
+ ```ts
41
+ export type SDropdownButtonSize = 'xs' | 'sm' | 'md';
42
+ ```
43
+
44
+ ### SDropdownButtonItem
45
+
46
+ ```ts
47
+ export interface SDropdownButtonItem {
48
+ value: string | number;
49
+ label: string;
50
+ icon?: SIconName;
51
+ disabled?: boolean;
52
+ }
53
+ ```
54
+
36
55
  ## Dependencies
37
56
 
38
57
  ### Depends on
@@ -0,0 +1,40 @@
1
+ import { type CSSProperties, type RefObject } from 'react';
2
+ import { type SEditorColorOption, type SEditorToolbarItem } from './editor.config';
3
+ import type { SEditorHandle } from './SEditor';
4
+ import type { TiptapApi } from './tiptap-api';
5
+ export interface EditorBodyProps {
6
+ /** 다 불러온 tiptap — 이 컴포넌트는 준비된 뒤에만 마운트된다 */
7
+ api: TiptapApi;
8
+ value?: string;
9
+ defaultValue?: string;
10
+ /** 지금 화면에 있는 HTML. 껍데기(SEditor)가 규칙 검증·폼 제출에 쓴다 */
11
+ htmlRef: RefObject<string>;
12
+ /** 사용자가 고쳐서 값이 바뀌었다 (setHTML·clear 같은 프로그램 조작은 제외) */
13
+ onInput: (html: string) => void;
14
+ onFocusChange: (focused: boolean) => void;
15
+ /** 에디터 인스턴스가 생겼다 — 껍데기가 밀린 focus() 를 흘려보낸다 */
16
+ onReady: () => void;
17
+ placeholder: string;
18
+ typography: boolean;
19
+ editable: boolean;
20
+ disabled: boolean;
21
+ minHeight?: number | string;
22
+ maxHeight?: number | string;
23
+ toolbar: SEditorToolbarItem[] | false;
24
+ /** 선택 영역 위에 뜨는 서식 판. `false` 면 그리지 않는다 */
25
+ bubbleMenu: SEditorToolbarItem[] | false;
26
+ fontSizes: number[];
27
+ colors: SEditorColorOption[];
28
+ highlights: SEditorColorOption[];
29
+ onImageUpload?: (file: File) => Promise<string>;
30
+ editorClass?: string;
31
+ editorStyle?: CSSProperties;
32
+ }
33
+ /**
34
+ * SEditor 의 편집 영역 (내부 전용 — 배럴로 내보내지 않는다).
35
+ *
36
+ * tiptap 을 실제로 부리는 곳은 여기뿐이고, 그 tiptap 조차 `api` prop 으로 받는다.
37
+ * 이 파일이 `@tiptap/*` 을 정적으로 import 하면 그 순간 SEditor 를 쓰지 않는 소비 앱까지
38
+ * tiptap 이 번들에 남는다 (tiptap-api.ts 주석 참고) — 타입만 가져온다.
39
+ */
40
+ export declare const EditorBody: import("react").ForwardRefExoticComponent<EditorBodyProps & import("react").RefAttributes<SEditorHandle>>;
@@ -0,0 +1,87 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ import { type SEditorColorOption, type SEditorHeadingLevel, type SEditorToolbarItem } from './editor.config';
3
+ import type { TiptapApi } from './tiptap-api';
4
+ /** 툴바 막대 — 엔진을 불러오는 동안 SEditor 가 같은 높이를 잡아 두는 데도 쓴다 */
5
+ export declare const TOOLBAR_BAR_CLASS = "flex flex-wrap items-center gap-[2px] border-b border-solid px-[8px] py-[4px]";
6
+ export declare const TOOLBAR_BAR_STYLE: {
7
+ borderBottomColor: string;
8
+ };
9
+ /** 버튼의 눌림 표시에 필요한 것만 추린 에디터 상태 */
10
+ declare const readEditorState: (e: Editor) => {
11
+ heading: SEditorHeadingLevel | 0;
12
+ bold: boolean;
13
+ italic: boolean;
14
+ underline: boolean;
15
+ strike: boolean;
16
+ code: boolean;
17
+ superscript: boolean;
18
+ subscript: boolean;
19
+ alignLeft: boolean;
20
+ alignCenter: boolean;
21
+ alignRight: boolean;
22
+ alignJustify: boolean;
23
+ bulletList: boolean;
24
+ orderedList: boolean;
25
+ taskList: boolean;
26
+ blockquote: boolean;
27
+ codeBlock: boolean;
28
+ link: boolean;
29
+ linkHref: string;
30
+ color: string;
31
+ highlight: string;
32
+ fontSize: string;
33
+ canUndo: boolean;
34
+ canRedo: boolean;
35
+ };
36
+ export type EditorToolbarState = ReturnType<typeof readEditorState>;
37
+ /** 에디터가 아직 없을 때의 상태 — 아무것도 켜져 있지 않고 되돌릴 것도 없다 */
38
+ export declare const IDLE_TOOLBAR_STATE: EditorToolbarState;
39
+ export interface EditorToolbarBarProps {
40
+ /** 눌림 표시 — 에디터가 아직 없으면 `IDLE_TOOLBAR_STATE` */
41
+ state: EditorToolbarState;
42
+ /** 없으면 버튼을 눌러도 아무 일도 하지 않는다 (그때는 disabled 로 함께 잠근다) */
43
+ editor: Editor | null;
44
+ items: SEditorToolbarItem[];
45
+ fontSizes: readonly number[];
46
+ colors: SEditorColorOption[];
47
+ highlights: SEditorColorOption[];
48
+ /** 이미지 업로드 훅. 없으면 `image` 항목을 그리지 않는다 */
49
+ onImageUpload?: (file: File) => Promise<string>;
50
+ /** 편집 불가(비활성·읽기전용·엔진 로딩 중) — 모든 버튼을 잠근다 */
51
+ disabled: boolean;
52
+ /**
53
+ * `'bar'` 는 편집 영역 위에 붙는 막대, `'bubble'` 은 선택 영역 위에 뜨는 판이다.
54
+ * 그리는 버튼은 같고 담는 상자와 줄바꿈만 다르다.
55
+ */
56
+ variant?: 'bar' | 'bubble';
57
+ }
58
+ interface EditorToolbarProps extends Omit<EditorToolbarBarProps, 'state'> {
59
+ /** 동적으로 불러온 tiptap (useEditorState) */
60
+ api: TiptapApi;
61
+ }
62
+ /**
63
+ * 툴바 막대 (내부 전용 — 배럴로 내보내지 않는다).
64
+ *
65
+ * tiptap 을 모른다 — 눌림 상태는 `state` 로 받고 명령은 `editor` 가 있을 때만 나간다.
66
+ * 그래서 엔진을 불러오는 동안에도 SEditor 가 같은 막대를 그려 자리를 지킬 수 있다.
67
+ * 버튼 개수·아이콘이 같아야 줄바꿈까지 같아, 엔진이 붙는 순간 화면이 밀리지 않는다.
68
+ */
69
+ export declare function EditorToolbarBar({ state, editor, items, fontSizes, colors, highlights, onImageUpload, disabled, variant, }: EditorToolbarBarProps): import("react").JSX.Element;
70
+ /**
71
+ * 버블 메뉴 — 글을 선택하면 그 위에 서식 판이 뜬다.
72
+ *
73
+ * tiptap Simple Editor 에는 없는 것이다(템플릿은 막대 하나뿐이다). 막대와 같은 버튼을
74
+ * 같은 코드로 그리고 담는 상자만 바꾼다 — 두 곳의 눌림 표시가 어긋날 일이 없다.
75
+ *
76
+ * 판은 `appendTo` 로 소속 모달(없으면 `body`)에 붙인다. 그대로 두면 tiptap 이 편집 영역의
77
+ * 부모에 붙이는데, 그 부모는 `maxHeight` 를 받으면 스크롤 상자가 되어 판 위쪽이 잘린다.
78
+ */
79
+ export declare function EditorBubbleMenu({ api, editor, ...rest }: EditorToolbarProps): import("react").JSX.Element | null;
80
+ /**
81
+ * SEditor 툴바 — 눌림 상태를 tiptap 에서 구독해 막대에 넘긴다.
82
+ *
83
+ * `useEditorState` 를 거치는 이유: tiptap v3 는 트랜잭션마다 리렌더하지 않으므로, 이걸
84
+ * 거치지 않으면 커서를 굵은 글자 위로 옮겨도 B 버튼이 켜지지 않는다.
85
+ */
86
+ export declare function EditorToolbar({ api, editor, ...rest }: EditorToolbarProps): import("react").JSX.Element;
87
+ export {};
@@ -0,0 +1,230 @@
1
+ # SEditor
2
+
3
+ > 자동 생성 문서 — `npm run docs:gen`. 소스: 각 컴포넌트의 Props/Handle 인터페이스 + import 의존성.
4
+
5
+ ### EditorBody
6
+
7
+ #### Props
8
+
9
+ | Prop | Type | Default | Description |
10
+ |------|------|---------|-------------|
11
+ | `api` | `TiptapApi` | — | 다 불러온 tiptap — 이 컴포넌트는 준비된 뒤에만 마운트된다 |
12
+ | `value?` | `string` | — | |
13
+ | `defaultValue?` | `string` | — | |
14
+ | `htmlRef` | `RefObject<string>` | — | 지금 화면에 있는 HTML. 껍데기(SEditor)가 규칙 검증·폼 제출에 쓴다 |
15
+ | `placeholder` | `string` | — | |
16
+ | `typography` | `boolean` | — | |
17
+ | `editable` | `boolean` | — | |
18
+ | `disabled` | `boolean` | — | |
19
+ | `minHeight?` | `number \| string` | — | |
20
+ | `maxHeight?` | `number \| string` | — | |
21
+ | `toolbar` | `SEditorToolbarItem[] \| false` | — | |
22
+ | `bubbleMenu` | `SEditorToolbarItem[] \| false` | — | 선택 영역 위에 뜨는 서식 판. `false` 면 그리지 않는다 |
23
+ | `fontSizes` | `number[]` | — | |
24
+ | `colors` | `SEditorColorOption[]` | — | |
25
+ | `highlights` | `SEditorColorOption[]` | — | |
26
+ | `editorClass?` | `string` | — | |
27
+ | `editorStyle?` | `CSSProperties` | — | |
28
+
29
+ #### Events
30
+
31
+ | Event | Type | Description |
32
+ |-------|------|-------------|
33
+ | `onInput` | `(html: string) => void` | 사용자가 고쳐서 값이 바뀌었다 (setHTML·clear 같은 프로그램 조작은 제외) |
34
+ | `onFocusChange` | `(focused: boolean) => void` | |
35
+ | `onReady` | `() => void` | 에디터 인스턴스가 생겼다 — 껍데기가 밀린 focus() 를 흘려보낸다 |
36
+ | `onImageUpload` | `(file: File) => Promise<string>` | |
37
+
38
+ ### EditorToolbarBar
39
+
40
+ #### Props
41
+
42
+ | Prop | Type | Default | Description |
43
+ |------|------|---------|-------------|
44
+ | `state` | `EditorToolbarState` | — | 눌림 표시 — 에디터가 아직 없으면 `IDLE_TOOLBAR_STATE` |
45
+ | `editor` | `Editor \| null` | — | 없으면 버튼을 눌러도 아무 일도 하지 않는다 (그때는 disabled 로 함께 잠근다) |
46
+ | `items` | `SEditorToolbarItem[]` | — | |
47
+ | `fontSizes` | `readonly number[]` | — | |
48
+ | `colors` | `SEditorColorOption[]` | — | |
49
+ | `highlights` | `SEditorColorOption[]` | — | |
50
+ | `disabled` | `boolean` | — | 편집 불가(비활성·읽기전용·엔진 로딩 중) — 모든 버튼을 잠근다 |
51
+ | `variant?` | `'bar' \| 'bubble'` | `'bar'` | `'bar'` 는 편집 영역 위에 붙는 막대, `'bubble'` 은 선택 영역 위에 뜨는 판이다. 그리는 버튼은 같고 담는 상자와 줄바꿈만 다르다. |
52
+
53
+ #### Events
54
+
55
+ | Event | Type | Description |
56
+ |-------|------|-------------|
57
+ | `onImageUpload` | `(file: File) => Promise<string>` | 이미지 업로드 훅. 없으면 `image` 항목을 그리지 않는다 |
58
+
59
+ ### SEditor
60
+
61
+ #### Props
62
+
63
+ | Prop | Type | Default | Description |
64
+ |------|------|---------|-------------|
65
+ | `value?` | `string` | — | 값 (제어) — HTML 문자열 |
66
+ | `defaultValue?` | `string` | — | 초기값 (비제어) — HTML 문자열 |
67
+ | `placeholder?` | `string` | `'내용을 입력해 주세요.'` | 빈 문서에 보일 안내 문구 |
68
+ | `minHeight?` | `number \| string` | `200` | 편집 영역 최소 높이 (숫자=px) |
69
+ | `maxHeight?` | `number \| string` | — | 편집 영역 최대 높이 (숫자=px). 넘으면 편집 영역 안에서만 스크롤한다 |
70
+ | `toolbar?` | `SEditorToolbarItem[] \| false` | `SEDITOR_DEFAULT_TOOLBAR` | 툴바 구성. `false` 면 툴바 없이 본문만 (읽기 화면·간단 메모용) |
71
+ | `bubbleMenu?` | `SEditorToolbarItem[] \| false` | `SEDITOR_DEFAULT_BUBBLE_MENU` | 글을 선택했을 때 그 위에 뜨는 서식 판의 구성. `false` 면 뜨지 않는다. 읽기 전용·비활성일 때는 어차피 뜨지 않는다. 좁은 칸에 놓인 에디터라면 판이 필드 밖으로 넘칠 수 있으니 항목을 줄이거나 `false` 로 끈다. |
72
+ | `fontSizes?` | `number[]` | `[...SEDITOR_FONT_SIZES]` | 글자 크기 드롭다운 선택지 (px) |
73
+ | `colors?` | `SEditorColorOption[]` | `SEDITOR_DEFAULT_COLORS` | 글자색 팔레트 |
74
+ | `highlights?` | `SEditorColorOption[]` | `SEDITOR_DEFAULT_HIGHLIGHTS` | 형광펜(배경색) 팔레트 |
75
+ | `typography?` | `boolean` | `false` | 따옴표·하이픈·화살표 자동 치환 (`"` → `“”`, `--` → `—`, `->` → `→`). 상품 코드·규격 문자열이 입력한 그대로 남아야 하는 화면이 많아 기본은 끔이다. **마운트 시점에만 반영된다** — 값이 바뀌어도 이미 만들어진 에디터에는 적용되지 않는다. |
76
+ | `rules?` | `Rule[]` | — | 유효성 규칙 — blur 시 자동 검증 |
77
+ | `status?` | `SFieldStatus` | — | 필드 상태 ('default' | 'pass' | 'error') |
78
+ | `focused?` | `boolean` | — | 포커스 상태 (제어/반영) |
79
+ | `hovered?` | `boolean` | — | 호버 상태 (제어/반영) |
80
+ | `name?` | `string` | — | 폼 전송용 name |
81
+ | `editorClass?` | `string` | — | 편집 영역 className |
82
+ | `editorStyle?` | `CSSProperties` | — | 편집 영역 style |
83
+ | `label?` | `string` | — | |
84
+ | `labelWidth?` | `number \| string` | — | |
85
+ | `icon?` | `SIconName` | — | 레이블 영역 아이콘 |
86
+ | `iconColor?` | `SColor` | — | |
87
+ | `labelTooltip?` | `string` | — | 레이블 툴팁 텍스트 |
88
+ | `labelTooltipProps?` | `Partial<STooltipProps>` | — | 레이블 툴팁 상세 옵션 |
89
+ | `addonLabel?` | `string` | — | 우측 어드온 레이블 |
90
+ | `addonAlign?` | `SFieldAddonAlign` | — | 어드온 정렬 |
91
+ | `hint?` | `string` | — | |
92
+ | `error?` | `boolean` | — | |
93
+ | `errorMessage?` | `string` | — | |
94
+ | `width?` | `SFieldWidth` | `'100%'` | 컨트롤 너비 — 폭 등급(`'xs' | 'sm' | 'md' | 'lg' | 'xl'`) · 숫자=px · CSS 길이. 본문 길이에 상한이 없으므로 기본은 `"100%"`(행 전체)다. |
95
+ | `disabled?` | `boolean` | `false` | |
96
+ | `readOnly?` | `boolean` | `false` | |
97
+ | `className?` | `string` | — | |
98
+ | `style?` | `CSSProperties` | — | |
99
+
100
+ #### Events
101
+
102
+ | Event | Type | Description |
103
+ |-------|------|-------------|
104
+ | `onValueChange` | `(html: string) => void` | 값 변경 (sdUpdate) — 빈 문서면 빈 문자열을 준다 |
105
+ | `onImageUpload` | `(file: File) => Promise<string>` | 이미지 업로드 — 고른 파일을 저장하고 **표시할 URL 을 돌려준다.** 저장 위치는 앱마다 다르므로 DS 가 정하지 않는다. 이 훅이 없으면 툴바에서 이미지 항목이 빠진다 (본문에 base64 를 박지 않는다 — HTML 이 그대로 DB 로 실려 간다). |
106
+ | `onFocus` | `() => void` | 포커스 진입 |
107
+ | `onBlur` | `() => void` | 포커스 이탈 |
108
+
109
+ #### Methods (ref)
110
+
111
+ | Method | Type | Description |
112
+ |--------|------|-------------|
113
+ | `focus` | `() => void` | 편집 영역에 포커스 |
114
+ | `blur` | `() => void` | 포커스 해제 |
115
+ | `getHTML` | `() => string` | 현재 내용을 HTML 로 반환 (빈 문서면 빈 문자열) |
116
+ | `getText` | `() => string` | 현재 내용을 서식 없는 텍스트로 반환 |
117
+ | `setHTML` | `(html: string) => void` | 내용을 HTML 로 교체 (onValueChange 를 발생시키지 않는다) |
118
+ | `clear` | `() => void` | 내용을 비운다 |
119
+ | `editor` | `Editor \| null` | tiptap 에디터 인스턴스 — 확장 명령이 필요할 때만 쓴다 |
120
+
121
+ ## Types
122
+
123
+ ### TiptapApi
124
+
125
+ ```ts
126
+ /** 동적으로 불러온 tiptap — 이 객체를 거치지 않고는 에디터 코드가 tiptap 을 만지지 않는다. */
127
+ export interface TiptapApi {
128
+ useEditor: TiptapReact['useEditor'];
129
+ useEditorState: TiptapReact['useEditorState'];
130
+ EditorContent: TiptapReact['EditorContent'];
131
+ /** 선택 영역 위에 뜨는 판 — 자리는 floating-ui 가 잡는다 */
132
+ BubbleMenu: TiptapMenus['BubbleMenu'];
133
+ /** tiptap 확장 구성 — 아래 createExtensions 주석 참고 */
134
+ createExtensions: (options: SEditorExtensionOptions) => AnyExtension[];
135
+ }
136
+ ```
137
+
138
+ ### SEditorToolbarItem
139
+
140
+ ```ts
141
+ export type SEditorToolbarItem = SEditorToolbarAction | '|';
142
+ ```
143
+
144
+ ### SEditorColorOption
145
+
146
+ ```ts
147
+ export interface SEditorColorOption {
148
+ /** 팔레트 칸의 접근성 레이블·툴팁 */
149
+ label: string;
150
+ /** 팔레트 키(`red_75` …) 또는 CSS 색상 문자열 */
151
+ color: SColor;
152
+ }
153
+ ```
154
+
155
+ ### EditorToolbarState
156
+
157
+ ```ts
158
+ export type EditorToolbarState = ReturnType<typeof readEditorState>;
159
+ ```
160
+
161
+ ### SEditorExtensionOptions
162
+
163
+ ```ts
164
+ export interface SEditorExtensionOptions {
165
+ /** 빈 문서에 보일 문구를 그때그때 읽어 오는 게터 */
166
+ getPlaceholder: () => string;
167
+ /** 따옴표·하이픈·화살표 자동 치환 (Typography) */
168
+ typography: boolean;
169
+ }
170
+ ```
171
+
172
+ ### SEditorToolbarAction
173
+
174
+ ```ts
175
+ export type SEditorToolbarAction = (typeof SEDITOR_TOOLBAR_ITEMS)[number];
176
+ ```
177
+
178
+ ### SEDITOR_TOOLBAR_ITEMS
179
+
180
+ ```ts
181
+ /** 툴바에 놓을 수 있는 항목. `'|'` 는 구분선이다. */
182
+ export const SEDITOR_TOOLBAR_ITEMS = [
183
+ 'heading',
184
+ 'fontSize',
185
+ 'bold',
186
+ 'italic',
187
+ 'underline',
188
+ 'strike',
189
+ 'code',
190
+ 'color',
191
+ 'highlight',
192
+ 'superscript',
193
+ 'subscript',
194
+ 'alignLeft',
195
+ 'alignCenter',
196
+ 'alignRight',
197
+ 'alignJustify',
198
+ 'bulletList',
199
+ 'orderedList',
200
+ 'taskList',
201
+ 'list',
202
+ 'blockquote',
203
+ 'codeBlock',
204
+ 'horizontalRule',
205
+ 'link',
206
+ 'image',
207
+ 'undo',
208
+ 'redo',
209
+ ] as const;
210
+ ```
211
+
212
+ ## Dependencies
213
+
214
+ ### Depends on
215
+
216
+ - [SButton](../SButton)
217
+ - [SField](../SField)
218
+ - [SIcon](../SIcon)
219
+ - [SInput](../SInput)
220
+
221
+ ### Graph
222
+
223
+ ```mermaid
224
+ graph TD;
225
+ SEditor --> SButton
226
+ SEditor --> SField
227
+ SEditor --> SIcon
228
+ SEditor --> SInput
229
+ style SEditor fill:#f9f,stroke:#333,stroke-width:4px
230
+ ```
@@ -0,0 +1,124 @@
1
+ import { type CSSProperties } from 'react';
2
+ import type { Editor } from '@tiptap/core';
3
+ import { type SColor } from '../../lib/color';
4
+ import { type SFieldWidth } from '../../lib/field-width';
5
+ import { type Rule } from '../../lib/form';
6
+ import { type SFieldAddonAlign, type SFieldStatus } from '../SField';
7
+ import { type SIconName } from '../SIcon';
8
+ import { type STooltipProps } from '../STooltip';
9
+ import { type SEditorColorOption, type SEditorToolbarItem } from './editor.config';
10
+ /** ref 로 노출되는 조작 메서드 */
11
+ export interface SEditorHandle {
12
+ /** 편집 영역에 포커스 */
13
+ focus: () => void;
14
+ /** 포커스 해제 */
15
+ blur: () => void;
16
+ /** 현재 내용을 HTML 로 반환 (빈 문서면 빈 문자열) */
17
+ getHTML: () => string;
18
+ /** 현재 내용을 서식 없는 텍스트로 반환 */
19
+ getText: () => string;
20
+ /** 내용을 HTML 로 교체 (onValueChange 를 발생시키지 않는다) */
21
+ setHTML: (html: string) => void;
22
+ /** 내용을 비운다 */
23
+ clear: () => void;
24
+ /** tiptap 에디터 인스턴스 — 확장 명령이 필요할 때만 쓴다 */
25
+ editor: Editor | null;
26
+ }
27
+ export interface SEditorProps {
28
+ /** 값 (제어) — HTML 문자열 */
29
+ value?: string;
30
+ /** 초기값 (비제어) — HTML 문자열 */
31
+ defaultValue?: string;
32
+ /** 값 변경 (sdUpdate) — 빈 문서면 빈 문자열을 준다 */
33
+ onValueChange?: (html: string) => void;
34
+ /** 빈 문서에 보일 안내 문구 */
35
+ placeholder?: string;
36
+ /** 편집 영역 최소 높이 (숫자=px) */
37
+ minHeight?: number | string;
38
+ /** 편집 영역 최대 높이 (숫자=px). 넘으면 편집 영역 안에서만 스크롤한다 */
39
+ maxHeight?: number | string;
40
+ /** 툴바 구성. `false` 면 툴바 없이 본문만 (읽기 화면·간단 메모용) */
41
+ toolbar?: SEditorToolbarItem[] | false;
42
+ /**
43
+ * 글을 선택했을 때 그 위에 뜨는 서식 판의 구성. `false` 면 뜨지 않는다.
44
+ *
45
+ * 읽기 전용·비활성일 때는 어차피 뜨지 않는다. 좁은 칸에 놓인 에디터라면 판이 필드 밖으로
46
+ * 넘칠 수 있으니 항목을 줄이거나 `false` 로 끈다.
47
+ */
48
+ bubbleMenu?: SEditorToolbarItem[] | false;
49
+ /** 글자 크기 드롭다운 선택지 (px) */
50
+ fontSizes?: number[];
51
+ /** 글자색 팔레트 */
52
+ colors?: SEditorColorOption[];
53
+ /** 형광펜(배경색) 팔레트 */
54
+ highlights?: SEditorColorOption[];
55
+ /**
56
+ * 이미지 업로드 — 고른 파일을 저장하고 **표시할 URL 을 돌려준다.**
57
+ * 저장 위치는 앱마다 다르므로 DS 가 정하지 않는다. 이 훅이 없으면 툴바에서
58
+ * 이미지 항목이 빠진다 (본문에 base64 를 박지 않는다 — HTML 이 그대로 DB 로 실려 간다).
59
+ */
60
+ onImageUpload?: (file: File) => Promise<string>;
61
+ /**
62
+ * 따옴표·하이픈·화살표 자동 치환 (`"` → `“”`, `--` → `—`, `->` → `→`).
63
+ * 상품 코드·규격 문자열이 입력한 그대로 남아야 하는 화면이 많아 기본은 끔이다.
64
+ * **마운트 시점에만 반영된다** — 값이 바뀌어도 이미 만들어진 에디터에는 적용되지 않는다.
65
+ */
66
+ typography?: boolean;
67
+ /** 유효성 규칙 — blur 시 자동 검증 */
68
+ rules?: Rule[];
69
+ /** 필드 상태 ('default' | 'pass' | 'error') */
70
+ status?: SFieldStatus;
71
+ /** 포커스 상태 (제어/반영) */
72
+ focused?: boolean;
73
+ /** 호버 상태 (제어/반영) */
74
+ hovered?: boolean;
75
+ /** 폼 전송용 name */
76
+ name?: string;
77
+ /** 편집 영역 className */
78
+ editorClass?: string;
79
+ /** 편집 영역 style */
80
+ editorStyle?: CSSProperties;
81
+ /** 포커스 진입 */
82
+ onFocus?: () => void;
83
+ /** 포커스 이탈 */
84
+ onBlur?: () => void;
85
+ label?: string;
86
+ labelWidth?: number | string;
87
+ /** 레이블 영역 아이콘 */
88
+ icon?: SIconName;
89
+ iconColor?: SColor;
90
+ /** 레이블 툴팁 텍스트 */
91
+ labelTooltip?: string;
92
+ /** 레이블 툴팁 상세 옵션 */
93
+ labelTooltipProps?: Partial<STooltipProps>;
94
+ /** 우측 어드온 레이블 */
95
+ addonLabel?: string;
96
+ /** 어드온 정렬 */
97
+ addonAlign?: SFieldAddonAlign;
98
+ hint?: string;
99
+ error?: boolean;
100
+ errorMessage?: string;
101
+ /**
102
+ * 컨트롤 너비 — 폭 등급(`'xs' | 'sm' | 'md' | 'lg' | 'xl'`) · 숫자=px · CSS 길이.
103
+ * 본문 길이에 상한이 없으므로 기본은 `"100%"`(행 전체)다.
104
+ */
105
+ width?: SFieldWidth;
106
+ disabled?: boolean;
107
+ readOnly?: boolean;
108
+ className?: string;
109
+ style?: CSSProperties;
110
+ }
111
+ /**
112
+ * SEditor — tiptap 기반 리치 텍스트 에디터.
113
+ *
114
+ * 값은 **HTML 문자열**로 주고받는다. 들어온 HTML 은 tiptap 스키마가 파싱하므로 스키마에 없는
115
+ * 태그·속성(script·onerror …)은 그 자리에서 떨어져 나간다 — 별도 살균기를 거치지 않는다.
116
+ * 테두리 박스·라벨·에러 표시는 `SField`(multiline) 가 소유하고, 이 컴포넌트는 그 안에
117
+ * 툴바와 편집 영역만 세로로 쌓는다.
118
+ *
119
+ * tiptap 은 **마운트한 뒤에 불러온다** — 정적으로 묶으면 SEditor 를 한 번도 쓰지 않는 소비
120
+ * 앱까지 tiptap·prosemirror 를 번들에 지고 간다 (`tiptap-api.ts` 주석 참고). 불러오는 동안은
121
+ * 같은 크기의 빈 편집 영역이 자리를 지키므로 화면이 튀지 않고, 그 사이 `ref` 의 메서드는
122
+ * 아무 일도 하지 않는다 — `focus()` 만은 기억해 두었다가 준비되는 순간 흘려보낸다.
123
+ */
124
+ export declare const SEditor: import("react").ForwardRefExoticComponent<SEditorProps & import("react").RefAttributes<SEditorHandle>>;