@thecb/components 6.0.0-beta.5 → 6.0.0-beta.8
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 +49 -37
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +49 -37
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/country-dropdown/CountryDropdown.js +1 -0
- package/src/components/atoms/dropdown/Dropdown.js +22 -9
- package/src/components/atoms/form-select/FormSelect.js +3 -1
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.js +1 -0
package/dist/index.cjs.js
CHANGED
|
@@ -19446,33 +19446,31 @@ var DropdownItemWrapper = styled__default.div.withConfig({
|
|
|
19446
19446
|
var SearchInput = styled__default.input.withConfig({
|
|
19447
19447
|
displayName: "Dropdown__SearchInput",
|
|
19448
19448
|
componentId: "sc-pn6m0h-3"
|
|
19449
|
-
})(["border:none;background-color:
|
|
19450
|
-
|
|
19451
|
-
|
|
19452
|
-
|
|
19453
|
-
|
|
19454
|
-
|
|
19455
|
-
|
|
19456
|
-
|
|
19457
|
-
|
|
19458
|
-
|
|
19459
|
-
|
|
19460
|
-
|
|
19461
|
-
|
|
19462
|
-
|
|
19463
|
-
|
|
19464
|
-
|
|
19465
|
-
|
|
19466
|
-
|
|
19467
|
-
|
|
19468
|
-
|
|
19469
|
-
|
|
19470
|
-
|
|
19471
|
-
|
|
19472
|
-
|
|
19473
|
-
|
|
19474
|
-
autoEraseTypeAhead = _ref9$autoEraseTypeAh === void 0 ? true : _ref9$autoEraseTypeAh,
|
|
19475
|
-
ariaLabelledby = _ref9.ariaLabelledby;
|
|
19449
|
+
})(["border:none;background-color:transparent;font-size:16px;height:24px;min-width:80%;"]);
|
|
19450
|
+
|
|
19451
|
+
var Dropdown = function Dropdown(_ref8) {
|
|
19452
|
+
var placeholder = _ref8.placeholder,
|
|
19453
|
+
options = _ref8.options,
|
|
19454
|
+
value = _ref8.value,
|
|
19455
|
+
isOpen = _ref8.isOpen,
|
|
19456
|
+
isError = _ref8.isError,
|
|
19457
|
+
onSelect = _ref8.onSelect,
|
|
19458
|
+
_ref8$disabledValues = _ref8.disabledValues,
|
|
19459
|
+
disabledValues = _ref8$disabledValues === void 0 ? [] : _ref8$disabledValues,
|
|
19460
|
+
_ref8$onClick = _ref8.onClick,
|
|
19461
|
+
onClick = _ref8$onClick === void 0 ? noop : _ref8$onClick,
|
|
19462
|
+
themeValues = _ref8.themeValues,
|
|
19463
|
+
maxHeight = _ref8.maxHeight,
|
|
19464
|
+
_ref8$widthFitOptions = _ref8.widthFitOptions,
|
|
19465
|
+
widthFitOptions = _ref8$widthFitOptions === void 0 ? false : _ref8$widthFitOptions,
|
|
19466
|
+
disabled = _ref8.disabled,
|
|
19467
|
+
_ref8$hasTitles = _ref8.hasTitles,
|
|
19468
|
+
hasTitles = _ref8$hasTitles === void 0 ? false : _ref8$hasTitles,
|
|
19469
|
+
_ref8$autoEraseTypeAh = _ref8.autoEraseTypeAhead,
|
|
19470
|
+
autoEraseTypeAhead = _ref8$autoEraseTypeAh === void 0 ? true : _ref8$autoEraseTypeAh,
|
|
19471
|
+
ariaLabelledby = _ref8.ariaLabelledby,
|
|
19472
|
+
_ref8$autocompleteVal = _ref8.autocompleteValue,
|
|
19473
|
+
autocompleteValue = _ref8$autocompleteVal === void 0 ? "" : _ref8$autocompleteVal;
|
|
19476
19474
|
|
|
19477
19475
|
var _useState = React.useState(""),
|
|
19478
19476
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -19530,6 +19528,7 @@ var Dropdown = function Dropdown(_ref9) {
|
|
|
19530
19528
|
var onKeyDown = function onKeyDown(e) {
|
|
19531
19529
|
var _optionRefs$current$l, _optionRefs$current;
|
|
19532
19530
|
|
|
19531
|
+
console.log("key down event is", e);
|
|
19533
19532
|
var key = e.key,
|
|
19534
19533
|
keyCode = e.keyCode;
|
|
19535
19534
|
var focus = document.activeElement;
|
|
@@ -19604,11 +19603,12 @@ var Dropdown = function Dropdown(_ref9) {
|
|
|
19604
19603
|
};
|
|
19605
19604
|
|
|
19606
19605
|
React.useEffect(function () {
|
|
19607
|
-
console.log("option refs in isopen useffect", optionRefs
|
|
19606
|
+
console.log("option refs in isopen useffect", optionRefs);
|
|
19607
|
+
console.log("option ref current in isopen useffect", optionRefs.current[0].current);
|
|
19608
19608
|
console.log("selected refs in isopen useffect", selectedRef);
|
|
19609
19609
|
console.log("value in isopen useffect", value);
|
|
19610
19610
|
|
|
19611
|
-
if (isOpen && selectedRef !== undefined) {
|
|
19611
|
+
if (isOpen && selectedRef !== undefined && selectedRef.current !== null) {
|
|
19612
19612
|
// WAI-ARIA requires the selected option to receive focus
|
|
19613
19613
|
selectedRef.current.focus();
|
|
19614
19614
|
} else if (isOpen && optionRefs.current[0].current) {
|
|
@@ -19624,7 +19624,7 @@ var Dropdown = function Dropdown(_ref9) {
|
|
|
19624
19624
|
clearTimeout(timer);
|
|
19625
19625
|
setTimer(setTimeout(function () {
|
|
19626
19626
|
return setInputValue("");
|
|
19627
|
-
},
|
|
19627
|
+
}, 3000));
|
|
19628
19628
|
}
|
|
19629
19629
|
|
|
19630
19630
|
setFilteredOptions(options.filter(function (option) {
|
|
@@ -19633,6 +19633,8 @@ var Dropdown = function Dropdown(_ref9) {
|
|
|
19633
19633
|
}, [inputValue]);
|
|
19634
19634
|
React.useEffect(function () {
|
|
19635
19635
|
if (!isOpen && filteredOptions[0] && !disabledValues.includes(filteredOptions[0].value) && filteredOptions[0].text != placeholder) {
|
|
19636
|
+
console.log("filtered options are", filteredOptions);
|
|
19637
|
+
console.log("option refs are", optionRefs);
|
|
19636
19638
|
onSelect(filteredOptions[0].value);
|
|
19637
19639
|
}
|
|
19638
19640
|
|
|
@@ -19669,12 +19671,15 @@ var Dropdown = function Dropdown(_ref9) {
|
|
|
19669
19671
|
extraStyles: "height: 48px;\n ".concat(disabled && "color: #6e727e;\n background-color: #f7f7f7;\n pointer-events: none;", "\n ")
|
|
19670
19672
|
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
19671
19673
|
direction: "row",
|
|
19672
|
-
bottomItem: 2
|
|
19674
|
+
bottomItem: 2,
|
|
19675
|
+
extraStyles: "position: relative;"
|
|
19673
19676
|
}, /*#__PURE__*/React__default.createElement(SearchInput, {
|
|
19674
19677
|
"aria-label": getSelection(),
|
|
19675
19678
|
placeholder: getSelection(),
|
|
19676
19679
|
value: inputValue,
|
|
19677
|
-
onChange:
|
|
19680
|
+
onChange: function onChange(e) {
|
|
19681
|
+
console.log("input change event", e);
|
|
19682
|
+
},
|
|
19678
19683
|
themeValues: themeValues,
|
|
19679
19684
|
role: "searchbox",
|
|
19680
19685
|
type: "text",
|
|
@@ -19682,7 +19687,10 @@ var Dropdown = function Dropdown(_ref9) {
|
|
|
19682
19687
|
"aria-autocomplete": "list",
|
|
19683
19688
|
"aria-controls": "".concat(ariaLabelledby, "_listbox"),
|
|
19684
19689
|
"aria-activedescendant": "selected_option",
|
|
19685
|
-
isOpen: isOpen
|
|
19690
|
+
isOpen: isOpen,
|
|
19691
|
+
tabIndex: -1,
|
|
19692
|
+
name: autocompleteValue,
|
|
19693
|
+
autocomplete: autocompleteValue
|
|
19686
19694
|
}), /*#__PURE__*/React__default.createElement(IconWrapper, {
|
|
19687
19695
|
open: isOpen
|
|
19688
19696
|
}, /*#__PURE__*/React__default.createElement(DropdownIcon, null)))), isOpen ? /*#__PURE__*/React__default.createElement(DropdownContentWrapper, {
|
|
@@ -19825,7 +19833,8 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
19825
19833
|
disabled = _ref.disabled,
|
|
19826
19834
|
themeValues = _ref.themeValues,
|
|
19827
19835
|
_ref$hasTitles = _ref.hasTitles,
|
|
19828
|
-
hasTitles = _ref$hasTitles === void 0 ? false : _ref$hasTitles
|
|
19836
|
+
hasTitles = _ref$hasTitles === void 0 ? false : _ref$hasTitles,
|
|
19837
|
+
autocompleteValue = _ref.autocompleteValue;
|
|
19829
19838
|
|
|
19830
19839
|
var _useState = React.useState(false),
|
|
19831
19840
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -19880,7 +19889,8 @@ var FormSelect = function FormSelect(_ref) {
|
|
|
19880
19889
|
onClick: function onClick() {
|
|
19881
19890
|
return setOpen(!open);
|
|
19882
19891
|
},
|
|
19883
|
-
disabled: disabled
|
|
19892
|
+
disabled: disabled,
|
|
19893
|
+
autocompleteValue: autocompleteValue
|
|
19884
19894
|
}), /*#__PURE__*/React__default.createElement(Stack, {
|
|
19885
19895
|
direction: "row",
|
|
19886
19896
|
justify: "space-between"
|
|
@@ -20653,7 +20663,8 @@ var CountryDropdown = function CountryDropdown(_ref) {
|
|
|
20653
20663
|
labelTextWhenNoError: labelTextWhenNoError,
|
|
20654
20664
|
errorMessages: errorMessages,
|
|
20655
20665
|
showErrors: showErrors,
|
|
20656
|
-
onChange: onChange
|
|
20666
|
+
onChange: onChange,
|
|
20667
|
+
autocompleteValue: "country-name"
|
|
20657
20668
|
});
|
|
20658
20669
|
};
|
|
20659
20670
|
|
|
@@ -33069,7 +33080,8 @@ var FormStateDropdown = function FormStateDropdown(_ref) {
|
|
|
33069
33080
|
fieldActions: fieldActions,
|
|
33070
33081
|
labelTextWhenNoError: labelTextWhenNoError,
|
|
33071
33082
|
errorMessages: errorMessages,
|
|
33072
|
-
showErrors: showErrors
|
|
33083
|
+
showErrors: showErrors,
|
|
33084
|
+
autocompleteValue: "address-level1"
|
|
33073
33085
|
});
|
|
33074
33086
|
};
|
|
33075
33087
|
|