@thecb/components 5.6.9 → 5.7.0-beta.1
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/index.cjs.js +6979 -8243
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +6980 -8243
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -6
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/atoms/form-layouts/FormInput.js +8 -8
- package/src/components/atoms/layouts/Box.js +2 -8
- package/src/components/atoms/layouts/Cluster.js +4 -4
- package/src/components/atoms/layouts/Cluster.styled.js +4 -4
- package/src/components/atoms/nav-footer/NavFooter.stories.js +1 -1
- package/src/components/molecules/.DS_Store +0 -0
- package/src/components/molecules/index.js +0 -1
- package/src/components/molecules/tabs/Tabs.js +3 -3
- package/src/deprecated/.DS_Store +0 -0
- package/src/util/general.js +0 -17
- package/dist/cb-components.cjs.js +0 -77
- package/dist/cb-components.esm.js +0 -21135
- package/dist/cb-components.umd.js +0 -81
- package/src/components/molecules/periscope-dashboard-iframe/PeriscopeDashBoardIframe.stories.js +0 -22
- package/src/components/molecules/periscope-dashboard-iframe/PeriscopeDashboardIframe.js +0 -124
- package/src/components/molecules/periscope-dashboard-iframe/PeriscopeDashboardIframe.styled.js +0 -9
- package/src/components/molecules/periscope-dashboard-iframe/index.js +0 -3
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('styled-components')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', 'styled-components'], factory) :
|
|
4
|
-
(global = global || self, factory(global['cb-components'] = {}, global.React, global.styled));
|
|
5
|
-
}(this, (function (exports, React, styled) { 'use strict';
|
|
6
|
-
|
|
7
|
-
React = React && Object.prototype.hasOwnProperty.call(React, 'default') ? React['default'] : React;
|
|
8
|
-
styled = styled && Object.prototype.hasOwnProperty.call(styled, 'default') ? styled['default'] : styled;
|
|
9
|
-
|
|
10
|
-
function _taggedTemplateLiteral(strings, raw) {
|
|
11
|
-
if (!raw) {
|
|
12
|
-
raw = strings.slice(0);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
return Object.freeze(Object.defineProperties(strings, {
|
|
16
|
-
raw: {
|
|
17
|
-
value: Object.freeze(raw)
|
|
18
|
-
}
|
|
19
|
-
}));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/*
|
|
23
|
-
Need to add a new color? Visit http://chir.ag/projects/name-that-color to generate a color name.
|
|
24
|
-
|
|
25
|
-
Name already taken? If you can't use the existing color, then use thesaurus.com to pick a similar name
|
|
26
|
-
to the one generated by name-that-color.
|
|
27
|
-
*/
|
|
28
|
-
var PEWTER_GREY = "#DFE1E4";
|
|
29
|
-
var MARINER_BLUE = "#2E75D2";
|
|
30
|
-
|
|
31
|
-
function _templateObject2() {
|
|
32
|
-
var data = _taggedTemplateLiteral(["\n height: 16px;\n width: 16px;\n background-color: ", ";\n border-radius: 8px;\n"]);
|
|
33
|
-
|
|
34
|
-
_templateObject2 = function _templateObject2() {
|
|
35
|
-
return data;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
return data;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function _templateObject() {
|
|
42
|
-
var data = _taggedTemplateLiteral(["\n height: 24px;\n width: 24px;\n border: 1px solid\n ", ";\n border-radius: 12px;\n display: flex;\n justify-content: center;\n align-items: center;\n margin: 10px;\n min-width: 24px;\n min-height: 24px;\n"]);
|
|
43
|
-
|
|
44
|
-
_templateObject = function _templateObject() {
|
|
45
|
-
return data;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
return data;
|
|
49
|
-
}
|
|
50
|
-
var defaultTheme = {
|
|
51
|
-
theme: {
|
|
52
|
-
accentColor: MARINER_BLUE,
|
|
53
|
-
inactiveColor: PEWTER_GREY
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
var RadioButtonBorder = styled.div(_templateObject(), function (_ref) {
|
|
57
|
-
var isSelected = _ref.isSelected,
|
|
58
|
-
theme = _ref.theme;
|
|
59
|
-
return isSelected ? theme.accentColor : theme.inactiveColor;
|
|
60
|
-
});
|
|
61
|
-
RadioButtonBorder.defaultProps = defaultTheme;
|
|
62
|
-
var RadioButtonCenter = styled.div(_templateObject2(), function (_ref2) {
|
|
63
|
-
var theme = _ref2.theme;
|
|
64
|
-
return theme.accentColor;
|
|
65
|
-
});
|
|
66
|
-
RadioButtonCenter.defaultProps = defaultTheme;
|
|
67
|
-
|
|
68
|
-
var RadioButton = function RadioButton(_ref3) {
|
|
69
|
-
var isSelected = _ref3.isSelected,
|
|
70
|
-
name = _ref3.name;
|
|
71
|
-
return React.createElement(RadioButtonBorder, {
|
|
72
|
-
isSelected: isSelected,
|
|
73
|
-
name: name
|
|
74
|
-
}, isSelected && React.createElement(RadioButtonCenter, null));
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
exports.RadioButton = RadioButton;
|
|
78
|
-
|
|
79
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
80
|
-
|
|
81
|
-
})));
|
package/src/components/molecules/periscope-dashboard-iframe/PeriscopeDashBoardIframe.stories.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import PeriscopeDashboardIframe from "./PeriscopeDashboardIframe";
|
|
3
|
-
import page from "../../../../.storybook/page";
|
|
4
|
-
import { boolean } from "@storybook/addon-knobs";
|
|
5
|
-
|
|
6
|
-
export const periscopeDashboardIframe = () => (
|
|
7
|
-
<PeriscopeDashboardIframe
|
|
8
|
-
url={"www.example.com"}
|
|
9
|
-
requestDashboardUrl={() => {}}
|
|
10
|
-
periscopeDataPending={boolean("dataPending", true)}
|
|
11
|
-
periscopeDataSuccess={boolean("dataSuccess", false)}
|
|
12
|
-
periscopeDataFailure={boolean("dataFailure", false)}
|
|
13
|
-
periscopeDataRequestSuccess={boolean("requestSuccess", false)}
|
|
14
|
-
periscopeDataRequestFailure={boolean("requestFailure", false)}
|
|
15
|
-
/>
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
const story = page({
|
|
19
|
-
title: "Components|Molecules/PeriscopeDashboardIframe",
|
|
20
|
-
Component: PeriscopeDashboardIframe
|
|
21
|
-
});
|
|
22
|
-
export default story;
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import React, { useLayoutEffect, useState, useEffect, Fragment } from "react";
|
|
2
|
-
import {
|
|
3
|
-
BoxWithShadow,
|
|
4
|
-
Center,
|
|
5
|
-
Box,
|
|
6
|
-
PeriscopeFailedIcon,
|
|
7
|
-
Heading,
|
|
8
|
-
Paragraph,
|
|
9
|
-
Cover,
|
|
10
|
-
Spinner
|
|
11
|
-
} from "../../atoms";
|
|
12
|
-
import { DashboardIframe } from "./PeriscopeDashboardIframe.styled";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Component: PeriscopeDashboardIframe
|
|
16
|
-
*
|
|
17
|
-
* Used for rendering Citybase's periscope reporting dashboards in iframes.
|
|
18
|
-
* Receives action props to trigger a request on mount for the iframe's url.
|
|
19
|
-
* Receives a string prop if/when we receive the url result.
|
|
20
|
-
* And receives action props to emit errors from failed iframe loading.
|
|
21
|
-
*
|
|
22
|
-
* The logic and api client methods to handle requests/response,
|
|
23
|
-
* store the url, etc. should be provided from the app consuming this library.
|
|
24
|
-
*
|
|
25
|
-
* If the url request is pending, render a spinner.
|
|
26
|
-
* If the url request failed, render a UI error state.
|
|
27
|
-
**/
|
|
28
|
-
|
|
29
|
-
const DASHBOARD_SIZE_MESSAGE_TYPE = "dashboard_resize";
|
|
30
|
-
const PERISCOPE_ORIGIN = "https://app.periscopedata.com";
|
|
31
|
-
const isValidMessage = message =>
|
|
32
|
-
message.isTrusted &&
|
|
33
|
-
message.origin === PERISCOPE_ORIGIN &&
|
|
34
|
-
message.data &&
|
|
35
|
-
message.data.event_type === DASHBOARD_SIZE_MESSAGE_TYPE;
|
|
36
|
-
|
|
37
|
-
const PeriscopeDashboardIframe = ({
|
|
38
|
-
url,
|
|
39
|
-
requestDashboardUrl,
|
|
40
|
-
periscopeDataPending,
|
|
41
|
-
periscopeDataSuccess,
|
|
42
|
-
periscopeDataFailure,
|
|
43
|
-
periscopeDataRequestSuccess,
|
|
44
|
-
periscopeDataRequestFailure
|
|
45
|
-
}) => {
|
|
46
|
-
const [height, setHeight] = useState(0);
|
|
47
|
-
let time = { timer: null };
|
|
48
|
-
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
time.timer = setTimeout(() => {
|
|
51
|
-
periscopeDataRequestFailure();
|
|
52
|
-
}, 10000);
|
|
53
|
-
}, []);
|
|
54
|
-
|
|
55
|
-
const Dashboard = height => url => (
|
|
56
|
-
<DashboardIframe
|
|
57
|
-
src={url}
|
|
58
|
-
width="100%"
|
|
59
|
-
height={height}
|
|
60
|
-
data-qa="DashboardIframe"
|
|
61
|
-
onLoad={() => {
|
|
62
|
-
let iframe = document.querySelector("iframe");
|
|
63
|
-
iframe.style.display = "initial";
|
|
64
|
-
}}
|
|
65
|
-
/>
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
const validatePeriscope = message => {
|
|
69
|
-
if (isValidMessage(message)) {
|
|
70
|
-
setHeight(message.data.dashboard_height + 100);
|
|
71
|
-
clearTimeout(time.timer);
|
|
72
|
-
periscopeDataRequestSuccess();
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
useLayoutEffect(() => {
|
|
77
|
-
window.addEventListener("message", validatePeriscope);
|
|
78
|
-
requestDashboardUrl();
|
|
79
|
-
return () => window.removeEventListener("message", validatePeriscope);
|
|
80
|
-
}, [requestDashboardUrl]);
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<Fragment>
|
|
84
|
-
<BoxWithShadow
|
|
85
|
-
padding="0"
|
|
86
|
-
minWidth="100%"
|
|
87
|
-
minHeight="592px"
|
|
88
|
-
variant="baseStandard"
|
|
89
|
-
background="#fff"
|
|
90
|
-
borderRadius="4px"
|
|
91
|
-
extraStyles={`display: flex; justify-content: center; align-items: center; flex-direction: column;`}
|
|
92
|
-
>
|
|
93
|
-
{periscopeDataPending && !periscopeDataSuccess && (
|
|
94
|
-
<Cover minHeight="100%" singleChild>
|
|
95
|
-
<Center intrinsic>
|
|
96
|
-
<Spinner size="100" />
|
|
97
|
-
</Center>
|
|
98
|
-
</Cover>
|
|
99
|
-
)}
|
|
100
|
-
{periscopeDataFailure && !periscopeDataSuccess && (
|
|
101
|
-
<Box padding="64px">
|
|
102
|
-
<Center intrinsic>
|
|
103
|
-
<Box padding="0 0 2rem">
|
|
104
|
-
<PeriscopeFailedIcon />
|
|
105
|
-
</Box>
|
|
106
|
-
<Heading variant="h3" weight="700">
|
|
107
|
-
Something Went Wrong
|
|
108
|
-
</Heading>
|
|
109
|
-
<Paragraph variant="p" extraStyles={`text-align: center;`}>
|
|
110
|
-
There was an issue trying to load the dashboard.
|
|
111
|
-
</Paragraph>
|
|
112
|
-
<Paragraph variant="p" extraStyles={`text-align: center;`}>
|
|
113
|
-
Your organization may not have a dashboard configured.
|
|
114
|
-
</Paragraph>
|
|
115
|
-
</Center>
|
|
116
|
-
</Box>
|
|
117
|
-
)}
|
|
118
|
-
{!periscopeDataFailure && url && Dashboard(height)(url)}
|
|
119
|
-
</BoxWithShadow>
|
|
120
|
-
</Fragment>
|
|
121
|
-
);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export default PeriscopeDashboardIframe;
|