@ezpg/app-ui 0.17.0 → 0.19.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 +17 -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/draft-preview.js +39 -0
- package/lib/module/blocks/detail-editor/draft-preview.js.map +1 -0
- package/lib/module/blocks/detail-editor/index.js +2 -0
- package/lib/module/blocks/detail-editor/index.js.map +1 -1
- package/lib/module/blocks/detail-editor/layout-picker.js +1 -1
- package/lib/module/blocks/detail-editor/layout-picker.js.map +1 -1
- 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/index.js +3 -0
- package/lib/module/blocks/index.js.map +1 -1
- package/lib/module/blocks/question-accordion/index.js +4 -0
- package/lib/module/blocks/question-accordion/index.js.map +1 -0
- package/lib/module/blocks/question-accordion/question-accordion.js +256 -0
- package/lib/module/blocks/question-accordion/question-accordion.js.map +1 -0
- 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/step-screen/step-screen.js +2 -3
- package/lib/module/blocks/step-screen/step-screen.js.map +1 -1
- package/lib/module/components/list-row/list-row.js +8 -2
- package/lib/module/components/list-row/list-row.js.map +1 -1
- package/lib/module/components/page-header/page-header.js +4 -2
- package/lib/module/components/page-header/page-header.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/text/text.js +4 -1
- package/lib/module/components/text/text.js.map +1 -1
- package/lib/module/index.js +1 -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/templates/index.js +1 -0
- package/lib/module/templates/index.js.map +1 -1
- package/lib/module/templates/parts.js +41 -1
- package/lib/module/templates/parts.js.map +1 -1
- package/lib/module/templates/result-template.js +2 -3
- package/lib/module/templates/result-template.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 +22 -2
- package/lib/module/theme/base.js.map +1 -1
- 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/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/index.d.ts +2 -0
- package/lib/typescript/src/blocks/detail-editor/index.d.ts.map +1 -1
- package/lib/typescript/src/blocks/detail-editor/layout-picker.d.ts +3 -0
- package/lib/typescript/src/blocks/detail-editor/layout-picker.d.ts.map +1 -1
- 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/index.d.ts +3 -0
- package/lib/typescript/src/blocks/index.d.ts.map +1 -1
- package/lib/typescript/src/blocks/question-accordion/index.d.ts +2 -0
- package/lib/typescript/src/blocks/question-accordion/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/question-accordion/question-accordion.d.ts +27 -0
- package/lib/typescript/src/blocks/question-accordion/question-accordion.d.ts.map +1 -0
- 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/list-row/list-row.d.ts.map +1 -1
- package/lib/typescript/src/components/page-header/page-header.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/text/text.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -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/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 +21 -1
- package/lib/typescript/src/theme/base.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +7 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/blocks/cover-photos/cover-photos.tsx +176 -0
- package/src/blocks/cover-photos/index.ts +5 -0
- package/src/blocks/detail-editor/draft-preview.tsx +34 -0
- package/src/blocks/detail-editor/index.ts +6 -0
- package/src/blocks/detail-editor/layout-picker.tsx +1 -1
- package/src/blocks/detail-editor/structure-picker.tsx +75 -0
- package/src/blocks/index.tsx +3 -0
- package/src/blocks/question-accordion/index.ts +6 -0
- package/src/blocks/question-accordion/question-accordion.tsx +254 -0
- package/src/blocks/slider-list/index.ts +5 -0
- package/src/blocks/slider-list/slider-list.tsx +57 -0
- package/src/blocks/step-screen/step-screen.tsx +3 -3
- package/src/components/list-row/list-row.tsx +6 -0
- package/src/components/page-header/page-header.tsx +4 -1
- package/src/components/section-tabs/index.ts +5 -0
- package/src/components/section-tabs/section-tabs.tsx +87 -0
- package/src/components/text/text.tsx +9 -1
- package/src/index.tsx +1 -0
- package/src/internal/flush-row.ts +3 -0
- package/src/templates/index.ts +5 -0
- package/src/templates/parts.tsx +45 -0
- package/src/templates/result-template.tsx +3 -3
- package/src/templates/sheet-form-template.tsx +190 -0
- package/src/theme/base.ts +22 -1
- package/src/types/index.ts +10 -3
|
@@ -49,3 +49,9 @@ export {
|
|
|
49
49
|
type TrayPhoto,
|
|
50
50
|
type TraySource,
|
|
51
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';
|
|
@@ -55,7 +55,7 @@ const useStyles = makeStyles((t) => ({
|
|
|
55
55
|
},
|
|
56
56
|
}));
|
|
57
57
|
|
|
58
|
-
function Diagram({ layout }: { layout: DetailLayout }) {
|
|
58
|
+
export function Diagram({ layout }: { layout: DetailLayout }) {
|
|
59
59
|
const t = useTheme();
|
|
60
60
|
const s = useStyles();
|
|
61
61
|
const photo = <View style={s.photo} />;
|
|
@@ -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
|
+
}
|
package/src/blocks/index.tsx
CHANGED
|
@@ -33,6 +33,9 @@ export * from './product-tile';
|
|
|
33
33
|
export * from './quick-actions';
|
|
34
34
|
export * from './action-grid';
|
|
35
35
|
export * from './site-summary';
|
|
36
|
+
export * from './cover-photos';
|
|
37
|
+
export * from './question-accordion';
|
|
38
|
+
export * from './slider-list';
|
|
36
39
|
export * from './scan-modal';
|
|
37
40
|
export * from './summary-cards';
|
|
38
41
|
export * from './request-card';
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { TextInput, View, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { Text } from '../../components/text/text';
|
|
4
|
+
import { ChevronGlyph } 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 QuestionOption = { value: string; label: string };
|
|
10
|
+
|
|
11
|
+
export type QuestionSection = {
|
|
12
|
+
key: string;
|
|
13
|
+
label: string;
|
|
14
|
+
question: string;
|
|
15
|
+
options: readonly QuestionOption[];
|
|
16
|
+
value: readonly string[];
|
|
17
|
+
hint?: string;
|
|
18
|
+
max?: number;
|
|
19
|
+
other?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type QuestionAccordionProps = {
|
|
23
|
+
sections: readonly QuestionSection[];
|
|
24
|
+
openKey: string | null;
|
|
25
|
+
onOpenChange: (key: string | null) => void;
|
|
26
|
+
onValueChange: (key: string, value: string[]) => void;
|
|
27
|
+
onOtherChange?: (key: string, text: string) => void;
|
|
28
|
+
otherLabel?: string;
|
|
29
|
+
otherMax?: number;
|
|
30
|
+
style?: StyleProp<ViewStyle>;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const ROW = 54;
|
|
34
|
+
const CELL = 50;
|
|
35
|
+
const DOT = 6;
|
|
36
|
+
|
|
37
|
+
const useStyles = makeStyles((t) => ({
|
|
38
|
+
row: {
|
|
39
|
+
height: ROW,
|
|
40
|
+
flexDirection: 'row',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
gap: t.space[2],
|
|
43
|
+
},
|
|
44
|
+
line: { borderTopWidth: 1, borderTopColor: t.colors.border },
|
|
45
|
+
index: {
|
|
46
|
+
width: t.space[6],
|
|
47
|
+
...t.typography.caption,
|
|
48
|
+
fontWeight: '500',
|
|
49
|
+
color: t.colors.ring,
|
|
50
|
+
fontVariant: ['tabular-nums'],
|
|
51
|
+
},
|
|
52
|
+
label: { ...t.typography.label, color: t.colors.mutedForeground },
|
|
53
|
+
summary: {
|
|
54
|
+
flex: 1,
|
|
55
|
+
textAlign: 'right',
|
|
56
|
+
...t.typography.body,
|
|
57
|
+
fontWeight: '500',
|
|
58
|
+
color: t.colors.title,
|
|
59
|
+
},
|
|
60
|
+
chevron: { transform: [{ rotate: '90deg' }] },
|
|
61
|
+
panel: {
|
|
62
|
+
marginHorizontal: -t.space[3],
|
|
63
|
+
marginVertical: t.space[2],
|
|
64
|
+
paddingTop: t.space[4],
|
|
65
|
+
paddingBottom: t.space[3],
|
|
66
|
+
paddingHorizontal: t.space[3],
|
|
67
|
+
borderRadius: t.radius.xl,
|
|
68
|
+
backgroundColor: t.colors.surface,
|
|
69
|
+
boxShadow: t.shadow.panel,
|
|
70
|
+
},
|
|
71
|
+
head: { flexDirection: 'row', alignItems: 'center', gap: t.space[2] },
|
|
72
|
+
openIndex: { color: t.colors.primary },
|
|
73
|
+
eyebrow: { ...t.typography.eyebrow, color: t.colors.primary },
|
|
74
|
+
hint: {
|
|
75
|
+
marginLeft: 'auto',
|
|
76
|
+
...t.typography.caption,
|
|
77
|
+
color: t.colors.ring,
|
|
78
|
+
},
|
|
79
|
+
question: {
|
|
80
|
+
marginTop: t.space[2],
|
|
81
|
+
marginBottom: t.space[4],
|
|
82
|
+
...t.typography.question,
|
|
83
|
+
color: t.colors.title,
|
|
84
|
+
},
|
|
85
|
+
grid: {
|
|
86
|
+
flexDirection: 'row',
|
|
87
|
+
flexWrap: 'wrap',
|
|
88
|
+
borderTopWidth: 1,
|
|
89
|
+
borderTopColor: t.colors.border,
|
|
90
|
+
},
|
|
91
|
+
cell: {
|
|
92
|
+
width: '50%',
|
|
93
|
+
height: CELL,
|
|
94
|
+
justifyContent: 'center',
|
|
95
|
+
paddingHorizontal: t.space[3],
|
|
96
|
+
borderBottomWidth: 1,
|
|
97
|
+
borderBottomColor: t.colors.border,
|
|
98
|
+
},
|
|
99
|
+
right: { borderLeftWidth: 1, borderLeftColor: t.colors.border },
|
|
100
|
+
picked: { backgroundColor: t.colors.selectSurface },
|
|
101
|
+
cellText: { ...t.typography.body, color: t.colors.mutedForeground },
|
|
102
|
+
pickedText: { fontWeight: '500', color: t.colors.selectForeground },
|
|
103
|
+
otherText: { color: t.colors.ring },
|
|
104
|
+
dot: {
|
|
105
|
+
position: 'absolute',
|
|
106
|
+
right: t.space[3],
|
|
107
|
+
width: DOT,
|
|
108
|
+
height: DOT,
|
|
109
|
+
borderRadius: t.radius.full,
|
|
110
|
+
backgroundColor: t.colors.primary,
|
|
111
|
+
},
|
|
112
|
+
input: {
|
|
113
|
+
marginTop: t.space[3],
|
|
114
|
+
paddingVertical: t.space[2],
|
|
115
|
+
borderBottomWidth: 1,
|
|
116
|
+
borderBottomColor: t.colors.input,
|
|
117
|
+
...t.typography.body,
|
|
118
|
+
color: t.colors.title,
|
|
119
|
+
},
|
|
120
|
+
}));
|
|
121
|
+
|
|
122
|
+
function pad(n: number): string {
|
|
123
|
+
return String(n).padStart(2, '0');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function QuestionAccordion({
|
|
127
|
+
sections,
|
|
128
|
+
openKey,
|
|
129
|
+
onOpenChange,
|
|
130
|
+
onValueChange,
|
|
131
|
+
onOtherChange,
|
|
132
|
+
otherLabel = '기타 · 직접 입력',
|
|
133
|
+
otherMax = 20,
|
|
134
|
+
style,
|
|
135
|
+
}: QuestionAccordionProps) {
|
|
136
|
+
const t = useTheme();
|
|
137
|
+
const s = useStyles();
|
|
138
|
+
const [typing, setTyping] = useState<string | null>(null);
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<View style={style}>
|
|
142
|
+
{sections.map((section, i) => {
|
|
143
|
+
const open = section.key === openKey;
|
|
144
|
+
const prevOpen = i > 0 && sections[i - 1]?.key === openKey;
|
|
145
|
+
const chosen = section.options
|
|
146
|
+
.filter((o) => section.value.includes(o.value))
|
|
147
|
+
.map((o) => o.label);
|
|
148
|
+
const summary = [
|
|
149
|
+
...chosen,
|
|
150
|
+
...(section.other ? [section.other] : []),
|
|
151
|
+
].join(' · ');
|
|
152
|
+
if (!open) {
|
|
153
|
+
return (
|
|
154
|
+
<PressableBase
|
|
155
|
+
key={section.key}
|
|
156
|
+
accessibilityRole="button"
|
|
157
|
+
accessibilityState={{ expanded: false }}
|
|
158
|
+
accessibilityLabel={
|
|
159
|
+
summary ? `${section.label}, ${summary}` : section.label
|
|
160
|
+
}
|
|
161
|
+
onPress={() => onOpenChange(section.key)}
|
|
162
|
+
style={[s.row, i > 0 && !prevOpen && s.line]}
|
|
163
|
+
>
|
|
164
|
+
<Text style={s.index}>{pad(i + 1)}</Text>
|
|
165
|
+
<Text style={s.label}>{section.label}</Text>
|
|
166
|
+
<Text numberOfLines={1} style={s.summary}>
|
|
167
|
+
{summary}
|
|
168
|
+
</Text>
|
|
169
|
+
<View style={s.chevron}>
|
|
170
|
+
<ChevronGlyph color={t.colors.ring} size={16} />
|
|
171
|
+
</View>
|
|
172
|
+
</PressableBase>
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
const max = section.max ?? section.options.length;
|
|
176
|
+
const otherOn = typing === section.key || Boolean(section.other);
|
|
177
|
+
const cells = [
|
|
178
|
+
...section.options.map((o) => ({ ...o, other: false })),
|
|
179
|
+
...(onOtherChange
|
|
180
|
+
? [{ value: '__other', label: otherLabel, other: true }]
|
|
181
|
+
: []),
|
|
182
|
+
];
|
|
183
|
+
return (
|
|
184
|
+
<View key={section.key} style={s.panel}>
|
|
185
|
+
<View style={s.head}>
|
|
186
|
+
<Text style={[s.index, s.openIndex]}>{pad(i + 1)}</Text>
|
|
187
|
+
<Text accessibilityRole="header" style={s.eyebrow}>
|
|
188
|
+
{section.label}
|
|
189
|
+
</Text>
|
|
190
|
+
{section.hint ? <Text style={s.hint}>{section.hint}</Text> : null}
|
|
191
|
+
</View>
|
|
192
|
+
<Text style={s.question}>{section.question}</Text>
|
|
193
|
+
<View accessibilityRole="list" style={s.grid}>
|
|
194
|
+
{cells.map((cell, c) => {
|
|
195
|
+
const picked = cell.other
|
|
196
|
+
? otherOn
|
|
197
|
+
: section.value.includes(cell.value);
|
|
198
|
+
return (
|
|
199
|
+
<PressableBase
|
|
200
|
+
key={cell.value}
|
|
201
|
+
accessibilityRole="checkbox"
|
|
202
|
+
accessibilityState={{ checked: picked }}
|
|
203
|
+
accessibilityLabel={cell.label}
|
|
204
|
+
onPress={() => {
|
|
205
|
+
if (cell.other) {
|
|
206
|
+
if (otherOn) {
|
|
207
|
+
setTyping(null);
|
|
208
|
+
onOtherChange?.(section.key, '');
|
|
209
|
+
} else {
|
|
210
|
+
setTyping(section.key);
|
|
211
|
+
}
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const next = picked
|
|
215
|
+
? section.value.filter((v) => v !== cell.value)
|
|
216
|
+
: section.value.length < max
|
|
217
|
+
? [...section.value, cell.value]
|
|
218
|
+
: [...section.value];
|
|
219
|
+
onValueChange(section.key, next);
|
|
220
|
+
}}
|
|
221
|
+
style={[s.cell, c % 2 === 1 && s.right, picked && s.picked]}
|
|
222
|
+
>
|
|
223
|
+
<Text
|
|
224
|
+
numberOfLines={1}
|
|
225
|
+
style={[
|
|
226
|
+
s.cellText,
|
|
227
|
+
cell.other && !picked && s.otherText,
|
|
228
|
+
picked && s.pickedText,
|
|
229
|
+
]}
|
|
230
|
+
>
|
|
231
|
+
{cell.label}
|
|
232
|
+
</Text>
|
|
233
|
+
{picked ? <View style={s.dot} /> : null}
|
|
234
|
+
</PressableBase>
|
|
235
|
+
);
|
|
236
|
+
})}
|
|
237
|
+
</View>
|
|
238
|
+
{otherOn ? (
|
|
239
|
+
<TextInput
|
|
240
|
+
value={section.other ?? ''}
|
|
241
|
+
onChangeText={(text) => onOtherChange?.(section.key, text)}
|
|
242
|
+
maxLength={otherMax}
|
|
243
|
+
autoFocus={typing === section.key && !section.other}
|
|
244
|
+
accessibilityLabel={`${section.label} ${otherLabel}`}
|
|
245
|
+
placeholderTextColor={t.colors.ring}
|
|
246
|
+
style={s.input}
|
|
247
|
+
/>
|
|
248
|
+
) : null}
|
|
249
|
+
</View>
|
|
250
|
+
);
|
|
251
|
+
})}
|
|
252
|
+
</View>
|
|
253
|
+
);
|
|
254
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { View, type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
import { Divider } from '../../components/divider/divider';
|
|
3
|
+
import { Slider } from '../../components/slider/slider';
|
|
4
|
+
import { Text } from '../../components/text/text';
|
|
5
|
+
import { makeStyles } from '../../utils/styles';
|
|
6
|
+
|
|
7
|
+
export type SliderListItem = {
|
|
8
|
+
key: string;
|
|
9
|
+
label: string;
|
|
10
|
+
startLabel: string;
|
|
11
|
+
endLabel: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type SliderListProps = {
|
|
15
|
+
items: readonly SliderListItem[];
|
|
16
|
+
values: Readonly<Record<string, number>>;
|
|
17
|
+
min?: number;
|
|
18
|
+
max?: number;
|
|
19
|
+
onChange: (key: string, value: number) => void;
|
|
20
|
+
style?: StyleProp<ViewStyle>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const useStyles = makeStyles((t) => ({
|
|
24
|
+
row: { paddingTop: t.space[2], gap: t.space[1] },
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
export function SliderList({
|
|
28
|
+
items,
|
|
29
|
+
values,
|
|
30
|
+
min = 0,
|
|
31
|
+
max = 1,
|
|
32
|
+
onChange,
|
|
33
|
+
style,
|
|
34
|
+
}: SliderListProps) {
|
|
35
|
+
const s = useStyles();
|
|
36
|
+
return (
|
|
37
|
+
<View style={style}>
|
|
38
|
+
{items.map((item) => (
|
|
39
|
+
<View key={item.key}>
|
|
40
|
+
<Divider />
|
|
41
|
+
<View style={s.row}>
|
|
42
|
+
<Text weight="medium">{item.label}</Text>
|
|
43
|
+
<Slider
|
|
44
|
+
value={values[item.key] ?? min}
|
|
45
|
+
min={min}
|
|
46
|
+
max={max}
|
|
47
|
+
onChange={(value) => onChange(item.key, value)}
|
|
48
|
+
startLabel={item.startLabel}
|
|
49
|
+
endLabel={item.endLabel}
|
|
50
|
+
accessibilityLabel={item.label}
|
|
51
|
+
/>
|
|
52
|
+
</View>
|
|
53
|
+
</View>
|
|
54
|
+
))}
|
|
55
|
+
</View>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
@@ -56,8 +56,8 @@ const useStyles = makeStyles((t) => ({
|
|
|
56
56
|
paddingBottom: t.layout.footerBottom,
|
|
57
57
|
},
|
|
58
58
|
title: {
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
...t.typography.screenTitle,
|
|
60
|
+
color: t.colors.title,
|
|
61
61
|
},
|
|
62
62
|
footer: {
|
|
63
63
|
gap: t.layout.itemGap,
|
|
@@ -136,7 +136,7 @@ export function StepScreen({
|
|
|
136
136
|
keyboardShouldPersistTaps="handled"
|
|
137
137
|
>
|
|
138
138
|
{top}
|
|
139
|
-
<Text
|
|
139
|
+
<Text accessibilityRole="header" style={s.title}>
|
|
140
140
|
{title}
|
|
141
141
|
</Text>
|
|
142
142
|
{children}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
1
2
|
import { Text, View } from 'react-native';
|
|
2
3
|
import { CheckGlyph, ChevronGlyph } from '../../internal/glyphs';
|
|
3
4
|
import { renderIcon, type IconSlot } from '../../internal/icon';
|
|
@@ -8,6 +9,7 @@ import {
|
|
|
8
9
|
import { useTheme } from '../../theme/theme-provider';
|
|
9
10
|
import { makeStyles } from '../../utils/styles';
|
|
10
11
|
import { Photo } from '../photo/photo';
|
|
12
|
+
import { FlushRowContext } from '../../internal/flush-row';
|
|
11
13
|
|
|
12
14
|
export type ListRowTone = 'muted' | 'warning' | 'danger';
|
|
13
15
|
|
|
@@ -48,6 +50,7 @@ const useStyles = makeStyles((t) => ({
|
|
|
48
50
|
},
|
|
49
51
|
twoLine: { minHeight: t.listRow.twoLine },
|
|
50
52
|
threeLine: { minHeight: t.listRow.threeLine },
|
|
53
|
+
flush: { paddingHorizontal: 0 },
|
|
51
54
|
pressed: { backgroundColor: t.colors.muted },
|
|
52
55
|
highlighted: { backgroundColor: t.colors.primaryTint },
|
|
53
56
|
top: { alignItems: 'flex-start' },
|
|
@@ -123,6 +126,7 @@ export function ListRow({
|
|
|
123
126
|
}: ListRowProps) {
|
|
124
127
|
const t = useTheme();
|
|
125
128
|
const s = useStyles();
|
|
129
|
+
const flush = useContext(FlushRowContext);
|
|
126
130
|
const icon = { color: t.colors.mutedForeground, size: t.iconSize.md };
|
|
127
131
|
const showChevron = chevron ?? !!onPress;
|
|
128
132
|
const lines = [overline, description].filter(Boolean).length;
|
|
@@ -228,6 +232,7 @@ export function ListRow({
|
|
|
228
232
|
<View
|
|
229
233
|
style={[
|
|
230
234
|
s.row,
|
|
235
|
+
flush && s.flush,
|
|
231
236
|
height,
|
|
232
237
|
meta && s.top,
|
|
233
238
|
highlighted && s.highlighted,
|
|
@@ -246,6 +251,7 @@ export function ListRow({
|
|
|
246
251
|
pressedStyle={s.pressed}
|
|
247
252
|
style={[
|
|
248
253
|
s.row,
|
|
254
|
+
flush && s.flush,
|
|
249
255
|
height,
|
|
250
256
|
meta && s.top,
|
|
251
257
|
highlighted && s.highlighted,
|
|
@@ -34,6 +34,9 @@ const useStyles = makeStyles((t) => ({
|
|
|
34
34
|
title: {
|
|
35
35
|
fontSize: t.typography.display.fontSize,
|
|
36
36
|
lineHeight: t.typography.display.lineHeight,
|
|
37
|
+
fontWeight: t.typography.screenTitle.fontWeight,
|
|
38
|
+
letterSpacing: t.typography.screenTitle.letterSpacing,
|
|
39
|
+
color: t.colors.title,
|
|
37
40
|
},
|
|
38
41
|
action: {
|
|
39
42
|
width: t.minTouchSize,
|
|
@@ -98,7 +101,7 @@ export function PageHeader({
|
|
|
98
101
|
const s = useStyles();
|
|
99
102
|
return (
|
|
100
103
|
<View style={[s.root, { paddingTop: t.space[5] + topInset }, style]}>
|
|
101
|
-
<Text
|
|
104
|
+
<Text accessibilityRole="header" style={s.title}>
|
|
102
105
|
{title}
|
|
103
106
|
</Text>
|
|
104
107
|
{action && !action.icon ? (
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { View, type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
import { PressableBase } from '../../internal/pressable-base';
|
|
3
|
+
import { useTheme } from '../../theme/theme-provider';
|
|
4
|
+
import { makeStyles } from '../../utils/styles';
|
|
5
|
+
import { Text } from '../text/text';
|
|
6
|
+
|
|
7
|
+
export type SectionTabsItem<T extends string> = {
|
|
8
|
+
value: T;
|
|
9
|
+
label: string;
|
|
10
|
+
dot?: boolean;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type SectionTabsProps<T extends string> = {
|
|
14
|
+
items: readonly SectionTabsItem<T>[];
|
|
15
|
+
value: T;
|
|
16
|
+
onValueChange: (value: T) => void;
|
|
17
|
+
style?: StyleProp<ViewStyle>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const DOT = 6;
|
|
21
|
+
|
|
22
|
+
const useStyles = makeStyles((t) => ({
|
|
23
|
+
row: {
|
|
24
|
+
flexDirection: 'row',
|
|
25
|
+
paddingHorizontal: t.space[2],
|
|
26
|
+
backgroundColor: t.colors.surface,
|
|
27
|
+
borderBottomWidth: 1,
|
|
28
|
+
borderBottomColor: t.colors.border,
|
|
29
|
+
},
|
|
30
|
+
tab: {
|
|
31
|
+
flex: 1,
|
|
32
|
+
height: t.minTouchSize,
|
|
33
|
+
flexDirection: 'row',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
justifyContent: 'center',
|
|
36
|
+
gap: t.space[1],
|
|
37
|
+
borderBottomWidth: 2,
|
|
38
|
+
borderBottomColor: 'transparent',
|
|
39
|
+
},
|
|
40
|
+
selected: { borderBottomColor: t.colors.foreground },
|
|
41
|
+
dot: {
|
|
42
|
+
width: DOT,
|
|
43
|
+
height: DOT,
|
|
44
|
+
borderRadius: t.radius.full,
|
|
45
|
+
backgroundColor: t.colors.danger,
|
|
46
|
+
},
|
|
47
|
+
}));
|
|
48
|
+
|
|
49
|
+
export function SectionTabs<T extends string>({
|
|
50
|
+
items,
|
|
51
|
+
value,
|
|
52
|
+
onValueChange,
|
|
53
|
+
style,
|
|
54
|
+
}: SectionTabsProps<T>) {
|
|
55
|
+
const t = useTheme();
|
|
56
|
+
const s = useStyles();
|
|
57
|
+
return (
|
|
58
|
+
<View accessibilityRole="tablist" style={[s.row, style]}>
|
|
59
|
+
{items.map((item) => {
|
|
60
|
+
const selected = item.value === value;
|
|
61
|
+
return (
|
|
62
|
+
<PressableBase
|
|
63
|
+
key={item.value}
|
|
64
|
+
accessibilityRole="tab"
|
|
65
|
+
accessibilityState={{ selected }}
|
|
66
|
+
accessibilityLabel={
|
|
67
|
+
item.dot ? `${item.label}, 확인 필요` : item.label
|
|
68
|
+
}
|
|
69
|
+
pressedStyle={{}}
|
|
70
|
+
onPress={() => onValueChange(item.value)}
|
|
71
|
+
style={[s.tab, selected && s.selected]}
|
|
72
|
+
>
|
|
73
|
+
<Text
|
|
74
|
+
numberOfLines={1}
|
|
75
|
+
maxFontSizeMultiplier={t.maxFontScale}
|
|
76
|
+
weight={selected ? 'bold' : undefined}
|
|
77
|
+
tone={selected ? undefined : 'muted'}
|
|
78
|
+
>
|
|
79
|
+
{item.label}
|
|
80
|
+
</Text>
|
|
81
|
+
{item.dot ? <View style={s.dot} /> : null}
|
|
82
|
+
</PressableBase>
|
|
83
|
+
);
|
|
84
|
+
})}
|
|
85
|
+
</View>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
@@ -25,6 +25,7 @@ const useStyles = makeStyles((t) => ({
|
|
|
25
25
|
screenTitle: t.typography.screenTitle,
|
|
26
26
|
display: t.typography.display,
|
|
27
27
|
default: { color: t.colors.foreground },
|
|
28
|
+
heading: { color: t.colors.title },
|
|
28
29
|
muted: { color: t.colors.mutedForeground },
|
|
29
30
|
primary: { color: t.colors.primary },
|
|
30
31
|
point: { color: t.colors.point },
|
|
@@ -51,7 +52,14 @@ export function Text({
|
|
|
51
52
|
<RNText
|
|
52
53
|
maxFontSizeMultiplier={t.maxFontScale}
|
|
53
54
|
{...rest}
|
|
54
|
-
style={[
|
|
55
|
+
style={[
|
|
56
|
+
s.font,
|
|
57
|
+
s[variant],
|
|
58
|
+
s[tone],
|
|
59
|
+
variant === 'screenTitle' && tone === 'default' && s.heading,
|
|
60
|
+
weight && s[weight],
|
|
61
|
+
style,
|
|
62
|
+
]}
|
|
55
63
|
/>
|
|
56
64
|
);
|
|
57
65
|
}
|
package/src/index.tsx
CHANGED
|
@@ -75,6 +75,7 @@ export * from './components/progress-circle';
|
|
|
75
75
|
export * from './components/result-mark';
|
|
76
76
|
export * from './components/page-header';
|
|
77
77
|
export * from './blocks/setup-guide';
|
|
78
|
+
export * from './components/section-tabs';
|
|
78
79
|
export * from './components/segmented-tabs';
|
|
79
80
|
export * from './components/sheet';
|
|
80
81
|
export * from './components/skeleton';
|
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';
|