@thecb/components 5.6.7 → 5.6.9
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/cb-components.cjs.js +77 -0
- package/dist/cb-components.esm.js +21135 -0
- package/dist/cb-components.umd.js +81 -0
- package/dist/index.cjs.js +133 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +133 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/layouts/Box.js +8 -2
- package/src/components/molecules/index.js +1 -0
- package/src/components/molecules/periscope-dashboard-iframe/PeriscopeDashBoardIframe.stories.js +22 -0
- package/src/components/molecules/periscope-dashboard-iframe/PeriscopeDashboardIframe.js +124 -0
- package/src/components/molecules/periscope-dashboard-iframe/PeriscopeDashboardIframe.styled.js +9 -0
- package/src/components/molecules/periscope-dashboard-iframe/index.js +3 -0
- package/src/util/general.js +17 -0
- package/src/.DS_Store +0 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/molecules/.DS_Store +0 -0
- package/src/deprecated/.DS_Store +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
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/dist/index.cjs.js
CHANGED
|
@@ -6115,6 +6115,16 @@ var checkDeniedCards = function checkDeniedCards(name) {
|
|
|
6115
6115
|
return "";
|
|
6116
6116
|
}
|
|
6117
6117
|
};
|
|
6118
|
+
/*
|
|
6119
|
+
An optional style for layout atoms that positions the atom completely off screen
|
|
6120
|
+
This will *not* be visible or accessible to sighted users
|
|
6121
|
+
Use to contain text content or a11y interactive content (skip links when not visible)
|
|
6122
|
+
that is only for users of assistive technologies (screen readers)
|
|
6123
|
+
|
|
6124
|
+
Currently implemented on the Box atom via the srOnly prop
|
|
6125
|
+
*/
|
|
6126
|
+
|
|
6127
|
+
var screenReaderOnlyStyle = "\n position: absolute;\n left: -10000px;\n top: auto;\n width: 1px;\n height: 1px;\n overflow: hidden;\n";
|
|
6118
6128
|
|
|
6119
6129
|
var general = /*#__PURE__*/Object.freeze({
|
|
6120
6130
|
__proto__: null,
|
|
@@ -6126,7 +6136,8 @@ var general = /*#__PURE__*/Object.freeze({
|
|
|
6126
6136
|
generateClickHandler: generateClickHandler,
|
|
6127
6137
|
checkCardBrand: checkCardBrand,
|
|
6128
6138
|
displayCardBrand: displayCardBrand,
|
|
6129
|
-
checkDeniedCards: checkDeniedCards
|
|
6139
|
+
checkDeniedCards: checkDeniedCards,
|
|
6140
|
+
screenReaderOnlyStyle: screenReaderOnlyStyle
|
|
6130
6141
|
});
|
|
6131
6142
|
|
|
6132
6143
|
var _excluded$1 = ["themeValues", "weight", "color", "extraStyles", "hoverStyles", "onClick", "onKeyPress", "as", "dataQa", "children"];
|
|
@@ -6269,10 +6280,13 @@ var BoxWrapper = styled__default(function (_ref) {
|
|
|
6269
6280
|
});
|
|
6270
6281
|
/* eslint-enable no-unused-vars */
|
|
6271
6282
|
|
|
6272
|
-
var _excluded$3 = ["padding", "borderSize", "borderColor", "borderRadius", "boxShadow", "background", "color", "minHeight", "width", "minWidth", "maxWidth", "borderWidthOverride", "border", "textAlign", "hoverStyles", "activeStyles", "disabledStyles", "variant", "as", "onClick", "onKeyDown", "onMouseEnter", "onMouseLeave", "onFocus", "onBlur", "onTouchEnd", "theme", "hiddenStyles", "extraStyles", "dataQa", "children"];
|
|
6283
|
+
var _excluded$3 = ["padding", "borderSize", "borderColor", "borderRadius", "boxShadow", "background", "color", "minHeight", "width", "minWidth", "maxWidth", "borderWidthOverride", "border", "textAlign", "hoverStyles", "activeStyles", "disabledStyles", "variant", "as", "onClick", "onKeyDown", "onMouseEnter", "onMouseLeave", "onFocus", "onBlur", "onTouchEnd", "theme", "hiddenStyles", "extraStyles", "srOnly", "dataQa", "children"];
|
|
6273
6284
|
/*
|
|
6274
6285
|
Box component to create generic boxes
|
|
6275
6286
|
Supply padding, border, background, and color values
|
|
6287
|
+
|
|
6288
|
+
srOnly prop enables special screen-reader style that is used to position content
|
|
6289
|
+
completely off screen (only for users of screen readers)
|
|
6276
6290
|
*/
|
|
6277
6291
|
|
|
6278
6292
|
var Box = function Box(_ref) {
|
|
@@ -6309,6 +6323,8 @@ var Box = function Box(_ref) {
|
|
|
6309
6323
|
theme = _ref.theme,
|
|
6310
6324
|
hiddenStyles = _ref.hiddenStyles,
|
|
6311
6325
|
extraStyles = _ref.extraStyles,
|
|
6326
|
+
_ref$srOnly = _ref.srOnly,
|
|
6327
|
+
srOnly = _ref$srOnly === void 0 ? false : _ref$srOnly,
|
|
6312
6328
|
dataQa = _ref.dataQa,
|
|
6313
6329
|
children = _ref.children,
|
|
6314
6330
|
rest = _objectWithoutProperties(_ref, _excluded$3);
|
|
@@ -6335,7 +6351,7 @@ var Box = function Box(_ref) {
|
|
|
6335
6351
|
onClick: onClick,
|
|
6336
6352
|
hiddenStyles: hiddenStyles,
|
|
6337
6353
|
onKeyDown: onKeyDown,
|
|
6338
|
-
extraStyles: extraStyles,
|
|
6354
|
+
extraStyles: srOnly ? "".concat(screenReaderOnlyStyle).concat(extraStyles) : extraStyles,
|
|
6339
6355
|
theme: theme,
|
|
6340
6356
|
textAlign: textAlign,
|
|
6341
6357
|
"data-qa": dataQa,
|
|
@@ -41446,6 +41462,119 @@ var WorkflowTile = function WorkflowTile(_ref) {
|
|
|
41446
41462
|
}))));
|
|
41447
41463
|
};
|
|
41448
41464
|
|
|
41465
|
+
var DashboardIframe = styled__default.iframe.withConfig({
|
|
41466
|
+
displayName: "PeriscopeDashboardIframestyled__DashboardIframe",
|
|
41467
|
+
componentId: "sc-j0cucj-0"
|
|
41468
|
+
})(["border:none;box-shadow:0 0 5px 0 ", ";display:none;"], ALTO_GREY);
|
|
41469
|
+
|
|
41470
|
+
/**
|
|
41471
|
+
* Component: PeriscopeDashboardIframe
|
|
41472
|
+
*
|
|
41473
|
+
* Used for rendering Citybase's periscope reporting dashboards in iframes.
|
|
41474
|
+
* Receives action props to trigger a request on mount for the iframe's url.
|
|
41475
|
+
* Receives a string prop if/when we receive the url result.
|
|
41476
|
+
* And receives action props to emit errors from failed iframe loading.
|
|
41477
|
+
*
|
|
41478
|
+
* The logic and api client methods to handle requests/response,
|
|
41479
|
+
* store the url, etc. should be provided from the app consuming this library.
|
|
41480
|
+
*
|
|
41481
|
+
* If the url request is pending, render a spinner.
|
|
41482
|
+
* If the url request failed, render a UI error state.
|
|
41483
|
+
**/
|
|
41484
|
+
|
|
41485
|
+
var DASHBOARD_SIZE_MESSAGE_TYPE = "dashboard_resize";
|
|
41486
|
+
var PERISCOPE_ORIGIN = "https://app.periscopedata.com";
|
|
41487
|
+
|
|
41488
|
+
var isValidMessage = function isValidMessage(message) {
|
|
41489
|
+
return message.isTrusted && message.origin === PERISCOPE_ORIGIN && message.data && message.data.event_type === DASHBOARD_SIZE_MESSAGE_TYPE;
|
|
41490
|
+
};
|
|
41491
|
+
|
|
41492
|
+
var PeriscopeDashboardIframe = function PeriscopeDashboardIframe(_ref) {
|
|
41493
|
+
var url = _ref.url,
|
|
41494
|
+
requestDashboardUrl = _ref.requestDashboardUrl,
|
|
41495
|
+
periscopeDataPending = _ref.periscopeDataPending,
|
|
41496
|
+
periscopeDataSuccess = _ref.periscopeDataSuccess,
|
|
41497
|
+
periscopeDataFailure = _ref.periscopeDataFailure,
|
|
41498
|
+
periscopeDataRequestSuccess = _ref.periscopeDataRequestSuccess,
|
|
41499
|
+
periscopeDataRequestFailure = _ref.periscopeDataRequestFailure;
|
|
41500
|
+
|
|
41501
|
+
var _useState = React.useState(0),
|
|
41502
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41503
|
+
height = _useState2[0],
|
|
41504
|
+
setHeight = _useState2[1];
|
|
41505
|
+
|
|
41506
|
+
var time = {
|
|
41507
|
+
timer: null
|
|
41508
|
+
};
|
|
41509
|
+
React.useEffect(function () {
|
|
41510
|
+
time.timer = setTimeout(function () {
|
|
41511
|
+
periscopeDataRequestFailure();
|
|
41512
|
+
}, 10000);
|
|
41513
|
+
}, []);
|
|
41514
|
+
|
|
41515
|
+
var Dashboard = function Dashboard(height) {
|
|
41516
|
+
return function (url) {
|
|
41517
|
+
return /*#__PURE__*/React__default.createElement(DashboardIframe, {
|
|
41518
|
+
src: url,
|
|
41519
|
+
width: "100%",
|
|
41520
|
+
height: height,
|
|
41521
|
+
"data-qa": "DashboardIframe",
|
|
41522
|
+
onLoad: function onLoad() {
|
|
41523
|
+
var iframe = document.querySelector("iframe");
|
|
41524
|
+
iframe.style.display = "initial";
|
|
41525
|
+
}
|
|
41526
|
+
});
|
|
41527
|
+
};
|
|
41528
|
+
};
|
|
41529
|
+
|
|
41530
|
+
var validatePeriscope = function validatePeriscope(message) {
|
|
41531
|
+
if (isValidMessage(message)) {
|
|
41532
|
+
setHeight(message.data.dashboard_height + 100);
|
|
41533
|
+
clearTimeout(time.timer);
|
|
41534
|
+
periscopeDataRequestSuccess();
|
|
41535
|
+
}
|
|
41536
|
+
};
|
|
41537
|
+
|
|
41538
|
+
React.useLayoutEffect(function () {
|
|
41539
|
+
window.addEventListener("message", validatePeriscope);
|
|
41540
|
+
requestDashboardUrl();
|
|
41541
|
+
return function () {
|
|
41542
|
+
return window.removeEventListener("message", validatePeriscope);
|
|
41543
|
+
};
|
|
41544
|
+
}, [requestDashboardUrl]);
|
|
41545
|
+
return /*#__PURE__*/React__default.createElement(React.Fragment, null, /*#__PURE__*/React__default.createElement(BoxWithShadow$1, {
|
|
41546
|
+
padding: "0",
|
|
41547
|
+
minWidth: "100%",
|
|
41548
|
+
minHeight: "592px",
|
|
41549
|
+
variant: "baseStandard",
|
|
41550
|
+
background: "#fff",
|
|
41551
|
+
borderRadius: "4px",
|
|
41552
|
+
extraStyles: "display: flex; justify-content: center; align-items: center; flex-direction: column;"
|
|
41553
|
+
}, periscopeDataPending && !periscopeDataSuccess && /*#__PURE__*/React__default.createElement(Cover, {
|
|
41554
|
+
minHeight: "100%",
|
|
41555
|
+
singleChild: true
|
|
41556
|
+
}, /*#__PURE__*/React__default.createElement(Center, {
|
|
41557
|
+
intrinsic: true
|
|
41558
|
+
}, /*#__PURE__*/React__default.createElement(Spinner$2, {
|
|
41559
|
+
size: "100"
|
|
41560
|
+
}))), periscopeDataFailure && !periscopeDataSuccess && /*#__PURE__*/React__default.createElement(Box, {
|
|
41561
|
+
padding: "64px"
|
|
41562
|
+
}, /*#__PURE__*/React__default.createElement(Center, {
|
|
41563
|
+
intrinsic: true
|
|
41564
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
41565
|
+
padding: "0 0 2rem"
|
|
41566
|
+
}, /*#__PURE__*/React__default.createElement(PeriscopeFailedIcon, null)), /*#__PURE__*/React__default.createElement(Heading$1, {
|
|
41567
|
+
variant: "h3",
|
|
41568
|
+
weight: "700"
|
|
41569
|
+
}, "Something Went Wrong"), /*#__PURE__*/React__default.createElement(Paragraph$1, {
|
|
41570
|
+
variant: "p",
|
|
41571
|
+
extraStyles: "text-align: center;"
|
|
41572
|
+
}, "There was an issue trying to load the dashboard."), /*#__PURE__*/React__default.createElement(Paragraph$1, {
|
|
41573
|
+
variant: "p",
|
|
41574
|
+
extraStyles: "text-align: center;"
|
|
41575
|
+
}, "Your organization may not have a dashboard configured."))), !periscopeDataFailure && url && Dashboard(height)(url)));
|
|
41576
|
+
};
|
|
41577
|
+
|
|
41449
41578
|
var pageBackground = "#F6F6F9";
|
|
41450
41579
|
var fallbackValues$H = {
|
|
41451
41580
|
pageBackground: pageBackground
|
|
@@ -41824,6 +41953,7 @@ exports.PaymentMethodIcon = PaymentMethodIcon$1;
|
|
|
41824
41953
|
exports.PaymentSearchIcon = PaymentSearchIcon;
|
|
41825
41954
|
exports.PaymentsIconSmall = PaymentsIconSmall$1;
|
|
41826
41955
|
exports.PendingIcon = PendingIcon;
|
|
41956
|
+
exports.PeriscopeDashboardIframe = PeriscopeDashboardIframe;
|
|
41827
41957
|
exports.PeriscopeFailedIcon = PeriscopeFailedIcon;
|
|
41828
41958
|
exports.PhoneForm = PhoneForm;
|
|
41829
41959
|
exports.Placeholder = Placeholder$1;
|