@ezpg/app-ui 0.12.1 → 0.13.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 (117) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/lib/module/blocks/bulk-ship-list/bulk-ship-list.js +33 -149
  3. package/lib/module/blocks/bulk-ship-list/bulk-ship-list.js.map +1 -1
  4. package/lib/module/blocks/index.js +4 -0
  5. package/lib/module/blocks/index.js.map +1 -1
  6. package/lib/module/blocks/photo-grid/index.js +4 -0
  7. package/lib/module/blocks/photo-grid/index.js.map +1 -0
  8. package/lib/module/blocks/photo-grid/photo-grid.js +99 -0
  9. package/lib/module/blocks/photo-grid/photo-grid.js.map +1 -0
  10. package/lib/module/blocks/request-card/index.js +4 -0
  11. package/lib/module/blocks/request-card/index.js.map +1 -0
  12. package/lib/module/blocks/request-card/request-card.js +96 -0
  13. package/lib/module/blocks/request-card/request-card.js.map +1 -0
  14. package/lib/module/blocks/scan-modal/index.js +4 -0
  15. package/lib/module/blocks/scan-modal/index.js.map +1 -0
  16. package/lib/module/blocks/scan-modal/scan-modal.js +67 -0
  17. package/lib/module/blocks/scan-modal/scan-modal.js.map +1 -0
  18. package/lib/module/blocks/summary-cards/index.js +4 -0
  19. package/lib/module/blocks/summary-cards/index.js.map +1 -0
  20. package/lib/module/blocks/summary-cards/summary-cards.js +468 -0
  21. package/lib/module/blocks/summary-cards/summary-cards.js.map +1 -0
  22. package/lib/module/components/dialog/dialog.js +23 -5
  23. package/lib/module/components/dialog/dialog.js.map +1 -1
  24. package/lib/module/components/field/field.js +12 -1
  25. package/lib/module/components/field/field.js.map +1 -1
  26. package/lib/module/components/list-row/list-row.js +45 -2
  27. package/lib/module/components/list-row/list-row.js.map +1 -1
  28. package/lib/module/components/progress-bar/progress-bar.js +2 -1
  29. package/lib/module/components/progress-bar/progress-bar.js.map +1 -1
  30. package/lib/module/components/status-badge/status-badge.js +1 -0
  31. package/lib/module/components/status-badge/status-badge.js.map +1 -1
  32. package/lib/module/components/stepper/index.js +4 -0
  33. package/lib/module/components/stepper/index.js.map +1 -0
  34. package/lib/module/components/stepper/stepper.js +93 -0
  35. package/lib/module/components/stepper/stepper.js.map +1 -0
  36. package/lib/module/index.js +2 -1
  37. package/lib/module/index.js.map +1 -1
  38. package/lib/module/internal/glyphs.js +44 -0
  39. package/lib/module/internal/glyphs.js.map +1 -1
  40. package/lib/module/templates/index.js +2 -0
  41. package/lib/module/templates/index.js.map +1 -1
  42. package/lib/module/templates/parts.js +11 -0
  43. package/lib/module/templates/parts.js.map +1 -1
  44. package/lib/module/templates/preview-template.js +77 -0
  45. package/lib/module/templates/preview-template.js.map +1 -0
  46. package/lib/module/templates/selection-template.js +24 -0
  47. package/lib/module/templates/selection-template.js.map +1 -0
  48. package/lib/typescript/src/blocks/bulk-ship-list/bulk-ship-list.d.ts +0 -1
  49. package/lib/typescript/src/blocks/bulk-ship-list/bulk-ship-list.d.ts.map +1 -1
  50. package/lib/typescript/src/blocks/index.d.ts +4 -0
  51. package/lib/typescript/src/blocks/index.d.ts.map +1 -1
  52. package/lib/typescript/src/blocks/photo-grid/index.d.ts +2 -0
  53. package/lib/typescript/src/blocks/photo-grid/index.d.ts.map +1 -0
  54. package/lib/typescript/src/blocks/photo-grid/photo-grid.d.ts +14 -0
  55. package/lib/typescript/src/blocks/photo-grid/photo-grid.d.ts.map +1 -0
  56. package/lib/typescript/src/blocks/request-card/index.d.ts +2 -0
  57. package/lib/typescript/src/blocks/request-card/index.d.ts.map +1 -0
  58. package/lib/typescript/src/blocks/request-card/request-card.d.ts +15 -0
  59. package/lib/typescript/src/blocks/request-card/request-card.d.ts.map +1 -0
  60. package/lib/typescript/src/blocks/scan-modal/index.d.ts +2 -0
  61. package/lib/typescript/src/blocks/scan-modal/index.d.ts.map +1 -0
  62. package/lib/typescript/src/blocks/scan-modal/scan-modal.d.ts +14 -0
  63. package/lib/typescript/src/blocks/scan-modal/scan-modal.d.ts.map +1 -0
  64. package/lib/typescript/src/blocks/summary-cards/index.d.ts +2 -0
  65. package/lib/typescript/src/blocks/summary-cards/index.d.ts.map +1 -0
  66. package/lib/typescript/src/blocks/summary-cards/summary-cards.d.ts +93 -0
  67. package/lib/typescript/src/blocks/summary-cards/summary-cards.d.ts.map +1 -0
  68. package/lib/typescript/src/components/dialog/dialog.d.ts +2 -1
  69. package/lib/typescript/src/components/dialog/dialog.d.ts.map +1 -1
  70. package/lib/typescript/src/components/field/field.d.ts +3 -1
  71. package/lib/typescript/src/components/field/field.d.ts.map +1 -1
  72. package/lib/typescript/src/components/list-row/list-row.d.ts +4 -1
  73. package/lib/typescript/src/components/list-row/list-row.d.ts.map +1 -1
  74. package/lib/typescript/src/components/progress-bar/progress-bar.d.ts +2 -1
  75. package/lib/typescript/src/components/progress-bar/progress-bar.d.ts.map +1 -1
  76. package/lib/typescript/src/components/status-badge/status-badge.d.ts +1 -1
  77. package/lib/typescript/src/components/status-badge/status-badge.d.ts.map +1 -1
  78. package/lib/typescript/src/components/stepper/index.d.ts +2 -0
  79. package/lib/typescript/src/components/stepper/index.d.ts.map +1 -0
  80. package/lib/typescript/src/components/stepper/stepper.d.ts +13 -0
  81. package/lib/typescript/src/components/stepper/stepper.d.ts.map +1 -0
  82. package/lib/typescript/src/index.d.ts +2 -1
  83. package/lib/typescript/src/index.d.ts.map +1 -1
  84. package/lib/typescript/src/internal/glyphs.d.ts +1 -0
  85. package/lib/typescript/src/internal/glyphs.d.ts.map +1 -1
  86. package/lib/typescript/src/templates/index.d.ts +4 -0
  87. package/lib/typescript/src/templates/index.d.ts.map +1 -1
  88. package/lib/typescript/src/templates/parts.d.ts +2 -1
  89. package/lib/typescript/src/templates/parts.d.ts.map +1 -1
  90. package/lib/typescript/src/templates/preview-template.d.ts +18 -0
  91. package/lib/typescript/src/templates/preview-template.d.ts.map +1 -0
  92. package/lib/typescript/src/templates/selection-template.d.ts +7 -0
  93. package/lib/typescript/src/templates/selection-template.d.ts.map +1 -0
  94. package/package.json +1 -1
  95. package/src/blocks/bulk-ship-list/bulk-ship-list.tsx +30 -126
  96. package/src/blocks/index.tsx +4 -0
  97. package/src/blocks/photo-grid/index.ts +5 -0
  98. package/src/blocks/photo-grid/photo-grid.tsx +96 -0
  99. package/src/blocks/request-card/index.ts +1 -0
  100. package/src/blocks/request-card/request-card.tsx +94 -0
  101. package/src/blocks/scan-modal/index.ts +1 -0
  102. package/src/blocks/scan-modal/scan-modal.tsx +61 -0
  103. package/src/blocks/summary-cards/index.ts +1 -0
  104. package/src/blocks/summary-cards/summary-cards.tsx +484 -0
  105. package/src/components/dialog/dialog.tsx +27 -7
  106. package/src/components/field/field.tsx +14 -1
  107. package/src/components/list-row/list-row.tsx +53 -2
  108. package/src/components/progress-bar/progress-bar.tsx +23 -14
  109. package/src/components/status-badge/status-badge.tsx +2 -1
  110. package/src/components/stepper/index.ts +1 -0
  111. package/src/components/stepper/stepper.tsx +85 -0
  112. package/src/index.tsx +2 -0
  113. package/src/internal/glyphs.tsx +37 -0
  114. package/src/templates/index.ts +7 -0
  115. package/src/templates/parts.tsx +9 -0
  116. package/src/templates/preview-template.tsx +88 -0
  117. package/src/templates/selection-template.tsx +22 -0
