dash-ui-kit 1.0.94 → 2.1.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 +97 -0
- package/dist/react/components/badge/index.cjs.js.map +1 -0
- package/dist/react/components/badge/index.d.ts +10 -1
- package/dist/react/components/badge/index.esm.js +92 -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 +540 -0
- package/dist/react/components/button/index.cjs.js.map +1 -0
- package/dist/react/components/button/index.d.ts +7 -1
- package/dist/react/components/button/index.esm.js +535 -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 +65 -0
- package/dist/react/components/heading/index.cjs.js.map +1 -0
- package/dist/react/components/heading/index.d.ts +4 -1
- package/dist/react/components/heading/index.esm.js +63 -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 +242 -0
- package/dist/react/components/input/index.cjs.js.map +1 -0
- package/dist/react/components/input/index.d.ts +4 -0
- package/dist/react/components/input/index.esm.js +237 -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 +469 -0
- package/dist/react/components/overlayMenu/index.cjs.js.map +1 -0
- package/dist/react/components/overlayMenu/index.d.ts +9 -10
- package/dist/react/components/overlayMenu/index.esm.js +464 -0
- package/dist/react/components/overlayMenu/index.esm.js.map +1 -0
- package/dist/react/components/overlaySelect/index.cjs.js +350 -0
- package/dist/react/components/overlaySelect/index.cjs.js.map +1 -0
- package/dist/react/components/overlaySelect/index.d.ts +4 -0
- package/dist/react/components/overlaySelect/index.esm.js +345 -0
- package/dist/react/components/overlaySelect/index.esm.js.map +1 -0
- package/dist/react/components/progressStepBar/index.cjs.js +54 -0
- package/dist/react/components/progressStepBar/index.cjs.js.map +1 -0
- package/dist/react/components/progressStepBar/index.d.ts +5 -2
- package/dist/react/components/progressStepBar/index.esm.js +52 -0
- package/dist/react/components/progressStepBar/index.esm.js.map +1 -0
- package/dist/react/components/select/index.cjs.js +241 -0
- package/dist/react/components/select/index.cjs.js.map +1 -0
- package/dist/react/components/select/index.d.ts +4 -0
- package/dist/react/components/select/index.esm.js +217 -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 +126 -0
- package/dist/react/components/text/index.cjs.js.map +1 -0
- package/dist/react/components/text/index.d.ts +5 -0
- package/dist/react/components/text/index.esm.js +121 -0
- package/dist/react/components/text/index.esm.js.map +1 -0
- package/dist/react/components/textarea/index.cjs.js +260 -0
- package/dist/react/components/textarea/index.cjs.js.map +1 -0
- package/dist/react/components/textarea/index.d.ts +4 -0
- package/dist/react/components/textarea/index.esm.js +255 -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 +181 -0
- package/dist/react/components/valueCard/index.cjs.js.map +1 -0
- package/dist/react/components/valueCard/index.d.ts +5 -1
- package/dist/react/components/valueCard/index.esm.js +176 -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/index.d.ts +1 -0
- package/dist/react/hooks/useColorScheme.cjs.js +25 -0
- package/dist/react/hooks/useColorScheme.cjs.js.map +1 -0
- package/dist/react/hooks/useColorScheme.d.ts +9 -0
- package/dist/react/hooks/useColorScheme.esm.js +23 -0
- package/dist/react/hooks/useColorScheme.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 -12833
- package/dist/react/index.cjs.js.map +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.esm.js +27 -12747
- 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 +63 -0
- package/dist/react-native/components/bigNumber/index.d.ts +26 -0
- package/dist/react-native/components/button/index.d.ts +45 -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 +59 -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 +47 -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 +2882 -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 +2833 -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 +3 -0
- package/dist/react-native/utils/resolveColorScheme.d.ts +1 -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,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns the number of whole days between two dates.
|
|
7
|
+
* Rounds up any partial day.
|
|
8
|
+
*
|
|
9
|
+
* @param startDate - The start date (Date | ISO string | timestamp)
|
|
10
|
+
* @param endDate - The end date (Date | ISO string | timestamp)
|
|
11
|
+
* @returns Number of days difference, or 0 if either date is missing/invalid
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Returns a human-readable difference between two dates.
|
|
15
|
+
*
|
|
16
|
+
* - `default`: largest unit with suffix (`"2d ago"`, `"5h left"`, etc.)
|
|
17
|
+
* - `detailed`: full breakdown as `"Xd:Yh:Zm"`
|
|
18
|
+
*
|
|
19
|
+
* If inputs are invalid, returns `"n/a"` or `"Invalid format"`.
|
|
20
|
+
*
|
|
21
|
+
* @param startDate - The start date (Date | ISO string | timestamp)
|
|
22
|
+
* @param endDate - The end date (Date | ISO string | timestamp)
|
|
23
|
+
* @param format - `'default'` or `'detailed'`
|
|
24
|
+
* @returns A string describing the time delta
|
|
25
|
+
*/
|
|
26
|
+
function getTimeDelta(startDate, endDate, format = 'default') {
|
|
27
|
+
const start = new Date(startDate);
|
|
28
|
+
const end = new Date(endDate);
|
|
29
|
+
if (isNaN(start.getTime()) || isNaN(end.getTime())) {
|
|
30
|
+
return 'n/a';
|
|
31
|
+
}
|
|
32
|
+
const diffMs = end.getTime() - start.getTime();
|
|
33
|
+
const isFuture = diffMs > 0;
|
|
34
|
+
const absMs = Math.abs(diffMs);
|
|
35
|
+
const days = Math.floor(absMs / (1000 * 60 * 60 * 24));
|
|
36
|
+
const hours = Math.floor(absMs % (1000 * 60 * 60 * 24) / (1000 * 60 * 60));
|
|
37
|
+
const minutes = Math.floor(absMs % (1000 * 60 * 60) / (1000 * 60));
|
|
38
|
+
const seconds = Math.floor(absMs % (1000 * 60) / 1000);
|
|
39
|
+
if (format === 'default') {
|
|
40
|
+
const suffix = isFuture ? 'left' : 'ago';
|
|
41
|
+
if (days > 0) {
|
|
42
|
+
return `${days}d ${suffix}`;
|
|
43
|
+
}
|
|
44
|
+
if (hours > 0) {
|
|
45
|
+
return `${hours}h ${suffix}`;
|
|
46
|
+
}
|
|
47
|
+
if (minutes > 0) {
|
|
48
|
+
return `${minutes} min. ${suffix}`;
|
|
49
|
+
}
|
|
50
|
+
return `${seconds} sec. ${suffix}`;
|
|
51
|
+
}
|
|
52
|
+
if (format === 'detailed') {
|
|
53
|
+
return `${days}d:${hours}h:${minutes}m`;
|
|
54
|
+
}
|
|
55
|
+
return 'Invalid format';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
exports.getTimeDelta = getTimeDelta;
|
|
59
|
+
//# sourceMappingURL=datetime.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datetime.cjs.js","sources":["../../../../src/shared/utils/datetime.ts"],"sourcesContent":["/**\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":["getTimeDelta","startDate","endDate","format","start","Date","end","isNaN","getTime","diffMs","isFuture","absMs","Math","abs","days","floor","hours","minutes","seconds","suffix"],"mappings":";;;;AAKA;;;;;;;AAOG;AAqCH;;;;;;;;;;;;AAYG;AACG,SAAUA,YAAYA,CAC1BC,SAAoB,EACpBC,OAAkB,EAClBC,SAA0B,SAAS,EAAA;AAEnC,EAAA,MAAMC,KAAK,GAAG,IAAIC,IAAI,CAACJ,SAAS,CAAC;AACjC,EAAA,MAAMK,GAAG,GAAG,IAAID,IAAI,CAACH,OAAO,CAAC;AAC7B,EAAA,IAAIK,KAAK,CAACH,KAAK,CAACI,OAAO,EAAE,CAAC,IAAID,KAAK,CAACD,GAAG,CAACE,OAAO,EAAE,CAAC,EAAE;AAClD,IAAA,OAAO,KAAK;AACd;AAEA,EAAA,MAAMC,MAAM,GAAGH,GAAG,CAACE,OAAO,EAAE,GAAGJ,KAAK,CAACI,OAAO,EAAE;AAC9C,EAAA,MAAME,QAAQ,GAAGD,MAAM,GAAG,CAAC;AAC3B,EAAA,MAAME,KAAK,GAAGC,IAAI,CAACC,GAAG,CAACJ,MAAM,CAAC;AAE9B,EAAA,MAAMK,IAAI,GAAGF,IAAI,CAACG,KAAK,CAACJ,KAAK,IAAI,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;EACtD,MAAMK,KAAK,GAAGJ,IAAI,CAACG,KAAK,CAAEJ,KAAK,IAAI,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,IAAK,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AAC5E,EAAA,MAAMM,OAAO,GAAGL,IAAI,CAACG,KAAK,CAAEJ,KAAK,IAAI,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,IAAK,IAAI,GAAG,EAAE,CAAC,CAAC;AACpE,EAAA,MAAMO,OAAO,GAAGN,IAAI,CAACG,KAAK,CAAEJ,KAAK,IAAI,IAAI,GAAG,EAAE,CAAC,GAAI,IAAI,CAAC;EAExD,IAAIR,MAAM,KAAK,SAAS,EAAE;AACxB,IAAA,MAAMgB,MAAM,GAAGT,QAAQ,GAAG,MAAM,GAAG,KAAK;IACxC,IAAII,IAAI,GAAG,CAAC,EAAE;AACZ,MAAA,OAAO,CAAGA,EAAAA,IAAI,CAAKK,EAAAA,EAAAA,MAAM,CAAE,CAAA;AAC7B;IACA,IAAIH,KAAK,GAAG,CAAC,EAAE;AACb,MAAA,OAAO,CAAGA,EAAAA,KAAK,CAAKG,EAAAA,EAAAA,MAAM,CAAE,CAAA;AAC9B;IACA,IAAIF,OAAO,GAAG,CAAC,EAAE;AACf,MAAA,OAAO,CAAGA,EAAAA,OAAO,CAASE,MAAAA,EAAAA,MAAM,CAAE,CAAA;AACpC;AACA,IAAA,OAAO,CAAGD,EAAAA,OAAO,CAASC,MAAAA,EAAAA,MAAM,CAAE,CAAA;AACpC;EAEA,IAAIhB,MAAM,KAAK,UAAU,EAAE;AACzB,IAAA,OAAO,GAAGW,IAAI,CAAA,EAAA,EAAKE,KAAK,CAAA,EAAA,EAAKC,OAAO,CAAG,CAAA,CAAA;AACzC;AAEA,EAAA,OAAO,gBAAgB;AACzB;;;;"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns the number of whole days between two dates.
|
|
5
|
+
* Rounds up any partial day.
|
|
6
|
+
*
|
|
7
|
+
* @param startDate - The start date (Date | ISO string | timestamp)
|
|
8
|
+
* @param endDate - The end date (Date | ISO string | timestamp)
|
|
9
|
+
* @returns Number of days difference, or 0 if either date is missing/invalid
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Returns a human-readable difference between two dates.
|
|
13
|
+
*
|
|
14
|
+
* - `default`: largest unit with suffix (`"2d ago"`, `"5h left"`, etc.)
|
|
15
|
+
* - `detailed`: full breakdown as `"Xd:Yh:Zm"`
|
|
16
|
+
*
|
|
17
|
+
* If inputs are invalid, returns `"n/a"` or `"Invalid format"`.
|
|
18
|
+
*
|
|
19
|
+
* @param startDate - The start date (Date | ISO string | timestamp)
|
|
20
|
+
* @param endDate - The end date (Date | ISO string | timestamp)
|
|
21
|
+
* @param format - `'default'` or `'detailed'`
|
|
22
|
+
* @returns A string describing the time delta
|
|
23
|
+
*/
|
|
24
|
+
function getTimeDelta(startDate, endDate, format = 'default') {
|
|
25
|
+
const start = new Date(startDate);
|
|
26
|
+
const end = new Date(endDate);
|
|
27
|
+
if (isNaN(start.getTime()) || isNaN(end.getTime())) {
|
|
28
|
+
return 'n/a';
|
|
29
|
+
}
|
|
30
|
+
const diffMs = end.getTime() - start.getTime();
|
|
31
|
+
const isFuture = diffMs > 0;
|
|
32
|
+
const absMs = Math.abs(diffMs);
|
|
33
|
+
const days = Math.floor(absMs / (1000 * 60 * 60 * 24));
|
|
34
|
+
const hours = Math.floor(absMs % (1000 * 60 * 60 * 24) / (1000 * 60 * 60));
|
|
35
|
+
const minutes = Math.floor(absMs % (1000 * 60 * 60) / (1000 * 60));
|
|
36
|
+
const seconds = Math.floor(absMs % (1000 * 60) / 1000);
|
|
37
|
+
if (format === 'default') {
|
|
38
|
+
const suffix = isFuture ? 'left' : 'ago';
|
|
39
|
+
if (days > 0) {
|
|
40
|
+
return `${days}d ${suffix}`;
|
|
41
|
+
}
|
|
42
|
+
if (hours > 0) {
|
|
43
|
+
return `${hours}h ${suffix}`;
|
|
44
|
+
}
|
|
45
|
+
if (minutes > 0) {
|
|
46
|
+
return `${minutes} min. ${suffix}`;
|
|
47
|
+
}
|
|
48
|
+
return `${seconds} sec. ${suffix}`;
|
|
49
|
+
}
|
|
50
|
+
if (format === 'detailed') {
|
|
51
|
+
return `${days}d:${hours}h:${minutes}m`;
|
|
52
|
+
}
|
|
53
|
+
return 'Invalid format';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export { getTimeDelta };
|
|
57
|
+
//# sourceMappingURL=datetime.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datetime.esm.js","sources":["../../../../src/shared/utils/datetime.ts"],"sourcesContent":["/**\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":["getTimeDelta","startDate","endDate","format","start","Date","end","isNaN","getTime","diffMs","isFuture","absMs","Math","abs","days","floor","hours","minutes","seconds","suffix"],"mappings":";;AAKA;;;;;;;AAOG;AAqCH;;;;;;;;;;;;AAYG;AACG,SAAUA,YAAYA,CAC1BC,SAAoB,EACpBC,OAAkB,EAClBC,SAA0B,SAAS,EAAA;AAEnC,EAAA,MAAMC,KAAK,GAAG,IAAIC,IAAI,CAACJ,SAAS,CAAC;AACjC,EAAA,MAAMK,GAAG,GAAG,IAAID,IAAI,CAACH,OAAO,CAAC;AAC7B,EAAA,IAAIK,KAAK,CAACH,KAAK,CAACI,OAAO,EAAE,CAAC,IAAID,KAAK,CAACD,GAAG,CAACE,OAAO,EAAE,CAAC,EAAE;AAClD,IAAA,OAAO,KAAK;AACd;AAEA,EAAA,MAAMC,MAAM,GAAGH,GAAG,CAACE,OAAO,EAAE,GAAGJ,KAAK,CAACI,OAAO,EAAE;AAC9C,EAAA,MAAME,QAAQ,GAAGD,MAAM,GAAG,CAAC;AAC3B,EAAA,MAAME,KAAK,GAAGC,IAAI,CAACC,GAAG,CAACJ,MAAM,CAAC;AAE9B,EAAA,MAAMK,IAAI,GAAGF,IAAI,CAACG,KAAK,CAACJ,KAAK,IAAI,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;EACtD,MAAMK,KAAK,GAAGJ,IAAI,CAACG,KAAK,CAAEJ,KAAK,IAAI,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,IAAK,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;AAC5E,EAAA,MAAMM,OAAO,GAAGL,IAAI,CAACG,KAAK,CAAEJ,KAAK,IAAI,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,IAAK,IAAI,GAAG,EAAE,CAAC,CAAC;AACpE,EAAA,MAAMO,OAAO,GAAGN,IAAI,CAACG,KAAK,CAAEJ,KAAK,IAAI,IAAI,GAAG,EAAE,CAAC,GAAI,IAAI,CAAC;EAExD,IAAIR,MAAM,KAAK,SAAS,EAAE;AACxB,IAAA,MAAMgB,MAAM,GAAGT,QAAQ,GAAG,MAAM,GAAG,KAAK;IACxC,IAAII,IAAI,GAAG,CAAC,EAAE;AACZ,MAAA,OAAO,CAAGA,EAAAA,IAAI,CAAKK,EAAAA,EAAAA,MAAM,CAAE,CAAA;AAC7B;IACA,IAAIH,KAAK,GAAG,CAAC,EAAE;AACb,MAAA,OAAO,CAAGA,EAAAA,KAAK,CAAKG,EAAAA,EAAAA,MAAM,CAAE,CAAA;AAC9B;IACA,IAAIF,OAAO,GAAG,CAAC,EAAE;AACf,MAAA,OAAO,CAAGA,EAAAA,OAAO,CAASE,MAAAA,EAAAA,MAAM,CAAE,CAAA;AACpC;AACA,IAAA,OAAO,CAAGD,EAAAA,OAAO,CAASC,MAAAA,EAAAA,MAAM,CAAE,CAAA;AACpC;EAEA,IAAIhB,MAAM,KAAK,UAAU,EAAE;AACzB,IAAA,OAAO,GAAGW,IAAI,CAAA,EAAA,EAAKE,KAAK,CAAA,EAAA,EAAKC,OAAO,CAAG,CAAA,CAAA;AACzC;AAEA,EAAA,OAAO,gBAAgB;AACzB;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Copy a string to the clipboard and invoke a callback with the result.
|
|
9
|
+
*
|
|
10
|
+
* @param copyText The text to copy. Defaults to empty string.
|
|
11
|
+
* @param callback Optional callback that will be called with { status: true } on success,
|
|
12
|
+
* or { status: false, message: error } on failure.
|
|
13
|
+
*/
|
|
14
|
+
function copyToClipboard(copyText = '', callback) {
|
|
15
|
+
navigator.clipboard.writeText(copyText).then(() => {
|
|
16
|
+
const result = {
|
|
17
|
+
status: true
|
|
18
|
+
};
|
|
19
|
+
callback === null || callback === void 0 ? void 0 : callback(result);
|
|
20
|
+
}).catch(err => {
|
|
21
|
+
const result = {
|
|
22
|
+
status: false,
|
|
23
|
+
message: err
|
|
24
|
+
};
|
|
25
|
+
callback === null || callback === void 0 ? void 0 : callback(result);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
exports.copyToClipboard = copyToClipboard;
|
|
30
|
+
exports.default = copyToClipboard;
|
|
31
|
+
//# sourceMappingURL=copyToClipboard.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copyToClipboard.cjs.js","sources":["../../../src/react/utils/copyToClipboard.ts"],"sourcesContent":["export interface CopyResult {\n status: boolean\n message?: unknown\n}\n\nexport type CopyCallback = (result: CopyResult) => void\n\n/**\n * Copy a string to the clipboard and invoke a callback with the result.\n *\n * @param copyText The text to copy. Defaults to empty string.\n * @param callback Optional callback that will be called with { status: true } on success,\n * or { status: false, message: error } on failure.\n */\nexport function copyToClipboard (\n copyText: string = '',\n callback?: CopyCallback\n): void {\n navigator.clipboard\n .writeText(copyText)\n .then(() => {\n const result: CopyResult = { status: true }\n callback?.(result)\n })\n .catch((err) => {\n const result: CopyResult = { status: false, message: err }\n callback?.(result)\n })\n}\n\nexport default copyToClipboard "],"names":["copyToClipboard","copyText","callback","navigator","clipboard","writeText","then","result","status","catch","err","message"],"mappings":";;;;;;AAOA;;;;;;AAMG;SACaA,eAAeA,CAC7BC,QAAmB,GAAA,EAAE,EACrBC,QAAuB,EAAA;EAEvBC,SAAS,CAACC,SAAS,CAChBC,SAAS,CAACJ,QAAQ,CAAC,CACnBK,IAAI,CAAC,MAAK;AACT,IAAA,MAAMC,MAAM,GAAe;AAAEC,MAAAA,MAAM,EAAE;KAAM;AAC3CN,IAAAA,QAAQ,aAARA,QAAQ,KAAA,MAAA,GAAA,MAAA,GAARA,QAAQ,CAAGK,MAAM,CAAC;AACpB,GAAC,CAAC,CACDE,KAAK,CAAEC,GAAG,IAAI;AACb,IAAA,MAAMH,MAAM,GAAe;AAAEC,MAAAA,MAAM,EAAE,KAAK;AAAEG,MAAAA,OAAO,EAAED;KAAK;AAC1DR,IAAAA,QAAQ,aAARA,QAAQ,KAAA,MAAA,GAAA,MAAA,GAARA,QAAQ,CAAGK,MAAM,CAAC;AACpB,GAAC,CAAC;AACN;;;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Copy a string to the clipboard and invoke a callback with the result.
|
|
5
|
+
*
|
|
6
|
+
* @param copyText The text to copy. Defaults to empty string.
|
|
7
|
+
* @param callback Optional callback that will be called with { status: true } on success,
|
|
8
|
+
* or { status: false, message: error } on failure.
|
|
9
|
+
*/
|
|
10
|
+
function copyToClipboard(copyText = '', callback) {
|
|
11
|
+
navigator.clipboard.writeText(copyText).then(() => {
|
|
12
|
+
const result = {
|
|
13
|
+
status: true
|
|
14
|
+
};
|
|
15
|
+
callback === null || callback === void 0 ? void 0 : callback(result);
|
|
16
|
+
}).catch(err => {
|
|
17
|
+
const result = {
|
|
18
|
+
status: false,
|
|
19
|
+
message: err
|
|
20
|
+
};
|
|
21
|
+
callback === null || callback === void 0 ? void 0 : callback(result);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { copyToClipboard, copyToClipboard as default };
|
|
26
|
+
//# sourceMappingURL=copyToClipboard.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copyToClipboard.esm.js","sources":["../../../src/react/utils/copyToClipboard.ts"],"sourcesContent":["export interface CopyResult {\n status: boolean\n message?: unknown\n}\n\nexport type CopyCallback = (result: CopyResult) => void\n\n/**\n * Copy a string to the clipboard and invoke a callback with the result.\n *\n * @param copyText The text to copy. Defaults to empty string.\n * @param callback Optional callback that will be called with { status: true } on success,\n * or { status: false, message: error } on failure.\n */\nexport function copyToClipboard (\n copyText: string = '',\n callback?: CopyCallback\n): void {\n navigator.clipboard\n .writeText(copyText)\n .then(() => {\n const result: CopyResult = { status: true }\n callback?.(result)\n })\n .catch((err) => {\n const result: CopyResult = { status: false, message: err }\n callback?.(result)\n })\n}\n\nexport default copyToClipboard "],"names":["copyToClipboard","copyText","callback","navigator","clipboard","writeText","then","result","status","catch","err","message"],"mappings":";;AAOA;;;;;;AAMG;SACaA,eAAeA,CAC7BC,QAAmB,GAAA,EAAE,EACrBC,QAAuB,EAAA;EAEvBC,SAAS,CAACC,SAAS,CAChBC,SAAS,CAACJ,QAAQ,CAAC,CACnBK,IAAI,CAAC,MAAK;AACT,IAAA,MAAMC,MAAM,GAAe;AAAEC,MAAAA,MAAM,EAAE;KAAM;AAC3CN,IAAAA,QAAQ,aAARA,QAAQ,KAAA,MAAA,GAAA,MAAA,GAARA,QAAQ,CAAGK,MAAM,CAAC;AACpB,GAAC,CAAC,CACDE,KAAK,CAAEC,GAAG,IAAI;AACb,IAAA,MAAMH,MAAM,GAAe;AAAEC,MAAAA,MAAM,EAAE,KAAK;AAAEG,MAAAA,OAAO,EAAED;KAAK;AAC1DR,IAAAA,QAAQ,aAARA,QAAQ,KAAA,MAAA,GAAA,MAAA,GAARA,QAAQ,CAAGK,MAAM,CAAC;AACpB,GAAC,CAAC;AACN;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { copyToClipboard } from './copyToClipboard';
|
|
2
|
-
export { getDaysBetweenDates, getDynamicRange, getTimeDelta, type DateInput, type TimeDeltaFormat } from '
|
|
2
|
+
export { getDaysBetweenDates, getDynamicRange, getTimeDelta, type DateInput, type TimeDeltaFormat } from '../../shared/utils/datetime';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewProps, ViewStyle } from 'react-native';
|
|
3
|
+
export interface AvatarProps extends Omit<ViewProps, 'style'> {
|
|
4
|
+
/** Username to generate identicon for */
|
|
5
|
+
username: string;
|
|
6
|
+
/** Additional CSS class name (for NativeWind) */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** Saturation level for the identicon (0-100) */
|
|
9
|
+
saturation?: number;
|
|
10
|
+
/** Lightness level for the identicon (0-100) */
|
|
11
|
+
lightness?: number;
|
|
12
|
+
/** Width of the avatar (default: 40) */
|
|
13
|
+
width?: number;
|
|
14
|
+
/** Height of the avatar (default: 40) */
|
|
15
|
+
height?: number;
|
|
16
|
+
/** Custom container style (overrides Tailwind classes) */
|
|
17
|
+
style?: ViewStyle;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Avatar component that creates unique identicons from usernames
|
|
21
|
+
* with customizable appearance.
|
|
22
|
+
*
|
|
23
|
+
* This is the React Native version that uses SvgXml instead of img tag.
|
|
24
|
+
*/
|
|
25
|
+
export declare const Avatar: React.FC<AvatarProps>;
|
|
26
|
+
export default Avatar;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewProps } from 'react-native';
|
|
3
|
+
export interface AvatarProps extends ViewProps {
|
|
4
|
+
/** Username to generate identicon for */
|
|
5
|
+
username: string;
|
|
6
|
+
/** Additional CSS class name (for NativeWind) */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** Saturation level for the identicon (0-100) */
|
|
9
|
+
saturation?: number;
|
|
10
|
+
/** Lightness level for the identicon (0-100) */
|
|
11
|
+
lightness?: number;
|
|
12
|
+
/** Width of the avatar (default: 40) */
|
|
13
|
+
width?: number;
|
|
14
|
+
/** Height of the avatar (default: 40) */
|
|
15
|
+
height?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Avatar component that creates unique identicons from usernames
|
|
19
|
+
* with customizable appearance.
|
|
20
|
+
*
|
|
21
|
+
* This is the Web/Storybook version that uses inline SVG.
|
|
22
|
+
*/
|
|
23
|
+
export declare const Avatar: React.FC<AvatarProps>;
|
|
24
|
+
export default Avatar;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle, TextStyle, PressableProps } from 'react-native';
|
|
3
|
+
/**
|
|
4
|
+
* Badge component props
|
|
5
|
+
*/
|
|
6
|
+
export interface BadgeProps extends Omit<PressableProps, 'style'> {
|
|
7
|
+
/**
|
|
8
|
+
* Content of the badge
|
|
9
|
+
*/
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Visual style variant
|
|
13
|
+
*/
|
|
14
|
+
variant?: 'default' | 'flat' | 'solid' | 'bordered';
|
|
15
|
+
/**
|
|
16
|
+
* Color theme
|
|
17
|
+
*/
|
|
18
|
+
color?: 'blue' | 'white' | 'gray' | 'light-gray' | 'turquoise' | 'red' | 'orange';
|
|
19
|
+
/**
|
|
20
|
+
* Light or dark theme
|
|
21
|
+
*/
|
|
22
|
+
theme?: 'light' | 'dark';
|
|
23
|
+
/**
|
|
24
|
+
* Color override for light theme
|
|
25
|
+
*/
|
|
26
|
+
colorLight?: 'blue' | 'white' | 'gray' | 'light-gray' | 'turquoise' | 'red' | 'orange';
|
|
27
|
+
/**
|
|
28
|
+
* Color override for dark theme
|
|
29
|
+
*/
|
|
30
|
+
colorDark?: 'blue' | 'white' | 'gray' | 'light-gray' | 'turquoise' | 'red' | 'orange';
|
|
31
|
+
/**
|
|
32
|
+
* Size of the badge
|
|
33
|
+
*/
|
|
34
|
+
size?: 'xxs' | 'xs' | 'sm' | 'xl';
|
|
35
|
+
/**
|
|
36
|
+
* Border radius variant
|
|
37
|
+
*/
|
|
38
|
+
borderRadius?: 'xs';
|
|
39
|
+
/**
|
|
40
|
+
* Additional Tailwind classes for styling
|
|
41
|
+
*/
|
|
42
|
+
className?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Custom container style (overrides Tailwind classes)
|
|
45
|
+
*/
|
|
46
|
+
style?: ViewStyle;
|
|
47
|
+
/**
|
|
48
|
+
* Custom text style (overrides Tailwind text classes)
|
|
49
|
+
*/
|
|
50
|
+
textStyle?: TextStyle;
|
|
51
|
+
/**
|
|
52
|
+
* Press handler
|
|
53
|
+
*/
|
|
54
|
+
onPress?: () => void;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* React Native Badge component with multiple variants, colors, sizes, and border radius options.
|
|
58
|
+
* Uses CVA for variant management and twrnc for Tailwind styling.
|
|
59
|
+
*
|
|
60
|
+
* Supports 28 style combinations (7 colors × 4 variants) with 4 sizes and optional custom border radius.
|
|
61
|
+
*/
|
|
62
|
+
export declare const Badge: React.FC<BadgeProps>;
|
|
63
|
+
export default Badge;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle, TextStyle } from 'react-native';
|
|
3
|
+
export type BigNumberVariant = 'space' | 'comma';
|
|
4
|
+
export interface BigNumberProps {
|
|
5
|
+
/** The numeric value (or string) to format. */
|
|
6
|
+
children?: number | string | null;
|
|
7
|
+
/** Use non-breaking space groups or comma groups. */
|
|
8
|
+
variant?: BigNumberVariant;
|
|
9
|
+
/** Extra class names to apply to the wrapper. Use gap-* classes for spacing between groups. */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Horizontal spacing (in pixels) around the decimal point. Negative values reduce spacing. @default -2 */
|
|
12
|
+
decimalPointSpacing?: number;
|
|
13
|
+
/** Custom container style (overrides Tailwind classes) */
|
|
14
|
+
style?: ViewStyle;
|
|
15
|
+
/** Custom text style (overrides Tailwind text classes) */
|
|
16
|
+
textStyle?: TextStyle;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Splits a numeric string into groups of three characters for display.
|
|
20
|
+
* Supports two variants:
|
|
21
|
+
* - `space`: groups separated by gap
|
|
22
|
+
* - `comma`: groups separated by commas, with decimal part after `.`
|
|
23
|
+
* Supports light/dark theme via dark: variants.
|
|
24
|
+
*/
|
|
25
|
+
export declare const BigNumber: React.FC<BigNumberProps>;
|
|
26
|
+
export default BigNumber;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PressableProps, ViewStyle, TextStyle } from 'react-native';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
declare const buttonStyles: (props?: ({
|
|
5
|
+
variant?: "solid" | "outline" | "ghost" | null | undefined;
|
|
6
|
+
colorScheme?: "red" | "gray" | "brand" | "mint" | "lightBlue" | "lightGray" | "white" | "halfWhite" | "halfBlue" | null | undefined;
|
|
7
|
+
size?: "sm" | "md" | "lg" | "xl" | null | undefined;
|
|
8
|
+
rounded?: "default" | "full" | null | undefined;
|
|
9
|
+
disabled?: boolean | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
11
|
+
type ButtonVariants = Omit<VariantProps<typeof buttonStyles>, 'disabled'>;
|
|
12
|
+
export interface ButtonProps extends Omit<PressableProps, 'style'>, ButtonVariants {
|
|
13
|
+
/** Light or dark theme */
|
|
14
|
+
theme?: 'light' | 'dark';
|
|
15
|
+
/** Solid, outline, or ghost style */
|
|
16
|
+
variant?: 'solid' | 'outline' | 'ghost';
|
|
17
|
+
/** Color scheme for the button */
|
|
18
|
+
colorScheme?: 'brand' | 'mint' | 'gray' | 'red' | 'lightBlue' | 'lightGray' | 'white' | 'halfWhite' | 'halfBlue';
|
|
19
|
+
/** Color scheme override for light theme */
|
|
20
|
+
colorSchemeLight?: 'brand' | 'mint' | 'gray' | 'red' | 'lightBlue' | 'lightGray' | 'white' | 'halfWhite' | 'halfBlue';
|
|
21
|
+
/** Color scheme override for dark theme */
|
|
22
|
+
colorSchemeDark?: 'brand' | 'mint' | 'gray' | 'red' | 'lightBlue' | 'lightGray' | 'white' | 'halfWhite' | 'halfBlue';
|
|
23
|
+
/** Size of the button */
|
|
24
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
25
|
+
/** Border radius style */
|
|
26
|
+
rounded?: 'default' | 'full';
|
|
27
|
+
/** Whether the button is disabled */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/** Whether to show loading indicator */
|
|
30
|
+
loading?: boolean;
|
|
31
|
+
/** Additional Tailwind classes for styling */
|
|
32
|
+
className?: string;
|
|
33
|
+
/** Custom container style (overrides Tailwind classes) */
|
|
34
|
+
style?: ViewStyle;
|
|
35
|
+
/** Custom text style (overrides Tailwind text classes) */
|
|
36
|
+
textStyle?: TextStyle;
|
|
37
|
+
/** Button content */
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* React Native Button component with variants, color schemes, sizes, and loading state.
|
|
42
|
+
* Uses Pressable for touch interactions and twrnc for Tailwind styling.
|
|
43
|
+
*/
|
|
44
|
+
export declare const Button: React.FC<ButtonProps>;
|
|
45
|
+
export default Button;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle, TextStyle } from 'react-native';
|
|
3
|
+
export interface CopyButtonProps {
|
|
4
|
+
/** Text to copy into clipboard */
|
|
5
|
+
text: string;
|
|
6
|
+
/** Optional callback that will be called with the copy result */
|
|
7
|
+
onCopy?: (success: boolean) => void;
|
|
8
|
+
/** Additional Tailwind classes for styling */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Custom container style (overrides Tailwind classes) */
|
|
11
|
+
style?: ViewStyle;
|
|
12
|
+
/** Custom text style for "Copied!" text (overrides Tailwind text classes) */
|
|
13
|
+
textStyle?: TextStyle;
|
|
14
|
+
/** Accessible label for the button */
|
|
15
|
+
accessibilityLabel?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* React Native CopyButton component. Copies text to clipboard on press
|
|
19
|
+
* and shows "Copied!" feedback briefly.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CopyButton: React.FC<CopyButtonProps>;
|
|
22
|
+
export default CopyButton;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
export interface CopyButtonProps {
|
|
4
|
+
/** Text to copy into clipboard */
|
|
5
|
+
text: string;
|
|
6
|
+
/** Optional callback that will be called with the copy result */
|
|
7
|
+
onCopy?: (success: boolean) => void;
|
|
8
|
+
/** Additional Tailwind classes for styling */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Additional style object */
|
|
11
|
+
style?: ViewStyle;
|
|
12
|
+
/** Accessible label for the button */
|
|
13
|
+
accessibilityLabel?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Web CopyButton component. Uses navigator.clipboard.writeText() for browser.
|
|
17
|
+
* Copies text to clipboard on press and shows "Copied!" feedback briefly.
|
|
18
|
+
*/
|
|
19
|
+
export declare const CopyButton: React.FC<CopyButtonProps>;
|
|
20
|
+
export default CopyButton;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
export interface DashLogoProps {
|
|
4
|
+
color?: string;
|
|
5
|
+
size?: number;
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
className?: string;
|
|
9
|
+
onPress?: () => void;
|
|
10
|
+
containerPadding?: number;
|
|
11
|
+
containerSize?: number;
|
|
12
|
+
containerClassName?: string;
|
|
13
|
+
/** Custom container style (overrides Tailwind classes) */
|
|
14
|
+
containerStyle?: ViewStyle;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Dash Logo component for React Native with customizable size and color
|
|
18
|
+
* Original aspect ratio: 30:25 (1.2:1)
|
|
19
|
+
*
|
|
20
|
+
* Color can be set via:
|
|
21
|
+
* - color prop (default: #4C7EFF)
|
|
22
|
+
*
|
|
23
|
+
* Container supports:
|
|
24
|
+
* - containerPadding: padding around the logo
|
|
25
|
+
* - containerSize: width/height of the container
|
|
26
|
+
* - containerClassName: Tailwind classes for the container
|
|
27
|
+
* - containerStyle: Additional style object for the container
|
|
28
|
+
*/
|
|
29
|
+
export declare const DashLogo: React.FC<DashLogoProps>;
|
|
30
|
+
export default DashLogo;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextProps as RNTextProps, TextStyle } from 'react-native';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
declare const headingStyles: (props?: ({
|
|
5
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6 | null | undefined;
|
|
6
|
+
weight?: "medium" | "semibold" | "bold" | "normal" | "extrabold" | null | undefined;
|
|
7
|
+
color?: "default" | "blue" | "red" | "gray" | "black" | "green" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
9
|
+
type HeadingVariants = VariantProps<typeof headingStyles>;
|
|
10
|
+
export interface HeadingProps extends Omit<RNTextProps, 'style'>, HeadingVariants {
|
|
11
|
+
/** Semantic level of the heading (1-6) */
|
|
12
|
+
level?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
13
|
+
/** Additional Tailwind classes for styling */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** Custom text style (overrides Tailwind classes) */
|
|
16
|
+
style?: TextStyle;
|
|
17
|
+
/** Text children */
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* React Native Heading component with semantic levels and customizable styling.
|
|
22
|
+
* Uses twrnc for Tailwind-like styling converted to React Native styles.
|
|
23
|
+
*/
|
|
24
|
+
export declare const Heading: React.FC<HeadingProps>;
|
|
25
|
+
export default Heading;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface IconProps {
|
|
3
|
+
color?: string;
|
|
4
|
+
size?: number;
|
|
5
|
+
className?: string;
|
|
6
|
+
onPress?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const ArrowIcon: React.FC<IconProps>;
|
|
9
|
+
export declare const CopyIcon: React.FC<IconProps>;
|
|
10
|
+
export declare const SuccessIcon: React.FC<IconProps>;
|
|
11
|
+
export declare const ErrorIcon: React.FC<IconProps>;
|
|
12
|
+
export declare const CheckIcon: React.FC<IconProps>;
|
|
13
|
+
export declare const CrossIcon: React.FC<IconProps>;
|
|
14
|
+
export declare const PlusIcon: React.FC<IconProps>;
|
|
15
|
+
export declare const ChevronIcon: React.FC<IconProps>;
|
|
16
|
+
export declare const SearchIcon: React.FC<IconProps>;
|
|
17
|
+
export declare const InfoCircleIcon: React.FC<IconProps>;
|
|
18
|
+
export declare const EyeOpenIcon: React.FC<IconProps>;
|
|
19
|
+
export declare const EyeClosedIcon: React.FC<IconProps>;
|
|
20
|
+
export declare const AsteriskIcon: React.FC<IconProps>;
|
|
21
|
+
export declare const TopRightArrowIcon: React.FC<IconProps>;
|
|
22
|
+
export declare const QueuedIcon: React.FC<IconProps>;
|
|
23
|
+
export declare const PooledIcon: React.FC<IconProps>;
|
|
24
|
+
export declare const BroadcastedIcon: React.FC<IconProps>;
|
|
25
|
+
export declare const Icons: {
|
|
26
|
+
ArrowIcon: React.FC<IconProps>;
|
|
27
|
+
CopyIcon: React.FC<IconProps>;
|
|
28
|
+
SuccessIcon: React.FC<IconProps>;
|
|
29
|
+
ErrorIcon: React.FC<IconProps>;
|
|
30
|
+
CheckIcon: React.FC<IconProps>;
|
|
31
|
+
CrossIcon: React.FC<IconProps>;
|
|
32
|
+
PlusIcon: React.FC<IconProps>;
|
|
33
|
+
ChevronIcon: React.FC<IconProps>;
|
|
34
|
+
SearchIcon: React.FC<IconProps>;
|
|
35
|
+
InfoCircleIcon: React.FC<IconProps>;
|
|
36
|
+
EyeOpenIcon: React.FC<IconProps>;
|
|
37
|
+
EyeClosedIcon: React.FC<IconProps>;
|
|
38
|
+
TopRightArrowIcon: React.FC<IconProps>;
|
|
39
|
+
QueuedIcon: React.FC<IconProps>;
|
|
40
|
+
PooledIcon: React.FC<IconProps>;
|
|
41
|
+
BroadcastedIcon: React.FC<IconProps>;
|
|
42
|
+
AsteriskIcon: React.FC<IconProps>;
|
|
43
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewProps, ViewStyle, TextStyle } from 'react-native';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
/** CVA for the root container with light/dark theme */
|
|
5
|
+
declare const identifier: (props?: ({
|
|
6
|
+
theme?: "light" | "dark" | null | undefined;
|
|
7
|
+
ellipsis?: boolean | null | undefined;
|
|
8
|
+
highlight?: "default" | "highlight" | "dim" | "first" | "last" | "both" | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
10
|
+
type IdentifierVariants = VariantProps<typeof identifier>;
|
|
11
|
+
export interface IdentifierProps extends IdentifierVariants, Omit<ViewProps, 'style'> {
|
|
12
|
+
children?: string;
|
|
13
|
+
avatar?: boolean;
|
|
14
|
+
copyButton?: boolean;
|
|
15
|
+
maxLines?: number;
|
|
16
|
+
className?: string;
|
|
17
|
+
middleEllipsis?: boolean;
|
|
18
|
+
edgeChars?: number;
|
|
19
|
+
/** Theme to use */
|
|
20
|
+
theme?: 'light' | 'dark';
|
|
21
|
+
/** Custom container style (overrides Tailwind classes) */
|
|
22
|
+
style?: ViewStyle;
|
|
23
|
+
/** Custom text style (overrides Tailwind text classes) */
|
|
24
|
+
textStyle?: TextStyle;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Identifier component for React Native
|
|
28
|
+
* Shows an ID string with optional highlighting, avatar, copy button, and ellipsis modes.
|
|
29
|
+
*
|
|
30
|
+
* Features:
|
|
31
|
+
* - Highlight modes: default, dim, highlight, first, last, both
|
|
32
|
+
* - Ellipsis modes: standard (tail), middle, maxLines
|
|
33
|
+
* - Avatar integration
|
|
34
|
+
* - Copy button integration
|
|
35
|
+
* - Theme support (light/dark)
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <Identifier highlight="both">0x1234567890abcdef</Identifier>
|
|
40
|
+
* <Identifier avatar copyButton>alice@example.com</Identifier>
|
|
41
|
+
* <Identifier middleEllipsis edgeChars={6}>very-long-identifier</Identifier>
|
|
42
|
+
* <Identifier maxLines={2}>Multi-line\nidentifier\ntext</Identifier>
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare const Identifier: React.FC<IdentifierProps>;
|
|
46
|
+
export default Identifier;
|
|
47
|
+
export { Identifier };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './text';
|
|
2
|
+
export * from './heading';
|
|
3
|
+
export * from './button';
|
|
4
|
+
export * from './input';
|
|
5
|
+
export * from './tabs';
|
|
6
|
+
export * from './avatar';
|
|
7
|
+
export * from './badge';
|
|
8
|
+
export * from './bigNumber';
|
|
9
|
+
export * from './copyButton';
|
|
10
|
+
export * from './identifier';
|
|
11
|
+
export * from './notActive';
|
|
12
|
+
export * from './valueCard';
|
|
13
|
+
export * from './icons';
|
|
14
|
+
export * from './dashLogo';
|
|
15
|
+
export * from './transactionStatusIcon';
|