emoji-picker-react 4.6.14 → 4.6.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/components/header/Search/BtnClearSearch.d.ts +2 -0
- package/dist/components/header/Search/IcnSearch.d.ts +2 -0
- package/dist/components/header/SkinTonePicker/BtnSkinToneVariation.d.ts +11 -0
- package/dist/components/navigation/CategoryButton.d.ts +11 -0
- package/dist/emoji-picker-react.cjs.development.js +285 -189
- package/dist/emoji-picker-react.cjs.development.js.map +1 -1
- package/dist/emoji-picker-react.cjs.production.min.js +1 -1
- package/dist/emoji-picker-react.cjs.production.min.js.map +1 -1
- package/dist/emoji-picker-react.esm.js +285 -189
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/body/EmojiVariationPicker.tsx +6 -7
- package/src/components/emoji/ClickableEmojiButton.tsx +5 -1
- package/src/components/footer/Preview.tsx +4 -6
- package/src/components/header/Header.tsx +1 -1
- package/src/components/header/Search/BtnClearSearch.tsx +91 -0
- package/src/components/header/{CssSearch.tsx → Search/CssSearch.tsx} +2 -2
- package/src/components/header/Search/IcnSearch.tsx +39 -0
- package/src/components/header/{Search.tsx → Search/Search.tsx} +14 -49
- package/src/components/header/SkinTonePicker/BtnSkinToneVariation.tsx +80 -0
- package/src/components/header/{SkinTonePicker.tsx → SkinTonePicker/SkinTonePicker.tsx} +25 -67
- package/src/components/navigation/CategoryButton.tsx +141 -0
- package/src/components/navigation/CategoryNavigation.tsx +10 -129
- /package/dist/components/header/{CssSearch.d.ts → Search/CssSearch.d.ts} +0 -0
- /package/dist/components/header/{Search.d.ts → Search/Search.d.ts} +0 -0
- /package/dist/components/header/{SkinTonePicker.d.ts → SkinTonePicker/SkinTonePicker.d.ts} +0 -0
- /package/src/components/header/{svg → Search/svg}/magnifier.svg +0 -0
- /package/src/components/header/{svg → Search/svg}/times.svg +0 -0
package/package.json
CHANGED
|
@@ -200,6 +200,12 @@ const styles = stylesheet.create({
|
|
|
200
200
|
transform: 'scale(0.9)',
|
|
201
201
|
transition: 'transform 0.1s ease-out, opacity 0.2s ease-out'
|
|
202
202
|
},
|
|
203
|
+
visible: {
|
|
204
|
+
opacity: '1',
|
|
205
|
+
visibility: 'visible',
|
|
206
|
+
pointerEvents: 'all',
|
|
207
|
+
transform: 'scale(1)'
|
|
208
|
+
},
|
|
203
209
|
pointingUp: {
|
|
204
210
|
'.': 'pointing-up',
|
|
205
211
|
transformOrigin: 'center 0%',
|
|
@@ -211,12 +217,6 @@ const styles = stylesheet.create({
|
|
|
211
217
|
transform: 'rotate(180deg) translateY(100%) translateX(18px)'
|
|
212
218
|
}
|
|
213
219
|
},
|
|
214
|
-
visible: {
|
|
215
|
-
opacity: '1',
|
|
216
|
-
visibility: 'visible',
|
|
217
|
-
pointerEvents: 'all',
|
|
218
|
-
transform: 'scale(1)'
|
|
219
|
-
},
|
|
220
220
|
pointer: {
|
|
221
221
|
'.': 'epr-emoji-pointer',
|
|
222
222
|
content: '',
|
|
@@ -237,7 +237,6 @@ const styles = stylesheet.create({
|
|
|
237
237
|
},
|
|
238
238
|
'.epr-auto-theme': {
|
|
239
239
|
pointer: {
|
|
240
|
-
// @ts-ignore
|
|
241
240
|
'@media (prefers-color-scheme: dark)': {
|
|
242
241
|
backgroundPosition: '-25px 0'
|
|
243
242
|
}
|
|
@@ -2,7 +2,11 @@ import { cx } from 'flairup';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
import { ClassNames } from '../../DomUtils/classNames';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
commonInteractionStyles,
|
|
7
|
+
commonStyles,
|
|
8
|
+
stylesheet
|
|
9
|
+
} from '../../Stylesheet/stylesheet';
|
|
6
10
|
import { Button } from '../atoms/Button';
|
|
7
11
|
|
|
8
12
|
type ClickableEmojiButtonProps = Readonly<{
|
|
@@ -19,7 +19,7 @@ import Flex from '../Layout/Flex';
|
|
|
19
19
|
import Space from '../Layout/Space';
|
|
20
20
|
import { useEmojiVariationPickerState } from '../context/PickerContext';
|
|
21
21
|
import { ViewOnlyEmoji } from '../emoji/ViewOnlyEmoji';
|
|
22
|
-
import { SkinTonePickerMenu } from '../header/SkinTonePicker';
|
|
22
|
+
import { SkinTonePickerMenu } from '../header/SkinTonePicker/SkinTonePicker';
|
|
23
23
|
|
|
24
24
|
export function Preview() {
|
|
25
25
|
const previewConfig = usePreviewConfig();
|
|
@@ -88,11 +88,9 @@ export function PreviewBody() {
|
|
|
88
88
|
/>
|
|
89
89
|
) : null}
|
|
90
90
|
</div>
|
|
91
|
-
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
<div className={cx(styles.label)}>{defaultText}</div>
|
|
95
|
-
)}
|
|
91
|
+
<div className={cx(styles.label)}>
|
|
92
|
+
{show ? emojiName(emoji) : defaultText}
|
|
93
|
+
</div>
|
|
96
94
|
</>
|
|
97
95
|
);
|
|
98
96
|
}
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import Relative from '../Layout/Relative';
|
|
4
4
|
import { CategoryNavigation } from '../navigation/CategoryNavigation';
|
|
5
5
|
|
|
6
|
-
import { SearchContainer } from './Search';
|
|
6
|
+
import { SearchContainer } from './Search/Search';
|
|
7
7
|
|
|
8
8
|
export function Header() {
|
|
9
9
|
return (
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { cx } from 'flairup';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
commonInteractionStyles,
|
|
6
|
+
stylesheet
|
|
7
|
+
} from '../../../Stylesheet/stylesheet';
|
|
8
|
+
import { useClearSearch } from '../../../hooks/useFilter';
|
|
9
|
+
import { Button } from '../../atoms/Button';
|
|
10
|
+
|
|
11
|
+
import SVGTimes from './svg/times.svg';
|
|
12
|
+
|
|
13
|
+
export function BtnClearSearch() {
|
|
14
|
+
const clearSearch = useClearSearch();
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Button
|
|
18
|
+
className={cx(
|
|
19
|
+
styles.btnClearSearch,
|
|
20
|
+
commonInteractionStyles.visibleOnSearchOnly
|
|
21
|
+
)}
|
|
22
|
+
onClick={clearSearch}
|
|
23
|
+
aria-label="Clear"
|
|
24
|
+
title="Clear"
|
|
25
|
+
>
|
|
26
|
+
<div className={cx(styles.icnClearnSearch)} />
|
|
27
|
+
</Button>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const HoverDark = {
|
|
32
|
+
':hover': {
|
|
33
|
+
'> .epr-icn-clear-search': {
|
|
34
|
+
backgroundPositionY: '-60px'
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const styles = stylesheet.create({
|
|
40
|
+
btnClearSearch: {
|
|
41
|
+
'.': 'epr-btn-clear-search',
|
|
42
|
+
position: 'absolute',
|
|
43
|
+
right: 'var(--epr-search-bar-inner-padding)',
|
|
44
|
+
height: '30px',
|
|
45
|
+
width: '30px',
|
|
46
|
+
display: 'flex',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
justifyContent: 'center',
|
|
49
|
+
top: '50%',
|
|
50
|
+
transform: 'translateY(-50%)',
|
|
51
|
+
padding: '0',
|
|
52
|
+
borderRadius: '50%',
|
|
53
|
+
':hover': {
|
|
54
|
+
background: 'var(--epr-hover-bg-color)'
|
|
55
|
+
},
|
|
56
|
+
':focus': {
|
|
57
|
+
background: 'var(--epr-hover-bg-color)'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
icnClearnSearch: {
|
|
61
|
+
'.': 'epr-icn-clear-search',
|
|
62
|
+
backgroundColor: 'transparent',
|
|
63
|
+
backgroundRepeat: 'no-repeat',
|
|
64
|
+
backgroundSize: '20px',
|
|
65
|
+
height: '20px',
|
|
66
|
+
width: '20px',
|
|
67
|
+
backgroundImage: `url(${SVGTimes})`,
|
|
68
|
+
':hover': {
|
|
69
|
+
backgroundPositionY: '-20px'
|
|
70
|
+
},
|
|
71
|
+
':focus': {
|
|
72
|
+
backgroundPositionY: '-20px'
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
'.epr-dark-theme': {
|
|
76
|
+
icnClearnSearch: {
|
|
77
|
+
backgroundPositionY: '-40px'
|
|
78
|
+
},
|
|
79
|
+
btnClearSearch: HoverDark
|
|
80
|
+
},
|
|
81
|
+
'.epr-auto-theme': {
|
|
82
|
+
icnClearnSearch: {
|
|
83
|
+
'@media (prefers-color-scheme: dark)': {
|
|
84
|
+
backgroundPositionY: '-40px'
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
btnClearSearch: {
|
|
88
|
+
'@media (prefers-color-scheme: dark)': HoverDark
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import { ClassNames, asSelectors } from '
|
|
4
|
-
import { getNormalizedSearchTerm } from '
|
|
3
|
+
import { ClassNames, asSelectors } from '../../../DomUtils/classNames';
|
|
4
|
+
import { getNormalizedSearchTerm } from '../../../hooks/useFilter';
|
|
5
5
|
|
|
6
6
|
const SCOPE = `${asSelectors(ClassNames.emojiPicker)} ${asSelectors(
|
|
7
7
|
ClassNames.emojiList
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { cx } from 'flairup';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import { stylesheet } from '../../../Stylesheet/stylesheet';
|
|
5
|
+
|
|
6
|
+
import SVGMagnifier from './svg/magnifier.svg';
|
|
7
|
+
|
|
8
|
+
export function IcnSearch() {
|
|
9
|
+
return <div className={cx(styles.icnSearch)} />;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const styles = stylesheet.create({
|
|
13
|
+
icnSearch: {
|
|
14
|
+
'.': 'epr-icn-search',
|
|
15
|
+
content: '',
|
|
16
|
+
position: 'absolute',
|
|
17
|
+
top: '50%',
|
|
18
|
+
left: 'var(--epr-search-bar-inner-padding)',
|
|
19
|
+
transform: 'translateY(-50%)',
|
|
20
|
+
width: '20px',
|
|
21
|
+
height: '20px',
|
|
22
|
+
backgroundRepeat: 'no-repeat',
|
|
23
|
+
backgroundPosition: '0 0',
|
|
24
|
+
backgroundSize: '20px',
|
|
25
|
+
backgroundImage: `url(${SVGMagnifier})`
|
|
26
|
+
},
|
|
27
|
+
'.epr-dark-theme': {
|
|
28
|
+
icnSearch: {
|
|
29
|
+
backgroundPositionY: '-20px'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
'.epr-auto-theme': {
|
|
33
|
+
icnSearch: {
|
|
34
|
+
'@media (prefers-color-scheme: dark)': {
|
|
35
|
+
backgroundPositionY: '-20px'
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
@@ -2,26 +2,23 @@ import { cx } from 'flairup';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
commonInteractionStyles,
|
|
7
|
-
stylesheet
|
|
8
|
-
} from '../../Stylesheet/stylesheet';
|
|
5
|
+
import { stylesheet } from '../../../Stylesheet/stylesheet';
|
|
9
6
|
import {
|
|
10
7
|
useAutoFocusSearchConfig,
|
|
11
8
|
useSearchDisabledConfig,
|
|
12
9
|
useSearchPlaceHolderConfig
|
|
13
|
-
} from '
|
|
14
|
-
import { useCloseAllOpenToggles } from '
|
|
15
|
-
import {
|
|
16
|
-
import { useIsSkinToneInSearch } from '
|
|
17
|
-
import Flex from '
|
|
18
|
-
import Relative from '
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
10
|
+
} from '../../../config/useConfig';
|
|
11
|
+
import { useCloseAllOpenToggles } from '../../../hooks/useCloseAllOpenToggles';
|
|
12
|
+
import { useFilter } from '../../../hooks/useFilter';
|
|
13
|
+
import { useIsSkinToneInSearch } from '../../../hooks/useShouldShowSkinTonePicker';
|
|
14
|
+
import Flex from '../../Layout/Flex';
|
|
15
|
+
import Relative from '../../Layout/Relative';
|
|
16
|
+
import { useSearchInputRef } from '../../context/ElementRefContext';
|
|
17
|
+
import { SkinTonePicker } from '../SkinTonePicker/SkinTonePicker';
|
|
21
18
|
|
|
19
|
+
import { BtnClearSearch } from './BtnClearSearch';
|
|
22
20
|
import { CssSearch } from './CssSearch';
|
|
23
|
-
import {
|
|
24
|
-
import SVGMagnifier from './svg/magnifier.svg';
|
|
21
|
+
import { IcnSearch } from './IcnSearch';
|
|
25
22
|
import SVGTimes from './svg/times.svg';
|
|
26
23
|
|
|
27
24
|
export function SearchContainer() {
|
|
@@ -46,7 +43,6 @@ export function Search() {
|
|
|
46
43
|
const [inc, setInc] = useState(0);
|
|
47
44
|
const closeAllOpenToggles = useCloseAllOpenToggles();
|
|
48
45
|
const SearchInputRef = useSearchInputRef();
|
|
49
|
-
const clearSearch = useClearSearch();
|
|
50
46
|
const placeholder = useSearchPlaceHolderConfig();
|
|
51
47
|
const autoFocus = useAutoFocusSearchConfig();
|
|
52
48
|
const { statusSearchResults, searchTerm, onChange } = useFilter();
|
|
@@ -85,18 +81,8 @@ export function Search() {
|
|
|
85
81
|
{statusSearchResults}
|
|
86
82
|
</div>
|
|
87
83
|
) : null}
|
|
88
|
-
<
|
|
89
|
-
<
|
|
90
|
-
className={cx(
|
|
91
|
-
styles.btnClearSearch,
|
|
92
|
-
commonInteractionStyles.visibleOnSearchOnly
|
|
93
|
-
)}
|
|
94
|
-
onClick={clearSearch}
|
|
95
|
-
aria-label="Clear"
|
|
96
|
-
title="Clear"
|
|
97
|
-
>
|
|
98
|
-
<div className={cx(styles.icnClearnSearch)} />
|
|
99
|
-
</Button>
|
|
84
|
+
<IcnSearch />
|
|
85
|
+
<BtnClearSearch />
|
|
100
86
|
</Relative>
|
|
101
87
|
);
|
|
102
88
|
}
|
|
@@ -139,20 +125,7 @@ const styles = stylesheet.create({
|
|
|
139
125
|
color: 'var(--epr-search-input-placeholder-color)'
|
|
140
126
|
}
|
|
141
127
|
},
|
|
142
|
-
|
|
143
|
-
'.': 'epr-icn-search',
|
|
144
|
-
content: '',
|
|
145
|
-
position: 'absolute',
|
|
146
|
-
top: '50%',
|
|
147
|
-
left: 'var(--epr-search-bar-inner-padding)',
|
|
148
|
-
transform: 'translateY(-50%)',
|
|
149
|
-
width: '20px',
|
|
150
|
-
height: '20px',
|
|
151
|
-
backgroundRepeat: 'no-repeat',
|
|
152
|
-
backgroundPosition: '0 0',
|
|
153
|
-
backgroundSize: '20px',
|
|
154
|
-
backgroundImage: `url(${SVGMagnifier})`
|
|
155
|
-
},
|
|
128
|
+
|
|
156
129
|
btnClearSearch: {
|
|
157
130
|
'.': 'epr-btn-clear-search',
|
|
158
131
|
position: 'absolute',
|
|
@@ -189,9 +162,6 @@ const styles = stylesheet.create({
|
|
|
189
162
|
}
|
|
190
163
|
},
|
|
191
164
|
'.epr-dark-theme': {
|
|
192
|
-
icnSearch: {
|
|
193
|
-
backgroundPositionY: '-20px'
|
|
194
|
-
},
|
|
195
165
|
icnClearnSearch: {
|
|
196
166
|
backgroundPositionY: '-40px'
|
|
197
167
|
},
|
|
@@ -202,11 +172,6 @@ const styles = stylesheet.create({
|
|
|
202
172
|
}
|
|
203
173
|
},
|
|
204
174
|
'.epr-auto-theme': {
|
|
205
|
-
icnSearch: {
|
|
206
|
-
'@media (prefers-color-scheme: dark)': {
|
|
207
|
-
backgroundPositionY: '-20px'
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
175
|
icnClearnSearch: {
|
|
211
176
|
'@media (prefers-color-scheme: dark)': {
|
|
212
177
|
backgroundPositionY: '-40px'
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { cx } from 'flairup';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import { stylesheet } from '../../../Stylesheet/stylesheet';
|
|
5
|
+
import { skinTonesNamed } from '../../../data/skinToneVariations';
|
|
6
|
+
import { SkinTones } from '../../../types/exposedTypes';
|
|
7
|
+
import { Button } from '../../atoms/Button';
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
onClick: () => void;
|
|
12
|
+
isActive: boolean;
|
|
13
|
+
skinToneVariation: SkinTones;
|
|
14
|
+
style?: React.CSSProperties;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line complexity
|
|
18
|
+
export function BtnSkinToneVariation({
|
|
19
|
+
isOpen,
|
|
20
|
+
onClick,
|
|
21
|
+
isActive,
|
|
22
|
+
skinToneVariation,
|
|
23
|
+
style
|
|
24
|
+
}: Props) {
|
|
25
|
+
return (
|
|
26
|
+
<Button
|
|
27
|
+
style={style}
|
|
28
|
+
onClick={onClick}
|
|
29
|
+
className={cx(
|
|
30
|
+
`epr-tone-${skinToneVariation}`,
|
|
31
|
+
styles.tone,
|
|
32
|
+
!isOpen && styles.closedTone,
|
|
33
|
+
isActive && styles.active
|
|
34
|
+
)}
|
|
35
|
+
tabIndex={isOpen ? 0 : -1}
|
|
36
|
+
aria-pressed={isActive}
|
|
37
|
+
aria-label={`Skin tone ${skinTonesNamed[skinToneVariation as SkinTones]}`}
|
|
38
|
+
></Button>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const styles = stylesheet.create({
|
|
43
|
+
closedTone: {
|
|
44
|
+
opacity: '0',
|
|
45
|
+
zIndex: '0'
|
|
46
|
+
},
|
|
47
|
+
active: {
|
|
48
|
+
'.': 'epr-active',
|
|
49
|
+
zIndex: '1',
|
|
50
|
+
opacity: '1'
|
|
51
|
+
},
|
|
52
|
+
tone: {
|
|
53
|
+
'.': 'epr-tone',
|
|
54
|
+
':hover': {
|
|
55
|
+
boxShadow: '0 0 0 3px var(--epr-active-skin-hover-color)'
|
|
56
|
+
},
|
|
57
|
+
':focus': {
|
|
58
|
+
boxShadow: '0 0 0 3px var(--epr-focus-bg-color)'
|
|
59
|
+
},
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
'&.epr-tone-neutral': {
|
|
62
|
+
backgroundColor: '#ffd225'
|
|
63
|
+
},
|
|
64
|
+
'&.epr-tone-1f3fb': {
|
|
65
|
+
backgroundColor: '#ffdfbd'
|
|
66
|
+
},
|
|
67
|
+
'&.epr-tone-1f3fc': {
|
|
68
|
+
backgroundColor: '#e9c197'
|
|
69
|
+
},
|
|
70
|
+
'&.epr-tone-1f3fd': {
|
|
71
|
+
backgroundColor: '#c88e62'
|
|
72
|
+
},
|
|
73
|
+
'&.epr-tone-1f3fe': {
|
|
74
|
+
backgroundColor: '#a86637'
|
|
75
|
+
},
|
|
76
|
+
'&.epr-tone-1f3ff': {
|
|
77
|
+
backgroundColor: '#60463a'
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
@@ -2,23 +2,21 @@
|
|
|
2
2
|
import { cx } from 'flairup';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
|
|
5
|
-
import { ClassNames } from '
|
|
6
|
-
import { stylesheet } from '
|
|
7
|
-
import { useSkinTonesDisabledConfig } from '
|
|
8
|
-
import skinToneVariations
|
|
9
|
-
|
|
10
|
-
} from '
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import Absolute from '../Layout/Absolute';
|
|
15
|
-
import Relative from '../Layout/Relative';
|
|
16
|
-
import { Button } from '../atoms/Button';
|
|
17
|
-
import { useSkinTonePickerRef } from '../context/ElementRefContext';
|
|
5
|
+
import { ClassNames } from '../../../DomUtils/classNames';
|
|
6
|
+
import { stylesheet } from '../../../Stylesheet/stylesheet';
|
|
7
|
+
import { useSkinTonesDisabledConfig } from '../../../config/useConfig';
|
|
8
|
+
import skinToneVariations from '../../../data/skinToneVariations';
|
|
9
|
+
import { useCloseAllOpenToggles } from '../../../hooks/useCloseAllOpenToggles';
|
|
10
|
+
import { useFocusSearchInput } from '../../../hooks/useFocus';
|
|
11
|
+
import Absolute from '../../Layout/Absolute';
|
|
12
|
+
import Relative from '../../Layout/Relative';
|
|
13
|
+
import { useSkinTonePickerRef } from '../../context/ElementRefContext';
|
|
18
14
|
import {
|
|
19
15
|
useActiveSkinToneState,
|
|
20
16
|
useSkinToneFanOpenState
|
|
21
|
-
} from '
|
|
17
|
+
} from '../../context/PickerContext';
|
|
18
|
+
|
|
19
|
+
import { BtnSkinToneVariation } from './BtnSkinToneVariation';
|
|
22
20
|
|
|
23
21
|
const ITEM_SIZE = 28;
|
|
24
22
|
|
|
@@ -61,7 +59,8 @@ export function SkinTonePicker({
|
|
|
61
59
|
className={cx(
|
|
62
60
|
styles.skinTones,
|
|
63
61
|
vertical && styles.vertical,
|
|
64
|
-
isOpen && styles.open
|
|
62
|
+
isOpen && styles.open,
|
|
63
|
+
vertical && isOpen && styles.verticalShadow
|
|
65
64
|
)}
|
|
66
65
|
style={
|
|
67
66
|
vertical
|
|
@@ -72,8 +71,12 @@ export function SkinTonePicker({
|
|
|
72
71
|
<div className={cx(styles.select)} ref={SkinTonePickerRef}>
|
|
73
72
|
{skinToneVariations.map((skinToneVariation, i) => {
|
|
74
73
|
const active = skinToneVariation === activeSkinTone;
|
|
74
|
+
|
|
75
75
|
return (
|
|
76
|
-
<
|
|
76
|
+
<BtnSkinToneVariation
|
|
77
|
+
key={skinToneVariation}
|
|
78
|
+
skinToneVariation={skinToneVariation}
|
|
79
|
+
isOpen={isOpen}
|
|
77
80
|
style={{
|
|
78
81
|
transform: cx(
|
|
79
82
|
vertical
|
|
@@ -82,6 +85,7 @@ export function SkinTonePicker({
|
|
|
82
85
|
isOpen && active && 'scale(1.3)'
|
|
83
86
|
)
|
|
84
87
|
}}
|
|
88
|
+
isActive={active}
|
|
85
89
|
onClick={() => {
|
|
86
90
|
if (isOpen) {
|
|
87
91
|
setActiveSkinTone(skinToneVariation);
|
|
@@ -91,19 +95,7 @@ export function SkinTonePicker({
|
|
|
91
95
|
}
|
|
92
96
|
closeAllOpenToggles();
|
|
93
97
|
}}
|
|
94
|
-
|
|
95
|
-
className={cx(
|
|
96
|
-
`epr-tone-${skinToneVariation}`,
|
|
97
|
-
styles.tone,
|
|
98
|
-
!isOpen && styles.closedTone,
|
|
99
|
-
active && styles.active
|
|
100
|
-
)}
|
|
101
|
-
tabIndex={isOpen ? 0 : -1}
|
|
102
|
-
aria-pressed={active}
|
|
103
|
-
aria-label={`Skin tone ${
|
|
104
|
-
skinTonesNamed[skinToneVariation as SkinTones]
|
|
105
|
-
}`}
|
|
106
|
-
></Button>
|
|
98
|
+
/>
|
|
107
99
|
);
|
|
108
100
|
})}
|
|
109
101
|
</div>
|
|
@@ -129,12 +121,15 @@ const styles = stylesheet.create({
|
|
|
129
121
|
padding: '10px 0'
|
|
130
122
|
},
|
|
131
123
|
vertical: {
|
|
132
|
-
padding: '
|
|
124
|
+
padding: '9px',
|
|
133
125
|
alignItems: 'flex-end',
|
|
134
126
|
flexDirection: 'column',
|
|
135
127
|
borderRadius: '6px',
|
|
136
128
|
border: '1px solid var(--epr-bg-color)'
|
|
137
129
|
},
|
|
130
|
+
verticalShadow: {
|
|
131
|
+
boxShadow: '0px 0 7px var(--epr-picker-border-color)'
|
|
132
|
+
},
|
|
138
133
|
open: {
|
|
139
134
|
// @ts-ignore
|
|
140
135
|
backdropFilter: 'blur(5px)',
|
|
@@ -169,42 +164,5 @@ const styles = stylesheet.create({
|
|
|
169
164
|
zIndex: '0',
|
|
170
165
|
boxShadow: '0 0 0 0px var(--epr-active-skin-hover-color)'
|
|
171
166
|
}
|
|
172
|
-
},
|
|
173
|
-
closedTone: {
|
|
174
|
-
opacity: '0',
|
|
175
|
-
zIndex: '0'
|
|
176
|
-
},
|
|
177
|
-
active: {
|
|
178
|
-
'.': 'epr-active',
|
|
179
|
-
zIndex: '1',
|
|
180
|
-
opacity: '1'
|
|
181
|
-
},
|
|
182
|
-
tone: {
|
|
183
|
-
'.': 'epr-tone',
|
|
184
|
-
':hover': {
|
|
185
|
-
boxShadow: '0 0 0 3px var(--epr-active-skin-hover-color)'
|
|
186
|
-
},
|
|
187
|
-
':focus': {
|
|
188
|
-
boxShadow: '0 0 0 3px var(--epr-focus-bg-color)'
|
|
189
|
-
},
|
|
190
|
-
// @ts-ignore
|
|
191
|
-
'&.epr-tone-neutral': {
|
|
192
|
-
backgroundColor: '#ffd225'
|
|
193
|
-
},
|
|
194
|
-
'&.epr-tone-1f3fb': {
|
|
195
|
-
backgroundColor: '#ffdfbd'
|
|
196
|
-
},
|
|
197
|
-
'&.epr-tone-1f3fc': {
|
|
198
|
-
backgroundColor: '#e9c197'
|
|
199
|
-
},
|
|
200
|
-
'&.epr-tone-1f3fd': {
|
|
201
|
-
backgroundColor: '#c88e62'
|
|
202
|
-
},
|
|
203
|
-
'&.epr-tone-1f3fe': {
|
|
204
|
-
backgroundColor: '#a86637'
|
|
205
|
-
},
|
|
206
|
-
'&.epr-tone-1f3ff': {
|
|
207
|
-
backgroundColor: '#60463a'
|
|
208
|
-
},
|
|
209
167
|
}
|
|
210
168
|
});
|