@twinmatrix/ui-sdk 0.0.1

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 (169) hide show
  1. package/README.md +49 -0
  2. package/THEME_CUSTOMIZATION.md +221 -0
  3. package/lib/cjs/index.js +224 -0
  4. package/lib/esm/index.js +224 -0
  5. package/lib/types/index.d.ts +33 -0
  6. package/lib/types/index.d.ts.map +1 -0
  7. package/lib/types/internal/alerts/AlertItem.d.ts +9 -0
  8. package/lib/types/internal/alerts/AlertItem.d.ts.map +1 -0
  9. package/lib/types/internal/alerts/AlertsList.d.ts +12 -0
  10. package/lib/types/internal/alerts/AlertsList.d.ts.map +1 -0
  11. package/lib/types/internal/alerts/index.d.ts +5 -0
  12. package/lib/types/internal/alerts/index.d.ts.map +1 -0
  13. package/lib/types/internal/alerts/types.d.ts +11 -0
  14. package/lib/types/internal/alerts/types.d.ts.map +1 -0
  15. package/lib/types/internal/alerts/utils.d.ts +2 -0
  16. package/lib/types/internal/alerts/utils.d.ts.map +1 -0
  17. package/lib/types/internal/charts/Chart.d.ts +28 -0
  18. package/lib/types/internal/charts/Chart.d.ts.map +1 -0
  19. package/lib/types/internal/charts/WidgetContainer.d.ts +16 -0
  20. package/lib/types/internal/charts/WidgetContainer.d.ts.map +1 -0
  21. package/lib/types/internal/charts/index.d.ts +5 -0
  22. package/lib/types/internal/charts/index.d.ts.map +1 -0
  23. package/lib/types/internal/stores/themeStore.d.ts +13 -0
  24. package/lib/types/internal/stores/themeStore.d.ts.map +1 -0
  25. package/lib/types/internal/theme/index.d.ts +26 -0
  26. package/lib/types/internal/theme/index.d.ts.map +1 -0
  27. package/lib/types/internal/theme/theme.d.ts +113 -0
  28. package/lib/types/internal/theme/theme.d.ts.map +1 -0
  29. package/lib/types/internal/theme/useAppTheme.d.ts +2 -0
  30. package/lib/types/internal/theme/useAppTheme.d.ts.map +1 -0
  31. package/lib/types/internal/ui/BottomBar.d.ts +9 -0
  32. package/lib/types/internal/ui/BottomBar.d.ts.map +1 -0
  33. package/lib/types/internal/ui/Button.d.ts +17 -0
  34. package/lib/types/internal/ui/Button.d.ts.map +1 -0
  35. package/lib/types/internal/ui/Card.d.ts +52 -0
  36. package/lib/types/internal/ui/Card.d.ts.map +1 -0
  37. package/lib/types/internal/ui/Dropdown.d.ts +12 -0
  38. package/lib/types/internal/ui/Dropdown.d.ts.map +1 -0
  39. package/lib/types/internal/ui/Modal.d.ts +45 -0
  40. package/lib/types/internal/ui/Modal.d.ts.map +1 -0
  41. package/lib/types/internal/ui/Panel.d.ts +30 -0
  42. package/lib/types/internal/ui/Panel.d.ts.map +1 -0
  43. package/lib/types/internal/ui/RadioButton.d.ts +13 -0
  44. package/lib/types/internal/ui/RadioButton.d.ts.map +1 -0
  45. package/lib/types/internal/ui/SidePanel.d.ts +10 -0
  46. package/lib/types/internal/ui/SidePanel.d.ts.map +1 -0
  47. package/lib/types/internal/ui/ThemeEditor.d.ts +21 -0
  48. package/lib/types/internal/ui/ThemeEditor.d.ts.map +1 -0
  49. package/lib/types/internal/ui/TopBar.d.ts +64 -0
  50. package/lib/types/internal/ui/TopBar.d.ts.map +1 -0
  51. package/lib/types/internal/ui/bottombar/Item.d.ts +9 -0
  52. package/lib/types/internal/ui/bottombar/Item.d.ts.map +1 -0
  53. package/lib/types/internal/ui/bottombar/Root.d.ts +8 -0
  54. package/lib/types/internal/ui/bottombar/Root.d.ts.map +1 -0
  55. package/lib/types/internal/ui/bottombar/styles.d.ts +19 -0
  56. package/lib/types/internal/ui/bottombar/styles.d.ts.map +1 -0
  57. package/lib/types/internal/ui/dropdown/Group.d.ts +9 -0
  58. package/lib/types/internal/ui/dropdown/Group.d.ts.map +1 -0
  59. package/lib/types/internal/ui/dropdown/Item.d.ts +12 -0
  60. package/lib/types/internal/ui/dropdown/Item.d.ts.map +1 -0
  61. package/lib/types/internal/ui/dropdown/Menu.d.ts +12 -0
  62. package/lib/types/internal/ui/dropdown/Menu.d.ts.map +1 -0
  63. package/lib/types/internal/ui/dropdown/Root.d.ts +11 -0
  64. package/lib/types/internal/ui/dropdown/Root.d.ts.map +1 -0
  65. package/lib/types/internal/ui/dropdown/Trigger.d.ts +11 -0
  66. package/lib/types/internal/ui/dropdown/Trigger.d.ts.map +1 -0
  67. package/lib/types/internal/ui/dropdown/styles.d.ts +67 -0
  68. package/lib/types/internal/ui/dropdown/styles.d.ts.map +1 -0
  69. package/lib/types/internal/ui/sidepanel/Body.d.ts +15 -0
  70. package/lib/types/internal/ui/sidepanel/Body.d.ts.map +1 -0
  71. package/lib/types/internal/ui/sidepanel/DrawerPanel.d.ts +13 -0
  72. package/lib/types/internal/ui/sidepanel/DrawerPanel.d.ts.map +1 -0
  73. package/lib/types/internal/ui/sidepanel/Footer.d.ts +5 -0
  74. package/lib/types/internal/ui/sidepanel/Footer.d.ts.map +1 -0
  75. package/lib/types/internal/ui/sidepanel/Header.d.ts +10 -0
  76. package/lib/types/internal/ui/sidepanel/Header.d.ts.map +1 -0
  77. package/lib/types/internal/ui/sidepanel/SidePanel.d.ts +11 -0
  78. package/lib/types/internal/ui/sidepanel/SidePanel.d.ts.map +1 -0
  79. package/lib/types/internal/ui/topbar/Actions.d.ts +5 -0
  80. package/lib/types/internal/ui/topbar/Actions.d.ts.map +1 -0
  81. package/lib/types/internal/ui/topbar/Badge.d.ts +5 -0
  82. package/lib/types/internal/ui/topbar/Badge.d.ts.map +1 -0
  83. package/lib/types/internal/ui/topbar/Divider.d.ts +5 -0
  84. package/lib/types/internal/ui/topbar/Divider.d.ts.map +1 -0
  85. package/lib/types/internal/ui/topbar/IconButton.d.ts +10 -0
  86. package/lib/types/internal/ui/topbar/IconButton.d.ts.map +1 -0
  87. package/lib/types/internal/ui/topbar/LevelSelector.d.ts +6 -0
  88. package/lib/types/internal/ui/topbar/LevelSelector.d.ts.map +1 -0
  89. package/lib/types/internal/ui/topbar/LocationSelector.d.ts +9 -0
  90. package/lib/types/internal/ui/topbar/LocationSelector.d.ts.map +1 -0
  91. package/lib/types/internal/ui/topbar/Logo.d.ts +8 -0
  92. package/lib/types/internal/ui/topbar/Logo.d.ts.map +1 -0
  93. package/lib/types/internal/ui/topbar/Root.d.ts +12 -0
  94. package/lib/types/internal/ui/topbar/Root.d.ts.map +1 -0
  95. package/lib/types/internal/ui/topbar/Section.d.ts +11 -0
  96. package/lib/types/internal/ui/topbar/Section.d.ts.map +1 -0
  97. package/lib/types/internal/ui/topbar/SelectBase.d.ts +19 -0
  98. package/lib/types/internal/ui/topbar/SelectBase.d.ts.map +1 -0
  99. package/lib/types/internal/ui/topbar/Spacer.d.ts +3 -0
  100. package/lib/types/internal/ui/topbar/Spacer.d.ts.map +1 -0
  101. package/lib/types/internal/ui/topbar/Title.d.ts +5 -0
  102. package/lib/types/internal/ui/topbar/Title.d.ts.map +1 -0
  103. package/lib/types/internal/ui/topbar/ToggleGroup.d.ts +14 -0
  104. package/lib/types/internal/ui/topbar/ToggleGroup.d.ts.map +1 -0
  105. package/lib/types/internal/ui/topbar/addons/BackButton.d.ts +6 -0
  106. package/lib/types/internal/ui/topbar/addons/BackButton.d.ts.map +1 -0
  107. package/lib/types/internal/ui/topbar/addons/EventsBar.d.ts +17 -0
  108. package/lib/types/internal/ui/topbar/addons/EventsBar.d.ts.map +1 -0
  109. package/lib/types/internal/ui/topbar/addons/LevelSelect.d.ts +6 -0
  110. package/lib/types/internal/ui/topbar/addons/LevelSelect.d.ts.map +1 -0
  111. package/lib/types/internal/ui/topbar/addons/ListTypeToggle.d.ts +6 -0
  112. package/lib/types/internal/ui/topbar/addons/ListTypeToggle.d.ts.map +1 -0
  113. package/lib/types/internal/ui/topbar/addons/LocationSelect.d.ts +9 -0
  114. package/lib/types/internal/ui/topbar/addons/LocationSelect.d.ts.map +1 -0
  115. package/lib/types/internal/ui/topbar/addons/SidebarToggleButton.d.ts +6 -0
  116. package/lib/types/internal/ui/topbar/addons/SidebarToggleButton.d.ts.map +1 -0
  117. package/lib/types/internal/ui/topbar/addons/ThemeToggleButton.d.ts +5 -0
  118. package/lib/types/internal/ui/topbar/addons/ThemeToggleButton.d.ts.map +1 -0
  119. package/lib/types/internal/ui/topbar/addons/TimelineToggleButton.d.ts +6 -0
  120. package/lib/types/internal/ui/topbar/addons/TimelineToggleButton.d.ts.map +1 -0
  121. package/lib/types/internal/ui/topbar/styles.d.ts +148 -0
  122. package/lib/types/internal/ui/topbar/styles.d.ts.map +1 -0
  123. package/lib/types/internal/utils/colorShades.d.ts +12 -0
  124. package/lib/types/internal/utils/colorShades.d.ts.map +1 -0
  125. package/lib/types/internal/webrtc/WebRTCManager.d.ts +28 -0
  126. package/lib/types/internal/webrtc/WebRTCManager.d.ts.map +1 -0
  127. package/lib/types/internal/webrtc/WebRTCStreamPlayer.d.ts +8 -0
  128. package/lib/types/internal/webrtc/WebRTCStreamPlayer.d.ts.map +1 -0
  129. package/lib/types/layout/DashboardBottomRegion.d.ts +17 -0
  130. package/lib/types/layout/DashboardBottomRegion.d.ts.map +1 -0
  131. package/lib/types/layout/DashboardMain.d.ts +16 -0
  132. package/lib/types/layout/DashboardMain.d.ts.map +1 -0
  133. package/lib/types/layout/DashboardMobileDrawer.d.ts +38 -0
  134. package/lib/types/layout/DashboardMobileDrawer.d.ts.map +1 -0
  135. package/lib/types/layout/DashboardShell.d.ts +18 -0
  136. package/lib/types/layout/DashboardShell.d.ts.map +1 -0
  137. package/lib/types/layout/DashboardSidePanel.d.ts +30 -0
  138. package/lib/types/layout/DashboardSidePanel.d.ts.map +1 -0
  139. package/lib/types/layout/index.d.ts +21 -0
  140. package/lib/types/layout/index.d.ts.map +1 -0
  141. package/lib/types/types/generic.d.ts +73 -0
  142. package/lib/types/types/generic.d.ts.map +1 -0
  143. package/lib/types/types/index.d.ts +7 -0
  144. package/lib/types/types/index.d.ts.map +1 -0
  145. package/lib/types/ui/index.d.ts +21 -0
  146. package/lib/types/ui/index.d.ts.map +1 -0
  147. package/lib/types/widgets/AIAnalysisPanel.d.ts +33 -0
  148. package/lib/types/widgets/AIAnalysisPanel.d.ts.map +1 -0
  149. package/lib/types/widgets/AlertCameraChart.d.ts +18 -0
  150. package/lib/types/widgets/AlertCameraChart.d.ts.map +1 -0
  151. package/lib/types/widgets/AlertSeverityChart.d.ts +20 -0
  152. package/lib/types/widgets/AlertSeverityChart.d.ts.map +1 -0
  153. package/lib/types/widgets/AlertTimelineChart.d.ts +18 -0
  154. package/lib/types/widgets/AlertTimelineChart.d.ts.map +1 -0
  155. package/lib/types/widgets/AlertTriggerChart.d.ts +18 -0
  156. package/lib/types/widgets/AlertTriggerChart.d.ts.map +1 -0
  157. package/lib/types/widgets/AlertsPanel.d.ts +22 -0
  158. package/lib/types/widgets/AlertsPanel.d.ts.map +1 -0
  159. package/lib/types/widgets/CameraStreamWidget.d.ts +39 -0
  160. package/lib/types/widgets/CameraStreamWidget.d.ts.map +1 -0
  161. package/lib/types/widgets/ChatbotPanel.d.ts +16 -0
  162. package/lib/types/widgets/ChatbotPanel.d.ts.map +1 -0
  163. package/lib/types/widgets/RecentActivityFeed.d.ts +18 -0
  164. package/lib/types/widgets/RecentActivityFeed.d.ts.map +1 -0
  165. package/lib/types/widgets/TopCamerasList.d.ts +17 -0
  166. package/lib/types/widgets/TopCamerasList.d.ts.map +1 -0
  167. package/lib/types/widgets/index.d.ts +27 -0
  168. package/lib/types/widgets/index.d.ts.map +1 -0
  169. package/package.json +70 -0
