@openfin/ui-library 0.1.8 → 0.1.9-alpha.1618538477

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.
Files changed (27) hide show
  1. package/README.md +3 -4
  2. package/dist/assets/fonts/Inter-Italic.woff2 +0 -0
  3. package/dist/assets/fonts/Inter-Regular.woff2 +0 -0
  4. package/dist/assets/fonts/Inter-SemiBold.woff2 +0 -0
  5. package/dist/assets/fonts/Inter-SemiBoldItalic.woff2 +0 -0
  6. package/dist/assets/fonts/index.d.ts +6 -0
  7. package/dist/assets/fonts/index.js +11 -0
  8. package/dist/assets/fonts/index.ts +6 -0
  9. package/dist/components/system/ThemeProvider/index.d.ts +1 -0
  10. package/dist/components/system/ThemeProvider/index.js +1 -0
  11. package/dist/components/system/ThemeProvider/lib/config.d.ts +15 -3
  12. package/dist/components/system/ThemeProvider/lib/config.js +0 -3
  13. package/dist/components/system/ThemeProvider/lib/constants.d.ts +5 -0
  14. package/dist/components/system/ThemeProvider/lib/constants.js +12 -1
  15. package/dist/components/system/ThemeProvider/lib/createFontFaceCss.d.ts +11 -0
  16. package/dist/components/system/ThemeProvider/lib/createFontFaceCss.js +43 -0
  17. package/dist/components/system/ThemeProvider/lib/fonts.d.js +1 -0
  18. package/dist/components/system/ThemeProvider/lib/helpers.js +4 -8
  19. package/dist/components/system/ThemeProvider/lib/mixins.d.ts +4 -0
  20. package/dist/components/system/ThemeProvider/lib/mixins.js +18 -0
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.js +1 -0
  23. package/package.json +19 -11
  24. package/dist/components/system/ThemeProvider/lib/font-face-base64.d.ts +0 -2
  25. package/dist/components/system/ThemeProvider/lib/font-face-base64.js +0 -71
  26. package/dist/components/system/ThemeProvider/lib/font-face-cdn.d.ts +0 -2
  27. package/dist/components/system/ThemeProvider/lib/font-face-cdn.js +0 -48
package/README.md CHANGED
@@ -104,12 +104,11 @@ yarn test
104
104
 
105
105
  ## How to Contribute
106
106
 
107
- ### 1. Enable the pre-push hook
107
+ ### 1. Git pre-push hook is handled by Husky automatically
108
108
 
109
109
  ```sh
110
- touch .git/hooks/pre-push &&
111
- printf "yarn git:pre-push" >> .git/hooks/pre-push &&
112
- chmod +x .git/hooks/pre-push
110
+ $ yarn git:pre-push
111
+ # Husky should runs this command automatically before pushing
113
112
  ```
114
113
 
115
114
  ### 2. Open a pull request 😎
