@ezpg/app-ui 0.16.0 → 0.18.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.
Files changed (194) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/lib/module/blocks/cover-photos/cover-photos.js +165 -0
  3. package/lib/module/blocks/cover-photos/cover-photos.js.map +1 -0
  4. package/lib/module/blocks/cover-photos/index.js +4 -0
  5. package/lib/module/blocks/cover-photos/index.js.map +1 -0
  6. package/lib/module/blocks/detail-editor/compare-slider.js +117 -0
  7. package/lib/module/blocks/detail-editor/compare-slider.js.map +1 -0
  8. package/lib/module/blocks/detail-editor/detail-canvas.js +339 -0
  9. package/lib/module/blocks/detail-editor/detail-canvas.js.map +1 -0
  10. package/lib/module/blocks/detail-editor/detail-composer.js +254 -0
  11. package/lib/module/blocks/detail-editor/detail-composer.js.map +1 -0
  12. package/lib/module/blocks/detail-editor/detail-editor-template.js +102 -0
  13. package/lib/module/blocks/detail-editor/detail-editor-template.js.map +1 -0
  14. package/lib/module/blocks/detail-editor/detail-types.js +64 -0
  15. package/lib/module/blocks/detail-editor/detail-types.js.map +1 -0
  16. package/lib/module/blocks/detail-editor/draft-preview.js +39 -0
  17. package/lib/module/blocks/detail-editor/draft-preview.js.map +1 -0
  18. package/lib/module/blocks/detail-editor/draft-strip.js +97 -0
  19. package/lib/module/blocks/detail-editor/draft-strip.js.map +1 -0
  20. package/lib/module/blocks/detail-editor/editor-bar.js +96 -0
  21. package/lib/module/blocks/detail-editor/editor-bar.js.map +1 -0
  22. package/lib/module/blocks/detail-editor/focus-context.js +5 -0
  23. package/lib/module/blocks/detail-editor/focus-context.js.map +1 -0
  24. package/lib/module/blocks/detail-editor/font-picker.js +74 -0
  25. package/lib/module/blocks/detail-editor/font-picker.js.map +1 -0
  26. package/lib/module/blocks/detail-editor/index.js +16 -0
  27. package/lib/module/blocks/detail-editor/index.js.map +1 -0
  28. package/lib/module/blocks/detail-editor/layout-picker.js +173 -0
  29. package/lib/module/blocks/detail-editor/layout-picker.js.map +1 -0
  30. package/lib/module/blocks/detail-editor/photo-tray.js +144 -0
  31. package/lib/module/blocks/detail-editor/photo-tray.js.map +1 -0
  32. package/lib/module/blocks/detail-editor/structure-picker.js +75 -0
  33. package/lib/module/blocks/detail-editor/structure-picker.js.map +1 -0
  34. package/lib/module/blocks/detail-editor/tool-row.js +63 -0
  35. package/lib/module/blocks/detail-editor/tool-row.js.map +1 -0
  36. package/lib/module/blocks/index.js +3 -0
  37. package/lib/module/blocks/index.js.map +1 -1
  38. package/lib/module/blocks/slider-list/index.js +4 -0
  39. package/lib/module/blocks/slider-list/index.js.map +1 -0
  40. package/lib/module/blocks/slider-list/slider-list.js +45 -0
  41. package/lib/module/blocks/slider-list/slider-list.js.map +1 -0
  42. package/lib/module/blocks/task-tiles/task-tiles.js +1 -1
  43. package/lib/module/blocks/task-tiles/task-tiles.js.map +1 -1
  44. package/lib/module/charts/mini-bars.js +1 -1
  45. package/lib/module/charts/mini-bars.js.map +1 -1
  46. package/lib/module/components/button/button.js +10 -3
  47. package/lib/module/components/button/button.js.map +1 -1
  48. package/lib/module/components/floating-tab-bar/floating-tab-bar.js +103 -0
  49. package/lib/module/components/floating-tab-bar/floating-tab-bar.js.map +1 -0
  50. package/lib/module/components/floating-tab-bar/index.js +4 -0
  51. package/lib/module/components/floating-tab-bar/index.js.map +1 -0
  52. package/lib/module/components/list-row/list-row.js +9 -3
  53. package/lib/module/components/list-row/list-row.js.map +1 -1
  54. package/lib/module/components/section-tabs/index.js +4 -0
  55. package/lib/module/components/section-tabs/index.js.map +1 -0
  56. package/lib/module/components/section-tabs/section-tabs.js +73 -0
  57. package/lib/module/components/section-tabs/section-tabs.js.map +1 -0
  58. package/lib/module/components/slider/index.js +4 -0
  59. package/lib/module/components/slider/index.js.map +1 -0
  60. package/lib/module/components/slider/slider.js +151 -0
  61. package/lib/module/components/slider/slider.js.map +1 -0
  62. package/lib/module/index.js +3 -0
  63. package/lib/module/index.js.map +1 -1
  64. package/lib/module/internal/flush-row.js +5 -0
  65. package/lib/module/internal/flush-row.js.map +1 -0
  66. package/lib/module/internal/pressable-base.js +3 -2
  67. package/lib/module/internal/pressable-base.js.map +1 -1
  68. package/lib/module/internal/tab-icon-pairs.js +25 -0
  69. package/lib/module/internal/tab-icon-pairs.js.map +1 -0
  70. package/lib/module/sortable/block-strip.js +151 -0
  71. package/lib/module/sortable/block-strip.js.map +1 -0
  72. package/lib/module/sortable/index.js +1 -0
  73. package/lib/module/sortable/index.js.map +1 -1
  74. package/lib/module/templates/index.js +1 -0
  75. package/lib/module/templates/index.js.map +1 -1
  76. package/lib/module/templates/parts.js +42 -2
  77. package/lib/module/templates/parts.js.map +1 -1
  78. package/lib/module/templates/sheet-form-template.js +174 -0
  79. package/lib/module/templates/sheet-form-template.js.map +1 -0
  80. package/lib/module/theme/base.js +4 -4
  81. package/lib/typescript/src/blocks/cover-photos/cover-photos.d.ts +16 -0
  82. package/lib/typescript/src/blocks/cover-photos/cover-photos.d.ts.map +1 -0
  83. package/lib/typescript/src/blocks/cover-photos/index.d.ts +2 -0
  84. package/lib/typescript/src/blocks/cover-photos/index.d.ts.map +1 -0
  85. package/lib/typescript/src/blocks/detail-editor/compare-slider.d.ts +8 -0
  86. package/lib/typescript/src/blocks/detail-editor/compare-slider.d.ts.map +1 -0
  87. package/lib/typescript/src/blocks/detail-editor/detail-canvas.d.ts +13 -0
  88. package/lib/typescript/src/blocks/detail-editor/detail-canvas.d.ts.map +1 -0
  89. package/lib/typescript/src/blocks/detail-editor/detail-composer.d.ts +25 -0
  90. package/lib/typescript/src/blocks/detail-editor/detail-composer.d.ts.map +1 -0
  91. package/lib/typescript/src/blocks/detail-editor/detail-editor-template.d.ts +13 -0
  92. package/lib/typescript/src/blocks/detail-editor/detail-editor-template.d.ts.map +1 -0
  93. package/lib/typescript/src/blocks/detail-editor/detail-types.d.ts +55 -0
  94. package/lib/typescript/src/blocks/detail-editor/detail-types.d.ts.map +1 -0
  95. package/lib/typescript/src/blocks/detail-editor/draft-preview.d.ts +8 -0
  96. package/lib/typescript/src/blocks/detail-editor/draft-preview.d.ts.map +1 -0
  97. package/lib/typescript/src/blocks/detail-editor/draft-strip.d.ts +16 -0
  98. package/lib/typescript/src/blocks/detail-editor/draft-strip.d.ts.map +1 -0
  99. package/lib/typescript/src/blocks/detail-editor/editor-bar.d.ts +18 -0
  100. package/lib/typescript/src/blocks/detail-editor/editor-bar.d.ts.map +1 -0
  101. package/lib/typescript/src/blocks/detail-editor/focus-context.d.ts +6 -0
  102. package/lib/typescript/src/blocks/detail-editor/focus-context.d.ts.map +1 -0
  103. package/lib/typescript/src/blocks/detail-editor/font-picker.d.ts +8 -0
  104. package/lib/typescript/src/blocks/detail-editor/font-picker.d.ts.map +1 -0
  105. package/lib/typescript/src/blocks/detail-editor/index.d.ts +14 -0
  106. package/lib/typescript/src/blocks/detail-editor/index.d.ts.map +1 -0
  107. package/lib/typescript/src/blocks/detail-editor/layout-picker.d.ts +11 -0
  108. package/lib/typescript/src/blocks/detail-editor/layout-picker.d.ts.map +1 -0
  109. package/lib/typescript/src/blocks/detail-editor/photo-tray.d.ts +15 -0
  110. package/lib/typescript/src/blocks/detail-editor/photo-tray.d.ts.map +1 -0
  111. package/lib/typescript/src/blocks/detail-editor/structure-picker.d.ts +13 -0
  112. package/lib/typescript/src/blocks/detail-editor/structure-picker.d.ts.map +1 -0
  113. package/lib/typescript/src/blocks/detail-editor/tool-row.d.ts +13 -0
  114. package/lib/typescript/src/blocks/detail-editor/tool-row.d.ts.map +1 -0
  115. package/lib/typescript/src/blocks/index.d.ts +3 -0
  116. package/lib/typescript/src/blocks/index.d.ts.map +1 -1
  117. package/lib/typescript/src/blocks/slider-list/index.d.ts +2 -0
  118. package/lib/typescript/src/blocks/slider-list/index.d.ts.map +1 -0
  119. package/lib/typescript/src/blocks/slider-list/slider-list.d.ts +17 -0
  120. package/lib/typescript/src/blocks/slider-list/slider-list.d.ts.map +1 -0
  121. package/lib/typescript/src/components/button/button.d.ts.map +1 -1
  122. package/lib/typescript/src/components/floating-tab-bar/floating-tab-bar.d.ts +20 -0
  123. package/lib/typescript/src/components/floating-tab-bar/floating-tab-bar.d.ts.map +1 -0
  124. package/lib/typescript/src/components/floating-tab-bar/index.d.ts +2 -0
  125. package/lib/typescript/src/components/floating-tab-bar/index.d.ts.map +1 -0
  126. package/lib/typescript/src/components/list-row/list-row.d.ts.map +1 -1
  127. package/lib/typescript/src/components/section-tabs/index.d.ts +2 -0
  128. package/lib/typescript/src/components/section-tabs/index.d.ts.map +1 -0
  129. package/lib/typescript/src/components/section-tabs/section-tabs.d.ts +14 -0
  130. package/lib/typescript/src/components/section-tabs/section-tabs.d.ts.map +1 -0
  131. package/lib/typescript/src/components/slider/index.d.ts +2 -0
  132. package/lib/typescript/src/components/slider/index.d.ts.map +1 -0
  133. package/lib/typescript/src/components/slider/slider.d.ts +14 -0
  134. package/lib/typescript/src/components/slider/slider.d.ts.map +1 -0
  135. package/lib/typescript/src/index.d.ts +3 -0
  136. package/lib/typescript/src/index.d.ts.map +1 -1
  137. package/lib/typescript/src/internal/flush-row.d.ts +2 -0
  138. package/lib/typescript/src/internal/flush-row.d.ts.map +1 -0
  139. package/lib/typescript/src/internal/pressable-base.d.ts +2 -1
  140. package/lib/typescript/src/internal/pressable-base.d.ts.map +1 -1
  141. package/lib/typescript/src/internal/tab-icon-pairs.d.ts +23 -0
  142. package/lib/typescript/src/internal/tab-icon-pairs.d.ts.map +1 -0
  143. package/lib/typescript/src/sortable/block-strip.d.ts +14 -0
  144. package/lib/typescript/src/sortable/block-strip.d.ts.map +1 -0
  145. package/lib/typescript/src/sortable/index.d.ts +1 -0
  146. package/lib/typescript/src/sortable/index.d.ts.map +1 -1
  147. package/lib/typescript/src/templates/index.d.ts +2 -0
  148. package/lib/typescript/src/templates/index.d.ts.map +1 -1
  149. package/lib/typescript/src/templates/parts.d.ts +2 -1
  150. package/lib/typescript/src/templates/parts.d.ts.map +1 -1
  151. package/lib/typescript/src/templates/sheet-form-template.d.ts +31 -0
  152. package/lib/typescript/src/templates/sheet-form-template.d.ts.map +1 -0
  153. package/lib/typescript/src/theme/base.d.ts +4 -4
  154. package/package.json +1 -1
  155. package/src/blocks/cover-photos/cover-photos.tsx +176 -0
  156. package/src/blocks/cover-photos/index.ts +5 -0
  157. package/src/blocks/detail-editor/compare-slider.tsx +112 -0
  158. package/src/blocks/detail-editor/detail-canvas.tsx +369 -0
  159. package/src/blocks/detail-editor/detail-composer.tsx +261 -0
  160. package/src/blocks/detail-editor/detail-editor-template.tsx +109 -0
  161. package/src/blocks/detail-editor/detail-types.ts +113 -0
  162. package/src/blocks/detail-editor/draft-preview.tsx +34 -0
  163. package/src/blocks/detail-editor/draft-strip.tsx +102 -0
  164. package/src/blocks/detail-editor/editor-bar.tsx +116 -0
  165. package/src/blocks/detail-editor/focus-context.ts +7 -0
  166. package/src/blocks/detail-editor/font-picker.tsx +75 -0
  167. package/src/blocks/detail-editor/index.ts +57 -0
  168. package/src/blocks/detail-editor/layout-picker.tsx +158 -0
  169. package/src/blocks/detail-editor/photo-tray.tsx +140 -0
  170. package/src/blocks/detail-editor/structure-picker.tsx +75 -0
  171. package/src/blocks/detail-editor/tool-row.tsx +66 -0
  172. package/src/blocks/index.tsx +3 -0
  173. package/src/blocks/slider-list/index.ts +5 -0
  174. package/src/blocks/slider-list/slider-list.tsx +57 -0
  175. package/src/blocks/task-tiles/task-tiles.tsx +1 -1
  176. package/src/charts/mini-bars.tsx +1 -1
  177. package/src/components/button/button.tsx +10 -3
  178. package/src/components/floating-tab-bar/floating-tab-bar.tsx +121 -0
  179. package/src/components/floating-tab-bar/index.ts +7 -0
  180. package/src/components/list-row/list-row.tsx +7 -1
  181. package/src/components/section-tabs/index.ts +5 -0
  182. package/src/components/section-tabs/section-tabs.tsx +87 -0
  183. package/src/components/slider/index.ts +1 -0
  184. package/src/components/slider/slider.tsx +142 -0
  185. package/src/index.tsx +3 -0
  186. package/src/internal/flush-row.ts +3 -0
  187. package/src/internal/pressable-base.tsx +3 -1
  188. package/src/internal/tab-icon-pairs.ts +22 -0
  189. package/src/sortable/block-strip.tsx +168 -0
  190. package/src/sortable/index.ts +5 -0
  191. package/src/templates/index.ts +5 -0
  192. package/src/templates/parts.tsx +46 -1
  193. package/src/templates/sheet-form-template.tsx +190 -0
  194. package/src/theme/base.ts +4 -4
