@infonomic/uikit 5.3.0 → 5.5.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/dist/astro.d.ts +51 -0
- package/dist/astro.js +51 -0
- package/dist/components/accordion/accordion.module.css +60 -0
- package/dist/components/avatar/avatar.module.css +54 -0
- package/dist/components/badge/badge.module.css +61 -0
- package/dist/components/button/button-group.module.css +19 -0
- package/dist/components/button/button.astro +86 -0
- package/dist/components/button/button.module.css +431 -0
- package/dist/components/button/control-buttons.module.css +132 -0
- package/dist/components/button/copy-button.module.css +56 -0
- package/dist/components/button/icon-button.astro +47 -0
- package/dist/components/card/card-content.astro +14 -0
- package/dist/components/card/card-description.astro +14 -0
- package/dist/components/card/card-footer.astro +14 -0
- package/dist/components/card/card-header.astro +14 -0
- package/dist/components/card/card-title.astro +14 -0
- package/dist/components/card/card.astro +41 -0
- package/dist/components/card/card.module.css +77 -0
- package/dist/components/container/container.astro +13 -0
- package/dist/components/container/container.module.css +36 -0
- package/dist/components/dropdown/dropdown.module.css +120 -0
- package/dist/components/forms/calendar.module.css +269 -0
- package/dist/components/forms/checkbox.astro +129 -0
- package/dist/components/forms/checkbox.js +1 -1
- package/dist/components/forms/checkbox.module.css +211 -0
- package/dist/components/forms/error-text.astro +14 -0
- package/dist/components/forms/error-text.module.css +9 -0
- package/dist/components/forms/help-text.astro +13 -0
- package/dist/components/forms/help-text.module.css +9 -0
- package/dist/components/forms/input-adornment.astro +26 -0
- package/dist/components/forms/input-adornment.module.css +21 -0
- package/dist/components/forms/input.astro +99 -0
- package/dist/components/forms/input.module.css +278 -0
- package/dist/components/forms/label.astro +24 -0
- package/dist/components/forms/label.module.css +15 -0
- package/dist/components/forms/radio-group.module.css +163 -0
- package/dist/components/forms/select.module.css +68 -0
- package/dist/components/forms/text-area.astro +77 -0
- package/dist/components/forms/text-area.module.css +10 -0
- package/dist/components/hamburger/hamburger.astro +30 -0
- package/dist/components/notifications/alert.module.css +110 -0
- package/dist/components/notifications/toast.module.css +237 -0
- package/dist/components/overlay/overlay.module.css +41 -0
- package/dist/components/pager/pagination.module.css +149 -0
- package/dist/components/scroll-area/scroll-area.module.css +64 -0
- package/dist/components/scroll-to-top/scroll-to-top.astro +75 -0
- package/dist/components/scroll-to-top/scroll-to-top.module.css +86 -0
- package/dist/components/section/section.astro +13 -0
- package/dist/components/section/section.module.css +9 -0
- package/dist/components/shimmer/shimmer.module.css +53 -0
- package/dist/components/table/table.module.css +100 -0
- package/dist/components/tabs/tabs.module.css +66 -0
- package/dist/components/tooltip/tooltip.module.css +45 -0
- package/dist/icons/check-icon.astro +37 -0
- package/dist/icons/close-icon.astro +38 -0
- package/dist/icons/icon-element.astro +27 -0
- package/dist/icons/icons.module.css +155 -0
- package/dist/icons/light-icon.astro +36 -0
- package/dist/icons/moon-icon.astro +38 -0
- package/dist/icons/search-icon.astro +40 -0
- package/dist/widgets/datepicker/datepicker.module.css +189 -0
- package/dist/widgets/drawer/drawer.module.css +112 -0
- package/dist/widgets/modal/modal.module.css +81 -0
- package/dist/widgets/timeline/timeline.module.css +87 -0
- package/package.json +5 -4
- package/src/astro.js +6 -0
- package/src/components/forms/checkbox.astro +129 -0
- package/src/components/forms/checkbox.tsx +1 -1
- package/src/components/forms/text-area.astro +77 -0
- package/src/icons/check-icon.astro +37 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
@layer infonomic-base, infonomic-functional, infonomic-utilities, infonomic-theme, infonomic-typography, infonomic-components;
|
|
2
|
+
|
|
3
|
+
@layer infonomic-components {
|
|
4
|
+
/* Positions are relative to the toast viewport which is set
|
|
5
|
+
globally in components/toast.css */
|
|
6
|
+
|
|
7
|
+
.root {
|
|
8
|
+
position: absolute;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
gap: var(--gap-1);
|
|
12
|
+
padding-top: 12px;
|
|
13
|
+
padding-bottom: 16px;
|
|
14
|
+
background: var(--gray-25);
|
|
15
|
+
border-width: var(--border-width-thin);
|
|
16
|
+
border-color: var(--border-color);
|
|
17
|
+
border-style: var(--border-style-solid);
|
|
18
|
+
border-radius: var(--border-radius-md);
|
|
19
|
+
box-shadow: var(--shadow-sm);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.root:is(:global(.dark) *) {
|
|
23
|
+
background: var(--canvas-800);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.root[data-state="open"] {
|
|
27
|
+
animation: slideInFromBottom 150ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.root[data-state="closed"] {
|
|
31
|
+
animation: hide 100ms ease-in;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.root[data-swipe="move"] {
|
|
35
|
+
transform: translateX(var(--radix-toast-swipe-move-x));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.root[data-swipe="cancel"] {
|
|
39
|
+
transform: translateX(0);
|
|
40
|
+
transition: transform 200ms ease-out;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.root.top-right[data-swipe="end"],
|
|
44
|
+
.root.bottom-right[data-swipe="end"] {
|
|
45
|
+
animation: swipeOutToRight 100ms ease-out;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.root.top-left[data-swipe="end"],
|
|
49
|
+
.root.bottom-left[data-swipe="end"] {
|
|
50
|
+
animation: swipeOutToLeft 100ms ease-out;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.header {
|
|
54
|
+
display: flex;
|
|
55
|
+
padding: 0 16px 0 12px;
|
|
56
|
+
align-items: start;
|
|
57
|
+
gap: var(--gap-2);
|
|
58
|
+
justify-content: space-between;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.close {
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
padding: 0;
|
|
66
|
+
min-width: 24px;
|
|
67
|
+
min-height: 24px;
|
|
68
|
+
width: 24px;
|
|
69
|
+
height: 24px;
|
|
70
|
+
border-radius: 100%;
|
|
71
|
+
margin-left: auto;
|
|
72
|
+
margin-top: -2px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.close svg {
|
|
76
|
+
fill: white;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
.title {
|
|
81
|
+
display: flex;
|
|
82
|
+
padding: 0 12px 0 8px;
|
|
83
|
+
align-items: start;
|
|
84
|
+
gap: var(--gap-2);
|
|
85
|
+
margin-bottom: 5px;
|
|
86
|
+
font-weight: 500;
|
|
87
|
+
font-size: 15px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.description {
|
|
91
|
+
margin: 0;
|
|
92
|
+
padding: 0 8px 0 12px;
|
|
93
|
+
font-size: var(--font-size-sm);
|
|
94
|
+
line-height: 1.3;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.action {
|
|
98
|
+
display: flex;
|
|
99
|
+
justify-content: end;
|
|
100
|
+
padding: 0 12px 0 12px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Positions are relative to the toast viewport which is set
|
|
104
|
+
globally in components/toast.css */
|
|
105
|
+
|
|
106
|
+
.top-left {
|
|
107
|
+
top: 88px;
|
|
108
|
+
right: 16px;
|
|
109
|
+
left: 16px;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.top-right {
|
|
113
|
+
top: 88px;
|
|
114
|
+
right: 16px;
|
|
115
|
+
left: 16px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.bottom-left {
|
|
119
|
+
bottom: 16px;
|
|
120
|
+
right: 16px;
|
|
121
|
+
left: 16px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.bottom-right {
|
|
125
|
+
bottom: 16px;
|
|
126
|
+
right: 16px;
|
|
127
|
+
left: 16px;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@media (min-width: 48rem) {
|
|
131
|
+
|
|
132
|
+
.root.top-right[data-state="open"],
|
|
133
|
+
.root.bottom-right[data-state="open"] {
|
|
134
|
+
animation: slideInFromRight 150ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.root.top-left[data-state="open"],
|
|
138
|
+
.root.bottom-left[data-state="open"] {
|
|
139
|
+
animation: slideInFromLeft 150ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.bottom-right {
|
|
143
|
+
bottom: 16px;
|
|
144
|
+
right: 16px;
|
|
145
|
+
left: auto;
|
|
146
|
+
width: 100%;
|
|
147
|
+
max-width: 390px;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.bottom-left {
|
|
151
|
+
bottom: 16px;
|
|
152
|
+
left: 16px;
|
|
153
|
+
right: auto;
|
|
154
|
+
width: 100%;
|
|
155
|
+
max-width: 390px;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.top-left {
|
|
159
|
+
top: 88px;
|
|
160
|
+
left: 16px;
|
|
161
|
+
right: auto;
|
|
162
|
+
bottom: auto;
|
|
163
|
+
width: 100%;
|
|
164
|
+
max-width: 390px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.top-right {
|
|
168
|
+
top: 88px;
|
|
169
|
+
right: 16px;
|
|
170
|
+
bottom: auto;
|
|
171
|
+
left: auto;
|
|
172
|
+
width: 100%;
|
|
173
|
+
max-width: 390px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
@keyframes slideInFromRight {
|
|
179
|
+
from {
|
|
180
|
+
transform: translateX(calc(100% + var(--viewport-padding)));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
to {
|
|
184
|
+
transform: translateX(0);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
@keyframes slideInFromLeft {
|
|
189
|
+
from {
|
|
190
|
+
transform: translateX(calc(-100% - var(--viewport-padding)));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
to {
|
|
194
|
+
transform: translateX(0);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
@keyframes slideInFromBottom {
|
|
199
|
+
from {
|
|
200
|
+
transform: translateY(calc(100% + var(--viewport-padding)));
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
to {
|
|
204
|
+
transform: translateY(0);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@keyframes swipeOutToRight {
|
|
209
|
+
from {
|
|
210
|
+
transform: translateX(var(--radix-toast-swipe-end-x));
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
to {
|
|
214
|
+
transform: translateX(calc(100% + var(--viewport-padding)));
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
@keyframes swipeOutToLeft {
|
|
219
|
+
from {
|
|
220
|
+
transform: translateX(var(--radix-toast-swipe-end-x));
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
to {
|
|
224
|
+
transform: translateX(calc(-100% - var(--viewport-padding)));
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
@keyframes hide {
|
|
229
|
+
from {
|
|
230
|
+
opacity: 1;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
to {
|
|
234
|
+
opacity: 0;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
.overlay {
|
|
2
|
+
position: fixed;
|
|
3
|
+
top: 0;
|
|
4
|
+
left: 0;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
background-color: rgba(245, 245, 245, 0.35);
|
|
8
|
+
z-index: 20;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.overlay:is(:global(.dark) *) {
|
|
12
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.animate-fade-in {
|
|
16
|
+
animation: fade-in 0.3s ease-in-out;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.animate-fade-out {
|
|
20
|
+
animation: fade-out 0.3s ease-in-out;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@keyframes fade-in {
|
|
24
|
+
from {
|
|
25
|
+
opacity: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
to {
|
|
29
|
+
opacity: 1;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@keyframes fade-out {
|
|
34
|
+
from {
|
|
35
|
+
opacity: 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
to {
|
|
39
|
+
opacity: 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
@layer infonomic-base, infonomic-functional, infonomic-utilities, infonomic-theme, infonomic-typography, infonomic-components;
|
|
2
|
+
|
|
3
|
+
@layer infonomic-components {
|
|
4
|
+
.pagination-root {
|
|
5
|
+
display: flex;
|
|
6
|
+
padding: 0;
|
|
7
|
+
align-items: center;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.pagination-items {
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
list-style: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.pagination-items {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
list-style: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.pagination-items.dashboard li,
|
|
23
|
+
.pagination-items.default li {
|
|
24
|
+
margin-right: -1px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.pagination-items.classic li {
|
|
28
|
+
margin-right: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.pagination-items.classic {
|
|
32
|
+
gap: 6px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.number-button.dashboard.rounded-left,
|
|
36
|
+
.number-button.default.rounded-left,
|
|
37
|
+
.first-button.dashboard.rounded-left,
|
|
38
|
+
.first-button.default.rounded-left,
|
|
39
|
+
.previous-button.dashboard.rounded-left,
|
|
40
|
+
.previous-button.default.rounded-left,
|
|
41
|
+
.last-button.dashboard.rounded-left,
|
|
42
|
+
.last-button.default.rounded-left,
|
|
43
|
+
.next-button.dashboard.rounded-left,
|
|
44
|
+
.next-button.default.rounded-left {
|
|
45
|
+
border-top-left-radius: var(--border-radius-sm);
|
|
46
|
+
border-bottom-left-radius: var(--border-radius-sm);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.number-button.dashboard.rounded-right,
|
|
50
|
+
.number-button.default.rounded-right,
|
|
51
|
+
.first-button.dashboard.rounded-right,
|
|
52
|
+
.first-button.default.rounded-right,
|
|
53
|
+
.previous-button.dashboard.rounded-right,
|
|
54
|
+
.previous-button.default.rounded-right,
|
|
55
|
+
.last-button.dashboard.rounded-right,
|
|
56
|
+
.last-button.default.rounded-right,
|
|
57
|
+
.next-button.dashboard.rounded-right,
|
|
58
|
+
.next-button.default.rounded-right {
|
|
59
|
+
border-top-right-radius: var(--border-radius-sm);
|
|
60
|
+
border-bottom-right-radius: var(--border-radius-sm);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.ellipses,
|
|
64
|
+
.last-button,
|
|
65
|
+
.next-button,
|
|
66
|
+
.previous-button,
|
|
67
|
+
.first-button,
|
|
68
|
+
.number-button {
|
|
69
|
+
margin-left: 0;
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
height: 32px;
|
|
74
|
+
line-height: 1;
|
|
75
|
+
border: 1px solid var(--stroke-primary);
|
|
76
|
+
background-color: var(--background);
|
|
77
|
+
color: var(--foreground);
|
|
78
|
+
font-size: var(--font-size-sm);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
.previous-button,
|
|
83
|
+
.last-button,
|
|
84
|
+
.next-button,
|
|
85
|
+
.first-button {
|
|
86
|
+
width: 38px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.ellipses,
|
|
90
|
+
.number-button {
|
|
91
|
+
min-width: 42px;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.last-button:hover,
|
|
95
|
+
.next-button:hover,
|
|
96
|
+
.number-button:hover,
|
|
97
|
+
.previous-button:hover,
|
|
98
|
+
.first-button:hover {
|
|
99
|
+
color: var(--text-on-primary);
|
|
100
|
+
background-color: var(--fill-primary-strong);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.last-button:disabled,
|
|
104
|
+
.last-button[disabled],
|
|
105
|
+
.next-button:disabled,
|
|
106
|
+
.next-button[disabled],
|
|
107
|
+
.number-button:disabled,
|
|
108
|
+
.number-button[disabled],
|
|
109
|
+
.previous-button:disabled,
|
|
110
|
+
.previous-button[disabled],
|
|
111
|
+
.first-button:disabled,
|
|
112
|
+
.first-button[disabled] {
|
|
113
|
+
cursor: default;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.number-button.active {
|
|
117
|
+
color: var(--text-on-primary);
|
|
118
|
+
background-color: var(--fill-primary-strong);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
/* Opinionated mobile */
|
|
123
|
+
.mobile-toggle {
|
|
124
|
+
display: none;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@media(min-width: 40rem) {
|
|
128
|
+
|
|
129
|
+
.mobile-toggle {
|
|
130
|
+
display: flex;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* 🌙 Dark via `.dark` class. We rely on the
|
|
135
|
+
* consuming application to detect a user's preferred
|
|
136
|
+
* color scheme - either by header or cookie, and set
|
|
137
|
+
* a root html class accordingly
|
|
138
|
+
*/
|
|
139
|
+
:global(.dark) {
|
|
140
|
+
.ellipses,
|
|
141
|
+
.number-button,
|
|
142
|
+
.next-button,
|
|
143
|
+
.last-button,
|
|
144
|
+
.previous-button,
|
|
145
|
+
.first-button {
|
|
146
|
+
border-color: var(--canvas-700);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
@layer infonomic-base, infonomic-functional, infonomic-utilities, infonomic-theme, infonomic-typography, infonomic-components;
|
|
2
|
+
|
|
3
|
+
@layer infonomic-components {
|
|
4
|
+
.root {
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
background-color: inherit;
|
|
8
|
+
--scrollbar-size: 10px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.viewport {
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 100%;
|
|
14
|
+
border-radius: inherit;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.scrollbar {
|
|
18
|
+
display: flex;
|
|
19
|
+
/* ensures no selection */
|
|
20
|
+
user-select: none;
|
|
21
|
+
/* disable browser handling of all panning and zooming gestures on touch devices */
|
|
22
|
+
touch-action: none;
|
|
23
|
+
padding: 2px;
|
|
24
|
+
background: var(--surface-panel-scrollbar);
|
|
25
|
+
transition: background 160ms ease-out;
|
|
26
|
+
|
|
27
|
+
&:hover {
|
|
28
|
+
background: var(--surface-panel-scrollbar);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&[data-orientation="vertical"] {
|
|
32
|
+
width: var(--scrollbar-size);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&[data-orientation="horizontal"] {
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
height: var(--scrollbar-size);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.thumb {
|
|
42
|
+
flex: 1;
|
|
43
|
+
background: var(--surface-panel-scrollbar-thumb);
|
|
44
|
+
border-radius: var(--border-radius-sm);
|
|
45
|
+
position: relative;
|
|
46
|
+
|
|
47
|
+
/* increase target size for touch devices https://www.w3.org/WAI/WCAG21/Understanding/target-size.html */
|
|
48
|
+
&::before {
|
|
49
|
+
content: "";
|
|
50
|
+
position: absolute;
|
|
51
|
+
top: 50%;
|
|
52
|
+
left: 50%;
|
|
53
|
+
transform: translate(-50%, -50%);
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: 100%;
|
|
56
|
+
min-width: 44px;
|
|
57
|
+
min-height: 44px;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.corner {
|
|
62
|
+
background: var(--surface-panel-scrollbar);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
import styles from './scroll-to-top.module.css'
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
class?: string
|
|
6
|
+
showAt?: number
|
|
7
|
+
offset?: number
|
|
8
|
+
'aria-label'?: string
|
|
9
|
+
[key: string]: any
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
class: className,
|
|
14
|
+
showAt = 200,
|
|
15
|
+
offset = -65,
|
|
16
|
+
'aria-label': ariaLabel = 'Scroll to top',
|
|
17
|
+
...rest
|
|
18
|
+
} = Astro.props
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
<button
|
|
22
|
+
type="button"
|
|
23
|
+
aria-label={ariaLabel}
|
|
24
|
+
class:list={['scroll-to-top', styles['scroll-to-top'], className]}
|
|
25
|
+
data-show-at={showAt}
|
|
26
|
+
data-offset={offset}
|
|
27
|
+
data-class-shown={styles['scroll-to-top-shown']}
|
|
28
|
+
{...rest}
|
|
29
|
+
>
|
|
30
|
+
<span aria-hidden="true">
|
|
31
|
+
<svg class="icon" style="fill: currentColor" focusable="false" viewBox="0 0 51 32">
|
|
32
|
+
<path d="M25.4,9.8L45.6,30l4.5-4.5L25.4,0.8L0.8,25.4L5.3,30L25.4,9.8z"></path>
|
|
33
|
+
</svg>
|
|
34
|
+
</span>
|
|
35
|
+
</button>
|
|
36
|
+
|
|
37
|
+
<script>
|
|
38
|
+
const buttons = document.querySelectorAll('button.scroll-to-top')
|
|
39
|
+
|
|
40
|
+
buttons.forEach((button) => {
|
|
41
|
+
if (!(button instanceof HTMLElement)) return
|
|
42
|
+
|
|
43
|
+
const showAt = Number(button.dataset.showAt) || 200
|
|
44
|
+
const offset = Number(button.dataset.offset) || -65
|
|
45
|
+
const classShown = button.dataset.classShown
|
|
46
|
+
|
|
47
|
+
if (classShown == null) return
|
|
48
|
+
|
|
49
|
+
// Click Handler
|
|
50
|
+
button.addEventListener('click', () => {
|
|
51
|
+
window.scrollTo({ top: offset, left: 0, behavior: 'smooth' })
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
// Scroll Handler
|
|
55
|
+
let ticking = false
|
|
56
|
+
const handleOnScroll = () => {
|
|
57
|
+
if (!ticking) {
|
|
58
|
+
window.requestAnimationFrame(() => {
|
|
59
|
+
const shouldShow = window.scrollY > showAt
|
|
60
|
+
if (shouldShow) {
|
|
61
|
+
button.classList.add(classShown)
|
|
62
|
+
button.classList.add('scroll-to-top-shown')
|
|
63
|
+
} else {
|
|
64
|
+
button.classList.remove(classShown)
|
|
65
|
+
button.classList.remove('scroll-to-top-shown')
|
|
66
|
+
}
|
|
67
|
+
ticking = false
|
|
68
|
+
})
|
|
69
|
+
ticking = true
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
window.addEventListener('scroll', handleOnScroll, { passive: true })
|
|
74
|
+
})
|
|
75
|
+
</script>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
@layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-typography, infonomic-components;
|
|
2
|
+
|
|
3
|
+
@layer infonomic-components {
|
|
4
|
+
.scroll-to-top,
|
|
5
|
+
:global(.scroll-to-top) {
|
|
6
|
+
display: flex;
|
|
7
|
+
position: fixed;
|
|
8
|
+
width: 0;
|
|
9
|
+
height: 0;
|
|
10
|
+
opacity: 0;
|
|
11
|
+
visibility: hidden;
|
|
12
|
+
align-items: center;
|
|
13
|
+
text-decoration: none;
|
|
14
|
+
border-style: none;
|
|
15
|
+
padding: 0;
|
|
16
|
+
margin: 0;
|
|
17
|
+
outline: none;
|
|
18
|
+
z-index: 20;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
bottom: 45px;
|
|
21
|
+
right: 30px;
|
|
22
|
+
color: var(--text-on-primary);
|
|
23
|
+
background-color: var(--fill-primary-strong);
|
|
24
|
+
transition-property: all, color;
|
|
25
|
+
transition-duration: 0.3s, 1ms;
|
|
26
|
+
transition-timing-function: cubic-bezier(0.25, 0.8, 0.5, 1), ease;
|
|
27
|
+
transition-delay: 0s, 0s;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.scroll-to-top span,
|
|
32
|
+
:global(.scroll-to-top span) {
|
|
33
|
+
width: 18px;
|
|
34
|
+
padding-bottom: 3px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.scroll-to-top span svg path,
|
|
38
|
+
:global(.scroll-to-top span svg path) {
|
|
39
|
+
stroke: none;
|
|
40
|
+
fill: var(--text-on-primary);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.scroll-to-top:hover,
|
|
44
|
+
.scroll-to-top:focus,
|
|
45
|
+
:global(.scroll-to-top:hover),
|
|
46
|
+
:global(.scroll-to-top:focus) {
|
|
47
|
+
color: var(--text-on-primary);
|
|
48
|
+
background-color: var(--fill-primary-strong-hover);
|
|
49
|
+
transform: translateY(-5px);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.scroll-to-top-shown,
|
|
53
|
+
:global(.scroll-to-top-shown) {
|
|
54
|
+
min-width: 0;
|
|
55
|
+
opacity: 1;
|
|
56
|
+
visibility: visible;
|
|
57
|
+
padding: 0;
|
|
58
|
+
width: 40px;
|
|
59
|
+
height: 40px;
|
|
60
|
+
bottom: 20px;
|
|
61
|
+
right: 10px;
|
|
62
|
+
border-radius: 20px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@media screen and (min-width: 587px) {
|
|
66
|
+
.scroll-to-top,
|
|
67
|
+
:global(.scroll-to-top) {
|
|
68
|
+
bottom: 45px;
|
|
69
|
+
right: 45px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.scroll-to-top span,
|
|
73
|
+
:global(.scroll-to-top span) {
|
|
74
|
+
width: 18px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.scroll-to-top-shown,
|
|
78
|
+
:global(.scroll-to-top-shown) {
|
|
79
|
+
width: 42px;
|
|
80
|
+
height: 42px;
|
|
81
|
+
border-radius: 21px;
|
|
82
|
+
bottom: 22px;
|
|
83
|
+
right: 22px;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|