@vetc-miniapp/ui-react 0.0.23 → 0.0.25
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 +375 -56
- package/dist/bridge.d.ts +11 -0
- package/dist/bridge.js +20 -0
- package/dist/components/app.d.ts +6 -0
- package/dist/components/app.js +34 -0
- package/dist/components/avatar/Avatar.d.ts +21 -0
- package/dist/components/avatar/Avatar.js +33 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/bottom-sheet/BottomSheet.d.ts +19 -0
- package/dist/components/bottom-sheet/BottomSheet.js +70 -0
- package/dist/components/bottom-sheet/index.d.ts +2 -0
- package/dist/components/bottom-sheet/index.js +1 -0
- package/dist/components/button/Button.d.ts +32 -0
- package/dist/components/button/Button.js +165 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/button-group/ButtonGroup.d.ts +28 -0
- package/dist/components/button-group/ButtonGroup.js +21 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/button-group/index.js +1 -0
- package/dist/components/card/Card.d.ts +18 -0
- package/dist/components/card/Card.js +35 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/checkbox/Checkbox.d.ts +41 -0
- package/dist/components/checkbox/Checkbox.js +94 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +1 -0
- package/dist/components/chip/Chip.d.ts +24 -0
- package/dist/components/chip/Chip.js +83 -0
- package/dist/components/chip/index.d.ts +2 -0
- package/dist/components/chip/index.js +1 -0
- package/dist/components/dialog/Dialog.d.ts +19 -0
- package/dist/components/dialog/Dialog.js +51 -0
- package/dist/components/dialog/index.d.ts +2 -0
- package/dist/components/dialog/index.js +1 -0
- package/dist/components/divider/Divider.d.ts +16 -0
- package/dist/components/divider/Divider.js +18 -0
- package/dist/components/divider/index.d.ts +2 -0
- package/dist/components/divider/index.js +1 -0
- package/dist/components/input/Input.d.ts +40 -0
- package/dist/components/input/Input.js +51 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +1 -0
- package/dist/components/list/List.d.ts +31 -0
- package/dist/components/list/List.js +72 -0
- package/dist/components/list/index.d.ts +2 -0
- package/dist/components/list/index.js +1 -0
- package/dist/components/loading/Loading.d.ts +28 -0
- package/dist/components/loading/Loading.js +33 -0
- package/dist/components/loading/index.d.ts +2 -0
- package/dist/components/loading/index.js +1 -0
- package/dist/components/modal/Modal.d.ts +38 -0
- package/dist/components/modal/Modal.js +50 -0
- package/dist/components/modal/index.d.ts +2 -0
- package/dist/components/modal/index.js +1 -0
- package/dist/components/navigation-bar/NavigationBar.d.ts +44 -0
- package/dist/components/navigation-bar/NavigationBar.js +70 -0
- package/dist/components/navigation-bar/index.d.ts +2 -0
- package/dist/components/navigation-bar/index.js +1 -0
- package/dist/components/radio/Radio.d.ts +40 -0
- package/dist/components/radio/Radio.js +88 -0
- package/dist/components/radio/index.d.ts +2 -0
- package/dist/components/radio/index.js +1 -0
- package/dist/components/select/Select.d.ts +29 -0
- package/dist/components/select/Select.js +30 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +1 -0
- package/dist/components/switch/Switch.d.ts +23 -0
- package/dist/components/switch/Switch.js +81 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +1 -0
- package/dist/components/tab-bar/TabBar.d.ts +28 -0
- package/dist/components/tab-bar/TabBar.js +60 -0
- package/dist/components/tab-bar/index.d.ts +2 -0
- package/dist/components/tab-bar/index.js +1 -0
- package/dist/components/textarea/Textarea.d.ts +31 -0
- package/dist/components/textarea/Textarea.js +33 -0
- package/dist/components/textarea/index.d.ts +2 -0
- package/dist/components/textarea/index.js +1 -0
- package/dist/components/toast/Toast.d.ts +41 -0
- package/dist/components/toast/Toast.js +61 -0
- package/dist/components/toast/index.d.ts +2 -0
- package/dist/components/toast/index.js +1 -0
- package/dist/components/typography/Typography.d.ts +45 -0
- package/dist/components/typography/Typography.js +143 -0
- package/dist/components/typography/index.d.ts +2 -0
- package/dist/components/typography/index.js +1 -0
- package/dist/hooks/use-app-pause.d.ts +6 -0
- package/dist/hooks/use-app-pause.js +29 -0
- package/dist/hooks/use-app-resume.d.ts +6 -0
- package/dist/hooks/use-app-resume.js +28 -0
- package/{src/ui-react/hooks/use-app-state.ts → dist/hooks/use-app-state.d.ts} +0 -1
- package/dist/hooks/use-app-state.js +1 -0
- package/dist/hooks/use-did-hide.d.ts +6 -0
- package/dist/hooks/use-did-hide.js +21 -0
- package/dist/hooks/use-did-show.d.ts +6 -0
- package/dist/hooks/use-did-show.js +21 -0
- package/dist/hooks/use-listener-scan-qr.d.ts +21 -0
- package/dist/hooks/use-listener-scan-qr.js +29 -0
- package/dist/hooks/use-navigate.d.ts +8 -0
- package/dist/hooks/use-navigate.js +23 -0
- package/dist/hooks/use-tap-app-bar.d.ts +6 -0
- package/dist/hooks/use-tap-app-bar.js +21 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.js +41 -0
- package/dist/styles/VETCProvider.d.ts +114 -0
- package/dist/styles/VETCProvider.js +124 -0
- package/dist/styles/tokens.css +448 -0
- package/dist/tokens/colors.d.ts +127 -0
- package/dist/tokens/colors.js +75 -0
- package/dist/tokens/index.d.ts +3 -0
- package/dist/tokens/index.js +3 -0
- package/dist/tokens/spacing.d.ts +56 -0
- package/dist/tokens/spacing.js +56 -0
- package/dist/tokens/typography.d.ts +121 -0
- package/dist/tokens/typography.js +57 -0
- package/dist/types/app.d.ts +21 -0
- package/dist/types/app.js +1 -0
- package/package.json +26 -8
- package/src/dist/ui-react/index.js +0 -2
- package/src/dist/ui-react/index.js.LICENSE.txt +0 -11
- package/src/ui-react/bridge.js +0 -36
- package/src/ui-react/bridge.ts +0 -48
- package/src/ui-react/components/app.d.ts +0 -7
- package/src/ui-react/components/app.jsx +0 -80
- package/src/ui-react/components/app.tsx +0 -42
- package/src/ui-react/components/app1.js +0 -101
- package/src/ui-react/hooks/use-app-pause.js +0 -35
- package/src/ui-react/hooks/use-app-pause.ts +0 -33
- package/src/ui-react/hooks/use-app-resume.js +0 -37
- package/src/ui-react/hooks/use-app-resume.ts +0 -32
- package/src/ui-react/hooks/use-app-state.js +0 -35
- package/src/ui-react/hooks/use-did-hide.js +0 -25
- package/src/ui-react/hooks/use-did-hide.ts +0 -34
- package/src/ui-react/hooks/use-did-show.js +0 -26
- package/src/ui-react/hooks/use-did-show.ts +0 -34
- package/src/ui-react/hooks/use-listener-scan-qr.js +0 -33
- package/src/ui-react/hooks/use-listener-scan-qr.ts +0 -52
- package/src/ui-react/hooks/use-navigate.js +0 -15
- package/src/ui-react/hooks/use-navigate.ts +0 -41
- package/src/ui-react/index.js +0 -8
- package/src/ui-react/index.ts +0 -9
- package/src/ui-react/types/app.js +0 -30
- package/src/ui-react/types/app.ts +0 -32
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VETC Design System — Color Tokens
|
|
3
|
+
* Resolved from tokens_vetc.json
|
|
4
|
+
*/
|
|
5
|
+
export declare const colorGlobal: {
|
|
6
|
+
readonly white: "#ffffff";
|
|
7
|
+
readonly black: "#000000";
|
|
8
|
+
readonly blue02: "#f4fbff";
|
|
9
|
+
readonly blue05: "#e4f4ff";
|
|
10
|
+
readonly blue10: "#cae9ff";
|
|
11
|
+
readonly blue15: "#afddff";
|
|
12
|
+
readonly blue20: "#95d1ff";
|
|
13
|
+
readonly blue25: "#7ac4fb";
|
|
14
|
+
readonly blue30: "#60b6f4";
|
|
15
|
+
readonly blue35: "#45a8eb";
|
|
16
|
+
readonly blue40: "#2b99df";
|
|
17
|
+
readonly blue45: "#108ad1";
|
|
18
|
+
readonly blue50: "#007ac1";
|
|
19
|
+
readonly blue60: "#005c9e";
|
|
20
|
+
readonly blue70: "#004179";
|
|
21
|
+
readonly blue80: "#002853";
|
|
22
|
+
readonly blue90: "#00122a";
|
|
23
|
+
readonly green02: "#f2fef2";
|
|
24
|
+
readonly green05: "#dffbdf";
|
|
25
|
+
readonly green10: "#bff4bf";
|
|
26
|
+
readonly green15: "#9feca7";
|
|
27
|
+
readonly green20: "#82e194";
|
|
28
|
+
readonly green25: "#68d583";
|
|
29
|
+
readonly green30: "#50c775";
|
|
30
|
+
readonly green35: "#39b669";
|
|
31
|
+
readonly green40: "#25a45e";
|
|
32
|
+
readonly green45: "#23965b";
|
|
33
|
+
readonly green50: "#208758";
|
|
34
|
+
readonly green60: "#1b6b4d";
|
|
35
|
+
readonly green70: "#15503f";
|
|
36
|
+
readonly green80: "#0f342d";
|
|
37
|
+
readonly green90: "#081a18";
|
|
38
|
+
readonly gray02: "#f9fafa";
|
|
39
|
+
readonly gray05: "#f1f1f2";
|
|
40
|
+
readonly gray10: "#e3e4e6";
|
|
41
|
+
readonly gray15: "#d4d6d9";
|
|
42
|
+
readonly gray20: "#c6c8cc";
|
|
43
|
+
readonly gray25: "#b8babf";
|
|
44
|
+
readonly gray30: "#abacb2";
|
|
45
|
+
readonly gray35: "#9d9ea5";
|
|
46
|
+
readonly gray40: "#8f9098";
|
|
47
|
+
readonly gray45: "#82828a";
|
|
48
|
+
readonly gray50: "#74747d";
|
|
49
|
+
readonly gray60: "#5e5d64";
|
|
50
|
+
readonly gray70: "#47464b";
|
|
51
|
+
readonly gray80: "#2f2f32";
|
|
52
|
+
readonly gray90: "#181719";
|
|
53
|
+
readonly red02: "#fff6f9";
|
|
54
|
+
readonly red05: "#ffe7f0";
|
|
55
|
+
readonly red10: "#ffd0de";
|
|
56
|
+
readonly red15: "#ffb8cc";
|
|
57
|
+
readonly red20: "#ffa1b8";
|
|
58
|
+
readonly red25: "#ff89a3";
|
|
59
|
+
readonly red30: "#fb718d";
|
|
60
|
+
readonly red35: "#f55c78";
|
|
61
|
+
readonly red40: "#ee4b62";
|
|
62
|
+
readonly red45: "#e53b4d";
|
|
63
|
+
readonly red50: "#da2c39";
|
|
64
|
+
readonly red60: "#b4211f";
|
|
65
|
+
readonly red70: "#852419";
|
|
66
|
+
readonly red80: "#571f12";
|
|
67
|
+
readonly red90: "#2b130a";
|
|
68
|
+
readonly orange02: "#fffbf0";
|
|
69
|
+
readonly orange05: "#fff3da";
|
|
70
|
+
readonly orange10: "#ffe3b4";
|
|
71
|
+
readonly orange15: "#ffd08f";
|
|
72
|
+
readonly orange20: "#ffbb69";
|
|
73
|
+
readonly orange25: "#ffa447";
|
|
74
|
+
readonly orange30: "#ff8c2f";
|
|
75
|
+
readonly orange35: "#ef7720";
|
|
76
|
+
readonly orange40: "#dd6e1d";
|
|
77
|
+
readonly orange45: "#cb651b";
|
|
78
|
+
readonly orange50: "#b85c18";
|
|
79
|
+
readonly orange60: "#934913";
|
|
80
|
+
readonly orange70: "#6f370f";
|
|
81
|
+
readonly orange80: "#4a250a";
|
|
82
|
+
readonly orange90: "#251205";
|
|
83
|
+
readonly yellow02: "#fff8e7";
|
|
84
|
+
readonly yellow05: "#ffefbc";
|
|
85
|
+
readonly yellow10: "#ffe374";
|
|
86
|
+
readonly yellow15: "#ffd62b";
|
|
87
|
+
readonly yellow20: "#f9c600";
|
|
88
|
+
readonly yellow25: "#e9b900";
|
|
89
|
+
readonly yellow30: "#daaa00";
|
|
90
|
+
readonly yellow35: "#ca9b00";
|
|
91
|
+
readonly yellow40: "#bb8b00";
|
|
92
|
+
readonly yellow45: "#ab7b00";
|
|
93
|
+
readonly yellow50: "#9c6b00";
|
|
94
|
+
readonly yellow60: "#7c4b00";
|
|
95
|
+
readonly yellow70: "#5d2f00";
|
|
96
|
+
readonly yellow80: "#3e1800";
|
|
97
|
+
readonly yellow90: "#1f0700";
|
|
98
|
+
};
|
|
99
|
+
export declare const colorAlias: {
|
|
100
|
+
readonly brand: "#25a45e";
|
|
101
|
+
readonly brandDark: "#208758";
|
|
102
|
+
readonly brandLight: "#dffbdf";
|
|
103
|
+
readonly positive: "#208758";
|
|
104
|
+
readonly positiveVariant: "#dffbdf";
|
|
105
|
+
readonly onPositive: "#ffffff";
|
|
106
|
+
readonly onPositiveVariant: "#1b6b4d";
|
|
107
|
+
readonly negative: "#da2c39";
|
|
108
|
+
readonly onNegative: "#ffffff";
|
|
109
|
+
readonly warning: "#ff8c2f";
|
|
110
|
+
readonly onWarning: "#ffffff";
|
|
111
|
+
readonly outline: "#74747d";
|
|
112
|
+
readonly outlineVariant: "#e3e4e6";
|
|
113
|
+
readonly outlineInverse: "#8f9098";
|
|
114
|
+
readonly theme: "#ffffff";
|
|
115
|
+
readonly themeVariant: "#f1f1f2";
|
|
116
|
+
readonly inverseTheme: "#181719";
|
|
117
|
+
readonly primaryOnTheme: "#181719";
|
|
118
|
+
readonly secondaryOnTheme: "#5e5d64";
|
|
119
|
+
readonly primaryOnInverseTheme: "#ffffff";
|
|
120
|
+
readonly secondaryOnInverseTheme: "#c6c8cc";
|
|
121
|
+
readonly disabledBackground: "#e3e4e6";
|
|
122
|
+
readonly disabledContent: "#abacb2";
|
|
123
|
+
readonly disabledOutline: "#c6c8cc";
|
|
124
|
+
readonly overlay: "rgba(0, 0, 0, 0.4)";
|
|
125
|
+
readonly overlayVariant: "rgba(0, 0, 0, 0.16)";
|
|
126
|
+
readonly skeleton: "rgba(0, 0, 0, 0.1)";
|
|
127
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VETC Design System — Color Tokens
|
|
3
|
+
* Resolved from tokens_vetc.json
|
|
4
|
+
*/
|
|
5
|
+
// ─── Global palette ───────────────────────────────────────────────────────────
|
|
6
|
+
export const colorGlobal = {
|
|
7
|
+
white: '#ffffff',
|
|
8
|
+
black: '#000000',
|
|
9
|
+
// Blue
|
|
10
|
+
blue02: '#f4fbff', blue05: '#e4f4ff', blue10: '#cae9ff',
|
|
11
|
+
blue15: '#afddff', blue20: '#95d1ff', blue25: '#7ac4fb',
|
|
12
|
+
blue30: '#60b6f4', blue35: '#45a8eb', blue40: '#2b99df',
|
|
13
|
+
blue45: '#108ad1', blue50: '#007ac1', blue60: '#005c9e',
|
|
14
|
+
blue70: '#004179', blue80: '#002853', blue90: '#00122a',
|
|
15
|
+
// Green (Brand)
|
|
16
|
+
green02: '#f2fef2', green05: '#dffbdf', green10: '#bff4bf',
|
|
17
|
+
green15: '#9feca7', green20: '#82e194', green25: '#68d583',
|
|
18
|
+
green30: '#50c775', green35: '#39b669', green40: '#25a45e',
|
|
19
|
+
green45: '#23965b', green50: '#208758', green60: '#1b6b4d',
|
|
20
|
+
green70: '#15503f', green80: '#0f342d', green90: '#081a18',
|
|
21
|
+
// Gray
|
|
22
|
+
gray02: '#f9fafa', gray05: '#f1f1f2', gray10: '#e3e4e6',
|
|
23
|
+
gray15: '#d4d6d9', gray20: '#c6c8cc', gray25: '#b8babf',
|
|
24
|
+
gray30: '#abacb2', gray35: '#9d9ea5', gray40: '#8f9098',
|
|
25
|
+
gray45: '#82828a', gray50: '#74747d', gray60: '#5e5d64',
|
|
26
|
+
gray70: '#47464b', gray80: '#2f2f32', gray90: '#181719',
|
|
27
|
+
// Red
|
|
28
|
+
red02: '#fff6f9', red05: '#ffe7f0', red10: '#ffd0de',
|
|
29
|
+
red15: '#ffb8cc', red20: '#ffa1b8', red25: '#ff89a3',
|
|
30
|
+
red30: '#fb718d', red35: '#f55c78', red40: '#ee4b62',
|
|
31
|
+
red45: '#e53b4d', red50: '#da2c39', red60: '#b4211f',
|
|
32
|
+
red70: '#852419', red80: '#571f12', red90: '#2b130a',
|
|
33
|
+
// Orange
|
|
34
|
+
orange02: '#fffbf0', orange05: '#fff3da', orange10: '#ffe3b4',
|
|
35
|
+
orange15: '#ffd08f', orange20: '#ffbb69', orange25: '#ffa447',
|
|
36
|
+
orange30: '#ff8c2f', orange35: '#ef7720', orange40: '#dd6e1d',
|
|
37
|
+
orange45: '#cb651b', orange50: '#b85c18', orange60: '#934913',
|
|
38
|
+
orange70: '#6f370f', orange80: '#4a250a', orange90: '#251205',
|
|
39
|
+
// Yellow
|
|
40
|
+
yellow02: '#fff8e7', yellow05: '#ffefbc', yellow10: '#ffe374',
|
|
41
|
+
yellow15: '#ffd62b', yellow20: '#f9c600', yellow25: '#e9b900',
|
|
42
|
+
yellow30: '#daaa00', yellow35: '#ca9b00', yellow40: '#bb8b00',
|
|
43
|
+
yellow45: '#ab7b00', yellow50: '#9c6b00', yellow60: '#7c4b00',
|
|
44
|
+
yellow70: '#5d2f00', yellow80: '#3e1800', yellow90: '#1f0700',
|
|
45
|
+
};
|
|
46
|
+
// ─── Semantic alias tokens ─────────────────────────────────────────────────────
|
|
47
|
+
export const colorAlias = {
|
|
48
|
+
brand: colorGlobal.green40, // #25a45e
|
|
49
|
+
brandDark: colorGlobal.green50, // #208758
|
|
50
|
+
brandLight: colorGlobal.green05, // #dffbdf
|
|
51
|
+
positive: colorGlobal.green50, // #208758
|
|
52
|
+
positiveVariant: colorGlobal.green05, // #dffbdf
|
|
53
|
+
onPositive: colorGlobal.white,
|
|
54
|
+
onPositiveVariant: colorGlobal.green60,
|
|
55
|
+
negative: colorGlobal.red50, // #da2c39
|
|
56
|
+
onNegative: colorGlobal.white,
|
|
57
|
+
warning: colorGlobal.orange30, // #ff8c2f
|
|
58
|
+
onWarning: colorGlobal.white,
|
|
59
|
+
outline: colorGlobal.gray50, // #74747d
|
|
60
|
+
outlineVariant: colorGlobal.gray10, // #e3e4e6
|
|
61
|
+
outlineInverse: colorGlobal.gray40,
|
|
62
|
+
theme: colorGlobal.white,
|
|
63
|
+
themeVariant: colorGlobal.gray05, // #f1f1f2
|
|
64
|
+
inverseTheme: colorGlobal.gray90,
|
|
65
|
+
primaryOnTheme: colorGlobal.gray90, // #181719
|
|
66
|
+
secondaryOnTheme: colorGlobal.gray60, // #5e5d64
|
|
67
|
+
primaryOnInverseTheme: colorGlobal.white,
|
|
68
|
+
secondaryOnInverseTheme: colorGlobal.gray20,
|
|
69
|
+
disabledBackground: colorGlobal.gray10, // #e3e4e6
|
|
70
|
+
disabledContent: colorGlobal.gray30, // #abacb2
|
|
71
|
+
disabledOutline: colorGlobal.gray20,
|
|
72
|
+
overlay: 'rgba(0, 0, 0, 0.4)',
|
|
73
|
+
overlayVariant: 'rgba(0, 0, 0, 0.16)',
|
|
74
|
+
skeleton: 'rgba(0, 0, 0, 0.1)',
|
|
75
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VETC Design System — Spacing & Sizing Tokens
|
|
3
|
+
* Base unit: 4px
|
|
4
|
+
*/
|
|
5
|
+
export declare const spacing: {
|
|
6
|
+
readonly 0: "0px";
|
|
7
|
+
readonly 1: "1px";
|
|
8
|
+
readonly 2: "2px";
|
|
9
|
+
readonly 4: "4px";
|
|
10
|
+
readonly 6: "6px";
|
|
11
|
+
readonly 8: "8px";
|
|
12
|
+
readonly 10: "10px";
|
|
13
|
+
readonly 12: "12px";
|
|
14
|
+
readonly 14: "14px";
|
|
15
|
+
readonly 16: "16px";
|
|
16
|
+
readonly 20: "20px";
|
|
17
|
+
readonly 24: "24px";
|
|
18
|
+
readonly 32: "32px";
|
|
19
|
+
readonly 40: "40px";
|
|
20
|
+
readonly 48: "48px";
|
|
21
|
+
readonly 56: "56px";
|
|
22
|
+
readonly 64: "64px";
|
|
23
|
+
readonly 72: "72px";
|
|
24
|
+
readonly 80: "80px";
|
|
25
|
+
};
|
|
26
|
+
export declare const borderRadius: {
|
|
27
|
+
readonly none: "0px";
|
|
28
|
+
readonly xs: "4px";
|
|
29
|
+
readonly sm: "6px";
|
|
30
|
+
readonly md: "8px";
|
|
31
|
+
readonly lg: "12px";
|
|
32
|
+
readonly xl: "16px";
|
|
33
|
+
readonly '2xl': "24px";
|
|
34
|
+
readonly pill: "1000px";
|
|
35
|
+
};
|
|
36
|
+
/** Component height standards from Figma */
|
|
37
|
+
export declare const componentHeight: {
|
|
38
|
+
readonly buttonLg: "48px";
|
|
39
|
+
readonly buttonSm: "32px";
|
|
40
|
+
readonly input: "48px";
|
|
41
|
+
readonly navBar: "56px";
|
|
42
|
+
readonly bottomNav: "56px";
|
|
43
|
+
readonly tabBar: "56px";
|
|
44
|
+
readonly listItem: "56px";
|
|
45
|
+
readonly chip: "32px";
|
|
46
|
+
readonly chipSm: "24px";
|
|
47
|
+
readonly iconStd: "24px";
|
|
48
|
+
readonly iconSm: "20px";
|
|
49
|
+
};
|
|
50
|
+
/** Shadow tokens */
|
|
51
|
+
export declare const shadow: {
|
|
52
|
+
readonly none: "none";
|
|
53
|
+
readonly sm: "0 1px 4px rgba(0, 0, 0, 0.08)";
|
|
54
|
+
readonly md: "0 2px 8px rgba(0, 0, 0, 0.12)";
|
|
55
|
+
readonly lg: "0 4px 16px rgba(0, 0, 0, 0.16)";
|
|
56
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VETC Design System — Spacing & Sizing Tokens
|
|
3
|
+
* Base unit: 4px
|
|
4
|
+
*/
|
|
5
|
+
export const spacing = {
|
|
6
|
+
0: '0px',
|
|
7
|
+
1: '1px',
|
|
8
|
+
2: '2px',
|
|
9
|
+
4: '4px',
|
|
10
|
+
6: '6px',
|
|
11
|
+
8: '8px',
|
|
12
|
+
10: '10px',
|
|
13
|
+
12: '12px',
|
|
14
|
+
14: '14px',
|
|
15
|
+
16: '16px',
|
|
16
|
+
20: '20px',
|
|
17
|
+
24: '24px',
|
|
18
|
+
32: '32px',
|
|
19
|
+
40: '40px',
|
|
20
|
+
48: '48px',
|
|
21
|
+
56: '56px',
|
|
22
|
+
64: '64px',
|
|
23
|
+
72: '72px',
|
|
24
|
+
80: '80px',
|
|
25
|
+
};
|
|
26
|
+
export const borderRadius = {
|
|
27
|
+
none: '0px',
|
|
28
|
+
xs: '4px',
|
|
29
|
+
sm: '6px',
|
|
30
|
+
md: '8px',
|
|
31
|
+
lg: '12px',
|
|
32
|
+
xl: '16px',
|
|
33
|
+
'2xl': '24px',
|
|
34
|
+
pill: '1000px',
|
|
35
|
+
};
|
|
36
|
+
/** Component height standards from Figma */
|
|
37
|
+
export const componentHeight = {
|
|
38
|
+
buttonLg: '48px',
|
|
39
|
+
buttonSm: '32px',
|
|
40
|
+
input: '48px',
|
|
41
|
+
navBar: '56px',
|
|
42
|
+
bottomNav: '56px',
|
|
43
|
+
tabBar: '56px',
|
|
44
|
+
listItem: '56px',
|
|
45
|
+
chip: '32px',
|
|
46
|
+
chipSm: '24px',
|
|
47
|
+
iconStd: '24px',
|
|
48
|
+
iconSm: '20px',
|
|
49
|
+
};
|
|
50
|
+
/** Shadow tokens */
|
|
51
|
+
export const shadow = {
|
|
52
|
+
none: 'none',
|
|
53
|
+
sm: '0 1px 4px rgba(0, 0, 0, 0.08)',
|
|
54
|
+
md: '0 2px 8px rgba(0, 0, 0, 0.12)',
|
|
55
|
+
lg: '0 4px 16px rgba(0, 0, 0, 0.16)',
|
|
56
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VETC Design System — Typography Tokens
|
|
3
|
+
* From Figma: Tasco DLS Mini App — Typography page
|
|
4
|
+
* Font weights: Regular=400, Medium=500, SemiBold=600, Bold=700
|
|
5
|
+
* Font sizes: 2XS=10 / XS=12 / SM=14 / Base=16 / LG=20 / XL=24 / 2XL=28 / 3XL=32 / 4XL=36
|
|
6
|
+
*/
|
|
7
|
+
export declare const fontFamily: {
|
|
8
|
+
readonly primary: "\"Roboto\", system-ui, -apple-system, sans-serif";
|
|
9
|
+
};
|
|
10
|
+
export declare const fontWeight: {
|
|
11
|
+
readonly regular: 400;
|
|
12
|
+
readonly medium: 500;
|
|
13
|
+
readonly semibold: 600;
|
|
14
|
+
readonly bold: 700;
|
|
15
|
+
readonly black: 900;
|
|
16
|
+
};
|
|
17
|
+
/** Font sizes from Figma Typography scale */
|
|
18
|
+
export declare const fontSize: {
|
|
19
|
+
readonly '2xs': "10px";
|
|
20
|
+
readonly xs: "12px";
|
|
21
|
+
readonly sm: "14px";
|
|
22
|
+
readonly base: "16px";
|
|
23
|
+
readonly lg: "20px";
|
|
24
|
+
readonly xl: "24px";
|
|
25
|
+
readonly '2xl': "28px";
|
|
26
|
+
readonly '3xl': "32px";
|
|
27
|
+
readonly '4xl': "36px";
|
|
28
|
+
};
|
|
29
|
+
/** Line heights from Figma (pixel ratios per size) */
|
|
30
|
+
export declare const lineHeight: {
|
|
31
|
+
readonly tight: "120%";
|
|
32
|
+
readonly normal: "140%";
|
|
33
|
+
readonly relaxed: "150%";
|
|
34
|
+
};
|
|
35
|
+
export declare const letterSpacing: {
|
|
36
|
+
readonly none: "0";
|
|
37
|
+
readonly sm: "0.1px";
|
|
38
|
+
readonly md: "0.25px";
|
|
39
|
+
readonly lg: "0.5px";
|
|
40
|
+
};
|
|
41
|
+
/** Typography style presets — Figma: Display=bold(700), Headline/Title/Label=semibold(600), Body=regular(400) */
|
|
42
|
+
export declare const textStyle: {
|
|
43
|
+
readonly display4xl: {
|
|
44
|
+
readonly fontSize: "36px";
|
|
45
|
+
readonly fontWeight: 700;
|
|
46
|
+
readonly lineHeight: "120%";
|
|
47
|
+
};
|
|
48
|
+
readonly display3xl: {
|
|
49
|
+
readonly fontSize: "32px";
|
|
50
|
+
readonly fontWeight: 700;
|
|
51
|
+
readonly lineHeight: "120%";
|
|
52
|
+
};
|
|
53
|
+
readonly display2xl: {
|
|
54
|
+
readonly fontSize: "28px";
|
|
55
|
+
readonly fontWeight: 700;
|
|
56
|
+
readonly lineHeight: "120%";
|
|
57
|
+
};
|
|
58
|
+
readonly headlineXl: {
|
|
59
|
+
readonly fontSize: "24px";
|
|
60
|
+
readonly fontWeight: 700;
|
|
61
|
+
readonly lineHeight: "140%";
|
|
62
|
+
};
|
|
63
|
+
readonly headlineLg: {
|
|
64
|
+
readonly fontSize: "20px";
|
|
65
|
+
readonly fontWeight: 600;
|
|
66
|
+
readonly lineHeight: "140%";
|
|
67
|
+
};
|
|
68
|
+
readonly titleBase: {
|
|
69
|
+
readonly fontSize: "16px";
|
|
70
|
+
readonly fontWeight: 600;
|
|
71
|
+
readonly lineHeight: "150%";
|
|
72
|
+
readonly letterSpacing: "0.1px";
|
|
73
|
+
};
|
|
74
|
+
readonly titleSm: {
|
|
75
|
+
readonly fontSize: "14px";
|
|
76
|
+
readonly fontWeight: 600;
|
|
77
|
+
readonly lineHeight: "150%";
|
|
78
|
+
readonly letterSpacing: "0.1px";
|
|
79
|
+
};
|
|
80
|
+
readonly labelBase: {
|
|
81
|
+
readonly fontSize: "16px";
|
|
82
|
+
readonly fontWeight: 600;
|
|
83
|
+
readonly lineHeight: "150%";
|
|
84
|
+
};
|
|
85
|
+
readonly labelSm: {
|
|
86
|
+
readonly fontSize: "14px";
|
|
87
|
+
readonly fontWeight: 600;
|
|
88
|
+
readonly lineHeight: "150%";
|
|
89
|
+
readonly letterSpacing: "0.5px";
|
|
90
|
+
};
|
|
91
|
+
readonly labelXs: {
|
|
92
|
+
readonly fontSize: "12px";
|
|
93
|
+
readonly fontWeight: 600;
|
|
94
|
+
readonly lineHeight: "150%";
|
|
95
|
+
readonly letterSpacing: "0.5px";
|
|
96
|
+
};
|
|
97
|
+
readonly bodyBase: {
|
|
98
|
+
readonly fontSize: "16px";
|
|
99
|
+
readonly fontWeight: 400;
|
|
100
|
+
readonly lineHeight: "150%";
|
|
101
|
+
readonly letterSpacing: "0.1px";
|
|
102
|
+
};
|
|
103
|
+
readonly bodySm: {
|
|
104
|
+
readonly fontSize: "14px";
|
|
105
|
+
readonly fontWeight: 400;
|
|
106
|
+
readonly lineHeight: "150%";
|
|
107
|
+
readonly letterSpacing: "0.25px";
|
|
108
|
+
};
|
|
109
|
+
readonly bodyXs: {
|
|
110
|
+
readonly fontSize: "12px";
|
|
111
|
+
readonly fontWeight: 400;
|
|
112
|
+
readonly lineHeight: "150%";
|
|
113
|
+
readonly letterSpacing: "0.5px";
|
|
114
|
+
};
|
|
115
|
+
readonly body2xs: {
|
|
116
|
+
readonly fontSize: "10px";
|
|
117
|
+
readonly fontWeight: 400;
|
|
118
|
+
readonly lineHeight: "150%";
|
|
119
|
+
readonly letterSpacing: "0.5px";
|
|
120
|
+
};
|
|
121
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VETC Design System — Typography Tokens
|
|
3
|
+
* From Figma: Tasco DLS Mini App — Typography page
|
|
4
|
+
* Font weights: Regular=400, Medium=500, SemiBold=600, Bold=700
|
|
5
|
+
* Font sizes: 2XS=10 / XS=12 / SM=14 / Base=16 / LG=20 / XL=24 / 2XL=28 / 3XL=32 / 4XL=36
|
|
6
|
+
*/
|
|
7
|
+
export const fontFamily = {
|
|
8
|
+
primary: '"Roboto", system-ui, -apple-system, sans-serif',
|
|
9
|
+
};
|
|
10
|
+
export const fontWeight = {
|
|
11
|
+
regular: 400,
|
|
12
|
+
medium: 500,
|
|
13
|
+
semibold: 600,
|
|
14
|
+
bold: 700,
|
|
15
|
+
black: 900,
|
|
16
|
+
};
|
|
17
|
+
/** Font sizes from Figma Typography scale */
|
|
18
|
+
export const fontSize = {
|
|
19
|
+
'2xs': '10px', // 2X-Small
|
|
20
|
+
xs: '12px', // X-Small
|
|
21
|
+
sm: '14px', // Small
|
|
22
|
+
base: '16px', // Base
|
|
23
|
+
lg: '20px', // Large
|
|
24
|
+
xl: '24px', // X-Large
|
|
25
|
+
'2xl': '28px', // 2X-Large
|
|
26
|
+
'3xl': '32px', // 3X-Large
|
|
27
|
+
'4xl': '36px', // 4X-Large
|
|
28
|
+
};
|
|
29
|
+
/** Line heights from Figma (pixel ratios per size) */
|
|
30
|
+
export const lineHeight = {
|
|
31
|
+
tight: '120%', // display: 36→44 ≈ 122%
|
|
32
|
+
normal: '140%', // heading: 20→28 = 140%
|
|
33
|
+
relaxed: '150%', // body/label: 16→24 = 150%
|
|
34
|
+
};
|
|
35
|
+
export const letterSpacing = {
|
|
36
|
+
none: '0',
|
|
37
|
+
sm: '0.1px',
|
|
38
|
+
md: '0.25px',
|
|
39
|
+
lg: '0.5px',
|
|
40
|
+
};
|
|
41
|
+
/** Typography style presets — Figma: Display=bold(700), Headline/Title/Label=semibold(600), Body=regular(400) */
|
|
42
|
+
export const textStyle = {
|
|
43
|
+
display4xl: { fontSize: fontSize['4xl'], fontWeight: fontWeight.bold, lineHeight: lineHeight.tight },
|
|
44
|
+
display3xl: { fontSize: fontSize['3xl'], fontWeight: fontWeight.bold, lineHeight: lineHeight.tight },
|
|
45
|
+
display2xl: { fontSize: fontSize['2xl'], fontWeight: fontWeight.bold, lineHeight: lineHeight.tight },
|
|
46
|
+
headlineXl: { fontSize: fontSize.xl, fontWeight: fontWeight.bold, lineHeight: lineHeight.normal },
|
|
47
|
+
headlineLg: { fontSize: fontSize.lg, fontWeight: fontWeight.semibold, lineHeight: lineHeight.normal },
|
|
48
|
+
titleBase: { fontSize: fontSize.base, fontWeight: fontWeight.semibold, lineHeight: lineHeight.relaxed, letterSpacing: letterSpacing.sm },
|
|
49
|
+
titleSm: { fontSize: fontSize.sm, fontWeight: fontWeight.semibold, lineHeight: lineHeight.relaxed, letterSpacing: letterSpacing.sm },
|
|
50
|
+
labelBase: { fontSize: fontSize.base, fontWeight: fontWeight.semibold, lineHeight: lineHeight.relaxed },
|
|
51
|
+
labelSm: { fontSize: fontSize.sm, fontWeight: fontWeight.semibold, lineHeight: lineHeight.relaxed, letterSpacing: letterSpacing.lg },
|
|
52
|
+
labelXs: { fontSize: fontSize.xs, fontWeight: fontWeight.semibold, lineHeight: lineHeight.relaxed, letterSpacing: letterSpacing.lg },
|
|
53
|
+
bodyBase: { fontSize: fontSize.base, fontWeight: fontWeight.regular, lineHeight: lineHeight.relaxed, letterSpacing: letterSpacing.sm },
|
|
54
|
+
bodySm: { fontSize: fontSize.sm, fontWeight: fontWeight.regular, lineHeight: lineHeight.relaxed, letterSpacing: letterSpacing.md },
|
|
55
|
+
bodyXs: { fontSize: fontSize.xs, fontWeight: fontWeight.regular, lineHeight: lineHeight.relaxed, letterSpacing: letterSpacing.lg },
|
|
56
|
+
body2xs: { fontSize: fontSize['2xs'], fontWeight: fontWeight.regular, lineHeight: lineHeight.relaxed, letterSpacing: letterSpacing.lg },
|
|
57
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type IAppConfig = {
|
|
2
|
+
pages: IPageConfig[];
|
|
3
|
+
} & IAppState;
|
|
4
|
+
export type IAppState = {
|
|
5
|
+
locale?: string;
|
|
6
|
+
theme?: "light" | "dark";
|
|
7
|
+
};
|
|
8
|
+
export type IPageConfig = {
|
|
9
|
+
/** Key định danh page dùng cho navigation */
|
|
10
|
+
key: string;
|
|
11
|
+
/** Tên hiển thị (optional, dùng cho header native) */
|
|
12
|
+
title?: string;
|
|
13
|
+
page: React.ComponentType<any>;
|
|
14
|
+
url: string;
|
|
15
|
+
/** Có cho phép back không */
|
|
16
|
+
canGoBack?: boolean;
|
|
17
|
+
/** Có phải root page không */
|
|
18
|
+
isRoot?: boolean;
|
|
19
|
+
/** Params mặc định khi mở page */
|
|
20
|
+
defaultParams?: Record<string, unknown>;
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vetc-miniapp/ui-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"description": "MiniApp Platform UI React",
|
|
5
|
-
"main": "
|
|
6
|
-
"
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./styles": "./dist/styles/tokens.css"
|
|
14
|
+
},
|
|
7
15
|
"type": "module",
|
|
8
16
|
"files": [
|
|
9
|
-
"
|
|
17
|
+
"dist"
|
|
10
18
|
],
|
|
11
19
|
"scripts": {
|
|
12
|
-
"build": "
|
|
20
|
+
"build": "tsc -p tsconfig.build.json && cp src/ui-react/styles/tokens.css dist/styles/tokens.css"
|
|
13
21
|
},
|
|
14
22
|
"keywords": [
|
|
15
23
|
"miniapp",
|
|
@@ -20,6 +28,7 @@
|
|
|
20
28
|
"author": "Hieuth052@gmail.com",
|
|
21
29
|
"license": "MIT",
|
|
22
30
|
"devDependencies": {
|
|
31
|
+
"@ant-design/icons": "^6.2.2",
|
|
23
32
|
"@babel/cli": "^7.28.6",
|
|
24
33
|
"@babel/core": "^7.29.0",
|
|
25
34
|
"@babel/preset-env": "^7.29.0",
|
|
@@ -28,14 +37,21 @@
|
|
|
28
37
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
29
38
|
"@rollup/plugin-terser": "^0.4.4",
|
|
30
39
|
"@types/node": "^25.2.0",
|
|
40
|
+
"@types/react": "^19.2.14",
|
|
41
|
+
"@types/react-dom": "^19.2.3",
|
|
42
|
+
"antd": "^6.3.7",
|
|
31
43
|
"babel-loader": "^10.0.0",
|
|
44
|
+
"css-loader": "^7.1.4",
|
|
45
|
+
"html-webpack-plugin": "^5.6.7",
|
|
46
|
+
"react": "^19.0.0",
|
|
47
|
+
"react-dom": "^19.0.0",
|
|
32
48
|
"rollup": "^4.57.1",
|
|
49
|
+
"style-loader": "^4.0.0",
|
|
33
50
|
"ts-loader": "^9.5.4",
|
|
34
51
|
"typescript": "^5.9.3",
|
|
35
52
|
"webpack": "^5.104.1",
|
|
36
53
|
"webpack-cli": "^6.0.1",
|
|
37
|
-
"
|
|
38
|
-
"react-dom": "^19.0.0"
|
|
54
|
+
"webpack-dev-server": "^5.2.3"
|
|
39
55
|
},
|
|
40
56
|
"dependencies": {
|
|
41
57
|
"acorn": "^8.15.0",
|
|
@@ -49,7 +65,9 @@
|
|
|
49
65
|
"webpack-sources": "^3.3.3"
|
|
50
66
|
},
|
|
51
67
|
"peerDependencies": {
|
|
68
|
+
"@ant-design/icons": ">=5.0.0",
|
|
69
|
+
"antd": ">=5.0.0",
|
|
52
70
|
"react": ">=19.0.0",
|
|
53
71
|
"react-dom": ">=19.0.0"
|
|
54
72
|
}
|
|
55
|
-
}
|
|
73
|
+
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports["vetc-miniapp/ui-react"]=e(require("react")):n["vetc-miniapp/ui-react"]=e(n.react)}(this,n=>(()=>{"use strict";var e={155(e){e.exports=n},698(n,e){var r=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function o(n,e,t){var o=null;if(void 0!==t&&(o=""+t),void 0!==e.key&&(o=""+e.key),"key"in e)for(var i in t={},e)"key"!==i&&(t[i]=e[i]);else t=e;return e=t.ref,{$$typeof:r,type:n,key:o,ref:void 0!==e?e:null,props:t}}e.Fragment=t,e.jsx=o,e.jsxs=o},848(n,e,r){n.exports=r(698)}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n](i,i.exports,t),i.exports}t.d=(n,e)=>{for(var r in e)t.o(e,r)&&!t.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:e[r]})},t.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),t.r=n=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})};var o={};t.r(o),t.d(o,{App:()=>x,appConfig:()=>h,useAppPause:()=>u,useAppResume:()=>a,useDidHide:()=>f,useDidShow:()=>c,useListenerScanQr:()=>m,useNavigate:()=>y});var i=t(155);function u(n){var e=(0,i.useRef)(n);(0,i.useEffect)(function(){e.current=n},[n]),(0,i.useEffect)(function(){if("undefined"!=typeof window&&window.MiniApp){var n=function(){try{e.current&&e.current()}catch(n){console.error("[useAppPause error]",n)}};return window.MiniApp.on("appPause",n),function(){window.MiniApp.off("appPause",n)}}},[])}function a(n){var e=(0,i.useRef)(n);(0,i.useEffect)(function(){e.current=n},[n]),(0,i.useEffect)(function(){if(console.warn("MiniApp: useAppResume"),"undefined"!=typeof window&&window.MiniApp){var n=function(){try{e.current&&e.current()}catch(n){console.error("[useAppResume error]",n)}};return window.MiniApp.on("appResume",n),function(){window.MiniApp.off("appResume",n)}}},[])}function c(n,e){var r=(0,i.useRef)(e);(0,i.useEffect)(function(){r.current=e},[e]),(0,i.useEffect)(function(){if(window.MiniApp){var e=function(e){var t;(null==e?void 0:e.route)===n&&(console.log("didShow",e),null===(t=r.current)||void 0===t||t.call(r,e))};return window.MiniApp.on("didShow",e),function(){window.MiniApp.off("didShow",e)}}},[n])}function f(n,e){var r=(0,i.useRef)(e);(0,i.useEffect)(function(){r.current=e},[e]),(0,i.useEffect)(function(){if(window.MiniApp){var e=function(e){var t;(null==e?void 0:e.route)===n&&(null===(t=r.current)||void 0===t||t.call(r,e))};return window.MiniApp.on("didHide",e),function(){window.MiniApp.off("didHide",e)}}},[n])}function p(){var n,e,r="function"==typeof Symbol?Symbol:{},t=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,t,o,i){var c=t&&t.prototype instanceof a?t:a,f=Object.create(c.prototype);return l(f,"_invoke",function(r,t,o){var i,a,c,f=0,p=o||[],l=!1,s={p:0,n:0,v:n,a:d,f:d.bind(n,4),d:function(e,r){return i=e,a=0,c=n,s.n=r,u}};function d(r,t){for(a=r,c=t,e=0;!l&&f&&!o&&e<p.length;e++){var o,i=p[e],d=s.p,v=i[2];r>3?(o=v===t)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=n):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,s.v=t,s.n=i[1]):d<v&&(o=r<3||i[0]>t||t>v)&&(i[4]=r,i[5]=t,s.n=v,a=0))}if(o||r>1)return u;throw l=!0,t}return function(o,p,v){if(f>1)throw TypeError("Generator is already running");for(l&&1===p&&d(p,v),a=p,c=v;(e=a<2?n:c)||!l;){i||(a?a<3?(a>1&&(s.n=-1),d(a,c)):s.n=c:s.v=c);try{if(f=2,i){if(a||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,a<2&&(a=0)}else 1===a&&(e=i.return)&&e.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=n}else if((e=(l=s.n<0)?c:r.call(t,s))!==u)break}catch(e){i=n,a=1,c=e}finally{f=1}}return{value:e,done:l}}}(r,o,i),!0),f}var u={};function a(){}function c(){}function f(){}e=Object.getPrototypeOf;var s=[][t]?e(e([][t]())):(l(e={},t,function(){return this}),e),d=f.prototype=a.prototype=Object.create(s);function v(n){return Object.setPrototypeOf?Object.setPrototypeOf(n,f):(n.__proto__=f,l(n,o,"GeneratorFunction")),n.prototype=Object.create(d),n}return c.prototype=f,l(d,"constructor",f),l(f,"constructor",c),c.displayName="GeneratorFunction",l(f,o,"GeneratorFunction"),l(d),l(d,o,"Generator"),l(d,t,function(){return this}),l(d,"toString",function(){return"[object Generator]"}),(p=function(){return{w:i,m:v}})()}function l(n,e,r,t){var o=Object.defineProperty;try{o({},"",{})}catch(n){o=0}l=function(n,e,r,t){function i(e,r){l(n,e,function(n){return this._invoke(e,r,n)})}e?o?o(n,e,{value:r,enumerable:!t,configurable:!t,writable:!t}):n[e]=r:(i("next",0),i("throw",1),i("return",2))},l(n,e,r,t)}function s(n,e,r,t,o,i,u){try{var a=n[i](u),c=a.value}catch(n){return void r(n)}a.done?e(c):Promise.resolve(c).then(t,o)}var d="undefined"!=typeof window,v=function(){return d&&window.flutter_inappwebview&&window.flutter_inappwebview.callHandler&&"function"==typeof window.flutter_inappwebview.callHandler?window.flutter_inappwebview:null},w=function(){var n,e=(n=p().m(function n(e){var r,t,o,i,u=arguments;return p().w(function(n){for(;;)switch(n.p=n.n){case 0:if(r=u.length>1&&void 0!==u[1]?u[1]:{},t=v()){n.n=1;break}return n.a(2,{ok:!1,error:"BRIDGE_CALL_FAILED"});case 1:return n.p=1,n.n=2,t.callHandler("MiniAppBridge",{action:e,payload:r});case 2:return o=n.v,n.a(2,o);case 3:return n.p=3,i=n.v,console.error("Bridge error:",i),n.a(2,{ok:!1,error:"BRIDGE_CALL_FAILED"})}},n,null,[[1,3]])}),function(){var e=this,r=arguments;return new Promise(function(t,o){var i=n.apply(e,r);function u(n){s(i,t,o,u,a,"next",n)}function a(n){s(i,t,o,u,a,"throw",n)}u(void 0)})});return function(n){return e.apply(this,arguments)}}();function y(){return function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("number"==typeof n)return w("navigate",{type:"native",action:"pop",delta:Math.abs(n)});w("navigate",{type:"native",action:"push",route:n,params:e,options:r})}}var h={locale:"vi",theme:"light",pages:[]};function m(n){var e=(0,i.useRef)(n);(0,i.useEffect)(function(){e.current=n},[n]),(0,i.useEffect)(function(){if("undefined"!=typeof window&&window.MiniApp){var n=function(n){try{var r;null===(r=e.current)||void 0===r||r.call(e,n)}catch(n){console.error("[useListenerScanQr error]",n)}};return window.MiniApp.on("onScanQRResult",n),function(){window.MiniApp.off("onScanQRResult",n)}}},[])}var b=t(848);function g(n,e){(null==e||e>n.length)&&(e=n.length);for(var r=0,t=Array(e);r<e;r++)t[r]=n[r];return t}var A=new Map,S="/";function j(){return A.get(S)}function M(n){S=n}function x(n){var e,r,t=n.config,o=n.children,u=(e=(0,i.useState)(null),r=2,function(n){if(Array.isArray(n))return n}(e)||function(n,e){var r=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=r){var t,o,i,u,a=[],c=!0,f=!1;try{if(i=(r=r.call(n)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(t=i.call(r)).done)&&(a.push(t.value),a.length!==e);c=!0);}catch(n){f=!0,o=n}finally{try{if(!c&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(f)throw o}}return a}}(e,r)||function(n,e){if(n){if("string"==typeof n)return g(n,e);var r={}.toString.call(n).slice(8,-1);return"Object"===r&&n.constructor&&(r=n.constructor.name),"Map"===r||"Set"===r?Array.from(n):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(n,e):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=u[0],c=u[1],f=(0,i.useRef)(!1);(0,i.useEffect)(function(){var n;if(null!=t&&null!==(n=t.pages)&&void 0!==n&&n.length&&!f.current){f.current=!0,function(n){A=new Map(n.pages.map(function(n){return[n.path,n]}))}(t),M((window.location.pathname||"/").replace("/miniapp","")||"/");var e=j();e||(M("/"),e=j()),c(e||null),w("registerAppConfig",{config:t})}},[t]);var p=(0,i.useMemo)(function(){return a&&a.Component?a.Component:null},[a]);return p?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(p,{}),o]}):(console.warn("MiniApp: Page not found"),(0,b.jsx)("div",{}))}return o})());
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @license React
|
|
5
|
-
* react-jsx-runtime.production.js
|
|
6
|
-
*
|
|
7
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the MIT license found in the
|
|
10
|
-
* LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/
|
package/src/ui-react/bridge.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
const isBrowser = typeof window !== "undefined";
|
|
2
|
-
|
|
3
|
-
const getBridge = () => {
|
|
4
|
-
if (!isBrowser || !window.flutter_inappwebview || !window.flutter_inappwebview.callHandler || typeof window.flutter_inappwebview.callHandler != "function") {
|
|
5
|
-
return null;
|
|
6
|
-
}
|
|
7
|
-
return window.flutter_inappwebview;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export const callHost = async (action, payload = {}) => {
|
|
11
|
-
const bridge = getBridge();
|
|
12
|
-
if (!bridge) {
|
|
13
|
-
// return Promise.reject(new Error("MiniApp bridge not available"));
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
ok: false,
|
|
17
|
-
error: "BRIDGE_CALL_FAILED"
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
try {
|
|
21
|
-
const response = await bridge.callHandler("MiniAppBridge", {
|
|
22
|
-
action,
|
|
23
|
-
payload,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
return response;
|
|
27
|
-
} catch (error) {
|
|
28
|
-
console.error("Bridge error:", error);
|
|
29
|
-
// throw error;
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
ok: false,
|
|
33
|
-
error: "BRIDGE_CALL_FAILED"
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
};
|