@thecb/components 9.1.7-beta.4 → 9.1.7-beta.6
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 +99 -59
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +99 -59
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/dropdown/Dropdown.js +16 -13
- package/src/util/colorUtils.js +68 -13
package/dist/index.cjs.js
CHANGED
|
@@ -18686,22 +18686,12 @@ var fallbackValues$4 = {
|
|
|
18686
18686
|
link: link
|
|
18687
18687
|
};
|
|
18688
18688
|
|
|
18689
|
-
/*
|
|
18690
|
-
|
|
18691
|
-
A utility function that can generate box-shadow values for components
|
|
18692
|
-
Takes a string representing an rgb color value and returns an object
|
|
18693
|
-
with values for standard, inset, and overlay shadows.
|
|
18694
|
-
|
|
18695
|
-
The objects for standard and inset shadows contain versions approiate
|
|
18696
|
-
for base, hover, and active interaction states.
|
|
18697
|
-
|
|
18698
|
-
*/
|
|
18699
|
-
|
|
18700
18689
|
/*
|
|
18701
18690
|
Function to convert string representing rgb color to rgba value with provided opacity
|
|
18702
18691
|
("rgb(41, 42, 51)", "0.1") => "rgba(41, 42, 51, 0.1)"
|
|
18703
18692
|
|
|
18704
18693
|
*/
|
|
18694
|
+
|
|
18705
18695
|
var rgbToRgba = function rgbToRgba() {
|
|
18706
18696
|
var rgbValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
18707
18697
|
var opacity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
|
@@ -18712,6 +18702,17 @@ var rgbToRgba = function rgbToRgba() {
|
|
|
18712
18702
|
|
|
18713
18703
|
return "".concat(rgbValue.slice(0, 3), "a").concat(rgbValue.slice(3, -1), ", ").concat(opacity).concat(rgbValue.slice(-1));
|
|
18714
18704
|
};
|
|
18705
|
+
/*
|
|
18706
|
+
|
|
18707
|
+
A utility function that can generate box-shadow values for components
|
|
18708
|
+
Takes a string representing an rgb color value and returns an object
|
|
18709
|
+
with values for standard, inset, and overlay shadows.
|
|
18710
|
+
|
|
18711
|
+
The objects for standard and inset shadows contain versions approiate
|
|
18712
|
+
for base, hover, and active interaction states.
|
|
18713
|
+
|
|
18714
|
+
*/
|
|
18715
|
+
|
|
18715
18716
|
|
|
18716
18717
|
var generateShadows = function generateShadows() {
|
|
18717
18718
|
var baseColorRGB = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "rgb(41, 42, 51)";
|
|
@@ -18739,9 +18740,51 @@ var generateShadows = function generateShadows() {
|
|
|
18739
18740
|
overlay: overlay
|
|
18740
18741
|
};
|
|
18741
18742
|
};
|
|
18742
|
-
|
|
18743
|
-
|
|
18744
|
-
|
|
18743
|
+
/*
|
|
18744
|
+
Function to convert a string representing hex color to rgb color
|
|
18745
|
+
hexToRbg("#00ff00") => [0, 255, 0]
|
|
18746
|
+
*/
|
|
18747
|
+
|
|
18748
|
+
var hexToRbg = function hexToRbg(hexColor) {
|
|
18749
|
+
var hexArr = hexColor.replace("#", "");
|
|
18750
|
+
var red = parseInt(hexArr.slice(0, 2), 16);
|
|
18751
|
+
var green = parseInt(hexArr.slice(2, 4), 16);
|
|
18752
|
+
var blue = parseInt(hexArr.slice(4, 6), 16);
|
|
18753
|
+
return [red, green, blue];
|
|
18754
|
+
};
|
|
18755
|
+
|
|
18756
|
+
var rbgToHex = function rbgToHex(rbgColor) {
|
|
18757
|
+
hexCodes = rbgColor.map(function (c) {
|
|
18758
|
+
var hex = c.toString(16).toUpperCase();
|
|
18759
|
+
return hex.length == 1 ? "0" + hex : hex;
|
|
18760
|
+
});
|
|
18761
|
+
return "#" + hexCodes.join("");
|
|
18762
|
+
};
|
|
18763
|
+
/*
|
|
18764
|
+
Function to calculate a new hex color given an original
|
|
18765
|
+
hex color, a hex background color, and an opacity number
|
|
18766
|
+
between 0 and 1 to apply to the background.
|
|
18767
|
+
|
|
18768
|
+
For example, to add a 20% black opacity (20% darker) to a green color
|
|
18769
|
+
("#00ff00"):
|
|
18770
|
+
addOpacityToHex("00ff00", "#000000", .2) => "#00CC00"
|
|
18771
|
+
*/
|
|
18772
|
+
|
|
18773
|
+
|
|
18774
|
+
var addOpacityToHex = function addOpacityToHex(hexColor, background, opacity) {
|
|
18775
|
+
if (hexColor == TRANSPARENT) {
|
|
18776
|
+
return hexColor;
|
|
18777
|
+
}
|
|
18778
|
+
|
|
18779
|
+
var color = hexToRbg(hexColor);
|
|
18780
|
+
var backgroundRbg = hexToRbg(background);
|
|
18781
|
+
var newColor = color.map(function (colorElem, index) {
|
|
18782
|
+
return Math.floor(opacity * backgroundRbg[index] + (1 - opacity) * colorElem);
|
|
18783
|
+
});
|
|
18784
|
+
return rbgToHex(newColor);
|
|
18785
|
+
};
|
|
18786
|
+
var darken = function darken(hexColor, opacity) {
|
|
18787
|
+
return addOpacityToHex(hexColor, "#000000", opacity);
|
|
18745
18788
|
};
|
|
18746
18789
|
|
|
18747
18790
|
var Alert = function Alert(_ref) {
|
|
@@ -23770,7 +23813,7 @@ var DropdownContentWrapper = styled__default.div.withConfig({
|
|
|
23770
23813
|
var DropdownItemWrapper = styled__default.li.withConfig({
|
|
23771
23814
|
displayName: "Dropdown__DropdownItemWrapper",
|
|
23772
23815
|
componentId: "sc-pn6m0h-2"
|
|
23773
|
-
})(["text-align:start;border-width:2px;border-style:solid;border-color:", ";box-shadow:none;box-sizing:border-box;width:100%;list-style:none;cursor:", ";&:hover{
|
|
23816
|
+
})(["text-align:start;border-width:2px;border-style:solid;border-color:", ";box-shadow:none;box-sizing:border-box;width:100%;list-style:none;cursor:", ";&:hover{border-color:", ";> *{background:", ";border-color:", ";}}&:focus{outline:none;border-color:", ";> *{background:", ";border-color:white;outline:none;}}"], function (_ref4) {
|
|
23774
23817
|
var selected = _ref4.selected,
|
|
23775
23818
|
themeValues = _ref4.themeValues;
|
|
23776
23819
|
return selected ? themeValues.selectedColor : WHITE;
|
|
@@ -23779,71 +23822,68 @@ var DropdownItemWrapper = styled__default.li.withConfig({
|
|
|
23779
23822
|
return disabled ? "default" : "pointer";
|
|
23780
23823
|
}, function (_ref6) {
|
|
23781
23824
|
var disabled = _ref6.disabled,
|
|
23825
|
+
selected = _ref6.selected,
|
|
23782
23826
|
themeValues = _ref6.themeValues;
|
|
23783
|
-
return
|
|
23827
|
+
return selected ? darken(themeValues.selectedColor, 0.2) : disabled ? WHITE : themeValues.hoverColor;
|
|
23784
23828
|
}, function (_ref7) {
|
|
23785
23829
|
var selected = _ref7.selected,
|
|
23830
|
+
disabled = _ref7.disabled,
|
|
23786
23831
|
themeValues = _ref7.themeValues;
|
|
23787
|
-
return selected ?
|
|
23832
|
+
return selected ? darken(themeValues.selectedColor, 0.2) : disabled ? WHITE : themeValues.hoverColor;
|
|
23788
23833
|
}, function (_ref8) {
|
|
23789
23834
|
var selected = _ref8.selected,
|
|
23790
23835
|
disabled = _ref8.disabled,
|
|
23791
23836
|
themeValues = _ref8.themeValues;
|
|
23792
|
-
return selected ?
|
|
23837
|
+
return selected ? darken(themeValues.selectedColor, 0.2) : disabled ? WHITE : themeValues.hoverColor;
|
|
23793
23838
|
}, function (_ref9) {
|
|
23794
|
-
var
|
|
23795
|
-
|
|
23796
|
-
return selected ? addOpacity(themeValues.selectedColor, 0.2, 0, 0, 0) : "";
|
|
23839
|
+
var themeValues = _ref9.themeValues;
|
|
23840
|
+
return themeValues.selectedColor;
|
|
23797
23841
|
}, function (_ref10) {
|
|
23798
23842
|
var selected = _ref10.selected,
|
|
23843
|
+
disabled = _ref10.disabled,
|
|
23799
23844
|
themeValues = _ref10.themeValues;
|
|
23800
|
-
return selected ?
|
|
23801
|
-
}, function (_ref11) {
|
|
23802
|
-
var selected = _ref11.selected,
|
|
23803
|
-
disabled = _ref11.disabled,
|
|
23804
|
-
themeValues = _ref11.themeValues;
|
|
23805
|
-
return selected ? addOpacity(themeValues.selectedColor, 0.2, 0, 0, 0) : disabled ? WHITE : themeValues.hoverColor;
|
|
23845
|
+
return selected ? darken(themeValues.selectedColor, 0.2) : disabled ? WHITE : themeValues.hoverColor;
|
|
23806
23846
|
});
|
|
23807
23847
|
var DropdownItemBorder = styled__default.div.withConfig({
|
|
23808
23848
|
displayName: "Dropdown__DropdownItemBorder",
|
|
23809
23849
|
componentId: "sc-pn6m0h-3"
|
|
23810
|
-
})(["background:", ";border-color:", ";border-width:2px;border-style:solid;padding:12px;"], function (
|
|
23850
|
+
})(["background:", ";border-color:", ";border-width:2px;border-style:solid;padding:12px;"], function (_ref11) {
|
|
23851
|
+
var selected = _ref11.selected,
|
|
23852
|
+
themeValues = _ref11.themeValues;
|
|
23853
|
+
return selected ? themeValues.selectedColor : WHITE;
|
|
23854
|
+
}, function (_ref12) {
|
|
23811
23855
|
var selected = _ref12.selected,
|
|
23812
23856
|
themeValues = _ref12.themeValues;
|
|
23813
23857
|
return selected ? themeValues.selectedColor : WHITE;
|
|
23814
|
-
}, function (_ref13) {
|
|
23815
|
-
var selected = _ref13.selected,
|
|
23816
|
-
themeValues = _ref13.themeValues;
|
|
23817
|
-
return selected ? themeValues.selectedColor : WHITE;
|
|
23818
23858
|
});
|
|
23819
23859
|
|
|
23820
|
-
var Dropdown = function Dropdown(
|
|
23821
|
-
var placeholder =
|
|
23822
|
-
options =
|
|
23823
|
-
value =
|
|
23824
|
-
isOpen =
|
|
23825
|
-
isError =
|
|
23826
|
-
onSelect =
|
|
23827
|
-
|
|
23828
|
-
disabledValues =
|
|
23829
|
-
|
|
23830
|
-
_onClick =
|
|
23831
|
-
themeValues =
|
|
23832
|
-
maxHeight =
|
|
23833
|
-
|
|
23834
|
-
widthFitOptions =
|
|
23835
|
-
disabled =
|
|
23836
|
-
|
|
23837
|
-
hasTitles =
|
|
23838
|
-
|
|
23839
|
-
autoEraseTypeAhead =
|
|
23840
|
-
ariaLabelledby =
|
|
23841
|
-
ariaDescribedby =
|
|
23842
|
-
autocompleteValue =
|
|
23843
|
-
|
|
23844
|
-
smoothScroll =
|
|
23845
|
-
|
|
23846
|
-
ariaInvalid =
|
|
23860
|
+
var Dropdown = function Dropdown(_ref13) {
|
|
23861
|
+
var placeholder = _ref13.placeholder,
|
|
23862
|
+
options = _ref13.options,
|
|
23863
|
+
value = _ref13.value,
|
|
23864
|
+
isOpen = _ref13.isOpen,
|
|
23865
|
+
isError = _ref13.isError,
|
|
23866
|
+
onSelect = _ref13.onSelect,
|
|
23867
|
+
_ref13$disabledValues = _ref13.disabledValues,
|
|
23868
|
+
disabledValues = _ref13$disabledValues === void 0 ? [] : _ref13$disabledValues,
|
|
23869
|
+
_ref13$onClick = _ref13.onClick,
|
|
23870
|
+
_onClick = _ref13$onClick === void 0 ? noop : _ref13$onClick,
|
|
23871
|
+
themeValues = _ref13.themeValues,
|
|
23872
|
+
maxHeight = _ref13.maxHeight,
|
|
23873
|
+
_ref13$widthFitOption = _ref13.widthFitOptions,
|
|
23874
|
+
widthFitOptions = _ref13$widthFitOption === void 0 ? false : _ref13$widthFitOption,
|
|
23875
|
+
disabled = _ref13.disabled,
|
|
23876
|
+
_ref13$hasTitles = _ref13.hasTitles,
|
|
23877
|
+
hasTitles = _ref13$hasTitles === void 0 ? false : _ref13$hasTitles,
|
|
23878
|
+
_ref13$autoEraseTypeA = _ref13.autoEraseTypeAhead,
|
|
23879
|
+
autoEraseTypeAhead = _ref13$autoEraseTypeA === void 0 ? true : _ref13$autoEraseTypeA,
|
|
23880
|
+
ariaLabelledby = _ref13.ariaLabelledby,
|
|
23881
|
+
ariaDescribedby = _ref13.ariaDescribedby,
|
|
23882
|
+
autocompleteValue = _ref13.autocompleteValue,
|
|
23883
|
+
_ref13$smoothScroll = _ref13.smoothScroll,
|
|
23884
|
+
smoothScroll = _ref13$smoothScroll === void 0 ? true : _ref13$smoothScroll,
|
|
23885
|
+
_ref13$ariaInvalid = _ref13.ariaInvalid,
|
|
23886
|
+
ariaInvalid = _ref13$ariaInvalid === void 0 ? false : _ref13$ariaInvalid;
|
|
23847
23887
|
|
|
23848
23888
|
var _useState = React.useState(""),
|
|
23849
23889
|
_useState2 = _slicedToArray(_useState, 2),
|