@@ -0,0 +1,116 @@
1
+ import { View } from 'react-native';
2
+ import { Button } from '../../components/button/button';
3
+ import {
4
+ CloseGlyph,
5
+ EyeGlyph,
6
+ MenuGlyph,
7
+ ReturnGlyph,
8
+ } from '../../internal/glyphs';
9
+ import { renderIcon, type IconSlot } from '../../internal/icon';
10
+ import { PressableBase } from '../../internal/pressable-base';
11
+ import { useTheme } from '../../theme/theme-provider';
12
+ import { makeStyles } from '../../utils/styles';
13
+
14
+ export type EditorBarProps = {
15
+ topInset?: number;
16
+ onClose: () => void;
17
+ onUndo?: () => void;
18
+ onRedo?: () => void;
19
+ onLayers?: () => void;
20
+ onPreview?: () => void;
21
+ layersOn?: boolean;
22
+ previewOn?: boolean;
23
+ action: {
24
+ label: string;
25
+ onPress: () => void;
26
+ disabled?: boolean;
27
+ loading?: boolean;
28
+ };
29
+ };
30
+
31
+ const useStyles = makeStyles((t) => ({
32
+ bar: {
33
+ flexDirection: 'row',
34
+ alignItems: 'center',
35
+ gap: t.space[2],
36
+ paddingHorizontal: t.space[3],
37
+ paddingBottom: t.space[2],
38
+ },
39
+ round: {
40
+ width: t.space[10],
41
+ height: t.space[10],
42
+ borderRadius: t.radius.full,
43
+ alignItems: 'center',
44
+ justifyContent: 'center',
45
+ },
46
+ group: {
47
+ flexDirection: 'row',
48
+ alignItems: 'center',
49
+ gap: t.space[1],
50
+ paddingHorizontal: t.space[1],
51
+ borderRadius: t.radius.full,
52
+ backgroundColor: t.colors.surface,
53
+ },
54
+ fill: { flex: 1 },
55
+ mirror: { transform: [{ scaleX: -1 }] },
56
+ on: { backgroundColor: t.colors.primaryTint },
57
+ }));
58
+
59
+ export function EditorBar({
60
+ topInset = 0,
61
+ onClose,
62
+ onUndo,
63
+ onRedo,
64
+ onLayers,
65
+ onPreview,
66
+ layersOn,
67
+ previewOn,
68
+ action,
69
+ }: EditorBarProps) {
70
+ const t = useTheme();
71
+ const s = useStyles();
72
+ const tool = (
73
+ key: string,
74
+ icon: IconSlot,
75
+ label: string,
76
+ onPress?: () => void,
77
+ on?: boolean,
78
+ mirror?: boolean
79
+ ) => (
80
+ <PressableBase
81
+ key={key}
82
+ onPress={onPress}
83
+ disabled={!onPress}
84
+ accessibilityLabel={label}
85
+ accessibilityState={{ disabled: !onPress, selected: !!on }}
86
+ style={[s.round, on && s.on, mirror && s.mirror]}
87
+ >
88
+ {renderIcon(icon, {
89
+ color: onPress ? t.colors.foreground : t.colors.input,
90
+ size: t.iconSize.md,
91
+ })}
92
+ </PressableBase>
93
+ );
94
+ return (
95
+ <View style={[s.bar, { paddingTop: topInset + t.space[2] }]}>
96
+ <View style={[s.round, { backgroundColor: t.colors.surface }]}>
97
+ {tool('close', CloseGlyph, '닫기', onClose)}
98
+ </View>
99
+ <View style={s.fill} />
100
+ <View style={s.group}>
101
+ {tool('undo', ReturnGlyph, '실행 취소', onUndo)}
102
+ {tool('redo', ReturnGlyph, '다시 실행', onRedo, false, true)}
103
+ {tool('layers', MenuGlyph, '레이어', onLayers, layersOn)}
104
+ {tool('preview', EyeGlyph, '미리보기', onPreview, previewOn)}
105
+ </View>
106
+ <Button
107
+ size="sm"
108
+ onPress={action.onPress}
109
+ disabled={action.disabled}
110
+ loading={action.loading}
111
+ >
112
+ {action.label}
113
+ </Button>
114
+ </View>
115
+ );
116
+ }
@@ -0,0 +1,7 @@
1
+ import { createContext } from 'react';
2
+
3
+ export type DetailFocusRect = { y: number; height: number };
4
+
5
+ export const DetailFocusContext = createContext<
6
+ ((rect: DetailFocusRect | null) => void) | null
7
+ >(null);
@@ -0,0 +1,75 @@
1
+ import { Text as RNText, View } from 'react-native';
2
+ import { Text } from '../../components/text/text';
3
+ import { PressableBase } from '../../internal/pressable-base';
4
+ import { useTheme } from '../../theme/theme-provider';
5
+ import { makeStyles } from '../../utils/styles';
6
+ import { DETAIL_FONT_FAMILY, type DetailFont } from './detail-types';
7
+
8
+ export type FontPickerProps = {
9
+ value: DetailFont;
10
+ onValueChange: (font: DetailFont) => void;
11
+ sample: string;
12
+ };
13
+
14
+ const NAMES: Record<DetailFont, string> = {
15
+ gothic: '고딕',
16
+ serif: '명조',
17
+ display: '굵은 제목',
18
+ hand: '손글씨',
19
+ };
20
+
21
+ const ORDER: DetailFont[] = ['gothic', 'serif', 'display', 'hand'];
22
+
23
+ const useStyles = makeStyles((t) => ({
24
+ list: { gap: t.space[1] },
25
+ row: {
26
+ flexDirection: 'row',
27
+ alignItems: 'center',
28
+ justifyContent: 'space-between',
29
+ minHeight: t.controlSize.sm,
30
+ paddingHorizontal: t.space[3],
31
+ borderRadius: t.radius.md,
32
+ },
33
+ on: { backgroundColor: t.colors.primaryTint },
34
+ sample: { flexShrink: 1 },
35
+ }));
36
+
37
+ export function FontPicker({ value, onValueChange, sample }: FontPickerProps) {
38
+ const t = useTheme();
39
+ const s = useStyles();
40
+ return (
41
+ <View style={s.list} accessibilityRole="radiogroup">
42
+ {ORDER.map((font) => {
43
+ const on = font === value;
44
+ return (
45
+ <PressableBase
46
+ key={font}
47
+ accessibilityRole="radio"
48
+ accessibilityState={{ selected: on }}
49
+ accessibilityLabel={NAMES[font]}
50
+ onPress={() => onValueChange(font)}
51
+ style={[s.row, on && s.on]}
52
+ >
53
+ <RNText
54
+ numberOfLines={1}
55
+ maxFontSizeMultiplier={t.maxFontScale}
56
+ style={[
57
+ s.sample,
58
+ {
59
+ fontFamily: DETAIL_FONT_FAMILY[font].regular,
60
+ fontSize: t.typography.bodyLg.fontSize,
61
+ color: t.colors.foreground,
62
+ },
63
+ ]}
64
+ >
65
+ {sample}
66
+ </RNText>
67
+ <Text variant="caption" tone="muted">
68
+ {NAMES[font]}
69
+ </Text>
70
+ </PressableBase>
71
+ );
72
+ })}
73
+ </View>
74
+ );
75
+ }
@@ -0,0 +1,57 @@
1
+ export {
2
+ DetailCanvas,
3
+ textStyleOf,
4
+ type DetailCanvasProps,
5
+ } from './detail-canvas';
6
+ export {
7
+ DetailComposer,
8
+ type ComposerAttachment,
9
+ type ComposerSource,
10
+ type DetailComposerProps,
11
+ } from './detail-composer';
12
+ export {
13
+ DetailEditorTemplate,
14
+ EditorPanel,
15
+ type DetailEditorTemplateProps,
16
+ } from './detail-editor-template';
17
+ export {
18
+ DETAIL_COLORS,
19
+ DETAIL_FONT_FAMILY,
20
+ DETAIL_LAYOUTS,
21
+ detailBlockSpace,
22
+ detailFontSize,
23
+ detailLineHeight,
24
+ detailTracking,
25
+ type DetailBlock,
26
+ type DetailDocValue,
27
+ type DetailEffect,
28
+ type DetailFont,
29
+ type DetailLayer,
30
+ type DetailLayout,
31
+ type DetailSelection,
32
+ type DetailTextStyle,
33
+ type DetailWeight,
34
+ } from './detail-types';
35
+ export {
36
+ DRAFT_THUMB_WIDTH,
37
+ DraftStrip,
38
+ type DraftStripItem,
39
+ type DraftStripProps,
40
+ } from './draft-strip';
41
+ export { EditorBar, type EditorBarProps } from './editor-bar';
42
+ export { FontPicker, type FontPickerProps } from './font-picker';
43
+ export { LayoutPicker, type LayoutPickerProps } from './layout-picker';
44
+ export { ToolRow, type ToolRowItem } from './tool-row';
45
+ export { CompareSlider, type CompareSliderProps } from './compare-slider';
46
+ export {
47
+ PhotoTray,
48
+ type PhotoTrayProps,
49
+ type TrayPhoto,
50
+ type TraySource,
51
+ } from './photo-tray';
52
+ export {
53
+ StructurePicker,
54
+ type StructureOption,
55
+ type StructurePickerProps,
56
+ } from './structure-picker';
57
+ export { DraftPreview, type DraftPreviewProps } from './draft-preview';
@@ -0,0 +1,158 @@
1
+ import { ScrollView, View } from 'react-native';
2
+ import { Text } from '../../components/text/text';
3
+ import { PressableBase } from '../../internal/pressable-base';
4
+ import { useTheme } from '../../theme/theme-provider';
5
+ import { makeStyles } from '../../utils/styles';
6
+ import { DETAIL_LAYOUTS, type DetailLayout } from './detail-types';
7
+
8
+ export type LayoutPickerProps = {
9
+ value: DetailLayout;
10
+ onValueChange: (layout: DetailLayout) => void;
11
+ labels?: Partial<Record<DetailLayout, string>>;
12
+ };
13
+
14
+ const LABELS: Record<DetailLayout, string> = {
15
+ image_top: '사진 위 · 글 아래',
16
+ text_top: '글 위 · 사진 아래',
17
+ side: '나란히',
18
+ image: '꽉 찬 사진',
19
+ two_images: '사진 두 장',
20
+ card: '카드',
21
+ text: '글만',
22
+ };
23
+
24
+ const useStyles = makeStyles((t) => ({
25
+ row: { gap: t.space[2], paddingHorizontal: t.space[3] },
26
+ item: { width: t.space[16] + t.space[6], gap: t.space[1] },
27
+ frame: {
28
+ height: t.space[16] + t.space[12],
29
+ overflow: 'hidden',
30
+ borderRadius: t.radius.md,
31
+ borderWidth: 1,
32
+ borderColor: t.colors.border,
33
+ backgroundColor: t.colors.muted,
34
+ padding: t.space[1],
35
+ gap: t.space[1],
36
+ },
37
+ on: { borderWidth: 2, borderColor: t.colors.primary },
38
+ photo: {
39
+ flex: 1,
40
+ borderRadius: t.radius.sm,
41
+ backgroundColor: t.colors.input,
42
+ },
43
+ lines: { gap: t.space[1], padding: t.space[1] },
44
+ line: { height: t.space[1], borderRadius: t.radius.full },
45
+ split: { flex: 1, flexDirection: 'row', gap: t.space[1] },
46
+ half: { flex: 1, justifyContent: 'center' },
47
+ long: { width: '80%' },
48
+ short: { width: '50%' },
49
+ card: {
50
+ flex: 1,
51
+ borderRadius: t.radius.sm,
52
+ backgroundColor: t.colors.surface,
53
+ padding: t.space[1],
54
+ gap: t.space[1],
55
+ },
56
+ }));
57
+
58
+ export function Diagram({ layout }: { layout: DetailLayout }) {
59
+ const t = useTheme();
60
+ const s = useStyles();
61
+ const photo = <View style={s.photo} />;
62
+ const lines = (
63
+ <View style={s.lines}>
64
+ <View
65
+ style={[s.line, s.long, { backgroundColor: t.colors.foreground }]}
66
+ />
67
+ <View
68
+ style={[s.line, s.short, { backgroundColor: t.colors.mutedForeground }]}
69
+ />
70
+ </View>
71
+ );
72
+ switch (layout) {
73
+ case 'image_top':
74
+ return (
75
+ <>
76
+ {photo}
77
+ {lines}
78
+ </>
79
+ );
80
+ case 'text_top':
81
+ return (
82
+ <>
83
+ {lines}
84
+ {photo}
85
+ </>
86
+ );
87
+ case 'side':
88
+ return (
89
+ <View style={s.split}>
90
+ {photo}
91
+ <View style={s.half}>{lines}</View>
92
+ </View>
93
+ );
94
+ case 'two_images':
95
+ return (
96
+ <>
97
+ <View style={s.split}>
98
+ {photo}
99
+ {photo}
100
+ </View>
101
+ {lines}
102
+ </>
103
+ );
104
+ case 'card':
105
+ return (
106
+ <View style={s.card}>
107
+ {photo}
108
+ {lines}
109
+ </View>
110
+ );
111
+ case 'text':
112
+ return <View style={s.half}>{lines}</View>;
113
+ default:
114
+ return photo;
115
+ }
116
+ }
117
+
118
+ export function LayoutPicker({
119
+ value,
120
+ onValueChange,
121
+ labels,
122
+ }: LayoutPickerProps) {
123
+ const s = useStyles();
124
+ return (
125
+ <ScrollView
126
+ horizontal
127
+ showsHorizontalScrollIndicator={false}
128
+ contentContainerStyle={s.row}
129
+ accessibilityRole="radiogroup"
130
+ >
131
+ {DETAIL_LAYOUTS.map((layout) => {
132
+ const on = layout === value;
133
+ const label = labels?.[layout] ?? LABELS[layout];
134
+ return (
135
+ <PressableBase
136
+ key={layout}
137
+ accessibilityRole="radio"
138
+ accessibilityState={{ selected: on }}
139
+ accessibilityLabel={label}
140
+ onPress={() => onValueChange(layout)}
141
+ style={s.item}
142
+ >
143
+ <View style={[s.frame, on && s.on]}>
144
+ <Diagram layout={layout} />
145
+ </View>
146
+ <Text
147
+ variant="caption"
148
+ tone={on ? 'default' : 'muted'}
149
+ numberOfLines={1}
150
+ >
151
+ {label}
152
+ </Text>
153
+ </PressableBase>
154
+ );
155
+ })}
156
+ </ScrollView>
157
+ );
158
+ }
@@ -0,0 +1,140 @@
1
+ import { Image, View } from 'react-native';
2
+ import { Text } from '../../components/text/text';
3
+ import {
4
+ CameraGlyph,
5
+ CloseGlyph,
6
+ ImageGlyph,
7
+ ScanGlyph,
8
+ } from '../../internal/glyphs';
9
+ import { renderIcon, type IconSlot } from '../../internal/icon';
10
+ import { PressableBase } from '../../internal/pressable-base';
11
+ import { useTheme } from '../../theme/theme-provider';
12
+ import { makeStyles } from '../../utils/styles';
13
+
14
+ export type TrayPhoto = { key: string; uri: string; reference?: boolean };
15
+ export type TraySource = 'camera' | 'library' | 'capture';
16
+
17
+ export type PhotoTrayProps = {
18
+ photos: readonly TrayPhoto[];
19
+ onRemove: (key: string) => void;
20
+ onAdd: (source: TraySource) => void;
21
+ mainLabel?: string;
22
+ referenceLabel?: string;
23
+ };
24
+
25
+ const ADD: { key: TraySource; label: string; icon: IconSlot }[] = [
26
+ { key: 'camera', label: '촬영', icon: CameraGlyph },
27
+ { key: 'library', label: '사진', icon: ImageGlyph },
28
+ { key: 'capture', label: '참고 캡처', icon: ScanGlyph },
29
+ ];
30
+
31
+ const useStyles = makeStyles((t) => ({
32
+ root: { gap: t.space[3], paddingHorizontal: t.layout.screenX },
33
+ grid: { flexDirection: 'row', flexWrap: 'wrap', gap: t.space[2] },
34
+ tile: { width: '31.5%' },
35
+ photo: {
36
+ width: '100%',
37
+ height: undefined,
38
+ aspectRatio: 3 / 4,
39
+ borderRadius: t.radius.lg,
40
+ backgroundColor: t.colors.muted,
41
+ },
42
+ reference: { borderWidth: 3, borderColor: t.colors.primary },
43
+ remove: {
44
+ position: 'absolute',
45
+ right: t.space[1],
46
+ top: t.space[1],
47
+ width: t.space[6],
48
+ height: t.space[6],
49
+ borderRadius: t.radius.full,
50
+ alignItems: 'center',
51
+ justifyContent: 'center',
52
+ backgroundColor: t.colors.foreground,
53
+ },
54
+ badge: {
55
+ position: 'absolute',
56
+ left: t.space[1],
57
+ bottom: t.space[1],
58
+ paddingHorizontal: t.space[2],
59
+ borderRadius: t.radius.full,
60
+ backgroundColor: t.colors.foreground,
61
+ },
62
+ adds: { flexDirection: 'row', gap: t.space[2] },
63
+ add: {
64
+ flex: 1,
65
+ height: t.space[16],
66
+ borderRadius: t.radius.lg,
67
+ borderWidth: 1,
68
+ borderStyle: 'dashed',
69
+ borderColor: t.colors.input,
70
+ alignItems: 'center',
71
+ justifyContent: 'center',
72
+ gap: t.space[1],
73
+ },
74
+ }));
75
+
76
+ export function PhotoTray({
77
+ photos,
78
+ onRemove,
79
+ onAdd,
80
+ mainLabel = '대표',
81
+ referenceLabel = '참고',
82
+ }: PhotoTrayProps) {
83
+ const t = useTheme();
84
+ const s = useStyles();
85
+ const main = photos.find((p) => !p.reference)?.key;
86
+ return (
87
+ <View style={s.root}>
88
+ {photos.length ? (
89
+ <View style={s.grid}>
90
+ {photos.map((p) => (
91
+ <View key={p.key} style={s.tile}>
92
+ <Image
93
+ source={{ uri: p.uri }}
94
+ resizeMode="cover"
95
+ style={[s.photo, p.reference && s.reference]}
96
+ />
97
+ <PressableBase
98
+ onPress={() => onRemove(p.key)}
99
+ accessibilityLabel="빼기"
100
+ touchHeight={t.space[6]}
101
+ style={s.remove}
102
+ >
103
+ <CloseGlyph color={t.colors.surface} size={t.iconSize.sm} />
104
+ </PressableBase>
105
+ {p.key === main || p.reference ? (
106
+ <View style={s.badge}>
107
+ <Text
108
+ variant="caption"
109
+ weight="bold"
110
+ style={{ color: t.colors.surface }}
111
+ >
112
+ {p.reference ? referenceLabel : mainLabel}
113
+ </Text>
114
+ </View>
115
+ ) : null}
116
+ </View>
117
+ ))}
118
+ </View>
119
+ ) : null}
120
+ <View style={s.adds}>
121
+ {ADD.map((a) => (
122
+ <PressableBase
123
+ key={a.key}
124
+ onPress={() => onAdd(a.key)}
125
+ accessibilityLabel={a.label}
126
+ style={s.add}
127
+ >
128
+ {renderIcon(a.icon, {
129
+ color: t.colors.mutedForeground,
130
+ size: t.iconSize.md,
131
+ })}
132
+ <Text variant="caption" tone="muted">
133
+ {a.label}
134
+ </Text>
135
+ </PressableBase>
136
+ ))}
137
+ </View>
138
+ </View>
139
+ );
140
+ }
@@ -0,0 +1,75 @@
1
+ import { View } from 'react-native';
2
+ import { Text } from '../../components/text/text';
3
+ import { PressableBase } from '../../internal/pressable-base';
4
+ import { makeStyles } from '../../utils/styles';
5
+ import type { DetailLayout } from './detail-types';
6
+ import { Diagram } from './layout-picker';
7
+
8
+ export type StructureOption<T extends string> = {
9
+ value: T;
10
+ label: string;
11
+ layouts: readonly DetailLayout[];
12
+ };
13
+
14
+ export type StructurePickerProps<T extends string> = {
15
+ items: readonly StructureOption<T>[];
16
+ value: T;
17
+ onValueChange: (value: T) => void;
18
+ };
19
+
20
+ const useStyles = makeStyles((t) => ({
21
+ row: { flexDirection: 'row', gap: t.space[3] },
22
+ item: { flex: 1, gap: t.space[2], alignItems: 'center' },
23
+ page: {
24
+ alignSelf: 'stretch',
25
+ aspectRatio: 0.7,
26
+ padding: t.space[2],
27
+ gap: t.space[1],
28
+ borderRadius: t.radius.md,
29
+ borderWidth: 1,
30
+ borderColor: t.colors.border,
31
+ backgroundColor: t.colors.muted,
32
+ },
33
+ on: { borderWidth: 2, borderColor: t.colors.primary },
34
+ part: { flex: 1, gap: t.space[1] },
35
+ }));
36
+
37
+ export function StructurePicker<T extends string>({
38
+ items,
39
+ value,
40
+ onValueChange,
41
+ }: StructurePickerProps<T>) {
42
+ const s = useStyles();
43
+ return (
44
+ <View accessibilityRole="radiogroup" style={s.row}>
45
+ {items.map((item) => {
46
+ const on = item.value === value;
47
+ return (
48
+ <PressableBase
49
+ key={item.value}
50
+ accessibilityRole="radio"
51
+ accessibilityState={{ selected: on }}
52
+ accessibilityLabel={item.label}
53
+ onPress={() => onValueChange(item.value)}
54
+ style={s.item}
55
+ >
56
+ <View style={[s.page, on && s.on]}>
57
+ {item.layouts.map((layout, index) => (
58
+ <View key={`${layout}-${index}`} style={s.part}>
59
+ <Diagram layout={layout} />
60
+ </View>
61
+ ))}
62
+ </View>
63
+ <Text
64
+ variant="caption"
65
+ weight={on ? 'bold' : undefined}
66
+ tone={on ? 'default' : 'muted'}
67
+ >
68
+ {item.label}
69
+ </Text>
70
+ </PressableBase>
71
+ );
72
+ })}
73
+ </View>
74
+ );
75
+ }
@@ -0,0 +1,66 @@
1
+ import { View } from 'react-native';
2
+ import { Text } from '../../components/text/text';
3
+ import { renderIcon, type IconSlot } from '../../internal/icon';
4
+ import { PressableBase } from '../../internal/pressable-base';
5
+ import { useTheme } from '../../theme/theme-provider';
6
+ import { makeStyles } from '../../utils/styles';
7
+
8
+ export type ToolRowItem = {
9
+ key: string;
10
+ icon: IconSlot;
11
+ label: string;
12
+ onPress: () => void;
13
+ active?: boolean;
14
+ disabled?: boolean;
15
+ };
16
+
17
+ const useStyles = makeStyles((t) => ({
18
+ row: {
19
+ flexDirection: 'row',
20
+ justifyContent: 'space-around',
21
+ paddingHorizontal: t.space[1],
22
+ },
23
+ item: { alignItems: 'center', gap: t.space[1], flex: 1 },
24
+ round: {
25
+ width: t.controlSize.sm,
26
+ height: t.controlSize.sm,
27
+ borderRadius: t.radius.full,
28
+ alignItems: 'center',
29
+ justifyContent: 'center',
30
+ backgroundColor: t.colors.surface,
31
+ },
32
+ on: { backgroundColor: t.colors.primaryTint },
33
+ }));
34
+
35
+ export function ToolRow({ items }: { items: readonly ToolRowItem[] }) {
36
+ const t = useTheme();
37
+ const s = useStyles();
38
+ return (
39
+ <View style={s.row}>
40
+ {items.map((item) => (
41
+ <PressableBase
42
+ key={item.key}
43
+ onPress={item.onPress}
44
+ disabled={item.disabled}
45
+ accessibilityLabel={item.label}
46
+ accessibilityState={{ selected: !!item.active }}
47
+ style={s.item}
48
+ >
49
+ <View style={[s.round, item.active && s.on]}>
50
+ {renderIcon(item.icon, {
51
+ color: item.active ? t.colors.primary : t.colors.foreground,
52
+ size: t.iconSize.md,
53
+ })}
54
+ </View>
55
+ <Text
56
+ variant="caption"
57
+ tone={item.active ? 'default' : 'muted'}
58
+ numberOfLines={1}
59
+ >
60
+ {item.label}
61
+ </Text>
62
+ </PressableBase>
63
+ ))}
64
+ </View>
65
+ );
66
+ }