@@ -1,13 +1,11 @@
1
1
  import { useState } from 'react';
2
- import { StyleSheet, View, type StyleProp, type ViewStyle } from 'react-native';
2
+ import { View, type StyleProp, type ViewStyle } from 'react-native';
3
3
  import { Field } from '../../components/field/field';
4
4
  import { ListRow } from '../../components/list-row/list-row';
5
- import { Photo } from '../../components/photo/photo';
6
5
  import { Sheet, SheetOptions } from '../../components/sheet/sheet';
7
6
  import { Text } from '../../components/text/text';
8
- import type { IconRenderProps } from '../../internal/icon';
9
- import { PressableBase } from '../../internal/pressable-base';
10
- import { useTheme } from '../../theme/theme-provider';
7
+ import { ScanGlyph } from '../../internal/glyphs';
8
+ import { ListSection } from '../../templates/parts';
11
9
  import { makeStyles } from '../../utils/styles';
12
10
 
13
11
  export type ShipCarrier = { code: string; name: string };
@@ -16,7 +14,6 @@ export type BulkShipRow = {
16
14
  id: string;
17
15
  title: string;
18
16
  subtitle?: string;
19
- image?: string | null;
20
17
  trackingNo: string;
21
18
  };
22
19
 
@@ -36,8 +33,6 @@ export type TrackingIssue = 'invalid' | 'duplicate';
36
33
  const TRACKING = /^[0-9-]{8,20}$/;
