diff --git a/src/analytics/script/integration/component/accordion/integrate.js b/src/analytics/script/integration/component/accordion/integrate.js new file mode 100644 index 000000000..feecb5c38 --- /dev/null +++ b/src/analytics/script/integration/component/accordion/integrate.js @@ -0,0 +1,10 @@ +import api from '../../../../api'; +import { AccordionActionee } from './accordion-actionee'; + +const integrateAccordion = () => { + if (api.accordion) { + api.internals.register(api.accordion.AccordionSelector.COLLAPSE, AccordionActionee); + } +}; + +export default integrateAccordion; diff --git a/src/analytics/script/integration/component/alert/integrate.js b/src/analytics/script/integration/component/alert/integrate.js new file mode 100644 index 000000000..a9a632074 --- /dev/null +++ b/src/analytics/script/integration/component/alert/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { AlertSelector } from './alert-selector'; +import { AlertActionee } from './alert-actionee'; + +const integrateAlert = () => { + api.internals.register(AlertSelector.ALERT, AlertActionee); +}; + +export default integrateAlert; diff --git a/src/analytics/script/integration/component/badge/integrate.js b/src/analytics/script/integration/component/badge/integrate.js new file mode 100644 index 000000000..022f60714 --- /dev/null +++ b/src/analytics/script/integration/component/badge/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { BadgeSelector } from './badge-selector'; +import { BadgeActionee } from './badge-actionee'; + +const integrateBadge = () => { + api.internals.register(BadgeSelector.BADGE, BadgeActionee); +}; + +export default integrateBadge; diff --git a/src/analytics/script/integration/component/breadcrumb/integrate.js b/src/analytics/script/integration/component/breadcrumb/integrate.js new file mode 100644 index 000000000..56430058d --- /dev/null +++ b/src/analytics/script/integration/component/breadcrumb/integrate.js @@ -0,0 +1,13 @@ +import api from '../../../../api'; +import { BreadcrumbSelector } from './breadcrumb-selector'; +import { BreadcrumbActionee } from './breadcrumb-actionee'; +import { BreadcrumbLinkActionee } from './breadcrumb-link-actionee'; + +const integrateBreadcrumb = () => { + if (api.breadcrumb) { + api.internals.register(BreadcrumbSelector.COLLAPSE, BreadcrumbActionee); + api.internals.register(BreadcrumbSelector.LINK, BreadcrumbLinkActionee); + } +}; + +export default integrateBreadcrumb; diff --git a/src/analytics/script/integration/component/button/integrate.js b/src/analytics/script/integration/component/button/integrate.js new file mode 100644 index 000000000..f05da1806 --- /dev/null +++ b/src/analytics/script/integration/component/button/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { ButtonSelector } from './button-selector'; +import { ButtonActionee } from './button-actionee'; + +const integrateButton = () => { + api.internals.register(ButtonSelector.BUTTON, ButtonActionee); +}; + +export default integrateButton; diff --git a/src/analytics/script/integration/component/callout/integrate.js b/src/analytics/script/integration/component/callout/integrate.js new file mode 100644 index 000000000..685c2ecc3 --- /dev/null +++ b/src/analytics/script/integration/component/callout/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { CalloutSelector } from './callout-selector'; +import { CalloutActionee } from './callout-actionee'; + +const integrateCallout = () => { + api.internals.register(CalloutSelector.CALLOUT, CalloutActionee); +}; + +export default integrateCallout; diff --git a/src/analytics/script/integration/component/card/integrate.js b/src/analytics/script/integration/component/card/integrate.js new file mode 100644 index 000000000..847b77f9a --- /dev/null +++ b/src/analytics/script/integration/component/card/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { CardSelector } from './card-selector'; +import { CardActionee } from './card-actionee'; + +const integrateCard = () => { + api.internals.register(CardSelector.CARD, CardActionee); +}; + +export default integrateCard; diff --git a/src/analytics/script/integration/component/checkbox/integrate.js b/src/analytics/script/integration/component/checkbox/integrate.js new file mode 100644 index 000000000..6051902e7 --- /dev/null +++ b/src/analytics/script/integration/component/checkbox/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { CheckboxSelector } from './checkbox-selector'; +import { CheckboxActionee } from './checkbox-actionee'; + +const integrateCheckbox = () => { + api.internals.register(CheckboxSelector.INPUT, CheckboxActionee); +}; + +export default integrateCheckbox; diff --git a/src/analytics/script/integration/component/components.js b/src/analytics/script/integration/component/components.js index 716b467d4..0b7b31a43 100644 --- a/src/analytics/script/integration/component/components.js +++ b/src/analytics/script/integration/component/components.js @@ -1,194 +1,82 @@ import api from '../../../api'; -import { AccordionActionee } from './accordion/accordion-actionee'; -import { BreadcrumbSelector } from './breadcrumb/breadcrumb-selector'; -import { BreadcrumbActionee } from './breadcrumb/breadcrumb-actionee'; -import { BreadcrumbLinkActionee } from './breadcrumb/breadcrumb-link-actionee'; -import { ButtonSelector } from './button/button-selector'; -import { ButtonActionee } from './button/button-actionee'; -import { AlertSelector } from './alert/alert-selector'; -import { AlertActionee } from './alert/alert-actionee'; -import { BadgeSelector } from './badge/badge-selector'; -import { BadgeActionee } from './badge/badge-actionee'; -import { CalloutSelector } from './callout/callout-selector'; -import { CalloutActionee } from './callout/callout-actionee'; -import { ConnectSelector } from './connect/connect-selector'; -import { ConnectActionee } from './connect/connect-actionee'; -import { ConnectLinkActionee } from './connect/connect-link-actionee'; -import { ContentSelector } from './content/content-selector'; -import { ContentActionee } from './content/content-actionee'; -import { ConsentSelector } from './consent/consent-selector'; -import { ConsentActionee } from './consent/consent-actionee'; -import { CardSelector } from './card/card-selector'; -import { CardActionee } from './card/card-actionee'; -import { CheckboxSelector } from './checkbox/checkbox-selector'; -import { CheckboxActionee } from './checkbox/checkbox-actionee'; -import { DownloadSelector } from './download/download-selector'; -import { DownloadActionee } from './download/download-actionee'; -import { FooterSelector } from './footer/footer-selector'; -import { FooterActionee } from './footer/footer-actionee'; -import { FollowSelector } from './follow/follow-selector'; -import { FollowActionee } from './follow/follow-actionee'; -import { FooterLinkActionee } from './footer/footer-link-actionee'; -import { HeaderActionee } from './header/header-actionee'; -import { HeaderSelector } from './header/header-selector'; -import { HeaderModalActionee } from './header/header-modal-actionee'; -import { HeaderToolsButtonActionee } from './header/header-tools-button-actionee'; -import { HeaderMenuButtonActionee } from './header/header-menu-button-actionee'; -import { HighlightSelector } from './highlight/highlight-selector'; -import { HighlightActionee } from './highlight/highlight-actionee'; -import { InputSelector } from './input/input-selector'; -import { InputActionee } from './input/input-actionee'; -import { LinkSelector } from './link/link-selector'; -import { LinkActionee } from './link/link-actionee'; -import { ModalActionee } from './modal/modal-actionee'; -import { NavigationSelector } from './navigation/navigation-selector'; -import { NavigationActionee } from './navigation/navigation-actionee'; -import { NavigationSectionActionee } from './navigation/navigation-section-actionee'; -import { NavigationLinkActionee } from './navigation/navigation-link-actionee'; -import { NoticeSelector } from './notice/notice-selector'; -import { NoticeActionee } from './notice/notice-actionee'; -import { PaginationSelector } from './pagination/pagination-selector'; -import { PaginationActionee } from './pagination/pagination-actionee'; -import { PaginationLinkActionee } from './pagination/pagination-link-actionee'; -import { RadioSelector } from './radio/radio-selector'; -import { RadioActionee } from './radio/radio-actionee'; -import { QuoteSelector } from './quote/quote-selector'; -import { QuoteActionee } from './quote/quote-actionee'; -import { SearchSelector } from './search/search-selector'; -import { SearchActionee } from './search/search-actionee'; -import { SelectSelector } from './select/select-selector'; -import { SelectActionee } from './select/select-actionee'; -import { SidemenuSelector } from './sidemenu/sidemenu-selector'; -import { SidemenuActionee } from './sidemenu/sidemenu-actionee'; -import { SidemenuLinkActionee } from './sidemenu/sidemenu-link-actionee'; -import { SidemenuSectionActionee } from './sidemenu/sidemenu-section-actionee'; -import { ShareSelector } from './share/share-selector'; -import { ShareActionee } from './share/share-actionee'; -import { StepperSelector } from './stepper/stepper-selector'; -import { StepperActionee } from './stepper/stepper-actionee'; -import { SummarySelector } from './summary/summary-selector'; -import { SummaryActionee } from './summary/summary-actionee'; -import { SummaryLinkActionee } from './summary/summary-link-actionee'; -import { SummarySectionActionee } from './summary/summary-section-actionee'; -import { TabActionee } from './tab/tab-actionee'; -import { TableSelector } from './table/table-selector'; -import { TableActionee } from './table/table-actionee'; -import { TileSelector } from './tile/tile-selector'; -import { TileActionee } from './tile/tile-actionee'; -import { ToggleSelector } from './toggle/toggle-selector'; -import { ToggleActionee } from './toggle/toggle-actionee'; -import { TagSelector } from './tag/tag-selector'; -import { TagActionee } from './tag/tag-actionee'; -import { TranscriptionSelector } from './transcription/transcription-selector'; -import { TranscriptionActionee } from './transcription/transcription-actionee'; -import { TranslateSelector } from './translate/translate-selector'; -import { TranslateActionee } from './translate/translate-actionee'; -import { UploadSelector } from './upload/upload-selector'; -import { UploadActionee } from './upload/upload-actionee'; +import integrateAccordion from './accordion/integrate'; +import integrateAlert from './alert/integrate'; +import integrateBreadcrumb from './breadcrumb/integrate'; +import integrateBadge from './badge/integrate'; +import integrateButton from './button/integrate'; +import integrateCallout from './callout/integrate'; +import integrateCard from './card/integrate'; +import integrateCheckbox from './checkbox/integrate'; +import integrateConnect from './connect/integrate'; +import integrateConsent from './consent/integrate'; +import integrateContent from './content/integrate'; +import integrateDownload from './download/integrate'; +import integrateFollow from './follow/integrate'; +import integrateFooter from './footer/integrate'; +import integrateHeader from './header/integrate'; +import integrateHighlight from './highlight/integrate'; +import integrateLink from './link/integrate'; +import integrateInput from './input/integrate'; +import integrateModal from './modal/integrate'; +import integrateNavigation from './navigation/integrate'; +import integrateNotice from './notice/integrate'; +import integratePagination from './pagination/integrate'; +import integrateQuote from './quote/integrate'; +import integrateRadio from './radio/integrate'; +import integrateSearch from './search/integrate'; +import integrateSelect from './select/integrate'; +import integrateShare from './share/integrate'; +import integrateSidemenu from './sidemenu/integrate'; +import integrateStepper from './stepper/integrate'; +import integrateSummary from './summary/integrate'; +import integrateTab from './tab/integrate'; +import integrateTable from './table/integrate'; +import integrateTag from './tag/integrate'; +import integrateTile from './tile/integrate'; +import integrateToggle from './toggle/integrate'; +import integrateTranscription from './transcription/integrate'; +import integrateTranslate from './translate/integrate'; +import integrateUpload from './upload/integrate'; const integrateComponents = () => { - if (api.accordion) { - api.internals.register(api.accordion.AccordionSelector.COLLAPSE, AccordionActionee); - } - - if (api.breadcrumb) { - api.internals.register(BreadcrumbSelector.COLLAPSE, BreadcrumbActionee); - api.internals.register(BreadcrumbSelector.LINK, BreadcrumbLinkActionee); - } - - api.internals.register(AlertSelector.ALERT, AlertActionee); - - api.internals.register(BadgeSelector.BADGE, BadgeActionee); - - api.internals.register(ButtonSelector.BUTTON, ButtonActionee); - - api.internals.register(CalloutSelector.CALLOUT, CalloutActionee); - - api.internals.register(ConnectSelector.CONNECT, ConnectActionee); - api.internals.register(ConnectSelector.LINK, ConnectLinkActionee); - - api.internals.register(ContentSelector.CONTENT, ContentActionee); - - api.internals.register(ConsentSelector.BANNER, ConsentActionee); - - api.internals.register(CardSelector.CARD, CardActionee); - - api.internals.register(InputSelector.INPUT, InputActionee); - - api.internals.register(CheckboxSelector.INPUT, CheckboxActionee); - - api.internals.register(DownloadSelector.LINK, DownloadActionee); - - api.internals.register(FooterSelector.FOOTER, FooterActionee); - api.internals.register(FooterSelector.FOOTER_LINKS, FooterLinkActionee); - - api.internals.register(FollowSelector.FOLLOW, FollowActionee); - - if (api.header) { - api.internals.register(api.header.HeaderSelector.HEADER, HeaderActionee); - api.internals.register(api.header.HeaderSelector.MODALS, HeaderModalActionee); - api.internals.register(HeaderSelector.TOOLS_BUTTON, HeaderToolsButtonActionee); - api.internals.register(HeaderSelector.MENU_BUTTON, HeaderMenuButtonActionee); - } - - api.internals.register(HighlightSelector.HIGHLIGHT, HighlightActionee); - - api.internals.register(LinkSelector.LINK, LinkActionee); - - if (api.modal) { - api.internals.register(api.modal.ModalSelector.MODAL, ModalActionee); - } - - if (api.navigation) { - api.internals.register(api.navigation.NavigationSelector.NAVIGATION, NavigationActionee); - api.internals.register(NavigationSelector.LINK, NavigationLinkActionee); - api.internals.register(api.navigation.NavigationSelector.COLLAPSE, NavigationSectionActionee); - } - - api.internals.register(NoticeSelector.NOTICE, NoticeActionee); - - api.internals.register(PaginationSelector.PAGINATION, PaginationActionee); - api.internals.register(PaginationSelector.LINK, PaginationLinkActionee); - - api.internals.register(QuoteSelector.QUOTE, QuoteActionee); - - api.internals.register(RadioSelector.INPUT, RadioActionee); - - api.internals.register(SearchSelector.SEARCH_BAR, SearchActionee); - - api.internals.register(SelectSelector.SELECT, SelectActionee); - - if (api.sidemenu) { - api.internals.register(SidemenuSelector.SIDEMENU, SidemenuActionee); - api.internals.register(SidemenuSelector.LINK, SidemenuLinkActionee); - api.internals.register(api.sidemenu.SidemenuSelector.COLLAPSE, SidemenuSectionActionee); - } - - api.internals.register(ShareSelector.SHARE, ShareActionee); - - api.internals.register(StepperSelector.STEPPER, StepperActionee); - - api.internals.register(SummarySelector.SUMMARY, SummaryActionee); - api.internals.register(SummarySelector.LINK, SummaryLinkActionee); - api.internals.register(SummarySelector.ITEM, SummarySectionActionee); - - if (api.tab) { - api.internals.register(api.tab.TabSelector.PANEL, TabActionee); - } - - api.internals.register(TableSelector.TABLE, TableActionee); - - api.internals.register(TagSelector.TAG, TagActionee); - - api.internals.register(TileSelector.TILE, TileActionee); - - api.internals.register(ToggleSelector.INPUT, ToggleActionee); - - api.internals.register(TranscriptionSelector.COLLAPSE, TranscriptionActionee); - - api.internals.register(TranslateSelector.COLLAPSE, TranslateActionee); - - api.internals.register(UploadSelector.UPLOAD, UploadActionee); + integrateAccordion(); + integrateBreadcrumb(); + integrateAlert(); + integrateBadge(); + integrateButton(); + integrateCallout(); + integrateConnect(); + integrateConsent(); + integrateContent(); + integrateCard(); + integrateInput(); + integrateCheckbox(); + integrateDownload(); + integrateFooter(); + integrateFollow(); + integrateHeader(); + integrateHighlight(); + integrateLink(); + integrateModal(); + integrateNavigation(); + integrateNotice(); + integratePagination(); + integrateQuote(); + integrateRadio(); + integrateSearch(); + integrateSelect(); + integrateShare(); + integrateSidemenu(); + integrateStepper(); + integrateSummary(); + integrateTab(); + integrateTable(); + integrateTag(); + integrateTile(); + integrateToggle(); + integrateTranscription(); + integrateTranslate(); + integrateUpload(); }; export default integrateComponents; diff --git a/src/analytics/script/integration/component/connect/integrate.js b/src/analytics/script/integration/component/connect/integrate.js new file mode 100644 index 000000000..96923e397 --- /dev/null +++ b/src/analytics/script/integration/component/connect/integrate.js @@ -0,0 +1,11 @@ +import api from '../../../../api'; +import { ConnectSelector } from './connect-selector'; +import { ConnectActionee } from './connect-actionee'; +import { ConnectLinkActionee } from './connect-link-actionee'; + +const integrateConnect = () => { + api.internals.register(ConnectSelector.CONNECT, ConnectActionee); + api.internals.register(ConnectSelector.LINK, ConnectLinkActionee); +}; + +export default integrateConnect; diff --git a/src/analytics/script/integration/component/consent/integrate.js b/src/analytics/script/integration/component/consent/integrate.js new file mode 100644 index 000000000..c998ccc4e --- /dev/null +++ b/src/analytics/script/integration/component/consent/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { ConsentSelector } from './consent-selector'; +import { ConsentActionee } from './consent-actionee'; + +const integrateConsent = () => { + api.internals.register(ConsentSelector.BANNER, ConsentActionee); +}; + +export default integrateConsent; diff --git a/src/analytics/script/integration/component/content/integrate.js b/src/analytics/script/integration/component/content/integrate.js new file mode 100644 index 000000000..b69250748 --- /dev/null +++ b/src/analytics/script/integration/component/content/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { ContentSelector } from './content-selector'; +import { ContentActionee } from './content-actionee'; + +const integrateContent = () => { + api.internals.register(ContentSelector.CONTENT, ContentActionee); +}; + +export default integrateContent; diff --git a/src/analytics/script/integration/component/download/integrate.js b/src/analytics/script/integration/component/download/integrate.js new file mode 100644 index 000000000..52f0162ff --- /dev/null +++ b/src/analytics/script/integration/component/download/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { DownloadSelector } from './download-selector'; +import { DownloadActionee } from './download-actionee'; + +const integrateDownload = () => { + api.internals.register(DownloadSelector.LINK, DownloadActionee); +}; + +export default integrateDownload; diff --git a/src/analytics/script/integration/component/follow/integrate.js b/src/analytics/script/integration/component/follow/integrate.js new file mode 100644 index 000000000..b7fde9bf7 --- /dev/null +++ b/src/analytics/script/integration/component/follow/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { FollowSelector } from './follow-selector'; +import { FollowActionee } from './follow-actionee'; + +const integrateFollow = () => { + api.internals.register(FollowSelector.FOLLOW, FollowActionee); +}; + +export default integrateFollow; diff --git a/src/analytics/script/integration/component/footer/integrate.js b/src/analytics/script/integration/component/footer/integrate.js new file mode 100644 index 000000000..961c82f9d --- /dev/null +++ b/src/analytics/script/integration/component/footer/integrate.js @@ -0,0 +1,11 @@ +import api from '../../../../api'; +import { FooterSelector } from './footer-selector'; +import { FooterActionee } from './footer-actionee'; +import { FooterLinkActionee } from './footer-link-actionee'; + +const integrateFooter = () => { + api.internals.register(FooterSelector.FOOTER, FooterActionee); + api.internals.register(FooterSelector.FOOTER_LINKS, FooterLinkActionee); +}; + +export default integrateFooter; diff --git a/src/analytics/script/integration/component/header/integrate.js b/src/analytics/script/integration/component/header/integrate.js new file mode 100644 index 000000000..8733112b2 --- /dev/null +++ b/src/analytics/script/integration/component/header/integrate.js @@ -0,0 +1,17 @@ +import api from '../../../../api'; +import { HeaderActionee } from './header-actionee'; +import { HeaderModalActionee } from './header-modal-actionee'; +import { HeaderSelector } from './header-selector'; +import { HeaderToolsButtonActionee } from './header-tools-button-actionee'; +import { HeaderMenuButtonActionee } from './header-menu-button-actionee'; + +const integrateHeader = () => { + if (api.header) { + api.internals.register(api.header.HeaderSelector.HEADER, HeaderActionee); + api.internals.register(api.header.HeaderSelector.MODALS, HeaderModalActionee); + api.internals.register(HeaderSelector.TOOLS_BUTTON, HeaderToolsButtonActionee); + api.internals.register(HeaderSelector.MENU_BUTTON, HeaderMenuButtonActionee); + } +}; + +export default integrateHeader; diff --git a/src/analytics/script/integration/component/highlight/integrate.js b/src/analytics/script/integration/component/highlight/integrate.js new file mode 100644 index 000000000..6e5ed68ef --- /dev/null +++ b/src/analytics/script/integration/component/highlight/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { HighlightSelector } from './highlight-selector'; +import { HighlightActionee } from './highlight-actionee'; + +const integrateHighlight = () => { + api.internals.register(HighlightSelector.HIGHLIGHT, HighlightActionee); +}; + +export default integrateHighlight; diff --git a/src/analytics/script/integration/component/input/integrate.js b/src/analytics/script/integration/component/input/integrate.js new file mode 100644 index 000000000..84ef52268 --- /dev/null +++ b/src/analytics/script/integration/component/input/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { InputSelector } from './input-selector'; +import { InputActionee } from './input-actionee'; + +const integrateInput = () => { + api.internals.register(InputSelector.INPUT, InputActionee); +}; + +export default integrateInput; diff --git a/src/analytics/script/integration/component/link/integrate.js b/src/analytics/script/integration/component/link/integrate.js new file mode 100644 index 000000000..1a56e3f3f --- /dev/null +++ b/src/analytics/script/integration/component/link/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { LinkSelector } from './link-selector'; +import { LinkActionee } from './link-actionee'; + +const integrateLink = () => { + api.internals.register(LinkSelector.LINK, LinkActionee); +}; + +export default integrateLink; diff --git a/src/analytics/script/integration/component/modal/integrate.js b/src/analytics/script/integration/component/modal/integrate.js new file mode 100644 index 000000000..b414e661b --- /dev/null +++ b/src/analytics/script/integration/component/modal/integrate.js @@ -0,0 +1,10 @@ +import api from '../../../../api'; +import { ModalActionee } from './modal-actionee'; + +const integrateModal = () => { + if (api.modal) { + api.internals.register(api.modal.ModalSelector.MODAL, ModalActionee); + } +}; + +export default integrateModal; diff --git a/src/analytics/script/integration/component/navigation/integrate.js b/src/analytics/script/integration/component/navigation/integrate.js new file mode 100644 index 000000000..735271c22 --- /dev/null +++ b/src/analytics/script/integration/component/navigation/integrate.js @@ -0,0 +1,15 @@ +import api from '../../../../api'; +import { NavigationActionee } from './navigation-actionee'; +import { NavigationSelector } from './navigation-selector'; +import { NavigationLinkActionee } from './navigation-link-actionee'; +import { NavigationSectionActionee } from './navigation-section-actionee'; + +const integrateNavigation = () => { + if (api.navigation) { + api.internals.register(api.navigation.NavigationSelector.NAVIGATION, NavigationActionee); + api.internals.register(NavigationSelector.LINK, NavigationLinkActionee); + api.internals.register(api.navigation.NavigationSelector.COLLAPSE, NavigationSectionActionee); + } +}; + +export default integrateNavigation; diff --git a/src/analytics/script/integration/component/notice/integrate.js b/src/analytics/script/integration/component/notice/integrate.js new file mode 100644 index 000000000..7c6664d99 --- /dev/null +++ b/src/analytics/script/integration/component/notice/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { NoticeSelector } from './notice-selector'; +import { NoticeActionee } from './notice-actionee'; + +const integrateNotice = () => { + api.internals.register(NoticeSelector.NOTICE, NoticeActionee); +}; + +export default integrateNotice; diff --git a/src/analytics/script/integration/component/pagination/integrate.js b/src/analytics/script/integration/component/pagination/integrate.js new file mode 100644 index 000000000..2ef7ea4a2 --- /dev/null +++ b/src/analytics/script/integration/component/pagination/integrate.js @@ -0,0 +1,11 @@ +import api from '../../../../api'; +import { PaginationSelector } from './pagination-selector'; +import { PaginationActionee } from './pagination-actionee'; +import { PaginationLinkActionee } from './pagination-link-actionee'; + +const integratePagination = () => { + api.internals.register(PaginationSelector.PAGINATION, PaginationActionee); + api.internals.register(PaginationSelector.LINK, PaginationLinkActionee); +}; + +export default integratePagination; diff --git a/src/analytics/script/integration/component/quote/integrate.js b/src/analytics/script/integration/component/quote/integrate.js new file mode 100644 index 000000000..32d5b6d68 --- /dev/null +++ b/src/analytics/script/integration/component/quote/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { QuoteSelector } from './quote-selector'; +import { QuoteActionee } from './quote-actionee'; + +const integrateQuote = () => { + api.internals.register(QuoteSelector.QUOTE, QuoteActionee); +}; + +export default integrateQuote; diff --git a/src/analytics/script/integration/component/radio/integrate.js b/src/analytics/script/integration/component/radio/integrate.js new file mode 100644 index 000000000..eea226823 --- /dev/null +++ b/src/analytics/script/integration/component/radio/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { RadioSelector } from './radio-selector'; +import { RadioActionee } from './radio-actionee'; + +const integrateRadio = () => { + api.internals.register(RadioSelector.INPUT, RadioActionee); +}; + +export default integrateRadio; diff --git a/src/analytics/script/integration/component/search/integrate.js b/src/analytics/script/integration/component/search/integrate.js new file mode 100644 index 000000000..a3e3366a2 --- /dev/null +++ b/src/analytics/script/integration/component/search/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { SearchSelector } from './search-selector'; +import { SearchActionee } from './search-actionee'; + +const integrateSearch = () => { + api.internals.register(SearchSelector.SEARCH_BAR, SearchActionee); +}; + +export default integrateSearch; diff --git a/src/analytics/script/integration/component/select/integrate.js b/src/analytics/script/integration/component/select/integrate.js new file mode 100644 index 000000000..0fe6d0893 --- /dev/null +++ b/src/analytics/script/integration/component/select/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { SelectSelector } from './select-selector'; +import { SelectActionee } from './select-actionee'; + +const integrateSelect = () => { + api.internals.register(SelectSelector.SELECT, SelectActionee); +}; + +export default integrateSelect; diff --git a/src/analytics/script/integration/component/share/integrate.js b/src/analytics/script/integration/component/share/integrate.js new file mode 100644 index 000000000..12d6d9074 --- /dev/null +++ b/src/analytics/script/integration/component/share/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { ShareSelector } from './share-selector'; +import { ShareActionee } from './share-actionee'; + +const integrateShare = () => { + api.internals.register(ShareSelector.SHARE, ShareActionee); +}; + +export default integrateShare; diff --git a/src/analytics/script/integration/component/sidemenu/integrate.js b/src/analytics/script/integration/component/sidemenu/integrate.js new file mode 100644 index 000000000..a86214dcc --- /dev/null +++ b/src/analytics/script/integration/component/sidemenu/integrate.js @@ -0,0 +1,15 @@ +import api from '../../../../api'; +import { SidemenuSelector } from './sidemenu-selector'; +import { SidemenuActionee } from './sidemenu-actionee'; +import { SidemenuLinkActionee } from './sidemenu-link-actionee'; +import { SidemenuSectionActionee } from './sidemenu-section-actionee'; + +const integrateSidemenu = () => { + if (api.sidemenu) { + api.internals.register(SidemenuSelector.SIDEMENU, SidemenuActionee); + api.internals.register(SidemenuSelector.LINK, SidemenuLinkActionee); + api.internals.register(api.sidemenu.SidemenuSelector.COLLAPSE, SidemenuSectionActionee); + } +}; + +export default integrateSidemenu; diff --git a/src/analytics/script/integration/component/stepper/integrate.js b/src/analytics/script/integration/component/stepper/integrate.js new file mode 100644 index 000000000..672767b06 --- /dev/null +++ b/src/analytics/script/integration/component/stepper/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { StepperSelector } from './stepper-selector'; +import { StepperActionee } from './stepper-actionee'; + +const integrateStepper = () => { + api.internals.register(StepperSelector.STEPPER, StepperActionee); +}; + +export default integrateStepper; diff --git a/src/analytics/script/integration/component/summary/integrate.js b/src/analytics/script/integration/component/summary/integrate.js new file mode 100644 index 000000000..1be053a1d --- /dev/null +++ b/src/analytics/script/integration/component/summary/integrate.js @@ -0,0 +1,13 @@ +import api from '../../../../api'; +import { SummarySelector } from './summary-selector'; +import { SummaryActionee } from './summary-actionee'; +import { SummaryLinkActionee } from './summary-link-actionee'; +import { SummarySectionActionee } from './summary-section-actionee'; + +const integrateSummary = () => { + api.internals.register(SummarySelector.SUMMARY, SummaryActionee); + api.internals.register(SummarySelector.LINK, SummaryLinkActionee); + api.internals.register(SummarySelector.ITEM, SummarySectionActionee); +}; + +export default integrateSummary; diff --git a/src/analytics/script/integration/component/tab/integrate.js b/src/analytics/script/integration/component/tab/integrate.js new file mode 100644 index 000000000..c1ef236c2 --- /dev/null +++ b/src/analytics/script/integration/component/tab/integrate.js @@ -0,0 +1,10 @@ +import api from '../../../../api'; +import { TabActionee } from './tab-actionee'; + +const integrateTab = () => { + if (api.tab) { + api.internals.register(api.tab.TabSelector.PANEL, TabActionee); + } +}; + +export default integrateTab; diff --git a/src/analytics/script/integration/component/table/integrate.js b/src/analytics/script/integration/component/table/integrate.js new file mode 100644 index 000000000..1b9b64565 --- /dev/null +++ b/src/analytics/script/integration/component/table/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { TableSelector } from './table-selector'; +import { TableActionee } from './table-actionee'; + +const integrateTable = () => { + api.internals.register(TableSelector.TABLE, TableActionee); +}; + +export default integrateTable; diff --git a/src/analytics/script/integration/component/tag/integrate.js b/src/analytics/script/integration/component/tag/integrate.js new file mode 100644 index 000000000..af6927cd2 --- /dev/null +++ b/src/analytics/script/integration/component/tag/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { TagSelector } from './tag-selector'; +import { TagActionee } from './tag-actionee'; + +const integrateTag = () => { + api.internals.register(TagSelector.TAG, TagActionee); +}; + +export default integrateTag; diff --git a/src/analytics/script/integration/component/tile/integrate.js b/src/analytics/script/integration/component/tile/integrate.js new file mode 100644 index 000000000..6511c40e0 --- /dev/null +++ b/src/analytics/script/integration/component/tile/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { TileSelector } from './tile-selector'; +import { TileActionee } from './tile-actionee'; + +const integrateTile = () => { + api.internals.register(TileSelector.TILE, TileActionee); +}; + +export default integrateTile; diff --git a/src/analytics/script/integration/component/toggle/integrate.js b/src/analytics/script/integration/component/toggle/integrate.js new file mode 100644 index 000000000..4e7fa640a --- /dev/null +++ b/src/analytics/script/integration/component/toggle/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { ToggleSelector } from './toggle-selector'; +import { ToggleActionee } from './toggle-actionee'; + +const integrateToggle = () => { + api.internals.register(ToggleSelector.INPUT, ToggleActionee); +}; + +export default integrateToggle; diff --git a/src/analytics/script/integration/component/transcription/integrate.js b/src/analytics/script/integration/component/transcription/integrate.js new file mode 100644 index 000000000..62632e2e9 --- /dev/null +++ b/src/analytics/script/integration/component/transcription/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { TranscriptionSelector } from './transcription-selector'; +import { TranscriptionActionee } from './transcription-actionee'; + +const integrateTranscription = () => { + api.internals.register(TranscriptionSelector.COLLAPSE, TranscriptionActionee); +}; + +export default integrateTranscription; diff --git a/src/analytics/script/integration/component/transcription/transcription-selector.js b/src/analytics/script/integration/component/transcription/transcription-selector.js index f30378395..a40232b57 100644 --- a/src/analytics/script/integration/component/transcription/transcription-selector.js +++ b/src/analytics/script/integration/component/transcription/transcription-selector.js @@ -1,7 +1,10 @@ import api from '../../../../api'; +const TRANSCRIPTION = api.internals.ns.selector('transcription'); +const COLLAPSE = api.internals.ns.selector('collapse'); + export const TranscriptionSelector = { - TRANSCRIPTION: api.internals.ns.selector('transcription'), - COLLAPSE: `${api.internals.ns.selector('transcription')} ${api.internals.ns.selector('collapse')}`, - TITLE: api.internals.ns.selector('transcription__title') + TRANSCRIPTION: TRANSCRIPTION, + COLLAPSE: `${TRANSCRIPTION} > ${COLLAPSE}, ${TRANSCRIPTION} > *:not(${TRANSCRIPTION}, ${COLLAPSE}) > ${COLLAPSE}, ${TRANSCRIPTION} > *:not(${TRANSCRIPTION}, ${COLLAPSE}) > *:not(${TRANSCRIPTION}, ${COLLAPSE}) > ${COLLAPSE}`, + TITLE: `${TRANSCRIPTION}__title` }; diff --git a/src/analytics/script/integration/component/translate/integrate.js b/src/analytics/script/integration/component/translate/integrate.js new file mode 100644 index 000000000..2a1ef0cc7 --- /dev/null +++ b/src/analytics/script/integration/component/translate/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { TranslateSelector } from './translate-selector'; +import { TranslateActionee } from './translate-actionee'; + +const integrateTranslate = () => { + api.internals.register(TranslateSelector.COLLAPSE, TranslateActionee); +}; + +export default integrateTranslate; diff --git a/src/analytics/script/integration/component/translate/translate-selector.js b/src/analytics/script/integration/component/translate/translate-selector.js index bd1634479..548dfb3bc 100644 --- a/src/analytics/script/integration/component/translate/translate-selector.js +++ b/src/analytics/script/integration/component/translate/translate-selector.js @@ -1,5 +1,9 @@ import api from '../../../../api'; +const TRANSLATE = api.internals.ns.selector('translate'); +const COLLAPSE = api.internals.ns.selector('collapse'); + export const TranslateSelector = { - BUTTON: api.internals.ns.selector('translate__btn') + BUTTON: `${TRANSLATE}__btn`, + COLLAPSE: `${TRANSLATE} > ${COLLAPSE}, ${TRANSLATE} > *:not(${TRANSLATE}, ${COLLAPSE}) > ${COLLAPSE}, ${TRANSLATE} > *:not(${TRANSLATE}, ${COLLAPSE}) > *:not(${TRANSLATE}, ${COLLAPSE}) > ${COLLAPSE}` }; diff --git a/src/analytics/script/integration/component/upload/integrate.js b/src/analytics/script/integration/component/upload/integrate.js new file mode 100644 index 000000000..57b4a8858 --- /dev/null +++ b/src/analytics/script/integration/component/upload/integrate.js @@ -0,0 +1,9 @@ +import api from '../../../../api'; +import { UploadSelector } from './upload-selector'; +import { UploadActionee } from './upload-actionee'; + +const integrateUpload = () => { + api.internals.register(UploadSelector.UPLOAD, UploadActionee); +}; + +export default integrateUpload; diff --git a/src/component/accordion/index.js b/src/component/accordion/index.js index e9ca2cbe2..afbeb9493 100644 --- a/src/component/accordion/index.js +++ b/src/component/accordion/index.js @@ -1,8 +1,10 @@ import api from './api.js'; +import { Accordion } from './script/accordion/accordion'; import { AccordionsGroup } from './script/accordion/accordions-group.js'; import { AccordionSelector } from './script/accordion/accordion-selector.js'; api.accordion = { + Accordion: Accordion, AccordionSelector: AccordionSelector, AccordionsGroup: AccordionsGroup }; diff --git a/src/component/accordion/main.js b/src/component/accordion/main.js index ec11c9209..9b663d41f 100644 --- a/src/component/accordion/main.js +++ b/src/component/accordion/main.js @@ -1,5 +1,6 @@ import api from './index.js'; api.internals.register(api.accordion.AccordionSelector.GROUP, api.accordion.AccordionsGroup); +api.internals.register(api.accordion.AccordionSelector.ACCORDION, api.accordion.Accordion); export default api; diff --git a/src/component/accordion/script/accordion/accordion-selector.js b/src/component/accordion/script/accordion/accordion-selector.js index debb40871..02f8e315b 100644 --- a/src/component/accordion/script/accordion/accordion-selector.js +++ b/src/component/accordion/script/accordion/accordion-selector.js @@ -1,6 +1,11 @@ import api from '../../api.js'; +const ACCORDION = api.internals.ns.selector('accordion'); +const COLLAPSE = api.internals.ns.selector('collapse'); + export const AccordionSelector = { GROUP: api.internals.ns.selector('accordions-group'), - COLLAPSE: `${api.internals.ns.selector('accordion')} > ${api.internals.ns.selector('collapse')}` + ACCORDION: ACCORDION, + COLLAPSE: `${ACCORDION} > ${COLLAPSE}, ${ACCORDION} > *:not(${ACCORDION}, ${COLLAPSE}) > ${COLLAPSE}, ${ACCORDION} > *:not(${ACCORDION}, ${COLLAPSE}) > *:not(${ACCORDION}, ${COLLAPSE}) > ${COLLAPSE}`, + BUTTON: `${ACCORDION}__btn` }; diff --git a/src/component/accordion/script/accordion/accordion.js b/src/component/accordion/script/accordion/accordion.js new file mode 100644 index 000000000..97a0a6b9e --- /dev/null +++ b/src/component/accordion/script/accordion/accordion.js @@ -0,0 +1,15 @@ +import api from '../../api.js'; +import { AccordionSelector } from './accordion-selector'; + +class Accordion extends api.core.Instance { + static get instanceClassName () { + return 'Accordion'; + } + + get collapsePrimary () { + const buttons = this.element.children.map(child => child.getInstance('CollapseButton')).filter(button => button !== null && button.hasClass(AccordionSelector.BUTTON)); + return buttons[0]; + } +} + +export { Accordion }; diff --git a/src/component/accordion/script/accordion/accordions-group.js b/src/component/accordion/script/accordion/accordions-group.js index 3fb7d204f..4aa74b32c 100644 --- a/src/component/accordion/script/accordion/accordions-group.js +++ b/src/component/accordion/script/accordion/accordions-group.js @@ -7,7 +7,7 @@ class AccordionsGroup extends api.core.CollapsesGroup { } validate (member) { - return member.node.matches(AccordionSelector.COLLAPSE); + return super.validate(member) && member.node.matches(AccordionSelector.COLLAPSE); } } diff --git a/src/component/breadcrumb/script/breadcrumb/breadcrumb-selector.js b/src/component/breadcrumb/script/breadcrumb/breadcrumb-selector.js index 907ffdbd7..e4f6642cd 100644 --- a/src/component/breadcrumb/script/breadcrumb/breadcrumb-selector.js +++ b/src/component/breadcrumb/script/breadcrumb/breadcrumb-selector.js @@ -1,5 +1,6 @@ import api from '../../api.js'; export const BreadcrumbSelector = { - BREADCRUMB: api.internals.ns.selector('breadcrumb') + BREADCRUMB: api.internals.ns.selector('breadcrumb'), + BUTTON: api.internals.ns.selector('breadcrumb__button') }; diff --git a/src/component/breadcrumb/script/breadcrumb/breadcrumb.js b/src/component/breadcrumb/script/breadcrumb/breadcrumb.js index 4ed91a1cb..f1d6d0935 100644 --- a/src/component/breadcrumb/script/breadcrumb/breadcrumb.js +++ b/src/component/breadcrumb/script/breadcrumb/breadcrumb.js @@ -1,4 +1,5 @@ import api from '../../api.js'; +import { BreadcrumbSelector } from './breadcrumb-selector.js'; class Breadcrumb extends api.core.Instance { constructor () { @@ -72,6 +73,11 @@ class Breadcrumb extends api.core.Instance { if (!link) return; if (document.activeElement !== link) this._focus(); } + + get collapsePrimary () { + const buttons = this.element.children.map(child => child.getInstance('CollapseButton')).filter(button => button !== null && button.hasClass(BreadcrumbSelector.BUTTON)); + return buttons[0]; + } } export { Breadcrumb }; diff --git a/src/component/header/example/sample/header.ejs b/src/component/header/example/sample/header.ejs index c3e457415..45c8fcbde 100755 --- a/src/component/header/example/sample/header.ejs +++ b/src/component/header/example/sample/header.ejs @@ -59,8 +59,8 @@ if (header.links !== undefined || header.search) { : header.search; tools.search.id = header.searchId || uniqueId('search'); - tools.search.modalId = uniqueId('modal'), - tools.search.btnId = uniqueId('button') + tools.search.modalId = tools.search.modalId || uniqueId('modal'), + tools.search.btnId = tools.search.btnId || uniqueId('button') } } @@ -88,8 +88,9 @@ if (header.navigation !== undefined) { if (hasMenu) { hasNavbar = true; - menu.modalId = uniqueId('modal'); - menu.id = uniqueId('button'); + const headerMenu = header.menu || {}; + menu.modalId = headerMenu.modalId || uniqueId('modal'); + menu.id = headerMenu.id || uniqueId('button'); if (header.navigation !== undefined) { menu.navigation.id = header.navigationId || uniqueId('navigation'); diff --git a/src/component/header/script/header/header-modal.js b/src/component/header/script/header/header-modal.js index 3153253cb..b6f528536 100644 --- a/src/component/header/script/header/header-modal.js +++ b/src/component/header/script/header/header-modal.js @@ -15,14 +15,15 @@ class HeaderModal extends api.core.Instance { } resize () { - if (this.isBreakpoint(api.core.Breakpoints.LG)) this.unqualify(); - else this.qualify(); + if (this.isBreakpoint(api.core.Breakpoints.LG)) this.deactivateModal(); + else this.activateModal(); } - qualify () { + activateModal () { this.setAttribute('role', 'dialog'); const modal = this.element.getInstance('Modal'); if (!modal) return; + modal.isEnabled = true; const buttons = modal.buttons; let id = ''; for (const button of buttons) { @@ -33,9 +34,11 @@ class HeaderModal extends api.core.Instance { this.listen('click', this._clickHandling, { capture: true }); } - unqualify () { + deactivateModal () { const modal = this.element.getInstance('Modal'); - if (modal) modal.conceal(); + if (!modal) return; + modal.conceal(); + modal.isEnabled = false; this.removeAttribute('role'); this.removeAttribute('aria-labelledby'); this.unlisten('click', this._clickHandling, { capture: true }); diff --git a/src/component/header/template/ejs/tools.ejs b/src/component/header/template/ejs/tools.ejs index a81ee6f33..9092ec386 100644 --- a/src/component/header/template/ejs/tools.ejs +++ b/src/component/header/template/ejs/tools.ejs @@ -26,7 +26,7 @@ <% if (tools.translate !== undefined) { %> - <%- include ('../../../translate/template/ejs/translate.ejs', {translate: tools.translate}); %> + <%- include('../../../translate/template/ejs/translate.ejs', { translate: tools.translate }); %> <% } %> <% } %> diff --git a/src/component/main.js b/src/component/main.js index b88c60a35..5a627a8f4 100644 --- a/src/component/main.js +++ b/src/component/main.js @@ -11,6 +11,7 @@ import './navigation/main.js'; import './tab/main.js'; import './table/main.js'; import './tag/main.js'; +import './transcription/main.js'; import './tile/main.js'; import './header/main.js'; import './display/main.js'; diff --git a/src/component/modal/script/modal/modal.js b/src/component/modal/script/modal/modal.js index 66eab3b74..5940f7d12 100644 --- a/src/component/modal/script/modal/modal.js +++ b/src/component/modal/script/modal/modal.js @@ -16,7 +16,7 @@ class Modal extends api.core.Disclosure { init () { super.init(); - this.listen('click', this.click.bind(this)); + this.listenClick(); this.listenKey(api.core.KeyCodes.ESCAPE, this.conceal.bind(this, false, false), true, true); } @@ -24,7 +24,7 @@ class Modal extends api.core.Disclosure { return this.element.getDescendantInstances('ModalBody', 'Modal')[0]; } - click (e) { + handleClick (e) { if (e.target === this.node && this.getAttribute(ModalAttribute.CONCEALING_BACKDROP) !== 'false') this.conceal(); } @@ -45,6 +45,10 @@ class Modal extends api.core.Disclosure { if (this.body) this.body.deactivate(); return true; } + + _electPrimary (candidates) { + return null; + } } export { Modal }; diff --git a/src/component/navigation/script/navigation/navigation-item.js b/src/component/navigation/script/navigation/navigation-item.js index d176f589f..a79bdb8a9 100644 --- a/src/component/navigation/script/navigation/navigation-item.js +++ b/src/component/navigation/script/navigation/navigation-item.js @@ -42,6 +42,11 @@ class NavigationItem extends api.core.Instance { if (value) api.internals.dom.addClass(this.element.node, NavigationSelector.ITEM_RIGHT); else api.internals.dom.removeClass(this.element.node, NavigationSelector.ITEM_RIGHT); } + + get collapsePrimary () { + const buttons = this.element.children.map(child => child.getInstance('CollapseButton')).filter(button => button !== null && (button.hasClass(NavigationSelector.BUTTON) || button.hasClass(NavigationSelector.TRANSLATE_BUTTON))); + return buttons[0]; + } } export { NavigationItem }; diff --git a/src/component/navigation/script/navigation/navigation-selector.js b/src/component/navigation/script/navigation/navigation-selector.js index 06d5d44d2..5479d6253 100644 --- a/src/component/navigation/script/navigation/navigation-selector.js +++ b/src/component/navigation/script/navigation/navigation-selector.js @@ -1,9 +1,14 @@ import api from '../../api.js'; +const ITEM = api.internals.ns.selector('nav__item'); +const COLLAPSE = api.internals.ns.selector('collapse'); + export const NavigationSelector = { NAVIGATION: api.internals.ns.selector('nav'), - COLLAPSE: `${api.internals.ns.selector('nav__item')} > ${api.internals.ns.selector('collapse')}`, - ITEM: api.internals.ns.selector('nav__item'), - ITEM_RIGHT: api.internals.ns('nav__item--align-right'), - MENU: api.internals.ns.selector('menu') + COLLAPSE: `${ITEM} > ${COLLAPSE}, ${ITEM} > *:not(${ITEM}, ${COLLAPSE}) > ${COLLAPSE}, ${ITEM} > *:not(${ITEM}, ${COLLAPSE}) > *:not(${ITEM}, ${COLLAPSE}) > ${COLLAPSE}`, + ITEM: ITEM, + ITEM_RIGHT: `${ITEM}--align-right`, + MENU: api.internals.ns.selector('menu'), + BUTTON: api.internals.ns.selector('nav__btn'), + TRANSLATE_BUTTON: api.internals.ns.selector('translate__btn') }; diff --git a/src/component/navigation/script/navigation/navigation.js b/src/component/navigation/script/navigation/navigation.js index 378fe7b72..166dc6c8f 100644 --- a/src/component/navigation/script/navigation/navigation.js +++ b/src/component/navigation/script/navigation/navigation.js @@ -13,11 +13,11 @@ class Navigation extends api.core.CollapsesGroup { this.out = false; this.listen('focusout', this.focusOutHandler.bind(this)); this.listen('mousedown', this.mouseDownHandler.bind(this)); - this.listen('click', this.clickHandler.bind(this), { capture: true }); + this.listenClick({ capture: true }); } validate (member) { - return member.element.node.matches(NavigationSelector.COLLAPSE); + return super.validate(member) && member.element.node.matches(NavigationSelector.COLLAPSE); } mouseDownHandler (e) { @@ -70,7 +70,7 @@ class Navigation extends api.core.CollapsesGroup { get index () { return super.index; } set index (value) { - if (value === -1 && this.current !== null && this.current.hasFocus) this.current.focus(); + if (value === -1 && this.current && this.current.hasFocus) this.current.focus(); super.index = value; } } diff --git a/src/component/navigation/style/scheme/_default.scss b/src/component/navigation/style/scheme/_default.scss index 494359118..6d19d4fad 100644 --- a/src/component/navigation/style/scheme/_default.scss +++ b/src/component/navigation/style/scheme/_default.scss @@ -20,7 +20,7 @@ } &__btn { - &[aria-expanded="true"] { + &[aria-expanded="true"]:not(:disabled) { @include respond-from(lg) { @include color.text(active blue-france, (legacy: $legacy)); @include color.background(open blue-france, (legacy: $legacy)); diff --git a/src/component/password/script/password/password-toggle.js b/src/component/password/script/password/password-toggle.js index 9be0164ff..3bbe8072d 100644 --- a/src/component/password/script/password/password-toggle.js +++ b/src/component/password/script/password/password-toggle.js @@ -7,7 +7,7 @@ class PasswordToggle extends api.core.Instance { } init () { - this.listen('click', this.toggle.bind(this)); + this.listenClick(); this.ascend(PasswordEmission.ADJUST, this.width); this.isSwappingFont = true; this._isChecked = this.isChecked; @@ -27,7 +27,7 @@ class PasswordToggle extends api.core.Instance { this.ascend(PasswordEmission.TOGGLE, value); } - toggle () { + handleClick () { this.isChecked = !this._isChecked; } diff --git a/src/component/sidemenu/example/sample/sidemenu.ejs b/src/component/sidemenu/example/sample/sidemenu.ejs index 1aa1e1e82..cd75fb5db 100755 --- a/src/component/sidemenu/example/sample/sidemenu.ejs +++ b/src/component/sidemenu/example/sample/sidemenu.ejs @@ -53,6 +53,7 @@ function menu(level, active, collapsable) { let data = { items: items(0), title: sidemenu.title || 'Titre de rubrique', + titleId: uniqueId('sidemenu-title'), modifier: sidemenu.modifier, collapseId: uniqueId('sidemenu') } diff --git a/src/component/sidemenu/index.js b/src/component/sidemenu/index.js index 83a08af61..c6b8a595b 100644 --- a/src/component/sidemenu/index.js +++ b/src/component/sidemenu/index.js @@ -1,9 +1,11 @@ import api from './api.js'; import { SidemenuList } from './script/sidemenu/sidemenu-list.js'; import { SidemenuSelector } from './script/sidemenu/sidemenu-selector.js'; +import { SidemenuItem } from './script/sidemenu/sidemenu-item'; api.sidemenu = { SidemenuList: SidemenuList, + SidemenuItem: SidemenuItem, SidemenuSelector: SidemenuSelector }; diff --git a/src/component/sidemenu/main.js b/src/component/sidemenu/main.js index 284203295..09dba108a 100644 --- a/src/component/sidemenu/main.js +++ b/src/component/sidemenu/main.js @@ -1,5 +1,6 @@ import api from './index.js'; api.internals.register(api.sidemenu.SidemenuSelector.LIST, api.sidemenu.SidemenuList); +api.internals.register(api.sidemenu.SidemenuSelector.ITEM, api.sidemenu.SidemenuItem); export default api; diff --git a/src/component/sidemenu/script/sidemenu/sidemenu-item.js b/src/component/sidemenu/script/sidemenu/sidemenu-item.js new file mode 100644 index 000000000..f5dce703e --- /dev/null +++ b/src/component/sidemenu/script/sidemenu/sidemenu-item.js @@ -0,0 +1,15 @@ +import api from '../../api.js'; +import { SidemenuSelector } from './sidemenu-selector.js'; + +class SidemenuItem extends api.core.Instance { + static get instanceClassName () { + return 'SidemenuItem'; + } + + get collapsePrimary () { + const buttons = this.element.children.map(child => child.getInstance('CollapseButton')).filter(button => button !== null && button.hasClass(SidemenuSelector.BUTTON)); + return buttons[0]; + } +} + +export { SidemenuItem }; diff --git a/src/component/sidemenu/script/sidemenu/sidemenu-list.js b/src/component/sidemenu/script/sidemenu/sidemenu-list.js index 8770fab62..827d9bc51 100644 --- a/src/component/sidemenu/script/sidemenu/sidemenu-list.js +++ b/src/component/sidemenu/script/sidemenu/sidemenu-list.js @@ -7,7 +7,7 @@ class SidemenuList extends api.core.CollapsesGroup { } validate (member) { - return member.node.matches(SidemenuSelector.COLLAPSE); + return super.validate(member) && member.node.matches(SidemenuSelector.COLLAPSE); } } diff --git a/src/component/sidemenu/script/sidemenu/sidemenu-selector.js b/src/component/sidemenu/script/sidemenu/sidemenu-selector.js index c2a1a496d..40af3f0d9 100644 --- a/src/component/sidemenu/script/sidemenu/sidemenu-selector.js +++ b/src/component/sidemenu/script/sidemenu/sidemenu-selector.js @@ -1,6 +1,11 @@ import api from '../../api.js'; +const ITEM = api.internals.ns.selector('sidemenu__item'); +const COLLAPSE = api.internals.ns.selector('collapse'); + export const SidemenuSelector = { LIST: api.internals.ns.selector('sidemenu__list'), - COLLAPSE: `${api.internals.ns.selector('sidemenu__item')} > ${api.internals.ns.selector('collapse')}` + COLLAPSE: `${ITEM} > ${COLLAPSE}, ${ITEM} > *:not(${ITEM}, ${COLLAPSE}) > ${COLLAPSE}, ${ITEM} > *:not(${ITEM}, ${COLLAPSE}) > *:not(${ITEM}, ${COLLAPSE}) > ${COLLAPSE}`, + ITEM: api.internals.ns.selector('sidemenu__item'), + BUTTON: api.internals.ns.selector('sidemenu__btn') }; diff --git a/src/component/sidemenu/template/ejs/sidemenu.ejs b/src/component/sidemenu/template/ejs/sidemenu.ejs index 3059f7e78..4fda00596 100644 --- a/src/component/sidemenu/template/ejs/sidemenu.ejs +++ b/src/component/sidemenu/template/ejs/sidemenu.ejs @@ -13,11 +13,11 @@ <% let sidemenu = locals.sidemenu || {}; %> <% eval(include('../../../../core/index.ejs')); %> -