@@ -0,0 +1,6 @@
1
+ export declare const Fonts: {
2
+ regular: any;
3
+ italic: any;
4
+ semiBold: any;
5
+ semiBoldItalic: any;
6
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Fonts = void 0;
7
+ const Inter_Regular_woff2_1 = __importDefault(require("./Inter-Regular.woff2"));
8
+ const Inter_Italic_woff2_1 = __importDefault(require("./Inter-Italic.woff2"));
9
+ const Inter_SemiBold_woff2_1 = __importDefault(require("./Inter-SemiBold.woff2"));
10
+ const Inter_SemiBoldItalic_woff2_1 = __importDefault(require("./Inter-SemiBoldItalic.woff2"));
11
+ exports.Fonts = { regular: Inter_Regular_woff2_1.default, italic: Inter_Italic_woff2_1.default, semiBold: Inter_SemiBold_woff2_1.default, semiBoldItalic: Inter_SemiBoldItalic_woff2_1.default };
@@ -0,0 +1,6 @@
1
+ import regular from './Inter-Regular.woff2';
2
+ import italic from './Inter-Italic.woff2';
3
+ import semiBold from './Inter-SemiBold.woff2';
4
+ import semiBoldItalic from './Inter-SemiBoldItalic.woff2';
5
+
6
+ export const Fonts = { regular, italic, semiBold, semiBoldItalic };
@@ -1,5 +1,6 @@
1
1
  export * from './lib/constants';
2
2
  export * from './lib/createTheme';
3
+ export * from './lib/createFontFaceCss';
3
4
  export * from './lib/helpers';
4
5
  export * from './lib/interface';
5
6
  export * from './lib/mixins';
@@ -12,6 +12,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./lib/constants"), exports);
14
14
  __exportStar(require("./lib/createTheme"), exports);
15
+ __exportStar(require("./lib/createFontFaceCss"), exports);
15
16
  __exportStar(require("./lib/helpers"), exports);
16
17
  __exportStar(require("./lib/interface"), exports);
17
18
  __exportStar(require("./lib/mixins"), exports);
@@ -1,7 +1,19 @@
1
+ import { FlattenSimpleInterpolation } from 'styled-components';
1
2
  /**
2
- * Configuration
3
+ * ThemeProvider Configuration
3
4
  */
4
- export declare type ConfigurationType = {
5
- fontLoading: 'cdn' | 'base64';
5
+ export declare type ConfigurationType = CDNFontConfig | ImportFontConfig;
6
+ /**
7
+ * Custom import and handling for font loading.
8
+ */
9
+ export declare type ImportFontConfig = {
10
+ fontLoading: 'import';
11
+ fontCss: FlattenSimpleInterpolation;
12
+ };
13
+ /**
14
+ * Use fonts from the Openfin CDN.
15
+ */
16
+ export declare type CDNFontConfig = {
17
+ fontLoading: 'cdn';
6
18
  };
7
19
  export declare const Configuration: ConfigurationType;
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Configuration
4
- */
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.Configuration = void 0;
7
4
  exports.Configuration = {
@@ -517,3 +517,8 @@ export declare const IconSize: {
517
517
  readonly xxlarge: "32px";
518
518
  readonly xxxlarge: "48px";
519
519
  };
520
+ /**
521
+ * @font-face --
522
+ * Generate @font-face CSS for CDN Loaded fonts
523
+ */
524
+ export declare const cdnFontFaceCss: import("styled-components").FlattenSimpleInterpolation;
@@ -19,9 +19,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
19
19
  return result;
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.IconSize = exports.IconSet = exports.Transition = exports.Typography = exports.LineHeight = exports.FontWeight = exports.FontSize = exports.FontStack = exports.Shadow = exports.Radius = exports.UnitPx = exports.Unit = exports.SizeName = exports.Size = exports.Color = void 0;
22
+ exports.cdnFontFaceCss = exports.IconSize = exports.IconSet = exports.Transition = exports.Typography = exports.LineHeight = exports.FontWeight = exports.FontSize = exports.FontStack = exports.Shadow = exports.Radius = exports.UnitPx = exports.Unit = exports.SizeName = exports.Size = exports.Color = void 0;
23
23
  const RadixIcons = __importStar(require("@modulz/radix-icons"));
24
24
  const OpenFinIcons = __importStar(require("../../../elements/Icon/openfin"));
25
+ const createFontFaceCss_1 = require("./createFontFaceCss");
25
26
  /**
26
27
  * Color --
27
28
  * Color maps names to values.
@@ -253,3 +254,13 @@ exports.IconSize = {
253
254
  [exports.Size.xxlarge]: exports.UnitPx.xxxlarge,
254
255
  [exports.Size.xxxlarge]: exports.UnitPx.xxxxlarge,
255
256
  };
257
+ /**
258
+ * @font-face --
259
+ * Generate @font-face CSS for CDN Loaded fonts
260
+ */
261
+ exports.cdnFontFaceCss = createFontFaceCss_1.createFontFaceCss({
262
+ regular: '//cdn.openfin.co/fonts/inter/Inter-Regular.woff2?v3.15',
263
+ italic: '//cdn.openfin.co/fonts/inter/Inter-Italic.woff2?v3.15',
264
+ semiBold: '//cdn.openfin.co/fonts/inter/Inter-SemiBold.woff2?v3.15',
265
+ semiBoldItalic: '//cdn.openfin.co/fonts/inter/Inter-SemiBoldItalic.woff2?v3.15',
266
+ });
@@ -0,0 +1,11 @@
1
+ import { FlattenSimpleInterpolation } from 'styled-components';
2
+ export interface ImportFonts {
3
+ regular: string;
4
+ italic: string;
5
+ semiBold: string;
6
+ semiBoldItalic: string;
7
+ }
8
+ /**
9
+ * Import global fonts using your own config.
10
+ */
11
+ export declare function createFontFaceCss(fonts: ImportFonts): FlattenSimpleInterpolation;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createFontFaceCss = void 0;
4
+ const styled_components_1 = require("styled-components");
5
+ const constants_1 = require("./constants");
6
+ /**
7
+ * Import global fonts using your own config.
8
+ */
9
+ function createFontFaceCss(fonts) {
10
+ return styled_components_1.css `
11
+ @font-face {
12
+ font-family: 'Inter';
13
+ src: url(${fonts.regular}) format('woff2');
14
+ font-weight: ${constants_1.FontWeight.normal};
15
+ font-style: normal;
16
+ font-display: swap;
17
+ }
18
+ @font-face {
19
+ font-family: 'Inter';
20
+ src: url(${fonts.italic}) format('woff2');
21
+ font-weight: ${constants_1.FontWeight.normal};
22
+ font-style: italic;
23
+ font-display: swap;
24
+ }
25
+
26
+ @font-face {
27
+ font-family: 'Inter';
28
+ src: url(${fonts.semiBold}) format('woff2');
29
+ font-weight: ${constants_1.FontWeight.bold};
30
+ font-style: normal;
31
+ font-display: swap;
32
+ }
33
+
34
+ @font-face {
35
+ font-family: 'Inter';
36
+ src: url(${fonts.semiBoldItalic}) format('woff2');
37
+ font-weight: ${constants_1.FontWeight.bold};
38
+ font-style: italic;
39
+ font-display: swap;
40
+ }
41
+ `;
42
+ }
43
+ exports.createFontFaceCss = createFontFaceCss;
@@ -0,0 +1 @@
1
+ "use strict";
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.getStatusColor = exports.getFontFaces = exports.getRootCssVars = exports.getVariantCSS = void 0;
7
- const font_face_base64_1 = __importDefault(require("./font-face-base64"));
8
- const font_face_cdn_1 = __importDefault(require("./font-face-cdn"));
4
+ const constants_1 = require("./constants");
9
5
  const palette_1 = require("./palette");
10
6
  /**
11
7
  * Get the CSS associated with a variant key
@@ -29,11 +25,11 @@ exports.getRootCssVars = getRootCssVars;
29
25
  */
30
26
  const getFontFaces = ({ theme }) => {
31
27
  switch (theme._config.fontLoading) {
32
- case 'base64':
33
- return font_face_base64_1.default;
28
+ case 'import':
29
+ return theme._config.fontCss;
34
30
  case 'cdn':
35
31
  default:
36
- return font_face_cdn_1.default;
32
+ return constants_1.cdnFontFaceCss;
37
33
  }
38
34
  };
39
35
  exports.getFontFaces = getFontFaces;
@@ -9,4 +9,8 @@ export declare const Mixins: {
9
9
  readonly base: import("styled-components").FlattenSimpleInterpolation;
10
10
  readonly small: import("styled-components").FlattenSimpleInterpolation;
11
11
  };
12
+ readonly appRegion: {
13
+ readonly drag: import("styled-components").FlattenSimpleInterpolation;
14
+ readonly noDrag: import("styled-components").FlattenSimpleInterpolation;
15
+ };
12
16
  };
@@ -53,6 +53,20 @@ const scrollbarSmall = styled_components_1.css `
53
53
  --scrollbarSize: 2px;
54
54
  ${scrollbar};
55
55
  `;
56
+ /**
57
+ * App Region Drag Behavior
58
+ * This affects what parts of the DOM can drag the OpenFin / Electron browser window
59
+ * - Apply 'Drag' to make an area behave like a drag handle
60
+ * - Apply 'NoDrag' to unset an area inside of a draggable area
61
+ *
62
+ * Note: DOM elements behaving as draggable regions typically ignore any other event handlers
63
+ */
64
+ const appRegionDrag = styled_components_1.css `
65
+ -webkit-app-region: drag;
66
+ `;
67
+ const appRegionNoDrag = styled_components_1.css `
68
+ -webkit-app-region: no-drag;
69
+ `;
56
70
  /**
57
71
  * Mixins --
58
72
  * Reusable utility fragments of CSS that make sense to express once (for consistency, maintainability).
@@ -64,4 +78,8 @@ exports.Mixins = {
64
78
  [constants_1.Size.base]: scrollbar,
65
79
  [constants_1.Size.small]: scrollbarSmall,
66
80
  },
81
+ appRegion: {
82
+ drag: appRegionDrag,
83
+ noDrag: appRegionNoDrag,
84
+ },
67
85
  };
package/dist/index.d.ts CHANGED
@@ -12,4 +12,5 @@ export * from './components/typography/Heading';
12
12
  export * from './components/typography/Text';
13
13
  export * from './hooks/useColorScheme';
14
14
  export * from './hooks/useMediaQuery';
15
+ export * from './assets/fonts';
15
16
  export * as StoryHelpers from './storybookHelpers';
package/dist/index.js CHANGED
@@ -37,4 +37,5 @@ __exportStar(require("./components/typography/Heading"), exports);
37
37
  __exportStar(require("./components/typography/Text"), exports);
38
38
  __exportStar(require("./hooks/useColorScheme"), exports);
39
39
  __exportStar(require("./hooks/useMediaQuery"), exports);
40
+ __exportStar(require("./assets/fonts"), exports);
40
41
  exports.StoryHelpers = __importStar(require("./storybookHelpers"));
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.8",
4
+ "version": "0.1.9-alpha.1618538477",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "repository": "github:openfin/ui-library",
@@ -9,6 +9,10 @@
9
9
  "files": [
10
10
  "dist/**/*"
11
11
  ],
12
+ "engines": {
13
+ "node": "14",
14
+ "yarn": "1"
15
+ },
12
16
  "license": "MIT",
13
17
  "dependencies": {
14
18
  "@modulz/radix-icons": "^4.0.0",
@@ -22,12 +26,12 @@
22
26
  "@babel/core": "^7.13.10",
23
27
  "@babel/preset-env": "^7.13.10",
24
28
  "@babel/preset-typescript": "^7.13.0",
25
- "@storybook/addon-actions": "^6.2.1",
26
- "@storybook/addon-essentials": "^6.2.1",
27
- "@storybook/addon-links": "^6.2.1",
28
- "@storybook/node-logger": "^6.2.1",
29
+ "@storybook/addon-actions": "^6.2.3",
30
+ "@storybook/addon-essentials": "^6.2.3",
31
+ "@storybook/addon-links": "^6.2.3",
32
+ "@storybook/node-logger": "^6.2.3",
29
33
  "@storybook/preset-create-react-app": "^3.1.7",
30
- "@storybook/react": "^6.2.1",
34
+ "@storybook/react": "^6.2.3",
31
35
  "@testing-library/jest-dom": "^5.11.9",
32
36
  "@testing-library/react": "^11.2.3",
33
37
  "@testing-library/user-event": "^12.6.2",
@@ -43,12 +47,14 @@
43
47
  "@typescript-eslint/eslint-plugin": "^4.17.0",
44
48
  "@typescript-eslint/parser": "^4.17.0",
45
49
  "babel-plugin-styled-components": "^1.12.0",
50
+ "cross-env": "^7.0.3",
46
51
  "eslint": "^7.21.0",
47
52
  "eslint-config-prettier": "^8.1.0",
48
53
  "eslint-plugin-jest": "^24.2.1",
49
54
  "eslint-plugin-prettier": "^3.3.1",
50
55
  "eslint-plugin-react": "^7.22.0",
51
56
  "faker": "^5.4.0",
57
+ "husky": "^6.0.0",
52
58
  "prettier": "^2.2.1",
53
59
  "react": "^17.0.1",
54
60
  "react-dom": "^17.0.1",
@@ -66,21 +72,23 @@
66
72
  },
67
73
  "scripts": {
68
74
  "start": "yarn storybook",
69
- "build": "yarn build:clean && yarn build:bundle",
75
+ "build": "yarn build:clean && yarn build:bundle && yarn build:copy",
70
76
  "build:bundle": "yarn build:scripts && yarn build:types",
71
77
  "build:clean": "rimraf dist",
78
+ "build:copy": "node scripts/copy src/assets dist/assets",
72
79
  "build:dev": "yarn build && yalc push",
73
- "build:scripts": "NODE_ENV=production babel src -d dist --extensions '.ts,.tsx'",
80
+ "build:scripts": "cross-env NODE_ENV=production babel src -d dist --extensions '.ts,.tsx'",
74
81
  "build:types": "tsc -p tsconfig.bundle.json",
75
82
  "test": "react-scripts test",
76
83
  "eject": "react-scripts eject",
77
84
  "lint": "yarn lint:typescript && yarn lint:styles",
78
- "lint:typescript": "eslint './src/**/*.{ts,tsx}'",
79
- "lint:styles": "stylelint './src/**/*.{ts,tsx}'",
85
+ "lint:typescript": "eslint \"./src/**/*.{ts,tsx}\"",
86
+ "lint:styles": "stylelint \"./src/**/*.{ts,tsx}\"",
80
87
  "storybook": "yarn storybook:cache-clear && start-storybook -p 6006 -s public",
81
88
  "storybook:build": "build-storybook -s public",
82
89
  "storybook:cache-clear": "rimraf ./node_modules/.cache/storybook",
83
- "git:pre-push": "yarn lint && yarn test --watchAll=false && yarn build"
90
+ "git:pre-push": "yarn lint && yarn test --watchAll=false && yarn build",
91
+ "prepare": "husky install"
84
92
  },
85
93
  "env": {
86
94
  "jest/globals": true
@@ -1,2 +0,0 @@
1
- declare const _default: import("styled-components").FlattenSimpleInterpolation;
2
- export default _default;