@ezpg/app-ui 0.15.0 → 0.17.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 +19 -0
- package/lib/module/adjust/dial-strip.js +2 -2
- 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-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 +14 -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/tool-row.js +63 -0
- package/lib/module/blocks/detail-editor/tool-row.js.map +1 -0
- package/lib/module/blocks/index.js +1 -0
- package/lib/module/blocks/index.js.map +1 -1
- package/lib/module/blocks/invite-card/invite-card.js +0 -2
- package/lib/module/blocks/invite-card/invite-card.js.map +1 -1
- 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 +1 -1
- package/lib/module/components/list-row/list-row.js.map +1 -1
- 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 +2 -0
- package/lib/module/index.js.map +1 -1
- 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/parts.js +1 -1
- package/lib/module/theme/base.js +17 -17
- 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-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 +12 -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 +8 -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/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 +1 -0
- package/lib/typescript/src/blocks/index.d.ts.map +1 -1
- package/lib/typescript/src/blocks/invite-card/invite-card.d.ts.map +1 -1
- 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/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 +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- 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/theme/base.d.ts +17 -17
- package/package.json +1 -1
- package/src/adjust/dial-strip.tsx +2 -2
- 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-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 +51 -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/tool-row.tsx +66 -0
- package/src/blocks/index.tsx +1 -0
- package/src/blocks/invite-card/invite-card.tsx +2 -4
- 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 +1 -1
- package/src/components/slider/index.ts +1 -0
- package/src/components/slider/slider.tsx +142 -0
- package/src/index.tsx +2 -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/parts.tsx +1 -1
- package/src/theme/base.ts +17 -17
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { ScrollView, View } from 'react-native';
|
|
2
|
+
import { Text } from '../../components/text/text';
|
|
3
|
+
import { PressableBase } from '../../internal/pressable-base';
|
|
4
|
+
import { useTheme } from '../../theme/theme-provider';
|
|
5
|
+
import { makeStyles } from '../../utils/styles';
|
|
6
|
+
import { DETAIL_LAYOUTS, type DetailLayout } from './detail-types';
|
|
7
|
+
|
|
8
|
+
export type LayoutPickerProps = {
|
|
9
|
+
value: DetailLayout;
|
|
10
|
+
onValueChange: (layout: DetailLayout) => void;
|
|
11
|
+
labels?: Partial<Record<DetailLayout, string>>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const LABELS: Record<DetailLayout, string> = {
|
|
15
|
+
image_top: '사진 위 · 글 아래',
|
|
16
|
+
text_top: '글 위 · 사진 아래',
|
|
17
|
+
side: '나란히',
|
|
18
|
+
image: '꽉 찬 사진',
|
|
19
|
+
two_images: '사진 두 장',
|
|
20
|
+
card: '카드',
|
|
21
|
+
text: '글만',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const useStyles = makeStyles((t) => ({
|
|
25
|
+
row: { gap: t.space[2], paddingHorizontal: t.space[3] },
|
|
26
|
+
item: { width: t.space[16] + t.space[6], gap: t.space[1] },
|
|
27
|
+
frame: {
|
|
28
|
+
height: t.space[16] + t.space[12],
|
|
29
|
+
overflow: 'hidden',
|
|
30
|
+
borderRadius: t.radius.md,
|
|
31
|
+
borderWidth: 1,
|
|
32
|
+
borderColor: t.colors.border,
|
|
33
|
+
backgroundColor: t.colors.muted,
|
|
34
|
+
padding: t.space[1],
|
|
35
|
+
gap: t.space[1],
|
|
36
|
+
},
|
|
37
|
+
on: { borderWidth: 2, borderColor: t.colors.primary },
|
|
38
|
+
photo: {
|
|
39
|
+
flex: 1,
|
|
40
|
+
borderRadius: t.radius.sm,
|
|
41
|
+
backgroundColor: t.colors.input,
|
|
42
|
+
},
|
|
43
|
+
lines: { gap: t.space[1], padding: t.space[1] },
|
|
44
|
+
line: { height: t.space[1], borderRadius: t.radius.full },
|
|
45
|
+
split: { flex: 1, flexDirection: 'row', gap: t.space[1] },
|
|
46
|
+
half: { flex: 1, justifyContent: 'center' },
|
|
47
|
+
long: { width: '80%' },
|
|
48
|
+
short: { width: '50%' },
|
|
49
|
+
card: {
|
|
50
|
+
flex: 1,
|
|
51
|
+
borderRadius: t.radius.sm,
|
|
52
|
+
backgroundColor: t.colors.surface,
|
|
53
|
+
padding: t.space[1],
|
|
54
|
+
gap: t.space[1],
|
|
55
|
+
},
|
|
56
|
+
}));
|
|
57
|
+
|
|
58
|
+
function Diagram({ layout }: { layout: DetailLayout }) {
|
|
59
|
+
const t = useTheme();
|
|
60
|
+
const s = useStyles();
|
|
61
|
+
const photo = <View style={s.photo} />;
|
|
62
|
+
const lines = (
|
|
63
|
+
<View style={s.lines}>
|
|
64
|
+
<View
|
|
65
|
+
style={[s.line, s.long, { backgroundColor: t.colors.foreground }]}
|
|
66
|
+
/>
|
|
67
|
+
<View
|
|
68
|
+
style={[s.line, s.short, { backgroundColor: t.colors.mutedForeground }]}
|
|
69
|
+
/>
|
|
70
|
+
</View>
|
|
71
|
+
);
|
|
72
|
+
switch (layout) {
|
|
73
|
+
case 'image_top':
|
|
74
|
+
return (
|
|
75
|
+
<>
|
|
76
|
+
{photo}
|
|
77
|
+
{lines}
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
case 'text_top':
|
|
81
|
+
return (
|
|
82
|
+
<>
|
|
83
|
+
{lines}
|
|
84
|
+
{photo}
|
|
85
|
+
</>
|
|
86
|
+
);
|
|
87
|
+
case 'side':
|
|
88
|
+
return (
|
|
89
|
+
<View style={s.split}>
|
|
90
|
+
{photo}
|
|
91
|
+
<View style={s.half}>{lines}</View>
|
|
92
|
+
</View>
|
|
93
|
+
);
|
|
94
|
+
case 'two_images':
|
|
95
|
+
return (
|
|
96
|
+
<>
|
|
97
|
+
<View style={s.split}>
|
|
98
|
+
{photo}
|
|
99
|
+
{photo}
|
|
100
|
+
</View>
|
|
101
|
+
{lines}
|
|
102
|
+
</>
|
|
103
|
+
);
|
|
104
|
+
case 'card':
|
|
105
|
+
return (
|
|
106
|
+
<View style={s.card}>
|
|
107
|
+
{photo}
|
|
108
|
+
{lines}
|
|
109
|
+
</View>
|
|
110
|
+
);
|
|
111
|
+
case 'text':
|
|
112
|
+
return <View style={s.half}>{lines}</View>;
|
|
113
|
+
default:
|
|
114
|
+
return photo;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function LayoutPicker({
|
|
119
|
+
value,
|
|
120
|
+
onValueChange,
|
|
121
|
+
labels,
|
|
122
|
+
}: LayoutPickerProps) {
|
|
123
|
+
const s = useStyles();
|
|
124
|
+
return (
|
|
125
|
+
<ScrollView
|
|
126
|
+
horizontal
|
|
127
|
+
showsHorizontalScrollIndicator={false}
|
|
128
|
+
contentContainerStyle={s.row}
|
|
129
|
+
accessibilityRole="radiogroup"
|
|
130
|
+
>
|
|
131
|
+
{DETAIL_LAYOUTS.map((layout) => {
|
|
132
|
+
const on = layout === value;
|
|
133
|
+
const label = labels?.[layout] ?? LABELS[layout];
|
|
134
|
+
return (
|
|
135
|
+
<PressableBase
|
|
136
|
+
key={layout}
|
|
137
|
+
accessibilityRole="radio"
|
|
138
|
+
accessibilityState={{ selected: on }}
|
|
139
|
+
accessibilityLabel={label}
|
|
140
|
+
onPress={() => onValueChange(layout)}
|
|
141
|
+
style={s.item}
|
|
142
|
+
>
|
|
143
|
+
<View style={[s.frame, on && s.on]}>
|
|
144
|
+
<Diagram layout={layout} />
|
|
145
|
+
</View>
|
|
146
|
+
<Text
|
|
147
|
+
variant="caption"
|
|
148
|
+
tone={on ? 'default' : 'muted'}
|
|
149
|
+
numberOfLines={1}
|
|
150
|
+
>
|
|
151
|
+
{label}
|
|
152
|
+
</Text>
|
|
153
|
+
</PressableBase>
|
|
154
|
+
);
|
|
155
|
+
})}
|
|
156
|
+
</ScrollView>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { Image, View } from 'react-native';
|
|
2
|
+
import { Text } from '../../components/text/text';
|
|
3
|
+
import {
|
|
4
|
+
CameraGlyph,
|
|
5
|
+
CloseGlyph,
|
|
6
|
+
ImageGlyph,
|
|
7
|
+
ScanGlyph,
|
|
8
|
+
} from '../../internal/glyphs';
|
|
9
|
+
import { renderIcon, type IconSlot } from '../../internal/icon';
|
|
10
|
+
import { PressableBase } from '../../internal/pressable-base';
|
|
11
|
+
import { useTheme } from '../../theme/theme-provider';
|
|
12
|
+
import { makeStyles } from '../../utils/styles';
|
|
13
|
+
|
|
14
|
+
export type TrayPhoto = { key: string; uri: string; reference?: boolean };
|
|
15
|
+
export type TraySource = 'camera' | 'library' | 'capture';
|
|
16
|
+
|
|
17
|
+
export type PhotoTrayProps = {
|
|
18
|
+
photos: readonly TrayPhoto[];
|
|
19
|
+
onRemove: (key: string) => void;
|
|
20
|
+
onAdd: (source: TraySource) => void;
|
|
21
|
+
mainLabel?: string;
|
|
22
|
+
referenceLabel?: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const ADD: { key: TraySource; label: string; icon: IconSlot }[] = [
|
|
26
|
+
{ key: 'camera', label: '촬영', icon: CameraGlyph },
|
|
27
|
+
{ key: 'library', label: '사진', icon: ImageGlyph },
|
|
28
|
+
{ key: 'capture', label: '참고 캡처', icon: ScanGlyph },
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const useStyles = makeStyles((t) => ({
|
|
32
|
+
root: { gap: t.space[3], paddingHorizontal: t.layout.screenX },
|
|
33
|
+
grid: { flexDirection: 'row', flexWrap: 'wrap', gap: t.space[2] },
|
|
34
|
+
tile: { width: '31.5%' },
|
|
35
|
+
photo: {
|
|
36
|
+
width: '100%',
|
|
37
|
+
height: undefined,
|
|
38
|
+
aspectRatio: 3 / 4,
|
|
39
|
+
borderRadius: t.radius.lg,
|
|
40
|
+
backgroundColor: t.colors.muted,
|
|
41
|
+
},
|
|
42
|
+
reference: { borderWidth: 3, borderColor: t.colors.primary },
|
|
43
|
+
remove: {
|
|
44
|
+
position: 'absolute',
|
|
45
|
+
right: t.space[1],
|
|
46
|
+
top: t.space[1],
|
|
47
|
+
width: t.space[6],
|
|
48
|
+
height: t.space[6],
|
|
49
|
+
borderRadius: t.radius.full,
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'center',
|
|
52
|
+
backgroundColor: t.colors.foreground,
|
|
53
|
+
},
|
|
54
|
+
badge: {
|
|
55
|
+
position: 'absolute',
|
|
56
|
+
left: t.space[1],
|
|
57
|
+
bottom: t.space[1],
|
|
58
|
+
paddingHorizontal: t.space[2],
|
|
59
|
+
borderRadius: t.radius.full,
|
|
60
|
+
backgroundColor: t.colors.foreground,
|
|
61
|
+
},
|
|
62
|
+
adds: { flexDirection: 'row', gap: t.space[2] },
|
|
63
|
+
add: {
|
|
64
|
+
flex: 1,
|
|
65
|
+
height: t.space[16],
|
|
66
|
+
borderRadius: t.radius.lg,
|
|
67
|
+
borderWidth: 1,
|
|
68
|
+
borderStyle: 'dashed',
|
|
69
|
+
borderColor: t.colors.input,
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
justifyContent: 'center',
|
|
72
|
+
gap: t.space[1],
|
|
73
|
+
},
|
|
74
|
+
}));
|
|
75
|
+
|
|
76
|
+
export function PhotoTray({
|
|
77
|
+
photos,
|
|
78
|
+
onRemove,
|
|
79
|
+
onAdd,
|
|
80
|
+
mainLabel = '대표',
|
|
81
|
+
referenceLabel = '참고',
|
|
82
|
+
}: PhotoTrayProps) {
|
|
83
|
+
const t = useTheme();
|
|
84
|
+
const s = useStyles();
|
|
85
|
+
const main = photos.find((p) => !p.reference)?.key;
|
|
86
|
+
return (
|
|
87
|
+
<View style={s.root}>
|
|
88
|
+
{photos.length ? (
|
|
89
|
+
<View style={s.grid}>
|
|
90
|
+
{photos.map((p) => (
|
|
91
|
+
<View key={p.key} style={s.tile}>
|
|
92
|
+
<Image
|
|
93
|
+
source={{ uri: p.uri }}
|
|
94
|
+
resizeMode="cover"
|
|
95
|
+
style={[s.photo, p.reference && s.reference]}
|
|
96
|
+
/>
|
|
97
|
+
<PressableBase
|
|
98
|
+
onPress={() => onRemove(p.key)}
|
|
99
|
+
accessibilityLabel="빼기"
|
|
100
|
+
touchHeight={t.space[6]}
|
|
101
|
+
style={s.remove}
|
|
102
|
+
>
|
|
103
|
+
<CloseGlyph color={t.colors.surface} size={t.iconSize.sm} />
|
|
104
|
+
</PressableBase>
|
|
105
|
+
{p.key === main || p.reference ? (
|
|
106
|
+
<View style={s.badge}>
|
|
107
|
+
<Text
|
|
108
|
+
variant="caption"
|
|
109
|
+
weight="bold"
|
|
110
|
+
style={{ color: t.colors.surface }}
|
|
111
|
+
>
|
|
112
|
+
{p.reference ? referenceLabel : mainLabel}
|
|
113
|
+
</Text>
|
|
114
|
+
</View>
|
|
115
|
+
) : null}
|
|
116
|
+
</View>
|
|
117
|
+
))}
|
|
118
|
+
</View>
|
|
119
|
+
) : null}
|
|
120
|
+
<View style={s.adds}>
|
|
121
|
+
{ADD.map((a) => (
|
|
122
|
+
<PressableBase
|
|
123
|
+
key={a.key}
|
|
124
|
+
onPress={() => onAdd(a.key)}
|
|
125
|
+
accessibilityLabel={a.label}
|
|
126
|
+
style={s.add}
|
|
127
|
+
>
|
|
128
|
+
{renderIcon(a.icon, {
|
|
129
|
+
color: t.colors.mutedForeground,
|
|
130
|
+
size: t.iconSize.md,
|
|
131
|
+
})}
|
|
132
|
+
<Text variant="caption" tone="muted">
|
|
133
|
+
{a.label}
|
|
134
|
+
</Text>
|
|
135
|
+
</PressableBase>
|
|
136
|
+
))}
|
|
137
|
+
</View>
|
|
138
|
+
</View>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import { Text } from '../../components/text/text';
|
|
3
|
+
import { renderIcon, type IconSlot } from '../../internal/icon';
|
|
4
|
+
import { PressableBase } from '../../internal/pressable-base';
|
|
5
|
+
import { useTheme } from '../../theme/theme-provider';
|
|
6
|
+
import { makeStyles } from '../../utils/styles';
|
|
7
|
+
|
|
8
|
+
export type ToolRowItem = {
|
|
9
|
+
key: string;
|
|
10
|
+
icon: IconSlot;
|
|
11
|
+
label: string;
|
|
12
|
+
onPress: () => void;
|
|
13
|
+
active?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const useStyles = makeStyles((t) => ({
|
|
18
|
+
row: {
|
|
19
|
+
flexDirection: 'row',
|
|
20
|
+
justifyContent: 'space-around',
|
|
21
|
+
paddingHorizontal: t.space[1],
|
|
22
|
+
},
|
|
23
|
+
item: { alignItems: 'center', gap: t.space[1], flex: 1 },
|
|
24
|
+
round: {
|
|
25
|
+
width: t.controlSize.sm,
|
|
26
|
+
height: t.controlSize.sm,
|
|
27
|
+
borderRadius: t.radius.full,
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
justifyContent: 'center',
|
|
30
|
+
backgroundColor: t.colors.surface,
|
|
31
|
+
},
|
|
32
|
+
on: { backgroundColor: t.colors.primaryTint },
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
export function ToolRow({ items }: { items: readonly ToolRowItem[] }) {
|
|
36
|
+
const t = useTheme();
|
|
37
|
+
const s = useStyles();
|
|
38
|
+
return (
|
|
39
|
+
<View style={s.row}>
|
|
40
|
+
{items.map((item) => (
|
|
41
|
+
<PressableBase
|
|
42
|
+
key={item.key}
|
|
43
|
+
onPress={item.onPress}
|
|
44
|
+
disabled={item.disabled}
|
|
45
|
+
accessibilityLabel={item.label}
|
|
46
|
+
accessibilityState={{ selected: !!item.active }}
|
|
47
|
+
style={s.item}
|
|
48
|
+
>
|
|
49
|
+
<View style={[s.round, item.active && s.on]}>
|
|
50
|
+
{renderIcon(item.icon, {
|
|
51
|
+
color: item.active ? t.colors.primary : t.colors.foreground,
|
|
52
|
+
size: t.iconSize.md,
|
|
53
|
+
})}
|
|
54
|
+
</View>
|
|
55
|
+
<Text
|
|
56
|
+
variant="caption"
|
|
57
|
+
tone={item.active ? 'default' : 'muted'}
|
|
58
|
+
numberOfLines={1}
|
|
59
|
+
>
|
|
60
|
+
{item.label}
|
|
61
|
+
</Text>
|
|
62
|
+
</PressableBase>
|
|
63
|
+
))}
|
|
64
|
+
</View>
|
|
65
|
+
);
|
|
66
|
+
}
|
package/src/blocks/index.tsx
CHANGED
|
@@ -7,6 +7,7 @@ export * from './invite-card';
|
|
|
7
7
|
export * from './color-swatch-picker';
|
|
8
8
|
export * from './copy-variant-picker';
|
|
9
9
|
export * from './credit-wallet';
|
|
10
|
+
export * from './detail-editor';
|
|
10
11
|
export * from './generation-progress';
|
|
11
12
|
export * from './invoice-row';
|
|
12
13
|
export * from './logo-candidate-grid';
|
|
@@ -84,7 +84,7 @@ export function InviteCard({
|
|
|
84
84
|
const content = (
|
|
85
85
|
<>
|
|
86
86
|
<View style={s.small}>
|
|
87
|
-
<Text variant="bodyLg" weight="bold"
|
|
87
|
+
<Text variant="bodyLg" weight="bold">
|
|
88
88
|
{initial(title)}
|
|
89
89
|
</Text>
|
|
90
90
|
</View>
|
|
@@ -118,9 +118,7 @@ export function InviteCard({
|
|
|
118
118
|
return (
|
|
119
119
|
<View style={[s.card, style]}>
|
|
120
120
|
<View style={s.mark}>
|
|
121
|
-
<Text variant="title"
|
|
122
|
-
{initial(title)}
|
|
123
|
-
</Text>
|
|
121
|
+
<Text variant="title">{initial(title)}</Text>
|
|
124
122
|
</View>
|
|
125
123
|
<Text variant="title" accessibilityRole="header">
|
|
126
124
|
{title}
|
|
@@ -56,7 +56,7 @@ export function TaskTiles({ items, style }: TaskTilesProps) {
|
|
|
56
56
|
pressedStyle={s.pressed}
|
|
57
57
|
>
|
|
58
58
|
{renderIcon(item.icon, {
|
|
59
|
-
color:
|
|
59
|
+
color: t.colors.mutedForeground,
|
|
60
60
|
size: t.iconSize.md,
|
|
61
61
|
})}
|
|
62
62
|
<Text variant="label" numberOfLines={1}>
|
package/src/charts/mini-bars.tsx
CHANGED
|
@@ -48,7 +48,12 @@ const useStyles = makeStyles((t) => ({
|
|
|
48
48
|
paddingHorizontal: t.space[5],
|
|
49
49
|
borderRadius: t.radius.lg,
|
|
50
50
|
},
|
|
51
|
-
primary: {
|
|
51
|
+
primary: {
|
|
52
|
+
backgroundColor: t.colors.surface,
|
|
53
|
+
borderWidth: 1.5,
|
|
54
|
+
borderColor: t.colors.primary,
|
|
55
|
+
},
|
|
56
|
+
primaryOff: { borderColor: t.colors.border },
|
|
52
57
|
secondary: { backgroundColor: t.colors.muted },
|
|
53
58
|
outline: {
|
|
54
59
|
backgroundColor: 'transparent',
|
|
@@ -85,8 +90,9 @@ export function Button({
|
|
|
85
90
|
}: ButtonProps) {
|
|
86
91
|
const t = useTheme();
|
|
87
92
|
const s = useStyles();
|
|
93
|
+
const off = variant === 'primary' && !!disabled && !loading;
|
|
88
94
|
const color = {
|
|
89
|
-
primary: t.colors.
|
|
95
|
+
primary: off ? t.colors.mutedForeground : t.colors.primary,
|
|
90
96
|
secondary: t.colors.foreground,
|
|
91
97
|
outline: t.colors.foreground,
|
|
92
98
|
ghost: t.colors.foreground,
|
|
@@ -100,7 +106,8 @@ export function Button({
|
|
|
100
106
|
disabled={disabled || loading}
|
|
101
107
|
touchHeight={t.controlSize[size]}
|
|
102
108
|
accessibilityState={{ ...accessibilityState, busy: loading }}
|
|
103
|
-
|
|
109
|
+
disabledStyle={variant === 'primary' ? {} : undefined}
|
|
110
|
+
style={[s.base, s[size], s[variant], off && s.primaryOff, style]}
|
|
104
111
|
>
|
|
105
112
|
{loading ? (
|
|
106
113
|
<ActivityIndicator size="small" color={color} />
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { Image, View, type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
import { PressableBase } from '../../internal/pressable-base';
|
|
3
|
+
import { TAB_ICONS } from '../../internal/tab-icon-pairs';
|
|
4
|
+
import { useTheme } from '../../theme/theme-provider';
|
|
5
|
+
import type { Theme } from '../../types';
|
|
6
|
+
import { makeStyles } from '../../utils/styles';
|
|
7
|
+
|
|
8
|
+
export type FloatingTabIcon = keyof typeof TAB_ICONS;
|
|
9
|
+
|
|
10
|
+
export type FloatingTabBarItem<K extends string> = {
|
|
11
|
+
key: K;
|
|
12
|
+
label: string;
|
|
13
|
+
icon: FloatingTabIcon;
|
|
14
|
+
badge?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type FloatingTabBarProps<K extends string> = {
|
|
18
|
+
items: readonly FloatingTabBarItem<K>[];
|
|
19
|
+
value: K;
|
|
20
|
+
onValueChange: (key: K) => void;
|
|
21
|
+
bottomInset?: number;
|
|
22
|
+
style?: StyleProp<ViewStyle>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const ICON = 24;
|
|
26
|
+
const DOT = 6;
|
|
27
|
+
const DOT_INSET = 6;
|
|
28
|
+
|
|
29
|
+
export function floatingTabBarSpace(t: Theme, bottomInset = 0) {
|
|
30
|
+
return bottomInset + t.space['16'] + t.space['4'] + t.space['2'];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const useStyles = makeStyles((t) => ({
|
|
34
|
+
bar: {
|
|
35
|
+
position: 'absolute',
|
|
36
|
+
left: t.space['4'],
|
|
37
|
+
right: t.space['4'],
|
|
38
|
+
height: t.space['16'],
|
|
39
|
+
flexDirection: 'row',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
gap: t.space['1'],
|
|
42
|
+
paddingHorizontal: t.space['2'],
|
|
43
|
+
borderRadius: t.radius.full,
|
|
44
|
+
borderWidth: 1,
|
|
45
|
+
borderColor: t.colors.border,
|
|
46
|
+
backgroundColor: t.colors.surface,
|
|
47
|
+
boxShadow: t.shadow.sm,
|
|
48
|
+
},
|
|
49
|
+
tab: {
|
|
50
|
+
flex: 1,
|
|
51
|
+
height: t.controlSize.md,
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
justifyContent: 'center',
|
|
54
|
+
borderRadius: t.radius.full,
|
|
55
|
+
},
|
|
56
|
+
selected: { backgroundColor: t.colors.primaryTint },
|
|
57
|
+
icon: { width: ICON, height: ICON },
|
|
58
|
+
dot: {
|
|
59
|
+
position: 'absolute',
|
|
60
|
+
top: 0,
|
|
61
|
+
left: ICON - DOT_INSET,
|
|
62
|
+
width: DOT,
|
|
63
|
+
height: DOT,
|
|
64
|
+
borderRadius: DOT / 2,
|
|
65
|
+
backgroundColor: t.colors.primaryEdge,
|
|
66
|
+
},
|
|
67
|
+
}));
|
|
68
|
+
|
|
69
|
+
export function FloatingTabBar<K extends string>({
|
|
70
|
+
items,
|
|
71
|
+
value,
|
|
72
|
+
onValueChange,
|
|
73
|
+
bottomInset = 0,
|
|
74
|
+
style,
|
|
75
|
+
}: FloatingTabBarProps<K>) {
|
|
76
|
+
const t = useTheme();
|
|
77
|
+
const s = useStyles();
|
|
78
|
+
return (
|
|
79
|
+
<View
|
|
80
|
+
accessibilityRole="tablist"
|
|
81
|
+
style={[s.bar, { bottom: bottomInset + t.space['4'] }, style]}
|
|
82
|
+
>
|
|
83
|
+
{items.map((item) => {
|
|
84
|
+
const selected = item.key === value;
|
|
85
|
+
return (
|
|
86
|
+
<PressableBase
|
|
87
|
+
key={item.key}
|
|
88
|
+
accessibilityRole="tab"
|
|
89
|
+
accessibilityState={{ selected }}
|
|
90
|
+
accessibilityLabel={
|
|
91
|
+
item.badge ? `${item.label}, ${item.badge}` : item.label
|
|
92
|
+
}
|
|
93
|
+
touchHeight={t.controlSize.md}
|
|
94
|
+
pressedStyle={{ opacity: t.opacity.pressed }}
|
|
95
|
+
onPress={() => {
|
|
96
|
+
if (!selected) onValueChange(item.key);
|
|
97
|
+
}}
|
|
98
|
+
style={[s.tab, selected && s.selected]}
|
|
99
|
+
>
|
|
100
|
+
<View style={s.icon}>
|
|
101
|
+
<Image
|
|
102
|
+
source={{
|
|
103
|
+
uri: TAB_ICONS[item.icon][selected ? 'fill' : 'line'],
|
|
104
|
+
}}
|
|
105
|
+
style={[
|
|
106
|
+
s.icon,
|
|
107
|
+
{
|
|
108
|
+
tintColor: selected
|
|
109
|
+
? t.colors.primary
|
|
110
|
+
: t.colors.mutedForeground,
|
|
111
|
+
},
|
|
112
|
+
]}
|
|
113
|
+
/>
|
|
114
|
+
{item.badge ? <View testID="tab-badge" style={s.dot} /> : null}
|
|
115
|
+
</View>
|
|
116
|
+
</PressableBase>
|
|
117
|
+
);
|
|
118
|
+
})}
|
|
119
|
+
</View>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Slider, type SliderProps } from './slider';
|