diff --git a/.eslintrc b/.eslintrc index e17cfe0..3f69276 100644 --- a/.eslintrc +++ b/.eslintrc @@ -3,7 +3,8 @@ "plugin:react/recommended", "plugin:@wordpress/eslint-plugin/recommended-with-formatting", "plugin:import/recommended", - "plugin:jsx-a11y/strict" + "plugin:jsx-a11y/strict", + "plugin:prettier/recommended" ], "plugins": [ "babel", @@ -36,8 +37,6 @@ "rules": { "no-console": "off", "react-hooks/exhaustive-deps": "off", - "react/jsx-max-props-per-line": [1, { "maximum": { "single": 2, "multi": 1 } }], - "react/jsx-first-prop-new-line": ["error", "multiline"], "strict": [ "error", "global" ], "curly": "warn", "import/order": [ diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..9da595c --- /dev/null +++ b/.prettierrc @@ -0,0 +1,10 @@ +{ + "useTabs": true, + "printWidth": 80, + "semi": true, + "singleQuote": true, + "endOfLine": "auto", + "arrowParens": "always", + "proseWrap": "always", + "bracketSpacing": true +} diff --git a/classes/module-base.php b/classes/module-base.php index 4633240..bfc4135 100644 --- a/classes/module-base.php +++ b/classes/module-base.php @@ -190,7 +190,7 @@ public function add_route( string $id, $instance ) { * @access public * @return Module[] */ - public function get_components() { + public function get_components(): array { return $this->components; } diff --git a/modules/legacy/module.php b/modules/legacy/module.php index 3b04414..9d38de8 100644 --- a/modules/legacy/module.php +++ b/modules/legacy/module.php @@ -21,7 +21,7 @@ public static function component_list() : array { 'Frontend', 'Customizer', 'Settings', - 'Admin' + 'Admin', ]; } @@ -30,7 +30,7 @@ public function backwards_compatibility() { /** * @var Customizer $customizer */ - $customizer = $this->get_components( 'Customizer' ); + $customizer = $this->get_components()['Customizer']; $customizer_fields = $customizer->get_customizer_fields(); $options = []; $mods = get_theme_mods(); diff --git a/modules/settings/assets/js/admin.js b/modules/settings/assets/js/admin.js index c3b2510..761df35 100644 --- a/modules/settings/assets/js/admin.js +++ b/modules/settings/assets/js/admin.js @@ -3,13 +3,13 @@ import { StrictMode, Fragment, createRoot } from '@wordpress/element'; import App from './app'; import { PluginSettingsProvider } from './contexts/plugin-settings'; -const rootNode = document.getElementById( 'ea11y-app' ); +const rootNode = document.getElementById('ea11y-app'); // Can't use the settings hook in the global scope so accessing directly const isDevelopment = window?.ea11ySettingsData?.isDevelopment; -const AppWrapper = Boolean( isDevelopment ) ? StrictMode : Fragment; +const AppWrapper = Boolean(isDevelopment) ? StrictMode : Fragment; -const root = createRoot( rootNode ); +const root = createRoot(rootNode); root.render( diff --git a/modules/settings/assets/js/api/exceptions/APIError.js b/modules/settings/assets/js/api/exceptions/APIError.js index f13a1f1..2750d97 100644 --- a/modules/settings/assets/js/api/exceptions/APIError.js +++ b/modules/settings/assets/js/api/exceptions/APIError.js @@ -1,6 +1,6 @@ class APIError extends Error { - constructor( message ) { - super( message ); + constructor(message) { + super(message); this.name = 'APIError'; } diff --git a/modules/settings/assets/js/api/index.js b/modules/settings/assets/js/api/index.js index 2648f10..79f675b 100644 --- a/modules/settings/assets/js/api/index.js +++ b/modules/settings/assets/js/api/index.js @@ -6,126 +6,126 @@ const wpV2Prefix = '/wp/v2'; const v1Prefix = '/ea11y/v1'; class API { - static async request( { path, data, method = 'POST' } ) { + static async request({ path, data, method = 'POST' }) { try { - if ( 'GET' === method && ! path.startsWith( wpV2Prefix ) ) { - path = addQueryArgs( path, { sb_time: new Date().getTime() } ); + if ('GET' === method && !path.startsWith(wpV2Prefix)) { + path = addQueryArgs(path, { sb_time: new Date().getTime() }); } - const response = await apiFetch( { + const response = await apiFetch({ path, method, data, - } ); + }); - if ( path.startsWith( wpV2Prefix ) ) { + if (path.startsWith(wpV2Prefix)) { return response; } - if ( ! response.success ) { - throw new APIError( response.data.message ); + if (!response.success) { + throw new APIError(response.data.message); } return response.data; - } catch ( e ) { - if ( e instanceof APIError ) { + } catch (e) { + if (e instanceof APIError) { throw e; } else { - throw new APIError( e.message ); + throw new APIError(e.message); } } } - static async initConnect( context = 'new' ) { + static async initConnect(context = 'new') { const data = { wp_rest: window?.ea11ySettingsData?.wpRestNonce, }; - if ( 'update' === context ) { + if ('update' === context) { data.update_redirect_uri = true; } - return API.request( { + return API.request({ method: 'POST', - path: `${ v1Prefix }/connect/authorize`, + path: `${v1Prefix}/connect/authorize`, data, - } ); + }); } static async clearSession() { - return API.request( { + return API.request({ method: 'POST', - path: `${ v1Prefix }/connect/deactivate_and_disconnect`, + path: `${v1Prefix}/connect/deactivate_and_disconnect`, data: { wp_rest: window?.ea11ySettingsData?.wpRestNonce, clear_session: true, }, - } ); + }); } static async deactivateAndDisconnect() { - return API.request( { + return API.request({ method: 'POST', - path: `${ v1Prefix }/connect/deactivate_and_disconnect`, + path: `${v1Prefix}/connect/deactivate_and_disconnect`, data: { wp_rest: window?.ea11ySettingsData?.wpRestNonce, }, - } ); + }); } static async deactivate() { - return API.request( { + return API.request({ method: 'POST', - path: `${ v1Prefix }/connect/deactivate`, + path: `${v1Prefix}/connect/deactivate`, data: { wp_rest: window?.ea11ySettingsData?.wpRestNonce, }, - } ); + }); } static async disconnect() { - return API.request( { + return API.request({ method: 'POST', - path: `${ v1Prefix }/connect/disconnect`, + path: `${v1Prefix}/connect/disconnect`, data: { wp_rest: window?.ea11ySettingsData?.wpRestNonce, }, - } ); + }); } static async reconnect() { - return API.request( { + return API.request({ method: 'POST', - path: `${ v1Prefix }/connect/reconnect`, + path: `${v1Prefix}/connect/reconnect`, data: { wp_rest: window?.ea11ySettingsData?.wpRestNonce, }, - } ); + }); } static async getSettings() { - return API.request( { + return API.request({ method: 'GET', - path: `${ wpV2Prefix }/settings`, - } ); + path: `${wpV2Prefix}/settings`, + }); } - static async updateSettings( data ) { - return API.request( { + static async updateSettings(data) { + return API.request({ method: 'PUT', - path: `${ wpV2Prefix }/settings`, + path: `${wpV2Prefix}/settings`, data, - } ); + }); } /** * @return {Promise} {} */ static async getPluginSettings() { - return API.request( { + return API.request({ method: 'GET', - path: `${ v1Prefix }/settings/get-settings`, - } ); + path: `${v1Prefix}/settings/get-settings`, + }); } } diff --git a/modules/settings/assets/js/app.js b/modules/settings/assets/js/app.js index 1a10f88..9a6cad7 100644 --- a/modules/settings/assets/js/app.js +++ b/modules/settings/assets/js/app.js @@ -3,30 +3,32 @@ import Box from '@elementor/ui/Box'; import DirectionProvider from '@elementor/ui/DirectionProvider'; import Grid from '@elementor/ui/Grid'; import { ThemeProvider } from '@elementor/ui/styles'; -import { ConnectModal, Notifications, MenuItems, AdminTopBar, BottomBar } from '@ea11y/components'; +import { + ConnectModal, + Notifications, + MenuItems, + AdminTopBar, + BottomBar, +} from '@ea11y/components'; import { useNotificationSettings, useSettings } from '@ea11y/hooks'; import { usePluginSettingsContext } from './contexts/plugin-settings'; import { Sidebar } from './layouts/sidebar'; const App = () => { const { isConnected } = usePluginSettingsContext(); - const { - notificationMessage, - notificationType, - } = useNotificationSettings(); + const { notificationMessage, notificationType } = useNotificationSettings(); const { selectedMenu } = useSettings(); // Accessing the selected menu item - const selectedParent = MenuItems[ selectedMenu.parent ]; - const selectedChild = selectedMenu.child ? selectedParent.children[ selectedMenu.child ] : null; + const selectedParent = MenuItems[selectedMenu.parent]; + const selectedChild = selectedMenu.child + ? selectedParent.children[selectedMenu.child] + : null; return ( - + - { ! isConnected && } - + {!isConnected && } + { justifyContent="space-between" > - - { selectedChild ? selectedChild.page : selectedParent?.page } + + {selectedChild ? selectedChild.page : selectedParent?.page} - + ); diff --git a/modules/settings/assets/js/components/admin-top-bar/index.js b/modules/settings/assets/js/components/admin-top-bar/index.js index ec97e36..ff92671 100644 --- a/modules/settings/assets/js/components/admin-top-bar/index.js +++ b/modules/settings/assets/js/components/admin-top-bar/index.js @@ -11,20 +11,19 @@ export const AdminTopBar = () => { alignItems: 'center', backgroundColor: 'background.default', gap: '10px', - borderBottom: '1px solid rgba(0, 0, 0, 0.12)' }; + borderBottom: '1px solid rgba(0, 0, 0, 0.12)', + }; return ( - + + sx={{ display: 'inline-flex', alignItems: 'center', gap: 1 }} + aria-label={__('Help', 'pojo-accessibility')} + > diff --git a/modules/settings/assets/js/components/alignment-matrix-control/index.js b/modules/settings/assets/js/components/alignment-matrix-control/index.js index 9153498..feecb05 100644 --- a/modules/settings/assets/js/components/alignment-matrix-control/index.js +++ b/modules/settings/assets/js/components/alignment-matrix-control/index.js @@ -9,41 +9,41 @@ import { useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; const AlignmentMatrixControl = () => { - const [ selectedValue, setSelectedValue ] = useState( 'center-right' ); + const [selectedValue, setSelectedValue] = useState('center-right'); - const handleChange = ( event ) => { - setSelectedValue( event.target.value ); + const handleChange = (event) => { + setSelectedValue(event.target.value); }; const options = [ - { value: 'top-left', label: __( 'Top Left', 'pojo-accessibility' ) }, - { value: 'top-right', label: __( 'Top Right', 'pojo-accessibility' ) }, - { value: 'center-left', label: __( 'Center Left', 'pojo-accessibility' ) }, - { value: 'center-right', label: __( 'Center Right', 'pojo-accessibility' ) }, - { value: 'bottom-left', label: __( 'Bottom Left', 'pojo-accessibility' ) }, - { value: 'bottom-right', label: __( 'Bottom Right', 'pojo-accessibility' ) }, + { value: 'top-left', label: __('Top Left', 'pojo-accessibility') }, + { value: 'top-right', label: __('Top Right', 'pojo-accessibility') }, + { value: 'center-left', label: __('Center Left', 'pojo-accessibility') }, + { value: 'center-right', label: __('Center Right', 'pojo-accessibility') }, + { value: 'bottom-left', label: __('Bottom Left', 'pojo-accessibility') }, + { value: 'bottom-right', label: __('Bottom Right', 'pojo-accessibility') }, ]; return ( - - { __( 'Default Position', 'pojo-accessibility' ) } + + {__('Default Position', 'pojo-accessibility')} { borderColor: 'secondary.main', borderRadius: 1, width: '100px', - } } + }} > - { options.map( ( option, i ) => } /> ) } + {options.map((option, i) => ( + } + /> + ))} diff --git a/modules/settings/assets/js/components/bottom-bar/index.js b/modules/settings/assets/js/components/bottom-bar/index.js index 5ecc9ec..95cca68 100644 --- a/modules/settings/assets/js/components/bottom-bar/index.js +++ b/modules/settings/assets/js/components/bottom-bar/index.js @@ -7,11 +7,12 @@ export const BottomBar = () => { + borderTop="1px solid rgba(0, 0, 0, 0.12)" + > ); diff --git a/modules/settings/assets/js/components/color-picker/index.js b/modules/settings/assets/js/components/color-picker/index.js index a3cf6ca..beecd7a 100644 --- a/modules/settings/assets/js/components/color-picker/index.js +++ b/modules/settings/assets/js/components/color-picker/index.js @@ -9,42 +9,39 @@ import { __ } from '@wordpress/i18n'; import './style.css'; const ColorPicker = () => { - const [ color, setColor ] = useState( '#2563eb' ); + const [color, setColor] = useState('#2563eb'); return ( - - { __( 'Color', 'pojo-accessibility' ) } + + {__('Color', 'pojo-accessibility')} - + - + + padding={2} + sx={{ backgroundColor: color }} + borderRadius={1} + marginRight={1} + > + }} + /> diff --git a/modules/settings/assets/js/components/connect-modal/connect-modal-icon.js b/modules/settings/assets/js/components/connect-modal/connect-modal-icon.js index 8bc1367..ce023c7 100644 --- a/modules/settings/assets/js/components/connect-modal/connect-modal-icon.js +++ b/modules/settings/assets/js/components/connect-modal/connect-modal-icon.js @@ -4,201 +4,265 @@ const ConnectModalIcon = () => { return ( - + - - - + strokeLinejoin="round" + /> + + + - - + fill="url(#pattern0_4586_17927)" + /> + + + strokeMiterlimit="10" + /> + strokeLinejoin="round" + /> + strokeLinejoin="round" + /> + strokeLinejoin="round" + /> - + strokeLinejoin="round" + /> + + strokeMiterlimit="10" + /> + strokeLinejoin="round" + /> - + strokeLinejoin="round" + /> + + strokeLinejoin="round" + /> + strokeLinejoin="round" + /> + strokeLinejoin="round" + /> - - + strokeLinejoin="round" + /> + + + strokeMiterlimit="10" + /> - + strokeMiterlimit="10" + /> + + strokeLinecap="round" + /> + strokeLinejoin="round" + /> + strokeLinejoin="round" + /> + strokeLinejoin="round" + /> + strokeLinejoin="round" + /> + strokeLinejoin="round" + /> + strokeLinejoin="round" + /> + strokeLinejoin="round" + /> + strokeLinejoin="round" + /> + strokeLinejoin="round" + /> + fill="white" + /> - + height="1" + > + { y1="62.9463" x2="288.705" y2="69.6428" - gradientUnits="userSpaceOnUse"> + gradientUnits="userSpaceOnUse" + > - + + transform="translate(0.0888672)" + /> + xlinkHref="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAX0AAADpCAYAAADI+eewAAAACXBIWXMAAC4jAAAuIwF4pT92AAAFUklEQVR4Xu3b0WrjVhRAUav0/39ZfSiCy0WyncROZO21oCSO5enAwPbx0c2yrusNgIZ/Hl0AwHWIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AOEiD5AiOgDhIg+QIjoA4SIPkCI6AO32+12W5ZlfXQNn29ZV//OABUmfYhalmWdp3vT/vWZ9IHb7fZ/8Nd1XR5dx2cz6UPYONkLfoPoQ5A1Tte/jy4Armee6k38HSZ9gBDRh7B1XRernhbRh4s7ivp4ZHNb6VjtXJ8jmxBw7zjm/KYg/NfmRi5c3Bh8gcd6BwKOYr+9IWz/7b+aKxF9uLAx6uP+fu/7+SvXZKcPF3K0u392p7+9CZj6r0v04SLmWO9N7M8e0RT967LegQuYb9aOj8evR1O8yHeIPnygLex7u/nt8d5XsN6BD7RN7Huhn6+bf/YMbxLXZdKHD3Q0yY+RHz8FHL2OHtGHDzQerxyDP8d8fuxYJn4jF07uXswfTfjizsxOH07s3pn5e0E/mvCfZf1zXSZ9OKmjUG9vBHtrnb0bvDAy6cMJ3Zvw966bw//odY888//mM7mRCydzL9rLcDZ/vm58TrQ5IvpwEmOwx2iPcd+ee/RJ4KfT/k9fz3mJPpzEM9P5fDJnfgN45s+gTfThpMZpe479/L0buDzLjVz4I0f793urmznur7x5O/Op4Zoc2YQ/8uxkPu/09z4BwLOsd+Bk5un96KYufIfowx/YW8+M+/nxOqHnlUQffsm8phmfm49i3rsWfkL04Y32pvR70/tR4IWfV3EjF95oL9ZHN2OPbuxa7/BKJn14o6OTN3uBF3d+g+jDG+3t7r9y5NJah1cTfXiDo739/LPtBu78/dH18FN+IxdeaDt9853nzxh4nzSuR/Thl8zHMY9u3P4lkb8+p3fgjb563v7dbwTP/B24NpM+vNjeRL/9/Og1r4q9qPOI6MMPjXv6MfhzyOf4fyf0os5PiT68yRz8vcd7nwjgnUQfXmxvehd0zkL04YtM5nwy0QcI8Ru5ACGiDxAi+gAhog8QIvoAIaIPECL6ACGiDxAi+gAhog8QIvoAIaIPECL6ACGiDxAi+gAhog8QIvoAIaIPECL6ACGiDxAi+gAhog8QIvoAIaIPECL6ACGiDxAi+gAhog8QIvoAIaIPECL6ACGiDxAi+gAhog8QIvoAIaIPECL6ACGiDxAi+gAhog8QIvoAIaIPECL6ACGiDxAi+gAhog8QIvoAIaIPECL6ACGiDxAi+gAhog8QIvoAIaIPECL6ACGiDxAi+gAhog8QIvoAIaIPECL6ACGiDxDyH3IoUtUNxiZ6AAAAAElFTkSuQmCC" + /> ); diff --git a/modules/settings/assets/js/components/connect-modal/index.js b/modules/settings/assets/js/components/connect-modal/index.js index 51ea0df..eb9befd 100644 --- a/modules/settings/assets/js/components/connect-modal/index.js +++ b/modules/settings/assets/js/components/connect-modal/index.js @@ -11,14 +11,14 @@ function ConnectModal() { const { redirectToConnect } = useAuth(); return ( - + - - - { __( 'Connect plugin on your site!', 'pojo-accessibility' ) } + }} + > + + + {__('Connect plugin on your site!', 'pojo-accessibility')} diff --git a/modules/settings/assets/js/components/icon-select/index.js b/modules/settings/assets/js/components/icon-select/index.js index e85c88f..bf8db60 100644 --- a/modules/settings/assets/js/components/icon-select/index.js +++ b/modules/settings/assets/js/components/icon-select/index.js @@ -4,55 +4,69 @@ import Paper from '@elementor/ui/Paper'; import Radio from '@elementor/ui/Radio'; import RadioGroup from '@elementor/ui/RadioGroup'; import Typography from '@elementor/ui/Typography'; -import { AccessibilityControlsIcon, AccessibilityEyeIcon, AccessibilityPersonIcon, AccessibilityTextIcon } from '@ea11y/icons'; +import { + AccessibilityControlsIcon, + AccessibilityEyeIcon, + AccessibilityPersonIcon, + AccessibilityTextIcon, +} from '@ea11y/icons'; import { useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; -const IconSelect = ( props ) => { - const [ selectedValue, setSelectedValue ] = useState( 'person' ); +const IconSelect = (props) => { + const [selectedValue, setSelectedValue] = useState('person'); const optionStyle = { - color: 'info.main', fontSize: 44, + color: 'info.main', + fontSize: 44, }; const options = [ { - value: 'person', icon: , label: __( 'Accessibility Person Icon', 'pojo-accessibility' ), + value: 'person', + icon: , + label: __('Accessibility Person Icon', 'pojo-accessibility'), }, { - value: 'eye', icon: , label: __( 'Accessibility Eye Icon', 'pojo-accessibility' ), + value: 'eye', + icon: , + label: __('Accessibility Eye Icon', 'pojo-accessibility'), }, { - value: 'text', icon: , label: __( 'Accessibility Text Badge Icon', 'pojo-accessibility' ), + value: 'text', + icon: , + label: __('Accessibility Text Badge Icon', 'pojo-accessibility'), }, { - value: 'controls', icon: , label: __( 'Accessibility Controls Slider Icon', 'pojo-accessibility' ), + value: 'controls', + icon: , + label: __('Accessibility Controls Slider Icon', 'pojo-accessibility'), }, ]; return ( - - { __( 'Icon', 'pojo-accessibility' ) } + + {__('Icon', 'pojo-accessibility')} - { options.map( ( option ) => ( + {options.map((option) => ( setSelectedValue( option.value ) } - sx={ { + onClick={() => setSelectedValue(option.value)} + sx={{ borderRadius: 'md', boxShadow: 'sm', display: 'flex', @@ -64,18 +78,22 @@ const IconSelect = ( props ) => { p: 2, minWidth: 100, minHeight: 100, - borderColor: selectedValue === option.value ? 'info.main' : 'divider', + borderColor: + selectedValue === option.value ? 'info.main' : 'divider', borderWidth: selectedValue === option.value ? 2 : 1, cursor: 'pointer', - } } - >{ option.icon } + }} + > + {option.icon} + value={option.value} + sx={{ + opacity: 0, + position: 'absolute', + }} + /> - ) ) } + ))} ); diff --git a/modules/settings/assets/js/components/icon-size/index.js b/modules/settings/assets/js/components/icon-size/index.js index 7f041a8..b509684 100644 --- a/modules/settings/assets/js/components/icon-size/index.js +++ b/modules/settings/assets/js/components/icon-size/index.js @@ -4,44 +4,60 @@ import Paper from '@elementor/ui/Paper'; import Radio from '@elementor/ui/Radio'; import RadioGroup from '@elementor/ui/RadioGroup'; import Typography from '@elementor/ui/Typography'; -import { AccessibilityEyeIcon, AccessibilityPersonIcon, AccessibilityTextIcon } from '@ea11y/icons'; +import { + AccessibilityEyeIcon, + AccessibilityPersonIcon, + AccessibilityTextIcon, +} from '@ea11y/icons'; import { useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; -const IconSize = ( props ) => { - const [ selectedValue, setSelectedValue ] = useState( 'medium' ); +const IconSize = (props) => { + const [selectedValue, setSelectedValue] = useState('medium'); const optionStyle = { color: 'info.main', fontSize: 44 }; const options = [ - { value: 'small', icon: , label: __( 'Accessibility Person Icon', 'pojo-accessibility' ) }, - { value: 'medium', icon: , label: __( 'Accessibility Eye Icon', 'pojo-accessibility' ) }, - { value: 'large', icon: , label: __( 'Accessibility Text Badge Icon', 'pojo-accessibility' ) }, + { + value: 'small', + icon: , + label: __('Accessibility Person Icon', 'pojo-accessibility'), + }, + { + value: 'medium', + icon: , + label: __('Accessibility Eye Icon', 'pojo-accessibility'), + }, + { + value: 'large', + icon: , + label: __('Accessibility Text Badge Icon', 'pojo-accessibility'), + }, ]; return ( - - { __( 'Size', 'pojo-accessibility' ) } + + {__('Size', 'pojo-accessibility')} - { options.map( ( option ) => ( + {options.map((option) => ( setSelectedValue( option.value ) } - sx={ { + onClick={() => setSelectedValue(option.value)} + sx={{ borderRadius: 'md', boxShadow: 'sm', display: 'flex', @@ -53,14 +69,19 @@ const IconSize = ( props ) => { p: 2, minWidth: 100, minHeight: 100, - borderColor: selectedValue === option.value ? 'info.main' : 'divider', + borderColor: + selectedValue === option.value ? 'info.main' : 'divider', borderWidth: selectedValue === option.value ? 2 : 1, cursor: 'pointer', - } } - >{ option.icon } - + }} + > + {option.icon} + - ) ) } + ))} ); diff --git a/modules/settings/assets/js/components/my-account-menu/index.js b/modules/settings/assets/js/components/my-account-menu/index.js index d35b0a1..0995398 100644 --- a/modules/settings/assets/js/components/my-account-menu/index.js +++ b/modules/settings/assets/js/components/my-account-menu/index.js @@ -8,65 +8,80 @@ import ListItemText from '@elementor/ui/ListItemText'; import Menu from '@elementor/ui/Menu'; import MenuItem from '@elementor/ui/MenuItem'; import Typography from '@elementor/ui/Typography'; -import { bindMenu, bindTrigger, usePopupState } from '@elementor/ui/usePopupState'; -import { useSettings } from '@ea11y/hooks'; import { - CreditCardIcon, - UserArrowIcon, -} from '@ea11y/icons'; + bindMenu, + bindTrigger, + usePopupState, +} from '@elementor/ui/usePopupState'; +import { useSettings } from '@ea11y/hooks'; +import { CreditCardIcon, UserArrowIcon } from '@ea11y/icons'; import { __ } from '@wordpress/i18n'; const MyAccountMenu = () => { const { openSidebar } = useSettings(); - const accountMenuState = usePopupState( { variant: 'popover', popupId: 'myAccountMenu' } ); + const accountMenuState = usePopupState({ + variant: 'popover', + popupId: 'myAccountMenu', + }); return ( <> - + - + - - + JB - - Jack Baueuer - jack@bauer.com + + + Jack Baueuer + + + jack@bauer.com + - - - - { __( 'Switch account', 'pojo-accessibility' ) } + + + + {__('Switch account', 'pojo-accessibility')} - - - - { __( 'Billing', 'pojo-accessibility' ) } + + + + {__('Billing', 'pojo-accessibility')} diff --git a/modules/settings/assets/js/components/notifications/index.js b/modules/settings/assets/js/components/notifications/index.js index 28a6024..66cc545 100644 --- a/modules/settings/assets/js/components/notifications/index.js +++ b/modules/settings/assets/js/components/notifications/index.js @@ -2,7 +2,7 @@ import Alert from '@elementor/ui/Alert'; import Snackbar from '@elementor/ui/Snackbar'; import { useNotificationSettings } from '@ea11y/hooks'; -const Notifications = ( { type, message } ) => { +const Notifications = ({ type, message }) => { const { showNotification, setShowNotification, @@ -11,24 +11,25 @@ const Notifications = ( { type, message } ) => { } = useNotificationSettings(); const closeNotification = () => { - setShowNotification( ! showNotification ); - setNotificationMessage( '' ); - setNotificationType( '' ); + setShowNotification(!showNotification); + setNotificationMessage(''); + setNotificationType(''); }; return ( setShowNotification( ! showNotification ) } - severity={ type } - variant="filled" > - { message } + onClose={() => setShowNotification(!showNotification)} + severity={type} + variant="filled" + > + {message} ); diff --git a/modules/settings/assets/js/components/position-control/index.js b/modules/settings/assets/js/components/position-control/index.js index fcba18b..eab814a 100644 --- a/modules/settings/assets/js/components/position-control/index.js +++ b/modules/settings/assets/js/components/position-control/index.js @@ -6,24 +6,28 @@ import MenuItem from '@elementor/ui/MenuItem'; import Select from '@elementor/ui/Select'; import TextField from '@elementor/ui/TextField'; import { styled } from '@elementor/ui/styles'; -import { usePopupState, bindTrigger, bindMenu } from '@elementor/ui/usePopupState'; +import { + usePopupState, + bindTrigger, + bindMenu, +} from '@elementor/ui/usePopupState'; import { useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; -const units = [ 'PX', 'REM', 'EM' ]; +const units = ['PX', 'REM', 'EM']; const horizontalOptions = [ - { value: 'to-left', label: __( 'To the left', 'pojo-accessibility' ) }, - { value: 'to-right', label: __( 'To the right', 'pojo-accessibility' ) }, + { value: 'to-left', label: __('To the left', 'pojo-accessibility') }, + { value: 'to-right', label: __('To the right', 'pojo-accessibility') }, ]; const verticalOptions = [ - { value: 'higher', label: __( 'Higher', 'pojo-accessibility' ) }, - { value: 'lower', label: __( 'Lower', 'pojo-accessibility' ) }, + { value: 'higher', label: __('Higher', 'pojo-accessibility') }, + { value: 'lower', label: __('Lower', 'pojo-accessibility') }, ]; // Customization for the WP admin global CSS. -const StyledTextField = styled( TextField )( () => ( { +const StyledTextField = styled(TextField)(() => ({ width: '200px', '.wp-admin & .MuiInputBase-input, & .MuiInputBase-input:focus': { backgroundColor: 'initial', @@ -37,64 +41,68 @@ const StyledTextField = styled( TextField )( () => ( { }, height: '56px', }, -} ) ); +})); -const PositionControl = ( { type, disabled }, props ) => { - const [ unitsIndex, setUnitsIndex ] = useState( 0 ); - const popupState = usePopupState( { +const PositionControl = ({ type, disabled }, props) => { + const [unitsIndex, setUnitsIndex] = useState(0); + const popupState = usePopupState({ variant: 'popover', popupId: 'textfield-inner-selection', - } ); + }); - const handleMenuItemClick = ( index ) => { - setUnitsIndex( index ); + const handleMenuItemClick = (index) => { + setUnitsIndex(index); popupState.close(); }; - const [ position, setPosition ] = useState( 10 ); - const handlePositionChange = ( event ) => setPosition( event.target.value ); + const [position, setPosition] = useState(10); + const handlePositionChange = (event) => setPosition(event.target.value); return ( - + - - { units.map( ( unit, index ) => ( - handleMenuItemClick( index ) }> - { unit } + + {units.map((unit, index) => ( + handleMenuItemClick(index)} + > + {unit} - ) ) } + ))} ), - } } + }} /> ); diff --git a/modules/settings/assets/js/components/sidebar-app-bar/index.js b/modules/settings/assets/js/components/sidebar-app-bar/index.js index b8ce254..fa44c5c 100644 --- a/modules/settings/assets/js/components/sidebar-app-bar/index.js +++ b/modules/settings/assets/js/components/sidebar-app-bar/index.js @@ -10,26 +10,30 @@ import { __ } from '@wordpress/i18n'; const SidebarAppBar = () => { const { openSidebar, setOpenSidebar } = useSettings(); - return ( - - - - - { __( 'Accessibility', 'pojo-accessibility' ) } - - - setOpenSidebar( ! openSidebar ) }> - - - - ); + return ( + + + + + + {__('Accessibility', 'pojo-accessibility')} + + + setOpenSidebar(!openSidebar)} + > + + + + + ); }; export default SidebarAppBar; diff --git a/modules/settings/assets/js/components/sidebar-menu/index.js b/modules/settings/assets/js/components/sidebar-menu/index.js index a2d1129..1e226d1 100644 --- a/modules/settings/assets/js/components/sidebar-menu/index.js +++ b/modules/settings/assets/js/components/sidebar-menu/index.js @@ -10,61 +10,70 @@ import { MenuItems } from './menu'; const SidebarMenu = () => { const { openSidebar, selectedMenu, setSelectedMenu } = useSettings(); - const [ expandedItems, setExpandedItems ] = useState( { widget: true } ); + const [expandedItems, setExpandedItems] = useState({ widget: true }); - const handleSelectedMenu = ( parentKey, childKey ) => { - if ( childKey ) { - setSelectedMenu( { parent: parentKey, child: childKey } ); + const handleSelectedMenu = (parentKey, childKey) => { + if (childKey) { + setSelectedMenu({ parent: parentKey, child: childKey }); } else { - setSelectedMenu( { parent: parentKey, child: null } ); + setSelectedMenu({ parent: parentKey, child: null }); } }; - const handleToggleItem = ( itemName ) => { - setExpandedItems( ( prev ) => ( { + const handleToggleItem = (itemName) => { + setExpandedItems((prev) => ({ ...prev, - [ itemName ]: ! prev[ itemName ], // Toggle the expanded state for the clicked item - } ) ); + [itemName]: !prev[itemName], // Toggle the expanded state for the clicked item + })); }; - return ( - { Object.entries( MenuItems ).map( ( [ key, item ] ) => ( - <> - - item.children ? handleToggleItem( key ) : handleSelectedMenu( key ) } - sx={ { justifyContent: 'center' } } - selected={ key === selectedMenu.parent && ( ! selectedMenu.child || ! openSidebar ) } - > - { item.icon } - - - { item.children && expandedItems[ key ] && ( - - { Object.entries( item.children ).map( ( [ childKey, child ] ) => ( - - ) ) } - - ) } - - ) ) } - ); + return ( + + {Object.entries(MenuItems).map(([key, item]) => ( + <> + + + item.children ? handleToggleItem(key) : handleSelectedMenu(key) + } + sx={{ justifyContent: 'center' }} + selected={ + key === selectedMenu.parent && + (!selectedMenu.child || !openSidebar) + } + > + {item.icon} + + + {item.children && expandedItems[key] && ( + + {Object.entries(item.children).map(([childKey, child]) => ( + + ))} + + )} + + ))} + + ); }; export default SidebarMenu; diff --git a/modules/settings/assets/js/components/sidebar-menu/menu.js b/modules/settings/assets/js/components/sidebar-menu/menu.js index 9f82b18..9f46c05 100644 --- a/modules/settings/assets/js/components/sidebar-menu/menu.js +++ b/modules/settings/assets/js/components/sidebar-menu/menu.js @@ -5,24 +5,24 @@ import { AccessibilityStatement, Menu, IconSettings } from '../../pages'; export const MenuItems = { widget: { - name: __( 'Widget', 'pojo-accessibility' ), + name: __('Widget', 'pojo-accessibility'), key: 'widget', icon: , children: { iconSettings: { - name: __( 'Icon Settings', 'pojo-accessibility' ), + name: __('Icon Settings', 'pojo-accessibility'), key: 'icon-settings', page: , }, menu: { - name: __( 'Menu', 'pojo-accessibility' ), + name: __('Menu', 'pojo-accessibility'), key: 'menu', page: , }, }, }, accessibilityStatement: { - name: __( 'Accessibility Statement', 'pojo-accessibility' ), + name: __('Accessibility Statement', 'pojo-accessibility'), key: 'accessibility-statement', page: , icon: , diff --git a/modules/settings/assets/js/contexts/plugin-settings-context.js b/modules/settings/assets/js/contexts/plugin-settings-context.js index 54d028f..60cabe0 100644 --- a/modules/settings/assets/js/contexts/plugin-settings-context.js +++ b/modules/settings/assets/js/contexts/plugin-settings-context.js @@ -1,40 +1,50 @@ -import { createContext, useCallback, useContext, useEffect, useState } from '@wordpress/element'; +import { + createContext, + useCallback, + useContext, + useEffect, + useState, +} from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import API from '../api'; import { useToastNotification } from '../hooks'; -const PluginSettingsContext = createContext( {} ); +const PluginSettingsContext = createContext({}); -export const PluginSettingsProvider = ( { children } ) => { +export const PluginSettingsProvider = ({ children }) => { const { error } = useToastNotification(); - const [ pluginSettings, setPluginSettings ] = useState(); - const [ loaded, setLoaded ] = useState( false ); + const [pluginSettings, setPluginSettings] = useState(); + const [loaded, setLoaded] = useState(false); - const refreshPluginSettings = useCallback( () => { - API.getPluginSettings().then( ( settings ) => { - if ( 'isConnected' in settings ) { - settings.isConnected = Boolean( settings.isConnected ); - } + const refreshPluginSettings = useCallback(() => { + API.getPluginSettings() + .then((settings) => { + if ('isConnected' in settings) { + settings.isConnected = Boolean(settings.isConnected); + } - setPluginSettings( settings ); - setLoaded( true ); - } ).catch( () => { - error( __( 'An error occurred.', 'pojo-accessibility' ) ); - setLoaded( true ); - } ); - }, [] ); + setPluginSettings(settings); + setLoaded(true); + }) + .catch(() => { + error(__('An error occurred.', 'pojo-accessibility')); + setLoaded(true); + }); + }, []); - useEffect( () => { + useEffect(() => { refreshPluginSettings(); - }, [ refreshPluginSettings ] ); + }, [refreshPluginSettings]); return ( - - { children } + + {children} ); }; export const usePluginSettingsContext = () => { - return useContext( PluginSettingsContext ); + return useContext(PluginSettingsContext); }; diff --git a/modules/settings/assets/js/contexts/plugin-settings.js b/modules/settings/assets/js/contexts/plugin-settings.js index 54d028f..60cabe0 100644 --- a/modules/settings/assets/js/contexts/plugin-settings.js +++ b/modules/settings/assets/js/contexts/plugin-settings.js @@ -1,40 +1,50 @@ -import { createContext, useCallback, useContext, useEffect, useState } from '@wordpress/element'; +import { + createContext, + useCallback, + useContext, + useEffect, + useState, +} from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import API from '../api'; import { useToastNotification } from '../hooks'; -const PluginSettingsContext = createContext( {} ); +const PluginSettingsContext = createContext({}); -export const PluginSettingsProvider = ( { children } ) => { +export const PluginSettingsProvider = ({ children }) => { const { error } = useToastNotification(); - const [ pluginSettings, setPluginSettings ] = useState(); - const [ loaded, setLoaded ] = useState( false ); + const [pluginSettings, setPluginSettings] = useState(); + const [loaded, setLoaded] = useState(false); - const refreshPluginSettings = useCallback( () => { - API.getPluginSettings().then( ( settings ) => { - if ( 'isConnected' in settings ) { - settings.isConnected = Boolean( settings.isConnected ); - } + const refreshPluginSettings = useCallback(() => { + API.getPluginSettings() + .then((settings) => { + if ('isConnected' in settings) { + settings.isConnected = Boolean(settings.isConnected); + } - setPluginSettings( settings ); - setLoaded( true ); - } ).catch( () => { - error( __( 'An error occurred.', 'pojo-accessibility' ) ); - setLoaded( true ); - } ); - }, [] ); + setPluginSettings(settings); + setLoaded(true); + }) + .catch(() => { + error(__('An error occurred.', 'pojo-accessibility')); + setLoaded(true); + }); + }, []); - useEffect( () => { + useEffect(() => { refreshPluginSettings(); - }, [ refreshPluginSettings ] ); + }, [refreshPluginSettings]); return ( - - { children } + + {children} ); }; export const usePluginSettingsContext = () => { - return useContext( PluginSettingsContext ); + return useContext(PluginSettingsContext); }; diff --git a/modules/settings/assets/js/hooks/use-auth.js b/modules/settings/assets/js/hooks/use-auth.js index 791ec33..174568e 100644 --- a/modules/settings/assets/js/hooks/use-auth.js +++ b/modules/settings/assets/js/hooks/use-auth.js @@ -7,7 +7,7 @@ export const useAuth = () => { const redirectToConnect = async () => { const link = await getConnectLink(); - window.open( link, '_self' ).focus(); + window.open(link, '_self').focus(); }; const getConnectLink = async () => { @@ -15,9 +15,9 @@ export const useAuth = () => { }; const getUpgradeLink = () => { - const url = new URL( UPGRADE_LINK ); + const url = new URL(UPGRADE_LINK); - url.searchParams.append( 'subscription_id', subscriptionId ); + url.searchParams.append('subscription_id', subscriptionId); return url.toString(); }; diff --git a/modules/settings/assets/js/hooks/use-modal.js b/modules/settings/assets/js/hooks/use-modal.js index 19aaaaf..e43b966 100644 --- a/modules/settings/assets/js/hooks/use-modal.js +++ b/modules/settings/assets/js/hooks/use-modal.js @@ -1,14 +1,14 @@ import { useState } from '@wordpress/element'; -export const useModal = ( defaultIsOpen = true ) => { - const [ isOpen, setIsOpen ] = useState( defaultIsOpen ); +export const useModal = (defaultIsOpen = true) => { + const [isOpen, setIsOpen] = useState(defaultIsOpen); const open = () => { - setIsOpen( true ); + setIsOpen(true); }; const close = () => { - setIsOpen( false ); + setIsOpen(false); }; return { diff --git a/modules/settings/assets/js/hooks/use-notifications.js b/modules/settings/assets/js/hooks/use-notifications.js index 0ea7558..97471ec 100644 --- a/modules/settings/assets/js/hooks/use-notifications.js +++ b/modules/settings/assets/js/hooks/use-notifications.js @@ -1,49 +1,46 @@ import { useState, createContext, useContext } from '@wordpress/element'; -const NotificationsContext = createContext( undefined ); +const NotificationsContext = createContext(undefined); export function useNotificationSettings() { - return useContext( NotificationsContext ); + return useContext(NotificationsContext); } -export const NotificationsProvider = ( { children } ) => { - const [ showNotification, setShowNotification ] = useState( false ); - const [ notificationMessage, setNotificationMessage ] = useState( '' ); - const [ notificationType, setNotificationType ] = useState( '' ); +export const NotificationsProvider = ({ children }) => { + const [showNotification, setShowNotification] = useState(false); + const [notificationMessage, setNotificationMessage] = useState(''); + const [notificationType, setNotificationType] = useState(''); return ( - { children } + {children} ); }; export const useToastNotification = () => { - const { - setNotificationMessage, - setNotificationType, - setShowNotification, - } = useContext( NotificationsContext ); - - const error = ( message ) => { - setNotificationMessage( message ); - setNotificationType( 'error' ); - setShowNotification( true ); + const { setNotificationMessage, setNotificationType, setShowNotification } = + useContext(NotificationsContext); + + const error = (message) => { + setNotificationMessage(message); + setNotificationType('error'); + setShowNotification(true); }; - const success = ( message ) => { - setNotificationMessage( message ); - setNotificationType( 'success' ); - setShowNotification( true ); + const success = (message) => { + setNotificationMessage(message); + setNotificationType('success'); + setShowNotification(true); }; return { diff --git a/modules/settings/assets/js/hooks/use-settings.js b/modules/settings/assets/js/hooks/use-settings.js index 7c58be8..700ca92 100644 --- a/modules/settings/assets/js/hooks/use-settings.js +++ b/modules/settings/assets/js/hooks/use-settings.js @@ -3,25 +3,28 @@ import { useState, createContext, useContext } from '@wordpress/element'; /** * Context Component. */ -const SettingsContext = createContext( null ); +const SettingsContext = createContext(null); export function useSettings() { - return useContext( SettingsContext ); + return useContext(SettingsContext); } -export const SettingsProvider = ( { children } ) => { - const [ openSidebar, setOpenSidebar ] = useState( true ); - const [ selectedMenu, setSelectedMenu ] = useState( { parent: 'widget', child: 'iconSettings' } ); +export const SettingsProvider = ({ children }) => { + const [openSidebar, setOpenSidebar] = useState(true); + const [selectedMenu, setSelectedMenu] = useState({ + parent: 'widget', + child: 'iconSettings', + }); return ( - { children } + {children} ); }; diff --git a/modules/settings/assets/js/hooks/use-storage.js b/modules/settings/assets/js/hooks/use-storage.js index 2377512..814a0ba 100644 --- a/modules/settings/assets/js/hooks/use-storage.js +++ b/modules/settings/assets/js/hooks/use-storage.js @@ -2,8 +2,8 @@ import { store as coreDataStore } from '@wordpress/core-data'; import { dispatch } from '@wordpress/data'; export const useStorage = () => { - const save = async ( data ) => { - return await dispatch( coreDataStore ).saveEntityRecord( 'root', 'site', data ); + const save = async (data) => { + return await dispatch(coreDataStore).saveEntityRecord('root', 'site', data); }; return { diff --git a/modules/settings/assets/js/icons/accessibility-controls.js b/modules/settings/assets/js/icons/accessibility-controls.js index 6aa3b14..fbcbefd 100644 --- a/modules/settings/assets/js/icons/accessibility-controls.js +++ b/modules/settings/assets/js/icons/accessibility-controls.js @@ -1,25 +1,22 @@ import SvgIcon from '@elementor/ui/SvgIcon'; -function AccessibilityControlsIcon( props ) { +function AccessibilityControlsIcon(props) { return ( - + - + strokeLinejoin="round" + /> ); } diff --git a/modules/settings/assets/js/icons/accessibility-eye.js b/modules/settings/assets/js/icons/accessibility-eye.js index cdeda1f..9c1d63b 100644 --- a/modules/settings/assets/js/icons/accessibility-eye.js +++ b/modules/settings/assets/js/icons/accessibility-eye.js @@ -1,25 +1,23 @@ import SvgIcon from '@elementor/ui/SvgIcon'; -function AccessibilityEyeIcon( props ) { +function AccessibilityEyeIcon(props) { return ( - + + strokeLinejoin="round" + /> @@ -27,7 +25,8 @@ function AccessibilityEyeIcon( props ) { width="48" height="48" fill="white" - transform="translate(8 8)" /> + transform="translate(8 8)" + /> diff --git a/modules/settings/assets/js/icons/accessibility-person.js b/modules/settings/assets/js/icons/accessibility-person.js index 051c77e..71f5ab1 100644 --- a/modules/settings/assets/js/icons/accessibility-person.js +++ b/modules/settings/assets/js/icons/accessibility-person.js @@ -1,25 +1,26 @@ import SvgIcon from '@elementor/ui/SvgIcon'; -function AccessibilityPersonIcon( props ) { +function AccessibilityPersonIcon(props) { return ( - - + + + strokeLinejoin="round" + /> ); } diff --git a/modules/settings/assets/js/icons/accessibility-text.js b/modules/settings/assets/js/icons/accessibility-text.js index 57f075e..88c81a1 100644 --- a/modules/settings/assets/js/icons/accessibility-text.js +++ b/modules/settings/assets/js/icons/accessibility-text.js @@ -1,13 +1,13 @@ import SvgIcon from '@elementor/ui/SvgIcon'; -function AccessibilityTextIcon( props ) { +function AccessibilityTextIcon(props) { return ( - + strokeOpacity="0.12" + /> + - + strokeWidth="3" + /> + ); } diff --git a/modules/settings/assets/js/icons/credit-card.js b/modules/settings/assets/js/icons/credit-card.js index af62533..bbb52b8 100644 --- a/modules/settings/assets/js/icons/credit-card.js +++ b/modules/settings/assets/js/icons/credit-card.js @@ -1,16 +1,13 @@ import SvgIcon from '@elementor/ui/SvgIcon'; -const CreditCardIcon = ( props, { size } ) => { +const CreditCardIcon = (props, { size }) => { return ( - + - + d="M5 4.79163C3.96447 4.79163 3.125 5.63109 3.125 6.66663V7.70829H16.875V6.66663C16.875 5.63109 16.0355 4.79163 15 4.79163H5ZM18.125 6.66663C18.125 4.94074 16.7259 3.54163 15 3.54163H5C3.27411 3.54163 1.875 4.94074 1.875 6.66663V13.3333C1.875 15.0592 3.27411 16.4583 5 16.4583H15C16.7259 16.4583 18.125 15.0592 18.125 13.3333V6.66663ZM16.875 8.95829H3.125V13.3333C3.125 14.3688 3.96447 15.2083 5 15.2083H15C16.0355 15.2083 16.875 14.3688 16.875 13.3333V8.95829ZM5.20833 12.5C5.20833 12.1548 5.48816 11.875 5.83333 11.875H5.84167C6.18684 11.875 6.46667 12.1548 6.46667 12.5C6.46667 12.8451 6.18684 13.125 5.84167 13.125H5.83333C5.48816 13.125 5.20833 12.8451 5.20833 12.5ZM8.54167 12.5C8.54167 12.1548 8.82149 11.875 9.16667 11.875H10.8333C11.1785 11.875 11.4583 12.1548 11.4583 12.5C11.4583 12.8451 11.1785 13.125 10.8333 13.125H9.16667C8.82149 13.125 8.54167 12.8451 8.54167 12.5Z" + /> ); }; diff --git a/modules/settings/assets/js/icons/elementor-logo.js b/modules/settings/assets/js/icons/elementor-logo.js index 5f3ad30..4afefe6 100644 --- a/modules/settings/assets/js/icons/elementor-logo.js +++ b/modules/settings/assets/js/icons/elementor-logo.js @@ -1,14 +1,15 @@ import SvgIcon from '@elementor/ui/SvgIcon'; -const ElementorLogo = ( { size } ) => { +const ElementorLogo = ({ size }) => { return ( - + + clipRule="evenodd" + /> diff --git a/modules/settings/assets/js/icons/square-rounded-chevrons-left.js b/modules/settings/assets/js/icons/square-rounded-chevrons-left.js index a753c86..4757bac 100644 --- a/modules/settings/assets/js/icons/square-rounded-chevrons-left.js +++ b/modules/settings/assets/js/icons/square-rounded-chevrons-left.js @@ -1,16 +1,18 @@ import SvgIcon from '@elementor/ui/SvgIcon'; -const SquareRoundedChevronsLeft = ( props, { size } ) => { +const SquareRoundedChevronsLeft = (props, { size }) => { return ( + fontSize={size} + sx={{ ...props.sx }} + {...props} + > + d="M5.33033 5.33033C4.21884 6.44182 3.75 8.39464 3.75 12C3.75 15.6054 4.21884 17.5582 5.33033 18.6697C6.44182 19.7812 8.39464 20.25 12 20.25C15.6054 20.25 17.5582 19.7812 18.6697 18.6697C19.7812 17.5582 20.25 15.6054 20.25 12C20.25 8.39464 19.7812 6.44182 18.6697 5.33033C17.5582 4.21884 15.6054 3.75 12 3.75C8.39464 3.75 6.44182 4.21884 5.33033 5.33033ZM4.26967 4.26967C5.85818 2.68116 8.40536 2.25 12 2.25C15.5946 2.25 18.1418 2.68116 19.7303 4.26967C21.3188 5.85818 21.75 8.40536 21.75 12C21.75 15.5946 21.3188 18.1418 19.7303 19.7303C18.1418 21.3188 15.5946 21.75 12 21.75C8.40536 21.75 5.85818 21.3188 4.26967 19.7303C2.68116 18.1418 2.25 15.5946 2.25 12C2.25 8.40536 2.68116 5.85818 4.26967 4.26967ZM11.5303 8.46967C11.8232 8.76256 11.8232 9.23744 11.5303 9.53033L9.06066 12L11.5303 14.4697C11.8232 14.7626 11.8232 15.2374 11.5303 15.5303C11.2374 15.8232 10.7626 15.8232 10.4697 15.5303L7.46967 12.5303C7.17678 12.2374 7.17678 11.7626 7.46967 11.4697L10.4697 8.46967C10.7626 8.17678 11.2374 8.17678 11.5303 8.46967ZM15.5303 8.46967C15.8232 8.76256 15.8232 9.23744 15.5303 9.53033L13.0607 12L15.5303 14.4697C15.8232 14.7626 15.8232 15.2374 15.5303 15.5303C15.2374 15.8232 14.7626 15.8232 14.4697 15.5303L11.4697 12.5303C11.1768 12.2374 11.1768 11.7626 11.4697 11.4697L14.4697 8.46967C14.7626 8.17678 15.2374 8.17678 15.5303 8.46967Z" + /> ); }; diff --git a/modules/settings/assets/js/icons/user-arrow.js b/modules/settings/assets/js/icons/user-arrow.js index 2adbdbe..0262aeb 100644 --- a/modules/settings/assets/js/icons/user-arrow.js +++ b/modules/settings/assets/js/icons/user-arrow.js @@ -1,21 +1,15 @@ import SvgIcon from '@elementor/ui/SvgIcon'; -const UserArrowIcon = ( props, { size } ) => { +const UserArrowIcon = (props, { size }) => { return ( - + - - + + ); }; diff --git a/modules/settings/assets/js/icons/widget.js b/modules/settings/assets/js/icons/widget.js index c7c84e4..49f1a89 100644 --- a/modules/settings/assets/js/icons/widget.js +++ b/modules/settings/assets/js/icons/widget.js @@ -1,8 +1,8 @@ import SvgIcon from '@elementor/ui/SvgIcon'; -const WidgetIcon = ( { size } ) => { +const WidgetIcon = ({ size }) => { return ( - + { stroke="black" strokeWidth="1.5" strokeLinecap="round" - strokeLinejoin="round" /> + strokeLinejoin="round" + /> + strokeLinejoin="round" + /> { stroke="black" strokeWidth="1.5" strokeLinecap="round" - strokeLinejoin="round" /> + strokeLinejoin="round" + /> ); diff --git a/modules/settings/assets/js/layouts/icon-design-settings.js b/modules/settings/assets/js/layouts/icon-design-settings.js index 3327300..437eede 100644 --- a/modules/settings/assets/js/layouts/icon-design-settings.js +++ b/modules/settings/assets/js/layouts/icon-design-settings.js @@ -6,22 +6,20 @@ import { __ } from '@wordpress/i18n'; const IconDesignSettings = () => { return ( - - - { __( 'Design', 'pojo-accessibility' ) } - { __( 'Customize the design of the button that visitors use to open the widget.', 'pojo-accessibility' ) } + + + + {__('Design', 'pojo-accessibility')} + + + {__( + 'Customize the design of the button that visitors use to open the widget.', + 'pojo-accessibility', + )} + - - + + diff --git a/modules/settings/assets/js/layouts/position-settings-desktop.js b/modules/settings/assets/js/layouts/position-settings-desktop.js index 66e5012..b50ea5c 100644 --- a/modules/settings/assets/js/layouts/position-settings-desktop.js +++ b/modules/settings/assets/js/layouts/position-settings-desktop.js @@ -7,34 +7,44 @@ import { useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; const PositionSettingsDesktop = () => { - const [ hiddenOnDesktop, setHiddenOnDesktop ] = useState( false ); - const [ disableExactPosition, setDisableExactPosition ] = useState( true ); + const [hiddenOnDesktop, setHiddenOnDesktop] = useState(false); + const [disableExactPosition, setDisableExactPosition] = useState(true); return ( <> { __( 'Hide on desktop', 'pojo-accessibility' ) } } + label={ + + {__('Hide on desktop', 'pojo-accessibility')} + + } labelPlacement="start" - control={ } - sx={ { marginLeft: 0, marginBottom: 3 } } - onChange={ () => setHiddenOnDesktop( ! hiddenOnDesktop ) } /> - { ! hiddenOnDesktop && - + control={} + sx={{ marginLeft: 0, marginBottom: 3 }} + onChange={() => setHiddenOnDesktop(!hiddenOnDesktop)} + /> + {!hiddenOnDesktop && ( + { __( 'Exact position', 'pojo-accessibility' ) } } + label={ + + {__('Exact position', 'pojo-accessibility')} + + } labelPlacement="start" - control={ } - sx={ { marginLeft: 0 } } - onChange={ () => setDisableExactPosition( ! disableExactPosition ) } /> - - + control={} + sx={{ marginLeft: 0 }} + onChange={() => setDisableExactPosition(!disableExactPosition)} + /> + + - } + )} ); }; diff --git a/modules/settings/assets/js/layouts/position-settings.js b/modules/settings/assets/js/layouts/position-settings.js index 3639975..c8f876e 100644 --- a/modules/settings/assets/js/layouts/position-settings.js +++ b/modules/settings/assets/js/layouts/position-settings.js @@ -16,54 +16,57 @@ const TABS = { }; const PositionSettings = () => { - const [ currentTab, setCurrentTab ] = useState( TABS.one ); - const { getTabProps } = useTabs( currentTab ); + const [currentTab, setCurrentTab] = useState(TABS.one); + const { getTabProps } = useTabs(currentTab); - const changeTab = ( tab ) => () => { - setCurrentTab( tab ); + const changeTab = (tab) => () => { + setCurrentTab(tab); }; return ( - - - { __( 'Position', 'pojo-accessibility' ) } - { __( 'Set where the widget appears on your site. This applies to all pages.', 'pojo-accessibility' ) } + + + + {__('Position', 'pojo-accessibility')} + + + {__( + 'Set where the widget appears on your site. This applies to all pages.', + 'pojo-accessibility', + )} + } + icon={} iconPosition="start" - onClick={ changeTab( TABS.one ) } + onClick={changeTab(TABS.one)} /> } + icon={} iconPosition="start" - onClick={ changeTab( TABS.two ) } + onClick={changeTab(TABS.two)} /> - { currentTab === TABS.one ? ( + {currentTab === TABS.one ? ( ) : ( - - - ) } + + )} ); }; diff --git a/modules/settings/assets/js/layouts/sidebar.js b/modules/settings/assets/js/layouts/sidebar.js index 1ff31c3..a462cc8 100644 --- a/modules/settings/assets/js/layouts/sidebar.js +++ b/modules/settings/assets/js/layouts/sidebar.js @@ -9,8 +9,8 @@ export const Sidebar = () => { return ( { height: '100%', justifyContent: 'space-between', }, - } } + }} > - + ); }; diff --git a/modules/settings/assets/js/pages/accessibility-statement.js b/modules/settings/assets/js/pages/accessibility-statement.js index c4a0c85..34cbc5c 100644 --- a/modules/settings/assets/js/pages/accessibility-statement.js +++ b/modules/settings/assets/js/pages/accessibility-statement.js @@ -1,5 +1,5 @@ const AccessibilityStatement = () => { - return (

AccessibilityStatement

); + return

AccessibilityStatement

; }; export default AccessibilityStatement; diff --git a/modules/settings/assets/js/pages/icon-settings.js b/modules/settings/assets/js/pages/icon-settings.js index bb8bb85..e744134 100644 --- a/modules/settings/assets/js/pages/icon-settings.js +++ b/modules/settings/assets/js/pages/icon-settings.js @@ -1,5 +1,5 @@ const IconSettings = () => { - return (

IconSettings

); + return

IconSettings

; }; export default IconSettings; diff --git a/modules/settings/assets/js/pages/menu.js b/modules/settings/assets/js/pages/menu.js index 2b618ce..eff5dfb 100644 --- a/modules/settings/assets/js/pages/menu.js +++ b/modules/settings/assets/js/pages/menu.js @@ -1,5 +1,5 @@ const Menu = () => { - return (

Menu

); + return

Menu

; }; export default Menu; diff --git a/package-lock.json b/package-lock.json index aee1775..d6fbf6c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,12 +28,15 @@ "@wordpress/eslint-plugin": "^21.3.0", "@wordpress/scripts": "^30.3.0", "eslint": "^8.57.1", + "eslint-config-prettier": "^9.1.0", "eslint-import-resolver-webpack": "^0.13.9", "eslint-plugin-babel": "^5.3.1", "eslint-plugin-import": "^2.31.0", "eslint-plugin-jsx-a11y": "^6.10.1", + "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-react": "^7.37.1", - "husky": "^9.1.6" + "husky": "^9.1.6", + "prettier": "^3.4.1" } }, "node_modules/@ampproject/remapping": { @@ -6536,6 +6539,18 @@ } } }, + "node_modules/@wordpress/eslint-plugin/node_modules/eslint-config-prettier": { + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.10.0.tgz", + "integrity": "sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==", + "dev": true, + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, "node_modules/@wordpress/eslint-plugin/node_modules/globals": { "version": "13.24.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", @@ -10755,9 +10770,9 @@ } }, "node_modules/eslint-config-prettier": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.10.0.tgz", - "integrity": "sha512-SM8AMJdeQqRYT9O9zguiruQZaN7+z+E4eAP9oiLNGKMtomwaB1E9dcgUD6ZAn/eQAb52USbvezbiljfZUhbJcg==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", + "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", "dev": true, "bin": { "eslint-config-prettier": "bin/cli.js" @@ -18191,11 +18206,10 @@ } }, "node_modules/prettier": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", - "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.1.tgz", + "integrity": "sha512-G+YdqtITVZmOJje6QkXQWzl3fSfMxFwm1tjTyo9exhkmWSqC4Yhd1+lug++IlR2mvRVAxEDDWYkQdeSztajqgg==", "dev": true, - "peer": true, "bin": { "prettier": "bin/prettier.cjs" }, diff --git a/package.json b/package.json index e8767b2..23eb061 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "start": "wp-scripts start", "format": "wp-scripts format", "lint:js": "wp-scripts lint-js", + "lint:js:fix": "wp-scripts lint-js --fix", "prepare": "husky install", "local:start": "wp-env start", "local:stop": "wp-env stop", @@ -26,11 +27,14 @@ "@wordpress/scripts": "^30.3.0", "eslint": "^8.57.1", "eslint-import-resolver-webpack": "^0.13.9", + "eslint-config-prettier": "^9.1.0", "eslint-plugin-babel": "^5.3.1", "eslint-plugin-import": "^2.31.0", "eslint-plugin-jsx-a11y": "^6.10.1", + "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-react": "^7.37.1", - "husky": "^9.1.6" + "husky": "^9.1.6", + "prettier": "^3.4.1" }, "dependencies": { "@elementor/icons": "^1.17.0", diff --git a/webpack.config.js b/webpack.config.js index ae6ffc0..415bf6c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,13 +1,9 @@ -const path = require( 'path' ); -const defaultConfig = require( '@wordpress/scripts/config/webpack.config' ); +const path = require('path'); +const defaultConfig = require('@wordpress/scripts/config/webpack.config'); // add your entry points here const entryPoints = { - admin: path.resolve( - process.cwd(), - 'modules/settings/assets/js', - 'admin.js', - ), + admin: path.resolve(process.cwd(), 'modules/settings/assets/js', 'admin.js'), }; module.exports = { @@ -15,16 +11,31 @@ module.exports = { entry: entryPoints, output: { ...defaultConfig.output, - path: path.resolve( process.cwd(), 'assets/build' ), + path: path.resolve(process.cwd(), 'assets/build'), }, resolve: { alias: { - '@ea11y/hooks': path.resolve( __dirname, 'modules/settings/assets/js/hooks/' ), - '@ea11y/components': path.resolve( __dirname, 'modules/settings/assets/js/components/' ), - '@ea11y/icons': path.resolve( __dirname, 'modules/settings/assets/js/icons/' ), - '@ea11y/layouts': path.resolve( __dirname, 'modules/settings/assets/js/layouts/' ), - '@ea11y/pages': path.resolve( __dirname, 'modules/settings/assets/js/pages/' ), + '@ea11y/hooks': path.resolve( + __dirname, + 'modules/settings/assets/js/hooks/', + ), + '@ea11y/components': path.resolve( + __dirname, + 'modules/settings/assets/js/components/', + ), + '@ea11y/icons': path.resolve( + __dirname, + 'modules/settings/assets/js/icons/', + ), + '@ea11y/layouts': path.resolve( + __dirname, + 'modules/settings/assets/js/layouts/', + ), + '@ea11y/pages': path.resolve( + __dirname, + 'modules/settings/assets/js/pages/', + ), }, - extensions: [ '.js', '.jsx' ], + extensions: ['.js', '.jsx'], }, };