@thecb/components 9.1.4 → 9.1.5
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 +68 -35
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +68 -35
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/dropdown/Dropdown.js +70 -36
- package/src/components/atoms/dropdown/Dropdown.theme.js +8 -2
- package/src/constants/colors.js +2 -0
package/package.json
CHANGED
|
@@ -12,11 +12,11 @@ import styled from "styled-components";
|
|
|
12
12
|
import "core-js/proposals/relative-indexing-method";
|
|
13
13
|
|
|
14
14
|
import {
|
|
15
|
-
|
|
15
|
+
ERROR_COLOR,
|
|
16
16
|
GREY_CHATEAU,
|
|
17
|
-
STORM_GREY,
|
|
18
17
|
MINESHAFT_GREY,
|
|
19
|
-
|
|
18
|
+
STORM_GREY,
|
|
19
|
+
WHITE
|
|
20
20
|
} from "../../../constants/colors";
|
|
21
21
|
import { fallbackValues } from "./Dropdown.theme";
|
|
22
22
|
import { themeComponent } from "../../../util/themeUtils";
|
|
@@ -55,37 +55,65 @@ const DropdownContentWrapper = styled.div`
|
|
|
55
55
|
`;
|
|
56
56
|
|
|
57
57
|
const DropdownItemWrapper = styled.li`
|
|
58
|
-
background-color: ${({ selected, themeValues }) =>
|
|
59
|
-
selected ? themeValues.selectedColor : WHITE};
|
|
60
58
|
text-align: start;
|
|
61
|
-
border-width:
|
|
62
|
-
border-
|
|
59
|
+
border-width: 2px;
|
|
60
|
+
border-style: solid;
|
|
61
|
+
border-color: ${({ selected, themeValues }) =>
|
|
62
|
+
selected ? themeValues.selectedColor : WHITE};
|
|
63
63
|
box-shadow: none;
|
|
64
|
-
padding: 1rem;
|
|
65
64
|
box-sizing: border-box;
|
|
66
65
|
width: 100%;
|
|
67
66
|
list-style: none;
|
|
68
67
|
cursor: ${({ disabled }) => (disabled ? "default" : "pointer")};
|
|
69
68
|
|
|
70
69
|
&:hover {
|
|
71
|
-
|
|
70
|
+
border-color: ${({ disabled, selected, themeValues }) =>
|
|
72
71
|
selected
|
|
73
|
-
? themeValues.
|
|
72
|
+
? themeValues.focusColor
|
|
74
73
|
: disabled
|
|
75
74
|
? WHITE
|
|
76
75
|
: themeValues.hoverColor};
|
|
76
|
+
> * {
|
|
77
|
+
background: ${({ selected, disabled, themeValues }) =>
|
|
78
|
+
selected
|
|
79
|
+
? themeValues.focusColor
|
|
80
|
+
: disabled
|
|
81
|
+
? WHITE
|
|
82
|
+
: themeValues.hoverColor};
|
|
83
|
+
border-color: ${({ selected, disabled, themeValues }) =>
|
|
84
|
+
selected
|
|
85
|
+
? themeValues.focusColor
|
|
86
|
+
: disabled
|
|
87
|
+
? WHITE
|
|
88
|
+
: themeValues.hoverColor};
|
|
89
|
+
}
|
|
77
90
|
}
|
|
78
91
|
&:focus {
|
|
79
|
-
background-color: ${({ selected, disabled, themeValues }) =>
|
|
80
|
-
selected
|
|
81
|
-
? themeValues.selectedColor
|
|
82
|
-
: disabled
|
|
83
|
-
? WHITE
|
|
84
|
-
: themeValues.hoverColor};
|
|
85
92
|
outline: none;
|
|
93
|
+
border-color: ${({ themeValues }) => themeValues.selectedColor};
|
|
94
|
+
> * {
|
|
95
|
+
background: ${({ selected, disabled, themeValues }) =>
|
|
96
|
+
selected
|
|
97
|
+
? themeValues.focusColor
|
|
98
|
+
: disabled
|
|
99
|
+
? WHITE
|
|
100
|
+
: themeValues.hoverColor};
|
|
101
|
+
border-color: white;
|
|
102
|
+
outline: none;
|
|
103
|
+
}
|
|
86
104
|
}
|
|
87
105
|
`;
|
|
88
106
|
|
|
107
|
+
const DropdownItemBorder = styled.div`
|
|
108
|
+
background: ${({ selected, themeValues }) =>
|
|
109
|
+
selected ? themeValues.selectedColor : WHITE};
|
|
110
|
+
border-color: ${({ selected, themeValues }) =>
|
|
111
|
+
selected ? themeValues.selectedColor : WHITE};
|
|
112
|
+
border-width: 2px;
|
|
113
|
+
border-style: solid;
|
|
114
|
+
padding: 12px;
|
|
115
|
+
`;
|
|
116
|
+
|
|
89
117
|
const Dropdown = ({
|
|
90
118
|
placeholder,
|
|
91
119
|
options,
|
|
@@ -385,27 +413,33 @@ const Dropdown = ({
|
|
|
385
413
|
role="option"
|
|
386
414
|
onFocus={() => setFocusedRef(optionRefs.current[i])}
|
|
387
415
|
>
|
|
388
|
-
<
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
? WHITE
|
|
393
|
-
: disabledValues.includes(choice.value)
|
|
394
|
-
? STORM_GREY
|
|
395
|
-
: MINESHAFT_GREY
|
|
396
|
-
}
|
|
397
|
-
extraStyles={`padding-left: 16px;
|
|
398
|
-
cursor: ${
|
|
399
|
-
disabledValues.includes(choice.value)
|
|
400
|
-
? "default"
|
|
401
|
-
: "pointer"
|
|
402
|
-
};
|
|
403
|
-
white-space: nowrap;
|
|
404
|
-
overflow: hidden;
|
|
405
|
-
text-overflow: ellipsis;`}
|
|
416
|
+
<DropdownItemBorder
|
|
417
|
+
disabled={disabledValues.includes(choice.value)}
|
|
418
|
+
selected={choice.value === value}
|
|
419
|
+
themeValues={themeValues}
|
|
406
420
|
>
|
|
407
|
-
|
|
408
|
-
|
|
421
|
+
<Text
|
|
422
|
+
variant="p"
|
|
423
|
+
color={
|
|
424
|
+
choice.value === value
|
|
425
|
+
? WHITE
|
|
426
|
+
: disabledValues.includes(choice.value)
|
|
427
|
+
? STORM_GREY
|
|
428
|
+
: MINESHAFT_GREY
|
|
429
|
+
}
|
|
430
|
+
extraStyles={`padding-left: 16px;
|
|
431
|
+
cursor: ${
|
|
432
|
+
disabledValues.includes(choice.value)
|
|
433
|
+
? "default"
|
|
434
|
+
: "pointer"
|
|
435
|
+
};
|
|
436
|
+
white-space: nowrap;
|
|
437
|
+
overflow: hidden;
|
|
438
|
+
text-overflow: ellipsis;`}
|
|
439
|
+
>
|
|
440
|
+
{choice.text}
|
|
441
|
+
</Text>
|
|
442
|
+
</DropdownItemBorder>
|
|
409
443
|
</DropdownItemWrapper>
|
|
410
444
|
);
|
|
411
445
|
})}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
HOVER_LIGHT_BLUE,
|
|
3
|
+
MATISSE_BLUE,
|
|
4
|
+
MATISSE_BLUE_DARK
|
|
5
|
+
} from "../../../constants/colors";
|
|
2
6
|
|
|
3
7
|
const selectedColor = `${MATISSE_BLUE}`;
|
|
4
8
|
const hoverColor = `${HOVER_LIGHT_BLUE}`;
|
|
9
|
+
const focusColor = `${MATISSE_BLUE_DARK}`;
|
|
5
10
|
|
|
6
11
|
export const fallbackValues = {
|
|
7
12
|
selectedColor,
|
|
8
|
-
hoverColor
|
|
13
|
+
hoverColor,
|
|
14
|
+
focusColor
|
|
9
15
|
};
|
package/src/constants/colors.js
CHANGED
|
@@ -56,6 +56,7 @@ const INFO_BLUE = "#E4F4FD";
|
|
|
56
56
|
const CORNFLOWER_BLUE = "#EBEFFB";
|
|
57
57
|
const HOVER_LIGHT_BLUE = "#EFFAFF";
|
|
58
58
|
const MATISSE_BLUE = "#15749D";
|
|
59
|
+
const MATISSE_BLUE_DARK = "#105C7D";
|
|
59
60
|
const ROYAL_BLUE = "#3181E3";
|
|
60
61
|
const ROYAL_BLUE_VIVID = "#3B5BDB";
|
|
61
62
|
const ASTRAL_BLUE = "#3176AA";
|
|
@@ -192,6 +193,7 @@ export {
|
|
|
192
193
|
BOSTON_BLUE,
|
|
193
194
|
HOVER_LIGHT_BLUE,
|
|
194
195
|
MATISSE_BLUE,
|
|
196
|
+
MATISSE_BLUE_DARK,
|
|
195
197
|
ROYAL_BLUE,
|
|
196
198
|
ROYAL_BLUE_VIVID,
|
|
197
199
|
ASTRAL_BLUE,
|