@chenyqthu/tp-mobile-ui-kit 0.0.0-stage → 0.2.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/README.md +214 -2
- package/dist/assets.js +5 -0
- package/dist/catalog.json +12355 -0
- package/dist/chunks/OmadaAppDemo-BO8a6A-m.js +4910 -0
- package/dist/chunks/TPPrompt-DLd32rsN.js +3456 -0
- package/dist/chunks/asset-icons-BIenKvAh.js +7613 -0
- package/dist/chunks/asset-illustrations-YHXzEd7z.js +3086 -0
- package/dist/chunks/asset-logos-DAyGwOLj.js +59 -0
- package/dist/chunks/asset-motion-D7fWh_JS.js +376 -0
- package/dist/core.js +3 -0
- package/dist/index.js +7 -0
- package/dist/libpag.wasm +0 -0
- package/dist/omada.js +7 -0
- package/dist/standalone.js +3438 -0
- package/dist/style.css +2 -0
- package/dist/types/assets-lib/TPBrandLogo.d.ts +15 -0
- package/dist/types/assets-lib/TPIcon.d.ts +19 -0
- package/dist/types/assets-lib/TPIllustration.d.ts +17 -0
- package/dist/types/assets-lib/TPMotion.d.ts +25 -0
- package/dist/types/assets-lib/assetsManifest.d.ts +22 -0
- package/dist/types/assets-lib/iconsManifest.d.ts +14 -0
- package/dist/types/assets-lib/index.d.ts +8 -0
- package/dist/types/assets-lib/motionsManifest.d.ts +12 -0
- package/dist/types/assets-lib/runtimeUrl.d.ts +4 -0
- package/dist/types/core/components/TPActionSheet.d.ts +4 -0
- package/dist/types/core/components/TPAlert.d.ts +4 -0
- package/dist/types/core/components/TPAvatar.d.ts +7 -0
- package/dist/types/core/components/TPBadge.d.ts +7 -0
- package/dist/types/core/components/TPBottomSheet.d.ts +4 -0
- package/dist/types/core/components/TPButton.d.ts +4 -0
- package/dist/types/core/components/TPCheckbox.d.ts +11 -0
- package/dist/types/core/components/TPDatePicker.d.ts +7 -0
- package/dist/types/core/components/TPDaySwitcher.d.ts +7 -0
- package/dist/types/core/components/TPDivider.d.ts +7 -0
- package/dist/types/core/components/TPEmptyState.d.ts +7 -0
- package/dist/types/core/components/TPFixedButtonBar.d.ts +4 -0
- package/dist/types/core/components/TPFixedToast.d.ts +7 -0
- package/dist/types/core/components/TPHeader.d.ts +4 -0
- package/dist/types/core/components/TPIconButton.d.ts +11 -0
- package/dist/types/core/components/TPInput.d.ts +8 -0
- package/dist/types/core/components/TPKeyboard.d.ts +7 -0
- package/dist/types/core/components/TPLast7DaysPicker.d.ts +7 -0
- package/dist/types/core/components/TPLiquidGlass.d.ts +8 -0
- package/dist/types/core/components/TPListButton.d.ts +7 -0
- package/dist/types/core/components/TPListCard.d.ts +7 -0
- package/dist/types/core/components/TPListItem.d.ts +7 -0
- package/dist/types/core/components/TPMenu.d.ts +4 -0
- package/dist/types/core/components/TPMonthPicker.d.ts +7 -0
- package/dist/types/core/components/TPPageControl.d.ts +4 -0
- package/dist/types/core/components/TPPhoneFrame.d.ts +4 -0
- package/dist/types/core/components/TPPinInput.d.ts +7 -0
- package/dist/types/core/components/TPPopup.d.ts +4 -0
- package/dist/types/core/components/TPProgress.d.ts +7 -0
- package/dist/types/core/components/TPPrompt.d.ts +4 -0
- package/dist/types/core/components/TPRadio.d.ts +11 -0
- package/dist/types/core/components/TPSearchBar.d.ts +7 -0
- package/dist/types/core/components/TPSectionHeader.d.ts +7 -0
- package/dist/types/core/components/TPSectionNote.d.ts +7 -0
- package/dist/types/core/components/TPSegment.d.ts +4 -0
- package/dist/types/core/components/TPSkeleton.d.ts +7 -0
- package/dist/types/core/components/TPSlider.d.ts +4 -0
- package/dist/types/core/components/TPStatusBar.d.ts +4 -0
- package/dist/types/core/components/TPStepText.d.ts +7 -0
- package/dist/types/core/components/TPStepper.d.ts +7 -0
- package/dist/types/core/components/TPSwipeRow.d.ts +8 -0
- package/dist/types/core/components/TPSwitch.d.ts +4 -0
- package/dist/types/core/components/TPTabBar.d.ts +4 -0
- package/dist/types/core/components/TPTag.d.ts +7 -0
- package/dist/types/core/components/TPText.d.ts +7 -0
- package/dist/types/core/components/TPTimePicker.d.ts +7 -0
- package/dist/types/core/components/TPToast.d.ts +13 -0
- package/dist/types/core/components/TPTooltip.d.ts +7 -0
- package/dist/types/core/components/TPWheelPicker.d.ts +7 -0
- package/dist/types/core/index.d.ts +50 -0
- package/dist/types/core/types.d.ts +646 -0
- package/dist/types/lib/assets.d.ts +1 -0
- package/dist/types/lib/core.d.ts +2 -0
- package/dist/types/lib/index.d.ts +4 -0
- package/dist/types/lib/omada.d.ts +4 -0
- package/dist/types/lib/standalone.d.ts +8 -0
- package/dist/types/omada/blocks/OmadaDeviceListBlock.d.ts +42 -0
- package/dist/types/omada/blocks/OmadaFirmwareUpdateBlock.d.ts +23 -0
- package/dist/types/omada/blocks/OmadaIncidentsBlock.d.ts +26 -0
- package/dist/types/omada/blocks/OmadaPortPanelBlock.d.ts +31 -0
- package/dist/types/omada/blocks/OmadaScheduleBlock.d.ts +33 -0
- package/dist/types/omada/blocks/OmadaTopologyBlock.d.ts +26 -0
- package/dist/types/omada/blocks/OmadaWirelessNetworkBlock.d.ts +25 -0
- package/dist/types/omada/components/OmadaStandardInput.d.ts +23 -0
- package/dist/types/omada/index.d.ts +18 -0
- package/dist/types/omada/pages/OmadaAppDemo.d.ts +18 -0
- package/dist/types/omada/pages/OmadaControllerListPage.d.ts +26 -0
- package/dist/types/omada/pages/OmadaDeviceDetailPage.d.ts +15 -0
- package/dist/types/omada/pages/OmadaHealthDetailPage.d.ts +17 -0
- package/dist/types/omada/pages/OmadaLaunchLoadingPage.d.ts +24 -0
- package/dist/types/omada/pages/OmadaSiteClientsPage.d.ts +34 -0
- package/dist/types/omada/pages/OmadaSiteDashboardPage.d.ts +28 -0
- package/dist/types/omada/pages/OmadaSiteDevicesPage.d.ts +18 -0
- package/dist/types/omada/pages/OmadaSiteInsightsPage.d.ts +17 -0
- package/dist/types/omada/pages/OmadaSiteSettingsPage.d.ts +22 -0
- package/dist/types/theme/TPThemeProvider.d.ts +33 -0
- package/dist/types/theme/index.d.ts +2 -0
- package/dist/types/theme/tokens.d.ts +80 -0
- package/package.json +88 -4
- package/skills/tp-mobile-ui-kit/SKILL.md +226 -0
- package/skills/tp-mobile-ui-kit/references/catalog.json +12355 -0
- package/skills/tp-mobile-ui-kit/scripts/query-catalog.mjs +289 -0
- package/skills/tp-mobile-ui-kit/scripts/verify-demo.mjs +193 -0
- package/skills/tp-mobile-ui-kit/templates/multi-brand.html +319 -0
- package/skills/tp-mobile-ui-kit/templates/multi-brand.tsx +337 -0
- package/skills/tp-mobile-ui-kit/templates/omada-dashboard.html +138 -0
- package/skills/tp-mobile-ui-kit/templates/omada-dashboard.tsx +119 -0
- package/skills/tp-mobile-ui-kit/templates/omada-device-detail.html +158 -0
- package/skills/tp-mobile-ui-kit/templates/omada-device-detail.tsx +135 -0
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>TP-Design Multi-Brand Theme Showcase</title>
|
|
7
|
+
<link
|
|
8
|
+
rel="stylesheet"
|
|
9
|
+
href="https://cdn.jsdelivr.net/npm/@chenyqthu/tp-mobile-ui-kit@latest/dist/style.css"
|
|
10
|
+
/>
|
|
11
|
+
<script src="https://cdn.jsdelivr.net/npm/@chenyqthu/tp-mobile-ui-kit@latest/dist/standalone.js"></script>
|
|
12
|
+
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
|
13
|
+
</head>
|
|
14
|
+
<body style="margin: 0;">
|
|
15
|
+
<div id="root"></div>
|
|
16
|
+
<script type="text/babel">
|
|
17
|
+
const { useState } = TPMobileUI.React;
|
|
18
|
+
const {
|
|
19
|
+
TP_BRANDS,
|
|
20
|
+
TPThemeProvider,
|
|
21
|
+
TPToastProvider,
|
|
22
|
+
TPPhoneFrame,
|
|
23
|
+
TPStatusBar,
|
|
24
|
+
TPHeader,
|
|
25
|
+
TPTabBar,
|
|
26
|
+
TPSegment,
|
|
27
|
+
TPButton,
|
|
28
|
+
TPSwitch,
|
|
29
|
+
TPSlider,
|
|
30
|
+
TPListCard,
|
|
31
|
+
TPListItem,
|
|
32
|
+
TPSectionHeader,
|
|
33
|
+
TPTag,
|
|
34
|
+
TPBadge,
|
|
35
|
+
TPSearchBar,
|
|
36
|
+
TPAlert,
|
|
37
|
+
TPBrandLogo,
|
|
38
|
+
TPIllustration,
|
|
39
|
+
TPIcon,
|
|
40
|
+
useTPTheme,
|
|
41
|
+
useTPToast,
|
|
42
|
+
} = window.TPMobileUI;
|
|
43
|
+
|
|
44
|
+
const BRAND_LOGO_MAP = {
|
|
45
|
+
omada: 'omada',
|
|
46
|
+
tapo: 'tapo',
|
|
47
|
+
tether: 'tether',
|
|
48
|
+
mercusys: 'mercusys',
|
|
49
|
+
deco: 'deco',
|
|
50
|
+
ux: 'tp-link',
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const TAB_ITEMS = [
|
|
54
|
+
{ key: 'controls', label: 'Controls', icon: 'tabbar-home-off', activeIcon: 'tabbar-home-on' },
|
|
55
|
+
{ key: 'lists', label: 'Devices', icon: 'tabbar-device-off', activeIcon: 'tabbar-device-on', badge: 2 },
|
|
56
|
+
{ key: 'assets', label: 'Assets', icon: 'tabbar-settings-off', activeIcon: 'tabbar-settings-on' },
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
function MultiBrandContent() {
|
|
60
|
+
const { brand, mode, resolvedMode, os, tokens, setBrand, setMode, setOS } = useTPTheme();
|
|
61
|
+
const toast = useTPToast();
|
|
62
|
+
|
|
63
|
+
const [activeTab, setActiveTab] = useState('controls');
|
|
64
|
+
const [txPower, setTxPower] = useState(75);
|
|
65
|
+
const [autoOptimize, setAutoOptimize] = useState(true);
|
|
66
|
+
const [search, setSearch] = useState('');
|
|
67
|
+
const [alertOpen, setAlertOpen] = useState(false);
|
|
68
|
+
|
|
69
|
+
const brandMeta = TP_BRANDS.find((b) => b.id === brand) || TP_BRANDS[0];
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<div
|
|
73
|
+
style={{
|
|
74
|
+
minHeight: '100vh',
|
|
75
|
+
background: tokens.background,
|
|
76
|
+
color: tokens.textPrimary,
|
|
77
|
+
padding: '20px 16px 36px',
|
|
78
|
+
boxSizing: 'border-box',
|
|
79
|
+
display: 'flex',
|
|
80
|
+
flexDirection: 'column',
|
|
81
|
+
alignItems: 'center',
|
|
82
|
+
gap: 14,
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
{/* Brand & Mode Control Bar */}
|
|
86
|
+
<div
|
|
87
|
+
style={{
|
|
88
|
+
width: '100%',
|
|
89
|
+
maxWidth: 780,
|
|
90
|
+
padding: '12px 16px',
|
|
91
|
+
borderRadius: 14,
|
|
92
|
+
background: tokens.card,
|
|
93
|
+
border: `1px solid ${tokens.listDivider}`,
|
|
94
|
+
display: 'flex',
|
|
95
|
+
flexDirection: 'column',
|
|
96
|
+
gap: 10,
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 6, alignItems: 'center', justifyContent: 'space-between' }}>
|
|
100
|
+
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 6 }}>
|
|
101
|
+
{TP_BRANDS.map((b) => (
|
|
102
|
+
<TPTag
|
|
103
|
+
key={b.id}
|
|
104
|
+
selected={brand === b.id}
|
|
105
|
+
onClick={() => setBrand(b.id)}
|
|
106
|
+
>
|
|
107
|
+
{b.label}
|
|
108
|
+
</TPTag>
|
|
109
|
+
))}
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div style={{ display: 'flex', gap: 6, alignItems: 'center' }}>
|
|
113
|
+
<TPSegment
|
|
114
|
+
variant="pill"
|
|
115
|
+
fullWidth={false}
|
|
116
|
+
options={[
|
|
117
|
+
{ key: 'light', label: 'Light' },
|
|
118
|
+
{ key: 'dark', label: 'Dark' },
|
|
119
|
+
{ key: 'system', label: 'OS' },
|
|
120
|
+
]}
|
|
121
|
+
value={mode}
|
|
122
|
+
onChange={(v) => setMode(v)}
|
|
123
|
+
/>
|
|
124
|
+
<TPSegment
|
|
125
|
+
variant="pill"
|
|
126
|
+
fullWidth={false}
|
|
127
|
+
options={[
|
|
128
|
+
{ key: 'ios', label: 'iOS' },
|
|
129
|
+
{ key: 'android', label: 'Android' },
|
|
130
|
+
]}
|
|
131
|
+
value={os}
|
|
132
|
+
onChange={(v) => setOS(v)}
|
|
133
|
+
/>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
<div style={{ fontSize: 12, color: tokens.textSecondary }}>
|
|
137
|
+
{brandMeta.description}
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
|
|
141
|
+
{/* Mobile Frame */}
|
|
142
|
+
<TPPhoneFrame
|
|
143
|
+
device={os === 'android' ? 'android' : 'iphone16pro'}
|
|
144
|
+
statusBar={<TPStatusBar time="10:51" os={os} signalStrength={4} wifiStrength={3} battery={94} />}
|
|
145
|
+
bottomBar={
|
|
146
|
+
<TPTabBar
|
|
147
|
+
variant={os === 'ios' ? 'floating-pill' : 'docked'}
|
|
148
|
+
items={TAB_ITEMS}
|
|
149
|
+
activeKey={activeTab}
|
|
150
|
+
onChange={setActiveTab}
|
|
151
|
+
/>
|
|
152
|
+
}
|
|
153
|
+
>
|
|
154
|
+
<TPHeader
|
|
155
|
+
variant="standard"
|
|
156
|
+
title={brandMeta.label}
|
|
157
|
+
subtitle={`${resolvedMode.toUpperCase()} • ${os.toUpperCase()}`}
|
|
158
|
+
rightBadge={2}
|
|
159
|
+
right={
|
|
160
|
+
<button
|
|
161
|
+
type="button"
|
|
162
|
+
className="tp-header-icon-btn"
|
|
163
|
+
aria-label="Refresh tokens"
|
|
164
|
+
onClick={() => toast.show({ type: 'success', message: `${brandMeta.label} (${resolvedMode}) synced` })}
|
|
165
|
+
>
|
|
166
|
+
<TPIcon name="nav-refresh" size={18} />
|
|
167
|
+
</button>
|
|
168
|
+
}
|
|
169
|
+
/>
|
|
170
|
+
|
|
171
|
+
<div style={{ padding: '12px 16px 24px', display: 'flex', flexDirection: 'column', gap: 12 }}>
|
|
172
|
+
<TPSegment
|
|
173
|
+
variant="pill"
|
|
174
|
+
options={[
|
|
175
|
+
{ key: 'controls', label: 'Controls' },
|
|
176
|
+
{ key: 'lists', label: 'Lists' },
|
|
177
|
+
{ key: 'assets', label: 'Assets' },
|
|
178
|
+
]}
|
|
179
|
+
value={activeTab}
|
|
180
|
+
onChange={setActiveTab}
|
|
181
|
+
/>
|
|
182
|
+
|
|
183
|
+
{activeTab === 'controls' && (
|
|
184
|
+
<>
|
|
185
|
+
<TPListCard divided>
|
|
186
|
+
<TPListItem
|
|
187
|
+
leading={<TPBrandLogo name={BRAND_LOGO_MAP[brand]} size={36} />}
|
|
188
|
+
title={`${brandMeta.label} Theme`}
|
|
189
|
+
subtitle={`Focus ${tokens.focus} • Btn radius ${tokens.radiusButton}px`}
|
|
190
|
+
trailing={<TPBadge count={tokens.buttonSecondaryStroke === 2 ? '2px' : 'Fill'} tone="focus" />}
|
|
191
|
+
/>
|
|
192
|
+
<TPListItem
|
|
193
|
+
title="Auto-Optimize Channel"
|
|
194
|
+
subtitle="Adapts switch track to brand focus color"
|
|
195
|
+
switchProps={{ checked: autoOptimize, onChange: setAutoOptimize }}
|
|
196
|
+
/>
|
|
197
|
+
</TPListCard>
|
|
198
|
+
|
|
199
|
+
<TPListCard padding="md">
|
|
200
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
|
|
201
|
+
<TPSlider
|
|
202
|
+
min={0}
|
|
203
|
+
max={100}
|
|
204
|
+
step={25}
|
|
205
|
+
value={txPower}
|
|
206
|
+
onChange={setTxPower}
|
|
207
|
+
showValue
|
|
208
|
+
unit="% Tx Power"
|
|
209
|
+
marks={[
|
|
210
|
+
{ value: 0, label: 'Low' },
|
|
211
|
+
{ value: 50, label: 'Mid' },
|
|
212
|
+
{ value: 100, label: 'Max' },
|
|
213
|
+
]}
|
|
214
|
+
/>
|
|
215
|
+
<TPButton
|
|
216
|
+
variant="primary"
|
|
217
|
+
block
|
|
218
|
+
onClick={() => toast.show({ type: 'success', message: `Applied ${brandMeta.label} config (${txPower}%)` })}
|
|
219
|
+
>
|
|
220
|
+
Primary Action ({tokens.radiusButton}px)
|
|
221
|
+
</TPButton>
|
|
222
|
+
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8 }}>
|
|
223
|
+
<TPButton variant="secondary" onClick={() => setAlertOpen(true)}>
|
|
224
|
+
Open Alert
|
|
225
|
+
</TPButton>
|
|
226
|
+
<TPButton variant="tonal" onClick={() => toast.show({ type: 'info', message: `OS style: ${os}` })}>
|
|
227
|
+
Show Toast
|
|
228
|
+
</TPButton>
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
</TPListCard>
|
|
232
|
+
</>
|
|
233
|
+
)}
|
|
234
|
+
|
|
235
|
+
{activeTab === 'lists' && (
|
|
236
|
+
<>
|
|
237
|
+
<TPSearchBar value={search} placeholder="Filter components..." onChange={setSearch} />
|
|
238
|
+
<TPSectionHeader title="Connected Nodes" count={3} />
|
|
239
|
+
<TPListCard divided>
|
|
240
|
+
<TPListItem
|
|
241
|
+
leading={<TPIcon name="client-ap" size={32} />}
|
|
242
|
+
title="Living Room Node"
|
|
243
|
+
subtitle="192.168.0.2 • 5 GHz"
|
|
244
|
+
value="Online"
|
|
245
|
+
arrow
|
|
246
|
+
/>
|
|
247
|
+
<TPListItem
|
|
248
|
+
leading={<TPIcon name="client-switch" size={32} />}
|
|
249
|
+
title="Core Switch"
|
|
250
|
+
subtitle="192.168.0.1 • PoE+"
|
|
251
|
+
badge={1}
|
|
252
|
+
arrow
|
|
253
|
+
/>
|
|
254
|
+
<TPListItem
|
|
255
|
+
leading={<TPIcon name="client-macbook" size={32} />}
|
|
256
|
+
title="Workstation"
|
|
257
|
+
subtitle="192.168.0.13"
|
|
258
|
+
checked
|
|
259
|
+
/>
|
|
260
|
+
</TPListCard>
|
|
261
|
+
</>
|
|
262
|
+
)}
|
|
263
|
+
|
|
264
|
+
{activeTab === 'assets' && (
|
|
265
|
+
<>
|
|
266
|
+
<TPListCard padding="md">
|
|
267
|
+
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 10 }}>
|
|
268
|
+
<TPIllustration name="mlo-network" width={260} />
|
|
269
|
+
<div style={{ fontSize: 13, color: tokens.textSecondary, textAlign: 'center' }}>
|
|
270
|
+
Illustrations automatically follow Light / Dark theme mode
|
|
271
|
+
</div>
|
|
272
|
+
</div>
|
|
273
|
+
</TPListCard>
|
|
274
|
+
<TPSectionHeader title="Brand Logos" count={6} />
|
|
275
|
+
<TPListCard padding="md">
|
|
276
|
+
<div style={{ display: 'flex', flexWrap: 'wrap', justifyContent: 'space-around', gap: 12 }}>
|
|
277
|
+
<TPBrandLogo name="omada" size={40} />
|
|
278
|
+
<TPBrandLogo name="tapo" size={40} />
|
|
279
|
+
<TPBrandLogo name="tether" size={40} />
|
|
280
|
+
<TPBrandLogo name="mercusys" size={40} />
|
|
281
|
+
<TPBrandLogo name="deco" size={40} />
|
|
282
|
+
<TPBrandLogo name="vigi" size={40} />
|
|
283
|
+
</div>
|
|
284
|
+
</TPListCard>
|
|
285
|
+
</>
|
|
286
|
+
)}
|
|
287
|
+
</div>
|
|
288
|
+
</TPPhoneFrame>
|
|
289
|
+
|
|
290
|
+
<TPAlert
|
|
291
|
+
open={alertOpen}
|
|
292
|
+
os={os}
|
|
293
|
+
title={`Reset ${brandMeta.label} Settings?`}
|
|
294
|
+
message={`This ${os === 'ios' ? 'iOS frosted dialog' : 'Android Material dialog'} adapts automatically to TPThemeProvider.`}
|
|
295
|
+
actions={[
|
|
296
|
+
{ label: 'Cancel', role: 'cancel' },
|
|
297
|
+
{
|
|
298
|
+
label: 'Reset',
|
|
299
|
+
role: 'destructive',
|
|
300
|
+
onClick: () => toast.show({ type: 'warning', message: 'Settings reset' }),
|
|
301
|
+
},
|
|
302
|
+
]}
|
|
303
|
+
onClose={() => setAlertOpen(false)}
|
|
304
|
+
/>
|
|
305
|
+
</div>
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
TPMobileUI.render(
|
|
310
|
+
<TPThemeProvider defaultBrand="omada" defaultMode="light" defaultOS="ios">
|
|
311
|
+
<TPToastProvider>
|
|
312
|
+
<MultiBrandContent />
|
|
313
|
+
</TPToastProvider>
|
|
314
|
+
</TPThemeProvider>,
|
|
315
|
+
'#root',
|
|
316
|
+
);
|
|
317
|
+
</script>
|
|
318
|
+
</body>
|
|
319
|
+
</html>
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import '@chenyqthu/tp-mobile-ui-kit/style.css';
|
|
3
|
+
import {
|
|
4
|
+
TP_BRANDS,
|
|
5
|
+
TPAlert,
|
|
6
|
+
TPBadge,
|
|
7
|
+
TPButton,
|
|
8
|
+
TPHeader,
|
|
9
|
+
TPListCard,
|
|
10
|
+
TPListItem,
|
|
11
|
+
TPPhoneFrame,
|
|
12
|
+
TPSearchBar,
|
|
13
|
+
TPSectionHeader,
|
|
14
|
+
TPSegment,
|
|
15
|
+
TPSlider,
|
|
16
|
+
TPStatusBar,
|
|
17
|
+
TPTabBar,
|
|
18
|
+
TPTag,
|
|
19
|
+
TPThemeProvider,
|
|
20
|
+
TPToastProvider,
|
|
21
|
+
useTPTheme,
|
|
22
|
+
useTPToast,
|
|
23
|
+
type TPBrand,
|
|
24
|
+
type TPColorMode,
|
|
25
|
+
type TPPlatformOS,
|
|
26
|
+
type TPTabBarItem,
|
|
27
|
+
} from '@chenyqthu/tp-mobile-ui-kit/core';
|
|
28
|
+
import {
|
|
29
|
+
TPBrandLogo,
|
|
30
|
+
TPIcon,
|
|
31
|
+
TPIllustration,
|
|
32
|
+
type TPBrandLogoName,
|
|
33
|
+
} from '@chenyqthu/tp-mobile-ui-kit/assets';
|
|
34
|
+
|
|
35
|
+
const BRAND_LOGO_MAP: Record<TPBrand, TPBrandLogoName> = {
|
|
36
|
+
omada: 'omada',
|
|
37
|
+
tapo: 'tapo',
|
|
38
|
+
tether: 'tether',
|
|
39
|
+
mercusys: 'mercusys',
|
|
40
|
+
deco: 'deco',
|
|
41
|
+
ux: 'tp-link',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const TAB_ITEMS: readonly TPTabBarItem[] = [
|
|
45
|
+
{ key: 'controls', label: 'Controls', icon: 'tabbar-home-off', activeIcon: 'tabbar-home-on' },
|
|
46
|
+
{ key: 'lists', label: 'Devices', icon: 'tabbar-device-off', activeIcon: 'tabbar-device-on', badge: 2 },
|
|
47
|
+
{ key: 'assets', label: 'Assets', icon: 'tabbar-settings-off', activeIcon: 'tabbar-settings-on' },
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
const MultiBrandContent: React.FC = () => {
|
|
51
|
+
const { brand, mode, resolvedMode, os, tokens, setBrand, setMode, setOS } = useTPTheme();
|
|
52
|
+
const toast = useTPToast();
|
|
53
|
+
|
|
54
|
+
const [activeTab, setActiveTab] = useState('controls');
|
|
55
|
+
const [txPower, setTxPower] = useState(75);
|
|
56
|
+
const [autoOptimize, setAutoOptimize] = useState(true);
|
|
57
|
+
const [search, setSearch] = useState('');
|
|
58
|
+
const [alertOpen, setAlertOpen] = useState(false);
|
|
59
|
+
|
|
60
|
+
const brandMeta = TP_BRANDS.find((b) => b.id === brand) ?? TP_BRANDS[0];
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div
|
|
64
|
+
style={{
|
|
65
|
+
minHeight: '100vh',
|
|
66
|
+
background: tokens.background,
|
|
67
|
+
color: tokens.textPrimary,
|
|
68
|
+
padding: '20px 16px 36px',
|
|
69
|
+
boxSizing: 'border-box',
|
|
70
|
+
display: 'flex',
|
|
71
|
+
flexDirection: 'column',
|
|
72
|
+
alignItems: 'center',
|
|
73
|
+
gap: 14,
|
|
74
|
+
}}
|
|
75
|
+
>
|
|
76
|
+
<div
|
|
77
|
+
style={{
|
|
78
|
+
width: '100%',
|
|
79
|
+
maxWidth: 780,
|
|
80
|
+
padding: '12px 16px',
|
|
81
|
+
borderRadius: 14,
|
|
82
|
+
background: tokens.card,
|
|
83
|
+
border: `1px solid ${tokens.listDivider}`,
|
|
84
|
+
display: 'flex',
|
|
85
|
+
flexDirection: 'column',
|
|
86
|
+
gap: 10,
|
|
87
|
+
}}
|
|
88
|
+
>
|
|
89
|
+
<div
|
|
90
|
+
style={{
|
|
91
|
+
display: 'flex',
|
|
92
|
+
flexWrap: 'wrap',
|
|
93
|
+
gap: 6,
|
|
94
|
+
alignItems: 'center',
|
|
95
|
+
justifyContent: 'space-between',
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
98
|
+
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 6 }}>
|
|
99
|
+
{TP_BRANDS.map((b) => (
|
|
100
|
+
<TPTag key={b.id} selected={brand === b.id} onClick={() => setBrand(b.id)}>
|
|
101
|
+
{b.label}
|
|
102
|
+
</TPTag>
|
|
103
|
+
))}
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
<div style={{ display: 'flex', gap: 6, alignItems: 'center' }}>
|
|
107
|
+
<TPSegment
|
|
108
|
+
variant="pill"
|
|
109
|
+
fullWidth={false}
|
|
110
|
+
options={[
|
|
111
|
+
{ key: 'light', label: 'Light' },
|
|
112
|
+
{ key: 'dark', label: 'Dark' },
|
|
113
|
+
{ key: 'system', label: 'OS' },
|
|
114
|
+
]}
|
|
115
|
+
value={mode}
|
|
116
|
+
onChange={(v) => setMode(v as TPColorMode)}
|
|
117
|
+
/>
|
|
118
|
+
<TPSegment
|
|
119
|
+
variant="pill"
|
|
120
|
+
fullWidth={false}
|
|
121
|
+
options={[
|
|
122
|
+
{ key: 'ios', label: 'iOS' },
|
|
123
|
+
{ key: 'android', label: 'Android' },
|
|
124
|
+
]}
|
|
125
|
+
value={os}
|
|
126
|
+
onChange={(v) => setOS(v as TPPlatformOS)}
|
|
127
|
+
/>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
<div style={{ fontSize: 12, color: tokens.textSecondary }}>{brandMeta.description}</div>
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
<TPPhoneFrame
|
|
134
|
+
device={os === 'android' ? 'android' : 'iphone16pro'}
|
|
135
|
+
statusBar={
|
|
136
|
+
<TPStatusBar time="10:51" os={os} signalStrength={4} wifiStrength={3} battery={94} />
|
|
137
|
+
}
|
|
138
|
+
bottomBar={
|
|
139
|
+
<TPTabBar
|
|
140
|
+
variant={os === 'ios' ? 'floating-pill' : 'docked'}
|
|
141
|
+
items={TAB_ITEMS}
|
|
142
|
+
activeKey={activeTab}
|
|
143
|
+
onChange={setActiveTab}
|
|
144
|
+
/>
|
|
145
|
+
}
|
|
146
|
+
>
|
|
147
|
+
<TPHeader
|
|
148
|
+
variant="standard"
|
|
149
|
+
title={brandMeta.label}
|
|
150
|
+
subtitle={`${resolvedMode.toUpperCase()} • ${os.toUpperCase()}`}
|
|
151
|
+
rightBadge={2}
|
|
152
|
+
right={
|
|
153
|
+
<button
|
|
154
|
+
type="button"
|
|
155
|
+
className="tp-header-icon-btn"
|
|
156
|
+
aria-label="Refresh tokens"
|
|
157
|
+
onClick={() =>
|
|
158
|
+
toast.show({ type: 'success', message: `${brandMeta.label} (${resolvedMode}) synced` })
|
|
159
|
+
}
|
|
160
|
+
>
|
|
161
|
+
<TPIcon name="nav-refresh" size={18} />
|
|
162
|
+
</button>
|
|
163
|
+
}
|
|
164
|
+
/>
|
|
165
|
+
|
|
166
|
+
<div style={{ padding: '12px 16px 24px', display: 'flex', flexDirection: 'column', gap: 12 }}>
|
|
167
|
+
<TPSegment
|
|
168
|
+
variant="pill"
|
|
169
|
+
options={[
|
|
170
|
+
{ key: 'controls', label: 'Controls' },
|
|
171
|
+
{ key: 'lists', label: 'Lists' },
|
|
172
|
+
{ key: 'assets', label: 'Assets' },
|
|
173
|
+
]}
|
|
174
|
+
value={activeTab}
|
|
175
|
+
onChange={setActiveTab}
|
|
176
|
+
/>
|
|
177
|
+
|
|
178
|
+
{activeTab === 'controls' && (
|
|
179
|
+
<>
|
|
180
|
+
<TPListCard divided>
|
|
181
|
+
<TPListItem
|
|
182
|
+
leading={<TPBrandLogo name={BRAND_LOGO_MAP[brand]} size={36} />}
|
|
183
|
+
title={`${brandMeta.label} Theme`}
|
|
184
|
+
subtitle={`Focus ${tokens.focus} • Btn radius ${tokens.radiusButton}px`}
|
|
185
|
+
trailing={
|
|
186
|
+
<TPBadge
|
|
187
|
+
count={tokens.buttonSecondaryStroke === 2 ? '2px' : 'Fill'}
|
|
188
|
+
tone="focus"
|
|
189
|
+
/>
|
|
190
|
+
}
|
|
191
|
+
/>
|
|
192
|
+
<TPListItem
|
|
193
|
+
title="Auto-Optimize Channel"
|
|
194
|
+
subtitle="Adapts switch track to brand focus color"
|
|
195
|
+
switchProps={{ checked: autoOptimize, onChange: setAutoOptimize }}
|
|
196
|
+
/>
|
|
197
|
+
</TPListCard>
|
|
198
|
+
|
|
199
|
+
<TPListCard padding="md">
|
|
200
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 10 }}>
|
|
201
|
+
<TPSlider
|
|
202
|
+
min={0}
|
|
203
|
+
max={100}
|
|
204
|
+
step={25}
|
|
205
|
+
value={txPower}
|
|
206
|
+
onChange={setTxPower}
|
|
207
|
+
showValue
|
|
208
|
+
unit="% Tx Power"
|
|
209
|
+
marks={[
|
|
210
|
+
{ value: 0, label: 'Low' },
|
|
211
|
+
{ value: 50, label: 'Mid' },
|
|
212
|
+
{ value: 100, label: 'Max' },
|
|
213
|
+
]}
|
|
214
|
+
/>
|
|
215
|
+
<TPButton
|
|
216
|
+
variant="primary"
|
|
217
|
+
block
|
|
218
|
+
onClick={() =>
|
|
219
|
+
toast.show({
|
|
220
|
+
type: 'success',
|
|
221
|
+
message: `Applied ${brandMeta.label} config (${txPower}%)`,
|
|
222
|
+
})
|
|
223
|
+
}
|
|
224
|
+
>
|
|
225
|
+
Primary Action ({tokens.radiusButton}px)
|
|
226
|
+
</TPButton>
|
|
227
|
+
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8 }}>
|
|
228
|
+
<TPButton variant="secondary" onClick={() => setAlertOpen(true)}>
|
|
229
|
+
Open Alert
|
|
230
|
+
</TPButton>
|
|
231
|
+
<TPButton
|
|
232
|
+
variant="tonal"
|
|
233
|
+
onClick={() => toast.show({ type: 'info', message: `OS style: ${os}` })}
|
|
234
|
+
>
|
|
235
|
+
Show Toast
|
|
236
|
+
</TPButton>
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
</TPListCard>
|
|
240
|
+
</>
|
|
241
|
+
)}
|
|
242
|
+
|
|
243
|
+
{activeTab === 'lists' && (
|
|
244
|
+
<>
|
|
245
|
+
<TPSearchBar value={search} placeholder="Filter components..." onChange={setSearch} />
|
|
246
|
+
<TPSectionHeader title="Connected Nodes" count={3} />
|
|
247
|
+
<TPListCard divided>
|
|
248
|
+
<TPListItem
|
|
249
|
+
leading={<TPIcon name="client-ap" size={32} />}
|
|
250
|
+
title="Living Room Node"
|
|
251
|
+
subtitle="192.168.0.2 • 5 GHz"
|
|
252
|
+
value="Online"
|
|
253
|
+
arrow
|
|
254
|
+
/>
|
|
255
|
+
<TPListItem
|
|
256
|
+
leading={<TPIcon name="client-switch" size={32} />}
|
|
257
|
+
title="Core Switch"
|
|
258
|
+
subtitle="192.168.0.1 • PoE+"
|
|
259
|
+
badge={1}
|
|
260
|
+
arrow
|
|
261
|
+
/>
|
|
262
|
+
<TPListItem
|
|
263
|
+
leading={<TPIcon name="client-macbook" size={32} />}
|
|
264
|
+
title="Workstation"
|
|
265
|
+
subtitle="192.168.0.13"
|
|
266
|
+
checked
|
|
267
|
+
/>
|
|
268
|
+
</TPListCard>
|
|
269
|
+
</>
|
|
270
|
+
)}
|
|
271
|
+
|
|
272
|
+
{activeTab === 'assets' && (
|
|
273
|
+
<>
|
|
274
|
+
<TPListCard padding="md">
|
|
275
|
+
<div
|
|
276
|
+
style={{
|
|
277
|
+
display: 'flex',
|
|
278
|
+
flexDirection: 'column',
|
|
279
|
+
alignItems: 'center',
|
|
280
|
+
gap: 10,
|
|
281
|
+
}}
|
|
282
|
+
>
|
|
283
|
+
<TPIllustration name="mlo-network" width={260} />
|
|
284
|
+
<div style={{ fontSize: 13, color: tokens.textSecondary, textAlign: 'center' }}>
|
|
285
|
+
Illustrations automatically follow Light / Dark theme mode
|
|
286
|
+
</div>
|
|
287
|
+
</div>
|
|
288
|
+
</TPListCard>
|
|
289
|
+
<TPSectionHeader title="Brand Logos" count={6} />
|
|
290
|
+
<TPListCard padding="md">
|
|
291
|
+
<div
|
|
292
|
+
style={{
|
|
293
|
+
display: 'flex',
|
|
294
|
+
flexWrap: 'wrap',
|
|
295
|
+
justifyContent: 'space-around',
|
|
296
|
+
gap: 12,
|
|
297
|
+
}}
|
|
298
|
+
>
|
|
299
|
+
<TPBrandLogo name="omada" size={40} />
|
|
300
|
+
<TPBrandLogo name="tapo" size={40} />
|
|
301
|
+
<TPBrandLogo name="tether" size={40} />
|
|
302
|
+
<TPBrandLogo name="mercusys" size={40} />
|
|
303
|
+
<TPBrandLogo name="deco" size={40} />
|
|
304
|
+
<TPBrandLogo name="vigi" size={40} />
|
|
305
|
+
</div>
|
|
306
|
+
</TPListCard>
|
|
307
|
+
</>
|
|
308
|
+
)}
|
|
309
|
+
</div>
|
|
310
|
+
</TPPhoneFrame>
|
|
311
|
+
|
|
312
|
+
<TPAlert
|
|
313
|
+
open={alertOpen}
|
|
314
|
+
os={os}
|
|
315
|
+
title={`Reset ${brandMeta.label} Settings?`}
|
|
316
|
+
message={`This ${os === 'ios' ? 'iOS frosted dialog' : 'Android Material dialog'} adapts automatically to TPThemeProvider.`}
|
|
317
|
+
actions={[
|
|
318
|
+
{ label: 'Cancel', role: 'cancel' },
|
|
319
|
+
{
|
|
320
|
+
label: 'Reset',
|
|
321
|
+
role: 'destructive',
|
|
322
|
+
onClick: () => toast.show({ type: 'warning', message: 'Settings reset' }),
|
|
323
|
+
},
|
|
324
|
+
]}
|
|
325
|
+
onClose={() => setAlertOpen(false)}
|
|
326
|
+
/>
|
|
327
|
+
</div>
|
|
328
|
+
);
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
export const MultiBrandTemplate: React.FC = () => (
|
|
332
|
+
<TPThemeProvider defaultBrand="omada" defaultMode="light" defaultOS="ios">
|
|
333
|
+
<TPToastProvider>
|
|
334
|
+
<MultiBrandContent />
|
|
335
|
+
</TPToastProvider>
|
|
336
|
+
</TPThemeProvider>
|
|
337
|
+
);
|