@ably/ui 14.0.0-dev.3f64b93 → 14.0.0-dev.450e302
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/core/.DS_Store +0 -0
- package/core/Accordion.js +1 -1
- package/core/Code.js +1 -1
- package/core/ContactFooter/component.css +9 -7
- package/core/ContactFooter.js +1 -1
- package/core/CookieMessage/component.css +12 -10
- package/core/CookieMessage.js +1 -1
- package/core/Expander.js +1 -1
- package/core/Flash/component.css +21 -19
- package/core/Flash.js +1 -1
- package/core/Footer/component.css +24 -22
- package/core/Footer.js +1 -1
- package/core/Meganav/component.css +105 -103
- package/core/Meganav/component.js +1 -1
- package/core/Meganav.js +1 -1
- package/core/Notice/component.css +6 -4
- package/core/Notice/component.js +1 -1
- package/core/Notice.js +1 -1
- package/core/Slider/component.css +32 -30
- package/core/Slider/component.js +1 -1
- package/core/Slider.js +1 -1
- package/core/Table/Table.js +1 -1
- package/core/Table/TableCell.js +3 -3
- package/core/Table/data.js +1 -1
- package/core/Table.js +1 -1
- package/core/scripts.js +1 -1
- package/core/styles/buttons.css +123 -121
- package/core/styles/forms.css +51 -49
- package/core/styles/layout.css +16 -14
- package/core/styles/properties.css +252 -250
- package/core/styles/text.css +167 -165
- package/core/styles.components.css +24 -22
- package/core/utils/syntax-highlighter.css +59 -55
- package/package.json +2 -4
- package/src/core/.DS_Store +0 -0
- package/src/core/Accordion.tsx +4 -2
- package/src/core/Code.tsx +0 -1
- package/src/core/ContactFooter/component.css +9 -7
- package/src/core/ContactFooter.tsx +0 -1
- package/src/core/CookieMessage/component.css +12 -10
- package/src/core/CookieMessage.tsx +0 -1
- package/src/core/Expander.tsx +17 -8
- package/src/core/Flash/component.css +21 -19
- package/src/core/Flash.tsx +0 -1
- package/src/core/Footer/component.css +24 -22
- package/src/core/Footer.tsx +0 -1
- package/src/core/Meganav/component.css +105 -103
- package/src/core/Meganav/component.js +0 -2
- package/src/core/Meganav.tsx +0 -1
- package/src/core/Notice/component.css +6 -4
- package/src/core/Notice/component.js +0 -1
- package/src/core/Notice.tsx +0 -1
- package/src/core/Slider/component.css +32 -30
- package/src/core/Slider/component.js +0 -2
- package/src/core/Slider.tsx +48 -17
- package/src/core/Table/Table.tsx +1 -2
- package/src/core/Table/TableCell.tsx +2 -40
- package/src/core/Table/data.tsx +21 -1
- package/src/core/Table.tsx +1 -12
- package/src/core/scripts.js +0 -2
- package/src/core/styles/buttons.css +123 -121
- package/src/core/styles/forms.css +51 -49
- package/src/core/styles/layout.css +16 -14
- package/src/core/styles/properties.css +252 -250
- package/src/core/styles/text.css +167 -165
- package/src/core/styles.components.css +24 -22
- package/src/core/utils/syntax-highlighter.css +59 -55
package/src/core/Expander.tsx
CHANGED
|
@@ -1,31 +1,40 @@
|
|
|
1
1
|
import React, { PropsWithChildren, useEffect, useRef, useState } from "react";
|
|
2
2
|
|
|
3
3
|
type ExpanderProps = {
|
|
4
|
-
|
|
4
|
+
heightThreshold?: number;
|
|
5
5
|
className?: string;
|
|
6
6
|
fadeClassName?: string;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
const Expander = ({
|
|
10
|
-
|
|
10
|
+
heightThreshold = 200,
|
|
11
11
|
className,
|
|
12
12
|
fadeClassName,
|
|
13
13
|
children,
|
|
14
14
|
}: PropsWithChildren<ExpanderProps>) => {
|
|
15
15
|
const innerRef = useRef<HTMLDivElement>(null);
|
|
16
|
-
const [
|
|
16
|
+
const [showControls, setShowControls] = useState(false);
|
|
17
|
+
const [height, setHeight] = useState<number | "auto">(heightThreshold);
|
|
17
18
|
const [expanded, setExpanded] = useState(false);
|
|
18
19
|
|
|
19
20
|
useEffect(() => {
|
|
20
|
-
|
|
21
|
-
}, [height, expanded]);
|
|
21
|
+
const contentHeight = innerRef.current?.clientHeight ?? heightThreshold;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
if (contentHeight < heightThreshold) {
|
|
24
|
+
setHeight("auto");
|
|
25
|
+
} else if (expanded) {
|
|
26
|
+
setHeight(contentHeight);
|
|
27
|
+
} else {
|
|
28
|
+
setHeight(heightThreshold);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setShowControls(contentHeight >= heightThreshold);
|
|
32
|
+
}, [heightThreshold, expanded]);
|
|
24
33
|
|
|
25
34
|
return (
|
|
26
35
|
<>
|
|
27
36
|
<div
|
|
28
|
-
style={{ height
|
|
37
|
+
style={{ height }}
|
|
29
38
|
className={`overflow-hidden transition-all relative ${className ?? ""}`}
|
|
30
39
|
>
|
|
31
40
|
{showControls && !expanded && (
|
|
@@ -42,7 +51,7 @@ const Expander = ({
|
|
|
42
51
|
onClick={() => setExpanded(!expanded)}
|
|
43
52
|
onKeyDown={(e) => e.key === "Enter" && setExpanded(!expanded)}
|
|
44
53
|
tabIndex={0}
|
|
45
|
-
className="mt-16 cursor-pointer font-bold text-gui-blue-default-light hover:text-gui-blue-hover-light
|
|
54
|
+
className="mt-16 cursor-pointer font-bold text-gui-blue-default-light hover:text-gui-blue-hover-light"
|
|
46
55
|
>
|
|
47
56
|
{expanded ? "View less -" : "View all +"}
|
|
48
57
|
</div>
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
@layer components {
|
|
2
|
+
.ui-flash {
|
|
3
|
+
@apply w-full fixed;
|
|
4
|
+
top: 5.5rem;
|
|
5
|
+
z-index: calc(var(--stacking-context-page-meganav) - 10);
|
|
6
|
+
transition: margin-top 200ms;
|
|
7
|
+
}
|
|
7
8
|
|
|
8
|
-
.ui-flash-message {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
9
|
+
.ui-flash-message {
|
|
10
|
+
@apply font-sans font-light antialiased max-w-screen-xl mx-auto mt-8 opacity-0 relative;
|
|
11
|
+
transition: opacity 200ms, transform 200ms, height 200ms 200ms,
|
|
12
|
+
margin-top 200ms 200ms;
|
|
13
|
+
transform: translateY(-200%) rotateX(-90deg);
|
|
14
|
+
}
|
|
14
15
|
|
|
15
|
-
/* dynamic content inside flash, can't add classes */
|
|
16
|
-
.ui-flash-text a {
|
|
17
|
-
|
|
18
|
-
}
|
|
16
|
+
/* dynamic content inside flash, can't add classes */
|
|
17
|
+
.ui-flash-text a {
|
|
18
|
+
@apply underline;
|
|
19
|
+
}
|
|
19
20
|
|
|
20
|
-
.ui-flash-message-enter {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
.ui-flash-message-enter {
|
|
22
|
+
@apply opacity-100;
|
|
23
|
+
transform: translateY(0) rotateX(0);
|
|
24
|
+
}
|
|
23
25
|
}
|
package/src/core/Flash.tsx
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
@layer components {
|
|
2
|
+
.ui-footer-col-title {
|
|
3
|
+
@apply font-mono text-overline2 p-menu-row-title font-medium uppercase tracking-widen-0.16;
|
|
4
|
+
}
|
|
4
5
|
|
|
5
|
-
.ui-footer-menu-row-link {
|
|
6
|
-
|
|
7
|
-
}
|
|
6
|
+
.ui-footer-menu-row-link {
|
|
7
|
+
@apply text-menu3 text-cool-black font-sans font-medium hover:text-gui-hover block;
|
|
8
|
+
}
|
|
8
9
|
|
|
9
|
-
.ui-footer-link {
|
|
10
|
-
|
|
11
|
-
}
|
|
10
|
+
.ui-footer-link {
|
|
11
|
+
@apply text-gui-default hover:text-gui-hover text-menu3 font-sans font-medium;
|
|
12
|
+
}
|
|
12
13
|
|
|
13
|
-
.ui-footer-compliance-text {
|
|
14
|
-
|
|
15
|
-
}
|
|
14
|
+
.ui-footer-compliance-text {
|
|
15
|
+
font-size: 12px;
|
|
16
|
+
}
|
|
16
17
|
|
|
17
|
-
.ui-footer-tick-icon {
|
|
18
|
-
|
|
19
|
-
}
|
|
18
|
+
.ui-footer-tick-icon {
|
|
19
|
+
min-width: 1.5rem;
|
|
20
|
+
}
|
|
20
21
|
|
|
21
|
-
@media (max-width: 1040px) {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
@media (max-width: 1040px) {
|
|
23
|
+
.ui-footer-bottom-links {
|
|
24
|
+
@apply pb-40;
|
|
25
|
+
}
|
|
24
26
|
}
|
|
25
|
-
}
|
|
26
27
|
|
|
27
|
-
@media screen {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
@media screen {
|
|
29
|
+
.ui-footer-glassdoor {
|
|
30
|
+
display: none;
|
|
31
|
+
}
|
|
30
32
|
}
|
|
31
33
|
}
|
package/src/core/Footer.tsx
CHANGED
|
@@ -1,112 +1,114 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
.ui-meganav-
|
|
20
|
-
.ui-meganav-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
1
|
+
@layer components {
|
|
2
|
+
.ui-meganav-wrapper {
|
|
3
|
+
/* Define values for new stacking context defined by position: fixed */
|
|
4
|
+
--stacking-context-meganav-dropdown: 10;
|
|
5
|
+
--stacking-context-meganav-mobile-panel: 20;
|
|
6
|
+
|
|
7
|
+
z-index: var(--stacking-context-page-meganav);
|
|
8
|
+
|
|
9
|
+
@apply fixed top-0 w-full;
|
|
10
|
+
@apply antialiased font-sans transition-colors;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ui-meganav {
|
|
14
|
+
height: var(--ui-meganav-height);
|
|
15
|
+
|
|
16
|
+
@apply flex justify-between items-center max-w-screen-xl mx-auto;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.ui-meganav-panel,
|
|
20
|
+
.ui-meganav-mobile-dropdown,
|
|
21
|
+
.ui-meganav-panel-account {
|
|
22
|
+
z-index: var(--stacking-context-meganav-dropdown);
|
|
23
|
+
|
|
24
|
+
@apply absolute left-0 right-0;
|
|
25
|
+
@apply border-mid-grey border-t shadow-container;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.ui-meganav-panel {
|
|
29
|
+
@apply bg-white;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.ui-meganav-panel-mobile {
|
|
33
|
+
z-index: var(--stacking-context-meganav-mobile-panel);
|
|
34
|
+
|
|
35
|
+
/* Prevents momentum-based scrolling https://devdocs.io/css/-webkit-overflow-scrolling */
|
|
36
|
+
-webkit-overflow-scrolling: auto;
|
|
37
|
+
|
|
38
|
+
@apply bg-white pt-16 border-0;
|
|
39
|
+
@apply border-mid-grey border-t shadow-container;
|
|
40
|
+
@apply fixed top-64 left-0 right-0 overflow-y-auto;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.ui-meganav-panel-account {
|
|
44
|
+
left: auto;
|
|
45
|
+
min-width: 20rem;
|
|
46
|
+
@apply bg-white rounded-t-none;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.ui-meganav-panel-split-bg {
|
|
50
|
+
background: linear-gradient(to right, #fafafb 33%, white 33%, white 100%);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ui-meganav-link {
|
|
54
|
+
@apply text-menu2 font-bold font-sans;
|
|
55
|
+
@apply mr-12 lg:mr-24 px-0 py-20;
|
|
56
|
+
@apply hover:text-gui-hover focus:text-gui-focus focus:outline-none;
|
|
57
|
+
@apply transition-colors;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.ui-meganav-item {
|
|
61
|
+
flex: 1 0 auto;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.ui-meganav-mobile-link {
|
|
65
|
+
@apply p-menu-row relative -left-8 w-extend-8;
|
|
66
|
+
@apply text-menu2 font-mono font-medium block text-cool-black text-left;
|
|
67
|
+
@apply flex items-center;
|
|
68
|
+
@apply focus:text-gui-focus focus:outline-none;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.ui-meganav-account-link {
|
|
72
|
+
@apply block px-8 py-8 hover:bg-light-grey hover:text-gui-hover rounded relative -left-8 text-menu3 w-extend-8 font-bold font-mono;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.ui-meganav-content {
|
|
76
|
+
@apply max-w-screen-xl py-24 lg:py-32 mx-auto;
|
|
77
|
+
@apply grid grid-cols-1;
|
|
78
|
+
@apply px-24 md:px-32 lg:px-32 xl:px-64;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* This is implemented not as padding so we can change the color of just this space, while keeping the grid
|
|
81
82
|
as close to the designs as possible */
|
|
82
|
-
.ui-meganav-content-spacer {
|
|
83
|
-
|
|
84
|
-
}
|
|
83
|
+
.ui-meganav-content-spacer {
|
|
84
|
+
@apply hidden md:block md:w-32 lg:w-32 xl:w-64 self-stretch flex-shrink-0 flex-grow-0;
|
|
85
|
+
}
|
|
85
86
|
|
|
86
|
-
.ui-meganav-media {
|
|
87
|
-
|
|
88
|
-
}
|
|
87
|
+
.ui-meganav-media {
|
|
88
|
+
@apply block px-8 py-8 hover:bg-light-grey rounded relative -left-8 w-extend-8;
|
|
89
|
+
}
|
|
89
90
|
|
|
90
|
-
.ui-meganav-media-with-image {
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
.ui-meganav-media-with-image {
|
|
92
|
+
grid-template-columns: max-content 1fr;
|
|
93
|
+
grid-template-rows: min-content 1fr;
|
|
93
94
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
95
|
+
@apply block px-8 py-8 hover:bg-light-grey rounded relative -left-8 w-extend-8;
|
|
96
|
+
@apply grid gap-x-16;
|
|
97
|
+
}
|
|
97
98
|
|
|
98
|
-
.ui-meganav-media-heading {
|
|
99
|
-
|
|
100
|
-
}
|
|
99
|
+
.ui-meganav-media-heading {
|
|
100
|
+
@apply text-menu3 text-cool-black font-bold font-sans group-hover:text-gui-hover group-focus:text-gui-focus leading-normal;
|
|
101
|
+
}
|
|
101
102
|
|
|
102
|
-
.ui-meganav-media-copy {
|
|
103
|
-
|
|
104
|
-
}
|
|
103
|
+
.ui-meganav-media-copy {
|
|
104
|
+
@apply text-p3 font-sans font-medium text-dark-grey leading-normal;
|
|
105
|
+
}
|
|
105
106
|
|
|
106
|
-
.ui-meganav-overline {
|
|
107
|
-
|
|
108
|
-
}
|
|
107
|
+
.ui-meganav-overline {
|
|
108
|
+
@apply text-overline2 text-cool-black uppercase font-medium font-mono tracking-widen-0.16 p-overline;
|
|
109
|
+
}
|
|
109
110
|
|
|
110
|
-
.ui-meganav-hr {
|
|
111
|
-
|
|
111
|
+
.ui-meganav-hr {
|
|
112
|
+
@apply my-0 text-mid-grey;
|
|
113
|
+
}
|
|
112
114
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import throttle from "lodash.throttle";
|
|
2
2
|
|
|
3
|
-
import "./component.css";
|
|
4
|
-
|
|
5
3
|
// Glossary:
|
|
6
4
|
// item - is the element which contains both the control and the panel - these are adjacent
|
|
7
5
|
// control - interactive element that controls showing and hiding of dropdown or panel
|
package/src/core/Meganav.tsx
CHANGED
|
@@ -4,7 +4,6 @@ import { connectState } from "./remote-data-store.js";
|
|
|
4
4
|
import { selectSessionData } from "./remote-session-data.js";
|
|
5
5
|
|
|
6
6
|
import Logo from "./Logo";
|
|
7
|
-
import "./Meganav/component.css";
|
|
8
7
|
import MeganavData from "./Meganav/component.json";
|
|
9
8
|
import MeganavScripts from "./Meganav/component.js";
|
|
10
9
|
import MeganavItemsDesktop from "./MeganavItemsDesktop";
|
package/src/core/Notice.tsx
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
@layer components {
|
|
2
|
+
.ui-slider-marker {
|
|
3
|
+
font-size: 0.5rem;
|
|
4
|
+
top: -1px;
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
@keyframes fillAnimation {
|
|
9
|
-
0% {
|
|
10
|
-
width: 0%;
|
|
11
|
-
}
|
|
12
|
-
100% {
|
|
13
|
-
width: 100%;
|
|
6
|
+
@apply leading-none px-4 relative;
|
|
14
7
|
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.ui-icon-cta {
|
|
18
|
-
@apply cursor-pointer overflow-hidden;
|
|
19
|
-
@apply rounded border-2 border-mid-grey hover:border-active-orange;
|
|
20
|
-
transition: all 0.4s;
|
|
21
|
-
}
|
|
22
8
|
|
|
23
|
-
@
|
|
24
|
-
|
|
25
|
-
|
|
9
|
+
@keyframes fillAnimation {
|
|
10
|
+
0% {
|
|
11
|
+
width: 0%;
|
|
12
|
+
}
|
|
13
|
+
100% {
|
|
14
|
+
width: 100%;
|
|
15
|
+
}
|
|
26
16
|
}
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
|
|
18
|
+
.ui-icon-cta {
|
|
19
|
+
@apply cursor-pointer overflow-hidden;
|
|
20
|
+
@apply rounded border-2 border-mid-grey hover:border-active-orange;
|
|
21
|
+
transition: all 0.4s;
|
|
29
22
|
}
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
|
|
24
|
+
@screen sm {
|
|
25
|
+
.ui-icon-cta-left:hover .ui-icon-cta-holder {
|
|
26
|
+
transform: translateX(-120%);
|
|
27
|
+
}
|
|
28
|
+
.ui-icon-cta-right .ui-icon-cta-holder {
|
|
29
|
+
transform: translateX(-120%);
|
|
30
|
+
}
|
|
31
|
+
.ui-icon-cta-right:hover .ui-icon-cta-holder {
|
|
32
|
+
transform: translateX(0%);
|
|
33
|
+
}
|
|
32
34
|
}
|
|
33
|
-
}
|
|
34
35
|
|
|
35
|
-
.ui-icon-cta-holder {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
.ui-icon-cta-holder {
|
|
37
|
+
@apply w-full h-full;
|
|
38
|
+
transition: all 0.4s;
|
|
39
|
+
}
|
|
38
40
|
}
|
package/src/core/Slider.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef, ReactNode } from "react";
|
|
2
2
|
import Icon from "./Icon";
|
|
3
|
-
import "./Slider/component.css";
|
|
4
3
|
|
|
5
4
|
interface SliderProps {
|
|
6
5
|
children: ReactNode[];
|
|
@@ -19,6 +18,8 @@ interface SliderIndicatorProps {
|
|
|
19
18
|
isInline?: boolean;
|
|
20
19
|
}
|
|
21
20
|
|
|
21
|
+
const SLIDE_TRANSITION_LENGTH = 300;
|
|
22
|
+
|
|
22
23
|
const SlideIndicator = ({
|
|
23
24
|
numSlides,
|
|
24
25
|
activeIndex,
|
|
@@ -29,7 +30,7 @@ const SlideIndicator = ({
|
|
|
29
30
|
return (
|
|
30
31
|
<ul
|
|
31
32
|
className={`flex gap-4 left-1/2 ${
|
|
32
|
-
isInline ? "bottom-0" : "absolute
|
|
33
|
+
isInline ? "bottom-0" : "absolute bottom-0 transform -translate-x-1/2"
|
|
33
34
|
}`}
|
|
34
35
|
>
|
|
35
36
|
{Array.from({ length: numSlides }, (_, i) =>
|
|
@@ -64,24 +65,43 @@ const SlideIndicator = ({
|
|
|
64
65
|
);
|
|
65
66
|
};
|
|
66
67
|
|
|
68
|
+
const setupSlides = (children: ReactNode[], activeIndex: number) => [
|
|
69
|
+
children[activeIndex === 0 ? children.length - 1 : activeIndex - 1],
|
|
70
|
+
children[activeIndex],
|
|
71
|
+
children[activeIndex === children.length - 1 ? 0 : activeIndex + 1],
|
|
72
|
+
];
|
|
73
|
+
|
|
67
74
|
const Slider = ({ children, options }: SliderProps) => {
|
|
68
75
|
const [activeIndex, setActiveIndex] = useState(0);
|
|
69
76
|
const [touchStartX, setTouchStartX] = useState(0);
|
|
70
77
|
const [touchEndX, setTouchEndX] = useState(0);
|
|
78
|
+
const [slides, setSlides] = useState<ReactNode[]>(
|
|
79
|
+
setupSlides(children, activeIndex)
|
|
80
|
+
);
|
|
81
|
+
const [translationCoefficient, setTranslationCoefficient] = useState(0);
|
|
71
82
|
const timerRef = useRef<NodeJS.Timeout | null>(null);
|
|
83
|
+
const [slideLock, setSlideLock] = useState(false);
|
|
72
84
|
|
|
73
85
|
const isInline = options?.controlPosition === "inline";
|
|
74
86
|
|
|
75
87
|
const next = () => {
|
|
76
|
-
|
|
77
|
-
|
|
88
|
+
if (!slideLock) {
|
|
89
|
+
setActiveIndex((prevIndex) => (prevIndex + 1) % children.length);
|
|
90
|
+
setTranslationCoefficient(1);
|
|
91
|
+
resetInterval();
|
|
92
|
+
setSlideLock(true);
|
|
93
|
+
}
|
|
78
94
|
};
|
|
79
95
|
|
|
80
96
|
const prev = () => {
|
|
81
|
-
|
|
82
|
-
prevIndex
|
|
83
|
-
|
|
84
|
-
|
|
97
|
+
if (!slideLock) {
|
|
98
|
+
setActiveIndex((prevIndex) =>
|
|
99
|
+
prevIndex > 0 ? prevIndex - 1 : children.length - 1
|
|
100
|
+
);
|
|
101
|
+
setTranslationCoefficient(-1);
|
|
102
|
+
resetInterval();
|
|
103
|
+
setSlideLock(true);
|
|
104
|
+
}
|
|
85
105
|
};
|
|
86
106
|
|
|
87
107
|
const resetInterval = () => {
|
|
@@ -113,6 +133,14 @@ const Slider = ({ children, options }: SliderProps) => {
|
|
|
113
133
|
};
|
|
114
134
|
}, [children.length, options?.interval]);
|
|
115
135
|
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
setTimeout(() => {
|
|
138
|
+
setSlides(setupSlides(children, activeIndex));
|
|
139
|
+
setTranslationCoefficient(0);
|
|
140
|
+
setSlideLock(false);
|
|
141
|
+
}, SLIDE_TRANSITION_LENGTH);
|
|
142
|
+
}, [activeIndex]);
|
|
143
|
+
|
|
116
144
|
return (
|
|
117
145
|
<div
|
|
118
146
|
className="relative"
|
|
@@ -120,18 +148,21 @@ const Slider = ({ children, options }: SliderProps) => {
|
|
|
120
148
|
onTouchMove={handleTouchMove}
|
|
121
149
|
onTouchEnd={handleTouchEnd}
|
|
122
150
|
>
|
|
123
|
-
<div className="overflow-
|
|
151
|
+
<div className="overflow-y-visible overflow-x-clip w-full py-40">
|
|
124
152
|
<div
|
|
125
|
-
className=
|
|
126
|
-
|
|
153
|
+
className={`flex items-center ${
|
|
154
|
+
translationCoefficient !== 0
|
|
155
|
+
? `transition-transform ease-in-out duration-${SLIDE_TRANSITION_LENGTH}`
|
|
156
|
+
: ""
|
|
157
|
+
} `}
|
|
158
|
+
style={{
|
|
159
|
+
transform: `translateX(-${(translationCoefficient + 1) * 100}%)`,
|
|
160
|
+
}}
|
|
127
161
|
>
|
|
128
|
-
{
|
|
162
|
+
{slides.map((child, index) => (
|
|
129
163
|
<div
|
|
130
164
|
key={index}
|
|
131
|
-
className="w-full flex-shrink-0 flex justify-center sm:px-60
|
|
132
|
-
style={{
|
|
133
|
-
opacity: activeIndex === index ? 1 : 0.1,
|
|
134
|
-
}}
|
|
165
|
+
className="w-full flex-shrink-0 flex justify-center sm:px-60"
|
|
135
166
|
>
|
|
136
167
|
{child}
|
|
137
168
|
</div>
|
|
@@ -142,7 +173,7 @@ const Slider = ({ children, options }: SliderProps) => {
|
|
|
142
173
|
<div
|
|
143
174
|
className={`flex items-center pointer-events-none ${
|
|
144
175
|
isInline
|
|
145
|
-
? "ui-standard-container justify-center gap-24"
|
|
176
|
+
? "ui-standard-container justify-center gap-24 -mt-16"
|
|
146
177
|
: "sm:flex sm:absolute inset-0 justify-between"
|
|
147
178
|
}`}
|
|
148
179
|
>
|
package/src/core/Table/Table.tsx
CHANGED
|
@@ -49,10 +49,9 @@ export const TableRowHeader = ({
|
|
|
49
49
|
...rest
|
|
50
50
|
}: PropsWithChildren<TableHTMLAttributes<HTMLTableRowElement>>) => (
|
|
51
51
|
<tr
|
|
52
|
-
className={`-ml-24 mt-8 sm:ml-0 sm:mt-0
|
|
52
|
+
className={`-ml-24 mt-8 sm:ml-0 sm:mt-0 sm:sticky z-10 ${
|
|
53
53
|
rest?.className ?? ""
|
|
54
54
|
}`}
|
|
55
|
-
style={{ top: "4rem" }}
|
|
56
55
|
>
|
|
57
56
|
{cloneElement(children as ReactElement, { isRowHeader: true })}
|
|
58
57
|
</tr>
|