@lotics/ui 8.0.0 → 9.0.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/AGENTS.md +171 -68
- package/examples/tpl_allocate.tsx +2 -2
- package/examples/tpl_attendance.tsx +2 -2
- package/examples/tpl_calendar.tsx +1 -1
- package/examples/tpl_dashboard.tsx +1 -1
- package/examples/tpl_item_list.tsx +1015 -124
- package/examples/tpl_pick.tsx +3 -3
- package/examples/tpl_pivot.tsx +1 -1
- package/examples/tpl_record.tsx +1354 -0
- package/examples/tpl_report.tsx +7 -7
- package/examples/tpl_rollup.tsx +6 -6
- package/examples/tpl_shifts.tsx +2 -2
- package/examples/tpl_statements.tsx +221 -0
- package/examples/tpl_stock.tsx +7 -7
- package/examples/tpl_task_board.tsx +16 -13
- package/examples/tpl_tasks.tsx +15 -28
- package/examples/tpl_tower.tsx +2 -2
- package/package.json +8 -1
- package/src/capture_row.tsx +59 -0
- package/src/checklist.tsx +104 -0
- package/src/chip.tsx +12 -3
- package/src/detail_row.tsx +137 -10
- package/src/inline_date_picker.tsx +8 -3
- package/src/inline_edit.tsx +40 -10
- package/src/inline_member_select.tsx +3 -0
- package/src/inline_number_input.tsx +5 -2
- package/src/inline_select.tsx +8 -3
- package/src/inline_tag_select.tsx +140 -0
- package/src/inline_text_input.tsx +5 -2
- package/src/inline_time_picker.tsx +5 -2
- package/src/ledger.tsx +220 -0
- package/src/locale.tsx +21 -0
- package/src/progress_bar.tsx +32 -1
- package/src/record_summary.tsx +101 -0
- package/src/section_heading.tsx +16 -8
- package/src/suggestion_chip.tsx +47 -0
- package/src/use_section_nav.test.ts +69 -0
- package/src/use_section_nav.ts +59 -0
- package/examples/tpl_billing.tsx +0 -344
- package/examples/tpl_detail.tsx +0 -232
- package/examples/tpl_directory.tsx +0 -260
- package/examples/tpl_intake.tsx +0 -206
- package/examples/tpl_order.tsx +0 -482
- package/examples/tpl_quick.tsx +0 -211
- package/examples/tpl_record_plain.tsx +0 -259
- package/examples/tpl_settings.tsx +0 -178
- package/examples/tpl_timeline.tsx +0 -244
- package/examples/tpl_wizard.tsx +0 -223
package/examples/tpl_intake.tsx
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import { ScrollView, View } from "react-native";
|
|
3
|
-
import { Text } from "@lotics/ui/text";
|
|
4
|
-
import { colors } from "@lotics/ui/colors";
|
|
5
|
-
import { Button } from "@lotics/ui/button";
|
|
6
|
-
import { Card, CardFooter, CardHeader, CardHeaderTitle } from "@lotics/ui/card";
|
|
7
|
-
import { FileDropzone } from "@lotics/ui/file_dropzone";
|
|
8
|
-
import type { DisplayFile } from "@lotics/ui/file_thumbnail";
|
|
9
|
-
import { FileThumbnailGrid } from "@lotics/ui/file_thumbnail_grid";
|
|
10
|
-
import { Divider } from "@lotics/ui/divider";
|
|
11
|
-
import { FormField } from "@lotics/ui/form_field";
|
|
12
|
-
import { Picker } from "@lotics/ui/picker";
|
|
13
|
-
import { Switch } from "@lotics/ui/switch";
|
|
14
|
-
import { TextInputField } from "@lotics/ui/text_input_field";
|
|
15
|
-
|
|
16
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
17
|
-
// Template · Client intake — the multi-section intake form for a new
|
|
18
|
-
// business partner. One banded Card: header (title + why it matters) →
|
|
19
|
-
// three titled fieldsets separated by Dividers → footer per Action Layout
|
|
20
|
-
// (helper text left · Cancel muted + ONE primary right). Fields wrap on a
|
|
21
|
-
// flexBasis grid; every field holds state; Tax ID demonstrates the error band.
|
|
22
|
-
// ─────────────────────────────────────────────────────────────────────────────
|
|
23
|
-
|
|
24
|
-
const INDUSTRIES = [
|
|
25
|
-
{ label: "Manufacturing", value: "san_xuat" },
|
|
26
|
-
{ label: "Trading", value: "thuong_mai" },
|
|
27
|
-
{ label: "Construction", value: "xay_dung" },
|
|
28
|
-
{ label: "Transportation", value: "van_tai" },
|
|
29
|
-
{ label: "Packaging", value: "bao_bi" },
|
|
30
|
-
{ label: "Other", value: "khac" },
|
|
31
|
-
];
|
|
32
|
-
|
|
33
|
-
const PAYMENT_TERMS = [
|
|
34
|
-
{ label: "Due on receipt", value: "ngay" },
|
|
35
|
-
{ label: "Net 15", value: "15" },
|
|
36
|
-
{ label: "Net 30", value: "30" },
|
|
37
|
-
{ label: "Net 45", value: "45" },
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
/** Grid cells: half-width on wide screens, full row when they can't fit. */
|
|
41
|
-
const half = { flexGrow: 1, flexBasis: 280 } as const;
|
|
42
|
-
const full = { flexGrow: 1, flexBasis: "100%" } as const;
|
|
43
|
-
|
|
44
|
-
function FieldsetTitle({ title, hint }: { title: string; hint: string }) {
|
|
45
|
-
return (
|
|
46
|
-
<View style={{ gap: 2, paddingBottom: 14 }}>
|
|
47
|
-
<Text size="xs" color="muted" transform="uppercase">{title}</Text>
|
|
48
|
-
<Text size="xs" color="muted">{hint}</Text>
|
|
49
|
-
</View>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function TplIntake() {
|
|
54
|
-
const [tenCongTy, setTenCongTy] = useState("Northwind Packaging Co., Ltd.");
|
|
55
|
-
const [mst, setMst] = useState("031245678");
|
|
56
|
-
const [linhVuc, setLinhVuc] = useState("");
|
|
57
|
-
const [nguoiLienHe, setNguoiLienHe] = useState("Maria Lopez");
|
|
58
|
-
const [dienThoai, setDienThoai] = useState("0903 558 214");
|
|
59
|
-
const [email, setEmail] = useState("maria.lopez@northwindpkg.com");
|
|
60
|
-
const [nhomZalo, setNhomZalo] = useState("");
|
|
61
|
-
const [hanThanhToan, setHanThanhToan] = useState("30");
|
|
62
|
-
const [hoaDonVat, setHoaDonVat] = useState(true);
|
|
63
|
-
const [ghiChu, setGhiChu] = useState("");
|
|
64
|
-
const [giayTo, setGiayTo] = useState<DisplayFile[]>([]);
|
|
65
|
-
|
|
66
|
-
const soChuSo = mst.replace(/\D/g, "").length;
|
|
67
|
-
const mstError =
|
|
68
|
-
mst.length > 0 && !/^\d{10}(\d{3})?$/.test(mst.replace(/[\s.-]/g, ""))
|
|
69
|
-
? `Tax ID must be 10 or 13 digits — currently ${soChuSo}.`
|
|
70
|
-
: undefined;
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<ScrollView style={{ flex: 1, backgroundColor: colors.white }} contentContainerStyle={{ padding: 28 }}>
|
|
74
|
-
<View style={{ width: "100%", maxWidth: 880, alignSelf: "center", gap: 16 }}>
|
|
75
|
-
{/* header band */}
|
|
76
|
-
<View style={{ flexDirection: "row", alignItems: "flex-end", gap: 12 }}>
|
|
77
|
-
<View style={{ gap: 2, flex: 1 }}>
|
|
78
|
-
<Text size="xl" weight="semibold">Client intake</Text>
|
|
79
|
-
<Text size="sm" color="muted">Set up a new partner record — complete details up front mean quotes, orders, and invoices never need a follow-up question</Text>
|
|
80
|
-
</View>
|
|
81
|
-
</View>
|
|
82
|
-
|
|
83
|
-
<Card style={{ padding: 0 }}>
|
|
84
|
-
{/* card header: what this form decides */}
|
|
85
|
-
<CardHeader>
|
|
86
|
-
<CardHeaderTitle description="Enter once, reuse on every future quote and invoice — the tax ID is the matching key, double-check it before creating">
|
|
87
|
-
Partner record
|
|
88
|
-
</CardHeaderTitle>
|
|
89
|
-
</CardHeader>
|
|
90
|
-
|
|
91
|
-
{/* fieldset 1 · General information */}
|
|
92
|
-
<View style={{ paddingHorizontal: 20, paddingTop: 18, paddingBottom: 4 }}>
|
|
93
|
-
<FieldsetTitle title="General information" hint="Legal name as on the business registration, not the trading name" />
|
|
94
|
-
<View style={{ flexDirection: "row", flexWrap: "wrap", columnGap: 16 }}>
|
|
95
|
-
<FormField label="Company name" style={full}>
|
|
96
|
-
<TextInputField value={tenCongTy} onChangeText={setTenCongTy} placeholder="Name on the business registration" />
|
|
97
|
-
</FormField>
|
|
98
|
-
<FormField label="Tax ID" error={mstError} style={half}>
|
|
99
|
-
<TextInputField
|
|
100
|
-
value={mst}
|
|
101
|
-
onChangeText={setMst}
|
|
102
|
-
placeholder="10 or 13 digits"
|
|
103
|
-
inputMode="numeric"
|
|
104
|
-
style={{ fontVariant: ["tabular-nums"] }}
|
|
105
|
-
/>
|
|
106
|
-
</FormField>
|
|
107
|
-
<FormField label="Industry" style={half}>
|
|
108
|
-
<Picker options={INDUSTRIES} value={linhVuc} onValueChange={setLinhVuc} placeholder="Select industry" />
|
|
109
|
-
</FormField>
|
|
110
|
-
</View>
|
|
111
|
-
</View>
|
|
112
|
-
<Divider />
|
|
113
|
-
|
|
114
|
-
{/* fieldset 2 · Contact */}
|
|
115
|
-
<View style={{ paddingHorizontal: 20, paddingTop: 18, paddingBottom: 4 }}>
|
|
116
|
-
<FieldsetTitle title="Contact" hint="The person who receives quotes and the monthly statement reconciliation" />
|
|
117
|
-
<View style={{ flexDirection: "row", flexWrap: "wrap", columnGap: 16 }}>
|
|
118
|
-
<FormField label="Contact person" style={half}>
|
|
119
|
-
<TextInputField value={nguoiLienHe} onChangeText={setNguoiLienHe} placeholder="Full name" />
|
|
120
|
-
</FormField>
|
|
121
|
-
<FormField label="Phone" style={half}>
|
|
122
|
-
<TextInputField
|
|
123
|
-
value={dienThoai}
|
|
124
|
-
onChangeText={setDienThoai}
|
|
125
|
-
placeholder="Mobile number"
|
|
126
|
-
inputMode="tel"
|
|
127
|
-
style={{ fontVariant: ["tabular-nums"] }}
|
|
128
|
-
/>
|
|
129
|
-
</FormField>
|
|
130
|
-
<FormField label="Email" style={half}>
|
|
131
|
-
<TextInputField value={email} onChangeText={setEmail} placeholder="name@company.com" inputMode="email" autoCapitalize="none" />
|
|
132
|
-
</FormField>
|
|
133
|
-
<FormField label="Chat group" optional optionalLabel="Optional" style={half}>
|
|
134
|
-
<TextInputField value={nhomZalo} onChangeText={setNhomZalo} placeholder="Group used to coordinate orders" />
|
|
135
|
-
</FormField>
|
|
136
|
-
</View>
|
|
137
|
-
</View>
|
|
138
|
-
<Divider />
|
|
139
|
-
|
|
140
|
-
{/* fieldset 3 · Terms */}
|
|
141
|
-
<View style={{ paddingHorizontal: 20, paddingTop: 18, paddingBottom: 4 }}>
|
|
142
|
-
<FieldsetTitle title="Terms" hint="Applied as the default on every order for this partner, adjustable per order" />
|
|
143
|
-
<View style={{ flexDirection: "row", flexWrap: "wrap", columnGap: 16 }}>
|
|
144
|
-
<FormField label="Payment terms" style={half}>
|
|
145
|
-
<Picker options={PAYMENT_TERMS} value={hanThanhToan} onValueChange={setHanThanhToan} placeholder="Select payment terms" />
|
|
146
|
-
</FormField>
|
|
147
|
-
<FormField label="VAT invoice" style={half}>
|
|
148
|
-
<View style={{ flexDirection: "row", alignItems: "center", gap: 10, minHeight: 40 }}>
|
|
149
|
-
<Switch accessibilityLabel="VAT invoice" value={hoaDonVat} onChange={setHoaDonVat} />
|
|
150
|
-
<Text size="sm" color="muted">{hoaDonVat ? "Issue an invoice for every order" : "No invoices issued"}</Text>
|
|
151
|
-
</View>
|
|
152
|
-
</FormField>
|
|
153
|
-
<FormField label="Notes" optional optionalLabel="Optional" style={full}>
|
|
154
|
-
<TextInputField
|
|
155
|
-
value={ghiChu}
|
|
156
|
-
onChangeText={setGhiChu}
|
|
157
|
-
placeholder="Special requirements for delivery, documents, reconciliation…"
|
|
158
|
-
numberOfLines={3}
|
|
159
|
-
/>
|
|
160
|
-
</FormField>
|
|
161
|
-
</View>
|
|
162
|
-
</View>
|
|
163
|
-
|
|
164
|
-
<Divider />
|
|
165
|
-
|
|
166
|
-
{/* fieldset 4 · Documents — the attachment pattern: FileDropzone
|
|
167
|
-
captures, FileThumbnailGrid displays what landed */}
|
|
168
|
-
<View style={{ paddingHorizontal: 20, paddingTop: 18, paddingBottom: 16, gap: 12 }}>
|
|
169
|
-
<FieldsetTitle title="Documents" hint="Business registration and legal documents — clear scans or photos" />
|
|
170
|
-
<FileDropzone
|
|
171
|
-
height={120}
|
|
172
|
-
label="Drop the business registration here"
|
|
173
|
-
hint="or click to browse · PDF, images"
|
|
174
|
-
dropLabel="Release to attach"
|
|
175
|
-
accept="application/pdf,image/*"
|
|
176
|
-
accessibilityLabel="Attach business registration"
|
|
177
|
-
onFiles={(files) =>
|
|
178
|
-
setGiayTo((prev) => [
|
|
179
|
-
...prev,
|
|
180
|
-
...files.map((f, i) => ({
|
|
181
|
-
id: `${f.name}-${prev.length + i}`,
|
|
182
|
-
filename: f.name,
|
|
183
|
-
mimeType: f.type || "application/octet-stream",
|
|
184
|
-
url: URL.createObjectURL(f),
|
|
185
|
-
})),
|
|
186
|
-
])
|
|
187
|
-
}
|
|
188
|
-
/>
|
|
189
|
-
{giayTo.length > 0 ? <FileThumbnailGrid files={giayTo} itemSize={88} /> : null}
|
|
190
|
-
</View>
|
|
191
|
-
|
|
192
|
-
{/* footer per Action Layout: helper left · Cancel muted + ONE primary right */}
|
|
193
|
-
<CardFooter>
|
|
194
|
-
<Text size="xs" color="muted" style={{ flex: 1 }}>
|
|
195
|
-
{giayTo.length > 0
|
|
196
|
-
? `${giayTo.length} files attached · record awaits Accounting approval before the first order`
|
|
197
|
-
: "New records await Accounting approval before the first order"}
|
|
198
|
-
</Text>
|
|
199
|
-
<Button title="Cancel" color="muted" onPress={() => {}} />
|
|
200
|
-
<Button title="Create record" color="primary" onPress={() => {}} />
|
|
201
|
-
</CardFooter>
|
|
202
|
-
</Card>
|
|
203
|
-
</View>
|
|
204
|
-
</ScrollView>
|
|
205
|
-
);
|
|
206
|
-
}
|