@ezpg/app-ui 0.17.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 (86) hide show
  1. package/CHANGELOG.md +9 -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/draft-preview.js +39 -0
  7. package/lib/module/blocks/detail-editor/draft-preview.js.map +1 -0
  8. package/lib/module/blocks/detail-editor/index.js +2 -0
  9. package/lib/module/blocks/detail-editor/index.js.map +1 -1
  10. package/lib/module/blocks/detail-editor/layout-picker.js +1 -1
  11. package/lib/module/blocks/detail-editor/layout-picker.js.map +1 -1
  12. package/lib/module/blocks/detail-editor/structure-picker.js +75 -0
  13. package/lib/module/blocks/detail-editor/structure-picker.js.map +1 -0
  14. package/lib/module/blocks/index.js +2 -0
  15. package/lib/module/blocks/index.js.map +1 -1
  16. package/lib/module/blocks/slider-list/index.js +4 -0
  17. package/lib/module/blocks/slider-list/index.js.map +1 -0
  18. package/lib/module/blocks/slider-list/slider-list.js +45 -0
  19. package/lib/module/blocks/slider-list/slider-list.js.map +1 -0
  20. package/lib/module/components/list-row/list-row.js +8 -2
  21. package/lib/module/components/list-row/list-row.js.map +1 -1
  22. package/lib/module/components/section-tabs/index.js +4 -0
  23. package/lib/module/components/section-tabs/index.js.map +1 -0
  24. package/lib/module/components/section-tabs/section-tabs.js +73 -0
  25. package/lib/module/components/section-tabs/section-tabs.js.map +1 -0
  26. package/lib/module/index.js +1 -0
  27. package/lib/module/index.js.map +1 -1
  28. package/lib/module/internal/flush-row.js +5 -0
  29. package/lib/module/internal/flush-row.js.map +1 -0
  30. package/lib/module/templates/index.js +1 -0
  31. package/lib/module/templates/index.js.map +1 -1
  32. package/lib/module/templates/parts.js +41 -1
  33. package/lib/module/templates/parts.js.map +1 -1
  34. package/lib/module/templates/sheet-form-template.js +174 -0
  35. package/lib/module/templates/sheet-form-template.js.map +1 -0
  36. package/lib/typescript/src/blocks/cover-photos/cover-photos.d.ts +16 -0
  37. package/lib/typescript/src/blocks/cover-photos/cover-photos.d.ts.map +1 -0
  38. package/lib/typescript/src/blocks/cover-photos/index.d.ts +2 -0
  39. package/lib/typescript/src/blocks/cover-photos/index.d.ts.map +1 -0
  40. package/lib/typescript/src/blocks/detail-editor/draft-preview.d.ts +8 -0
  41. package/lib/typescript/src/blocks/detail-editor/draft-preview.d.ts.map +1 -0
  42. package/lib/typescript/src/blocks/detail-editor/index.d.ts +2 -0
  43. package/lib/typescript/src/blocks/detail-editor/index.d.ts.map +1 -1
  44. package/lib/typescript/src/blocks/detail-editor/layout-picker.d.ts +3 -0
  45. package/lib/typescript/src/blocks/detail-editor/layout-picker.d.ts.map +1 -1
  46. package/lib/typescript/src/blocks/detail-editor/structure-picker.d.ts +13 -0
  47. package/lib/typescript/src/blocks/detail-editor/structure-picker.d.ts.map +1 -0
  48. package/lib/typescript/src/blocks/index.d.ts +2 -0
  49. package/lib/typescript/src/blocks/index.d.ts.map +1 -1
  50. package/lib/typescript/src/blocks/slider-list/index.d.ts +2 -0
  51. package/lib/typescript/src/blocks/slider-list/index.d.ts.map +1 -0
  52. package/lib/typescript/src/blocks/slider-list/slider-list.d.ts +17 -0
  53. package/lib/typescript/src/blocks/slider-list/slider-list.d.ts.map +1 -0
  54. package/lib/typescript/src/components/list-row/list-row.d.ts.map +1 -1
  55. package/lib/typescript/src/components/section-tabs/index.d.ts +2 -0
  56. package/lib/typescript/src/components/section-tabs/index.d.ts.map +1 -0
  57. package/lib/typescript/src/components/section-tabs/section-tabs.d.ts +14 -0
  58. package/lib/typescript/src/components/section-tabs/section-tabs.d.ts.map +1 -0
  59. package/lib/typescript/src/index.d.ts +1 -0
  60. package/lib/typescript/src/index.d.ts.map +1 -1
  61. package/lib/typescript/src/internal/flush-row.d.ts +2 -0
  62. package/lib/typescript/src/internal/flush-row.d.ts.map +1 -0
  63. package/lib/typescript/src/templates/index.d.ts +2 -0
  64. package/lib/typescript/src/templates/index.d.ts.map +1 -1
  65. package/lib/typescript/src/templates/parts.d.ts +2 -1
  66. package/lib/typescript/src/templates/parts.d.ts.map +1 -1
  67. package/lib/typescript/src/templates/sheet-form-template.d.ts +31 -0
  68. package/lib/typescript/src/templates/sheet-form-template.d.ts.map +1 -0
  69. package/package.json +1 -1
  70. package/src/blocks/cover-photos/cover-photos.tsx +176 -0
  71. package/src/blocks/cover-photos/index.ts +5 -0
  72. package/src/blocks/detail-editor/draft-preview.tsx +34 -0
  73. package/src/blocks/detail-editor/index.ts +6 -0
  74. package/src/blocks/detail-editor/layout-picker.tsx +1 -1
  75. package/src/blocks/detail-editor/structure-picker.tsx +75 -0
  76. package/src/blocks/index.tsx +2 -0
  77. package/src/blocks/slider-list/index.ts +5 -0
  78. package/src/blocks/slider-list/slider-list.tsx +57 -0
  79. package/src/components/list-row/list-row.tsx +6 -0
  80. package/src/components/section-tabs/index.ts +5 -0
  81. package/src/components/section-tabs/section-tabs.tsx +87 -0
  82. package/src/index.tsx +1 -0
  83. package/src/internal/flush-row.ts +3 -0
  84. package/src/templates/index.ts +5 -0
  85. package/src/templates/parts.tsx +45 -0
  86. package/src/templates/sheet-form-template.tsx +190 -0
