@openfin/ui-library 0.1.17 → 0.1.18-alpha.1623279799

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.
@@ -6,6 +6,9 @@ export declare type BaseInputProps = InputHTMLAttributes<HTMLInputElement> & {
6
6
  renderInput?: Function;
7
7
  isFullWidth?: true;
8
8
  } & WithStatusProps;
9
+ /**
10
+ * @private This should not be exposed beyond the ui-library.
11
+ */
9
12
  export declare const BaseInput: import("react").ForwardRefExoticComponent<InputHTMLAttributes<HTMLInputElement> & {
10
13
  message?: string | undefined;
11
14
  label?: string | undefined;
@@ -21,6 +21,9 @@ const styled_components_1 = __importDefault(require("styled-components"));
21
21
  const Box_1 = require("../../layout/Box");
22
22
  const ThemeProvider_1 = require("../../system/ThemeProvider");
23
23
  const Text_1 = require("../../typography/Text");
24
+ /**
25
+ * @private This should not be exposed beyond the ui-library.
26
+ */
24
27
  exports.BaseInput = react_1.forwardRef((_a, ref) => {
25
28
  var { className, renderInput, message, label, status, name } = _a, inputProps = __rest(_a, ["className", "renderInput", "message", "label", "status", "name"]);
26
29
  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)),
@@ -18,8 +18,9 @@ export declare const Color: {
18
18
  readonly darkGray1: "#53565F";
19
19
  readonly darkGray2: "#383A40";
20
20
  readonly darkGray3: "#24262B";
21
- readonly darkGray4: "#1E1F23";
22
- readonly darkGray5: "#111214";
21
+ readonly darkGray4: "#2F3136";
22
+ readonly darkGray5: "#1E1F23";
23
+ readonly darkGray6: "#111214";
23
24
  readonly openFinDarkest: "#3D39CD";
24
25
  readonly openFinDarker: "#4642E0";
25
26
  readonly openFin: "#504CFF";
@@ -42,8 +42,9 @@ exports.Color = {
42
42
  darkGray1: '#53565F',
43
43
  darkGray2: '#383A40',
44
44
  darkGray3: '#24262B',
45
- darkGray4: '#1E1F23',
46
- darkGray5: '#111214',
45
+ darkGray4: '#2F3136',
46
+ darkGray5: '#1E1F23',
47
+ darkGray6: '#111214',
47
48
  openFinDarkest: '#3D39CD',
48
49
  openFinDarker: '#4642E0',
49
50
  openFin: '#504CFF',
@@ -30,7 +30,7 @@ exports.OpenFinLightTheme = createTheme_1.createTheme(Object.assign(Object.assig
30
30
  */
31
31
  exports.OpenFinDarkTheme = createTheme_1.createTheme(Object.assign(Object.assign({}, sharedPalette), {
32
32
  // Background levels
33
- [palette_1.Palette.background1]: constants_1.Color.darkGray5, [palette_1.Palette.background2]: constants_1.Color.darkGray4, [palette_1.Palette.background3]: constants_1.Color.darkGray3, [palette_1.Palette.background4]: constants_1.Color.darkGray2, [palette_1.Palette.background5]: constants_1.Color.darkGray1, [palette_1.Palette.background6]: constants_1.Color.neutralGray,
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
35
  [palette_1.Palette.brandSecondary]: constants_1.Color.darkGray2,
36
36
  // Inputs
package/dist/index.d.ts CHANGED
@@ -16,3 +16,4 @@ export * from './hooks/useColorScheme';
16
16
  export * from './hooks/useMediaQuery';
17
17
  export * from './hooks/usePrevious';
18
18
  export * as StoryHelpers from './storybookHelpers';
19
+ export * from './lib/whenFin';
package/dist/index.js CHANGED
@@ -41,3 +41,4 @@ __exportStar(require("./hooks/useColorScheme"), exports);
41
41
  __exportStar(require("./hooks/useMediaQuery"), exports);
42
42
  __exportStar(require("./hooks/usePrevious"), exports);
43
43
  exports.StoryHelpers = __importStar(require("./storybookHelpers"));
44
+ __exportStar(require("./lib/whenFin"), exports);
@@ -0,0 +1,6 @@
1
+ /**
2
+ * OpenFin/Non-OpenFin context expression switch.
3
+ * @param finValue Expression invoked/returned when running in the fin environment.
4
+ * @param noFinValue Expression invoked/returned when not running in the fin environment.
5
+ */
6
+ export declare function whenFin<F, N = undefined>(finValue: (() => F) | F, noFinValue?: (() => N) | N): F | N | undefined;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.whenFin = void 0;
4
+ /**
5
+ * OpenFin/Non-OpenFin context expression switch.
6
+ * @param finValue Expression invoked/returned when running in the fin environment.
7
+ * @param noFinValue Expression invoked/returned when not running in the fin environment.
8
+ */
9
+ function whenFin(finValue, noFinValue) {
10
+ const expression = typeof fin !== 'undefined' ? finValue : noFinValue;
11
+ return typeof expression === 'function' ? expression() : expression;
12
+ }
13
+ exports.whenFin = whenFin;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const whenFin_1 = require("./whenFin");
4
+ describe('whenFin', () => {
5
+ afterEach(() => {
6
+ delete global.fin;
7
+ });
8
+ describe('When `fin` is present', () => {
9
+ beforeEach(() => {
10
+ global.fin = {};
11
+ });
12
+ test('And a function provided the function is invoked', () => {
13
+ let value = 0;
14
+ whenFin_1.whenFin(() => {
15
+ value = 1;
16
+ });
17
+ expect(value).toEqual(1);
18
+ });
19
+ test('And a value provided the value is returned', () => {
20
+ const value = whenFin_1.whenFin(1, undefined);
21
+ expect(value).toEqual(1);
22
+ });
23
+ });
24
+ describe('When `fin` is not present', () => {
25
+ test('And a function provided the function is invoked', () => {
26
+ let value = 0;
27
+ whenFin_1.whenFin(() => {
28
+ value = 0;
29
+ }, () => {
30
+ value = 1;
31
+ });
32
+ expect(value).toEqual(1);
33
+ });
34
+ test('And a value provided the value is returned', () => {
35
+ const value = whenFin_1.whenFin(undefined, 1);
36
+ expect(value).toEqual(1);
37
+ });
38
+ });
39
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openfin/ui-library",
3
3
  "description": "OpenFin UI Component Library",
4
- "version": "0.1.17",
4
+ "version": "0.1.18-alpha.1623279799",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "repository": "github:openfin/ui-library",