oolib 2.111.0 → 2.111.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
export interface TypoProps {
|
|
3
|
+
invert?: boolean;
|
|
4
|
+
value?: string;
|
|
5
|
+
suffix?: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
theme?: any;
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
className?: string;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
2
13
|
export declare const LABEL: React.FunctionComponent<TypoCompProps>;
|
|
3
14
|
export interface TypoCompProps {
|
|
4
15
|
[key: string]: any;
|
|
@@ -61,7 +61,7 @@ var GenComp = function (_a) {
|
|
|
61
61
|
var localize = (0, utilsOolib_1.useLocale)();
|
|
62
62
|
var invert = props.invert, value = props.value, suffix = props.suffix, color = props.color, children = props.children, theme = props.theme, style = props.style, className = props.className, restProps = __rest(props, ["invert", "value", "suffix", "color", "children", "theme", "style", "className"]);
|
|
63
63
|
var displayText = children || value;
|
|
64
|
-
var localText = localize(displayText
|
|
64
|
+
var localText = localize(displayText);
|
|
65
65
|
return (react_1.default.createElement(Comp, __assign({}, genFontStylingProps(restProps), { color: color, className: className, style: style, invert: invert }),
|
|
66
66
|
localText,
|
|
67
67
|
" ",
|
|
@@ -73,7 +73,9 @@ var SANS_0 = function (props) { return react_1.default.createElement(GenComp, {
|
|
|
73
73
|
exports.SANS_0 = SANS_0;
|
|
74
74
|
var SANS_2 = function (props) { return react_1.default.createElement(GenComp, { props: props, Comp: index_styled_1.SANS_2_STYLED }); };
|
|
75
75
|
exports.SANS_2 = SANS_2;
|
|
76
|
-
var SANS_3 = function (props) {
|
|
76
|
+
var SANS_3 = function (props) {
|
|
77
|
+
return (react_1.default.createElement(GenComp, { props: props, Comp: index_styled_1.SANS_3_STYLED }));
|
|
78
|
+
};
|
|
77
79
|
exports.SANS_3 = SANS_3;
|
|
78
80
|
var SANS_3_4 = function (props) { return react_1.default.createElement(GenComp, { props: props, Comp: index_styled_1.SANS_3_4_STYLED }); };
|
|
79
81
|
exports.SANS_3_4 = SANS_3_4;
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* These are utility functions that make certain tasks
|
|
5
5
|
* within oolib easier
|
|
6
6
|
*/
|
|
7
|
+
import { ReactNode } from 'react';
|
|
7
8
|
import { ColorsType } from '../themes/colors';
|
|
8
|
-
export declare const useLocale: () => (
|
|
9
|
+
export declare const useLocale: () => (value: ReactNode) => ReactNode;
|
|
9
10
|
export declare const getPrimaryColor10: (colors?: ColorsType) => string;
|
|
10
11
|
export declare const getPrimaryColor40: (colors?: ColorsType) => string;
|
|
11
12
|
export declare const getPrimaryColor100: (colors?: ColorsType) => string;
|
package/dist/utilsOolib/index.js
CHANGED
|
@@ -5,29 +5,33 @@
|
|
|
5
5
|
* These are utility functions that make certain tasks
|
|
6
6
|
* within oolib easier
|
|
7
7
|
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
8
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
12
|
exports.getPrimaryColorText = exports.getPrimaryColor100 = exports.getPrimaryColor40 = exports.getPrimaryColor10 = exports.useLocale = void 0;
|
|
13
|
+
var react_1 = __importDefault(require("react"));
|
|
10
14
|
var styled_components_1 = require("styled-components");
|
|
11
15
|
var colors_1 = require("../themes/colors");
|
|
12
16
|
var primaryColor10 = colors_1.colors.primaryColor10, primaryColor40 = colors_1.colors.primaryColor40, primaryColor100 = colors_1.colors.primaryColor100, primaryColorText = colors_1.colors.primaryColorText;
|
|
13
17
|
var useLocale = function () {
|
|
14
18
|
var currentTheme = (0, styled_components_1.useTheme)();
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
;
|
|
20
|
+
var localize = function (value) {
|
|
21
|
+
// Check if the value is a React component or a JavaScript object
|
|
22
|
+
if (react_1.default.isValidElement(value) || typeof value === 'object') {
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
25
|
+
// If the value is a string, attempt to localize it
|
|
26
|
+
if (typeof value === 'string') {
|
|
27
|
+
return (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.localize) ? currentTheme.localize(value) : value;
|
|
28
|
+
}
|
|
29
|
+
// If the value is a React element or another type of value, render it as-is
|
|
30
|
+
return value;
|
|
17
31
|
};
|
|
18
32
|
return localize;
|
|
19
33
|
};
|
|
20
34
|
exports.useLocale = useLocale;
|
|
21
|
-
// export const useLocale = () => {
|
|
22
|
-
// const currentTheme = useTheme();
|
|
23
|
-
// const localize = text => {
|
|
24
|
-
// console.log({ text })
|
|
25
|
-
// return currentTheme?.localize
|
|
26
|
-
// ? currentTheme.localize(text)
|
|
27
|
-
// : text
|
|
28
|
-
// }
|
|
29
|
-
// return localize
|
|
30
|
-
// }
|
|
31
35
|
var getPrimaryColor10 = function (colors) {
|
|
32
36
|
return (colors === null || colors === void 0 ? void 0 : colors.primaryColor10) || primaryColor10;
|
|
33
37
|
};
|