@@ -62,19 +62,64 @@ const useStyles = makeStyles((t) => ({
62
62
  paddingVertical: t.space[3],
63
63
  },
64
64
  cardLine: { height: 1, backgroundColor: t.colors.muted },
65
+ split: {
66
+ flexDirection: 'row',
67
+ backgroundColor: t.colors.surface,
68
+ borderTopWidth: 1,
69
+ borderTopColor: t.colors.border,
70
+ },
71
+ side: { flex: 1 },
72
+ main: { flex: 2 },
65
73
  }));
66
74
 
67
75
  export function BottomBar({
68
76
  primaryAction,
69
77
  secondaryAction,
70
78
  bottomInset = 0,
79
+ split = false,
71
80
  }: {
72
81
  primaryAction: TemplateAction;
73
82
  secondaryAction?: TemplateAction;
74
83
  bottomInset?: number;
84
+ split?: boolean;
75
85
  }) {
76
86
  const t = useTheme();
77
87
  const s = useStyles();
88
+ if (split) {
89
+ return (
90
+ <View
91
+ style={[
92
+ s.bar,
93
+ s.split,
94
+ { paddingBottom: t.layout.footerBottom + bottomInset },
95
+ ]}
96
+ >
97
+ {secondaryAction ? (
98
+ <View style={s.side}>
99
+ <Button
100
+ size="lg"
101
+ variant="secondary"
102
+ onPress={secondaryAction.onPress}
103
+ disabled={secondaryAction.disabled}
104
+ loading={secondaryAction.loading}
105
+ >
106
+ {secondaryAction.label}
107
+ </Button>
108
+ </View>
109
+ ) : null}
110
+ <View style={s.main}>
111
+ <Button
112
+ size="lg"
113
+ onPress={primaryAction.onPress}
114
+ disabled={primaryAction.disabled}
115
+ loading={primaryAction.loading}
116
+ >
117
+ {primaryAction.label}
118
+ </Button>
119
+ </View>
120
+ </View>
121
+ );
122
+ }
78
123
  return (
79
124
  <View
80
125
  style={[s.bar, { paddingBottom: t.layout.footerBottom + bottomInset }]}
@@ -0,0 +1,190 @@
1
+ import type { ComponentRef, ReactNode, Ref } from 'react';
2
+ import {
3
+ KeyboardAvoidingView,
4
+ ScrollView,
5
+ View,
6
+ type LayoutChangeEvent,
7
+ } from 'react-native';
8
+ import { Text } from '../components/text/text';
9
+ import { ChevronGlyph } from '../internal/glyphs';
10
+ import { PressableBase } from '../internal/pressable-base';
11
+ import { useTheme } from '../theme/theme-provider';
12
+ import { makeStyles } from '../utils/styles';
13
+ import { FlushRowContext } from '../internal/flush-row';
14
+ import { BottomBar, type TemplateAction } from './parts';
15
+
16
+ export type SheetFormTemplateProps = {
17
+ title: string;
18
+ onBack?: () => void;
19
+ backLabel?: string;
20
+ action?: { label: string; onPress: () => void; disabled?: boolean };
21
+ tabs?: ReactNode;
22
+ primaryAction: TemplateAction;
23
+ secondaryAction?: TemplateAction;
24
+ topInset?: number;
25
+ bottomInset?: number;
26
+ scrollRef?: Ref<ComponentRef<typeof ScrollView>>;
27
+ onScrollY?: (y: number) => void;
28
+ children: ReactNode;
29
+ };
30
+
31
+ export type SheetBlockProps = {
32
+ title: string;
33
+ aside?: ReactNode;
34
+ lead?: ReactNode;
35
+ onLayout?: (event: LayoutChangeEvent) => void;
36
+ children: ReactNode;
37
+ };
38
+
39
+ const useStyles = makeStyles((t) => ({
40
+ root: { flex: 1, backgroundColor: t.colors.background },
41
+ header: {
42
+ height: t.headerHeight,
43
+ flexDirection: 'row',
44
+ alignItems: 'center',
45
+ paddingHorizontal: t.space[1],
46
+ backgroundColor: t.colors.surface,
47
+ },
48
+ side: {
49
+ minWidth: t.minTouchSize * 2,
50
+ height: t.minTouchSize,
51
+ justifyContent: 'center',
52
+ },
53
+ end: { alignItems: 'flex-end', paddingHorizontal: t.space[3] },
54
+ back: {
55
+ width: t.minTouchSize,
56
+ height: t.minTouchSize,
57
+ alignItems: 'center',
58
+ justifyContent: 'center',
59
+ transform: [{ scaleX: -1 }],
60
+ },
61
+ title: {
62
+ flex: 1,
63
+ textAlign: 'center',
64
+ fontSize: t.typography.title.fontSize,
65
+ lineHeight: t.typography.title.lineHeight,
66
+ },
67
+ body: { padding: t.space[3], gap: t.space[3] },
68
+ block: {
69
+ padding: t.space[4],
70
+ gap: t.space[3],
71
+ borderRadius: t.radius.lg,
72
+ backgroundColor: t.colors.surface,
73
+ },
74
+ head: {
75
+ flexDirection: 'row',
76
+ alignItems: 'center',
77
+ justifyContent: 'space-between',
78
+ gap: t.space[2],
79
+ },
80
+ lead: { flexDirection: 'row', alignItems: 'center', gap: t.space[1] },
81
+ blockTitle: {
82
+ fontSize: t.typography.title.fontSize,
83
+ lineHeight: t.typography.title.lineHeight,
84
+ },
85
+ }));
86
+
87
+ export function SheetBlock({
88
+ title,
89
+ aside,
90
+ lead,
91
+ onLayout,
92
+ children,
93
+ }: SheetBlockProps) {
94
+ const s = useStyles();
95
+ return (
96
+ <View onLayout={onLayout} style={s.block}>
97
+ <View style={s.head}>
98
+ <View style={s.lead}>
99
+ {lead}
100
+ <Text weight="bold" accessibilityRole="header" style={s.blockTitle}>
101
+ {title}
102
+ </Text>
103
+ </View>
104
+ {aside}
105
+ </View>
106
+ <FlushRowContext.Provider value>{children}</FlushRowContext.Provider>
107
+ </View>
108
+ );
109
+ }
110
+
111
+ export function SheetFormTemplate({
112
+ title,
113
+ onBack,
114
+ backLabel = '뒤로',
115
+ action,
116
+ tabs,
117
+ primaryAction,
118
+ secondaryAction,
119
+ topInset = 0,
120
+ bottomInset = 0,
121
+ scrollRef,
122
+ onScrollY,
123
+ children,
124
+ }: SheetFormTemplateProps) {
125
+ const t = useTheme();
126
+ const s = useStyles();
127
+ return (
128
+ <KeyboardAvoidingView behavior="padding" style={s.root}>
129
+ <View style={{ paddingTop: topInset, backgroundColor: t.colors.surface }}>
130
+ <View style={s.header}>
131
+ <View style={s.side}>
132
+ {onBack ? (
133
+ <PressableBase
134
+ accessibilityLabel={backLabel}
135
+ onPress={onBack}
136
+ style={s.back}
137
+ >
138
+ <ChevronGlyph color={t.colors.foreground} size={24} />
139
+ </PressableBase>
140
+ ) : null}
141
+ </View>
142
+ <Text
143
+ weight="bold"
144
+ numberOfLines={1}
145
+ accessibilityRole="header"
146
+ style={s.title}
147
+ >
148
+ {title}
149
+ </Text>
150
+ <View style={[s.side, s.end]}>
151
+ {action ? (
152
+ <PressableBase
153
+ accessibilityRole="button"
154
+ disabled={action.disabled}
155
+ onPress={action.onPress}
156
+ >
157
+ <Text
158
+ weight="medium"
159
+ tone={action.disabled ? 'muted' : undefined}
160
+ >
161
+ {action.label}
162
+ </Text>
163
+ </PressableBase>
164
+ ) : null}
165
+ </View>
166
+ </View>
167
+ </View>
168
+ {tabs}
169
+ <ScrollView
170
+ ref={scrollRef}
171
+ contentContainerStyle={s.body}
172
+ keyboardShouldPersistTaps="handled"
173
+ scrollEventThrottle={32}
174
+ onScroll={
175
+ onScrollY
176
+ ? (event) => onScrollY(event.nativeEvent.contentOffset.y)
177
+ : undefined
178
+ }
179
+ >
180
+ {children}
181
+ </ScrollView>
182
+ <BottomBar
183
+ split
184
+ primaryAction={primaryAction}
185
+ secondaryAction={secondaryAction}
186
+ bottomInset={bottomInset}
187
+ />
188
+ </KeyboardAvoidingView>
189
+ );
190
+ }