@nectary/components 0.42.0 → 0.43.0
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/action-menu/index.js +1 -2
- package/card-container/index.js +1 -1
- package/color-menu/index.d.ts +3 -3
- package/color-menu/index.js +1 -2
- package/color-menu/types.d.ts +2 -2
- package/dialog/index.js +2 -2
- package/emoji/index.d.ts +11 -0
- package/emoji/index.js +47 -0
- package/emoji/types.d.ts +11 -0
- package/emoji/types.js +1 -0
- package/emoji/utils.d.ts +1 -0
- package/emoji/utils.js +46 -0
- package/emoji-picker/index.d.ts +28 -0
- package/emoji-picker/index.js +319 -0
- package/emoji-picker/types.d.ts +25 -0
- package/emoji-picker/types.js +1 -0
- package/icon/index.d.ts +11 -0
- package/icon/index.js +32 -0
- package/icon/types.d.ts +11 -0
- package/icon/types.js +1 -0
- package/icon-button/index.js +1 -1
- package/package.json +3 -1
- package/pop/index.js +1 -2
- package/popover/index.js +1 -2
- package/segment/index.js +1 -1
- package/select-menu/index.js +1 -2
- package/tabs/index.js +24 -76
- package/tabs/types.d.ts +9 -2
- package/tabs-icon-option/index.d.ts +11 -0
- package/tabs-icon-option/index.js +75 -0
- package/tabs-icon-option/types.d.ts +19 -0
- package/tabs-icon-option/types.js +1 -0
- package/tabs-option/index.d.ts +1 -0
- package/tabs-option/index.js +8 -15
- package/tabs-option/types.d.ts +13 -5
- package/theme/avatar.css +25 -0
- package/theme/badge.css +15 -0
- package/theme/chip.css +53 -0
- package/theme/color-swatch.css +65 -0
- package/theme/elevation.css +7 -0
- package/theme/emoji.css +6 -0
- package/theme/fonts.css +85 -0
- package/theme/fonts.json +88 -0
- package/theme/icon.css +7 -0
- package/theme/palette.css +90 -0
- package/theme/shapes.css +7 -0
- package/theme/tag.css +53 -0
- package/theme/typography.css +16 -0
- package/theme.css +2 -0
- package/tooltip/index.js +78 -31
- package/utils/csv.d.ts +3 -0
- package/utils/csv.js +21 -0
- package/utils/dom.d.ts +30 -0
- package/utils/dom.js +143 -0
- package/utils/element.d.ts +12 -0
- package/utils/element.js +38 -0
- package/utils/get-react-event-handler.d.ts +1 -0
- package/utils/get-react-event-handler.js +8 -0
- package/utils/index.d.ts +8 -57
- package/utils/index.js +8 -301
- package/utils/rect.d.ts +4 -0
- package/utils/rect.js +29 -0
- package/utils/slot.d.ts +4 -0
- package/utils/slot.js +38 -0
- package/utils/throttle.d.ts +4 -0
- package/utils/throttle.js +25 -0
- /package/{utils/animation.d.ts → tooltip/tooltip-state.d.ts} +0 -0
- /package/{utils/animation.js → tooltip/tooltip-state.js} +0 -0
package/theme/fonts.css
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
@font-face {
|
|
2
|
+
font-family: "Gilroy";
|
|
3
|
+
font-weight: 400;
|
|
4
|
+
font-style: normal;
|
|
5
|
+
font-display: swap;
|
|
6
|
+
src:
|
|
7
|
+
local("Gilroy-Regular"),
|
|
8
|
+
url("https://d2vu40klajma73.cloudfront.net/Gilroy-Regular.woff2") format("woff2"),
|
|
9
|
+
url("https://d2vu40klajma73.cloudfront.net/Gilroy-Regular.woff") format("woff");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@font-face {
|
|
13
|
+
font-family: "Gilroy";
|
|
14
|
+
font-weight: 600;
|
|
15
|
+
font-style: normal;
|
|
16
|
+
font-display: swap;
|
|
17
|
+
src:
|
|
18
|
+
local("Gilroy-SemiBold"),
|
|
19
|
+
url("https://d2vu40klajma73.cloudfront.net/Gilroy-SemiBold.woff2") format("woff2"),
|
|
20
|
+
url("https://d2vu40klajma73.cloudfront.net/Gilroy-SemiBold.woff") format("woff");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@font-face {
|
|
24
|
+
font-family: "Gilroy";
|
|
25
|
+
font-weight: 700;
|
|
26
|
+
font-style: normal;
|
|
27
|
+
font-display: swap;
|
|
28
|
+
src:
|
|
29
|
+
local("Gilroy-Bold"),
|
|
30
|
+
url("https://d2vu40klajma73.cloudfront.net/Gilroy-Bold.woff2") format("woff2"),
|
|
31
|
+
url("https://d2vu40klajma73.cloudfront.net/Gilroy-Bold.woff") format("woff");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@font-face {
|
|
35
|
+
font-family: "DM Sans";
|
|
36
|
+
font-weight: 400;
|
|
37
|
+
font-style: normal;
|
|
38
|
+
font-display: swap;
|
|
39
|
+
src:
|
|
40
|
+
local("DMSans-Regular"),
|
|
41
|
+
url("https://d2vu40klajma73.cloudfront.net/DM-Sans-400.woff2") format("woff2"),
|
|
42
|
+
url("https://d2vu40klajma73.cloudfront.net/DM-Sans-400.woff") format("woff");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@font-face {
|
|
46
|
+
font-family: "DM Sans";
|
|
47
|
+
font-weight: 500;
|
|
48
|
+
font-style: normal;
|
|
49
|
+
font-display: swap;
|
|
50
|
+
src:
|
|
51
|
+
local("DMSans-Medium"),
|
|
52
|
+
url("https://d2vu40klajma73.cloudfront.net/DM-Sans-500.woff2") format("woff2"),
|
|
53
|
+
url("https://d2vu40klajma73.cloudfront.net/DM-Sans-500.woff") format("woff");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@font-face {
|
|
57
|
+
font-family: "DM Sans";
|
|
58
|
+
font-weight: 700;
|
|
59
|
+
font-style: normal;
|
|
60
|
+
font-display: swap;
|
|
61
|
+
src:
|
|
62
|
+
local("DMSans-Bold"),
|
|
63
|
+
url("https://d2vu40klajma73.cloudfront.net/DM-Sans-700.woff2") format("woff2"),
|
|
64
|
+
url("https://d2vu40klajma73.cloudfront.net/DM-Sans-700.woff") format("woff");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@font-face {
|
|
68
|
+
font-family: "DM Mono";
|
|
69
|
+
font-weight: 400;
|
|
70
|
+
font-style: normal;
|
|
71
|
+
font-display: swap;
|
|
72
|
+
src:
|
|
73
|
+
local("DMMono-Regular"),
|
|
74
|
+
url("https://d2vu40klajma73.cloudfront.net/DM-Mono-400.woff2") format("woff2"),
|
|
75
|
+
url("https://d2vu40klajma73.cloudfront.net/DM-Mono-400.woff") format("woff");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@font-face {
|
|
79
|
+
font-family: "Material Icons Outlined";
|
|
80
|
+
font-style: normal;
|
|
81
|
+
font-weight: 400;
|
|
82
|
+
src:
|
|
83
|
+
url("https://fonts.gstatic.com/s/materialsymbolsoutlined/v63/kJF1BvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oDMzByHX9rA6RzazHD_dY43zj-jCxv3fzvRNU22ZXGJpEpjC_1v-p_4MrImHCIJIZrDCvHOejbd5zrDAt.woff2") format("woff2"),
|
|
84
|
+
url("https://fonts.gstatic.com/s/materialsymbolsoutlined/v63/kJF1BvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oDMzByHX9rA6RzazHD_dY43zj-jCxv3fzvRNU22ZXGJpEpjC_1v-p_4MrImHCIJIZrDCvHOelbd5zrDAt.woff") format("woff");
|
|
85
|
+
}
|
package/theme/fonts.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"family": "Gilroy",
|
|
4
|
+
"weight": 400,
|
|
5
|
+
"style": "normal",
|
|
6
|
+
"display": "swap",
|
|
7
|
+
"src": {
|
|
8
|
+
"local": "Gilroy-Regular",
|
|
9
|
+
"woff2": "https://d2vu40klajma73.cloudfront.net/Gilroy-Regular.woff2",
|
|
10
|
+
"woff": "https://d2vu40klajma73.cloudfront.net/Gilroy-Regular.woff"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"family": "Gilroy",
|
|
15
|
+
"weight": 600,
|
|
16
|
+
"style": "normal",
|
|
17
|
+
"display": "swap",
|
|
18
|
+
"src": {
|
|
19
|
+
"local": "Gilroy-SemiBold",
|
|
20
|
+
"woff2": "https://d2vu40klajma73.cloudfront.net/Gilroy-SemiBold.woff2",
|
|
21
|
+
"woff": "https://d2vu40klajma73.cloudfront.net/Gilroy-SemiBold.woff"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"family": "Gilroy",
|
|
26
|
+
"weight": 700,
|
|
27
|
+
"style": "normal",
|
|
28
|
+
"display": "swap",
|
|
29
|
+
"src": {
|
|
30
|
+
"local": "Gilroy-Bold",
|
|
31
|
+
"woff2": "https://d2vu40klajma73.cloudfront.net/Gilroy-Bold.woff2",
|
|
32
|
+
"woff": "https://d2vu40klajma73.cloudfront.net/Gilroy-Bold.woff"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"family": "DM Sans",
|
|
37
|
+
"weight": 400,
|
|
38
|
+
"style": "normal",
|
|
39
|
+
"display": "swap",
|
|
40
|
+
"src": {
|
|
41
|
+
"local": "DMSans-Regular",
|
|
42
|
+
"woff2": "https://d2vu40klajma73.cloudfront.net/DM-Sans-400.woff2",
|
|
43
|
+
"woff": "https://d2vu40klajma73.cloudfront.net/DM-Sans-400.woff"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"family": "DM Sans",
|
|
48
|
+
"weight": 500,
|
|
49
|
+
"style": "normal",
|
|
50
|
+
"display": "swap",
|
|
51
|
+
"src": {
|
|
52
|
+
"local": "DMSans-Medium",
|
|
53
|
+
"woff2": "https://d2vu40klajma73.cloudfront.net/DM-Sans-500.woff2",
|
|
54
|
+
"woff": "https://d2vu40klajma73.cloudfront.net/DM-Sans-500.woff"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"family": "DM Sans",
|
|
59
|
+
"weight": 700,
|
|
60
|
+
"style": "normal",
|
|
61
|
+
"display": "swap",
|
|
62
|
+
"src": {
|
|
63
|
+
"local": "DMSans-Bold",
|
|
64
|
+
"woff2": "https://d2vu40klajma73.cloudfront.net/DM-Sans-700.woff2",
|
|
65
|
+
"woff": "https://d2vu40klajma73.cloudfront.net/DM-Sans-700.woff"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"family": "DM Mono",
|
|
70
|
+
"weight": 400,
|
|
71
|
+
"style": "normal",
|
|
72
|
+
"display": "swap",
|
|
73
|
+
"src": {
|
|
74
|
+
"local": "DMMono-Regular",
|
|
75
|
+
"woff2": "https://d2vu40klajma73.cloudfront.net/DM-Mono-400.woff2",
|
|
76
|
+
"woff": "https://d2vu40klajma73.cloudfront.net/DM-Mono-400.woff"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"family": "Material Icons Outlined",
|
|
81
|
+
"weight": 400,
|
|
82
|
+
"style": "normal",
|
|
83
|
+
"src": {
|
|
84
|
+
"woff2": "https://fonts.gstatic.com/s/materialsymbolsoutlined/v63/kJF1BvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oDMzByHX9rA6RzazHD_dY43zj-jCxv3fzvRNU22ZXGJpEpjC_1v-p_4MrImHCIJIZrDCvHOejbd5zrDAt.woff2",
|
|
85
|
+
"woff": "https://fonts.gstatic.com/s/materialsymbolsoutlined/v63/kJF1BvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oDMzByHX9rA6RzazHD_dY43zj-jCxv3fzvRNU22ZXGJpEpjC_1v-p_4MrImHCIJIZrDCvHOelbd5zrDAt.woff"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
]
|
package/theme/icon.css
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
:root,
|
|
2
|
+
:host {
|
|
3
|
+
--sinch-color-honey-700: #CC8800;
|
|
4
|
+
--sinch-color-honey-600: #FFAA00;
|
|
5
|
+
--sinch-color-honey-500: #FFBE3C;
|
|
6
|
+
--sinch-color-honey-400: #FFCC66;
|
|
7
|
+
--sinch-color-honey-300: #FFDF9E;
|
|
8
|
+
--sinch-color-honey-200: #FCECCB;
|
|
9
|
+
--sinch-color-honey-100: #FFF7E6;
|
|
10
|
+
--sinch-color-tropical-700: #003D3D;
|
|
11
|
+
--sinch-color-tropical-600: #005757;
|
|
12
|
+
--sinch-color-tropical-500: #007171;
|
|
13
|
+
--sinch-color-tropical-400: #059688;
|
|
14
|
+
--sinch-color-tropical-300: #66AAAA;
|
|
15
|
+
--sinch-color-tropical-200: #A7D5C2;
|
|
16
|
+
--sinch-color-tropical-100: #DCEDE1;
|
|
17
|
+
--sinch-color-tropical-50: #E5F1F1;
|
|
18
|
+
--sinch-color-stormy-700: #000000;
|
|
19
|
+
--sinch-color-stormy-600: #171717;
|
|
20
|
+
--sinch-color-stormy-500: #242424;
|
|
21
|
+
--sinch-color-stormy-400: #595959;
|
|
22
|
+
--sinch-color-stormy-300: #767676;
|
|
23
|
+
--sinch-color-stormy-200: #8C8C8C;
|
|
24
|
+
--sinch-color-stormy-100: #A6A6A6;
|
|
25
|
+
--sinch-color-ocean-700: #1B3E65;
|
|
26
|
+
--sinch-color-ocean-600: #1686CB;
|
|
27
|
+
--sinch-color-ocean-500: #3AA7EA;
|
|
28
|
+
--sinch-color-ocean-400: #6EBBEE;
|
|
29
|
+
--sinch-color-ocean-300: #A1D5F5;
|
|
30
|
+
--sinch-color-ocean-200: #C8E6F9;
|
|
31
|
+
--sinch-color-ocean-100: #DEF2FF;
|
|
32
|
+
--sinch-color-ocean-50: #F3FAFE;
|
|
33
|
+
--sinch-color-snow-700: #CCCCCC;
|
|
34
|
+
--sinch-color-snow-600: #D9D9D9;
|
|
35
|
+
--sinch-color-snow-500: #E0E0E0;
|
|
36
|
+
--sinch-color-snow-400: #F2F2F2;
|
|
37
|
+
--sinch-color-snow-200: #F8F8F8;
|
|
38
|
+
--sinch-color-snow-100: #FFFFFF;
|
|
39
|
+
--sinch-color-raspberry-700: #882024;
|
|
40
|
+
--sinch-color-raspberry-600: #D13D42;
|
|
41
|
+
--sinch-color-raspberry-500: #EF5858;
|
|
42
|
+
--sinch-color-raspberry-400: #F38686;
|
|
43
|
+
--sinch-color-raspberry-300: #FFB8B8;
|
|
44
|
+
--sinch-color-raspberry-200: #FBD5D5;
|
|
45
|
+
--sinch-color-raspberry-100: #FFE8E4;
|
|
46
|
+
--sinch-color-raspberry-50: #FFF6F5;
|
|
47
|
+
--sinch-color-night-700: #1223a1;
|
|
48
|
+
--sinch-color-night-400: #3247E9;
|
|
49
|
+
--sinch-color-night-200: #D1D6FA;
|
|
50
|
+
--sinch-color-grass-700: #006602;
|
|
51
|
+
--sinch-color-grass-400: #39B93D;
|
|
52
|
+
--sinch-color-grass-200: #B4E4B5;
|
|
53
|
+
--sinch-color-dirt-700: #363230;
|
|
54
|
+
--sinch-color-dirt-400: #828282;
|
|
55
|
+
--sinch-color-dirt-200: #E0DDDC;
|
|
56
|
+
--sinch-color-candy-700: #981b77;
|
|
57
|
+
--sinch-color-candy-400: #E467C3;
|
|
58
|
+
--sinch-color-candy-200: #F6CBEA;
|
|
59
|
+
--sinch-color-mud-700: #6d4e46;
|
|
60
|
+
--sinch-color-mud-400: #8B6559;
|
|
61
|
+
--sinch-color-mud-200: #D7C6C1;
|
|
62
|
+
--sinch-color-orange-700: #974302;
|
|
63
|
+
--sinch-color-orange-400: #FF8C34;
|
|
64
|
+
--sinch-color-orange-200: #FFD4B3;
|
|
65
|
+
--sinch-color-bolt-700: #805500;
|
|
66
|
+
--sinch-color-bolt-400: #FFBE3C;
|
|
67
|
+
--sinch-color-bolt-200: #FFE6B3;
|
|
68
|
+
--sinch-color-violet-700: #4F1B98;
|
|
69
|
+
--sinch-color-violet-400: #9E67E4;
|
|
70
|
+
--sinch-color-violet-200: #DECBF6;
|
|
71
|
+
--sinch-color-error-700: #882024;
|
|
72
|
+
--sinch-color-error-500: #D13D42;
|
|
73
|
+
--sinch-color-error-200: #FBD5D5;
|
|
74
|
+
--sinch-color-success-700: #275D33;
|
|
75
|
+
--sinch-color-success-500: #46A65A;
|
|
76
|
+
--sinch-color-success-200: #D7F1D8;
|
|
77
|
+
--sinch-color-informative-700: #003B7E;
|
|
78
|
+
--sinch-color-informative-500: #2071CE;
|
|
79
|
+
--sinch-color-informative-200: #D5E5F8;
|
|
80
|
+
--sinch-color-warning-700: #9C2E00;
|
|
81
|
+
--sinch-color-warning-500: #F35B1C;
|
|
82
|
+
--sinch-color-warning-200: #FFE8D6;
|
|
83
|
+
--sinch-color-skin-tone-0: #FFCC4D;
|
|
84
|
+
--sinch-color-skin-tone-10: #F7DECE;
|
|
85
|
+
--sinch-color-skin-tone-20: #F3D2A2;
|
|
86
|
+
--sinch-color-skin-tone-30: #D4AB88;
|
|
87
|
+
--sinch-color-skin-tone-40: #AF7E57;
|
|
88
|
+
--sinch-color-skin-tone-50: #7C533E;
|
|
89
|
+
--sinch-color-transparent: transparent;
|
|
90
|
+
}
|
package/theme/shapes.css
ADDED
package/theme/tag.css
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
:root,
|
|
2
|
+
:host {
|
|
3
|
+
--sinch-tag-color-default-bg: var(--sinch-color-snow-500);
|
|
4
|
+
--sinch-tag-color-default-fg: var(--sinch-color-stormy-500);
|
|
5
|
+
--sinch-tag-color-light-blue-bg: var(--sinch-color-night-200);
|
|
6
|
+
--sinch-tag-color-light-blue-fg: var(--sinch-color-night-700);
|
|
7
|
+
--sinch-tag-color-light-brown-bg: var(--sinch-color-mud-200);
|
|
8
|
+
--sinch-tag-color-light-brown-fg: var(--sinch-color-mud-700);
|
|
9
|
+
--sinch-tag-color-light-gray-bg: var(--sinch-color-dirt-200);
|
|
10
|
+
--sinch-tag-color-light-gray-fg: var(--sinch-color-dirt-700);
|
|
11
|
+
--sinch-tag-color-light-green-bg: var(--sinch-color-grass-200);
|
|
12
|
+
--sinch-tag-color-light-green-fg: var(--sinch-color-grass-700);
|
|
13
|
+
--sinch-tag-color-light-orange-bg: var(--sinch-color-orange-200);
|
|
14
|
+
--sinch-tag-color-light-orange-fg: var(--sinch-color-orange-700);
|
|
15
|
+
--sinch-tag-color-light-pink-bg: var(--sinch-color-candy-200);
|
|
16
|
+
--sinch-tag-color-light-pink-fg: var(--sinch-color-candy-700);
|
|
17
|
+
--sinch-tag-color-light-violet-bg: var(--sinch-color-violet-200);
|
|
18
|
+
--sinch-tag-color-light-violet-fg: var(--sinch-color-violet-700);
|
|
19
|
+
--sinch-tag-color-light-yellow-bg: var(--sinch-color-bolt-200);
|
|
20
|
+
--sinch-tag-color-light-yellow-fg: var(--sinch-color-bolt-700);
|
|
21
|
+
--sinch-tag-color-dark-blue-bg: var(--sinch-color-night-700);
|
|
22
|
+
--sinch-tag-color-dark-blue-fg: var(--sinch-color-night-200);
|
|
23
|
+
--sinch-tag-color-dark-brown-bg: var(--sinch-color-mud-700);
|
|
24
|
+
--sinch-tag-color-dark-brown-fg: var(--sinch-color-mud-200);
|
|
25
|
+
--sinch-tag-color-dark-gray-bg: var(--sinch-color-dirt-700);
|
|
26
|
+
--sinch-tag-color-dark-gray-fg: var(--sinch-color-dirt-200);
|
|
27
|
+
--sinch-tag-color-dark-green-bg: var(--sinch-color-grass-700);
|
|
28
|
+
--sinch-tag-color-dark-green-fg: var(--sinch-color-grass-200);
|
|
29
|
+
--sinch-tag-color-dark-orange-bg: var(--sinch-color-orange-700);
|
|
30
|
+
--sinch-tag-color-dark-orange-fg: var(--sinch-color-orange-200);
|
|
31
|
+
--sinch-tag-color-dark-pink-bg: var(--sinch-color-candy-700);
|
|
32
|
+
--sinch-tag-color-dark-pink-fg: var(--sinch-color-candy-200);
|
|
33
|
+
--sinch-tag-color-dark-violet-bg: var(--sinch-color-violet-700);
|
|
34
|
+
--sinch-tag-color-dark-violet-fg: var(--sinch-color-violet-200);
|
|
35
|
+
--sinch-tag-color-dark-yellow-bg: var(--sinch-color-bolt-700);
|
|
36
|
+
--sinch-tag-color-dark-yellow-fg: var(--sinch-color-bolt-200);
|
|
37
|
+
--sinch-tag-color-blue-bg: var(--sinch-color-night-400);
|
|
38
|
+
--sinch-tag-color-blue-fg: var(--sinch-color-snow-100);
|
|
39
|
+
--sinch-tag-color-brown-bg: var(--sinch-color-mud-400);
|
|
40
|
+
--sinch-tag-color-brown-fg: var(--sinch-color-snow-100);
|
|
41
|
+
--sinch-tag-color-gray-bg: var(--sinch-color-dirt-400);
|
|
42
|
+
--sinch-tag-color-gray-fg: var(--sinch-color-snow-100);
|
|
43
|
+
--sinch-tag-color-green-bg: var(--sinch-color-grass-400);
|
|
44
|
+
--sinch-tag-color-green-fg: var(--sinch-color-stormy-500);
|
|
45
|
+
--sinch-tag-color-orange-bg: var(--sinch-color-orange-400);
|
|
46
|
+
--sinch-tag-color-orange-fg: var(--sinch-color-stormy-500);
|
|
47
|
+
--sinch-tag-color-pink-bg: var(--sinch-color-candy-400);
|
|
48
|
+
--sinch-tag-color-pink-fg: var(--sinch-color-stormy-500);
|
|
49
|
+
--sinch-tag-color-violet-bg: var(--sinch-color-violet-400);
|
|
50
|
+
--sinch-tag-color-violet-fg: var(--sinch-color-stormy-500);
|
|
51
|
+
--sinch-tag-color-yellow-bg: var(--sinch-color-bolt-400);
|
|
52
|
+
--sinch-tag-color-yellow-fg: var(--sinch-color-stormy-500);
|
|
53
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
:root,
|
|
2
|
+
:host {
|
|
3
|
+
--sinch-font-family: "Gilroy", "Arial", "sans-serif";
|
|
4
|
+
--sinch-font-weight-emphasized: 600;
|
|
5
|
+
--sinch-font-title-xl: 600 40px/48px var(--sinch-font-family);
|
|
6
|
+
--sinch-font-title-l: 600 24px/32px var(--sinch-font-family);
|
|
7
|
+
--sinch-font-title-m: 600 20px/24px var(--sinch-font-family);
|
|
8
|
+
--sinch-font-title-s: 600 16px/24px var(--sinch-font-family);
|
|
9
|
+
--sinch-font-title-xs: 600 14px/22px var(--sinch-font-family);
|
|
10
|
+
--sinch-font-text-m: 400 16px/24px var(--sinch-font-family);
|
|
11
|
+
--sinch-font-text-s: 400 14px/22px var(--sinch-font-family);
|
|
12
|
+
--sinch-font-text-xs: 400 12px/20px var(--sinch-font-family);
|
|
13
|
+
--sinch-font-text-xxs: 400 10px/16px var(--sinch-font-family);
|
|
14
|
+
--sinch-font-mono-family: "DM Mono", "monospace";
|
|
15
|
+
--sinch-font-mono-text-s: 400 16px/24px var(--sinch-font-mono-family);
|
|
16
|
+
}
|
package/theme.css
CHANGED
package/tooltip/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import '../text';
|
|
2
2
|
import '../pop';
|
|
3
3
|
import { defineCustomElement, getBooleanAttribute, getAttribute, getLiteralAttribute, updateBooleanAttribute, updateAttribute, updateLiteralAttribute, NectaryElement, setClass, rectOverlap } from '../utils';
|
|
4
|
-
import { TooltipState } from '../utils/animation';
|
|
5
4
|
const templateHTML = '<style>:host{display:contents}#content-wrapper{padding-bottom:8px}#content{position:relative;display:block;max-width:300px;padding:2px 6px;box-sizing:border-box;color:var(--sinch-color-text-default);background-color:var(--sinch-color-snow-600);border-radius:var(--sinch-shape-radius-xs);pointer-events:none;opacity:0}:host([orientation=left]) #content-wrapper{padding-bottom:0;padding-right:8px}:host([orientation=right]) #content-wrapper{padding-bottom:0;padding-left:8px}:host([orientation^=bottom]) #content-wrapper{padding-bottom:0;padding-top:8px}#text{word-break:break-word;pointer-events:none}#tip{position:absolute;left:50%;top:100%;transform:translateX(-50%) rotate(0);transform-origin:top center;fill:var(--sinch-color-snow-600);pointer-events:none}#tip.hidden{display:none}:host([orientation=left]) #tip{transform:translateX(-50%) rotate(270deg);top:50%;left:100%}:host([orientation=right]) #tip{transform:translateX(-50%) rotate(90deg);top:50%;left:0}:host([orientation^=bottom]) #tip{transform:translateX(-50%) rotate(180deg);top:0}:host([inverted]:not([inverted=false])) #content{background-color:var(--sinch-color-stormy-500);color:var(--sinch-color-text-inverted)}:host([inverted]:not([inverted=false])) #tip{fill:var(--sinch-color-stormy-500)}</style><sinch-pop id="pop"><slot id="target" slot="target"></slot><div id="content-wrapper" slot="content"><div id="content"><sinch-text id="text" type="s"></sinch-text><svg id="tip" width="8" height="4" aria-hidden="true"><path d="m4 4 4-4h-8l4 4Z"/></svg></div></div></sinch-pop>';
|
|
5
|
+
import { TooltipState } from './tooltip-state';
|
|
6
6
|
import { assertOrientation, getPopOrientation, orientationValues } from './utils';
|
|
7
7
|
const TIP_SIZE = 8;
|
|
8
8
|
const SHOW_DELAY = 1000;
|
|
9
|
-
const HIDE_DELAY =
|
|
10
|
-
const ANIMATION_DURATION =
|
|
9
|
+
const HIDE_DELAY = 0;
|
|
10
|
+
const ANIMATION_DURATION = 50;
|
|
11
11
|
const template = document.createElement('template');
|
|
12
12
|
template.innerHTML = templateHTML;
|
|
13
13
|
defineCustomElement('sinch-tooltip', class extends NectaryElement {
|
|
@@ -21,6 +21,8 @@ defineCustomElement('sinch-tooltip', class extends NectaryElement {
|
|
|
21
21
|
#tooltipState;
|
|
22
22
|
#animation = null;
|
|
23
23
|
#shouldReduceMotion = false;
|
|
24
|
+
#isConnected = false;
|
|
25
|
+
#isSubscribed = false;
|
|
24
26
|
constructor() {
|
|
25
27
|
super();
|
|
26
28
|
const shadowRoot = this.attachShadow();
|
|
@@ -36,35 +38,20 @@ defineCustomElement('sinch-tooltip', class extends NectaryElement {
|
|
|
36
38
|
showDelay: SHOW_DELAY,
|
|
37
39
|
hideDelay: this.#shouldReduceMotion ? HIDE_DELAY + ANIMATION_DURATION : HIDE_DELAY,
|
|
38
40
|
hideAnimationDuration: this.#shouldReduceMotion ? 0 : ANIMATION_DURATION,
|
|
39
|
-
onShow: this.#
|
|
40
|
-
onHideStart: this.#
|
|
41
|
-
onHideEnd: this.#
|
|
41
|
+
onShow: this.#onStateShow,
|
|
42
|
+
onHideStart: this.#onStateHideStart,
|
|
43
|
+
onHideEnd: this.#onStateHideEnd
|
|
42
44
|
});
|
|
43
45
|
}
|
|
44
46
|
connectedCallback() {
|
|
47
|
+
this.#isConnected = true;
|
|
45
48
|
this.#controller = new AbortController();
|
|
46
|
-
const {
|
|
47
|
-
signal
|
|
48
|
-
}
|
|
49
|
-
this.#$pop.addEventListener('-close', this.#onPopClose,
|
|
50
|
-
signal
|
|
51
|
-
});
|
|
52
|
-
this.#$target.addEventListener('mousedown', this.#onMouseDown, {
|
|
53
|
-
signal
|
|
54
|
-
});
|
|
55
|
-
this.#$target.addEventListener('mouseenter', this.#onMouseEnter, {
|
|
56
|
-
signal
|
|
57
|
-
});
|
|
58
|
-
this.#$target.addEventListener('mouseleave', this.#onMouseLeave, {
|
|
59
|
-
signal
|
|
60
|
-
});
|
|
61
|
-
this.#$contentWrapper.addEventListener('mouseenter', this.#onMouseEnter, {
|
|
62
|
-
signal
|
|
63
|
-
});
|
|
64
|
-
this.#$contentWrapper.addEventListener('mouseleave', this.#onMouseLeave, {
|
|
65
|
-
signal
|
|
66
|
-
});
|
|
49
|
+
const options = {
|
|
50
|
+
signal: this.#controller.signal
|
|
51
|
+
};
|
|
52
|
+
this.#$pop.addEventListener('-close', this.#onPopClose, options);
|
|
67
53
|
updateAttribute(this.#$pop, 'orientation', getPopOrientation(this.orientation));
|
|
54
|
+
this.#updateText();
|
|
68
55
|
}
|
|
69
56
|
disconnectedCallback() {
|
|
70
57
|
this.#controller.abort();
|
|
@@ -101,7 +88,7 @@ defineCustomElement('sinch-tooltip', class extends NectaryElement {
|
|
|
101
88
|
switch (name) {
|
|
102
89
|
case 'text':
|
|
103
90
|
{
|
|
104
|
-
this
|
|
91
|
+
this.#updateText();
|
|
105
92
|
break;
|
|
106
93
|
}
|
|
107
94
|
case 'orientation':
|
|
@@ -118,19 +105,28 @@ defineCustomElement('sinch-tooltip', class extends NectaryElement {
|
|
|
118
105
|
}
|
|
119
106
|
#onMouseDown = () => {
|
|
120
107
|
this.#tooltipState.interrupt();
|
|
108
|
+
this.#unsubscribeScroll();
|
|
121
109
|
};
|
|
122
110
|
#onPopClose = () => {
|
|
123
111
|
this.#tooltipState.destroy();
|
|
112
|
+
this.#unsubscribeScroll();
|
|
124
113
|
};
|
|
125
114
|
#onMouseEnter = () => {
|
|
126
115
|
this.#tooltipState.show();
|
|
116
|
+
this.#subscribeScroll();
|
|
117
|
+
this.#subscribeMouseLeaveEvents();
|
|
127
118
|
};
|
|
128
119
|
#onMouseLeave = e => {
|
|
129
120
|
if (!this.#isOpen() || e.relatedTarget !== this.#$contentWrapper && e.relatedTarget !== this.#$target) {
|
|
130
121
|
this.#tooltipState.hide();
|
|
122
|
+
this.#unsubscribeScroll();
|
|
131
123
|
}
|
|
132
124
|
};
|
|
133
|
-
#
|
|
125
|
+
#onScroll = () => {
|
|
126
|
+
this.#tooltipState.destroy();
|
|
127
|
+
this.#unsubscribeScroll();
|
|
128
|
+
};
|
|
129
|
+
#onStateShow = () => {
|
|
134
130
|
updateBooleanAttribute(this.#$pop, 'open', true);
|
|
135
131
|
requestAnimationFrame(this.#updateTipOrientation);
|
|
136
132
|
if (this.#animation !== null) {
|
|
@@ -146,14 +142,15 @@ defineCustomElement('sinch-tooltip', class extends NectaryElement {
|
|
|
146
142
|
});
|
|
147
143
|
}
|
|
148
144
|
};
|
|
149
|
-
#
|
|
145
|
+
#onStateHideStart = () => {
|
|
150
146
|
this.#animation.updatePlaybackRate(-1);
|
|
151
147
|
this.#animation.play();
|
|
152
148
|
};
|
|
153
|
-
#
|
|
149
|
+
#onStateHideEnd = () => {
|
|
154
150
|
this.#animation.finish();
|
|
155
151
|
this.#resetTipOrientation();
|
|
156
152
|
updateBooleanAttribute(this.#$pop, 'open', false);
|
|
153
|
+
this.#unsubscribeMouseLeaveEvents();
|
|
157
154
|
};
|
|
158
155
|
#resetTipOrientation() {
|
|
159
156
|
this.#$tip.style.top = '';
|
|
@@ -180,6 +177,56 @@ defineCustomElement('sinch-tooltip', class extends NectaryElement {
|
|
|
180
177
|
}
|
|
181
178
|
setClass(this.#$tip, 'hidden', rectOverlap(targetRect, contentRect));
|
|
182
179
|
};
|
|
180
|
+
#updateText() {
|
|
181
|
+
if (!this.#isConnected) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const value = this.text;
|
|
185
|
+
this.#$tooltipText.textContent = value;
|
|
186
|
+
if (value.length === 0) {
|
|
187
|
+
if (this.#isSubscribed) {
|
|
188
|
+
this.#tooltipState.destroy();
|
|
189
|
+
this.#unsubscribeMouseEnterEvent();
|
|
190
|
+
this.#unsubscribeMouseLeaveEvents();
|
|
191
|
+
}
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
this.#subscribeMouseEnterEvent();
|
|
195
|
+
}
|
|
196
|
+
#subscribeMouseEnterEvent() {
|
|
197
|
+
if (!this.#isConnected || this.#isSubscribed) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
this.#$target.addEventListener('mouseenter', this.#onMouseEnter, {
|
|
201
|
+
signal: this.#controller.signal
|
|
202
|
+
});
|
|
203
|
+
this.#isSubscribed = true;
|
|
204
|
+
}
|
|
205
|
+
#unsubscribeMouseEnterEvent() {
|
|
206
|
+
this.#$target.removeEventListener('mouseenter', this.#onMouseEnter);
|
|
207
|
+
this.#isSubscribed = false;
|
|
208
|
+
}
|
|
209
|
+
#subscribeMouseLeaveEvents() {
|
|
210
|
+
const options = {
|
|
211
|
+
signal: this.#controller.signal
|
|
212
|
+
};
|
|
213
|
+
this.#$target.addEventListener('mousedown', this.#onMouseDown, options);
|
|
214
|
+
this.#$target.addEventListener('mouseleave', this.#onMouseLeave, options);
|
|
215
|
+
this.#$contentWrapper.addEventListener('mouseenter', this.#onMouseEnter, options);
|
|
216
|
+
this.#$contentWrapper.addEventListener('mouseleave', this.#onMouseLeave, options);
|
|
217
|
+
}
|
|
218
|
+
#unsubscribeMouseLeaveEvents() {
|
|
219
|
+
this.#$target.removeEventListener('mousedown', this.#onMouseDown);
|
|
220
|
+
this.#$target.removeEventListener('mouseleave', this.#onMouseLeave);
|
|
221
|
+
this.#$contentWrapper.removeEventListener('mouseenter', this.#onMouseEnter);
|
|
222
|
+
this.#$contentWrapper.removeEventListener('mouseleave', this.#onMouseLeave);
|
|
223
|
+
}
|
|
224
|
+
#subscribeScroll() {
|
|
225
|
+
window.addEventListener('wheel', this.#onScroll, true);
|
|
226
|
+
}
|
|
227
|
+
#unsubscribeScroll() {
|
|
228
|
+
window.removeEventListener('wheel', this.#onScroll, true);
|
|
229
|
+
}
|
|
183
230
|
#isOpen() {
|
|
184
231
|
return this.#$pop.hasAttribute('open');
|
|
185
232
|
}
|
package/utils/csv.d.ts
ADDED
package/utils/csv.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const unpackCsv = csv => {
|
|
2
|
+
return csv === '' ? [] : csv.split(',');
|
|
3
|
+
};
|
|
4
|
+
const packCsv = values => {
|
|
5
|
+
return Array.from(values).join(',');
|
|
6
|
+
};
|
|
7
|
+
export const getCsvSet = acc => {
|
|
8
|
+
return new Set(unpackCsv(acc));
|
|
9
|
+
};
|
|
10
|
+
export const updateCsv = (acc, value, setActive) => {
|
|
11
|
+
const values = getCsvSet(acc);
|
|
12
|
+
if (setActive) {
|
|
13
|
+
values.add(value);
|
|
14
|
+
} else {
|
|
15
|
+
values.delete(value);
|
|
16
|
+
}
|
|
17
|
+
return packCsv(values);
|
|
18
|
+
};
|
|
19
|
+
export const getFirstCsvValue = acc => {
|
|
20
|
+
return acc === '' ? null : unpackCsv(acc)[0];
|
|
21
|
+
};
|
package/utils/dom.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const updateExplicitBooleanAttribute: ($element: Element, attrName: string, attrValue: boolean | null | undefined) => void;
|
|
2
|
+
export declare const isAttrTrue: (attrValue: string | null) => boolean;
|
|
3
|
+
export declare const getBooleanAttribute: ($element: Element, attrName: string) => boolean;
|
|
4
|
+
export declare const updateBooleanAttribute: ($element: Element, attrName: string, attrValue: boolean | null | undefined) => void;
|
|
5
|
+
export declare const updateAttribute: ($element: Element, attrName: string, attrValue: string | number | boolean | null | undefined) => void;
|
|
6
|
+
export declare function getAttribute($element: Element, attrName: string): string | null;
|
|
7
|
+
export declare function getAttribute($element: Element, attrName: string, defaultValue: string): string;
|
|
8
|
+
export declare const isLiteralValue: <T extends readonly string[]>(literals: T, value: string | null | undefined) => value is T[number];
|
|
9
|
+
export declare const updateLiteralAttribute: <T extends readonly string[]>($element: Element, literals: T, attrName: string, attrValue: string | null | undefined) => void;
|
|
10
|
+
export declare function getLiteralAttribute<T extends readonly string[]>($element: Element, literals: T, attrName: string): T[number];
|
|
11
|
+
export declare function getLiteralAttribute<T extends readonly string[]>($element: Element, literals: T, attrName: string, defaultValue: null): T[number] | null;
|
|
12
|
+
export declare function getLiteralAttribute<T extends readonly string[]>($element: Element, literals: T, attrName: string, defaultValue: T[number]): T[number];
|
|
13
|
+
export declare const clampNumber: (value: number, min: number, max: number) => number;
|
|
14
|
+
declare type IntegerOptions = {
|
|
15
|
+
min?: number;
|
|
16
|
+
max?: number;
|
|
17
|
+
defaultValue?: number | null;
|
|
18
|
+
itemSizeMultiplier?: number;
|
|
19
|
+
itemSpaceBetween?: number;
|
|
20
|
+
};
|
|
21
|
+
export declare const attrValueToInteger: (value: string | null, options?: IntegerOptions) => number | null;
|
|
22
|
+
export declare const attrValueToPixels: (value: string | null, options?: IntegerOptions) => string;
|
|
23
|
+
export declare const updateIntegerAttribute: ($element: Element, attrName: string, attrValue: string | number | null | undefined, options?: IntegerOptions) => void;
|
|
24
|
+
export declare function getIntegerAttribute($element: Element, attrName: string): number | undefined;
|
|
25
|
+
export declare function getIntegerAttribute($element: Element, attrName: string, defaultValue: null): number | null;
|
|
26
|
+
export declare function getIntegerAttribute($element: Element, attrName: string, defaultValue: number): number;
|
|
27
|
+
export declare const setClass: (elem: Element, name: string, isSet: boolean) => void;
|
|
28
|
+
export declare const getCssVar: (element: Element, variableName: string) => string | null;
|
|
29
|
+
export declare const cloneNode: (el: Element, deep: boolean) => Element;
|
|
30
|
+
export {};
|