@openfin/ui-library 0.1.3-alpha.1616720507 → 0.1.3-alpha.1616720712
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/controls/Toggle/toggle.js +3 -3
- package/dist/components/input/TextInput/textInput.js +1 -1
- package/dist/components/system/GlobalStyles/globalStyles.js +13 -10
- package/dist/components/system/ThemeProvider/lib/helpers.d.ts +6 -0
- package/dist/components/system/ThemeProvider/lib/helpers.js +9 -1
- package/dist/components/system/ThemeProvider/lib/types.d.ts +2 -1
- package/package.json +1 -1
|
@@ -49,8 +49,8 @@ const InputContainer = styled_components_1.default(Box_1.Box) `
|
|
|
49
49
|
border-radius: calc(0.5 * var(--px-toggle));
|
|
50
50
|
|
|
51
51
|
background: ${({ isChecked, theme }) => isChecked ? theme.palette.brandPrimary : theme.palette.inputBg};
|
|
52
|
-
transition: background var(--
|
|
53
|
-
border-color var(
|
|
52
|
+
transition: background var(--openfin-ui-globalTransition),
|
|
53
|
+
border-color var(---openfin-ui-globalTransition);
|
|
54
54
|
|
|
55
55
|
&:focus-within {
|
|
56
56
|
border-color: ${({ theme }) => theme.palette.inputFocused};
|
|
@@ -67,7 +67,7 @@ const ToggleKnob = styled_components_1.default.button `
|
|
|
67
67
|
background: ${({ theme }) => theme.palette.inputColor};
|
|
68
68
|
border: none;
|
|
69
69
|
outline: none;
|
|
70
|
-
transition: left var(--
|
|
70
|
+
transition: left var(--openfin-ui-globalTransition);
|
|
71
71
|
pointer-events: none; /* Allow pass-thru for native input */
|
|
72
72
|
`;
|
|
73
73
|
const ToggleInput = styled_components_1.default(RawInput_1.RawInput) `
|
|
@@ -47,7 +47,7 @@ const StyledInputField = styled_components_1.default(RawInput_1.RawInput) `
|
|
|
47
47
|
color: ${({ theme }) => theme.palette.inputColor};
|
|
48
48
|
font-size: ${({ theme }) => theme.fontSize.base};
|
|
49
49
|
padding: ${({ theme }) => `${theme.px.small} ${theme.px.base}`};
|
|
50
|
-
transition: border-color var(--
|
|
50
|
+
transition: border-color var(--openfin-ui-globalTransition);
|
|
51
51
|
|
|
52
52
|
&:focus {
|
|
53
53
|
outline: 0;
|
|
@@ -7,11 +7,14 @@ const helpers_1 = require("../ThemeProvider/lib/helpers");
|
|
|
7
7
|
exports.GlobalStyles = styled_components_1.createGlobalStyle `
|
|
8
8
|
/** -> Define Global CSS Vars */
|
|
9
9
|
:root {
|
|
10
|
-
--
|
|
11
|
-
--
|
|
12
|
-
--
|
|
13
|
-
--
|
|
14
|
-
--
|
|
10
|
+
--openfin-ui-globalBackground: ${({ theme }) => theme.palette.background1};
|
|
11
|
+
--openfin-ui-globalText: ${({ theme }) => theme.palette.textDefault};
|
|
12
|
+
--openfin-ui-globalPlaceholder: ${({ theme }) => theme.palette.inputPlaceholder};
|
|
13
|
+
--openfin-ui-globalTypography: ${constants_1.Typography.base};
|
|
14
|
+
--openfin-ui-globalTransition: ${({ theme }) => theme.transition.base};
|
|
15
|
+
|
|
16
|
+
/* Map over the palette keys and create variables out of them */
|
|
17
|
+
${helpers_1.getRootCssVars}
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
/** -> @font-face Declaration */
|
|
@@ -32,19 +35,19 @@ exports.GlobalStyles = styled_components_1.createGlobalStyle `
|
|
|
32
35
|
/** -> Apply Global Styles */
|
|
33
36
|
:root,
|
|
34
37
|
body {
|
|
35
|
-
background: var(--
|
|
36
|
-
color: var(--
|
|
37
|
-
font: var(--
|
|
38
|
+
background: var(--openfin-ui-globalBackground);
|
|
39
|
+
color: var(--openfin-ui-globalText);
|
|
40
|
+
font: var(--openfin-ui-globalTypography);
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
::placeholder {
|
|
41
|
-
color: var(--
|
|
44
|
+
color: var(--openfin-ui-globalPlaceholder);
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
/** -> Reduced Motion (Accessibility) */
|
|
45
48
|
@media (prefers-reduced-motion) {
|
|
46
49
|
:root {
|
|
47
|
-
--
|
|
50
|
+
--openfin-ui-globalTransition: ${({ theme }) => theme.transition.none};
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
`;
|
|
@@ -12,6 +12,12 @@ export declare type ComponentVariants = {
|
|
|
12
12
|
* @todo This needs to be typed better
|
|
13
13
|
*/
|
|
14
14
|
export declare const getVariantCSS: (variants: ComponentVariants, variantProp: string) => (props: StyledProps<any>) => any;
|
|
15
|
+
/**
|
|
16
|
+
* Build :root { --var } key value pairs from Palette
|
|
17
|
+
*/
|
|
18
|
+
export declare const getRootCssVars: ({ theme }: {
|
|
19
|
+
theme: DefaultTheme;
|
|
20
|
+
}) => string;
|
|
15
21
|
/**
|
|
16
22
|
* Lazy Load font-faces based on Theme Configuration
|
|
17
23
|
*/
|
|
@@ -3,9 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getStatusColor = exports.getFontFaces = exports.getVariantCSS = void 0;
|
|
6
|
+
exports.getStatusColor = exports.getFontFaces = exports.getRootCssVars = exports.getVariantCSS = void 0;
|
|
7
7
|
const font_face_base64_1 = __importDefault(require("./font-face-base64"));
|
|
8
8
|
const font_face_cdn_1 = __importDefault(require("./font-face-cdn"));
|
|
9
|
+
const palette_1 = require("./palette");
|
|
9
10
|
/**
|
|
10
11
|
* Get the CSS associated with a variant key
|
|
11
12
|
* @param variants -- Component variants data structure
|
|
@@ -16,6 +17,13 @@ const getVariantCSS = (variants, variantProp) => (props) => {
|
|
|
16
17
|
return variants[variantProp][props[variantProp]];
|
|
17
18
|
};
|
|
18
19
|
exports.getVariantCSS = getVariantCSS;
|
|
20
|
+
/**
|
|
21
|
+
* Build :root { --var } key value pairs from Palette
|
|
22
|
+
*/
|
|
23
|
+
const getRootCssVars = ({ theme }) => Object.keys(palette_1.Palette)
|
|
24
|
+
.map((key) => `--openfin-ui-${key}: ${theme.palette[key]};`)
|
|
25
|
+
.join('\n');
|
|
26
|
+
exports.getRootCssVars = getRootCssVars;
|
|
19
27
|
/**
|
|
20
28
|
* Lazy Load font-faces based on Theme Configuration
|
|
21
29
|
*/
|
|
@@ -15,11 +15,12 @@ export declare type TransitionType = keyof typeof Transition;
|
|
|
15
15
|
export declare type TypographyType = keyof typeof Typography;
|
|
16
16
|
export declare type UnitPxType = keyof typeof UnitPx;
|
|
17
17
|
export declare type UnitType = keyof typeof Unit;
|
|
18
|
-
export declare type PaletteType = Record<keyof typeof Palette, string>;
|
|
19
18
|
export declare type ThemeSet = {
|
|
20
19
|
light: DefaultTheme;
|
|
21
20
|
dark: DefaultTheme;
|
|
22
21
|
};
|
|
22
|
+
export declare type PaletteKeyType = keyof typeof Palette;
|
|
23
|
+
export declare type PaletteType = Record<keyof typeof Palette, string>;
|
|
23
24
|
export declare type ThemePaletteSet = {
|
|
24
25
|
light: {
|
|
25
26
|
palette: PaletteType;
|
package/package.json
CHANGED