@opexa/portal-components 0.0.353 → 0.0.355
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.
|
@@ -63,7 +63,7 @@ export function DailyCheckInQuest() {
|
|
|
63
63
|
currency: localeInfo.currency.code,
|
|
64
64
|
minDecimalPlaces: 0,
|
|
65
65
|
maxDecimalPlaces: 0,
|
|
66
|
-
})}`) : done ? (_jsx(CheckIcon, { className: "size-4" })) : (
|
|
66
|
+
})}`) : done ? (_jsx(CheckIcon, { className: "size-4" })) : (_jsx(XIcon, { className: "size-4" }));
|
|
67
67
|
return (_jsx("div", { className: twMerge('flex items-center justify-center', done ? 'text-brand-400' : 'text-text-secondary-700'), children: _jsx("p", { children: reward }) }, item.day));
|
|
68
68
|
}) }), _jsx("div", { className: "h-2 w-full overflow-hidden rounded-full bg-bg-primary", children: _jsx("div", { className: "h-full rounded-full bg-utility-brand-600 transition-all duration-300", style: { width: `${progressPercentage}%` } }) }), _jsx("div", { className: "grid grid-cols-7 place-items-center", children: dailyCheckedInData.map((item) => (_jsxs("div", { className: "group relative size-fit text-text-secondary-700 ui-active:text-brand-400", "data-active": dataAttr(item.day <= (checkInStreak ?? 0)), children: [_jsx(CalendarIcon, { className: "h-4.5 w-auto" }), _jsx("p", { className: "-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 text-2xs leading-none", children: item.day })] }, item.day))) })] }), _jsx(Button, { onClick: () => checkInDailyQuestMutation.mutate(id), className: "disabled:bg-bg-primary disabled:text-text-disabled", disabled: status === 'COMPLETED' ||
|
|
69
69
|
status === 'FAILED' ||
|
package/dist/ui/Prose/Prose.js
CHANGED
|
@@ -3,5 +3,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { ark } from '@ark-ui/react/factory';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
5
|
export function Prose(props) {
|
|
6
|
-
return (_jsx(ark.div, { ...props, className: twMerge('prose', 'prose-invert', 'max-w-none', 'prose-h1:text-text-primary-900', 'prose-h2:text-text-primary-900', 'prose-h3:text-text-primary-900', 'prose-h4:text-text-primary-900', 'prose-h5:text-text-primary-900', 'prose-h6:text-text-primary-900', 'prose-h1:text-4xl', 'prose-h2:text-3xl', 'prose-h3:text-2xl', 'prose-h4:text-xl', 'prose-h5:text-lg', 'prose-h6:text-base', 'prose-headings:font-semibold', 'prose-p:text-text-secondary-700', 'prose-ul:text-text-secondary-700', 'prose-ol:text-text-secondary-700', 'prose-li:text-text-secondary-700', 'prose-li:marker:text-text-secondary-700', 'prose-strong:text-text-secondary-700', 'prose-ul:text-text-secondary-700', 'prose-em:text-text-secondary-700', 'prose-b:text-text-secondary-700', 'prose-u:text-text-secondary-700', 'prose-img:block', 'prose-img:w-full', 'prose-img:h-auto', 'prose-strong:font-medium', 'prose-b:font-medium', props.className) }));
|
|
6
|
+
return (_jsx(ark.div, { ...props, className: twMerge('prose', 'prose-invert', 'max-w-none', 'prose-h1:text-text-primary-900', 'prose-h2:text-text-primary-900', 'prose-h3:text-text-primary-900', 'prose-h4:text-text-primary-900', 'prose-h5:text-text-primary-900', 'prose-h6:text-text-primary-900', 'prose-h1:text-4xl', 'prose-h2:text-3xl', 'prose-h3:text-2xl', 'prose-h4:text-xl', 'prose-h5:text-lg', 'prose-h6:text-base', 'prose-headings:font-semibold', 'prose-p:text-text-secondary-700', 'prose-ul:text-text-secondary-700', 'prose-ol:text-text-secondary-700', 'prose-li:text-text-secondary-700', 'prose-li:marker:text-text-secondary-700', 'prose-strong:text-text-secondary-700', 'prose-ul:text-text-secondary-700', 'prose-em:text-text-secondary-700', 'prose-b:text-text-secondary-700', 'prose-u:text-text-secondary-700', 'prose-img:block', 'prose-img:w-full', 'prose-img:h-auto', 'prose-strong:font-medium', 'prose-b:font-medium', 'prose-p:m-0', 'prose-span:ml-0', 'prose-ol:pl-0', 'prose-li:ml-0', 'prose-ol:list-inside', props.className) }));
|
|
7
7
|
}
|
|
@@ -7,6 +7,8 @@ interface FormatNumberConfig {
|
|
|
7
7
|
minDecimalPlaces?: number;
|
|
8
8
|
/** @default 2 */
|
|
9
9
|
maxDecimalPlaces?: number;
|
|
10
|
+
/** If true, do not round up decimals, just truncate */
|
|
11
|
+
truncate?: boolean;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* @example
|
|
@@ -15,6 +17,7 @@ interface FormatNumberConfig {
|
|
|
15
17
|
* numberFormatter.format(1234567.89, { locale: 'de-DE' }) // "1.234.567,89"
|
|
16
18
|
* numberFormatter.format(1234567.89, { compact: true }) // "1M"
|
|
17
19
|
* numberFormatter.format(1234567.89, { currency: 'USD' }) // "$1,234,567.89"
|
|
20
|
+
* numberFormatter.format(1.259, { maxDecimalPlaces: 2, truncate: true }) // "1.25"
|
|
18
21
|
* ```
|
|
19
22
|
*/
|
|
20
23
|
export declare const formatNumber: (value: unknown, config?: FormatNumberConfig) => string;
|
|
@@ -5,7 +5,12 @@ const defaultConfig = {
|
|
|
5
5
|
compact: false,
|
|
6
6
|
minDecimalPlaces: 0,
|
|
7
7
|
maxDecimalPlaces: 2,
|
|
8
|
+
truncate: true,
|
|
8
9
|
};
|
|
10
|
+
function truncateDecimals(value, decimals) {
|
|
11
|
+
const factor = 10 ** decimals;
|
|
12
|
+
return Math.trunc(value * factor) / factor;
|
|
13
|
+
}
|
|
9
14
|
/**
|
|
10
15
|
* @example
|
|
11
16
|
* ```ts
|
|
@@ -13,12 +18,11 @@ const defaultConfig = {
|
|
|
13
18
|
* numberFormatter.format(1234567.89, { locale: 'de-DE' }) // "1.234.567,89"
|
|
14
19
|
* numberFormatter.format(1234567.89, { compact: true }) // "1M"
|
|
15
20
|
* numberFormatter.format(1234567.89, { currency: 'USD' }) // "$1,234,567.89"
|
|
21
|
+
* numberFormatter.format(1.259, { maxDecimalPlaces: 2, truncate: true }) // "1.25"
|
|
16
22
|
* ```
|
|
17
23
|
*/
|
|
18
24
|
export const formatNumber = cache((value, config) => {
|
|
19
|
-
const {
|
|
20
|
-
/**/
|
|
21
|
-
locale, compact, currency, minDecimalPlaces, maxDecimalPlaces, } = Object.assign({}, defaultConfig, config);
|
|
25
|
+
const { locale, compact, currency, minDecimalPlaces, maxDecimalPlaces, truncate, } = Object.assign({}, defaultConfig, config);
|
|
22
26
|
const formatter = new Intl.NumberFormat(locale, {
|
|
23
27
|
minimumFractionDigits: minDecimalPlaces,
|
|
24
28
|
maximumFractionDigits: maxDecimalPlaces,
|
|
@@ -36,5 +40,9 @@ export const formatNumber = cache((value, config) => {
|
|
|
36
40
|
}
|
|
37
41
|
: {}),
|
|
38
42
|
});
|
|
39
|
-
|
|
43
|
+
let parsed = parseDecimal(value, 0);
|
|
44
|
+
if (truncate) {
|
|
45
|
+
parsed = truncateDecimals(parsed, maxDecimalPlaces);
|
|
46
|
+
}
|
|
47
|
+
return formatter.format(parsed);
|
|
40
48
|
});
|