@openfin/ui-library 0.1.6 → 0.1.7-alpha.1617063648
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/Button/button.d.ts +1 -1
- package/dist/components/controls/Button/button.js +3 -3
- package/dist/components/controls/Toggle/toggle.d.ts +2 -2
- package/dist/components/controls/Toggle/toggle.js +6 -3
- package/dist/components/input/TextInput/textInput.d.ts +2 -1
- package/dist/components/input/TextInput/textInput.js +2 -2
- package/dist/components/system/ThemeProvider/lib/createTheme.d.ts +1 -1
- package/dist/components/system/ThemeProvider/lib/createTheme.js +12 -6
- package/dist/components/system/ThemeProvider/themes/openfin.js +1 -1
- package/dist/storybookHelpers.js +3 -0
- package/package.json +1 -1
|
@@ -33,5 +33,5 @@ export declare const Button: FC<ButtonProps>;
|
|
|
33
33
|
*/
|
|
34
34
|
export declare const ButtonPrimary: FC<ButtonProps>;
|
|
35
35
|
export declare const ButtonSecondary: FC<ButtonProps>;
|
|
36
|
-
export declare const
|
|
36
|
+
export declare const ButtonTextOnly: FC<ButtonProps>;
|
|
37
37
|
export {};
|
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
17
|
+
exports.ButtonTextOnly = exports.ButtonSecondary = exports.ButtonPrimary = exports.Button = void 0;
|
|
18
18
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
20
20
|
const Box_1 = require("../../layout/Box");
|
|
@@ -79,5 +79,5 @@ const ButtonPrimary = (props) => (jsx_runtime_1.jsx(exports.Button, Object.assig
|
|
|
79
79
|
exports.ButtonPrimary = ButtonPrimary;
|
|
80
80
|
const ButtonSecondary = (props) => (jsx_runtime_1.jsx(exports.Button, Object.assign({}, props, { kind: "secondary" }), void 0));
|
|
81
81
|
exports.ButtonSecondary = ButtonSecondary;
|
|
82
|
-
const
|
|
83
|
-
exports.
|
|
82
|
+
const ButtonTextOnly = (props) => (jsx_runtime_1.jsx(exports.Button, Object.assign({}, props, { kind: "textOnly" }), void 0));
|
|
83
|
+
exports.ButtonTextOnly = ButtonTextOnly;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { FC, InputHTMLAttributes } from 'react';
|
|
1
|
+
import React, { FC, InputHTMLAttributes } from 'react';
|
|
2
2
|
export declare type LabelSideType = 'left' | 'right';
|
|
3
3
|
export declare type ToggleProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
4
4
|
label?: string;
|
|
5
5
|
labelSide?: LabelSideType;
|
|
6
6
|
type?: 'checkbox' | 'radio';
|
|
7
|
-
onChange?:
|
|
7
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
8
8
|
};
|
|
9
9
|
export declare const Toggle: FC<ToggleProps>;
|
|
@@ -21,12 +21,15 @@ const styled_components_1 = __importDefault(require("styled-components"));
|
|
|
21
21
|
const RawInput_1 = require("../../input/RawInput");
|
|
22
22
|
const Box_1 = require("../../layout/Box");
|
|
23
23
|
const Toggle = (_a) => {
|
|
24
|
-
var { id, label, labelSide = 'right', type = 'checkbox'
|
|
24
|
+
var { id, label, onChange, labelSide = 'right', type = 'checkbox' } = _a, inputProps = __rest(_a, ["id", "label", "onChange", "labelSide", "type"]);
|
|
25
25
|
const [isChecked, setIsChecked] = react_1.useState(inputProps.checked);
|
|
26
|
+
react_1.useEffect(() => {
|
|
27
|
+
setIsChecked(inputProps.checked);
|
|
28
|
+
}, [inputProps.checked]);
|
|
26
29
|
return (jsx_runtime_1.jsxs(ToggleContainer, Object.assign({ labelSide: labelSide }, { children: [label ? jsx_runtime_1.jsx(ToggleLabel, Object.assign({ htmlFor: id }, { children: label }), void 0) : undefined,
|
|
27
|
-
jsx_runtime_1.jsxs(InputContainer, Object.assign({ isChecked: isChecked }, { children: [jsx_runtime_1.jsx(ToggleInput, Object.assign({ id: id, type: type
|
|
30
|
+
jsx_runtime_1.jsxs(InputContainer, Object.assign({ isChecked: isChecked }, { children: [jsx_runtime_1.jsx(ToggleInput, Object.assign({}, inputProps, { id: id, type: type, onChange: (event) => {
|
|
28
31
|
setIsChecked(event.target.checked);
|
|
29
|
-
onChange(event);
|
|
32
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
30
33
|
} }), void 0),
|
|
31
34
|
jsx_runtime_1.jsx(ToggleKnob, { tabIndex: -1 }, void 0)] }), void 0)] }), void 0));
|
|
32
35
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FC, InputHTMLAttributes } from 'react';
|
|
2
|
+
import { WithStatusProps } from '../../system/HOC';
|
|
2
3
|
export declare type TextInputProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
3
4
|
message?: string;
|
|
4
5
|
label?: string;
|
|
5
6
|
};
|
|
6
|
-
export declare const TextInput: FC
|
|
7
|
+
export declare const TextInput: FC<TextInputProps & WithStatusProps>;
|
|
@@ -23,9 +23,9 @@ const Box_1 = require("../../layout/Box");
|
|
|
23
23
|
const Text_1 = require("../../typography/Text");
|
|
24
24
|
const ThemeProvider_1 = require("../../system/ThemeProvider");
|
|
25
25
|
exports.TextInput = HOC_1.withStatus((_a) => {
|
|
26
|
-
var { className, message, label, status, name } = _a,
|
|
26
|
+
var { className, message, label, status, name } = _a, inputProps = __rest(_a, ["className", "message", "label", "status", "name"]);
|
|
27
27
|
return (jsx_runtime_1.jsxs(InputContainer, Object.assign({ flexDirection: "column", alignItems: "flex-start" }, { children: [!!label && (jsx_runtime_1.jsx(InputLabel, Object.assign({ as: "label", htmlFor: name, weight: "bold" }, { children: label }), void 0)),
|
|
28
|
-
jsx_runtime_1.jsx(StyledInputField, Object.assign({ className: className, type: "text", name: name, status: status },
|
|
28
|
+
jsx_runtime_1.jsx(StyledInputField, Object.assign({ className: className, type: "text", name: name, status: status }, inputProps), void 0),
|
|
29
29
|
!!message && jsx_runtime_1.jsx(InputMessage, Object.assign({ status: status }, { children: message }), void 0)] }), void 0));
|
|
30
30
|
});
|
|
31
31
|
const InputLabel = styled_components_1.default(Text_1.Text) `
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DefaultTheme } from 'styled-components';
|
|
2
2
|
import { PaletteType } from '../lib/types';
|
|
3
3
|
/**
|
|
4
|
-
* Create a theme by accepting an incomplete theme object and deriving the remaining colors based on
|
|
4
|
+
* Create a theme by accepting an incomplete theme object and deriving the remaining colors based on button colors.
|
|
5
5
|
*
|
|
6
6
|
* @param {Partial<PaletteType>} paletteConfig The provided theme keys, whether we or the end user defined them.
|
|
7
7
|
* @returns {DefaultTheme}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createTheme = void 0;
|
|
4
|
-
const colors_1 = require("./colors");
|
|
5
4
|
const config_1 = require("../lib/config");
|
|
6
5
|
const constants_1 = require("../lib/constants");
|
|
7
|
-
const
|
|
6
|
+
const colors_1 = require("./colors");
|
|
7
|
+
const palette_1 = require("./palette");
|
|
8
8
|
const LIGHTNESS_PERCENTAGE_ACTIVE = 2;
|
|
9
9
|
const LIGHTNESS_PERCENTAGE_HOVER = 5;
|
|
10
10
|
const LIGHTNESS_PERCENTAGE_FOCUSED = 20;
|
|
@@ -22,14 +22,20 @@ const base = {
|
|
|
22
22
|
px: constants_1.UnitPx,
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Created Active, Hover, and Focused Colors derived from base color
|
|
26
|
+
*/
|
|
27
|
+
const createDerivedButtonPalette = (key, baseColor) => ({
|
|
28
|
+
[`${key}Active`]: colors_1.darkenColor(baseColor, LIGHTNESS_PERCENTAGE_ACTIVE),
|
|
29
|
+
[`${key}Hover`]: colors_1.lightenColor(baseColor, LIGHTNESS_PERCENTAGE_HOVER),
|
|
30
|
+
[`${key}Focused`]: colors_1.lightenColor(baseColor, LIGHTNESS_PERCENTAGE_FOCUSED),
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* Create a theme by accepting an incomplete theme object and deriving the remaining colors based on button colors.
|
|
26
34
|
*
|
|
27
35
|
* @param {Partial<PaletteType>} paletteConfig The provided theme keys, whether we or the end user defined them.
|
|
28
36
|
* @returns {DefaultTheme}
|
|
29
37
|
*/
|
|
30
38
|
const createTheme = (paletteConfig) => {
|
|
31
|
-
|
|
32
|
-
const brandSecondary = paletteConfig.brandSecondary;
|
|
33
|
-
return Object.assign(Object.assign({}, base), { palette: Object.assign(Object.assign({}, paletteConfig), { [palette_1.Palette.brandPrimaryActive]: colors_1.darkenColor(brandPrimary, LIGHTNESS_PERCENTAGE_ACTIVE), [palette_1.Palette.brandPrimaryHover]: colors_1.lightenColor(brandPrimary, LIGHTNESS_PERCENTAGE_HOVER), [palette_1.Palette.brandPrimaryFocused]: colors_1.lightenColor(brandPrimary, LIGHTNESS_PERCENTAGE_FOCUSED), [palette_1.Palette.brandSecondaryActive]: colors_1.darkenColor(brandSecondary, LIGHTNESS_PERCENTAGE_ACTIVE), [palette_1.Palette.brandSecondaryHover]: colors_1.lightenColor(brandSecondary, LIGHTNESS_PERCENTAGE_HOVER), [palette_1.Palette.brandSecondaryFocused]: colors_1.lightenColor(brandSecondary, LIGHTNESS_PERCENTAGE_FOCUSED) }) });
|
|
39
|
+
return Object.assign(Object.assign({}, base), { palette: Object.assign(Object.assign(Object.assign({}, paletteConfig), createDerivedButtonPalette(palette_1.Palette.brandPrimary, paletteConfig.brandPrimary)), createDerivedButtonPalette(palette_1.Palette.brandSecondary, paletteConfig.brandSecondary)) });
|
|
34
40
|
};
|
|
35
41
|
exports.createTheme = createTheme;
|
|
@@ -32,7 +32,7 @@ exports.OpenFinDarkTheme = createTheme_1.createTheme(Object.assign(Object.assign
|
|
|
32
32
|
// Background levels
|
|
33
33
|
[palette_1.Palette.background1]: constants_1.Color.darkGray6, [palette_1.Palette.background2]: constants_1.Color.darkGray5, [palette_1.Palette.background3]: constants_1.Color.darkGray4, [palette_1.Palette.background4]: constants_1.Color.darkGray3, [palette_1.Palette.background5]: constants_1.Color.darkGray2, [palette_1.Palette.background6]: constants_1.Color.darkGray1,
|
|
34
34
|
// Brand
|
|
35
|
-
[palette_1.Palette.brandSecondary]: constants_1.Color.
|
|
35
|
+
[palette_1.Palette.brandSecondary]: constants_1.Color.darkGray1,
|
|
36
36
|
// Inputs
|
|
37
37
|
[palette_1.Palette.inputBg]: constants_1.Color.darkGray1, [palette_1.Palette.inputColor]: constants_1.Color.white, [palette_1.Palette.inputPlaceholder]: constants_1.Color.lightGray4, [palette_1.Palette.inputDisabled]: constants_1.Color.neutralGray, [palette_1.Palette.inputFocused]: constants_1.Color.lightGray4,
|
|
38
38
|
// Text
|
package/dist/storybookHelpers.js
CHANGED
|
@@ -48,6 +48,9 @@ exports.SpatialLink = styled_components_1.default.a.attrs({
|
|
|
48
48
|
display: block;
|
|
49
49
|
color: ${({ theme }) => theme.palette.textDefault};
|
|
50
50
|
text-decoration: none;
|
|
51
|
+
padding: ${({ theme }) => theme.px.small};
|
|
52
|
+
border: 1px solid ${({ theme }) => theme.palette.textDefault};
|
|
53
|
+
border-radius: ${({ theme }) => theme.radius.small};
|
|
51
54
|
&:after {
|
|
52
55
|
display: block;
|
|
53
56
|
content: 'Source: Spatial';
|
package/package.json
CHANGED