dash-ui-kit 1.0.93 → 2.0.0-dev
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 +52 -0
- package/dist/react/components/accordion/index.cjs.js +193 -0
- package/dist/react/components/accordion/index.cjs.js.map +1 -0
- package/dist/react/components/accordion/index.esm.js +169 -0
- package/dist/react/components/accordion/index.esm.js.map +1 -0
- package/dist/react/components/avatar/index.cjs.js +39 -0
- package/dist/react/components/avatar/index.cjs.js.map +1 -0
- package/dist/react/components/avatar/index.esm.js +34 -0
- package/dist/react/components/avatar/index.esm.js.map +1 -0
- package/dist/react/components/badge/index.cjs.js +92 -0
- package/dist/react/components/badge/index.cjs.js.map +1 -0
- package/dist/react/components/badge/index.esm.js +87 -0
- package/dist/react/components/badge/index.esm.js.map +1 -0
- package/dist/react/components/bigNumber/index.cjs.js +100 -0
- package/dist/react/components/bigNumber/index.cjs.js.map +1 -0
- package/dist/react/components/bigNumber/index.esm.js +95 -0
- package/dist/react/components/bigNumber/index.esm.js.map +1 -0
- package/dist/react/components/button/index.cjs.js +535 -0
- package/dist/react/components/button/index.cjs.js.map +1 -0
- package/dist/react/components/button/index.d.ts +3 -1
- package/dist/react/components/button/index.esm.js +530 -0
- package/dist/react/components/button/index.esm.js.map +1 -0
- package/dist/react/components/copyButton/index.cjs.js +95 -0
- package/dist/react/components/copyButton/index.cjs.js.map +1 -0
- package/dist/react/components/copyButton/index.esm.js +71 -0
- package/dist/react/components/copyButton/index.esm.js.map +1 -0
- package/dist/react/components/dashLogo/index.cjs.js +74 -0
- package/dist/react/components/dashLogo/index.cjs.js.map +1 -0
- package/dist/react/components/dashLogo/index.esm.js +69 -0
- package/dist/react/components/dashLogo/index.esm.js.map +1 -0
- package/dist/react/components/dateBlock/index.cjs.js +120 -0
- package/dist/react/components/dateBlock/index.cjs.js.map +1 -0
- package/dist/react/components/dateBlock/index.esm.js +115 -0
- package/dist/react/components/dateBlock/index.esm.js.map +1 -0
- package/dist/react/components/dialog/index.cjs.js +292 -0
- package/dist/react/components/dialog/index.cjs.js.map +1 -0
- package/dist/react/components/dialog/index.esm.js +270 -0
- package/dist/react/components/dialog/index.esm.js.map +1 -0
- package/dist/react/components/heading/index.cjs.js +60 -0
- package/dist/react/components/heading/index.cjs.js.map +1 -0
- package/dist/react/components/heading/index.esm.js +58 -0
- package/dist/react/components/heading/index.esm.js.map +1 -0
- package/dist/react/components/icons/index.cjs.js +1173 -0
- package/dist/react/components/icons/index.cjs.js.map +1 -0
- package/dist/react/components/icons/index.d.ts +2 -0
- package/dist/react/components/icons/index.esm.js +1128 -0
- package/dist/react/components/icons/index.esm.js.map +1 -0
- package/dist/react/components/identifier/index.cjs.js +286 -0
- package/dist/react/components/identifier/index.cjs.js.map +1 -0
- package/dist/react/components/identifier/index.esm.js +282 -0
- package/dist/react/components/identifier/index.esm.js.map +1 -0
- package/dist/react/components/index.cjs.js +101 -0
- package/dist/react/components/index.cjs.js.map +1 -0
- package/dist/react/components/index.d.ts +1 -1
- package/dist/react/components/index.esm.js +29 -0
- package/dist/react/components/index.esm.js.map +1 -0
- package/dist/react/components/input/index.cjs.js +237 -0
- package/dist/react/components/input/index.cjs.js.map +1 -0
- package/dist/react/components/input/index.esm.js +232 -0
- package/dist/react/components/input/index.esm.js.map +1 -0
- package/dist/react/components/list/index.cjs.js +49 -0
- package/dist/react/components/list/index.cjs.js.map +1 -0
- package/dist/react/components/list/index.esm.js +47 -0
- package/dist/react/components/list/index.esm.js.map +1 -0
- package/dist/react/components/notActive/index.cjs.js +40 -0
- package/dist/react/components/notActive/index.cjs.js.map +1 -0
- package/dist/react/components/notActive/index.esm.js +38 -0
- package/dist/react/components/notActive/index.esm.js.map +1 -0
- package/dist/react/components/overlayMenu/index.cjs.js +425 -0
- package/dist/react/components/overlayMenu/index.cjs.js.map +1 -0
- package/dist/react/components/overlayMenu/index.esm.js +420 -0
- package/dist/react/components/overlayMenu/index.esm.js.map +1 -0
- package/dist/react/components/overlaySelect/index.cjs.js +345 -0
- package/dist/react/components/overlaySelect/index.cjs.js.map +1 -0
- package/dist/react/components/overlaySelect/index.esm.js +340 -0
- package/dist/react/components/overlaySelect/index.esm.js.map +1 -0
- package/dist/react/components/progressStepBar/index.cjs.js +49 -0
- package/dist/react/components/progressStepBar/index.cjs.js.map +1 -0
- package/dist/react/components/progressStepBar/index.d.ts +2 -1
- package/dist/react/components/progressStepBar/index.esm.js +47 -0
- package/dist/react/components/progressStepBar/index.esm.js.map +1 -0
- package/dist/react/components/select/index.cjs.js +236 -0
- package/dist/react/components/select/index.cjs.js.map +1 -0
- package/dist/react/components/select/index.esm.js +212 -0
- package/dist/react/components/select/index.esm.js.map +1 -0
- package/dist/react/components/switch/index.cjs.js +184 -0
- package/dist/react/components/switch/index.cjs.js.map +1 -0
- package/dist/react/components/switch/index.esm.js +179 -0
- package/dist/react/components/switch/index.esm.js.map +1 -0
- package/dist/react/components/tabs/index.cjs.js +178 -0
- package/dist/react/components/tabs/index.cjs.js.map +1 -0
- package/dist/react/components/tabs/index.esm.js +154 -0
- package/dist/react/components/tabs/index.esm.js.map +1 -0
- package/dist/react/components/text/index.cjs.js +120 -0
- package/dist/react/components/text/index.cjs.js.map +1 -0
- package/dist/react/components/text/index.esm.js +115 -0
- package/dist/react/components/text/index.esm.js.map +1 -0
- package/dist/react/components/textarea/index.cjs.js +256 -0
- package/dist/react/components/textarea/index.cjs.js.map +1 -0
- package/dist/react/components/textarea/index.esm.js +251 -0
- package/dist/react/components/textarea/index.esm.js.map +1 -0
- package/dist/react/components/timeDelta/index.cjs.js +93 -0
- package/dist/react/components/timeDelta/index.cjs.js.map +1 -0
- package/dist/react/components/timeDelta/index.d.ts +1 -1
- package/dist/react/components/timeDelta/index.esm.js +88 -0
- package/dist/react/components/timeDelta/index.esm.js.map +1 -0
- package/dist/react/components/transactionStatusIcon/index.cjs.js +59 -0
- package/dist/react/components/transactionStatusIcon/index.cjs.js.map +1 -0
- package/dist/react/components/transactionStatusIcon/index.esm.js +54 -0
- package/dist/react/components/transactionStatusIcon/index.esm.js.map +1 -0
- package/dist/react/components/valueCard/index.cjs.js +176 -0
- package/dist/react/components/valueCard/index.cjs.js.map +1 -0
- package/dist/react/components/valueCard/index.d.ts +1 -1
- package/dist/react/components/valueCard/index.esm.js +171 -0
- package/dist/react/components/valueCard/index.esm.js.map +1 -0
- package/dist/react/contexts/ThemeContext.cjs.js +79 -0
- package/dist/react/contexts/ThemeContext.cjs.js.map +1 -0
- package/dist/react/contexts/ThemeContext.esm.js +76 -0
- package/dist/react/contexts/ThemeContext.esm.js.map +1 -0
- package/dist/react/contexts/index.cjs.js +11 -0
- package/dist/react/contexts/index.cjs.js.map +1 -0
- package/dist/react/contexts/index.esm.js +4 -0
- package/dist/react/contexts/index.esm.js.map +1 -0
- package/dist/react/hooks/useDebounce.cjs.js +83 -0
- package/dist/react/hooks/useDebounce.cjs.js.map +1 -0
- package/dist/react/hooks/useDebounce.esm.js +78 -0
- package/dist/react/hooks/useDebounce.esm.js.map +1 -0
- package/dist/react/index.cjs.js +99 -12811
- package/dist/react/index.cjs.js.map +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.esm.js +27 -12725
- package/dist/react/index.esm.js.map +1 -1
- package/dist/react/shared/utils/datetime.cjs.js +59 -0
- package/dist/react/shared/utils/datetime.cjs.js.map +1 -0
- package/dist/react/shared/utils/datetime.esm.js +57 -0
- package/dist/react/shared/utils/datetime.esm.js.map +1 -0
- package/dist/react/utils/copyToClipboard.cjs.js +31 -0
- package/dist/react/utils/copyToClipboard.cjs.js.map +1 -0
- package/dist/react/utils/copyToClipboard.esm.js +26 -0
- package/dist/react/utils/copyToClipboard.esm.js.map +1 -0
- package/dist/react/utils/index.d.ts +1 -1
- package/dist/react-native/components/avatar/index.d.ts +26 -0
- package/dist/react-native/components/avatar/index.web.d.ts +24 -0
- package/dist/react-native/components/badge/index.d.ts +51 -0
- package/dist/react-native/components/bigNumber/index.d.ts +26 -0
- package/dist/react-native/components/button/index.d.ts +39 -0
- package/dist/react-native/components/copyButton/index.d.ts +22 -0
- package/dist/react-native/components/copyButton/index.web.d.ts +20 -0
- package/dist/react-native/components/dashLogo/index.d.ts +30 -0
- package/dist/react-native/components/heading/index.d.ts +25 -0
- package/dist/react-native/components/icons/index.d.ts +43 -0
- package/dist/react-native/components/identifier/index.d.ts +47 -0
- package/dist/react-native/components/index.d.ts +15 -0
- package/dist/react-native/components/input/index.d.ts +53 -0
- package/dist/react-native/components/notActive/index.d.ts +16 -0
- package/dist/react-native/components/tabs/index.d.ts +50 -0
- package/dist/react-native/components/text/index.d.ts +28 -0
- package/dist/react-native/components/transactionStatusIcon/index.d.ts +24 -0
- package/dist/react-native/components/valueCard/index.d.ts +43 -0
- package/dist/react-native/hooks/index.d.ts +1 -0
- package/dist/react-native/hooks/useDebounce.d.ts +43 -0
- package/dist/react-native/index.cjs.js +2856 -0
- package/dist/react-native/index.cjs.js.map +1 -0
- package/dist/react-native/index.d.ts +4 -0
- package/dist/react-native/index.esm.js +2808 -0
- package/dist/react-native/index.esm.js.map +1 -0
- package/dist/react-native/styles/index.d.ts +11 -0
- package/dist/react-native/styles/tokens.d.ts +308 -0
- package/dist/react-native/styles/utils.d.ts +65 -0
- package/dist/react-native/utils/clipboard.d.ts +27 -0
- package/dist/react-native/utils/index.d.ts +2 -0
- package/dist/react-native/utils/tw.d.ts +7 -0
- package/dist/shared/constants/colors.d.ts +25 -0
- package/dist/shared/constants/index.d.ts +2 -0
- package/dist/shared/constants/sizes.d.ts +49 -0
- package/dist/shared/index.cjs.js +171 -0
- package/dist/shared/index.cjs.js.map +1 -0
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/index.esm.js +161 -0
- package/dist/shared/index.esm.js.map +1 -0
- package/dist/shared/types/common.d.ts +33 -0
- package/dist/shared/types/index.d.ts +1 -0
- package/dist/shared/utils/index.d.ts +1 -0
- package/dist/styles.css +1 -1
- package/package.json +50 -8
- /package/dist/{react → shared}/utils/datetime.d.ts +0 -0
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Design tokens for React Native
|
|
3
|
+
*
|
|
4
|
+
* These tokens are derived from the web theme (src/styles/theme.pcss)
|
|
5
|
+
* and optimized for React Native StyleSheet usage.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { colors, spacing, typography, borderRadius, shadows } from 'dash-ui-kit/react-native';
|
|
10
|
+
* import { StyleSheet, Platform } from 'react-native';
|
|
11
|
+
*
|
|
12
|
+
* const styles = StyleSheet.create({
|
|
13
|
+
* container: {
|
|
14
|
+
* backgroundColor: colors.brand,
|
|
15
|
+
* padding: spacing[4],
|
|
16
|
+
* borderRadius: borderRadius.md,
|
|
17
|
+
* ...Platform.select({
|
|
18
|
+
* ios: shadows.md.ios,
|
|
19
|
+
* android: shadows.md.android,
|
|
20
|
+
* }),
|
|
21
|
+
* },
|
|
22
|
+
* title: {
|
|
23
|
+
* fontSize: typography.fontSize.xl,
|
|
24
|
+
* fontWeight: typography.fontWeight.semibold,
|
|
25
|
+
* lineHeight: typography.lineHeight.xl,
|
|
26
|
+
* },
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Color palette
|
|
32
|
+
* Derived from theme.pcss color variables
|
|
33
|
+
*/
|
|
34
|
+
export declare const colors: {
|
|
35
|
+
readonly brand: "#4C7EFF";
|
|
36
|
+
readonly brandDim: "#96A7FF";
|
|
37
|
+
readonly brandDark: "#4D5895";
|
|
38
|
+
readonly brandDarkness: "#13172A";
|
|
39
|
+
readonly mint: "#60F6D2";
|
|
40
|
+
readonly mintHover: "#4DD4B1";
|
|
41
|
+
readonly yellowLight: "#fef3c7";
|
|
42
|
+
readonly yellow: "#fde68a";
|
|
43
|
+
readonly primaryDarkBlue: "#0C1C33";
|
|
44
|
+
readonly primaryDieSubdued: "rgba(12, 28, 51, 0.03)";
|
|
45
|
+
readonly green: "#40BF40";
|
|
46
|
+
readonly green75: "rgba(64, 191, 64, 0.75)";
|
|
47
|
+
readonly green15: "rgba(64, 191, 64, 0.15)";
|
|
48
|
+
readonly green5: "rgba(64, 191, 64, 0.05)";
|
|
49
|
+
readonly red: "#CD2E00";
|
|
50
|
+
readonly red75: "rgba(205, 46, 0, 0.75)";
|
|
51
|
+
readonly red15: "rgba(205, 46, 0, 0.15)";
|
|
52
|
+
readonly red5: "rgba(205, 46, 0, 0.05)";
|
|
53
|
+
readonly orange: "#F98F12";
|
|
54
|
+
readonly orange75: "rgba(249, 143, 18, 0.75)";
|
|
55
|
+
readonly orange15: "rgba(249, 143, 18, 0.15)";
|
|
56
|
+
readonly orange5: "rgba(249, 143, 18, 0.05)";
|
|
57
|
+
readonly white: "#FFFFFF";
|
|
58
|
+
readonly black: "#000000";
|
|
59
|
+
readonly transparent: "transparent";
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Spacing scale
|
|
63
|
+
* Based on 4px base unit (Tailwind-compatible)
|
|
64
|
+
*/
|
|
65
|
+
export declare const spacing: {
|
|
66
|
+
readonly 0: 0;
|
|
67
|
+
readonly 1: 4;
|
|
68
|
+
readonly 2: 8;
|
|
69
|
+
readonly 3: 12;
|
|
70
|
+
readonly 4: 16;
|
|
71
|
+
readonly 5: 20;
|
|
72
|
+
readonly 6: 24;
|
|
73
|
+
readonly 7: 28;
|
|
74
|
+
readonly 8: 32;
|
|
75
|
+
readonly 9: 36;
|
|
76
|
+
readonly 10: 40;
|
|
77
|
+
readonly 11: 44;
|
|
78
|
+
readonly 12: 48;
|
|
79
|
+
readonly 14: 56;
|
|
80
|
+
readonly 16: 64;
|
|
81
|
+
readonly 18: 72;
|
|
82
|
+
readonly 20: 80;
|
|
83
|
+
readonly 24: 96;
|
|
84
|
+
readonly 28: 112;
|
|
85
|
+
readonly 32: 128;
|
|
86
|
+
readonly 36: 144;
|
|
87
|
+
readonly 40: 160;
|
|
88
|
+
readonly 44: 176;
|
|
89
|
+
readonly 48: 192;
|
|
90
|
+
readonly 52: 208;
|
|
91
|
+
readonly 56: 224;
|
|
92
|
+
readonly 60: 240;
|
|
93
|
+
readonly 64: 256;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Typography scale
|
|
97
|
+
* Font sizes, weights, and line heights
|
|
98
|
+
*/
|
|
99
|
+
export declare const typography: {
|
|
100
|
+
/**
|
|
101
|
+
* Font size scale
|
|
102
|
+
*/
|
|
103
|
+
readonly fontSize: {
|
|
104
|
+
readonly xs: 12;
|
|
105
|
+
readonly sm: 14;
|
|
106
|
+
readonly base: 16;
|
|
107
|
+
readonly lg: 18;
|
|
108
|
+
readonly xl: 20;
|
|
109
|
+
readonly '2xl': 24;
|
|
110
|
+
readonly '3xl': 30;
|
|
111
|
+
readonly '4xl': 36;
|
|
112
|
+
readonly '5xl': 48;
|
|
113
|
+
readonly '6xl': 60;
|
|
114
|
+
readonly '7xl': 72;
|
|
115
|
+
readonly '8xl': 96;
|
|
116
|
+
readonly '9xl': 128;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Font weight scale
|
|
120
|
+
* Values are strings for React Native compatibility
|
|
121
|
+
*/
|
|
122
|
+
readonly fontWeight: {
|
|
123
|
+
readonly normal: "400";
|
|
124
|
+
readonly medium: "500";
|
|
125
|
+
readonly semibold: "600";
|
|
126
|
+
readonly bold: "700";
|
|
127
|
+
readonly extrabold: "800";
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Line height scale (in pixels)
|
|
131
|
+
* Calculated based on common typography ratios
|
|
132
|
+
*/
|
|
133
|
+
readonly lineHeight: {
|
|
134
|
+
readonly xs: 16;
|
|
135
|
+
readonly sm: 20;
|
|
136
|
+
readonly base: 24;
|
|
137
|
+
readonly lg: 28;
|
|
138
|
+
readonly xl: 28;
|
|
139
|
+
readonly '2xl': 32;
|
|
140
|
+
readonly '3xl': 36;
|
|
141
|
+
readonly '4xl': 40;
|
|
142
|
+
readonly '5xl': 56;
|
|
143
|
+
readonly '6xl': 72;
|
|
144
|
+
readonly '7xl': 84;
|
|
145
|
+
readonly '8xl': 112;
|
|
146
|
+
readonly '9xl': 144;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Letter spacing (tracking)
|
|
150
|
+
*/
|
|
151
|
+
readonly letterSpacing: {
|
|
152
|
+
readonly tighter: -0.8;
|
|
153
|
+
readonly tight: -0.4;
|
|
154
|
+
readonly normal: 0;
|
|
155
|
+
readonly wide: 0.4;
|
|
156
|
+
readonly wider: 0.8;
|
|
157
|
+
readonly widest: 1.6;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Border radius scale
|
|
162
|
+
*/
|
|
163
|
+
export declare const borderRadius: {
|
|
164
|
+
readonly none: 0;
|
|
165
|
+
readonly xs: 4;
|
|
166
|
+
readonly sm: 10;
|
|
167
|
+
readonly md: 12;
|
|
168
|
+
readonly lg: 14;
|
|
169
|
+
readonly xl: 16;
|
|
170
|
+
readonly '2xl': 20;
|
|
171
|
+
readonly '3xl': 24;
|
|
172
|
+
readonly full: 9999;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Shadow presets
|
|
176
|
+
* Platform-specific implementations for iOS and Android
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* import { Platform } from 'react-native';
|
|
181
|
+
*
|
|
182
|
+
* const shadowStyle = Platform.select({
|
|
183
|
+
* ios: shadows.md.ios,
|
|
184
|
+
* android: shadows.md.android,
|
|
185
|
+
* });
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
export declare const shadows: {
|
|
189
|
+
/**
|
|
190
|
+
* Small shadow - subtle elevation
|
|
191
|
+
*/
|
|
192
|
+
readonly sm: {
|
|
193
|
+
readonly ios: {
|
|
194
|
+
readonly shadowColor: "#000000";
|
|
195
|
+
readonly shadowOffset: {
|
|
196
|
+
readonly width: 0;
|
|
197
|
+
readonly height: 1;
|
|
198
|
+
};
|
|
199
|
+
readonly shadowOpacity: 0.1;
|
|
200
|
+
readonly shadowRadius: 2;
|
|
201
|
+
};
|
|
202
|
+
readonly android: {
|
|
203
|
+
readonly elevation: 2;
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* Medium shadow - standard elevation
|
|
208
|
+
*/
|
|
209
|
+
readonly md: {
|
|
210
|
+
readonly ios: {
|
|
211
|
+
readonly shadowColor: "#000000";
|
|
212
|
+
readonly shadowOffset: {
|
|
213
|
+
readonly width: 0;
|
|
214
|
+
readonly height: 2;
|
|
215
|
+
};
|
|
216
|
+
readonly shadowOpacity: 0.15;
|
|
217
|
+
readonly shadowRadius: 4;
|
|
218
|
+
};
|
|
219
|
+
readonly android: {
|
|
220
|
+
readonly elevation: 4;
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Large shadow - prominent elevation
|
|
225
|
+
*/
|
|
226
|
+
readonly lg: {
|
|
227
|
+
readonly ios: {
|
|
228
|
+
readonly shadowColor: "#000000";
|
|
229
|
+
readonly shadowOffset: {
|
|
230
|
+
readonly width: 0;
|
|
231
|
+
readonly height: 4;
|
|
232
|
+
};
|
|
233
|
+
readonly shadowOpacity: 0.2;
|
|
234
|
+
readonly shadowRadius: 8;
|
|
235
|
+
};
|
|
236
|
+
readonly android: {
|
|
237
|
+
readonly elevation: 8;
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* Extra large shadow - maximum elevation
|
|
242
|
+
*/
|
|
243
|
+
readonly xl: {
|
|
244
|
+
readonly ios: {
|
|
245
|
+
readonly shadowColor: "#000000";
|
|
246
|
+
readonly shadowOffset: {
|
|
247
|
+
readonly width: 0;
|
|
248
|
+
readonly height: 8;
|
|
249
|
+
};
|
|
250
|
+
readonly shadowOpacity: 0.25;
|
|
251
|
+
readonly shadowRadius: 16;
|
|
252
|
+
};
|
|
253
|
+
readonly android: {
|
|
254
|
+
readonly elevation: 12;
|
|
255
|
+
};
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* Border width scale
|
|
260
|
+
*/
|
|
261
|
+
export declare const borderWidth: {
|
|
262
|
+
readonly 0: 0;
|
|
263
|
+
readonly 1: 1;
|
|
264
|
+
readonly 2: 2;
|
|
265
|
+
readonly 4: 4;
|
|
266
|
+
readonly 8: 8;
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* Opacity scale
|
|
270
|
+
*/
|
|
271
|
+
export declare const opacity: {
|
|
272
|
+
readonly 0: 0;
|
|
273
|
+
readonly 5: 0.05;
|
|
274
|
+
readonly 10: 0.1;
|
|
275
|
+
readonly 15: 0.15;
|
|
276
|
+
readonly 20: 0.2;
|
|
277
|
+
readonly 25: 0.25;
|
|
278
|
+
readonly 30: 0.3;
|
|
279
|
+
readonly 40: 0.4;
|
|
280
|
+
readonly 50: 0.5;
|
|
281
|
+
readonly 60: 0.6;
|
|
282
|
+
readonly 70: 0.7;
|
|
283
|
+
readonly 75: 0.75;
|
|
284
|
+
readonly 80: 0.8;
|
|
285
|
+
readonly 90: 0.9;
|
|
286
|
+
readonly 95: 0.95;
|
|
287
|
+
readonly 100: 1;
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
290
|
+
* Z-index scale
|
|
291
|
+
*/
|
|
292
|
+
export declare const zIndex: {
|
|
293
|
+
readonly 0: 0;
|
|
294
|
+
readonly 10: 10;
|
|
295
|
+
readonly 20: 20;
|
|
296
|
+
readonly 30: 30;
|
|
297
|
+
readonly 40: 40;
|
|
298
|
+
readonly 50: 50;
|
|
299
|
+
readonly auto: "auto";
|
|
300
|
+
};
|
|
301
|
+
export type Colors = typeof colors;
|
|
302
|
+
export type Spacing = typeof spacing;
|
|
303
|
+
export type Typography = typeof typography;
|
|
304
|
+
export type BorderRadius = typeof borderRadius;
|
|
305
|
+
export type Shadows = typeof shadows;
|
|
306
|
+
export type BorderWidth = typeof borderWidth;
|
|
307
|
+
export type Opacity = typeof opacity;
|
|
308
|
+
export type ZIndex = typeof zIndex;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for React Native styles
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Creates an rgba color string from hex color and opacity
|
|
6
|
+
*
|
|
7
|
+
* @param hexColor - Hex color string (e.g., '#4C7EFF')
|
|
8
|
+
* @param alpha - Opacity value between 0 and 1
|
|
9
|
+
* @returns rgba color string
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* rgba('#4C7EFF', 0.5) // 'rgba(76, 126, 255, 0.5)'
|
|
14
|
+
* rgba('#40BF40', 0.15) // 'rgba(64, 191, 64, 0.15)'
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function rgba(hexColor: string, alpha: number): string;
|
|
18
|
+
/**
|
|
19
|
+
* Converts hex color to rgba
|
|
20
|
+
* Alias for rgba() with more explicit naming
|
|
21
|
+
*
|
|
22
|
+
* @param hexColor - Hex color string
|
|
23
|
+
* @param alpha - Opacity value between 0 and 1
|
|
24
|
+
* @returns rgba color string
|
|
25
|
+
*/
|
|
26
|
+
export declare function hexToRgba(hexColor: string, alpha: number): string;
|
|
27
|
+
/**
|
|
28
|
+
* Shadow style type for iOS platform
|
|
29
|
+
*/
|
|
30
|
+
type IOSShadowStyle = {
|
|
31
|
+
shadowColor: string;
|
|
32
|
+
shadowOffset: {
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
};
|
|
36
|
+
shadowOpacity: number;
|
|
37
|
+
shadowRadius: number;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Shadow style type for Android platform
|
|
41
|
+
*/
|
|
42
|
+
type AndroidShadowStyle = {
|
|
43
|
+
elevation: number;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Gets platform-specific shadow styles
|
|
47
|
+
*
|
|
48
|
+
* @param size - Shadow size: 'sm' | 'md' | 'lg' | 'xl'
|
|
49
|
+
* @returns Platform-specific shadow styles
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const styles = StyleSheet.create({
|
|
54
|
+
* card: {
|
|
55
|
+
* ...getShadow('md'),
|
|
56
|
+
* },
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function getShadow(size: 'sm' | 'md' | 'lg' | 'xl'): IOSShadowStyle | AndroidShadowStyle;
|
|
61
|
+
/**
|
|
62
|
+
* Type guard to check if value is a valid spacing key
|
|
63
|
+
*/
|
|
64
|
+
export declare function isSpacingKey(value: any): value is keyof typeof import('./tokens').spacing;
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Universal Clipboard utility for React Native and Expo
|
|
3
|
+
*
|
|
4
|
+
* Supports both:
|
|
5
|
+
* - @react-native-clipboard/clipboard (React Native)
|
|
6
|
+
* - expo-clipboard (Expo)
|
|
7
|
+
*
|
|
8
|
+
* Automatically detects which one is available and uses it.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Universal Clipboard object
|
|
12
|
+
* Compatible with both expo-clipboard and @react-native-clipboard/clipboard
|
|
13
|
+
*/
|
|
14
|
+
declare const Clipboard: {
|
|
15
|
+
/**
|
|
16
|
+
* Set string to clipboard
|
|
17
|
+
* @param text - Text to copy
|
|
18
|
+
*/
|
|
19
|
+
setString: (text: string) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Get string from clipboard
|
|
22
|
+
* @returns Promise with clipboard content
|
|
23
|
+
*/
|
|
24
|
+
getString: () => Promise<string>;
|
|
25
|
+
};
|
|
26
|
+
export default Clipboard;
|
|
27
|
+
export { Clipboard };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const tw: import("twrnc").TailwindFn;
|
|
2
|
+
/**
|
|
3
|
+
* Helper to convert className string to React Native style object
|
|
4
|
+
* @param className - Tailwind class names string
|
|
5
|
+
* @returns React Native style object
|
|
6
|
+
*/
|
|
7
|
+
export declare const cn: (className: string) => import("twrnc").Style;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dash brand colors (from CSS variables)
|
|
3
|
+
*/
|
|
4
|
+
export declare const DASH_COLORS: {
|
|
5
|
+
readonly brand: "var(--color-dash-brand)";
|
|
6
|
+
readonly brandDim: "var(--color-dash-brand-dim)";
|
|
7
|
+
readonly brandDark: "var(--color-dash-brand-dark)";
|
|
8
|
+
readonly brandDarkness: "var(--color-dash-brand-darkness)";
|
|
9
|
+
readonly mint: "var(--color-dash-mint)";
|
|
10
|
+
readonly mintHover: "var(--color-dash-mint-hover)";
|
|
11
|
+
readonly yellowLight: "var(--color-dash-yellow-light)";
|
|
12
|
+
readonly yellow: "var(--color-dash-yellow)";
|
|
13
|
+
readonly primaryDieSubdued: "var(--color-dash-primary-die-subdued)";
|
|
14
|
+
readonly primaryDarkBlue: "var(--color-dash-primary-dark-blue)";
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Status/semantic color mappings
|
|
18
|
+
*/
|
|
19
|
+
export declare const STATUS_COLORS: {
|
|
20
|
+
readonly success: "green";
|
|
21
|
+
readonly error: "red";
|
|
22
|
+
readonly warning: "orange";
|
|
23
|
+
readonly info: "blue";
|
|
24
|
+
readonly neutral: "gray";
|
|
25
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard size mappings to Tailwind classes
|
|
3
|
+
*/
|
|
4
|
+
export declare const TAILWIND_SIZES: {
|
|
5
|
+
readonly xxs: "text-[10px]";
|
|
6
|
+
readonly xs: "text-xs";
|
|
7
|
+
readonly sm: "text-sm";
|
|
8
|
+
readonly md: "text-base";
|
|
9
|
+
readonly lg: "text-lg";
|
|
10
|
+
readonly xl: "text-xl";
|
|
11
|
+
readonly '2xl': "text-2xl";
|
|
12
|
+
readonly '3xl': "text-3xl";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Font weight mappings to Tailwind classes
|
|
16
|
+
*/
|
|
17
|
+
export declare const TAILWIND_WEIGHTS: {
|
|
18
|
+
readonly normal: "font-normal";
|
|
19
|
+
readonly medium: "font-medium";
|
|
20
|
+
readonly semibold: "font-semibold";
|
|
21
|
+
readonly bold: "font-bold";
|
|
22
|
+
readonly extrabold: "font-extrabold";
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Spacing constants (in pixels)
|
|
26
|
+
*/
|
|
27
|
+
export declare const SPACING: {
|
|
28
|
+
readonly xxs: 4;
|
|
29
|
+
readonly xs: 8;
|
|
30
|
+
readonly sm: 12;
|
|
31
|
+
readonly md: 16;
|
|
32
|
+
readonly lg: 24;
|
|
33
|
+
readonly xl: 32;
|
|
34
|
+
readonly '2xl': 48;
|
|
35
|
+
readonly '3xl': 64;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Border radius constants
|
|
39
|
+
*/
|
|
40
|
+
export declare const BORDER_RADIUS: {
|
|
41
|
+
readonly none: "0";
|
|
42
|
+
readonly xs: "0.25rem";
|
|
43
|
+
readonly sm: "0.375rem";
|
|
44
|
+
readonly md: "0.5rem";
|
|
45
|
+
readonly lg: "0.75rem";
|
|
46
|
+
readonly xl: "1rem";
|
|
47
|
+
readonly '2xl': "1.5rem";
|
|
48
|
+
readonly full: "9999px";
|
|
49
|
+
};
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Standard size mappings to Tailwind classes
|
|
5
|
+
*/
|
|
6
|
+
const TAILWIND_SIZES = {
|
|
7
|
+
xxs: 'text-[10px]',
|
|
8
|
+
xs: 'text-xs',
|
|
9
|
+
sm: 'text-sm',
|
|
10
|
+
md: 'text-base',
|
|
11
|
+
lg: 'text-lg',
|
|
12
|
+
xl: 'text-xl',
|
|
13
|
+
'2xl': 'text-2xl',
|
|
14
|
+
'3xl': 'text-3xl'
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Font weight mappings to Tailwind classes
|
|
18
|
+
*/
|
|
19
|
+
const TAILWIND_WEIGHTS = {
|
|
20
|
+
normal: 'font-normal',
|
|
21
|
+
medium: 'font-medium',
|
|
22
|
+
semibold: 'font-semibold',
|
|
23
|
+
bold: 'font-bold',
|
|
24
|
+
extrabold: 'font-extrabold'
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Spacing constants (in pixels)
|
|
28
|
+
*/
|
|
29
|
+
const SPACING = {
|
|
30
|
+
xxs: 4,
|
|
31
|
+
xs: 8,
|
|
32
|
+
sm: 12,
|
|
33
|
+
md: 16,
|
|
34
|
+
lg: 24,
|
|
35
|
+
xl: 32,
|
|
36
|
+
'2xl': 48,
|
|
37
|
+
'3xl': 64
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Border radius constants
|
|
41
|
+
*/
|
|
42
|
+
const BORDER_RADIUS = {
|
|
43
|
+
none: '0',
|
|
44
|
+
xs: '0.25rem',
|
|
45
|
+
// 4px
|
|
46
|
+
sm: '0.375rem',
|
|
47
|
+
// 6px
|
|
48
|
+
md: '0.5rem',
|
|
49
|
+
// 8px
|
|
50
|
+
lg: '0.75rem',
|
|
51
|
+
// 12px
|
|
52
|
+
xl: '1rem',
|
|
53
|
+
// 16px
|
|
54
|
+
'2xl': '1.5rem',
|
|
55
|
+
// 24px
|
|
56
|
+
full: '9999px'
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Dash brand colors (from CSS variables)
|
|
61
|
+
*/
|
|
62
|
+
const DASH_COLORS = {
|
|
63
|
+
brand: 'var(--color-dash-brand)',
|
|
64
|
+
brandDim: 'var(--color-dash-brand-dim)',
|
|
65
|
+
brandDark: 'var(--color-dash-brand-dark)',
|
|
66
|
+
brandDarkness: 'var(--color-dash-brand-darkness)',
|
|
67
|
+
mint: 'var(--color-dash-mint)',
|
|
68
|
+
mintHover: 'var(--color-dash-mint-hover)',
|
|
69
|
+
yellowLight: 'var(--color-dash-yellow-light)',
|
|
70
|
+
yellow: 'var(--color-dash-yellow)',
|
|
71
|
+
primaryDieSubdued: 'var(--color-dash-primary-die-subdued)',
|
|
72
|
+
primaryDarkBlue: 'var(--color-dash-primary-dark-blue)'
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Status/semantic color mappings
|
|
76
|
+
*/
|
|
77
|
+
const STATUS_COLORS = {
|
|
78
|
+
success: 'green',
|
|
79
|
+
error: 'red',
|
|
80
|
+
warning: 'orange',
|
|
81
|
+
info: 'blue',
|
|
82
|
+
neutral: 'gray'
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Returns the number of whole days between two dates.
|
|
87
|
+
* Rounds up any partial day.
|
|
88
|
+
*
|
|
89
|
+
* @param startDate - The start date (Date | ISO string | timestamp)
|
|
90
|
+
* @param endDate - The end date (Date | ISO string | timestamp)
|
|
91
|
+
* @returns Number of days difference, or 0 if either date is missing/invalid
|
|
92
|
+
*/
|
|
93
|
+
function getDaysBetweenDates(startDate, endDate) {
|
|
94
|
+
if (startDate == null || endDate == null) return 0;
|
|
95
|
+
const start = new Date(startDate);
|
|
96
|
+
const end = new Date(endDate);
|
|
97
|
+
if (isNaN(start.getTime()) || isNaN(end.getTime())) return 0;
|
|
98
|
+
const diffMs = Math.abs(end.getTime() - start.getTime());
|
|
99
|
+
const days = Math.ceil(diffMs / (1000 * 60 * 60 * 24));
|
|
100
|
+
return days;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Creates a dynamic ISO-range from now back by `duration` milliseconds.
|
|
104
|
+
*
|
|
105
|
+
* @param duration - Time span in milliseconds
|
|
106
|
+
* @returns Object with `start` and `end` ISO date strings
|
|
107
|
+
*/
|
|
108
|
+
function getDynamicRange(duration) {
|
|
109
|
+
const now = new Date();
|
|
110
|
+
const end = now.toISOString();
|
|
111
|
+
const start = new Date(now.getTime() - duration).toISOString();
|
|
112
|
+
return {
|
|
113
|
+
start,
|
|
114
|
+
end
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Returns a human-readable difference between two dates.
|
|
119
|
+
*
|
|
120
|
+
* - `default`: largest unit with suffix (`"2d ago"`, `"5h left"`, etc.)
|
|
121
|
+
* - `detailed`: full breakdown as `"Xd:Yh:Zm"`
|
|
122
|
+
*
|
|
123
|
+
* If inputs are invalid, returns `"n/a"` or `"Invalid format"`.
|
|
124
|
+
*
|
|
125
|
+
* @param startDate - The start date (Date | ISO string | timestamp)
|
|
126
|
+
* @param endDate - The end date (Date | ISO string | timestamp)
|
|
127
|
+
* @param format - `'default'` or `'detailed'`
|
|
128
|
+
* @returns A string describing the time delta
|
|
129
|
+
*/
|
|
130
|
+
function getTimeDelta(startDate, endDate, format = 'default') {
|
|
131
|
+
const start = new Date(startDate);
|
|
132
|
+
const end = new Date(endDate);
|
|
133
|
+
if (isNaN(start.getTime()) || isNaN(end.getTime())) {
|
|
134
|
+
return 'n/a';
|
|
135
|
+
}
|
|
136
|
+
const diffMs = end.getTime() - start.getTime();
|
|
137
|
+
const isFuture = diffMs > 0;
|
|
138
|
+
const absMs = Math.abs(diffMs);
|
|
139
|
+
const days = Math.floor(absMs / (1000 * 60 * 60 * 24));
|
|
140
|
+
const hours = Math.floor(absMs % (1000 * 60 * 60 * 24) / (1000 * 60 * 60));
|
|
141
|
+
const minutes = Math.floor(absMs % (1000 * 60 * 60) / (1000 * 60));
|
|
142
|
+
const seconds = Math.floor(absMs % (1000 * 60) / 1000);
|
|
143
|
+
if (format === 'default') {
|
|
144
|
+
const suffix = isFuture ? 'left' : 'ago';
|
|
145
|
+
if (days > 0) {
|
|
146
|
+
return `${days}d ${suffix}`;
|
|
147
|
+
}
|
|
148
|
+
if (hours > 0) {
|
|
149
|
+
return `${hours}h ${suffix}`;
|
|
150
|
+
}
|
|
151
|
+
if (minutes > 0) {
|
|
152
|
+
return `${minutes} min. ${suffix}`;
|
|
153
|
+
}
|
|
154
|
+
return `${seconds} sec. ${suffix}`;
|
|
155
|
+
}
|
|
156
|
+
if (format === 'detailed') {
|
|
157
|
+
return `${days}d:${hours}h:${minutes}m`;
|
|
158
|
+
}
|
|
159
|
+
return 'Invalid format';
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
exports.BORDER_RADIUS = BORDER_RADIUS;
|
|
163
|
+
exports.DASH_COLORS = DASH_COLORS;
|
|
164
|
+
exports.SPACING = SPACING;
|
|
165
|
+
exports.STATUS_COLORS = STATUS_COLORS;
|
|
166
|
+
exports.TAILWIND_SIZES = TAILWIND_SIZES;
|
|
167
|
+
exports.TAILWIND_WEIGHTS = TAILWIND_WEIGHTS;
|
|
168
|
+
exports.getDaysBetweenDates = getDaysBetweenDates;
|
|
169
|
+
exports.getDynamicRange = getDynamicRange;
|
|
170
|
+
exports.getTimeDelta = getTimeDelta;
|
|
171
|
+
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../src/shared/constants/sizes.ts","../../src/shared/constants/colors.ts","../../src/shared/utils/datetime.ts"],"sourcesContent":["/**\n * Standard size mappings to Tailwind classes\n */\nexport const TAILWIND_SIZES = {\n xxs: 'text-[10px]',\n xs: 'text-xs',\n sm: 'text-sm',\n md: 'text-base',\n lg: 'text-lg',\n xl: 'text-xl',\n '2xl': 'text-2xl',\n '3xl': 'text-3xl'\n} as const\n\n/**\n * Font weight mappings to Tailwind classes\n */\nexport const TAILWIND_WEIGHTS = {\n normal: 'font-normal',\n medium: 'font-medium',\n semibold: 'font-semibold',\n bold: 'font-bold',\n extrabold: 'font-extrabold'\n} as const\n\n/**\n * Spacing constants (in pixels)\n */\nexport const SPACING = {\n xxs: 4,\n xs: 8,\n sm: 12,\n md: 16,\n lg: 24,\n xl: 32,\n '2xl': 48,\n '3xl': 64\n} as const\n\n/**\n * Border radius constants\n */\nexport const BORDER_RADIUS = {\n none: '0',\n xs: '0.25rem', // 4px\n sm: '0.375rem', // 6px\n md: '0.5rem', // 8px\n lg: '0.75rem', // 12px\n xl: '1rem', // 16px\n '2xl': '1.5rem', // 24px\n full: '9999px'\n} as const\n","/**\n * Dash brand colors (from CSS variables)\n */\nexport const DASH_COLORS = {\n brand: 'var(--color-dash-brand)',\n brandDim: 'var(--color-dash-brand-dim)',\n brandDark: 'var(--color-dash-brand-dark)',\n brandDarkness: 'var(--color-dash-brand-darkness)',\n mint: 'var(--color-dash-mint)',\n mintHover: 'var(--color-dash-mint-hover)',\n yellowLight: 'var(--color-dash-yellow-light)',\n yellow: 'var(--color-dash-yellow)',\n primaryDieSubdued: 'var(--color-dash-primary-die-subdued)',\n primaryDarkBlue: 'var(--color-dash-primary-dark-blue)'\n} as const\n\n/**\n * Status/semantic color mappings\n */\nexport const STATUS_COLORS = {\n success: 'green',\n error: 'red',\n warning: 'orange',\n info: 'blue',\n neutral: 'gray'\n} as const\n","/**\n * Acceptable inputs for date parameters.\n */\nexport type DateInput = Date | string | number\n\n/**\n * Returns the number of whole days between two dates.\n * Rounds up any partial day.\n *\n * @param startDate - The start date (Date | ISO string | timestamp)\n * @param endDate - The end date (Date | ISO string | timestamp)\n * @returns Number of days difference, or 0 if either date is missing/invalid\n */\nexport function getDaysBetweenDates (\n startDate?: DateInput,\n endDate?: DateInput\n): number {\n if (startDate == null || endDate == null) return 0\n\n const start = new Date(startDate)\n const end = new Date(endDate)\n if (isNaN(start.getTime()) || isNaN(end.getTime())) return 0\n\n const diffMs = Math.abs(end.getTime() - start.getTime())\n const days = Math.ceil(diffMs / (1000 * 60 * 60 * 24))\n return days\n}\n\n/**\n * Creates a dynamic ISO-range from now back by `duration` milliseconds.\n *\n * @param duration - Time span in milliseconds\n * @returns Object with `start` and `end` ISO date strings\n */\nexport function getDynamicRange (duration: number): {\n start: string\n end: string\n} {\n const now = new Date()\n const end = now.toISOString()\n const start = new Date(now.getTime() - duration).toISOString()\n return { start, end }\n}\n\n/**\n * Allowed formats for time delta output.\n */\nexport type TimeDeltaFormat = 'default' | 'detailed'\n\n/**\n * Returns a human-readable difference between two dates.\n *\n * - `default`: largest unit with suffix (`\"2d ago\"`, `\"5h left\"`, etc.)\n * - `detailed`: full breakdown as `\"Xd:Yh:Zm\"`\n *\n * If inputs are invalid, returns `\"n/a\"` or `\"Invalid format\"`.\n *\n * @param startDate - The start date (Date | ISO string | timestamp)\n * @param endDate - The end date (Date | ISO string | timestamp)\n * @param format - `'default'` or `'detailed'`\n * @returns A string describing the time delta\n */\nexport function getTimeDelta (\n startDate: DateInput,\n endDate: DateInput,\n format: TimeDeltaFormat = 'default'\n): string {\n const start = new Date(startDate)\n const end = new Date(endDate)\n if (isNaN(start.getTime()) || isNaN(end.getTime())) {\n return 'n/a'\n }\n\n const diffMs = end.getTime() - start.getTime()\n const isFuture = diffMs > 0\n const absMs = Math.abs(diffMs)\n\n const days = Math.floor(absMs / (1000 * 60 * 60 * 24))\n const hours = Math.floor((absMs % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))\n const minutes = Math.floor((absMs % (1000 * 60 * 60)) / (1000 * 60))\n const seconds = Math.floor((absMs % (1000 * 60)) / 1000)\n\n if (format === 'default') {\n const suffix = isFuture ? 'left' : 'ago'\n if (days > 0) {\n return `${days}d ${suffix}`\n }\n if (hours > 0) {\n return `${hours}h ${suffix}`\n }\n if (minutes > 0) {\n return `${minutes} min. ${suffix}`\n }\n return `${seconds} sec. ${suffix}`\n }\n\n if (format === 'detailed') {\n return `${days}d:${hours}h:${minutes}m`\n }\n\n return 'Invalid format'\n}\n"],"names":["TAILWIND_SIZES","xxs","xs","sm","md","lg","xl","TAILWIND_WEIGHTS","normal","medium","semibold","bold","extrabold","SPACING","BORDER_RADIUS","none","full","DASH_COLORS","brand","brandDim","brandDark","brandDarkness","mint","mintHover","yellowLight","yellow","primaryDieSubdued","primaryDarkBlue","STATUS_COLORS","success","error","warning","info","neutral","getDaysBetweenDates","startDate","endDate","start","Date","end","isNaN","getTime","diffMs","Math","abs","days","ceil","getDynamicRange","duration","now","toISOString","getTimeDelta","format","isFuture","absMs","floor","hours","minutes","seconds","suffix"],"mappings":";;AAAA;;AAEG;AACI,MAAMA,cAAc,GAAG;AAC5BC,EAAAA,GAAG,EAAE,aAAa;AAClBC,EAAAA,EAAE,EAAE,SAAS;AACbC,EAAAA,EAAE,EAAE,SAAS;AACbC,EAAAA,EAAE,EAAE,WAAW;AACfC,EAAAA,EAAE,EAAE,SAAS;AACbC,EAAAA,EAAE,EAAE,SAAS;AACb,EAAA,KAAK,EAAE,UAAU;AACjB,EAAA,KAAK,EAAE;;AAGT;;AAEG;AACI,MAAMC,gBAAgB,GAAG;AAC9BC,EAAAA,MAAM,EAAE,aAAa;AACrBC,EAAAA,MAAM,EAAE,aAAa;AACrBC,EAAAA,QAAQ,EAAE,eAAe;AACzBC,EAAAA,IAAI,EAAE,WAAW;AACjBC,EAAAA,SAAS,EAAE;;AAGb;;AAEG;AACI,MAAMC,OAAO,GAAG;AACrBZ,EAAAA,GAAG,EAAE,CAAC;AACNC,EAAAA,EAAE,EAAE,CAAC;AACLC,EAAAA,EAAE,EAAE,EAAE;AACNC,EAAAA,EAAE,EAAE,EAAE;AACNC,EAAAA,EAAE,EAAE,EAAE;AACNC,EAAAA,EAAE,EAAE,EAAE;AACN,EAAA,KAAK,EAAE,EAAE;AACT,EAAA,KAAK,EAAE;;AAGT;;AAEG;AACI,MAAMQ,aAAa,GAAG;AAC3BC,EAAAA,IAAI,EAAE,GAAG;AACTb,EAAAA,EAAE,EAAE,SAAS;AAAI;AACjBC,EAAAA,EAAE,EAAE,UAAU;AAAG;AACjBC,EAAAA,EAAE,EAAE,QAAQ;AAAK;AACjBC,EAAAA,EAAE,EAAE,SAAS;AAAI;AACjBC,EAAAA,EAAE,EAAE,MAAM;AAAO;AACjB,EA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