@vetc-miniapp/ui-react 0.0.26 → 0.0.28

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.
Files changed (60) hide show
  1. package/dist/index.js +1 -41
  2. package/package.json +3 -2
  3. package/dist/bridge.js +0 -20
  4. package/dist/components/app.js +0 -34
  5. package/dist/components/avatar/Avatar.js +0 -33
  6. package/dist/components/avatar/index.js +0 -1
  7. package/dist/components/bottom-sheet/BottomSheet.js +0 -70
  8. package/dist/components/bottom-sheet/index.js +0 -1
  9. package/dist/components/button/Button.js +0 -165
  10. package/dist/components/button/index.js +0 -1
  11. package/dist/components/button-group/ButtonGroup.js +0 -21
  12. package/dist/components/button-group/index.js +0 -1
  13. package/dist/components/card/Card.js +0 -35
  14. package/dist/components/card/index.js +0 -1
  15. package/dist/components/checkbox/Checkbox.js +0 -94
  16. package/dist/components/checkbox/index.js +0 -1
  17. package/dist/components/chip/Chip.js +0 -83
  18. package/dist/components/chip/index.js +0 -1
  19. package/dist/components/dialog/Dialog.js +0 -51
  20. package/dist/components/dialog/index.js +0 -1
  21. package/dist/components/divider/Divider.js +0 -18
  22. package/dist/components/divider/index.js +0 -1
  23. package/dist/components/input/Input.js +0 -51
  24. package/dist/components/input/index.js +0 -1
  25. package/dist/components/list/List.js +0 -72
  26. package/dist/components/list/index.js +0 -1
  27. package/dist/components/loading/Loading.js +0 -33
  28. package/dist/components/loading/index.js +0 -1
  29. package/dist/components/modal/Modal.js +0 -50
  30. package/dist/components/modal/index.js +0 -1
  31. package/dist/components/navigation-bar/NavigationBar.js +0 -70
  32. package/dist/components/navigation-bar/index.js +0 -1
  33. package/dist/components/radio/Radio.js +0 -88
  34. package/dist/components/radio/index.js +0 -1
  35. package/dist/components/select/Select.js +0 -30
  36. package/dist/components/select/index.js +0 -1
  37. package/dist/components/switch/Switch.js +0 -81
  38. package/dist/components/switch/index.js +0 -1
  39. package/dist/components/tab-bar/TabBar.js +0 -60
  40. package/dist/components/tab-bar/index.js +0 -1
  41. package/dist/components/textarea/Textarea.js +0 -33
  42. package/dist/components/textarea/index.js +0 -1
  43. package/dist/components/toast/Toast.js +0 -61
  44. package/dist/components/toast/index.js +0 -1
  45. package/dist/components/typography/Typography.js +0 -143
  46. package/dist/components/typography/index.js +0 -1
  47. package/dist/hooks/use-app-pause.js +0 -25
  48. package/dist/hooks/use-app-resume.js +0 -25
  49. package/dist/hooks/use-app-state.js +0 -1
  50. package/dist/hooks/use-did-hide.js +0 -20
  51. package/dist/hooks/use-did-show.js +0 -20
  52. package/dist/hooks/use-listener-scan-qr.js +0 -25
  53. package/dist/hooks/use-navigate.js +0 -23
  54. package/dist/hooks/use-tap-app-bar.js +0 -20
  55. package/dist/styles/VETCProvider.js +0 -124
  56. package/dist/tokens/colors.js +0 -75
  57. package/dist/tokens/index.js +0 -3
  58. package/dist/tokens/spacing.js +0 -56
  59. package/dist/tokens/typography.js +0 -57
  60. package/dist/types/app.js +0 -1
