@c15t/react 0.0.1-rc.10
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/LICENSE.md +595 -0
- package/README.md +55 -0
- package/dist/components/consent-manager-dialog/__tests__/styles.spec.cjs +223 -0
- package/dist/components/consent-manager-dialog/__tests__/styles.spec.d.ts +2 -0
- package/dist/components/consent-manager-dialog/__tests__/styles.spec.d.ts.map +1 -0
- package/dist/components/consent-manager-dialog/__tests__/styles.spec.js +188 -0
- package/dist/components/consent-manager-dialog/__tests__/utils.cjs +68 -0
- package/dist/components/consent-manager-dialog/__tests__/utils.d.ts +13 -0
- package/dist/components/consent-manager-dialog/__tests__/utils.d.ts.map +1 -0
- package/dist/components/consent-manager-dialog/__tests__/utils.js +34 -0
- package/dist/components/consent-manager-dialog/atoms/dialog-card.cjs +154 -0
- package/dist/components/consent-manager-dialog/atoms/dialog-card.d.ts +90 -0
- package/dist/components/consent-manager-dialog/atoms/dialog-card.d.ts.map +1 -0
- package/dist/components/consent-manager-dialog/atoms/dialog-card.js +95 -0
- package/dist/components/consent-manager-dialog/atoms/overlay.cjs +86 -0
- package/dist/components/consent-manager-dialog/atoms/overlay.d.ts +71 -0
- package/dist/components/consent-manager-dialog/atoms/overlay.d.ts.map +1 -0
- package/dist/components/consent-manager-dialog/atoms/overlay.js +37 -0
- package/dist/components/consent-manager-dialog/consent-manager-dialog.cjs +148 -0
- package/dist/components/consent-manager-dialog/consent-manager-dialog.d.ts +40 -0
- package/dist/components/consent-manager-dialog/consent-manager-dialog.d.ts.map +1 -0
- package/dist/components/consent-manager-dialog/consent-manager-dialog.js +100 -0
- package/dist/components/consent-manager-dialog/consent-manager-dialog.module.cjs +50 -0
- package/dist/components/consent-manager-dialog/consent-manager-dialog.module.js +16 -0
- package/dist/components/consent-manager-dialog/consent-manager-dialog_module.css +202 -0
- package/dist/components/consent-manager-dialog/index.cjs +51 -0
- package/dist/components/consent-manager-dialog/index.d.ts +4 -0
- package/dist/components/consent-manager-dialog/index.d.ts.map +1 -0
- package/dist/components/consent-manager-dialog/index.js +18 -0
- package/dist/components/consent-manager-dialog/theme.cjs +19 -0
- package/dist/components/consent-manager-dialog/theme.d.ts +19 -0
- package/dist/components/consent-manager-dialog/theme.d.ts.map +1 -0
- package/dist/components/consent-manager-dialog/theme.js +0 -0
- package/dist/components/consent-manager-widget/__tests__/styles.spec.cjs +228 -0
- package/dist/components/consent-manager-widget/__tests__/styles.spec.d.ts +2 -0
- package/dist/components/consent-manager-widget/__tests__/styles.spec.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/__tests__/styles.spec.js +193 -0
- package/dist/components/consent-manager-widget/__tests__/utils.cjs +68 -0
- package/dist/components/consent-manager-widget/__tests__/utils.d.ts +13 -0
- package/dist/components/consent-manager-widget/__tests__/utils.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/__tests__/utils.js +34 -0
- package/dist/components/consent-manager-widget/atoms/accordion.cjs +169 -0
- package/dist/components/consent-manager-widget/atoms/accordion.d.ts +57 -0
- package/dist/components/consent-manager-widget/atoms/accordion.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/atoms/accordion.js +106 -0
- package/dist/components/consent-manager-widget/atoms/button.cjs +93 -0
- package/dist/components/consent-manager-widget/atoms/button.d.ts +27 -0
- package/dist/components/consent-manager-widget/atoms/button.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/atoms/button.js +52 -0
- package/dist/components/consent-manager-widget/atoms/footer.cjs +74 -0
- package/dist/components/consent-manager-widget/atoms/footer.d.ts +15 -0
- package/dist/components/consent-manager-widget/atoms/footer.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/atoms/footer.js +23 -0
- package/dist/components/consent-manager-widget/atoms/logo.cjs +101 -0
- package/dist/components/consent-manager-widget/atoms/logo.d.ts +8 -0
- package/dist/components/consent-manager-widget/atoms/logo.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/atoms/logo.js +67 -0
- package/dist/components/consent-manager-widget/atoms/root.cjs +60 -0
- package/dist/components/consent-manager-widget/atoms/root.d.ts +82 -0
- package/dist/components/consent-manager-widget/atoms/root.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/atoms/root.js +25 -0
- package/dist/components/consent-manager-widget/consent-manager-widget.cjs +96 -0
- package/dist/components/consent-manager-widget/consent-manager-widget.d.ts +44 -0
- package/dist/components/consent-manager-widget/consent-manager-widget.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/consent-manager-widget.js +62 -0
- package/dist/components/consent-manager-widget/consent-manager-widget.module.cjs +61 -0
- package/dist/components/consent-manager-widget/consent-manager-widget.module.js +27 -0
- package/dist/components/consent-manager-widget/consent-manager-widget_module.css +337 -0
- package/dist/components/consent-manager-widget/index.cjs +69 -0
- package/dist/components/consent-manager-widget/index.d.ts +11 -0
- package/dist/components/consent-manager-widget/index.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/index.js +36 -0
- package/dist/components/consent-manager-widget/theme.cjs +19 -0
- package/dist/components/consent-manager-widget/theme.d.ts +50 -0
- package/dist/components/consent-manager-widget/theme.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/theme.js +0 -0
- package/dist/components/consent-manager-widget/types.cjs +19 -0
- package/dist/components/consent-manager-widget/types.d.ts +18 -0
- package/dist/components/consent-manager-widget/types.d.ts.map +1 -0
- package/dist/components/consent-manager-widget/types.js +0 -0
- package/dist/components/cookie-banner/__tests__/styles.spec.cjs +241 -0
- package/dist/components/cookie-banner/__tests__/styles.spec.d.ts +2 -0
- package/dist/components/cookie-banner/__tests__/styles.spec.d.ts.map +1 -0
- package/dist/components/cookie-banner/__tests__/styles.spec.js +206 -0
- package/dist/components/cookie-banner/__tests__/utils.cjs +67 -0
- package/dist/components/cookie-banner/__tests__/utils.d.ts +13 -0
- package/dist/components/cookie-banner/__tests__/utils.d.ts.map +1 -0
- package/dist/components/cookie-banner/__tests__/utils.js +33 -0
- package/dist/components/cookie-banner/atoms/overlay.cjs +89 -0
- package/dist/components/cookie-banner/atoms/overlay.d.ts +46 -0
- package/dist/components/cookie-banner/atoms/overlay.d.ts.map +1 -0
- package/dist/components/cookie-banner/atoms/overlay.js +40 -0
- package/dist/components/cookie-banner/atoms/root.cjs +132 -0
- package/dist/components/cookie-banner/atoms/root.d.ts +93 -0
- package/dist/components/cookie-banner/atoms/root.d.ts.map +1 -0
- package/dist/components/cookie-banner/atoms/root.js +83 -0
- package/dist/components/cookie-banner/components.cjs +186 -0
- package/dist/components/cookie-banner/components.d.ts +136 -0
- package/dist/components/cookie-banner/components.d.ts.map +1 -0
- package/dist/components/cookie-banner/components.js +121 -0
- package/dist/components/cookie-banner/cookie-banner.cjs +100 -0
- package/dist/components/cookie-banner/cookie-banner.d.ts +144 -0
- package/dist/components/cookie-banner/cookie-banner.d.ts.map +1 -0
- package/dist/components/cookie-banner/cookie-banner.js +66 -0
- package/dist/components/cookie-banner/cookie-banner.module.cjs +55 -0
- package/dist/components/cookie-banner/cookie-banner.module.js +21 -0
- package/dist/components/cookie-banner/cookie-banner_module.css +224 -0
- package/dist/components/cookie-banner/error-boundary.cjs +68 -0
- package/dist/components/cookie-banner/error-boundary.d.ts +56 -0
- package/dist/components/cookie-banner/error-boundary.d.ts.map +1 -0
- package/dist/components/cookie-banner/error-boundary.js +34 -0
- package/dist/components/cookie-banner/index.cjs +59 -0
- package/dist/components/cookie-banner/index.d.ts +52 -0
- package/dist/components/cookie-banner/index.d.ts.map +1 -0
- package/dist/components/cookie-banner/index.js +26 -0
- package/dist/components/cookie-banner/theme.cjs +19 -0
- package/dist/components/cookie-banner/theme.d.ts +71 -0
- package/dist/components/cookie-banner/theme.d.ts.map +1 -0
- package/dist/components/cookie-banner/theme.js +0 -0
- package/dist/components/shared/libs/polymorphic.cjs +19 -0
- package/dist/components/shared/libs/polymorphic.d.ts +15 -0
- package/dist/components/shared/libs/polymorphic.d.ts.map +1 -0
- package/dist/components/shared/libs/polymorphic.js +0 -0
- package/dist/components/shared/libs/recursive-clone-children.cjs +49 -0
- package/dist/components/shared/libs/recursive-clone-children.d.ts +14 -0
- package/dist/components/shared/libs/recursive-clone-children.d.ts.map +1 -0
- package/dist/components/shared/libs/recursive-clone-children.js +15 -0
- package/dist/components/shared/primitives/box.cjs +54 -0
- package/dist/components/shared/primitives/box.d.ts +47 -0
- package/dist/components/shared/primitives/box.d.ts.map +1 -0
- package/dist/components/shared/primitives/box.js +20 -0
- package/dist/components/shared/primitives/button.cjs +96 -0
- package/dist/components/shared/primitives/button.d.ts +207 -0
- package/dist/components/shared/primitives/button.d.ts.map +1 -0
- package/dist/components/shared/primitives/button.js +62 -0
- package/dist/components/shared/primitives/button.types.cjs +19 -0
- package/dist/components/shared/primitives/button.types.d.ts +35 -0
- package/dist/components/shared/primitives/button.types.d.ts.map +1 -0
- package/dist/components/shared/primitives/button.types.js +0 -0
- package/dist/components/shared/ui/accordion/accordion.cjs +219 -0
- package/dist/components/shared/ui/accordion/accordion.d.ts +44 -0
- package/dist/components/shared/ui/accordion/accordion.d.ts.map +1 -0
- package/dist/components/shared/ui/accordion/accordion.js +165 -0
- package/dist/components/shared/ui/accordion/accordion.module.cjs +49 -0
- package/dist/components/shared/ui/accordion/accordion.module.js +15 -0
- package/dist/components/shared/ui/accordion/accordion.types.cjs +19 -0
- package/dist/components/shared/ui/accordion/accordion.types.d.ts +74 -0
- package/dist/components/shared/ui/accordion/accordion.types.d.ts.map +1 -0
- package/dist/components/shared/ui/accordion/accordion.types.js +0 -0
- package/dist/components/shared/ui/accordion/accordion_module.css +197 -0
- package/dist/components/shared/ui/accordion/index.cjs +76 -0
- package/dist/components/shared/ui/accordion/index.d.ts +3 -0
- package/dist/components/shared/ui/accordion/index.d.ts.map +1 -0
- package/dist/components/shared/ui/accordion/index.js +2 -0
- package/dist/components/shared/ui/button/button.cjs +199 -0
- package/dist/components/shared/ui/button/button.d.ts +444 -0
- package/dist/components/shared/ui/button/button.d.ts.map +1 -0
- package/dist/components/shared/ui/button/button.js +149 -0
- package/dist/components/shared/ui/button/button.module.cjs +65 -0
- package/dist/components/shared/ui/button/button.module.js +31 -0
- package/dist/components/shared/ui/button/button.types.cjs +19 -0
- package/dist/components/shared/ui/button/button.types.d.ts +45 -0
- package/dist/components/shared/ui/button/button.types.d.ts.map +1 -0
- package/dist/components/shared/ui/button/button.types.js +0 -0
- package/dist/components/shared/ui/button/button_module.css +247 -0
- package/dist/components/shared/ui/button/index.cjs +76 -0
- package/dist/components/shared/ui/button/index.d.ts +3 -0
- package/dist/components/shared/ui/button/index.d.ts.map +1 -0
- package/dist/components/shared/ui/button/index.js +2 -0
- package/dist/components/shared/ui/icon.cjs +57 -0
- package/dist/components/shared/ui/icon.d.ts +8 -0
- package/dist/components/shared/ui/icon.d.ts.map +1 -0
- package/dist/components/shared/ui/icon.js +23 -0
- package/dist/components/shared/ui/logo.cjs +101 -0
- package/dist/components/shared/ui/logo.d.ts +8 -0
- package/dist/components/shared/ui/logo.d.ts.map +1 -0
- package/dist/components/shared/ui/logo.js +67 -0
- package/dist/components/shared/ui/switch/index.cjs +76 -0
- package/dist/components/shared/ui/switch/index.d.ts +3 -0
- package/dist/components/shared/ui/switch/index.d.ts.map +1 -0
- package/dist/components/shared/ui/switch/index.js +2 -0
- package/dist/components/shared/ui/switch/switch.cjs +95 -0
- package/dist/components/shared/ui/switch/switch.d.ts +24 -0
- package/dist/components/shared/ui/switch/switch.d.ts.map +1 -0
- package/dist/components/shared/ui/switch/switch.js +47 -0
- package/dist/components/shared/ui/switch/switch.module.cjs +45 -0
- package/dist/components/shared/ui/switch/switch.module.js +11 -0
- package/dist/components/shared/ui/switch/switch.types.cjs +19 -0
- package/dist/components/shared/ui/switch/switch.types.d.ts +34 -0
- package/dist/components/shared/ui/switch/switch.types.d.ts.map +1 -0
- package/dist/components/shared/ui/switch/switch.types.js +0 -0
- package/dist/components/shared/ui/switch/switch_module.css +183 -0
- package/dist/context/consent-manager-context.cjs +38 -0
- package/dist/context/consent-manager-context.d.ts +13 -0
- package/dist/context/consent-manager-context.d.ts.map +1 -0
- package/dist/context/consent-manager-context.js +4 -0
- package/dist/context/theme-context.cjs +40 -0
- package/dist/context/theme-context.d.ts +102 -0
- package/dist/context/theme-context.d.ts.map +1 -0
- package/dist/context/theme-context.js +5 -0
- package/dist/hooks/index.cjs +94 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/use-consent-manager.cjs +45 -0
- package/dist/hooks/use-consent-manager.d.ts +61 -0
- package/dist/hooks/use-consent-manager.d.ts.map +1 -0
- package/dist/hooks/use-consent-manager.js +11 -0
- package/dist/hooks/use-focus-trap.cjs +76 -0
- package/dist/hooks/use-focus-trap.d.ts +15 -0
- package/dist/hooks/use-focus-trap.d.ts.map +1 -0
- package/dist/hooks/use-focus-trap.js +42 -0
- package/dist/hooks/use-scroll-lock.cjs +55 -0
- package/dist/hooks/use-scroll-lock.d.ts +26 -0
- package/dist/hooks/use-scroll-lock.d.ts.map +1 -0
- package/dist/hooks/use-scroll-lock.js +21 -0
- package/dist/hooks/use-theme.cjs +56 -0
- package/dist/hooks/use-theme.d.ts +2 -0
- package/dist/hooks/use-theme.d.ts.map +1 -0
- package/dist/hooks/use-theme.js +22 -0
- package/dist/hooks/use-translations.cjs +58 -0
- package/dist/hooks/use-translations.d.ts +29 -0
- package/dist/hooks/use-translations.d.ts.map +1 -0
- package/dist/hooks/use-translations.js +24 -0
- package/dist/index.cjs +101 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/providers/consent-manager-provider.cjs +110 -0
- package/dist/providers/consent-manager-provider.d.ts +16 -0
- package/dist/providers/consent-manager-provider.d.ts.map +1 -0
- package/dist/providers/consent-manager-provider.js +76 -0
- package/dist/types/consent-manager.cjs +19 -0
- package/dist/types/consent-manager.d.ts +120 -0
- package/dist/types/consent-manager.d.ts.map +1 -0
- package/dist/types/consent-manager.js +0 -0
- package/dist/types/theme/index.cjs +76 -0
- package/dist/types/theme/index.d.ts +3 -0
- package/dist/types/theme/index.d.ts.map +1 -0
- package/dist/types/theme/index.js +2 -0
- package/dist/types/theme/style-keys.cjs +19 -0
- package/dist/types/theme/style-keys.d.ts +14 -0
- package/dist/types/theme/style-keys.d.ts.map +1 -0
- package/dist/types/theme/style-keys.js +0 -0
- package/dist/types/theme/style-types.cjs +19 -0
- package/dist/types/theme/style-types.d.ts +34 -0
- package/dist/types/theme/style-types.d.ts.map +1 -0
- package/dist/types/theme/style-types.js +0 -0
- package/dist/utils/cn.cjs +55 -0
- package/dist/utils/cn.d.ts +11 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cn.js +6 -0
- package/dist/utils/merge-styles.cjs +62 -0
- package/dist/utils/merge-styles.d.ts +11 -0
- package/dist/utils/merge-styles.d.ts.map +1 -0
- package/dist/utils/merge-styles.js +28 -0
- package/dist/utils/translations.cjs +86 -0
- package/dist/utils/translations.d.ts +14 -0
- package/dist/utils/translations.d.ts.map +1 -0
- package/dist/utils/translations.js +50 -0
- package/dist/utils/use-styles.cjs +95 -0
- package/dist/utils/use-styles.d.ts +32 -0
- package/dist/utils/use-styles.d.ts.map +1 -0
- package/dist/utils/use-styles.js +61 -0
- package/package.json +90 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
6
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: definition[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.o = function(obj, prop) {
|
|
14
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
(()=>{
|
|
18
|
+
__webpack_require__.r = function(exports1) {
|
|
19
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
20
|
+
value: 'Module'
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
})();
|
|
27
|
+
var __webpack_exports__ = {};
|
|
28
|
+
__webpack_require__.r(__webpack_exports__);
|
|
29
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
30
|
+
ConsentStateContext: ()=>ConsentStateContext
|
|
31
|
+
});
|
|
32
|
+
const external_react_namespaceObject = require("react");
|
|
33
|
+
const ConsentStateContext = external_react_namespaceObject.createContext(void 0);
|
|
34
|
+
var __webpack_export_target__ = exports;
|
|
35
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
36
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
37
|
+
value: true
|
|
38
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ConsentManagerContextValue } from '../types/consent-manager';
|
|
3
|
+
/**
|
|
4
|
+
* React context for sharing consent management state.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* This context provides access to both the current consent state and
|
|
8
|
+
* the methods to modify it throughout the application.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare const ConsentStateContext: React.Context<ConsentManagerContextValue | undefined>;
|
|
13
|
+
//# sourceMappingURL=consent-manager-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent-manager-context.d.ts","sourceRoot":"","sources":["../../src/context/consent-manager-context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAE3E;;;;;;;;GAQG;AACH,eAAO,MAAM,mBAAmB,uDAEpB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
6
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: definition[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.o = function(obj, prop) {
|
|
14
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
(()=>{
|
|
18
|
+
__webpack_require__.r = function(exports1) {
|
|
19
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
20
|
+
value: 'Module'
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
})();
|
|
27
|
+
var __webpack_exports__ = {};
|
|
28
|
+
__webpack_require__.r(__webpack_exports__);
|
|
29
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
30
|
+
LocalThemeContext: ()=>LocalThemeContext,
|
|
31
|
+
GlobalThemeContext: ()=>GlobalThemeContext
|
|
32
|
+
});
|
|
33
|
+
const external_react_namespaceObject = require("react");
|
|
34
|
+
const GlobalThemeContext = (0, external_react_namespaceObject.createContext)(null);
|
|
35
|
+
const LocalThemeContext = (0, external_react_namespaceObject.createContext)(null);
|
|
36
|
+
var __webpack_export_target__ = exports;
|
|
37
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
38
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
39
|
+
value: true
|
|
40
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration value type for the ThemeContext.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Provides type-safe theme customization options for components.
|
|
6
|
+
* Supports generic theme types for different component variants.
|
|
7
|
+
* Includes animation and style control features.
|
|
8
|
+
*
|
|
9
|
+
* @typeParam Theme - The theme configuration type for the component
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* type MyTheme = {
|
|
14
|
+
* colors: {
|
|
15
|
+
* primary: string;
|
|
16
|
+
* secondary: string;
|
|
17
|
+
* };
|
|
18
|
+
* };
|
|
19
|
+
*
|
|
20
|
+
* const value: ThemeContextValue<MyTheme> = {
|
|
21
|
+
* theme: {
|
|
22
|
+
* colors: {
|
|
23
|
+
* primary: '#007bff',
|
|
24
|
+
* secondary: '#6c757d'
|
|
25
|
+
* }
|
|
26
|
+
* },
|
|
27
|
+
* noStyle: false,
|
|
28
|
+
* disableAnimation: false
|
|
29
|
+
* };
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export type ThemeContextValue<Theme = unknown> = {
|
|
35
|
+
/**
|
|
36
|
+
* Theme configuration object for styling components
|
|
37
|
+
* @remarks Partial to allow incremental theme overrides
|
|
38
|
+
* @default undefined
|
|
39
|
+
*/
|
|
40
|
+
theme?: Partial<Theme>;
|
|
41
|
+
/**
|
|
42
|
+
* Disables all animations when true
|
|
43
|
+
* @remarks Useful for reduced motion preferences
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
disableAnimation?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Removes default styles when true
|
|
49
|
+
* @remarks Enables fully custom styling
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
noStyle?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Locks the scroll when true & hides the overlay when disabled
|
|
55
|
+
* @remarks Useful for preventing scroll when a modal is open
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
scrollLock?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Traps keyboard focus within a dialog when true
|
|
61
|
+
* @remarks Enhances accessibility for modal dialogs
|
|
62
|
+
* @default true
|
|
63
|
+
*/
|
|
64
|
+
trapFocus?: boolean;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Context for providing theme values to components.
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* Combines consent management state with theme configuration.
|
|
71
|
+
* Must be provided by a parent Theme.Root component.
|
|
72
|
+
* Supports TypeScript generic themes for type safety.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* <ThemeContext.Provider value={{ theme: myTheme, noStyle: false }}>
|
|
77
|
+
* <App />
|
|
78
|
+
* </ThemeContext.Provider>
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
export declare const GlobalThemeContext: import("react").Context<ThemeContextValue<unknown> | null>;
|
|
84
|
+
/**
|
|
85
|
+
* Context for providing theme values to components.
|
|
86
|
+
*
|
|
87
|
+
* @remarks
|
|
88
|
+
* Combines consent management state with theme configuration.
|
|
89
|
+
* Must be provided by a parent Theme.Root component.
|
|
90
|
+
* Supports TypeScript generic themes for type safety.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```tsx
|
|
94
|
+
* <ThemeContext.Provider value={{ theme: myTheme, noStyle: false }}>
|
|
95
|
+
* <App />
|
|
96
|
+
* </ThemeContext.Provider>
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
export declare const LocalThemeContext: import("react").Context<ThemeContextValue<unknown> | null>;
|
|
102
|
+
//# sourceMappingURL=theme-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-context.d.ts","sourceRoot":"","sources":["../../src/context/theme-context.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,MAAM,iBAAiB,CAAC,KAAK,GAAG,OAAO,IAAI;IAChD;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAEvB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,kBAAkB,4DACwB,CAAC;AAExD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iBAAiB,4DACyB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
3
|
+
const GlobalThemeContext = (0, __WEBPACK_EXTERNAL_MODULE_react__.createContext)(null);
|
|
4
|
+
const LocalThemeContext = (0, __WEBPACK_EXTERNAL_MODULE_react__.createContext)(null);
|
|
5
|
+
export { GlobalThemeContext, LocalThemeContext };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"./use-consent-manager": function(module) {
|
|
4
|
+
module.exports = require("./use-consent-manager.cjs");
|
|
5
|
+
},
|
|
6
|
+
"./use-focus-trap": function(module) {
|
|
7
|
+
module.exports = require("./use-focus-trap.cjs");
|
|
8
|
+
},
|
|
9
|
+
"./use-theme": function(module) {
|
|
10
|
+
module.exports = require("./use-theme.cjs");
|
|
11
|
+
},
|
|
12
|
+
"./use-translations": function(module) {
|
|
13
|
+
module.exports = require("./use-translations.cjs");
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var __webpack_module_cache__ = {};
|
|
17
|
+
function __webpack_require__(moduleId) {
|
|
18
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
19
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
20
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
21
|
+
exports: {}
|
|
22
|
+
};
|
|
23
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
24
|
+
return module.exports;
|
|
25
|
+
}
|
|
26
|
+
(()=>{
|
|
27
|
+
__webpack_require__.n = function(module) {
|
|
28
|
+
var getter = module && module.__esModule ? function() {
|
|
29
|
+
return module['default'];
|
|
30
|
+
} : function() {
|
|
31
|
+
return module;
|
|
32
|
+
};
|
|
33
|
+
__webpack_require__.d(getter, {
|
|
34
|
+
a: getter
|
|
35
|
+
});
|
|
36
|
+
return getter;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
(()=>{
|
|
40
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
41
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: definition[key]
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
(()=>{
|
|
48
|
+
__webpack_require__.o = function(obj, prop) {
|
|
49
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
50
|
+
};
|
|
51
|
+
})();
|
|
52
|
+
(()=>{
|
|
53
|
+
__webpack_require__.r = function(exports1) {
|
|
54
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
55
|
+
value: 'Module'
|
|
56
|
+
});
|
|
57
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
58
|
+
value: true
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
})();
|
|
62
|
+
var __webpack_exports__ = {};
|
|
63
|
+
(()=>{
|
|
64
|
+
__webpack_require__.r(__webpack_exports__);
|
|
65
|
+
var _use_consent_manager__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./use-consent-manager");
|
|
66
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
67
|
+
for(var __WEBPACK_IMPORT_KEY__ in _use_consent_manager__WEBPACK_IMPORTED_MODULE_0__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
68
|
+
return _use_consent_manager__WEBPACK_IMPORTED_MODULE_0__[key];
|
|
69
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
70
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
71
|
+
var _use_focus_trap__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./use-focus-trap");
|
|
72
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
73
|
+
for(var __WEBPACK_IMPORT_KEY__ in _use_focus_trap__WEBPACK_IMPORTED_MODULE_1__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
74
|
+
return _use_focus_trap__WEBPACK_IMPORTED_MODULE_1__[key];
|
|
75
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
76
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
77
|
+
var _use_theme__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./use-theme");
|
|
78
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
79
|
+
for(var __WEBPACK_IMPORT_KEY__ in _use_theme__WEBPACK_IMPORTED_MODULE_2__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
80
|
+
return _use_theme__WEBPACK_IMPORTED_MODULE_2__[key];
|
|
81
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
82
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
83
|
+
var _use_translations__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./use-translations");
|
|
84
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
85
|
+
for(var __WEBPACK_IMPORT_KEY__ in _use_translations__WEBPACK_IMPORTED_MODULE_3__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
86
|
+
return _use_translations__WEBPACK_IMPORTED_MODULE_3__[key];
|
|
87
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
88
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
89
|
+
})();
|
|
90
|
+
var __webpack_export_target__ = exports;
|
|
91
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
92
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
93
|
+
value: true
|
|
94
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = function(obj, prop) {
|
|
13
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
(()=>{
|
|
17
|
+
__webpack_require__.r = function(exports1) {
|
|
18
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
19
|
+
value: 'Module'
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
22
|
+
value: true
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
})();
|
|
26
|
+
var __webpack_exports__ = {};
|
|
27
|
+
__webpack_require__.r(__webpack_exports__);
|
|
28
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
29
|
+
useConsentManager: ()=>useConsentManager
|
|
30
|
+
});
|
|
31
|
+
const external_react_namespaceObject = require("react");
|
|
32
|
+
const consent_manager_context_cjs_namespaceObject = require("../context/consent-manager-context.cjs");
|
|
33
|
+
function useConsentManager() {
|
|
34
|
+
const context = (0, external_react_namespaceObject.useContext)(consent_manager_context_cjs_namespaceObject.ConsentStateContext);
|
|
35
|
+
if (void 0 === context) throw new Error('useConsentManager must be used within a ConsentManagerProvider');
|
|
36
|
+
return {
|
|
37
|
+
...context.state,
|
|
38
|
+
...context.store.getState()
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
var __webpack_export_target__ = exports;
|
|
42
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
43
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
44
|
+
value: true
|
|
45
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook for accessing and managing consent state.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This hook provides access to the complete consent management API, including:
|
|
6
|
+
* - Current consent state (what consents are given/required)
|
|
7
|
+
* - Methods to update consents
|
|
8
|
+
* - Compliance settings and region detection
|
|
9
|
+
* - State persistence and retrieval
|
|
10
|
+
*
|
|
11
|
+
* The hook must be used within a ConsentManagerProvider component.
|
|
12
|
+
*
|
|
13
|
+
* @throws {Error}
|
|
14
|
+
* Throws if used outside of a ConsentManagerProvider context.
|
|
15
|
+
*
|
|
16
|
+
* @returns Combined state and methods for consent management
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare function useConsentManager(): {
|
|
20
|
+
consents: import("c15t").ConsentState;
|
|
21
|
+
consentInfo: {
|
|
22
|
+
time: number;
|
|
23
|
+
type: "all" | "custom" | "necessary";
|
|
24
|
+
} | null;
|
|
25
|
+
showPopup: boolean;
|
|
26
|
+
isLoadingConsentInfo: boolean;
|
|
27
|
+
gdprTypes: import("c15t").AllConsentNames[];
|
|
28
|
+
isPrivacyDialogOpen: boolean;
|
|
29
|
+
complianceSettings: Record<import("c15t").ComplianceRegion, import("c15t").ComplianceSettings>;
|
|
30
|
+
callbacks: import("c15t").Callbacks;
|
|
31
|
+
detectedCountry: string | null;
|
|
32
|
+
locationInfo: import("c15t").LocationInfo | null;
|
|
33
|
+
jurisdictionInfo: import("c15t").JurisdictionInfo | null;
|
|
34
|
+
privacySettings: import("c15t").PrivacySettings;
|
|
35
|
+
translationConfig: import("c15t").TranslationConfig;
|
|
36
|
+
setTranslationConfig: (config: import("c15t").TranslationConfig) => void;
|
|
37
|
+
includeNonDisplayedConsents: boolean;
|
|
38
|
+
consentTypes: import("c15t").ConsentType[];
|
|
39
|
+
setConsent: (name: import("c15t").AllConsentNames, value: boolean) => void;
|
|
40
|
+
setShowPopup: (show: boolean, force?: boolean) => void;
|
|
41
|
+
setIsPrivacyDialogOpen: (isOpen: boolean) => void;
|
|
42
|
+
saveConsents: (type: "all" | "custom" | "necessary") => void;
|
|
43
|
+
resetConsents: () => void;
|
|
44
|
+
setGdprTypes: (types: import("c15t").AllConsentNames[]) => void;
|
|
45
|
+
setComplianceSetting: (region: import("c15t").ComplianceRegion, settings: Partial<import("c15t").ComplianceSettings>) => void;
|
|
46
|
+
resetComplianceSettings: () => void;
|
|
47
|
+
setCallback: (name: keyof import("c15t").Callbacks, callback: import("c15t").CallbackFunction | undefined) => void;
|
|
48
|
+
setDetectedCountry: (country: string) => void;
|
|
49
|
+
setLocationInfo: (location: import("c15t").LocationInfo | null) => void;
|
|
50
|
+
setJurisdictionInfo: (jurisdiction: import("c15t").JurisdictionInfo | null) => void;
|
|
51
|
+
fetchConsentBannerInfo: (url?: string) => Promise<import("c15t").ConsentBannerResponse | undefined>;
|
|
52
|
+
getDisplayedConsents: () => typeof import("c15t").consentTypes;
|
|
53
|
+
hasConsented: () => boolean;
|
|
54
|
+
clearAllData: () => void;
|
|
55
|
+
updateConsentMode: () => void;
|
|
56
|
+
setPrivacySettings: (settings: Partial<import("c15t").PrivacySettings>) => void;
|
|
57
|
+
getEffectiveConsents: () => import("c15t").ConsentState;
|
|
58
|
+
hasConsentFor: (consentType: import("c15t").AllConsentNames) => boolean;
|
|
59
|
+
setIncludeNonDisplayedConsents: (include: boolean) => void;
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=use-consent-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-consent-manager.d.ts","sourceRoot":"","sources":["../../src/hooks/use-consent-manager.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB;;;;;;;;;;;;;;;;;;;;;uCAc21E,CAAC;;;;;;;;;;;gCAA+kE,CAAC;;;;;;;;;EAD58I"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__context_consent_manager_context_js_ee8f06d2__ from "../context/consent-manager-context.js";
|
|
3
|
+
function useConsentManager() {
|
|
4
|
+
const context = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__context_consent_manager_context_js_ee8f06d2__.ConsentStateContext);
|
|
5
|
+
if (void 0 === context) throw new Error('useConsentManager must be used within a ConsentManagerProvider');
|
|
6
|
+
return {
|
|
7
|
+
...context.state,
|
|
8
|
+
...context.store.getState()
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export { useConsentManager };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = function(obj, prop) {
|
|
13
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
(()=>{
|
|
17
|
+
__webpack_require__.r = function(exports1) {
|
|
18
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
19
|
+
value: 'Module'
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
22
|
+
value: true
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
})();
|
|
26
|
+
var __webpack_exports__ = {};
|
|
27
|
+
__webpack_require__.r(__webpack_exports__);
|
|
28
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
29
|
+
useFocusTrap: ()=>useFocusTrap
|
|
30
|
+
});
|
|
31
|
+
const external_react_namespaceObject = require("react");
|
|
32
|
+
function useFocusTrap(shouldTrap, containerRef) {
|
|
33
|
+
const previousFocusRef = (0, external_react_namespaceObject.useRef)(null);
|
|
34
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
35
|
+
if (!shouldTrap || !containerRef || !containerRef.current) return;
|
|
36
|
+
previousFocusRef.current = document.activeElement;
|
|
37
|
+
const focusableElements = getFocusableElements(containerRef.current);
|
|
38
|
+
if (focusableElements.length > 0) setTimeout(()=>{
|
|
39
|
+
focusableElements[0]?.focus();
|
|
40
|
+
}, 0);
|
|
41
|
+
else if (-1 !== containerRef.current.tabIndex) try {
|
|
42
|
+
containerRef.current.focus();
|
|
43
|
+
} catch (e) {}
|
|
44
|
+
const handleKeyDown = (e)=>{
|
|
45
|
+
if ('Tab' !== e.key || !containerRef.current) return;
|
|
46
|
+
const focusableElements = getFocusableElements(containerRef.current);
|
|
47
|
+
if (0 === focusableElements.length) return;
|
|
48
|
+
const firstElement = focusableElements[0];
|
|
49
|
+
const lastElement = focusableElements.at(-1);
|
|
50
|
+
if (e.shiftKey && document.activeElement === firstElement) {
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
lastElement?.focus();
|
|
53
|
+
} else if (!e.shiftKey && document.activeElement === lastElement) {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
firstElement?.focus();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
59
|
+
return ()=>{
|
|
60
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
61
|
+
if (previousFocusRef.current && 'focus' in previousFocusRef.current) setTimeout(()=>previousFocusRef.current?.focus(), 0);
|
|
62
|
+
};
|
|
63
|
+
}, [
|
|
64
|
+
shouldTrap,
|
|
65
|
+
containerRef
|
|
66
|
+
]);
|
|
67
|
+
}
|
|
68
|
+
function getFocusableElements(container) {
|
|
69
|
+
const selector = 'a[href]:not([disabled]),button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[contenteditable],[tabindex]:not([tabindex="-1"])';
|
|
70
|
+
return Array.from(container.querySelectorAll(selector)).filter((el)=>el.offsetWidth > 0 && el.offsetHeight > 0);
|
|
71
|
+
}
|
|
72
|
+
var __webpack_export_target__ = exports;
|
|
73
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
74
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
75
|
+
value: true
|
|
76
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Hook that manages focus trapping within a container.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* This hook ensures keyboard navigation stays within the container
|
|
7
|
+
* while it's active, improving accessibility for modal dialogs.
|
|
8
|
+
*
|
|
9
|
+
* @param shouldTrap - Boolean indicating whether focus should be trapped
|
|
10
|
+
* @param containerRef - Reference to the container element
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export declare function useFocusTrap(shouldTrap: boolean, containerRef: RefObject<HTMLElement> | null): void;
|
|
15
|
+
//# sourceMappingURL=use-focus-trap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-focus-trap.d.ts","sourceRoot":"","sources":["../../src/hooks/use-focus-trap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAE1D;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC3B,UAAU,EAAE,OAAO,EACnB,YAAY,EAAE,SAAS,CAAC,WAAW,CAAC,GAAG,IAAI,GACzC,IAAI,CAiEN"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
2
|
+
function useFocusTrap(shouldTrap, containerRef) {
|
|
3
|
+
const previousFocusRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
|
|
4
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
5
|
+
if (!shouldTrap || !containerRef || !containerRef.current) return;
|
|
6
|
+
previousFocusRef.current = document.activeElement;
|
|
7
|
+
const focusableElements = getFocusableElements(containerRef.current);
|
|
8
|
+
if (focusableElements.length > 0) setTimeout(()=>{
|
|
9
|
+
focusableElements[0]?.focus();
|
|
10
|
+
}, 0);
|
|
11
|
+
else if (-1 !== containerRef.current.tabIndex) try {
|
|
12
|
+
containerRef.current.focus();
|
|
13
|
+
} catch (e) {}
|
|
14
|
+
const handleKeyDown = (e)=>{
|
|
15
|
+
if ('Tab' !== e.key || !containerRef.current) return;
|
|
16
|
+
const focusableElements = getFocusableElements(containerRef.current);
|
|
17
|
+
if (0 === focusableElements.length) return;
|
|
18
|
+
const firstElement = focusableElements[0];
|
|
19
|
+
const lastElement = focusableElements.at(-1);
|
|
20
|
+
if (e.shiftKey && document.activeElement === firstElement) {
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
lastElement?.focus();
|
|
23
|
+
} else if (!e.shiftKey && document.activeElement === lastElement) {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
firstElement?.focus();
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
document.addEventListener('keydown', handleKeyDown);
|
|
29
|
+
return ()=>{
|
|
30
|
+
document.removeEventListener('keydown', handleKeyDown);
|
|
31
|
+
if (previousFocusRef.current && 'focus' in previousFocusRef.current) setTimeout(()=>previousFocusRef.current?.focus(), 0);
|
|
32
|
+
};
|
|
33
|
+
}, [
|
|
34
|
+
shouldTrap,
|
|
35
|
+
containerRef
|
|
36
|
+
]);
|
|
37
|
+
}
|
|
38
|
+
function getFocusableElements(container) {
|
|
39
|
+
const selector = 'a[href]:not([disabled]),button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[contenteditable],[tabindex]:not([tabindex="-1"])';
|
|
40
|
+
return Array.from(container.querySelectorAll(selector)).filter((el)=>el.offsetWidth > 0 && el.offsetHeight > 0);
|
|
41
|
+
}
|
|
42
|
+
export { useFocusTrap };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = function(exports1, definition) {
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = function(obj, prop) {
|
|
13
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
(()=>{
|
|
17
|
+
__webpack_require__.r = function(exports1) {
|
|
18
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
19
|
+
value: 'Module'
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
22
|
+
value: true
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
})();
|
|
26
|
+
var __webpack_exports__ = {};
|
|
27
|
+
__webpack_require__.r(__webpack_exports__);
|
|
28
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
29
|
+
useScrollLock: ()=>useScrollLock
|
|
30
|
+
});
|
|
31
|
+
const external_react_namespaceObject = require("react");
|
|
32
|
+
function useScrollLock(shouldLock) {
|
|
33
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
34
|
+
if (shouldLock) {
|
|
35
|
+
const originalStyles = {
|
|
36
|
+
overflow: document.body.style.overflow,
|
|
37
|
+
paddingRight: document.body.style.paddingRight
|
|
38
|
+
};
|
|
39
|
+
const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
40
|
+
document.body.style.overflow = 'hidden';
|
|
41
|
+
if (scrollbarWidth > 0) document.body.style.paddingRight = `${scrollbarWidth}px`;
|
|
42
|
+
return ()=>{
|
|
43
|
+
document.body.style.overflow = originalStyles.overflow;
|
|
44
|
+
document.body.style.paddingRight = originalStyles.paddingRight;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}, [
|
|
48
|
+
shouldLock
|
|
49
|
+
]);
|
|
50
|
+
}
|
|
51
|
+
var __webpack_export_target__ = exports;
|
|
52
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
53
|
+
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
54
|
+
value: true
|
|
55
|
+
});
|