@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.
- package/CHANGELOG.md +21 -0
- package/lib/module/blocks/cover-photos/cover-photos.js +165 -0
- package/lib/module/blocks/cover-photos/cover-photos.js.map +1 -0
- package/lib/module/blocks/cover-photos/index.js +4 -0
- package/lib/module/blocks/cover-photos/index.js.map +1 -0
- package/lib/module/blocks/detail-editor/compare-slider.js +117 -0
- package/lib/module/blocks/detail-editor/compare-slider.js.map +1 -0
- package/lib/module/blocks/detail-editor/detail-canvas.js +339 -0
- package/lib/module/blocks/detail-editor/detail-canvas.js.map +1 -0
- package/lib/module/blocks/detail-editor/detail-composer.js +254 -0
- package/lib/module/blocks/detail-editor/detail-composer.js.map +1 -0
- package/lib/module/blocks/detail-editor/detail-editor-template.js +102 -0
- package/lib/module/blocks/detail-editor/detail-editor-template.js.map +1 -0
- package/lib/module/blocks/detail-editor/detail-types.js +64 -0
- package/lib/module/blocks/detail-editor/detail-types.js.map +1 -0
- package/lib/module/blocks/detail-editor/draft-preview.js +39 -0
- package/lib/module/blocks/detail-editor/draft-preview.js.map +1 -0
- package/lib/module/blocks/detail-editor/draft-strip.js +97 -0
- package/lib/module/blocks/detail-editor/draft-strip.js.map +1 -0
- package/lib/module/blocks/detail-editor/editor-bar.js +96 -0
- package/lib/module/blocks/detail-editor/editor-bar.js.map +1 -0
- package/lib/module/blocks/detail-editor/focus-context.js +5 -0
- package/lib/module/blocks/detail-editor/focus-context.js.map +1 -0
- package/lib/module/blocks/detail-editor/font-picker.js +74 -0
- package/lib/module/blocks/detail-editor/font-picker.js.map +1 -0
- package/lib/module/blocks/detail-editor/index.js +16 -0
- package/lib/module/blocks/detail-editor/index.js.map +1 -0
- package/lib/module/blocks/detail-editor/layout-picker.js +173 -0
- package/lib/module/blocks/detail-editor/layout-picker.js.map +1 -0
- package/lib/module/blocks/detail-editor/photo-tray.js +144 -0
- package/lib/module/blocks/detail-editor/photo-tray.js.map +1 -0
- package/lib/module/blocks/detail-editor/structure-picker.js +75 -0
- package/lib/module/blocks/detail-editor/structure-picker.js.map +1 -0
- package/lib/module/blocks/detail-editor/tool-row.js +63 -0
- package/lib/module/blocks/detail-editor/tool-row.js.map +1 -0
- package/lib/module/blocks/index.js +3 -0
- package/lib/module/blocks/index.js.map +1 -1
- package/lib/module/blocks/slider-list/index.js +4 -0
- package/lib/module/blocks/slider-list/index.js.map +1 -0
- package/lib/module/blocks/slider-list/slider-list.js +45 -0
- package/lib/module/blocks/slider-list/slider-list.js.map +1 -0
- package/lib/module/blocks/task-tiles/task-tiles.js +1 -1
- package/lib/module/blocks/task-tiles/task-tiles.js.map +1 -1
- package/lib/module/charts/mini-bars.js +1 -1
- package/lib/module/charts/mini-bars.js.map +1 -1
- package/lib/module/components/button/button.js +10 -3
- package/lib/module/components/button/button.js.map +1 -1
- package/lib/module/components/floating-tab-bar/floating-tab-bar.js +103 -0
- package/lib/module/components/floating-tab-bar/floating-tab-bar.js.map +1 -0
- package/lib/module/components/floating-tab-bar/index.js +4 -0
- package/lib/module/components/floating-tab-bar/index.js.map +1 -0
- package/lib/module/components/list-row/list-row.js +9 -3
- package/lib/module/components/list-row/list-row.js.map +1 -1
- package/lib/module/components/section-tabs/index.js +4 -0
- package/lib/module/components/section-tabs/index.js.map +1 -0
- package/lib/module/components/section-tabs/section-tabs.js +73 -0
- package/lib/module/components/section-tabs/section-tabs.js.map +1 -0
- package/lib/module/components/slider/index.js +4 -0
- package/lib/module/components/slider/index.js.map +1 -0
- package/lib/module/components/slider/slider.js +151 -0
- package/lib/module/components/slider/slider.js.map +1 -0
- package/lib/module/index.js +3 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/flush-row.js +5 -0
- package/lib/module/internal/flush-row.js.map +1 -0
- package/lib/module/internal/pressable-base.js +3 -2
- package/lib/module/internal/pressable-base.js.map +1 -1
- package/lib/module/internal/tab-icon-pairs.js +25 -0
- package/lib/module/internal/tab-icon-pairs.js.map +1 -0
- package/lib/module/sortable/block-strip.js +151 -0
- package/lib/module/sortable/block-strip.js.map +1 -0
- package/lib/module/sortable/index.js +1 -0
- package/lib/module/sortable/index.js.map +1 -1
- package/lib/module/templates/index.js +1 -0
- package/lib/module/templates/index.js.map +1 -1
- package/lib/module/templates/parts.js +42 -2
- package/lib/module/templates/parts.js.map +1 -1
- package/lib/module/templates/sheet-form-template.js +174 -0
- package/lib/module/templates/sheet-form-template.js.map +1 -0
- package/lib/module/theme/base.js +4 -4
- package/lib/typescript/src/blocks/cover-photos/cover-photos.d.ts +16 -0
- package/lib/typescript/src/blocks/cover-photos/cover-photos.d.ts.map +1 -0
- package/lib/typescript/src/blocks/cover-photos/index.d.ts +2 -0
- package/lib/typescript/src/blocks/cover-photos/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/compare-slider.d.ts +8 -0
- package/lib/typescript/src/blocks/detail-editor/compare-slider.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/detail-canvas.d.ts +13 -0
- package/lib/typescript/src/blocks/detail-editor/detail-canvas.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/detail-composer.d.ts +25 -0
- package/lib/typescript/src/blocks/detail-editor/detail-composer.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/detail-editor-template.d.ts +13 -0
- package/lib/typescript/src/blocks/detail-editor/detail-editor-template.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/detail-types.d.ts +55 -0
- package/lib/typescript/src/blocks/detail-editor/detail-types.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/draft-preview.d.ts +8 -0
- package/lib/typescript/src/blocks/detail-editor/draft-preview.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/draft-strip.d.ts +16 -0
- package/lib/typescript/src/blocks/detail-editor/draft-strip.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/editor-bar.d.ts +18 -0
- package/lib/typescript/src/blocks/detail-editor/editor-bar.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/focus-context.d.ts +6 -0
- package/lib/typescript/src/blocks/detail-editor/focus-context.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/font-picker.d.ts +8 -0
- package/lib/typescript/src/blocks/detail-editor/font-picker.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/index.d.ts +14 -0
- package/lib/typescript/src/blocks/detail-editor/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/layout-picker.d.ts +11 -0
- package/lib/typescript/src/blocks/detail-editor/layout-picker.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/photo-tray.d.ts +15 -0
- package/lib/typescript/src/blocks/detail-editor/photo-tray.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/structure-picker.d.ts +13 -0
- package/lib/typescript/src/blocks/detail-editor/structure-picker.d.ts.map +1 -0
- package/lib/typescript/src/blocks/detail-editor/tool-row.d.ts +13 -0
- package/lib/typescript/src/blocks/detail-editor/tool-row.d.ts.map +1 -0
- package/lib/typescript/src/blocks/index.d.ts +3 -0
- package/lib/typescript/src/blocks/index.d.ts.map +1 -1
- package/lib/typescript/src/blocks/slider-list/index.d.ts +2 -0
- package/lib/typescript/src/blocks/slider-list/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/slider-list/slider-list.d.ts +17 -0
- package/lib/typescript/src/blocks/slider-list/slider-list.d.ts.map +1 -0
- package/lib/typescript/src/components/button/button.d.ts.map +1 -1
- package/lib/typescript/src/components/floating-tab-bar/floating-tab-bar.d.ts +20 -0
- package/lib/typescript/src/components/floating-tab-bar/floating-tab-bar.d.ts.map +1 -0
- package/lib/typescript/src/components/floating-tab-bar/index.d.ts +2 -0
- package/lib/typescript/src/components/floating-tab-bar/index.d.ts.map +1 -0
- package/lib/typescript/src/components/list-row/list-row.d.ts.map +1 -1
- package/lib/typescript/src/components/section-tabs/index.d.ts +2 -0
- package/lib/typescript/src/components/section-tabs/index.d.ts.map +1 -0
- package/lib/typescript/src/components/section-tabs/section-tabs.d.ts +14 -0
- package/lib/typescript/src/components/section-tabs/section-tabs.d.ts.map +1 -0
- package/lib/typescript/src/components/slider/index.d.ts +2 -0
- package/lib/typescript/src/components/slider/index.d.ts.map +1 -0
- package/lib/typescript/src/components/slider/slider.d.ts +14 -0
- package/lib/typescript/src/components/slider/slider.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/internal/flush-row.d.ts +2 -0
- package/lib/typescript/src/internal/flush-row.d.ts.map +1 -0
- package/lib/typescript/src/internal/pressable-base.d.ts +2 -1
- package/lib/typescript/src/internal/pressable-base.d.ts.map +1 -1
- package/lib/typescript/src/internal/tab-icon-pairs.d.ts +23 -0
- package/lib/typescript/src/internal/tab-icon-pairs.d.ts.map +1 -0
- package/lib/typescript/src/sortable/block-strip.d.ts +14 -0
- package/lib/typescript/src/sortable/block-strip.d.ts.map +1 -0
- package/lib/typescript/src/sortable/index.d.ts +1 -0
- package/lib/typescript/src/sortable/index.d.ts.map +1 -1
- package/lib/typescript/src/templates/index.d.ts +2 -0
- package/lib/typescript/src/templates/index.d.ts.map +1 -1
- package/lib/typescript/src/templates/parts.d.ts +2 -1
- package/lib/typescript/src/templates/parts.d.ts.map +1 -1
- package/lib/typescript/src/templates/sheet-form-template.d.ts +31 -0
- package/lib/typescript/src/templates/sheet-form-template.d.ts.map +1 -0
- package/lib/typescript/src/theme/base.d.ts +4 -4
- package/package.json +1 -1
- package/src/blocks/cover-photos/cover-photos.tsx +176 -0
- package/src/blocks/cover-photos/index.ts +5 -0
- package/src/blocks/detail-editor/compare-slider.tsx +112 -0
- package/src/blocks/detail-editor/detail-canvas.tsx +369 -0
- package/src/blocks/detail-editor/detail-composer.tsx +261 -0
- package/src/blocks/detail-editor/detail-editor-template.tsx +109 -0
- package/src/blocks/detail-editor/detail-types.ts +113 -0
- package/src/blocks/detail-editor/draft-preview.tsx +34 -0
- package/src/blocks/detail-editor/draft-strip.tsx +102 -0
- package/src/blocks/detail-editor/editor-bar.tsx +116 -0
- package/src/blocks/detail-editor/focus-context.ts +7 -0
- package/src/blocks/detail-editor/font-picker.tsx +75 -0
- package/src/blocks/detail-editor/index.ts +57 -0
- package/src/blocks/detail-editor/layout-picker.tsx +158 -0
- package/src/blocks/detail-editor/photo-tray.tsx +140 -0
- package/src/blocks/detail-editor/structure-picker.tsx +75 -0
- package/src/blocks/detail-editor/tool-row.tsx +66 -0
- package/src/blocks/index.tsx +3 -0
- package/src/blocks/slider-list/index.ts +5 -0
- package/src/blocks/slider-list/slider-list.tsx +57 -0
- package/src/blocks/task-tiles/task-tiles.tsx +1 -1
- package/src/charts/mini-bars.tsx +1 -1
- package/src/components/button/button.tsx +10 -3
- package/src/components/floating-tab-bar/floating-tab-bar.tsx +121 -0
- package/src/components/floating-tab-bar/index.ts +7 -0
- package/src/components/list-row/list-row.tsx +7 -1
- package/src/components/section-tabs/index.ts +5 -0
- package/src/components/section-tabs/section-tabs.tsx +87 -0
- package/src/components/slider/index.ts +1 -0
- package/src/components/slider/slider.tsx +142 -0
- package/src/index.tsx +3 -0
- package/src/internal/flush-row.ts +3 -0
- package/src/internal/pressable-base.tsx +3 -1
- package/src/internal/tab-icon-pairs.ts +22 -0
- package/src/sortable/block-strip.tsx +168 -0
- package/src/sortable/index.ts +5 -0
- package/src/templates/index.ts +5 -0
- package/src/templates/parts.tsx +46 -1
- package/src/templates/sheet-form-template.tsx +190 -0
- package/src/theme/base.ts +4 -4
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useEffect,
|
|
3
|
+
useRef,
|
|
4
|
+
useState,
|
|
5
|
+
type ComponentRef,
|
|
6
|
+
type ReactNode,
|
|
7
|
+
} from 'react';
|
|
8
|
+
import { ScrollView, Text as RNText, View } from 'react-native';
|
|
9
|
+
import Sortable from 'react-native-sortables';
|
|
10
|
+
import { PressableBase } from '../internal/pressable-base';
|
|
11
|
+
import { useTheme } from '../theme/theme-provider';
|
|
12
|
+
import { makeStyles } from '../utils/styles';
|
|
13
|
+
|
|
14
|
+
export type BlockStripItem = { key: string; thumb: ReactNode };
|
|
15
|
+
|
|
16
|
+
export type BlockStripProps = {
|
|
17
|
+
items: readonly BlockStripItem[];
|
|
18
|
+
value: string | null;
|
|
19
|
+
onValueChange: (key: string) => void;
|
|
20
|
+
onReorder: (keys: string[]) => void;
|
|
21
|
+
onAdd?: () => void;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const W = 54;
|
|
25
|
+
const H = 70;
|
|
26
|
+
|
|
27
|
+
const useStyles = makeStyles((t) => ({
|
|
28
|
+
row: {
|
|
29
|
+
paddingHorizontal: t.space[3],
|
|
30
|
+
paddingVertical: t.space[2],
|
|
31
|
+
flexDirection: 'row',
|
|
32
|
+
gap: t.space[2],
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
},
|
|
35
|
+
chip: {
|
|
36
|
+
width: W,
|
|
37
|
+
height: H,
|
|
38
|
+
overflow: 'hidden',
|
|
39
|
+
borderRadius: t.radius.md,
|
|
40
|
+
borderWidth: 1,
|
|
41
|
+
borderColor: t.colors.border,
|
|
42
|
+
backgroundColor: t.colors.surface,
|
|
43
|
+
},
|
|
44
|
+
on: { borderWidth: 2.5, borderColor: t.colors.primary },
|
|
45
|
+
num: {
|
|
46
|
+
position: 'absolute',
|
|
47
|
+
left: t.space[1],
|
|
48
|
+
top: t.space[1],
|
|
49
|
+
minWidth: t.space[4] + 2,
|
|
50
|
+
height: t.space[4] + 2,
|
|
51
|
+
borderRadius: t.radius.full,
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
justifyContent: 'center',
|
|
54
|
+
},
|
|
55
|
+
numText: {
|
|
56
|
+
fontSize: t.typography.caption.fontSize - 1,
|
|
57
|
+
fontWeight: '700',
|
|
58
|
+
color: t.colors.primaryForeground,
|
|
59
|
+
},
|
|
60
|
+
add: {
|
|
61
|
+
width: W,
|
|
62
|
+
height: H,
|
|
63
|
+
borderRadius: t.radius.md,
|
|
64
|
+
borderWidth: 1,
|
|
65
|
+
borderStyle: 'dashed',
|
|
66
|
+
borderColor: t.colors.input,
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
justifyContent: 'center',
|
|
69
|
+
},
|
|
70
|
+
plus: {
|
|
71
|
+
fontSize: t.typography.title.fontSize,
|
|
72
|
+
color: t.colors.mutedForeground,
|
|
73
|
+
},
|
|
74
|
+
}));
|
|
75
|
+
|
|
76
|
+
export function BlockStrip({
|
|
77
|
+
items,
|
|
78
|
+
value,
|
|
79
|
+
onValueChange,
|
|
80
|
+
onReorder,
|
|
81
|
+
onAdd,
|
|
82
|
+
}: BlockStripProps) {
|
|
83
|
+
const t = useTheme();
|
|
84
|
+
const s = useStyles();
|
|
85
|
+
const scroller = useRef<ComponentRef<typeof ScrollView>>(null);
|
|
86
|
+
const offset = useRef(0);
|
|
87
|
+
const [width, setWidth] = useState(0);
|
|
88
|
+
const picked = items.findIndex((item) => item.key === value);
|
|
89
|
+
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
if (picked < 0 || width <= 0) return;
|
|
92
|
+
const edge = t.space[3];
|
|
93
|
+
const left = edge + picked * (W + t.space[2]);
|
|
94
|
+
const right = left + W;
|
|
95
|
+
const now = offset.current;
|
|
96
|
+
const next =
|
|
97
|
+
left - edge < now
|
|
98
|
+
? left - edge
|
|
99
|
+
: right + edge > now + width
|
|
100
|
+
? right + edge - width
|
|
101
|
+
: now;
|
|
102
|
+
if (next !== now) {
|
|
103
|
+
scroller.current?.scrollTo({ x: Math.max(0, next), animated: true });
|
|
104
|
+
}
|
|
105
|
+
}, [picked, width, t]);
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<ScrollView
|
|
109
|
+
ref={scroller}
|
|
110
|
+
horizontal
|
|
111
|
+
showsHorizontalScrollIndicator={false}
|
|
112
|
+
contentContainerStyle={s.row}
|
|
113
|
+
scrollEventThrottle={16}
|
|
114
|
+
onScroll={(e) => {
|
|
115
|
+
offset.current = e.nativeEvent.contentOffset.x;
|
|
116
|
+
}}
|
|
117
|
+
onLayout={(e) => setWidth(e.nativeEvent.layout.width)}
|
|
118
|
+
>
|
|
119
|
+
<View style={{ width: items.length * (W + t.space[2]) - t.space[2] }}>
|
|
120
|
+
<Sortable.Grid
|
|
121
|
+
data={[...items]}
|
|
122
|
+
keyExtractor={(item) => item.key}
|
|
123
|
+
rows={1}
|
|
124
|
+
rowHeight={H}
|
|
125
|
+
columnGap={t.space[2]}
|
|
126
|
+
activeItemScale={1.12}
|
|
127
|
+
inactiveItemOpacity={1}
|
|
128
|
+
onDragEnd={({ data }) => onReorder(data.map((item) => item.key))}
|
|
129
|
+
renderItem={({ item, index }) => {
|
|
130
|
+
const on = item.key === value;
|
|
131
|
+
return (
|
|
132
|
+
<PressableBase
|
|
133
|
+
onPress={() => onValueChange(item.key)}
|
|
134
|
+
accessibilityLabel={`블록 ${index + 1}`}
|
|
135
|
+
accessibilityState={{ selected: on }}
|
|
136
|
+
pressedStyle={{}}
|
|
137
|
+
style={[s.chip, on && s.on]}
|
|
138
|
+
>
|
|
139
|
+
{item.thumb}
|
|
140
|
+
<View
|
|
141
|
+
style={[
|
|
142
|
+
s.num,
|
|
143
|
+
{
|
|
144
|
+
backgroundColor: on
|
|
145
|
+
? t.colors.primary
|
|
146
|
+
: t.colors.foreground,
|
|
147
|
+
},
|
|
148
|
+
]}
|
|
149
|
+
>
|
|
150
|
+
<RNText style={s.numText}>{index + 1}</RNText>
|
|
151
|
+
</View>
|
|
152
|
+
</PressableBase>
|
|
153
|
+
);
|
|
154
|
+
}}
|
|
155
|
+
/>
|
|
156
|
+
</View>
|
|
157
|
+
{onAdd ? (
|
|
158
|
+
<PressableBase
|
|
159
|
+
onPress={onAdd}
|
|
160
|
+
accessibilityLabel="블록 추가"
|
|
161
|
+
style={s.add}
|
|
162
|
+
>
|
|
163
|
+
<RNText style={s.plus}>+</RNText>
|
|
164
|
+
</PressableBase>
|
|
165
|
+
) : null}
|
|
166
|
+
</ScrollView>
|
|
167
|
+
);
|
|
168
|
+
}
|
package/src/sortable/index.ts
CHANGED
package/src/templates/index.ts
CHANGED
|
@@ -41,3 +41,8 @@ export type {
|
|
|
41
41
|
} from './preview-template';
|
|
42
42
|
export { SplitPreviewTemplate } from './split-preview-template';
|
|
43
43
|
export type { SplitPreviewTemplateProps } from './split-preview-template';
|
|
44
|
+
export { SheetBlock, SheetFormTemplate } from './sheet-form-template';
|
|
45
|
+
export type {
|
|
46
|
+
SheetBlockProps,
|
|
47
|
+
SheetFormTemplateProps,
|
|
48
|
+
} from './sheet-form-template';
|
package/src/templates/parts.tsx
CHANGED
|
@@ -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 }]}
|
|
@@ -172,7 +217,7 @@ export function ListSection({
|
|
|
172
217
|
<View style={s.sectionHead}>
|
|
173
218
|
<Text
|
|
174
219
|
variant="label"
|
|
175
|
-
tone="
|
|
220
|
+
tone="muted"
|
|
176
221
|
weight="semibold"
|
|
177
222
|
accessibilityRole="header"
|
|
178
223
|
>
|
|
@@ -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
|
+
}
|
package/src/theme/base.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const semantic = {
|
|
2
2
|
light: {
|
|
3
|
-
background: '#
|
|
3
|
+
background: '#f4f4f5',
|
|
4
4
|
surface: '#ffffff',
|
|
5
5
|
foreground: '#1a1a1a',
|
|
6
6
|
muted: '#f0f0f0',
|
|
@@ -8,10 +8,10 @@ export const semantic = {
|
|
|
8
8
|
border: '#e3e3e3',
|
|
9
9
|
input: '#c7c7c7',
|
|
10
10
|
ring: '#a3a3a3',
|
|
11
|
-
primary: '#
|
|
12
|
-
primaryForeground: '#
|
|
11
|
+
primary: '#c54211',
|
|
12
|
+
primaryForeground: '#ffffff',
|
|
13
13
|
primaryTint: '#fdf0ea',
|
|
14
|
-
primaryContainer: '#
|
|
14
|
+
primaryContainer: '#f6d3c3',
|
|
15
15
|
primaryEdge: '#ed6431',
|
|
16
16
|
point: '#1a1a1a',
|
|
17
17
|
danger: '#b91c1c',
|