@superrb/react-addons 4.0.0-2 → 4.0.0-21
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/.idea/codeStyles/Project.xml +61 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/copilot.data.migration.ask2agent.xml +6 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/react-addons.iml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.yarn/install-state.gz +0 -0
- package/.yarnrc.yml +1 -0
- package/components/form.d.ts +2 -1
- package/components/form.d.ts.map +1 -1
- package/components/form.js +1 -1
- package/components/modal.d.ts.map +1 -1
- package/components/modal.js +24 -7
- package/config.d.ts +9 -0
- package/config.d.ts.map +1 -0
- package/config.js +90 -0
- package/hooks/use-draggable-scroll.js +11 -2
- package/hooks/use-escape.d.ts +3 -1
- package/hooks/use-escape.d.ts.map +1 -1
- package/hooks/use-escape.js +9 -4
- package/hooks/use-event-listener.d.ts +5 -6
- package/hooks/use-event-listener.d.ts.map +1 -1
- package/hooks/use-event-listener.js +13 -22
- package/hooks/use-hide-on-scroll.d.ts.map +1 -1
- package/hooks/use-hide-on-scroll.js +5 -5
- package/hooks/use-parallax.d.ts.map +1 -1
- package/hooks/use-parallax.js +5 -2
- package/hooks/use-slideshow.d.ts.map +1 -1
- package/hooks/use-slideshow.js +43 -35
- package/index.d.ts +2 -1
- package/index.d.ts.map +1 -1
- package/index.js +2 -1
- package/package.json +12 -9
- package/store/cookies.d.ts.map +1 -1
- package/store/cookies.js +0 -4
- package/store/modal.d.ts.map +1 -1
- package/store/modal.js +0 -4
- package/store/nav.d.ts.map +1 -1
- package/store/nav.js +0 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/actions.d.ts +0 -6
- package/actions.d.ts.map +0 -1
- package/actions.js +0 -18
- package/components/video.d.ts +0 -17
- package/components/video.d.ts.map +0 -1
- package/components/video.js +0 -44
- package/context/cookies-context-provider.d.ts +0 -13
- package/context/cookies-context-provider.d.ts.map +0 -1
- package/context/cookies-context-provider.js +0 -54
- package/context.d.ts +0 -8
- package/context.d.ts.map +0 -1
- package/context.js +0 -7
package/hooks/use-slideshow.js
CHANGED
|
@@ -65,7 +65,6 @@ export function getCurrentSlideIndex(element, currentIndex) {
|
|
|
65
65
|
export default function useSlideshow(slideshow) {
|
|
66
66
|
const [currentSlide, setCurrentSlide] = useState(0);
|
|
67
67
|
const [progress, setProgress] = useState(-1);
|
|
68
|
-
const [ready, setReady] = useState(false);
|
|
69
68
|
const update = () => {
|
|
70
69
|
if (!slideshow.current) {
|
|
71
70
|
return;
|
|
@@ -73,10 +72,9 @@ export default function useSlideshow(slideshow) {
|
|
|
73
72
|
setCurrentSlide((current) => getCurrentSlideIndex(slideshow.current, current));
|
|
74
73
|
setProgress(getScrollProgress(slideshow.current));
|
|
75
74
|
};
|
|
76
|
-
useEventListener('scroll', update, { passive: true }, slideshow
|
|
77
|
-
useEventListener('resize', update, { passive: true }, slideshow
|
|
75
|
+
useEventListener('scroll', update, { passive: true }, slideshow);
|
|
76
|
+
useEventListener('resize', update, { passive: true }, slideshow);
|
|
78
77
|
useEffect(() => {
|
|
79
|
-
setReady(true);
|
|
80
78
|
if (slideshow.current) {
|
|
81
79
|
update();
|
|
82
80
|
slideshow.current.setAttribute('role', 'region');
|
|
@@ -87,7 +85,7 @@ export default function useSlideshow(slideshow) {
|
|
|
87
85
|
useEffect(() => {
|
|
88
86
|
;
|
|
89
87
|
[...slideshow.current?.children].forEach((child) => child.setAttribute('aria-hidden', 'true'));
|
|
90
|
-
slideshow.current?.children[currentSlide]
|
|
88
|
+
slideshow.current?.children?.[currentSlide]?.setAttribute('aria-hidden', 'false');
|
|
91
89
|
}, [currentSlide, slideshow]);
|
|
92
90
|
return {
|
|
93
91
|
slideshowRef: slideshow,
|
|
@@ -95,37 +93,47 @@ export default function useSlideshow(slideshow) {
|
|
|
95
93
|
slideCount: slideshow.current?.children.length || 0,
|
|
96
94
|
goTo(index) {
|
|
97
95
|
index = Math.min(slideshow.current?.children.length - 1, Math.max(0, index));
|
|
98
|
-
const newElement = slideshow.current?.children[index];
|
|
99
|
-
newElement.scrollIntoView({
|
|
100
|
-
behavior: 'smooth',
|
|
101
|
-
block: isHorizontal(slideshow.current)
|
|
102
|
-
? 'nearest'
|
|
103
|
-
: isCentered(slideshow.current)
|
|
104
|
-
? 'center'
|
|
105
|
-
: 'start',
|
|
106
|
-
inline: isHorizontal(slideshow.current)
|
|
107
|
-
? isCentered(slideshow.current)
|
|
108
|
-
? 'center'
|
|
109
|
-
: 'start'
|
|
110
|
-
: 'nearest',
|
|
111
|
-
});
|
|
112
|
-
// const scrollOpts: ScrollToOptions = {
|
|
96
|
+
const newElement = slideshow.current?.children?.[index];
|
|
97
|
+
// newElement.scrollIntoView({
|
|
113
98
|
// behavior: 'smooth',
|
|
114
|
-
//
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
//
|
|
121
|
-
//
|
|
122
|
-
//
|
|
123
|
-
//
|
|
124
|
-
//
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
99
|
+
// block: isHorizontal(slideshow.current)
|
|
100
|
+
// ? 'nearest'
|
|
101
|
+
// : isCentered(slideshow.current)
|
|
102
|
+
// ? 'center'
|
|
103
|
+
// : 'start',
|
|
104
|
+
// inline: isHorizontal(slideshow.current)
|
|
105
|
+
// ? isCentered(slideshow.current)
|
|
106
|
+
// ? 'center'
|
|
107
|
+
// : 'start'
|
|
108
|
+
// : 'nearest',
|
|
109
|
+
// })
|
|
110
|
+
const scrollOpts = {
|
|
111
|
+
behavior: 'smooth',
|
|
112
|
+
};
|
|
113
|
+
const horizontal = isHorizontal(slideshow.current);
|
|
114
|
+
const styles = window.getComputedStyle(slideshow.current);
|
|
115
|
+
const padding = horizontal
|
|
116
|
+
? parseInt(styles.paddingLeft)
|
|
117
|
+
: parseInt(styles.paddingTop);
|
|
118
|
+
if (isHorizontal(slideshow.current)) {
|
|
119
|
+
if (isCentered(slideshow.current)) {
|
|
120
|
+
scrollOpts.left =
|
|
121
|
+
newElement?.offsetLeft + newElement?.clientWidth / 2 - padding;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
scrollOpts.left = newElement?.offsetLeft - padding;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
if (isCentered(slideshow.current)) {
|
|
129
|
+
scrollOpts.top =
|
|
130
|
+
newElement?.offsetTop + newElement?.clientHeight / 2 - padding;
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
scrollOpts.top = newElement?.offsetTop - padding;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
slideshow.current?.scrollTo(scrollOpts);
|
|
129
137
|
},
|
|
130
138
|
atStart: progress <= 0 || progress === -1,
|
|
131
139
|
atEnd: progress >= 1 || progress === -1,
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as Components from './components';
|
|
2
|
+
import * as Config from './config';
|
|
2
3
|
import * as Hooks from './hooks';
|
|
3
4
|
import * as Store from './store';
|
|
4
5
|
import * as Storage from './storage';
|
|
5
6
|
import * as Utils from './utils';
|
|
6
|
-
export { Components, Hooks, Store, Storage, Utils };
|
|
7
|
+
export { Components, Config, Hooks, Store, Storage, Utils };
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA;AAChC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA;AAChC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AAEpC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA;AAEhC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAA;AAClC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA;AAChC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA;AAChC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AAEpC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAA;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
package/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as Components from './components';
|
|
2
|
+
import * as Config from './config';
|
|
2
3
|
import * as Hooks from './hooks';
|
|
3
4
|
import * as Store from './store';
|
|
4
5
|
import * as Storage from './storage';
|
|
5
6
|
// import * as Types from './types'
|
|
6
7
|
import * as Utils from './utils';
|
|
7
|
-
export { Components, Hooks, Store, Storage, Utils };
|
|
8
|
+
export { Components, Config, Hooks, Store, Storage, Utils };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superrb/react-addons",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.0-
|
|
4
|
+
"version": "4.0.0-21",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
7
7
|
"repository": "https://github.com/superrbstudio/react-addons",
|
|
@@ -14,14 +14,15 @@
|
|
|
14
14
|
"js-cookie": "^3.0.5",
|
|
15
15
|
"react-google-recaptcha-v3": "^1.10.1",
|
|
16
16
|
"react-hook-form": "^7.46.1",
|
|
17
|
-
"react-use-draggable-scroll": "^0.4.7"
|
|
18
|
-
"simple-zustand-devtools": "^1.1.0"
|
|
17
|
+
"react-use-draggable-scroll": "^0.4.7"
|
|
19
18
|
},
|
|
20
19
|
"peerDependencies": {
|
|
20
|
+
"csp-header": "^6.1.0",
|
|
21
21
|
"react": "^19.1.0",
|
|
22
22
|
"typescript": "^5.2.2",
|
|
23
|
+
"usehooks-ts": "^3.1.1",
|
|
23
24
|
"yup": "^1.4.0",
|
|
24
|
-
"zustand": "^
|
|
25
|
+
"zustand": "^5.0.5"
|
|
25
26
|
},
|
|
26
27
|
"scripts": {
|
|
27
28
|
"build": "tsc",
|
|
@@ -33,7 +34,8 @@
|
|
|
33
34
|
"@types/js-cookie": "^3.0.3",
|
|
34
35
|
"@types/node": "^20.5.7",
|
|
35
36
|
"@types/react": "^19.1.0",
|
|
36
|
-
"
|
|
37
|
+
"csp-header": "^6.3.0",
|
|
38
|
+
"eslint": "9.26.0",
|
|
37
39
|
"eslint-config-next": "^13.5.3",
|
|
38
40
|
"eslint-config-prettier": "^9.0.0",
|
|
39
41
|
"eslint-plugin-jsx-a11y": "^6.7.1",
|
|
@@ -43,10 +45,11 @@
|
|
|
43
45
|
"react": "^19.1.0",
|
|
44
46
|
"typescript": "^5.2.2",
|
|
45
47
|
"typescript-eslint": "^0.0.1-alpha.0",
|
|
48
|
+
"usehooks-ts": "^3.1.1",
|
|
46
49
|
"watch": "^1.0.2",
|
|
47
|
-
"yup": "^1.
|
|
48
|
-
"zustand": "^
|
|
50
|
+
"yup": "^1.7.1",
|
|
51
|
+
"zustand": "^5.0.5"
|
|
49
52
|
},
|
|
50
|
-
"packageManager": "yarn@4.
|
|
53
|
+
"packageManager": "yarn@4.12.0",
|
|
51
54
|
"stableVersion": "3.0.0"
|
|
52
|
-
}
|
|
55
|
+
}
|
package/store/cookies.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../src/store/cookies.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../src/store/cookies.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC1B,eAAe,EAAE,OAAO,CAAA;IACxB,uBAAuB,EAAE,OAAO,CAAA;IAChC,kBAAkB,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAA;IAC/C,0BAA0B,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAA;IACvD,SAAS,EAAE,OAAO,CAAA;IAClB,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB;AAED,QAAA,MAAM,cAAc,0EAyBlB,CAAA;AAEF,eAAe,cAAc,CAAA"}
|
package/store/cookies.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { create } from 'zustand';
|
|
2
|
-
import { mountStoreDevtool } from 'simple-zustand-devtools';
|
|
3
2
|
import Cookies from 'js-cookie';
|
|
4
3
|
const useCookieStore = create()((set) => {
|
|
5
4
|
const cookiesAccepted = !!Cookies.get('accepted-cookies') || false;
|
|
@@ -26,7 +25,4 @@ const useCookieStore = create()((set) => {
|
|
|
26
25
|
closePopup: () => set({ popupOpen: false }),
|
|
27
26
|
};
|
|
28
27
|
});
|
|
29
|
-
if (process.env.NODE_ENV === 'development') {
|
|
30
|
-
mountStoreDevtool('CookieStore', useCookieStore);
|
|
31
|
-
}
|
|
32
28
|
export default useCookieStore;
|
package/store/modal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../src/store/modal.ts"],"names":[],"mappings":"AAGA,UAAU,UAAU;IAClB,SAAS,EAAE;QACT,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KACvB,CAAA;IACD,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;IACjC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC;AAED,QAAA,MAAM,aAAa,yEASjB,CAAA;
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../src/store/modal.ts"],"names":[],"mappings":"AAGA,UAAU,UAAU;IAClB,SAAS,EAAE;QACT,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KACvB,CAAA;IACD,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;IACjC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC;AAED,QAAA,MAAM,aAAa,yEASjB,CAAA;AAEF,eAAe,aAAa,CAAA"}
|
package/store/modal.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { create } from 'zustand';
|
|
2
|
-
import { mountStoreDevtool } from 'simple-zustand-devtools';
|
|
3
2
|
const useModalStore = create()((set, get) => {
|
|
4
3
|
return {
|
|
5
4
|
openState: {},
|
|
@@ -8,7 +7,4 @@ const useModalStore = create()((set, get) => {
|
|
|
8
7
|
closeModal: (name) => set((state) => ({ openState: { ...state.openState, [name]: false } })),
|
|
9
8
|
};
|
|
10
9
|
});
|
|
11
|
-
if (process.env.NODE_ENV === 'development') {
|
|
12
|
-
mountStoreDevtool('ModalStore', useModalStore);
|
|
13
|
-
}
|
|
14
10
|
export default useModalStore;
|
package/store/nav.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav.d.ts","sourceRoot":"","sources":["../src/store/nav.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nav.d.ts","sourceRoot":"","sources":["../src/store/nav.ts"],"names":[],"mappings":"AAEA,UAAU,QAAQ;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,QAAA,MAAM,WAAW,uEAKd,CAAA;AAEH,eAAe,WAAW,CAAA"}
|
package/store/nav.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { create } from 'zustand';
|
|
2
|
-
import { mountStoreDevtool } from 'simple-zustand-devtools';
|
|
3
2
|
const useNavStore = create()((set) => ({
|
|
4
3
|
navOpen: false,
|
|
5
4
|
toggleNav: () => set((state) => ({ navOpen: !state.navOpen })),
|
|
6
5
|
openNav: () => set({ navOpen: true }),
|
|
7
6
|
closeNav: () => set({ navOpen: false }),
|
|
8
7
|
}));
|
|
9
|
-
if (process.env.NODE_ENV === 'development') {
|
|
10
|
-
mountStoreDevtool('NavStore', useNavStore);
|
|
11
|
-
}
|
|
12
8
|
export default useNavStore;
|