@taiv/ui 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Data/Cards/ChartCard.d.ts +9 -0
- package/dist/components/Data/Cards/ChartCard.d.ts.map +1 -0
- package/dist/components/Data/Cards/ChartCard.js +9 -0
- package/dist/components/Data/Cards/PieChartCard.d.ts +10 -0
- package/dist/components/Data/Cards/PieChartCard.d.ts.map +1 -0
- package/dist/components/Data/Cards/PieChartCard.js +9 -0
- package/dist/components/Data/Cards/StatsCard.d.ts +17 -0
- package/dist/components/Data/Cards/StatsCard.d.ts.map +1 -0
- package/dist/components/Data/Cards/StatsCard.js +38 -0
- package/dist/components/Data/Chart.d.ts +5 -24
- package/dist/components/Data/Chart.d.ts.map +1 -1
- package/dist/components/Data/Chart.js +63 -80
- package/dist/components/Data/JustChart.d.ts +23 -0
- package/dist/components/Data/JustChart.d.ts.map +1 -0
- package/dist/components/Data/JustChart.js +70 -0
- package/dist/components/Data/JustPieChart.d.ts +20 -0
- package/dist/components/Data/JustPieChart.d.ts.map +1 -0
- package/dist/components/Data/JustPieChart.js +63 -0
- package/dist/components/Data/PieChart.d.ts +9 -12
- package/dist/components/Data/PieChart.d.ts.map +1 -1
- package/dist/components/Data/PieChart.js +35 -43
- package/dist/components/Data/StatsBadge.d.ts +10 -0
- package/dist/components/Data/StatsBadge.d.ts.map +1 -0
- package/dist/components/Data/StatsBadge.js +25 -0
- package/dist/components/Data/StatsCard.d.ts +2 -2
- package/dist/components/Data/StatsCard.d.ts.map +1 -1
- package/dist/components/Data/StatsCard.js +2 -2
- package/dist/components/Data/shared/chartFormats.d.ts +8 -0
- package/dist/components/Data/shared/chartFormats.d.ts.map +1 -0
- package/dist/components/Data/shared/chartFormats.js +29 -0
- package/dist/components/Data/shared/dataFormats.d.ts +7 -33
- package/dist/components/Data/shared/dataFormats.d.ts.map +1 -1
- package/dist/components/Data/shared/dataFormats.js +15 -20
- package/dist/components/Info/Badge.d.ts +10 -0
- package/dist/components/Info/Badge.d.ts.map +1 -1
- package/dist/components/Info/Badge.js +64 -1
- package/dist/components/Info/Tooltips/FormulaTooltip.d.ts +8 -0
- package/dist/components/Info/Tooltips/FormulaTooltip.d.ts.map +1 -0
- package/dist/components/Info/Tooltips/FormulaTooltip.js +11 -0
- package/dist/components/Info/Tooltips/InfoTooltip.d.ts +2 -1
- package/dist/components/Info/Tooltips/InfoTooltip.d.ts.map +1 -1
- package/dist/components/Info/Tooltips/InfoTooltip.js +2 -2
- package/dist/components/Info/Tooltips/Tooltip.d.ts +2 -1
- package/dist/components/Info/Tooltips/Tooltip.d.ts.map +1 -1
- package/dist/components/Info/Tooltips/Tooltip.js +2 -2
- package/dist/components/Inputs/Controls/Radio.d.ts +8 -0
- package/dist/components/Inputs/Controls/Radio.d.ts.map +1 -0
- package/dist/components/Inputs/Controls/Radio.js +43 -0
- package/dist/components/Inputs/Controls/RadioList.d.ts +16 -0
- package/dist/components/Inputs/Controls/RadioList.d.ts.map +1 -0
- package/dist/components/Inputs/Controls/RadioList.js +24 -0
- package/dist/components/Inputs/DatePickers/DatePicker.d.ts.map +1 -1
- package/dist/components/Inputs/DatePickers/DatePicker.js +39 -3
- package/dist/components/Inputs/Dates/DatePicker.d.ts +12 -0
- package/dist/components/Inputs/Dates/DatePicker.d.ts.map +1 -0
- package/dist/components/Inputs/Dates/DatePicker.js +71 -0
- package/dist/components/Inputs/Dropdowns/CascadingSelect.d.ts +17 -0
- package/dist/components/Inputs/Dropdowns/CascadingSelect.d.ts.map +1 -0
- package/dist/components/Inputs/Dropdowns/CascadingSelect.js +70 -0
- package/dist/components/Inputs/Dropdowns/FontSelect.d.ts +2 -5
- package/dist/components/Inputs/Dropdowns/FontSelect.d.ts.map +1 -1
- package/dist/components/Inputs/Dropdowns/FontSelect.js +1 -1
- package/dist/components/Inputs/Dropdowns/NestedSelect.d.ts +17 -0
- package/dist/components/Inputs/Dropdowns/NestedSelect.d.ts.map +1 -0
- package/dist/components/Inputs/Dropdowns/NestedSelect.js +70 -0
- package/dist/components/Inputs/Dropdowns/Select.d.ts.map +1 -1
- package/dist/components/Inputs/Dropdowns/Select.js +2 -2
- package/dist/components/Inputs/Dropdowns/shared/fontSelectList.d.ts +1 -4
- package/dist/components/Inputs/Dropdowns/shared/fontSelectList.d.ts.map +1 -1
- package/dist/components/Inputs/Dropdowns/shared/fontSelectList.js +1 -4
- package/dist/components/Layout/Divider.d.ts +2 -1
- package/dist/components/Layout/Divider.d.ts.map +1 -1
- package/dist/components/Layout/Divider.js +2 -2
- package/dist/components/Layout/SectionCard.d.ts.map +1 -1
- package/dist/components/Layout/SectionCard.js +3 -2
- package/dist/components/Misc/IconBadge.d.ts +2 -2
- package/dist/components/Misc/IconBadge.d.ts.map +1 -1
- package/dist/components/Misc/IconBadge.js +3 -4
- package/dist/components/Typography/Formula.d.ts +10 -0
- package/dist/components/Typography/Formula.d.ts.map +1 -0
- package/dist/components/Typography/Formula.js +141 -0
- package/dist/components/Typography/Fraction.d.ts +3 -4
- package/dist/components/Typography/Fraction.d.ts.map +1 -1
- package/dist/components/Typography/Fraction.js +6 -3
- package/dist/components/Typography/Text.d.ts +1 -1
- package/dist/components/Typography/Text.d.ts.map +1 -1
- package/dist/components/Typography/Text.js +7 -0
- package/dist/components/index.d.ts +11 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +11 -2
- package/dist/constants/colors.d.ts +1 -1
- package/dist/constants/colors.d.ts.map +1 -1
- package/dist/constants/colors.js +3 -3
- package/dist/constants/data.d.ts +70 -0
- package/dist/constants/data.d.ts.map +1 -0
- package/dist/constants/data.js +15 -0
- package/dist/hooks/useDropdowns.d.ts +9 -0
- package/dist/hooks/useDropdowns.d.ts.map +1 -0
- package/dist/hooks/useDropdowns.js +12 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/types.d.ts +20 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js +2 -0
- package/dist/utils/charts.d.ts +13 -0
- package/dist/utils/charts.d.ts.map +1 -0
- package/dist/utils/charts.js +48 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/select.d.ts +5 -0
- package/dist/utils/select.d.ts.map +1 -0
- package/dist/utils/select.js +12 -0
- package/package.json +4 -2
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from './Text';
|
|
3
|
+
import { Fraction } from './Fraction';
|
|
4
|
+
import { Group } from '../Layout/Group';
|
|
5
|
+
class FormulaParser {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.tokens = [];
|
|
8
|
+
this.current = 0;
|
|
9
|
+
}
|
|
10
|
+
parse(expression) {
|
|
11
|
+
const hasMathOperators = /[*\/+\-()=]/.test(expression);
|
|
12
|
+
if (!hasMathOperators) {
|
|
13
|
+
return [{ type: 'default', value: expression }];
|
|
14
|
+
}
|
|
15
|
+
this.tokens = this.tokenize(expression);
|
|
16
|
+
this.current = 0;
|
|
17
|
+
return this.parseExpression();
|
|
18
|
+
}
|
|
19
|
+
tokenize(expression) {
|
|
20
|
+
const tokens = [];
|
|
21
|
+
let i = 0;
|
|
22
|
+
while (i < expression.length) {
|
|
23
|
+
const char = expression[i];
|
|
24
|
+
if (char === '(' || char === ')') {
|
|
25
|
+
tokens.push(char);
|
|
26
|
+
i++;
|
|
27
|
+
}
|
|
28
|
+
else if (char === '/' || char === '*' || char === '+' || char === '-' || char === '=' || char === '_') {
|
|
29
|
+
tokens.push(char);
|
|
30
|
+
i++;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
let text = '';
|
|
34
|
+
while (i < expression.length && !/[*\/+\-()=_]/.test(expression[i])) {
|
|
35
|
+
text += expression[i];
|
|
36
|
+
i++;
|
|
37
|
+
}
|
|
38
|
+
if (text) {
|
|
39
|
+
tokens.push(text);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// Strip whitespace from all tokens
|
|
44
|
+
const cleanedTokens = tokens.map((token) => token.trim()).filter((token) => token.length > 0);
|
|
45
|
+
console.log('Tokenized tokens:', cleanedTokens);
|
|
46
|
+
return cleanedTokens;
|
|
47
|
+
}
|
|
48
|
+
parseExpression() {
|
|
49
|
+
console.log('parseExpression - current token:', this.peek(), 'position:', this.current);
|
|
50
|
+
return this.parseAddition();
|
|
51
|
+
}
|
|
52
|
+
parseAddition() {
|
|
53
|
+
let left = this.parseMultiplication();
|
|
54
|
+
console.log('parseAddition - after parseMultiplication, current token:', this.peek(), 'position:', this.current);
|
|
55
|
+
while (this.current < this.tokens.length && (this.peek() === '+' || this.peek() === '-' || this.peek() === '=')) {
|
|
56
|
+
console.log('parseAddition - found operator:', this.peek());
|
|
57
|
+
const operator = this.advance();
|
|
58
|
+
const right = this.parseMultiplication();
|
|
59
|
+
left = [...left, { type: 'operator', value: operator }, ...right];
|
|
60
|
+
}
|
|
61
|
+
return left;
|
|
62
|
+
}
|
|
63
|
+
parseMultiplication() {
|
|
64
|
+
let left = this.parseDivision();
|
|
65
|
+
while (this.current < this.tokens.length && this.peek() === '*') {
|
|
66
|
+
const operator = this.advance();
|
|
67
|
+
const right = this.parseDivision();
|
|
68
|
+
left = [...left, { type: 'operator', value: operator }, ...right];
|
|
69
|
+
}
|
|
70
|
+
return left;
|
|
71
|
+
}
|
|
72
|
+
parseDivision() {
|
|
73
|
+
let left = this.parsePrimary();
|
|
74
|
+
while (this.current < this.tokens.length && this.peek() === '/') {
|
|
75
|
+
this.advance();
|
|
76
|
+
const right = this.parsePrimary();
|
|
77
|
+
const fraction = {
|
|
78
|
+
type: 'fraction',
|
|
79
|
+
numerator: left,
|
|
80
|
+
denominator: right,
|
|
81
|
+
};
|
|
82
|
+
left = [fraction];
|
|
83
|
+
}
|
|
84
|
+
return left;
|
|
85
|
+
}
|
|
86
|
+
parsePrimary() {
|
|
87
|
+
if (this.peek() === '(') {
|
|
88
|
+
this.advance(); // consume '('
|
|
89
|
+
const expr = this.parseExpression();
|
|
90
|
+
this.advance(); // consume ')'
|
|
91
|
+
// Wrap the expression with parentheses
|
|
92
|
+
// return [{ type: 'default', value: '(' }, ...expr, { type: 'default', value: ')' }];
|
|
93
|
+
return expr;
|
|
94
|
+
}
|
|
95
|
+
// Handle text tokens
|
|
96
|
+
const token = this.peek();
|
|
97
|
+
if (token && !/[*\/+\-()=_]/.test(token)) {
|
|
98
|
+
const text = this.advance();
|
|
99
|
+
// Check if next token is a subscript (text in parentheses)
|
|
100
|
+
if (this.peek() === '_') {
|
|
101
|
+
this.advance(); // consume '_'
|
|
102
|
+
const subscript = this.peek();
|
|
103
|
+
if (subscript && !/[*\/+\-_()=_]/.test(subscript)) {
|
|
104
|
+
this.advance(); // consume subscript text
|
|
105
|
+
return [{ type: 'subscript', value: text, subscript }];
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return [{ type: 'default', value: text }];
|
|
109
|
+
}
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
peek() {
|
|
113
|
+
return this.tokens[this.current] || '';
|
|
114
|
+
}
|
|
115
|
+
advance() {
|
|
116
|
+
return this.tokens[this.current++] || '';
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Update the renderer to handle subscript
|
|
120
|
+
const FormulaRenderer = ({ nodes, weight, size, color }) => {
|
|
121
|
+
return (_jsx(Group, { gap: "0.5rem", children: nodes.map((node, index) => {
|
|
122
|
+
switch (node.type) {
|
|
123
|
+
case 'default':
|
|
124
|
+
return (_jsx(Text, { weight: weight, size: size, color: color, children: node.value }, index));
|
|
125
|
+
case 'operator':
|
|
126
|
+
return (_jsx(Text, { weight: weight, size: size, color: color, children: node.value === '*' ? '×' : node.value }, index));
|
|
127
|
+
case 'subscript':
|
|
128
|
+
return (_jsxs(Text, { weight: weight, size: size, color: color, children: [node.value, _jsx("sub", { children: `(${node.subscript})` })] }, index));
|
|
129
|
+
case 'fraction':
|
|
130
|
+
return (_jsx(Fraction, { color: color, weight: weight, size: size, numerator: _jsx(FormulaRenderer, { nodes: node.numerator || [], weight: weight, size: size, color: color }), denominator: _jsx(FormulaRenderer, { nodes: node.denominator || [], weight: weight, size: size, color: color }) }, index));
|
|
131
|
+
default:
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
}) }));
|
|
135
|
+
};
|
|
136
|
+
const Formula = ({ expression, weight, size, color }) => {
|
|
137
|
+
const parser = new FormulaParser();
|
|
138
|
+
const parsedNodes = parser.parse(expression);
|
|
139
|
+
return _jsx(FormulaRenderer, { nodes: parsedNodes, weight: weight, size: size, color: color });
|
|
140
|
+
};
|
|
141
|
+
export { Formula };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
interface FractionProps {
|
|
2
|
+
import { TextProps } from './Text';
|
|
3
|
+
interface FractionProps extends Omit<TextProps, 'children' | 'styles'> {
|
|
4
4
|
numerator: React.ReactNode;
|
|
5
5
|
denominator: React.ReactNode;
|
|
6
|
-
variant: keyof typeof textStyle;
|
|
7
6
|
}
|
|
8
|
-
declare const Fraction: ({ numerator, denominator, variant }: FractionProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare const Fraction: ({ numerator, denominator, variant, color, weight, size }: FractionProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
export { Fraction };
|
|
10
9
|
//# sourceMappingURL=Fraction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fraction.d.ts","sourceRoot":"","sources":["../../../src/components/Typography/Fraction.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Fraction.d.ts","sourceRoot":"","sources":["../../../src/components/Typography/Fraction.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEnC,UAAU,aAAc,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,GAAG,QAAQ,CAAC;IACpE,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAED,QAAA,MAAM,QAAQ,GAAI,0DAAmE,aAAa,4CAajG,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Divider } from '../Layout/Divider';
|
|
3
|
+
import { textStyle } from '../../constants';
|
|
3
4
|
import { Text } from './Text';
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
import { Stack } from '../Layout/Stack';
|
|
6
|
+
const Fraction = ({ numerator, denominator, variant = 'body', color, weight, size }) => {
|
|
7
|
+
const selectedVariant = textStyle[variant];
|
|
8
|
+
return (_jsxs(Stack, { sx: { display: 'inline-flex', alignItems: 'center', lineHeight: 1 }, gap: "0.25rem", children: [_jsx(Text, { variant: variant, color: color, weight: weight, size: size, sx: { display: 'block', textAlign: 'center' }, children: numerator }), _jsx(Divider, { color: color || selectedVariant.color, width: "100%" }), _jsx(Text, { variant: variant, color: color, weight: weight, size: size, sx: { display: 'block', textAlign: 'center' }, children: denominator })] }));
|
|
6
9
|
};
|
|
7
10
|
export { Fraction };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
|
2
2
|
import { TextProps as MantineTextProps } from '@mantine/core';
|
|
3
3
|
import { textStyle, fontSize, fontWeight } from '../../constants/font';
|
|
4
|
-
interface TextProps extends MantineTextProps {
|
|
4
|
+
export interface TextProps extends MantineTextProps {
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
variant?: keyof typeof textStyle;
|
|
7
7
|
size?: keyof typeof fontSize;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/components/Typography/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAuB,SAAS,IAAI,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/components/Typography/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAuB,SAAS,IAAI,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvE,MAAM,WAAW,SAAU,SAAQ,gBAAgB;IACjD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,OAAO,SAAS,CAAC;IACjC,IAAI,CAAC,EAAE,MAAM,OAAO,QAAQ,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,OAAO,UAAU,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,QAAA,MAAM,IAAI,GAAI,8DAAuE,SAAS,4CAwC7F,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -23,6 +23,13 @@ const Text = ({ variant = 'body', size, children, weight, color, styles, ...prop
|
|
|
23
23
|
...customColor,
|
|
24
24
|
fontWeight: fontWeight.bold,
|
|
25
25
|
},
|
|
26
|
+
'& sub': {
|
|
27
|
+
...selectedVariant,
|
|
28
|
+
...customColor,
|
|
29
|
+
fontWeight: fontWeight.medium,
|
|
30
|
+
fontSize: '0.8em',
|
|
31
|
+
marginLeft: '0.2em',
|
|
32
|
+
},
|
|
26
33
|
}, ...props, children: children }));
|
|
27
34
|
};
|
|
28
35
|
export { Text };
|
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
export { CheckboxTable } from './Data/CheckboxTable';
|
|
2
2
|
export { Chart } from './Data/Chart';
|
|
3
|
+
export { ChartCard } from './Data/Cards/ChartCard';
|
|
3
4
|
export { PieChart } from './Data/PieChart';
|
|
5
|
+
export { PieChartCard } from './Data/Cards/PieChartCard';
|
|
4
6
|
export { RemovableItemList } from './Data/RemovableItemList';
|
|
5
|
-
export { StatsCard } from './Data/StatsCard';
|
|
7
|
+
export { StatsCard } from './Data/Cards/StatsCard';
|
|
8
|
+
export { StatsBadge } from './Data/StatsBadge';
|
|
6
9
|
export { Modal } from './Info/Modals/Modal';
|
|
7
10
|
export { ModalProvider } from './Info/Modals/ModalProvider';
|
|
8
11
|
export { NotificationProvider } from './Info/Notifications/NotificationProvider';
|
|
12
|
+
export { Badge } from './Info/Badge';
|
|
9
13
|
export { Tooltip } from './Info/Tooltips/Tooltip';
|
|
10
14
|
export { InfoTooltip } from './Info/Tooltips/InfoTooltip';
|
|
15
|
+
export { FormulaTooltip } from './Info/Tooltips/FormulaTooltip';
|
|
11
16
|
export { InfoCard } from './Info/InfoCard';
|
|
12
17
|
export { AutoComplete } from './Inputs/TextInputs/AutoComplete';
|
|
13
18
|
export { Button } from './Inputs/Buttons/Button';
|
|
14
19
|
export { UnstyledButton } from './Inputs/Buttons/UnstyledButton';
|
|
15
20
|
export { Checkbox } from './Inputs/Controls/Checkbox';
|
|
21
|
+
export { Radio } from './Inputs/Controls/Radio';
|
|
22
|
+
export { RadioList } from './Inputs/Controls/RadioList';
|
|
16
23
|
export { Toggle } from './Inputs/Controls/Toggle';
|
|
17
24
|
export { FontSelect } from './Inputs/Dropdowns/FontSelect';
|
|
18
25
|
export { MultiSelect } from './Inputs/Dropdowns/MultiSelect';
|
|
26
|
+
export { CascadingSelect } from './Inputs/Dropdowns/CascadingSelect';
|
|
19
27
|
export { SearchBar } from './Inputs/TextInputs/SearchBar';
|
|
20
28
|
export { Select } from './Inputs/Dropdowns/Select';
|
|
21
29
|
export { Slider } from './Inputs/Sliders/Slider';
|
|
@@ -23,7 +31,7 @@ export { VolumeSlider } from './Inputs/Sliders/VolumeSlider';
|
|
|
23
31
|
export { TextArea } from './Inputs/TextInputs/TextArea';
|
|
24
32
|
export { TextInput } from './Inputs/TextInputs/TextInput';
|
|
25
33
|
export { PasswordInput } from './Inputs/TextInputs/PasswordInput';
|
|
26
|
-
export { DatePicker } from './Inputs/
|
|
34
|
+
export { DatePicker } from './Inputs/Dates/DatePicker';
|
|
27
35
|
export { AutoGrid } from './Layout/AutoGrid';
|
|
28
36
|
export { Grid } from './Layout/Grid';
|
|
29
37
|
export { Box } from './Layout/Box';
|
|
@@ -40,6 +48,7 @@ export { CollapsibleText } from './Typography/CollapsibleText';
|
|
|
40
48
|
export { Text } from './Typography/Text';
|
|
41
49
|
export { Title } from './Typography/Title';
|
|
42
50
|
export { Fraction } from './Typography/Fraction';
|
|
51
|
+
export { Formula } from './Typography/Formula';
|
|
43
52
|
export { Transition } from './Misc/Transition';
|
|
44
53
|
export { IconBadge } from './Misc/IconBadge';
|
|
45
54
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"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"}
|
package/dist/components/index.js
CHANGED
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
//Data
|
|
2
2
|
export { CheckboxTable } from './Data/CheckboxTable';
|
|
3
3
|
export { Chart } from './Data/Chart';
|
|
4
|
+
export { ChartCard } from './Data/Cards/ChartCard';
|
|
4
5
|
export { PieChart } from './Data/PieChart';
|
|
6
|
+
export { PieChartCard } from './Data/Cards/PieChartCard';
|
|
5
7
|
export { RemovableItemList } from './Data/RemovableItemList';
|
|
6
|
-
export { StatsCard } from './Data/StatsCard';
|
|
8
|
+
export { StatsCard } from './Data/Cards/StatsCard';
|
|
9
|
+
export { StatsBadge } from './Data/StatsBadge';
|
|
7
10
|
//Info
|
|
8
11
|
export { Modal } from './Info/Modals/Modal';
|
|
9
12
|
export { ModalProvider } from './Info/Modals/ModalProvider';
|
|
10
13
|
export { NotificationProvider } from './Info/Notifications/NotificationProvider';
|
|
14
|
+
export { Badge } from './Info/Badge';
|
|
11
15
|
export { Tooltip } from './Info/Tooltips/Tooltip';
|
|
12
16
|
export { InfoTooltip } from './Info/Tooltips/InfoTooltip';
|
|
17
|
+
export { FormulaTooltip } from './Info/Tooltips/FormulaTooltip';
|
|
13
18
|
export { InfoCard } from './Info/InfoCard';
|
|
14
19
|
//Inputs
|
|
15
20
|
export { AutoComplete } from './Inputs/TextInputs/AutoComplete';
|
|
16
21
|
export { Button } from './Inputs/Buttons/Button';
|
|
17
22
|
export { UnstyledButton } from './Inputs/Buttons/UnstyledButton';
|
|
18
23
|
export { Checkbox } from './Inputs/Controls/Checkbox';
|
|
24
|
+
export { Radio } from './Inputs/Controls/Radio';
|
|
25
|
+
export { RadioList } from './Inputs/Controls/RadioList';
|
|
19
26
|
export { Toggle } from './Inputs/Controls/Toggle';
|
|
20
27
|
export { FontSelect } from './Inputs/Dropdowns/FontSelect';
|
|
21
28
|
export { MultiSelect } from './Inputs/Dropdowns/MultiSelect';
|
|
29
|
+
export { CascadingSelect } from './Inputs/Dropdowns/CascadingSelect';
|
|
22
30
|
export { SearchBar } from './Inputs/TextInputs/SearchBar';
|
|
23
31
|
export { Select } from './Inputs/Dropdowns/Select';
|
|
24
32
|
export { Slider } from './Inputs/Sliders/Slider';
|
|
@@ -26,7 +34,7 @@ export { VolumeSlider } from './Inputs/Sliders/VolumeSlider';
|
|
|
26
34
|
export { TextArea } from './Inputs/TextInputs/TextArea';
|
|
27
35
|
export { TextInput } from './Inputs/TextInputs/TextInput';
|
|
28
36
|
export { PasswordInput } from './Inputs/TextInputs/PasswordInput';
|
|
29
|
-
export { DatePicker } from './Inputs/
|
|
37
|
+
export { DatePicker } from './Inputs/Dates/DatePicker';
|
|
30
38
|
//Layout
|
|
31
39
|
export { AutoGrid } from './Layout/AutoGrid';
|
|
32
40
|
export { Grid } from './Layout/Grid';
|
|
@@ -45,6 +53,7 @@ export { CollapsibleText } from './Typography/CollapsibleText';
|
|
|
45
53
|
export { Text } from './Typography/Text';
|
|
46
54
|
export { Title } from './Typography/Title';
|
|
47
55
|
export { Fraction } from './Typography/Fraction';
|
|
56
|
+
export { Formula } from './Typography/Formula';
|
|
48
57
|
//Misc
|
|
49
58
|
export { Transition } from './Misc/Transition';
|
|
50
59
|
export { IconBadge } from './Misc/IconBadge';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/constants/colors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/constants/colors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI;;;;;;CAMP,CAAC;AACX,eAAO,MAAM,OAAO;;;;;;CAAO,CAAC;AAE5B,eAAO,MAAM,IAAI;;;;;;CAMP,CAAC;AACX,eAAO,MAAM,OAAO;;;;;;CAAO,CAAC;AAE5B,eAAO,MAAM,KAAK;;;;;;CAMR,CAAC;AACX,eAAO,MAAM,OAAO;;;;;;CAAQ,CAAC;AAE7B,eAAO,MAAM,MAAM;;;;;;CAMT,CAAC;AACX,eAAO,MAAM,OAAO;;;;;;CAAS,CAAC;AAE9B,eAAO,MAAM,GAAG;;;;;;CAMN,CAAC;AACX,eAAO,MAAM,KAAK;;;;;;CAAM,CAAC;AAGzB,eAAO,MAAM,MAAM;;;;CAIT,CAAC;AAEX,eAAO,MAAM,MAAM;;;;CAIT,CAAC;AAGX,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMT,CAAC;AAGX,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQb,CAAC"}
|
package/dist/constants/colors.js
CHANGED
|
@@ -49,7 +49,7 @@ export const salmon = {
|
|
|
49
49
|
100: '#FFD1C7',
|
|
50
50
|
200: '#FF806F',
|
|
51
51
|
};
|
|
52
|
-
//
|
|
52
|
+
// Primary semantic/functional color exports - for use in UI, actions, states, etc. anything that would be affected by theme changes down the line
|
|
53
53
|
export const colors = {
|
|
54
54
|
neutral,
|
|
55
55
|
primary,
|
|
@@ -57,8 +57,8 @@ export const colors = {
|
|
|
57
57
|
warning,
|
|
58
58
|
error,
|
|
59
59
|
};
|
|
60
|
-
//
|
|
61
|
-
export const
|
|
60
|
+
// Primitive color exports - for purely aesthetic purpose, i.e. icons, backgrounds, etc. anything that we want to hardcode to a specific color
|
|
61
|
+
export const primitives = {
|
|
62
62
|
blue,
|
|
63
63
|
green,
|
|
64
64
|
yellow,
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export declare const numberFormats: {
|
|
2
|
+
integer: {
|
|
3
|
+
decimalPlaces: number;
|
|
4
|
+
prefix: string;
|
|
5
|
+
suffix: string;
|
|
6
|
+
};
|
|
7
|
+
decimal: {
|
|
8
|
+
decimalPlaces: number;
|
|
9
|
+
prefix: string;
|
|
10
|
+
suffix: string;
|
|
11
|
+
};
|
|
12
|
+
currency: {
|
|
13
|
+
decimalPlaces: number;
|
|
14
|
+
prefix: string;
|
|
15
|
+
suffix: string;
|
|
16
|
+
};
|
|
17
|
+
percentage: {
|
|
18
|
+
decimalPlaces: number;
|
|
19
|
+
prefix: string;
|
|
20
|
+
suffix: string;
|
|
21
|
+
};
|
|
22
|
+
multiple: {
|
|
23
|
+
decimalPlaces: number;
|
|
24
|
+
prefix: string;
|
|
25
|
+
suffix: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export declare const formats: {
|
|
29
|
+
integer: {
|
|
30
|
+
decimalPlaces: number;
|
|
31
|
+
prefix: string;
|
|
32
|
+
suffix: string;
|
|
33
|
+
};
|
|
34
|
+
decimal: {
|
|
35
|
+
decimalPlaces: number;
|
|
36
|
+
prefix: string;
|
|
37
|
+
suffix: string;
|
|
38
|
+
};
|
|
39
|
+
currency: {
|
|
40
|
+
decimalPlaces: number;
|
|
41
|
+
prefix: string;
|
|
42
|
+
suffix: string;
|
|
43
|
+
};
|
|
44
|
+
percentage: {
|
|
45
|
+
decimalPlaces: number;
|
|
46
|
+
prefix: string;
|
|
47
|
+
suffix: string;
|
|
48
|
+
};
|
|
49
|
+
multiple: {
|
|
50
|
+
decimalPlaces: number;
|
|
51
|
+
prefix: string;
|
|
52
|
+
suffix: string;
|
|
53
|
+
};
|
|
54
|
+
string: {
|
|
55
|
+
decimalPlaces: number;
|
|
56
|
+
prefix: string;
|
|
57
|
+
suffix: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export declare const truncation: {
|
|
61
|
+
readonly thousand: {
|
|
62
|
+
readonly threshold: 1000;
|
|
63
|
+
readonly suffix: "k";
|
|
64
|
+
};
|
|
65
|
+
readonly million: {
|
|
66
|
+
readonly threshold: 1000000;
|
|
67
|
+
readonly suffix: "M";
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/constants/data.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;CAMzB,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGnB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;CAGb,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const numberFormats = {
|
|
2
|
+
integer: { decimalPlaces: 0, prefix: '', suffix: '' },
|
|
3
|
+
decimal: { decimalPlaces: 1, prefix: '', suffix: '' },
|
|
4
|
+
currency: { decimalPlaces: 2, prefix: '$', suffix: '' },
|
|
5
|
+
percentage: { decimalPlaces: 1, prefix: '', suffix: '%' },
|
|
6
|
+
multiple: { decimalPlaces: 1, prefix: '', suffix: 'x' },
|
|
7
|
+
};
|
|
8
|
+
export const formats = {
|
|
9
|
+
string: { decimalPlaces: 0, prefix: '', suffix: '' },
|
|
10
|
+
...numberFormats,
|
|
11
|
+
};
|
|
12
|
+
export const truncation = {
|
|
13
|
+
thousand: { threshold: 1000, suffix: 'k' },
|
|
14
|
+
million: { threshold: 1000000, suffix: 'M' },
|
|
15
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type OptionValue = string | number | null | undefined;
|
|
2
|
+
interface SelectOption {
|
|
3
|
+
value: OptionValue;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function findLabel<T extends SelectOption>(value: OptionValue, options: T[] | undefined | null, fallbackLabel?: string): string;
|
|
7
|
+
export declare function findOption<T extends SelectOption>(value: OptionValue, options: T[] | undefined | null): T | undefined;
|
|
8
|
+
export type { SelectOption };
|
|
9
|
+
//# sourceMappingURL=useDropdowns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDropdowns.d.ts","sourceRoot":"","sources":["../../src/hooks/useDropdowns.tsx"],"names":[],"mappings":"AAAA,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAEtD,UAAU,YAAY;IACpB,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,SAAS,GAAG,IAAI,EAAE,aAAa,GAAE,MAAW,GAAG,MAAM,CAKzI;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,SAAS,CAGrH;AAED,YAAY,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function findLabel(value, options, fallbackLabel = '') {
|
|
2
|
+
var _a;
|
|
3
|
+
if (!options || value == null)
|
|
4
|
+
return fallbackLabel;
|
|
5
|
+
const option = options.find((opt) => opt.value === value);
|
|
6
|
+
return (_a = option === null || option === void 0 ? void 0 : option.label) !== null && _a !== void 0 ? _a : fallbackLabel;
|
|
7
|
+
}
|
|
8
|
+
export function findOption(value, options) {
|
|
9
|
+
if (!options || value == null)
|
|
10
|
+
return undefined;
|
|
11
|
+
return options.find((opt) => opt.value === value);
|
|
12
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type SelectOption = {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
};
|
|
5
|
+
export type DataPoint = {
|
|
6
|
+
key: string;
|
|
7
|
+
value: string | number;
|
|
8
|
+
};
|
|
9
|
+
export type PieDataPoint = {
|
|
10
|
+
key: string;
|
|
11
|
+
value: string | number;
|
|
12
|
+
color?: string;
|
|
13
|
+
};
|
|
14
|
+
export type ChartSeries = {
|
|
15
|
+
name: string;
|
|
16
|
+
data: DataPoint[];
|
|
17
|
+
color?: string;
|
|
18
|
+
type?: 'line' | 'area' | 'bar';
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;CAChC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { formats, truncation } from '../constants/data';
|
|
2
|
+
import { DataPoint } from '../types/types';
|
|
3
|
+
interface FormatOptions {
|
|
4
|
+
truncateAt?: keyof typeof truncation;
|
|
5
|
+
decimalPlaces?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const getChartFormatter: (format: keyof typeof formats, options?: FormatOptions) => ((value: string | number) => string);
|
|
8
|
+
export declare const aggregateDataByDate: (data: DataPoint[]) => {
|
|
9
|
+
key: string;
|
|
10
|
+
value: number;
|
|
11
|
+
}[];
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=charts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"charts.d.ts","sourceRoot":"","sources":["../../src/utils/charts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAiB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,UAAU,aAAa;IACrB,UAAU,CAAC,EAAE,MAAM,OAAO,UAAU,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAeD,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM,OAAO,OAAO,EAAE,UAAU,aAAa,KAAG,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAa5H,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,MAAM,SAAS,EAAE;;;GAmBpD,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import { numberFormats, truncation } from '../constants/data';
|
|
3
|
+
const formatAndTruncate = (value, format, options) => {
|
|
4
|
+
var _a, _b;
|
|
5
|
+
const absValue = Math.abs(value);
|
|
6
|
+
const config = numberFormats[format];
|
|
7
|
+
const truncateConfig = truncation[(_a = options === null || options === void 0 ? void 0 : options.truncateAt) !== null && _a !== void 0 ? _a : 'thousand'];
|
|
8
|
+
const computedDecimalPlaces = (_b = options === null || options === void 0 ? void 0 : options.decimalPlaces) !== null && _b !== void 0 ? _b : config.decimalPlaces;
|
|
9
|
+
if (absValue >= truncateConfig.threshold) {
|
|
10
|
+
return `${config.prefix}${(value / truncateConfig.threshold).toFixed(1)}${truncateConfig.suffix}${config.suffix}`;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
return `${config.prefix}${value.toFixed(computedDecimalPlaces)}${config.suffix}`;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export const getChartFormatter = (format, options) => {
|
|
17
|
+
if (format === 'string') {
|
|
18
|
+
return (value) => String(value);
|
|
19
|
+
}
|
|
20
|
+
else if (format in numberFormats) {
|
|
21
|
+
return (value) => {
|
|
22
|
+
const numValue = typeof value === 'string' ? parseFloat(value) : value;
|
|
23
|
+
if (isNaN(numValue)) {
|
|
24
|
+
return String(value);
|
|
25
|
+
}
|
|
26
|
+
return formatAndTruncate(numValue, format, options);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
throw new Error(`Invalid format: ${format}`);
|
|
30
|
+
};
|
|
31
|
+
export const aggregateDataByDate = (data) => {
|
|
32
|
+
const dailyTotals = data.reduce((acc, item) => {
|
|
33
|
+
const date = dayjs(item.key).format('MMM DD');
|
|
34
|
+
const value = typeof item.value === 'number' ? item.value : 0;
|
|
35
|
+
if (!acc[date]) {
|
|
36
|
+
acc[date] = 0;
|
|
37
|
+
}
|
|
38
|
+
acc[date] += value;
|
|
39
|
+
return acc;
|
|
40
|
+
}, {});
|
|
41
|
+
const result = Object.keys(dailyTotals)
|
|
42
|
+
.map((date) => ({
|
|
43
|
+
key: date,
|
|
44
|
+
value: dailyTotals[date],
|
|
45
|
+
}))
|
|
46
|
+
.sort((a, b) => dayjs(a.key, 'MMM DD').valueOf() - dayjs(b.key, 'MMM DD').valueOf());
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SelectOption } from '../types';
|
|
2
|
+
export declare function getOptionLabel<T extends SelectOption>(value: string, options: T[] | undefined | null, fallbackLabel?: string): string;
|
|
3
|
+
export declare function getOptionByValue<T extends SelectOption>(value: string, options: T[] | undefined | null): T | undefined;
|
|
4
|
+
export type { SelectOption };
|
|
5
|
+
//# sourceMappingURL=select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/utils/select.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,wBAAgB,cAAc,CAAC,CAAC,SAAS,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,SAAS,GAAG,IAAI,EAAE,aAAa,GAAE,MAAW,GAAG,MAAM,CAKzI;AAED,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,SAAS,CAGtH;AAED,YAAY,EAAE,YAAY,EAAE,CAAC"}
|