@thecb/components 6.0.8 → 6.0.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/index.cjs.js +36 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +36 -10
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/dropdown/Dropdown.js +2 -0
- package/src/components/atoms/form-layouts/FormInput.js +14 -4
- package/src/components/atoms/form-select/FormSelect.js +8 -2
- package/src/components/molecules/periscope-dashboard-iframe/PeriscopeDashboardIframe.js +5 -2
- package/src/util/general.js +13 -0
package/dist/index.esm.js
CHANGED
|
@@ -6066,6 +6066,18 @@ var createUniqueId = function createUniqueId() {
|
|
|
6066
6066
|
return "_" + Math.random().toString(36).substr(2, 9);
|
|
6067
6067
|
};
|
|
6068
6068
|
|
|
6069
|
+
var createIdFromString = function createIdFromString(text, postscript) {
|
|
6070
|
+
var unique = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
6071
|
+
|
|
6072
|
+
if (text === undefined) {
|
|
6073
|
+
return createUniqueId();
|
|
6074
|
+
} else {
|
|
6075
|
+
// "first name", undefined, false -> "first-name"
|
|
6076
|
+
// "email address", "error message", false -> "email-address-error-message"
|
|
6077
|
+
// "shopping cart", "order item", true -> "shopping-cart-order-item_2ahtlz608"
|
|
6078
|
+
return "".concat(text === null || text === void 0 ? void 0 : text.replace(/\s+/g, "-")).concat(postscript ? "-".concat(postscript === null || postscript === void 0 ? void 0 : postscript.replace(/\s+/g, "-")) : "").concat(unique ? createUniqueId() : "");
|
|
6079
|
+
}
|
|
6080
|
+
};
|
|
6069
6081
|
var safeChildren = function safeChildren(children) {
|
|
6070
6082
|
var replacement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
6071
6083
|
var unsafeValues = [false, undefined, NaN, null];
|
|
@@ -6148,6 +6160,7 @@ var general = /*#__PURE__*/Object.freeze({
|
|
|
6148
6160
|
displayCurrency: displayCurrency,
|
|
6149
6161
|
convertCentsToMoneyInt: convertCentsToMoneyInt,
|
|
6150
6162
|
formatPercent: formatPercent,
|
|
6163
|
+
createIdFromString: createIdFromString,
|
|
6151
6164
|
safeChildren: safeChildren,
|
|
6152
6165
|
generateClickHandler: generateClickHandler,
|
|
6153
6166
|
checkCardBrand: checkCardBrand,
|
|
@@ -20712,6 +20725,7 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
20712
20725
|
_ref8$autoEraseTypeAh = _ref8.autoEraseTypeAhead,
|
|
20713
20726
|
autoEraseTypeAhead = _ref8$autoEraseTypeAh === void 0 ? true : _ref8$autoEraseTypeAh,
|
|
20714
20727
|
ariaLabelledby = _ref8.ariaLabelledby,
|
|
20728
|
+
ariaDescribedby = _ref8.ariaDescribedby,
|
|
20715
20729
|
_ref8$autocompleteVal = _ref8.autocompleteValue,
|
|
20716
20730
|
autocompleteValue = _ref8$autocompleteVal === void 0 ? "" : _ref8$autocompleteVal,
|
|
20717
20731
|
_ref8$smoothScroll = _ref8.smoothScroll,
|
|
@@ -20961,6 +20975,7 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
20961
20975
|
"aria-owns": "".concat(ariaLabelledby, "_listbox"),
|
|
20962
20976
|
"aria-haspopup": "listbox",
|
|
20963
20977
|
"aria-labelledby": ariaLabelledby,
|
|
20978
|
+
"aria-describedby": ariaDescribedby,
|
|
20964
20979
|
"aria-expanded": isOpen,
|
|
20965
20980
|
autocomplete: autocompleteValue,
|
|
20966
20981
|
background: isOpen ? themeValues.hoverColor : WHITE,
|
|
@@ -21177,9 +21192,10 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
21177
21192
|
color: themeValues.labelColor,
|
|
21178
21193
|
weight: themeValues.fontWeight,
|
|
21179
21194
|
extraStyles: "word-break: break-word;\n font-family: Public Sans;\n &::first-letter {\n text-transform: uppercase;\n }",
|
|
21180
|
-
id: labelTextWhenNoError
|
|
21195
|
+
id: createIdFromString(labelTextWhenNoError)
|
|
21181
21196
|
}, labelTextWhenNoError))), /*#__PURE__*/React.createElement(Dropdown$1, {
|
|
21182
|
-
ariaLabelledby: labelTextWhenNoError
|
|
21197
|
+
ariaLabelledby: createIdFromString(labelTextWhenNoError),
|
|
21198
|
+
ariaDescribedby: createIdFromString(labelTextWhenNoError, "error message"),
|
|
21183
21199
|
maxHeight: dropdownMaxHeight,
|
|
21184
21200
|
hasTitles: hasTitles,
|
|
21185
21201
|
placeholder: options[0] ? options[0].text : "",
|
|
@@ -21206,7 +21222,8 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
21206
21222
|
color: ERROR_COLOR,
|
|
21207
21223
|
variant: "pXS",
|
|
21208
21224
|
weight: themeValues.fontWeight,
|
|
21209
|
-
extraStyles: "word-break: break-word;\n font-family: Public Sans;\n &::first-letter {\n text-transform: uppercase;\n }"
|
|
21225
|
+
extraStyles: "word-break: break-word;\n font-family: Public Sans;\n &::first-letter {\n text-transform: uppercase;\n }",
|
|
21226
|
+
id: createIdFromString(labelTextWhenNoError, "error message")
|
|
21210
21227
|
}, errorMessages[field.errors[0]]) : /*#__PURE__*/React.createElement(Text$1, {
|
|
21211
21228
|
extraStyles: "height: ".concat(themeValues.lineHeight, ";")
|
|
21212
21229
|
})));
|
|
@@ -22629,7 +22646,7 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22629
22646
|
variant: "pS",
|
|
22630
22647
|
weight: themeValues.fontWeight,
|
|
22631
22648
|
extraStyles: "word-break: break-word;\n font-family: Public Sans;\n &::first-letter {\n text-transform: uppercase;\n }",
|
|
22632
|
-
id: labelTextWhenNoError
|
|
22649
|
+
id: createIdFromString(labelTextWhenNoError)
|
|
22633
22650
|
}, labelTextWhenNoError), /*#__PURE__*/React.createElement(Text$1, {
|
|
22634
22651
|
color: themeValues.linkColor,
|
|
22635
22652
|
variant: "pS",
|
|
@@ -22646,7 +22663,7 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22646
22663
|
variant: "pS",
|
|
22647
22664
|
fontWeight: themeValues.fontWeight,
|
|
22648
22665
|
extraStyles: "word-break: break-word;\n font-family: Public Sans;\n &::first-letter {\n text-transform: uppercase;\n }",
|
|
22649
|
-
id: labelTextWhenNoError
|
|
22666
|
+
id: createIdFromString(labelTextWhenNoError)
|
|
22650
22667
|
}, labelTextWhenNoError), type === "password" && /*#__PURE__*/React.createElement(Text$1, {
|
|
22651
22668
|
variant: "pS",
|
|
22652
22669
|
color: themeValues.linkColor,
|
|
@@ -22666,7 +22683,8 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22666
22683
|
}, decorator)))), /*#__PURE__*/React.createElement(Box, {
|
|
22667
22684
|
padding: "0"
|
|
22668
22685
|
}, formatter ? /*#__PURE__*/React.createElement(FormattedInputField, _extends({
|
|
22669
|
-
"aria-labelledby": labelTextWhenNoError
|
|
22686
|
+
"aria-labelledby": createIdFromString(labelTextWhenNoError),
|
|
22687
|
+
"aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
|
|
22670
22688
|
onChange: function onChange(e) {
|
|
22671
22689
|
return fieldActions.set(e);
|
|
22672
22690
|
},
|
|
@@ -22682,7 +22700,8 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22682
22700
|
$customHeight: customHeight,
|
|
22683
22701
|
$extraStyles: extraStyles
|
|
22684
22702
|
}, props)) : /*#__PURE__*/React.createElement(InputField, _extends({
|
|
22685
|
-
"aria-labelledby": labelTextWhenNoError
|
|
22703
|
+
"aria-labelledby": createIdFromString(labelTextWhenNoError),
|
|
22704
|
+
"aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
|
|
22686
22705
|
onChange: function onChange(e) {
|
|
22687
22706
|
return fieldActions.set(e.target.value);
|
|
22688
22707
|
},
|
|
@@ -22704,7 +22723,8 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22704
22723
|
color: ERROR_COLOR,
|
|
22705
22724
|
variant: "pXS",
|
|
22706
22725
|
weight: themeValues.fontWeight,
|
|
22707
|
-
extraStyles: "word-break: break-word;\n font-family: Public Sans;\n &::first-letter {\n text-transform: uppercase;\n }"
|
|
22726
|
+
extraStyles: "word-break: break-word;\n font-family: Public Sans;\n &::first-letter {\n text-transform: uppercase;\n }",
|
|
22727
|
+
id: createIdFromString(labelTextWhenNoError, "error message")
|
|
22708
22728
|
}, errorMessages[field.errors[0]]) : /*#__PURE__*/React.createElement(Text$1, {
|
|
22709
22729
|
extraStyles: "height: ".concat(themeValues.lineHeight, ";")
|
|
22710
22730
|
}), !isMobile && decorator && /*#__PURE__*/React.createElement(Box, {
|
|
@@ -43289,6 +43309,9 @@ var PeriscopeDashboardIframe = function PeriscopeDashboardIframe(_ref) {
|
|
|
43289
43309
|
time.timer = setTimeout(function () {
|
|
43290
43310
|
periscopeDataRequestFailure();
|
|
43291
43311
|
}, 10000);
|
|
43312
|
+
return function () {
|
|
43313
|
+
return clearTimeout(time.timer);
|
|
43314
|
+
};
|
|
43292
43315
|
}, []);
|
|
43293
43316
|
|
|
43294
43317
|
var Dashboard = function Dashboard(height) {
|
|
@@ -43309,8 +43332,11 @@ var PeriscopeDashboardIframe = function PeriscopeDashboardIframe(_ref) {
|
|
|
43309
43332
|
var validatePeriscope = function validatePeriscope(message) {
|
|
43310
43333
|
if (isValidMessage(message)) {
|
|
43311
43334
|
setHeight(message.data.dashboard_height + 100);
|
|
43312
|
-
|
|
43313
|
-
|
|
43335
|
+
|
|
43336
|
+
if (!periscopeDataSuccess) {
|
|
43337
|
+
clearTimeout(time.timer);
|
|
43338
|
+
periscopeDataRequestSuccess();
|
|
43339
|
+
}
|
|
43314
43340
|
}
|
|
43315
43341
|
};
|
|
43316
43342
|
|