@ebrains/components 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/clone-846acfdd.js +5 -0
- package/dist/cjs/color-primary-palette_6.cjs.entry.js +15 -15
- package/dist/cjs/components-section.cjs.entry.js +4 -6
- package/dist/cjs/components.cjs.js +2 -2
- package/dist/cjs/correct-use-of-colors.cjs.entry.js +2 -2
- package/dist/cjs/docs-palettes.cjs.entry.js +2 -2
- package/dist/cjs/docs-tokens.cjs.entry.js +2 -2
- package/dist/cjs/download-9d17d025.js +20 -0
- package/dist/cjs/edit-ff5b84d8.js +5 -0
- package/dist/cjs/{eds-avatar_26.cjs.entry.js → eds-accordion_34.cjs.entry.js} +3597 -203
- package/dist/cjs/eds-app-root.cjs.entry.js +2 -2
- package/dist/cjs/eds-card-desc_2.cjs.entry.js +3 -3
- package/dist/cjs/eds-card-generic.cjs.entry.js +1 -1
- package/dist/cjs/eds-card-project.cjs.entry.js +2 -2
- package/dist/cjs/eds-card-section.cjs.entry.js +1 -1
- package/dist/cjs/eds-card-tags.cjs.entry.js +2 -2
- package/dist/cjs/eds-card-tool.cjs.entry.js +2 -2
- package/dist/cjs/eds-cookies-preference.cjs.entry.js +2 -2
- package/dist/cjs/eds-feedback.cjs.entry.js +2 -2
- package/dist/cjs/eds-footer.cjs.entry.js +9 -5
- package/dist/cjs/eds-frame.cjs.entry.js +2 -2
- package/dist/cjs/eds-fullscreen-menu.cjs.entry.js +9 -4
- package/dist/cjs/eds-gauge.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-arrow-diagonal.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-arrow-right.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-bin.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-bluesky.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-bookmark.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-chevron-down.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-chevron-left.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-chevron-right.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-chevron-up.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-clone.cjs.entry.js +18 -0
- package/dist/cjs/eds-icon-close.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-copy.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-download.cjs.entry.js +18 -0
- package/dist/cjs/eds-icon-draft.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-edit.cjs.entry.js +3 -3
- package/dist/cjs/eds-icon-eu.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-external.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-facebook.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-gitlab.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-linkedin.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-loader.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-mastodon.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-menu.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-minus.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-more.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-paper.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-plus.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-portal.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-private.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-public.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-search.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-star.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-start.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-success.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-thumbs-down.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-thumbs-up.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-tutorial.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-twitter.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-unknown.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-updown.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-user.cjs.entry.js +2 -2
- package/dist/cjs/eds-icon-view.cjs.entry.js +18 -0
- package/dist/cjs/eds-icon-youtube.cjs.entry.js +2 -2
- package/dist/cjs/eds-modal.cjs.entry.js +3 -3
- package/dist/cjs/eds-pie.cjs.entry.js +1 -1
- package/dist/cjs/eds-progress-bar.cjs.entry.js +2 -2
- package/dist/cjs/eds-section-core_2.cjs.entry.js +4 -4
- package/dist/cjs/eds-social-networks.cjs.entry.js +3 -5
- package/dist/cjs/eds-spinner.cjs.entry.js +2 -2
- package/dist/cjs/eds-splash-screen.cjs.entry.js +1 -1
- package/dist/cjs/eds-timeline.cjs.entry.js +2 -2
- package/dist/cjs/eds-toast-manager.cjs.entry.js +2 -2
- package/dist/cjs/eds-trl.cjs.entry.js +2 -2
- package/dist/cjs/incorrect-use-of-colors.cjs.entry.js +2 -2
- package/dist/cjs/{index-88c8039f.js → index-0249a32e.js} +19 -32
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/logo-space.cjs.entry.js +2 -2
- package/dist/cjs/logo-variations-horizontal_2.cjs.entry.js +3 -3
- package/dist/cjs/logo-variations-tabs.cjs.entry.js +2 -2
- package/dist/cjs/logo-wrong-usage.cjs.entry.js +2 -2
- package/dist/cjs/svg-repository.cjs.entry.js +10 -22
- package/dist/cjs/token-list_3.cjs.entry.js +4 -4
- package/dist/cjs/token-ratios.cjs.entry.js +2 -2
- package/dist/cjs/token-spacing.cjs.entry.js +2 -2
- package/dist/cjs/token-typography.cjs.entry.js +2 -2
- package/dist/cjs/view-80d5c6c8.js +5 -0
- package/dist/collection/collection-manifest.json +4 -0
- package/dist/collection/components/eds-accordion/eds-accordion.js +1 -1
- package/dist/collection/components/eds-alert/eds-alert.js +30 -3
- package/dist/collection/components/eds-avatar/eds-avatar.js +1 -1
- package/dist/collection/components/eds-block-break/eds-block-break.js +1 -1
- package/dist/collection/components/eds-breadcrump/eds-breadcrump.js +1 -1
- package/dist/collection/components/eds-button/eds-button.css +4 -0
- package/dist/collection/components/eds-button/eds-button.js +19 -8
- package/dist/collection/components/eds-cards/eds-card-composer/eds-card-desc/eds-card-desc.js +1 -1
- package/dist/collection/components/eds-cards/eds-card-composer/eds-card-tags/eds-card-tags.js +1 -1
- package/dist/collection/components/eds-cards/eds-card-composer/eds-card-title/eds-card-title.js +1 -1
- package/dist/collection/components/eds-cards/eds-card-project/eds-card-project.js +1 -1
- package/dist/collection/components/eds-cards/eds-card-tool/eds-card-tool.js +1 -1
- package/dist/collection/components/eds-charts/eds-gauge/eds-gauge.js +1 -1
- package/dist/collection/components/eds-code-block/eds-code-block.js +1 -1
- package/dist/collection/components/eds-dropdown/eds-dropdown.js +2 -2
- package/dist/collection/components/eds-icons/chevron/eds-icon-chevron-down/eds-icon-chevron-down.js +1 -1
- package/dist/collection/components/eds-icons/chevron/eds-icon-chevron-left/eds-icon-chevron-left.js +1 -1
- package/dist/collection/components/eds-icons/chevron/eds-icon-chevron-right/eds-icon-chevron-right.js +1 -1
- package/dist/collection/components/eds-icons/chevron/eds-icon-chevron-up/eds-icon-chevron-up.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-arrow-diagonal/eds-icon-arrow-diagonal.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-arrow-right/eds-icon-arrow-right.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-bin/eds-icon-bin.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-bookmark/eds-icon-bookmark.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-clone/eds-icon-clone.js +36 -0
- package/dist/collection/components/eds-icons/eds-icon-close/eds-icon-close.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-copy/eds-icon-copy.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-download/eds-icon-download.js +36 -0
- package/dist/collection/components/eds-icons/eds-icon-draft/eds-icon-draft.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-edit/eds-icon-edit.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-eu/eds-icon-eu.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-external/eds-icon-external.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-gitlab/eds-icon-gitlab.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-loader/eds-icon-loader.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-menu/eds-icon-menu.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-minus/eds-icon-minus.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-more/eds-icon-more.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-paper/eds-icon-paper.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-plus/eds-icon-plus.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-portal/eds-icon-portal.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-private/eds-icon-private.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-public/eds-icon-public.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-search/eds-icon-search.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-star/eds-icon-star.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-start/eds-icon-start.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-success/eds-icon-success.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-thumbs-down/eds-icon-thumbs-down.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-thumbs-up/eds-icon-thumbs-up.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-tutorial/eds-icon-tutorial.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-unknown/eds-icon-unknown.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-updown/eds-icon-updown.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-user/eds-icon-user.js +1 -1
- package/dist/collection/components/eds-icons/eds-icon-view/eds-icon-view.js +36 -0
- package/dist/collection/components/eds-icons/social/eds-icon-bluesky/eds-icon-bluesky.js +1 -1
- package/dist/collection/components/eds-icons/social/eds-icon-facebook/eds-icon-facebook.js +1 -1
- package/dist/collection/components/eds-icons/social/eds-icon-linkedin/eds-icon-linkedin.js +1 -1
- package/dist/collection/components/eds-icons/social/eds-icon-mastodon/eds-icon-mastodon.js +1 -1
- package/dist/collection/components/eds-icons/social/eds-icon-twitter/eds-icon-twitter.js +1 -1
- package/dist/collection/components/eds-icons/social/eds-icon-youtube/eds-icon-youtube.js +1 -1
- package/dist/collection/components/eds-img/eds-img.js +2 -2
- package/dist/collection/components/eds-input-elements/eds-input/eds-input.js +2 -2
- package/dist/collection/components/eds-input-elements/eds-input-footer/eds-input-footer.js +1 -1
- package/dist/collection/components/eds-input-elements/eds-input-label/eds-input-label.js +1 -1
- package/dist/collection/components/eds-input-elements/eds-input-range/eds-input-range.js +1 -1
- package/dist/collection/components/eds-input-elements/eds-input-search/eds-input-search.js +1 -1
- package/dist/collection/components/eds-input-elements/eds-input-select/eds-input-select.js +2 -2
- package/dist/collection/components/eds-input-field/eds-input-field.js +3 -2
- package/dist/collection/components/eds-link/eds-link.js +27 -7
- package/dist/collection/components/eds-link/eds-link.stories.js +3 -1
- package/dist/collection/components/eds-logo/eds-logo.js +1 -1
- package/dist/collection/components/eds-modal/eds-modal.js +2 -2
- package/dist/collection/components/eds-nps/eds-npm.stories.js +36 -0
- package/dist/collection/components/eds-nps/eds-nps.css +73 -0
- package/dist/collection/components/eds-nps/eds-nps.js +163 -0
- package/dist/collection/components/eds-pagination/eds-pagination.css +16 -0
- package/dist/collection/components/eds-pagination/eds-pagination.js +131 -51
- package/dist/collection/components/eds-progress-bar/eds-progress-bar.js +1 -1
- package/dist/collection/components/eds-rating/eds-rating.js +25 -3
- package/dist/collection/components/eds-section/eds-section-core/eds-section-core.js +1 -1
- package/dist/collection/components/eds-section/eds-section-heading/eds-section-heading.js +2 -2
- package/dist/collection/components/eds-spinner/eds-spinner.js +1 -1
- package/dist/collection/components/eds-switch/eds-switch.css +15 -5
- package/dist/collection/components/eds-switch/eds-switch.js +26 -4
- package/dist/collection/components/eds-table/eds-table.css +4 -0
- package/dist/collection/components/eds-table/eds-table.js +42 -39
- package/dist/collection/components/eds-table/eds-table.stories.js +1 -1
- package/dist/collection/components/eds-tag/eds-tag.js +1 -1
- package/dist/collection/components/eds-timeline/eds-timeline.js +1 -1
- package/dist/collection/components/eds-tooltip/eds-tooltip.css +5 -0
- package/dist/collection/components/eds-tooltip/eds-tooltip.js +2 -2
- package/dist/collection/components/eds-trl/eds-trl.js +1 -1
- package/dist/collection/eds-docs-ui/colors/color-palette/primary.js +1 -1
- package/dist/collection/eds-docs-ui/colors/color-palette/secondary.js +1 -1
- package/dist/collection/eds-docs-ui/colors/color-palette/support.js +1 -1
- package/dist/collection/eds-docs-ui/colors/gradient-palette/primary.js +1 -1
- package/dist/collection/eds-docs-ui/colors/gradient-palette/secondary.js +7 -7
- package/dist/collection/eds-docs-ui/colors/gradient-palette/support.js +3 -3
- package/dist/collection/eds-docs-ui/colors/use-of-colors/correct-use-of-colors.js +1 -1
- package/dist/collection/eds-docs-ui/colors/use-of-colors/incorrect-use-of-colors.js +1 -1
- package/dist/collection/eds-docs-ui/components-section/components-section.js +1 -1
- package/dist/collection/eds-docs-ui/components-section/functional/overview.js +1 -1
- package/dist/collection/eds-docs-ui/design-tokens/docs-tokens/docs-tokens.js +1 -1
- package/dist/collection/eds-docs-ui/design-tokens/token-list/token-list.js +1 -1
- package/dist/collection/eds-docs-ui/design-tokens/token-radii/token-radii.js +1 -1
- package/dist/collection/eds-docs-ui/design-tokens/token-ratios/token-ratios.js +1 -1
- package/dist/collection/eds-docs-ui/design-tokens/token-shadows/token-shadows.js +1 -1
- package/dist/collection/eds-docs-ui/design-tokens/token-spacing/token-spacing.js +1 -1
- package/dist/collection/eds-docs-ui/design-tokens/token-typography/token-typography.js +1 -1
- package/dist/collection/eds-docs-ui/docs-palettes/docs-palettes.js +1 -1
- package/dist/collection/eds-docs-ui/logo/logo-space/logo-space.js +1 -1
- package/dist/collection/eds-docs-ui/logo/logo-variations/horizontal/logo-variations-horizontal.js +1 -1
- package/dist/collection/eds-docs-ui/logo/logo-variations/vertical/logo-variations-vertical.js +1 -1
- package/dist/collection/eds-docs-ui/logo/logo-variations-tabs/logo-variations.js +1 -1
- package/dist/collection/eds-docs-ui/logo/logo-wrong-usage/logo-wrong-usage.js +1 -1
- package/dist/collection/eds-docs-ui/svg-repository/svg-repository.js +1 -1
- package/dist/collection/shared-ui/eds-cookies-preference/eds-cookies-preference.js +1 -1
- package/dist/collection/shared-ui/eds-feedback/eds-feedback.js +1 -1
- package/dist/collection/shared-ui/eds-footer/eds-footer.js +13 -6
- package/dist/collection/shared-ui/eds-form/eds-form.css +72 -0
- package/dist/collection/shared-ui/eds-form/eds-form.js +110 -5
- package/dist/collection/shared-ui/eds-form/eds-form.stories.js +33 -4
- package/dist/collection/shared-ui/eds-frame/eds-frame.js +1 -1
- package/dist/collection/shared-ui/eds-fullscreen-menu/eds-fullscreen-menu.js +50 -16
- package/dist/collection/shared-ui/eds-header/eds-header.js +1 -1
- package/dist/collection/shared-ui/eds-matomo-notice/eds-matomo-notice.js +20 -8
- package/dist/collection/shared-ui/eds-social-networks/eds-social-networks.css +0 -20
- package/dist/collection/shared-ui/eds-social-networks/eds-social-networks.js +1 -3
- package/dist/collection/shared-ui/eds-social-networks/eds-social-networks.stories.js +6 -7
- package/dist/collection/shared-ui/eds-steps/eds-steps.css +136 -92
- package/dist/collection/shared-ui/eds-steps/eds-steps.js +234 -40
- package/dist/collection/shared-ui/eds-steps/eds-steps.stories.js +71 -7
- package/dist/collection/shared-ui/eds-steps-v2/eds-steps-v2.css +44 -33
- package/dist/collection/shared-ui/eds-steps-v2/eds-steps-v2.js +195 -19
- package/dist/collection/shared-ui/eds-steps-v2/eds-steps-v2.stories.js +65 -4
- package/dist/collection/shared-ui/eds-tabs/eds-tabs.css +26 -5
- package/dist/collection/shared-ui/eds-tabs/eds-tabs.js +89 -31
- package/dist/collection/shared-ui/eds-toast-manager/eds-toast-manager.js +1 -1
- package/dist/collection/shared-ui/eds-user/eds-user.js +35 -1
- package/dist/collection/shared-ui/examples/eds-app-root/eds-app-root.js +1 -1
- package/dist/collection/utils/eds-form/formValidators.js +34 -0
- package/dist/components/clone.js +3 -0
- package/dist/components/components-section.js +3 -5
- package/dist/components/components.css +7 -12
- package/dist/components/components.esm.js +1 -1
- package/dist/components/correct-use-of-colors.js +1 -1
- package/dist/components/docs-palettes.js +1 -1
- package/dist/components/docs-tokens.js +1 -1
- package/dist/components/download.js +18 -0
- package/dist/components/edit.js +1 -1
- package/dist/components/eds-accordion2.js +1 -1
- package/dist/components/eds-alert2.js +21 -5
- package/dist/components/eds-app-root.js +1 -1
- package/dist/components/eds-avatar2.js +1 -1
- package/dist/components/eds-block-break2.js +1 -1
- package/dist/components/eds-breadcrumb.js +1 -1
- package/dist/components/eds-button2.js +21 -10
- package/dist/components/eds-card-desc2.js +1 -1
- package/dist/components/eds-card-project.js +1 -1
- package/dist/components/eds-card-tags.js +1 -1
- package/dist/components/eds-card-title2.js +1 -1
- package/dist/components/eds-card-tool.js +1 -1
- package/dist/components/eds-code-block2.js +1 -1
- package/dist/components/eds-cookies-preference.js +1 -1
- package/dist/components/eds-dropdown2.js +2 -2
- package/dist/components/eds-feedback.js +1 -1
- package/dist/components/eds-footer2.js +8 -4
- package/dist/components/eds-form.js +100 -24
- package/dist/components/eds-frame.js +1 -1
- package/dist/components/eds-fullscreen-menu.js +8 -3
- package/dist/components/eds-gauge.js +1 -1
- package/dist/components/eds-header.js +1 -1
- package/dist/components/eds-icon-arrow-diagonal.js +1 -1
- package/dist/components/eds-icon-arrow-right.js +1 -1
- package/dist/components/eds-icon-bin.js +1 -1
- package/dist/components/eds-icon-bluesky.js +1 -1
- package/dist/components/eds-icon-bookmark.js +1 -1
- package/dist/components/eds-icon-chevron-down.js +1 -1
- package/dist/components/eds-icon-chevron-left.js +1 -1
- package/dist/components/eds-icon-chevron-right.js +1 -1
- package/dist/components/eds-icon-chevron-up.js +1 -1
- package/dist/components/eds-icon-clone.d.ts +11 -0
- package/dist/components/eds-icon-clone.js +33 -0
- package/dist/components/eds-icon-close.js +1 -1
- package/dist/components/eds-icon-copy.js +1 -1
- package/dist/components/eds-icon-download.d.ts +11 -0
- package/dist/components/eds-icon-download.js +33 -0
- package/dist/components/eds-icon-draft.js +1 -1
- package/dist/components/eds-icon-edit.js +1 -1
- package/dist/components/eds-icon-eu.js +1 -1
- package/dist/components/eds-icon-external.js +1 -1
- package/dist/components/eds-icon-facebook.js +1 -1
- package/dist/components/eds-icon-gitlab.js +1 -1
- package/dist/components/eds-icon-linkedin.js +1 -1
- package/dist/components/eds-icon-loader.js +1 -1
- package/dist/components/eds-icon-mastodon.js +1 -1
- package/dist/components/eds-icon-menu.js +1 -1
- package/dist/components/eds-icon-minus.js +1 -1
- package/dist/components/eds-icon-more.js +1 -1
- package/dist/components/eds-icon-paper.js +1 -1
- package/dist/components/eds-icon-plus.js +1 -1
- package/dist/components/eds-icon-portal.js +1 -1
- package/dist/components/eds-icon-private.js +1 -1
- package/dist/components/eds-icon-public.js +1 -1
- package/dist/components/eds-icon-search.js +1 -1
- package/dist/components/eds-icon-star.js +1 -1
- package/dist/components/eds-icon-start.js +1 -1
- package/dist/components/eds-icon-success.js +1 -1
- package/dist/components/eds-icon-thumbs-down.js +1 -1
- package/dist/components/eds-icon-thumbs-up.js +1 -1
- package/dist/components/eds-icon-tutorial.js +1 -1
- package/dist/components/eds-icon-twitter.js +1 -1
- package/dist/components/eds-icon-unknown.js +1 -1
- package/dist/components/eds-icon-updown.js +1 -1
- package/dist/components/eds-icon-user.js +1 -1
- package/dist/components/eds-icon-view.d.ts +11 -0
- package/dist/components/eds-icon-view.js +33 -0
- package/dist/components/eds-icon-youtube.js +1 -1
- package/dist/components/eds-img2.js +2 -2
- package/dist/components/eds-input-field2.js +4 -3
- package/dist/components/eds-input-footer2.js +1 -1
- package/dist/components/eds-input-label2.js +1 -1
- package/dist/components/eds-input-range2.js +1 -1
- package/dist/components/eds-input-search2.js +1 -1
- package/dist/components/eds-input-select2.js +2 -2
- package/dist/components/eds-input2.js +2 -2
- package/dist/components/eds-link2.js +27 -7
- package/dist/components/eds-logo2.js +1 -1
- package/dist/components/eds-modal.js +2 -2
- package/dist/components/eds-nps.d.ts +11 -0
- package/dist/components/eds-nps.js +6 -0
- package/dist/components/eds-nps2.js +120 -0
- package/dist/components/eds-pagination2.js +120 -53
- package/dist/components/eds-progress-bar2.js +1 -1
- package/dist/components/eds-rating2.js +25 -3
- package/dist/components/eds-section-core2.js +1 -1
- package/dist/components/eds-section-heading2.js +2 -2
- package/dist/components/eds-social-networks2.js +2 -4
- package/dist/components/eds-spinner2.js +1 -1
- package/dist/components/eds-steps-v2.js +35 -13
- package/dist/components/eds-steps2.js +54 -35
- package/dist/components/eds-switch.js +27 -5
- package/dist/components/eds-table2.js +74 -41
- package/dist/components/eds-tabs.js +90 -32
- package/dist/components/eds-tag2.js +1 -1
- package/dist/components/eds-timeline.js +1 -1
- package/dist/components/eds-toast-manager.js +1 -1
- package/dist/components/eds-tooltip.js +1 -50
- package/dist/components/eds-tooltip2.js +52 -0
- package/dist/components/eds-trl.js +37 -25
- package/dist/components/eds-user.js +12 -10
- package/dist/components/incorrect-use-of-colors.js +9 -3
- package/dist/components/logo-space.js +35 -23
- package/dist/components/logo-variations-horizontal2.js +1 -1
- package/dist/components/logo-variations-tabs.js +1 -1
- package/dist/components/logo-variations-vertical2.js +1 -1
- package/dist/components/logo-wrong-usage.js +1 -1
- package/dist/components/p-0452fe52.entry.js +1 -0
- package/dist/components/p-04f288b1.entry.js +1 -0
- package/dist/components/p-06951aa3.entry.js +1 -0
- package/dist/components/p-0da7d1c9.js +1 -0
- package/dist/components/p-101392d0.entry.js +1 -0
- package/dist/components/{p-ed4d9bf5.entry.js → p-171f8e6b.entry.js} +1 -1
- package/dist/components/p-19e69c03.entry.js +1 -0
- package/dist/components/{p-e2e7250a.entry.js → p-1b032aa8.entry.js} +1 -1
- package/dist/components/{p-adbd0d7b.entry.js → p-265150a1.entry.js} +1 -1
- package/dist/components/p-27c4a06e.js +1 -0
- package/dist/components/p-28ec52a7.entry.js +1 -0
- package/dist/components/p-2f712656.entry.js +1 -0
- package/dist/components/p-3097c321.entry.js +1 -0
- package/dist/components/p-36db7db0.entry.js +1 -0
- package/dist/components/p-38b0ea8d.entry.js +1 -0
- package/dist/components/p-3b551ade.entry.js +9 -0
- package/dist/components/p-3fa4a703.entry.js +1 -0
- package/dist/components/p-3fa54526.entry.js +1 -0
- package/dist/components/p-42680319.entry.js +1 -0
- package/dist/components/{p-6d3b5818.entry.js → p-4c618a35.entry.js} +1 -1
- package/dist/components/p-4d207d0e.entry.js +1 -0
- package/dist/components/p-4db384d9.entry.js +1 -0
- package/dist/components/p-4eb2cf7f.js +1 -0
- package/dist/components/{p-70e8e66f.entry.js → p-50d7eed9.entry.js} +1 -1
- package/dist/components/p-5367bb59.entry.js +1 -0
- package/dist/components/{p-356846cd.entry.js → p-5479e43b.entry.js} +1 -1
- package/dist/components/{p-3e183368.entry.js → p-58c8c0d7.entry.js} +1 -1
- package/dist/components/p-5a88cdc2.entry.js +1 -0
- package/dist/components/p-5b574bb2.entry.js +1 -0
- package/dist/components/p-5ec9fc29.entry.js +1 -0
- package/dist/components/p-5f350866.entry.js +1 -0
- package/dist/components/p-5ff10b6f.entry.js +1 -0
- package/dist/components/p-6420754e.entry.js +1 -0
- package/dist/components/{p-b073d78f.entry.js → p-64b7a6fc.entry.js} +1 -1
- package/dist/components/{p-02d94d2d.entry.js → p-6614881d.entry.js} +1 -1
- package/dist/components/p-68a2cd95.entry.js +1 -0
- package/dist/components/{p-f6ca2aa6.entry.js → p-6a2d1e11.entry.js} +1 -1
- package/dist/components/p-6b988c76.entry.js +1 -0
- package/dist/components/p-7032a73b.entry.js +1 -0
- package/dist/components/p-7272628d.entry.js +1 -0
- package/dist/components/p-78c348e2.entry.js +1 -0
- package/dist/components/{p-8c0b0121.entry.js → p-79afd8aa.entry.js} +1 -1
- package/dist/components/p-7a5623b5.entry.js +1 -0
- package/dist/components/p-7fa46b01.entry.js +1 -0
- package/dist/components/p-86eff0cb.entry.js +1 -0
- package/dist/components/p-870001ee.entry.js +1 -0
- package/dist/components/p-88eeaeca.entry.js +1 -0
- package/dist/components/p-8b7910d2.entry.js +1 -0
- package/dist/components/p-8cf98230.entry.js +1 -0
- package/dist/components/{p-e35e156d.entry.js → p-8eced026.entry.js} +1 -1
- package/dist/components/{p-0687532c.entry.js → p-8edd07db.entry.js} +1 -1
- package/dist/components/p-8ef68d8a.entry.js +1 -0
- package/dist/components/p-8fb1eb43.entry.js +1 -0
- package/dist/components/p-9261d27c.entry.js +1 -0
- package/dist/components/{p-9d18d7b1.entry.js → p-94a223ec.entry.js} +1 -1
- package/dist/components/{p-1f5c19b9.entry.js → p-9c1c5e8d.entry.js} +1 -1
- package/dist/components/p-9cb14b1f.entry.js +1 -0
- package/dist/components/{p-024789cc.entry.js → p-a5fd4fc9.entry.js} +1 -1
- package/dist/components/p-a6586448.entry.js +1 -0
- package/dist/components/p-ad7d603b.entry.js +1 -0
- package/dist/components/p-b24ef7f7.entry.js +1 -0
- package/dist/components/{p-66f4cdd9.entry.js → p-b31babda.entry.js} +1 -1
- package/dist/components/p-baa2df0b.entry.js +1 -0
- package/dist/components/p-bfe9d934.entry.js +1 -0
- package/dist/components/p-c1943b8f.entry.js +1 -0
- package/dist/components/{p-b3a40663.entry.js → p-c66f4dd8.entry.js} +1 -1
- package/dist/components/{p-4e473b4e.entry.js → p-d1927da7.entry.js} +1 -1
- package/dist/components/{p-543f2347.entry.js → p-d2e485a1.entry.js} +1 -1
- package/dist/components/{p-794f11e7.entry.js → p-d3391236.entry.js} +1 -1
- package/dist/components/p-da0e9a75.entry.js +1 -0
- package/dist/components/p-dbe11048.entry.js +1 -0
- package/dist/components/{p-773a119a.entry.js → p-dd28ab38.entry.js} +1 -1
- package/dist/components/p-e42ac312.entry.js +1 -0
- package/dist/components/p-e6c3f38c.entry.js +1 -0
- package/dist/components/p-e7c37e5b.entry.js +1 -0
- package/dist/components/p-e8374410.entry.js +1 -0
- package/dist/components/p-e90da4ba.entry.js +1 -0
- package/dist/components/p-e9cd3c4b.entry.js +1 -0
- package/dist/components/p-ebd59113.entry.js +1 -0
- package/dist/components/{p-28ae3f3a.js → p-efbc374c.js} +2 -2
- package/dist/components/p-f092b706.entry.js +1 -0
- package/dist/components/p-f29e7506.entry.js +1 -0
- package/dist/components/p-f2abe4d8.js +1 -0
- package/dist/components/p-f40dd50d.entry.js +1 -0
- package/dist/components/p-fc099d59.entry.js +1 -0
- package/dist/components/p-fda3da92.entry.js +1 -0
- package/dist/components/{p-2839899a.entry.js → p-ff902c98.entry.js} +1 -1
- package/dist/components/primary.js +1 -1
- package/dist/components/primary2.js +1 -1
- package/dist/components/secondary.js +1 -1
- package/dist/components/secondary2.js +7 -7
- package/dist/components/support.js +1 -1
- package/dist/components/support2.js +3 -3
- package/dist/components/svg-repository.js +41 -41
- package/dist/components/token-list2.js +1 -1
- package/dist/components/token-radii2.js +1 -1
- package/dist/components/token-ratios.js +1 -1
- package/dist/components/token-shadows2.js +1 -1
- package/dist/components/token-spacing.js +1 -1
- package/dist/components/token-typography.js +1 -1
- package/dist/components/view.js +3 -0
- package/dist/esm/clone-dab56639.js +3 -0
- package/dist/esm/color-primary-palette_6.entry.js +15 -15
- package/dist/esm/components-section.entry.js +4 -6
- package/dist/esm/components.js +3 -3
- package/dist/esm/correct-use-of-colors.entry.js +2 -2
- package/dist/esm/docs-palettes.entry.js +2 -2
- package/dist/esm/docs-tokens.entry.js +2 -2
- package/dist/esm/download-47746956.js +18 -0
- package/dist/esm/edit-3893a517.js +3 -0
- package/dist/esm/{eds-avatar_26.entry.js → eds-accordion_34.entry.js} +3591 -205
- package/dist/esm/eds-app-root.entry.js +2 -2
- package/dist/esm/eds-card-desc_2.entry.js +3 -3
- package/dist/esm/eds-card-generic.entry.js +1 -1
- package/dist/esm/eds-card-project.entry.js +2 -2
- package/dist/esm/eds-card-section.entry.js +1 -1
- package/dist/esm/eds-card-tags.entry.js +2 -2
- package/dist/esm/eds-card-tool.entry.js +2 -2
- package/dist/esm/eds-cookies-preference.entry.js +2 -2
- package/dist/esm/eds-feedback.entry.js +2 -2
- package/dist/esm/eds-footer.entry.js +9 -5
- package/dist/esm/eds-frame.entry.js +2 -2
- package/dist/esm/eds-fullscreen-menu.entry.js +9 -4
- package/dist/esm/eds-gauge.entry.js +2 -2
- package/dist/esm/eds-icon-arrow-diagonal.entry.js +2 -2
- package/dist/esm/eds-icon-arrow-right.entry.js +2 -2
- package/dist/esm/eds-icon-bin.entry.js +2 -2
- package/dist/esm/eds-icon-bluesky.entry.js +2 -2
- package/dist/esm/eds-icon-bookmark.entry.js +2 -2
- package/dist/esm/eds-icon-chevron-down.entry.js +2 -2
- package/dist/esm/eds-icon-chevron-left.entry.js +2 -2
- package/dist/esm/eds-icon-chevron-right.entry.js +2 -2
- package/dist/esm/eds-icon-chevron-up.entry.js +2 -2
- package/dist/esm/eds-icon-clone.entry.js +14 -0
- package/dist/esm/eds-icon-close.entry.js +2 -2
- package/dist/esm/eds-icon-copy.entry.js +2 -2
- package/dist/esm/eds-icon-download.entry.js +14 -0
- package/dist/esm/eds-icon-draft.entry.js +2 -2
- package/dist/esm/eds-icon-edit.entry.js +3 -3
- package/dist/esm/eds-icon-eu.entry.js +2 -2
- package/dist/esm/eds-icon-external.entry.js +2 -2
- package/dist/esm/eds-icon-facebook.entry.js +2 -2
- package/dist/esm/eds-icon-gitlab.entry.js +2 -2
- package/dist/esm/eds-icon-linkedin.entry.js +2 -2
- package/dist/esm/eds-icon-loader.entry.js +2 -2
- package/dist/esm/eds-icon-mastodon.entry.js +2 -2
- package/dist/esm/eds-icon-menu.entry.js +2 -2
- package/dist/esm/eds-icon-minus.entry.js +2 -2
- package/dist/esm/eds-icon-more.entry.js +2 -2
- package/dist/esm/eds-icon-paper.entry.js +2 -2
- package/dist/esm/eds-icon-plus.entry.js +2 -2
- package/dist/esm/eds-icon-portal.entry.js +2 -2
- package/dist/esm/eds-icon-private.entry.js +2 -2
- package/dist/esm/eds-icon-public.entry.js +2 -2
- package/dist/esm/eds-icon-search.entry.js +2 -2
- package/dist/esm/eds-icon-star.entry.js +2 -2
- package/dist/esm/eds-icon-start.entry.js +2 -2
- package/dist/esm/eds-icon-success.entry.js +2 -2
- package/dist/esm/eds-icon-thumbs-down.entry.js +2 -2
- package/dist/esm/eds-icon-thumbs-up.entry.js +2 -2
- package/dist/esm/eds-icon-tutorial.entry.js +2 -2
- package/dist/esm/eds-icon-twitter.entry.js +2 -2
- package/dist/esm/eds-icon-unknown.entry.js +2 -2
- package/dist/esm/eds-icon-updown.entry.js +2 -2
- package/dist/esm/eds-icon-user.entry.js +2 -2
- package/dist/esm/eds-icon-view.entry.js +14 -0
- package/dist/esm/eds-icon-youtube.entry.js +2 -2
- package/dist/esm/eds-modal.entry.js +3 -3
- package/dist/esm/eds-pie.entry.js +1 -1
- package/dist/esm/eds-progress-bar.entry.js +2 -2
- package/dist/esm/eds-section-core_2.entry.js +4 -4
- package/dist/esm/eds-social-networks.entry.js +3 -5
- package/dist/esm/eds-spinner.entry.js +2 -2
- package/dist/esm/eds-splash-screen.entry.js +1 -1
- package/dist/esm/eds-timeline.entry.js +2 -2
- package/dist/esm/eds-toast-manager.entry.js +2 -2
- package/dist/esm/eds-trl.entry.js +2 -2
- package/dist/esm/incorrect-use-of-colors.entry.js +2 -2
- package/dist/esm/{index-fdb33359.js → index-e84b871c.js} +19 -32
- package/dist/esm/loader.js +3 -3
- package/dist/esm/logo-space.entry.js +2 -2
- package/dist/esm/logo-variations-horizontal_2.entry.js +3 -3
- package/dist/esm/logo-variations-tabs.entry.js +2 -2
- package/dist/esm/logo-wrong-usage.entry.js +2 -2
- package/dist/esm/svg-repository.entry.js +9 -21
- package/dist/esm/token-list_3.entry.js +4 -4
- package/dist/esm/token-ratios.entry.js +2 -2
- package/dist/esm/token-spacing.entry.js +2 -2
- package/dist/esm/token-typography.entry.js +2 -2
- package/dist/esm/view-e900f2d4.js +3 -0
- package/dist/hydrate/index.js +852 -327
- package/dist/hydrate/index.mjs +852 -327
- package/dist/types/Users/nigeor/Documents/Projects/EBRAINS/ebrains-ui-ecosystem/packages/components/.stencil/packages/svgs/src/lib/svgs.d.ts +3 -1
- package/dist/types/components/eds-alert/eds-alert.d.ts +6 -0
- package/dist/types/components/eds-button/eds-button.d.ts +1 -0
- package/dist/types/components/eds-icons/eds-icon-clone/eds-icon-clone.d.ts +10 -0
- package/dist/types/components/eds-icons/eds-icon-download/eds-icon-download.d.ts +10 -0
- package/dist/types/components/eds-icons/eds-icon-view/eds-icon-view.d.ts +10 -0
- package/dist/types/components/eds-link/eds-link.d.ts +1 -0
- package/dist/types/components/eds-nps/eds-npm.stories.d.ts +28 -0
- package/dist/types/components/eds-nps/eds-nps.d.ts +20 -0
- package/dist/types/components/eds-pagination/eds-pagination.d.ts +23 -2
- package/dist/types/components/eds-rating/eds-rating.d.ts +3 -1
- package/dist/types/components/eds-switch/eds-switch.d.ts +1 -0
- package/dist/types/components/eds-table/eds-table.d.ts +23 -8
- package/dist/types/components/eds-table/eds-table.stories.d.ts +7 -2
- package/dist/types/components.d.ts +421 -41
- package/dist/types/shared-ui/eds-footer/eds-footer.d.ts +4 -2
- package/dist/types/shared-ui/eds-form/eds-form.d.ts +18 -0
- package/dist/types/shared-ui/eds-form/eds-form.stories.d.ts +19 -0
- package/dist/types/shared-ui/eds-fullscreen-menu/eds-fullscreen-menu.d.ts +44 -13
- package/dist/types/shared-ui/eds-matomo-notice/eds-matomo-notice.d.ts +11 -3
- package/dist/types/shared-ui/eds-social-networks/eds-social-networks.d.ts +0 -2
- package/dist/types/shared-ui/eds-social-networks/eds-social-networks.stories.d.ts +1 -1
- package/dist/types/shared-ui/eds-steps/eds-steps.d.ts +72 -24
- package/dist/types/shared-ui/eds-steps/eds-steps.stories.d.ts +58 -0
- package/dist/types/shared-ui/eds-steps-v2/eds-steps-v2.d.ts +42 -19
- package/dist/types/shared-ui/eds-steps-v2/eds-steps-v2.stories.d.ts +33 -0
- package/dist/types/shared-ui/eds-tabs/eds-tabs.d.ts +7 -9
- package/dist/types/shared-ui/eds-user/eds-user.d.ts +5 -0
- package/dist/types/utils/eds-form/formValidators.d.ts +1 -0
- package/package.json +1 -1
- package/dist/cjs/edit-5714c144.js +0 -5
- package/dist/cjs/eds-accordion.cjs.entry.js +0 -87
- package/dist/cjs/eds-alert.cjs.entry.js +0 -104
- package/dist/cjs/eds-breadcrumb.cjs.entry.js +0 -145
- package/dist/cjs/eds-code-block.cjs.entry.js +0 -2489
- package/dist/cjs/eds-matomo-notice.cjs.entry.js +0 -125
- package/dist/cjs/eds-switch.cjs.entry.js +0 -46
- package/dist/cjs/eds-tooltip.cjs.entry.js +0 -38
- package/dist/components/p-023bc47c.entry.js +0 -1
- package/dist/components/p-02df910c.entry.js +0 -1
- package/dist/components/p-0be79e08.entry.js +0 -1
- package/dist/components/p-0e74d8b4.entry.js +0 -1
- package/dist/components/p-11efb1d1.entry.js +0 -1
- package/dist/components/p-1791ce82.entry.js +0 -1
- package/dist/components/p-19d586e6.entry.js +0 -1
- package/dist/components/p-2679926c.entry.js +0 -1
- package/dist/components/p-2d1a7471.entry.js +0 -1
- package/dist/components/p-2ff16a39.entry.js +0 -1
- package/dist/components/p-32e18e48.entry.js +0 -1
- package/dist/components/p-38e99d4b.entry.js +0 -1
- package/dist/components/p-3a331c68.entry.js +0 -1
- package/dist/components/p-4088ae0e.entry.js +0 -1
- package/dist/components/p-4277fb1a.entry.js +0 -1
- package/dist/components/p-42a73db4.entry.js +0 -1
- package/dist/components/p-43468b0f.entry.js +0 -1
- package/dist/components/p-44055e68.entry.js +0 -1
- package/dist/components/p-4a5d0dcd.entry.js +0 -1
- package/dist/components/p-4a7412ec.entry.js +0 -1
- package/dist/components/p-4b88d84c.entry.js +0 -1
- package/dist/components/p-50f43dfd.entry.js +0 -1
- package/dist/components/p-562afa88.entry.js +0 -1
- package/dist/components/p-564431ad.entry.js +0 -1
- package/dist/components/p-5aa4065a.entry.js +0 -1
- package/dist/components/p-5ae1c931.entry.js +0 -1
- package/dist/components/p-634258e6.entry.js +0 -1
- package/dist/components/p-68f45098.entry.js +0 -1
- package/dist/components/p-73a44c48.entry.js +0 -1
- package/dist/components/p-73c74835.entry.js +0 -1
- package/dist/components/p-76905315.entry.js +0 -1
- package/dist/components/p-7dbe791f.entry.js +0 -1
- package/dist/components/p-7ec52188.entry.js +0 -1
- package/dist/components/p-7fc84bb2.js +0 -1
- package/dist/components/p-82559816.entry.js +0 -1
- package/dist/components/p-85683b18.entry.js +0 -1
- package/dist/components/p-8681e5d8.entry.js +0 -1
- package/dist/components/p-877d13d9.entry.js +0 -1
- package/dist/components/p-8dee879d.entry.js +0 -1
- package/dist/components/p-911b1c0b.entry.js +0 -1
- package/dist/components/p-93e6ba0f.entry.js +0 -1
- package/dist/components/p-960aa103.entry.js +0 -1
- package/dist/components/p-996005b7.entry.js +0 -1
- package/dist/components/p-9e53eca3.entry.js +0 -1
- package/dist/components/p-aa5e75b4.entry.js +0 -1
- package/dist/components/p-ae9393b6.entry.js +0 -1
- package/dist/components/p-af137162.entry.js +0 -1
- package/dist/components/p-b630e51a.entry.js +0 -1
- package/dist/components/p-bb9af709.entry.js +0 -1
- package/dist/components/p-c2dc3692.entry.js +0 -1
- package/dist/components/p-c91b4eec.entry.js +0 -1
- package/dist/components/p-caff3355.entry.js +0 -1
- package/dist/components/p-ce66ea37.entry.js +0 -1
- package/dist/components/p-d4f239d7.entry.js +0 -1
- package/dist/components/p-d7251d4d.entry.js +0 -1
- package/dist/components/p-deb9bbed.entry.js +0 -1
- package/dist/components/p-ed7696a2.entry.js +0 -1
- package/dist/components/p-f2416727.entry.js +0 -1
- package/dist/components/p-f28b5da7.entry.js +0 -1
- package/dist/components/p-f3839914.entry.js +0 -1
- package/dist/components/p-f42b6251.entry.js +0 -1
- package/dist/components/p-f7a31196.entry.js +0 -1
- package/dist/components/p-f973c83b.entry.js +0 -1
- package/dist/components/p-fe167c78.entry.js +0 -9
- package/dist/esm/edit-1dc8d11b.js +0 -3
- package/dist/esm/eds-accordion.entry.js +0 -83
- package/dist/esm/eds-alert.entry.js +0 -100
- package/dist/esm/eds-breadcrumb.entry.js +0 -141
- package/dist/esm/eds-code-block.entry.js +0 -2485
- package/dist/esm/eds-matomo-notice.entry.js +0 -121
- package/dist/esm/eds-switch.entry.js +0 -42
- package/dist/esm/eds-tooltip.entry.js +0 -34
- /package/dist/collection/shared-ui/eds-toast-manager/{eds-toast-manager.stories.js → eds-toast-manager.st.js} +0 -0
- /package/dist/types/shared-ui/eds-toast-manager/{eds-toast-manager.stories.d.ts → eds-toast-manager.st.d.ts} +0 -0
|
@@ -1,10 +1,195 @@
|
|
|
1
|
-
import { r as registerInstance, h, g as getElement,
|
|
2
|
-
import { s as sendAnalytics } from './analytics-d99780e3.js';
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, g as getElement, H as Host } from './index-e84b871c.js';
|
|
2
|
+
import { s as sendAnalytics, m as matomoOptIn, a as matomoOptOut } from './analytics-d99780e3.js';
|
|
3
3
|
import { c as cva } from './index-39c58238.js';
|
|
4
4
|
import { p as parseData } from './sharedUtils-a550989c.js';
|
|
5
5
|
import { h as hLogoColor } from './logo-color-7f1fd803.js';
|
|
6
6
|
import { h as hLogoBlack, a as hLogoColorWhite, b as hLogoWhite, c as hLogoWhiteNoBg, v as vLogoColor, d as vLogoBlack, e as vLogoColorWhite, f as vLogoWhite, g as vLogoWhiteNoBg } from './logo-white-no-bg-f382f86f.js';
|
|
7
7
|
|
|
8
|
+
const edsAccordionCss = "blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}.min-h-56{min-height:3.5rem}.container{width:calc(var(--container-width, 100%) - (2 * var(--breakout-container-outer-gutter, var(--container-outer-gutter, var(--outer-gutter, 0)))));margin-right:auto;margin-left:auto}.container>*{--container-outer-gutter:0;--breakout-container-outer-gutter:0}.break-words{overflow-wrap:break-word}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.effect-color{transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}.border-softer{border:2px solid rgba(0, 0, 0, .1)}.bg-default{background-color:var(--grey-200)}.bg-inverse{background-color:var(--white)}.relative{position:relative}.absolute{position:absolute}.inset-x-16{left:1rem;right:1rem}.top-16{top:1rem}.pr-32{padding-right:2rem}.pr-36{padding-right:2.25rem}.pr-40{padding-right:2.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.line-clamp-4{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:4}.w-full{width:100%}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.rounded-md{border-radius:12px}.outline-none{outline:2px solid transparent;outline-offset:2px}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.text-light{color:var(--grey-700)}.z-1{z-index:1}.z-10{z-index:10}.effect-height{transition-duration:300ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1);transition-property:height}.h-0{height:0rem}.h-auto{height:auto}.pt-4{padding-top:0.25rem}.overflow-hidden{overflow:hidden}.grid{display:grid}.overflow-hidden{overflow:hidden}.rounded-lg{border-radius:16px}.border-2{border-width:2px}.p-16{padding:1rem}.ml-auto{margin-left:auto}.mr-auto{margin-right:auto}.f-heading-06{font-family:var(--f-heading-06-fontFamily);font-weight:var(--f-heading-06-fontWeight);font-size:var(--f-heading-06-fontSize);line-height:var(--f-heading-06-lineHeight);letter-spacing:var(--f-heading-06-letterSpacing)}.text-left{text-align:left}.text-center{text-align:center}";
|
|
9
|
+
const EdsAccordionStyle0 = edsAccordionCss;
|
|
10
|
+
|
|
11
|
+
const EdsAccordion = class {
|
|
12
|
+
constructor(hostRef) {
|
|
13
|
+
registerInstance(this, hostRef);
|
|
14
|
+
this.accordion = createEvent(this, "accordion", 7);
|
|
15
|
+
/**
|
|
16
|
+
* Handles the click event on the accordion header to toggle expansion.
|
|
17
|
+
* Toggles the `isExpanded` state and emits the `accordion` event.
|
|
18
|
+
*/
|
|
19
|
+
this.handleClick = () => {
|
|
20
|
+
var _a;
|
|
21
|
+
this.isExpanded = !this.isExpanded;
|
|
22
|
+
this.accordion.emit(this.isExpanded);
|
|
23
|
+
this.setPanelHeight();
|
|
24
|
+
sendAnalytics({
|
|
25
|
+
category: 'ui-component',
|
|
26
|
+
parentContext: null,
|
|
27
|
+
tag: this.el.tagName.toLowerCase(),
|
|
28
|
+
name: ((_a = this.heading) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '',
|
|
29
|
+
action: this.isExpanded ? 'expanded' : 'collapsed'
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Calculates and sets the panel height based on the content height
|
|
34
|
+
* and adjusts based on the `shortContent` and `isExpanded` states.
|
|
35
|
+
*/
|
|
36
|
+
this.setPanelHeight = () => {
|
|
37
|
+
if (this.childContentRef) {
|
|
38
|
+
this.shortContent =
|
|
39
|
+
this.wrapperRef.scrollWidth > 830 && !this.description
|
|
40
|
+
? this.childContentRef.scrollHeight <= 80
|
|
41
|
+
: this.childContentRef.scrollHeight <= 20;
|
|
42
|
+
this.panelHeight = this.isExpanded && !this.shortContent ? this.childContentRef.scrollHeight : 0;
|
|
43
|
+
}
|
|
44
|
+
if (this.headerRef) {
|
|
45
|
+
this.headerHeight = this.headerRef.scrollHeight - 30;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
this.heading = undefined;
|
|
49
|
+
this.description = undefined;
|
|
50
|
+
this.switchBg = true;
|
|
51
|
+
this.expanded = false;
|
|
52
|
+
this.clampText = true;
|
|
53
|
+
this.buttonIntent = 'tertiary';
|
|
54
|
+
this.isExpanded = this.expanded;
|
|
55
|
+
this.panelHeight = 0;
|
|
56
|
+
this.shortContent = false;
|
|
57
|
+
this.headerHeight = 0;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Lifecycle method that sets up the initial panel height and adds a resize event listener
|
|
61
|
+
* to recalculate height on window resize.
|
|
62
|
+
*/
|
|
63
|
+
componentDidLoad() {
|
|
64
|
+
this.setPanelHeight();
|
|
65
|
+
window.addEventListener('resize', this.setPanelHeight);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Lifecycle method that cleans up the resize event listener when the component is removed.
|
|
69
|
+
*/
|
|
70
|
+
disconnectedCallback() {
|
|
71
|
+
window.removeEventListener('resize', this.setPanelHeight);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Renders the accordion structure, including header, content, description, and any slotted content.
|
|
75
|
+
* Adjusts styles based on `switchBg`, `tiny`, `clampText`, and other props.
|
|
76
|
+
*/
|
|
77
|
+
render() {
|
|
78
|
+
return (h("div", { key: '1abfd8bfea763bc10e6f17148dbc252d0c3ffdea', ref: (el) => (this.wrapperRef = el), class: `flex effect-color border-softer relative grid overflow-hidden rounded-lg border-2 p-16
|
|
79
|
+
${this.switchBg && this.isExpanded ? 'bg-inverse' : 'bg-default'}
|
|
80
|
+
${this.switchBg ? 'hover:bg-inverse' : ''}
|
|
81
|
+
${this.description ? 'min-h-56' : ''}` }, h("h3", { key: '137a3311195d51f46c6677558219828e5f4d06b5', ref: (el) => (this.headerRef = el), class: "mr-auto f-heading-06 text-left absolute inset-x-16 break-words top-16 pr-40" }, this.heading), h("div", { key: '0fc6d493fd61726a53a8c4311bd183eb3ad5b270', class: "ml-auto" }, h("eds-button", { key: 'cb8182e05c5c11950c0e624ce6b11e27a4d506ab', id: "toggleAccordion", intent: this.buttonIntent, "aria-expanded": this.isExpanded || this.shortContent, "aria-label": "Toggle accordion", "aria-controls": "accordionSection", class: `effect-color flex w-full items-center justify-between rounded-md`, onClick: this.handleClick, icon: "chevron-down" })), h("div", { key: '084bfb116dcccadf7253ca8ac8de6a1e1d4aa41f', class: `w-full`, style: Number.isFinite(this.headerHeight) ? { marginTop: `${this.headerHeight}px` } : {} }, this.description ? (h("span", { class: `text-light ${!this.isExpanded && this.clampText ? 'line-clamp-1' : ''}` }, this.description)) : null, h("section", { key: 'c332a210fa4ce90f1974098ff790a7600dfb1721', id: "accordionSection", "aria-labelledby": "accordionHeader", "aria-hidden": !this.isExpanded, class: `z-1 effect-height relative h-0 w-full ${!this.isExpanded && this.clampText ? 'overflow-hidden' : ''}`, style: { height: this.isExpanded ? 'auto' : '0' } }, h("div", { key: '842bc3bc7a968ef5a428a97327f38253e8a32888', ref: (el) => (this.childContentRef = el), class: `accordion-content effect-color pt-4`, "aria-hidden": !this.isExpanded }, h("span", { key: '7c8fa8040da18cc2c128b42cdf9e75bfffe4c439', class: `${!this.isExpanded && this.clampText ? 'line-clamp-2' : ''}` }, h("slot", { key: '852837c0c8c9d8a36f6263f7a943f50d82563a3c' })))))));
|
|
82
|
+
}
|
|
83
|
+
get el() { return getElement(this); }
|
|
84
|
+
};
|
|
85
|
+
EdsAccordion.style = EdsAccordionStyle0;
|
|
86
|
+
|
|
87
|
+
const edsAlertCss = "*,\n::before,\n::after {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n border-color: currentColor;\n}\n\np {\n margin: 0;\n}\n\n.f-ui-01 {\n font-family: var(--f-ui-01-fontFamily);\n font-weight: var(--f-ui-01-fontWeight);\n font-size: var(--f-ui-01-fontSize);\n line-height: var(--f-ui-01-lineHeight);\n letter-spacing: var(--f-ui-01-letterSpacing);\n}\n\n.border-inside {\n position: relative;\n\n &::after {\n pointer-events: none;\n }\n\n &::after {\n position: absolute;\n }\n\n &::after {\n inset: 0rem;\n }\n\n &::after {\n z-index: 1;\n }\n\n &::after {\n border-radius: 8px;\n }\n\n &::after {\n border-width: 1px;\n }\n\n &::after {\n border-width: 2px;\n }\n\n &::after {\n border-color: rgba(0, 0, 0, .1);\n }\n\n &::after {\n content: '';\n }\n}\n\n.flex {\n display: flex;\n}\n\n.w-full {\n width: 100%;\n}\n\n.flex-row {\n flex-direction: row;\n}\n\n.items-center {\n align-items: center;\n}\n\n.justify-between {\n justify-content: space-between;\n}\n\n.gap-x-12 {\n -moz-column-gap: 0.75rem;\n column-gap: 0.75rem;\n}\n\n.space-y-12> :not([hidden])~ :not([hidden]) {\n --tw-space-y-reverse: 0;\n margin-top: calc(0.75rem * calc(1 - var(--tw-space-y-reverse)));\n margin-bottom: calc(0.75rem * var(--tw-space-y-reverse));\n}\n\n.rounded-lg {\n border-radius: 16px;\n}\n\n.bg-dark {\n background-color: var(--grey-300);\n}\n\n.bg-error {\n background-color: var(--red-200);\n}\n\n.bg-success {\n background-color: var(--green-200);\n}\n\n.bg-warning {\n background-color: var(--yellow-200);\n}\n\n.p-16 {\n padding: 1rem;\n}\n\n.p-20 {\n padding: 1.25rem;\n}\n\n.px-12 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n\n.px-20 {\n padding-left: 1.25rem;\n padding-right: 1.25rem;\n}\n\n.py-12 {\n padding-top: 0.75rem;\n padding-bottom: 0.75rem;\n}\n\n.py-20 {\n padding-top: 1.25rem;\n padding-bottom: 1.25rem;\n}\n\n.py-8 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n\n.pr-12 {\n padding-right: 0.75rem;\n}\n\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n[class*=underline-] {\n text-decoration-line: underline;\n}\n\n.after\\:rounded-lg::after {\n border-radius: 16px;\n}\n\n.after\\:border-softest::after {\n border-color: rgba(0, 0, 0, .05);\n}";
|
|
88
|
+
const EdsAlertStyle0 = edsAlertCss;
|
|
89
|
+
|
|
90
|
+
const alertStyles = cva(['w-full bg-dark'], {
|
|
91
|
+
variants: {
|
|
92
|
+
intent: {
|
|
93
|
+
default: '',
|
|
94
|
+
warning: 'bg-warning',
|
|
95
|
+
error: 'bg-error',
|
|
96
|
+
success: 'bg-success'
|
|
97
|
+
},
|
|
98
|
+
brd: {
|
|
99
|
+
rounded: 'rounded-lg border-inside after:border-softest after:rounded-lg',
|
|
100
|
+
normal: ''
|
|
101
|
+
},
|
|
102
|
+
direction: {
|
|
103
|
+
vertical: 'space-y-12',
|
|
104
|
+
horizontal: 'flex flex-row items-center justify-between gap-x-12'
|
|
105
|
+
},
|
|
106
|
+
withBtn: {
|
|
107
|
+
false: '',
|
|
108
|
+
true: ''
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
compoundVariants: [
|
|
112
|
+
{
|
|
113
|
+
direction: 'horizontal',
|
|
114
|
+
withBtn: true,
|
|
115
|
+
class: 'px-20 pr-12 py-12'
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
direction: 'horizontal',
|
|
119
|
+
withBtn: false,
|
|
120
|
+
class: 'p-20'
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
direction: 'vertical',
|
|
124
|
+
withBtn: true,
|
|
125
|
+
class: 'p-16'
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
direction: 'vertical',
|
|
129
|
+
withBtn: false,
|
|
130
|
+
class: 'px-12 py-20'
|
|
131
|
+
}
|
|
132
|
+
],
|
|
133
|
+
defaultVariants: {
|
|
134
|
+
intent: 'default',
|
|
135
|
+
brd: 'rounded',
|
|
136
|
+
direction: 'horizontal'
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
const EdsAlert = class {
|
|
140
|
+
constructor(hostRef) {
|
|
141
|
+
registerInstance(this, hostRef);
|
|
142
|
+
this.edsalert = createEvent(this, "edsalert", 7);
|
|
143
|
+
this.message = undefined;
|
|
144
|
+
this.pressableLabel = undefined;
|
|
145
|
+
this.pressableUrl = undefined;
|
|
146
|
+
this.direction = 'horizontal';
|
|
147
|
+
this.intent = 'default';
|
|
148
|
+
this.brd = 'rounded';
|
|
149
|
+
this.withBtn = false;
|
|
150
|
+
}
|
|
151
|
+
componentWillLoad() {
|
|
152
|
+
this.withBtn = Boolean(this.pressableLabel);
|
|
153
|
+
}
|
|
154
|
+
componentDidLoad() {
|
|
155
|
+
// Focus the alert container for immediate screen reader announcement
|
|
156
|
+
/*if (this.intent === 'error' || this.intent === 'warning') {
|
|
157
|
+
this.el.shadowRoot?.querySelector('[role="alert"]')?.setAttribute('tabindex', '-1');
|
|
158
|
+
(this.el.shadowRoot?.querySelector('[role="alert"]') as HTMLElement)?.focus();
|
|
159
|
+
}*/
|
|
160
|
+
var _a;
|
|
161
|
+
// Query for the 'eds-link' element inside the shadow root.
|
|
162
|
+
const lnk = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('eds-link');
|
|
163
|
+
if (lnk) {
|
|
164
|
+
this.emitContext(lnk);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
emitContext(linkElement) {
|
|
168
|
+
const event = new CustomEvent('parentContext', {
|
|
169
|
+
detail: {
|
|
170
|
+
componentName: this.el.tagName.toLowerCase(),
|
|
171
|
+
identifier: null
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
linkElement.dispatchEvent(event);
|
|
175
|
+
}
|
|
176
|
+
handleAction() {
|
|
177
|
+
// Emit the alertAction event for parent components to handle
|
|
178
|
+
this.edsalert.emit();
|
|
179
|
+
}
|
|
180
|
+
render() {
|
|
181
|
+
const ariaLabel = this.intent !== 'default' ? `${this.intent} alert` : 'alert';
|
|
182
|
+
return (h("div", { key: '2d22944e7ae86cf2523c194e20215a3d986083d9', class: alertStyles({
|
|
183
|
+
intent: this.intent,
|
|
184
|
+
brd: this.brd,
|
|
185
|
+
direction: this.direction,
|
|
186
|
+
withBtn: this.withBtn
|
|
187
|
+
}), role: "alert", "aria-label": ariaLabel, "aria-live": this.intent === 'error' ? 'assertive' : 'polite', "aria-labelledby": "alert-message", "aria-describedby": this.withBtn ? 'alert-action' : undefined }, h("p", { key: 'b6c22446b0d87fb01a3cb882fe205ef48ea60b05', id: "alert-message", class: "f-ui-01 py-8", innerHTML: this.message }), this.withBtn && (h("div", { key: '8414820eb7b65c83459cfb90adef3ea696e42444', id: "alert-action" }, this.pressableUrl ? (h("eds-link", { class: "eds-alert-link", label: this.pressableLabel, url: this.pressableUrl, intent: "secondary", external: true })) : (h("eds-button", { class: "eds-alert-button", label: this.pressableLabel, intent: "secondary", onClick: () => this.handleAction() }))))));
|
|
188
|
+
}
|
|
189
|
+
get el() { return getElement(this); }
|
|
190
|
+
};
|
|
191
|
+
EdsAlert.style = EdsAlertStyle0;
|
|
192
|
+
|
|
8
193
|
const edsAvatarCss = "::before,\n::after {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n border-color: currentColor;\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n.border-inside {\n position: relative;\n\n &::after {\n pointer-events: none;\n }\n\n &::after {\n position: absolute;\n }\n\n &::after {\n inset: 0rem;\n }\n\n &::after {\n z-index: 1;\n }\n\n &::after {\n border-radius: 8px;\n }\n\n &::after {\n border-width: 1px;\n }\n\n &::after {\n border-width: 2px;\n }\n\n &::after {\n border: 2px solid rgba(0, 0, 0, .1);\n }\n\n &::after {\n content: '';\n }\n}\n\n.border-inside-pill {\n &::after {\n border-radius: 100px;\n }\n\n &::after {\n content: '';\n }\n}\n\n.border-inside-inverse {\n &::after {\n border: 2px solid rgba(255, 255, 255, 0.3);\n }\n\n &::after {\n content: '';\n }\n}\n\n.aspect-1x1 {\n aspect-ratio: 1/1;\n}\n\n.flex {\n display: flex;\n}\n\n.inline-flex {\n display: inline-flex;\n}\n\n.items-center {\n align-items: center;\n}\n\n.justify-center {\n justify-content: center;\n}\n\n.overflow-hidden {\n overflow: hidden;\n}\n\n.px-4 {\n padding-left: 0.25rem;\n padding-right: 0.25rem;\n}\n\n.rounded-pill {\n border-radius: 100px;\n}\n\n.rounded-sm {\n border-radius: 8px;\n}\n\n.rounded-xs {\n border-radius: 4px;\n}\n\n.rounded-full {\n border-radius: 9999px;\n}\n\n.bg-dark {\n background-color: var(--grey-300);\n}\n\n.bg-darker {\n background-color: var(--grey-400);\n}\n\n.bg-stronger {\n background-color: var(--grey-900);\n}\n\n.bg-strongest {\n background-color: var(--black);\n}\n\n.text-accent {\n color: var(--green-500);\n}\n\n.text-default {\n color: var(--black);\n}\n\n.\\!no-underline {\n text-decoration-line: none !important;\n}\n\n.f-ui-01 {\n font-family: var(--f-ui-01-fontFamily);\n font-weight: var(--f-ui-01-fontWeight);\n font-size: var(--f-ui-01-fontSize);\n line-height: var(--f-ui-01-lineHeight);\n letter-spacing: var(--f-ui-01-letterSpacing);\n}\n\n.w-32 {\n width: 2rem;\n}\n\n.w-44 {\n width: 2.75rem;\n}\n\n.w-\\[54px\\] {\n width: 54px;\n}\n\n.bg-gradient-01-top {\n background: linear-gradient(to bottom, #00E766, ease-in-out, #E6E6E6);\n}\n\n.bg-gradient-01-bottom {\n background: linear-gradient(to top, #00E766, ease-in-out, #E6E6E6);\n}\n\n.bg-gradient-02-top {\n background: linear-gradient(to bottom, #F3F30A, ease-in-out, #E6E6E6);\n}\n\n.bg-gradient-02-bottom {\n background: linear-gradient(to top, #F3F30A, ease-in-out, #E6E6E6);\n}\n\n.bg-gradient-03-top {\n background: linear-gradient(to bottom, #C461FF, ease-in-out, #E6E6E6);\n}\n\n.bg-gradient-03-bottom {\n background: linear-gradient(to top, #C461FF, ease-in-out, #E6E6E6);\n}\n\n.bg-gradient-04-top {\n background: linear-gradient(to bottom, #2B69FC, ease-in-out, #E6E6E6);\n}\n\n.bg-gradient-04-bottom {\n background: linear-gradient(to top, #2B69FC, ease-in-out, #E6E6E6);\n}";
|
|
9
194
|
const EdsAvatarStyle0 = edsAvatarCss;
|
|
10
195
|
|
|
@@ -62,7 +247,7 @@ const EdsAvatar = class {
|
|
|
62
247
|
* @returns {JSX.Element} The rendered avatar component.
|
|
63
248
|
*/
|
|
64
249
|
render() {
|
|
65
|
-
return (h("div", { key: '
|
|
250
|
+
return (h("div", { key: '34e86e50b1176efd8ae0cd9b30cd3823527d7eee', class: this.containerClasses }, this.picture ? (h("eds-img", { src: this.picture, width: 54, height: 54, sizes: "120px", alt: `${this.firstName} ${this.lastName}`, lazyload: true, withBg: true })) : (h("abbr", { title: this.computedInitials || `${this.firstName} ${this.lastName}`, class: "!no-underline f-ui-01" }, this.computedInitials))));
|
|
66
251
|
}
|
|
67
252
|
};
|
|
68
253
|
EdsAvatar.style = EdsAvatarStyle0;
|
|
@@ -76,12 +261,149 @@ const EdsBlockBreak = class {
|
|
|
76
261
|
this.inverse = false;
|
|
77
262
|
}
|
|
78
263
|
render() {
|
|
79
|
-
return h("hr", { key: '
|
|
264
|
+
return h("hr", { key: '688e11c730af1193f28db196cd144c6dd2efc3c6', class: `${this.inverse ? 'border-default' : 'border-softer'} my-16 inline-block w-full border-t-2` });
|
|
80
265
|
}
|
|
81
266
|
};
|
|
82
267
|
EdsBlockBreak.style = EdsBlockBreakStyle0;
|
|
83
268
|
|
|
84
|
-
const edsButtonCss = "*,\n::before,\n::after {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n border-color: currentColor;\n}\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\n 1. Change the font styles in all browsers.\n 2. Remove the margin in Firefox and Safari.\n 3. Remove default padding in all browsers.\n */\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n font-size: 100%;\n font-weight: inherit;\n line-height: inherit;\n letter-spacing: inherit;\n color: inherit;\n margin: 0;\n padding: 0;\n}\n\n/*\n Remove the inheritance of text transform in Edge and Firefox.\n */\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n 1. Correct the inability to style clickable types in iOS and Safari.\n 2. Remove default button styles.\n */\nbutton,\ninput:where([type='button']),\ninput:where([type='reset']),\ninput:where([type='submit']) {\n -webkit-appearance: button;\n /* 1 */\n background-color: transparent;\n /* 2 */\n background-image: none;\n /* 2 */\n}\n\np {\n margin: 0;\n}\n\n/*\n Set the default cursor for buttons.\n */\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\n Make sure disabled buttons don't get the pointer cursor.\n */\n:disabled {\n cursor: default;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n.f-body-01 {\n font-family: var(--f-body-01-fontFamily);\n font-weight: var(--f-body-01-fontWeight);\n font-size: var(--f-body-01-fontSize);\n line-height: var(--f-body-01-lineHeight);\n letter-spacing: var(--f-body-01-letterSpacing);\n}\n\n.f-body-02 {\n font-family: var(--f-body-02-fontFamily);\n font-weight: var(--f-body-02-fontWeight);\n font-size: var(--f-body-02-fontSize);\n line-height: var(--f-body-02-lineHeight);\n letter-spacing: var(--f-body-02-letterSpacing);\n}\n\n.f-ui-01 {\n font-family: var(--f-ui-01-fontFamily);\n font-weight: var(--f-ui-01-fontWeight);\n font-size: var(--f-ui-01-fontSize);\n line-height: var(--f-ui-01-lineHeight);\n letter-spacing: var(--f-ui-01-letterSpacing);\n}\n\n.f-ui-02 {\n font-family: var(--f-ui-02-fontFamily);\n font-weight: var(--f-ui-02-fontWeight);\n font-size: var(--f-ui-02-fontSize);\n line-height: var(--f-ui-02-lineHeight);\n letter-spacing: var(--f-ui-02-letterSpacing);\n}\n\n.border-inside {\n position: relative;\n\n &::after {\n pointer-events: none;\n }\n\n &::after {\n position: absolute;\n }\n\n &::after {\n inset: 0rem;\n }\n\n &::after {\n z-index: 1;\n }\n\n &::after {\n border-radius: 8px;\n }\n\n &::after {\n border-width: 1px;\n }\n\n &::after {\n border-width: 2px;\n }\n\n &::after {\n border-color: rgba(0, 0, 0, .1);\n }\n\n &::after {\n content: '';\n }\n}\n\n.border-inside-inverse {\n &::after {\n border-color: rgba(255, 255, 255, 0.3);\n }\n\n &::after {\n content: '';\n }\n}\n\n.border-inside-pill {\n &::after {\n border-radius: 100px;\n }\n\n &::after {\n content: '';\n }\n}\n\n.loader {\n box-sizing: border-box;\n display: inline-block;\n height: 1rem;\n width: 1rem;\n}\n\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.loader {\n animation: spin 1s linear infinite;\n border-radius: 9999px;\n border: 3px solid rgba(0, 0, 0, .3);\n border-bottom-color: #000;\n}\n\n/** region TRANSITIONS */\n.effect-color {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 300ms;\n transition-timing-function: cubic-bezier(0, 0, 0.2, 1);\n}\n\n.effect-focus {\n outline-width: 3px;\n outline-offset: 2px;\n outline-color: var(--green-500);\n}\n\n.effect-focus:focus-visible {\n outline-style: solid;\n}\n\n.effect-focus-within {\n outline-width: 3px;\n outline-offset: 2px;\n outline-color: var(--green-500);\n}\n\n.effect-focus-within:focus-within {\n outline-style: solid;\n}\n\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.pointer-events-none {\n pointer-events: none;\n}\n\n.static {\n position: static;\n}\n\n.fixed {\n position: fixed;\n}\n\n.absolute {\n position: absolute;\n}\n\n.relative {\n position: relative;\n}\n\n.sticky {\n position: sticky;\n}\n\n.inset-0 {\n inset: 0rem;\n}\n\n.inset-x-16 {\n left: 1rem;\n right: 1rem;\n}\n\n.-top-8 {\n top: -0.5rem;\n}\n\n.left-0 {\n left: 0rem;\n}\n\n.left-1\\/2 {\n left: 50%;\n}\n\n.left-4 {\n left: 0.25rem;\n}\n\n.left-\\[4px\\] {\n left: 4px;\n}\n\n.right-0 {\n right: 0rem;\n}\n\n.right-4 {\n right: 0.25rem;\n}\n\n.right-8 {\n right: 0.5rem;\n}\n\n.right-\\[6px\\] {\n right: 6px;\n}\n\n.top-0 {\n top: 0rem;\n}\n\n.top-1\\/2 {\n top: 50%;\n}\n\n.m-0 {\n margin: 0rem;\n}\n\n.mx-auto {\n margin-left: auto;\n margin-right: auto;\n}\n\n.-ml-16 {\n margin-left: -1rem;\n}\n\n.-mr-16 {\n margin-right: -1rem;\n}\n\n.ml-0 {\n margin-left: 0rem;\n}\n\n.ml-4 {\n margin-left: 0.25rem;\n}\n\n.ml-64 {\n margin-left: 4rem;\n}\n\n.ml-8 {\n margin-left: 0.5rem;\n}\n\n.ml-auto {\n margin-left: auto;\n}\n\n.mr-4 {\n margin-right: 0.25rem;\n}\n\n.mr-8 {\n margin-right: 0.5rem;\n}\n\n.mr-auto {\n margin-right: auto;\n}\n\n.block {\n display: block;\n}\n\n.inline-block {\n display: inline-block;\n}\n\n.inline {\n display: inline;\n}\n\n.flex {\n display: flex;\n}\n\n.inline-flex {\n display: inline-flex;\n}\n\n.hidden {\n display: none;\n}\n\n.h-20 {\n height: 1.25rem;\n}\n\n.h-24 {\n height: 1.5rem;\n}\n\n.h-36 {\n height: 2.25rem;\n}\n\n.h-44 {\n height: 2.75rem;\n}\n\n.h-auto {\n height: auto;\n}\n\n.h-full {\n height: 100%;\n}\n\n.\\!min-h-20 {\n min-height: 1.25rem !important;\n}\n\n.min-h-screen {\n min-height: 100vh;\n}\n\n.w-20 {\n width: 1.25rem;\n}\n\n.w-full {\n width: 100%;\n}\n\n.flex-none {\n flex: none;\n}\n\n.grow {\n flex-grow: 1;\n}\n\n.cursor-pointer {\n cursor: pointer;\n}\n\n.resize {\n resize: both;\n}\n\n.flex-row {\n flex-direction: row;\n}\n\n.flex-row-reverse {\n flex-direction: row-reverse;\n}\n\n.flex-col {\n flex-direction: column;\n}\n\n.flex-wrap {\n flex-wrap: wrap;\n}\n\n.items-center {\n align-items: center;\n}\n\n.justify-center {\n justify-content: center;\n}\n\n.justify-between {\n justify-content: space-between;\n}\n\n.space-x-2> :not([hidden])~ :not([hidden]) {\n --tw-space-x-reverse: 0;\n margin-right: calc(0.125rem * var(--tw-space-x-reverse));\n margin-left: calc(0.125rem * calc(1 - var(--tw-space-x-reverse)));\n}\n\n.overflow-hidden {\n overflow: hidden;\n}\n\n.overflow-x-auto {\n overflow-x: auto;\n}\n\n.overflow-x-hidden {\n overflow-x: hidden;\n}\n\n.overflow-y-scroll {\n overflow-y: scroll;\n}\n\n.whitespace-nowrap {\n white-space: nowrap;\n}\n\n.break-words {\n overflow-wrap: break-word;\n}\n\n.rounded {\n border-radius: 0.25rem;\n}\n\n.rounded-full {\n border-radius: 9999px;\n}\n\n.rounded-lg {\n border-radius: 16px;\n}\n\n.rounded-md {\n border-radius: 12px;\n}\n\n.rounded-pill {\n border-radius: 100px;\n}\n\n.rounded-sm {\n border-radius: 8px;\n}\n\n.rounded-xxs {\n border-radius: 2px;\n}\n\n.border {\n border-width: 1px;\n}\n\n.border-\\[\\#0034CB\\] {\n --tw-border-opacity: 1;\n border-color: rgb(0 52 203 / var(--tw-border-opacity));\n}\n\n.border-\\[\\#d2d2d2\\] {\n --tw-border-opacity: 1;\n border-color: rgb(210 210 210 / var(--tw-border-opacity));\n}\n\n.border-softest {\n border-color: rgba(0, 0, 0, .05);\n}\n\n.border-b-softer {\n border-bottom-color: rgba(0, 0, 0, .1);\n}\n\n.\\!bg-accent-dark {\n background-color: var(--green-600) !important;\n}\n\n.\\!bg-darker {\n background-color: var(--grey-400) !important;\n}\n\n.\\!bg-strong-dark {\n background-color: var(--grey-800) !important;\n}\n\n.bg-accent {\n background-color: var(--green-500);\n}\n\n.bg-accent-dark {\n background-color: var(--green-600);\n}\n\n.bg-dark {\n background-color: var(--grey-300);\n}\n\n.bg-darker {\n background-color: var(--grey-400);\n}\n\n.bg-overlay {\n background-color: rgba(0, 0, 0, 0.25);\n}\n\n.bg-strong {\n background-color: var(--grey-700);\n}\n\n.bg-strong-dark {\n background-color: var(--grey-800);\n}\n\n.bg-stronger {\n background-color: var(--grey-900);\n}\n\n.bg-strongest {\n background-color: var(--black);\n}\n\n.p-12 {\n padding: 0.75rem;\n}\n\n.p-6 {\n padding: 0.375rem;\n}\n\n.p-8 {\n padding: 0.5rem;\n}\n\n.\\!px-0 {\n padding-left: 0rem !important;\n padding-right: 0rem !important;\n}\n\n.px-12 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n\n.px-16 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n\n.py-8 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n\n.pl-4 {\n padding-left: 0.25rem;\n}\n\n.pl-8 {\n padding-left: 0.5rem;\n}\n\n.pr-4 {\n padding-right: 0.25rem;\n}\n\n.pr-8 {\n padding-right: 0.5rem;\n}\n\n.\\!text-current {\n color: currentColor !important;\n}\n\n.text-accent {\n color: var(--green-500);\n}\n\n.text-current {\n color: currentColor;\n}\n\n.text-default {\n color: var(--black);\n}\n\n.text-inverse {\n color: var(--white);\n}\n\n.text-lightest {\n color: var(--grey-500);\n}\n\n.opacity-0 {\n opacity: 0;\n}\n\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.shadow-accent {\n --tw-shadow: 0px 0px 12px rgba(0, 201, 89, 0.6);\n --tw-shadow-colored: 0px 0px 12px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.underline-offset-4 {\n text-underline-offset: 0.2em;\n}\n\n.\\@container {\n container-type: inline-size;\n}\n\n.after\\:effect-opacity::after {\n transition-property: opacity;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 300ms;\n transition-timing-function: cubic-bezier(0, 0, 0.2, 1);\n}\n\n.even\\:bg-inverse-softer:nth-child(even) {\n background-color: rgba(255, 255, 255, .15);\n}\n\n.invalid\\:text-lightest:invalid {\n color: var(--grey-500);\n}\n\n.focus-within\\:bg-transparent:focus-within {\n background-color: var(--transparent);\n}\n\n.hover\\:bg-accent-dark:hover {\n background-color: var(--green-600);\n}\n\n.hover\\:bg-dark:hover {\n background-color: var(--grey-300);\n}\n\n.hover\\:bg-darker:hover {\n background-color: var(--grey-400);\n}\n\n.hover\\:bg-default:hover {\n background-color: var(--grey-200);\n}\n\n.hover\\:bg-inverse:hover {\n background-color: var(--white);\n}\n\n.hover\\:bg-strong-dark:hover {\n background-color: var(--grey-800);\n}\n\n.hover\\:bg-transparent:hover {\n background-color: var(--transparent);\n}\n\n.hover\\:text-default:hover {\n color: var(--black);\n}\n\n.hover\\:text-lighter:hover {\n color: var(--grey-600);\n}\n\n.hover\\:\\!underline:hover {\n text-decoration-line: underline !important;\n}\n\n.hover\\:no-underline:hover {\n text-decoration-line: none;\n}\n\n.hover\\:shadow-hover:hover {\n --tw-shadow: 0px 0px 16px rgba(0, 0, 0, 0.2);\n --tw-shadow-colored: 0px 0px 16px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.focus\\:shadow-none:focus {\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.focus\\:outline-none:focus {\n outline: 2px solid transparent;\n outline-offset: 2px;\n}\n\n.disabled\\:cursor-not-allowed:disabled {\n cursor: not-allowed;\n}\n\n.disabled\\:bg-dark:disabled {\n background-color: var(--grey-300);\n}\n\n.disabled\\:text-lightest:disabled {\n color: var(--grey-500);\n}\n\n.aria-disabled\\:cursor-not-allowed[aria-disabled=\"true\"] {\n cursor: not-allowed;\n}\n\n.aria-disabled\\:\\!border-transparent[aria-disabled=\"true\"] {\n border-color: var(--transparent) !important;\n}\n\n.aria-disabled\\:bg-dark[aria-disabled=\"true\"] {\n background-color: var(--grey-300);\n}\n\n.aria-disabled\\:bg-transparent[aria-disabled=\"true\"] {\n background-color: var(--transparent);\n}\n\n.aria-disabled\\:text-light[aria-disabled=\"true\"] {\n color: var(--grey-700);\n}\n\n.aria-disabled\\:text-lightest[aria-disabled=\"true\"] {\n color: var(--grey-500);\n}\n\n.aria-disabled\\:line-through[aria-disabled=\"true\"] {\n text-decoration-line: line-through;\n}\n\n.aria-disabled\\:shadow-none[aria-disabled=\"true\"] {\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.aria-current-page\\:bg-darker[aria-current=\"page\"] {\n background-color: var(--grey-400);\n}\n\n.after\\:absolute::after {\n position: absolute;\n}\n\n.after\\:inset-0::after {\n inset: 0rem;\n}\n\n.after\\:inset-x-0::after {\n left: 0rem;\n right: 0rem;\n}\n\n.after\\:bottom-0::after {\n bottom: 0rem;\n}\n\n.after\\:left-16::after {\n left: 1rem;\n}\n\n.after\\:right-16::after {\n right: 1rem;\n}\n\n.after\\:z-10::after {\n z-index: 10;\n}\n\n.after\\:rounded-lg::after {\n border-radius: 16px;\n}\n\n.after\\:rounded-t-lg::after {\n border-top-left-radius: 16px;\n border-top-right-radius: 16px;\n}\n\n.after\\:border-3::after {\n border-width: 3px;\n}\n\n.after\\:border-b-2::after {\n border-bottom-width: 2px;\n}\n\n.after\\:\\!border-transparent::after {\n border-color: var(--transparent) !important;\n}\n\n.after\\:border-accent::after {\n border-color: var(--green-500);\n}\n\n.after\\:border-softest::after {\n border-color: rgba(0, 0, 0, .05);\n}\n\n.after\\:opacity-0::after {\n opacity: 0;\n}\n\n.after\\:content-\\[\\'\\'\\]::after {\n --tw-content: '';\n content: var(--tw-content);\n}\n\n.hover\\:after\\:\\!border-transparent:hover::after {\n border-color: var(--transparent) !important;\n}\n\n.hover\\:after\\:opacity-100:hover::after {\n opacity: 1;\n}\n\n.focus-visible\\:after\\:opacity-100:focus-visible::after {\n opacity: 1;\n}\n\n.aria-disabled\\:after\\:\\!border-transparent[aria-disabled=\"true\"]::after {\n border-color: var(--transparent) !important;\n}\n\n.hover\\:before\\:opacity-100:hover::before {\n opacity: 1;\n}";
|
|
269
|
+
const edsBreadcrumbCss = "blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}.hidden{display:none}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.items-center{align-items:center}.justify-center{justify-content:center}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.125rem * var(--tw-space-x-reverse));margin-left:calc(0.125rem * calc(1 - var(--tw-space-x-reverse)))}.px-2{padding-left:0.125rem;padding-right:0.125rem}.w-20{width:1.25rem}.w-28{width:1.75rem}.w-32{width:2rem}.w-44{width:2.75rem}.h-20{height:1.25rem}.h-24{height:1.5rem}.h-28{height:1.75rem}.h-32{height:2rem}@media (min-width: 750px){.md\\:block{display:block}}";
|
|
270
|
+
const EdsBreadcrumbStyle0 = edsBreadcrumbCss;
|
|
271
|
+
|
|
272
|
+
const EdsBreadcrumb = class {
|
|
273
|
+
constructor(hostRef) {
|
|
274
|
+
registerInstance(this, hostRef);
|
|
275
|
+
/**
|
|
276
|
+
* Updates the maximum number of visible items and tracks if the screen is small.
|
|
277
|
+
*/
|
|
278
|
+
this.updateScreenSize = () => {
|
|
279
|
+
const width = window.innerWidth;
|
|
280
|
+
if (width < 769) {
|
|
281
|
+
this.maxVisibleItems = 3;
|
|
282
|
+
}
|
|
283
|
+
else if (width <= 1024) {
|
|
284
|
+
this.maxVisibleItems = 3;
|
|
285
|
+
}
|
|
286
|
+
else if (width <= 1280) {
|
|
287
|
+
this.maxVisibleItems = 3;
|
|
288
|
+
}
|
|
289
|
+
else if (width <= 2200) {
|
|
290
|
+
this.maxVisibleItems = 4;
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
this.maxVisibleItems = 6;
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
this.items = [];
|
|
297
|
+
this.intent = 'ghost';
|
|
298
|
+
this.parsedItems = [];
|
|
299
|
+
this.isSmallScreen = false;
|
|
300
|
+
this.maxVisibleItems = 6;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Watches for changes to the `items` prop and parses it.
|
|
304
|
+
*/
|
|
305
|
+
parseItems(newValue) {
|
|
306
|
+
this.parsedItems = parseData(newValue);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Lifecycle method that runs when the component is about to be loaded.
|
|
310
|
+
* It parses the initial `items` prop value.
|
|
311
|
+
*/
|
|
312
|
+
componentWillLoad() {
|
|
313
|
+
this.parseItems(this.items);
|
|
314
|
+
this.updateScreenSize();
|
|
315
|
+
window.addEventListener('resize', this.updateScreenSize);
|
|
316
|
+
}
|
|
317
|
+
disconnectedCallback() {
|
|
318
|
+
window.removeEventListener('resize', this.updateScreenSize);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Lifecycle method that runs when the component has fully loaded.
|
|
322
|
+
* It emits a custom event for each `eds-link` element contained within the breadcrumb.
|
|
323
|
+
*/
|
|
324
|
+
componentDidLoad() {
|
|
325
|
+
var _a;
|
|
326
|
+
const links = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('eds-link');
|
|
327
|
+
links === null || links === void 0 ? void 0 : links.forEach((link) => {
|
|
328
|
+
this.emitContext(link);
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Emits a custom event called `parentContext` for a given link element.
|
|
333
|
+
* This event provides context information about the breadcrumb component.
|
|
334
|
+
*
|
|
335
|
+
* @param linkElement - The link element to which the event will be dispatched.
|
|
336
|
+
*/
|
|
337
|
+
emitContext(linkElement) {
|
|
338
|
+
const event = new CustomEvent('parentContext', {
|
|
339
|
+
detail: {
|
|
340
|
+
componentName: this.el.tagName.toLowerCase(),
|
|
341
|
+
identifier: null
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
linkElement.dispatchEvent(event);
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Returns breadcrumb items with potential truncation if there are too many.
|
|
348
|
+
* It inserts an ellipsis item where necessary.
|
|
349
|
+
*/
|
|
350
|
+
getTruncatedItems() {
|
|
351
|
+
const totalItems = this.parsedItems.length;
|
|
352
|
+
const ellipsis = { label: '...', url: '', isHidden: true };
|
|
353
|
+
if (totalItems > this.maxVisibleItems) {
|
|
354
|
+
const firstItem = this.parsedItems[0];
|
|
355
|
+
const lastItems = this.parsedItems.slice(-2);
|
|
356
|
+
if (this.maxVisibleItems === 3) {
|
|
357
|
+
return [firstItem, ellipsis, ...lastItems];
|
|
358
|
+
}
|
|
359
|
+
else if (this.maxVisibleItems === 4) {
|
|
360
|
+
const middleItem = this.parsedItems[Math.floor(totalItems / 2)];
|
|
361
|
+
return [firstItem, middleItem, ellipsis, ...lastItems];
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return this.parsedItems;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Helper to determine the display label and full label.
|
|
368
|
+
* If the label is longer than 15 characters and the item is not the current (last) item,
|
|
369
|
+
* we display a truncated version but use the full label for aria attributes.
|
|
370
|
+
*/
|
|
371
|
+
getLabels(item, isCurrent) {
|
|
372
|
+
if (!isCurrent && item.label.length > 15) {
|
|
373
|
+
return { displayLabel: `${item.label.slice(0, 15)}...`, fullLabel: item.label };
|
|
374
|
+
}
|
|
375
|
+
return { displayLabel: item.label, fullLabel: item.label };
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Render method for the breadcrumb component.
|
|
379
|
+
* It creates a navigation element with an ordered list of breadcrumb links.
|
|
380
|
+
* The last link is marked as the current page.
|
|
381
|
+
*/
|
|
382
|
+
render() {
|
|
383
|
+
const itemsToRender = this.getTruncatedItems();
|
|
384
|
+
return (h("nav", { key: '0625a234ec9f5095abbeaafa11e56bceb0432764', "aria-label": "Breadcrumb" }, h("ol", { key: '3898a4b048eca6c606a6948b26ec25a608cb908e', class: "flex items-center space-x-2" }, itemsToRender.map((item, index) => {
|
|
385
|
+
const isLast = index === itemsToRender.length - 1;
|
|
386
|
+
return (h("li", { class: "flex items-center" }, !item.isHidden ? ((() => {
|
|
387
|
+
const { fullLabel } = this.getLabels(item, isLast);
|
|
388
|
+
const linkIntent = isLast
|
|
389
|
+
? this.intent === 'strong'
|
|
390
|
+
? 'weak'
|
|
391
|
+
: this.intent === 'weak'
|
|
392
|
+
? 'strong'
|
|
393
|
+
: this.intent
|
|
394
|
+
: this.intent;
|
|
395
|
+
return (h("eds-link", Object.assign({ label: fullLabel, url: item.url, intent: linkIntent, disabled: isLast, current: isLast, "aria-label": fullLabel, size: "small", "icon-small": "false" }, (isLast ? { 'aria-current': 'page' } : {}))));
|
|
396
|
+
})()) : (h("eds-link", { label: "...", url: "#", intent: "strong", current: false, "aria-label": "...", size: "small", "icon-small": "false", icon: "chevron-right" })), !isLast && !item.isHidden && (h("eds-icon-wrapper", { icon: "chevron-right", class: "w-20 h-20" }))));
|
|
397
|
+
}))));
|
|
398
|
+
}
|
|
399
|
+
get el() { return getElement(this); }
|
|
400
|
+
static get watchers() { return {
|
|
401
|
+
"items": ["parseItems"]
|
|
402
|
+
}; }
|
|
403
|
+
};
|
|
404
|
+
EdsBreadcrumb.style = EdsBreadcrumbStyle0;
|
|
405
|
+
|
|
406
|
+
const edsButtonCss = "*,\n::before,\n::after {\n box-sizing: border-box;\n border-width: 0;\n border-style: solid;\n border-color: currentColor;\n}\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\n 1. Change the font styles in all browsers.\n 2. Remove the margin in Firefox and Safari.\n 3. Remove default padding in all browsers.\n */\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit;\n font-feature-settings: inherit;\n font-variation-settings: inherit;\n font-size: 100%;\n font-weight: inherit;\n line-height: inherit;\n letter-spacing: inherit;\n color: inherit;\n margin: 0;\n padding: 0;\n}\n\n/*\n Remove the inheritance of text transform in Edge and Firefox.\n */\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n 1. Correct the inability to style clickable types in iOS and Safari.\n 2. Remove default button styles.\n */\nbutton,\ninput:where([type='button']),\ninput:where([type='reset']),\ninput:where([type='submit']) {\n -webkit-appearance: button;\n /* 1 */\n background-color: transparent;\n /* 2 */\n background-image: none;\n /* 2 */\n}\n\np {\n margin: 0;\n}\n\n/*\n Set the default cursor for buttons.\n */\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\n Make sure disabled buttons don't get the pointer cursor.\n */\n:disabled {\n cursor: default;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden] {\n display: none;\n}\n\n.f-body-01 {\n font-family: var(--f-body-01-fontFamily);\n font-weight: var(--f-body-01-fontWeight);\n font-size: var(--f-body-01-fontSize);\n line-height: var(--f-body-01-lineHeight);\n letter-spacing: var(--f-body-01-letterSpacing);\n}\n\n.f-body-02 {\n font-family: var(--f-body-02-fontFamily);\n font-weight: var(--f-body-02-fontWeight);\n font-size: var(--f-body-02-fontSize);\n line-height: var(--f-body-02-lineHeight);\n letter-spacing: var(--f-body-02-letterSpacing);\n}\n\n.f-ui-01 {\n font-family: var(--f-ui-01-fontFamily);\n font-weight: var(--f-ui-01-fontWeight);\n font-size: var(--f-ui-01-fontSize);\n line-height: var(--f-ui-01-lineHeight);\n letter-spacing: var(--f-ui-01-letterSpacing);\n}\n\n.f-ui-02 {\n font-family: var(--f-ui-02-fontFamily);\n font-weight: var(--f-ui-02-fontWeight);\n font-size: var(--f-ui-02-fontSize);\n line-height: var(--f-ui-02-lineHeight);\n letter-spacing: var(--f-ui-02-letterSpacing);\n}\n\n.border-inside {\n position: relative;\n\n &::after {\n pointer-events: none;\n }\n\n &::after {\n position: absolute;\n }\n\n &::after {\n inset: 0rem;\n }\n\n &::after {\n z-index: 1;\n }\n\n &::after {\n border-radius: 8px;\n }\n\n &::after {\n border-width: 1px;\n }\n\n &::after {\n border-width: 2px;\n }\n\n &::after {\n border-color: rgba(0, 0, 0, .1);\n }\n\n &::after {\n content: '';\n }\n}\n\n.border-inside-inverse {\n &::after {\n border-color: rgba(255, 255, 255, 0.3);\n }\n\n &::after {\n content: '';\n }\n}\n\n.border-inside-pill {\n &::after {\n border-radius: 100px;\n }\n\n &::after {\n content: '';\n }\n}\n\n.loader {\n box-sizing: border-box;\n display: inline-block;\n height: 1rem;\n width: 1rem;\n}\n\n@keyframes spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.loader {\n animation: spin 1s linear infinite;\n border-radius: 9999px;\n border: 3px solid rgba(0, 0, 0, .3);\n border-bottom-color: #000;\n}\n\n/** region TRANSITIONS */\n.effect-color {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 300ms;\n transition-timing-function: cubic-bezier(0, 0, 0.2, 1);\n}\n\n.effect-focus {\n outline-width: 3px;\n outline-offset: 2px;\n outline-color: var(--green-500);\n}\n\n.effect-focus:focus-visible {\n outline-style: solid;\n}\n\n.effect-focus-within {\n outline-width: 3px;\n outline-offset: 2px;\n outline-color: var(--green-500);\n}\n\n.effect-focus-within:focus-within {\n outline-style: solid;\n}\n\n.sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.pointer-events-none {\n pointer-events: none;\n}\n\n.static {\n position: static;\n}\n\n.fixed {\n position: fixed;\n}\n\n.absolute {\n position: absolute;\n}\n\n.relative {\n position: relative;\n}\n\n.sticky {\n position: sticky;\n}\n\n.inset-0 {\n inset: 0rem;\n}\n\n.inset-x-16 {\n left: 1rem;\n right: 1rem;\n}\n\n.-top-8 {\n top: -0.5rem;\n}\n\n.left-0 {\n left: 0rem;\n}\n\n.left-1\\/2 {\n left: 50%;\n}\n\n.left-4 {\n left: 0.25rem;\n}\n\n.left-\\[4px\\] {\n left: 4px;\n}\n\n.right-0 {\n right: 0rem;\n}\n\n.right-4 {\n right: 0.25rem;\n}\n\n.right-8 {\n right: 0.5rem;\n}\n\n.right-\\[6px\\] {\n right: 6px;\n}\n\n.top-0 {\n top: 0rem;\n}\n\n.top-1\\/2 {\n top: 50%;\n}\n\n.m-0 {\n margin: 0rem;\n}\n\n.mx-auto {\n margin-left: auto;\n margin-right: auto;\n}\n\n.-ml-16 {\n margin-left: -1rem;\n}\n\n.-mr-16 {\n margin-right: -1rem;\n}\n\n.ml-0 {\n margin-left: 0rem;\n}\n\n.ml-4 {\n margin-left: 0.25rem;\n}\n\n.ml-64 {\n margin-left: 4rem;\n}\n\n.ml-8 {\n margin-left: 0.5rem;\n}\n\n.ml-auto {\n margin-left: auto;\n}\n\n.mr-4 {\n margin-right: 0.25rem;\n}\n\n.mr-8 {\n margin-right: 0.5rem;\n}\n\n.mr-auto {\n margin-right: auto;\n}\n\n.block {\n display: block;\n}\n\n.\\!block {\n display: block !important;\n}\n\n.inline-block {\n display: inline-block;\n}\n\n.inline {\n display: inline;\n}\n\n.flex {\n display: flex;\n}\n\n.inline-flex {\n display: inline-flex;\n}\n\n.hidden {\n display: none;\n}\n\n.h-20 {\n height: 1.25rem;\n}\n\n.h-24 {\n height: 1.5rem;\n}\n\n.h-36 {\n height: 2.25rem;\n}\n\n.h-44 {\n height: 2.75rem;\n}\n\n.h-auto {\n height: auto;\n}\n\n.h-full {\n height: 100%;\n}\n\n.\\!min-h-20 {\n min-height: 1.25rem !important;\n}\n\n.min-h-screen {\n min-height: 100vh;\n}\n\n.w-20 {\n width: 1.25rem;\n}\n\n.w-full {\n width: 100%;\n}\n\n.flex-none {\n flex: none;\n}\n\n.grow {\n flex-grow: 1;\n}\n\n.cursor-pointer {\n cursor: pointer;\n}\n\n.resize {\n resize: both;\n}\n\n.flex-row {\n flex-direction: row;\n}\n\n.flex-row-reverse {\n flex-direction: row-reverse;\n}\n\n.flex-col {\n flex-direction: column;\n}\n\n.flex-wrap {\n flex-wrap: wrap;\n}\n\n.items-center {\n align-items: center;\n}\n\n.justify-center {\n justify-content: center;\n}\n\n.justify-between {\n justify-content: space-between;\n}\n\n.space-x-2> :not([hidden])~ :not([hidden]) {\n --tw-space-x-reverse: 0;\n margin-right: calc(0.125rem * var(--tw-space-x-reverse));\n margin-left: calc(0.125rem * calc(1 - var(--tw-space-x-reverse)));\n}\n\n.overflow-hidden {\n overflow: hidden;\n}\n\n.overflow-x-auto {\n overflow-x: auto;\n}\n\n.overflow-x-hidden {\n overflow-x: hidden;\n}\n\n.overflow-y-scroll {\n overflow-y: scroll;\n}\n\n.whitespace-nowrap {\n white-space: nowrap;\n}\n\n.break-words {\n overflow-wrap: break-word;\n}\n\n.rounded {\n border-radius: 0.25rem;\n}\n\n.rounded-full {\n border-radius: 9999px;\n}\n\n.rounded-lg {\n border-radius: 16px;\n}\n\n.rounded-md {\n border-radius: 12px;\n}\n\n.rounded-pill {\n border-radius: 100px;\n}\n\n.rounded-sm {\n border-radius: 8px;\n}\n\n.rounded-xxs {\n border-radius: 2px;\n}\n\n.border {\n border-width: 1px;\n}\n\n.border-\\[\\#0034CB\\] {\n --tw-border-opacity: 1;\n border-color: rgb(0 52 203 / var(--tw-border-opacity));\n}\n\n.border-\\[\\#d2d2d2\\] {\n --tw-border-opacity: 1;\n border-color: rgb(210 210 210 / var(--tw-border-opacity));\n}\n\n.border-softest {\n border-color: rgba(0, 0, 0, .05);\n}\n\n.border-b-softer {\n border-bottom-color: rgba(0, 0, 0, .1);\n}\n\n.\\!bg-accent-dark {\n background-color: var(--green-600) !important;\n}\n\n.\\!bg-darker {\n background-color: var(--grey-400) !important;\n}\n\n.\\!bg-strong-dark {\n background-color: var(--grey-800) !important;\n}\n\n.bg-accent {\n background-color: var(--green-500);\n}\n\n.bg-accent-dark {\n background-color: var(--green-600);\n}\n\n.bg-dark {\n background-color: var(--grey-300);\n}\n\n.bg-darker {\n background-color: var(--grey-400);\n}\n\n.bg-overlay {\n background-color: rgba(0, 0, 0, 0.25);\n}\n\n.bg-strong {\n background-color: var(--grey-700);\n}\n\n.bg-strong-dark {\n background-color: var(--grey-800);\n}\n\n.bg-stronger {\n background-color: var(--grey-900);\n}\n\n.bg-strongest {\n background-color: var(--black);\n}\n\n.p-12 {\n padding: 0.75rem;\n}\n\n.p-6 {\n padding: 0.375rem;\n}\n\n.p-8 {\n padding: 0.5rem;\n}\n\n.\\!px-0 {\n padding-left: 0rem !important;\n padding-right: 0rem !important;\n}\n\n.px-12 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\n\n.px-16 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\n\n.py-8 {\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n}\n\n.pl-4 {\n padding-left: 0.25rem;\n}\n\n.pl-8 {\n padding-left: 0.5rem;\n}\n\n.pr-4 {\n padding-right: 0.25rem;\n}\n\n.pr-8 {\n padding-right: 0.5rem;\n}\n\n.\\!text-current {\n color: currentColor !important;\n}\n\n.text-accent {\n color: var(--green-500);\n}\n\n.text-current {\n color: currentColor;\n}\n\n.text-default {\n color: var(--black);\n}\n\n.text-inverse {\n color: var(--white);\n}\n\n.text-lightest {\n color: var(--grey-500);\n}\n\n.opacity-0 {\n opacity: 0;\n}\n\n.shadow {\n --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.shadow-accent {\n --tw-shadow: 0px 0px 12px rgba(0, 201, 89, 0.6);\n --tw-shadow-colored: 0px 0px 12px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.underline-offset-4 {\n text-underline-offset: 0.2em;\n}\n\n.\\@container {\n container-type: inline-size;\n}\n\n.after\\:effect-opacity::after {\n transition-property: opacity;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 300ms;\n transition-timing-function: cubic-bezier(0, 0, 0.2, 1);\n}\n\n.even\\:bg-inverse-softer:nth-child(even) {\n background-color: rgba(255, 255, 255, .15);\n}\n\n.invalid\\:text-lightest:invalid {\n color: var(--grey-500);\n}\n\n.focus-within\\:bg-transparent:focus-within {\n background-color: var(--transparent);\n}\n\n.hover\\:bg-accent-dark:hover {\n background-color: var(--green-600);\n}\n\n.hover\\:bg-dark:hover {\n background-color: var(--grey-300);\n}\n\n.hover\\:bg-darker:hover {\n background-color: var(--grey-400);\n}\n\n.hover\\:bg-default:hover {\n background-color: var(--grey-200);\n}\n\n.hover\\:bg-inverse:hover {\n background-color: var(--white);\n}\n\n.hover\\:bg-strong-dark:hover {\n background-color: var(--grey-800);\n}\n\n.hover\\:bg-transparent:hover {\n background-color: var(--transparent);\n}\n\n.hover\\:text-default:hover {\n color: var(--black);\n}\n\n.hover\\:text-lighter:hover {\n color: var(--grey-600);\n}\n\n.hover\\:\\!underline:hover {\n text-decoration-line: underline !important;\n}\n\n.hover\\:no-underline:hover {\n text-decoration-line: none;\n}\n\n.hover\\:shadow-hover:hover {\n --tw-shadow: 0px 0px 16px rgba(0, 0, 0, 0.2);\n --tw-shadow-colored: 0px 0px 16px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.focus\\:shadow-none:focus {\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.focus\\:outline-none:focus {\n outline: 2px solid transparent;\n outline-offset: 2px;\n}\n\n.disabled\\:cursor-not-allowed:disabled {\n cursor: not-allowed;\n}\n\n.disabled\\:bg-dark:disabled {\n background-color: var(--grey-300);\n}\n\n.disabled\\:text-lightest:disabled {\n color: var(--grey-500);\n}\n\n.aria-disabled\\:cursor-not-allowed[aria-disabled=\"true\"] {\n cursor: not-allowed;\n}\n\n.aria-disabled\\:\\!border-transparent[aria-disabled=\"true\"] {\n border-color: var(--transparent) !important;\n}\n\n.aria-disabled\\:bg-dark[aria-disabled=\"true\"] {\n background-color: var(--grey-300);\n}\n\n.aria-disabled\\:bg-transparent[aria-disabled=\"true\"] {\n background-color: var(--transparent);\n}\n\n.aria-disabled\\:text-light[aria-disabled=\"true\"] {\n color: var(--grey-700);\n}\n\n.aria-disabled\\:text-lightest[aria-disabled=\"true\"] {\n color: var(--grey-500);\n}\n\n.aria-disabled\\:line-through[aria-disabled=\"true\"] {\n text-decoration-line: line-through;\n}\n\n.aria-disabled\\:shadow-none[aria-disabled=\"true\"] {\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n\n.aria-current-page\\:bg-darker[aria-current=\"page\"] {\n background-color: var(--grey-400);\n}\n\n.after\\:absolute::after {\n position: absolute;\n}\n\n.after\\:inset-0::after {\n inset: 0rem;\n}\n\n.after\\:inset-x-0::after {\n left: 0rem;\n right: 0rem;\n}\n\n.after\\:bottom-0::after {\n bottom: 0rem;\n}\n\n.after\\:left-16::after {\n left: 1rem;\n}\n\n.after\\:right-16::after {\n right: 1rem;\n}\n\n.after\\:z-10::after {\n z-index: 10;\n}\n\n.after\\:rounded-lg::after {\n border-radius: 16px;\n}\n\n.after\\:rounded-t-lg::after {\n border-top-left-radius: 16px;\n border-top-right-radius: 16px;\n}\n\n.after\\:border-3::after {\n border-width: 3px;\n}\n\n.after\\:border-b-2::after {\n border-bottom-width: 2px;\n}\n\n.after\\:\\!border-transparent::after {\n border-color: var(--transparent) !important;\n}\n\n.after\\:border-accent::after {\n border-color: var(--green-500);\n}\n\n.after\\:border-softest::after {\n border-color: rgba(0, 0, 0, .05);\n}\n\n.after\\:opacity-0::after {\n opacity: 0;\n}\n\n.after\\:content-\\[\\'\\'\\]::after {\n --tw-content: '';\n content: var(--tw-content);\n}\n\n.hover\\:after\\:\\!border-transparent:hover::after {\n border-color: var(--transparent) !important;\n}\n\n.hover\\:after\\:opacity-100:hover::after {\n opacity: 1;\n}\n\n.focus-visible\\:after\\:opacity-100:focus-visible::after {\n opacity: 1;\n}\n\n.aria-disabled\\:after\\:\\!border-transparent[aria-disabled=\"true\"]::after {\n border-color: var(--transparent) !important;\n}\n\n.hover\\:before\\:opacity-100:hover::before {\n opacity: 1;\n}";
|
|
85
407
|
const EdsButtonStyle0 = edsButtonCss;
|
|
86
408
|
|
|
87
409
|
const EdsButton = class {
|
|
@@ -101,7 +423,7 @@ const EdsButton = class {
|
|
|
101
423
|
secondary: 'border-inside border-inside-inverse text-inverse bg-strongest hover:bg-strong-dark',
|
|
102
424
|
tertiary: 'border-inside after:border-softest bg-dark hover:bg-darker',
|
|
103
425
|
ghost: 'border-inside hover:bg-darker',
|
|
104
|
-
ghostInverse: 'border-inside hover:bg-dark'
|
|
426
|
+
ghostInverse: 'border-inside text-lightest hover:bg-dark'
|
|
105
427
|
},
|
|
106
428
|
loading: {
|
|
107
429
|
true: 'pointer-events-none',
|
|
@@ -211,8 +533,7 @@ const EdsButton = class {
|
|
|
211
533
|
}
|
|
212
534
|
handleClick(event) {
|
|
213
535
|
var _a, _b;
|
|
214
|
-
if (this.disabled) {
|
|
215
|
-
// Prevent navigation if the link is disabled
|
|
536
|
+
if (this.disabled || this.loading) {
|
|
216
537
|
event.preventDefault();
|
|
217
538
|
return;
|
|
218
539
|
}
|
|
@@ -228,6 +549,16 @@ const EdsButton = class {
|
|
|
228
549
|
this.triggerClick(); // Trigger the passed-in function
|
|
229
550
|
}
|
|
230
551
|
}
|
|
552
|
+
handleKeyDown(event) {
|
|
553
|
+
if (this.disabled || this.loading) {
|
|
554
|
+
// Fix: check loading too
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
if (event.key === 'Enter' || (this.elementType === 'a' && event.key === ' ')) {
|
|
558
|
+
event.preventDefault();
|
|
559
|
+
this.handleClick(event);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
231
562
|
render() {
|
|
232
563
|
const classes = this.button({
|
|
233
564
|
intent: this.intent,
|
|
@@ -239,18 +570,2502 @@ const EdsButton = class {
|
|
|
239
570
|
iconSmall: this.iconSmall
|
|
240
571
|
});
|
|
241
572
|
const ElementType = this.elementType;
|
|
242
|
-
|
|
573
|
+
const isInteractive = !this.disabled && !this.loading;
|
|
574
|
+
return (h(Host, { key: '835cc81d3563abf1b5cb4c21165de1ef726d1e43' }, h(ElementType, { key: 'df05b2b2152e707e5fdd6028c5f557097d7e2b04', tabindex: isInteractive ? '0' : '-1', "aria-label": this.label ? undefined : this.ariaLabel, "aria-disabled": this.disabled || this.loading ? 'true' : undefined, "aria-busy": this.loading ? 'true' : undefined, disabled: this.elementType === 'button' ? this.disabled || this.loading : undefined, role: this.elementType === 'a' ? 'button' : undefined, class: `${classes || ''} ${this.extraClass || ''}`, onClick: (event) => this.handleClick(event), onKeyDown: (event) => this.handleKeyDown(event) }, this.label && (h("span", { key: '27c7473403e7c1bfd3dfc270151d44dbb639ceb3', class: this.loading ? 'opacity-0' : '', "aria-hidden": this.loading ? 'true' : undefined }, this.label)), this.loading && (h("span", { key: 'f52496884816bc299fb76c1afae5e4798bf642d2', class: "absolute inset-0 flex items-center justify-center", "aria-hidden": "true" }, h("span", { key: 'd42bf2c229f6956a1e0dbe64aa6c79ad5608ca5c', class: "loader", style: {
|
|
243
575
|
border: `3px solid ${this.intent === 'secondary' ? 'rgba(255, 255, 255, .3)' : 'rgba(0, 0, 0, .3)'}`,
|
|
244
576
|
borderBottomColor: this.intent === 'secondary' ? '#fff' : '#000'
|
|
245
577
|
} }))), this.icon ? (h("eds-icon-wrapper", { class: `
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
578
|
+
flex inline-flex items-center justify-center
|
|
579
|
+
${this.size === 'large' ? 'h-24 w-24' : 'h-20 w-20'}
|
|
580
|
+
`, icon: this.icon, "aria-hidden": "true" })) : null)));
|
|
249
581
|
}
|
|
582
|
+
static get delegatesFocus() { return true; }
|
|
250
583
|
get el() { return getElement(this); }
|
|
251
584
|
};
|
|
252
585
|
EdsButton.style = EdsButtonStyle0;
|
|
253
586
|
|
|
587
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
588
|
+
|
|
589
|
+
var prism = {exports: {}};
|
|
590
|
+
|
|
591
|
+
(function (module) {
|
|
592
|
+
/* **********************************************
|
|
593
|
+
Begin prism-core.js
|
|
594
|
+
********************************************** */
|
|
595
|
+
|
|
596
|
+
/// <reference lib="WebWorker"/>
|
|
597
|
+
|
|
598
|
+
var _self = (typeof window !== 'undefined')
|
|
599
|
+
? window // if in browser
|
|
600
|
+
: (
|
|
601
|
+
(typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
|
|
602
|
+
? self // if in worker
|
|
603
|
+
: {} // if in node js
|
|
604
|
+
);
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
608
|
+
*
|
|
609
|
+
* @license MIT <https://opensource.org/licenses/MIT>
|
|
610
|
+
* @author Lea Verou <https://lea.verou.me>
|
|
611
|
+
* @namespace
|
|
612
|
+
* @public
|
|
613
|
+
*/
|
|
614
|
+
var Prism = (function (_self) {
|
|
615
|
+
|
|
616
|
+
// Private helper vars
|
|
617
|
+
var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
|
|
618
|
+
var uniqueId = 0;
|
|
619
|
+
|
|
620
|
+
// The grammar object for plaintext
|
|
621
|
+
var plainTextGrammar = {};
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
var _ = {
|
|
625
|
+
/**
|
|
626
|
+
* By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
|
|
627
|
+
* current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
|
|
628
|
+
* additional languages or plugins yourself.
|
|
629
|
+
*
|
|
630
|
+
* By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
|
|
631
|
+
*
|
|
632
|
+
* You obviously have to change this value before the automatic highlighting started. To do this, you can add an
|
|
633
|
+
* empty Prism object into the global scope before loading the Prism script like this:
|
|
634
|
+
*
|
|
635
|
+
* ```js
|
|
636
|
+
* window.Prism = window.Prism || {};
|
|
637
|
+
* Prism.manual = true;
|
|
638
|
+
* // add a new <script> to load Prism's script
|
|
639
|
+
* ```
|
|
640
|
+
*
|
|
641
|
+
* @default false
|
|
642
|
+
* @type {boolean}
|
|
643
|
+
* @memberof Prism
|
|
644
|
+
* @public
|
|
645
|
+
*/
|
|
646
|
+
manual: _self.Prism && _self.Prism.manual,
|
|
647
|
+
/**
|
|
648
|
+
* By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
|
|
649
|
+
* `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
|
|
650
|
+
* own worker, you don't want it to do this.
|
|
651
|
+
*
|
|
652
|
+
* By setting this value to `true`, Prism will not add its own listeners to the worker.
|
|
653
|
+
*
|
|
654
|
+
* You obviously have to change this value before Prism executes. To do this, you can add an
|
|
655
|
+
* empty Prism object into the global scope before loading the Prism script like this:
|
|
656
|
+
*
|
|
657
|
+
* ```js
|
|
658
|
+
* window.Prism = window.Prism || {};
|
|
659
|
+
* Prism.disableWorkerMessageHandler = true;
|
|
660
|
+
* // Load Prism's script
|
|
661
|
+
* ```
|
|
662
|
+
*
|
|
663
|
+
* @default false
|
|
664
|
+
* @type {boolean}
|
|
665
|
+
* @memberof Prism
|
|
666
|
+
* @public
|
|
667
|
+
*/
|
|
668
|
+
disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* A namespace for utility methods.
|
|
672
|
+
*
|
|
673
|
+
* All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
|
|
674
|
+
* change or disappear at any time.
|
|
675
|
+
*
|
|
676
|
+
* @namespace
|
|
677
|
+
* @memberof Prism
|
|
678
|
+
*/
|
|
679
|
+
util: {
|
|
680
|
+
encode: function encode(tokens) {
|
|
681
|
+
if (tokens instanceof Token) {
|
|
682
|
+
return new Token(tokens.type, encode(tokens.content), tokens.alias);
|
|
683
|
+
} else if (Array.isArray(tokens)) {
|
|
684
|
+
return tokens.map(encode);
|
|
685
|
+
} else {
|
|
686
|
+
return tokens.replace(/&/g, '&').replace(/</g, '<').replace(/\u00a0/g, ' ');
|
|
687
|
+
}
|
|
688
|
+
},
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Returns the name of the type of the given value.
|
|
692
|
+
*
|
|
693
|
+
* @param {any} o
|
|
694
|
+
* @returns {string}
|
|
695
|
+
* @example
|
|
696
|
+
* type(null) === 'Null'
|
|
697
|
+
* type(undefined) === 'Undefined'
|
|
698
|
+
* type(123) === 'Number'
|
|
699
|
+
* type('foo') === 'String'
|
|
700
|
+
* type(true) === 'Boolean'
|
|
701
|
+
* type([1, 2]) === 'Array'
|
|
702
|
+
* type({}) === 'Object'
|
|
703
|
+
* type(String) === 'Function'
|
|
704
|
+
* type(/abc+/) === 'RegExp'
|
|
705
|
+
*/
|
|
706
|
+
type: function (o) {
|
|
707
|
+
return Object.prototype.toString.call(o).slice(8, -1);
|
|
708
|
+
},
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Returns a unique number for the given object. Later calls will still return the same number.
|
|
712
|
+
*
|
|
713
|
+
* @param {Object} obj
|
|
714
|
+
* @returns {number}
|
|
715
|
+
*/
|
|
716
|
+
objId: function (obj) {
|
|
717
|
+
if (!obj['__id']) {
|
|
718
|
+
Object.defineProperty(obj, '__id', { value: ++uniqueId });
|
|
719
|
+
}
|
|
720
|
+
return obj['__id'];
|
|
721
|
+
},
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Creates a deep clone of the given object.
|
|
725
|
+
*
|
|
726
|
+
* The main intended use of this function is to clone language definitions.
|
|
727
|
+
*
|
|
728
|
+
* @param {T} o
|
|
729
|
+
* @param {Record<number, any>} [visited]
|
|
730
|
+
* @returns {T}
|
|
731
|
+
* @template T
|
|
732
|
+
*/
|
|
733
|
+
clone: function deepClone(o, visited) {
|
|
734
|
+
visited = visited || {};
|
|
735
|
+
|
|
736
|
+
var clone; var id;
|
|
737
|
+
switch (_.util.type(o)) {
|
|
738
|
+
case 'Object':
|
|
739
|
+
id = _.util.objId(o);
|
|
740
|
+
if (visited[id]) {
|
|
741
|
+
return visited[id];
|
|
742
|
+
}
|
|
743
|
+
clone = /** @type {Record<string, any>} */ ({});
|
|
744
|
+
visited[id] = clone;
|
|
745
|
+
|
|
746
|
+
for (var key in o) {
|
|
747
|
+
if (o.hasOwnProperty(key)) {
|
|
748
|
+
clone[key] = deepClone(o[key], visited);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
return /** @type {any} */ (clone);
|
|
753
|
+
|
|
754
|
+
case 'Array':
|
|
755
|
+
id = _.util.objId(o);
|
|
756
|
+
if (visited[id]) {
|
|
757
|
+
return visited[id];
|
|
758
|
+
}
|
|
759
|
+
clone = [];
|
|
760
|
+
visited[id] = clone;
|
|
761
|
+
|
|
762
|
+
(/** @type {Array} */(/** @type {any} */(o))).forEach(function (v, i) {
|
|
763
|
+
clone[i] = deepClone(v, visited);
|
|
764
|
+
});
|
|
765
|
+
|
|
766
|
+
return /** @type {any} */ (clone);
|
|
767
|
+
|
|
768
|
+
default:
|
|
769
|
+
return o;
|
|
770
|
+
}
|
|
771
|
+
},
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
|
|
775
|
+
*
|
|
776
|
+
* If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
|
|
777
|
+
*
|
|
778
|
+
* @param {Element} element
|
|
779
|
+
* @returns {string}
|
|
780
|
+
*/
|
|
781
|
+
getLanguage: function (element) {
|
|
782
|
+
while (element) {
|
|
783
|
+
var m = lang.exec(element.className);
|
|
784
|
+
if (m) {
|
|
785
|
+
return m[1].toLowerCase();
|
|
786
|
+
}
|
|
787
|
+
element = element.parentElement;
|
|
788
|
+
}
|
|
789
|
+
return 'none';
|
|
790
|
+
},
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* Sets the Prism `language-xxxx` class of the given element.
|
|
794
|
+
*
|
|
795
|
+
* @param {Element} element
|
|
796
|
+
* @param {string} language
|
|
797
|
+
* @returns {void}
|
|
798
|
+
*/
|
|
799
|
+
setLanguage: function (element, language) {
|
|
800
|
+
// remove all `language-xxxx` classes
|
|
801
|
+
// (this might leave behind a leading space)
|
|
802
|
+
element.className = element.className.replace(RegExp(lang, 'gi'), '');
|
|
803
|
+
|
|
804
|
+
// add the new `language-xxxx` class
|
|
805
|
+
// (using `classList` will automatically clean up spaces for us)
|
|
806
|
+
element.classList.add('language-' + language);
|
|
807
|
+
},
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* Returns the script element that is currently executing.
|
|
811
|
+
*
|
|
812
|
+
* This does __not__ work for line script element.
|
|
813
|
+
*
|
|
814
|
+
* @returns {HTMLScriptElement | null}
|
|
815
|
+
*/
|
|
816
|
+
currentScript: function () {
|
|
817
|
+
if (typeof document === 'undefined') {
|
|
818
|
+
return null;
|
|
819
|
+
}
|
|
820
|
+
if ('currentScript' in document && 1 < 2 /* hack to trip TS' flow analysis */) {
|
|
821
|
+
return /** @type {any} */ (document.currentScript);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
// IE11 workaround
|
|
825
|
+
// we'll get the src of the current script by parsing IE11's error stack trace
|
|
826
|
+
// this will not work for inline scripts
|
|
827
|
+
|
|
828
|
+
try {
|
|
829
|
+
throw new Error();
|
|
830
|
+
} catch (err) {
|
|
831
|
+
// Get file src url from stack. Specifically works with the format of stack traces in IE.
|
|
832
|
+
// A stack will look like this:
|
|
833
|
+
//
|
|
834
|
+
// Error
|
|
835
|
+
// at _.util.currentScript (http://localhost/components/prism-core.js:119:5)
|
|
836
|
+
// at Global code (http://localhost/components/prism-core.js:606:1)
|
|
837
|
+
|
|
838
|
+
var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
|
|
839
|
+
if (src) {
|
|
840
|
+
var scripts = document.getElementsByTagName('script');
|
|
841
|
+
for (var i in scripts) {
|
|
842
|
+
if (scripts[i].src == src) {
|
|
843
|
+
return scripts[i];
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
return null;
|
|
848
|
+
}
|
|
849
|
+
},
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* Returns whether a given class is active for `element`.
|
|
853
|
+
*
|
|
854
|
+
* The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
|
|
855
|
+
* if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
|
|
856
|
+
* given class is just the given class with a `no-` prefix.
|
|
857
|
+
*
|
|
858
|
+
* Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
|
|
859
|
+
* closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
|
|
860
|
+
* ancestors have the given class or the negated version of it, then the default activation will be returned.
|
|
861
|
+
*
|
|
862
|
+
* In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
|
|
863
|
+
* version of it, the class is considered active.
|
|
864
|
+
*
|
|
865
|
+
* @param {Element} element
|
|
866
|
+
* @param {string} className
|
|
867
|
+
* @param {boolean} [defaultActivation=false]
|
|
868
|
+
* @returns {boolean}
|
|
869
|
+
*/
|
|
870
|
+
isActive: function (element, className, defaultActivation) {
|
|
871
|
+
var no = 'no-' + className;
|
|
872
|
+
|
|
873
|
+
while (element) {
|
|
874
|
+
var classList = element.classList;
|
|
875
|
+
if (classList.contains(className)) {
|
|
876
|
+
return true;
|
|
877
|
+
}
|
|
878
|
+
if (classList.contains(no)) {
|
|
879
|
+
return false;
|
|
880
|
+
}
|
|
881
|
+
element = element.parentElement;
|
|
882
|
+
}
|
|
883
|
+
return !!defaultActivation;
|
|
884
|
+
}
|
|
885
|
+
},
|
|
886
|
+
|
|
887
|
+
/**
|
|
888
|
+
* This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
|
|
889
|
+
*
|
|
890
|
+
* @namespace
|
|
891
|
+
* @memberof Prism
|
|
892
|
+
* @public
|
|
893
|
+
*/
|
|
894
|
+
languages: {
|
|
895
|
+
/**
|
|
896
|
+
* The grammar for plain, unformatted text.
|
|
897
|
+
*/
|
|
898
|
+
plain: plainTextGrammar,
|
|
899
|
+
plaintext: plainTextGrammar,
|
|
900
|
+
text: plainTextGrammar,
|
|
901
|
+
txt: plainTextGrammar,
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* Creates a deep copy of the language with the given id and appends the given tokens.
|
|
905
|
+
*
|
|
906
|
+
* If a token in `redef` also appears in the copied language, then the existing token in the copied language
|
|
907
|
+
* will be overwritten at its original position.
|
|
908
|
+
*
|
|
909
|
+
* ## Best practices
|
|
910
|
+
*
|
|
911
|
+
* Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
|
|
912
|
+
* doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
|
|
913
|
+
* understand the language definition because, normally, the order of tokens matters in Prism grammars.
|
|
914
|
+
*
|
|
915
|
+
* Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
|
|
916
|
+
* Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
|
|
917
|
+
*
|
|
918
|
+
* @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
|
|
919
|
+
* @param {Grammar} redef The new tokens to append.
|
|
920
|
+
* @returns {Grammar} The new language created.
|
|
921
|
+
* @public
|
|
922
|
+
* @example
|
|
923
|
+
* Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
|
|
924
|
+
* // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
|
|
925
|
+
* // at its original position
|
|
926
|
+
* 'comment': { ... },
|
|
927
|
+
* // CSS doesn't have a 'color' token, so this token will be appended
|
|
928
|
+
* 'color': /\b(?:red|green|blue)\b/
|
|
929
|
+
* });
|
|
930
|
+
*/
|
|
931
|
+
extend: function (id, redef) {
|
|
932
|
+
var lang = _.util.clone(_.languages[id]);
|
|
933
|
+
|
|
934
|
+
for (var key in redef) {
|
|
935
|
+
lang[key] = redef[key];
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
return lang;
|
|
939
|
+
},
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Inserts tokens _before_ another token in a language definition or any other grammar.
|
|
943
|
+
*
|
|
944
|
+
* ## Usage
|
|
945
|
+
*
|
|
946
|
+
* This helper method makes it easy to modify existing languages. For example, the CSS language definition
|
|
947
|
+
* not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
|
|
948
|
+
* in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
|
|
949
|
+
* appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
|
|
950
|
+
* this:
|
|
951
|
+
*
|
|
952
|
+
* ```js
|
|
953
|
+
* Prism.languages.markup.style = {
|
|
954
|
+
* // token
|
|
955
|
+
* };
|
|
956
|
+
* ```
|
|
957
|
+
*
|
|
958
|
+
* then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
|
|
959
|
+
* before existing tokens. For the CSS example above, you would use it like this:
|
|
960
|
+
*
|
|
961
|
+
* ```js
|
|
962
|
+
* Prism.languages.insertBefore('markup', 'cdata', {
|
|
963
|
+
* 'style': {
|
|
964
|
+
* // token
|
|
965
|
+
* }
|
|
966
|
+
* });
|
|
967
|
+
* ```
|
|
968
|
+
*
|
|
969
|
+
* ## Special cases
|
|
970
|
+
*
|
|
971
|
+
* If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
|
|
972
|
+
* will be ignored.
|
|
973
|
+
*
|
|
974
|
+
* This behavior can be used to insert tokens after `before`:
|
|
975
|
+
*
|
|
976
|
+
* ```js
|
|
977
|
+
* Prism.languages.insertBefore('markup', 'comment', {
|
|
978
|
+
* 'comment': Prism.languages.markup.comment,
|
|
979
|
+
* // tokens after 'comment'
|
|
980
|
+
* });
|
|
981
|
+
* ```
|
|
982
|
+
*
|
|
983
|
+
* ## Limitations
|
|
984
|
+
*
|
|
985
|
+
* The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
|
|
986
|
+
* properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
|
|
987
|
+
* differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
|
|
988
|
+
* deleting properties which is necessary to insert at arbitrary positions.
|
|
989
|
+
*
|
|
990
|
+
* To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
|
|
991
|
+
* Instead, it will create a new object and replace all references to the target object with the new one. This
|
|
992
|
+
* can be done without temporarily deleting properties, so the iteration order is well-defined.
|
|
993
|
+
*
|
|
994
|
+
* However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
|
|
995
|
+
* you hold the target object in a variable, then the value of the variable will not change.
|
|
996
|
+
*
|
|
997
|
+
* ```js
|
|
998
|
+
* var oldMarkup = Prism.languages.markup;
|
|
999
|
+
* var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
|
|
1000
|
+
*
|
|
1001
|
+
* assert(oldMarkup !== Prism.languages.markup);
|
|
1002
|
+
* assert(newMarkup === Prism.languages.markup);
|
|
1003
|
+
* ```
|
|
1004
|
+
*
|
|
1005
|
+
* @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
|
|
1006
|
+
* object to be modified.
|
|
1007
|
+
* @param {string} before The key to insert before.
|
|
1008
|
+
* @param {Grammar} insert An object containing the key-value pairs to be inserted.
|
|
1009
|
+
* @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
|
|
1010
|
+
* object to be modified.
|
|
1011
|
+
*
|
|
1012
|
+
* Defaults to `Prism.languages`.
|
|
1013
|
+
* @returns {Grammar} The new grammar object.
|
|
1014
|
+
* @public
|
|
1015
|
+
*/
|
|
1016
|
+
insertBefore: function (inside, before, insert, root) {
|
|
1017
|
+
root = root || /** @type {any} */ (_.languages);
|
|
1018
|
+
var grammar = root[inside];
|
|
1019
|
+
/** @type {Grammar} */
|
|
1020
|
+
var ret = {};
|
|
1021
|
+
|
|
1022
|
+
for (var token in grammar) {
|
|
1023
|
+
if (grammar.hasOwnProperty(token)) {
|
|
1024
|
+
|
|
1025
|
+
if (token == before) {
|
|
1026
|
+
for (var newToken in insert) {
|
|
1027
|
+
if (insert.hasOwnProperty(newToken)) {
|
|
1028
|
+
ret[newToken] = insert[newToken];
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
// Do not insert token which also occur in insert. See #1525
|
|
1034
|
+
if (!insert.hasOwnProperty(token)) {
|
|
1035
|
+
ret[token] = grammar[token];
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
var old = root[inside];
|
|
1041
|
+
root[inside] = ret;
|
|
1042
|
+
|
|
1043
|
+
// Update references in other language definitions
|
|
1044
|
+
_.languages.DFS(_.languages, function (key, value) {
|
|
1045
|
+
if (value === old && key != inside) {
|
|
1046
|
+
this[key] = ret;
|
|
1047
|
+
}
|
|
1048
|
+
});
|
|
1049
|
+
|
|
1050
|
+
return ret;
|
|
1051
|
+
},
|
|
1052
|
+
|
|
1053
|
+
// Traverse a language definition with Depth First Search
|
|
1054
|
+
DFS: function DFS(o, callback, type, visited) {
|
|
1055
|
+
visited = visited || {};
|
|
1056
|
+
|
|
1057
|
+
var objId = _.util.objId;
|
|
1058
|
+
|
|
1059
|
+
for (var i in o) {
|
|
1060
|
+
if (o.hasOwnProperty(i)) {
|
|
1061
|
+
callback.call(o, i, o[i], type || i);
|
|
1062
|
+
|
|
1063
|
+
var property = o[i];
|
|
1064
|
+
var propertyType = _.util.type(property);
|
|
1065
|
+
|
|
1066
|
+
if (propertyType === 'Object' && !visited[objId(property)]) {
|
|
1067
|
+
visited[objId(property)] = true;
|
|
1068
|
+
DFS(property, callback, null, visited);
|
|
1069
|
+
} else if (propertyType === 'Array' && !visited[objId(property)]) {
|
|
1070
|
+
visited[objId(property)] = true;
|
|
1071
|
+
DFS(property, callback, i, visited);
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
},
|
|
1077
|
+
|
|
1078
|
+
plugins: {},
|
|
1079
|
+
|
|
1080
|
+
/**
|
|
1081
|
+
* This is the most high-level function in Prism’s API.
|
|
1082
|
+
* It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
|
|
1083
|
+
* each one of them.
|
|
1084
|
+
*
|
|
1085
|
+
* This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
|
|
1086
|
+
*
|
|
1087
|
+
* @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
|
|
1088
|
+
* @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
|
|
1089
|
+
* @memberof Prism
|
|
1090
|
+
* @public
|
|
1091
|
+
*/
|
|
1092
|
+
highlightAll: function (async, callback) {
|
|
1093
|
+
_.highlightAllUnder(document, async, callback);
|
|
1094
|
+
},
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
|
|
1098
|
+
* {@link Prism.highlightElement} on each one of them.
|
|
1099
|
+
*
|
|
1100
|
+
* The following hooks will be run:
|
|
1101
|
+
* 1. `before-highlightall`
|
|
1102
|
+
* 2. `before-all-elements-highlight`
|
|
1103
|
+
* 3. All hooks of {@link Prism.highlightElement} for each element.
|
|
1104
|
+
*
|
|
1105
|
+
* @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
|
|
1106
|
+
* @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
|
|
1107
|
+
* @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
|
|
1108
|
+
* @memberof Prism
|
|
1109
|
+
* @public
|
|
1110
|
+
*/
|
|
1111
|
+
highlightAllUnder: function (container, async, callback) {
|
|
1112
|
+
var env = {
|
|
1113
|
+
callback: callback,
|
|
1114
|
+
container: container,
|
|
1115
|
+
selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1118
|
+
_.hooks.run('before-highlightall', env);
|
|
1119
|
+
|
|
1120
|
+
env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
|
|
1121
|
+
|
|
1122
|
+
_.hooks.run('before-all-elements-highlight', env);
|
|
1123
|
+
|
|
1124
|
+
for (var i = 0, element; (element = env.elements[i++]);) {
|
|
1125
|
+
_.highlightElement(element, async === true, env.callback);
|
|
1126
|
+
}
|
|
1127
|
+
},
|
|
1128
|
+
|
|
1129
|
+
/**
|
|
1130
|
+
* Highlights the code inside a single element.
|
|
1131
|
+
*
|
|
1132
|
+
* The following hooks will be run:
|
|
1133
|
+
* 1. `before-sanity-check`
|
|
1134
|
+
* 2. `before-highlight`
|
|
1135
|
+
* 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
|
|
1136
|
+
* 4. `before-insert`
|
|
1137
|
+
* 5. `after-highlight`
|
|
1138
|
+
* 6. `complete`
|
|
1139
|
+
*
|
|
1140
|
+
* Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
|
|
1141
|
+
* the element's language.
|
|
1142
|
+
*
|
|
1143
|
+
* @param {Element} element The element containing the code.
|
|
1144
|
+
* It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
|
|
1145
|
+
* @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
|
|
1146
|
+
* to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
|
|
1147
|
+
* [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
|
|
1148
|
+
*
|
|
1149
|
+
* Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
|
|
1150
|
+
* asynchronous highlighting to work. You can build your own bundle on the
|
|
1151
|
+
* [Download page](https://prismjs.com/download.html).
|
|
1152
|
+
* @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
|
|
1153
|
+
* Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
|
|
1154
|
+
* @memberof Prism
|
|
1155
|
+
* @public
|
|
1156
|
+
*/
|
|
1157
|
+
highlightElement: function (element, async, callback) {
|
|
1158
|
+
// Find language
|
|
1159
|
+
var language = _.util.getLanguage(element);
|
|
1160
|
+
var grammar = _.languages[language];
|
|
1161
|
+
|
|
1162
|
+
// Set language on the element, if not present
|
|
1163
|
+
_.util.setLanguage(element, language);
|
|
1164
|
+
|
|
1165
|
+
// Set language on the parent, for styling
|
|
1166
|
+
var parent = element.parentElement;
|
|
1167
|
+
if (parent && parent.nodeName.toLowerCase() === 'pre') {
|
|
1168
|
+
_.util.setLanguage(parent, language);
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
var code = element.textContent;
|
|
1172
|
+
|
|
1173
|
+
var env = {
|
|
1174
|
+
element: element,
|
|
1175
|
+
language: language,
|
|
1176
|
+
grammar: grammar,
|
|
1177
|
+
code: code
|
|
1178
|
+
};
|
|
1179
|
+
|
|
1180
|
+
function insertHighlightedCode(highlightedCode) {
|
|
1181
|
+
env.highlightedCode = highlightedCode;
|
|
1182
|
+
|
|
1183
|
+
_.hooks.run('before-insert', env);
|
|
1184
|
+
|
|
1185
|
+
env.element.innerHTML = env.highlightedCode;
|
|
1186
|
+
|
|
1187
|
+
_.hooks.run('after-highlight', env);
|
|
1188
|
+
_.hooks.run('complete', env);
|
|
1189
|
+
callback && callback.call(env.element);
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
_.hooks.run('before-sanity-check', env);
|
|
1193
|
+
|
|
1194
|
+
// plugins may change/add the parent/element
|
|
1195
|
+
parent = env.element.parentElement;
|
|
1196
|
+
if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {
|
|
1197
|
+
parent.setAttribute('tabindex', '0');
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
if (!env.code) {
|
|
1201
|
+
_.hooks.run('complete', env);
|
|
1202
|
+
callback && callback.call(env.element);
|
|
1203
|
+
return;
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
_.hooks.run('before-highlight', env);
|
|
1207
|
+
|
|
1208
|
+
if (!env.grammar) {
|
|
1209
|
+
insertHighlightedCode(_.util.encode(env.code));
|
|
1210
|
+
return;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
if (async && _self.Worker) {
|
|
1214
|
+
var worker = new Worker(_.filename);
|
|
1215
|
+
|
|
1216
|
+
worker.onmessage = function (evt) {
|
|
1217
|
+
insertHighlightedCode(evt.data);
|
|
1218
|
+
};
|
|
1219
|
+
|
|
1220
|
+
worker.postMessage(JSON.stringify({
|
|
1221
|
+
language: env.language,
|
|
1222
|
+
code: env.code,
|
|
1223
|
+
immediateClose: true
|
|
1224
|
+
}));
|
|
1225
|
+
} else {
|
|
1226
|
+
insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
|
|
1227
|
+
}
|
|
1228
|
+
},
|
|
1229
|
+
|
|
1230
|
+
/**
|
|
1231
|
+
* Low-level function, only use if you know what you’re doing. It accepts a string of text as input
|
|
1232
|
+
* and the language definitions to use, and returns a string with the HTML produced.
|
|
1233
|
+
*
|
|
1234
|
+
* The following hooks will be run:
|
|
1235
|
+
* 1. `before-tokenize`
|
|
1236
|
+
* 2. `after-tokenize`
|
|
1237
|
+
* 3. `wrap`: On each {@link Token}.
|
|
1238
|
+
*
|
|
1239
|
+
* @param {string} text A string with the code to be highlighted.
|
|
1240
|
+
* @param {Grammar} grammar An object containing the tokens to use.
|
|
1241
|
+
*
|
|
1242
|
+
* Usually a language definition like `Prism.languages.markup`.
|
|
1243
|
+
* @param {string} language The name of the language definition passed to `grammar`.
|
|
1244
|
+
* @returns {string} The highlighted HTML.
|
|
1245
|
+
* @memberof Prism
|
|
1246
|
+
* @public
|
|
1247
|
+
* @example
|
|
1248
|
+
* Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
|
|
1249
|
+
*/
|
|
1250
|
+
highlight: function (text, grammar, language) {
|
|
1251
|
+
var env = {
|
|
1252
|
+
code: text,
|
|
1253
|
+
grammar: grammar,
|
|
1254
|
+
language: language
|
|
1255
|
+
};
|
|
1256
|
+
_.hooks.run('before-tokenize', env);
|
|
1257
|
+
if (!env.grammar) {
|
|
1258
|
+
throw new Error('The language "' + env.language + '" has no grammar.');
|
|
1259
|
+
}
|
|
1260
|
+
env.tokens = _.tokenize(env.code, env.grammar);
|
|
1261
|
+
_.hooks.run('after-tokenize', env);
|
|
1262
|
+
return Token.stringify(_.util.encode(env.tokens), env.language);
|
|
1263
|
+
},
|
|
1264
|
+
|
|
1265
|
+
/**
|
|
1266
|
+
* This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
|
|
1267
|
+
* and the language definitions to use, and returns an array with the tokenized code.
|
|
1268
|
+
*
|
|
1269
|
+
* When the language definition includes nested tokens, the function is called recursively on each of these tokens.
|
|
1270
|
+
*
|
|
1271
|
+
* This method could be useful in other contexts as well, as a very crude parser.
|
|
1272
|
+
*
|
|
1273
|
+
* @param {string} text A string with the code to be highlighted.
|
|
1274
|
+
* @param {Grammar} grammar An object containing the tokens to use.
|
|
1275
|
+
*
|
|
1276
|
+
* Usually a language definition like `Prism.languages.markup`.
|
|
1277
|
+
* @returns {TokenStream} An array of strings and tokens, a token stream.
|
|
1278
|
+
* @memberof Prism
|
|
1279
|
+
* @public
|
|
1280
|
+
* @example
|
|
1281
|
+
* let code = `var foo = 0;`;
|
|
1282
|
+
* let tokens = Prism.tokenize(code, Prism.languages.javascript);
|
|
1283
|
+
* tokens.forEach(token => {
|
|
1284
|
+
* if (token instanceof Prism.Token && token.type === 'number') {
|
|
1285
|
+
* console.log(`Found numeric literal: ${token.content}`);
|
|
1286
|
+
* }
|
|
1287
|
+
* });
|
|
1288
|
+
*/
|
|
1289
|
+
tokenize: function (text, grammar) {
|
|
1290
|
+
var rest = grammar.rest;
|
|
1291
|
+
if (rest) {
|
|
1292
|
+
for (var token in rest) {
|
|
1293
|
+
grammar[token] = rest[token];
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
delete grammar.rest;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
var tokenList = new LinkedList();
|
|
1300
|
+
addAfter(tokenList, tokenList.head, text);
|
|
1301
|
+
|
|
1302
|
+
matchGrammar(text, tokenList, grammar, tokenList.head, 0);
|
|
1303
|
+
|
|
1304
|
+
return toArray(tokenList);
|
|
1305
|
+
},
|
|
1306
|
+
|
|
1307
|
+
/**
|
|
1308
|
+
* @namespace
|
|
1309
|
+
* @memberof Prism
|
|
1310
|
+
* @public
|
|
1311
|
+
*/
|
|
1312
|
+
hooks: {
|
|
1313
|
+
all: {},
|
|
1314
|
+
|
|
1315
|
+
/**
|
|
1316
|
+
* Adds the given callback to the list of callbacks for the given hook.
|
|
1317
|
+
*
|
|
1318
|
+
* The callback will be invoked when the hook it is registered for is run.
|
|
1319
|
+
* Hooks are usually directly run by a highlight function but you can also run hooks yourself.
|
|
1320
|
+
*
|
|
1321
|
+
* One callback function can be registered to multiple hooks and the same hook multiple times.
|
|
1322
|
+
*
|
|
1323
|
+
* @param {string} name The name of the hook.
|
|
1324
|
+
* @param {HookCallback} callback The callback function which is given environment variables.
|
|
1325
|
+
* @public
|
|
1326
|
+
*/
|
|
1327
|
+
add: function (name, callback) {
|
|
1328
|
+
var hooks = _.hooks.all;
|
|
1329
|
+
|
|
1330
|
+
hooks[name] = hooks[name] || [];
|
|
1331
|
+
|
|
1332
|
+
hooks[name].push(callback);
|
|
1333
|
+
},
|
|
1334
|
+
|
|
1335
|
+
/**
|
|
1336
|
+
* Runs a hook invoking all registered callbacks with the given environment variables.
|
|
1337
|
+
*
|
|
1338
|
+
* Callbacks will be invoked synchronously and in the order in which they were registered.
|
|
1339
|
+
*
|
|
1340
|
+
* @param {string} name The name of the hook.
|
|
1341
|
+
* @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
|
|
1342
|
+
* @public
|
|
1343
|
+
*/
|
|
1344
|
+
run: function (name, env) {
|
|
1345
|
+
var callbacks = _.hooks.all[name];
|
|
1346
|
+
|
|
1347
|
+
if (!callbacks || !callbacks.length) {
|
|
1348
|
+
return;
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
for (var i = 0, callback; (callback = callbacks[i++]);) {
|
|
1352
|
+
callback(env);
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
},
|
|
1356
|
+
|
|
1357
|
+
Token: Token
|
|
1358
|
+
};
|
|
1359
|
+
_self.Prism = _;
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
// Typescript note:
|
|
1363
|
+
// The following can be used to import the Token type in JSDoc:
|
|
1364
|
+
//
|
|
1365
|
+
// @typedef {InstanceType<import("./prism-core")["Token"]>} Token
|
|
1366
|
+
|
|
1367
|
+
/**
|
|
1368
|
+
* Creates a new token.
|
|
1369
|
+
*
|
|
1370
|
+
* @param {string} type See {@link Token#type type}
|
|
1371
|
+
* @param {string | TokenStream} content See {@link Token#content content}
|
|
1372
|
+
* @param {string|string[]} [alias] The alias(es) of the token.
|
|
1373
|
+
* @param {string} [matchedStr=""] A copy of the full string this token was created from.
|
|
1374
|
+
* @class
|
|
1375
|
+
* @global
|
|
1376
|
+
* @public
|
|
1377
|
+
*/
|
|
1378
|
+
function Token(type, content, alias, matchedStr) {
|
|
1379
|
+
/**
|
|
1380
|
+
* The type of the token.
|
|
1381
|
+
*
|
|
1382
|
+
* This is usually the key of a pattern in a {@link Grammar}.
|
|
1383
|
+
*
|
|
1384
|
+
* @type {string}
|
|
1385
|
+
* @see GrammarToken
|
|
1386
|
+
* @public
|
|
1387
|
+
*/
|
|
1388
|
+
this.type = type;
|
|
1389
|
+
/**
|
|
1390
|
+
* The strings or tokens contained by this token.
|
|
1391
|
+
*
|
|
1392
|
+
* This will be a token stream if the pattern matched also defined an `inside` grammar.
|
|
1393
|
+
*
|
|
1394
|
+
* @type {string | TokenStream}
|
|
1395
|
+
* @public
|
|
1396
|
+
*/
|
|
1397
|
+
this.content = content;
|
|
1398
|
+
/**
|
|
1399
|
+
* The alias(es) of the token.
|
|
1400
|
+
*
|
|
1401
|
+
* @type {string|string[]}
|
|
1402
|
+
* @see GrammarToken
|
|
1403
|
+
* @public
|
|
1404
|
+
*/
|
|
1405
|
+
this.alias = alias;
|
|
1406
|
+
// Copy of the full string this token was created from
|
|
1407
|
+
this.length = (matchedStr || '').length | 0;
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
/**
|
|
1411
|
+
* A token stream is an array of strings and {@link Token Token} objects.
|
|
1412
|
+
*
|
|
1413
|
+
* Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
|
|
1414
|
+
* them.
|
|
1415
|
+
*
|
|
1416
|
+
* 1. No adjacent strings.
|
|
1417
|
+
* 2. No empty strings.
|
|
1418
|
+
*
|
|
1419
|
+
* The only exception here is the token stream that only contains the empty string and nothing else.
|
|
1420
|
+
*
|
|
1421
|
+
* @typedef {Array<string | Token>} TokenStream
|
|
1422
|
+
* @global
|
|
1423
|
+
* @public
|
|
1424
|
+
*/
|
|
1425
|
+
|
|
1426
|
+
/**
|
|
1427
|
+
* Converts the given token or token stream to an HTML representation.
|
|
1428
|
+
*
|
|
1429
|
+
* The following hooks will be run:
|
|
1430
|
+
* 1. `wrap`: On each {@link Token}.
|
|
1431
|
+
*
|
|
1432
|
+
* @param {string | Token | TokenStream} o The token or token stream to be converted.
|
|
1433
|
+
* @param {string} language The name of current language.
|
|
1434
|
+
* @returns {string} The HTML representation of the token or token stream.
|
|
1435
|
+
* @memberof Token
|
|
1436
|
+
* @static
|
|
1437
|
+
*/
|
|
1438
|
+
Token.stringify = function stringify(o, language) {
|
|
1439
|
+
if (typeof o == 'string') {
|
|
1440
|
+
return o;
|
|
1441
|
+
}
|
|
1442
|
+
if (Array.isArray(o)) {
|
|
1443
|
+
var s = '';
|
|
1444
|
+
o.forEach(function (e) {
|
|
1445
|
+
s += stringify(e, language);
|
|
1446
|
+
});
|
|
1447
|
+
return s;
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
var env = {
|
|
1451
|
+
type: o.type,
|
|
1452
|
+
content: stringify(o.content, language),
|
|
1453
|
+
tag: 'span',
|
|
1454
|
+
classes: ['token', o.type],
|
|
1455
|
+
attributes: {},
|
|
1456
|
+
language: language
|
|
1457
|
+
};
|
|
1458
|
+
|
|
1459
|
+
var aliases = o.alias;
|
|
1460
|
+
if (aliases) {
|
|
1461
|
+
if (Array.isArray(aliases)) {
|
|
1462
|
+
Array.prototype.push.apply(env.classes, aliases);
|
|
1463
|
+
} else {
|
|
1464
|
+
env.classes.push(aliases);
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
_.hooks.run('wrap', env);
|
|
1469
|
+
|
|
1470
|
+
var attributes = '';
|
|
1471
|
+
for (var name in env.attributes) {
|
|
1472
|
+
attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"';
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
|
|
1476
|
+
};
|
|
1477
|
+
|
|
1478
|
+
/**
|
|
1479
|
+
* @param {RegExp} pattern
|
|
1480
|
+
* @param {number} pos
|
|
1481
|
+
* @param {string} text
|
|
1482
|
+
* @param {boolean} lookbehind
|
|
1483
|
+
* @returns {RegExpExecArray | null}
|
|
1484
|
+
*/
|
|
1485
|
+
function matchPattern(pattern, pos, text, lookbehind) {
|
|
1486
|
+
pattern.lastIndex = pos;
|
|
1487
|
+
var match = pattern.exec(text);
|
|
1488
|
+
if (match && lookbehind && match[1]) {
|
|
1489
|
+
// change the match to remove the text matched by the Prism lookbehind group
|
|
1490
|
+
var lookbehindLength = match[1].length;
|
|
1491
|
+
match.index += lookbehindLength;
|
|
1492
|
+
match[0] = match[0].slice(lookbehindLength);
|
|
1493
|
+
}
|
|
1494
|
+
return match;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
/**
|
|
1498
|
+
* @param {string} text
|
|
1499
|
+
* @param {LinkedList<string | Token>} tokenList
|
|
1500
|
+
* @param {any} grammar
|
|
1501
|
+
* @param {LinkedListNode<string | Token>} startNode
|
|
1502
|
+
* @param {number} startPos
|
|
1503
|
+
* @param {RematchOptions} [rematch]
|
|
1504
|
+
* @returns {void}
|
|
1505
|
+
* @private
|
|
1506
|
+
*
|
|
1507
|
+
* @typedef RematchOptions
|
|
1508
|
+
* @property {string} cause
|
|
1509
|
+
* @property {number} reach
|
|
1510
|
+
*/
|
|
1511
|
+
function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
|
|
1512
|
+
for (var token in grammar) {
|
|
1513
|
+
if (!grammar.hasOwnProperty(token) || !grammar[token]) {
|
|
1514
|
+
continue;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
var patterns = grammar[token];
|
|
1518
|
+
patterns = Array.isArray(patterns) ? patterns : [patterns];
|
|
1519
|
+
|
|
1520
|
+
for (var j = 0; j < patterns.length; ++j) {
|
|
1521
|
+
if (rematch && rematch.cause == token + ',' + j) {
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
var patternObj = patterns[j];
|
|
1526
|
+
var inside = patternObj.inside;
|
|
1527
|
+
var lookbehind = !!patternObj.lookbehind;
|
|
1528
|
+
var greedy = !!patternObj.greedy;
|
|
1529
|
+
var alias = patternObj.alias;
|
|
1530
|
+
|
|
1531
|
+
if (greedy && !patternObj.pattern.global) {
|
|
1532
|
+
// Without the global flag, lastIndex won't work
|
|
1533
|
+
var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
|
|
1534
|
+
patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
/** @type {RegExp} */
|
|
1538
|
+
var pattern = patternObj.pattern || patternObj;
|
|
1539
|
+
|
|
1540
|
+
for ( // iterate the token list and keep track of the current token/string position
|
|
1541
|
+
var currentNode = startNode.next, pos = startPos;
|
|
1542
|
+
currentNode !== tokenList.tail;
|
|
1543
|
+
pos += currentNode.value.length, currentNode = currentNode.next
|
|
1544
|
+
) {
|
|
1545
|
+
|
|
1546
|
+
if (rematch && pos >= rematch.reach) {
|
|
1547
|
+
break;
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
var str = currentNode.value;
|
|
1551
|
+
|
|
1552
|
+
if (tokenList.length > text.length) {
|
|
1553
|
+
// Something went terribly wrong, ABORT, ABORT!
|
|
1554
|
+
return;
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
if (str instanceof Token) {
|
|
1558
|
+
continue;
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
var removeCount = 1; // this is the to parameter of removeBetween
|
|
1562
|
+
var match;
|
|
1563
|
+
|
|
1564
|
+
if (greedy) {
|
|
1565
|
+
match = matchPattern(pattern, pos, text, lookbehind);
|
|
1566
|
+
if (!match || match.index >= text.length) {
|
|
1567
|
+
break;
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
var from = match.index;
|
|
1571
|
+
var to = match.index + match[0].length;
|
|
1572
|
+
var p = pos;
|
|
1573
|
+
|
|
1574
|
+
// find the node that contains the match
|
|
1575
|
+
p += currentNode.value.length;
|
|
1576
|
+
while (from >= p) {
|
|
1577
|
+
currentNode = currentNode.next;
|
|
1578
|
+
p += currentNode.value.length;
|
|
1579
|
+
}
|
|
1580
|
+
// adjust pos (and p)
|
|
1581
|
+
p -= currentNode.value.length;
|
|
1582
|
+
pos = p;
|
|
1583
|
+
|
|
1584
|
+
// the current node is a Token, then the match starts inside another Token, which is invalid
|
|
1585
|
+
if (currentNode.value instanceof Token) {
|
|
1586
|
+
continue;
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
// find the last node which is affected by this match
|
|
1590
|
+
for (
|
|
1591
|
+
var k = currentNode;
|
|
1592
|
+
k !== tokenList.tail && (p < to || typeof k.value === 'string');
|
|
1593
|
+
k = k.next
|
|
1594
|
+
) {
|
|
1595
|
+
removeCount++;
|
|
1596
|
+
p += k.value.length;
|
|
1597
|
+
}
|
|
1598
|
+
removeCount--;
|
|
1599
|
+
|
|
1600
|
+
// replace with the new match
|
|
1601
|
+
str = text.slice(pos, p);
|
|
1602
|
+
match.index -= pos;
|
|
1603
|
+
} else {
|
|
1604
|
+
match = matchPattern(pattern, 0, str, lookbehind);
|
|
1605
|
+
if (!match) {
|
|
1606
|
+
continue;
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
// eslint-disable-next-line no-redeclare
|
|
1611
|
+
var from = match.index;
|
|
1612
|
+
var matchStr = match[0];
|
|
1613
|
+
var before = str.slice(0, from);
|
|
1614
|
+
var after = str.slice(from + matchStr.length);
|
|
1615
|
+
|
|
1616
|
+
var reach = pos + str.length;
|
|
1617
|
+
if (rematch && reach > rematch.reach) {
|
|
1618
|
+
rematch.reach = reach;
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
var removeFrom = currentNode.prev;
|
|
1622
|
+
|
|
1623
|
+
if (before) {
|
|
1624
|
+
removeFrom = addAfter(tokenList, removeFrom, before);
|
|
1625
|
+
pos += before.length;
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
removeRange(tokenList, removeFrom, removeCount);
|
|
1629
|
+
|
|
1630
|
+
var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
|
|
1631
|
+
currentNode = addAfter(tokenList, removeFrom, wrapped);
|
|
1632
|
+
|
|
1633
|
+
if (after) {
|
|
1634
|
+
addAfter(tokenList, currentNode, after);
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
if (removeCount > 1) {
|
|
1638
|
+
// at least one Token object was removed, so we have to do some rematching
|
|
1639
|
+
// this can only happen if the current pattern is greedy
|
|
1640
|
+
|
|
1641
|
+
/** @type {RematchOptions} */
|
|
1642
|
+
var nestedRematch = {
|
|
1643
|
+
cause: token + ',' + j,
|
|
1644
|
+
reach: reach
|
|
1645
|
+
};
|
|
1646
|
+
matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
|
|
1647
|
+
|
|
1648
|
+
// the reach might have been extended because of the rematching
|
|
1649
|
+
if (rematch && nestedRematch.reach > rematch.reach) {
|
|
1650
|
+
rematch.reach = nestedRematch.reach;
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
/**
|
|
1659
|
+
* @typedef LinkedListNode
|
|
1660
|
+
* @property {T} value
|
|
1661
|
+
* @property {LinkedListNode<T> | null} prev The previous node.
|
|
1662
|
+
* @property {LinkedListNode<T> | null} next The next node.
|
|
1663
|
+
* @template T
|
|
1664
|
+
* @private
|
|
1665
|
+
*/
|
|
1666
|
+
|
|
1667
|
+
/**
|
|
1668
|
+
* @template T
|
|
1669
|
+
* @private
|
|
1670
|
+
*/
|
|
1671
|
+
function LinkedList() {
|
|
1672
|
+
/** @type {LinkedListNode<T>} */
|
|
1673
|
+
var head = { value: null, prev: null, next: null };
|
|
1674
|
+
/** @type {LinkedListNode<T>} */
|
|
1675
|
+
var tail = { value: null, prev: head, next: null };
|
|
1676
|
+
head.next = tail;
|
|
1677
|
+
|
|
1678
|
+
/** @type {LinkedListNode<T>} */
|
|
1679
|
+
this.head = head;
|
|
1680
|
+
/** @type {LinkedListNode<T>} */
|
|
1681
|
+
this.tail = tail;
|
|
1682
|
+
this.length = 0;
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
/**
|
|
1686
|
+
* Adds a new node with the given value to the list.
|
|
1687
|
+
*
|
|
1688
|
+
* @param {LinkedList<T>} list
|
|
1689
|
+
* @param {LinkedListNode<T>} node
|
|
1690
|
+
* @param {T} value
|
|
1691
|
+
* @returns {LinkedListNode<T>} The added node.
|
|
1692
|
+
* @template T
|
|
1693
|
+
*/
|
|
1694
|
+
function addAfter(list, node, value) {
|
|
1695
|
+
// assumes that node != list.tail && values.length >= 0
|
|
1696
|
+
var next = node.next;
|
|
1697
|
+
|
|
1698
|
+
var newNode = { value: value, prev: node, next: next };
|
|
1699
|
+
node.next = newNode;
|
|
1700
|
+
next.prev = newNode;
|
|
1701
|
+
list.length++;
|
|
1702
|
+
|
|
1703
|
+
return newNode;
|
|
1704
|
+
}
|
|
1705
|
+
/**
|
|
1706
|
+
* Removes `count` nodes after the given node. The given node will not be removed.
|
|
1707
|
+
*
|
|
1708
|
+
* @param {LinkedList<T>} list
|
|
1709
|
+
* @param {LinkedListNode<T>} node
|
|
1710
|
+
* @param {number} count
|
|
1711
|
+
* @template T
|
|
1712
|
+
*/
|
|
1713
|
+
function removeRange(list, node, count) {
|
|
1714
|
+
var next = node.next;
|
|
1715
|
+
for (var i = 0; i < count && next !== list.tail; i++) {
|
|
1716
|
+
next = next.next;
|
|
1717
|
+
}
|
|
1718
|
+
node.next = next;
|
|
1719
|
+
next.prev = node;
|
|
1720
|
+
list.length -= i;
|
|
1721
|
+
}
|
|
1722
|
+
/**
|
|
1723
|
+
* @param {LinkedList<T>} list
|
|
1724
|
+
* @returns {T[]}
|
|
1725
|
+
* @template T
|
|
1726
|
+
*/
|
|
1727
|
+
function toArray(list) {
|
|
1728
|
+
var array = [];
|
|
1729
|
+
var node = list.head.next;
|
|
1730
|
+
while (node !== list.tail) {
|
|
1731
|
+
array.push(node.value);
|
|
1732
|
+
node = node.next;
|
|
1733
|
+
}
|
|
1734
|
+
return array;
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
|
|
1738
|
+
if (!_self.document) {
|
|
1739
|
+
if (!_self.addEventListener) {
|
|
1740
|
+
// in Node.js
|
|
1741
|
+
return _;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
if (!_.disableWorkerMessageHandler) {
|
|
1745
|
+
// In worker
|
|
1746
|
+
_self.addEventListener('message', function (evt) {
|
|
1747
|
+
var message = JSON.parse(evt.data);
|
|
1748
|
+
var lang = message.language;
|
|
1749
|
+
var code = message.code;
|
|
1750
|
+
var immediateClose = message.immediateClose;
|
|
1751
|
+
|
|
1752
|
+
_self.postMessage(_.highlight(code, _.languages[lang], lang));
|
|
1753
|
+
if (immediateClose) {
|
|
1754
|
+
_self.close();
|
|
1755
|
+
}
|
|
1756
|
+
}, false);
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
return _;
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
// Get current script and highlight
|
|
1763
|
+
var script = _.util.currentScript();
|
|
1764
|
+
|
|
1765
|
+
if (script) {
|
|
1766
|
+
_.filename = script.src;
|
|
1767
|
+
|
|
1768
|
+
if (script.hasAttribute('data-manual')) {
|
|
1769
|
+
_.manual = true;
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
function highlightAutomaticallyCallback() {
|
|
1774
|
+
if (!_.manual) {
|
|
1775
|
+
_.highlightAll();
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
if (!_.manual) {
|
|
1780
|
+
// If the document state is "loading", then we'll use DOMContentLoaded.
|
|
1781
|
+
// If the document state is "interactive" and the prism.js script is deferred, then we'll also use the
|
|
1782
|
+
// DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they
|
|
1783
|
+
// might take longer one animation frame to execute which can create a race condition where only some plugins have
|
|
1784
|
+
// been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded.
|
|
1785
|
+
// See https://github.com/PrismJS/prism/issues/2102
|
|
1786
|
+
var readyState = document.readyState;
|
|
1787
|
+
if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
|
|
1788
|
+
document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
|
|
1789
|
+
} else {
|
|
1790
|
+
if (window.requestAnimationFrame) {
|
|
1791
|
+
window.requestAnimationFrame(highlightAutomaticallyCallback);
|
|
1792
|
+
} else {
|
|
1793
|
+
window.setTimeout(highlightAutomaticallyCallback, 16);
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
return _;
|
|
1799
|
+
|
|
1800
|
+
}(_self));
|
|
1801
|
+
|
|
1802
|
+
if (module.exports) {
|
|
1803
|
+
module.exports = Prism;
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
// hack for components to work correctly in node.js
|
|
1807
|
+
if (typeof commonjsGlobal !== 'undefined') {
|
|
1808
|
+
commonjsGlobal.Prism = Prism;
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
// some additional documentation/types
|
|
1812
|
+
|
|
1813
|
+
/**
|
|
1814
|
+
* The expansion of a simple `RegExp` literal to support additional properties.
|
|
1815
|
+
*
|
|
1816
|
+
* @typedef GrammarToken
|
|
1817
|
+
* @property {RegExp} pattern The regular expression of the token.
|
|
1818
|
+
* @property {boolean} [lookbehind=false] If `true`, then the first capturing group of `pattern` will (effectively)
|
|
1819
|
+
* behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token.
|
|
1820
|
+
* @property {boolean} [greedy=false] Whether the token is greedy.
|
|
1821
|
+
* @property {string|string[]} [alias] An optional alias or list of aliases.
|
|
1822
|
+
* @property {Grammar} [inside] The nested grammar of this token.
|
|
1823
|
+
*
|
|
1824
|
+
* The `inside` grammar will be used to tokenize the text value of each token of this kind.
|
|
1825
|
+
*
|
|
1826
|
+
* This can be used to make nested and even recursive language definitions.
|
|
1827
|
+
*
|
|
1828
|
+
* Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into
|
|
1829
|
+
* each another.
|
|
1830
|
+
* @global
|
|
1831
|
+
* @public
|
|
1832
|
+
*/
|
|
1833
|
+
|
|
1834
|
+
/**
|
|
1835
|
+
* @typedef Grammar
|
|
1836
|
+
* @type {Object<string, RegExp | GrammarToken | Array<RegExp | GrammarToken>>}
|
|
1837
|
+
* @property {Grammar} [rest] An optional grammar object that will be appended to this grammar.
|
|
1838
|
+
* @global
|
|
1839
|
+
* @public
|
|
1840
|
+
*/
|
|
1841
|
+
|
|
1842
|
+
/**
|
|
1843
|
+
* A function which will invoked after an element was successfully highlighted.
|
|
1844
|
+
*
|
|
1845
|
+
* @callback HighlightCallback
|
|
1846
|
+
* @param {Element} element The element successfully highlighted.
|
|
1847
|
+
* @returns {void}
|
|
1848
|
+
* @global
|
|
1849
|
+
* @public
|
|
1850
|
+
*/
|
|
1851
|
+
|
|
1852
|
+
/**
|
|
1853
|
+
* @callback HookCallback
|
|
1854
|
+
* @param {Object<string, any>} env The environment variables of the hook.
|
|
1855
|
+
* @returns {void}
|
|
1856
|
+
* @global
|
|
1857
|
+
* @public
|
|
1858
|
+
*/
|
|
1859
|
+
|
|
1860
|
+
|
|
1861
|
+
/* **********************************************
|
|
1862
|
+
Begin prism-markup.js
|
|
1863
|
+
********************************************** */
|
|
1864
|
+
|
|
1865
|
+
Prism.languages.markup = {
|
|
1866
|
+
'comment': {
|
|
1867
|
+
pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
|
|
1868
|
+
greedy: true
|
|
1869
|
+
},
|
|
1870
|
+
'prolog': {
|
|
1871
|
+
pattern: /<\?[\s\S]+?\?>/,
|
|
1872
|
+
greedy: true
|
|
1873
|
+
},
|
|
1874
|
+
'doctype': {
|
|
1875
|
+
// https://www.w3.org/TR/xml/#NT-doctypedecl
|
|
1876
|
+
pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
|
|
1877
|
+
greedy: true,
|
|
1878
|
+
inside: {
|
|
1879
|
+
'internal-subset': {
|
|
1880
|
+
pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
|
|
1881
|
+
lookbehind: true,
|
|
1882
|
+
greedy: true,
|
|
1883
|
+
inside: null // see below
|
|
1884
|
+
},
|
|
1885
|
+
'string': {
|
|
1886
|
+
pattern: /"[^"]*"|'[^']*'/,
|
|
1887
|
+
greedy: true
|
|
1888
|
+
},
|
|
1889
|
+
'punctuation': /^<!|>$|[[\]]/,
|
|
1890
|
+
'doctype-tag': /^DOCTYPE/i,
|
|
1891
|
+
'name': /[^\s<>'"]+/
|
|
1892
|
+
}
|
|
1893
|
+
},
|
|
1894
|
+
'cdata': {
|
|
1895
|
+
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
1896
|
+
greedy: true
|
|
1897
|
+
},
|
|
1898
|
+
'tag': {
|
|
1899
|
+
pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
|
|
1900
|
+
greedy: true,
|
|
1901
|
+
inside: {
|
|
1902
|
+
'tag': {
|
|
1903
|
+
pattern: /^<\/?[^\s>\/]+/,
|
|
1904
|
+
inside: {
|
|
1905
|
+
'punctuation': /^<\/?/,
|
|
1906
|
+
'namespace': /^[^\s>\/:]+:/
|
|
1907
|
+
}
|
|
1908
|
+
},
|
|
1909
|
+
'special-attr': [],
|
|
1910
|
+
'attr-value': {
|
|
1911
|
+
pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
|
|
1912
|
+
inside: {
|
|
1913
|
+
'punctuation': [
|
|
1914
|
+
{
|
|
1915
|
+
pattern: /^=/,
|
|
1916
|
+
alias: 'attr-equals'
|
|
1917
|
+
},
|
|
1918
|
+
{
|
|
1919
|
+
pattern: /^(\s*)["']|["']$/,
|
|
1920
|
+
lookbehind: true
|
|
1921
|
+
}
|
|
1922
|
+
]
|
|
1923
|
+
}
|
|
1924
|
+
},
|
|
1925
|
+
'punctuation': /\/?>/,
|
|
1926
|
+
'attr-name': {
|
|
1927
|
+
pattern: /[^\s>\/]+/,
|
|
1928
|
+
inside: {
|
|
1929
|
+
'namespace': /^[^\s>\/:]+:/
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
|
|
1933
|
+
}
|
|
1934
|
+
},
|
|
1935
|
+
'entity': [
|
|
1936
|
+
{
|
|
1937
|
+
pattern: /&[\da-z]{1,8};/i,
|
|
1938
|
+
alias: 'named-entity'
|
|
1939
|
+
},
|
|
1940
|
+
/&#x?[\da-f]{1,8};/i
|
|
1941
|
+
]
|
|
1942
|
+
};
|
|
1943
|
+
|
|
1944
|
+
Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
|
|
1945
|
+
Prism.languages.markup['entity'];
|
|
1946
|
+
Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
|
|
1947
|
+
|
|
1948
|
+
// Plugin to make entity title show the real entity, idea by Roman Komarov
|
|
1949
|
+
Prism.hooks.add('wrap', function (env) {
|
|
1950
|
+
|
|
1951
|
+
if (env.type === 'entity') {
|
|
1952
|
+
env.attributes['title'] = env.content.replace(/&/, '&');
|
|
1953
|
+
}
|
|
1954
|
+
});
|
|
1955
|
+
|
|
1956
|
+
Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
|
|
1957
|
+
/**
|
|
1958
|
+
* Adds an inlined language to markup.
|
|
1959
|
+
*
|
|
1960
|
+
* An example of an inlined language is CSS with `<style>` tags.
|
|
1961
|
+
*
|
|
1962
|
+
* @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
|
|
1963
|
+
* case insensitive.
|
|
1964
|
+
* @param {string} lang The language key.
|
|
1965
|
+
* @example
|
|
1966
|
+
* addInlined('style', 'css');
|
|
1967
|
+
*/
|
|
1968
|
+
value: function addInlined(tagName, lang) {
|
|
1969
|
+
var includedCdataInside = {};
|
|
1970
|
+
includedCdataInside['language-' + lang] = {
|
|
1971
|
+
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
|
1972
|
+
lookbehind: true,
|
|
1973
|
+
inside: Prism.languages[lang]
|
|
1974
|
+
};
|
|
1975
|
+
includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
|
|
1976
|
+
|
|
1977
|
+
var inside = {
|
|
1978
|
+
'included-cdata': {
|
|
1979
|
+
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
1980
|
+
inside: includedCdataInside
|
|
1981
|
+
}
|
|
1982
|
+
};
|
|
1983
|
+
inside['language-' + lang] = {
|
|
1984
|
+
pattern: /[\s\S]+/,
|
|
1985
|
+
inside: Prism.languages[lang]
|
|
1986
|
+
};
|
|
1987
|
+
|
|
1988
|
+
var def = {};
|
|
1989
|
+
def[tagName] = {
|
|
1990
|
+
pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () { return tagName; }), 'i'),
|
|
1991
|
+
lookbehind: true,
|
|
1992
|
+
greedy: true,
|
|
1993
|
+
inside: inside
|
|
1994
|
+
};
|
|
1995
|
+
|
|
1996
|
+
Prism.languages.insertBefore('markup', 'cdata', def);
|
|
1997
|
+
}
|
|
1998
|
+
});
|
|
1999
|
+
Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
|
|
2000
|
+
/**
|
|
2001
|
+
* Adds an pattern to highlight languages embedded in HTML attributes.
|
|
2002
|
+
*
|
|
2003
|
+
* An example of an inlined language is CSS with `style` attributes.
|
|
2004
|
+
*
|
|
2005
|
+
* @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
|
|
2006
|
+
* case insensitive.
|
|
2007
|
+
* @param {string} lang The language key.
|
|
2008
|
+
* @example
|
|
2009
|
+
* addAttribute('style', 'css');
|
|
2010
|
+
*/
|
|
2011
|
+
value: function (attrName, lang) {
|
|
2012
|
+
Prism.languages.markup.tag.inside['special-attr'].push({
|
|
2013
|
+
pattern: RegExp(
|
|
2014
|
+
/(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
|
|
2015
|
+
'i'
|
|
2016
|
+
),
|
|
2017
|
+
lookbehind: true,
|
|
2018
|
+
inside: {
|
|
2019
|
+
'attr-name': /^[^\s=]+/,
|
|
2020
|
+
'attr-value': {
|
|
2021
|
+
pattern: /=[\s\S]+/,
|
|
2022
|
+
inside: {
|
|
2023
|
+
'value': {
|
|
2024
|
+
pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
|
|
2025
|
+
lookbehind: true,
|
|
2026
|
+
alias: [lang, 'language-' + lang],
|
|
2027
|
+
inside: Prism.languages[lang]
|
|
2028
|
+
},
|
|
2029
|
+
'punctuation': [
|
|
2030
|
+
{
|
|
2031
|
+
pattern: /^=/,
|
|
2032
|
+
alias: 'attr-equals'
|
|
2033
|
+
},
|
|
2034
|
+
/"|'/
|
|
2035
|
+
]
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
});
|
|
2040
|
+
}
|
|
2041
|
+
});
|
|
2042
|
+
|
|
2043
|
+
Prism.languages.html = Prism.languages.markup;
|
|
2044
|
+
Prism.languages.mathml = Prism.languages.markup;
|
|
2045
|
+
Prism.languages.svg = Prism.languages.markup;
|
|
2046
|
+
|
|
2047
|
+
Prism.languages.xml = Prism.languages.extend('markup', {});
|
|
2048
|
+
Prism.languages.ssml = Prism.languages.xml;
|
|
2049
|
+
Prism.languages.atom = Prism.languages.xml;
|
|
2050
|
+
Prism.languages.rss = Prism.languages.xml;
|
|
2051
|
+
|
|
2052
|
+
|
|
2053
|
+
/* **********************************************
|
|
2054
|
+
Begin prism-css.js
|
|
2055
|
+
********************************************** */
|
|
2056
|
+
|
|
2057
|
+
(function (Prism) {
|
|
2058
|
+
|
|
2059
|
+
var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
2060
|
+
|
|
2061
|
+
Prism.languages.css = {
|
|
2062
|
+
'comment': /\/\*[\s\S]*?\*\//,
|
|
2063
|
+
'atrule': {
|
|
2064
|
+
pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
|
|
2065
|
+
inside: {
|
|
2066
|
+
'rule': /^@[\w-]+/,
|
|
2067
|
+
'selector-function-argument': {
|
|
2068
|
+
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
|
2069
|
+
lookbehind: true,
|
|
2070
|
+
alias: 'selector'
|
|
2071
|
+
},
|
|
2072
|
+
'keyword': {
|
|
2073
|
+
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
|
2074
|
+
lookbehind: true
|
|
2075
|
+
}
|
|
2076
|
+
// See rest below
|
|
2077
|
+
}
|
|
2078
|
+
},
|
|
2079
|
+
'url': {
|
|
2080
|
+
// https://drafts.csswg.org/css-values-3/#urls
|
|
2081
|
+
pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
|
|
2082
|
+
greedy: true,
|
|
2083
|
+
inside: {
|
|
2084
|
+
'function': /^url/i,
|
|
2085
|
+
'punctuation': /^\(|\)$/,
|
|
2086
|
+
'string': {
|
|
2087
|
+
pattern: RegExp('^' + string.source + '$'),
|
|
2088
|
+
alias: 'url'
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
},
|
|
2092
|
+
'selector': {
|
|
2093
|
+
pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
|
|
2094
|
+
lookbehind: true
|
|
2095
|
+
},
|
|
2096
|
+
'string': {
|
|
2097
|
+
pattern: string,
|
|
2098
|
+
greedy: true
|
|
2099
|
+
},
|
|
2100
|
+
'property': {
|
|
2101
|
+
pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
|
2102
|
+
lookbehind: true
|
|
2103
|
+
},
|
|
2104
|
+
'important': /!important\b/i,
|
|
2105
|
+
'function': {
|
|
2106
|
+
pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
|
2107
|
+
lookbehind: true
|
|
2108
|
+
},
|
|
2109
|
+
'punctuation': /[(){};:,]/
|
|
2110
|
+
};
|
|
2111
|
+
|
|
2112
|
+
Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
|
|
2113
|
+
|
|
2114
|
+
var markup = Prism.languages.markup;
|
|
2115
|
+
if (markup) {
|
|
2116
|
+
markup.tag.addInlined('style', 'css');
|
|
2117
|
+
markup.tag.addAttribute('style', 'css');
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
}(Prism));
|
|
2121
|
+
|
|
2122
|
+
|
|
2123
|
+
/* **********************************************
|
|
2124
|
+
Begin prism-clike.js
|
|
2125
|
+
********************************************** */
|
|
2126
|
+
|
|
2127
|
+
Prism.languages.clike = {
|
|
2128
|
+
'comment': [
|
|
2129
|
+
{
|
|
2130
|
+
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
|
|
2131
|
+
lookbehind: true,
|
|
2132
|
+
greedy: true
|
|
2133
|
+
},
|
|
2134
|
+
{
|
|
2135
|
+
pattern: /(^|[^\\:])\/\/.*/,
|
|
2136
|
+
lookbehind: true,
|
|
2137
|
+
greedy: true
|
|
2138
|
+
}
|
|
2139
|
+
],
|
|
2140
|
+
'string': {
|
|
2141
|
+
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
|
|
2142
|
+
greedy: true
|
|
2143
|
+
},
|
|
2144
|
+
'class-name': {
|
|
2145
|
+
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
|
|
2146
|
+
lookbehind: true,
|
|
2147
|
+
inside: {
|
|
2148
|
+
'punctuation': /[.\\]/
|
|
2149
|
+
}
|
|
2150
|
+
},
|
|
2151
|
+
'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
|
|
2152
|
+
'boolean': /\b(?:false|true)\b/,
|
|
2153
|
+
'function': /\b\w+(?=\()/,
|
|
2154
|
+
'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
|
|
2155
|
+
'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
|
|
2156
|
+
'punctuation': /[{}[\];(),.:]/
|
|
2157
|
+
};
|
|
2158
|
+
|
|
2159
|
+
|
|
2160
|
+
/* **********************************************
|
|
2161
|
+
Begin prism-javascript.js
|
|
2162
|
+
********************************************** */
|
|
2163
|
+
|
|
2164
|
+
Prism.languages.javascript = Prism.languages.extend('clike', {
|
|
2165
|
+
'class-name': [
|
|
2166
|
+
Prism.languages.clike['class-name'],
|
|
2167
|
+
{
|
|
2168
|
+
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
|
|
2169
|
+
lookbehind: true
|
|
2170
|
+
}
|
|
2171
|
+
],
|
|
2172
|
+
'keyword': [
|
|
2173
|
+
{
|
|
2174
|
+
pattern: /((?:^|\})\s*)catch\b/,
|
|
2175
|
+
lookbehind: true
|
|
2176
|
+
},
|
|
2177
|
+
{
|
|
2178
|
+
pattern: /(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,
|
|
2179
|
+
lookbehind: true
|
|
2180
|
+
},
|
|
2181
|
+
],
|
|
2182
|
+
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
|
|
2183
|
+
'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
|
|
2184
|
+
'number': {
|
|
2185
|
+
pattern: RegExp(
|
|
2186
|
+
/(^|[^\w$])/.source +
|
|
2187
|
+
'(?:' +
|
|
2188
|
+
(
|
|
2189
|
+
// constant
|
|
2190
|
+
/NaN|Infinity/.source +
|
|
2191
|
+
'|' +
|
|
2192
|
+
// binary integer
|
|
2193
|
+
/0[bB][01]+(?:_[01]+)*n?/.source +
|
|
2194
|
+
'|' +
|
|
2195
|
+
// octal integer
|
|
2196
|
+
/0[oO][0-7]+(?:_[0-7]+)*n?/.source +
|
|
2197
|
+
'|' +
|
|
2198
|
+
// hexadecimal integer
|
|
2199
|
+
/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source +
|
|
2200
|
+
'|' +
|
|
2201
|
+
// decimal bigint
|
|
2202
|
+
/\d+(?:_\d+)*n/.source +
|
|
2203
|
+
'|' +
|
|
2204
|
+
// decimal number (integer or float) but no bigint
|
|
2205
|
+
/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source
|
|
2206
|
+
) +
|
|
2207
|
+
')' +
|
|
2208
|
+
/(?![\w$])/.source
|
|
2209
|
+
),
|
|
2210
|
+
lookbehind: true
|
|
2211
|
+
},
|
|
2212
|
+
'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
|
|
2213
|
+
});
|
|
2214
|
+
|
|
2215
|
+
Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
|
|
2216
|
+
|
|
2217
|
+
Prism.languages.insertBefore('javascript', 'keyword', {
|
|
2218
|
+
'regex': {
|
|
2219
|
+
pattern: RegExp(
|
|
2220
|
+
// lookbehind
|
|
2221
|
+
// eslint-disable-next-line regexp/no-dupe-characters-character-class
|
|
2222
|
+
/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source +
|
|
2223
|
+
// Regex pattern:
|
|
2224
|
+
// There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
|
|
2225
|
+
// classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
|
|
2226
|
+
// with the only syntax, so we have to define 2 different regex patterns.
|
|
2227
|
+
/\//.source +
|
|
2228
|
+
'(?:' +
|
|
2229
|
+
/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source +
|
|
2230
|
+
'|' +
|
|
2231
|
+
// `v` flag syntax. This supports 3 levels of nested character classes.
|
|
2232
|
+
/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source +
|
|
2233
|
+
')' +
|
|
2234
|
+
// lookahead
|
|
2235
|
+
/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
|
|
2236
|
+
),
|
|
2237
|
+
lookbehind: true,
|
|
2238
|
+
greedy: true,
|
|
2239
|
+
inside: {
|
|
2240
|
+
'regex-source': {
|
|
2241
|
+
pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
|
|
2242
|
+
lookbehind: true,
|
|
2243
|
+
alias: 'language-regex',
|
|
2244
|
+
inside: Prism.languages.regex
|
|
2245
|
+
},
|
|
2246
|
+
'regex-delimiter': /^\/|\/$/,
|
|
2247
|
+
'regex-flags': /^[a-z]+$/,
|
|
2248
|
+
}
|
|
2249
|
+
},
|
|
2250
|
+
// This must be declared before keyword because we use "function" inside the look-forward
|
|
2251
|
+
'function-variable': {
|
|
2252
|
+
pattern: /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,
|
|
2253
|
+
alias: 'function'
|
|
2254
|
+
},
|
|
2255
|
+
'parameter': [
|
|
2256
|
+
{
|
|
2257
|
+
pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
|
|
2258
|
+
lookbehind: true,
|
|
2259
|
+
inside: Prism.languages.javascript
|
|
2260
|
+
},
|
|
2261
|
+
{
|
|
2262
|
+
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
|
|
2263
|
+
lookbehind: true,
|
|
2264
|
+
inside: Prism.languages.javascript
|
|
2265
|
+
},
|
|
2266
|
+
{
|
|
2267
|
+
pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
|
|
2268
|
+
lookbehind: true,
|
|
2269
|
+
inside: Prism.languages.javascript
|
|
2270
|
+
},
|
|
2271
|
+
{
|
|
2272
|
+
pattern: /((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,
|
|
2273
|
+
lookbehind: true,
|
|
2274
|
+
inside: Prism.languages.javascript
|
|
2275
|
+
}
|
|
2276
|
+
],
|
|
2277
|
+
'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
|
|
2278
|
+
});
|
|
2279
|
+
|
|
2280
|
+
Prism.languages.insertBefore('javascript', 'string', {
|
|
2281
|
+
'hashbang': {
|
|
2282
|
+
pattern: /^#!.*/,
|
|
2283
|
+
greedy: true,
|
|
2284
|
+
alias: 'comment'
|
|
2285
|
+
},
|
|
2286
|
+
'template-string': {
|
|
2287
|
+
pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
|
|
2288
|
+
greedy: true,
|
|
2289
|
+
inside: {
|
|
2290
|
+
'template-punctuation': {
|
|
2291
|
+
pattern: /^`|`$/,
|
|
2292
|
+
alias: 'string'
|
|
2293
|
+
},
|
|
2294
|
+
'interpolation': {
|
|
2295
|
+
pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
|
|
2296
|
+
lookbehind: true,
|
|
2297
|
+
inside: {
|
|
2298
|
+
'interpolation-punctuation': {
|
|
2299
|
+
pattern: /^\$\{|\}$/,
|
|
2300
|
+
alias: 'punctuation'
|
|
2301
|
+
},
|
|
2302
|
+
rest: Prism.languages.javascript
|
|
2303
|
+
}
|
|
2304
|
+
},
|
|
2305
|
+
'string': /[\s\S]+/
|
|
2306
|
+
}
|
|
2307
|
+
},
|
|
2308
|
+
'string-property': {
|
|
2309
|
+
pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
|
|
2310
|
+
lookbehind: true,
|
|
2311
|
+
greedy: true,
|
|
2312
|
+
alias: 'property'
|
|
2313
|
+
}
|
|
2314
|
+
});
|
|
2315
|
+
|
|
2316
|
+
Prism.languages.insertBefore('javascript', 'operator', {
|
|
2317
|
+
'literal-property': {
|
|
2318
|
+
pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
|
|
2319
|
+
lookbehind: true,
|
|
2320
|
+
alias: 'property'
|
|
2321
|
+
},
|
|
2322
|
+
});
|
|
2323
|
+
|
|
2324
|
+
if (Prism.languages.markup) {
|
|
2325
|
+
Prism.languages.markup.tag.addInlined('script', 'javascript');
|
|
2326
|
+
|
|
2327
|
+
// add attribute support for all DOM events.
|
|
2328
|
+
// https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
|
|
2329
|
+
Prism.languages.markup.tag.addAttribute(
|
|
2330
|
+
/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,
|
|
2331
|
+
'javascript'
|
|
2332
|
+
);
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
Prism.languages.js = Prism.languages.javascript;
|
|
2336
|
+
|
|
2337
|
+
|
|
2338
|
+
/* **********************************************
|
|
2339
|
+
Begin prism-file-highlight.js
|
|
2340
|
+
********************************************** */
|
|
2341
|
+
|
|
2342
|
+
(function () {
|
|
2343
|
+
|
|
2344
|
+
if (typeof Prism === 'undefined' || typeof document === 'undefined') {
|
|
2345
|
+
return;
|
|
2346
|
+
}
|
|
2347
|
+
|
|
2348
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
|
|
2349
|
+
if (!Element.prototype.matches) {
|
|
2350
|
+
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
var LOADING_MESSAGE = 'Loading…';
|
|
2354
|
+
var FAILURE_MESSAGE = function (status, message) {
|
|
2355
|
+
return '✖ Error ' + status + ' while fetching file: ' + message;
|
|
2356
|
+
};
|
|
2357
|
+
var FAILURE_EMPTY_MESSAGE = '✖ Error: File does not exist or is empty';
|
|
2358
|
+
|
|
2359
|
+
var EXTENSIONS = {
|
|
2360
|
+
'js': 'javascript',
|
|
2361
|
+
'py': 'python',
|
|
2362
|
+
'rb': 'ruby',
|
|
2363
|
+
'ps1': 'powershell',
|
|
2364
|
+
'psm1': 'powershell',
|
|
2365
|
+
'sh': 'bash',
|
|
2366
|
+
'bat': 'batch',
|
|
2367
|
+
'h': 'c',
|
|
2368
|
+
'tex': 'latex'
|
|
2369
|
+
};
|
|
2370
|
+
|
|
2371
|
+
var STATUS_ATTR = 'data-src-status';
|
|
2372
|
+
var STATUS_LOADING = 'loading';
|
|
2373
|
+
var STATUS_LOADED = 'loaded';
|
|
2374
|
+
var STATUS_FAILED = 'failed';
|
|
2375
|
+
|
|
2376
|
+
var SELECTOR = 'pre[data-src]:not([' + STATUS_ATTR + '="' + STATUS_LOADED + '"])'
|
|
2377
|
+
+ ':not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';
|
|
2378
|
+
|
|
2379
|
+
/**
|
|
2380
|
+
* Loads the given file.
|
|
2381
|
+
*
|
|
2382
|
+
* @param {string} src The URL or path of the source file to load.
|
|
2383
|
+
* @param {(result: string) => void} success
|
|
2384
|
+
* @param {(reason: string) => void} error
|
|
2385
|
+
*/
|
|
2386
|
+
function loadFile(src, success, error) {
|
|
2387
|
+
var xhr = new XMLHttpRequest();
|
|
2388
|
+
xhr.open('GET', src, true);
|
|
2389
|
+
xhr.onreadystatechange = function () {
|
|
2390
|
+
if (xhr.readyState == 4) {
|
|
2391
|
+
if (xhr.status < 400 && xhr.responseText) {
|
|
2392
|
+
success(xhr.responseText);
|
|
2393
|
+
} else {
|
|
2394
|
+
if (xhr.status >= 400) {
|
|
2395
|
+
error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
|
|
2396
|
+
} else {
|
|
2397
|
+
error(FAILURE_EMPTY_MESSAGE);
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
};
|
|
2402
|
+
xhr.send(null);
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2405
|
+
/**
|
|
2406
|
+
* Parses the given range.
|
|
2407
|
+
*
|
|
2408
|
+
* This returns a range with inclusive ends.
|
|
2409
|
+
*
|
|
2410
|
+
* @param {string | null | undefined} range
|
|
2411
|
+
* @returns {[number, number | undefined] | undefined}
|
|
2412
|
+
*/
|
|
2413
|
+
function parseRange(range) {
|
|
2414
|
+
var m = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || '');
|
|
2415
|
+
if (m) {
|
|
2416
|
+
var start = Number(m[1]);
|
|
2417
|
+
var comma = m[2];
|
|
2418
|
+
var end = m[3];
|
|
2419
|
+
|
|
2420
|
+
if (!comma) {
|
|
2421
|
+
return [start, start];
|
|
2422
|
+
}
|
|
2423
|
+
if (!end) {
|
|
2424
|
+
return [start, undefined];
|
|
2425
|
+
}
|
|
2426
|
+
return [start, Number(end)];
|
|
2427
|
+
}
|
|
2428
|
+
return undefined;
|
|
2429
|
+
}
|
|
2430
|
+
|
|
2431
|
+
Prism.hooks.add('before-highlightall', function (env) {
|
|
2432
|
+
env.selector += ', ' + SELECTOR;
|
|
2433
|
+
});
|
|
2434
|
+
|
|
2435
|
+
Prism.hooks.add('before-sanity-check', function (env) {
|
|
2436
|
+
var pre = /** @type {HTMLPreElement} */ (env.element);
|
|
2437
|
+
if (pre.matches(SELECTOR)) {
|
|
2438
|
+
env.code = ''; // fast-path the whole thing and go to complete
|
|
2439
|
+
|
|
2440
|
+
pre.setAttribute(STATUS_ATTR, STATUS_LOADING); // mark as loading
|
|
2441
|
+
|
|
2442
|
+
// add code element with loading message
|
|
2443
|
+
var code = pre.appendChild(document.createElement('CODE'));
|
|
2444
|
+
code.textContent = LOADING_MESSAGE;
|
|
2445
|
+
|
|
2446
|
+
var src = pre.getAttribute('data-src');
|
|
2447
|
+
|
|
2448
|
+
var language = env.language;
|
|
2449
|
+
if (language === 'none') {
|
|
2450
|
+
// the language might be 'none' because there is no language set;
|
|
2451
|
+
// in this case, we want to use the extension as the language
|
|
2452
|
+
var extension = (/\.(\w+)$/.exec(src) || [, 'none'])[1];
|
|
2453
|
+
language = EXTENSIONS[extension] || extension;
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
// set language classes
|
|
2457
|
+
Prism.util.setLanguage(code, language);
|
|
2458
|
+
Prism.util.setLanguage(pre, language);
|
|
2459
|
+
|
|
2460
|
+
// preload the language
|
|
2461
|
+
var autoloader = Prism.plugins.autoloader;
|
|
2462
|
+
if (autoloader) {
|
|
2463
|
+
autoloader.loadLanguages(language);
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
// load file
|
|
2467
|
+
loadFile(
|
|
2468
|
+
src,
|
|
2469
|
+
function (text) {
|
|
2470
|
+
// mark as loaded
|
|
2471
|
+
pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
|
|
2472
|
+
|
|
2473
|
+
// handle data-range
|
|
2474
|
+
var range = parseRange(pre.getAttribute('data-range'));
|
|
2475
|
+
if (range) {
|
|
2476
|
+
var lines = text.split(/\r\n?|\n/g);
|
|
2477
|
+
|
|
2478
|
+
// the range is one-based and inclusive on both ends
|
|
2479
|
+
var start = range[0];
|
|
2480
|
+
var end = range[1] == null ? lines.length : range[1];
|
|
2481
|
+
|
|
2482
|
+
if (start < 0) { start += lines.length; }
|
|
2483
|
+
start = Math.max(0, Math.min(start - 1, lines.length));
|
|
2484
|
+
if (end < 0) { end += lines.length; }
|
|
2485
|
+
end = Math.max(0, Math.min(end, lines.length));
|
|
2486
|
+
|
|
2487
|
+
text = lines.slice(start, end).join('\n');
|
|
2488
|
+
|
|
2489
|
+
// add data-start for line numbers
|
|
2490
|
+
if (!pre.hasAttribute('data-start')) {
|
|
2491
|
+
pre.setAttribute('data-start', String(start + 1));
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
// highlight code
|
|
2496
|
+
code.textContent = text;
|
|
2497
|
+
Prism.highlightElement(code);
|
|
2498
|
+
},
|
|
2499
|
+
function (error) {
|
|
2500
|
+
// mark as failed
|
|
2501
|
+
pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
|
|
2502
|
+
|
|
2503
|
+
code.textContent = error;
|
|
2504
|
+
}
|
|
2505
|
+
);
|
|
2506
|
+
}
|
|
2507
|
+
});
|
|
2508
|
+
|
|
2509
|
+
Prism.plugins.fileHighlight = {
|
|
2510
|
+
/**
|
|
2511
|
+
* Executes the File Highlight plugin for all matching `pre` elements under the given container.
|
|
2512
|
+
*
|
|
2513
|
+
* Note: Elements which are already loaded or currently loading will not be touched by this method.
|
|
2514
|
+
*
|
|
2515
|
+
* @param {ParentNode} [container=document]
|
|
2516
|
+
*/
|
|
2517
|
+
highlight: function highlight(container) {
|
|
2518
|
+
var elements = (container || document).querySelectorAll(SELECTOR);
|
|
2519
|
+
|
|
2520
|
+
for (var i = 0, element; (element = elements[i++]);) {
|
|
2521
|
+
Prism.highlightElement(element);
|
|
2522
|
+
}
|
|
2523
|
+
}
|
|
2524
|
+
};
|
|
2525
|
+
|
|
2526
|
+
var logged = false;
|
|
2527
|
+
/** @deprecated Use `Prism.plugins.fileHighlight.highlight` instead. */
|
|
2528
|
+
Prism.fileHighlight = function () {
|
|
2529
|
+
if (!logged) {
|
|
2530
|
+
console.warn('Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.');
|
|
2531
|
+
logged = true;
|
|
2532
|
+
}
|
|
2533
|
+
Prism.plugins.fileHighlight.highlight.apply(this, arguments);
|
|
2534
|
+
};
|
|
2535
|
+
|
|
2536
|
+
}());
|
|
2537
|
+
}(prism));
|
|
2538
|
+
|
|
2539
|
+
const Prism$1 = prism.exports;
|
|
2540
|
+
|
|
2541
|
+
Prism.languages.python = {
|
|
2542
|
+
'comment': {
|
|
2543
|
+
pattern: /(^|[^\\])#.*/,
|
|
2544
|
+
lookbehind: true,
|
|
2545
|
+
greedy: true
|
|
2546
|
+
},
|
|
2547
|
+
'string-interpolation': {
|
|
2548
|
+
pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
|
|
2549
|
+
greedy: true,
|
|
2550
|
+
inside: {
|
|
2551
|
+
'interpolation': {
|
|
2552
|
+
// "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
|
|
2553
|
+
pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
|
|
2554
|
+
lookbehind: true,
|
|
2555
|
+
inside: {
|
|
2556
|
+
'format-spec': {
|
|
2557
|
+
pattern: /(:)[^:(){}]+(?=\}$)/,
|
|
2558
|
+
lookbehind: true
|
|
2559
|
+
},
|
|
2560
|
+
'conversion-option': {
|
|
2561
|
+
pattern: //,
|
|
2562
|
+
alias: 'punctuation'
|
|
2563
|
+
},
|
|
2564
|
+
rest: null
|
|
2565
|
+
}
|
|
2566
|
+
},
|
|
2567
|
+
'string': /[\s\S]+/
|
|
2568
|
+
}
|
|
2569
|
+
},
|
|
2570
|
+
'triple-quoted-string': {
|
|
2571
|
+
pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
|
|
2572
|
+
greedy: true,
|
|
2573
|
+
alias: 'string'
|
|
2574
|
+
},
|
|
2575
|
+
'string': {
|
|
2576
|
+
pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
|
|
2577
|
+
greedy: true
|
|
2578
|
+
},
|
|
2579
|
+
'function': {
|
|
2580
|
+
pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
|
|
2581
|
+
lookbehind: true
|
|
2582
|
+
},
|
|
2583
|
+
'class-name': {
|
|
2584
|
+
pattern: /(\bclass\s+)\w+/i,
|
|
2585
|
+
lookbehind: true
|
|
2586
|
+
},
|
|
2587
|
+
'decorator': {
|
|
2588
|
+
pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
|
|
2589
|
+
lookbehind: true,
|
|
2590
|
+
alias: ['annotation', 'punctuation'],
|
|
2591
|
+
inside: {
|
|
2592
|
+
'punctuation': /\./
|
|
2593
|
+
}
|
|
2594
|
+
},
|
|
2595
|
+
'keyword': /\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,
|
|
2596
|
+
'builtin': /\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,
|
|
2597
|
+
'boolean': /\b(?:False|None|True)\b/,
|
|
2598
|
+
'number': /\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,
|
|
2599
|
+
'operator': /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
|
|
2600
|
+
'punctuation': /[{}[\];(),.:]/
|
|
2601
|
+
};
|
|
2602
|
+
|
|
2603
|
+
Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;
|
|
2604
|
+
|
|
2605
|
+
Prism.languages.py = Prism.languages.python;
|
|
2606
|
+
|
|
2607
|
+
(function (Prism) {
|
|
2608
|
+
// $ set | grep '^[A-Z][^[:space:]]*=' | cut -d= -f1 | tr '\n' '|'
|
|
2609
|
+
// + LC_ALL, RANDOM, REPLY, SECONDS.
|
|
2610
|
+
// + make sure PS1..4 are here as they are not always set,
|
|
2611
|
+
// - some useless things.
|
|
2612
|
+
var envVars = '\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b';
|
|
2613
|
+
|
|
2614
|
+
var commandAfterHeredoc = {
|
|
2615
|
+
pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
|
|
2616
|
+
lookbehind: true,
|
|
2617
|
+
alias: 'punctuation', // this looks reasonably well in all themes
|
|
2618
|
+
inside: null // see below
|
|
2619
|
+
};
|
|
2620
|
+
|
|
2621
|
+
var insideString = {
|
|
2622
|
+
'bash': commandAfterHeredoc,
|
|
2623
|
+
'environment': {
|
|
2624
|
+
pattern: RegExp('\\$' + envVars),
|
|
2625
|
+
alias: 'constant'
|
|
2626
|
+
},
|
|
2627
|
+
'variable': [
|
|
2628
|
+
// [0]: Arithmetic Environment
|
|
2629
|
+
{
|
|
2630
|
+
pattern: /\$?\(\([\s\S]+?\)\)/,
|
|
2631
|
+
greedy: true,
|
|
2632
|
+
inside: {
|
|
2633
|
+
// If there is a $ sign at the beginning highlight $(( and )) as variable
|
|
2634
|
+
'variable': [
|
|
2635
|
+
{
|
|
2636
|
+
pattern: /(^\$\(\([\s\S]+)\)\)/,
|
|
2637
|
+
lookbehind: true
|
|
2638
|
+
},
|
|
2639
|
+
/^\$\(\(/
|
|
2640
|
+
],
|
|
2641
|
+
'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
|
|
2642
|
+
// Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
|
|
2643
|
+
'operator': /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
|
|
2644
|
+
// If there is no $ sign at the beginning highlight (( and )) as punctuation
|
|
2645
|
+
'punctuation': /\(\(?|\)\)?|,|;/
|
|
2646
|
+
}
|
|
2647
|
+
},
|
|
2648
|
+
// [1]: Command Substitution
|
|
2649
|
+
{
|
|
2650
|
+
pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
|
|
2651
|
+
greedy: true,
|
|
2652
|
+
inside: {
|
|
2653
|
+
'variable': /^\$\(|^`|\)$|`$/
|
|
2654
|
+
}
|
|
2655
|
+
},
|
|
2656
|
+
// [2]: Brace expansion
|
|
2657
|
+
{
|
|
2658
|
+
pattern: /\$\{[^}]+\}/,
|
|
2659
|
+
greedy: true,
|
|
2660
|
+
inside: {
|
|
2661
|
+
'operator': /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
|
|
2662
|
+
'punctuation': /[\[\]]/,
|
|
2663
|
+
'environment': {
|
|
2664
|
+
pattern: RegExp('(\\{)' + envVars),
|
|
2665
|
+
lookbehind: true,
|
|
2666
|
+
alias: 'constant'
|
|
2667
|
+
}
|
|
2668
|
+
}
|
|
2669
|
+
},
|
|
2670
|
+
/\$(?:\w+|[#?*!@$])/
|
|
2671
|
+
],
|
|
2672
|
+
// Escape sequences from echo and printf's manuals, and escaped quotes.
|
|
2673
|
+
'entity': /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/
|
|
2674
|
+
};
|
|
2675
|
+
|
|
2676
|
+
Prism.languages.bash = {
|
|
2677
|
+
'shebang': {
|
|
2678
|
+
pattern: /^#!\s*\/.*/,
|
|
2679
|
+
alias: 'important'
|
|
2680
|
+
},
|
|
2681
|
+
'comment': {
|
|
2682
|
+
pattern: /(^|[^"{\\$])#.*/,
|
|
2683
|
+
lookbehind: true
|
|
2684
|
+
},
|
|
2685
|
+
'function-name': [
|
|
2686
|
+
// a) function foo {
|
|
2687
|
+
// b) foo() {
|
|
2688
|
+
// c) function foo() {
|
|
2689
|
+
// but not “foo {”
|
|
2690
|
+
{
|
|
2691
|
+
// a) and c)
|
|
2692
|
+
pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
|
|
2693
|
+
lookbehind: true,
|
|
2694
|
+
alias: 'function'
|
|
2695
|
+
},
|
|
2696
|
+
{
|
|
2697
|
+
// b)
|
|
2698
|
+
pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
|
|
2699
|
+
alias: 'function'
|
|
2700
|
+
}
|
|
2701
|
+
],
|
|
2702
|
+
// Highlight variable names as variables in for and select beginnings.
|
|
2703
|
+
'for-or-select': {
|
|
2704
|
+
pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
|
|
2705
|
+
alias: 'variable',
|
|
2706
|
+
lookbehind: true
|
|
2707
|
+
},
|
|
2708
|
+
// Highlight variable names as variables in the left-hand part
|
|
2709
|
+
// of assignments (“=” and “+=”).
|
|
2710
|
+
'assign-left': {
|
|
2711
|
+
pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
|
|
2712
|
+
inside: {
|
|
2713
|
+
'environment': {
|
|
2714
|
+
pattern: RegExp('(^|[\\s;|&]|[<>]\\()' + envVars),
|
|
2715
|
+
lookbehind: true,
|
|
2716
|
+
alias: 'constant'
|
|
2717
|
+
}
|
|
2718
|
+
},
|
|
2719
|
+
alias: 'variable',
|
|
2720
|
+
lookbehind: true
|
|
2721
|
+
},
|
|
2722
|
+
// Highlight parameter names as variables
|
|
2723
|
+
'parameter': {
|
|
2724
|
+
pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,
|
|
2725
|
+
alias: 'variable',
|
|
2726
|
+
lookbehind: true
|
|
2727
|
+
},
|
|
2728
|
+
'string': [
|
|
2729
|
+
// Support for Here-documents https://en.wikipedia.org/wiki/Here_document
|
|
2730
|
+
{
|
|
2731
|
+
pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
|
|
2732
|
+
lookbehind: true,
|
|
2733
|
+
greedy: true,
|
|
2734
|
+
inside: insideString
|
|
2735
|
+
},
|
|
2736
|
+
// Here-document with quotes around the tag
|
|
2737
|
+
// → No expansion (so no “inside”).
|
|
2738
|
+
{
|
|
2739
|
+
pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
|
|
2740
|
+
lookbehind: true,
|
|
2741
|
+
greedy: true,
|
|
2742
|
+
inside: {
|
|
2743
|
+
'bash': commandAfterHeredoc
|
|
2744
|
+
}
|
|
2745
|
+
},
|
|
2746
|
+
// “Normal” string
|
|
2747
|
+
{
|
|
2748
|
+
// https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
|
|
2749
|
+
pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
|
|
2750
|
+
lookbehind: true,
|
|
2751
|
+
greedy: true,
|
|
2752
|
+
inside: insideString
|
|
2753
|
+
},
|
|
2754
|
+
{
|
|
2755
|
+
// https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
|
|
2756
|
+
pattern: /(^|[^$\\])'[^']*'/,
|
|
2757
|
+
lookbehind: true,
|
|
2758
|
+
greedy: true
|
|
2759
|
+
},
|
|
2760
|
+
{
|
|
2761
|
+
// https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
|
|
2762
|
+
pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
|
|
2763
|
+
greedy: true,
|
|
2764
|
+
inside: {
|
|
2765
|
+
'entity': insideString.entity
|
|
2766
|
+
}
|
|
2767
|
+
}
|
|
2768
|
+
],
|
|
2769
|
+
'environment': {
|
|
2770
|
+
pattern: RegExp('\\$?' + envVars),
|
|
2771
|
+
alias: 'constant'
|
|
2772
|
+
},
|
|
2773
|
+
'variable': insideString.variable,
|
|
2774
|
+
'function': {
|
|
2775
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,
|
|
2776
|
+
lookbehind: true
|
|
2777
|
+
},
|
|
2778
|
+
'keyword': {
|
|
2779
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
|
|
2780
|
+
lookbehind: true
|
|
2781
|
+
},
|
|
2782
|
+
// https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
|
|
2783
|
+
'builtin': {
|
|
2784
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,
|
|
2785
|
+
lookbehind: true,
|
|
2786
|
+
// Alias added to make those easier to distinguish from strings.
|
|
2787
|
+
alias: 'class-name'
|
|
2788
|
+
},
|
|
2789
|
+
'boolean': {
|
|
2790
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
|
|
2791
|
+
lookbehind: true
|
|
2792
|
+
},
|
|
2793
|
+
'file-descriptor': {
|
|
2794
|
+
pattern: /\B&\d\b/,
|
|
2795
|
+
alias: 'important'
|
|
2796
|
+
},
|
|
2797
|
+
'operator': {
|
|
2798
|
+
// Lots of redirections here, but not just that.
|
|
2799
|
+
pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
|
|
2800
|
+
inside: {
|
|
2801
|
+
'file-descriptor': {
|
|
2802
|
+
pattern: /^\d/,
|
|
2803
|
+
alias: 'important'
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
},
|
|
2807
|
+
'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
|
|
2808
|
+
'number': {
|
|
2809
|
+
pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
|
|
2810
|
+
lookbehind: true
|
|
2811
|
+
}
|
|
2812
|
+
};
|
|
2813
|
+
|
|
2814
|
+
commandAfterHeredoc.inside = Prism.languages.bash;
|
|
2815
|
+
|
|
2816
|
+
/* Patterns in command substitution. */
|
|
2817
|
+
var toBeCopied = [
|
|
2818
|
+
'comment',
|
|
2819
|
+
'function-name',
|
|
2820
|
+
'for-or-select',
|
|
2821
|
+
'assign-left',
|
|
2822
|
+
'parameter',
|
|
2823
|
+
'string',
|
|
2824
|
+
'environment',
|
|
2825
|
+
'function',
|
|
2826
|
+
'keyword',
|
|
2827
|
+
'builtin',
|
|
2828
|
+
'boolean',
|
|
2829
|
+
'file-descriptor',
|
|
2830
|
+
'operator',
|
|
2831
|
+
'punctuation',
|
|
2832
|
+
'number'
|
|
2833
|
+
];
|
|
2834
|
+
var inside = insideString.variable[1].inside;
|
|
2835
|
+
for (var i = 0; i < toBeCopied.length; i++) {
|
|
2836
|
+
inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]];
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2839
|
+
Prism.languages.sh = Prism.languages.bash;
|
|
2840
|
+
Prism.languages.shell = Prism.languages.bash;
|
|
2841
|
+
}(Prism));
|
|
2842
|
+
|
|
2843
|
+
(function (Prism) {
|
|
2844
|
+
|
|
2845
|
+
// https://yaml.org/spec/1.2/spec.html#c-ns-anchor-property
|
|
2846
|
+
// https://yaml.org/spec/1.2/spec.html#c-ns-alias-node
|
|
2847
|
+
var anchorOrAlias = /[*&][^\s[\]{},]+/;
|
|
2848
|
+
// https://yaml.org/spec/1.2/spec.html#c-ns-tag-property
|
|
2849
|
+
var tag = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/;
|
|
2850
|
+
// https://yaml.org/spec/1.2/spec.html#c-ns-properties(n,c)
|
|
2851
|
+
var properties = '(?:' + tag.source + '(?:[ \t]+' + anchorOrAlias.source + ')?|'
|
|
2852
|
+
+ anchorOrAlias.source + '(?:[ \t]+' + tag.source + ')?)';
|
|
2853
|
+
// https://yaml.org/spec/1.2/spec.html#ns-plain(n,c)
|
|
2854
|
+
// This is a simplified version that doesn't support "#" and multiline keys
|
|
2855
|
+
// All these long scarry character classes are simplified versions of YAML's characters
|
|
2856
|
+
var plainKey = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source
|
|
2857
|
+
.replace(/<PLAIN>/g, function () { return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source; });
|
|
2858
|
+
var string = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
|
|
2859
|
+
|
|
2860
|
+
/**
|
|
2861
|
+
*
|
|
2862
|
+
* @param {string} value
|
|
2863
|
+
* @param {string} [flags]
|
|
2864
|
+
* @returns {RegExp}
|
|
2865
|
+
*/
|
|
2866
|
+
function createValuePattern(value, flags) {
|
|
2867
|
+
flags = (flags || '').replace(/m/g, '') + 'm'; // add m flag
|
|
2868
|
+
var pattern = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source
|
|
2869
|
+
.replace(/<<prop>>/g, function () { return properties; }).replace(/<<value>>/g, function () { return value; });
|
|
2870
|
+
return RegExp(pattern, flags);
|
|
2871
|
+
}
|
|
2872
|
+
|
|
2873
|
+
Prism.languages.yaml = {
|
|
2874
|
+
'scalar': {
|
|
2875
|
+
pattern: RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source
|
|
2876
|
+
.replace(/<<prop>>/g, function () { return properties; })),
|
|
2877
|
+
lookbehind: true,
|
|
2878
|
+
alias: 'string'
|
|
2879
|
+
},
|
|
2880
|
+
'comment': /#.*/,
|
|
2881
|
+
'key': {
|
|
2882
|
+
pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source
|
|
2883
|
+
.replace(/<<prop>>/g, function () { return properties; })
|
|
2884
|
+
.replace(/<<key>>/g, function () { return '(?:' + plainKey + '|' + string + ')'; })),
|
|
2885
|
+
lookbehind: true,
|
|
2886
|
+
greedy: true,
|
|
2887
|
+
alias: 'atrule'
|
|
2888
|
+
},
|
|
2889
|
+
'directive': {
|
|
2890
|
+
pattern: /(^[ \t]*)%.+/m,
|
|
2891
|
+
lookbehind: true,
|
|
2892
|
+
alias: 'important'
|
|
2893
|
+
},
|
|
2894
|
+
'datetime': {
|
|
2895
|
+
pattern: createValuePattern(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),
|
|
2896
|
+
lookbehind: true,
|
|
2897
|
+
alias: 'number'
|
|
2898
|
+
},
|
|
2899
|
+
'boolean': {
|
|
2900
|
+
pattern: createValuePattern(/false|true/.source, 'i'),
|
|
2901
|
+
lookbehind: true,
|
|
2902
|
+
alias: 'important'
|
|
2903
|
+
},
|
|
2904
|
+
'null': {
|
|
2905
|
+
pattern: createValuePattern(/null|~/.source, 'i'),
|
|
2906
|
+
lookbehind: true,
|
|
2907
|
+
alias: 'important'
|
|
2908
|
+
},
|
|
2909
|
+
'string': {
|
|
2910
|
+
pattern: createValuePattern(string),
|
|
2911
|
+
lookbehind: true,
|
|
2912
|
+
greedy: true
|
|
2913
|
+
},
|
|
2914
|
+
'number': {
|
|
2915
|
+
pattern: createValuePattern(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, 'i'),
|
|
2916
|
+
lookbehind: true
|
|
2917
|
+
},
|
|
2918
|
+
'tag': tag,
|
|
2919
|
+
'important': anchorOrAlias,
|
|
2920
|
+
'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./
|
|
2921
|
+
};
|
|
2922
|
+
|
|
2923
|
+
Prism.languages.yml = Prism.languages.yaml;
|
|
2924
|
+
|
|
2925
|
+
}(Prism));
|
|
2926
|
+
|
|
2927
|
+
(function (Prism) {
|
|
2928
|
+
|
|
2929
|
+
var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
2930
|
+
|
|
2931
|
+
Prism.languages.css = {
|
|
2932
|
+
'comment': /\/\*[\s\S]*?\*\//,
|
|
2933
|
+
'atrule': {
|
|
2934
|
+
pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
|
|
2935
|
+
inside: {
|
|
2936
|
+
'rule': /^@[\w-]+/,
|
|
2937
|
+
'selector-function-argument': {
|
|
2938
|
+
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
|
2939
|
+
lookbehind: true,
|
|
2940
|
+
alias: 'selector'
|
|
2941
|
+
},
|
|
2942
|
+
'keyword': {
|
|
2943
|
+
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
|
2944
|
+
lookbehind: true
|
|
2945
|
+
}
|
|
2946
|
+
// See rest below
|
|
2947
|
+
}
|
|
2948
|
+
},
|
|
2949
|
+
'url': {
|
|
2950
|
+
// https://drafts.csswg.org/css-values-3/#urls
|
|
2951
|
+
pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
|
|
2952
|
+
greedy: true,
|
|
2953
|
+
inside: {
|
|
2954
|
+
'function': /^url/i,
|
|
2955
|
+
'punctuation': /^\(|\)$/,
|
|
2956
|
+
'string': {
|
|
2957
|
+
pattern: RegExp('^' + string.source + '$'),
|
|
2958
|
+
alias: 'url'
|
|
2959
|
+
}
|
|
2960
|
+
}
|
|
2961
|
+
},
|
|
2962
|
+
'selector': {
|
|
2963
|
+
pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
|
|
2964
|
+
lookbehind: true
|
|
2965
|
+
},
|
|
2966
|
+
'string': {
|
|
2967
|
+
pattern: string,
|
|
2968
|
+
greedy: true
|
|
2969
|
+
},
|
|
2970
|
+
'property': {
|
|
2971
|
+
pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
|
2972
|
+
lookbehind: true
|
|
2973
|
+
},
|
|
2974
|
+
'important': /!important\b/i,
|
|
2975
|
+
'function': {
|
|
2976
|
+
pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
|
2977
|
+
lookbehind: true
|
|
2978
|
+
},
|
|
2979
|
+
'punctuation': /[(){};:,]/
|
|
2980
|
+
};
|
|
2981
|
+
|
|
2982
|
+
Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
|
|
2983
|
+
|
|
2984
|
+
var markup = Prism.languages.markup;
|
|
2985
|
+
if (markup) {
|
|
2986
|
+
markup.tag.addInlined('style', 'css');
|
|
2987
|
+
markup.tag.addAttribute('style', 'css');
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2990
|
+
}(Prism));
|
|
2991
|
+
|
|
2992
|
+
const edsCodeBlockCss = ":host{display:block;font-family:var(--font-family, 'Courier New', monospace)}pre[class*=\"language-\"]{white-space:pre-wrap;word-break:break-word;}.language{font-weight:bold;text-transform:uppercase}pre{margin:0;border-radius:8px;color:var(--purple-200);overflow:auto}code{font-family:'Courier New', monospace}.token.keyword{color:var(--purple-500)}.token.string{color:var(--green-500)}.token.function{color:var(--cyan-500)}.token.comment{color:var(--grey-700)}.relative{position:relative}.bg-stronger{background-color:var(--grey-900)}.rounded-sm{border-radius:8px}.rounded-xs{border-radius:4px}.text-inverse{color:var(--white)}.text-light{color:var(--grey-700)}.text-lighter{color:var(--grey-600)}.text-lightest{color:var(--grey-500)}.flex{display:flex}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.p-0{padding:0rem}.p-12{padding:0.75rem}.p-16{padding:1rem}.p-20{padding:1.25rem}.p-6{padding:0.375rem}.p-8{padding:0.5rem}.pl-8{padding-left:0.5rem}.mb-10{margin-bottom:0.625rem}.mb-12{margin-bottom:0.75rem}.mb-28{margin-bottom:1.75rem}.pb-16{padding-bottom:1rem}.pb-20{padding-bottom:1.25rem}.pb-28{padding-bottom:1.75rem}.pb-60{padding-bottom:3.75rem}.pb-8{padding-bottom:0.5rem}.mt-16{margin-top:1rem}.mt-2{margin-top:0.125rem}.mt-20{margin-top:1.25rem}.mt-28{margin-top:1.75rem}.w-20{width:1.25rem}.h-20{height:1.25rem}.f-ui-03{font-family:var(--f-ui-03-fontFamily);font-weight:var(--f-ui-03-fontWeight);font-size:var(--f-ui-03-fontSize);line-height:var(--f-ui-03-lineHeight);letter-spacing:var(--f-ui-03-letterSpacing)}.f-ui-03-light{font-family:var(--f-ui-03-light-fontFamily);font-weight:var(--f-ui-03-light-fontWeight);font-size:var(--f-ui-03-light-fontSize);line-height:var(--f-ui-03-light-lineHeight);letter-spacing:var(--f-ui-03-light-letterSpacing)}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}";
|
|
2993
|
+
const EdsCodeBlockStyle0 = edsCodeBlockCss;
|
|
2994
|
+
|
|
2995
|
+
const EdsCodeBlock = class {
|
|
2996
|
+
constructor(hostRef) {
|
|
2997
|
+
registerInstance(this, hostRef);
|
|
2998
|
+
this.code = undefined;
|
|
2999
|
+
this.language = undefined;
|
|
3000
|
+
this.copied = false;
|
|
3001
|
+
}
|
|
3002
|
+
/**
|
|
3003
|
+
* Copies the current code content to the clipboard and sets a temporary copied state.
|
|
3004
|
+
*
|
|
3005
|
+
* @private
|
|
3006
|
+
* @returns {void}
|
|
3007
|
+
*/
|
|
3008
|
+
copyToClipboard() {
|
|
3009
|
+
navigator.clipboard.writeText(this.code).then(() => {
|
|
3010
|
+
this.copied = true;
|
|
3011
|
+
/*const analyticsName = this.createHumanFriendlyAnalyticsName(this.code, this.language);
|
|
3012
|
+
sendAnalytics({
|
|
3013
|
+
category: 'ui-component',
|
|
3014
|
+
parentContext: null,
|
|
3015
|
+
tag: this.el.tagName.toLowerCase(),
|
|
3016
|
+
name: analyticsName || '',
|
|
3017
|
+
action: 'copy'
|
|
3018
|
+
});*/
|
|
3019
|
+
setTimeout(() => (this.copied = false), 2000);
|
|
3020
|
+
});
|
|
3021
|
+
}
|
|
3022
|
+
/**
|
|
3023
|
+
* Utility function that creates a human-friendly analytics name based on the code and language.
|
|
3024
|
+
* It uses:
|
|
3025
|
+
* - The language (in uppercase)
|
|
3026
|
+
* - The number of non-empty lines in the code
|
|
3027
|
+
* - The first non-empty line of code (truncated to 30 characters, if needed)
|
|
3028
|
+
*
|
|
3029
|
+
* returns A descriptive analytics name.
|
|
3030
|
+
*/
|
|
3031
|
+
/*private createHumanFriendlyAnalyticsName(code: string, language: string): string {
|
|
3032
|
+
// Count non-empty lines
|
|
3033
|
+
const lines = code.split('\n').filter(line => line.trim() !== '').length;
|
|
3034
|
+
|
|
3035
|
+
// Find the first non-empty line and trim it
|
|
3036
|
+
let firstNonEmptyLine = code.split('\n').find(line => line.trim() !== '');
|
|
3037
|
+
firstNonEmptyLine = firstNonEmptyLine ? firstNonEmptyLine.trim() : '';
|
|
3038
|
+
|
|
3039
|
+
// Truncate the snippet if it’s too long
|
|
3040
|
+
if (firstNonEmptyLine.length > 30) {
|
|
3041
|
+
firstNonEmptyLine = firstNonEmptyLine.substring(0, 30) + '...';
|
|
3042
|
+
}
|
|
3043
|
+
|
|
3044
|
+
return `CodeBlock:${language.toLowerCase()}|${lines}-line(s)|${firstNonEmptyLine.toLowerCase()}`;
|
|
3045
|
+
}*/
|
|
3046
|
+
/**
|
|
3047
|
+
* Returns the syntax-highlighted HTML for the code.
|
|
3048
|
+
* If the provided language is supported by Prism, this method returns the highlighted code.
|
|
3049
|
+
* Otherwise, it logs a warning and returns the raw code.
|
|
3050
|
+
*
|
|
3051
|
+
* @private
|
|
3052
|
+
* @returns {string} The highlighted HTML string for the code block.
|
|
3053
|
+
*/
|
|
3054
|
+
getHighlightedCode() {
|
|
3055
|
+
if (this.language && Prism$1.languages[this.language]) {
|
|
3056
|
+
return Prism$1.highlight(this.code, Prism$1.languages[this.language], this.language);
|
|
3057
|
+
}
|
|
3058
|
+
// eslint-disable-next-line
|
|
3059
|
+
//console.warn(`Unsupported or missing language: ${this.language}`);
|
|
3060
|
+
return this.code; // Fallback if language is not provided or unsupported
|
|
3061
|
+
}
|
|
3062
|
+
render() {
|
|
3063
|
+
return (h("div", { key: '3cfaec27c58d05868313150f1a358ff64c8eafbd', class: "relative bg-stronger rounded-sm" }, h("div", { key: 'ed91821385f30305348750dbfffec5fdd7b4dbb8', class: "text-inverse flex justify-between items-center p-8" }, this.language ? (h("span", { class: "f-ui-03" }, this.language.toUpperCase())) : (h("pre", { class: "bg-stronger pl-8", role: "region", "aria-label": "Code block without language" }, h("code", { innerHTML: this.getHighlightedCode() }))), h("span", { key: '3e419585214883c878a8e84c440dbd29d590002d', "aria-hidden": "true", class: "w-20 h-20 mt-8" }, h("eds-icon-wrapper", { key: '051fa9c714d5c077d5d96ec9b92f8a744ec123bc', icon: this.copied ? 'success' : 'copy', onClick: () => this.copyToClipboard() })), h("span", { key: '707950ce89cb0c24b1afac42a8801d13659b6bab', class: "sr-only" }, "Copy Code")), this.language && (h("pre", { key: '59923dd4c16cfecafffa2edaaac5ef7579c3f128', class: `language-${this.language} bg-stronger pl-8 pb-8`, role: "region", "aria-label": `Code block in ${this.language}` }, h("code", { key: '8c708992c04029d71685ad8922383ecdda05ac3c', innerHTML: this.getHighlightedCode() })))));
|
|
3064
|
+
}
|
|
3065
|
+
get el() { return getElement(this); }
|
|
3066
|
+
};
|
|
3067
|
+
EdsCodeBlock.style = EdsCodeBlockStyle0;
|
|
3068
|
+
|
|
254
3069
|
const edsDropdownCss = ".z-focus{z-index:99}.relative{position:relative}.shadow-small{--tw-shadow:0px 1.5px 2px rgba(0, 0, 0, 0.1);--tw-shadow-colored:0px 1.5px 2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.bg-inverse{background-color:var(--white)}.border-softest{border:2px solid rgba(0, 0, 0, .05)}.z-10{z-index:10}.z-on-top{z-index:99999}.absolute{position:absolute}.top-full{top:100%}.mt-4{margin-top:0.25rem}.mt-6{margin-top:0.375rem}.mt-8{margin-top:0.5rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.flex-col{flex-direction:column}.gap-y-4{row-gap:0.25rem}.rounded-lg{border-radius:16px}.border-2{border-width:2px}.p-8{padding:0.5rem}.left-0{left:0rem}.left-1\\/2{left:50%}.left-4{left:0.25rem}.left-\\[4px\\]{left:4px}.right-0{right:0rem}.right-4{right:0.25rem}.right-8{right:0.5rem}";
|
|
255
3070
|
const EdsDropdownStyle0 = edsDropdownCss;
|
|
256
3071
|
|
|
@@ -356,14 +3171,14 @@ const EdsDropdown = class {
|
|
|
356
3171
|
* @returns {JSX.Element} The rendered dropdown component.
|
|
357
3172
|
*/
|
|
358
3173
|
render() {
|
|
359
|
-
return (h("div", { key: '
|
|
3174
|
+
return (h("div", { key: '31e8b1fd4e146cbcad4d74bd78dff1cd1e1950bd', class: "z-focus relative", ref: (el) => (this.dropdownContent = el) }, h("eds-button", { key: '7021a0b0ff66780a324d7d9d1f6cff250ab64178', label: this.label, "aria-label": this.ariaLabel, icon: this.icon, intent: this.intent, onClick: this.handleClick, "aria-expanded": this.isOpen.toString(), "aria-haspopup": "menu" }), h("nav", { key: '904fd2a7f727a8b3966eab6cf9ebdb0efa474ae0', role: "menu", class: {
|
|
360
3175
|
'shadow-small bg-inverse border-softest z-10 z-on-top absolute top-full mt-4 flex flex-col gap-y-4 border-2 p-8': true,
|
|
361
3176
|
'left-4': this.dropdownPos === 'left' && this.dropdownOffset,
|
|
362
3177
|
'left-0': this.dropdownPos === 'left' && !this.dropdownOffset,
|
|
363
3178
|
'right-4': this.dropdownPos === 'right' && this.dropdownOffset,
|
|
364
3179
|
'right-0': this.dropdownPos === 'right' && !this.dropdownOffset,
|
|
365
3180
|
'rounded-lg': this.rounded
|
|
366
|
-
}, style: { display: this.isOpen ? 'block' : 'none' }, "aria-label": "Dropdown", "aria-hidden": !this.isOpen }, h("slot", { key: '
|
|
3181
|
+
}, style: { display: this.isOpen ? 'block' : 'none' }, "aria-label": "Dropdown", "aria-hidden": !this.isOpen }, h("slot", { key: 'b416621930c7117775fef2ee91bdca0f660302f5' }))));
|
|
367
3182
|
}
|
|
368
3183
|
get host() { return getElement(this); }
|
|
369
3184
|
};
|
|
@@ -454,6 +3269,13 @@ function findRatingElement(formEl) {
|
|
|
454
3269
|
}
|
|
455
3270
|
return null;
|
|
456
3271
|
}
|
|
3272
|
+
function findNpsElement(formEl) {
|
|
3273
|
+
const elements = Array.from(formEl.querySelectorAll('eds-nps'));
|
|
3274
|
+
for (const element of elements) {
|
|
3275
|
+
return element;
|
|
3276
|
+
}
|
|
3277
|
+
return null;
|
|
3278
|
+
}
|
|
457
3279
|
/**
|
|
458
3280
|
* Validates all fields and returns an object containing the errors and a flag indicating any errors.
|
|
459
3281
|
*/
|
|
@@ -463,6 +3285,7 @@ isFieldVisible) {
|
|
|
463
3285
|
const errors = {};
|
|
464
3286
|
let hasError = false;
|
|
465
3287
|
parsedFields.forEach((field) => {
|
|
3288
|
+
var _a;
|
|
466
3289
|
// Only validate fields that are visible.
|
|
467
3290
|
if (!isFieldVisible(field, values)) {
|
|
468
3291
|
// If a field is hidden, clear its error.
|
|
@@ -498,6 +3321,29 @@ isFieldVisible) {
|
|
|
498
3321
|
}
|
|
499
3322
|
}
|
|
500
3323
|
}
|
|
3324
|
+
// NPS type
|
|
3325
|
+
else if (field.type === 'nps') {
|
|
3326
|
+
const npsEl = findNpsElement(formEl);
|
|
3327
|
+
if (npsEl && npsEl.shadowRoot) {
|
|
3328
|
+
const raw = (_a = npsEl.shadowRoot
|
|
3329
|
+
.querySelector('eds-button[tabindex="0"]')) === null || _a === void 0 ? void 0 : _a.getAttribute('aria-label');
|
|
3330
|
+
const parsed = raw !== null ? parseInt(raw, 10) : NaN;
|
|
3331
|
+
const value = Number.isInteger(parsed) && parsed >= 0 && parsed <= 10 ? parsed : NaN;
|
|
3332
|
+
if (isNaN(value)) {
|
|
3333
|
+
// eslint-disable-next-line
|
|
3334
|
+
if (field.required) {
|
|
3335
|
+
errors[field.name] = ['This field is required.'];
|
|
3336
|
+
hasError = true;
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
else if (field.required) {
|
|
3341
|
+
// No NPS component found but required
|
|
3342
|
+
errors[field.name] = ['This field is required.'];
|
|
3343
|
+
hasError = true;
|
|
3344
|
+
}
|
|
3345
|
+
return;
|
|
3346
|
+
}
|
|
501
3347
|
else {
|
|
502
3348
|
// For all other types, find the first matching element.
|
|
503
3349
|
const inputEl = findFieldElement(formEl, field.name);
|
|
@@ -549,7 +3395,7 @@ function getFormInitData({ initData, parsedFields, currentValues
|
|
|
549
3395
|
return { updatedValues };
|
|
550
3396
|
}
|
|
551
3397
|
|
|
552
|
-
const edsFormCss = ".container{width:calc(var(--container-width, 100%) - (2 * var(--breakout-container-outer-gutter, var(--container-outer-gutter, var(--outer-gutter, 0)))));margin-right:auto;margin-left:auto}.container>*{--container-outer-gutter:0;--breakout-container-outer-gutter:0}.flex{display:flex}.flex-col{flex-direction:column}.f-body-01{font-family:var(--f-body-01-fontFamily);font-weight:var(--f-body-01-fontWeight);font-size:var(--f-body-01-fontSize);line-height:var(--f-body-01-lineHeight);letter-spacing:var(--f-body-01-letterSpacing)}.f-body-01 b,.f-body-01 strong{font-weight:var(--f-body-01---bold-weight, bold)}.f-body-02 b,.f-body-02 strong{font-weight:var(--f-body-02---bold-weight, bold)}.f-heading-04{font-family:var(--f-heading-04-fontFamily);font-weight:var(--f-heading-04-fontWeight);font-size:var(--f-heading-04-fontSize);line-height:var(--f-heading-04-lineHeight);letter-spacing:var(--f-heading-04-letterSpacing)}.rounded-sm{border-radius:8px}.border-softer{border-color:rgba(0, 0, 0, .1)}.border-2{border-width:2px}.mt-20{margin-top:1.25rem}.mt-32{margin-top:2rem}.mb-32{margin-bottom:2rem}.pt-28{padding-top:1.75rem}.pl-8{padding-left:0.5rem}.pl-16{padding-left:1rem}.border-l-2{border-left-width:2px}.gap-y-8{row-gap:0.5rem}.gap-y-16{row-gap:1rem}.gap-y-24{row-gap:1.5rem}.border-group{border-left:1px solid var(--soft-color, #ddd);padding-left:1rem}";
|
|
3398
|
+
const edsFormCss = ".container{width:calc(var(--container-width, 100%) - (2 * var(--breakout-container-outer-gutter, var(--container-outer-gutter, var(--outer-gutter, 0)))));margin-right:auto;margin-left:auto}.container>*{--container-outer-gutter:0;--breakout-container-outer-gutter:0}.flex{display:flex}.flex-col{flex-direction:column}.f-body-01{font-family:var(--f-body-01-fontFamily);font-weight:var(--f-body-01-fontWeight);font-size:var(--f-body-01-fontSize);line-height:var(--f-body-01-lineHeight);letter-spacing:var(--f-body-01-letterSpacing)}.f-body-02{font-family:var(--f-body-02-fontFamily);font-weight:var(--f-body-02-fontWeight);font-size:var(--f-body-02-fontSize);line-height:var(--f-body-02-lineHeight);letter-spacing:var(--f-body-02-letterSpacing)}.f-body-01 b,.f-body-01 strong{font-weight:var(--f-body-01---bold-weight, bold)}.f-body-02 b,.f-body-02 strong{font-weight:var(--f-body-02---bold-weight, bold)}.f-heading-04{font-family:var(--f-heading-04-fontFamily);font-weight:var(--f-heading-04-fontWeight);font-size:var(--f-heading-04-fontSize);line-height:var(--f-heading-04-lineHeight);letter-spacing:var(--f-heading-04-letterSpacing)}.f-heading-05{font-family:var(--f-heading-05-fontFamily);font-weight:var(--f-heading-05-fontWeight);font-size:var(--f-heading-05-fontSize);line-height:var(--f-heading-05-lineHeight);letter-spacing:var(--f-heading-05-letterSpacing)}.text-light{color:var(--grey-700)}.rounded-sm{border-radius:8px}.border-softer{border-color:rgba(0, 0, 0, .1)}.border-2{border-width:2px}.mt-20{margin-top:1.25rem}.mt-32{margin-top:2rem}.mb-32{margin-bottom:2rem}.pt-28{padding-top:1.75rem}.pl-8{padding-left:0.5rem}.pl-16{padding-left:1rem}.border-l-2{border-left-width:2px}.gap-y-8{row-gap:0.5rem}.gap-y-16{row-gap:1rem}.gap-y-24{row-gap:1.5rem}.border-group{border-left:1px solid var(--soft-color, #ddd);padding-left:1rem}.bg-inverse{background-color:var(--white)}.effect-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}.shadow-hover{--tw-shadow:0px 0px 16px rgba(0, 0, 0, 0.2);--tw-shadow-colored:0px 0px 16px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.cursor-pointer{cursor:pointer}.effect-focus-within{outline-width:3px;outline-offset:2px;outline-color:var(--green-500)}.effect-focus-within:focus-within{outline-style:solid}.relative{position:relative}.rounded-lg{border-radius:16px}.px-16{padding-left:1rem;padding-right:1rem}.pb-16{padding-bottom:1rem}.p-32{padding:2rem}";
|
|
553
3399
|
const EdsFormStyle0 = edsFormCss;
|
|
554
3400
|
|
|
555
3401
|
const EdsForm = class {
|
|
@@ -557,13 +3403,17 @@ const EdsForm = class {
|
|
|
557
3403
|
registerInstance(this, hostRef);
|
|
558
3404
|
this.form = createEvent(this, "form", 7);
|
|
559
3405
|
this.name = 'eds-form';
|
|
3406
|
+
this.title = undefined;
|
|
3407
|
+
this.description = undefined;
|
|
560
3408
|
this.setFormUrl = true;
|
|
561
3409
|
this.formBtn = true;
|
|
562
3410
|
this.formBtnLabel = 'Submit';
|
|
3411
|
+
this.buttonIntent = 'primary';
|
|
563
3412
|
this.errorMessage = 'Some fields in your form are incorrect.';
|
|
564
3413
|
this.fields = [];
|
|
565
3414
|
this.groups = [];
|
|
566
3415
|
this.initData = {};
|
|
3416
|
+
this.formStyle = 'default';
|
|
567
3417
|
this.values = {};
|
|
568
3418
|
this.isSubmitting = false;
|
|
569
3419
|
this.hasError = false;
|
|
@@ -787,6 +3637,25 @@ const EdsForm = class {
|
|
|
787
3637
|
message: `${field.name} updated`
|
|
788
3638
|
});
|
|
789
3639
|
}
|
|
3640
|
+
handleNPS(e, field) {
|
|
3641
|
+
const score = e.detail;
|
|
3642
|
+
this.values = Object.assign(Object.assign({}, this.values), { [field.name]: score });
|
|
3643
|
+
const newErrors = Object.assign({}, this.errors);
|
|
3644
|
+
if (field.required && score === null) {
|
|
3645
|
+
newErrors[field.name] = ['This field is required'];
|
|
3646
|
+
}
|
|
3647
|
+
else {
|
|
3648
|
+
delete newErrors[field.name];
|
|
3649
|
+
}
|
|
3650
|
+
this.errors = newErrors;
|
|
3651
|
+
this.hasError = Object.keys(newErrors).length > 0;
|
|
3652
|
+
this.form.emit({
|
|
3653
|
+
event: 'change',
|
|
3654
|
+
field: field.name,
|
|
3655
|
+
value: score,
|
|
3656
|
+
message: `${field.name} updated`
|
|
3657
|
+
});
|
|
3658
|
+
}
|
|
790
3659
|
handleSubmit() {
|
|
791
3660
|
var _a, _b;
|
|
792
3661
|
if (this.isSubmitting) {
|
|
@@ -842,10 +3711,15 @@ const EdsForm = class {
|
|
|
842
3711
|
}
|
|
843
3712
|
get groupedFields() {
|
|
844
3713
|
const map = {};
|
|
845
|
-
// initialize buckets for each group
|
|
3714
|
+
// initialize buckets for each declared group
|
|
846
3715
|
this.parsedGroups.forEach((g) => (map[g.id] = []));
|
|
3716
|
+
// always keep an ungrouped bucket
|
|
847
3717
|
map['__ungrouped'] = [];
|
|
3718
|
+
// only bucket fields that are currently visible
|
|
848
3719
|
this.parsedFields.forEach((f) => {
|
|
3720
|
+
if (!this.isFieldVisible(f)) {
|
|
3721
|
+
return;
|
|
3722
|
+
}
|
|
849
3723
|
const gid = f.groupId || '__ungrouped';
|
|
850
3724
|
if (!map[gid]) {
|
|
851
3725
|
map[gid] = [];
|
|
@@ -855,7 +3729,7 @@ const EdsForm = class {
|
|
|
855
3729
|
return map;
|
|
856
3730
|
}
|
|
857
3731
|
renderField(field) {
|
|
858
|
-
var _a, _b;
|
|
3732
|
+
var _a, _b, _c;
|
|
859
3733
|
if (!this.isFieldVisible(field)) {
|
|
860
3734
|
return null;
|
|
861
3735
|
}
|
|
@@ -865,7 +3739,10 @@ const EdsForm = class {
|
|
|
865
3739
|
const val = this.values[field.name] || 0;
|
|
866
3740
|
return (h("div", { class: "form-group rating-field", key: field.name }, h("div", { class: "flex justify-between" }, field && (h("eds-input-label", { name: `rating-${field.name}`, label: field.label, disabled: field.disabled, required: field.required }))), h("eds-rating", { id: `rating-${field.name}`, "rating-type": field.ratingType, "rating-count": field.ratingCount, "selected-rating": val, onRating: (e) => this.handleRating(e, field) }), h("div", { class: "mt-6" }, h("eds-input-footer", { id: `${field.name}-footer`, name: field.name, message: field.message, "error-message": (_a = this.errors[field.name]) === null || _a === void 0 ? void 0 : _a.join('<br/>'), error: !!this.errors[field.name], link: field.link }))));
|
|
867
3741
|
}
|
|
868
|
-
|
|
3742
|
+
else if (field.type === 'nps') {
|
|
3743
|
+
return (h("div", { class: "form-group nps-field", key: field.name }, h("div", { class: "flex justify-between" }, field && (h("eds-input-label", { name: `nps-${field.name}`, label: field.question, disabled: field.disabled, required: field.required }))), h("eds-nps", { id: `nps-${field.name}`, "right-label": field.rightLabel, "left-label": field.leftLabel, onNps: (e) => this.handleNPS(e, field) }), h("div", { class: "mt-6" }, h("eds-input-footer", { id: `${field.name}-footer`, name: field.name, "error-message": (_b = this.errors[field.name]) === null || _b === void 0 ? void 0 : _b.join('<br/>'), error: !!this.errors[field.name] }))));
|
|
3744
|
+
}
|
|
3745
|
+
return (h("eds-input-field", { key: field.name, name: field.name, label: field.label, placeholder: field.placeholder, type: field.type, value: this.values[field.name], required: field.required, hint: field.hint, message: field.message, error: !!this.errors[field.name], errorMessage: (_c = this.errors[field.name]) === null || _c === void 0 ? void 0 : _c.join('<br/>'), options: field.options, onInput: (e) => this.handleInput(e, field), onChangeNative: (e) => this.handleChange(e, field) }));
|
|
869
3746
|
}
|
|
870
3747
|
async getData() {
|
|
871
3748
|
return this.makeFormData();
|
|
@@ -874,9 +3751,13 @@ const EdsForm = class {
|
|
|
874
3751
|
const hiddenFields = this.parsedFields.filter((field) => field.type === 'hidden');
|
|
875
3752
|
//const otherFields = this.parsedFields.filter((field) => field.type !== 'hidden');
|
|
876
3753
|
const buckets = this.groupedFields;
|
|
877
|
-
|
|
3754
|
+
// build the shadow/bg classes if formStyle="shadow"
|
|
3755
|
+
const styleClasses = this.formStyle === 'shadow'
|
|
3756
|
+
? 'bg-inverse effect-shadow shadow-hover border-softer relative rounded-lg border-2 p-32'
|
|
3757
|
+
: '';
|
|
3758
|
+
return (h("form", { key: 'ecf49eb81f18b444d059d3bdea4600f4ae594ea9', class: styleClasses, ref: (el) => (this.formEl = el), autocomplete: "on", onSubmit: this.handleSubmit }, h("div", { key: '65137fb770f274431c7906326cdf49e0fee73b18', class: "flex flex-col gap-y-24" }, this.title && (h("span", { key: 'e4c5b4a7883c4569a657cc234f18f995480ec8df', role: "heading", class: "f-heading-04" }, this.title)), this.description && h("span", { key: '65528e4600127f1cff4ce0e5be6f8a6bddc4c864', class: "f-body-02 text-light" }, this.description), h("slot", { key: '6230035a050386763723c2b60bd5e81b912762d7' })), hiddenFields.map((field, index) => (h("eds-input", { key: index, type: "hidden", name: field.name, value: field.value }))), this.parsedGroups
|
|
878
3759
|
.filter((g) => Array.isArray(buckets[g.id]) && buckets[g.id].length > 0)
|
|
879
|
-
.map((g) => (h("div", { class: "container mt-
|
|
3760
|
+
.map((g) => (h("div", { class: "container mt-32", key: g.id }, h("span", { class: "f-body-02" }, h("b", null, g.title)), h("div", { class: "border-group mt-32 mb-32 flex flex-col gap-y-24" }, buckets[g.id].map((f) => this.renderField(f)))))), h("div", { key: '8116d30248f8461a842365470da9915200531028', class: "flex flex-col mt-32 gap-y-24" }, buckets['__ungrouped'].map((f) => this.renderField(f))), this.formBtn && (h("div", { key: 'e2f1d3ca6a9f6a3b44c45e576150505c49e41dd1', class: "mt-32" }, h("eds-button", { key: 'e312bf08b5db526c00497fafaa9476a225919aaf', intent: this.buttonIntent, label: this.formBtnLabel, disabled: this.isSubmitting, loading: this.isSubmitting, onClick: () => this.handleSubmit() })))));
|
|
880
3761
|
}
|
|
881
3762
|
get el() { return getElement(this); }
|
|
882
3763
|
static get watchers() { return {
|
|
@@ -934,7 +3815,7 @@ const EdsHeader = class {
|
|
|
934
3815
|
const classes = variantClasses[this.headerVariant] || variantClasses.default;
|
|
935
3816
|
// Logo color variant: default and inverse use 'color', strong uses 'color-white'
|
|
936
3817
|
const logoType = this.headerVariant === 'strong' ? 'color-white' : 'color';
|
|
937
|
-
return (h("header", { key: '
|
|
3818
|
+
return (h("header", { key: 'a0f5bb7d9e850e9414db804019674d6bcbc8ea0b', class: `flex items-center justify-between relative z-10 ${classes}` }, h("div", { key: '678d5b1583e6fa47c0eac8ce734e8ec34cd76ad9', class: "mr-auto w-[200px] h-[85px]" }, h("eds-logo", { key: '12ce9c42b266bbddfd75d2a8f0097708480a2490', type: logoType, href: this.homeUrl })), this.parsedLinks && (h("nav", { key: 'eb388b679d4e268dc7fc011bc2a6406a619287c8', class: "absolute left-1/2 top-1/2 grow -translate-x-1/2 -translate-y-1/2 justify-center hidden md:flex" }, h("ul", { key: 'c3f8689bb257166c50dd678287c8ad4f54eb315a', class: "flex gap-x-2" }, this.parsedLinks.map((link) => (h("eds-link", { label: link.label, "aria-label": link.label, url: link.url, intent: "ghost", size: "large", icon: link.icon, external: link.external, "extra-class": "after:effect-opacity aria-current-page:bg-darker whitespace-nowrap !text-current after:!border-transparent after:opacity-0 hover:after:!border-transparent hover:after:opacity-100" })))))), h("slot", { key: '3f689a811a60052393a795937a908cf7d0604cc6' }), this.menuEnabled && (h("div", { key: '506b953b455b72085d83bdaafc6855992075ddbe', class: "md:hidden flex overflow-hidden px-16" }, h("eds-button", { key: '5b526affd813549a6142efab255d6486a5e2dd66', "aria-label": "Menu", intent: this.headerVariant === 'default' ? 'ghost' : 'ghostInverse', icon: "menu", size: "small", onClick: () => this.handleToggleMenu() })))));
|
|
938
3819
|
}
|
|
939
3820
|
get hostEl() { return getElement(this); }
|
|
940
3821
|
};
|
|
@@ -1016,10 +3897,10 @@ const EdsImg = class {
|
|
|
1016
3897
|
imgOpts['loading'] = 'lazy';
|
|
1017
3898
|
imgOpts['decoding'] = 'async';
|
|
1018
3899
|
}
|
|
1019
|
-
return (h("div", { key: '
|
|
3900
|
+
return (h("div", { key: 'fec0dcf2ec178a953f4ced8a71b037030983670d', class: {
|
|
1020
3901
|
'items-center justify-center': true,
|
|
1021
3902
|
'effect-bg-pattern': this.lazyload && this.showBg
|
|
1022
|
-
} }, h("picture", { key: '
|
|
3903
|
+
} }, h("picture", { key: '0df010a6ed50519be0a2017bf12db7d1ab2fb208' }, this.formats.map((format) => (h("source", { type: format.type, srcSet: format.srcset, media: format.media, sizes: this.sizes }))), h("img", Object.assign({ key: 'ea4275b2cc6be0cce5ab63f97d05454e3c4ee1dc', ref: (el) => (this.img = el), class: {
|
|
1023
3904
|
'effect-opacity object-cover object-center': true,
|
|
1024
3905
|
'opacity-100': this.loaded,
|
|
1025
3906
|
'opacity-0': !this.loaded
|
|
@@ -1078,7 +3959,7 @@ const EdsInput = class {
|
|
|
1078
3959
|
render() {
|
|
1079
3960
|
const withIcon = !!this.icon;
|
|
1080
3961
|
const describedBy = this.hasMessage || this.error ? `${this.name}-error` : '';
|
|
1081
|
-
return (h("div", { key: '
|
|
3962
|
+
return (h("div", { key: '0a6386205f78655569bf93960a4e2664563e4014', class: "relative flex items-center" }, this.type === 'textarea' ? (h("textarea", { id: this.inputId || this.name, name: this.name, placeholder: this.placeholder, value: this.innerVal.toString(), required: this.required, disabled: this.disabled, class: `min-h-80 input input-textarea ${withIcon ? 'input-with-icon' : ''} ${this.error ? 'input-error' : ''} ${this.extraClass}`, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, maxlength: this.maxLength, onInput: this.handleInput, onChange: this.handleInput })) : this.type === 'select' ? (h("select", { id: this.inputId || this.name, name: this.name, required: this.required, disabled: this.disabled, class: `input input-select ${this.error ? 'input-error' : ''} ${this.extraClass}`, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, onInput: this.handleInput, onChange: this.handleInput }, this.options.map((option) => (h("option", { value: option.value, selected: option.value === this.innerVal, key: option.value }, option.label))))) : (h("input", Object.assign({ id: this.inputId || this.name, name: this.name, placeholder: this.placeholder, value: this.innerVal.toString(), required: this.required, disabled: this.disabled, type: this.type, checked: ['radio', 'checkbox'].includes(this.type) ? this.checked : undefined }, (this.type === 'number'
|
|
1082
3963
|
? {
|
|
1083
3964
|
min: this.min,
|
|
1084
3965
|
max: this.max,
|
|
@@ -1089,7 +3970,7 @@ const EdsInput = class {
|
|
|
1089
3970
|
input ${this.type === 'radio' ? 'input-radio' : this.type === 'checkbox' ? 'input-checkbox' : ''}
|
|
1090
3971
|
${withIcon && this.type !== 'radio' && this.type !== 'checkbox' ? 'input-icon pl-36' : ''}
|
|
1091
3972
|
${this.error ? 'input-error' : ''}
|
|
1092
|
-
`, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, maxlength: this.maxLength, onInput: this.handleInput, onChange: this.handleInput }))), this.maxLength && this.type === 'textarea' && (h("span", { key: '
|
|
3973
|
+
`, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, maxlength: this.maxLength, onInput: this.handleInput, onChange: this.handleInput }))), this.maxLength && this.type === 'textarea' && (h("span", { key: 'c78bf1501f682cde9a193ea6726baf2433566516', class: `input-counter f-ui-05 absolute bottom-8 right-8 ${this.maxLengthReached ? 'input-counter-error' : ''}` }, this.maxLength)), this.icon && (h("eds-icon-wrapper", { key: 'c07e7d5d8394292cf365f32838dfd837ccf168d6', class: `absolute top-1/2 left-[4px] -translate-y-1/2 ${this.disabled ? 'text-lightest' : 'text-lightest'}`, icon: this.icon }))));
|
|
1093
3974
|
}
|
|
1094
3975
|
get el() { return getElement(this); }
|
|
1095
3976
|
static get watchers() { return {
|
|
@@ -1200,7 +4081,7 @@ const EdsInputField = class {
|
|
|
1200
4081
|
}
|
|
1201
4082
|
render() {
|
|
1202
4083
|
const inputOpts = Object.assign({ name: this.name, id: this.inputId, placeholder: this.placeholder, disabled: this.disabled, onInput: this.handleNativeInput, onChange: this.handleNativeChange, type: this.type, required: this.required, value: this.value, error: this.error, icon: this.icon, checked: this.checked }, (this.type === 'number' ? { min: this.min, max: this.max, step: this.step } : {}));
|
|
1203
|
-
return (h("div", { key: '
|
|
4084
|
+
return (h("div", { key: 'eaa1d9c1095204c82bd01eab0f19f80eeee64d05' }, this.type === 'checkbox' || this.type === 'radio' ? (this.parsedOptions.length > 0 ? (h("fieldset", { class: "space-y-4 mt-8" }, h("div", { class: "flex justify-between mb-4" }, this.label && (h("eds-input-label", { name: this.inputId || this.name, label: this.label, required: this.required })), this.hint && (h("p", { id: `${this.name}-hint`, class: "f-ui-05 text-lighter mt-8 ml-8" }, this.hint))), this.parsedOptions.map((option) => (h("div", { class: "flex items-center gap-x-4 gap-y-4", key: option.value }, h("eds-input", Object.assign({}, inputOpts, { value: option.value, checked: typeof this.value === 'string' && this.value.split(',').includes(String(option.value)) })), h("label", { htmlFor: this.name, class: `input-label-options ${this.disabled ? 'text-lighter' : ''}` }, option.label)))))) : (h("div", { class: "flex items-center gap-x-8" }, h("eds-input", Object.assign({}, inputOpts, { value: this.value, checked: this.value === 'on' || this.checked })), this.label && (h("eds-input-label", { name: this.inputId || this.name, label: this.label, disabled: this.disabled, required: this.required }))))) : (h("div", null, h("div", { class: "flex justify-between mb-4" }, this.label && (h("eds-input-label", { name: this.inputId || this.name, label: this.label, disabled: this.disabled, required: this.required })), this.hint && (h("p", { id: `${this.name}-hint`, class: "f-ui-05 text-lighter mt-8 ml-8" }, this.hint))), this.type === 'select' ? (h("eds-input-select", Object.assign({}, inputOpts, { options: this.parsedOptions }))) : this.type === 'file' ? (h("input", { type: "file", id: this.inputId || this.name, name: this.name, onChange: this.onChangeNative, disabled: this.disabled, required: this.required })) : this.type === 'search' ? (h("eds-input-search", { name: "search-box" })) : this.type === 'range' ? ((() => {
|
|
1204
4085
|
var _a, _b, _c;
|
|
1205
4086
|
const rangeProps = {
|
|
1206
4087
|
name: inputOpts.name,
|
|
@@ -1213,8 +4094,9 @@ const EdsInputField = class {
|
|
|
1213
4094
|
const opt = this.parsedOptions;
|
|
1214
4095
|
const numberValue = typeof this.value === 'string' ? parseFloat(this.value) : this.value || 0;
|
|
1215
4096
|
return (h("eds-input-range", Object.assign({}, rangeProps, { min: (_a = opt[0]) === null || _a === void 0 ? void 0 : _a.value, max: (_b = opt[1]) === null || _b === void 0 ? void 0 : _b.value, step: (_c = opt[2]) === null || _c === void 0 ? void 0 : _c.value, value: numberValue })));
|
|
1216
|
-
})()) : (h("eds-input", Object.assign({}, inputOpts))))), h("div", { key: '
|
|
4097
|
+
})()) : (h("eds-input", Object.assign({}, inputOpts))))), h("div", { key: '60e6c848d41591b2e9ec8c5cf8dd656ec8562c38', class: "mt-6" }, h("eds-input-footer", { key: 'e9298e01dbab9aa6a98a486286b32024766348d1', id: `${this.name}-footer`, name: this.name, message: this.message, "error-message": this.errorMessage, error: this.error, link: this.link }))));
|
|
1217
4098
|
}
|
|
4099
|
+
static get delegatesFocus() { return true; }
|
|
1218
4100
|
get hostEl() { return getElement(this); }
|
|
1219
4101
|
};
|
|
1220
4102
|
EdsInputField.style = EdsInputFieldStyle0;
|
|
@@ -1232,7 +4114,7 @@ const EdsInputFooter = class {
|
|
|
1232
4114
|
this.link = undefined;
|
|
1233
4115
|
}
|
|
1234
4116
|
render() {
|
|
1235
|
-
return (h("div", { key: '
|
|
4117
|
+
return (h("div", { key: '54571d8f3c08a7a4f12e40728e02a7210ab0d345' }, this.error && this.errorMessage && (h("div", { key: 'db35f0c0dfa931d55d57a9c4ad3fffaeb4cea914', id: `error_${this.name}`, class: "text-error flex items-center" }, h("eds-icon-wrapper", { key: '63e401d86876829d8d2bbab887a66ef0dbd1837f', icon: "warning" }), h("p", { key: '81f8b0819a7cb119353c8ac38ab1df0cafb9d36f', class: "f-ui-04 ml-4 mb-4", innerHTML: this.errorMessage }))), this.message && h("p", { key: 'e5018623e2d8578864dc1f0b06d54e4a60ff9020', id: `desc_${this.name}`, class: "f-ui-05 text-lighter", innerHTML: this.message }), this.link && (h("a", { key: 'e7b6bde26ae02cf07ac8b8e6461282a4ba1355ed', href: this.link.url, class: "f-ui-05 effect-color hover:text-lighter underline underline-offset-4" }, this.link.label))));
|
|
1236
4118
|
}
|
|
1237
4119
|
};
|
|
1238
4120
|
EdsInputFooter.style = EdsInputFooterStyle0;
|
|
@@ -1249,7 +4131,7 @@ const EdsInputLabel = class {
|
|
|
1249
4131
|
this.disabled = false;
|
|
1250
4132
|
}
|
|
1251
4133
|
render() {
|
|
1252
|
-
return (h("label", { key: '
|
|
4134
|
+
return (h("label", { key: '90e0659383fd3be9a166457de5429385fe3bfe02', htmlFor: this.name, class: `input-label ${this.disabled ? 'text-lighter' : ''}` }, this.label, this.required && (h("span", { key: '4d417c45dd636bfd5872d846e5eb89ff3694a4d4' }, h("span", { key: '3924011891ee03e530fe25b269bf4231f3acd9cb', "aria-hidden": "true" }, "*"), h("span", { key: '2f343b6b4ab4cbd538189cfa404210cf676eefe7', class: "sr-only" }, "required")))));
|
|
1253
4135
|
}
|
|
1254
4136
|
};
|
|
1255
4137
|
EdsInputLabel.style = EdsInputLabelStyle0;
|
|
@@ -1296,7 +4178,7 @@ const EdsInputRange = class {
|
|
|
1296
4178
|
return this.inputElement;
|
|
1297
4179
|
}
|
|
1298
4180
|
render() {
|
|
1299
|
-
return (h("div", { key: '
|
|
4181
|
+
return (h("div", { key: '3fa2ef579847e66bcacc35afe202192b78a06975', class: "relative flex flex-col items-start" }, h("input", { key: '669cc03e44dfa1ae8eae758f82f41939de1be625', id: this.inputId || this.name, name: this.name, min: this.min, max: this.max, step: this.step, value: this.sliderVal, required: this.required, disabled: this.disabled, type: "range", class: "w-full py-6 input", tabindex: "0", role: "slider", "aria-describedby": `desc_${this.name}`, "aria-valuemin": this.min, "aria-valuemax": this.max, "aria-valuenow": this.sliderVal, onInput: this.onInput, onChange: this.onChange }), h("p", { key: 'b3865e1bfacb423da277f4b76dfd0f3294f96cc6', id: `desc_${this.name}`, class: "block f-ui-05 mt-4 text-lighter" }, "Current value: ", this.sliderVal)));
|
|
1300
4182
|
}
|
|
1301
4183
|
get el() { return getElement(this); }
|
|
1302
4184
|
static get watchers() { return {
|
|
@@ -1365,7 +4247,7 @@ const EdsInputSearch = class {
|
|
|
1365
4247
|
return this.inputElement;
|
|
1366
4248
|
}
|
|
1367
4249
|
render() {
|
|
1368
|
-
return (h("div", { key: '
|
|
4250
|
+
return (h("div", { key: 'ad7c42baf7c54ede5dca7dd2a6916557f46d33d6', class: "relative flex items-center" }, h("eds-icon-wrapper", { key: '6de80c397bae5e541de1ce3c2937bed860b58363', icon: "search", class: "absolute top-1/2 left-[4px] -translate-y-1/2 text-lightest", "aria-hidden": "true" }), h("input", { key: '9637c5569c97061fde3735ecb58b6a6f81a10e15', id: this.inputId || this.name, name: this.name, placeholder: this.placeholder, value: this.value || '', required: this.required, disabled: this.disabled, type: "search", "aria-label": this.placeholder, class: `input pl-36 ${this.decorate}`,
|
|
1369
4251
|
//onInput={this.onInput}
|
|
1370
4252
|
onChange: this.onChange })));
|
|
1371
4253
|
}
|
|
@@ -1394,12 +4276,12 @@ const EdsInputSelect = class {
|
|
|
1394
4276
|
const selectId = this.inputId || this.name;
|
|
1395
4277
|
const placeholderText = this.placeholder || `Pick from the list`;
|
|
1396
4278
|
const describedBy = this.hasMessage || this.error ? `${this.name}-error` : undefined;
|
|
1397
|
-
return (h("div", { key: '
|
|
4279
|
+
return (h("div", { key: '06be08db809ec9970ca4d7bdbdcdf1c8f2bc8840', class: "relative" }, h("select", { key: 'e4319592e6c2f0c71e0dc75ca2d854506bda70bc', id: selectId, name: this.name, class: {
|
|
1398
4280
|
input: true,
|
|
1399
4281
|
'input-error': this.error,
|
|
1400
4282
|
'px-4': true,
|
|
1401
4283
|
'py-2': true
|
|
1402
|
-
}, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, disabled: this.disabled, required: this.required, onChange: this.handleChange }, h("option", { key: '
|
|
4284
|
+
}, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, disabled: this.disabled, required: this.required, onChange: this.handleChange }, h("option", { key: 'a0ece38948f84a10ea8cd4c0a01b3f8b9730c7ef', value: "", disabled: true, hidden: true }, placeholderText), this.options.map((opt, index) => (h("option", { key: index, value: opt.value, selected: opt.value === this.value }, opt.label)))), h("span", { key: '8ce085e43d0ba6340e52b0666dc0a31abbf1a2f9', class: "bg-dark rounded-xs absolute top-1/2 right-[6px] flex h-28 w-28 -translate-y-1/2 items-center justify-center" }, h("eds-icon-wrapper", { key: '8b91b3fa3a819d04ede5d7816fcb2f04e66fd03b', class: "w-20 h-20", icon: "chevron-right" }))));
|
|
1403
4285
|
}
|
|
1404
4286
|
};
|
|
1405
4287
|
|
|
@@ -1567,20 +4449,42 @@ const EdsLink = class {
|
|
|
1567
4449
|
event.preventDefault();
|
|
1568
4450
|
return;
|
|
1569
4451
|
}
|
|
1570
|
-
sendAnalytics({
|
|
1571
|
-
category: 'ui-component',
|
|
1572
|
-
parentContext: this.parentContext,
|
|
1573
|
-
tag: this.el.tagName.toLowerCase(),
|
|
1574
|
-
name: ((_a = this.label) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || ((_b = this.ariaLabel) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || '',
|
|
1575
|
-
action: 'click'
|
|
1576
|
-
});
|
|
4452
|
+
sendAnalytics({
|
|
4453
|
+
category: 'ui-component',
|
|
4454
|
+
parentContext: this.parentContext,
|
|
4455
|
+
tag: this.el.tagName.toLowerCase(),
|
|
4456
|
+
name: ((_a = this.label) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || ((_b = this.ariaLabel) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || '',
|
|
4457
|
+
action: 'click'
|
|
4458
|
+
});
|
|
4459
|
+
}
|
|
4460
|
+
handleKeyDown(event) {
|
|
4461
|
+
if (this.disabled) {
|
|
4462
|
+
return;
|
|
4463
|
+
}
|
|
4464
|
+
// Handle Enter and Space keys for activation
|
|
4465
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
4466
|
+
event.preventDefault();
|
|
4467
|
+
this.handleClick(event);
|
|
4468
|
+
// For actual navigation, trigger the native link behavior
|
|
4469
|
+
if (this.url && !this.disabled) {
|
|
4470
|
+
if (this.external) {
|
|
4471
|
+
window.open(this.url, '_blank', 'noopener,noreferrer');
|
|
4472
|
+
}
|
|
4473
|
+
else {
|
|
4474
|
+
window.location.href = this.url;
|
|
4475
|
+
}
|
|
4476
|
+
}
|
|
4477
|
+
}
|
|
1577
4478
|
}
|
|
1578
4479
|
getLinkSize() {
|
|
4480
|
+
if (this.intent === 'underline') {
|
|
4481
|
+
return 'underline';
|
|
4482
|
+
}
|
|
1579
4483
|
return this.size;
|
|
1580
4484
|
}
|
|
1581
4485
|
renderLeftIcon() {
|
|
1582
4486
|
if (this.icon && this.iconPos === 'left') {
|
|
1583
|
-
return (h("span", { class:
|
|
4487
|
+
return (h("span", { class: "flex" }, h("eds-icon-wrapper", { "aria-hidden": "true", class: `
|
|
1584
4488
|
flex inline-flex items-center justify-center
|
|
1585
4489
|
${this.size === 'large' ? 'h-24 w-24' : 'h-20 w-20'}
|
|
1586
4490
|
`, icon: this.icon })));
|
|
@@ -1589,7 +4493,7 @@ const EdsLink = class {
|
|
|
1589
4493
|
}
|
|
1590
4494
|
renderRightIcon() {
|
|
1591
4495
|
if (this.icon && this.iconPos === 'right') {
|
|
1592
|
-
return (h("span", { class:
|
|
4496
|
+
return (h("span", { class: "flex" }, h("eds-icon-wrapper", { "aria-hidden": "true", class: `
|
|
1593
4497
|
flex inline-flex items-center justify-center
|
|
1594
4498
|
${this.size === 'large' ? 'h-24 w-24' : 'h-20 w-20'}
|
|
1595
4499
|
`, icon: this.icon })));
|
|
@@ -1597,8 +4501,6 @@ const EdsLink = class {
|
|
|
1597
4501
|
return null;
|
|
1598
4502
|
}
|
|
1599
4503
|
render() {
|
|
1600
|
-
// If the link is disabled, use a <span>; otherwise, use an <a> element.
|
|
1601
|
-
const ComponentType = this.disabled ? 'span' : 'a';
|
|
1602
4504
|
const classes = linkStyles({
|
|
1603
4505
|
intent: this.intent,
|
|
1604
4506
|
size: this.getLinkSize(),
|
|
@@ -1606,12 +4508,12 @@ const EdsLink = class {
|
|
|
1606
4508
|
isActive: this.current,
|
|
1607
4509
|
hasIcon: !!this.icon
|
|
1608
4510
|
});
|
|
1609
|
-
|
|
1610
|
-
const
|
|
4511
|
+
const isInteractive = !this.disabled;
|
|
4512
|
+
const isIconOnly = !this.label || (this.hideLabelOnSmallScreen && this.icon);
|
|
1611
4513
|
const labelClasses = this.hideLabelOnSmallScreen
|
|
1612
4514
|
? 'hidden lg:flex' // Tailwind example: hidden on small screens, visible on larger
|
|
1613
4515
|
: '';
|
|
1614
|
-
return (h(
|
|
4516
|
+
return (h("a", { key: 'bc82c9ea21f98ed71c812c8366ba8368c3ac5bf4', class: `${classes || ''} ${this.extraClass || ''}`, href: isInteractive ? this.url : undefined, target: this.external && isInteractive ? '_blank' : undefined, rel: this.external && isInteractive ? 'noopener noreferrer' : undefined, tabIndex: isInteractive ? 0 : -1, "aria-label": isIconOnly ? this.ariaLabel || 'Link' : undefined, "aria-disabled": this.disabled ? 'true' : undefined, "aria-current": this.current ? 'page' : undefined, role: this.disabled ? 'link' : undefined, download: this.download ? '' : undefined, onClick: (event) => this.handleClick(event), onKeyDown: (event) => this.handleKeyDown(event) }, h("span", { key: 'eed89377d27a476a7d7e70a8c40f3100b8089a0b', class: "z-1 relative inline-flex items-center justify-center" }, this.renderLeftIcon(), this.label && h("span", { key: 'c6d09f0c54e092e53350014d6d89b67c35a8be71', class: labelClasses }, this.label), this.renderRightIcon())));
|
|
1615
4517
|
}
|
|
1616
4518
|
get el() { return getElement(this); }
|
|
1617
4519
|
};
|
|
@@ -1679,29 +4581,273 @@ const EdsLogo = class {
|
|
|
1679
4581
|
}
|
|
1680
4582
|
render() {
|
|
1681
4583
|
const logoContent = this.getLogo();
|
|
1682
|
-
return (h("a", { key: '
|
|
4584
|
+
return (h("a", { key: 'e5c4e4701d698282dc85561c8c434f0790fb2401', href: this.href, onClick: () => this.handleClick(), class: "eds-logo-wrapper", "aria-label": this.label }, h("div", { key: '32cc8649fe67b6c4a874b5c1aaa6d4d793b4c4c7', innerHTML: logoContent })));
|
|
1683
4585
|
}
|
|
1684
4586
|
get el() { return getElement(this); }
|
|
1685
4587
|
};
|
|
1686
4588
|
EdsLogo.style = EdsLogoStyle0;
|
|
1687
4589
|
|
|
1688
|
-
const
|
|
4590
|
+
const edsMatomoNoticeCss = ".fixed{position:fixed}.absolute{position:absolute}.w-full{width:100%}.bottom-0{bottom:0rem}.bottom-4{bottom:0.25rem}.p-4{padding:0.25rem}.p-6{padding:0.375rem}.p-8{padding:0.5rem}.z-10{z-index:10}.z-\\[999999\\]{z-index:999999}.left-0{left:0rem}.left-1\\/2{left:50%}.grow{flex-grow:1}.-translate-x-1\\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.flex{display:flex}.gap-12{gap:0.75rem}.gap-20{gap:1.25rem}.gap-4{gap:0.25rem}@media (min-width: 750px){.md\\:left-1\\/2{left:50%}.md\\:flex{display:flex}.md\\:hidden{display:none}.md\\:-translate-x-1\\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\\:-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}}";
|
|
4591
|
+
const EdsMatomoNoticeStyle0 = edsMatomoNoticeCss;
|
|
4592
|
+
|
|
4593
|
+
const EdsMatomoNotice = class {
|
|
4594
|
+
constructor(hostRef) {
|
|
4595
|
+
registerInstance(this, hostRef);
|
|
4596
|
+
this.consent = createEvent(this, "consent", 7);
|
|
4597
|
+
this.heading = 'Analytics Consent';
|
|
4598
|
+
this.description = "We use anonymous analytics to improve our services. No data is collected unless you give your consent. If you don't wish to send data right now, you can always re-enable analytics later by clicking the Cookies Preference button in the footer. However, by opting in today, you're joining a community that shapes our product's future—all while keeping your data completely anonymous.";
|
|
4599
|
+
this.optOutMessage = "You are already part of our community, and your anonymous data helps shape our product's future! Rest assured, your privacy is fully protected.";
|
|
4600
|
+
this.forceShow = false;
|
|
4601
|
+
this.showNotice = true;
|
|
4602
|
+
}
|
|
4603
|
+
/**
|
|
4604
|
+
* Listens for global custom events to open the matomo-consent.
|
|
4605
|
+
*/
|
|
4606
|
+
toggleCookiesConsent() {
|
|
4607
|
+
this.showNotice = !this.showNotice;
|
|
4608
|
+
}
|
|
4609
|
+
/**
|
|
4610
|
+
* Checks if the consent cookie exists.
|
|
4611
|
+
*/
|
|
4612
|
+
hasCookieConsent() {
|
|
4613
|
+
return !!document.cookie.split('; ').find((row) => row.startsWith('mtm_consent='));
|
|
4614
|
+
}
|
|
4615
|
+
/**
|
|
4616
|
+
* Checks if the user has opted out after has opted in.
|
|
4617
|
+
*/
|
|
4618
|
+
optedOut() {
|
|
4619
|
+
return !!document.cookie.split('; ').find((row) => row.startsWith('mtm_consent_removed'));
|
|
4620
|
+
}
|
|
4621
|
+
/**
|
|
4622
|
+
* Generate a unique storage key based on appId or the app's domain.
|
|
4623
|
+
*/
|
|
4624
|
+
getStorageKey() {
|
|
4625
|
+
return `${window.location.host}-matomo-deferred`;
|
|
4626
|
+
}
|
|
4627
|
+
/**
|
|
4628
|
+
* Check cookies and sessionStorage (unless forceShow is true) to decide if the notice should be shown.
|
|
4629
|
+
*/
|
|
4630
|
+
componentWillLoad() {
|
|
4631
|
+
// If a decision has been made previously (opted in or out), don't show the notice.
|
|
4632
|
+
const consentGiven = localStorage.getItem(`${window.location.host}-matomo-consent-given`);
|
|
4633
|
+
if (consentGiven === 'out' || this.optedOut()) {
|
|
4634
|
+
this.showNotice = false;
|
|
4635
|
+
return;
|
|
4636
|
+
}
|
|
4637
|
+
if (this.forceShow) {
|
|
4638
|
+
// If forceShow is true, always show the notice
|
|
4639
|
+
this.showNotice = true;
|
|
4640
|
+
}
|
|
4641
|
+
else {
|
|
4642
|
+
// If user has already consented, hide the notice
|
|
4643
|
+
// eslint-disable-next-line
|
|
4644
|
+
if (this.hasCookieConsent()) {
|
|
4645
|
+
this.showNotice = false;
|
|
4646
|
+
}
|
|
4647
|
+
else {
|
|
4648
|
+
// Otherwise check if user deferred in this session
|
|
4649
|
+
const sessionDeferred = sessionStorage.getItem(this.getStorageKey());
|
|
4650
|
+
this.showNotice = !sessionDeferred;
|
|
4651
|
+
}
|
|
4652
|
+
}
|
|
4653
|
+
}
|
|
4654
|
+
componentDidLoad() {
|
|
4655
|
+
const btns = this.el.shadowRoot.querySelectorAll('eds-button');
|
|
4656
|
+
btns.forEach((b) => {
|
|
4657
|
+
this.emitContext(b);
|
|
4658
|
+
});
|
|
4659
|
+
}
|
|
4660
|
+
emitContext(linkElement) {
|
|
4661
|
+
const event = new CustomEvent('parentContext', {
|
|
4662
|
+
detail: {
|
|
4663
|
+
componentName: this.el.tagName.toLowerCase(),
|
|
4664
|
+
identifier: null
|
|
4665
|
+
}
|
|
4666
|
+
});
|
|
4667
|
+
linkElement.dispatchEvent(event);
|
|
4668
|
+
}
|
|
4669
|
+
optInAnalytics() {
|
|
4670
|
+
matomoOptIn();
|
|
4671
|
+
localStorage.removeItem(`${window.location.host}-matomo-consent-given`);
|
|
4672
|
+
this.hideNotice();
|
|
4673
|
+
this.consent.emit('in');
|
|
4674
|
+
}
|
|
4675
|
+
optOutAnalytics() {
|
|
4676
|
+
matomoOptOut();
|
|
4677
|
+
this.hideNotice();
|
|
4678
|
+
this.consent.emit('out');
|
|
4679
|
+
}
|
|
4680
|
+
noThanks() {
|
|
4681
|
+
matomoOptOut();
|
|
4682
|
+
localStorage.setItem(`${window.location.host}-matomo-consent-given`, 'out');
|
|
4683
|
+
this.hideNotice();
|
|
4684
|
+
this.consent.emit('out');
|
|
4685
|
+
}
|
|
4686
|
+
/*private deferDecision() {
|
|
4687
|
+
sessionStorage.setItem(this.getStorageKey(), 'true');
|
|
4688
|
+
this.hideNotice();
|
|
4689
|
+
this.consent.emit('defer');
|
|
4690
|
+
}*/
|
|
4691
|
+
keepMeIn() {
|
|
4692
|
+
this.hideNotice();
|
|
4693
|
+
}
|
|
4694
|
+
hideNotice() {
|
|
4695
|
+
this.showNotice = false;
|
|
4696
|
+
}
|
|
4697
|
+
render() {
|
|
4698
|
+
if (!this.showNotice) {
|
|
4699
|
+
return null;
|
|
4700
|
+
}
|
|
4701
|
+
return (h("div", { class: "fixed bottom-0 p-8 z-[999999] grow md:left-1/2 md:-translate-x-1/2 md:-translate-y-1/2 justify-center" }, h("eds-accordion", { title: this.heading, description: this.hasCookieConsent() ? this.optOutMessage : this.description, switchBg: true, expanded: true }, this.hasCookieConsent() ? (h("div", { class: "flex items-center gap-4" }, this.optedOut() ? (h("eds-button", { intent: "primary", label: "Opt me in again", "aria-label": "Opt me in again", onClick: () => this.optInAnalytics() })) : (h("eds-button", { intent: "primary", label: "Keep Me In", "aria-label": "Keep Me In", onClick: () => this.keepMeIn() })), h("eds-button", { intent: "ghostInverse", label: "Opt-out", "aria-label": "Opt-out from analytics", onClick: () => this.optOutAnalytics() }))) : (h("div", { class: "flex items-center gap-4" }, h("eds-button", { intent: "primary", label: "I agree", "aria-label": "Opt-in for analytics", onClick: () => this.optInAnalytics() }), h("eds-button", { intent: "ghost", label: "No, thanks", "aria-label": "Opt-out from analytics", onClick: () => this.noThanks() }))))));
|
|
4702
|
+
}
|
|
4703
|
+
get el() { return getElement(this); }
|
|
4704
|
+
};
|
|
4705
|
+
EdsMatomoNotice.style = EdsMatomoNoticeStyle0;
|
|
4706
|
+
|
|
4707
|
+
const edsNpsCss = ".flex{display:flex}.justify-between{justify-content:space-between}.mt-4{margin-top:0.25rem}.mt-8{margin-top:0.5rem}.ml-4{margin-left:0.25rem}.mr-4{margin-right:0.25rem}.grid{display:grid}.grid-col-span-1{--container-grid-columns:1;grid-column:span 1 / span 1}.grid-cols-11{grid-template-columns:repeat(11, minmax(0, 1fr))}.grid-cols-11[class*=\"grid-line-x\"][class*=\"grid-line-x\"]>*:nth-child(n)::before{border-bottom-width:1px}.grid-cols-11[class*=\"grid-line-xfull\"]>*:nth-child(n)::before{inset-inline-start:calc(var(--inner-gutter) / -2);inset-inline-end:calc(var(--inner-gutter) / -2)}.grid-cols-11[class*=\"grid-line-x\"]>*:nth-child(11n+1)::before{inset-inline-start:0}.grid-cols-11[class*=\"grid-line-x\"]>*:nth-child(11n+11)::before{inset-inline-end:0}.grid-cols-11[class*=\"grid-line-x\"]>*:nth-child(11n+1):nth-last-child(-n+11)::before{border-bottom-width:0}.grid-cols-11[class*=\"grid-line-x\"]>*:nth-child(11n+1):nth-last-child(-n+11)~*::before{border-bottom-width:0}.grid-cols-11[class*=\"grid-line-y\"][class*=\"grid-line-y\"]>*:nth-child(n)::after{border-inline-end-width:1px}.grid-cols-11[class*=\"grid-line-y\"][class*=\"grid-line-y\"]>*:nth-child(11n+11)::after{border-inline-end-width:0}.grid-cols-11[class*=\"grid-line-y\"][class*=\"grid-line-y\"]>*:nth-child(-n+11)::after{top:0}.grid-cols-11[class*=\"grid-line-y\"][class*=\"grid-line-y\"]>*:nth-child(11n+1):nth-last-child(-n+11)::after{bottom:0}.grid-cols-11[class*=\"grid-line-y\"][class*=\"grid-line-y\"]>*:nth-child(11n+1):nth-last-child(-n+11)~li::after{bottom:0}.f-ui-04{font-family:var(--f-ui-04-fontFamily);font-weight:var(--f-ui-04-fontWeight);font-size:var(--f-ui-04-fontSize);line-height:var(--f-ui-04-lineHeight);letter-spacing:var(--f-ui-04-letterSpacing)}.text-light{color:var(--grey-700)}";
|
|
4708
|
+
const EdsNpsStyle0 = edsNpsCss;
|
|
4709
|
+
|
|
4710
|
+
const EdsNps = class {
|
|
4711
|
+
constructor(hostRef) {
|
|
4712
|
+
registerInstance(this, hostRef);
|
|
4713
|
+
this.nps = createEvent(this, "nps", 7);
|
|
4714
|
+
this.min = 0;
|
|
4715
|
+
this.max = 10;
|
|
4716
|
+
this.question = undefined;
|
|
4717
|
+
this.leftLabel = undefined;
|
|
4718
|
+
this.rightLabel = undefined;
|
|
4719
|
+
this.selectedValue = null;
|
|
4720
|
+
}
|
|
4721
|
+
handleClick(value) {
|
|
4722
|
+
this.selectedValue = value;
|
|
4723
|
+
this.nps.emit(value);
|
|
4724
|
+
}
|
|
4725
|
+
handleKeyNav(e) {
|
|
4726
|
+
const radios = Array.from(this.el.shadowRoot.querySelectorAll('eds-button'));
|
|
4727
|
+
const currentIndex = radios.findIndex((r) => r.tabIndex === 0);
|
|
4728
|
+
switch (e.key) {
|
|
4729
|
+
case 'ArrowRight':
|
|
4730
|
+
case 'ArrowLeft': {
|
|
4731
|
+
e.preventDefault();
|
|
4732
|
+
const delta = e.key === 'ArrowRight' ? 1 : -1;
|
|
4733
|
+
const nextIndex = Math.min(this.max, Math.max(0, currentIndex + delta));
|
|
4734
|
+
this.activateRadio(radios, nextIndex);
|
|
4735
|
+
break;
|
|
4736
|
+
}
|
|
4737
|
+
case 'Home': {
|
|
4738
|
+
e.preventDefault();
|
|
4739
|
+
this.activateRadio(radios, 0);
|
|
4740
|
+
break;
|
|
4741
|
+
}
|
|
4742
|
+
case 'End': {
|
|
4743
|
+
e.preventDefault();
|
|
4744
|
+
this.activateRadio(radios, this.max);
|
|
4745
|
+
break;
|
|
4746
|
+
}
|
|
4747
|
+
case 'Enter':
|
|
4748
|
+
case ' ': {
|
|
4749
|
+
e.preventDefault();
|
|
4750
|
+
if (currentIndex >= 0) {
|
|
4751
|
+
this.handleClick(this.min + currentIndex);
|
|
4752
|
+
}
|
|
4753
|
+
break;
|
|
4754
|
+
}
|
|
4755
|
+
case 'Escape': {
|
|
4756
|
+
e.preventDefault();
|
|
4757
|
+
if (currentIndex >= 0) {
|
|
4758
|
+
radios[currentIndex].blur();
|
|
4759
|
+
}
|
|
4760
|
+
break;
|
|
4761
|
+
}
|
|
4762
|
+
default:
|
|
4763
|
+
return;
|
|
4764
|
+
}
|
|
4765
|
+
}
|
|
4766
|
+
activateRadio(radios, index) {
|
|
4767
|
+
const target = radios[index];
|
|
4768
|
+
const value = this.min + index;
|
|
4769
|
+
this.handleClick(value);
|
|
4770
|
+
target.focus();
|
|
4771
|
+
}
|
|
4772
|
+
render() {
|
|
4773
|
+
const count = this.max - this.min + 1;
|
|
4774
|
+
//onst fallback = 0;
|
|
4775
|
+
return (h("div", { key: '3831baab086cbf44a3d1511885f15bbab23c9cd2', class: "eds-nps" }, h("eds-input-label", { key: 'f9bd8a812d1b65a634dfaa7aae704218dc79468c', id: "nps-question", name: "nps-question", label: this.question }), h("div", { key: '398f5225c5b4071c2570a74a9e642f5059bb7813', role: "group", id: "nps-buttons", "aria-labelledby": "nps-question", class: "grid grid-cols-11", onKeyDown: (e) => this.handleKeyNav(e) }, Array.from({ length: count }, (_, i) => {
|
|
4776
|
+
const val = this.min + i;
|
|
4777
|
+
const isSelected = val === this.selectedValue;
|
|
4778
|
+
const tabIndex = isSelected ? 0 : -1;
|
|
4779
|
+
return (h("div", { class: "grid-col-span-1", key: val }, h("eds-button", { tabindex: tabIndex, label: `${val}`, "aria-label": `${val}`, intent: isSelected ? 'primary' : 'ghost', "extra-class": "!block !px-0 w-full", triggerClick: () => this.handleClick(val) })));
|
|
4780
|
+
})), h("div", { key: '0acafaae3f2ce522ffbc245c5733ca509d4bf3c1', class: "flex justify-between mt-8" }, h("span", { key: '001e0be00b07ae2e831ea6af0c577a5eeecb9a56', class: "f-ui-04 text-light ml-4" }, this.leftLabel), h("span", { key: '99a12d89ea577fb2bb9c34241a2b9f0f254c284a', class: "f-ui-04 text-light mr-4" }, this.rightLabel))));
|
|
4781
|
+
}
|
|
4782
|
+
get el() { return getElement(this); }
|
|
4783
|
+
};
|
|
4784
|
+
EdsNps.style = EdsNpsStyle0;
|
|
4785
|
+
|
|
4786
|
+
const edsPaginationCss = "ul,menu{list-style:none;margin:0;padding:0}.f-ui-03{font-family:var(--f-ui-03-fontFamily);font-weight:var(--f-ui-03-fontWeight);font-size:var(--f-ui-03-fontSize);line-height:var(--f-ui-03-lineHeight);letter-spacing:var(--f-ui-03-letterSpacing)}.f-ui-03-light{font-family:var(--f-ui-03-light-fontFamily);font-weight:var(--f-ui-03-light-fontWeight);font-size:var(--f-ui-03-light-fontSize);line-height:var(--f-ui-03-light-lineHeight);letter-spacing:var(--f-ui-03-light-letterSpacing)}.f-ui-02{font-family:var(--f-ui-02-fontFamily);font-weight:var(--f-ui-02-fontWeight);font-size:var(--f-ui-02-fontSize);line-height:var(--f-ui-02-lineHeight);letter-spacing:var(--f-ui-02-letterSpacing)}.f-ui-02-light{font-family:var(--f-ui-02-light-fontFamily);font-weight:var(--f-ui-02-light-fontWeight);font-size:var(--f-ui-02-light-fontSize);line-height:var(--f-ui-02-light-lineHeight);letter-spacing:var(--f-ui-02-light-letterSpacing)}.text-light{color:var(--grey-700)}.text-lightest{color:var(--grey-500)}.mb-28{margin-bottom:1.75rem}.w-full{width:100%}.w-20{width:1.25rem}.h-20{height:1.25rem}.h-28{height:1.75rem}.h-32{height:2rem}.h-36{height:2.25rem}.text-center{text-align:center}.flex{display:flex}.inline-flex{display:inline-flex}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-x-8{-moz-column-gap:0.5rem;column-gap:0.5rem}.mr-auto{margin-right:auto}.ml-auto{margin-left:auto}.\\!p-8{padding:0.5rem !important}.ml-4{margin-left:0.25rem}.mr-4{margin-right:0.25rem}.hidden{display:none}.gap-1{gap:0.0625rem}.py-4{padding-top:0.25rem;padding-bottom:0.25rem}.transition-colors{transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}@media (min-width: 900px){.lg\\:\\!pr-12{padding-right:0.75rem !important}.lg\\:flex{display:flex}}";
|
|
1689
4787
|
const EdsPaginationStyle0 = edsPaginationCss;
|
|
1690
4788
|
|
|
1691
4789
|
const EdsPagination = class {
|
|
1692
4790
|
constructor(hostRef) {
|
|
1693
4791
|
registerInstance(this, hostRef);
|
|
4792
|
+
/**
|
|
4793
|
+
* Handles keyboard navigation within the pagination
|
|
4794
|
+
*/
|
|
4795
|
+
this.handleKeyDown = (e) => {
|
|
4796
|
+
if (this.mode !== 'default' || !this.useButtons) {
|
|
4797
|
+
return;
|
|
4798
|
+
}
|
|
4799
|
+
const navigableItems = this.getNavigableItems();
|
|
4800
|
+
if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
|
|
4801
|
+
e.preventDefault();
|
|
4802
|
+
const increment = e.key === 'ArrowRight' ? 1 : -1;
|
|
4803
|
+
let currentIndex = this.focusedIndex;
|
|
4804
|
+
// If no item is focused, start from current page or first item
|
|
4805
|
+
if (currentIndex === -1) {
|
|
4806
|
+
const currentPageIndex = navigableItems.findIndex((item) => item.type === 'page' && item.page === this.currentPage);
|
|
4807
|
+
currentIndex = currentPageIndex !== -1 ? currentPageIndex : 0;
|
|
4808
|
+
}
|
|
4809
|
+
let newIndex = currentIndex + increment;
|
|
4810
|
+
// Wrap around navigation
|
|
4811
|
+
if (newIndex >= navigableItems.length) {
|
|
4812
|
+
newIndex = 0;
|
|
4813
|
+
}
|
|
4814
|
+
else if (newIndex < 0) {
|
|
4815
|
+
newIndex = navigableItems.length - 1;
|
|
4816
|
+
}
|
|
4817
|
+
this.focusedIndex = newIndex;
|
|
4818
|
+
this.focusPaginationItem(newIndex);
|
|
4819
|
+
}
|
|
4820
|
+
else if (e.key === 'Home') {
|
|
4821
|
+
e.preventDefault();
|
|
4822
|
+
this.focusedIndex = 0;
|
|
4823
|
+
this.focusPaginationItem(0);
|
|
4824
|
+
}
|
|
4825
|
+
else if (e.key === 'End') {
|
|
4826
|
+
e.preventDefault();
|
|
4827
|
+
const lastIndex = navigableItems.length - 1;
|
|
4828
|
+
this.focusedIndex = lastIndex;
|
|
4829
|
+
this.focusPaginationItem(lastIndex);
|
|
4830
|
+
}
|
|
4831
|
+
};
|
|
4832
|
+
/**
|
|
4833
|
+
* Handles focus events for pagination items
|
|
4834
|
+
*/
|
|
4835
|
+
this.handleItemFocus = (index) => {
|
|
4836
|
+
this.focusedIndex = index;
|
|
4837
|
+
};
|
|
1694
4838
|
this.currentPage = undefined;
|
|
1695
4839
|
this.lastPage = undefined;
|
|
1696
4840
|
this.perPage = 10;
|
|
1697
4841
|
this.total = 0;
|
|
1698
4842
|
this.url = '';
|
|
1699
4843
|
this.mode = 'default';
|
|
4844
|
+
this.useButtons = true;
|
|
1700
4845
|
this.prevLabel = 'Prev';
|
|
1701
4846
|
this.nextLabel = 'Next';
|
|
1702
4847
|
this.prevUrl = '';
|
|
1703
4848
|
this.nextUrl = '';
|
|
1704
4849
|
this.links = [];
|
|
4850
|
+
this.focusedIndex = -1;
|
|
1705
4851
|
}
|
|
1706
4852
|
/** Lifecycle hook to generate pagination links on component load */
|
|
1707
4853
|
componentWillLoad() {
|
|
@@ -1710,24 +4856,17 @@ const EdsPagination = class {
|
|
|
1710
4856
|
}
|
|
1711
4857
|
}
|
|
1712
4858
|
componentDidLoad() {
|
|
1713
|
-
//
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
this.emitContext(links[0]);
|
|
1721
|
-
|
|
1722
|
-
// Emit context for the last link, if it's different from the first
|
|
1723
|
-
if (links.length > 1) {
|
|
1724
|
-
this.emitContext(links[links.length - 1]);
|
|
1725
|
-
}
|
|
1726
|
-
}*/
|
|
4859
|
+
// Only emit context for links, not buttons
|
|
4860
|
+
if (!this.useButtons) {
|
|
4861
|
+
const links = this.hostEl.shadowRoot.querySelectorAll('eds-link');
|
|
4862
|
+
links.forEach((lnk) => {
|
|
4863
|
+
this.emitContext(lnk);
|
|
4864
|
+
});
|
|
4865
|
+
}
|
|
1727
4866
|
}
|
|
1728
4867
|
/**
|
|
1729
4868
|
* Emits a custom event called `parentContext` for a given link element.
|
|
1730
|
-
* This event provides context information about the
|
|
4869
|
+
* This event provides context information about the pagination component.
|
|
1731
4870
|
*
|
|
1732
4871
|
* @param linkElement - The link element to which the event will be dispatched.
|
|
1733
4872
|
*/
|
|
@@ -1745,6 +4884,34 @@ const EdsPagination = class {
|
|
|
1745
4884
|
this.generateLinks();
|
|
1746
4885
|
}
|
|
1747
4886
|
}
|
|
4887
|
+
/**
|
|
4888
|
+
* Gets all navigable pagination items for keyboard navigation
|
|
4889
|
+
*/
|
|
4890
|
+
getNavigableItems() {
|
|
4891
|
+
const items = [];
|
|
4892
|
+
// Previous button
|
|
4893
|
+
items.push({ type: 'prev', disabled: this.isFirstPage() });
|
|
4894
|
+
// Page numbers
|
|
4895
|
+
this.links.forEach((link) => {
|
|
4896
|
+
if (typeof link === 'object') {
|
|
4897
|
+
items.push({ type: 'page', page: parseInt(link.label), disabled: false });
|
|
4898
|
+
}
|
|
4899
|
+
});
|
|
4900
|
+
// Next button
|
|
4901
|
+
items.push({ type: 'next', disabled: this.isLastPage() });
|
|
4902
|
+
return items.filter((item) => !item.disabled);
|
|
4903
|
+
}
|
|
4904
|
+
/**
|
|
4905
|
+
* Focuses a specific pagination item by index
|
|
4906
|
+
*/
|
|
4907
|
+
focusPaginationItem(index) {
|
|
4908
|
+
var _a;
|
|
4909
|
+
const buttons = (_a = this.hostEl.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.pagination-button');
|
|
4910
|
+
const targetButton = buttons === null || buttons === void 0 ? void 0 : buttons[index];
|
|
4911
|
+
if (targetButton) {
|
|
4912
|
+
targetButton.focus();
|
|
4913
|
+
}
|
|
4914
|
+
}
|
|
1748
4915
|
/**
|
|
1749
4916
|
* Checks if the current page is the first page
|
|
1750
4917
|
* @returns {boolean} - true if current page is the first page
|
|
@@ -1767,7 +4934,7 @@ const EdsPagination = class {
|
|
|
1767
4934
|
generateLink(page) {
|
|
1768
4935
|
const urlHasQuery = this.url.includes('?');
|
|
1769
4936
|
return {
|
|
1770
|
-
ariaLabel: `
|
|
4937
|
+
ariaLabel: `Go to page ${page}`,
|
|
1771
4938
|
url: `${this.url}${urlHasQuery ? '&' : '?'}page=${page}`,
|
|
1772
4939
|
label: page.toString(),
|
|
1773
4940
|
current: this.currentPage === page,
|
|
@@ -1787,7 +4954,6 @@ const EdsPagination = class {
|
|
|
1787
4954
|
* Creates a pagination range based on delta, current, and total pages
|
|
1788
4955
|
* @param {number} current - Current page number
|
|
1789
4956
|
* @param {number} total - Total number of pages
|
|
1790
|
-
* @param {number} delta - Range of pages to display around the current page
|
|
1791
4957
|
* @returns {(number | string)[]} - Range of page numbers or ellipses
|
|
1792
4958
|
*/
|
|
1793
4959
|
getPaginationGenerator(current, total) {
|
|
@@ -1802,7 +4968,7 @@ const EdsPagination = class {
|
|
|
1802
4968
|
else {
|
|
1803
4969
|
// Always show the first page
|
|
1804
4970
|
range.push(1);
|
|
1805
|
-
// Add ellipsis if there
|
|
4971
|
+
// Add ellipsis if there's a gap between the first page and the current range start
|
|
1806
4972
|
if (current - delta > 2) {
|
|
1807
4973
|
range.push('...');
|
|
1808
4974
|
}
|
|
@@ -1810,7 +4976,7 @@ const EdsPagination = class {
|
|
|
1810
4976
|
for (let i = Math.max(2, current - delta); i <= Math.min(total - 1, current + delta); i++) {
|
|
1811
4977
|
range.push(i);
|
|
1812
4978
|
}
|
|
1813
|
-
// Add ellipsis if there
|
|
4979
|
+
// Add ellipsis if there's a gap between the current range end and the last page
|
|
1814
4980
|
if (current + delta < total - 1) {
|
|
1815
4981
|
range.push('...');
|
|
1816
4982
|
}
|
|
@@ -1825,9 +4991,11 @@ const EdsPagination = class {
|
|
|
1825
4991
|
*/
|
|
1826
4992
|
pageResults() {
|
|
1827
4993
|
if (this.total > 0) {
|
|
4994
|
+
const start = this.perPage * ((this.currentPage || 1) - 1) + 1;
|
|
4995
|
+
const end = Math.min(this.perPage * (this.currentPage || 1), this.total);
|
|
1828
4996
|
return this.total > this.perPage
|
|
1829
|
-
?
|
|
1830
|
-
:
|
|
4997
|
+
? `Showing ${start} to ${end} of ${this.total} results`
|
|
4998
|
+
: `Showing ${this.total} result${this.total !== 1 ? 's' : ''}`;
|
|
1831
4999
|
}
|
|
1832
5000
|
return '';
|
|
1833
5001
|
}
|
|
@@ -1840,11 +5008,13 @@ const EdsPagination = class {
|
|
|
1840
5008
|
if (this.mode === 'navigator') {
|
|
1841
5009
|
return; // No page clicking logic for navigator mode
|
|
1842
5010
|
}
|
|
1843
|
-
|
|
5011
|
+
if (this.useButtons) {
|
|
5012
|
+
event.preventDefault(); // Prevent default for buttons
|
|
5013
|
+
}
|
|
1844
5014
|
if (newPage !== this.currentPage) {
|
|
1845
5015
|
this.links = this.links.map((link) => typeof link === 'object' ? Object.assign(Object.assign({}, link), { current: parseInt(link.label) === newPage }) : link);
|
|
1846
5016
|
const pageChangeEvent = new CustomEvent('page', {
|
|
1847
|
-
detail: newPage,
|
|
5017
|
+
detail: { value: newPage },
|
|
1848
5018
|
bubbles: true,
|
|
1849
5019
|
composed: true
|
|
1850
5020
|
});
|
|
@@ -1853,38 +5023,25 @@ const EdsPagination = class {
|
|
|
1853
5023
|
}
|
|
1854
5024
|
}
|
|
1855
5025
|
render() {
|
|
1856
|
-
|
|
1857
|
-
|
|
5026
|
+
const navigableIndex = -1; // Track index for keyboard navigation
|
|
5027
|
+
return (h("div", { key: '9379c40daaca176e67fb59918f1ca387cb4759b9' }, this.total > 0 && this.mode === 'default' && (h("p", { key: 'd09f7f6b7de136987d5b52564bc60afb3775299a', class: "f-ui-03 text-light mb-28 w-full text-center", "aria-live": "polite", id: "pagination-info" }, h("span", { key: '4af8f097a79c8fb0495838f06424f43e5e5dcddc', class: "text-light sr-only" }, "Results:"), this.pageResults())), this.mode === 'navigator' || (this.lastPage && this.lastPage > 1) ? (h("nav", { "aria-label": "Pagination Navigation", "aria-describedby": this.mode === 'default' ? 'pagination-info' : undefined, onKeyDown: this.handleKeyDown }, h("ul", { class: "flex items-center justify-center gap-x-8", role: "list" }, h("li", { class: "mr-auto" }, this.useButtons ? (h("div", { class: "pagination-button-wrapper", onFocus: () => this.handleItemFocus(navigableIndex) }, h("eds-button", { label: this.prevLabel, disabled: this.mode === 'navigator' ? !this.prevUrl : this.isFirstPage(), "aria-label": "Go to previous page", icon: "chevron-left", "icon-pos": "left", size: "small", "icon-small": "true", intent: "ghost", "extra-class": "!p-8 lg:!pr-12 pagination-button", onClick: (event) => {
|
|
5028
|
+
if (this.mode === 'default' && !this.isFirstPage()) {
|
|
5029
|
+
this.handlePageClick(event, (this.currentPage || 1) - 1);
|
|
5030
|
+
}
|
|
5031
|
+
} }))) : (h("eds-link", { label: this.prevLabel, url: this.mode === 'navigator'
|
|
5032
|
+
? this.prevUrl || '#'
|
|
1858
5033
|
: this.isFirstPage()
|
|
1859
5034
|
? '#'
|
|
1860
|
-
: this.generateLink(this.currentPage - 1).url, disabled: this.mode === 'navigator'
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
if (this.isFirstPage()) {
|
|
1865
|
-
event.preventDefault(); // Prevent click if disabled
|
|
1866
|
-
}
|
|
1867
|
-
else {
|
|
1868
|
-
this.handlePageClick(event, (this.currentPage || 1) - 1);
|
|
1869
|
-
}
|
|
5035
|
+
: this.generateLink(this.currentPage - 1).url, disabled: this.mode === 'navigator' ? !this.prevUrl : this.isFirstPage(), "aria-label": "Go to previous page", icon: "chevron-left", "icon-pos": "left", size: "small", "icon-small": "true", intent: "strong", "hide-label-on-small-screen": true, class: "!p-8 lg:!pr-12" }))), this.mode === 'default' &&
|
|
5036
|
+
this.links.map((link, index) => (h("li", { key: index, class: "f-ui-02 flex h-36 items-center justify-center" }, typeof link === 'string' ? (h("span", { class: "flex items-center justify-center", "aria-hidden": "true" }, link)) : this.useButtons ? (h("div", { class: "pagination-button-wrapper", onFocus: () => this.handleItemFocus(navigableIndex) }, h("eds-button", { label: link.label, "aria-label": link.current ? `Current page, page ${link.label}` : `Go to page ${link.label}`, "aria-current": link.current ? 'page' : undefined, size: "small", "extra-class": "!p-8 pagination-button", intent: link.current ? 'secondary' : 'ghost', onClick: (event) => this.handlePageClick(event, parseInt(link.label)) }))) : (h("eds-link", { url: link.url, "aria-label": link.ariaLabel, label: link.label, current: link.current, "aria-current": link.current ? 'page' : undefined, size: "small", class: "!p-8", intent: link.current ? 'secondary' : 'ghost', onClick: (event) => this.handlePageClick(event, parseInt(link.label)) }))))), h("li", { class: "ml-auto" }, this.useButtons ? (h("div", { class: "pagination-button-wrapper", onFocus: () => this.handleItemFocus(navigableIndex) }, h("eds-button", { label: this.nextLabel, disabled: this.mode === 'navigator' ? !this.nextUrl : this.isLastPage(), "aria-label": "Go to next page", size: "small", "icon-small": "true", icon: "chevron-right", intent: "ghost", "extra-class": "!p-8 lg:!pl-12 pagination-button", onClick: (event) => {
|
|
5037
|
+
if (this.mode === 'default' && !this.isLastPage()) {
|
|
5038
|
+
this.handlePageClick(event, (this.currentPage || 1) + 1);
|
|
1870
5039
|
}
|
|
1871
|
-
} })), this.mode === '
|
|
1872
|
-
|
|
1873
|
-
? this.nextUrl || '#' // Use nextUrl if provided, otherwise disable with '#'
|
|
5040
|
+
} }))) : (h("eds-link", { label: this.nextLabel, url: this.mode === 'navigator'
|
|
5041
|
+
? this.nextUrl || '#'
|
|
1874
5042
|
: this.isLastPage()
|
|
1875
5043
|
? '#'
|
|
1876
|
-
: this.generateLink(this.currentPage + 1).url, disabled: this.mode === 'navigator'
|
|
1877
|
-
? !this.nextUrl // Disable if nextUrl is not provided
|
|
1878
|
-
: this.isLastPage(), "aria-label": "Next page", size: "small", "icon-small": "true", icon: "chevron-right", intent: "strong", "hide-label-on-small-screen": true, class: "!p-8 lg:!pl-12 flex items-center gap-1 py-4 transition-colors", onClick: (event) => {
|
|
1879
|
-
if (this.mode === 'default') {
|
|
1880
|
-
if (this.isLastPage()) {
|
|
1881
|
-
event.preventDefault(); // Prevent click if disabled
|
|
1882
|
-
}
|
|
1883
|
-
else {
|
|
1884
|
-
this.handlePageClick(event, (this.currentPage || 1) + 1);
|
|
1885
|
-
}
|
|
1886
|
-
}
|
|
1887
|
-
} }))))) : null));
|
|
5044
|
+
: this.generateLink(this.currentPage + 1).url, disabled: this.mode === 'navigator' ? !this.nextUrl : this.isLastPage(), "aria-label": "Go to next page", size: "small", "icon-small": "true", icon: "chevron-right", intent: "strong", "hide-label-on-small-screen": true, class: "!p-8 lg:!pl-12 flex items-center gap-1 py-4 transition-colors" })))))) : null));
|
|
1888
5045
|
}
|
|
1889
5046
|
get hostEl() { return getElement(this); }
|
|
1890
5047
|
static get watchers() { return {
|
|
@@ -1901,6 +5058,7 @@ const EdsRating = class {
|
|
|
1901
5058
|
constructor(hostRef) {
|
|
1902
5059
|
registerInstance(this, hostRef);
|
|
1903
5060
|
this.rating = createEvent(this, "rating", 7);
|
|
5061
|
+
this.buttonRefs = [];
|
|
1904
5062
|
this.ratingType = 'star';
|
|
1905
5063
|
this.ratingCount = 5;
|
|
1906
5064
|
this.selectedRating = 0;
|
|
@@ -1934,16 +5092,37 @@ const EdsRating = class {
|
|
|
1934
5092
|
* Handles the click event on a star.
|
|
1935
5093
|
* @param rating - The selected rating value.
|
|
1936
5094
|
*/
|
|
1937
|
-
|
|
5095
|
+
onSelect(rating) {
|
|
1938
5096
|
this.selectedRating = rating;
|
|
1939
5097
|
this.rating.emit(rating);
|
|
5098
|
+
setTimeout(() => {
|
|
5099
|
+
const btn = this.buttonRefs[rating - 1];
|
|
5100
|
+
btn === null || btn === void 0 ? void 0 : btn.focus();
|
|
5101
|
+
}, 0);
|
|
5102
|
+
}
|
|
5103
|
+
handleKeyNav(e) {
|
|
5104
|
+
const { key } = e;
|
|
5105
|
+
if (!['ArrowRight', 'ArrowLeft', 'ArrowDown', 'ArrowUp'].includes(key)) {
|
|
5106
|
+
return;
|
|
5107
|
+
}
|
|
5108
|
+
e.preventDefault();
|
|
5109
|
+
const increment = key === 'ArrowRight' || key === 'ArrowDown' ? 1 : -1;
|
|
5110
|
+
let next = (this.selectedRating || 1) + increment;
|
|
5111
|
+
if (next > this.ratingCount) {
|
|
5112
|
+
next = 1;
|
|
5113
|
+
}
|
|
5114
|
+
if (next < 1) {
|
|
5115
|
+
next = this.ratingCount;
|
|
5116
|
+
}
|
|
5117
|
+
this.onSelect(next);
|
|
1940
5118
|
}
|
|
1941
5119
|
render() {
|
|
1942
|
-
return (h("div", { key: '
|
|
5120
|
+
return (h("div", { key: 'a7fc18897f2901f60432432899da18861e76edf6', id: "rating-buttons", role: "group", "aria-labelledby": "rating", class: "stars flex space-x-1 my-8", onKeyDown: (e) => this.handleKeyNav(e) }, Array.from({ length: this.ratingCount }, (_, index) => {
|
|
1943
5121
|
const starRating = index + 1;
|
|
1944
5122
|
const isSelected = starRating <= this.selectedRating;
|
|
1945
5123
|
// Use the mapping text if available; otherwise, fall back to a generic label.
|
|
1946
|
-
|
|
5124
|
+
const checked = this.selectedRating === starRating;
|
|
5125
|
+
return (h("eds-button", { ref: (el) => (this.buttonRefs[index] = el), icon: this.ratingType, "aria-label": `${starRating} ${this.ratingType}${starRating > 1 ? 's' : ''}`, onClick: () => this.onSelect(starRating), tabIndex: checked || (this.selectedRating === 0 && index === 0) ? 0 : -1, intent: isSelected ? 'primary' : 'ghost', size: "large", "extra-class": "p-2" // Optional padding or styling for the star button
|
|
1947
5126
|
}));
|
|
1948
5127
|
})));
|
|
1949
5128
|
}
|
|
@@ -1951,40 +5130,60 @@ const EdsRating = class {
|
|
|
1951
5130
|
};
|
|
1952
5131
|
EdsRating.style = EdsRatingStyle0;
|
|
1953
5132
|
|
|
1954
|
-
const edsStepsCss = ".steps{position:sticky;margin-left:16px;margin-bottom:12px;border-left:1px solid var(--soft-color, #ddd);padding-left:23px;counter-reset:step}.steps h3{counter-increment:step;font-size:var(--f-heading-05-fontSize);font-weight:var(--f-heading-05-fontWeight);line-height:var(--f-heading-05-lineHeight);position:relative}.steps h3::before{content:counter(step);position:absolute;left:-40px;top
|
|
5133
|
+
const edsStepsCss = ".steps{position:sticky;margin-left:16px;margin-bottom:12px;border-left:1px solid var(--soft-color, #ddd);padding-left:23px;counter-reset:step}.steps h3{counter-increment:step;font-size:var(--f-heading-05-fontSize);font-weight:var(--f-heading-05-fontWeight);line-height:var(--f-heading-05-lineHeight);position:relative}.steps h3::before{content:counter(step);position:absolute;left:-40px;top:-2px;display:flex;align-items:center;justify-content:center;width:32px;height:32px;font-size:1rem;border:1px solid #ccc;background:var(--grey-900);color:#fff;border-radius:50%}.steps h4,.steps h5{counter-increment:step;font-size:var(--f-heading-06-fontSize);font-weight:var(--f-heading-06-fontWeight);line-height:var(--f-heading-06-lineHeight);position:relative}.steps h4::before,.steps h5::before{content:counter(step);position:absolute;left:-40px;top:-2px;display:flex;align-items:center;justify-content:center;width:30px;height:30px;font-size:0.875rem;border:1px solid #ccc;background:#333;color:#fff;border-radius:50%}.steps blockquote{margin-top:16px;margin-bottom:16px;font-style:italic;color:#aaa;padding-left:6px}.f-body-02{font-family:var(--f-body-02-fontFamily);font-weight:var(--f-body-02-fontWeight);font-size:var(--f-body-02-fontSize);line-height:var(--f-body-02-lineHeight);letter-spacing:var(--f-body-02-letterSpacing)}.text-light{color:var(--grey-700)}.text-lighter{color:var(--grey-600)}.my-16{margin-top:1rem;margin-bottom:1rem}.mt-16{margin-top:1rem}.mb-28{margin-bottom:1.75rem}.ml-8{margin-left:0.5rem}.gap-y-16{row-gap:1rem}.gap-x-16{-moz-column-gap:1rem;column-gap:1rem}.flex{display:flex}.grid{display:grid}.hidden{display:none}.block{display:block}.cursor-pointer{cursor:pointer}";
|
|
1955
5134
|
const EdsStepsStyle0 = edsStepsCss;
|
|
1956
5135
|
|
|
1957
5136
|
const EdsSteps = class {
|
|
1958
5137
|
constructor(hostRef) {
|
|
1959
5138
|
registerInstance(this, hostRef);
|
|
1960
5139
|
this.step = createEvent(this, "step", 7);
|
|
5140
|
+
this.finished = createEvent(this, "finished", 7);
|
|
5141
|
+
this.next = createEvent(this, "next", 7);
|
|
5142
|
+
this.back = createEvent(this, "back", 7);
|
|
1961
5143
|
this.handleNext = () => {
|
|
1962
|
-
|
|
1963
|
-
if (this.activeStep
|
|
1964
|
-
this.
|
|
5144
|
+
const lastIndex = this.parsedSteps.length - 1;
|
|
5145
|
+
if (this.activeStep >= lastIndex) {
|
|
5146
|
+
this.finished.emit();
|
|
5147
|
+
return;
|
|
5148
|
+
}
|
|
5149
|
+
const target = this.activeStep + 1;
|
|
5150
|
+
this.next.emit(target);
|
|
5151
|
+
if (this.isNextDisabledFor(this.activeStep)) {
|
|
5152
|
+
return;
|
|
5153
|
+
} // block advance only if current is disabled
|
|
5154
|
+
this.activeStep = target;
|
|
5155
|
+
this.step.emit(this.activeStep);
|
|
5156
|
+
// 2) if using the boolean form, clear it when moving away from a step
|
|
5157
|
+
if (!Array.isArray(this.disableNext)) {
|
|
5158
|
+
this.disableNext = false;
|
|
1965
5159
|
}
|
|
1966
5160
|
};
|
|
1967
5161
|
this.handleBack = () => {
|
|
1968
5162
|
if (this.activeStep > 0) {
|
|
1969
|
-
|
|
5163
|
+
const target = this.activeStep - 1;
|
|
5164
|
+
this.back.emit(target);
|
|
5165
|
+
this.activeStep = target;
|
|
1970
5166
|
this.step.emit(this.activeStep);
|
|
5167
|
+
// also clear boolean form on back
|
|
5168
|
+
if (!Array.isArray(this.disableNext)) {
|
|
5169
|
+
this.disableNext = false;
|
|
5170
|
+
}
|
|
1971
5171
|
}
|
|
1972
5172
|
};
|
|
1973
5173
|
this.steps = [];
|
|
1974
5174
|
this.type = 'static';
|
|
5175
|
+
this.nextLabel = 'Next';
|
|
5176
|
+
this.backLabel = 'Back';
|
|
5177
|
+
this.finishLabel = 'Finish';
|
|
5178
|
+
this.disableNext = false;
|
|
5179
|
+
this.headingLevel = 'h4';
|
|
1975
5180
|
this.activeStep = 0;
|
|
1976
5181
|
}
|
|
1977
|
-
/**
|
|
1978
|
-
* Lifecycle method that runs when the component has fully loaded.
|
|
1979
|
-
* It emits a custom event for each `eds-button` element contained within the breadcrumb.
|
|
1980
|
-
*/
|
|
1981
5182
|
componentDidLoad() {
|
|
1982
5183
|
var _a;
|
|
1983
5184
|
if (this.type === 'linear') {
|
|
1984
5185
|
const btns = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('eds-button');
|
|
1985
|
-
btns === null || btns === void 0 ? void 0 : btns.forEach((btn) =>
|
|
1986
|
-
this.emitContext(btn);
|
|
1987
|
-
});
|
|
5186
|
+
btns === null || btns === void 0 ? void 0 : btns.forEach((btn) => this.emitContext(btn));
|
|
1988
5187
|
}
|
|
1989
5188
|
}
|
|
1990
5189
|
activeStepChanged(newValue) {
|
|
@@ -1992,19 +5191,10 @@ const EdsSteps = class {
|
|
|
1992
5191
|
var _a;
|
|
1993
5192
|
const activeStepContainer = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.step')[newValue];
|
|
1994
5193
|
if (activeStepContainer) {
|
|
1995
|
-
|
|
1996
|
-
btns.forEach((btn) => {
|
|
1997
|
-
this.emitContext(btn);
|
|
1998
|
-
});
|
|
5194
|
+
activeStepContainer.querySelectorAll('eds-button').forEach((btn) => this.emitContext(btn));
|
|
1999
5195
|
}
|
|
2000
5196
|
}, 50);
|
|
2001
5197
|
}
|
|
2002
|
-
/**
|
|
2003
|
-
* Emits a custom event called `parentContext` for a given link element.
|
|
2004
|
-
* This event provides context information about the breadcrumb component.
|
|
2005
|
-
*
|
|
2006
|
-
* @param linkElement - The link element to which the event will be dispatched.
|
|
2007
|
-
*/
|
|
2008
5198
|
emitContext(linkElement) {
|
|
2009
5199
|
const event = new CustomEvent('parentContext', {
|
|
2010
5200
|
detail: {
|
|
@@ -2014,26 +5204,29 @@ const EdsSteps = class {
|
|
|
2014
5204
|
});
|
|
2015
5205
|
linkElement.dispatchEvent(event);
|
|
2016
5206
|
}
|
|
2017
|
-
handleStepClick(index) {
|
|
2018
|
-
this.step.emit(index);
|
|
2019
|
-
// In linear mode, update the active step on header click.
|
|
2020
|
-
if (this.type === 'linear') {
|
|
2021
|
-
this.activeStep = index;
|
|
2022
|
-
}
|
|
2023
|
-
}
|
|
2024
|
-
/**
|
|
2025
|
-
* Parse the JSON string into an array of steps.
|
|
2026
|
-
*/
|
|
2027
5207
|
get parsedSteps() {
|
|
2028
5208
|
return parseData(this.steps);
|
|
2029
5209
|
}
|
|
5210
|
+
isNextDisabledFor(index) {
|
|
5211
|
+
return Array.isArray(this.disableNext)
|
|
5212
|
+
? !!this.disableNext[index] // per-step
|
|
5213
|
+
: index === this.activeStep && !!this.disableNext; // only active step
|
|
5214
|
+
}
|
|
5215
|
+
/** Render the semantic heading element */
|
|
5216
|
+
renderHeading(title) {
|
|
5217
|
+
const Tag = this.headingLevel;
|
|
5218
|
+
return h(Tag, null, title);
|
|
5219
|
+
}
|
|
2030
5220
|
render() {
|
|
2031
5221
|
const steps = this.parsedSteps;
|
|
2032
5222
|
if (this.type === 'linear') {
|
|
2033
|
-
return (h("div",
|
|
5223
|
+
return (h("div", { class: "steps" }, steps.map((step, index) => {
|
|
5224
|
+
const isLast = index === steps.length - 1;
|
|
5225
|
+
return (h("div", { class: "step mb-28", key: index }, this.renderHeading(step.title), this.activeStep === index && (h("div", { class: "content grid gap-y-16" }, h("slot", { name: `step-${index}` }, h("div", { class: isLast ? 'f-body-02 text-lighter' : 'f-body-02 text-lighter', innerHTML: step.content })), h("div", { class: "flex items-center mt-16" }, h("eds-button", { label: this.backLabel, intent: "ghost", icon: "chevron-left", iconPos: "left", iconSmall: true, onClick: this.handleBack, disabled: index === 0, class: index === 0 ? 'hidden' : 'block', size: "small" }), h("eds-button", { label: isLast ? this.finishLabel : this.nextLabel, intent: "primary", icon: "chevron-right", iconSmall: true, onClick: this.handleNext, disabled: this.isNextDisabledFor(index), size: "small", class: "ml-8" })), h("slot", { name: `actions-${index}` })))));
|
|
5226
|
+
})));
|
|
2034
5227
|
}
|
|
2035
|
-
// Static
|
|
2036
|
-
return (h("div", { class: "steps" }, steps.map((step, index) => (h("div", { class: "step mb-28", key: index },
|
|
5228
|
+
// Static: no navigation buttons
|
|
5229
|
+
return (h("div", { class: "steps" }, steps.map((step, index) => (h("div", { class: "step mb-28", key: index }, this.renderHeading(step.title), h("div", { class: "content" }, h("slot", { name: `step-${index}` }, h("div", { class: index === steps.length - 1 ? 'f-body-02 text-lighter mt-16' : 'f-body-02 text-lighter my-16', innerHTML: step.content }))))))));
|
|
2037
5230
|
}
|
|
2038
5231
|
get el() { return getElement(this); }
|
|
2039
5232
|
static get watchers() { return {
|
|
@@ -2042,22 +5235,36 @@ const EdsSteps = class {
|
|
|
2042
5235
|
};
|
|
2043
5236
|
EdsSteps.style = EdsStepsStyle0;
|
|
2044
5237
|
|
|
2045
|
-
const edsStepsV2Css = "
|
|
5238
|
+
const edsStepsV2Css = ".steps{position:sticky;margin-left:16px;border-left:1px solid var(--soft-color, #ddd);padding-left:23px;counter-reset:step}.steps h3{counter-increment:step;font-size:var(--f-heading-05-fontSize);font-weight:var(--f-heading-05-fontWeight);line-height:var(--f-heading-05-lineHeight);position:relative}.steps h3::before{content:counter(step);position:absolute;left:-40px;top:-2px;display:flex;align-items:center;justify-content:center;width:32px;height:32px;font-size:1rem;border:1px solid #ccc;background:var(--grey-900);color:#fff;border-radius:50%}.steps h4,.steps h5{counter-increment:step;font-size:var(--f-heading-06-fontSize);font-weight:var(--f-heading-06-fontWeight);line-height:var(--f-heading-06-lineHeight);position:relative}.steps h4::before,.steps h5::before{content:counter(step);position:absolute;left:-40px;top:-2px;display:flex;align-items:center;justify-content:center;width:30px;height:30px;font-size:0.875rem;border:1px solid #ccc;background:#333;color:#fff;border-radius:50%}.steps blockquote{margin-top:16px;margin-bottom:16px;font-style:italic;color:#aaa;padding-left:6px}.steps-img-placeholder{width:100%;height:200px;background:linear-gradient(to bottom, #9CE142, #00C959, #00A595);}.bg-\\[\\#00A595\\]{--tw-bg-opacity:1;background-color:rgb(0 165 149 / var(--tw-bg-opacity))}.relative{position:relative}.f-heading-04{font-family:var(--f-heading-04-fontFamily);font-weight:var(--f-heading-04-fontWeight);font-size:var(--f-heading-04-fontSize);line-height:var(--f-heading-04-lineHeight);letter-spacing:var(--f-heading-04-letterSpacing)}.f-body-02{font-family:var(--f-body-02-fontFamily);font-weight:var(--f-body-02-fontWeight);font-size:var(--f-body-02-fontSize);line-height:var(--f-body-02-lineHeight);letter-spacing:var(--f-body-02-letterSpacing)}.text-inverse{color:var(--white)}.text-light{color:var(--grey-700)}.text-lighter{color:var(--grey-600)}.w-full{width:100%}.h-52{height:3.25rem}.h-96{height:6rem}.h-\\[200px\\]{height:200px}.mt-16{margin-top:1rem}.my-16{margin-top:1rem;margin-bottom:1rem}.mb-12{margin-bottom:0.75rem}.last\\:mb-0:last-child{margin-bottom:0rem}.last\\:mt-16:last-child{margin-top:1rem}.border-softer{border:2px solid rgba(0, 0, 0, .1)}.relative{position:relative}.flex{display:flex}.inline-flex{display:inline-flex}.grow{flex-grow:1}.rounded{border-radius:0.25rem}.rounded-lg{border-radius:16px}.rounded-t-lg{border-top-left-radius:16px;border-top-right-radius:16px}.border-2{border-width:2px}.p-8{padding:0.5rem}.p-24{padding:1.5rem}.bg-default{background-color:var(--grey-200)}.bg-inverse{background-color:var(--white)}.top-2{top:0.125rem}.bottom-2{bottom:0.125rem}.left-2{left:0.125rem}.right-2{right:0.125rem}.-translate-x-1\\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.overflow-hidden{overflow:hidden}.space-y-8{--tw-space-y-reverse:0;margin-top:calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0.5rem * var(--tw-space-y-reverse))}.space-y-16{--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.ml-8{margin-left:0.5rem}.gap-y-16{row-gap:1rem}.gap-x-16{-moz-column-gap:1rem;column-gap:1rem}.flex{display:flex}.grid{display:grid}.hidden{display:none}.block{display:block}.px-8{padding-left:0.5rem;padding-right:0.5rem}.pb-20{padding-bottom:1.25rem}";
|
|
2046
5239
|
const EdsStepsV2Style0 = edsStepsV2Css;
|
|
2047
5240
|
|
|
2048
5241
|
const EdsStepsV2 = class {
|
|
2049
5242
|
constructor(hostRef) {
|
|
2050
5243
|
registerInstance(this, hostRef);
|
|
2051
5244
|
this.step = createEvent(this, "step", 7);
|
|
5245
|
+
this.finished = createEvent(this, "finished", 7);
|
|
5246
|
+
this.next = createEvent(this, "next", 7);
|
|
5247
|
+
this.back = createEvent(this, "back", 7);
|
|
2052
5248
|
this.handleNext = () => {
|
|
2053
|
-
|
|
2054
|
-
if (this.activeStep
|
|
5249
|
+
const lastIndex = this.parsedSteps.length - 1;
|
|
5250
|
+
if (this.activeStep >= lastIndex) {
|
|
5251
|
+
// Finish
|
|
5252
|
+
this.finished.emit();
|
|
5253
|
+
return;
|
|
5254
|
+
}
|
|
5255
|
+
// Next
|
|
5256
|
+
const target = this.activeStep + 1;
|
|
5257
|
+
this.next.emit(target);
|
|
5258
|
+
if (!this.disableNext) {
|
|
5259
|
+
this.activeStep = target;
|
|
2055
5260
|
this.step.emit(this.activeStep);
|
|
2056
5261
|
}
|
|
2057
5262
|
};
|
|
2058
5263
|
this.handleBack = () => {
|
|
2059
5264
|
if (this.activeStep > 0) {
|
|
2060
|
-
|
|
5265
|
+
const target = this.activeStep - 1;
|
|
5266
|
+
this.back.emit(target);
|
|
5267
|
+
this.activeStep = target;
|
|
2061
5268
|
this.step.emit(this.activeStep);
|
|
2062
5269
|
}
|
|
2063
5270
|
};
|
|
@@ -2067,6 +5274,11 @@ const EdsStepsV2 = class {
|
|
|
2067
5274
|
this.imageWidth = undefined;
|
|
2068
5275
|
this.bg = true;
|
|
2069
5276
|
this.message = undefined;
|
|
5277
|
+
this.nextLabel = 'Next';
|
|
5278
|
+
this.backLabel = 'Back';
|
|
5279
|
+
this.finishLabel = 'Finish';
|
|
5280
|
+
this.disableNext = false;
|
|
5281
|
+
this.headingLevel = 'h4';
|
|
2070
5282
|
this.activeStep = 0;
|
|
2071
5283
|
}
|
|
2072
5284
|
componentDidLoad() {
|
|
@@ -2105,24 +5317,22 @@ const EdsStepsV2 = class {
|
|
|
2105
5317
|
'border-softer effect-focus-within relative rounded-lg border-2'
|
|
2106
5318
|
].join(' ');
|
|
2107
5319
|
}
|
|
2108
|
-
handleStepClick(index) {
|
|
2109
|
-
this.step.emit(index);
|
|
2110
|
-
// In linear mode, update the active step on header click.
|
|
2111
|
-
if (this.type === 'linear') {
|
|
2112
|
-
this.activeStep = index;
|
|
2113
|
-
}
|
|
2114
|
-
}
|
|
2115
5320
|
/**
|
|
2116
5321
|
* Parses the steps property into an array of Step objects.
|
|
2117
5322
|
*/
|
|
2118
5323
|
get parsedSteps() {
|
|
2119
5324
|
return parseData(this.steps);
|
|
2120
5325
|
}
|
|
5326
|
+
/** Render the semantic heading element */
|
|
5327
|
+
renderHeading(title) {
|
|
5328
|
+
const Tag = this.headingLevel;
|
|
5329
|
+
return h(Tag, null, title);
|
|
5330
|
+
}
|
|
2121
5331
|
render() {
|
|
2122
5332
|
const steps = this.parsedSteps;
|
|
2123
|
-
return (h("div", { key: '
|
|
5333
|
+
return (h("div", { key: '1ff00f17a85e9a3a9d7bef23694560acd77e7ee4', class: this.articleClasses() }, this.imageSrc ? (h("div", { class: "w-full mb-12 rounded-t-lg overflow-hidden border-2" }, h("eds-img", { src: this.imageSrc, width: this.imageWidth, "with-bg": "true", "lazy-load": "true", alt: "Step illustration" }))) : (this.message && (h("div", { class: "w-full bg-[#00A595] rounded-t-lg border-2" }, h("div", { class: "p-24" }, h("span", { class: "text-inverse f-heading-04 " }, this.message))))), h("div", { key: 'a0328e80df5d9447cfa5378eb9e45925f1f68c69', class: "pb-20 px-8" }, this.type === 'linear' ? (h("div", { class: "steps" }, steps.map((step, index) => (h("div", { class: index === 0 ? 'step' : 'step space-y-16', key: index }, this.renderHeading(step.title), this.activeStep === index && (h("div", { class: "content grid gap-y-16" }, h("slot", { name: `step-${index}` }, h("div", { class: index === steps.length - 1 ? 'f-body-02 text-lighter' : 'f-body-02 text-lighter', innerHTML: step.content })), h("div", { class: "flex items-center" }, h("eds-button", { label: this.backLabel, intent: "ghost", icon: "chevron-left", iconPos: "left", iconSmall: true, onClick: this.handleBack, disabled: index === 0, class: index === 0 ? 'hidden' : 'block', size: "small" }), h("eds-button", { label: index === steps.length - 1 ? this.finishLabel : this.nextLabel, intent: "primary", icon: "chevron-right", iconSmall: true, onClick: this.handleNext, disabled: this.disableNext, size: "small", class: "ml-8" }))))))))) : (
|
|
2124
5334
|
// Static mode: show all steps with their content.
|
|
2125
|
-
h("div", { class: "steps space-y-8" }, steps.map((step, index) => (h("div", { class: "step", key: index },
|
|
5335
|
+
h("div", { class: "steps space-y-8" }, steps.map((step, index) => (h("div", { class: "step", key: index }, this.renderHeading(step.title), h("div", { class: "content" }, h("slot", { name: `step-${index}` }, h("div", { class: index === steps.length - 1 ? 'f-body-02 text-lighter mt-16' : 'f-body-02 text-lighter', innerHTML: step.content })))))))))));
|
|
2126
5336
|
}
|
|
2127
5337
|
get el() { return getElement(this); }
|
|
2128
5338
|
static get watchers() { return {
|
|
@@ -2131,7 +5341,67 @@ const EdsStepsV2 = class {
|
|
|
2131
5341
|
};
|
|
2132
5342
|
EdsStepsV2.style = EdsStepsV2Style0;
|
|
2133
5343
|
|
|
2134
|
-
const
|
|
5344
|
+
const edsSwitchCss = ":host{display:inline-block}.switch-container{display:inline-flex;align-items:center}.switch-label{font-family:var(--f-ui-02-light-fontFamily);font-weight:var(--f-ui-02-light-fontWeight);font-size:var(--f-ui-02-light-fontSize);line-height:var(--f-ui-02-light-lineHeight);letter-spacing:var(--f-ui-02-light-letterSpacing)}button.switch{position:relative;display:inline-flex;align-items:center;width:50px;height:26px;border:none;border-radius:13px;background-color:#ccc;padding:0;cursor:pointer;transition:background-color 0.2s}button.switch.switch--checked{background-color:var(--green-500)}button.switch.switch--disabled{opacity:0.6;cursor:not-allowed}.switch-handle{position:absolute;width:22px;height:22px;border-radius:50%;background-color:#fff;top:2px;left:2px;transition:transform 0.2s}button.switch.switch--checked .switch-handle{transform:translateX(24px)}.ml-8{margin-left:0.5rem}.mr-8{margin-right:0.5rem}.switch:focus{outline:2px solid #005fcc;outline-offset:2px}.switch:focus:not(:focus-visible){outline:none}.switch:focus-visible{outline-width:3px;outline-offset:2px;outline-color:var(--green-500)}";
|
|
5345
|
+
const EdsSwitchStyle0 = edsSwitchCss;
|
|
5346
|
+
|
|
5347
|
+
const EdsSwitch = class {
|
|
5348
|
+
constructor(hostRef) {
|
|
5349
|
+
registerInstance(this, hostRef);
|
|
5350
|
+
this.uiswitch = createEvent(this, "uiswitch", 7);
|
|
5351
|
+
this.toggleSwitch = () => {
|
|
5352
|
+
if (this.disabled) {
|
|
5353
|
+
return;
|
|
5354
|
+
}
|
|
5355
|
+
this.checked = !this.checked;
|
|
5356
|
+
this.uiswitch.emit({ value: this.checked });
|
|
5357
|
+
sendAnalytics({
|
|
5358
|
+
category: 'ui-component',
|
|
5359
|
+
tag: this.el.tagName.toLowerCase(),
|
|
5360
|
+
name: this.checked ? this.labelOn : this.labelOff || '',
|
|
5361
|
+
action: 'checked'
|
|
5362
|
+
});
|
|
5363
|
+
};
|
|
5364
|
+
this.handleKeyDown = (e) => {
|
|
5365
|
+
if (this.disabled) {
|
|
5366
|
+
return;
|
|
5367
|
+
}
|
|
5368
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
5369
|
+
e.preventDefault();
|
|
5370
|
+
this.toggleSwitch();
|
|
5371
|
+
}
|
|
5372
|
+
};
|
|
5373
|
+
this.checked = false;
|
|
5374
|
+
this.disabled = false;
|
|
5375
|
+
this.labelOn = '';
|
|
5376
|
+
this.labelOff = '';
|
|
5377
|
+
}
|
|
5378
|
+
render() {
|
|
5379
|
+
const switchId = `switch-${Math.random().toString(36).substr(2, 9)}`;
|
|
5380
|
+
const labelledBy = [];
|
|
5381
|
+
if (this.labelOff) {
|
|
5382
|
+
labelledBy.push(`${switchId}-off`);
|
|
5383
|
+
}
|
|
5384
|
+
if (this.labelOn) {
|
|
5385
|
+
labelledBy.push(`${switchId}-on`);
|
|
5386
|
+
}
|
|
5387
|
+
const accessibleLabel = labelledBy.length === 0
|
|
5388
|
+
? this.labelOn || this.labelOff
|
|
5389
|
+
? this.checked
|
|
5390
|
+
? this.labelOn
|
|
5391
|
+
: this.labelOff
|
|
5392
|
+
: 'Toggle switch'
|
|
5393
|
+
: undefined;
|
|
5394
|
+
return (h("div", { key: '95a833cbe8e736d7e747f6fdd8504dd8c169ea60', class: "switch-container" }, this.labelOff && (h("span", { key: 'a88de63c35409ab244a6cba5bd70a10728a08b2a', id: `${switchId}-off`, class: "switch-label switch-label--off mr-8" }, this.labelOff)), h("button", { key: 'd6573f05164f2b57063e9a97c3b983f32700bd7a', id: switchId, tabindex: this.disabled ? '-1' : '0', type: "button", role: "switch", "aria-checked": this.checked ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', "aria-labelledby": labelledBy.length > 0 ? labelledBy.join(' ') : undefined, "aria-label": accessibleLabel, class: {
|
|
5395
|
+
switch: true,
|
|
5396
|
+
'switch--checked': this.checked,
|
|
5397
|
+
'switch--disabled': this.disabled
|
|
5398
|
+
}, onClick: this.toggleSwitch, onKeyDown: this.handleKeyDown, disabled: this.disabled }, h("span", { key: '35e6da3bb76779bfaad04d8990dec419524fb543', class: "switch-handle" })), this.labelOn && (h("span", { key: 'b14243d9d45dbdddb9473ad2c5696e07be9831d3', id: `${switchId}-on`, class: "switch-label switch-label--on ml-8" }, this.labelOn))));
|
|
5399
|
+
}
|
|
5400
|
+
get el() { return getElement(this); }
|
|
5401
|
+
};
|
|
5402
|
+
EdsSwitch.style = EdsSwitchStyle0;
|
|
5403
|
+
|
|
5404
|
+
const edsTableCss = "table{text-indent:0;border-color:inherit;border-collapse:collapse;}.container{width:calc(var(--container-width, 100%) - (2 * var(--breakout-container-outer-gutter, var(--container-outer-gutter, var(--outer-gutter, 0)))));margin-right:auto;margin-left:auto}.container>*{--container-outer-gutter:0;--breakout-container-outer-gutter:0}.pt-32{padding-top:2rem}.pt-40{padding-top:2.5rem}.pt-48{padding-top:3rem}.pb-28{padding-bottom:1.75rem}.pb-60{padding-bottom:3.75rem}.mt-20{margin-top:1.25rem}.mt-28{margin-top:1.75rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.overflow-x-auto{overflow-x:auto}.mt-6{margin-top:0.375rem}.p-0{padding:0rem}.p-4{padding:0.25rem}.m-0{margin:0rem}.border{border-width:1px}.border-softer{border:1px solid rgba(0, 0, 0, .1)}.even\\:bg-inverse-softer:nth-child(even){background-color:rgba(255, 255, 255, .15)}.px-8{padding-left:0.5rem;padding-right:0.5rem}.px-20{padding-left:1.25rem;padding-right:1.25rem}.py-8{padding-top:0.5rem;padding-bottom:0.5rem}.f-ui-01{font-family:var(--f-ui-01-fontFamily);font-weight:var(--f-ui-01-fontWeight);font-size:var(--f-ui-01-fontSize);line-height:var(--f-ui-01-lineHeight);letter-spacing:var(--f-ui-01-letterSpacing)}.f-ui-02{font-family:var(--f-ui-02-fontFamily);font-weight:var(--f-ui-02-fontWeight);font-size:var(--f-ui-02-fontSize);line-height:var(--f-ui-02-lineHeight);letter-spacing:var(--f-ui-02-letterSpacing)}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.text-center{text-align:center}.break-words{overflow-wrap:anywhere}";
|
|
2135
5405
|
const EdsTableStyle0 = edsTableCss;
|
|
2136
5406
|
|
|
2137
5407
|
const EdsTable = class {
|
|
@@ -2141,8 +5411,33 @@ const EdsTable = class {
|
|
|
2141
5411
|
this.handleResize = () => {
|
|
2142
5412
|
this.updateContainerWidth();
|
|
2143
5413
|
};
|
|
5414
|
+
this.onActionKeyDown = (e) => {
|
|
5415
|
+
var _a;
|
|
5416
|
+
if (e.key !== 'ArrowRight' && e.key !== 'ArrowLeft') {
|
|
5417
|
+
return;
|
|
5418
|
+
}
|
|
5419
|
+
e.preventDefault();
|
|
5420
|
+
const currentButton = e.target;
|
|
5421
|
+
const toolbar = currentButton.closest('[role="toolbar"]');
|
|
5422
|
+
if (!toolbar) {
|
|
5423
|
+
return;
|
|
5424
|
+
}
|
|
5425
|
+
// Find all focusable action buttons in this row
|
|
5426
|
+
const actionButtons = Array.from(toolbar.querySelectorAll('eds-button'));
|
|
5427
|
+
const currentIndex = actionButtons.indexOf(currentButton);
|
|
5428
|
+
if (currentIndex === -1) {
|
|
5429
|
+
return;
|
|
5430
|
+
}
|
|
5431
|
+
let nextIndex;
|
|
5432
|
+
if (e.key === 'ArrowRight') {
|
|
5433
|
+
nextIndex = (currentIndex + 1) % actionButtons.length;
|
|
5434
|
+
}
|
|
5435
|
+
else {
|
|
5436
|
+
nextIndex = (currentIndex - 1 + actionButtons.length) % actionButtons.length;
|
|
5437
|
+
}
|
|
5438
|
+
(_a = actionButtons[nextIndex]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
5439
|
+
};
|
|
2144
5440
|
this.data = null;
|
|
2145
|
-
this.endpoint = null;
|
|
2146
5441
|
this.config = {};
|
|
2147
5442
|
this.rowsPerPage = 10;
|
|
2148
5443
|
this.paginationEnabled = true;
|
|
@@ -2180,7 +5475,7 @@ const EdsTable = class {
|
|
|
2180
5475
|
componentWillLoad() {
|
|
2181
5476
|
this.parseConfig();
|
|
2182
5477
|
this.handleActionsChange();
|
|
2183
|
-
this.
|
|
5478
|
+
this.parseData();
|
|
2184
5479
|
}
|
|
2185
5480
|
componentDidLoad() {
|
|
2186
5481
|
this.updateContainerWidth();
|
|
@@ -2228,24 +5523,13 @@ const EdsTable = class {
|
|
|
2228
5523
|
this.parsedConfig = {};
|
|
2229
5524
|
}
|
|
2230
5525
|
}
|
|
2231
|
-
async fetchData() {
|
|
2232
|
-
try {
|
|
2233
|
-
const response = await fetch(this.endpoint);
|
|
2234
|
-
const data = await response.json();
|
|
2235
|
-
this.data = data;
|
|
2236
|
-
}
|
|
2237
|
-
catch (error) {
|
|
2238
|
-
// eslint-disable-next-line
|
|
2239
|
-
console.error('Failed to fetch data:', error);
|
|
2240
|
-
}
|
|
2241
|
-
}
|
|
2242
5526
|
setupPaginationListener() {
|
|
2243
5527
|
if (!this.shouldEnablePagination()) {
|
|
2244
5528
|
return;
|
|
2245
5529
|
}
|
|
2246
5530
|
const paginationEl = this.hostEl.shadowRoot.querySelector('eds-pagination');
|
|
2247
5531
|
if (paginationEl && !paginationEl.hasAttribute('listener-attached')) {
|
|
2248
|
-
paginationEl.addEventListener('page', (event) => this.handlePageChange(event.detail));
|
|
5532
|
+
paginationEl.addEventListener('page', (event) => this.handlePageChange(event.detail.value));
|
|
2249
5533
|
paginationEl.setAttribute('listener-attached', 'true');
|
|
2250
5534
|
}
|
|
2251
5535
|
}
|
|
@@ -2293,7 +5577,10 @@ const EdsTable = class {
|
|
|
2293
5577
|
const checked = !!row[boundField];
|
|
2294
5578
|
return (h("eds-input-field", { name: `chc-${actionName}`, label: act.label, type: "checkbox", checked: checked, onChange: (e) => this.emitAction(act.name, row, e.target.checked) }));
|
|
2295
5579
|
}
|
|
2296
|
-
|
|
5580
|
+
// Let all action buttons be focusable naturally
|
|
5581
|
+
const showLabel = act.showLabel === true;
|
|
5582
|
+
const btn = (h("eds-button", { icon: act.icon, label: showLabel ? act.label : null, iconPos: "left", pill: true, size: "small", intent: "ghost", tabIndex: 0, onClick: () => this.emitAction(act.name, row) }));
|
|
5583
|
+
return showLabel ? btn : h("eds-tooltip", { content: act.label }, btn);
|
|
2297
5584
|
}
|
|
2298
5585
|
emitAction(actionName, row, checked) {
|
|
2299
5586
|
sendAnalytics({
|
|
@@ -2339,7 +5626,7 @@ const EdsTable = class {
|
|
|
2339
5626
|
const columnWidth = visibleColumnsCount > 0 ? Math.floor((currentContainerWidth / visibleColumnsCount) * this.divisionFactor()) : 100;
|
|
2340
5627
|
const paginatedRows = this.getPaginatedRows();
|
|
2341
5628
|
const lastPage = Math.ceil(this.totalRows / this.rowsPerPage);
|
|
2342
|
-
return (h("div", { key: '
|
|
5629
|
+
return (h("div", { key: '67cfdabc741af13585699e43e67ba0d204a60706' }, this.searchEnabled && (h("div", { key: '208240b9832f9b2e9645cc9d7315a43bd47b54b3' }, h("eds-input-field", { key: 1, icon: "search", name: "search", "aria-label": "Search", type: "text", placeholder: "Search...", onInput: (event) => this.handleSearch(event) }))), h("div", { key: '893924497d1535b7d29bc0b64ba48f4a3e366c43', class: "mt-20" }, h("table", { key: 'a019fa4f2886d4c2aa4bddc88dc7b6d7aa63fdcb', class: "block overflow-x-auto mt-6 p-0" }, h("thead", { key: 'a6360fea59c605878e443a23cf45d0f8a9644140' }, h("tr", { key: '09702e8838f32c52bf6314b59ec598c6fa55d609', class: "m-0 p-0 border border-softer even:bg-inverse-softer" }, this.columns.map((col) => {
|
|
2343
5630
|
var _a;
|
|
2344
5631
|
if (col === 'actions') {
|
|
2345
5632
|
return (h("th", { class: "m-0 py-8 border border-softer f-ui-02 break-words", style: { minWidth: `${columnWidth - 4}px` } }));
|
|
@@ -2348,17 +5635,22 @@ const EdsTable = class {
|
|
|
2348
5635
|
return (h("th", { class: "m-0 py-8 border border-softer f-ui-02 break-words", style: { minWidth: `${columnWidth - 4}px` } }, this.capitalize(col)));
|
|
2349
5636
|
}
|
|
2350
5637
|
return null;
|
|
2351
|
-
}))), h("tbody", { key: '
|
|
5638
|
+
}))), h("tbody", { key: '5cdb3697e6c84921a823b40714a497f02c82e360' }, paginatedRows.map((row) => (h("tr", { class: "m-0 p-0 border border-softer even:bg-inverse-softer" }, this.columns.map((col) => {
|
|
2352
5639
|
var _a;
|
|
2353
5640
|
if (col === 'actions') {
|
|
2354
|
-
return (h("td", { class: "text-center border border-softer m-0 f-ui-02 break-words actions-cell", style: { minWidth: `${columnWidth - 4}px` } }, h("div", {
|
|
5641
|
+
return (h("td", { class: "text-center border border-softer m-0 f-ui-02 break-words actions-cell", style: { minWidth: `${columnWidth - 4}px` } }, h("div", { role: "toolbar", "aria-label": "Row actions", onKeyDown: this.onActionKeyDown, style: {
|
|
5642
|
+
display: 'flex',
|
|
5643
|
+
gap: '0.5rem',
|
|
5644
|
+
justifyContent: 'center',
|
|
5645
|
+
flexWrap: 'wrap'
|
|
5646
|
+
} }, this.parsedActions.map((act) => (h("span", { style: { whiteSpace: 'nowrap' } }, this.renderSingleActionCell(act.name, row)))))));
|
|
2355
5647
|
}
|
|
2356
5648
|
if (!((_a = this.parsedConfig[col]) === null || _a === void 0 ? void 0 : _a.hidden)) {
|
|
2357
5649
|
// Regular data cell
|
|
2358
5650
|
return (h("td", { class: "text-center border border-softer m-0 py-8 f-ui-2 break-words", style: { minWidth: `${columnWidth - 4}px` } }, this.renderCell(row[col], col)));
|
|
2359
5651
|
}
|
|
2360
5652
|
return null;
|
|
2361
|
-
}))))))), this.shouldEnablePagination() && (h("div", { key: '
|
|
5653
|
+
}))))))), this.shouldEnablePagination() && (h("div", { key: 'f5af2cd6e65c3ed55ec2810ec4b1e3f891866271', class: "mt-20" }, h("eds-pagination", { key: '32965384707df502fb197712c73bb290e38ce040', currentPage: this.currentPage, lastPage: lastPage, perPage: this.rowsPerPage, total: this.totalRows, mode: "default" })))));
|
|
2362
5654
|
}
|
|
2363
5655
|
get hostEl() { return getElement(this); }
|
|
2364
5656
|
static get watchers() { return {
|
|
@@ -2369,22 +5661,27 @@ const EdsTable = class {
|
|
|
2369
5661
|
};
|
|
2370
5662
|
EdsTable.style = EdsTableStyle0;
|
|
2371
5663
|
|
|
2372
|
-
const edsTabsCss = "*,::before,::after{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(147 197 253 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}*,::before,::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:currentColor;}::before,::after{--tw-content:''}a{color:inherit;text-decoration:inherit}.relative{position:relative}.f-ui-03{font-family:var(--f-ui-03-fontFamily);font-weight:var(--f-ui-03-fontWeight);font-size:var(--f-ui-03-fontSize);line-height:var(--f-ui-03-lineHeight);letter-spacing:var(--f-ui-03-letterSpacing)}.whitespace-nowrap{white-space:nowrap}.effect-
|
|
5664
|
+
const edsTabsCss = "*,::before,::after{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(147 197 253 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}*,::before,::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:currentColor;}::before,::after{--tw-content:''}a{color:inherit;text-decoration:inherit}.relative{position:relative}.f-ui-03{font-family:var(--f-ui-03-fontFamily);font-weight:var(--f-ui-03-fontWeight);font-size:var(--f-ui-03-fontSize);line-height:var(--f-ui-03-lineHeight);letter-spacing:var(--f-ui-03-letterSpacing)}.whitespace-nowrap{white-space:nowrap}.effect-focus{outline-width:3px;outline-offset:2px;outline-color:var(--green-500)}.effect-focus:focus-visible{outline-style:solid}.effect-focus-within{outline-width:3px;outline-offset:2px;outline-color:var(--green-500)}.focus-visible\\:text-default:focus-visible{color:var(--black)}.hover\\:text-default:hover{color:var(--black)}.border-2{border-width:2px}.after\\:content-\\[\\'\\'\\]::after{--tw-content:'';content:var(--tw-content)}.after\\:bottom-0::after{bottom:0rem}.after\\:border-0::after{border-width:0px}.after\\:border-b-2::after{border-bottom-width:2px}.after\\:absolute::after{position:absolute}.after\\:inset-0::after{inset:0rem}.after\\:rounded-lg::after{border-radius:16px}.after\\:border-solid::after{border-style:solid}.after\\:border-3::after{border-width:3px}.after\\:border-accent::after{border-color:var(--green-500)}.after\\:opacity-0::after{opacity:0}.outline-none{outline:2px solid transparent;outline-offset:2px}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:after\\:opacity-100:focus-visible::after{opacity:1}.rounded-t-lg{border-top-left-radius:16px;border-top-right-radius:16px}.rounded-tl-lg{border-top-left-radius:16px}.rounded-tr-lg{border-top-right-radius:16px}.border-l-0{border-left-width:0px}.border-r-0{border-right-width:0px}.border-b-0{border-bottom-width:0px}.pr-28{padding-right:1.75rem}.pl-28{padding-left:1.75rem}.-mr-16{margin-right:-1rem}.-ml-16{margin-left:-1rem}.px-16{padding-left:1rem;padding-right:1rem}.py-12{padding-top:0.75rem;padding-bottom:0.75rem}.after\\:left-16::after{left:1rem}.after\\:right-16::after{right:1rem}.text-lighter{color:var(--grey-600)}.bg-dark{background-color:var(--grey-300)}.hover\\:bg-darker:hover{background-color:var(--grey-400)}.border-soft{border-color:var(--grey-400)}.border-softest{border-color:rgba(0, 0, 0, .05)}.bg-default{background-color:var(--grey-200)}.text-default{color:var(--black)}.z-99{z-index:99}.after\\:z-10::after{z-index:10}.before\\:bottom-0::before{bottom:0rem}.before\\:h-12::before{height:0.75rem}.before\\:opacity-5::before{opacity:0.05}.before\\:content-\\[\\'\\'\\]::before{--tw-content:'';content:var(--tw-content)}.before\\:absolute::before{position:absolute}.before\\:-bottom-2::before{bottom:-0.125rem}.after\\:inset-x-0::after{left:0rem;right:0rem}.before\\:inset-x-0::before{left:0rem;right:0rem}.before\\:h-3::before{height:0.1875rem}.before\\:bg-default::before{background-color:var(--grey-200)}.after\\:border-soft::after{border-color:rgba(0, 0, 0, .15 )}.after\\:border-softest::after{border-color:rgba(0, 0, 0, .05)}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.before\\:bg-gradient-y::before{background:linear-gradient(to bottom, transparent, ease-in-out, black)}.scroller-x{-ms-overflow-style:none;scrollbar-width:none}.overflow-x-auto{overflow-x:auto}.max-w-xxxl{max-width:2200px}.z-1{z-index:1}.mx-auto{margin-left:auto;margin-right:auto}.pt-8{padding-top:0.5rem}.pr-16{padding-right:1rem}.pl-16{padding-left:1rem}.inline-flex{display:inline-flex}@media (min-width: 900px){.lg\\:px-28{padding-left:1.75rem;padding-right:1.75rem}}@media (min-width: 2200px){.xxxl\\:px-0{padding-left:0rem;padding-right:0rem}}";
|
|
2373
5665
|
const EdsTabsStyle0 = edsTabsCss;
|
|
2374
5666
|
|
|
2375
5667
|
const EdsTabs = class {
|
|
2376
5668
|
constructor(hostRef) {
|
|
2377
5669
|
registerInstance(this, hostRef);
|
|
2378
5670
|
this.tab = createEvent(this, "tab", 7);
|
|
5671
|
+
this.tabRefs = [];
|
|
5672
|
+
// Store tab reference
|
|
5673
|
+
this.setTabRef = (el, index) => {
|
|
5674
|
+
if (el) {
|
|
5675
|
+
this.tabRefs[index] = el;
|
|
5676
|
+
}
|
|
5677
|
+
};
|
|
2379
5678
|
// cva configuration
|
|
2380
5679
|
this.tabCva = cva([
|
|
2381
5680
|
'relative py-12',
|
|
2382
5681
|
'f-ui-03 whitespace-nowrap',
|
|
2383
|
-
'effect-color',
|
|
5682
|
+
'effect-color effect-focus',
|
|
2384
5683
|
'focus-visible:text-default hover:text-default',
|
|
2385
|
-
'border-2'
|
|
2386
|
-
"after:content-[''] after:absolute after:inset-0 after:rounded-t-lg after:opacity-0",
|
|
2387
|
-
'outline-none focus:outline-none focus-visible:outline-none focus-visible:after:opacity-100'
|
|
5684
|
+
'border-2'
|
|
2388
5685
|
], {
|
|
2389
5686
|
variants: {
|
|
2390
5687
|
position: {
|
|
@@ -2394,7 +5691,10 @@ const EdsTabs = class {
|
|
|
2394
5691
|
right: 'pl-28 pr-16 rounded-tr-lg border-l-0 -ml-16 after:left-16'
|
|
2395
5692
|
},
|
|
2396
5693
|
active: {
|
|
2397
|
-
false:
|
|
5694
|
+
false: [
|
|
5695
|
+
'text-lighter bg-dark hover:bg-darker border-softest border-b-0 z-1',
|
|
5696
|
+
"after:content-[''] after:absolute after:bottom-0 after:inset-x-0 after:h-2 after:border-soft"
|
|
5697
|
+
],
|
|
2398
5698
|
true: [
|
|
2399
5699
|
'bg-default text-default z-99',
|
|
2400
5700
|
'rounded-t-lg',
|
|
@@ -2413,28 +5713,35 @@ const EdsTabs = class {
|
|
|
2413
5713
|
componentWillLoad() {
|
|
2414
5714
|
this.parseTabs();
|
|
2415
5715
|
this.setActiveIndex();
|
|
2416
|
-
this.tab.emit({ tabId: this.identifier, index:
|
|
5716
|
+
this.tab.emit({ tabId: this.identifier, index: this.activeIndex });
|
|
2417
5717
|
}
|
|
2418
5718
|
/**
|
|
2419
|
-
* Parses the `
|
|
2420
|
-
* Returns an empty array if parsing fails or if `
|
|
2421
|
-
*
|
|
2422
|
-
* @returns {any[]} Array of parsed link objects
|
|
2423
|
-
*/
|
|
2424
|
-
/**
|
|
2425
|
-
* Parses the `links` prop into an array of link objects.
|
|
2426
|
-
* Returns an empty array if parsing fails or if `links` is not a valid JSON string or object.
|
|
5719
|
+
* Parses the `tabs` prop into an array of tab objects.
|
|
5720
|
+
* Returns an empty array if parsing fails or if `tabs` is not a valid JSON string or object.
|
|
2427
5721
|
*
|
|
2428
|
-
* @returns {any[]} Array of parsed
|
|
5722
|
+
* @returns {any[]} Array of parsed tab objects
|
|
2429
5723
|
*/
|
|
2430
5724
|
parseTabs() {
|
|
2431
5725
|
this.parsedTabs = parseData(this.tabs);
|
|
5726
|
+
// Reset tab refs when tabs change
|
|
5727
|
+
this.tabRefs = [];
|
|
2432
5728
|
}
|
|
2433
5729
|
componentDidLoad() {
|
|
2434
5730
|
this.scrollToActiveTab();
|
|
2435
5731
|
}
|
|
5732
|
+
componentDidUpdate() {
|
|
5733
|
+
// Ensure we have the correct number of tab refs after render
|
|
5734
|
+
if (this.tabRefs.length !== this.parsedTabs.length) {
|
|
5735
|
+
this.tabRefs = new Array(this.parsedTabs.length).fill(null);
|
|
5736
|
+
}
|
|
5737
|
+
}
|
|
2436
5738
|
setActiveIndex() {
|
|
2437
5739
|
this.activeIndex = this.parsedTabs.findIndex((tab) => tab.active);
|
|
5740
|
+
// If no active tab found, default to first tab
|
|
5741
|
+
if (this.activeIndex === -1 && this.parsedTabs.length > 0) {
|
|
5742
|
+
this.activeIndex = 0;
|
|
5743
|
+
this.parsedTabs[0].active = true;
|
|
5744
|
+
}
|
|
2438
5745
|
}
|
|
2439
5746
|
scrollToActiveTab() {
|
|
2440
5747
|
var _a;
|
|
@@ -2456,31 +5763,74 @@ const EdsTabs = class {
|
|
|
2456
5763
|
: index < this.activeIndex
|
|
2457
5764
|
? 'left'
|
|
2458
5765
|
: 'right';
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
5766
|
+
const rawZ = position === 'left' ? index : this.parsedTabs.length + 1 - index;
|
|
5767
|
+
// clamp inactive to at least 1
|
|
5768
|
+
const z = active ? this.parsedTabs.length + 99 : Math.max(rawZ, 1);
|
|
5769
|
+
return Object.assign({ class: this.tabCva({ active, position }), style: {
|
|
5770
|
+
// stringify the number so it matches { [key: string]: string }
|
|
5771
|
+
zIndex: `${z}`
|
|
2464
5772
|
} }, (active ? { 'data-tab-active': 'true' } : {}));
|
|
2465
5773
|
}
|
|
2466
|
-
handleTabClick(index, tabLabel) {
|
|
5774
|
+
handleTabClick(index, tabLabel, shouldFocus = true) {
|
|
5775
|
+
// Validate index
|
|
5776
|
+
if (index < 0 || index >= this.parsedTabs.length) {
|
|
5777
|
+
return;
|
|
5778
|
+
}
|
|
2467
5779
|
// Update the active index and set all tabs' active state accordingly
|
|
2468
5780
|
this.activeIndex = index;
|
|
2469
5781
|
this.parsedTabs = this.parsedTabs.map((tab, tabIndex) => (Object.assign(Object.assign({}, tab), { active: tabIndex === index })));
|
|
2470
5782
|
this.tab.emit({ tabId: this.identifier, index: index, name: tabLabel });
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
5783
|
+
// Only send analytics for actual clicks, not keyboard navigation
|
|
5784
|
+
if (shouldFocus) {
|
|
5785
|
+
sendAnalytics({
|
|
5786
|
+
category: 'ui-component',
|
|
5787
|
+
tag: this.el.tagName.toLowerCase(),
|
|
5788
|
+
name: (tabLabel === null || tabLabel === void 0 ? void 0 : tabLabel.toLowerCase()) || '',
|
|
5789
|
+
action: 'click'
|
|
5790
|
+
});
|
|
5791
|
+
}
|
|
5792
|
+
// Focus management for keyboard navigation
|
|
5793
|
+
if (shouldFocus && this.tabRefs[index]) {
|
|
5794
|
+
// Use a small timeout to ensure the DOM has updated
|
|
5795
|
+
setTimeout(() => {
|
|
5796
|
+
var _a;
|
|
5797
|
+
(_a = this.tabRefs[index]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
5798
|
+
}, 0);
|
|
5799
|
+
}
|
|
5800
|
+
}
|
|
5801
|
+
onKeyDown(ev, idx) {
|
|
5802
|
+
let newIndex = idx;
|
|
5803
|
+
switch (ev.key) {
|
|
5804
|
+
case 'ArrowRight':
|
|
5805
|
+
newIndex = (idx + 1) % this.parsedTabs.length;
|
|
5806
|
+
ev.preventDefault();
|
|
5807
|
+
break;
|
|
5808
|
+
case 'ArrowLeft':
|
|
5809
|
+
newIndex = (idx - 1 + this.parsedTabs.length) % this.parsedTabs.length;
|
|
5810
|
+
ev.preventDefault();
|
|
5811
|
+
break;
|
|
5812
|
+
case 'Home':
|
|
5813
|
+
newIndex = 0;
|
|
5814
|
+
ev.preventDefault();
|
|
5815
|
+
break;
|
|
5816
|
+
case 'End':
|
|
5817
|
+
newIndex = this.parsedTabs.length - 1;
|
|
5818
|
+
ev.preventDefault();
|
|
5819
|
+
break;
|
|
5820
|
+
default:
|
|
5821
|
+
return; // Don't handle other keys
|
|
5822
|
+
}
|
|
5823
|
+
if (newIndex !== idx) {
|
|
5824
|
+
this.handleTabClick(newIndex, this.parsedTabs[newIndex].label, true);
|
|
5825
|
+
}
|
|
2477
5826
|
}
|
|
2478
5827
|
render() {
|
|
2479
|
-
return (h("div", { key: '
|
|
2480
|
-
const TabComponent =
|
|
5828
|
+
return (h("div", { key: '7cb51cf475d45ee3e43877ee4d42565f5930613a', id: `${this.identifier}` }, h("div", { key: '4f3c6d23f9084f07e5728b72310b96798d20b724', class: "scroller-x overflow-x-auto relative z-[1] mx-auto px-16 pt-8 lg:px-28 after:border-soft before:bg-gradient-y relative overflow-x-hidden before:absolute before:inset-x-0 before:bottom-0 before:h-12 before:opacity-5 before:content-[''] after:absolute after:inset-x-0 after:bottom-0 after:border-b-2 after:content-['']" }, h("nav", { key: '4d55e72e9f437cef8be06931445f619196a973a7', role: "tablist", ref: (el) => (this.tabContainer = el), class: "inline-flex", "aria-label": this.navAriaLabel }, this.parsedTabs.map((tab, index) => {
|
|
5829
|
+
const TabComponent = 'button';
|
|
2481
5830
|
const tabProps = this.getTabOptions(tab.active, index);
|
|
2482
|
-
|
|
2483
|
-
|
|
5831
|
+
const isActive = index === this.activeIndex;
|
|
5832
|
+
return (h(TabComponent, Object.assign({}, tabProps, { type: "button", role: "tab", "aria-selected": tab.active ? 'true' : 'false', tabIndex: isActive ? 0 : -1, "aria-label": tab.ariaLabel || tab.label, "aria-controls": `panel-${index}`, id: `tab-${index}`, ref: (el) => this.setTabRef(el, index), onClick: () => this.handleTabClick(index, tab.label, true), onKeyDown: (e) => this.onKeyDown(e, index) }), tab.label || tab.ariaLabel));
|
|
5833
|
+
}))), h("div", { key: 'e75f877da39c25e912853fea5dc2438fc15c67b5', class: "tab-panels" }, this.parsedTabs.map((_, index) => (h("div", { role: "tabpanel", id: `panel-${index}`, "aria-labelledby": `tab-${index}`, hidden: index !== this.activeIndex, tabIndex: index === this.activeIndex ? 0 : -1, class: "effect-focus" }, h("slot", { name: `panel-${index}` })))))));
|
|
2484
5834
|
}
|
|
2485
5835
|
get el() { return getElement(this); }
|
|
2486
5836
|
static get watchers() { return {
|
|
@@ -2525,7 +5875,7 @@ const EdsTag = class {
|
|
|
2525
5875
|
}
|
|
2526
5876
|
render() {
|
|
2527
5877
|
const classes = tagStyles({ intent: this.intent, size: this.size });
|
|
2528
|
-
return h("span", { key: '
|
|
5878
|
+
return h("span", { key: 'e3fe041e8783a7d1bb5a281eb154e3c07851da38', class: classes }, this.label);
|
|
2529
5879
|
}
|
|
2530
5880
|
};
|
|
2531
5881
|
EdsTag.style = EdsTagStyle0;
|
|
@@ -2601,13 +5951,48 @@ const EdsToast = class {
|
|
|
2601
5951
|
};
|
|
2602
5952
|
EdsToast.style = EdsToastStyle0;
|
|
2603
5953
|
|
|
5954
|
+
const edsTooltipCss = ".relative{position:relative}.absolute{position:absolute}.inline-block{display:inline-block}.rounded-xs{border-radius:4px}.bg-strongest{background-color:var(--black)}.text-inverse{color:var(--white)}.f-ui-03-light{font-family:var(--f-ui-03-light-fontFamily);font-weight:var(--f-ui-03-light-fontWeight);font-size:var(--f-ui-03-light-fontSize);line-height:var(--f-ui-03-light-lineHeight);letter-spacing:var(--f-ui-03-light-letterSpacing)}.pointer-events-none{pointer-events:none}.left-1\\/2{left:50%}.z-10{z-index:10}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-1\\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.whitespace-nowrap{white-space:nowrap}.p-6{padding:0.375rem}.px-4{padding-left:0.25rem;padding-right:0.25rem}.top-full{top:100%}.bottom-full{bottom:100%}.right-full{right:100%}.left-full{left:100%}.mr-2{margin-right:0.125rem}.ml-2{margin-left:0.125rem}.mt-2{margin-top:0.125rem}.mb-2{margin-bottom:0.125rem}.opacity-0{opacity:0}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.duration-150{transition-duration:150ms}.ease-in-out{transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.group:hover .group-hover\\:opacity-100{opacity:1}.max-w-\\[20rem\\]{max-width:20rem}.whitespace-normal{white-space:normal}.break-words{overflow-wrap:break-word}.w-full{width:100%}";
|
|
5955
|
+
const EdsTooltipStyle0 = edsTooltipCss;
|
|
5956
|
+
|
|
5957
|
+
const EdsTooltip = class {
|
|
5958
|
+
constructor(hostRef) {
|
|
5959
|
+
registerInstance(this, hostRef);
|
|
5960
|
+
this.content = undefined;
|
|
5961
|
+
this.position = 'top';
|
|
5962
|
+
}
|
|
5963
|
+
/** fire analytics on every hover */
|
|
5964
|
+
handleHover() {
|
|
5965
|
+
sendAnalytics({
|
|
5966
|
+
category: 'ui-component',
|
|
5967
|
+
tag: this.el.tagName.toLowerCase(),
|
|
5968
|
+
name: this.content.toLowerCase(),
|
|
5969
|
+
action: 'hover'
|
|
5970
|
+
});
|
|
5971
|
+
}
|
|
5972
|
+
render() {
|
|
5973
|
+
const positionClass = this.position === 'bottom' ? 'top-full mt-2' : 'bottom-full mb-2';
|
|
5974
|
+
return (h("div", { key: '135df7d17db03fb3bb7bbcc50ad9ee5d84a2bca2', class: "relative w-full inline-block group" }, h("slot", { key: '4c12874eeb942e33f9c62ea6f1077fd051f683b6' }), h("div", { key: '8bb7173d16889b2ae550dc0269d9e47e1dae00ac', class: `absolute ${positionClass}
|
|
5975
|
+
rounded-xs bg-strongest text-inverse
|
|
5976
|
+
f-ui-03-light pointer-events-none
|
|
5977
|
+
z-10 px-4 opacity-0 transition-opacity duration-150 ease-in-out
|
|
5978
|
+
group-hover:opacity-100 whitespace-normal break-words`, role: "tooltip" }, this.content)));
|
|
5979
|
+
}
|
|
5980
|
+
get el() { return getElement(this); }
|
|
5981
|
+
};
|
|
5982
|
+
EdsTooltip.style = EdsTooltipStyle0;
|
|
5983
|
+
|
|
2604
5984
|
const edsUserCss = "hr,p{margin:0}.block{display:block}.flex{display:flex}.flex-col{flex-direction:column}.items-center{align-items:center}.text-default{color:var(--black)}.min-w-\\[280px\\]{min-width:280px}.p-8{padding:0.5rem}.gap-x-16{-moz-column-gap:1rem;column-gap:1rem}.gap-y-8{row-gap:0.5rem}.pb-16{padding-bottom:1rem}.border-b-2{border-bottom-width:2px}.border-softer{border-color:rgba(0, 0, 0, .1 )}.max-w-full{max-width:100%}.w-full{width:100%}.f-ui-01{font-family:var(--f-ui-01-fontFamily);font-weight:var(--f-ui-01-fontWeight);font-size:var(--f-ui-01-fontSize);line-height:var(--f-ui-01-lineHeight);letter-spacing:var(--f-ui-01-letterSpacing)}.f-ui-03-light{font-family:var(--f-ui-03-light-fontFamily);font-weight:var(--f-ui-03-light-fontWeight);font-size:var(--f-ui-03-light-fontSize);line-height:var(--f-ui-03-light-lineHeight);letter-spacing:var(--f-ui-03-light-letterSpacing)}.text-light{color:var(--grey-700)}.mt-4{margin-top:0.25rem}.mt-16{margin-top:1rem}";
|
|
2605
5985
|
const EdsUserStyle0 = edsUserCss;
|
|
2606
5986
|
|
|
2607
5987
|
const EdsUser = class {
|
|
2608
5988
|
constructor(hostRef) {
|
|
2609
5989
|
registerInstance(this, hostRef);
|
|
5990
|
+
this.handleDropdown = (e) => {
|
|
5991
|
+
this.expanded = e.detail.expanded;
|
|
5992
|
+
};
|
|
2610
5993
|
this.user = undefined;
|
|
5994
|
+
this.intent = 'tertiary';
|
|
5995
|
+
this.expanded = false;
|
|
2611
5996
|
}
|
|
2612
5997
|
/**
|
|
2613
5998
|
* Helper getter to ensure we work with a User object.
|
|
@@ -2633,10 +6018,11 @@ const EdsUser = class {
|
|
|
2633
6018
|
}
|
|
2634
6019
|
render() {
|
|
2635
6020
|
const user = this.parsedUser;
|
|
2636
|
-
|
|
6021
|
+
const iconName = this.expanded ? 'chevron-down' : 'chevron-right';
|
|
6022
|
+
return (h("div", { key: '965387104c4bd6cd3223c08f16d90146c098594c', class: "block" }, h("div", { key: '37fe5539cb058112ebe0d910439acb55b5abccd8', class: "flex items-center" }, h("eds-dropdown", { key: '17afc8dbae191aec1202ba04d85c41ed656a8c5b', label: `Hi, ${user.preferred_username}`, intent: this.intent, "aria-label": "User Menu", "dropdown-pos": "right", "dropdown-offset": "false", icon: iconName, class: "text-default", onDropdown: this.handleDropdown }, h("div", { key: '0228c1728b0b73e2504d2608339f9be408be09b8', class: "min-w-[280px] p-8" }, h("div", { key: 'b83148ff8249bde91842b036da5506f9f5cbb145', class: "flex gap-x-16" }, h("eds-avatar", { key: '243a05bae2e4e592dc386b1897d824232d0bcfa6', "first-name": user.given_name, "last-name": user.family_name, initials: this.initials, color: "black" }), h("div", { key: '6938f54621aa89e61aa6639e8c88af4e262e0fec', class: "max-w-full" }, user.name && h("p", { key: '224ce5cf6819a9dd0c3794410a94da30cc4213bf', class: "f-ui-01 text-default w-full text-ellipsis" }, user.name), user.preferred_username && h("p", { key: '096ac761149763ef4305ef5e9bf1f4b593a0fe4f', class: "f-ui-03-light text-light mt-4" }, user.preferred_username), user.email && h("p", { key: '79f7da3c6c5efc1f521991c403184cf050b3d2e7', class: "f-ui-03-light text-light mt-4" }, user.email))), h("div", { key: '52ce98bcc290902605ebd427ee8ab72ac9af3d62', class: "text-default flex w-full flex-col gap-y-8" }, h("slot", { key: '88d1b250c434830347e0eb813214382ce899c485' })))))));
|
|
2637
6023
|
}
|
|
2638
6024
|
get hostEl() { return getElement(this); }
|
|
2639
6025
|
};
|
|
2640
6026
|
EdsUser.style = EdsUserStyle0;
|
|
2641
6027
|
|
|
2642
|
-
export { EdsAvatar as eds_avatar, EdsBlockBreak as eds_block_break, EdsButton as eds_button, EdsDropdown as eds_dropdown, EdsForm as eds_form, EdsHeader as eds_header, EdsIconWrapper as eds_icon_wrapper, EdsImg as eds_img, EdsInput as eds_input, EdsInputField as eds_input_field, EdsInputFooter as eds_input_footer, EdsInputLabel as eds_input_label, EdsInputRange as eds_input_range, EdsInputSearch as eds_input_search, EdsInputSelect as eds_input_select, EdsLink as eds_link, EdsLogo as eds_logo, EdsPagination as eds_pagination, EdsRating as eds_rating, EdsSteps as eds_steps, EdsStepsV2 as eds_steps_v2, EdsTable as eds_table, EdsTabs as eds_tabs, EdsTag as eds_tag, EdsToast as eds_toast, EdsUser as eds_user };
|
|
6028
|
+
export { EdsAccordion as eds_accordion, EdsAlert as eds_alert, EdsAvatar as eds_avatar, EdsBlockBreak as eds_block_break, EdsBreadcrumb as eds_breadcrumb, EdsButton as eds_button, EdsCodeBlock as eds_code_block, EdsDropdown as eds_dropdown, EdsForm as eds_form, EdsHeader as eds_header, EdsIconWrapper as eds_icon_wrapper, EdsImg as eds_img, EdsInput as eds_input, EdsInputField as eds_input_field, EdsInputFooter as eds_input_footer, EdsInputLabel as eds_input_label, EdsInputRange as eds_input_range, EdsInputSearch as eds_input_search, EdsInputSelect as eds_input_select, EdsLink as eds_link, EdsLogo as eds_logo, EdsMatomoNotice as eds_matomo_notice, EdsNps as eds_nps, EdsPagination as eds_pagination, EdsRating as eds_rating, EdsSteps as eds_steps, EdsStepsV2 as eds_steps_v2, EdsSwitch as eds_switch, EdsTable as eds_table, EdsTabs as eds_tabs, EdsTag as eds_tag, EdsToast as eds_toast, EdsTooltip as eds_tooltip, EdsUser as eds_user };
|