package/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # @twinmatrix/ui-sdk
2
+
3
+ TwinMatrix UI SDK - Dashboard components, widgets, and UI primitives for React applications.
4
+
5
+ ## Installation
6
+
7
+ This SDK is used as a git dependency in TwinMatrix applications. It will be cloned during the build process.
8
+
9
+ ## Usage
10
+
11
+ ```typescript
12
+ import {
13
+ DashboardShell,
14
+ DashboardSidePanel,
15
+ AlertsPanel,
16
+ useAppTheme,
17
+ setCustomTheme
18
+ } from '@twinmatrix/ui-sdk';
19
+
20
+ function MyDashboard() {
21
+ const theme = useAppTheme();
22
+
23
+ return (
24
+ <DashboardShell>
25
+ <DashboardSidePanel side="right" isOpen={true} title="Alerts">
26
+ <AlertsPanel items={alertItems} />
27
+ </DashboardSidePanel>
28
+ </DashboardShell>
29
+ );
30
+ }
31
+ ```
32
+
33
+ ## Development
34
+
35
+ ```bash
36
+ # Install dependencies
37
+ npm install
38
+
39
+ # Build the SDK
40
+ npm run build
41
+ ```
42
+
43
+ ## Documentation
44
+
45
+ See [THEME_CUSTOMIZATION.md](./THEME_CUSTOMIZATION.md) for theme customization guide.
46
+
47
+ ## License
48
+
49
+ MIT
@@ -0,0 +1,221 @@
1
+ # Theme Customization Guide
2
+
3
+ The Dashboard SDK provides a default theme with sensible colors, but you can customize it to match your brand.
4
+
5
+ ## Quick Start
6
+
7
+ ```typescript
8
+ import { setCustomTheme, getTheme } from '@dashboard-sdk';
9
+
10
+ // Customize theme colors for dark mode
11
+ setCustomTheme('dark', {
12
+ accent: {
13
+ primary: '#FF5733', // Your brand primary color
14
+ secondary: '#33FF57', // Your brand secondary color
15
+ },
16
+ surface: {
17
+ topbar: '#FF5733', // Match topbar to your brand
18
+ },
19
+ text: {
20
+ onAccent: '#FFFFFF', // Text color on accent backgrounds
21
+ },
22
+ });
23
+
24
+ // Customize both light and dark modes at once
25
+ setCustomTheme('light', {
26
+ accent: { primary: '#0066CC' },
27
+ surface: { topbar: '#0066CC' },
28
+ });
29
+
30
+ setCustomTheme('dark', {
31
+ accent: { primary: '#3399FF' },
32
+ surface: { topbar: '#3399FF' },
33
+ });
34
+ ```
35
+
36
+ ## API Reference
37
+
38
+ ### `setCustomTheme(mode, override)`
39
+
40
+ Set custom theme overrides for a specific mode.
41
+
42
+ **Parameters:**
43
+ - `mode: 'light' | 'dark'` - The theme mode to customize
44
+ - `override: PartialTheme` - Partial theme object with your customizations
45
+
46
+ **Example:**
47
+ ```typescript
48
+ setCustomTheme('dark', {
49
+ accent: {
50
+ primary: '#FF5733',
51
+ secondary: '#33FF57',
52
+ },
53
+ surface: {
54
+ topbar: '#FF5733',
55
+ panel: '#1a1a1a',
56
+ },
57
+ chart: {
58
+ palette: ['#FF5733', '#33FF57', '#3357FF'],
59
+ },
60
+ });
61
+ ```
62
+
63
+ ### `setCustomThemes(overrides)`
64
+
65
+ Set custom theme overrides for both modes at once.
66
+
67
+ **Parameters:**
68
+ - `overrides: { light?: PartialTheme; dark?: PartialTheme }` - Theme overrides for each mode
69
+
70
+ **Example:**
71
+ ```typescript
72
+ setCustomThemes({
73
+ light: {
74
+ accent: { primary: '#0066CC' },
75
+ },
76
+ dark: {
77
+ accent: { primary: '#3399FF' },
78
+ },
79
+ });
80
+ ```
81
+
82
+ ### `resetTheme(mode?)`
83
+
84
+ Reset theme overrides to defaults.
85
+
86
+ **Parameters:**
87
+ - `mode?: 'light' | 'dark'` - Optional mode to reset. If omitted, resets both modes.
88
+
89
+ **Example:**
90
+ ```typescript
91
+ resetTheme('dark'); // Reset only dark mode
92
+ resetTheme(); // Reset both modes
93
+ ```
94
+
95
+ ### `getTheme(mode)`
96
+
97
+ Get the current theme (with custom overrides applied).
98
+
99
+ **Parameters:**
100
+ - `mode: 'light' | 'dark'` - The theme mode to retrieve
101
+
102
+ **Returns:** `Theme` - The complete theme object
103
+
104
+ **Example:**
105
+ ```typescript
106
+ const darkTheme = getTheme('dark');
107
+ console.log(darkTheme.accent.primary); // Your custom primary color
108
+ ```
109
+
110
+ ### `getBaseTheme(mode)`
111
+
112
+ Get the base theme without any custom overrides.
113
+
114
+ **Parameters:**
115
+ - `mode: 'light' | 'dark'` - The theme mode to retrieve
116
+
117
+ **Returns:** `Theme` - The base theme object
118
+
119
+ ## Theme Structure
120
+
121
+ The `Theme` type includes the following properties:
122
+
123
+ ```typescript
124
+ type Theme = {
125
+ surface: {
126
+ app: string; // Main app background
127
+ topbar: string; // Top bar background
128
+ panel: string; // Side panel background
129
+ card: string; // Card background
130
+ modal: string; // Modal background
131
+ control: string; // Control elements background
132
+ backdrop: string; // Modal backdrop
133
+ neutral: string; // Neutral background
134
+ hover: string; // Hover state background
135
+ };
136
+ text: {
137
+ primary: string; // Primary text color
138
+ muted: string; // Muted/secondary text
139
+ inverted: string; // Inverted text (for dark backgrounds)
140
+ onAccent: string; // Text on accent backgrounds
141
+ };
142
+ accent: {
143
+ primary: string; // Primary accent color
144
+ secondary: string; // Secondary accent color
145
+ };
146
+ semantic: {
147
+ success: string; // Success state color
148
+ warning: string; // Warning state color
149
+ danger: string; // Danger/error color
150
+ info: string; // Info state color
151
+ };
152
+ border: {
153
+ subtle: string; // Subtle border color
154
+ strong: string; // Strong border color
155
+ };
156
+ chart: {
157
+ palette: string[]; // Chart color palette
158
+ grid: string; // Chart grid color
159
+ text: string; // Chart text color
160
+ };
161
+ state: {
162
+ hover: string; // Hover state color
163
+ active: string; // Active state color
164
+ focus: string; // Focus state color
165
+ };
166
+ };
167
+ ```
168
+
169
+ ## Best Practices
170
+
171
+ 1. **Set theme early**: Call `setCustomTheme` before rendering any SDK components, ideally in your app initialization code.
172
+
173
+ 2. **Use brand colors**: Map your brand's primary and secondary colors to `accent.primary` and `accent.secondary`.
174
+
175
+ 3. **Maintain contrast**: Ensure text colors have sufficient contrast against their backgrounds for accessibility.
176
+
177
+ 4. **Test both modes**: Customize both light and dark modes if your app supports theme switching.
178
+
179
+ ## Example: Complete Theme Setup
180
+
181
+ ```typescript
182
+ // In your app initialization (e.g., App.tsx or main.tsx)
183
+ import { setCustomThemes } from '@dashboard-sdk';
184
+
185
+ // Your brand colors
186
+ const BRAND_PRIMARY = '#FF5733';
187
+ const BRAND_SECONDARY = '#33FF57';
188
+ const BRAND_DARK = '#1a1a1a';
189
+
190
+ // Setup themes
191
+ setCustomThemes({
192
+ light: {
193
+ accent: {
194
+ primary: BRAND_PRIMARY,
195
+ secondary: BRAND_SECONDARY,
196
+ },
197
+ surface: {
198
+ topbar: BRAND_PRIMARY,
199
+ },
200
+ text: {
201
+ onAccent: '#FFFFFF',
202
+ },
203
+ },
204
+ dark: {
205
+ accent: {
206
+ primary: BRAND_PRIMARY,
207
+ secondary: BRAND_SECONDARY,
208
+ },
209
+ surface: {
210
+ topbar: BRAND_PRIMARY,
211
+ app: BRAND_DARK,
212
+ panel: '#222222',
213
+ },
214
+ text: {
215
+ onAccent: '#FFFFFF',
216
+ },
217
+ },
218
+ });
219
+
220
+ // Now render your dashboard components
221
+ ```