@openfin/ui-library 0.1.21 → 0.1.22-alpha.1627308148

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.
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { IconProps } from '@modulz/radix-icons/dist/types';
3
+ /**
4
+ * OpenFin Icon
5
+ */
6
+ export declare const LockedClosedFilledIcon: ({ color, ...props }: IconProps) => JSX.Element;
@@ -0,0 +1,23 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.LockedClosedFilledIcon = void 0;
15
+ const jsx_runtime_1 = require("react/jsx-runtime");
16
+ /**
17
+ * OpenFin Icon
18
+ */
19
+ const LockedClosedFilledIcon = (_a) => {
20
+ var { color = 'currentColor' } = _a, props = __rest(_a, ["color"]);
21
+ return (jsx_runtime_1.jsx("svg", Object.assign({ width: "15", height: "15", viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props, { children: jsx_runtime_1.jsx("path", { d: "M5.00003 4.63623C5.00003 3.76052 5.24222 3.10561 5.64327 2.67378C6.03938 2.24727 6.64585 1.97852 7.50143 1.97852C8.35748 1.97852 8.96309 2.24673 9.35827 2.6723C9.75841 3.10321 10 3.75729 10 4.63346V6.50021H11V4.63346C11 3.57917 10.7076 2.65578 10.0911 1.99183C9.46955 1.32254 8.57586 0.978516 7.50143 0.978516C6.42678 0.978516 5.53255 1.3235 4.91052 1.99328C4.29342 2.65775 4.00003 3.58169 4.00003 4.63623V6.50021H5.00003V4.63623ZM3 6.50021C2.72386 6.50021 2.5 6.72407 2.5 7.00021V13.0002C2.5 13.2764 2.72386 13.5002 3 13.5002H12C12.2761 13.5002 12.5 13.2764 12.5 13.0002V7.00021C12.5 6.72407 12.2761 6.50021 12 6.50021H3Z", fill: color }, void 0) }), void 0));
22
+ };
23
+ exports.LockedClosedFilledIcon = LockedClosedFilledIcon;
@@ -1,3 +1,4 @@
1
1
  export * from './OpenFinIcon';
2
2
  export * from './BellIcon';
3
3
  export * from './WorkspaceIcon';
4
+ export * from './LockedClosedFilledIcon';
@@ -13,3 +13,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./OpenFinIcon"), exports);
14
14
  __exportStar(require("./BellIcon"), exports);
15
15
  __exportStar(require("./WorkspaceIcon"), exports);
16
+ __exportStar(require("./LockedClosedFilledIcon"), exports);
@@ -1,7 +1,5 @@
1
1
  import React from 'react';
2
2
  export interface DefinitionListProps extends React.HTMLAttributes<HTMLDListElement> {
3
- definitions: {
4
- [key: string]: string;
5
- };
3
+ definitions: Map<string, string>;
6
4
  }
7
5
  export declare const DefinitionList: React.FC<DefinitionListProps>;
@@ -20,19 +20,30 @@ const react_1 = __importDefault(require("react"));
20
20
  const styled_components_1 = __importDefault(require("styled-components"));
21
21
  const DefinitionList = (_a) => {
22
22
  var { definitions } = _a, rest = __rest(_a, ["definitions"]);
23
- return (jsx_runtime_1.jsx(List, Object.assign({}, rest, { children: Object.keys(definitions).map((name, index) => {
23
+ return (jsx_runtime_1.jsx(List, Object.assign({}, rest, { children: Array.from(definitions.keys()).map((name, index) => {
24
24
  return (jsx_runtime_1.jsxs(react_1.default.Fragment, { children: [jsx_runtime_1.jsx(Name, { children: name }, void 0),
25
- jsx_runtime_1.jsx(Definition, { children: definitions[name] }, void 0)] }, `${name}-${index}`));
25
+ jsx_runtime_1.jsx(Definition, { children: definitions.get(name) }, void 0)] }, `${name}-${index}`));
26
26
  }) }), void 0));
27
27
  };
28
28
  exports.DefinitionList = DefinitionList;
29
29
  const List = styled_components_1.default.dl `
30
30
  display: grid;
31
31
  grid-template-columns: 1fr 3fr;
32
- gap: ${({ theme }) => `0 ${theme.px.small}`};
32
+ gap: ${({ theme }) => `0 ${theme.px.large}`};
33
+ overflow-y: auto;
34
+ padding: ${({ theme }) => `${theme.px.small} ${theme.px.base}`};
35
+ word-break: break-word;
33
36
  `;
34
37
  const Name = styled_components_1.default.dt `
35
- font-weight: ${({ theme }) => theme.fontWeight.bold};
38
+ color: ${({ theme }) => theme.palette.textHelp};
39
+ font-size: ${({ theme }) => theme.fontSize.small};
40
+ font-weight: ${({ theme }) => theme.fontWeight.normal};
41
+ line-height: ${({ theme }) => theme.px.base};
42
+ padding-bottom: ${({ theme }) => theme.px.small};
36
43
  white-space: nowrap;
37
44
  `;
38
- const Definition = styled_components_1.default.dd ``;
45
+ const Definition = styled_components_1.default.dd `
46
+ font-size: ${({ theme }) => theme.fontSize.small};
47
+ line-height: ${({ theme }) => theme.px.base};
48
+ padding-bottom: ${({ theme }) => theme.px.small};
49
+ `;
@@ -207,6 +207,7 @@ export declare const IconSet: {
207
207
  readonly OpenFinIcon: ({ color, ...props }: import("@modulz/radix-icons/dist/types").IconProps) => JSX.Element;
208
208
  readonly BellIcon: ({ color, ...props }: import("@modulz/radix-icons/dist/types").IconProps) => JSX.Element;
209
209
  readonly WorkspaceIcon: ({ color, ...props }: import("@modulz/radix-icons/dist/types").IconProps) => JSX.Element;
210
+ readonly LockedClosedFilledIcon: ({ color, ...props }: import("@modulz/radix-icons/dist/types").IconProps) => JSX.Element;
210
211
  readonly ActivityLogIcon: ({ color, ...props }: import("@modulz/radix-icons/dist/types").IconProps) => JSX.Element;
211
212
  readonly AlignBaselineIcon: ({ color, ...props }: import("@modulz/radix-icons/dist/types").IconProps) => JSX.Element;
212
213
  readonly AlignBottomIcon: ({ color, ...props }: import("@modulz/radix-icons/dist/types").IconProps) => JSX.Element;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ export interface ContactCardProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ /**
4
+ * Name of the contact.
5
+ */
6
+ name: string;
7
+ /**
8
+ * Title of the contact.
9
+ */
10
+ title?: string;
11
+ /**
12
+ * URL for the contact's profile photo.
13
+ */
14
+ photoUrl?: string;
15
+ /**
16
+ * A flag to indicate that the contact card should display the contact's initials as profile photo if the photo url is undefined.
17
+ */
18
+ useInitials?: boolean;
19
+ /**
20
+ * An array of detail list objects that can be used for logical grouping of contact details.
21
+ */
22
+ details: Map<string, string>[];
23
+ }
24
+ export declare const ContactCard: React.FC<ContactCardProps>;
@@ -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 @@
1
+ export * from './contactCard';
@@ -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,2 @@
1
+ export declare const getInitials: (name: string) => string;
2
+ export declare const getColorForName: (name?: string) => string;
@@ -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;
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.21",
4
+ "version": "0.1.22-alpha.1627308148",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "repository": "github:openfin/ui-library",