vision-accessibility 1.0.2 → 1.0.3
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/README.md +70 -1
- package/dist/components/AccessibilityPanel/AccessibilityPanel.d.ts.map +1 -1
- package/dist/components/AccessibilityToggle/AccessibilityToggle.d.ts +2 -0
- package/dist/components/AccessibilityToggle/AccessibilityToggle.d.ts.map +1 -1
- package/dist/components/ColorSchemeControl/ColorSchemeControl.d.ts +2 -0
- package/dist/components/ColorSchemeControl/ColorSchemeControl.d.ts.map +1 -1
- package/dist/components/FontSizeControl/FontSizeControl.d.ts +2 -0
- package/dist/components/FontSizeControl/FontSizeControl.d.ts.map +1 -1
- package/dist/components/ImageControl/ImageControl.d.ts +2 -0
- package/dist/components/ImageControl/ImageControl.d.ts.map +1 -1
- package/dist/config/translations.d.ts +57 -0
- package/dist/config/translations.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +371 -202
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/css-applier.d.ts +1 -0
- package/dist/lib/css-applier.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +39 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/AccessibilityPanel/AccessibilityPanel.module.scss +22 -31
- package/src/components/AccessibilityPanel/AccessibilityPanel.stories.tsx +50 -10
- package/src/components/AccessibilityPanel/AccessibilityPanel.tsx +72 -44
- package/src/components/AccessibilityToggle/AccessibilityToggle.stories.tsx +11 -0
- package/src/components/AccessibilityToggle/AccessibilityToggle.tsx +17 -10
- package/src/components/ColorSchemeControl/ColorSchemeControl.stories.tsx +15 -0
- package/src/components/ColorSchemeControl/ColorSchemeControl.tsx +99 -61
- package/src/components/FontSizeControl/FontSizeControl.stories.tsx +15 -0
- package/src/components/FontSizeControl/FontSizeControl.tsx +99 -61
- package/src/components/ImageControl/ImageControl.stories.tsx +11 -0
- package/src/components/ImageControl/ImageControl.tsx +17 -10
- package/src/config/translations.ts +82 -0
- package/src/hooks/useAccessibilitySettings.ts +12 -12
- package/src/index.ts +12 -8
- package/src/lib/css-applier.ts +54 -38
- package/src/styles/global.scss +1 -4
- package/src/types/index.ts +43 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VisionAccessibility={},e.React)}(this,function(e,t){"use strict";const r={isEnabled:!1,colorScheme:"standard",fontSize:"standard",showImages:!0},
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VisionAccessibility={},e.React,e.ReactDOM)}(this,function(e,t,a){"use strict";const r={isEnabled:!1,colorScheme:"standard",fontSize:"standard",showImages:!0},n="accessibility-settings",o={panelTitle:"Настройки доступности",panelDescription:"Настройте отображение страницы для улучшения доступности",closePanelLabel:"Закрыть панель настроек доступности",colorSchemeTitle:"Цветовая схема",colorSchemeStandardLabel:"Стандартный",colorSchemeStandardDescription:"Обычная цветовая схема сайта",colorSchemeHighContrastLabel:"Контрастный белый на черном",colorSchemeHighContrastDescription:"Высококонтрастная схема для лучшей читаемости",colorSchemeGrayscaleLabel:"Черно-белый",colorSchemeGrayscaleDescription:"Преобразование всех цветов в оттенки серого",fontSizeTitle:"Размер шрифта",fontSizeSmallLabel:"Мелкий",fontSizeSmallDescription:"Уменьшенный размер текста (80%)",fontSizeStandardLabel:"Стандартный",fontSizeStandardDescription:"Обычный размер текста",fontSizeLargeLabel:"Крупный",fontSizeLargeDescription:"Увеличенный размер текста (130%)",imageControlTitle:"Изображения",imageControlShowLabel:"Показывать изображения",imageControlHideLabel:"Скрывать изображения",accessibilityToggleLabel:"Режим доступности",accessibilityEnableDescription:"Все настройки доступности активны. Используйте элементы управления ниже для точной настройки.",accessibilityDisableDescription:"Включите режим доступности для активации всех настроек. При выключении все изменения будут сброшены."},s=e=>{try{if("undefined"==typeof window)return;localStorage.setItem(n,JSON.stringify(e))}catch(t){console.warn("Не удалось сохранить настройки доступности:",t)}},i=()=>{try{if("undefined"==typeof window)return null;const e=localStorage.getItem(n);return e?c(JSON.parse(e)):null}catch(e){return console.warn("Не удалось загрузить настройки доступности:",e),null}},l=()=>{try{if("undefined"==typeof window)return;localStorage.removeItem(n)}catch(e){console.warn("Не удалось очистить настройки доступности:",e)}},c=e=>{if(!e||"object"!=typeof e)return r;const t=e;return{isEnabled:"boolean"==typeof t.isEnabled?t.isEnabled:r.isEnabled,colorScheme:["standard","high-contrast","grayscale"].includes(t.colorScheme)?t.colorScheme:r.colorScheme,fontSize:["small","standard","large"].includes(t.fontSize)?t.fontSize:r.fontSize,showImages:"boolean"==typeof t.showImages?t.showImages:r.showImages}},d=()=>"undefined"==typeof document?[]:document.querySelectorAll("h1, h2, h3, h4, h5, h6, p, span, a, button, label, li"),u=(e,t)=>{try{if("undefined"==typeof window)return;e()}catch(a){console.warn(t,a)}},m=()=>"undefined"!=typeof window&&"undefined"!=typeof document;function f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var p,h={exports:{}};
|
|
2
2
|
/*!
|
|
3
3
|
Copyright (c) 2018 Jed Watson.
|
|
4
4
|
Licensed under the MIT License (MIT), see
|
|
5
5
|
http://jedwatson.github.io/classnames
|
|
6
|
-
*/
|
|
6
|
+
*/p=h,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=r(e,a(n)))}return e}function a(a){if("string"==typeof a||"number"==typeof a)return a;if("object"!=typeof a)return"";if(Array.isArray(a))return t.apply(null,a);if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]"))return a.toString();var n="";for(var o in a)e.call(a,o)&&a[o]&&(n=r(n,o));return n}function r(e,t){return t?e?e+" "+t:e+t:e}p.exports?(t.default=t,p.exports=t):window.classNames=t}();const y=f(h.exports),b="data-original-font-size",_={small:.8,standard:1,large:1.3},g=e=>{const t=window.getComputedStyle(e).fontSize;return parseFloat(t)},S=e=>{if(!e.hasAttribute(b)){const t=g(e);e.setAttribute(b,t.toString())}},j=e=>{const t=e.getAttribute(b);if(t)return parseFloat(t);const a=g(e);return e.setAttribute(b,a.toString()),a},x=(e,t)=>{e.style.fontSize=`${t}px`},v=e=>{e.style.fontSize="",e.removeAttribute(b)},k=e=>{u(()=>{if(!m())return;const t=d(),a=_[e];t.forEach(t=>{try{if("standard"===e)v(t);else{S(t);const e=j(t);x(t,e*a)}}catch(r){console.warn("Ошибка при изменении размера шрифта элемента:",t,r)}})},`Ошибка при применении динамического размера шрифта: ${e}`)},N=()=>{u(()=>{if(!m())return;d().forEach(e=>{try{v(e)}catch(t){console.warn("Ошибка при сбросе размера шрифта элемента:",e,t)}})},"Ошибка при сбросе всех размеров шрифта")},E=e=>{"standard"!==e&&u(()=>{if(!m())return;const t=d(),a=_[e];t.forEach(e=>{if(!e.hasAttribute(b)&&!e.style.fontSize)try{S(e);const t=j(e);x(e,t*a)}catch(t){console.warn("Ошибка при обновлении размера шрифта нового элемента:",e,t)}})},`Ошибка при обновлении размера шрифта новых элементов: ${e}`)},C={HIGH_CONTRAST:y("accessibility-high-contrast"),FONT_SMALL:"accessibility-font-small",FONT_LARGE:"accessibility-font-large",HIDE_IMAGES:"accessibility-hide-images"},w=e=>{u(()=>{if(m())switch(document.body.classList.remove(C.HIGH_CONTRAST),document.body.style.filter="",D(),e){case"high-contrast":document.body.classList.add(C.HIGH_CONTRAST),O();break;case"grayscale":document.body.style.filter="grayscale(100%)";break;case"standard":break;default:console.warn(`Неизвестная цветовая схема: ${e}`)}},`Ошибка при применении цветовой схемы: ${e}`)},L=e=>e.hasAttribute("data-accessibility-panel-container")||null!==e.closest("[data-accessibility-panel-container]"),T=e=>{k(e)},A=e=>{u(()=>{if(!m())return;const t=document.querySelectorAll("img");e?t.forEach(e=>{e.style.visibility=""}):t.forEach(e=>{e.style.visibility="hidden"})},`Ошибка при управлении отображением изображений: ${e}`)},$=()=>{u(()=>{if(!m())return;document.body.classList.remove(C.HIGH_CONTRAST),document.body.classList.remove(C.FONT_SMALL),document.body.classList.remove(C.FONT_LARGE),document.body.style.filter="",N();document.querySelectorAll("img").forEach(e=>{e.style.visibility=""}),D()},"Ошибка при удалении всех стилей доступности")},z=e=>{e.isEnabled&&(w(e.colorScheme),T(e.fontSize)),A(e.showImages)},O=()=>{u(()=>{if(!m())return;document.querySelectorAll("*").forEach(e=>{e instanceof HTMLElement&&!L(e)&&(e.style.backgroundColor="#000",e.style.color="#fff",e.style.borderColor="#fff")});document.querySelectorAll("a:not([data-accessibility-panel-container])").forEach(e=>{e instanceof HTMLElement&&!L(e)&&(e.style.color="#ffff00")});document.querySelectorAll("a:visited:not([data-accessibility-panel-container])").forEach(e=>{e instanceof HTMLElement&&!L(e)&&(e.style.color="#ff00ff")});document.querySelectorAll("button:not([data-accessibility-panel-container])").forEach(e=>{e instanceof HTMLElement&&!L(e)&&(e.style.backgroundColor="#fff",e.style.color="#000",e.style.border="2px solid #fff")});document.querySelectorAll("input, textarea, select:not([data-accessibility-panel-container])").forEach(e=>{e instanceof HTMLElement&&!L(e)&&(e.style.backgroundColor="#fff",e.style.color="#000",e.style.border="2px solid #fff")})},"Ошибка при применении стилей высокого контраста ко всем элементам")},D=()=>{u(()=>{if(!m())return;document.querySelectorAll("*").forEach(e=>{e instanceof HTMLElement&&!L(e)&&(e.style.backgroundColor="",e.style.color="",e.style.borderColor="")});document.querySelectorAll("a:not([data-accessibility-panel-container])").forEach(e=>{e instanceof HTMLElement&&!L(e)&&(e.style.color="")});document.querySelectorAll("a:visited:not([data-accessibility-panel-container])").forEach(e=>{e instanceof HTMLElement&&!L(e)&&(e.style.color="")});document.querySelectorAll("button:not([data-accessibility-panel-container])").forEach(e=>{e instanceof HTMLElement&&!L(e)&&(e.style.backgroundColor="",e.style.color="",e.style.border="")});document.querySelectorAll("input, textarea, select:not([data-accessibility-panel-container])").forEach(e=>{e instanceof HTMLElement&&!L(e)&&(e.style.backgroundColor="",e.style.color="",e.style.border="")})},"Ошибка при удалении стилей высокого контраста со всех элементов")},I=()=>{const[e,a]=t.useState(r),[n,o]=t.useState(!1);t.useEffect(()=>{if("undefined"==typeof window||!n||!e.isEnabled)return;const t=new MutationObserver(t=>{let a=!1;t.forEach(e=>{"childList"===e.type&&e.addedNodes.forEach(e=>{if(e.nodeType===Node.ELEMENT_NODE){const t=e;(t.matches("h1, h2, h3, h4, h5, h6, p, span, a, button, label, li, div")||t.querySelector("h1, h2, h3, h4, h5, h6, p, span, a, button, label, li, div"))&&(a=!0)}})}),a&&"standard"!==e.fontSize&&setTimeout(()=>{E(e.fontSize)},100)});return t.observe(document.body,{childList:!0,subtree:!0}),()=>{t.disconnect()}},[n,e.isEnabled,e.fontSize]),t.useEffect(()=>{if("undefined"!=typeof window)try{const e=i();e&&(a(e),e.isEnabled&&z(e))}catch(e){console.warn("Ошибка при загрузке настроек доступности:",e),a(r)}finally{o(!0)}},[]),t.useEffect(()=>{if(n)try{s(e),e.isEnabled?z(e):$()}catch(t){console.warn("Ошибка при сохранении настроек доступности:",t)}},[e,n]);const c=t.useCallback(e=>{a(t=>{const a={...t,...e};return t.isEnabled&&!a.isEnabled&&$(),a})},[]),d=t.useCallback(()=>{try{$(),a(r),l()}catch(e){console.warn("Ошибка при сбросе настроек доступности:",e)}},[]);return{settings:e,updateSettings:c,resetSettings:d,isLoaded:n}};var M,q={exports:{}},R={};var H,P={};
|
|
7
7
|
/**
|
|
8
8
|
* @license React
|
|
9
9
|
* react-jsx-runtime.development.js
|
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
*
|
|
13
13
|
* This source code is licensed under the MIT license found in the
|
|
14
14
|
* LICENSE file in the root directory of this source tree.
|
|
15
|
-
*/"production"===process.env.NODE_ENV?H.exports=function(){if(R)return P;R=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(t,r,o){var n=null;if(void 0!==o&&(n=""+o),void 0!==r.key&&(n=""+r.key),"key"in r)for(var s in o={},r)"key"!==s&&(o[s]=r[s]);else o=r;return r=o.ref,{$$typeof:e,type:t,key:n,ref:void 0!==r?r:null,props:o}}return P.Fragment=t,P.jsx=r,P.jsxs=r,P}():H.exports=(D||(D=1,"production"!==process.env.NODE_ENV&&function(){function e(t){if(null==t)return null;if("function"==typeof t)return t.$$typeof===w?null:t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case m:return"Fragment";case _:return"Profiler";case y:return"StrictMode";case S:return"Suspense";case v:return"SuspenseList";case x:return"Activity"}if("object"==typeof t)switch("number"==typeof t.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case p:return"Portal";case b:return t.displayName||"Context";case h:return(t._context.displayName||"Context")+".Consumer";case g:var r=t.render;return(t=t.displayName)||(t=""!==(t=r.displayName||r.name||"")?"ForwardRef("+t+")":"ForwardRef"),t;case k:return null!==(r=t.displayName||null)?r:e(t.type)||"Memo";case j:r=t._payload,t=t._init;try{return e(t(r))}catch(o){}}return null}function r(e){return""+e}function o(e){try{r(e);var t=!1}catch(s){t=!0}if(t){var o=(t=console).error,n="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return o.call(t,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",n),r(e)}}function n(t){if(t===m)return"<>";if("object"==typeof t&&null!==t&&t.$$typeof===j)return"<...>";try{var r=e(t);return r?"<"+r+">":"<...>"}catch(o){return"<...>"}}function s(){return Error("react-stack-top-frame")}function a(){var t=e(this.type);return T[t]||(T[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),void 0!==(t=this.props.ref)?t:null}function l(t,r,n,s,l,c){var u,p=r.children;if(void 0!==p)if(s)if(C(p)){for(s=0;s<p.length;s++)i(p[s]);Object.freeze&&Object.freeze(p)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else i(p);if(N.call(r,"key")){p=e(t);var m=Object.keys(r).filter(function(e){return"key"!==e});s=0<m.length?"{key: someKey, "+m.join(": ..., ")+": ...}":"{key: someKey}",$[p+s]||(m=0<m.length?"{"+m.join(": ..., ")+": ...}":"{}",console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',s,p,m,p),$[p+s]=!0)}if(p=null,void 0!==n&&(o(n),p=""+n),function(e){if(N.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(r)&&(o(r.key),p=""+r.key),"key"in r)for(var y in n={},r)"key"!==y&&(n[y]=r[y]);else n=r;return p&&function(e,t){function r(){d||(d=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}(n,"function"==typeof t?t.displayName||t.name||"Unknown":t),function(e,t,r,o,n,s){var l=r.ref;return e={$$typeof:f,type:e,key:t,props:r,_owner:o},null!==(void 0!==l?l:null)?Object.defineProperty(e,"ref",{enumerable:!1,get:a}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:n}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:s}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(t,p,n,null===(u=E.A)?null:u.getOwner(),l,c)}function i(e){c(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===j&&("fulfilled"===e._payload.status?c(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function c(e){return"object"==typeof e&&null!==e&&e.$$typeof===f}var d,u=t,f=Symbol.for("react.transitional.element"),p=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),b=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),v=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),w=Symbol.for("react.client.reference"),E=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=Object.prototype.hasOwnProperty,C=Array.isArray,A=console.createTask?console.createTask:function(){return null},T={},O=(u={react_stack_bottom_frame:function(e){return e()}}).react_stack_bottom_frame.bind(u,s)(),L=A(n(s)),$={};F.Fragment=m,F.jsx=function(e,t,r){var o=1e4>E.recentlyCreatedOwnerStacks++;return l(e,t,r,!1,o?Error("react-stack-top-frame"):O,o?A(n(e)):L)},F.jsxs=function(e,t,r){var o=1e4>E.recentlyCreatedOwnerStacks++;return l(e,t,r,!0,o?Error("react-stack-top-frame"):O,o?A(n(e)):L)}}()),F);var q=H.exports;const G=t.createContext(null),B=({children:e})=>{const t=M();return q.jsx(G.Provider,{value:t,children:e})},U=()=>{const e=t.useContext(G);if(!e)throw new Error("useAccessibilityContext должен использоваться внутри AccessibilityProvider");return e},V="_accessibilityToggle_kpjm6_9",J="_toggleContainer_kpjm6_15",K="_toggleLabel_kpjm6_21",Y="_toggleInput_kpjm6_42",W="_toggleSlider_kpjm6_49",X="_toggleThumb_kpjm6_55",Q="_toggleContent_kpjm6_81",Z="_toggleTitle_kpjm6_88",ee="_toggleStatus_kpjm6_95",te="_description_kpjm6_102",re="_highContrastMode_kpjm6_110",oe=({className:e})=>{const{settings:t,updateSettings:r}=U(),o=t.isEnabled;return q.jsx("div",{className:`${V} ${e||""} ${"high-contrast"===t.colorScheme?re:""}`,children:q.jsxs("div",{className:J,children:[q.jsxs("label",{className:K,children:[q.jsx("input",{type:"checkbox",checked:o,onChange:e=>{r({isEnabled:e.target.checked})},className:Y,"aria-describedby":"accessibility-toggle-description"}),q.jsx("span",{className:W,"aria-hidden":"true",children:q.jsx("span",{className:X})}),q.jsxs("div",{className:Q,children:[q.jsx("span",{className:Z,children:"Режим доступности"}),q.jsx("span",{className:ee,children:o?"Включен":"Выключен"})]})]}),q.jsx("p",{id:"accessibility-toggle-description",className:te,children:o?"Все настройки доступности активны. Используйте элементы управления ниже для точной настройки.":"Включите режим доступности для активации всех настроек. При выключении все изменения будут сброшены."})]})})},ne="_colorSchemeControl_1kr72_9",se="_disabled_1kr72_12",ae="_title_1kr72_12",le="_optionsContainer_1kr72_23",ie="_option_1kr72_23",ce="_selected_1kr72_50",de="_radioIndicator_1kr72_54",ue="_optionDisabled_1kr72_62",fe="_radioInput_1kr72_72",pe="_optionContent_1kr72_79",me="_optionLabel_1kr72_91",ye="_optionDescription_1kr72_98",_e="_highContrastMode_1kr72_129",he=[{value:"standard",label:"Стандартный",description:"Обычная цветовая схема сайта"},{value:"high-contrast",label:"Контрастный белый на черном",description:"Высококонтрастная схема для лучшей читаемости"},{value:"grayscale",label:"Черно-белый",description:"Преобразование всех цветов в оттенки серого"}],be=({className:e})=>{const{settings:t,updateSettings:r}=U(),o=t.colorScheme,n=t.isEnabled,s=e=>{const t=e.target.value;r({colorScheme:t})};return q.jsxs("div",{className:`${ne} ${e||""} ${n?"":se} ${"high-contrast"===o?_e:""}`,children:[q.jsx("h4",{className:ae,children:"Цветовая схема"}),q.jsx("div",{className:le,role:"radiogroup","aria-labelledby":"color-scheme-title",children:he.map(e=>q.jsxs("label",{className:`${ie} ${o===e.value?ce:""} ${n?"":ue}`,children:[q.jsx("input",{type:"radio",name:"colorScheme",value:e.value,checked:o===e.value,onChange:s,className:fe,"aria-describedby":`color-scheme-${e.value}-description`,disabled:!n}),q.jsxs("div",{className:pe,children:[q.jsx("span",{className:me,children:e.label}),q.jsx("span",{id:`color-scheme-${e.value}-description`,className:ye,children:e.description})]}),q.jsx("div",{className:de,"aria-hidden":"true"})]},e.value))})]})},ge="_fontSizeControl_1c68l_9",Se="_disabled_1c68l_12",ve="_title_1c68l_12",ke="_optionsContainer_1c68l_23",je="_option_1c68l_23",xe="_selected_1c68l_50",we="_radioIndicator_1c68l_54",Ee="_optionDisabled_1c68l_62",Ne="_radioInput_1c68l_72",Ce="_optionContent_1c68l_79",Ae="_optionLabel_1c68l_91",Te="_optionDescription_1c68l_98",Oe="_highContrastMode_1c68l_129",Le=[{value:"small",label:"Мелкий",description:"Уменьшенный размер текста (80%)"},{value:"standard",label:"Стандартный",description:"Обычный размер текста"},{value:"large",label:"Крупный",description:"Увеличенный размер текста (130%)"}],$e=({className:e})=>{const{settings:t,updateSettings:r}=U(),o=t.fontSize,n=t.isEnabled,s=e=>{const t=e.target.value;r({fontSize:t})};return q.jsxs("div",{className:`${ge} ${e||""} ${n?"":Se} ${"high-contrast"===t.colorScheme?Oe:""}`,children:[q.jsx("h4",{className:ve,children:"Размер шрифта"}),q.jsx("div",{className:ke,role:"radiogroup","aria-labelledby":"font-size-title",children:Le.map(e=>q.jsxs("label",{className:`${je} ${o===e.value?xe:""} ${n?"":Ee}`,children:[q.jsx("input",{type:"radio",name:"fontSize",value:e.value,checked:o===e.value,onChange:s,className:Ne,"aria-describedby":`font-size-${e.value}-description`,disabled:!n}),q.jsxs("div",{className:Ce,children:[q.jsx("span",{className:Ae,children:e.label}),q.jsx("span",{id:`font-size-${e.value}-description`,className:Te,children:e.description})]}),q.jsx("div",{className:we,"aria-hidden":"true"})]},e.value))})]})},Ie="_imageControl_hkxkm_9",ze="_disabled_hkxkm_12",Me="_title_hkxkm_12",Re="_switchContainer_hkxkm_23",He="_switchLabel_hkxkm_29",Pe="_switchDisabled_hkxkm_49",De="_switchInput_hkxkm_59",Fe="_switchSlider_hkxkm_66",qe="_switchThumb_hkxkm_72",Ge="_switchText_hkxkm_98",Be="_description_hkxkm_106",Ue="_highContrastMode_hkxkm_114",Ve=({className:e})=>{const{settings:t,updateSettings:r}=U(),o=t.showImages,n=t.isEnabled;return q.jsxs("div",{className:`${Ie} ${e||""} ${n?"":ze} ${"high-contrast"===t.colorScheme?Ue:""}`,children:[q.jsx("h4",{className:Me,children:"Изображения"}),q.jsxs("div",{className:Re,children:[q.jsxs("label",{className:`${He} ${n?"":Pe}`,children:[q.jsx("input",{type:"checkbox",checked:o,onChange:e=>{r({showImages:e.target.checked})},className:De,"aria-describedby":"image-control-description",disabled:!n}),q.jsx("span",{className:Fe,"aria-hidden":"true",children:q.jsx("span",{className:qe})}),q.jsx("span",{className:Ge,children:o?"Показывать изображения":"Скрывать изображения"})]}),q.jsx("p",{id:"image-control-description",className:Be,children:o?"Изображения отображаются на странице":"Изображения скрыты для лучшей концентрации на тексте"})]})]})},Je="_stickyContainer_18ltw_9",Ke="_panel_18ltw_21",Ye="_top-right_18ltw_36",We="_top-left_18ltw_40",Xe="_bottom-right_18ltw_44",Qe="_bottom-left_18ltw_52",Ze="_header_18ltw_73",et="_title_18ltw_82",tt="_closeButton_18ltw_90",rt="_description_18ltw_121",ot="_content_18ltw_129",nt="_controls_18ltw_149",st="_highContrastMode_18ltw_155",at="_slideIn_18ltw_1",lt={stickyContainer:Je,panel:Ke,"top-right":"_top-right_18ltw_36",topRight:Ye,"top-left":"_top-left_18ltw_40",topLeft:We,"bottom-right":"_bottom-right_18ltw_44",bottomRight:Xe,"bottom-left":"_bottom-left_18ltw_52",bottomLeft:Qe,header:Ze,title:et,closeButton:tt,description:rt,content:ot,controls:nt,highContrastMode:st,slideIn:at},it=Object.freeze(Object.defineProperty({__proto__:null,bottomLeft:Qe,bottomRight:Xe,closeButton:tt,content:ot,controls:nt,default:lt,description:rt,header:Ze,highContrastMode:st,panel:Ke,slideIn:at,stickyContainer:Je,title:et,topLeft:We,topRight:Ye},Symbol.toStringTag,{value:"Module"})),ct="object"==typeof it&<?lt:lt||it,dt=({isOpen:e,onClose:r,position:o="top-right"})=>{const n=t.useRef(null);t.useEffect(()=>{if(!e)return;const t=e=>{n.current&&!n.current.contains(e.target)&&r()},o=setTimeout(()=>{document.addEventListener("mousedown",t)},100);return()=>{clearTimeout(o),document.removeEventListener("mousedown",t)}},[e,r]),t.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&r()};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},[e,r]);if(!e)return null;const{settings:s}=U();return q.jsx("div",{className:h(ct.stickyContainer),children:q.jsxs("div",{ref:n,className:h(ct.panel,ct[o],"high-contrast"===s.colorScheme&&ct.highContrastMode),role:"dialog","aria-modal":"true","aria-labelledby":"accessibility-panel-title","aria-describedby":"accessibility-panel-description",children:[q.jsxs("div",{className:h(ct.header),children:[q.jsx("h3",{id:"accessibility-panel-title",className:h(ct.title),children:"Настройки доступности"}),q.jsx("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),r()},className:h(ct.closeButton),"aria-label":"Закрыть панель настроек доступности",type:"button",children:"×"})]}),q.jsx("div",{id:"accessibility-panel-description",className:h(ct.description),children:"Настройте отображение страницы для улучшения доступности"}),q.jsxs("div",{className:h(ct.content),children:[q.jsx(oe,{}),q.jsxs("div",{className:h(ct.controls),children:[q.jsx(be,{}),q.jsx($e,{}),q.jsx(Ve,{})]})]})]})})};e.AccessibilityPanel=e=>q.jsx(B,{children:q.jsx(dt,{...e})}),e.AccessibilityProvider=B,e.AccessibilityToggle=oe,e.CSS_CLASSES=C,e.ColorSchemeControl=be,e.DEFAULT_ACCESSIBILITY_SETTINGS=r,e.FontSizeControl=$e,e.ImageControl=Ve,e.STORAGE_KEY=o,e.applyAllSettings=$,e.applyClassToElements=d,e.applyColorScheme=A,e.applyDynamicFontSize=w,e.applyFontSize=T,e.applyImageVisibility=O,e.applySettingIfEnabled=(e,t,r)=>{if(e)switch(t){case"colorScheme":A(r);break;case"fontSize":T(r);break;case"imageVisibility":O(r);break;default:console.warn(`Неизвестный тип настройки: ${t}`)}},e.clearStorage=a,e.getImageElements=c,e.getTextElements=i,e.isDOMAvailable=p,e.isFontSizeModified=()=>{if(!p())return!1;const e=i();for(let t=0;t<Math.min(e.length,10);t++)if(e[t].hasAttribute(b))return!0;return!1},e.loadFromStorage=s,e.removeAllAccessibilityStyles=L,e.removeClassFromElements=u,e.resetAllFontSizes=E,e.safeDOMOperation=f,e.safeLocalStorageOperation=(e,t,r)=>{try{return e()}catch(o){return console.warn(r,o),t}},e.saveToStorage=n,e.updateNewElementsFontSize=N,e.useAccessibilityContext=U,e.useAccessibilitySetting=e=>{const{settings:r,updateSettings:o}=M(),n=t.useCallback(t=>{o({[e]:t})},[e,o]);return[r[e],n]},e.useAccessibilitySettings=M,e.useAccessibilityToggle=()=>{const{settings:e,updateSettings:r}=M(),o=t.useCallback(e=>{r({isEnabled:e})},[r]);return[e.isEnabled,o]},e.validateSettings=l,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
|
15
|
+
*/"production"===process.env.NODE_ENV?q.exports=function(){if(M)return R;M=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(t,a,r){var n=null;if(void 0!==r&&(n=""+r),void 0!==a.key&&(n=""+a.key),"key"in a)for(var o in r={},a)"key"!==o&&(r[o]=a[o]);else r=a;return a=r.ref,{$$typeof:e,type:t,key:n,ref:void 0!==a?a:null,props:r}}return R.Fragment=t,R.jsx=a,R.jsxs=a,R}():q.exports=(H||(H=1,"production"!==process.env.NODE_ENV&&function(){function e(t){if(null==t)return null;if("function"==typeof t)return t.$$typeof===N?null:t.displayName||t.name||null;if("string"==typeof t)return t;switch(t){case p:return"Fragment";case y:return"Profiler";case h:return"StrictMode";case S:return"Suspense";case j:return"SuspenseList";case k:return"Activity"}if("object"==typeof t)switch("number"==typeof t.tag&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case f:return"Portal";case _:return t.displayName||"Context";case b:return(t._context.displayName||"Context")+".Consumer";case g:var a=t.render;return(t=t.displayName)||(t=""!==(t=a.displayName||a.name||"")?"ForwardRef("+t+")":"ForwardRef"),t;case x:return null!==(a=t.displayName||null)?a:e(t.type)||"Memo";case v:a=t._payload,t=t._init;try{return e(t(a))}catch(r){}}return null}function a(e){return""+e}function r(e){try{a(e);var t=!1}catch(o){t=!0}if(t){var r=(t=console).error,n="function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return r.call(t,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",n),a(e)}}function n(t){if(t===p)return"<>";if("object"==typeof t&&null!==t&&t.$$typeof===v)return"<...>";try{var a=e(t);return a?"<"+a+">":"<...>"}catch(r){return"<...>"}}function o(){return Error("react-stack-top-frame")}function s(){var t=e(this.type);return T[t]||(T[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),void 0!==(t=this.props.ref)?t:null}function i(t,a,n,o,i,c){var u,f=a.children;if(void 0!==f)if(o)if(w(f)){for(o=0;o<f.length;o++)l(f[o]);Object.freeze&&Object.freeze(f)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else l(f);if(C.call(a,"key")){f=e(t);var p=Object.keys(a).filter(function(e){return"key"!==e});o=0<p.length?"{key: someKey, "+p.join(": ..., ")+": ...}":"{key: someKey}",z[f+o]||(p=0<p.length?"{"+p.join(": ..., ")+": ...}":"{}",console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',o,f,p,f),z[f+o]=!0)}if(f=null,void 0!==n&&(r(n),f=""+n),function(e){if(C.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(a)&&(r(a.key),f=""+a.key),"key"in a)for(var h in n={},a)"key"!==h&&(n[h]=a[h]);else n=a;return f&&function(e,t){function a(){d||(d=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}a.isReactWarning=!0,Object.defineProperty(e,"key",{get:a,configurable:!0})}(n,"function"==typeof t?t.displayName||t.name||"Unknown":t),function(e,t,a,r,n,o){var i=a.ref;return e={$$typeof:m,type:e,key:t,props:a,_owner:r},null!==(void 0!==i?i:null)?Object.defineProperty(e,"ref",{enumerable:!1,get:s}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:n}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:o}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}(t,f,n,null===(u=E.A)?null:u.getOwner(),i,c)}function l(e){c(e)?e._store&&(e._store.validated=1):"object"==typeof e&&null!==e&&e.$$typeof===v&&("fulfilled"===e._payload.status?c(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function c(e){return"object"==typeof e&&null!==e&&e.$$typeof===m}var d,u=t,m=Symbol.for("react.transitional.element"),f=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),b=Symbol.for("react.consumer"),_=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),x=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),k=Symbol.for("react.activity"),N=Symbol.for("react.client.reference"),E=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C=Object.prototype.hasOwnProperty,w=Array.isArray,L=console.createTask?console.createTask:function(){return null},T={},A=(u={react_stack_bottom_frame:function(e){return e()}}).react_stack_bottom_frame.bind(u,o)(),$=L(n(o)),z={};P.Fragment=p,P.jsx=function(e,t,a){var r=1e4>E.recentlyCreatedOwnerStacks++;return i(e,t,a,!1,r?Error("react-stack-top-frame"):A,r?L(n(e)):$)},P.jsxs=function(e,t,a){var r=1e4>E.recentlyCreatedOwnerStacks++;return i(e,t,a,!0,r?Error("react-stack-top-frame"):A,r?L(n(e)):$)}}()),P);var F=q.exports;const G=t.createContext(null),V=({children:e})=>{const t=I();return F.jsx(G.Provider,{value:t,children:e})},B=()=>{const e=t.useContext(G);if(!e)throw new Error("useAccessibilityContext должен использоваться внутри AccessibilityProvider");return e},U="_accessibilityToggle_kpjm6_9",J="_toggleContainer_kpjm6_15",K="_toggleLabel_kpjm6_21",Y="_toggleInput_kpjm6_42",W="_toggleSlider_kpjm6_49",X="_toggleThumb_kpjm6_55",Q="_toggleContent_kpjm6_81",Z="_toggleTitle_kpjm6_88",ee="_toggleStatus_kpjm6_95",te="_description_kpjm6_102",ae="_highContrastMode_kpjm6_110",re=({className:e,translations:t={}})=>{const a={...o,...t},{settings:r,updateSettings:n}=B(),s=r.isEnabled;return F.jsx("div",{className:`${U} ${e||""} ${"high-contrast"===r.colorScheme?ae:""}`,children:F.jsxs("div",{className:J,children:[F.jsxs("label",{className:K,children:[F.jsx("input",{type:"checkbox",checked:s,onChange:e=>{n({isEnabled:e.target.checked})},className:Y,"aria-describedby":"accessibility-toggle-description"}),F.jsx("span",{className:W,"aria-hidden":"true",children:F.jsx("span",{className:X})}),F.jsxs("div",{className:Q,children:[F.jsx("span",{className:Z,children:a.accessibilityToggleLabel}),F.jsx("span",{className:ee,children:s?a.accessibilityEnableLabel:a.accessibilityDisableLabel})]})]}),F.jsx("p",{id:"accessibility-toggle-description",className:te,children:s?a.accessibilityEnableDescription||"Все настройки доступности активны. Используйте элементы управления ниже для точной настройки.":a.accessibilityDisableDescription||"Включите режим доступности для активации всех настроек. При выключении все изменения будут сброшены."})]})})},ne="_colorSchemeControl_1kr72_9",oe="_disabled_1kr72_12",se="_title_1kr72_12",ie="_optionsContainer_1kr72_23",le="_option_1kr72_23",ce="_selected_1kr72_50",de="_radioIndicator_1kr72_54",ue="_optionDisabled_1kr72_62",me="_radioInput_1kr72_72",fe="_optionContent_1kr72_79",pe="_optionLabel_1kr72_91",he="_optionDescription_1kr72_98",ye="_highContrastMode_1kr72_129",be=({className:e,translations:t={}})=>{const a={...o,...t},{settings:r,updateSettings:n}=B(),s=r.colorScheme,i=r.isEnabled,l=e=>{const t=e.target.value;n({colorScheme:t})};return F.jsxs("div",{className:`${ne} ${e||""} ${i?"":oe} ${"high-contrast"===s?ye:""}`,children:[F.jsx("h4",{className:se,children:a.colorSchemeTitle}),F.jsxs("div",{className:ie,role:"radiogroup","aria-labelledby":"color-scheme-title",children:[F.jsxs("label",{className:`${le} ${"standard"===s?ce:""} ${i?"":ue}`,children:[F.jsx("input",{type:"radio",name:"colorScheme",value:"standard",checked:"standard"===s,onChange:l,className:me,"aria-describedby":"color-scheme-standard-description",disabled:!i}),F.jsxs("div",{className:fe,children:[F.jsx("span",{className:pe,children:a.colorSchemeStandardLabel}),F.jsx("span",{id:"color-scheme-standard-description",className:he,children:a.colorSchemeStandardDescription})]}),F.jsx("div",{className:de,"aria-hidden":"true"})]},"standard"),F.jsxs("label",{className:`${le} ${"high-contrast"===s?ce:""} ${i?"":ue}`,children:[F.jsx("input",{type:"radio",name:"colorScheme",value:"high-contrast",checked:"high-contrast"===s,onChange:l,className:me,"aria-describedby":"color-scheme-high-contrast-description",disabled:!i}),F.jsxs("div",{className:fe,children:[F.jsx("span",{className:pe,children:a.colorSchemeHighContrastLabel}),F.jsx("span",{id:"color-scheme-high-contrast-description",className:he,children:a.colorSchemeHighContrastDescription})]}),F.jsx("div",{className:de,"aria-hidden":"true"})]},"high-contrast"),F.jsxs("label",{className:`${le} ${"grayscale"===s?ce:""} ${i?"":ue}`,children:[F.jsx("input",{type:"radio",name:"colorScheme",value:"grayscale",checked:"grayscale"===s,onChange:l,className:me,"aria-describedby":"color-scheme-grayscale-description",disabled:!i}),F.jsxs("div",{className:fe,children:[F.jsx("span",{className:pe,children:a.colorSchemeGrayscaleLabel}),F.jsx("span",{id:"color-scheme-grayscale-description",className:he,children:a.colorSchemeGrayscaleDescription})]}),F.jsx("div",{className:de,"aria-hidden":"true"})]},"grayscale")]})]})},_e="_fontSizeControl_1c68l_9",ge="_disabled_1c68l_12",Se="_title_1c68l_12",je="_optionsContainer_1c68l_23",xe="_option_1c68l_23",ve="_selected_1c68l_50",ke="_radioIndicator_1c68l_54",Ne="_optionDisabled_1c68l_62",Ee="_radioInput_1c68l_72",Ce="_optionContent_1c68l_79",we="_optionLabel_1c68l_91",Le="_optionDescription_1c68l_98",Te="_highContrastMode_1c68l_129",Ae=({className:e,translations:t={}})=>{const a={...o,...t},{settings:r,updateSettings:n}=B(),s=r.fontSize,i=r.isEnabled,l=e=>{const t=e.target.value;n({fontSize:t})};return F.jsxs("div",{className:`${_e} ${e||""} ${i?"":ge} ${"high-contrast"===r.colorScheme?Te:""}`,children:[F.jsx("h4",{className:Se,children:a.fontSizeTitle}),F.jsxs("div",{className:je,role:"radiogroup","aria-labelledby":"font-size-title",children:[F.jsxs("label",{className:`${xe} ${"small"===s?ve:""} ${i?"":Ne}`,children:[F.jsx("input",{type:"radio",name:"fontSize",value:"small",checked:"small"===s,onChange:l,className:Ee,"aria-describedby":"font-size-small-description",disabled:!i}),F.jsxs("div",{className:Ce,children:[F.jsx("span",{className:we,children:a.fontSizeSmallLabel}),F.jsx("span",{id:"font-size-small-description",className:Le,children:a.fontSizeSmallDescription})]}),F.jsx("div",{className:ke,"aria-hidden":"true"})]},"small"),F.jsxs("label",{className:`${xe} ${"standard"===s?ve:""} ${i?"":Ne}`,children:[F.jsx("input",{type:"radio",name:"fontSize",value:"standard",checked:"standard"===s,onChange:l,className:Ee,"aria-describedby":"font-size-standard-description",disabled:!i}),F.jsxs("div",{className:Ce,children:[F.jsx("span",{className:we,children:a.fontSizeStandardLabel}),F.jsx("span",{id:"font-size-standard-description",className:Le,children:a.fontSizeStandardDescription})]}),F.jsx("div",{className:ke,"aria-hidden":"true"})]},"standard"),F.jsxs("label",{className:`${xe} ${"large"===s?ve:""} ${i?"":Ne}`,children:[F.jsx("input",{type:"radio",name:"fontSize",value:"large",checked:"large"===s,onChange:l,className:Ee,"aria-describedby":"font-size-large-description",disabled:!i}),F.jsxs("div",{className:Ce,children:[F.jsx("span",{className:we,children:a.fontSizeLargeLabel}),F.jsx("span",{id:"font-size-large-description",className:Le,children:a.fontSizeLargeDescription})]}),F.jsx("div",{className:ke,"aria-hidden":"true"})]},"large")]})]})},$e="_imageControl_hkxkm_9",ze="_disabled_hkxkm_12",Oe="_title_hkxkm_12",De="_switchContainer_hkxkm_23",Ie="_switchLabel_hkxkm_29",Me="_switchDisabled_hkxkm_49",qe="_switchInput_hkxkm_59",Re="_switchSlider_hkxkm_66",He="_switchThumb_hkxkm_72",Pe="_switchText_hkxkm_98",Fe="_description_hkxkm_106",Ge="_highContrastMode_hkxkm_114",Ve=({className:e,translations:t={}})=>{const a={...o,...t},{settings:r,updateSettings:n}=B(),s=r.showImages,i=r.isEnabled;return F.jsxs("div",{className:`${$e} ${e||""} ${i?"":ze} ${"high-contrast"===r.colorScheme?Ge:""}`,children:[F.jsx("h4",{className:Oe,children:a.imageControlTitle}),F.jsxs("div",{className:De,children:[F.jsxs("label",{className:`${Ie} ${i?"":Me}`,children:[F.jsx("input",{type:"checkbox",checked:s,onChange:e=>{n({showImages:e.target.checked})},className:qe,"aria-describedby":"image-control-description",disabled:!i}),F.jsx("span",{className:Re,"aria-hidden":"true",children:F.jsx("span",{className:He})}),F.jsx("span",{className:Pe,children:s?a.imageControlShowLabel:a.imageControlHideLabel})]}),F.jsx("p",{id:"image-control-description",className:Fe,children:s?a.imageControlShowDescription:a.imageControlHideDescription})]})]})},Be="_stickyContainer_1xq4j_9",Ue="_top-right_1xq4j_16",Je="_top-left_1xq4j_20",Ke="_panel_1xq4j_31",Ye="_bottom-right_1xq4j_53",We="_bottom-left_1xq4j_53",Xe="_header_1xq4j_59",Qe="_title_1xq4j_68",Ze="_closeButton_1xq4j_76",et="_description_1xq4j_107",tt="_content_1xq4j_115",at="_controls_1xq4j_135",rt="_highContrastMode_1xq4j_141",nt="_slideIn_1xq4j_1",ot="_grayscaleMode_1xq4j_191",st={stickyContainer:Be,"top-right":"_top-right_1xq4j_16",topRight:Ue,"top-left":"_top-left_1xq4j_20",topLeft:Je,panel:Ke,"bottom-right":"_bottom-right_1xq4j_53",bottomRight:Ye,"bottom-left":"_bottom-left_1xq4j_53",bottomLeft:We,header:Xe,title:Qe,closeButton:Ze,description:et,content:tt,controls:at,highContrastMode:rt,slideIn:nt,grayscaleMode:ot},it=Object.freeze(Object.defineProperty({__proto__:null,bottomLeft:We,bottomRight:Ye,closeButton:Ze,content:tt,controls:at,default:st,description:et,grayscaleMode:ot,header:Xe,highContrastMode:rt,panel:Ke,slideIn:nt,stickyContainer:Be,title:Qe,topLeft:Je,topRight:Ue},Symbol.toStringTag,{value:"Module"})),lt="object"==typeof it&&st?st:st||it,ct=({isOpen:e,onClose:r,position:n="top-right",translations:s={}})=>{const i=t.useRef(null),l={...o,...s},[c,d]=t.useState(null);t.useLayoutEffect(()=>{const e=document.createElement("div");return e.setAttribute("data-accessibility-panel-container","true"),document.documentElement.appendChild(e),d(e),()=>{e.parentNode&&e.parentNode.removeChild(e)}},[]),t.useEffect(()=>{if(!e)return;const t=e=>{i.current&&!i.current.contains(e.target)&&r()},a=setTimeout(()=>{document.addEventListener("mousedown",t)},100);return()=>{clearTimeout(a),document.removeEventListener("mousedown",t)}},[e,r]),t.useEffect(()=>{if(!e)return;const t=e=>{"Escape"===e.key&&r()};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},[e,r]);if(!e||!c)return null;const{settings:u}=B();return a.createPortal(F.jsx("div",{className:y(lt.stickyContainer,lt[n]),children:F.jsxs("div",{ref:i,className:y(lt.panel,"high-contrast"===u.colorScheme&<.highContrastMode,"grayscale"===u.colorScheme&<.grayscaleMode),role:"dialog","aria-modal":"true","aria-labelledby":"accessibility-panel-title","aria-describedby":"accessibility-panel-description",children:[F.jsxs("div",{className:y(lt.header),children:[F.jsx("h3",{id:"accessibility-panel-title",className:y(lt.title),children:l.panelTitle}),F.jsx("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),r()},className:y(lt.closeButton),"aria-label":l.closePanelLabel,type:"button",children:"×"})]}),F.jsx("div",{id:"accessibility-panel-description",className:y(lt.description),children:l.panelDescription}),F.jsxs("div",{className:y(lt.content),children:[F.jsx(re,{translations:l}),F.jsxs("div",{className:y(lt.controls),children:[F.jsx(be,{translations:l}),F.jsx(Ae,{translations:l}),F.jsx(Ve,{translations:l})]})]})]})}),c)};e.AccessibilityPanel=e=>F.jsx(V,{children:F.jsx(ct,{...e})}),e.AccessibilityProvider=V,e.AccessibilityToggle=re,e.CSS_CLASSES=C,e.ColorSchemeControl=be,e.DEFAULT_ACCESSIBILITY_SETTINGS=r,e.FontSizeControl=Ae,e.ImageControl=Ve,e.STORAGE_KEY=n,e.applyAllSettings=z,e.applyClassToElements=(e,t)=>{e.forEach(e=>{e&&e.classList&&e.classList.add(t)})},e.applyColorScheme=w,e.applyDynamicFontSize=k,e.applyFontSize=T,e.applyImageVisibility=A,e.applySettingIfEnabled=(e,t,a)=>{if(e||"imageVisibility"===t)switch(t){case"colorScheme":w(a);break;case"fontSize":T(a);break;case"imageVisibility":A(a);break;default:console.warn(`Неизвестный тип настройки: ${t}`)}},e.clearStorage=l,e.defaultTranslations=o,e.getImageElements=()=>"undefined"==typeof document?[]:document.querySelectorAll('img, picture, svg[role="img"]'),e.getTextElements=d,e.isDOMAvailable=m,e.isFontSizeModified=()=>{if(!m())return!1;const e=d();for(let t=0;t<Math.min(e.length,10);t++)if(e[t].hasAttribute(b))return!0;return!1},e.loadFromStorage=i,e.removeAllAccessibilityStyles=$,e.removeClassFromElements=(e,t)=>{e.forEach(e=>{e&&e.classList&&e.classList.remove(t)})},e.resetAllFontSizes=N,e.safeDOMOperation=u,e.safeLocalStorageOperation=(e,t,a)=>{try{return e()}catch(r){return console.warn(a,r),t}},e.saveToStorage=s,e.updateNewElementsFontSize=E,e.useAccessibilityContext=B,e.useAccessibilitySetting=e=>{const{settings:a,updateSettings:r}=I(),n=t.useCallback(t=>{r({[e]:t})},[e,r]);return[a[e],n]},e.useAccessibilitySettings=I,e.useAccessibilityToggle=()=>{const{settings:e,updateSettings:a}=I(),r=t.useCallback(e=>{a({isEnabled:e})},[a]);return[e.isEnabled,r]},e.validateSettings=c,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
|
16
16
|
//# sourceMappingURL=index.umd.js.map
|