@@ -1,23 +0,0 @@
1
- import { callHost } from "../bridge";
2
- /* ================= Hook ================= */
3
- export function useNavigate() {
4
- return (route, params = {}, options = {}) => {
5
- // POP navigation
6
- if (typeof route === "number") {
7
- callHost("navigate", {
8
- type: "native",
9
- action: "pop",
10
- delta: Math.abs(route),
11
- });
12
- return;
13
- }
14
- // Gửi sang native host
15
- callHost("navigate", {
16
- type: "native",
17
- action: "push",
18
- route,
19
- params,
20
- options,
21
- }).catch(console.error);
22
- };
23
- }
@@ -1,20 +0,0 @@
1
- import { useEffect, useRef } from "react";
2
- export function useTapAppBar(route, callback) {
3
- const saved = useRef(callback);
4
- // luôn giữ callback mới nhất
5
- useEffect(() => {
6
- saved.current = callback;
7
- }, [callback]);
8
- useEffect(() => {
9
- if (typeof window === "undefined" || !window.MiniApp)
10
- return;
11
- const bridge = window.MiniApp;
12
- const handler = (data) => {
13
- if (data?.route === route) {
14
- saved.current?.(data);
15
- }
16
- };
17
- bridge.on("onTapAppBar", handler);
18
- return () => bridge.off("onTapAppBar", handler);
19
- }, [route]);
20
- }
@@ -1,124 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { ConfigProvider, App as AntApp, theme } from 'antd';
3
- import { colorAlias, colorGlobal } from '../tokens/colors';
4
- export const vetcAntdTheme = {
5
- token: {
6
- // Brand / Primary
7
- colorPrimary: colorAlias.brand, // #25a45e
8
- colorPrimaryHover: colorGlobal.green35,
9
- colorPrimaryActive: colorAlias.brandDark,
10
- colorPrimaryBg: colorGlobal.green02,
11
- colorPrimaryBgHover: colorGlobal.green05,
12
- // Error / Danger
13
- colorError: colorAlias.negative, // #da2c39
14
- colorErrorHover: colorGlobal.red60,
15
- colorErrorBg: colorGlobal.red02,
16
- // Warning
17
- colorWarning: colorAlias.warning, // #ff8c2f
18
- colorWarningBg: colorGlobal.orange02,
19
- // Success
20
- colorSuccess: colorAlias.positive, // #208758
21
- colorSuccessBg: colorGlobal.green02,
22
- // Text
23
- colorText: colorAlias.primaryOnTheme, // #181719
24
- colorTextSecondary: colorAlias.secondaryOnTheme, // #5e5d64
25
- colorTextDisabled: colorAlias.disabledContent, // #abacb2
26
- colorTextPlaceholder: colorGlobal.gray50,
27
- // Background
28
- colorBgContainer: colorAlias.theme, // #ffffff
29
- colorBgLayout: colorAlias.themeVariant, // #f1f1f2
30
- colorBgSpotlight: colorAlias.inverseTheme,
31
- // Border
32
- colorBorder: colorGlobal.gray20, // #c6c8cc
33
- colorBorderSecondary: colorGlobal.gray10, // #e3e4e6
34
- colorSplit: colorGlobal.gray10,
35
- // Fill states
36
- colorFill: colorGlobal.gray05,
37
- colorFillSecondary: colorGlobal.gray10,
38
- colorFillTertiary: colorGlobal.gray15,
39
- // Typography
40
- fontFamily: '"Roboto", system-ui, -apple-system, sans-serif',
41
- fontSize: 16,
42
- fontSizeSM: 13,
43
- fontSizeLG: 18,
44
- fontSizeXL: 19,
45
- fontSizeHeading1: 32,
46
- fontSizeHeading2: 28,
47
- fontSizeHeading3: 24,
48
- fontSizeHeading4: 19,
49
- fontSizeHeading5: 16,
50
- fontWeightStrong: 600,
51
- lineHeight: 1.5,
52
- // Shape
53
- borderRadius: 8,
54
- borderRadiusSM: 6,
55
- borderRadiusLG: 12,
56
- borderRadiusXS: 4,
57
- // Size
58
- controlHeight: 48,
59
- controlHeightSM: 32,
60
- controlHeightLG: 56,
61
- // Padding
62
- paddingXS: 8,
63
- paddingSM: 12,
64
- padding: 16,
65
- paddingMD: 16,
66
- paddingLG: 24,
67
- // Motion
68
- motionDurationFast: '150ms',
69
- motionDurationMid: '250ms',
70
- },
71
- components: {
72
- Button: {
73
- primaryColor: '#ffffff',
74
- defaultBorderColor: colorGlobal.gray20,
75
- defaultColor: colorAlias.primaryOnTheme,
76
- borderRadius: 12,
77
- borderRadiusSM: 8,
78
- borderRadiusLG: 12,
79
- controlHeight: 48,
80
- controlHeightSM: 32,
81
- paddingInline: 16,
82
- paddingInlineSM: 12,
83
- fontWeight: 600,
84
- },
85
- Input: {
86
- borderRadius: 8,
87
- controlHeight: 48,
88
- paddingInline: 12,
89
- colorBorder: colorGlobal.gray20,
90
- hoverBorderColor: colorAlias.outline,
91
- activeBorderColor: colorAlias.brand,
92
- },
93
- Select: {
94
- borderRadius: 8,
95
- controlHeight: 48,
96
- },
97
- Checkbox: {
98
- borderRadius: 4,
99
- controlInteractiveSize: 20,
100
- },
101
- Radio: {
102
- radioSize: 20,
103
- dotSize: 8,
104
- },
105
- Switch: {
106
- trackHeight: 32,
107
- trackMinWidth: 52,
108
- handleSize: 28,
109
- colorPrimary: colorAlias.brand,
110
- },
111
- Modal: {
112
- borderRadiusLG: 16,
113
- paddingContentHorizontalLG: 16,
114
- paddingMD: 16,
115
- },
116
- Card: {
117
- borderRadius: 16,
118
- paddingLG: 16,
119
- },
120
- },
121
- };
122
- export function VETCProvider({ children }) {
123
- return (_jsx(ConfigProvider, { theme: { ...vetcAntdTheme, algorithm: theme.defaultAlgorithm }, children: _jsx(AntApp, { children: children }) }));
124
- }
@@ -1,75 +0,0 @@
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
- };
@@ -1,3 +0,0 @@
1
- export * from './colors';
2
- export * from './typography';
3
- export * from './spacing';
@@ -1,56 +0,0 @@
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
- };
@@ -1,57 +0,0 @@
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
- };
package/dist/types/app.js DELETED
@@ -1 +0,0 @@
1
- export {};