shared-design-system 1.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.
Files changed (78) hide show
  1. package/README.md +258 -0
  2. package/dist/components/Alert.d.ts +9 -0
  3. package/dist/components/Alert.js +58 -0
  4. package/dist/components/Alert.js.map +1 -0
  5. package/dist/components/Avatar.d.ts +8 -0
  6. package/dist/components/Avatar.js +43 -0
  7. package/dist/components/Avatar.js.map +1 -0
  8. package/dist/components/Badge.d.ts +5 -0
  9. package/dist/components/Badge.js +55 -0
  10. package/dist/components/Badge.js.map +1 -0
  11. package/dist/components/Breadcrumbs.d.ts +10 -0
  12. package/dist/components/Breadcrumbs.js +31 -0
  13. package/dist/components/Breadcrumbs.js.map +1 -0
  14. package/dist/components/Button.d.ts +7 -0
  15. package/dist/components/Button.js +77 -0
  16. package/dist/components/Button.js.map +1 -0
  17. package/dist/components/Card.d.ts +8 -0
  18. package/dist/components/Card.js +39 -0
  19. package/dist/components/Card.js.map +1 -0
  20. package/dist/components/ConfirmModal.d.ts +12 -0
  21. package/dist/components/ConfirmModal.js +53 -0
  22. package/dist/components/ConfirmModal.js.map +1 -0
  23. package/dist/components/Divider.d.ts +6 -0
  24. package/dist/components/Divider.js +35 -0
  25. package/dist/components/Divider.js.map +1 -0
  26. package/dist/components/InputComponents.d.ts +23 -0
  27. package/dist/components/InputComponents.js +83 -0
  28. package/dist/components/InputComponents.js.map +1 -0
  29. package/dist/components/ListComponents.d.ts +13 -0
  30. package/dist/components/ListComponents.js +28 -0
  31. package/dist/components/ListComponents.js.map +1 -0
  32. package/dist/components/LoadingSpinner.d.ts +7 -0
  33. package/dist/components/LoadingSpinner.js +21 -0
  34. package/dist/components/LoadingSpinner.js.map +1 -0
  35. package/dist/components/Progress.d.ts +9 -0
  36. package/dist/components/Progress.js +43 -0
  37. package/dist/components/Progress.js.map +1 -0
  38. package/dist/components/Radio.d.ts +21 -0
  39. package/dist/components/Radio.js +51 -0
  40. package/dist/components/Radio.js.map +1 -0
  41. package/dist/components/ReadOnlyField.d.ts +6 -0
  42. package/dist/components/ReadOnlyField.js +21 -0
  43. package/dist/components/ReadOnlyField.js.map +1 -0
  44. package/dist/components/Skeleton.d.ts +7 -0
  45. package/dist/components/Skeleton.js +28 -0
  46. package/dist/components/Skeleton.js.map +1 -0
  47. package/dist/components/Stack.d.ts +9 -0
  48. package/dist/components/Stack.js +28 -0
  49. package/dist/components/Stack.js.map +1 -0
  50. package/dist/components/Steps.d.ts +14 -0
  51. package/dist/components/Steps.js +84 -0
  52. package/dist/components/Steps.js.map +1 -0
  53. package/dist/components/Switch.d.ts +5 -0
  54. package/dist/components/Switch.js +39 -0
  55. package/dist/components/Switch.js.map +1 -0
  56. package/dist/components/Table.d.ts +31 -0
  57. package/dist/components/Table.js +54 -0
  58. package/dist/components/Table.js.map +1 -0
  59. package/dist/components/Tabs.d.ts +15 -0
  60. package/dist/components/Tabs.js +42 -0
  61. package/dist/components/Tabs.js.map +1 -0
  62. package/dist/components/Tag.d.ts +7 -0
  63. package/dist/components/Tag.js +43 -0
  64. package/dist/components/Tag.js.map +1 -0
  65. package/dist/components/Tooltip.d.ts +6 -0
  66. package/dist/components/Tooltip.js +43 -0
  67. package/dist/components/Tooltip.js.map +1 -0
  68. package/dist/components/Typography.d.ts +16 -0
  69. package/dist/components/Typography.js +68 -0
  70. package/dist/components/Typography.js.map +1 -0
  71. package/dist/index.d.ts +48 -0
  72. package/dist/index.js +29 -0
  73. package/dist/index.js.map +1 -0
  74. package/dist/tokens.d.ts +69 -0
  75. package/dist/tokens.js +69 -0
  76. package/dist/tokens.js.map +1 -0
  77. package/package.json +45 -0
  78. package/tailwind.preset.js +23 -0
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Design Tokens — shared-design-system
3
+ * Single source of truth for colors, spacing, typography, shadows.
4
+ */
5
+ export interface ColorTokens {
6
+ primary: string;
7
+ primaryDark: string;
8
+ primaryLight: string;
9
+ success: string;
10
+ successBg: string;
11
+ warning: string;
12
+ warningBg: string;
13
+ danger: string;
14
+ dangerBg: string;
15
+ info: string;
16
+ infoBg: string;
17
+ text: string;
18
+ textMuted: string;
19
+ textDisabled: string;
20
+ border: string;
21
+ borderFocus: string;
22
+ surface: string;
23
+ surfaceAlt: string;
24
+ overlay: string;
25
+ }
26
+ export interface RadiusTokens {
27
+ sm: string;
28
+ md: string;
29
+ lg: string;
30
+ xl: string;
31
+ full: string;
32
+ }
33
+ export interface ShadowTokens {
34
+ sm: string;
35
+ md: string;
36
+ lg: string;
37
+ xl: string;
38
+ }
39
+ export interface FontTokens {
40
+ family: string;
41
+ xs: string;
42
+ sm: string;
43
+ base: string;
44
+ md: string;
45
+ lg: string;
46
+ xl: string;
47
+ '2xl': string;
48
+ weightNormal: number;
49
+ weightMedium: number;
50
+ weightSemibold: number;
51
+ weightBold: number;
52
+ }
53
+ export interface SpacingTokens {
54
+ [key: string]: string;
55
+ }
56
+ export interface TransitionTokens {
57
+ fast: string;
58
+ normal: string;
59
+ slow: string;
60
+ }
61
+ export interface DesignTokens {
62
+ color: ColorTokens;
63
+ radius: RadiusTokens;
64
+ shadow: ShadowTokens;
65
+ font: FontTokens;
66
+ spacing: SpacingTokens;
67
+ transition: TransitionTokens;
68
+ }
69
+ export declare const tokens: DesignTokens;
package/dist/tokens.js ADDED
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Design Tokens — shared-design-system
3
+ * Single source of truth for colors, spacing, typography, shadows.
4
+ */
5
+ export const tokens = {
6
+ color: {
7
+ primary: 'var(--ds-color-primary, #f59e0b)',
8
+ primaryDark: 'var(--ds-color-primary-dark, #d97706)',
9
+ primaryLight: 'var(--ds-color-primary-light, #fef3c7)',
10
+ success: 'var(--ds-color-success, #10b981)',
11
+ successBg: 'var(--ds-color-success-bg, #ecfdf5)',
12
+ warning: 'var(--ds-color-warning, #f59e0b)',
13
+ warningBg: 'var(--ds-color-warning-bg, #fffbeb)',
14
+ danger: 'var(--ds-color-danger, #ef4444)',
15
+ dangerBg: 'var(--ds-color-danger-bg, #fef2f2)',
16
+ info: 'var(--ds-color-info, #3b82f6)',
17
+ infoBg: 'var(--ds-color-info-bg, #eff6ff)',
18
+ text: 'var(--ds-color-text, #0f172a)',
19
+ textMuted: 'var(--ds-color-text-muted, #64748b)',
20
+ textDisabled: 'var(--ds-color-text-disabled, #94a3b8)',
21
+ border: 'var(--ds-color-border, #e2e8f0)',
22
+ borderFocus: 'var(--ds-color-border-focus, #f59e0b)',
23
+ surface: 'var(--ds-color-surface, #ffffff)',
24
+ surfaceAlt: 'var(--ds-color-surface-alt, #f8fafc)',
25
+ overlay: 'rgba(0,0,0,0.35)',
26
+ },
27
+ radius: {
28
+ sm: '6px',
29
+ md: '10px',
30
+ lg: '14px',
31
+ xl: '20px',
32
+ full: '9999px',
33
+ },
34
+ shadow: {
35
+ sm: '0 1px 3px rgba(0,0,0,.08)',
36
+ md: '0 4px 12px rgba(0,0,0,.10)',
37
+ lg: '0 8px 30px rgba(0,0,0,.14)',
38
+ xl: '0 16px 48px rgba(0,0,0,.18)',
39
+ },
40
+ font: {
41
+ family: "'Inter', system-ui, sans-serif",
42
+ xs: '11px',
43
+ sm: '13px',
44
+ base: '14px',
45
+ md: '15px',
46
+ lg: '17px',
47
+ xl: '20px',
48
+ '2xl': '24px',
49
+ weightNormal: 400,
50
+ weightMedium: 500,
51
+ weightSemibold: 600,
52
+ weightBold: 700,
53
+ },
54
+ spacing: {
55
+ '1': '4px',
56
+ '2': '8px',
57
+ '3': '12px',
58
+ '4': '16px',
59
+ '5': '20px',
60
+ '6': '24px',
61
+ '8': '32px',
62
+ },
63
+ transition: {
64
+ fast: 'all .15s ease',
65
+ normal: 'all .25s ease',
66
+ slow: 'all .4s ease',
67
+ },
68
+ };
69
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyEH,MAAM,CAAC,MA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,EAAE,MAAM;QACX,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,MAAM;KACZ;IACD,UAAU,EAAE;QACV,IAAI,EAAI,eAAe;QACvB,MAAM,EAAE,eAAe;QACvB,IAAI,EAAI,cAAc;KACvB;CACF,CAAC"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "shared-design-system",
3
+ "version": "1.2.0",
4
+ "description": "Shared Tailwind Design System & UI Tokens for all Micro Frontends",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ },
14
+ "./tokens": {
15
+ "import": "./dist/tokens.js",
16
+ "require": "./dist/tokens.js",
17
+ "types": "./dist/tokens.d.ts"
18
+ },
19
+ "./tailwind.preset": "./tailwind.preset.js"
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "tailwind.preset.js",
24
+ "README.md"
25
+ ],
26
+ "scripts": {
27
+ "build": "tsc --project tsconfig.build.json",
28
+ "typecheck": "tsc --noEmit",
29
+ "prepublishOnly": "npm run typecheck && npm run build"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "peerDependencies": {
35
+ "react": "^18.0.0",
36
+ "react-dom": "^18.0.0",
37
+ "tailwindcss": "^3.0.0"
38
+ },
39
+ "devDependencies": {
40
+ "typescript": "^5.4.0",
41
+ "@types/react": "^18.2.0",
42
+ "@types/react-dom": "^18.2.0",
43
+ "@types/node": "^20.11.0"
44
+ }
45
+ }
@@ -0,0 +1,23 @@
1
+ /** @type {import('tailwindcss').Config} */
2
+ module.exports = {
3
+ theme: {
4
+ extend: {
5
+ colors: {
6
+ // Ánh xạ sang biến CSS Variable (Có giá trị fallback)
7
+ primary: 'var(--theme-color-primary, #0f172a)',
8
+ secondary: 'var(--theme-color-secondary, #64748b)',
9
+ brand: {
10
+ 50: '#f0fdf4',
11
+ 500: '#22c55e',
12
+ }
13
+ },
14
+ fontFamily: {
15
+ sans: ['Inter', 'system-ui', 'sans-serif'],
16
+ },
17
+ borderRadius: {
18
+ 'theme': 'var(--theme-border-radius, 0.5rem)',
19
+ }
20
+ },
21
+ },
22
+ plugins: [],
23
+ };