37
34
  const INVALID = '숫자와 -만 8~20자리로 입력해 주세요';
38
35
  const DUPLICATE = '같은 송장 번호가 다른 주문에도 있어요';
39
- const FIELD_HEIGHT = 52;
40
- const THUMB = 48;
41
36
 
42
37
  export function trackingIssues(
43
38
  rows: readonly BulkShipRow[]
@@ -61,69 +56,10 @@ export function trackingIssues(
61
56
  }
62
57
 
63
58
  const useStyles = makeStyles((t) => ({
64
- head: {
65
- paddingTop: t.space[4],
66
- paddingBottom: t.space[2],
67
- paddingHorizontal: t.layout.screenX,
68
- },
69
59
  list: { gap: t.space[4] },
70
- row: { gap: t.space[2], paddingHorizontal: t.layout.screenX },
71
- item: { flexDirection: 'row', alignItems: 'center', gap: t.space[3] },
72
- thumb: { width: THUMB },
73
- body: { flex: 1 },
74
- input: { flexDirection: 'row', alignItems: 'flex-start', gap: t.space[2] },
75
- field: { flex: 1 },
76
- scan: {
77
- width: FIELD_HEIGHT,
78
- height: FIELD_HEIGHT,
79
- alignItems: 'center',
80
- justifyContent: 'center',
81
- borderRadius: t.radius.md,
82
- borderWidth: 1,
83
- borderColor: t.colors.input,
84
- backgroundColor: t.colors.surface,
85
- },
86
- pressed: { backgroundColor: t.colors.muted },
60
+ row: { gap: t.space[1], paddingHorizontal: t.layout.screenX },
87
61
  }));
88
62
 
89
- const g = StyleSheet.create({ absolute: { position: 'absolute' } });
90
-
91
- function ScanGlyph({ color, size }: IconRenderProps) {
92
- const stroke = Math.max(1.5, size / 12);
93
- const arm = size * 0.3;
94
- const corner = (v: 'top' | 'bottom', h: 'left' | 'right') => ({
95
- position: 'absolute' as const,
96
- width: arm,
97
- height: arm,
98
- borderColor: color,
99
- [v]: 0,
100
- [h]: 0,
101
- [v === 'top' ? 'borderTopWidth' : 'borderBottomWidth']: stroke,
102
- [h === 'left' ? 'borderLeftWidth' : 'borderRightWidth']: stroke,
103
- });
104
- return (
105
- <View style={{ width: size, height: size }}>
106
- <View style={corner('top', 'left')} />
107
- <View style={corner('top', 'right')} />
108
- <View style={corner('bottom', 'left')} />
109
- <View style={corner('bottom', 'right')} />
110
- <View
111
- style={[
112
- g.absolute,
113
- {
114
- left: size * 0.12,
115
- right: size * 0.12,
116
- top: (size - stroke) / 2,
117
- height: stroke,
118
- borderRadius: stroke,
119
- backgroundColor: color,
120
- },
121
- ]}
122
- />
123
- </View>
124
- );
125
- }
126
-
127
63
  export function BulkShipList({
128
64
  carriers,
129
65
  carrier,
@@ -134,56 +70,31 @@ export function BulkShipList({
134
70
  bottomInset = 0,
135
71
  style,
136
72
  }: BulkShipListProps) {
137
- const t = useTheme();
138
73
  const s = useStyles();
139
74
  const [picking, setPicking] = useState(false);
140
75
  const issues = trackingIssues(rows);
141
76
  const selected = carriers.find((c) => c.code === carrier);
77
+ const filled = rows.filter((row) => row.trackingNo.trim()).length;
142
78
  return (
143
79
  <View style={style}>
144
- <ListRow
145
- title="택배사"
146
- value={selected?.name ?? '선택'}
147
- chevron
148
- onPress={() => setPicking(true)}
149
- />
150
- <View style={s.head}>
151
- <Text
152
- variant="label"
153
- tone="muted"
154
- weight="semibold"
155
- accessibilityRole="header"
156
- >
157
- {`${rows.length}건`}
158
- </Text>
159
- </View>
160
- <View style={s.list}>
161
- {rows.map((row) => {
162
- const issue = issues[row.id];
163
- return (
164
- <View key={row.id} style={s.row}>
165
- <View style={s.item}>
166
- {row.image !== undefined ? (
167
- <Photo
168
- source={{ uri: row.image ?? '' }}
169
- radius={t.radius.md}
170
- style={s.thumb}
171
- />
172
- ) : null}
173
- <View style={s.body}>
174
- <Text variant="bodyLg" numberOfLines={1}>
175
- {row.title}
176
- </Text>
177
- {row.subtitle ? (
178
- <Text variant="label" tone="muted" numberOfLines={1}>
179
- {row.subtitle}
180
- </Text>
181
- ) : null}
182
- </View>
183
- </View>
184
- <View style={s.input}>
80
+ <ListSection card>
81
+ <ListRow
82
+ title="택배사"
83
+ value={selected?.name ?? '선택'}
84
+ chevron
85
+ onPress={() => setPicking(true)}
86
+ />
87
+ </ListSection>
88
+ <ListSection title={`송장 번호 ${filled}/${rows.length}`}>
89
+ <View style={s.list}>
90
+ {rows.map((row) => {
91
+ const issue = issues[row.id];
92
+ return (
93
+ <View key={row.id} style={s.row}>
94
+ <Text variant="label" numberOfLines={1}>
95
+ {row.subtitle ? `${row.subtitle} · ${row.title}` : row.title}
96
+ </Text>
185
97
  <Field
186
- style={s.field}
187
98
  value={row.trackingNo}
188
99
  onChangeText={(v) => onTrackingChange(row.id, v)}
189
100
  placeholder="송장 번호"
@@ -194,26 +105,19 @@ export function BulkShipList({
194
105
  accessibilityLabel={`${row.title} 송장 번호`}
195
106
  error={issue === 'invalid' ? INVALID : undefined}
196
107
  warning={issue === 'duplicate' ? DUPLICATE : undefined}
108
+ trailing={onScan ? ScanGlyph : undefined}
109
+ onTrailingPress={onScan ? () => onScan(row.id) : undefined}
110
+ trailingLabel={`${row.title} 송장 스캔`}
197
111
  />
198
- {onScan ? (
199
- <PressableBase
200
- accessibilityLabel={`${row.title} 송장 스캔`}
201
- onPress={() => onScan(row.id)}
202
- pressedStyle={s.pressed}
203
- style={s.scan}
204
- >
205
- <ScanGlyph color={t.colors.foreground} size={22} />
206
- </PressableBase>
207
- ) : null}
208
112
  </View>
209
- </View>
210
- );
211
- })}
212
- </View>
113
+ );
114
+ })}
115
+ </View>
116
+ </ListSection>
213
117
  <Sheet
214
118
  open={picking}
215
119
  onOpenChange={setPicking}
216
- title="택배사"
120
+ title="택배사 선택"
217
121
  bottomInset={bottomInset}
218
122
  >
219
123
  <SheetOptions
@@ -32,3 +32,7 @@ export * from './product-tile';
32
32
  export * from './quick-actions';
33
33
  export * from './action-grid';
34
34
  export * from './site-summary';
35
+ export * from './scan-modal';
36
+ export * from './summary-cards';
37
+ export * from './request-card';
38
+ export * from './photo-grid';
@@ -0,0 +1,5 @@
1
+ export {
2
+ PhotoGrid,
3
+ type PhotoGridItem,
4
+ type PhotoGridProps,
5
+ } from './photo-grid';
@@ -0,0 +1,96 @@
1
+ import { View } from 'react-native';
2
+ import { Photo } from '../../components/photo/photo';
3
+ import { Text } from '../../components/text/text';
4
+ import { PlusGlyph } from '../../internal/glyphs';
5
+ import { PressableBase } from '../../internal/pressable-base';
6
+ import { useTheme } from '../../theme/theme-provider';
7
+ import { makeStyles } from '../../utils/styles';
8
+
9
+ export type PhotoGridItem = {
10
+ key: string;
11
+ title: string;
12
+ caption?: string;
13
+ image?: string | null;
14
+ };
15
+
16
+ export type PhotoGridProps = {
17
+ items: readonly PhotoGridItem[];
18
+ addLabel: string;
19
+ onAdd: () => void;
20
+ onPress: (key: string) => void;
21
+ };
22
+
23
+ const useStyles = makeStyles((t) => ({
24
+ root: {
25
+ flexDirection: 'row',
26
+ flexWrap: 'wrap',
27
+ gap: t.layout.itemGap,
28
+ marginTop: t.layout.groupGap,
29
+ paddingHorizontal: t.layout.screenX,
30
+ },
31
+ cell: {
32
+ flexBasis: '48%',
33
+ flexGrow: 1,
34
+ overflow: 'hidden',
35
+ borderRadius: t.radius.lg,
36
+ backgroundColor: t.colors.surface,
37
+ },
38
+ add: {
39
+ alignItems: 'center',
40
+ justifyContent: 'center',
41
+ gap: t.space[1],
42
+ borderWidth: 1,
43
+ borderStyle: 'dashed',
44
+ borderColor: t.colors.input,
45
+ },
46
+ photo: { width: '100%' },
47
+ body: { padding: t.space[3], gap: t.space[1] },
48
+ pressed: { backgroundColor: t.colors.muted },
49
+ }));
50
+
51
+ export function PhotoGrid({ items, addLabel, onAdd, onPress }: PhotoGridProps) {
52
+ const t = useTheme();
53
+ const s = useStyles();
54
+ return (
55
+ <View style={s.root}>
56
+ <PressableBase
57
+ accessibilityRole="button"
58
+ accessibilityLabel={addLabel}
59
+ onPress={onAdd}
60
+ pressedStyle={s.pressed}
61
+ style={[s.cell, s.add]}
62
+ >
63
+ <PlusGlyph color={t.colors.primary} size={t.iconSize.md} />
64
+ <Text variant="label" weight="bold" tone="point">
65
+ {addLabel}
66
+ </Text>
67
+ </PressableBase>
68
+ {items.map((item) => (
69
+ <PressableBase
70
+ key={item.key}
71
+ accessibilityRole="button"
72
+ accessibilityLabel={item.title}
73
+ onPress={() => onPress(item.key)}
74
+ pressedStyle={s.pressed}
75
+ style={s.cell}
76
+ >
77
+ <Photo
78
+ source={{ uri: item.image ?? '' }}
79
+ seed={item.title}
80
+ style={s.photo}
81
+ />
82
+ <View style={s.body}>
83
+ <Text variant="label" weight="semibold" numberOfLines={1}>
84
+ {item.title}
85
+ </Text>
86
+ {item.caption ? (
87
+ <Text variant="caption" tone="muted" numberOfLines={1}>
88
+ {item.caption}
89
+ </Text>
90
+ ) : null}
91
+ </View>
92
+ </PressableBase>
93
+ ))}
94
+ </View>
95
+ );
96
+ }
@@ -0,0 +1 @@
1
+ export { RequestCard, type RequestCardProps } from './request-card';
@@ -0,0 +1,94 @@
1
+ import { View, type StyleProp, type ViewStyle } from 'react-native';
2
+ import { Button } from '../../components/button/button';
3
+ import { StatusBadge } from '../../components/status-badge/status-badge';
4
+ import { Text } from '../../components/text/text';
5
+ import { PressableBase } from '../../internal/pressable-base';
6
+ import { makeStyles } from '../../utils/styles';
7
+
8
+ export type RequestCardProps = {
9
+ name: string;
10
+ tag?: string;
11
+ due?: string;
12
+ urgent?: boolean;
13
+ summary?: string;
14
+ meta?: string;
15
+ actionLabel?: string;
16
+ onAction?: () => void;
17
+ onPress?: () => void;
18
+ style?: StyleProp<ViewStyle>;
19
+ };
20
+
21
+ const useStyles = makeStyles((t) => ({
22
+ card: {
23
+ marginTop: t.layout.itemGap,
24
+ marginHorizontal: t.layout.screenX,
25
+ padding: t.space[4],
26
+ gap: t.space[2],
27
+ borderRadius: t.radius.lg,
28
+ backgroundColor: t.colors.surface,
29
+ },
30
+ pressed: { backgroundColor: t.colors.muted },
31
+ head: { flexDirection: 'row', alignItems: 'center', gap: t.space[2] },
32
+ name: { flexShrink: 1 },
33
+ space: { flex: 1 },
34
+ foot: {
35
+ flexDirection: 'row',
36
+ alignItems: 'center',
37
+ justifyContent: 'space-between',
38
+ gap: t.space[3],
39
+ },
40
+ }));
41
+
42
+ export function RequestCard({
43
+ name,
44
+ tag,
45
+ due,
46
+ urgent = false,
47
+ summary,
48
+ meta,
49
+ actionLabel,
50
+ onAction,
51
+ onPress,
52
+ style,
53
+ }: RequestCardProps) {
54
+ const s = useStyles();
55
+ return (
56
+ <PressableBase
57
+ accessibilityRole="button"
58
+ accessibilityLabel={[name, tag, due, summary].filter(Boolean).join(' ')}
59
+ onPress={onPress}
60
+ pressedStyle={s.pressed}
61
+ style={[s.card, style]}
62
+ >
63
+ <View style={s.head}>
64
+ <Text variant="bodyLg" weight="bold" numberOfLines={1} style={s.name}>
65
+ {name}
66
+ </Text>
67
+ {tag ? <StatusBadge>{tag}</StatusBadge> : null}
68
+ <View style={s.space} />
69
+ {due ? (
70
+ <Text variant="label" weight="bold" tone={urgent ? 'point' : 'muted'}>
71
+ {due}
72
+ </Text>
73
+ ) : null}
74
+ </View>
75
+ {summary ? (
76
+ <Text variant="label" tone="muted" numberOfLines={2}>
77
+ {summary}
78
+ </Text>
79
+ ) : null}
80
+ {meta || actionLabel ? (
81
+ <View style={s.foot}>
82
+ <Text variant="caption" tone="muted">
83
+ {meta ?? ''}
84
+ </Text>
85
+ {actionLabel && onAction ? (
86
+ <Button size="sm" onPress={onAction}>
87
+ {actionLabel}
88
+ </Button>
89
+ ) : null}
90
+ </View>
91
+ ) : null}
92
+ </PressableBase>
93
+ );
94
+ }
@@ -0,0 +1 @@
1
+ export * from './scan-modal';
@@ -0,0 +1,61 @@
1
+ import type { ReactNode } from 'react';
2
+ import { Modal, View, type StyleProp, type ViewStyle } from 'react-native';
3
+ import { Text } from '../../components/text/text';
4
+ import { CloseGlyph } from '../../internal/glyphs';
5
+ import { PressableBase } from '../../internal/pressable-base';
6
+ import { useTheme } from '../../theme/theme-provider';
7
+ import { makeStyles } from '../../utils/styles';
8
+
9
+ export type ScanModalProps = {
10
+ open: boolean;
11
+ onClose: () => void;
12
+ title: string;
13
+ topInset?: number;
14
+ bottomInset?: number;
15
+ children: (frame: { style: StyleProp<ViewStyle> }) => ReactNode;
16
+ };
17
+
18
+ const useStyles = makeStyles((t) => ({
19
+ root: { flex: 1, backgroundColor: t.colors.background },
20
+ head: {
21
+ flexDirection: 'row',
22
+ alignItems: 'center',
23
+ justifyContent: 'space-between',
24
+ paddingHorizontal: t.layout.screenX,
25
+ paddingVertical: t.space[3],
26
+ },
27
+ frame: { flex: 1 },
28
+ }));
29
+
30
+ export function ScanModal({
31
+ open,
32
+ onClose,
33
+ title,
34
+ topInset = 0,
35
+ bottomInset = 0,
36
+ children,
37
+ }: ScanModalProps) {
38
+ const t = useTheme();
39
+ const s = useStyles();
40
+ return (
41
+ <Modal visible={open} animationType="slide" onRequestClose={onClose}>
42
+ <View
43
+ style={[s.root, { paddingTop: topInset, paddingBottom: bottomInset }]}
44
+ >
45
+ <View style={s.head}>
46
+ <Text variant="title" weight="bold" accessibilityRole="header">
47
+ {title}
48
+ </Text>
49
+ <PressableBase
50
+ accessibilityRole="button"
51
+ accessibilityLabel="닫기"
52
+ onPress={onClose}
53
+ >
54
+ <CloseGlyph color={t.colors.foreground} size={t.iconSize.md} />
55
+ </PressableBase>
56
+ </View>
57
+ {children({ style: s.frame })}
58
+ </View>
59
+ </Modal>
60
+ );
61
+ }
@@ -0,0 +1 @@
1
+ export * from './summary-cards';