oddsgate-ds 1.0.87 → 1.0.88
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/cjs/index.js +5 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/helpers/events.d.ts +1 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/helpers/events.d.ts +1 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/types.d.ts +3 -1
- package/package.json +1 -1
- package/src/components/organisms/CircularSlider/CircularSlider.component.tsx +6 -5
- package/src/components/organisms/Tabs/Tabs.component.tsx +4 -2
- package/src/helpers/events.ts +9 -0
- package/src/helpers/useMediaQuery.tsx +5 -1
- package/src/index.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const debounce: (callback: any, wait: number) => (...args: any) => void;
|
|
@@ -48,4 +48,5 @@ export { iconsList } from './helpers/getIcons';
|
|
|
48
48
|
export { default as GlobalStyles } from './styles/Global';
|
|
49
49
|
export { default as clickOutSideToClose } from './helpers/clickOutsideToClose';
|
|
50
50
|
export { default as isTouchDevice } from './helpers/isTouchDevice';
|
|
51
|
+
export { debounce } from './helpers/events';
|
|
51
52
|
export { variables };
|
package/dist/types.d.ts
CHANGED
|
@@ -637,4 +637,6 @@ declare function clickOutSideToClose(ref: React.RefObject<HTMLDivElement>, close
|
|
|
637
637
|
|
|
638
638
|
declare const isTouchDevice: () => boolean;
|
|
639
639
|
|
|
640
|
-
|
|
640
|
+
declare const debounce: (callback: any, wait: number) => (...args: any) => void;
|
|
641
|
+
|
|
642
|
+
export { Accordion, AccordionItem, BlogCard, Button, CareersCard, CheckRadioField, Chip, CircularSlider, CloseButton, Column, Counter, Cover, Dropdown, DropdownItem, EmptyState, EventsCard, Flex, FormField, GlobalStyles, Heading, Icon, IconBox, IconTitle, ImageWrapper, LicenseCard, Loader, LogosCard, Marquee, Modal, NewsCard, OffCanvas, PortalComponent, ProductCard, Quote, RichText, Row, ScrollingNav, Separator, ShareModal, Slider, SocialLinks, Spacer, Tabs, TeamCard, Video, VideoEmbed, clickOutSideToClose, debounce, iconsList, isTouchDevice, variables };
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
|
|
10
10
|
import Heading from '@/components/atoms/Heading/Heading.component';
|
|
11
11
|
import { ICircularSlider } from './CircularSlider.interface'
|
|
12
|
+
import { debounce } from '@/helpers/events';
|
|
12
13
|
import isTouchDevice from '@/helpers/isTouchDevice';
|
|
13
14
|
|
|
14
15
|
const CircularSlider = ({
|
|
@@ -88,7 +89,7 @@ const CircularSlider = ({
|
|
|
88
89
|
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
const sliderResize = () => {
|
|
92
|
+
const sliderResize = debounce(() => {
|
|
92
93
|
let radius,
|
|
93
94
|
w = slider?.current ? slider?.current?.getBoundingClientRect().width : 0,
|
|
94
95
|
h = slider?.current ? slider?.current.getBoundingClientRect().height : 0;
|
|
@@ -96,7 +97,7 @@ const CircularSlider = ({
|
|
|
96
97
|
2 * h <= w ? radius = h * sliderSize : radius = (w / 2) * sliderSize;
|
|
97
98
|
|
|
98
99
|
setSize(Math.round(radius));
|
|
99
|
-
}
|
|
100
|
+
}, 250)
|
|
100
101
|
|
|
101
102
|
const addStyle = () => {
|
|
102
103
|
setTimeout(() => {
|
|
@@ -126,10 +127,10 @@ const CircularSlider = ({
|
|
|
126
127
|
if (currentSlide === 0 && newSlide === (slides.length - 1)) {
|
|
127
128
|
multiplier = -1;
|
|
128
129
|
direction = "-";
|
|
129
|
-
} else if(currentSlide === (slides.length - 1) && newSlide === 0) {
|
|
130
|
+
} else if (currentSlide === (slides.length - 1) && newSlide === 0) {
|
|
130
131
|
multiplier = 1;
|
|
131
132
|
direction = "+";
|
|
132
|
-
}else{
|
|
133
|
+
} else {
|
|
133
134
|
multiplier = newSlide - currentSlide
|
|
134
135
|
direction = currentSlide < newSlide ? "+" : "-";
|
|
135
136
|
}
|
|
@@ -149,7 +150,7 @@ const CircularSlider = ({
|
|
|
149
150
|
|
|
150
151
|
|
|
151
152
|
for (let i = 0; i < slides.length; i++) {
|
|
152
|
-
slides[i].addEventListener('click', rotateSlider, {passive: true});
|
|
153
|
+
slides[i].addEventListener('click', rotateSlider, { passive: true });
|
|
153
154
|
};
|
|
154
155
|
|
|
155
156
|
window.addEventListener('resize', sliderResize)
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
|
|
9
9
|
import Heading from '@/components/atoms/Heading/Heading.component'
|
|
10
10
|
import { ITabs } from './Tabs.interface'
|
|
11
|
+
import { debounce } from '@/helpers/events'
|
|
11
12
|
|
|
12
13
|
const Tabs = ({ id, title, menu, vertical, className, style }: ITabs) => {
|
|
13
14
|
const [active, setActive] = useState(0)
|
|
@@ -19,7 +20,8 @@ const Tabs = ({ id, title, menu, vertical, className, style }: ITabs) => {
|
|
|
19
20
|
setActive(index);
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
|
|
24
|
+
const setTabsHeight = debounce(() => {
|
|
23
25
|
if (!tabsContent.current) return;
|
|
24
26
|
|
|
25
27
|
const heights: number[] = [];
|
|
@@ -27,7 +29,7 @@ const Tabs = ({ id, title, menu, vertical, className, style }: ITabs) => {
|
|
|
27
29
|
heights.push(child?.offsetHeight as number)
|
|
28
30
|
})
|
|
29
31
|
tabsContent.current.style.height = `${Math.max(...heights)}px`;
|
|
30
|
-
}
|
|
32
|
+
}, 250)
|
|
31
33
|
|
|
32
34
|
useEffect(()=>{
|
|
33
35
|
setTabsHeight();
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
|
+
import { debounce } from './events';
|
|
4
|
+
|
|
3
5
|
function useMediaQuery(query: string) {
|
|
4
6
|
const [matches, setMatches] = useState<boolean>(false)
|
|
5
7
|
|
|
@@ -11,7 +13,9 @@ function useMediaQuery(query: string) {
|
|
|
11
13
|
setMatches(media.matches)
|
|
12
14
|
}
|
|
13
15
|
|
|
14
|
-
const listener = () =>
|
|
16
|
+
const listener = debounce(() => {
|
|
17
|
+
setMatches(media.matches)
|
|
18
|
+
}, 250)
|
|
15
19
|
window.addEventListener('resize', listener)
|
|
16
20
|
|
|
17
21
|
return () => window.removeEventListener('resize', listener)
|
package/src/index.ts
CHANGED
|
@@ -58,6 +58,7 @@ export { default as GlobalStyles } from './styles/Global'
|
|
|
58
58
|
|
|
59
59
|
export { default as clickOutSideToClose } from './helpers/clickOutsideToClose'
|
|
60
60
|
export { default as isTouchDevice } from './helpers/isTouchDevice'
|
|
61
|
+
export { debounce } from './helpers/events'
|
|
61
62
|
|
|
62
63
|
export { variables };
|
|
63
64
|
|