@thecb/components 5.6.9 → 5.6.10
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 +20 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +20 -9
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/dropdown/Dropdown.js +8 -4
- package/src/components/atoms/form-select/FormSelect.js +3 -1
- package/dist/cb-components.cjs.js +0 -77
- package/dist/cb-components.esm.js +0 -21135
- package/dist/cb-components.umd.js +0 -81
package/package.json
CHANGED
|
@@ -92,7 +92,8 @@ const Dropdown = ({
|
|
|
92
92
|
themeValues,
|
|
93
93
|
maxHeight,
|
|
94
94
|
widthFitOptions = false,
|
|
95
|
-
disabled
|
|
95
|
+
disabled,
|
|
96
|
+
hasTitles = false
|
|
96
97
|
}) => {
|
|
97
98
|
const [inputValue, setInputValue] = useState("");
|
|
98
99
|
const [optionsState, setOptionsState] = useState([]);
|
|
@@ -113,6 +114,9 @@ const Dropdown = ({
|
|
|
113
114
|
const optionRefs = useRef([...Array(options.length)].map(() => createRef()));
|
|
114
115
|
const dropdownRef = useRef(null);
|
|
115
116
|
|
|
117
|
+
const getSelection = () =>
|
|
118
|
+
value ? options.find(option => option.value === value)?.text : placeholder;
|
|
119
|
+
|
|
116
120
|
const onKeyDown = e => {
|
|
117
121
|
const { key, keyCode } = e;
|
|
118
122
|
const focus = document.activeElement;
|
|
@@ -210,6 +214,7 @@ const Dropdown = ({
|
|
|
210
214
|
background-color: #f7f7f7;
|
|
211
215
|
pointer-events: none;`
|
|
212
216
|
}
|
|
217
|
+
title={hasTitles ? getSelection() : null}
|
|
213
218
|
>
|
|
214
219
|
<Box
|
|
215
220
|
as="button"
|
|
@@ -253,9 +258,7 @@ const Dropdown = ({
|
|
|
253
258
|
pointer-events: none;`
|
|
254
259
|
}
|
|
255
260
|
>
|
|
256
|
-
{
|
|
257
|
-
? options.find(option => option.value === value)?.text
|
|
258
|
-
: placeholder}
|
|
261
|
+
{getSelection()}
|
|
259
262
|
</Text>
|
|
260
263
|
)}
|
|
261
264
|
<IconWrapper open={isOpen}>
|
|
@@ -287,6 +290,7 @@ const Dropdown = ({
|
|
|
287
290
|
disabled={disabledValues.includes(choice.value)}
|
|
288
291
|
data-qa={choice.text}
|
|
289
292
|
themeValues={themeValues}
|
|
293
|
+
title={hasTitles ? choice.text : null}
|
|
290
294
|
>
|
|
291
295
|
<Text
|
|
292
296
|
variant="p"
|
|
@@ -18,7 +18,8 @@ const FormSelect = ({
|
|
|
18
18
|
dropdownMaxHeight,
|
|
19
19
|
disabledValues,
|
|
20
20
|
disabled,
|
|
21
|
-
themeValues
|
|
21
|
+
themeValues,
|
|
22
|
+
hasTitles = false
|
|
22
23
|
}) => {
|
|
23
24
|
const [open, setOpen] = useState(false);
|
|
24
25
|
const dropdownRef = useRef(null);
|
|
@@ -59,6 +60,7 @@ const FormSelect = ({
|
|
|
59
60
|
<Dropdown
|
|
60
61
|
aria-labelledby={labelTextWhenNoError.replace(/\s+/g, "-")}
|
|
61
62
|
maxHeight={dropdownMaxHeight}
|
|
63
|
+
hasTitles={hasTitles}
|
|
62
64
|
placeholder={options[0] ? options[0].text : ""}
|
|
63
65
|
options={options}
|
|
64
66
|
value={field.rawValue}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
|
-
|
|
7
|
-
var React = _interopDefault(require('react'));
|
|
8
|
-
var styled = _interopDefault(require('styled-components'));
|
|
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;
|