@thecb/components 6.0.0-beta.12 → 6.0.0-beta.15
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 +30 -26
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +30 -26
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/dropdown/Dropdown.js +32 -21
package/dist/index.esm.js
CHANGED
|
@@ -19400,14 +19400,14 @@ var fallbackValues$e = {
|
|
|
19400
19400
|
var IconWrapper = styled.div.withConfig({
|
|
19401
19401
|
displayName: "Dropdown__IconWrapper",
|
|
19402
19402
|
componentId: "sc-pn6m0h-0"
|
|
19403
|
-
})(["display:flex;flex-direction:column;justify-content:center;transition:transform 0.3s ease;", ""], function (_ref) {
|
|
19403
|
+
})(["display:flex;flex-direction:column;justify-content:center;transition:transform 0.3s ease;", " position:absolute;top:20px;right:12px;"], function (_ref) {
|
|
19404
19404
|
var open = _ref.open;
|
|
19405
19405
|
return open ? "transform: rotate(-180deg)" : "";
|
|
19406
19406
|
});
|
|
19407
19407
|
var DropdownContentWrapper = styled.div.withConfig({
|
|
19408
19408
|
displayName: "Dropdown__DropdownContentWrapper",
|
|
19409
19409
|
componentId: "sc-pn6m0h-1"
|
|
19410
|
-
})(["transform-origin:0 0;border:1px solid ", ";border-radius:2px;background-color:", ";padding:8px 0 8px;position:absolute;width:", ";min-width:100%;max-height:", ";overflow-y:scroll;z-index:1;box-sizing:border-box;&:focus{outline:none;}"], GREY_CHATEAU, WHITE, function (_ref2) {
|
|
19410
|
+
})(["transform-origin:0 0;border:1px solid ", ";border-radius:2px;background-color:", ";padding:8px 0 8px;position:absolute;width:", ";min-width:100%;max-height:", ";overflow-y:scroll;z-index:1;box-sizing:border-box;&:focus{outline:none;}ul{padding-left:0;}"], GREY_CHATEAU, WHITE, function (_ref2) {
|
|
19411
19411
|
var widthFitOptions = _ref2.widthFitOptions;
|
|
19412
19412
|
return widthFitOptions ? "fit-content" : "100%";
|
|
19413
19413
|
}, function (_ref3) {
|
|
@@ -19417,7 +19417,7 @@ var DropdownContentWrapper = styled.div.withConfig({
|
|
|
19417
19417
|
var DropdownItemWrapper = styled.li.withConfig({
|
|
19418
19418
|
displayName: "Dropdown__DropdownItemWrapper",
|
|
19419
19419
|
componentId: "sc-pn6m0h-2"
|
|
19420
|
-
})(["background-color:", ";text-align:start;border-width:0px;border-color:transparent;box-shadow:none;padding:1rem;box-sizing:border-box;width:100%;cursor:", ";&:hover{background-color:", ";}&:focus{background-color:", ";outline:none;}"], function (_ref4) {
|
|
19420
|
+
})(["background-color:", ";text-align:start;border-width:0px;border-color:transparent;box-shadow:none;padding:1rem;box-sizing:border-box;width:100%;list-style:none;cursor:", ";&:hover{background-color:", ";}&:focus{background-color:", ";outline:none;}"], function (_ref4) {
|
|
19421
19421
|
var selected = _ref4.selected,
|
|
19422
19422
|
themeValues = _ref4.themeValues;
|
|
19423
19423
|
return selected ? themeValues.selectedColor : WHITE;
|
|
@@ -19446,7 +19446,7 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19446
19446
|
_ref8$disabledValues = _ref8.disabledValues,
|
|
19447
19447
|
disabledValues = _ref8$disabledValues === void 0 ? [] : _ref8$disabledValues,
|
|
19448
19448
|
_ref8$onClick = _ref8.onClick,
|
|
19449
|
-
|
|
19449
|
+
_onClick = _ref8$onClick === void 0 ? noop : _ref8$onClick,
|
|
19450
19450
|
themeValues = _ref8.themeValues,
|
|
19451
19451
|
maxHeight = _ref8.maxHeight,
|
|
19452
19452
|
_ref8$widthFitOptions = _ref8.widthFitOptions,
|
|
@@ -19521,18 +19521,14 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19521
19521
|
var onKeyDown = function onKeyDown(e) {
|
|
19522
19522
|
var _optionRefs$current$l, _optionRefs$current;
|
|
19523
19523
|
|
|
19524
|
-
console.log("
|
|
19525
|
-
console.log("key down event value is", e.target.value);
|
|
19524
|
+
console.log("current input value", inputValue);
|
|
19526
19525
|
var key = e.key,
|
|
19527
19526
|
keyCode = e.keyCode;
|
|
19528
19527
|
var focus = document.activeElement;
|
|
19529
19528
|
console.log("dropdown value is", value);
|
|
19530
|
-
console.log("focus is", focus);
|
|
19531
|
-
console.log("option refs are", optionRefs.current);
|
|
19532
19529
|
var optionEl = optionRefs.current.find(function (ref) {
|
|
19533
19530
|
return ref.current === focus;
|
|
19534
19531
|
});
|
|
19535
|
-
console.log("option el is", optionEl);
|
|
19536
19532
|
|
|
19537
19533
|
switch (key) {
|
|
19538
19534
|
case "ArrowDown":
|
|
@@ -19546,7 +19542,7 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19546
19542
|
break;
|
|
19547
19543
|
}
|
|
19548
19544
|
} else {
|
|
19549
|
-
|
|
19545
|
+
_onClick();
|
|
19550
19546
|
}
|
|
19551
19547
|
|
|
19552
19548
|
break;
|
|
@@ -19562,7 +19558,7 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19562
19558
|
break;
|
|
19563
19559
|
}
|
|
19564
19560
|
} else {
|
|
19565
|
-
|
|
19561
|
+
_onClick();
|
|
19566
19562
|
}
|
|
19567
19563
|
|
|
19568
19564
|
break;
|
|
@@ -19591,7 +19587,7 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19591
19587
|
|
|
19592
19588
|
case "Escape":
|
|
19593
19589
|
if (isOpen) {
|
|
19594
|
-
|
|
19590
|
+
_onClick();
|
|
19595
19591
|
}
|
|
19596
19592
|
|
|
19597
19593
|
break;
|
|
@@ -19599,11 +19595,6 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19599
19595
|
};
|
|
19600
19596
|
|
|
19601
19597
|
useEffect$1(function () {
|
|
19602
|
-
console.log("option refs in isopen useffect", optionRefs);
|
|
19603
|
-
console.log("option ref current in isopen useffect", optionRefs.current[0].current);
|
|
19604
|
-
console.log("selected refs in isopen useffect", selectedRef);
|
|
19605
|
-
console.log("value in isopen useffect", value);
|
|
19606
|
-
|
|
19607
19598
|
if (isOpen && selectedRef !== undefined && selectedRef.current !== null) {
|
|
19608
19599
|
// WAI-ARIA requires the selected option to receive focus
|
|
19609
19600
|
selectedRef.current.focus();
|
|
@@ -19629,8 +19620,6 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19629
19620
|
}, [inputValue]);
|
|
19630
19621
|
useEffect$1(function () {
|
|
19631
19622
|
if (!isOpen && filteredOptions[0] && !disabledValues.includes(filteredOptions[0].value) && filteredOptions[0].text != placeholder) {
|
|
19632
|
-
console.log("filtered options are", filteredOptions);
|
|
19633
|
-
console.log("option refs are", optionRefs);
|
|
19634
19623
|
onSelect(filteredOptions[0].value);
|
|
19635
19624
|
}
|
|
19636
19625
|
|
|
@@ -19640,10 +19629,19 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19640
19629
|
dropdownRef.current.focus();
|
|
19641
19630
|
}
|
|
19642
19631
|
}, [filteredOptions]);
|
|
19643
|
-
return /*#__PURE__*/React.createElement(
|
|
19632
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
19633
|
+
padding: "0",
|
|
19634
|
+
background: isOpen ? themeValues.hoverColor : WHITE,
|
|
19635
|
+
extraStyles: "position: relative;",
|
|
19636
|
+
minWidth: "100%",
|
|
19637
|
+
onClick: function onClick() {
|
|
19638
|
+
_onClick();
|
|
19639
|
+
},
|
|
19640
|
+
onKeyDown: onKeyDown,
|
|
19641
|
+
width: "100%"
|
|
19642
|
+
}, /*#__PURE__*/React.createElement(Stack, {
|
|
19644
19643
|
direction: "row",
|
|
19645
|
-
bottomItem: 2
|
|
19646
|
-
extraStyles: "position: relative;"
|
|
19644
|
+
bottomItem: 2
|
|
19647
19645
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
19648
19646
|
as: "input",
|
|
19649
19647
|
"aria-multiline": "false",
|
|
@@ -19659,14 +19657,20 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19659
19657
|
borderRadius: "2px",
|
|
19660
19658
|
borderSize: "1px",
|
|
19661
19659
|
borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor : GREY_CHATEAU,
|
|
19660
|
+
borderWidthOverride: "1px 0px 1px 1px",
|
|
19662
19661
|
extraStyles: disabled && "color: #6e727e;\n background-color: #f7f7f7;\n pointer-events: none;",
|
|
19663
19662
|
hoverStyles: "background-color: ".concat(themeValues.hoverColor, ";"),
|
|
19664
19663
|
isOpen: isOpen,
|
|
19664
|
+
minHeight: "48px",
|
|
19665
|
+
minWidth: "100%",
|
|
19665
19666
|
name: autocompleteValue,
|
|
19666
|
-
|
|
19667
|
-
|
|
19668
|
-
|
|
19667
|
+
onFocus: function onFocus() {
|
|
19668
|
+
if (!isOpen) {
|
|
19669
|
+
_onClick();
|
|
19670
|
+
}
|
|
19671
|
+
},
|
|
19669
19672
|
onChange: function onChange(e) {
|
|
19673
|
+
console.log("current input value", inputValue);
|
|
19670
19674
|
console.log("input change event", e.target);
|
|
19671
19675
|
console.log("input change event value", e.target.value);
|
|
19672
19676
|
setInputValue(e.target.value);
|
|
@@ -19677,7 +19681,7 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19677
19681
|
themeValues: themeValues,
|
|
19678
19682
|
title: hasTitles ? getSelection() : null,
|
|
19679
19683
|
type: "text",
|
|
19680
|
-
tabIndex:
|
|
19684
|
+
tabIndex: 0,
|
|
19681
19685
|
value: inputValue,
|
|
19682
19686
|
width: "100%",
|
|
19683
19687
|
dataQa: placeholder
|