@ezpg/app-ui 0.20.0 → 0.21.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 +14 -0
- package/lib/module/blocks/choice-art/choice-art.js +589 -0
- package/lib/module/blocks/choice-art/choice-art.js.map +1 -0
- package/lib/module/blocks/choice-art/index.js +4 -0
- package/lib/module/blocks/choice-art/index.js.map +1 -0
- package/lib/module/blocks/index.js +1 -0
- package/lib/module/blocks/index.js.map +1 -1
- package/lib/module/components/page-header/page-header.js +25 -1
- package/lib/module/components/page-header/page-header.js.map +1 -1
- package/lib/module/components/toast/index.js.map +1 -1
- package/lib/module/components/toast/toast.js +8 -4
- package/lib/module/components/toast/toast.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/glyphs.js +457 -0
- package/lib/module/internal/glyphs.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/preview-edit-template.js +422 -0
- package/lib/module/templates/preview-edit-template.js.map +1 -0
- package/lib/typescript/src/blocks/choice-art/choice-art.d.ts +73 -0
- package/lib/typescript/src/blocks/choice-art/choice-art.d.ts.map +1 -0
- package/lib/typescript/src/blocks/choice-art/index.d.ts +2 -0
- package/lib/typescript/src/blocks/choice-art/index.d.ts.map +1 -0
- package/lib/typescript/src/blocks/index.d.ts +1 -0
- package/lib/typescript/src/blocks/index.d.ts.map +1 -1
- package/lib/typescript/src/components/page-header/page-header.d.ts +1 -0
- package/lib/typescript/src/components/page-header/page-header.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/index.d.ts +1 -1
- package/lib/typescript/src/components/toast/index.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/toast.d.ts +4 -1
- package/lib/typescript/src/components/toast/toast.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/internal/glyphs.d.ts +12 -0
- package/lib/typescript/src/internal/glyphs.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/preview-edit-template.d.ts +39 -0
- package/lib/typescript/src/templates/preview-edit-template.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/blocks/choice-art/choice-art.tsx +500 -0
- package/src/blocks/choice-art/index.ts +29 -0
- package/src/blocks/index.tsx +1 -0
- package/src/components/page-header/page-header.tsx +28 -1
- package/src/components/toast/index.ts +1 -0
- package/src/components/toast/toast.tsx +12 -4
- package/src/index.tsx +12 -0
- package/src/internal/glyphs.tsx +409 -0
- package/src/templates/index.ts +7 -0
- package/src/templates/preview-edit-template.tsx +467 -0
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
import { Text as RNText, View, type ViewStyle } from 'react-native';
|
|
2
|
+
import { CheckGlyph, ChevronGlyph, CloseGlyph } from '../../internal/glyphs';
|
|
3
|
+
import { haptic } from '../../internal/haptics';
|
|
4
|
+
import { PressableBase } from '../../internal/pressable-base';
|
|
5
|
+
import { useTheme } from '../../theme/theme-provider';
|
|
6
|
+
import { makeStyles } from '../../utils/styles';
|
|
7
|
+
|
|
8
|
+
export type ColumnsArtProps = { count: number; color: string };
|
|
9
|
+
|
|
10
|
+
export type RatioArtProps = { width: number; height: number; color: string };
|
|
11
|
+
|
|
12
|
+
export type LevelsArtProps = { levels: readonly number[]; color: string };
|
|
13
|
+
|
|
14
|
+
export type SlashArtProps = { color: string };
|
|
15
|
+
|
|
16
|
+
export type PlacementSpot = 'center' | 'corner' | 'band';
|
|
17
|
+
|
|
18
|
+
export type PlacementArtProps = {
|
|
19
|
+
spot: PlacementSpot;
|
|
20
|
+
color: string;
|
|
21
|
+
scale?: number;
|
|
22
|
+
dim?: boolean;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type PlacementThumbProps = {
|
|
26
|
+
spot: PlacementSpot;
|
|
27
|
+
scale?: number;
|
|
28
|
+
dim?: boolean;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type FooterArtProps = { text: boolean; color: string };
|
|
32
|
+
|
|
33
|
+
export type SampleArtProps = { text: string; color: string; strike?: boolean };
|
|
34
|
+
|
|
35
|
+
export type FieldArtProps = { shown: boolean; color: string };
|
|
36
|
+
|
|
37
|
+
export type FoldArtProps = { open: boolean; color: string };
|
|
38
|
+
|
|
39
|
+
export type ButtonArtProps = { text: number; color: string };
|
|
40
|
+
|
|
41
|
+
export type ChoiceChip = {
|
|
42
|
+
key: string;
|
|
43
|
+
label: string;
|
|
44
|
+
selected: boolean;
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
onPress: () => void;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type ChoiceChipsProps = { items: readonly ChoiceChip[] };
|
|
50
|
+
|
|
51
|
+
const useStyles = makeStyles((t) => ({
|
|
52
|
+
box: {
|
|
53
|
+
width: t.space[10],
|
|
54
|
+
height: t.space[6],
|
|
55
|
+
flexDirection: 'row',
|
|
56
|
+
gap: t.space[1],
|
|
57
|
+
},
|
|
58
|
+
levels: {
|
|
59
|
+
width: t.space[10],
|
|
60
|
+
height: t.space[6],
|
|
61
|
+
flexDirection: 'row',
|
|
62
|
+
alignItems: 'flex-end',
|
|
63
|
+
justifyContent: 'center',
|
|
64
|
+
gap: t.space[1],
|
|
65
|
+
},
|
|
66
|
+
bar: { flex: 1, borderRadius: t.space[1] / 2 },
|
|
67
|
+
level: { width: t.space[2], borderRadius: t.space[1] / 2 },
|
|
68
|
+
ratio: {
|
|
69
|
+
height: t.space[8],
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
justifyContent: 'center',
|
|
72
|
+
},
|
|
73
|
+
frame: { height: t.space[8], borderRadius: t.space[1] / 2 },
|
|
74
|
+
sample: {
|
|
75
|
+
fontFamily: t.fontFamily,
|
|
76
|
+
fontSize: t.typography.label.fontSize,
|
|
77
|
+
lineHeight: t.space[6],
|
|
78
|
+
fontWeight: '600',
|
|
79
|
+
},
|
|
80
|
+
strike: { textDecorationLine: 'line-through' },
|
|
81
|
+
thumb: {
|
|
82
|
+
width: t.space[10] + t.space[2],
|
|
83
|
+
height: t.space[12] + t.space[2],
|
|
84
|
+
alignItems: 'center',
|
|
85
|
+
justifyContent: 'center',
|
|
86
|
+
borderRadius: t.radius.md,
|
|
87
|
+
backgroundColor: t.colors.recess,
|
|
88
|
+
},
|
|
89
|
+
thumbPhone: { width: t.space[6], height: t.space[10] },
|
|
90
|
+
pair: {
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
alignItems: 'flex-end',
|
|
93
|
+
gap: t.space[1] + t.space[1] / 2,
|
|
94
|
+
},
|
|
95
|
+
web: { width: t.space[12], height: t.space[8] },
|
|
96
|
+
phone: { width: t.space[4], height: t.space[8] },
|
|
97
|
+
outline: {
|
|
98
|
+
position: 'absolute',
|
|
99
|
+
left: 0,
|
|
100
|
+
right: 0,
|
|
101
|
+
top: 0,
|
|
102
|
+
bottom: 0,
|
|
103
|
+
borderWidth: 1.5,
|
|
104
|
+
borderRadius: t.space[1],
|
|
105
|
+
opacity: 0.55,
|
|
106
|
+
},
|
|
107
|
+
shade: {
|
|
108
|
+
position: 'absolute',
|
|
109
|
+
left: 0,
|
|
110
|
+
right: 0,
|
|
111
|
+
top: 0,
|
|
112
|
+
bottom: 0,
|
|
113
|
+
borderRadius: t.space[1],
|
|
114
|
+
opacity: 0.22,
|
|
115
|
+
},
|
|
116
|
+
spot: { position: 'absolute', borderRadius: t.space[1] / 2 },
|
|
117
|
+
footer: {
|
|
118
|
+
width: t.space[12],
|
|
119
|
+
height: t.space[6],
|
|
120
|
+
flexDirection: 'row',
|
|
121
|
+
alignItems: 'center',
|
|
122
|
+
justifyContent: 'flex-end',
|
|
123
|
+
gap: t.space[2],
|
|
124
|
+
paddingHorizontal: t.space[1],
|
|
125
|
+
borderTopWidth: 1.5,
|
|
126
|
+
},
|
|
127
|
+
footerText: {
|
|
128
|
+
flex: 1,
|
|
129
|
+
height: t.space[1],
|
|
130
|
+
borderRadius: t.space[1],
|
|
131
|
+
},
|
|
132
|
+
slash: {
|
|
133
|
+
width: t.space[6],
|
|
134
|
+
height: t.space[6],
|
|
135
|
+
alignItems: 'center',
|
|
136
|
+
justifyContent: 'center',
|
|
137
|
+
borderWidth: 1.5,
|
|
138
|
+
borderRadius: t.space[1] / 2,
|
|
139
|
+
overflow: 'hidden',
|
|
140
|
+
},
|
|
141
|
+
slashLine: {
|
|
142
|
+
width: t.space[8],
|
|
143
|
+
height: 1.5,
|
|
144
|
+
transform: [{ rotate: '-45deg' }],
|
|
145
|
+
},
|
|
146
|
+
form: {
|
|
147
|
+
width: t.space[12],
|
|
148
|
+
height: t.space[8],
|
|
149
|
+
gap: t.space[1],
|
|
150
|
+
},
|
|
151
|
+
field: {
|
|
152
|
+
flex: 1,
|
|
153
|
+
justifyContent: 'center',
|
|
154
|
+
paddingHorizontal: t.space[1],
|
|
155
|
+
borderWidth: 1.5,
|
|
156
|
+
borderRadius: t.space[1] / 2,
|
|
157
|
+
},
|
|
158
|
+
fieldGone: { borderStyle: 'dashed', opacity: 0.45 },
|
|
159
|
+
ink: { width: '50%', height: t.space[1] / 2, borderRadius: t.space[1] },
|
|
160
|
+
fold: {
|
|
161
|
+
width: t.space[12],
|
|
162
|
+
height: t.space[8],
|
|
163
|
+
gap: t.space[1],
|
|
164
|
+
},
|
|
165
|
+
foldHead: {
|
|
166
|
+
height: t.space[3] + t.space[1] / 2,
|
|
167
|
+
flexDirection: 'row',
|
|
168
|
+
alignItems: 'center',
|
|
169
|
+
gap: t.space[1],
|
|
170
|
+
paddingHorizontal: t.space[1],
|
|
171
|
+
borderWidth: 1.5,
|
|
172
|
+
borderRadius: t.space[1] / 2,
|
|
173
|
+
},
|
|
174
|
+
foldBody: {
|
|
175
|
+
flex: 1,
|
|
176
|
+
justifyContent: 'center',
|
|
177
|
+
gap: t.space[1] / 2,
|
|
178
|
+
paddingHorizontal: t.space[1],
|
|
179
|
+
borderRadius: t.space[1] / 2,
|
|
180
|
+
},
|
|
181
|
+
foldEdge: { borderWidth: 1.5 },
|
|
182
|
+
grow: { flex: 1 },
|
|
183
|
+
button: {
|
|
184
|
+
width: t.space[12] + t.space[2],
|
|
185
|
+
height: t.space[5],
|
|
186
|
+
alignItems: 'center',
|
|
187
|
+
justifyContent: 'center',
|
|
188
|
+
borderWidth: 1.5,
|
|
189
|
+
borderRadius: t.radius.full,
|
|
190
|
+
},
|
|
191
|
+
buttonText: { height: t.space[1] / 2, borderRadius: t.space[1] },
|
|
192
|
+
paper: {
|
|
193
|
+
width: t.space[6] + t.space[1],
|
|
194
|
+
height: t.space[10],
|
|
195
|
+
justifyContent: 'flex-end',
|
|
196
|
+
gap: t.space[1] / 2,
|
|
197
|
+
padding: t.space[1],
|
|
198
|
+
borderRadius: t.space[1] / 2,
|
|
199
|
+
backgroundColor: t.colors.surface,
|
|
200
|
+
},
|
|
201
|
+
paperLine: {
|
|
202
|
+
height: t.space[1],
|
|
203
|
+
borderRadius: t.space[1],
|
|
204
|
+
backgroundColor: t.colors.border,
|
|
205
|
+
},
|
|
206
|
+
paperShort: { width: '60%' },
|
|
207
|
+
paperButton: {
|
|
208
|
+
height: t.space[1],
|
|
209
|
+
marginTop: t.space[1],
|
|
210
|
+
borderRadius: t.space[1],
|
|
211
|
+
backgroundColor: t.colors.faint,
|
|
212
|
+
},
|
|
213
|
+
chips: { flexDirection: 'row', flexWrap: 'wrap', gap: t.space[2] },
|
|
214
|
+
chip: {
|
|
215
|
+
height: t.space[8] + t.space[1],
|
|
216
|
+
flexDirection: 'row',
|
|
217
|
+
alignItems: 'center',
|
|
218
|
+
gap: t.space[1],
|
|
219
|
+
paddingHorizontal: t.space[3],
|
|
220
|
+
borderRadius: t.radius.full,
|
|
221
|
+
borderWidth: 1.5,
|
|
222
|
+
borderColor: t.colors.line,
|
|
223
|
+
backgroundColor: t.colors.surface,
|
|
224
|
+
},
|
|
225
|
+
chipOn: {
|
|
226
|
+
borderColor: t.colors.primaryEdge,
|
|
227
|
+
backgroundColor: t.colors.selectSurface,
|
|
228
|
+
},
|
|
229
|
+
chipLabel: {
|
|
230
|
+
fontFamily: t.fontFamily,
|
|
231
|
+
fontSize: t.typography.eyebrow.fontSize,
|
|
232
|
+
lineHeight: t.typography.eyebrow.lineHeight,
|
|
233
|
+
fontWeight: '400',
|
|
234
|
+
color: t.colors.title,
|
|
235
|
+
},
|
|
236
|
+
chipLabelOn: { fontWeight: '600', color: t.colors.selectForeground },
|
|
237
|
+
}));
|
|
238
|
+
|
|
239
|
+
export function ColumnsArt({ count, color }: ColumnsArtProps) {
|
|
240
|
+
const s = useStyles();
|
|
241
|
+
return (
|
|
242
|
+
<View style={s.box}>
|
|
243
|
+
{Array.from({ length: count }, (_, i) => (
|
|
244
|
+
<View key={i} style={[s.bar, { backgroundColor: color }]} />
|
|
245
|
+
))}
|
|
246
|
+
</View>
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export function RatioArt({ width, height, color }: RatioArtProps) {
|
|
251
|
+
const s = useStyles();
|
|
252
|
+
return (
|
|
253
|
+
<View style={s.ratio}>
|
|
254
|
+
<View
|
|
255
|
+
style={[
|
|
256
|
+
s.frame,
|
|
257
|
+
{ aspectRatio: width / height, backgroundColor: color },
|
|
258
|
+
]}
|
|
259
|
+
/>
|
|
260
|
+
</View>
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export function LevelsArt({ levels, color }: LevelsArtProps) {
|
|
265
|
+
const s = useStyles();
|
|
266
|
+
const top = Math.max(1, ...levels);
|
|
267
|
+
return (
|
|
268
|
+
<View style={s.levels}>
|
|
269
|
+
{levels.map((level, i) => (
|
|
270
|
+
<View
|
|
271
|
+
key={i}
|
|
272
|
+
style={[
|
|
273
|
+
s.level,
|
|
274
|
+
{ height: `${(level / top) * 100}%`, backgroundColor: color },
|
|
275
|
+
]}
|
|
276
|
+
/>
|
|
277
|
+
))}
|
|
278
|
+
</View>
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export function SampleArt({ text, color, strike }: SampleArtProps) {
|
|
283
|
+
const t = useTheme();
|
|
284
|
+
const s = useStyles();
|
|
285
|
+
return (
|
|
286
|
+
<RNText
|
|
287
|
+
numberOfLines={1}
|
|
288
|
+
maxFontSizeMultiplier={t.maxFontScale}
|
|
289
|
+
style={[s.sample, strike && s.strike, { color }]}
|
|
290
|
+
>
|
|
291
|
+
{text}
|
|
292
|
+
</RNText>
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export function SlashArt({ color }: SlashArtProps) {
|
|
297
|
+
const s = useStyles();
|
|
298
|
+
return (
|
|
299
|
+
<View style={[s.slash, { borderColor: color }]}>
|
|
300
|
+
<View style={[s.slashLine, { backgroundColor: color }]} />
|
|
301
|
+
</View>
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const EDGE = 3;
|
|
306
|
+
|
|
307
|
+
function spotBox(
|
|
308
|
+
spot: PlacementSpot,
|
|
309
|
+
phone: boolean,
|
|
310
|
+
scale: number
|
|
311
|
+
): ViewStyle {
|
|
312
|
+
const grow = (n: number) => `${Math.min(100, n * scale)}%` as const;
|
|
313
|
+
if (spot === 'band') {
|
|
314
|
+
return { left: 0, right: 0, bottom: 0, height: grow(22) };
|
|
315
|
+
}
|
|
316
|
+
if (spot === 'corner') {
|
|
317
|
+
return phone
|
|
318
|
+
? { left: 0, right: 0, bottom: 0, height: grow(36) }
|
|
319
|
+
: { right: EDGE, bottom: EDGE, width: grow(32), height: grow(50) };
|
|
320
|
+
}
|
|
321
|
+
const width = phone ? 78 * Math.min(1, scale) : 40 * scale;
|
|
322
|
+
const height = phone ? 38 * scale : 46 * scale;
|
|
323
|
+
return {
|
|
324
|
+
left: `${(100 - Math.min(100, width)) / 2}%`,
|
|
325
|
+
top: `${(100 - Math.min(100, height)) / 2}%`,
|
|
326
|
+
width: `${Math.min(100, width)}%`,
|
|
327
|
+
height: `${Math.min(100, height)}%`,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
function Screen({
|
|
332
|
+
phone,
|
|
333
|
+
spot,
|
|
334
|
+
color,
|
|
335
|
+
scale,
|
|
336
|
+
dim,
|
|
337
|
+
style,
|
|
338
|
+
}: Required<PlacementArtProps> & { phone: boolean; style?: ViewStyle }) {
|
|
339
|
+
const s = useStyles();
|
|
340
|
+
return (
|
|
341
|
+
<View style={style ?? (phone ? s.phone : s.web)}>
|
|
342
|
+
{dim ? <View style={[s.shade, { backgroundColor: color }]} /> : null}
|
|
343
|
+
<View style={[s.outline, { borderColor: color }]} />
|
|
344
|
+
<View
|
|
345
|
+
style={[
|
|
346
|
+
s.spot,
|
|
347
|
+
spotBox(spot, phone, scale),
|
|
348
|
+
{ backgroundColor: color },
|
|
349
|
+
]}
|
|
350
|
+
/>
|
|
351
|
+
</View>
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
export function PlacementArt({
|
|
356
|
+
spot,
|
|
357
|
+
color,
|
|
358
|
+
scale = 1,
|
|
359
|
+
dim = false,
|
|
360
|
+
}: PlacementArtProps) {
|
|
361
|
+
const s = useStyles();
|
|
362
|
+
return (
|
|
363
|
+
<View style={s.pair}>
|
|
364
|
+
<Screen phone={false} spot={spot} color={color} scale={scale} dim={dim} />
|
|
365
|
+
<Screen phone spot={spot} color={color} scale={scale} dim={dim} />
|
|
366
|
+
</View>
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export function FooterArt({ text, color }: FooterArtProps) {
|
|
371
|
+
const t = useTheme();
|
|
372
|
+
const s = useStyles();
|
|
373
|
+
return (
|
|
374
|
+
<View style={[s.footer, { borderTopColor: color }]}>
|
|
375
|
+
{text ? (
|
|
376
|
+
<View style={[s.footerText, { backgroundColor: color }]} />
|
|
377
|
+
) : null}
|
|
378
|
+
<CloseGlyph color={color} size={t.iconSize.sm} />
|
|
379
|
+
</View>
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export function PlacementThumb({
|
|
384
|
+
spot,
|
|
385
|
+
scale = 1,
|
|
386
|
+
dim = false,
|
|
387
|
+
}: PlacementThumbProps) {
|
|
388
|
+
const t = useTheme();
|
|
389
|
+
const s = useStyles();
|
|
390
|
+
return (
|
|
391
|
+
<View style={s.thumb}>
|
|
392
|
+
<Screen
|
|
393
|
+
phone
|
|
394
|
+
spot={spot}
|
|
395
|
+
color={t.colors.faint}
|
|
396
|
+
scale={scale}
|
|
397
|
+
dim={dim}
|
|
398
|
+
style={s.thumbPhone}
|
|
399
|
+
/>
|
|
400
|
+
</View>
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export function FieldArt({ shown, color }: FieldArtProps) {
|
|
405
|
+
const s = useStyles();
|
|
406
|
+
return (
|
|
407
|
+
<View style={s.form}>
|
|
408
|
+
<View style={[s.field, { borderColor: color }]}>
|
|
409
|
+
<View style={[s.ink, { backgroundColor: color }]} />
|
|
410
|
+
</View>
|
|
411
|
+
<View style={[s.field, !shown && s.fieldGone, { borderColor: color }]}>
|
|
412
|
+
{shown ? <View style={[s.ink, { backgroundColor: color }]} /> : null}
|
|
413
|
+
</View>
|
|
414
|
+
</View>
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
export function FoldArt({ open, color }: FoldArtProps) {
|
|
419
|
+
const t = useTheme();
|
|
420
|
+
const s = useStyles();
|
|
421
|
+
return (
|
|
422
|
+
<View style={s.fold}>
|
|
423
|
+
<View style={[s.foldHead, { borderColor: color }]}>
|
|
424
|
+
<View style={[s.grow, s.ink, { backgroundColor: color }]} />
|
|
425
|
+
<View style={{ transform: [{ rotate: open ? '-90deg' : '90deg' }] }}>
|
|
426
|
+
<ChevronGlyph color={color} size={t.space[2]} />
|
|
427
|
+
</View>
|
|
428
|
+
</View>
|
|
429
|
+
{open ? (
|
|
430
|
+
<View style={[s.foldBody, s.foldEdge, { borderColor: color }]}>
|
|
431
|
+
<View style={[s.ink, { backgroundColor: color }]} />
|
|
432
|
+
<View style={[s.ink, { width: '30%', backgroundColor: color }]} />
|
|
433
|
+
</View>
|
|
434
|
+
) : null}
|
|
435
|
+
</View>
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
export function ButtonArt({ text, color }: ButtonArtProps) {
|
|
440
|
+
const s = useStyles();
|
|
441
|
+
const width = `${Math.round(Math.min(1, Math.max(0, text)) * 100)}%` as const;
|
|
442
|
+
return (
|
|
443
|
+
<View style={[s.button, { borderColor: color }]}>
|
|
444
|
+
<View style={[s.buttonText, { width, backgroundColor: color }]} />
|
|
445
|
+
</View>
|
|
446
|
+
);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
export function FormThumb() {
|
|
450
|
+
const s = useStyles();
|
|
451
|
+
return (
|
|
452
|
+
<View style={s.thumb}>
|
|
453
|
+
<View style={s.paper}>
|
|
454
|
+
<View style={s.paperLine} />
|
|
455
|
+
<View style={s.paperLine} />
|
|
456
|
+
<View style={s.paperLine} />
|
|
457
|
+
<View style={[s.paperLine, s.paperShort]} />
|
|
458
|
+
<View style={s.paperButton} />
|
|
459
|
+
</View>
|
|
460
|
+
</View>
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export function ChoiceChips({ items }: ChoiceChipsProps) {
|
|
465
|
+
const t = useTheme();
|
|
466
|
+
const s = useStyles();
|
|
467
|
+
return (
|
|
468
|
+
<View style={s.chips}>
|
|
469
|
+
{items.map((item) => (
|
|
470
|
+
<PressableBase
|
|
471
|
+
key={item.key}
|
|
472
|
+
accessibilityRole="checkbox"
|
|
473
|
+
accessibilityLabel={item.label}
|
|
474
|
+
accessibilityState={{
|
|
475
|
+
checked: item.selected,
|
|
476
|
+
disabled: item.disabled,
|
|
477
|
+
}}
|
|
478
|
+
feedback="small"
|
|
479
|
+
disabled={item.disabled}
|
|
480
|
+
onPress={() => {
|
|
481
|
+
haptic('select');
|
|
482
|
+
item.onPress();
|
|
483
|
+
}}
|
|
484
|
+
style={[s.chip, item.selected && s.chipOn]}
|
|
485
|
+
>
|
|
486
|
+
{item.selected ? (
|
|
487
|
+
<CheckGlyph color={t.colors.primaryEdge} size={t.iconSize.sm} />
|
|
488
|
+
) : null}
|
|
489
|
+
<RNText
|
|
490
|
+
numberOfLines={1}
|
|
491
|
+
maxFontSizeMultiplier={t.maxFontScale}
|
|
492
|
+
style={[s.chipLabel, item.selected && s.chipLabelOn]}
|
|
493
|
+
>
|
|
494
|
+
{item.label}
|
|
495
|
+
</RNText>
|
|
496
|
+
</PressableBase>
|
|
497
|
+
))}
|
|
498
|
+
</View>
|
|
499
|
+
);
|
|
500
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export {
|
|
2
|
+
ButtonArt,
|
|
3
|
+
ChoiceChips,
|
|
4
|
+
ColumnsArt,
|
|
5
|
+
FieldArt,
|
|
6
|
+
FoldArt,
|
|
7
|
+
FormThumb,
|
|
8
|
+
FooterArt,
|
|
9
|
+
PlacementArt,
|
|
10
|
+
PlacementThumb,
|
|
11
|
+
LevelsArt,
|
|
12
|
+
RatioArt,
|
|
13
|
+
SampleArt,
|
|
14
|
+
SlashArt,
|
|
15
|
+
type ButtonArtProps,
|
|
16
|
+
type ChoiceChip,
|
|
17
|
+
type ChoiceChipsProps,
|
|
18
|
+
type ColumnsArtProps,
|
|
19
|
+
type FieldArtProps,
|
|
20
|
+
type FoldArtProps,
|
|
21
|
+
type FooterArtProps,
|
|
22
|
+
type PlacementArtProps,
|
|
23
|
+
type PlacementThumbProps,
|
|
24
|
+
type PlacementSpot,
|
|
25
|
+
type LevelsArtProps,
|
|
26
|
+
type RatioArtProps,
|
|
27
|
+
type SampleArtProps,
|
|
28
|
+
type SlashArtProps,
|
|
29
|
+
} from './choice-art';
|
package/src/blocks/index.tsx
CHANGED
|
@@ -9,6 +9,7 @@ export type PageHeaderAction = {
|
|
|
9
9
|
icon?: IconSlot;
|
|
10
10
|
label: string;
|
|
11
11
|
badge?: boolean;
|
|
12
|
+
framed?: boolean;
|
|
12
13
|
onPress: () => void;
|
|
13
14
|
};
|
|
14
15
|
|
|
@@ -45,6 +46,16 @@ const useStyles = makeStyles((t) => ({
|
|
|
45
46
|
justifyContent: 'center',
|
|
46
47
|
},
|
|
47
48
|
text: { paddingHorizontal: t.space[2], width: 'auto' },
|
|
49
|
+
framed: {
|
|
50
|
+
height: t.space[8] + t.space[1],
|
|
51
|
+
marginVertical: -(t.space[1] / 2),
|
|
52
|
+
flexDirection: 'row',
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
gap: t.space[2],
|
|
55
|
+
paddingHorizontal: t.space[3],
|
|
56
|
+
borderRadius: t.radius.lg,
|
|
57
|
+
backgroundColor: t.colors.surface,
|
|
58
|
+
},
|
|
48
59
|
dot: {
|
|
49
60
|
position: 'absolute',
|
|
50
61
|
top: t.space[2] + t.space[1],
|
|
@@ -108,7 +119,23 @@ export function PageHeader({
|
|
|
108
119
|
<Text accessibilityRole="header" style={s.title}>
|
|
109
120
|
{title}
|
|
110
121
|
</Text>
|
|
111
|
-
{action &&
|
|
122
|
+
{action?.icon && action.framed ? (
|
|
123
|
+
<PressableBase
|
|
124
|
+
onPress={action.onPress}
|
|
125
|
+
accessibilityRole="button"
|
|
126
|
+
accessibilityLabel={action.label}
|
|
127
|
+
feedback="small"
|
|
128
|
+
style={s.framed}
|
|
129
|
+
>
|
|
130
|
+
{renderIcon(action.icon, {
|
|
131
|
+
color: t.colors.title,
|
|
132
|
+
size: t.iconSize.md,
|
|
133
|
+
})}
|
|
134
|
+
<Text variant="body" weight="medium">
|
|
135
|
+
{action.label}
|
|
136
|
+
</Text>
|
|
137
|
+
</PressableBase>
|
|
138
|
+
) : action && !action.icon ? (
|
|
112
139
|
<HeaderButton label={action.label} onPress={action.onPress} />
|
|
113
140
|
) : action ? (
|
|
114
141
|
<PressableBase
|
|
@@ -154,12 +154,20 @@ const useStyles = makeStyles((t) => ({
|
|
|
154
154
|
},
|
|
155
155
|
}));
|
|
156
156
|
|
|
157
|
-
export
|
|
157
|
+
export type ToastHostProps = { bottom?: number };
|
|
158
|
+
|
|
159
|
+
export function ToastHost({ bottom }: ToastHostProps = {}) {
|
|
158
160
|
const store = useContext(StoreContext);
|
|
159
|
-
return store ? <ToastHostInner store={store} /> : null;
|
|
161
|
+
return store ? <ToastHostInner store={store} bottom={bottom} /> : null;
|
|
160
162
|
}
|
|
161
163
|
|
|
162
|
-
function ToastHostInner({
|
|
164
|
+
function ToastHostInner({
|
|
165
|
+
store,
|
|
166
|
+
bottom,
|
|
167
|
+
}: {
|
|
168
|
+
store: ToastStore;
|
|
169
|
+
bottom?: number;
|
|
170
|
+
}) {
|
|
163
171
|
const t = useTheme();
|
|
164
172
|
const s = useStyles();
|
|
165
173
|
const id = useId();
|
|
@@ -211,7 +219,7 @@ function ToastHostInner({ store }: { store: ToastStore }) {
|
|
|
211
219
|
return (
|
|
212
220
|
<View
|
|
213
221
|
pointerEvents="box-none"
|
|
214
|
-
style={[s.layer, { bottom: t.space[4] + store.bottomInset }]}
|
|
222
|
+
style={[s.layer, { bottom: bottom ?? t.space[4] + store.bottomInset }]}
|
|
215
223
|
>
|
|
216
224
|
<Animated.View
|
|
217
225
|
accessibilityRole="alert"
|
package/src/index.tsx
CHANGED
|
@@ -72,6 +72,18 @@ export {
|
|
|
72
72
|
CropGlyph,
|
|
73
73
|
EraserGlyph,
|
|
74
74
|
BucketGlyph,
|
|
75
|
+
MonitorGlyph,
|
|
76
|
+
MobileGlyph,
|
|
77
|
+
ColumnsGlyph,
|
|
78
|
+
TwoColumnsGlyph,
|
|
79
|
+
TagGlyph,
|
|
80
|
+
SortGlyph,
|
|
81
|
+
PositionGlyph,
|
|
82
|
+
ResizeGlyph,
|
|
83
|
+
OverlayGlyph,
|
|
84
|
+
MailGlyph,
|
|
85
|
+
TicketGlyph,
|
|
86
|
+
ButtonGlyph,
|
|
75
87
|
} from './internal/glyphs';
|
|
76
88
|
export { contrastRatio, pickForeground } from './utils/color';
|
|
77
89
|
|