@openfin/ui-library 0.1.40-alpha.1657030820 → 0.1.40
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/README.md +7 -0
- package/dist/assets/fonts/index.d.ts +6 -0
- package/dist/assets/fonts/index.js +11 -0
- package/dist/components/controls/Button/button.js +83 -0
- package/dist/components/controls/Button/button.variants.js +124 -0
- package/dist/components/controls/Button/index.js +14 -0
- package/dist/components/controls/Toggle/index.js +13 -0
- package/dist/components/controls/Toggle/toggle.js +98 -0
- package/dist/components/elements/Badge/badge.js +41 -0
- package/dist/components/elements/Badge/index.js +13 -0
- package/dist/components/elements/Icon/icon.js +56 -0
- package/dist/components/elements/Icon/icon.variants.js +60 -0
- package/dist/components/elements/Icon/index.js +13 -0
- package/dist/{types/components → components}/elements/Icon/openfin/BellIcon.d.ts +1 -0
- package/dist/components/elements/Icon/openfin/BellIcon.js +24 -0
- package/dist/{types/components → components}/elements/Icon/openfin/BrokenLinkIcon.d.ts +1 -0
- package/dist/components/elements/Icon/openfin/BrokenLinkIcon.js +21 -0
- package/dist/{types/components → components}/elements/Icon/openfin/FilterIcon.d.ts +1 -0
- package/dist/components/elements/Icon/openfin/FilterIcon.js +20 -0
- package/dist/{types/components → components}/elements/Icon/openfin/FloppyDiskIcon.d.ts +1 -0
- package/dist/components/elements/Icon/openfin/FloppyDiskIcon.js +23 -0
- package/dist/{types/components → components}/elements/Icon/openfin/LightBulbFilledIcon.d.ts +1 -0
- package/dist/components/elements/Icon/openfin/LightBulbFilledIcon.js +21 -0
- package/dist/{types/components → components}/elements/Icon/openfin/LightBulbOutlinedIcon.d.ts +1 -0
- package/dist/components/elements/Icon/openfin/LightBulbOutlinedIcon.js +20 -0
- package/dist/{types/components → components}/elements/Icon/openfin/LockedClosedFilledIcon.d.ts +1 -0
- package/dist/components/elements/Icon/openfin/LockedClosedFilledIcon.js +23 -0
- package/dist/{types/components → components}/elements/Icon/openfin/MinimizeIcon.d.ts +1 -0
- package/dist/components/elements/Icon/openfin/MinimizeIcon.js +23 -0
- package/dist/{types/components → components}/elements/Icon/openfin/OpenFinIcon.d.ts +1 -0
- package/dist/components/elements/Icon/openfin/OpenFinIcon.js +23 -0
- package/dist/{types/components → components}/elements/Icon/openfin/WorkspaceIcon.d.ts +1 -0
- package/dist/components/elements/Icon/openfin/WorkspaceIcon.js +26 -0
- package/dist/components/elements/Icon/openfin/index.js +22 -0
- package/dist/components/elements/Loader/index.js +13 -0
- package/dist/components/elements/Loader/loader.js +25 -0
- package/dist/components/input/BaseInput/baseInput.js +94 -0
- package/dist/components/input/BaseInput/index.js +13 -0
- package/dist/components/input/Checkbox/checkbox.js +96 -0
- package/dist/components/input/Checkbox/index.js +13 -0
- package/dist/components/input/NumberInput/index.js +13 -0
- package/dist/components/input/NumberInput/numberInput.js +108 -0
- package/dist/components/input/RawInput/index.js +13 -0
- package/dist/components/input/RawInput/rawInput.js +12 -0
- package/dist/components/input/TextInput/index.js +13 -0
- package/dist/components/input/TextInput/textInput.js +10 -0
- package/dist/components/layout/Box/box.js +50 -0
- package/dist/components/layout/Box/index.js +13 -0
- package/dist/components/layout/Box/types.js +2 -0
- package/dist/components/layout/DefinitionList/definitionList.js +49 -0
- package/dist/components/layout/DefinitionList/index.js +13 -0
- package/dist/components/system/GlobalStyles/globalStyles.js +53 -0
- package/dist/components/system/GlobalStyles/index.js +13 -0
- package/dist/components/system/HOC/index.js +2 -0
- package/dist/components/system/ThemeProvider/index.js +21 -0
- package/dist/{types/components → components}/system/ThemeProvider/lib/colors.d.ts +2 -2
- package/dist/components/system/ThemeProvider/lib/colors.js +21 -0
- package/dist/components/system/ThemeProvider/lib/config.js +6 -0
- package/dist/{types/components → components}/system/ThemeProvider/lib/constants.d.ts +1 -0
- package/dist/components/system/ThemeProvider/lib/constants.js +271 -0
- package/dist/components/system/ThemeProvider/lib/createFontFaceCss.js +43 -0
- package/dist/components/system/ThemeProvider/lib/createTheme.js +43 -0
- package/dist/components/system/ThemeProvider/lib/fonts.d.js +1 -0
- package/dist/{types/components → components}/system/ThemeProvider/lib/helpers.d.ts +1 -2
- package/dist/components/system/ThemeProvider/lib/helpers.js +54 -0
- package/dist/components/system/ThemeProvider/lib/interface.js +2 -0
- package/dist/components/system/ThemeProvider/lib/mixins.js +85 -0
- package/dist/components/system/ThemeProvider/lib/palette.js +38 -0
- package/dist/components/system/ThemeProvider/lib/types.js +2 -0
- package/dist/components/system/ThemeProvider/theme/index.js +13 -0
- package/dist/components/system/ThemeProvider/theme/openfin.js +39 -0
- package/dist/components/system/ThemeProvider/themeProvider.js +20 -0
- package/dist/components/templates/ContactCard/contactCard.js +114 -0
- package/dist/components/templates/ContactCard/index.js +13 -0
- package/dist/components/templates/utils/name.js +22 -0
- package/dist/{types/components → components}/typography/Heading/heading.d.ts +24 -24
- package/dist/components/typography/Heading/heading.js +64 -0
- package/dist/components/typography/Heading/index.js +13 -0
- package/dist/components/typography/Text/index.js +13 -0
- package/dist/components/typography/Text/text.js +21 -0
- package/dist/hooks/useColorScheme.js +33 -0
- package/dist/hooks/useMediaQuery.js +39 -0
- package/dist/hooks/usePrevious.js +12 -0
- package/dist/hooks/useTheme.js +34 -0
- package/dist/{types/index.d.ts → index.d.ts} +0 -2
- package/dist/index.js +46 -0
- package/dist/{types/lib → lib}/math.d.ts +1 -5
- package/dist/lib/math.js +24 -0
- package/dist/lib/whenFin.js +13 -0
- package/dist/lib/whenFin.spec.js +39 -0
- package/dist/react-app-env.d.js +2 -0
- package/dist/{types/storybookHelpers.d.ts → storybookHelpers.d.ts} +1 -1
- package/dist/storybookHelpers.js +58 -0
- package/package.json +70 -93
- package/dist/openfin.ui.js +0 -660
- package/dist/openfin.ui.js.LICENSE.txt +0 -14
- package/dist/types/components/controls/Button/button.stories.d.ts +0 -6
- package/dist/types/components/controls/Button/button.test.d.ts +0 -1
- package/dist/types/components/controls/Toggle/toggle.stories.d.ts +0 -6
- package/dist/types/components/controls/Toggle/toggle.test.d.ts +0 -1
- package/dist/types/components/elements/Badge/badge.stories.d.ts +0 -5
- package/dist/types/components/elements/Badge/badge.test.d.ts +0 -1
- package/dist/types/components/elements/Icon/icon.stories.d.ts +0 -15
- package/dist/types/components/elements/Icon/icon.test.d.ts +0 -1
- package/dist/types/components/elements/Loader/loader.stories.d.ts +0 -6
- package/dist/types/components/elements/Loader/loader.test.d.ts +0 -1
- package/dist/types/components/elements/Scrollbar/scrollbar.stories.d.ts +0 -6
- package/dist/types/components/elements/Scrollbar/scrollbarSmall.stories.d.ts +0 -9
- package/dist/types/components/input/BaseInput/baseInput.stories.d.ts +0 -7
- package/dist/types/components/input/Checkbox/checkbox.stories.d.ts +0 -7
- package/dist/types/components/input/NumberInput/numberInput.stories.d.ts +0 -7
- package/dist/types/components/input/RadioGroup/index.d.ts +0 -1
- package/dist/types/components/input/RadioGroup/radioGroup.d.ts +0 -12
- package/dist/types/components/input/RadioGroup/radioGroup.stories.d.ts +0 -6
- package/dist/types/components/input/RadioInput/index.d.ts +0 -1
- package/dist/types/components/input/RadioInput/radioInput.d.ts +0 -11
- package/dist/types/components/input/RadioInput/radioInput.stories.d.ts +0 -7
- package/dist/types/components/input/RadioInput/radioInput.test.d.ts +0 -1
- package/dist/types/components/input/RawInput/rawInput.stories.d.ts +0 -4
- package/dist/types/components/input/TextInput/textInput.stories.d.ts +0 -7
- package/dist/types/components/input/TextInput/textInput.test.d.ts +0 -1
- package/dist/types/components/layout/Box/box.stories.d.ts +0 -6
- package/dist/types/components/layout/Box/box.test.d.ts +0 -1
- package/dist/types/components/layout/DefinitionList/definitionList.stories.d.ts +0 -5
- package/dist/types/components/layout/DefinitionList/definitionList.test.d.ts +0 -1
- package/dist/types/components/system/ThemeProvider/palette.stories.d.ts +0 -7
- package/dist/types/components/system/ThemeProvider/theme.stories.d.ts +0 -7
- package/dist/types/components/system/ThemeProvider/themeProvider.stories.d.ts +0 -10
- package/dist/types/components/templates/ContactCard/contactCard.stories.d.ts +0 -7
- package/dist/types/components/templates/ContactCard/contactCard.test.d.ts +0 -1
- package/dist/types/components/typography/Heading/heading.stories.d.ts +0 -6
- package/dist/types/components/typography/Text/text.stories.d.ts +0 -6
- package/dist/types/hooks/usePrevious.stories.d.ts +0 -6
- package/dist/types/setupTests.d.ts +0 -1
- package/dist/types/testUtils.d.ts +0 -9
- /package/dist/{types/components → components}/controls/Button/button.d.ts +0 -0
- /package/dist/{types/components → components}/controls/Button/button.variants.d.ts +0 -0
- /package/dist/{types/components → components}/controls/Button/index.d.ts +0 -0
- /package/dist/{types/components → components}/controls/Toggle/index.d.ts +0 -0
- /package/dist/{types/components → components}/controls/Toggle/toggle.d.ts +0 -0
- /package/dist/{types/components → components}/elements/Badge/badge.d.ts +0 -0
- /package/dist/{types/components → components}/elements/Badge/index.d.ts +0 -0
- /package/dist/{types/components → components}/elements/Icon/icon.d.ts +0 -0
- /package/dist/{types/components → components}/elements/Icon/icon.variants.d.ts +0 -0
- /package/dist/{types/components → components}/elements/Icon/index.d.ts +0 -0
- /package/dist/{types/components → components}/elements/Icon/openfin/index.d.ts +0 -0
- /package/dist/{types/components → components}/elements/Loader/index.d.ts +0 -0
- /package/dist/{types/components → components}/elements/Loader/loader.d.ts +0 -0
- /package/dist/{types/components → components}/input/BaseInput/baseInput.d.ts +0 -0
- /package/dist/{types/components → components}/input/BaseInput/index.d.ts +0 -0
- /package/dist/{types/components → components}/input/Checkbox/checkbox.d.ts +0 -0
- /package/dist/{types/components → components}/input/Checkbox/index.d.ts +0 -0
- /package/dist/{types/components → components}/input/NumberInput/index.d.ts +0 -0
- /package/dist/{types/components → components}/input/NumberInput/numberInput.d.ts +0 -0
- /package/dist/{types/components → components}/input/RawInput/index.d.ts +0 -0
- /package/dist/{types/components → components}/input/RawInput/rawInput.d.ts +0 -0
- /package/dist/{types/components → components}/input/TextInput/index.d.ts +0 -0
- /package/dist/{types/components → components}/input/TextInput/textInput.d.ts +0 -0
- /package/dist/{types/components → components}/layout/Box/box.d.ts +0 -0
- /package/dist/{types/components → components}/layout/Box/index.d.ts +0 -0
- /package/dist/{types/components → components}/layout/Box/types.d.ts +0 -0
- /package/dist/{types/components → components}/layout/DefinitionList/definitionList.d.ts +0 -0
- /package/dist/{types/components → components}/layout/DefinitionList/index.d.ts +0 -0
- /package/dist/{types/components → components}/system/GlobalStyles/globalStyles.d.ts +0 -0
- /package/dist/{types/components → components}/system/GlobalStyles/index.d.ts +0 -0
- /package/dist/{types/components → components}/system/HOC/index.d.ts +0 -0
- /package/dist/{types/components → components}/system/ThemeProvider/index.d.ts +0 -0
- /package/dist/{types/components → components}/system/ThemeProvider/lib/config.d.ts +0 -0
- /package/dist/{types/components → components}/system/ThemeProvider/lib/createFontFaceCss.d.ts +0 -0
- /package/dist/{types/components → components}/system/ThemeProvider/lib/createTheme.d.ts +0 -0
- /package/dist/{types/components → components}/system/ThemeProvider/lib/interface.d.ts +0 -0
- /package/dist/{types/components → components}/system/ThemeProvider/lib/mixins.d.ts +0 -0
- /package/dist/{types/components → components}/system/ThemeProvider/lib/palette.d.ts +0 -0
- /package/dist/{types/components → components}/system/ThemeProvider/lib/types.d.ts +0 -0
- /package/dist/{types/components → components}/system/ThemeProvider/theme/index.d.ts +0 -0
- /package/dist/{types/components → components}/system/ThemeProvider/theme/openfin.d.ts +0 -0
- /package/dist/{types/components → components}/system/ThemeProvider/themeProvider.d.ts +0 -0
- /package/dist/{types/components → components}/templates/ContactCard/contactCard.d.ts +0 -0
- /package/dist/{types/components → components}/templates/ContactCard/index.d.ts +0 -0
- /package/dist/{types/components → components}/templates/utils/name.d.ts +0 -0
- /package/dist/{types/components → components}/typography/Heading/index.d.ts +0 -0
- /package/dist/{types/components → components}/typography/Text/index.d.ts +0 -0
- /package/dist/{types/components → components}/typography/Text/text.d.ts +0 -0
- /package/dist/{types/hooks → hooks}/useColorScheme.d.ts +0 -0
- /package/dist/{types/hooks → hooks}/useMediaQuery.d.ts +0 -0
- /package/dist/{types/hooks → hooks}/usePrevious.d.ts +0 -0
- /package/dist/{types/hooks → hooks}/useTheme.d.ts +0 -0
- /package/dist/{types/lib → lib}/whenFin.d.ts +0 -0
- /package/dist/{types/lib → lib}/whenFin.spec.d.ts +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { DefaultTheme, StyledProps } from 'styled-components';
|
|
2
2
|
import { StatusType } from '../../HOC';
|
|
3
|
-
import { Palette } from './palette';
|
|
4
3
|
export declare type ComponentVariants = {
|
|
5
4
|
[key: string]: {
|
|
6
5
|
[key: string]: any;
|
|
@@ -29,4 +28,4 @@ export declare const getFontFaces: ({ theme }: {
|
|
|
29
28
|
* Retrive the correct palette value based on the provided status type.
|
|
30
29
|
* Falls back to optionally provided palette key, then to 'inherit'.
|
|
31
30
|
*/
|
|
32
|
-
export declare const getStatusColor: (theme: DefaultTheme, status?: StatusType, defaultKey?:
|
|
31
|
+
export declare const getStatusColor: (theme: DefaultTheme, status?: StatusType | undefined, defaultKey?: "background1" | "background2" | "background3" | "background4" | "background5" | "background6" | "brandPrimary" | "brandSecondary" | "brandPrimaryActive" | "brandPrimaryHover" | "brandPrimaryFocused" | "brandPrimaryText" | "brandSecondaryActive" | "brandSecondaryHover" | "brandSecondaryFocused" | "brandSecondaryText" | "inputBackground" | "inputColor" | "inputPlaceholder" | "inputDisabled" | "inputFocused" | "statusSuccess" | "statusWarning" | "statusCritical" | "statusActive" | "textDefault" | "textHelp" | "textInactive" | undefined) => string;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getStatusColor = exports.getFontFaces = exports.getRootCssVars = exports.getVariantCSS = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const palette_1 = require("./palette");
|
|
6
|
+
/**
|
|
7
|
+
* Get the CSS associated with a variant key
|
|
8
|
+
* @param variants -- Component variants data structure
|
|
9
|
+
* @param variantProp -- The key (enum) for looking up the variant value
|
|
10
|
+
* @todo This needs to be typed better
|
|
11
|
+
*/
|
|
12
|
+
const getVariantCSS = (variants, variantProp) => (props) => {
|
|
13
|
+
return variants[variantProp][props[variantProp]];
|
|
14
|
+
};
|
|
15
|
+
exports.getVariantCSS = getVariantCSS;
|
|
16
|
+
/**
|
|
17
|
+
* Build :root { --var } key value pairs from Palette
|
|
18
|
+
*/
|
|
19
|
+
const getRootCssVars = ({ theme }) => Object.keys(palette_1.Palette)
|
|
20
|
+
.map((key) => `--openfin-ui-${key}: ${theme.palette[key]};`)
|
|
21
|
+
.join('\n');
|
|
22
|
+
exports.getRootCssVars = getRootCssVars;
|
|
23
|
+
/**
|
|
24
|
+
* Lazy Load font-faces based on Theme Configuration
|
|
25
|
+
*/
|
|
26
|
+
const getFontFaces = ({ theme }) => {
|
|
27
|
+
switch (theme._config.fontLoading) {
|
|
28
|
+
case 'import':
|
|
29
|
+
return theme._config.fontCss;
|
|
30
|
+
case 'cdn':
|
|
31
|
+
default:
|
|
32
|
+
return constants_1.cdnFontFaceCss;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
exports.getFontFaces = getFontFaces;
|
|
36
|
+
/**
|
|
37
|
+
* Retrive the correct palette value based on the provided status type.
|
|
38
|
+
* Falls back to optionally provided palette key, then to 'inherit'.
|
|
39
|
+
*/
|
|
40
|
+
const getStatusColor = (theme, status, defaultKey) => {
|
|
41
|
+
switch (status) {
|
|
42
|
+
case 'active':
|
|
43
|
+
return theme.palette.statusActive;
|
|
44
|
+
case 'critical':
|
|
45
|
+
return theme.palette.statusCritical;
|
|
46
|
+
case 'warning':
|
|
47
|
+
return theme.palette.statusWarning;
|
|
48
|
+
case 'success':
|
|
49
|
+
return theme.palette.statusSuccess;
|
|
50
|
+
default:
|
|
51
|
+
return defaultKey ? theme.palette[defaultKey] : 'inherit';
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
exports.getStatusColor = getStatusColor;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Mixins = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const styled_components_1 = require("styled-components");
|
|
6
|
+
/**
|
|
7
|
+
* Mixins
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Prevent User Selection
|
|
11
|
+
*/
|
|
12
|
+
const noSelect = styled_components_1.css `
|
|
13
|
+
user-select: none;
|
|
14
|
+
`;
|
|
15
|
+
/**
|
|
16
|
+
* Prevent Text from Wrapping and truncate with ellipsis
|
|
17
|
+
* when it overflows the parent container
|
|
18
|
+
*/
|
|
19
|
+
const textOverflow = styled_components_1.css `
|
|
20
|
+
white-space: nowrap;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
text-overflow: ellipsis;
|
|
23
|
+
`;
|
|
24
|
+
/**
|
|
25
|
+
* Scrollbar (4px)
|
|
26
|
+
* @link https://www.figma.com/file/0Y3pKZj0tJWuleF12h5Sua/Spatial---Components?node-id=2048%3A7477
|
|
27
|
+
*/
|
|
28
|
+
const scrollbar = styled_components_1.css `
|
|
29
|
+
&::-webkit-scrollbar {
|
|
30
|
+
width: var(--scrollbarSize, ${constants_1.UnitPx.xsmall});
|
|
31
|
+
height: var(--scrollbarSize, ${constants_1.UnitPx.xsmall});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&::-webkit-scrollbar-track {
|
|
35
|
+
background: ${constants_1.Color.neutralGray};
|
|
36
|
+
border-radius: var(--scrollbarSize, ${constants_1.UnitPx.xsmall});
|
|
37
|
+
opacity: 0.8;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&::-webkit-scrollbar-thumb {
|
|
41
|
+
background: ${constants_1.Color.white};
|
|
42
|
+
width: var(--scrollbarSize, ${constants_1.UnitPx.xsmall});
|
|
43
|
+
height: var(--scrollbarSize, ${constants_1.UnitPx.xsmall});
|
|
44
|
+
border-radius: var(--scrollbarSize, ${constants_1.UnitPx.xsmall});
|
|
45
|
+
opacity: 0.8;
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
/**
|
|
49
|
+
* Scrollbar Tiny (2px)
|
|
50
|
+
* Extends the regular scrollbar
|
|
51
|
+
*/
|
|
52
|
+
const scrollbarSmall = styled_components_1.css `
|
|
53
|
+
--scrollbarSize: 2px;
|
|
54
|
+
${scrollbar};
|
|
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
|
+
`;
|
|
70
|
+
/**
|
|
71
|
+
* Mixins --
|
|
72
|
+
* Reusable utility fragments of CSS that make sense to express once (for consistency, maintainability).
|
|
73
|
+
*/
|
|
74
|
+
exports.Mixins = {
|
|
75
|
+
noSelect,
|
|
76
|
+
textOverflow,
|
|
77
|
+
scrollbar: {
|
|
78
|
+
[constants_1.Size.base]: scrollbar,
|
|
79
|
+
[constants_1.Size.small]: scrollbarSmall,
|
|
80
|
+
},
|
|
81
|
+
appRegion: {
|
|
82
|
+
drag: appRegionDrag,
|
|
83
|
+
noDrag: appRegionNoDrag,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Palette = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Theme Palette -- Canonical list of names we use to reference color values within a theme
|
|
6
|
+
*/
|
|
7
|
+
exports.Palette = {
|
|
8
|
+
background1: 'background1',
|
|
9
|
+
background2: 'background2',
|
|
10
|
+
background3: 'background3',
|
|
11
|
+
background4: 'background4',
|
|
12
|
+
background5: 'background5',
|
|
13
|
+
background6: 'background6',
|
|
14
|
+
brandPrimary: 'brandPrimary',
|
|
15
|
+
brandSecondary: 'brandSecondary',
|
|
16
|
+
// --BEGIN These are calculated during theme creation. See ./createTheme.ts
|
|
17
|
+
brandPrimaryActive: 'brandPrimaryActive',
|
|
18
|
+
brandPrimaryHover: 'brandPrimaryHover',
|
|
19
|
+
brandPrimaryFocused: 'brandPrimaryFocused',
|
|
20
|
+
brandPrimaryText: 'brandPrimaryText',
|
|
21
|
+
brandSecondaryActive: 'brandSecondaryActive',
|
|
22
|
+
brandSecondaryHover: 'brandSecondaryHover',
|
|
23
|
+
brandSecondaryFocused: 'brandSecondaryFocused',
|
|
24
|
+
brandSecondaryText: 'brandSecondaryText',
|
|
25
|
+
// --END
|
|
26
|
+
inputBackground: 'inputBackground',
|
|
27
|
+
inputColor: 'inputColor',
|
|
28
|
+
inputPlaceholder: 'inputPlaceholder',
|
|
29
|
+
inputDisabled: 'inputDisabled',
|
|
30
|
+
inputFocused: 'inputFocused',
|
|
31
|
+
statusSuccess: 'statusSuccess',
|
|
32
|
+
statusWarning: 'statusWarning',
|
|
33
|
+
statusCritical: 'statusCritical',
|
|
34
|
+
statusActive: 'statusActive',
|
|
35
|
+
textDefault: 'textDefault',
|
|
36
|
+
textHelp: 'textHelp',
|
|
37
|
+
textInactive: 'textInactive',
|
|
38
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./openfin"), exports);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenFinDarkTheme = exports.OpenFinLightTheme = void 0;
|
|
4
|
+
const palette_1 = require("../lib/palette");
|
|
5
|
+
const constants_1 = require("../lib/constants");
|
|
6
|
+
const createTheme_1 = require("../lib/createTheme");
|
|
7
|
+
const sharedPalette = {
|
|
8
|
+
// Brand
|
|
9
|
+
[palette_1.Palette.brandPrimary]: constants_1.Color.openFin,
|
|
10
|
+
// Status
|
|
11
|
+
[palette_1.Palette.statusSuccess]: constants_1.Color.functional1,
|
|
12
|
+
[palette_1.Palette.statusWarning]: constants_1.Color.functional10,
|
|
13
|
+
[palette_1.Palette.statusCritical]: constants_1.Color.functional7,
|
|
14
|
+
[palette_1.Palette.statusActive]: constants_1.Color.functional3,
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Light Theme
|
|
18
|
+
*/
|
|
19
|
+
exports.OpenFinLightTheme = createTheme_1.createTheme(Object.assign(Object.assign({}, sharedPalette), {
|
|
20
|
+
// Background levels
|
|
21
|
+
[palette_1.Palette.background1]: constants_1.Color.white, [palette_1.Palette.background2]: constants_1.Color.lightGray1, [palette_1.Palette.background3]: constants_1.Color.lightGray2, [palette_1.Palette.background4]: constants_1.Color.lightGray3, [palette_1.Palette.background5]: constants_1.Color.lightGray4, [palette_1.Palette.background6]: constants_1.Color.lightGray5,
|
|
22
|
+
// Brand
|
|
23
|
+
[palette_1.Palette.brandSecondary]: constants_1.Color.darkGray5,
|
|
24
|
+
// Inputs
|
|
25
|
+
[palette_1.Palette.inputBackground]: constants_1.Color.lightGray3, [palette_1.Palette.inputColor]: constants_1.Color.darkGray5, [palette_1.Palette.inputPlaceholder]: constants_1.Color.darkGray2, [palette_1.Palette.inputDisabled]: constants_1.Color.neutralGray, [palette_1.Palette.inputFocused]: constants_1.Color.lightGray5,
|
|
26
|
+
// Text
|
|
27
|
+
[palette_1.Palette.textDefault]: constants_1.Color.darkGray5, [palette_1.Palette.textHelp]: constants_1.Color.darkGray3, [palette_1.Palette.textInactive]: constants_1.Color.neutralGray }));
|
|
28
|
+
/**
|
|
29
|
+
* Dark Theme
|
|
30
|
+
*/
|
|
31
|
+
exports.OpenFinDarkTheme = createTheme_1.createTheme(Object.assign(Object.assign({}, sharedPalette), {
|
|
32
|
+
// Background levels
|
|
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
|
+
// Brand
|
|
35
|
+
[palette_1.Palette.brandSecondary]: constants_1.Color.darkGray2,
|
|
36
|
+
// Inputs
|
|
37
|
+
[palette_1.Palette.inputBackground]: constants_1.Color.darkGray1, [palette_1.Palette.inputColor]: constants_1.Color.white, [palette_1.Palette.inputPlaceholder]: constants_1.Color.lightGray5, [palette_1.Palette.inputDisabled]: constants_1.Color.neutralGray, [palette_1.Palette.inputFocused]: constants_1.Color.lightGray5,
|
|
38
|
+
// Text
|
|
39
|
+
[palette_1.Palette.textDefault]: constants_1.Color.white, [palette_1.Palette.textHelp]: constants_1.Color.lightGray5, [palette_1.Palette.textInactive]: constants_1.Color.neutralGray }));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThemeProvider = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const styled_components_1 = require("styled-components");
|
|
6
|
+
const useTheme_1 = require("../../../hooks/useTheme");
|
|
7
|
+
const GlobalStyles_1 = require("../GlobalStyles");
|
|
8
|
+
/**
|
|
9
|
+
* ## OpenFin ThemeProvider
|
|
10
|
+
* - Extends StyledComponents ThemeProvider
|
|
11
|
+
* - Applies built-in OpenFin themes automatically using System Preference for Color Scheme
|
|
12
|
+
* - Includes global stylesheet with typography, reset, and global css vars
|
|
13
|
+
* - Accepts Light / Dark Mode scheme override
|
|
14
|
+
* - Accepts Light / Dark Mode palette override
|
|
15
|
+
*/
|
|
16
|
+
const ThemeProvider = ({ children, themes, scheme, config, includeGlobalStyles = true, }) => {
|
|
17
|
+
const currentTheme = useTheme_1.useTheme({ themes, scheme, config });
|
|
18
|
+
return (jsx_runtime_1.jsx(styled_components_1.ThemeProvider, Object.assign({ theme: currentTheme }, { children: jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: [includeGlobalStyles && jsx_runtime_1.jsx(GlobalStyles_1.GlobalStyles, {}, void 0), children] }, void 0) }), void 0));
|
|
19
|
+
};
|
|
20
|
+
exports.ThemeProvider = ThemeProvider;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ContactCard = void 0;
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const react_1 = __importDefault(require("react"));
|
|
20
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
21
|
+
// import { getColorForName, getInitials } from '../utils/name';
|
|
22
|
+
const DefinitionList_1 = require("../../layout/DefinitionList");
|
|
23
|
+
const name_1 = require("../utils/name");
|
|
24
|
+
const ContactCard = (_a) => {
|
|
25
|
+
var { name, title, photoUrl, useInitials = false, details } = _a, rest = __rest(_a, ["name", "title", "photoUrl", "useInitials", "details"]);
|
|
26
|
+
const renderProfileImage = photoUrl || useInitials;
|
|
27
|
+
const initials = react_1.default.useMemo(() => name_1.getInitials(name), [name]);
|
|
28
|
+
const color = react_1.default.useMemo(() => name_1.getColorForName(name), [name]);
|
|
29
|
+
return (jsx_runtime_1.jsxs(Container, Object.assign({}, rest, { children: [jsx_runtime_1.jsxs(Header, { children: [renderProfileImage && (jsx_runtime_1.jsx(ProfileImage, Object.assign({ iconColor: color }, { children: photoUrl ? jsx_runtime_1.jsx(Photo, { alt: title, src: photoUrl }, void 0) : jsx_runtime_1.jsx(LetterIcon, { children: initials }, void 0) }), void 0)),
|
|
30
|
+
jsx_runtime_1.jsxs(Identity, { children: [jsx_runtime_1.jsxs(Name, { children: [" ", name, " "] }, void 0),
|
|
31
|
+
title && jsx_runtime_1.jsxs(Title, { children: [" ", title, " "] }, void 0)] }, void 0)] }, void 0),
|
|
32
|
+
jsx_runtime_1.jsx(DetailsPane, { children: details.map((list, index) => (jsx_runtime_1.jsxs(react_1.default.Fragment, { children: [jsx_runtime_1.jsx(DetailList, { definitions: list }, void 0),
|
|
33
|
+
index < details.length - 1 && jsx_runtime_1.jsx(HorizontalLine, {}, void 0)] }, `${name}-details-${index}`))) }, void 0)] }), void 0));
|
|
34
|
+
};
|
|
35
|
+
exports.ContactCard = ContactCard;
|
|
36
|
+
const Container = styled_components_1.default.div `
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
height: 100%;
|
|
40
|
+
padding: ${({ theme }) => theme.px.base};
|
|
41
|
+
`;
|
|
42
|
+
const Header = styled_components_1.default.div `
|
|
43
|
+
border-bottom: solid 1px ${({ theme }) => theme.palette.background6};
|
|
44
|
+
display: flex;
|
|
45
|
+
margin-bottom: ${({ theme }) => theme.px.base};
|
|
46
|
+
padding-bottom: ${({ theme }) => theme.px.small};
|
|
47
|
+
`;
|
|
48
|
+
const ProfileImage = styled_components_1.default.div `
|
|
49
|
+
align-items: center;
|
|
50
|
+
background-color: ${(attrs) => attrs.iconColor};
|
|
51
|
+
border-radius: ${({ theme }) => theme.px.xsmall};
|
|
52
|
+
display: flex;
|
|
53
|
+
height: ${({ theme }) => theme.iconSize.xxxlarge};
|
|
54
|
+
justify-content: center;
|
|
55
|
+
margin-right: ${({ theme }) => theme.px.small};
|
|
56
|
+
width: ${({ theme }) => theme.iconSize.xxxlarge};
|
|
57
|
+
`;
|
|
58
|
+
const LetterIcon = styled_components_1.default.span `
|
|
59
|
+
font-size: ${({ theme }) => theme.fontSize.base};
|
|
60
|
+
text-transform: uppercase;
|
|
61
|
+
`;
|
|
62
|
+
const Photo = styled_components_1.default.img `
|
|
63
|
+
border-radius: ${({ theme }) => theme.px.xsmall};
|
|
64
|
+
height: ${({ theme }) => theme.iconSize.xxxlarge};
|
|
65
|
+
object-fit: cover;
|
|
66
|
+
user-select: none;
|
|
67
|
+
width: ${({ theme }) => theme.iconSize.xxxlarge};
|
|
68
|
+
`;
|
|
69
|
+
const Identity = styled_components_1.default.div `
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
min-width: 0;
|
|
74
|
+
`;
|
|
75
|
+
const Name = styled_components_1.default.span `
|
|
76
|
+
font-size: ${({ theme }) => theme.fontSize.large};
|
|
77
|
+
line-height: ${({ theme }) => theme.px.large};
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
padding-bottom: ${({ theme }) => theme.px.xsmall};
|
|
80
|
+
text-overflow: ellipsis;
|
|
81
|
+
white-space: nowrap;
|
|
82
|
+
`;
|
|
83
|
+
const Title = styled_components_1.default.span `
|
|
84
|
+
color: ${({ theme }) => theme.palette.textHelp};
|
|
85
|
+
line-height: ${({ theme }) => theme.px.base};
|
|
86
|
+
overflow: hidden;
|
|
87
|
+
padding-bottom: 2px;
|
|
88
|
+
text-overflow: ellipsis;
|
|
89
|
+
white-space: nowrap;
|
|
90
|
+
`;
|
|
91
|
+
const DetailsPane = styled_components_1.default.div `
|
|
92
|
+
background-color: ${({ theme }) => theme.palette.background5};
|
|
93
|
+
border-radius: 2px;
|
|
94
|
+
flex: 1;
|
|
95
|
+
overflow-y: auto;
|
|
96
|
+
padding: ${({ theme }) => theme.px.small};
|
|
97
|
+
`;
|
|
98
|
+
const HorizontalLine = styled_components_1.default.div `
|
|
99
|
+
border-bottom: solid 1px ${({ theme }) => theme.palette.background6};
|
|
100
|
+
margin-bottom: ${({ theme }) => theme.px.base};
|
|
101
|
+
`;
|
|
102
|
+
const DetailList = styled_components_1.default(DefinitionList_1.DefinitionList) `
|
|
103
|
+
dt {
|
|
104
|
+
text-align: left;
|
|
105
|
+
text-transform: capitalize;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
dd {
|
|
109
|
+
overflow: hidden;
|
|
110
|
+
text-align: right;
|
|
111
|
+
text-overflow: ellipsis;
|
|
112
|
+
white-space: nowrap;
|
|
113
|
+
}
|
|
114
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./contactCard"), exports);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getColorForName = exports.getInitials = void 0;
|
|
4
|
+
const getInitials = (name) => {
|
|
5
|
+
const trimmed = name.trim();
|
|
6
|
+
const lastWordPos = trimmed.lastIndexOf(' ');
|
|
7
|
+
if (lastWordPos > -1) {
|
|
8
|
+
return [trimmed.charAt(0), trimmed.charAt(lastWordPos + 1)].join('');
|
|
9
|
+
}
|
|
10
|
+
return trimmed.slice(0, 2);
|
|
11
|
+
};
|
|
12
|
+
exports.getInitials = getInitials;
|
|
13
|
+
const colors = ['#8C61FF', '#00CC88', '#FF8FB8', '#FF976B', '#FD5E60', '#36C3FE', '#5254FB'];
|
|
14
|
+
const getColorForName = (name = '') => {
|
|
15
|
+
let total = 0;
|
|
16
|
+
for (let i = 0; i < name.length; i++) {
|
|
17
|
+
const code = name.codePointAt(i);
|
|
18
|
+
total += code;
|
|
19
|
+
}
|
|
20
|
+
return colors[total % colors.length];
|
|
21
|
+
};
|
|
22
|
+
exports.getColorForName = getColorForName;
|