@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
|
@@ -2,13 +2,198 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-0249a32e.js');
|
|
6
6
|
const analytics = require('./analytics-28713bf7.js');
|
|
7
7
|
const index$1 = require('./index-ab9fbefe.js');
|
|
8
8
|
const sharedUtils = require('./sharedUtils-8e287250.js');
|
|
9
9
|
const logoColor = require('./logo-color-6c787ac1.js');
|
|
10
10
|
const logoWhiteNoBg = require('./logo-white-no-bg-4a0e0f4b.js');
|
|
11
11
|
|
|
12
|
+
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}";
|
|
13
|
+
const EdsAccordionStyle0 = edsAccordionCss;
|
|
14
|
+
|
|
15
|
+
const EdsAccordion = class {
|
|
16
|
+
constructor(hostRef) {
|
|
17
|
+
index.registerInstance(this, hostRef);
|
|
18
|
+
this.accordion = index.createEvent(this, "accordion", 7);
|
|
19
|
+
/**
|
|
20
|
+
* Handles the click event on the accordion header to toggle expansion.
|
|
21
|
+
* Toggles the `isExpanded` state and emits the `accordion` event.
|
|
22
|
+
*/
|
|
23
|
+
this.handleClick = () => {
|
|
24
|
+
var _a;
|
|
25
|
+
this.isExpanded = !this.isExpanded;
|
|
26
|
+
this.accordion.emit(this.isExpanded);
|
|
27
|
+
this.setPanelHeight();
|
|
28
|
+
analytics.sendAnalytics({
|
|
29
|
+
category: 'ui-component',
|
|
30
|
+
parentContext: null,
|
|
31
|
+
tag: this.el.tagName.toLowerCase(),
|
|
32
|
+
name: ((_a = this.heading) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '',
|
|
33
|
+
action: this.isExpanded ? 'expanded' : 'collapsed'
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Calculates and sets the panel height based on the content height
|
|
38
|
+
* and adjusts based on the `shortContent` and `isExpanded` states.
|
|
39
|
+
*/
|
|
40
|
+
this.setPanelHeight = () => {
|
|
41
|
+
if (this.childContentRef) {
|
|
42
|
+
this.shortContent =
|
|
43
|
+
this.wrapperRef.scrollWidth > 830 && !this.description
|
|
44
|
+
? this.childContentRef.scrollHeight <= 80
|
|
45
|
+
: this.childContentRef.scrollHeight <= 20;
|
|
46
|
+
this.panelHeight = this.isExpanded && !this.shortContent ? this.childContentRef.scrollHeight : 0;
|
|
47
|
+
}
|
|
48
|
+
if (this.headerRef) {
|
|
49
|
+
this.headerHeight = this.headerRef.scrollHeight - 30;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
this.heading = undefined;
|
|
53
|
+
this.description = undefined;
|
|
54
|
+
this.switchBg = true;
|
|
55
|
+
this.expanded = false;
|
|
56
|
+
this.clampText = true;
|
|
57
|
+
this.buttonIntent = 'tertiary';
|
|
58
|
+
this.isExpanded = this.expanded;
|
|
59
|
+
this.panelHeight = 0;
|
|
60
|
+
this.shortContent = false;
|
|
61
|
+
this.headerHeight = 0;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Lifecycle method that sets up the initial panel height and adds a resize event listener
|
|
65
|
+
* to recalculate height on window resize.
|
|
66
|
+
*/
|
|
67
|
+
componentDidLoad() {
|
|
68
|
+
this.setPanelHeight();
|
|
69
|
+
window.addEventListener('resize', this.setPanelHeight);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Lifecycle method that cleans up the resize event listener when the component is removed.
|
|
73
|
+
*/
|
|
74
|
+
disconnectedCallback() {
|
|
75
|
+
window.removeEventListener('resize', this.setPanelHeight);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Renders the accordion structure, including header, content, description, and any slotted content.
|
|
79
|
+
* Adjusts styles based on `switchBg`, `tiny`, `clampText`, and other props.
|
|
80
|
+
*/
|
|
81
|
+
render() {
|
|
82
|
+
return (index.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
|
|
83
|
+
${this.switchBg && this.isExpanded ? 'bg-inverse' : 'bg-default'}
|
|
84
|
+
${this.switchBg ? 'hover:bg-inverse' : ''}
|
|
85
|
+
${this.description ? 'min-h-56' : ''}` }, index.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), index.h("div", { key: '0fc6d493fd61726a53a8c4311bd183eb3ad5b270', class: "ml-auto" }, index.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" })), index.h("div", { key: '084bfb116dcccadf7253ca8ac8de6a1e1d4aa41f', class: `w-full`, style: Number.isFinite(this.headerHeight) ? { marginTop: `${this.headerHeight}px` } : {} }, this.description ? (index.h("span", { class: `text-light ${!this.isExpanded && this.clampText ? 'line-clamp-1' : ''}` }, this.description)) : null, index.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' } }, index.h("div", { key: '842bc3bc7a968ef5a428a97327f38253e8a32888', ref: (el) => (this.childContentRef = el), class: `accordion-content effect-color pt-4`, "aria-hidden": !this.isExpanded }, index.h("span", { key: '7c8fa8040da18cc2c128b42cdf9e75bfffe4c439', class: `${!this.isExpanded && this.clampText ? 'line-clamp-2' : ''}` }, index.h("slot", { key: '852837c0c8c9d8a36f6263f7a943f50d82563a3c' })))))));
|
|
86
|
+
}
|
|
87
|
+
get el() { return index.getElement(this); }
|
|
88
|
+
};
|
|
89
|
+
EdsAccordion.style = EdsAccordionStyle0;
|
|
90
|
+
|
|
91
|
+
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}";
|
|
92
|
+
const EdsAlertStyle0 = edsAlertCss;
|
|
93
|
+
|
|
94
|
+
const alertStyles = index$1.cva(['w-full bg-dark'], {
|
|
95
|
+
variants: {
|
|
96
|
+
intent: {
|
|
97
|
+
default: '',
|
|
98
|
+
warning: 'bg-warning',
|
|
99
|
+
error: 'bg-error',
|
|
100
|
+
success: 'bg-success'
|
|
101
|
+
},
|
|
102
|
+
brd: {
|
|
103
|
+
rounded: 'rounded-lg border-inside after:border-softest after:rounded-lg',
|
|
104
|
+
normal: ''
|
|
105
|
+
},
|
|
106
|
+
direction: {
|
|
107
|
+
vertical: 'space-y-12',
|
|
108
|
+
horizontal: 'flex flex-row items-center justify-between gap-x-12'
|
|
109
|
+
},
|
|
110
|
+
withBtn: {
|
|
111
|
+
false: '',
|
|
112
|
+
true: ''
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
compoundVariants: [
|
|
116
|
+
{
|
|
117
|
+
direction: 'horizontal',
|
|
118
|
+
withBtn: true,
|
|
119
|
+
class: 'px-20 pr-12 py-12'
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
direction: 'horizontal',
|
|
123
|
+
withBtn: false,
|
|
124
|
+
class: 'p-20'
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
direction: 'vertical',
|
|
128
|
+
withBtn: true,
|
|
129
|
+
class: 'p-16'
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
direction: 'vertical',
|
|
133
|
+
withBtn: false,
|
|
134
|
+
class: 'px-12 py-20'
|
|
135
|
+
}
|
|
136
|
+
],
|
|
137
|
+
defaultVariants: {
|
|
138
|
+
intent: 'default',
|
|
139
|
+
brd: 'rounded',
|
|
140
|
+
direction: 'horizontal'
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
const EdsAlert = class {
|
|
144
|
+
constructor(hostRef) {
|
|
145
|
+
index.registerInstance(this, hostRef);
|
|
146
|
+
this.edsalert = index.createEvent(this, "edsalert", 7);
|
|
147
|
+
this.message = undefined;
|
|
148
|
+
this.pressableLabel = undefined;
|
|
149
|
+
this.pressableUrl = undefined;
|
|
150
|
+
this.direction = 'horizontal';
|
|
151
|
+
this.intent = 'default';
|
|
152
|
+
this.brd = 'rounded';
|
|
153
|
+
this.withBtn = false;
|
|
154
|
+
}
|
|
155
|
+
componentWillLoad() {
|
|
156
|
+
this.withBtn = Boolean(this.pressableLabel);
|
|
157
|
+
}
|
|
158
|
+
componentDidLoad() {
|
|
159
|
+
// Focus the alert container for immediate screen reader announcement
|
|
160
|
+
/*if (this.intent === 'error' || this.intent === 'warning') {
|
|
161
|
+
this.el.shadowRoot?.querySelector('[role="alert"]')?.setAttribute('tabindex', '-1');
|
|
162
|
+
(this.el.shadowRoot?.querySelector('[role="alert"]') as HTMLElement)?.focus();
|
|
163
|
+
}*/
|
|
164
|
+
var _a;
|
|
165
|
+
// Query for the 'eds-link' element inside the shadow root.
|
|
166
|
+
const lnk = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('eds-link');
|
|
167
|
+
if (lnk) {
|
|
168
|
+
this.emitContext(lnk);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
emitContext(linkElement) {
|
|
172
|
+
const event = new CustomEvent('parentContext', {
|
|
173
|
+
detail: {
|
|
174
|
+
componentName: this.el.tagName.toLowerCase(),
|
|
175
|
+
identifier: null
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
linkElement.dispatchEvent(event);
|
|
179
|
+
}
|
|
180
|
+
handleAction() {
|
|
181
|
+
// Emit the alertAction event for parent components to handle
|
|
182
|
+
this.edsalert.emit();
|
|
183
|
+
}
|
|
184
|
+
render() {
|
|
185
|
+
const ariaLabel = this.intent !== 'default' ? `${this.intent} alert` : 'alert';
|
|
186
|
+
return (index.h("div", { key: '2d22944e7ae86cf2523c194e20215a3d986083d9', class: alertStyles({
|
|
187
|
+
intent: this.intent,
|
|
188
|
+
brd: this.brd,
|
|
189
|
+
direction: this.direction,
|
|
190
|
+
withBtn: this.withBtn
|
|
191
|
+
}), role: "alert", "aria-label": ariaLabel, "aria-live": this.intent === 'error' ? 'assertive' : 'polite', "aria-labelledby": "alert-message", "aria-describedby": this.withBtn ? 'alert-action' : undefined }, index.h("p", { key: 'b6c22446b0d87fb01a3cb882fe205ef48ea60b05', id: "alert-message", class: "f-ui-01 py-8", innerHTML: this.message }), this.withBtn && (index.h("div", { key: '8414820eb7b65c83459cfb90adef3ea696e42444', id: "alert-action" }, this.pressableUrl ? (index.h("eds-link", { class: "eds-alert-link", label: this.pressableLabel, url: this.pressableUrl, intent: "secondary", external: true })) : (index.h("eds-button", { class: "eds-alert-button", label: this.pressableLabel, intent: "secondary", onClick: () => this.handleAction() }))))));
|
|
192
|
+
}
|
|
193
|
+
get el() { return index.getElement(this); }
|
|
194
|
+
};
|
|
195
|
+
EdsAlert.style = EdsAlertStyle0;
|
|
196
|
+
|
|
12
197
|
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}";
|
|
13
198
|
const EdsAvatarStyle0 = edsAvatarCss;
|
|
14
199
|
|
|
@@ -66,7 +251,7 @@ const EdsAvatar = class {
|
|
|
66
251
|
* @returns {JSX.Element} The rendered avatar component.
|
|
67
252
|
*/
|
|
68
253
|
render() {
|
|
69
|
-
return (index.h("div", { key: '
|
|
254
|
+
return (index.h("div", { key: '34e86e50b1176efd8ae0cd9b30cd3823527d7eee', class: this.containerClasses }, this.picture ? (index.h("eds-img", { src: this.picture, width: 54, height: 54, sizes: "120px", alt: `${this.firstName} ${this.lastName}`, lazyload: true, withBg: true })) : (index.h("abbr", { title: this.computedInitials || `${this.firstName} ${this.lastName}`, class: "!no-underline f-ui-01" }, this.computedInitials))));
|
|
70
255
|
}
|
|
71
256
|
};
|
|
72
257
|
EdsAvatar.style = EdsAvatarStyle0;
|
|
@@ -80,12 +265,149 @@ const EdsBlockBreak = class {
|
|
|
80
265
|
this.inverse = false;
|
|
81
266
|
}
|
|
82
267
|
render() {
|
|
83
|
-
return index.h("hr", { key: '
|
|
268
|
+
return index.h("hr", { key: '688e11c730af1193f28db196cd144c6dd2efc3c6', class: `${this.inverse ? 'border-default' : 'border-softer'} my-16 inline-block w-full border-t-2` });
|
|
84
269
|
}
|
|
85
270
|
};
|
|
86
271
|
EdsBlockBreak.style = EdsBlockBreakStyle0;
|
|
87
272
|
|
|
88
|
-
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}";
|
|
273
|
+
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}}";
|
|
274
|
+
const EdsBreadcrumbStyle0 = edsBreadcrumbCss;
|
|
275
|
+
|
|
276
|
+
const EdsBreadcrumb = class {
|
|
277
|
+
constructor(hostRef) {
|
|
278
|
+
index.registerInstance(this, hostRef);
|
|
279
|
+
/**
|
|
280
|
+
* Updates the maximum number of visible items and tracks if the screen is small.
|
|
281
|
+
*/
|
|
282
|
+
this.updateScreenSize = () => {
|
|
283
|
+
const width = window.innerWidth;
|
|
284
|
+
if (width < 769) {
|
|
285
|
+
this.maxVisibleItems = 3;
|
|
286
|
+
}
|
|
287
|
+
else if (width <= 1024) {
|
|
288
|
+
this.maxVisibleItems = 3;
|
|
289
|
+
}
|
|
290
|
+
else if (width <= 1280) {
|
|
291
|
+
this.maxVisibleItems = 3;
|
|
292
|
+
}
|
|
293
|
+
else if (width <= 2200) {
|
|
294
|
+
this.maxVisibleItems = 4;
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
this.maxVisibleItems = 6;
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
this.items = [];
|
|
301
|
+
this.intent = 'ghost';
|
|
302
|
+
this.parsedItems = [];
|
|
303
|
+
this.isSmallScreen = false;
|
|
304
|
+
this.maxVisibleItems = 6;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Watches for changes to the `items` prop and parses it.
|
|
308
|
+
*/
|
|
309
|
+
parseItems(newValue) {
|
|
310
|
+
this.parsedItems = sharedUtils.parseData(newValue);
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Lifecycle method that runs when the component is about to be loaded.
|
|
314
|
+
* It parses the initial `items` prop value.
|
|
315
|
+
*/
|
|
316
|
+
componentWillLoad() {
|
|
317
|
+
this.parseItems(this.items);
|
|
318
|
+
this.updateScreenSize();
|
|
319
|
+
window.addEventListener('resize', this.updateScreenSize);
|
|
320
|
+
}
|
|
321
|
+
disconnectedCallback() {
|
|
322
|
+
window.removeEventListener('resize', this.updateScreenSize);
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Lifecycle method that runs when the component has fully loaded.
|
|
326
|
+
* It emits a custom event for each `eds-link` element contained within the breadcrumb.
|
|
327
|
+
*/
|
|
328
|
+
componentDidLoad() {
|
|
329
|
+
var _a;
|
|
330
|
+
const links = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('eds-link');
|
|
331
|
+
links === null || links === void 0 ? void 0 : links.forEach((link) => {
|
|
332
|
+
this.emitContext(link);
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Emits a custom event called `parentContext` for a given link element.
|
|
337
|
+
* This event provides context information about the breadcrumb component.
|
|
338
|
+
*
|
|
339
|
+
* @param linkElement - The link element to which the event will be dispatched.
|
|
340
|
+
*/
|
|
341
|
+
emitContext(linkElement) {
|
|
342
|
+
const event = new CustomEvent('parentContext', {
|
|
343
|
+
detail: {
|
|
344
|
+
componentName: this.el.tagName.toLowerCase(),
|
|
345
|
+
identifier: null
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
linkElement.dispatchEvent(event);
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Returns breadcrumb items with potential truncation if there are too many.
|
|
352
|
+
* It inserts an ellipsis item where necessary.
|
|
353
|
+
*/
|
|
354
|
+
getTruncatedItems() {
|
|
355
|
+
const totalItems = this.parsedItems.length;
|
|
356
|
+
const ellipsis = { label: '...', url: '', isHidden: true };
|
|
357
|
+
if (totalItems > this.maxVisibleItems) {
|
|
358
|
+
const firstItem = this.parsedItems[0];
|
|
359
|
+
const lastItems = this.parsedItems.slice(-2);
|
|
360
|
+
if (this.maxVisibleItems === 3) {
|
|
361
|
+
return [firstItem, ellipsis, ...lastItems];
|
|
362
|
+
}
|
|
363
|
+
else if (this.maxVisibleItems === 4) {
|
|
364
|
+
const middleItem = this.parsedItems[Math.floor(totalItems / 2)];
|
|
365
|
+
return [firstItem, middleItem, ellipsis, ...lastItems];
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
return this.parsedItems;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Helper to determine the display label and full label.
|
|
372
|
+
* If the label is longer than 15 characters and the item is not the current (last) item,
|
|
373
|
+
* we display a truncated version but use the full label for aria attributes.
|
|
374
|
+
*/
|
|
375
|
+
getLabels(item, isCurrent) {
|
|
376
|
+
if (!isCurrent && item.label.length > 15) {
|
|
377
|
+
return { displayLabel: `${item.label.slice(0, 15)}...`, fullLabel: item.label };
|
|
378
|
+
}
|
|
379
|
+
return { displayLabel: item.label, fullLabel: item.label };
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Render method for the breadcrumb component.
|
|
383
|
+
* It creates a navigation element with an ordered list of breadcrumb links.
|
|
384
|
+
* The last link is marked as the current page.
|
|
385
|
+
*/
|
|
386
|
+
render() {
|
|
387
|
+
const itemsToRender = this.getTruncatedItems();
|
|
388
|
+
return (index.h("nav", { key: '0625a234ec9f5095abbeaafa11e56bceb0432764', "aria-label": "Breadcrumb" }, index.h("ol", { key: '3898a4b048eca6c606a6948b26ec25a608cb908e', class: "flex items-center space-x-2" }, itemsToRender.map((item, index$1) => {
|
|
389
|
+
const isLast = index$1 === itemsToRender.length - 1;
|
|
390
|
+
return (index.h("li", { class: "flex items-center" }, !item.isHidden ? ((() => {
|
|
391
|
+
const { fullLabel } = this.getLabels(item, isLast);
|
|
392
|
+
const linkIntent = isLast
|
|
393
|
+
? this.intent === 'strong'
|
|
394
|
+
? 'weak'
|
|
395
|
+
: this.intent === 'weak'
|
|
396
|
+
? 'strong'
|
|
397
|
+
: this.intent
|
|
398
|
+
: this.intent;
|
|
399
|
+
return (index.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' } : {}))));
|
|
400
|
+
})()) : (index.h("eds-link", { label: "...", url: "#", intent: "strong", current: false, "aria-label": "...", size: "small", "icon-small": "false", icon: "chevron-right" })), !isLast && !item.isHidden && (index.h("eds-icon-wrapper", { icon: "chevron-right", class: "w-20 h-20" }))));
|
|
401
|
+
}))));
|
|
402
|
+
}
|
|
403
|
+
get el() { return index.getElement(this); }
|
|
404
|
+
static get watchers() { return {
|
|
405
|
+
"items": ["parseItems"]
|
|
406
|
+
}; }
|
|
407
|
+
};
|
|
408
|
+
EdsBreadcrumb.style = EdsBreadcrumbStyle0;
|
|
409
|
+
|
|
410
|
+
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}";
|
|
89
411
|
const EdsButtonStyle0 = edsButtonCss;
|
|
90
412
|
|
|
91
413
|
const EdsButton = class {
|
|
@@ -105,7 +427,7 @@ const EdsButton = class {
|
|
|
105
427
|
secondary: 'border-inside border-inside-inverse text-inverse bg-strongest hover:bg-strong-dark',
|
|
106
428
|
tertiary: 'border-inside after:border-softest bg-dark hover:bg-darker',
|
|
107
429
|
ghost: 'border-inside hover:bg-darker',
|
|
108
|
-
ghostInverse: 'border-inside hover:bg-dark'
|
|
430
|
+
ghostInverse: 'border-inside text-lightest hover:bg-dark'
|
|
109
431
|
},
|
|
110
432
|
loading: {
|
|
111
433
|
true: 'pointer-events-none',
|
|
@@ -215,8 +537,7 @@ const EdsButton = class {
|
|
|
215
537
|
}
|
|
216
538
|
handleClick(event) {
|
|
217
539
|
var _a, _b;
|
|
218
|
-
if (this.disabled) {
|
|
219
|
-
// Prevent navigation if the link is disabled
|
|
540
|
+
if (this.disabled || this.loading) {
|
|
220
541
|
event.preventDefault();
|
|
221
542
|
return;
|
|
222
543
|
}
|
|
@@ -232,6 +553,16 @@ const EdsButton = class {
|
|
|
232
553
|
this.triggerClick(); // Trigger the passed-in function
|
|
233
554
|
}
|
|
234
555
|
}
|
|
556
|
+
handleKeyDown(event) {
|
|
557
|
+
if (this.disabled || this.loading) {
|
|
558
|
+
// Fix: check loading too
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
if (event.key === 'Enter' || (this.elementType === 'a' && event.key === ' ')) {
|
|
562
|
+
event.preventDefault();
|
|
563
|
+
this.handleClick(event);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
235
566
|
render() {
|
|
236
567
|
const classes = this.button({
|
|
237
568
|
intent: this.intent,
|
|
@@ -243,18 +574,2502 @@ const EdsButton = class {
|
|
|
243
574
|
iconSmall: this.iconSmall
|
|
244
575
|
});
|
|
245
576
|
const ElementType = this.elementType;
|
|
246
|
-
|
|
577
|
+
const isInteractive = !this.disabled && !this.loading;
|
|
578
|
+
return (index.h(index.Host, { key: '835cc81d3563abf1b5cb4c21165de1ef726d1e43' }, index.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 && (index.h("span", { key: '27c7473403e7c1bfd3dfc270151d44dbb639ceb3', class: this.loading ? 'opacity-0' : '', "aria-hidden": this.loading ? 'true' : undefined }, this.label)), this.loading && (index.h("span", { key: 'f52496884816bc299fb76c1afae5e4798bf642d2', class: "absolute inset-0 flex items-center justify-center", "aria-hidden": "true" }, index.h("span", { key: 'd42bf2c229f6956a1e0dbe64aa6c79ad5608ca5c', class: "loader", style: {
|
|
247
579
|
border: `3px solid ${this.intent === 'secondary' ? 'rgba(255, 255, 255, .3)' : 'rgba(0, 0, 0, .3)'}`,
|
|
248
580
|
borderBottomColor: this.intent === 'secondary' ? '#fff' : '#000'
|
|
249
581
|
} }))), this.icon ? (index.h("eds-icon-wrapper", { class: `
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
582
|
+
flex inline-flex items-center justify-center
|
|
583
|
+
${this.size === 'large' ? 'h-24 w-24' : 'h-20 w-20'}
|
|
584
|
+
`, icon: this.icon, "aria-hidden": "true" })) : null)));
|
|
253
585
|
}
|
|
586
|
+
static get delegatesFocus() { return true; }
|
|
254
587
|
get el() { return index.getElement(this); }
|
|
255
588
|
};
|
|
256
589
|
EdsButton.style = EdsButtonStyle0;
|
|
257
590
|
|
|
591
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
592
|
+
|
|
593
|
+
var prism = {exports: {}};
|
|
594
|
+
|
|
595
|
+
(function (module) {
|
|
596
|
+
/* **********************************************
|
|
597
|
+
Begin prism-core.js
|
|
598
|
+
********************************************** */
|
|
599
|
+
|
|
600
|
+
/// <reference lib="WebWorker"/>
|
|
601
|
+
|
|
602
|
+
var _self = (typeof window !== 'undefined')
|
|
603
|
+
? window // if in browser
|
|
604
|
+
: (
|
|
605
|
+
(typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope)
|
|
606
|
+
? self // if in worker
|
|
607
|
+
: {} // if in node js
|
|
608
|
+
);
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
612
|
+
*
|
|
613
|
+
* @license MIT <https://opensource.org/licenses/MIT>
|
|
614
|
+
* @author Lea Verou <https://lea.verou.me>
|
|
615
|
+
* @namespace
|
|
616
|
+
* @public
|
|
617
|
+
*/
|
|
618
|
+
var Prism = (function (_self) {
|
|
619
|
+
|
|
620
|
+
// Private helper vars
|
|
621
|
+
var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i;
|
|
622
|
+
var uniqueId = 0;
|
|
623
|
+
|
|
624
|
+
// The grammar object for plaintext
|
|
625
|
+
var plainTextGrammar = {};
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
var _ = {
|
|
629
|
+
/**
|
|
630
|
+
* By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the
|
|
631
|
+
* current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load
|
|
632
|
+
* additional languages or plugins yourself.
|
|
633
|
+
*
|
|
634
|
+
* By setting this value to `true`, Prism will not automatically highlight all code elements on the page.
|
|
635
|
+
*
|
|
636
|
+
* You obviously have to change this value before the automatic highlighting started. To do this, you can add an
|
|
637
|
+
* empty Prism object into the global scope before loading the Prism script like this:
|
|
638
|
+
*
|
|
639
|
+
* ```js
|
|
640
|
+
* window.Prism = window.Prism || {};
|
|
641
|
+
* Prism.manual = true;
|
|
642
|
+
* // add a new <script> to load Prism's script
|
|
643
|
+
* ```
|
|
644
|
+
*
|
|
645
|
+
* @default false
|
|
646
|
+
* @type {boolean}
|
|
647
|
+
* @memberof Prism
|
|
648
|
+
* @public
|
|
649
|
+
*/
|
|
650
|
+
manual: _self.Prism && _self.Prism.manual,
|
|
651
|
+
/**
|
|
652
|
+
* By default, if Prism is in a web worker, it assumes that it is in a worker it created itself, so it uses
|
|
653
|
+
* `addEventListener` to communicate with its parent instance. However, if you're using Prism manually in your
|
|
654
|
+
* own worker, you don't want it to do this.
|
|
655
|
+
*
|
|
656
|
+
* By setting this value to `true`, Prism will not add its own listeners to the worker.
|
|
657
|
+
*
|
|
658
|
+
* You obviously have to change this value before Prism executes. To do this, you can add an
|
|
659
|
+
* empty Prism object into the global scope before loading the Prism script like this:
|
|
660
|
+
*
|
|
661
|
+
* ```js
|
|
662
|
+
* window.Prism = window.Prism || {};
|
|
663
|
+
* Prism.disableWorkerMessageHandler = true;
|
|
664
|
+
* // Load Prism's script
|
|
665
|
+
* ```
|
|
666
|
+
*
|
|
667
|
+
* @default false
|
|
668
|
+
* @type {boolean}
|
|
669
|
+
* @memberof Prism
|
|
670
|
+
* @public
|
|
671
|
+
*/
|
|
672
|
+
disableWorkerMessageHandler: _self.Prism && _self.Prism.disableWorkerMessageHandler,
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* A namespace for utility methods.
|
|
676
|
+
*
|
|
677
|
+
* All function in this namespace that are not explicitly marked as _public_ are for __internal use only__ and may
|
|
678
|
+
* change or disappear at any time.
|
|
679
|
+
*
|
|
680
|
+
* @namespace
|
|
681
|
+
* @memberof Prism
|
|
682
|
+
*/
|
|
683
|
+
util: {
|
|
684
|
+
encode: function encode(tokens) {
|
|
685
|
+
if (tokens instanceof Token) {
|
|
686
|
+
return new Token(tokens.type, encode(tokens.content), tokens.alias);
|
|
687
|
+
} else if (Array.isArray(tokens)) {
|
|
688
|
+
return tokens.map(encode);
|
|
689
|
+
} else {
|
|
690
|
+
return tokens.replace(/&/g, '&').replace(/</g, '<').replace(/\u00a0/g, ' ');
|
|
691
|
+
}
|
|
692
|
+
},
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Returns the name of the type of the given value.
|
|
696
|
+
*
|
|
697
|
+
* @param {any} o
|
|
698
|
+
* @returns {string}
|
|
699
|
+
* @example
|
|
700
|
+
* type(null) === 'Null'
|
|
701
|
+
* type(undefined) === 'Undefined'
|
|
702
|
+
* type(123) === 'Number'
|
|
703
|
+
* type('foo') === 'String'
|
|
704
|
+
* type(true) === 'Boolean'
|
|
705
|
+
* type([1, 2]) === 'Array'
|
|
706
|
+
* type({}) === 'Object'
|
|
707
|
+
* type(String) === 'Function'
|
|
708
|
+
* type(/abc+/) === 'RegExp'
|
|
709
|
+
*/
|
|
710
|
+
type: function (o) {
|
|
711
|
+
return Object.prototype.toString.call(o).slice(8, -1);
|
|
712
|
+
},
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Returns a unique number for the given object. Later calls will still return the same number.
|
|
716
|
+
*
|
|
717
|
+
* @param {Object} obj
|
|
718
|
+
* @returns {number}
|
|
719
|
+
*/
|
|
720
|
+
objId: function (obj) {
|
|
721
|
+
if (!obj['__id']) {
|
|
722
|
+
Object.defineProperty(obj, '__id', { value: ++uniqueId });
|
|
723
|
+
}
|
|
724
|
+
return obj['__id'];
|
|
725
|
+
},
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* Creates a deep clone of the given object.
|
|
729
|
+
*
|
|
730
|
+
* The main intended use of this function is to clone language definitions.
|
|
731
|
+
*
|
|
732
|
+
* @param {T} o
|
|
733
|
+
* @param {Record<number, any>} [visited]
|
|
734
|
+
* @returns {T}
|
|
735
|
+
* @template T
|
|
736
|
+
*/
|
|
737
|
+
clone: function deepClone(o, visited) {
|
|
738
|
+
visited = visited || {};
|
|
739
|
+
|
|
740
|
+
var clone; var id;
|
|
741
|
+
switch (_.util.type(o)) {
|
|
742
|
+
case 'Object':
|
|
743
|
+
id = _.util.objId(o);
|
|
744
|
+
if (visited[id]) {
|
|
745
|
+
return visited[id];
|
|
746
|
+
}
|
|
747
|
+
clone = /** @type {Record<string, any>} */ ({});
|
|
748
|
+
visited[id] = clone;
|
|
749
|
+
|
|
750
|
+
for (var key in o) {
|
|
751
|
+
if (o.hasOwnProperty(key)) {
|
|
752
|
+
clone[key] = deepClone(o[key], visited);
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
return /** @type {any} */ (clone);
|
|
757
|
+
|
|
758
|
+
case 'Array':
|
|
759
|
+
id = _.util.objId(o);
|
|
760
|
+
if (visited[id]) {
|
|
761
|
+
return visited[id];
|
|
762
|
+
}
|
|
763
|
+
clone = [];
|
|
764
|
+
visited[id] = clone;
|
|
765
|
+
|
|
766
|
+
(/** @type {Array} */(/** @type {any} */(o))).forEach(function (v, i) {
|
|
767
|
+
clone[i] = deepClone(v, visited);
|
|
768
|
+
});
|
|
769
|
+
|
|
770
|
+
return /** @type {any} */ (clone);
|
|
771
|
+
|
|
772
|
+
default:
|
|
773
|
+
return o;
|
|
774
|
+
}
|
|
775
|
+
},
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
|
+
* Returns the Prism language of the given element set by a `language-xxxx` or `lang-xxxx` class.
|
|
779
|
+
*
|
|
780
|
+
* If no language is set for the element or the element is `null` or `undefined`, `none` will be returned.
|
|
781
|
+
*
|
|
782
|
+
* @param {Element} element
|
|
783
|
+
* @returns {string}
|
|
784
|
+
*/
|
|
785
|
+
getLanguage: function (element) {
|
|
786
|
+
while (element) {
|
|
787
|
+
var m = lang.exec(element.className);
|
|
788
|
+
if (m) {
|
|
789
|
+
return m[1].toLowerCase();
|
|
790
|
+
}
|
|
791
|
+
element = element.parentElement;
|
|
792
|
+
}
|
|
793
|
+
return 'none';
|
|
794
|
+
},
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* Sets the Prism `language-xxxx` class of the given element.
|
|
798
|
+
*
|
|
799
|
+
* @param {Element} element
|
|
800
|
+
* @param {string} language
|
|
801
|
+
* @returns {void}
|
|
802
|
+
*/
|
|
803
|
+
setLanguage: function (element, language) {
|
|
804
|
+
// remove all `language-xxxx` classes
|
|
805
|
+
// (this might leave behind a leading space)
|
|
806
|
+
element.className = element.className.replace(RegExp(lang, 'gi'), '');
|
|
807
|
+
|
|
808
|
+
// add the new `language-xxxx` class
|
|
809
|
+
// (using `classList` will automatically clean up spaces for us)
|
|
810
|
+
element.classList.add('language-' + language);
|
|
811
|
+
},
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* Returns the script element that is currently executing.
|
|
815
|
+
*
|
|
816
|
+
* This does __not__ work for line script element.
|
|
817
|
+
*
|
|
818
|
+
* @returns {HTMLScriptElement | null}
|
|
819
|
+
*/
|
|
820
|
+
currentScript: function () {
|
|
821
|
+
if (typeof document === 'undefined') {
|
|
822
|
+
return null;
|
|
823
|
+
}
|
|
824
|
+
if ('currentScript' in document && 1 < 2 /* hack to trip TS' flow analysis */) {
|
|
825
|
+
return /** @type {any} */ (document.currentScript);
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
// IE11 workaround
|
|
829
|
+
// we'll get the src of the current script by parsing IE11's error stack trace
|
|
830
|
+
// this will not work for inline scripts
|
|
831
|
+
|
|
832
|
+
try {
|
|
833
|
+
throw new Error();
|
|
834
|
+
} catch (err) {
|
|
835
|
+
// Get file src url from stack. Specifically works with the format of stack traces in IE.
|
|
836
|
+
// A stack will look like this:
|
|
837
|
+
//
|
|
838
|
+
// Error
|
|
839
|
+
// at _.util.currentScript (http://localhost/components/prism-core.js:119:5)
|
|
840
|
+
// at Global code (http://localhost/components/prism-core.js:606:1)
|
|
841
|
+
|
|
842
|
+
var src = (/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(err.stack) || [])[1];
|
|
843
|
+
if (src) {
|
|
844
|
+
var scripts = document.getElementsByTagName('script');
|
|
845
|
+
for (var i in scripts) {
|
|
846
|
+
if (scripts[i].src == src) {
|
|
847
|
+
return scripts[i];
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
return null;
|
|
852
|
+
}
|
|
853
|
+
},
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* Returns whether a given class is active for `element`.
|
|
857
|
+
*
|
|
858
|
+
* The class can be activated if `element` or one of its ancestors has the given class and it can be deactivated
|
|
859
|
+
* if `element` or one of its ancestors has the negated version of the given class. The _negated version_ of the
|
|
860
|
+
* given class is just the given class with a `no-` prefix.
|
|
861
|
+
*
|
|
862
|
+
* Whether the class is active is determined by the closest ancestor of `element` (where `element` itself is
|
|
863
|
+
* closest ancestor) that has the given class or the negated version of it. If neither `element` nor any of its
|
|
864
|
+
* ancestors have the given class or the negated version of it, then the default activation will be returned.
|
|
865
|
+
*
|
|
866
|
+
* In the paradoxical situation where the closest ancestor contains __both__ the given class and the negated
|
|
867
|
+
* version of it, the class is considered active.
|
|
868
|
+
*
|
|
869
|
+
* @param {Element} element
|
|
870
|
+
* @param {string} className
|
|
871
|
+
* @param {boolean} [defaultActivation=false]
|
|
872
|
+
* @returns {boolean}
|
|
873
|
+
*/
|
|
874
|
+
isActive: function (element, className, defaultActivation) {
|
|
875
|
+
var no = 'no-' + className;
|
|
876
|
+
|
|
877
|
+
while (element) {
|
|
878
|
+
var classList = element.classList;
|
|
879
|
+
if (classList.contains(className)) {
|
|
880
|
+
return true;
|
|
881
|
+
}
|
|
882
|
+
if (classList.contains(no)) {
|
|
883
|
+
return false;
|
|
884
|
+
}
|
|
885
|
+
element = element.parentElement;
|
|
886
|
+
}
|
|
887
|
+
return !!defaultActivation;
|
|
888
|
+
}
|
|
889
|
+
},
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* This namespace contains all currently loaded languages and the some helper functions to create and modify languages.
|
|
893
|
+
*
|
|
894
|
+
* @namespace
|
|
895
|
+
* @memberof Prism
|
|
896
|
+
* @public
|
|
897
|
+
*/
|
|
898
|
+
languages: {
|
|
899
|
+
/**
|
|
900
|
+
* The grammar for plain, unformatted text.
|
|
901
|
+
*/
|
|
902
|
+
plain: plainTextGrammar,
|
|
903
|
+
plaintext: plainTextGrammar,
|
|
904
|
+
text: plainTextGrammar,
|
|
905
|
+
txt: plainTextGrammar,
|
|
906
|
+
|
|
907
|
+
/**
|
|
908
|
+
* Creates a deep copy of the language with the given id and appends the given tokens.
|
|
909
|
+
*
|
|
910
|
+
* If a token in `redef` also appears in the copied language, then the existing token in the copied language
|
|
911
|
+
* will be overwritten at its original position.
|
|
912
|
+
*
|
|
913
|
+
* ## Best practices
|
|
914
|
+
*
|
|
915
|
+
* Since the position of overwriting tokens (token in `redef` that overwrite tokens in the copied language)
|
|
916
|
+
* doesn't matter, they can technically be in any order. However, this can be confusing to others that trying to
|
|
917
|
+
* understand the language definition because, normally, the order of tokens matters in Prism grammars.
|
|
918
|
+
*
|
|
919
|
+
* Therefore, it is encouraged to order overwriting tokens according to the positions of the overwritten tokens.
|
|
920
|
+
* Furthermore, all non-overwriting tokens should be placed after the overwriting ones.
|
|
921
|
+
*
|
|
922
|
+
* @param {string} id The id of the language to extend. This has to be a key in `Prism.languages`.
|
|
923
|
+
* @param {Grammar} redef The new tokens to append.
|
|
924
|
+
* @returns {Grammar} The new language created.
|
|
925
|
+
* @public
|
|
926
|
+
* @example
|
|
927
|
+
* Prism.languages['css-with-colors'] = Prism.languages.extend('css', {
|
|
928
|
+
* // Prism.languages.css already has a 'comment' token, so this token will overwrite CSS' 'comment' token
|
|
929
|
+
* // at its original position
|
|
930
|
+
* 'comment': { ... },
|
|
931
|
+
* // CSS doesn't have a 'color' token, so this token will be appended
|
|
932
|
+
* 'color': /\b(?:red|green|blue)\b/
|
|
933
|
+
* });
|
|
934
|
+
*/
|
|
935
|
+
extend: function (id, redef) {
|
|
936
|
+
var lang = _.util.clone(_.languages[id]);
|
|
937
|
+
|
|
938
|
+
for (var key in redef) {
|
|
939
|
+
lang[key] = redef[key];
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
return lang;
|
|
943
|
+
},
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* Inserts tokens _before_ another token in a language definition or any other grammar.
|
|
947
|
+
*
|
|
948
|
+
* ## Usage
|
|
949
|
+
*
|
|
950
|
+
* This helper method makes it easy to modify existing languages. For example, the CSS language definition
|
|
951
|
+
* not only defines CSS highlighting for CSS documents, but also needs to define highlighting for CSS embedded
|
|
952
|
+
* in HTML through `<style>` elements. To do this, it needs to modify `Prism.languages.markup` and add the
|
|
953
|
+
* appropriate tokens. However, `Prism.languages.markup` is a regular JavaScript object literal, so if you do
|
|
954
|
+
* this:
|
|
955
|
+
*
|
|
956
|
+
* ```js
|
|
957
|
+
* Prism.languages.markup.style = {
|
|
958
|
+
* // token
|
|
959
|
+
* };
|
|
960
|
+
* ```
|
|
961
|
+
*
|
|
962
|
+
* then the `style` token will be added (and processed) at the end. `insertBefore` allows you to insert tokens
|
|
963
|
+
* before existing tokens. For the CSS example above, you would use it like this:
|
|
964
|
+
*
|
|
965
|
+
* ```js
|
|
966
|
+
* Prism.languages.insertBefore('markup', 'cdata', {
|
|
967
|
+
* 'style': {
|
|
968
|
+
* // token
|
|
969
|
+
* }
|
|
970
|
+
* });
|
|
971
|
+
* ```
|
|
972
|
+
*
|
|
973
|
+
* ## Special cases
|
|
974
|
+
*
|
|
975
|
+
* If the grammars of `inside` and `insert` have tokens with the same name, the tokens in `inside`'s grammar
|
|
976
|
+
* will be ignored.
|
|
977
|
+
*
|
|
978
|
+
* This behavior can be used to insert tokens after `before`:
|
|
979
|
+
*
|
|
980
|
+
* ```js
|
|
981
|
+
* Prism.languages.insertBefore('markup', 'comment', {
|
|
982
|
+
* 'comment': Prism.languages.markup.comment,
|
|
983
|
+
* // tokens after 'comment'
|
|
984
|
+
* });
|
|
985
|
+
* ```
|
|
986
|
+
*
|
|
987
|
+
* ## Limitations
|
|
988
|
+
*
|
|
989
|
+
* The main problem `insertBefore` has to solve is iteration order. Since ES2015, the iteration order for object
|
|
990
|
+
* properties is guaranteed to be the insertion order (except for integer keys) but some browsers behave
|
|
991
|
+
* differently when keys are deleted and re-inserted. So `insertBefore` can't be implemented by temporarily
|
|
992
|
+
* deleting properties which is necessary to insert at arbitrary positions.
|
|
993
|
+
*
|
|
994
|
+
* To solve this problem, `insertBefore` doesn't actually insert the given tokens into the target object.
|
|
995
|
+
* Instead, it will create a new object and replace all references to the target object with the new one. This
|
|
996
|
+
* can be done without temporarily deleting properties, so the iteration order is well-defined.
|
|
997
|
+
*
|
|
998
|
+
* However, only references that can be reached from `Prism.languages` or `insert` will be replaced. I.e. if
|
|
999
|
+
* you hold the target object in a variable, then the value of the variable will not change.
|
|
1000
|
+
*
|
|
1001
|
+
* ```js
|
|
1002
|
+
* var oldMarkup = Prism.languages.markup;
|
|
1003
|
+
* var newMarkup = Prism.languages.insertBefore('markup', 'comment', { ... });
|
|
1004
|
+
*
|
|
1005
|
+
* assert(oldMarkup !== Prism.languages.markup);
|
|
1006
|
+
* assert(newMarkup === Prism.languages.markup);
|
|
1007
|
+
* ```
|
|
1008
|
+
*
|
|
1009
|
+
* @param {string} inside The property of `root` (e.g. a language id in `Prism.languages`) that contains the
|
|
1010
|
+
* object to be modified.
|
|
1011
|
+
* @param {string} before The key to insert before.
|
|
1012
|
+
* @param {Grammar} insert An object containing the key-value pairs to be inserted.
|
|
1013
|
+
* @param {Object<string, any>} [root] The object containing `inside`, i.e. the object that contains the
|
|
1014
|
+
* object to be modified.
|
|
1015
|
+
*
|
|
1016
|
+
* Defaults to `Prism.languages`.
|
|
1017
|
+
* @returns {Grammar} The new grammar object.
|
|
1018
|
+
* @public
|
|
1019
|
+
*/
|
|
1020
|
+
insertBefore: function (inside, before, insert, root) {
|
|
1021
|
+
root = root || /** @type {any} */ (_.languages);
|
|
1022
|
+
var grammar = root[inside];
|
|
1023
|
+
/** @type {Grammar} */
|
|
1024
|
+
var ret = {};
|
|
1025
|
+
|
|
1026
|
+
for (var token in grammar) {
|
|
1027
|
+
if (grammar.hasOwnProperty(token)) {
|
|
1028
|
+
|
|
1029
|
+
if (token == before) {
|
|
1030
|
+
for (var newToken in insert) {
|
|
1031
|
+
if (insert.hasOwnProperty(newToken)) {
|
|
1032
|
+
ret[newToken] = insert[newToken];
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
// Do not insert token which also occur in insert. See #1525
|
|
1038
|
+
if (!insert.hasOwnProperty(token)) {
|
|
1039
|
+
ret[token] = grammar[token];
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
var old = root[inside];
|
|
1045
|
+
root[inside] = ret;
|
|
1046
|
+
|
|
1047
|
+
// Update references in other language definitions
|
|
1048
|
+
_.languages.DFS(_.languages, function (key, value) {
|
|
1049
|
+
if (value === old && key != inside) {
|
|
1050
|
+
this[key] = ret;
|
|
1051
|
+
}
|
|
1052
|
+
});
|
|
1053
|
+
|
|
1054
|
+
return ret;
|
|
1055
|
+
},
|
|
1056
|
+
|
|
1057
|
+
// Traverse a language definition with Depth First Search
|
|
1058
|
+
DFS: function DFS(o, callback, type, visited) {
|
|
1059
|
+
visited = visited || {};
|
|
1060
|
+
|
|
1061
|
+
var objId = _.util.objId;
|
|
1062
|
+
|
|
1063
|
+
for (var i in o) {
|
|
1064
|
+
if (o.hasOwnProperty(i)) {
|
|
1065
|
+
callback.call(o, i, o[i], type || i);
|
|
1066
|
+
|
|
1067
|
+
var property = o[i];
|
|
1068
|
+
var propertyType = _.util.type(property);
|
|
1069
|
+
|
|
1070
|
+
if (propertyType === 'Object' && !visited[objId(property)]) {
|
|
1071
|
+
visited[objId(property)] = true;
|
|
1072
|
+
DFS(property, callback, null, visited);
|
|
1073
|
+
} else if (propertyType === 'Array' && !visited[objId(property)]) {
|
|
1074
|
+
visited[objId(property)] = true;
|
|
1075
|
+
DFS(property, callback, i, visited);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
},
|
|
1081
|
+
|
|
1082
|
+
plugins: {},
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1085
|
+
* This is the most high-level function in Prism’s API.
|
|
1086
|
+
* It fetches all the elements that have a `.language-xxxx` class and then calls {@link Prism.highlightElement} on
|
|
1087
|
+
* each one of them.
|
|
1088
|
+
*
|
|
1089
|
+
* This is equivalent to `Prism.highlightAllUnder(document, async, callback)`.
|
|
1090
|
+
*
|
|
1091
|
+
* @param {boolean} [async=false] Same as in {@link Prism.highlightAllUnder}.
|
|
1092
|
+
* @param {HighlightCallback} [callback] Same as in {@link Prism.highlightAllUnder}.
|
|
1093
|
+
* @memberof Prism
|
|
1094
|
+
* @public
|
|
1095
|
+
*/
|
|
1096
|
+
highlightAll: function (async, callback) {
|
|
1097
|
+
_.highlightAllUnder(document, async, callback);
|
|
1098
|
+
},
|
|
1099
|
+
|
|
1100
|
+
/**
|
|
1101
|
+
* Fetches all the descendants of `container` that have a `.language-xxxx` class and then calls
|
|
1102
|
+
* {@link Prism.highlightElement} on each one of them.
|
|
1103
|
+
*
|
|
1104
|
+
* The following hooks will be run:
|
|
1105
|
+
* 1. `before-highlightall`
|
|
1106
|
+
* 2. `before-all-elements-highlight`
|
|
1107
|
+
* 3. All hooks of {@link Prism.highlightElement} for each element.
|
|
1108
|
+
*
|
|
1109
|
+
* @param {ParentNode} container The root element, whose descendants that have a `.language-xxxx` class will be highlighted.
|
|
1110
|
+
* @param {boolean} [async=false] Whether each element is to be highlighted asynchronously using Web Workers.
|
|
1111
|
+
* @param {HighlightCallback} [callback] An optional callback to be invoked on each element after its highlighting is done.
|
|
1112
|
+
* @memberof Prism
|
|
1113
|
+
* @public
|
|
1114
|
+
*/
|
|
1115
|
+
highlightAllUnder: function (container, async, callback) {
|
|
1116
|
+
var env = {
|
|
1117
|
+
callback: callback,
|
|
1118
|
+
container: container,
|
|
1119
|
+
selector: 'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'
|
|
1120
|
+
};
|
|
1121
|
+
|
|
1122
|
+
_.hooks.run('before-highlightall', env);
|
|
1123
|
+
|
|
1124
|
+
env.elements = Array.prototype.slice.apply(env.container.querySelectorAll(env.selector));
|
|
1125
|
+
|
|
1126
|
+
_.hooks.run('before-all-elements-highlight', env);
|
|
1127
|
+
|
|
1128
|
+
for (var i = 0, element; (element = env.elements[i++]);) {
|
|
1129
|
+
_.highlightElement(element, async === true, env.callback);
|
|
1130
|
+
}
|
|
1131
|
+
},
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* Highlights the code inside a single element.
|
|
1135
|
+
*
|
|
1136
|
+
* The following hooks will be run:
|
|
1137
|
+
* 1. `before-sanity-check`
|
|
1138
|
+
* 2. `before-highlight`
|
|
1139
|
+
* 3. All hooks of {@link Prism.highlight}. These hooks will be run by an asynchronous worker if `async` is `true`.
|
|
1140
|
+
* 4. `before-insert`
|
|
1141
|
+
* 5. `after-highlight`
|
|
1142
|
+
* 6. `complete`
|
|
1143
|
+
*
|
|
1144
|
+
* Some the above hooks will be skipped if the element doesn't contain any text or there is no grammar loaded for
|
|
1145
|
+
* the element's language.
|
|
1146
|
+
*
|
|
1147
|
+
* @param {Element} element The element containing the code.
|
|
1148
|
+
* It must have a class of `language-xxxx` to be processed, where `xxxx` is a valid language identifier.
|
|
1149
|
+
* @param {boolean} [async=false] Whether the element is to be highlighted asynchronously using Web Workers
|
|
1150
|
+
* to improve performance and avoid blocking the UI when highlighting very large chunks of code. This option is
|
|
1151
|
+
* [disabled by default](https://prismjs.com/faq.html#why-is-asynchronous-highlighting-disabled-by-default).
|
|
1152
|
+
*
|
|
1153
|
+
* Note: All language definitions required to highlight the code must be included in the main `prism.js` file for
|
|
1154
|
+
* asynchronous highlighting to work. You can build your own bundle on the
|
|
1155
|
+
* [Download page](https://prismjs.com/download.html).
|
|
1156
|
+
* @param {HighlightCallback} [callback] An optional callback to be invoked after the highlighting is done.
|
|
1157
|
+
* Mostly useful when `async` is `true`, since in that case, the highlighting is done asynchronously.
|
|
1158
|
+
* @memberof Prism
|
|
1159
|
+
* @public
|
|
1160
|
+
*/
|
|
1161
|
+
highlightElement: function (element, async, callback) {
|
|
1162
|
+
// Find language
|
|
1163
|
+
var language = _.util.getLanguage(element);
|
|
1164
|
+
var grammar = _.languages[language];
|
|
1165
|
+
|
|
1166
|
+
// Set language on the element, if not present
|
|
1167
|
+
_.util.setLanguage(element, language);
|
|
1168
|
+
|
|
1169
|
+
// Set language on the parent, for styling
|
|
1170
|
+
var parent = element.parentElement;
|
|
1171
|
+
if (parent && parent.nodeName.toLowerCase() === 'pre') {
|
|
1172
|
+
_.util.setLanguage(parent, language);
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
var code = element.textContent;
|
|
1176
|
+
|
|
1177
|
+
var env = {
|
|
1178
|
+
element: element,
|
|
1179
|
+
language: language,
|
|
1180
|
+
grammar: grammar,
|
|
1181
|
+
code: code
|
|
1182
|
+
};
|
|
1183
|
+
|
|
1184
|
+
function insertHighlightedCode(highlightedCode) {
|
|
1185
|
+
env.highlightedCode = highlightedCode;
|
|
1186
|
+
|
|
1187
|
+
_.hooks.run('before-insert', env);
|
|
1188
|
+
|
|
1189
|
+
env.element.innerHTML = env.highlightedCode;
|
|
1190
|
+
|
|
1191
|
+
_.hooks.run('after-highlight', env);
|
|
1192
|
+
_.hooks.run('complete', env);
|
|
1193
|
+
callback && callback.call(env.element);
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
_.hooks.run('before-sanity-check', env);
|
|
1197
|
+
|
|
1198
|
+
// plugins may change/add the parent/element
|
|
1199
|
+
parent = env.element.parentElement;
|
|
1200
|
+
if (parent && parent.nodeName.toLowerCase() === 'pre' && !parent.hasAttribute('tabindex')) {
|
|
1201
|
+
parent.setAttribute('tabindex', '0');
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
if (!env.code) {
|
|
1205
|
+
_.hooks.run('complete', env);
|
|
1206
|
+
callback && callback.call(env.element);
|
|
1207
|
+
return;
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
_.hooks.run('before-highlight', env);
|
|
1211
|
+
|
|
1212
|
+
if (!env.grammar) {
|
|
1213
|
+
insertHighlightedCode(_.util.encode(env.code));
|
|
1214
|
+
return;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
if (async && _self.Worker) {
|
|
1218
|
+
var worker = new Worker(_.filename);
|
|
1219
|
+
|
|
1220
|
+
worker.onmessage = function (evt) {
|
|
1221
|
+
insertHighlightedCode(evt.data);
|
|
1222
|
+
};
|
|
1223
|
+
|
|
1224
|
+
worker.postMessage(JSON.stringify({
|
|
1225
|
+
language: env.language,
|
|
1226
|
+
code: env.code,
|
|
1227
|
+
immediateClose: true
|
|
1228
|
+
}));
|
|
1229
|
+
} else {
|
|
1230
|
+
insertHighlightedCode(_.highlight(env.code, env.grammar, env.language));
|
|
1231
|
+
}
|
|
1232
|
+
},
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* Low-level function, only use if you know what you’re doing. It accepts a string of text as input
|
|
1236
|
+
* and the language definitions to use, and returns a string with the HTML produced.
|
|
1237
|
+
*
|
|
1238
|
+
* The following hooks will be run:
|
|
1239
|
+
* 1. `before-tokenize`
|
|
1240
|
+
* 2. `after-tokenize`
|
|
1241
|
+
* 3. `wrap`: On each {@link Token}.
|
|
1242
|
+
*
|
|
1243
|
+
* @param {string} text A string with the code to be highlighted.
|
|
1244
|
+
* @param {Grammar} grammar An object containing the tokens to use.
|
|
1245
|
+
*
|
|
1246
|
+
* Usually a language definition like `Prism.languages.markup`.
|
|
1247
|
+
* @param {string} language The name of the language definition passed to `grammar`.
|
|
1248
|
+
* @returns {string} The highlighted HTML.
|
|
1249
|
+
* @memberof Prism
|
|
1250
|
+
* @public
|
|
1251
|
+
* @example
|
|
1252
|
+
* Prism.highlight('var foo = true;', Prism.languages.javascript, 'javascript');
|
|
1253
|
+
*/
|
|
1254
|
+
highlight: function (text, grammar, language) {
|
|
1255
|
+
var env = {
|
|
1256
|
+
code: text,
|
|
1257
|
+
grammar: grammar,
|
|
1258
|
+
language: language
|
|
1259
|
+
};
|
|
1260
|
+
_.hooks.run('before-tokenize', env);
|
|
1261
|
+
if (!env.grammar) {
|
|
1262
|
+
throw new Error('The language "' + env.language + '" has no grammar.');
|
|
1263
|
+
}
|
|
1264
|
+
env.tokens = _.tokenize(env.code, env.grammar);
|
|
1265
|
+
_.hooks.run('after-tokenize', env);
|
|
1266
|
+
return Token.stringify(_.util.encode(env.tokens), env.language);
|
|
1267
|
+
},
|
|
1268
|
+
|
|
1269
|
+
/**
|
|
1270
|
+
* This is the heart of Prism, and the most low-level function you can use. It accepts a string of text as input
|
|
1271
|
+
* and the language definitions to use, and returns an array with the tokenized code.
|
|
1272
|
+
*
|
|
1273
|
+
* When the language definition includes nested tokens, the function is called recursively on each of these tokens.
|
|
1274
|
+
*
|
|
1275
|
+
* This method could be useful in other contexts as well, as a very crude parser.
|
|
1276
|
+
*
|
|
1277
|
+
* @param {string} text A string with the code to be highlighted.
|
|
1278
|
+
* @param {Grammar} grammar An object containing the tokens to use.
|
|
1279
|
+
*
|
|
1280
|
+
* Usually a language definition like `Prism.languages.markup`.
|
|
1281
|
+
* @returns {TokenStream} An array of strings and tokens, a token stream.
|
|
1282
|
+
* @memberof Prism
|
|
1283
|
+
* @public
|
|
1284
|
+
* @example
|
|
1285
|
+
* let code = `var foo = 0;`;
|
|
1286
|
+
* let tokens = Prism.tokenize(code, Prism.languages.javascript);
|
|
1287
|
+
* tokens.forEach(token => {
|
|
1288
|
+
* if (token instanceof Prism.Token && token.type === 'number') {
|
|
1289
|
+
* console.log(`Found numeric literal: ${token.content}`);
|
|
1290
|
+
* }
|
|
1291
|
+
* });
|
|
1292
|
+
*/
|
|
1293
|
+
tokenize: function (text, grammar) {
|
|
1294
|
+
var rest = grammar.rest;
|
|
1295
|
+
if (rest) {
|
|
1296
|
+
for (var token in rest) {
|
|
1297
|
+
grammar[token] = rest[token];
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
delete grammar.rest;
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
var tokenList = new LinkedList();
|
|
1304
|
+
addAfter(tokenList, tokenList.head, text);
|
|
1305
|
+
|
|
1306
|
+
matchGrammar(text, tokenList, grammar, tokenList.head, 0);
|
|
1307
|
+
|
|
1308
|
+
return toArray(tokenList);
|
|
1309
|
+
},
|
|
1310
|
+
|
|
1311
|
+
/**
|
|
1312
|
+
* @namespace
|
|
1313
|
+
* @memberof Prism
|
|
1314
|
+
* @public
|
|
1315
|
+
*/
|
|
1316
|
+
hooks: {
|
|
1317
|
+
all: {},
|
|
1318
|
+
|
|
1319
|
+
/**
|
|
1320
|
+
* Adds the given callback to the list of callbacks for the given hook.
|
|
1321
|
+
*
|
|
1322
|
+
* The callback will be invoked when the hook it is registered for is run.
|
|
1323
|
+
* Hooks are usually directly run by a highlight function but you can also run hooks yourself.
|
|
1324
|
+
*
|
|
1325
|
+
* One callback function can be registered to multiple hooks and the same hook multiple times.
|
|
1326
|
+
*
|
|
1327
|
+
* @param {string} name The name of the hook.
|
|
1328
|
+
* @param {HookCallback} callback The callback function which is given environment variables.
|
|
1329
|
+
* @public
|
|
1330
|
+
*/
|
|
1331
|
+
add: function (name, callback) {
|
|
1332
|
+
var hooks = _.hooks.all;
|
|
1333
|
+
|
|
1334
|
+
hooks[name] = hooks[name] || [];
|
|
1335
|
+
|
|
1336
|
+
hooks[name].push(callback);
|
|
1337
|
+
},
|
|
1338
|
+
|
|
1339
|
+
/**
|
|
1340
|
+
* Runs a hook invoking all registered callbacks with the given environment variables.
|
|
1341
|
+
*
|
|
1342
|
+
* Callbacks will be invoked synchronously and in the order in which they were registered.
|
|
1343
|
+
*
|
|
1344
|
+
* @param {string} name The name of the hook.
|
|
1345
|
+
* @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
|
|
1346
|
+
* @public
|
|
1347
|
+
*/
|
|
1348
|
+
run: function (name, env) {
|
|
1349
|
+
var callbacks = _.hooks.all[name];
|
|
1350
|
+
|
|
1351
|
+
if (!callbacks || !callbacks.length) {
|
|
1352
|
+
return;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
for (var i = 0, callback; (callback = callbacks[i++]);) {
|
|
1356
|
+
callback(env);
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
},
|
|
1360
|
+
|
|
1361
|
+
Token: Token
|
|
1362
|
+
};
|
|
1363
|
+
_self.Prism = _;
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
// Typescript note:
|
|
1367
|
+
// The following can be used to import the Token type in JSDoc:
|
|
1368
|
+
//
|
|
1369
|
+
// @typedef {InstanceType<import("./prism-core")["Token"]>} Token
|
|
1370
|
+
|
|
1371
|
+
/**
|
|
1372
|
+
* Creates a new token.
|
|
1373
|
+
*
|
|
1374
|
+
* @param {string} type See {@link Token#type type}
|
|
1375
|
+
* @param {string | TokenStream} content See {@link Token#content content}
|
|
1376
|
+
* @param {string|string[]} [alias] The alias(es) of the token.
|
|
1377
|
+
* @param {string} [matchedStr=""] A copy of the full string this token was created from.
|
|
1378
|
+
* @class
|
|
1379
|
+
* @global
|
|
1380
|
+
* @public
|
|
1381
|
+
*/
|
|
1382
|
+
function Token(type, content, alias, matchedStr) {
|
|
1383
|
+
/**
|
|
1384
|
+
* The type of the token.
|
|
1385
|
+
*
|
|
1386
|
+
* This is usually the key of a pattern in a {@link Grammar}.
|
|
1387
|
+
*
|
|
1388
|
+
* @type {string}
|
|
1389
|
+
* @see GrammarToken
|
|
1390
|
+
* @public
|
|
1391
|
+
*/
|
|
1392
|
+
this.type = type;
|
|
1393
|
+
/**
|
|
1394
|
+
* The strings or tokens contained by this token.
|
|
1395
|
+
*
|
|
1396
|
+
* This will be a token stream if the pattern matched also defined an `inside` grammar.
|
|
1397
|
+
*
|
|
1398
|
+
* @type {string | TokenStream}
|
|
1399
|
+
* @public
|
|
1400
|
+
*/
|
|
1401
|
+
this.content = content;
|
|
1402
|
+
/**
|
|
1403
|
+
* The alias(es) of the token.
|
|
1404
|
+
*
|
|
1405
|
+
* @type {string|string[]}
|
|
1406
|
+
* @see GrammarToken
|
|
1407
|
+
* @public
|
|
1408
|
+
*/
|
|
1409
|
+
this.alias = alias;
|
|
1410
|
+
// Copy of the full string this token was created from
|
|
1411
|
+
this.length = (matchedStr || '').length | 0;
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1414
|
+
/**
|
|
1415
|
+
* A token stream is an array of strings and {@link Token Token} objects.
|
|
1416
|
+
*
|
|
1417
|
+
* Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process
|
|
1418
|
+
* them.
|
|
1419
|
+
*
|
|
1420
|
+
* 1. No adjacent strings.
|
|
1421
|
+
* 2. No empty strings.
|
|
1422
|
+
*
|
|
1423
|
+
* The only exception here is the token stream that only contains the empty string and nothing else.
|
|
1424
|
+
*
|
|
1425
|
+
* @typedef {Array<string | Token>} TokenStream
|
|
1426
|
+
* @global
|
|
1427
|
+
* @public
|
|
1428
|
+
*/
|
|
1429
|
+
|
|
1430
|
+
/**
|
|
1431
|
+
* Converts the given token or token stream to an HTML representation.
|
|
1432
|
+
*
|
|
1433
|
+
* The following hooks will be run:
|
|
1434
|
+
* 1. `wrap`: On each {@link Token}.
|
|
1435
|
+
*
|
|
1436
|
+
* @param {string | Token | TokenStream} o The token or token stream to be converted.
|
|
1437
|
+
* @param {string} language The name of current language.
|
|
1438
|
+
* @returns {string} The HTML representation of the token or token stream.
|
|
1439
|
+
* @memberof Token
|
|
1440
|
+
* @static
|
|
1441
|
+
*/
|
|
1442
|
+
Token.stringify = function stringify(o, language) {
|
|
1443
|
+
if (typeof o == 'string') {
|
|
1444
|
+
return o;
|
|
1445
|
+
}
|
|
1446
|
+
if (Array.isArray(o)) {
|
|
1447
|
+
var s = '';
|
|
1448
|
+
o.forEach(function (e) {
|
|
1449
|
+
s += stringify(e, language);
|
|
1450
|
+
});
|
|
1451
|
+
return s;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
var env = {
|
|
1455
|
+
type: o.type,
|
|
1456
|
+
content: stringify(o.content, language),
|
|
1457
|
+
tag: 'span',
|
|
1458
|
+
classes: ['token', o.type],
|
|
1459
|
+
attributes: {},
|
|
1460
|
+
language: language
|
|
1461
|
+
};
|
|
1462
|
+
|
|
1463
|
+
var aliases = o.alias;
|
|
1464
|
+
if (aliases) {
|
|
1465
|
+
if (Array.isArray(aliases)) {
|
|
1466
|
+
Array.prototype.push.apply(env.classes, aliases);
|
|
1467
|
+
} else {
|
|
1468
|
+
env.classes.push(aliases);
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
_.hooks.run('wrap', env);
|
|
1473
|
+
|
|
1474
|
+
var attributes = '';
|
|
1475
|
+
for (var name in env.attributes) {
|
|
1476
|
+
attributes += ' ' + name + '="' + (env.attributes[name] || '').replace(/"/g, '"') + '"';
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
return '<' + env.tag + ' class="' + env.classes.join(' ') + '"' + attributes + '>' + env.content + '</' + env.tag + '>';
|
|
1480
|
+
};
|
|
1481
|
+
|
|
1482
|
+
/**
|
|
1483
|
+
* @param {RegExp} pattern
|
|
1484
|
+
* @param {number} pos
|
|
1485
|
+
* @param {string} text
|
|
1486
|
+
* @param {boolean} lookbehind
|
|
1487
|
+
* @returns {RegExpExecArray | null}
|
|
1488
|
+
*/
|
|
1489
|
+
function matchPattern(pattern, pos, text, lookbehind) {
|
|
1490
|
+
pattern.lastIndex = pos;
|
|
1491
|
+
var match = pattern.exec(text);
|
|
1492
|
+
if (match && lookbehind && match[1]) {
|
|
1493
|
+
// change the match to remove the text matched by the Prism lookbehind group
|
|
1494
|
+
var lookbehindLength = match[1].length;
|
|
1495
|
+
match.index += lookbehindLength;
|
|
1496
|
+
match[0] = match[0].slice(lookbehindLength);
|
|
1497
|
+
}
|
|
1498
|
+
return match;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
/**
|
|
1502
|
+
* @param {string} text
|
|
1503
|
+
* @param {LinkedList<string | Token>} tokenList
|
|
1504
|
+
* @param {any} grammar
|
|
1505
|
+
* @param {LinkedListNode<string | Token>} startNode
|
|
1506
|
+
* @param {number} startPos
|
|
1507
|
+
* @param {RematchOptions} [rematch]
|
|
1508
|
+
* @returns {void}
|
|
1509
|
+
* @private
|
|
1510
|
+
*
|
|
1511
|
+
* @typedef RematchOptions
|
|
1512
|
+
* @property {string} cause
|
|
1513
|
+
* @property {number} reach
|
|
1514
|
+
*/
|
|
1515
|
+
function matchGrammar(text, tokenList, grammar, startNode, startPos, rematch) {
|
|
1516
|
+
for (var token in grammar) {
|
|
1517
|
+
if (!grammar.hasOwnProperty(token) || !grammar[token]) {
|
|
1518
|
+
continue;
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
var patterns = grammar[token];
|
|
1522
|
+
patterns = Array.isArray(patterns) ? patterns : [patterns];
|
|
1523
|
+
|
|
1524
|
+
for (var j = 0; j < patterns.length; ++j) {
|
|
1525
|
+
if (rematch && rematch.cause == token + ',' + j) {
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
var patternObj = patterns[j];
|
|
1530
|
+
var inside = patternObj.inside;
|
|
1531
|
+
var lookbehind = !!patternObj.lookbehind;
|
|
1532
|
+
var greedy = !!patternObj.greedy;
|
|
1533
|
+
var alias = patternObj.alias;
|
|
1534
|
+
|
|
1535
|
+
if (greedy && !patternObj.pattern.global) {
|
|
1536
|
+
// Without the global flag, lastIndex won't work
|
|
1537
|
+
var flags = patternObj.pattern.toString().match(/[imsuy]*$/)[0];
|
|
1538
|
+
patternObj.pattern = RegExp(patternObj.pattern.source, flags + 'g');
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
/** @type {RegExp} */
|
|
1542
|
+
var pattern = patternObj.pattern || patternObj;
|
|
1543
|
+
|
|
1544
|
+
for ( // iterate the token list and keep track of the current token/string position
|
|
1545
|
+
var currentNode = startNode.next, pos = startPos;
|
|
1546
|
+
currentNode !== tokenList.tail;
|
|
1547
|
+
pos += currentNode.value.length, currentNode = currentNode.next
|
|
1548
|
+
) {
|
|
1549
|
+
|
|
1550
|
+
if (rematch && pos >= rematch.reach) {
|
|
1551
|
+
break;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
var str = currentNode.value;
|
|
1555
|
+
|
|
1556
|
+
if (tokenList.length > text.length) {
|
|
1557
|
+
// Something went terribly wrong, ABORT, ABORT!
|
|
1558
|
+
return;
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
if (str instanceof Token) {
|
|
1562
|
+
continue;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
var removeCount = 1; // this is the to parameter of removeBetween
|
|
1566
|
+
var match;
|
|
1567
|
+
|
|
1568
|
+
if (greedy) {
|
|
1569
|
+
match = matchPattern(pattern, pos, text, lookbehind);
|
|
1570
|
+
if (!match || match.index >= text.length) {
|
|
1571
|
+
break;
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
var from = match.index;
|
|
1575
|
+
var to = match.index + match[0].length;
|
|
1576
|
+
var p = pos;
|
|
1577
|
+
|
|
1578
|
+
// find the node that contains the match
|
|
1579
|
+
p += currentNode.value.length;
|
|
1580
|
+
while (from >= p) {
|
|
1581
|
+
currentNode = currentNode.next;
|
|
1582
|
+
p += currentNode.value.length;
|
|
1583
|
+
}
|
|
1584
|
+
// adjust pos (and p)
|
|
1585
|
+
p -= currentNode.value.length;
|
|
1586
|
+
pos = p;
|
|
1587
|
+
|
|
1588
|
+
// the current node is a Token, then the match starts inside another Token, which is invalid
|
|
1589
|
+
if (currentNode.value instanceof Token) {
|
|
1590
|
+
continue;
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
// find the last node which is affected by this match
|
|
1594
|
+
for (
|
|
1595
|
+
var k = currentNode;
|
|
1596
|
+
k !== tokenList.tail && (p < to || typeof k.value === 'string');
|
|
1597
|
+
k = k.next
|
|
1598
|
+
) {
|
|
1599
|
+
removeCount++;
|
|
1600
|
+
p += k.value.length;
|
|
1601
|
+
}
|
|
1602
|
+
removeCount--;
|
|
1603
|
+
|
|
1604
|
+
// replace with the new match
|
|
1605
|
+
str = text.slice(pos, p);
|
|
1606
|
+
match.index -= pos;
|
|
1607
|
+
} else {
|
|
1608
|
+
match = matchPattern(pattern, 0, str, lookbehind);
|
|
1609
|
+
if (!match) {
|
|
1610
|
+
continue;
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
// eslint-disable-next-line no-redeclare
|
|
1615
|
+
var from = match.index;
|
|
1616
|
+
var matchStr = match[0];
|
|
1617
|
+
var before = str.slice(0, from);
|
|
1618
|
+
var after = str.slice(from + matchStr.length);
|
|
1619
|
+
|
|
1620
|
+
var reach = pos + str.length;
|
|
1621
|
+
if (rematch && reach > rematch.reach) {
|
|
1622
|
+
rematch.reach = reach;
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
var removeFrom = currentNode.prev;
|
|
1626
|
+
|
|
1627
|
+
if (before) {
|
|
1628
|
+
removeFrom = addAfter(tokenList, removeFrom, before);
|
|
1629
|
+
pos += before.length;
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
removeRange(tokenList, removeFrom, removeCount);
|
|
1633
|
+
|
|
1634
|
+
var wrapped = new Token(token, inside ? _.tokenize(matchStr, inside) : matchStr, alias, matchStr);
|
|
1635
|
+
currentNode = addAfter(tokenList, removeFrom, wrapped);
|
|
1636
|
+
|
|
1637
|
+
if (after) {
|
|
1638
|
+
addAfter(tokenList, currentNode, after);
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
if (removeCount > 1) {
|
|
1642
|
+
// at least one Token object was removed, so we have to do some rematching
|
|
1643
|
+
// this can only happen if the current pattern is greedy
|
|
1644
|
+
|
|
1645
|
+
/** @type {RematchOptions} */
|
|
1646
|
+
var nestedRematch = {
|
|
1647
|
+
cause: token + ',' + j,
|
|
1648
|
+
reach: reach
|
|
1649
|
+
};
|
|
1650
|
+
matchGrammar(text, tokenList, grammar, currentNode.prev, pos, nestedRematch);
|
|
1651
|
+
|
|
1652
|
+
// the reach might have been extended because of the rematching
|
|
1653
|
+
if (rematch && nestedRematch.reach > rematch.reach) {
|
|
1654
|
+
rematch.reach = nestedRematch.reach;
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
/**
|
|
1663
|
+
* @typedef LinkedListNode
|
|
1664
|
+
* @property {T} value
|
|
1665
|
+
* @property {LinkedListNode<T> | null} prev The previous node.
|
|
1666
|
+
* @property {LinkedListNode<T> | null} next The next node.
|
|
1667
|
+
* @template T
|
|
1668
|
+
* @private
|
|
1669
|
+
*/
|
|
1670
|
+
|
|
1671
|
+
/**
|
|
1672
|
+
* @template T
|
|
1673
|
+
* @private
|
|
1674
|
+
*/
|
|
1675
|
+
function LinkedList() {
|
|
1676
|
+
/** @type {LinkedListNode<T>} */
|
|
1677
|
+
var head = { value: null, prev: null, next: null };
|
|
1678
|
+
/** @type {LinkedListNode<T>} */
|
|
1679
|
+
var tail = { value: null, prev: head, next: null };
|
|
1680
|
+
head.next = tail;
|
|
1681
|
+
|
|
1682
|
+
/** @type {LinkedListNode<T>} */
|
|
1683
|
+
this.head = head;
|
|
1684
|
+
/** @type {LinkedListNode<T>} */
|
|
1685
|
+
this.tail = tail;
|
|
1686
|
+
this.length = 0;
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
/**
|
|
1690
|
+
* Adds a new node with the given value to the list.
|
|
1691
|
+
*
|
|
1692
|
+
* @param {LinkedList<T>} list
|
|
1693
|
+
* @param {LinkedListNode<T>} node
|
|
1694
|
+
* @param {T} value
|
|
1695
|
+
* @returns {LinkedListNode<T>} The added node.
|
|
1696
|
+
* @template T
|
|
1697
|
+
*/
|
|
1698
|
+
function addAfter(list, node, value) {
|
|
1699
|
+
// assumes that node != list.tail && values.length >= 0
|
|
1700
|
+
var next = node.next;
|
|
1701
|
+
|
|
1702
|
+
var newNode = { value: value, prev: node, next: next };
|
|
1703
|
+
node.next = newNode;
|
|
1704
|
+
next.prev = newNode;
|
|
1705
|
+
list.length++;
|
|
1706
|
+
|
|
1707
|
+
return newNode;
|
|
1708
|
+
}
|
|
1709
|
+
/**
|
|
1710
|
+
* Removes `count` nodes after the given node. The given node will not be removed.
|
|
1711
|
+
*
|
|
1712
|
+
* @param {LinkedList<T>} list
|
|
1713
|
+
* @param {LinkedListNode<T>} node
|
|
1714
|
+
* @param {number} count
|
|
1715
|
+
* @template T
|
|
1716
|
+
*/
|
|
1717
|
+
function removeRange(list, node, count) {
|
|
1718
|
+
var next = node.next;
|
|
1719
|
+
for (var i = 0; i < count && next !== list.tail; i++) {
|
|
1720
|
+
next = next.next;
|
|
1721
|
+
}
|
|
1722
|
+
node.next = next;
|
|
1723
|
+
next.prev = node;
|
|
1724
|
+
list.length -= i;
|
|
1725
|
+
}
|
|
1726
|
+
/**
|
|
1727
|
+
* @param {LinkedList<T>} list
|
|
1728
|
+
* @returns {T[]}
|
|
1729
|
+
* @template T
|
|
1730
|
+
*/
|
|
1731
|
+
function toArray(list) {
|
|
1732
|
+
var array = [];
|
|
1733
|
+
var node = list.head.next;
|
|
1734
|
+
while (node !== list.tail) {
|
|
1735
|
+
array.push(node.value);
|
|
1736
|
+
node = node.next;
|
|
1737
|
+
}
|
|
1738
|
+
return array;
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
|
|
1742
|
+
if (!_self.document) {
|
|
1743
|
+
if (!_self.addEventListener) {
|
|
1744
|
+
// in Node.js
|
|
1745
|
+
return _;
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
if (!_.disableWorkerMessageHandler) {
|
|
1749
|
+
// In worker
|
|
1750
|
+
_self.addEventListener('message', function (evt) {
|
|
1751
|
+
var message = JSON.parse(evt.data);
|
|
1752
|
+
var lang = message.language;
|
|
1753
|
+
var code = message.code;
|
|
1754
|
+
var immediateClose = message.immediateClose;
|
|
1755
|
+
|
|
1756
|
+
_self.postMessage(_.highlight(code, _.languages[lang], lang));
|
|
1757
|
+
if (immediateClose) {
|
|
1758
|
+
_self.close();
|
|
1759
|
+
}
|
|
1760
|
+
}, false);
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
return _;
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
// Get current script and highlight
|
|
1767
|
+
var script = _.util.currentScript();
|
|
1768
|
+
|
|
1769
|
+
if (script) {
|
|
1770
|
+
_.filename = script.src;
|
|
1771
|
+
|
|
1772
|
+
if (script.hasAttribute('data-manual')) {
|
|
1773
|
+
_.manual = true;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
function highlightAutomaticallyCallback() {
|
|
1778
|
+
if (!_.manual) {
|
|
1779
|
+
_.highlightAll();
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
if (!_.manual) {
|
|
1784
|
+
// If the document state is "loading", then we'll use DOMContentLoaded.
|
|
1785
|
+
// If the document state is "interactive" and the prism.js script is deferred, then we'll also use the
|
|
1786
|
+
// DOMContentLoaded event because there might be some plugins or languages which have also been deferred and they
|
|
1787
|
+
// might take longer one animation frame to execute which can create a race condition where only some plugins have
|
|
1788
|
+
// been loaded when Prism.highlightAll() is executed, depending on how fast resources are loaded.
|
|
1789
|
+
// See https://github.com/PrismJS/prism/issues/2102
|
|
1790
|
+
var readyState = document.readyState;
|
|
1791
|
+
if (readyState === 'loading' || readyState === 'interactive' && script && script.defer) {
|
|
1792
|
+
document.addEventListener('DOMContentLoaded', highlightAutomaticallyCallback);
|
|
1793
|
+
} else {
|
|
1794
|
+
if (window.requestAnimationFrame) {
|
|
1795
|
+
window.requestAnimationFrame(highlightAutomaticallyCallback);
|
|
1796
|
+
} else {
|
|
1797
|
+
window.setTimeout(highlightAutomaticallyCallback, 16);
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
return _;
|
|
1803
|
+
|
|
1804
|
+
}(_self));
|
|
1805
|
+
|
|
1806
|
+
if (module.exports) {
|
|
1807
|
+
module.exports = Prism;
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
// hack for components to work correctly in node.js
|
|
1811
|
+
if (typeof commonjsGlobal !== 'undefined') {
|
|
1812
|
+
commonjsGlobal.Prism = Prism;
|
|
1813
|
+
}
|
|
1814
|
+
|
|
1815
|
+
// some additional documentation/types
|
|
1816
|
+
|
|
1817
|
+
/**
|
|
1818
|
+
* The expansion of a simple `RegExp` literal to support additional properties.
|
|
1819
|
+
*
|
|
1820
|
+
* @typedef GrammarToken
|
|
1821
|
+
* @property {RegExp} pattern The regular expression of the token.
|
|
1822
|
+
* @property {boolean} [lookbehind=false] If `true`, then the first capturing group of `pattern` will (effectively)
|
|
1823
|
+
* behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token.
|
|
1824
|
+
* @property {boolean} [greedy=false] Whether the token is greedy.
|
|
1825
|
+
* @property {string|string[]} [alias] An optional alias or list of aliases.
|
|
1826
|
+
* @property {Grammar} [inside] The nested grammar of this token.
|
|
1827
|
+
*
|
|
1828
|
+
* The `inside` grammar will be used to tokenize the text value of each token of this kind.
|
|
1829
|
+
*
|
|
1830
|
+
* This can be used to make nested and even recursive language definitions.
|
|
1831
|
+
*
|
|
1832
|
+
* Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into
|
|
1833
|
+
* each another.
|
|
1834
|
+
* @global
|
|
1835
|
+
* @public
|
|
1836
|
+
*/
|
|
1837
|
+
|
|
1838
|
+
/**
|
|
1839
|
+
* @typedef Grammar
|
|
1840
|
+
* @type {Object<string, RegExp | GrammarToken | Array<RegExp | GrammarToken>>}
|
|
1841
|
+
* @property {Grammar} [rest] An optional grammar object that will be appended to this grammar.
|
|
1842
|
+
* @global
|
|
1843
|
+
* @public
|
|
1844
|
+
*/
|
|
1845
|
+
|
|
1846
|
+
/**
|
|
1847
|
+
* A function which will invoked after an element was successfully highlighted.
|
|
1848
|
+
*
|
|
1849
|
+
* @callback HighlightCallback
|
|
1850
|
+
* @param {Element} element The element successfully highlighted.
|
|
1851
|
+
* @returns {void}
|
|
1852
|
+
* @global
|
|
1853
|
+
* @public
|
|
1854
|
+
*/
|
|
1855
|
+
|
|
1856
|
+
/**
|
|
1857
|
+
* @callback HookCallback
|
|
1858
|
+
* @param {Object<string, any>} env The environment variables of the hook.
|
|
1859
|
+
* @returns {void}
|
|
1860
|
+
* @global
|
|
1861
|
+
* @public
|
|
1862
|
+
*/
|
|
1863
|
+
|
|
1864
|
+
|
|
1865
|
+
/* **********************************************
|
|
1866
|
+
Begin prism-markup.js
|
|
1867
|
+
********************************************** */
|
|
1868
|
+
|
|
1869
|
+
Prism.languages.markup = {
|
|
1870
|
+
'comment': {
|
|
1871
|
+
pattern: /<!--(?:(?!<!--)[\s\S])*?-->/,
|
|
1872
|
+
greedy: true
|
|
1873
|
+
},
|
|
1874
|
+
'prolog': {
|
|
1875
|
+
pattern: /<\?[\s\S]+?\?>/,
|
|
1876
|
+
greedy: true
|
|
1877
|
+
},
|
|
1878
|
+
'doctype': {
|
|
1879
|
+
// https://www.w3.org/TR/xml/#NT-doctypedecl
|
|
1880
|
+
pattern: /<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,
|
|
1881
|
+
greedy: true,
|
|
1882
|
+
inside: {
|
|
1883
|
+
'internal-subset': {
|
|
1884
|
+
pattern: /(^[^\[]*\[)[\s\S]+(?=\]>$)/,
|
|
1885
|
+
lookbehind: true,
|
|
1886
|
+
greedy: true,
|
|
1887
|
+
inside: null // see below
|
|
1888
|
+
},
|
|
1889
|
+
'string': {
|
|
1890
|
+
pattern: /"[^"]*"|'[^']*'/,
|
|
1891
|
+
greedy: true
|
|
1892
|
+
},
|
|
1893
|
+
'punctuation': /^<!|>$|[[\]]/,
|
|
1894
|
+
'doctype-tag': /^DOCTYPE/i,
|
|
1895
|
+
'name': /[^\s<>'"]+/
|
|
1896
|
+
}
|
|
1897
|
+
},
|
|
1898
|
+
'cdata': {
|
|
1899
|
+
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
1900
|
+
greedy: true
|
|
1901
|
+
},
|
|
1902
|
+
'tag': {
|
|
1903
|
+
pattern: /<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,
|
|
1904
|
+
greedy: true,
|
|
1905
|
+
inside: {
|
|
1906
|
+
'tag': {
|
|
1907
|
+
pattern: /^<\/?[^\s>\/]+/,
|
|
1908
|
+
inside: {
|
|
1909
|
+
'punctuation': /^<\/?/,
|
|
1910
|
+
'namespace': /^[^\s>\/:]+:/
|
|
1911
|
+
}
|
|
1912
|
+
},
|
|
1913
|
+
'special-attr': [],
|
|
1914
|
+
'attr-value': {
|
|
1915
|
+
pattern: /=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,
|
|
1916
|
+
inside: {
|
|
1917
|
+
'punctuation': [
|
|
1918
|
+
{
|
|
1919
|
+
pattern: /^=/,
|
|
1920
|
+
alias: 'attr-equals'
|
|
1921
|
+
},
|
|
1922
|
+
{
|
|
1923
|
+
pattern: /^(\s*)["']|["']$/,
|
|
1924
|
+
lookbehind: true
|
|
1925
|
+
}
|
|
1926
|
+
]
|
|
1927
|
+
}
|
|
1928
|
+
},
|
|
1929
|
+
'punctuation': /\/?>/,
|
|
1930
|
+
'attr-name': {
|
|
1931
|
+
pattern: /[^\s>\/]+/,
|
|
1932
|
+
inside: {
|
|
1933
|
+
'namespace': /^[^\s>\/:]+:/
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
}
|
|
1938
|
+
},
|
|
1939
|
+
'entity': [
|
|
1940
|
+
{
|
|
1941
|
+
pattern: /&[\da-z]{1,8};/i,
|
|
1942
|
+
alias: 'named-entity'
|
|
1943
|
+
},
|
|
1944
|
+
/&#x?[\da-f]{1,8};/i
|
|
1945
|
+
]
|
|
1946
|
+
};
|
|
1947
|
+
|
|
1948
|
+
Prism.languages.markup['tag'].inside['attr-value'].inside['entity'] =
|
|
1949
|
+
Prism.languages.markup['entity'];
|
|
1950
|
+
Prism.languages.markup['doctype'].inside['internal-subset'].inside = Prism.languages.markup;
|
|
1951
|
+
|
|
1952
|
+
// Plugin to make entity title show the real entity, idea by Roman Komarov
|
|
1953
|
+
Prism.hooks.add('wrap', function (env) {
|
|
1954
|
+
|
|
1955
|
+
if (env.type === 'entity') {
|
|
1956
|
+
env.attributes['title'] = env.content.replace(/&/, '&');
|
|
1957
|
+
}
|
|
1958
|
+
});
|
|
1959
|
+
|
|
1960
|
+
Object.defineProperty(Prism.languages.markup.tag, 'addInlined', {
|
|
1961
|
+
/**
|
|
1962
|
+
* Adds an inlined language to markup.
|
|
1963
|
+
*
|
|
1964
|
+
* An example of an inlined language is CSS with `<style>` tags.
|
|
1965
|
+
*
|
|
1966
|
+
* @param {string} tagName The name of the tag that contains the inlined language. This name will be treated as
|
|
1967
|
+
* case insensitive.
|
|
1968
|
+
* @param {string} lang The language key.
|
|
1969
|
+
* @example
|
|
1970
|
+
* addInlined('style', 'css');
|
|
1971
|
+
*/
|
|
1972
|
+
value: function addInlined(tagName, lang) {
|
|
1973
|
+
var includedCdataInside = {};
|
|
1974
|
+
includedCdataInside['language-' + lang] = {
|
|
1975
|
+
pattern: /(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,
|
|
1976
|
+
lookbehind: true,
|
|
1977
|
+
inside: Prism.languages[lang]
|
|
1978
|
+
};
|
|
1979
|
+
includedCdataInside['cdata'] = /^<!\[CDATA\[|\]\]>$/i;
|
|
1980
|
+
|
|
1981
|
+
var inside = {
|
|
1982
|
+
'included-cdata': {
|
|
1983
|
+
pattern: /<!\[CDATA\[[\s\S]*?\]\]>/i,
|
|
1984
|
+
inside: includedCdataInside
|
|
1985
|
+
}
|
|
1986
|
+
};
|
|
1987
|
+
inside['language-' + lang] = {
|
|
1988
|
+
pattern: /[\s\S]+/,
|
|
1989
|
+
inside: Prism.languages[lang]
|
|
1990
|
+
};
|
|
1991
|
+
|
|
1992
|
+
var def = {};
|
|
1993
|
+
def[tagName] = {
|
|
1994
|
+
pattern: RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g, function () { return tagName; }), 'i'),
|
|
1995
|
+
lookbehind: true,
|
|
1996
|
+
greedy: true,
|
|
1997
|
+
inside: inside
|
|
1998
|
+
};
|
|
1999
|
+
|
|
2000
|
+
Prism.languages.insertBefore('markup', 'cdata', def);
|
|
2001
|
+
}
|
|
2002
|
+
});
|
|
2003
|
+
Object.defineProperty(Prism.languages.markup.tag, 'addAttribute', {
|
|
2004
|
+
/**
|
|
2005
|
+
* Adds an pattern to highlight languages embedded in HTML attributes.
|
|
2006
|
+
*
|
|
2007
|
+
* An example of an inlined language is CSS with `style` attributes.
|
|
2008
|
+
*
|
|
2009
|
+
* @param {string} attrName The name of the tag that contains the inlined language. This name will be treated as
|
|
2010
|
+
* case insensitive.
|
|
2011
|
+
* @param {string} lang The language key.
|
|
2012
|
+
* @example
|
|
2013
|
+
* addAttribute('style', 'css');
|
|
2014
|
+
*/
|
|
2015
|
+
value: function (attrName, lang) {
|
|
2016
|
+
Prism.languages.markup.tag.inside['special-attr'].push({
|
|
2017
|
+
pattern: RegExp(
|
|
2018
|
+
/(^|["'\s])/.source + '(?:' + attrName + ')' + /\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,
|
|
2019
|
+
'i'
|
|
2020
|
+
),
|
|
2021
|
+
lookbehind: true,
|
|
2022
|
+
inside: {
|
|
2023
|
+
'attr-name': /^[^\s=]+/,
|
|
2024
|
+
'attr-value': {
|
|
2025
|
+
pattern: /=[\s\S]+/,
|
|
2026
|
+
inside: {
|
|
2027
|
+
'value': {
|
|
2028
|
+
pattern: /(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,
|
|
2029
|
+
lookbehind: true,
|
|
2030
|
+
alias: [lang, 'language-' + lang],
|
|
2031
|
+
inside: Prism.languages[lang]
|
|
2032
|
+
},
|
|
2033
|
+
'punctuation': [
|
|
2034
|
+
{
|
|
2035
|
+
pattern: /^=/,
|
|
2036
|
+
alias: 'attr-equals'
|
|
2037
|
+
},
|
|
2038
|
+
/"|'/
|
|
2039
|
+
]
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
});
|
|
2044
|
+
}
|
|
2045
|
+
});
|
|
2046
|
+
|
|
2047
|
+
Prism.languages.html = Prism.languages.markup;
|
|
2048
|
+
Prism.languages.mathml = Prism.languages.markup;
|
|
2049
|
+
Prism.languages.svg = Prism.languages.markup;
|
|
2050
|
+
|
|
2051
|
+
Prism.languages.xml = Prism.languages.extend('markup', {});
|
|
2052
|
+
Prism.languages.ssml = Prism.languages.xml;
|
|
2053
|
+
Prism.languages.atom = Prism.languages.xml;
|
|
2054
|
+
Prism.languages.rss = Prism.languages.xml;
|
|
2055
|
+
|
|
2056
|
+
|
|
2057
|
+
/* **********************************************
|
|
2058
|
+
Begin prism-css.js
|
|
2059
|
+
********************************************** */
|
|
2060
|
+
|
|
2061
|
+
(function (Prism) {
|
|
2062
|
+
|
|
2063
|
+
var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
2064
|
+
|
|
2065
|
+
Prism.languages.css = {
|
|
2066
|
+
'comment': /\/\*[\s\S]*?\*\//,
|
|
2067
|
+
'atrule': {
|
|
2068
|
+
pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
|
|
2069
|
+
inside: {
|
|
2070
|
+
'rule': /^@[\w-]+/,
|
|
2071
|
+
'selector-function-argument': {
|
|
2072
|
+
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
|
2073
|
+
lookbehind: true,
|
|
2074
|
+
alias: 'selector'
|
|
2075
|
+
},
|
|
2076
|
+
'keyword': {
|
|
2077
|
+
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
|
2078
|
+
lookbehind: true
|
|
2079
|
+
}
|
|
2080
|
+
// See rest below
|
|
2081
|
+
}
|
|
2082
|
+
},
|
|
2083
|
+
'url': {
|
|
2084
|
+
// https://drafts.csswg.org/css-values-3/#urls
|
|
2085
|
+
pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
|
|
2086
|
+
greedy: true,
|
|
2087
|
+
inside: {
|
|
2088
|
+
'function': /^url/i,
|
|
2089
|
+
'punctuation': /^\(|\)$/,
|
|
2090
|
+
'string': {
|
|
2091
|
+
pattern: RegExp('^' + string.source + '$'),
|
|
2092
|
+
alias: 'url'
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
},
|
|
2096
|
+
'selector': {
|
|
2097
|
+
pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
|
|
2098
|
+
lookbehind: true
|
|
2099
|
+
},
|
|
2100
|
+
'string': {
|
|
2101
|
+
pattern: string,
|
|
2102
|
+
greedy: true
|
|
2103
|
+
},
|
|
2104
|
+
'property': {
|
|
2105
|
+
pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
|
2106
|
+
lookbehind: true
|
|
2107
|
+
},
|
|
2108
|
+
'important': /!important\b/i,
|
|
2109
|
+
'function': {
|
|
2110
|
+
pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
|
2111
|
+
lookbehind: true
|
|
2112
|
+
},
|
|
2113
|
+
'punctuation': /[(){};:,]/
|
|
2114
|
+
};
|
|
2115
|
+
|
|
2116
|
+
Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
|
|
2117
|
+
|
|
2118
|
+
var markup = Prism.languages.markup;
|
|
2119
|
+
if (markup) {
|
|
2120
|
+
markup.tag.addInlined('style', 'css');
|
|
2121
|
+
markup.tag.addAttribute('style', 'css');
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
}(Prism));
|
|
2125
|
+
|
|
2126
|
+
|
|
2127
|
+
/* **********************************************
|
|
2128
|
+
Begin prism-clike.js
|
|
2129
|
+
********************************************** */
|
|
2130
|
+
|
|
2131
|
+
Prism.languages.clike = {
|
|
2132
|
+
'comment': [
|
|
2133
|
+
{
|
|
2134
|
+
pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
|
|
2135
|
+
lookbehind: true,
|
|
2136
|
+
greedy: true
|
|
2137
|
+
},
|
|
2138
|
+
{
|
|
2139
|
+
pattern: /(^|[^\\:])\/\/.*/,
|
|
2140
|
+
lookbehind: true,
|
|
2141
|
+
greedy: true
|
|
2142
|
+
}
|
|
2143
|
+
],
|
|
2144
|
+
'string': {
|
|
2145
|
+
pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,
|
|
2146
|
+
greedy: true
|
|
2147
|
+
},
|
|
2148
|
+
'class-name': {
|
|
2149
|
+
pattern: /(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,
|
|
2150
|
+
lookbehind: true,
|
|
2151
|
+
inside: {
|
|
2152
|
+
'punctuation': /[.\\]/
|
|
2153
|
+
}
|
|
2154
|
+
},
|
|
2155
|
+
'keyword': /\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,
|
|
2156
|
+
'boolean': /\b(?:false|true)\b/,
|
|
2157
|
+
'function': /\b\w+(?=\()/,
|
|
2158
|
+
'number': /\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,
|
|
2159
|
+
'operator': /[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,
|
|
2160
|
+
'punctuation': /[{}[\];(),.:]/
|
|
2161
|
+
};
|
|
2162
|
+
|
|
2163
|
+
|
|
2164
|
+
/* **********************************************
|
|
2165
|
+
Begin prism-javascript.js
|
|
2166
|
+
********************************************** */
|
|
2167
|
+
|
|
2168
|
+
Prism.languages.javascript = Prism.languages.extend('clike', {
|
|
2169
|
+
'class-name': [
|
|
2170
|
+
Prism.languages.clike['class-name'],
|
|
2171
|
+
{
|
|
2172
|
+
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,
|
|
2173
|
+
lookbehind: true
|
|
2174
|
+
}
|
|
2175
|
+
],
|
|
2176
|
+
'keyword': [
|
|
2177
|
+
{
|
|
2178
|
+
pattern: /((?:^|\})\s*)catch\b/,
|
|
2179
|
+
lookbehind: true
|
|
2180
|
+
},
|
|
2181
|
+
{
|
|
2182
|
+
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/,
|
|
2183
|
+
lookbehind: true
|
|
2184
|
+
},
|
|
2185
|
+
],
|
|
2186
|
+
// Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444)
|
|
2187
|
+
'function': /#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,
|
|
2188
|
+
'number': {
|
|
2189
|
+
pattern: RegExp(
|
|
2190
|
+
/(^|[^\w$])/.source +
|
|
2191
|
+
'(?:' +
|
|
2192
|
+
(
|
|
2193
|
+
// constant
|
|
2194
|
+
/NaN|Infinity/.source +
|
|
2195
|
+
'|' +
|
|
2196
|
+
// binary integer
|
|
2197
|
+
/0[bB][01]+(?:_[01]+)*n?/.source +
|
|
2198
|
+
'|' +
|
|
2199
|
+
// octal integer
|
|
2200
|
+
/0[oO][0-7]+(?:_[0-7]+)*n?/.source +
|
|
2201
|
+
'|' +
|
|
2202
|
+
// hexadecimal integer
|
|
2203
|
+
/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source +
|
|
2204
|
+
'|' +
|
|
2205
|
+
// decimal bigint
|
|
2206
|
+
/\d+(?:_\d+)*n/.source +
|
|
2207
|
+
'|' +
|
|
2208
|
+
// decimal number (integer or float) but no bigint
|
|
2209
|
+
/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source
|
|
2210
|
+
) +
|
|
2211
|
+
')' +
|
|
2212
|
+
/(?![\w$])/.source
|
|
2213
|
+
),
|
|
2214
|
+
lookbehind: true
|
|
2215
|
+
},
|
|
2216
|
+
'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/
|
|
2217
|
+
});
|
|
2218
|
+
|
|
2219
|
+
Prism.languages.javascript['class-name'][0].pattern = /(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;
|
|
2220
|
+
|
|
2221
|
+
Prism.languages.insertBefore('javascript', 'keyword', {
|
|
2222
|
+
'regex': {
|
|
2223
|
+
pattern: RegExp(
|
|
2224
|
+
// lookbehind
|
|
2225
|
+
// eslint-disable-next-line regexp/no-dupe-characters-character-class
|
|
2226
|
+
/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source +
|
|
2227
|
+
// Regex pattern:
|
|
2228
|
+
// There are 2 regex patterns here. The RegExp set notation proposal added support for nested character
|
|
2229
|
+
// classes if the `v` flag is present. Unfortunately, nested CCs are both context-free and incompatible
|
|
2230
|
+
// with the only syntax, so we have to define 2 different regex patterns.
|
|
2231
|
+
/\//.source +
|
|
2232
|
+
'(?:' +
|
|
2233
|
+
/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source +
|
|
2234
|
+
'|' +
|
|
2235
|
+
// `v` flag syntax. This supports 3 levels of nested character classes.
|
|
2236
|
+
/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source +
|
|
2237
|
+
')' +
|
|
2238
|
+
// lookahead
|
|
2239
|
+
/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source
|
|
2240
|
+
),
|
|
2241
|
+
lookbehind: true,
|
|
2242
|
+
greedy: true,
|
|
2243
|
+
inside: {
|
|
2244
|
+
'regex-source': {
|
|
2245
|
+
pattern: /^(\/)[\s\S]+(?=\/[a-z]*$)/,
|
|
2246
|
+
lookbehind: true,
|
|
2247
|
+
alias: 'language-regex',
|
|
2248
|
+
inside: Prism.languages.regex
|
|
2249
|
+
},
|
|
2250
|
+
'regex-delimiter': /^\/|\/$/,
|
|
2251
|
+
'regex-flags': /^[a-z]+$/,
|
|
2252
|
+
}
|
|
2253
|
+
},
|
|
2254
|
+
// This must be declared before keyword because we use "function" inside the look-forward
|
|
2255
|
+
'function-variable': {
|
|
2256
|
+
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*=>))/,
|
|
2257
|
+
alias: 'function'
|
|
2258
|
+
},
|
|
2259
|
+
'parameter': [
|
|
2260
|
+
{
|
|
2261
|
+
pattern: /(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,
|
|
2262
|
+
lookbehind: true,
|
|
2263
|
+
inside: Prism.languages.javascript
|
|
2264
|
+
},
|
|
2265
|
+
{
|
|
2266
|
+
pattern: /(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,
|
|
2267
|
+
lookbehind: true,
|
|
2268
|
+
inside: Prism.languages.javascript
|
|
2269
|
+
},
|
|
2270
|
+
{
|
|
2271
|
+
pattern: /(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,
|
|
2272
|
+
lookbehind: true,
|
|
2273
|
+
inside: Prism.languages.javascript
|
|
2274
|
+
},
|
|
2275
|
+
{
|
|
2276
|
+
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*\{)/,
|
|
2277
|
+
lookbehind: true,
|
|
2278
|
+
inside: Prism.languages.javascript
|
|
2279
|
+
}
|
|
2280
|
+
],
|
|
2281
|
+
'constant': /\b[A-Z](?:[A-Z_]|\dx?)*\b/
|
|
2282
|
+
});
|
|
2283
|
+
|
|
2284
|
+
Prism.languages.insertBefore('javascript', 'string', {
|
|
2285
|
+
'hashbang': {
|
|
2286
|
+
pattern: /^#!.*/,
|
|
2287
|
+
greedy: true,
|
|
2288
|
+
alias: 'comment'
|
|
2289
|
+
},
|
|
2290
|
+
'template-string': {
|
|
2291
|
+
pattern: /`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,
|
|
2292
|
+
greedy: true,
|
|
2293
|
+
inside: {
|
|
2294
|
+
'template-punctuation': {
|
|
2295
|
+
pattern: /^`|`$/,
|
|
2296
|
+
alias: 'string'
|
|
2297
|
+
},
|
|
2298
|
+
'interpolation': {
|
|
2299
|
+
pattern: /((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,
|
|
2300
|
+
lookbehind: true,
|
|
2301
|
+
inside: {
|
|
2302
|
+
'interpolation-punctuation': {
|
|
2303
|
+
pattern: /^\$\{|\}$/,
|
|
2304
|
+
alias: 'punctuation'
|
|
2305
|
+
},
|
|
2306
|
+
rest: Prism.languages.javascript
|
|
2307
|
+
}
|
|
2308
|
+
},
|
|
2309
|
+
'string': /[\s\S]+/
|
|
2310
|
+
}
|
|
2311
|
+
},
|
|
2312
|
+
'string-property': {
|
|
2313
|
+
pattern: /((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,
|
|
2314
|
+
lookbehind: true,
|
|
2315
|
+
greedy: true,
|
|
2316
|
+
alias: 'property'
|
|
2317
|
+
}
|
|
2318
|
+
});
|
|
2319
|
+
|
|
2320
|
+
Prism.languages.insertBefore('javascript', 'operator', {
|
|
2321
|
+
'literal-property': {
|
|
2322
|
+
pattern: /((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,
|
|
2323
|
+
lookbehind: true,
|
|
2324
|
+
alias: 'property'
|
|
2325
|
+
},
|
|
2326
|
+
});
|
|
2327
|
+
|
|
2328
|
+
if (Prism.languages.markup) {
|
|
2329
|
+
Prism.languages.markup.tag.addInlined('script', 'javascript');
|
|
2330
|
+
|
|
2331
|
+
// add attribute support for all DOM events.
|
|
2332
|
+
// https://developer.mozilla.org/en-US/docs/Web/Events#Standard_events
|
|
2333
|
+
Prism.languages.markup.tag.addAttribute(
|
|
2334
|
+
/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,
|
|
2335
|
+
'javascript'
|
|
2336
|
+
);
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2339
|
+
Prism.languages.js = Prism.languages.javascript;
|
|
2340
|
+
|
|
2341
|
+
|
|
2342
|
+
/* **********************************************
|
|
2343
|
+
Begin prism-file-highlight.js
|
|
2344
|
+
********************************************** */
|
|
2345
|
+
|
|
2346
|
+
(function () {
|
|
2347
|
+
|
|
2348
|
+
if (typeof Prism === 'undefined' || typeof document === 'undefined') {
|
|
2349
|
+
return;
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
|
|
2353
|
+
if (!Element.prototype.matches) {
|
|
2354
|
+
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
2355
|
+
}
|
|
2356
|
+
|
|
2357
|
+
var LOADING_MESSAGE = 'Loading…';
|
|
2358
|
+
var FAILURE_MESSAGE = function (status, message) {
|
|
2359
|
+
return '✖ Error ' + status + ' while fetching file: ' + message;
|
|
2360
|
+
};
|
|
2361
|
+
var FAILURE_EMPTY_MESSAGE = '✖ Error: File does not exist or is empty';
|
|
2362
|
+
|
|
2363
|
+
var EXTENSIONS = {
|
|
2364
|
+
'js': 'javascript',
|
|
2365
|
+
'py': 'python',
|
|
2366
|
+
'rb': 'ruby',
|
|
2367
|
+
'ps1': 'powershell',
|
|
2368
|
+
'psm1': 'powershell',
|
|
2369
|
+
'sh': 'bash',
|
|
2370
|
+
'bat': 'batch',
|
|
2371
|
+
'h': 'c',
|
|
2372
|
+
'tex': 'latex'
|
|
2373
|
+
};
|
|
2374
|
+
|
|
2375
|
+
var STATUS_ATTR = 'data-src-status';
|
|
2376
|
+
var STATUS_LOADING = 'loading';
|
|
2377
|
+
var STATUS_LOADED = 'loaded';
|
|
2378
|
+
var STATUS_FAILED = 'failed';
|
|
2379
|
+
|
|
2380
|
+
var SELECTOR = 'pre[data-src]:not([' + STATUS_ATTR + '="' + STATUS_LOADED + '"])'
|
|
2381
|
+
+ ':not([' + STATUS_ATTR + '="' + STATUS_LOADING + '"])';
|
|
2382
|
+
|
|
2383
|
+
/**
|
|
2384
|
+
* Loads the given file.
|
|
2385
|
+
*
|
|
2386
|
+
* @param {string} src The URL or path of the source file to load.
|
|
2387
|
+
* @param {(result: string) => void} success
|
|
2388
|
+
* @param {(reason: string) => void} error
|
|
2389
|
+
*/
|
|
2390
|
+
function loadFile(src, success, error) {
|
|
2391
|
+
var xhr = new XMLHttpRequest();
|
|
2392
|
+
xhr.open('GET', src, true);
|
|
2393
|
+
xhr.onreadystatechange = function () {
|
|
2394
|
+
if (xhr.readyState == 4) {
|
|
2395
|
+
if (xhr.status < 400 && xhr.responseText) {
|
|
2396
|
+
success(xhr.responseText);
|
|
2397
|
+
} else {
|
|
2398
|
+
if (xhr.status >= 400) {
|
|
2399
|
+
error(FAILURE_MESSAGE(xhr.status, xhr.statusText));
|
|
2400
|
+
} else {
|
|
2401
|
+
error(FAILURE_EMPTY_MESSAGE);
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
};
|
|
2406
|
+
xhr.send(null);
|
|
2407
|
+
}
|
|
2408
|
+
|
|
2409
|
+
/**
|
|
2410
|
+
* Parses the given range.
|
|
2411
|
+
*
|
|
2412
|
+
* This returns a range with inclusive ends.
|
|
2413
|
+
*
|
|
2414
|
+
* @param {string | null | undefined} range
|
|
2415
|
+
* @returns {[number, number | undefined] | undefined}
|
|
2416
|
+
*/
|
|
2417
|
+
function parseRange(range) {
|
|
2418
|
+
var m = /^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(range || '');
|
|
2419
|
+
if (m) {
|
|
2420
|
+
var start = Number(m[1]);
|
|
2421
|
+
var comma = m[2];
|
|
2422
|
+
var end = m[3];
|
|
2423
|
+
|
|
2424
|
+
if (!comma) {
|
|
2425
|
+
return [start, start];
|
|
2426
|
+
}
|
|
2427
|
+
if (!end) {
|
|
2428
|
+
return [start, undefined];
|
|
2429
|
+
}
|
|
2430
|
+
return [start, Number(end)];
|
|
2431
|
+
}
|
|
2432
|
+
return undefined;
|
|
2433
|
+
}
|
|
2434
|
+
|
|
2435
|
+
Prism.hooks.add('before-highlightall', function (env) {
|
|
2436
|
+
env.selector += ', ' + SELECTOR;
|
|
2437
|
+
});
|
|
2438
|
+
|
|
2439
|
+
Prism.hooks.add('before-sanity-check', function (env) {
|
|
2440
|
+
var pre = /** @type {HTMLPreElement} */ (env.element);
|
|
2441
|
+
if (pre.matches(SELECTOR)) {
|
|
2442
|
+
env.code = ''; // fast-path the whole thing and go to complete
|
|
2443
|
+
|
|
2444
|
+
pre.setAttribute(STATUS_ATTR, STATUS_LOADING); // mark as loading
|
|
2445
|
+
|
|
2446
|
+
// add code element with loading message
|
|
2447
|
+
var code = pre.appendChild(document.createElement('CODE'));
|
|
2448
|
+
code.textContent = LOADING_MESSAGE;
|
|
2449
|
+
|
|
2450
|
+
var src = pre.getAttribute('data-src');
|
|
2451
|
+
|
|
2452
|
+
var language = env.language;
|
|
2453
|
+
if (language === 'none') {
|
|
2454
|
+
// the language might be 'none' because there is no language set;
|
|
2455
|
+
// in this case, we want to use the extension as the language
|
|
2456
|
+
var extension = (/\.(\w+)$/.exec(src) || [, 'none'])[1];
|
|
2457
|
+
language = EXTENSIONS[extension] || extension;
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
// set language classes
|
|
2461
|
+
Prism.util.setLanguage(code, language);
|
|
2462
|
+
Prism.util.setLanguage(pre, language);
|
|
2463
|
+
|
|
2464
|
+
// preload the language
|
|
2465
|
+
var autoloader = Prism.plugins.autoloader;
|
|
2466
|
+
if (autoloader) {
|
|
2467
|
+
autoloader.loadLanguages(language);
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
// load file
|
|
2471
|
+
loadFile(
|
|
2472
|
+
src,
|
|
2473
|
+
function (text) {
|
|
2474
|
+
// mark as loaded
|
|
2475
|
+
pre.setAttribute(STATUS_ATTR, STATUS_LOADED);
|
|
2476
|
+
|
|
2477
|
+
// handle data-range
|
|
2478
|
+
var range = parseRange(pre.getAttribute('data-range'));
|
|
2479
|
+
if (range) {
|
|
2480
|
+
var lines = text.split(/\r\n?|\n/g);
|
|
2481
|
+
|
|
2482
|
+
// the range is one-based and inclusive on both ends
|
|
2483
|
+
var start = range[0];
|
|
2484
|
+
var end = range[1] == null ? lines.length : range[1];
|
|
2485
|
+
|
|
2486
|
+
if (start < 0) { start += lines.length; }
|
|
2487
|
+
start = Math.max(0, Math.min(start - 1, lines.length));
|
|
2488
|
+
if (end < 0) { end += lines.length; }
|
|
2489
|
+
end = Math.max(0, Math.min(end, lines.length));
|
|
2490
|
+
|
|
2491
|
+
text = lines.slice(start, end).join('\n');
|
|
2492
|
+
|
|
2493
|
+
// add data-start for line numbers
|
|
2494
|
+
if (!pre.hasAttribute('data-start')) {
|
|
2495
|
+
pre.setAttribute('data-start', String(start + 1));
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2499
|
+
// highlight code
|
|
2500
|
+
code.textContent = text;
|
|
2501
|
+
Prism.highlightElement(code);
|
|
2502
|
+
},
|
|
2503
|
+
function (error) {
|
|
2504
|
+
// mark as failed
|
|
2505
|
+
pre.setAttribute(STATUS_ATTR, STATUS_FAILED);
|
|
2506
|
+
|
|
2507
|
+
code.textContent = error;
|
|
2508
|
+
}
|
|
2509
|
+
);
|
|
2510
|
+
}
|
|
2511
|
+
});
|
|
2512
|
+
|
|
2513
|
+
Prism.plugins.fileHighlight = {
|
|
2514
|
+
/**
|
|
2515
|
+
* Executes the File Highlight plugin for all matching `pre` elements under the given container.
|
|
2516
|
+
*
|
|
2517
|
+
* Note: Elements which are already loaded or currently loading will not be touched by this method.
|
|
2518
|
+
*
|
|
2519
|
+
* @param {ParentNode} [container=document]
|
|
2520
|
+
*/
|
|
2521
|
+
highlight: function highlight(container) {
|
|
2522
|
+
var elements = (container || document).querySelectorAll(SELECTOR);
|
|
2523
|
+
|
|
2524
|
+
for (var i = 0, element; (element = elements[i++]);) {
|
|
2525
|
+
Prism.highlightElement(element);
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
};
|
|
2529
|
+
|
|
2530
|
+
var logged = false;
|
|
2531
|
+
/** @deprecated Use `Prism.plugins.fileHighlight.highlight` instead. */
|
|
2532
|
+
Prism.fileHighlight = function () {
|
|
2533
|
+
if (!logged) {
|
|
2534
|
+
console.warn('Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead.');
|
|
2535
|
+
logged = true;
|
|
2536
|
+
}
|
|
2537
|
+
Prism.plugins.fileHighlight.highlight.apply(this, arguments);
|
|
2538
|
+
};
|
|
2539
|
+
|
|
2540
|
+
}());
|
|
2541
|
+
}(prism));
|
|
2542
|
+
|
|
2543
|
+
const Prism$1 = prism.exports;
|
|
2544
|
+
|
|
2545
|
+
Prism.languages.python = {
|
|
2546
|
+
'comment': {
|
|
2547
|
+
pattern: /(^|[^\\])#.*/,
|
|
2548
|
+
lookbehind: true,
|
|
2549
|
+
greedy: true
|
|
2550
|
+
},
|
|
2551
|
+
'string-interpolation': {
|
|
2552
|
+
pattern: /(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,
|
|
2553
|
+
greedy: true,
|
|
2554
|
+
inside: {
|
|
2555
|
+
'interpolation': {
|
|
2556
|
+
// "{" <expression> <optional "!s", "!r", or "!a"> <optional ":" format specifier> "}"
|
|
2557
|
+
pattern: /((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,
|
|
2558
|
+
lookbehind: true,
|
|
2559
|
+
inside: {
|
|
2560
|
+
'format-spec': {
|
|
2561
|
+
pattern: /(:)[^:(){}]+(?=\}$)/,
|
|
2562
|
+
lookbehind: true
|
|
2563
|
+
},
|
|
2564
|
+
'conversion-option': {
|
|
2565
|
+
pattern: //,
|
|
2566
|
+
alias: 'punctuation'
|
|
2567
|
+
},
|
|
2568
|
+
rest: null
|
|
2569
|
+
}
|
|
2570
|
+
},
|
|
2571
|
+
'string': /[\s\S]+/
|
|
2572
|
+
}
|
|
2573
|
+
},
|
|
2574
|
+
'triple-quoted-string': {
|
|
2575
|
+
pattern: /(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,
|
|
2576
|
+
greedy: true,
|
|
2577
|
+
alias: 'string'
|
|
2578
|
+
},
|
|
2579
|
+
'string': {
|
|
2580
|
+
pattern: /(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,
|
|
2581
|
+
greedy: true
|
|
2582
|
+
},
|
|
2583
|
+
'function': {
|
|
2584
|
+
pattern: /((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,
|
|
2585
|
+
lookbehind: true
|
|
2586
|
+
},
|
|
2587
|
+
'class-name': {
|
|
2588
|
+
pattern: /(\bclass\s+)\w+/i,
|
|
2589
|
+
lookbehind: true
|
|
2590
|
+
},
|
|
2591
|
+
'decorator': {
|
|
2592
|
+
pattern: /(^[\t ]*)@\w+(?:\.\w+)*/m,
|
|
2593
|
+
lookbehind: true,
|
|
2594
|
+
alias: ['annotation', 'punctuation'],
|
|
2595
|
+
inside: {
|
|
2596
|
+
'punctuation': /\./
|
|
2597
|
+
}
|
|
2598
|
+
},
|
|
2599
|
+
'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/,
|
|
2600
|
+
'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/,
|
|
2601
|
+
'boolean': /\b(?:False|None|True)\b/,
|
|
2602
|
+
'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,
|
|
2603
|
+
'operator': /[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,
|
|
2604
|
+
'punctuation': /[{}[\];(),.:]/
|
|
2605
|
+
};
|
|
2606
|
+
|
|
2607
|
+
Prism.languages.python['string-interpolation'].inside['interpolation'].inside.rest = Prism.languages.python;
|
|
2608
|
+
|
|
2609
|
+
Prism.languages.py = Prism.languages.python;
|
|
2610
|
+
|
|
2611
|
+
(function (Prism) {
|
|
2612
|
+
// $ set | grep '^[A-Z][^[:space:]]*=' | cut -d= -f1 | tr '\n' '|'
|
|
2613
|
+
// + LC_ALL, RANDOM, REPLY, SECONDS.
|
|
2614
|
+
// + make sure PS1..4 are here as they are not always set,
|
|
2615
|
+
// - some useless things.
|
|
2616
|
+
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';
|
|
2617
|
+
|
|
2618
|
+
var commandAfterHeredoc = {
|
|
2619
|
+
pattern: /(^(["']?)\w+\2)[ \t]+\S.*/,
|
|
2620
|
+
lookbehind: true,
|
|
2621
|
+
alias: 'punctuation', // this looks reasonably well in all themes
|
|
2622
|
+
inside: null // see below
|
|
2623
|
+
};
|
|
2624
|
+
|
|
2625
|
+
var insideString = {
|
|
2626
|
+
'bash': commandAfterHeredoc,
|
|
2627
|
+
'environment': {
|
|
2628
|
+
pattern: RegExp('\\$' + envVars),
|
|
2629
|
+
alias: 'constant'
|
|
2630
|
+
},
|
|
2631
|
+
'variable': [
|
|
2632
|
+
// [0]: Arithmetic Environment
|
|
2633
|
+
{
|
|
2634
|
+
pattern: /\$?\(\([\s\S]+?\)\)/,
|
|
2635
|
+
greedy: true,
|
|
2636
|
+
inside: {
|
|
2637
|
+
// If there is a $ sign at the beginning highlight $(( and )) as variable
|
|
2638
|
+
'variable': [
|
|
2639
|
+
{
|
|
2640
|
+
pattern: /(^\$\(\([\s\S]+)\)\)/,
|
|
2641
|
+
lookbehind: true
|
|
2642
|
+
},
|
|
2643
|
+
/^\$\(\(/
|
|
2644
|
+
],
|
|
2645
|
+
'number': /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,
|
|
2646
|
+
// Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic
|
|
2647
|
+
'operator': /--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,
|
|
2648
|
+
// If there is no $ sign at the beginning highlight (( and )) as punctuation
|
|
2649
|
+
'punctuation': /\(\(?|\)\)?|,|;/
|
|
2650
|
+
}
|
|
2651
|
+
},
|
|
2652
|
+
// [1]: Command Substitution
|
|
2653
|
+
{
|
|
2654
|
+
pattern: /\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,
|
|
2655
|
+
greedy: true,
|
|
2656
|
+
inside: {
|
|
2657
|
+
'variable': /^\$\(|^`|\)$|`$/
|
|
2658
|
+
}
|
|
2659
|
+
},
|
|
2660
|
+
// [2]: Brace expansion
|
|
2661
|
+
{
|
|
2662
|
+
pattern: /\$\{[^}]+\}/,
|
|
2663
|
+
greedy: true,
|
|
2664
|
+
inside: {
|
|
2665
|
+
'operator': /:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,
|
|
2666
|
+
'punctuation': /[\[\]]/,
|
|
2667
|
+
'environment': {
|
|
2668
|
+
pattern: RegExp('(\\{)' + envVars),
|
|
2669
|
+
lookbehind: true,
|
|
2670
|
+
alias: 'constant'
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
},
|
|
2674
|
+
/\$(?:\w+|[#?*!@$])/
|
|
2675
|
+
],
|
|
2676
|
+
// Escape sequences from echo and printf's manuals, and escaped quotes.
|
|
2677
|
+
'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})/
|
|
2678
|
+
};
|
|
2679
|
+
|
|
2680
|
+
Prism.languages.bash = {
|
|
2681
|
+
'shebang': {
|
|
2682
|
+
pattern: /^#!\s*\/.*/,
|
|
2683
|
+
alias: 'important'
|
|
2684
|
+
},
|
|
2685
|
+
'comment': {
|
|
2686
|
+
pattern: /(^|[^"{\\$])#.*/,
|
|
2687
|
+
lookbehind: true
|
|
2688
|
+
},
|
|
2689
|
+
'function-name': [
|
|
2690
|
+
// a) function foo {
|
|
2691
|
+
// b) foo() {
|
|
2692
|
+
// c) function foo() {
|
|
2693
|
+
// but not “foo {”
|
|
2694
|
+
{
|
|
2695
|
+
// a) and c)
|
|
2696
|
+
pattern: /(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,
|
|
2697
|
+
lookbehind: true,
|
|
2698
|
+
alias: 'function'
|
|
2699
|
+
},
|
|
2700
|
+
{
|
|
2701
|
+
// b)
|
|
2702
|
+
pattern: /\b[\w-]+(?=\s*\(\s*\)\s*\{)/,
|
|
2703
|
+
alias: 'function'
|
|
2704
|
+
}
|
|
2705
|
+
],
|
|
2706
|
+
// Highlight variable names as variables in for and select beginnings.
|
|
2707
|
+
'for-or-select': {
|
|
2708
|
+
pattern: /(\b(?:for|select)\s+)\w+(?=\s+in\s)/,
|
|
2709
|
+
alias: 'variable',
|
|
2710
|
+
lookbehind: true
|
|
2711
|
+
},
|
|
2712
|
+
// Highlight variable names as variables in the left-hand part
|
|
2713
|
+
// of assignments (“=” and “+=”).
|
|
2714
|
+
'assign-left': {
|
|
2715
|
+
pattern: /(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,
|
|
2716
|
+
inside: {
|
|
2717
|
+
'environment': {
|
|
2718
|
+
pattern: RegExp('(^|[\\s;|&]|[<>]\\()' + envVars),
|
|
2719
|
+
lookbehind: true,
|
|
2720
|
+
alias: 'constant'
|
|
2721
|
+
}
|
|
2722
|
+
},
|
|
2723
|
+
alias: 'variable',
|
|
2724
|
+
lookbehind: true
|
|
2725
|
+
},
|
|
2726
|
+
// Highlight parameter names as variables
|
|
2727
|
+
'parameter': {
|
|
2728
|
+
pattern: /(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,
|
|
2729
|
+
alias: 'variable',
|
|
2730
|
+
lookbehind: true
|
|
2731
|
+
},
|
|
2732
|
+
'string': [
|
|
2733
|
+
// Support for Here-documents https://en.wikipedia.org/wiki/Here_document
|
|
2734
|
+
{
|
|
2735
|
+
pattern: /((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,
|
|
2736
|
+
lookbehind: true,
|
|
2737
|
+
greedy: true,
|
|
2738
|
+
inside: insideString
|
|
2739
|
+
},
|
|
2740
|
+
// Here-document with quotes around the tag
|
|
2741
|
+
// → No expansion (so no “inside”).
|
|
2742
|
+
{
|
|
2743
|
+
pattern: /((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,
|
|
2744
|
+
lookbehind: true,
|
|
2745
|
+
greedy: true,
|
|
2746
|
+
inside: {
|
|
2747
|
+
'bash': commandAfterHeredoc
|
|
2748
|
+
}
|
|
2749
|
+
},
|
|
2750
|
+
// “Normal” string
|
|
2751
|
+
{
|
|
2752
|
+
// https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html
|
|
2753
|
+
pattern: /(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,
|
|
2754
|
+
lookbehind: true,
|
|
2755
|
+
greedy: true,
|
|
2756
|
+
inside: insideString
|
|
2757
|
+
},
|
|
2758
|
+
{
|
|
2759
|
+
// https://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html
|
|
2760
|
+
pattern: /(^|[^$\\])'[^']*'/,
|
|
2761
|
+
lookbehind: true,
|
|
2762
|
+
greedy: true
|
|
2763
|
+
},
|
|
2764
|
+
{
|
|
2765
|
+
// https://www.gnu.org/software/bash/manual/html_node/ANSI_002dC-Quoting.html
|
|
2766
|
+
pattern: /\$'(?:[^'\\]|\\[\s\S])*'/,
|
|
2767
|
+
greedy: true,
|
|
2768
|
+
inside: {
|
|
2769
|
+
'entity': insideString.entity
|
|
2770
|
+
}
|
|
2771
|
+
}
|
|
2772
|
+
],
|
|
2773
|
+
'environment': {
|
|
2774
|
+
pattern: RegExp('\\$?' + envVars),
|
|
2775
|
+
alias: 'constant'
|
|
2776
|
+
},
|
|
2777
|
+
'variable': insideString.variable,
|
|
2778
|
+
'function': {
|
|
2779
|
+
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;|&])/,
|
|
2780
|
+
lookbehind: true
|
|
2781
|
+
},
|
|
2782
|
+
'keyword': {
|
|
2783
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,
|
|
2784
|
+
lookbehind: true
|
|
2785
|
+
},
|
|
2786
|
+
// https://www.gnu.org/software/bash/manual/html_node/Shell-Builtin-Commands.html
|
|
2787
|
+
'builtin': {
|
|
2788
|
+
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;|&])/,
|
|
2789
|
+
lookbehind: true,
|
|
2790
|
+
// Alias added to make those easier to distinguish from strings.
|
|
2791
|
+
alias: 'class-name'
|
|
2792
|
+
},
|
|
2793
|
+
'boolean': {
|
|
2794
|
+
pattern: /(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,
|
|
2795
|
+
lookbehind: true
|
|
2796
|
+
},
|
|
2797
|
+
'file-descriptor': {
|
|
2798
|
+
pattern: /\B&\d\b/,
|
|
2799
|
+
alias: 'important'
|
|
2800
|
+
},
|
|
2801
|
+
'operator': {
|
|
2802
|
+
// Lots of redirections here, but not just that.
|
|
2803
|
+
pattern: /\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,
|
|
2804
|
+
inside: {
|
|
2805
|
+
'file-descriptor': {
|
|
2806
|
+
pattern: /^\d/,
|
|
2807
|
+
alias: 'important'
|
|
2808
|
+
}
|
|
2809
|
+
}
|
|
2810
|
+
},
|
|
2811
|
+
'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,
|
|
2812
|
+
'number': {
|
|
2813
|
+
pattern: /(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,
|
|
2814
|
+
lookbehind: true
|
|
2815
|
+
}
|
|
2816
|
+
};
|
|
2817
|
+
|
|
2818
|
+
commandAfterHeredoc.inside = Prism.languages.bash;
|
|
2819
|
+
|
|
2820
|
+
/* Patterns in command substitution. */
|
|
2821
|
+
var toBeCopied = [
|
|
2822
|
+
'comment',
|
|
2823
|
+
'function-name',
|
|
2824
|
+
'for-or-select',
|
|
2825
|
+
'assign-left',
|
|
2826
|
+
'parameter',
|
|
2827
|
+
'string',
|
|
2828
|
+
'environment',
|
|
2829
|
+
'function',
|
|
2830
|
+
'keyword',
|
|
2831
|
+
'builtin',
|
|
2832
|
+
'boolean',
|
|
2833
|
+
'file-descriptor',
|
|
2834
|
+
'operator',
|
|
2835
|
+
'punctuation',
|
|
2836
|
+
'number'
|
|
2837
|
+
];
|
|
2838
|
+
var inside = insideString.variable[1].inside;
|
|
2839
|
+
for (var i = 0; i < toBeCopied.length; i++) {
|
|
2840
|
+
inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]];
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2843
|
+
Prism.languages.sh = Prism.languages.bash;
|
|
2844
|
+
Prism.languages.shell = Prism.languages.bash;
|
|
2845
|
+
}(Prism));
|
|
2846
|
+
|
|
2847
|
+
(function (Prism) {
|
|
2848
|
+
|
|
2849
|
+
// https://yaml.org/spec/1.2/spec.html#c-ns-anchor-property
|
|
2850
|
+
// https://yaml.org/spec/1.2/spec.html#c-ns-alias-node
|
|
2851
|
+
var anchorOrAlias = /[*&][^\s[\]{},]+/;
|
|
2852
|
+
// https://yaml.org/spec/1.2/spec.html#c-ns-tag-property
|
|
2853
|
+
var tag = /!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/;
|
|
2854
|
+
// https://yaml.org/spec/1.2/spec.html#c-ns-properties(n,c)
|
|
2855
|
+
var properties = '(?:' + tag.source + '(?:[ \t]+' + anchorOrAlias.source + ')?|'
|
|
2856
|
+
+ anchorOrAlias.source + '(?:[ \t]+' + tag.source + ')?)';
|
|
2857
|
+
// https://yaml.org/spec/1.2/spec.html#ns-plain(n,c)
|
|
2858
|
+
// This is a simplified version that doesn't support "#" and multiline keys
|
|
2859
|
+
// All these long scarry character classes are simplified versions of YAML's characters
|
|
2860
|
+
var plainKey = /(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source
|
|
2861
|
+
.replace(/<PLAIN>/g, function () { return /[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source; });
|
|
2862
|
+
var string = /"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;
|
|
2863
|
+
|
|
2864
|
+
/**
|
|
2865
|
+
*
|
|
2866
|
+
* @param {string} value
|
|
2867
|
+
* @param {string} [flags]
|
|
2868
|
+
* @returns {RegExp}
|
|
2869
|
+
*/
|
|
2870
|
+
function createValuePattern(value, flags) {
|
|
2871
|
+
flags = (flags || '').replace(/m/g, '') + 'm'; // add m flag
|
|
2872
|
+
var pattern = /([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source
|
|
2873
|
+
.replace(/<<prop>>/g, function () { return properties; }).replace(/<<value>>/g, function () { return value; });
|
|
2874
|
+
return RegExp(pattern, flags);
|
|
2875
|
+
}
|
|
2876
|
+
|
|
2877
|
+
Prism.languages.yaml = {
|
|
2878
|
+
'scalar': {
|
|
2879
|
+
pattern: RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source
|
|
2880
|
+
.replace(/<<prop>>/g, function () { return properties; })),
|
|
2881
|
+
lookbehind: true,
|
|
2882
|
+
alias: 'string'
|
|
2883
|
+
},
|
|
2884
|
+
'comment': /#.*/,
|
|
2885
|
+
'key': {
|
|
2886
|
+
pattern: RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source
|
|
2887
|
+
.replace(/<<prop>>/g, function () { return properties; })
|
|
2888
|
+
.replace(/<<key>>/g, function () { return '(?:' + plainKey + '|' + string + ')'; })),
|
|
2889
|
+
lookbehind: true,
|
|
2890
|
+
greedy: true,
|
|
2891
|
+
alias: 'atrule'
|
|
2892
|
+
},
|
|
2893
|
+
'directive': {
|
|
2894
|
+
pattern: /(^[ \t]*)%.+/m,
|
|
2895
|
+
lookbehind: true,
|
|
2896
|
+
alias: 'important'
|
|
2897
|
+
},
|
|
2898
|
+
'datetime': {
|
|
2899
|
+
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),
|
|
2900
|
+
lookbehind: true,
|
|
2901
|
+
alias: 'number'
|
|
2902
|
+
},
|
|
2903
|
+
'boolean': {
|
|
2904
|
+
pattern: createValuePattern(/false|true/.source, 'i'),
|
|
2905
|
+
lookbehind: true,
|
|
2906
|
+
alias: 'important'
|
|
2907
|
+
},
|
|
2908
|
+
'null': {
|
|
2909
|
+
pattern: createValuePattern(/null|~/.source, 'i'),
|
|
2910
|
+
lookbehind: true,
|
|
2911
|
+
alias: 'important'
|
|
2912
|
+
},
|
|
2913
|
+
'string': {
|
|
2914
|
+
pattern: createValuePattern(string),
|
|
2915
|
+
lookbehind: true,
|
|
2916
|
+
greedy: true
|
|
2917
|
+
},
|
|
2918
|
+
'number': {
|
|
2919
|
+
pattern: createValuePattern(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source, 'i'),
|
|
2920
|
+
lookbehind: true
|
|
2921
|
+
},
|
|
2922
|
+
'tag': tag,
|
|
2923
|
+
'important': anchorOrAlias,
|
|
2924
|
+
'punctuation': /---|[:[\]{}\-,|>?]|\.\.\./
|
|
2925
|
+
};
|
|
2926
|
+
|
|
2927
|
+
Prism.languages.yml = Prism.languages.yaml;
|
|
2928
|
+
|
|
2929
|
+
}(Prism));
|
|
2930
|
+
|
|
2931
|
+
(function (Prism) {
|
|
2932
|
+
|
|
2933
|
+
var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
|
|
2934
|
+
|
|
2935
|
+
Prism.languages.css = {
|
|
2936
|
+
'comment': /\/\*[\s\S]*?\*\//,
|
|
2937
|
+
'atrule': {
|
|
2938
|
+
pattern: RegExp('@[\\w-](?:' + /[^;{\s"']|\s+(?!\s)/.source + '|' + string.source + ')*?' + /(?:;|(?=\s*\{))/.source),
|
|
2939
|
+
inside: {
|
|
2940
|
+
'rule': /^@[\w-]+/,
|
|
2941
|
+
'selector-function-argument': {
|
|
2942
|
+
pattern: /(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,
|
|
2943
|
+
lookbehind: true,
|
|
2944
|
+
alias: 'selector'
|
|
2945
|
+
},
|
|
2946
|
+
'keyword': {
|
|
2947
|
+
pattern: /(^|[^\w-])(?:and|not|only|or)(?![\w-])/,
|
|
2948
|
+
lookbehind: true
|
|
2949
|
+
}
|
|
2950
|
+
// See rest below
|
|
2951
|
+
}
|
|
2952
|
+
},
|
|
2953
|
+
'url': {
|
|
2954
|
+
// https://drafts.csswg.org/css-values-3/#urls
|
|
2955
|
+
pattern: RegExp('\\burl\\((?:' + string.source + '|' + /(?:[^\\\r\n()"']|\\[\s\S])*/.source + ')\\)', 'i'),
|
|
2956
|
+
greedy: true,
|
|
2957
|
+
inside: {
|
|
2958
|
+
'function': /^url/i,
|
|
2959
|
+
'punctuation': /^\(|\)$/,
|
|
2960
|
+
'string': {
|
|
2961
|
+
pattern: RegExp('^' + string.source + '$'),
|
|
2962
|
+
alias: 'url'
|
|
2963
|
+
}
|
|
2964
|
+
}
|
|
2965
|
+
},
|
|
2966
|
+
'selector': {
|
|
2967
|
+
pattern: RegExp('(^|[{}\\s])[^{}\\s](?:[^{};"\'\\s]|\\s+(?![\\s{])|' + string.source + ')*(?=\\s*\\{)'),
|
|
2968
|
+
lookbehind: true
|
|
2969
|
+
},
|
|
2970
|
+
'string': {
|
|
2971
|
+
pattern: string,
|
|
2972
|
+
greedy: true
|
|
2973
|
+
},
|
|
2974
|
+
'property': {
|
|
2975
|
+
pattern: /(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,
|
|
2976
|
+
lookbehind: true
|
|
2977
|
+
},
|
|
2978
|
+
'important': /!important\b/i,
|
|
2979
|
+
'function': {
|
|
2980
|
+
pattern: /(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,
|
|
2981
|
+
lookbehind: true
|
|
2982
|
+
},
|
|
2983
|
+
'punctuation': /[(){};:,]/
|
|
2984
|
+
};
|
|
2985
|
+
|
|
2986
|
+
Prism.languages.css['atrule'].inside.rest = Prism.languages.css;
|
|
2987
|
+
|
|
2988
|
+
var markup = Prism.languages.markup;
|
|
2989
|
+
if (markup) {
|
|
2990
|
+
markup.tag.addInlined('style', 'css');
|
|
2991
|
+
markup.tag.addAttribute('style', 'css');
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2994
|
+
}(Prism));
|
|
2995
|
+
|
|
2996
|
+
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}";
|
|
2997
|
+
const EdsCodeBlockStyle0 = edsCodeBlockCss;
|
|
2998
|
+
|
|
2999
|
+
const EdsCodeBlock = class {
|
|
3000
|
+
constructor(hostRef) {
|
|
3001
|
+
index.registerInstance(this, hostRef);
|
|
3002
|
+
this.code = undefined;
|
|
3003
|
+
this.language = undefined;
|
|
3004
|
+
this.copied = false;
|
|
3005
|
+
}
|
|
3006
|
+
/**
|
|
3007
|
+
* Copies the current code content to the clipboard and sets a temporary copied state.
|
|
3008
|
+
*
|
|
3009
|
+
* @private
|
|
3010
|
+
* @returns {void}
|
|
3011
|
+
*/
|
|
3012
|
+
copyToClipboard() {
|
|
3013
|
+
navigator.clipboard.writeText(this.code).then(() => {
|
|
3014
|
+
this.copied = true;
|
|
3015
|
+
/*const analyticsName = this.createHumanFriendlyAnalyticsName(this.code, this.language);
|
|
3016
|
+
sendAnalytics({
|
|
3017
|
+
category: 'ui-component',
|
|
3018
|
+
parentContext: null,
|
|
3019
|
+
tag: this.el.tagName.toLowerCase(),
|
|
3020
|
+
name: analyticsName || '',
|
|
3021
|
+
action: 'copy'
|
|
3022
|
+
});*/
|
|
3023
|
+
setTimeout(() => (this.copied = false), 2000);
|
|
3024
|
+
});
|
|
3025
|
+
}
|
|
3026
|
+
/**
|
|
3027
|
+
* Utility function that creates a human-friendly analytics name based on the code and language.
|
|
3028
|
+
* It uses:
|
|
3029
|
+
* - The language (in uppercase)
|
|
3030
|
+
* - The number of non-empty lines in the code
|
|
3031
|
+
* - The first non-empty line of code (truncated to 30 characters, if needed)
|
|
3032
|
+
*
|
|
3033
|
+
* returns A descriptive analytics name.
|
|
3034
|
+
*/
|
|
3035
|
+
/*private createHumanFriendlyAnalyticsName(code: string, language: string): string {
|
|
3036
|
+
// Count non-empty lines
|
|
3037
|
+
const lines = code.split('\n').filter(line => line.trim() !== '').length;
|
|
3038
|
+
|
|
3039
|
+
// Find the first non-empty line and trim it
|
|
3040
|
+
let firstNonEmptyLine = code.split('\n').find(line => line.trim() !== '');
|
|
3041
|
+
firstNonEmptyLine = firstNonEmptyLine ? firstNonEmptyLine.trim() : '';
|
|
3042
|
+
|
|
3043
|
+
// Truncate the snippet if it’s too long
|
|
3044
|
+
if (firstNonEmptyLine.length > 30) {
|
|
3045
|
+
firstNonEmptyLine = firstNonEmptyLine.substring(0, 30) + '...';
|
|
3046
|
+
}
|
|
3047
|
+
|
|
3048
|
+
return `CodeBlock:${language.toLowerCase()}|${lines}-line(s)|${firstNonEmptyLine.toLowerCase()}`;
|
|
3049
|
+
}*/
|
|
3050
|
+
/**
|
|
3051
|
+
* Returns the syntax-highlighted HTML for the code.
|
|
3052
|
+
* If the provided language is supported by Prism, this method returns the highlighted code.
|
|
3053
|
+
* Otherwise, it logs a warning and returns the raw code.
|
|
3054
|
+
*
|
|
3055
|
+
* @private
|
|
3056
|
+
* @returns {string} The highlighted HTML string for the code block.
|
|
3057
|
+
*/
|
|
3058
|
+
getHighlightedCode() {
|
|
3059
|
+
if (this.language && Prism$1.languages[this.language]) {
|
|
3060
|
+
return Prism$1.highlight(this.code, Prism$1.languages[this.language], this.language);
|
|
3061
|
+
}
|
|
3062
|
+
// eslint-disable-next-line
|
|
3063
|
+
//console.warn(`Unsupported or missing language: ${this.language}`);
|
|
3064
|
+
return this.code; // Fallback if language is not provided or unsupported
|
|
3065
|
+
}
|
|
3066
|
+
render() {
|
|
3067
|
+
return (index.h("div", { key: '3cfaec27c58d05868313150f1a358ff64c8eafbd', class: "relative bg-stronger rounded-sm" }, index.h("div", { key: 'ed91821385f30305348750dbfffec5fdd7b4dbb8', class: "text-inverse flex justify-between items-center p-8" }, this.language ? (index.h("span", { class: "f-ui-03" }, this.language.toUpperCase())) : (index.h("pre", { class: "bg-stronger pl-8", role: "region", "aria-label": "Code block without language" }, index.h("code", { innerHTML: this.getHighlightedCode() }))), index.h("span", { key: '3e419585214883c878a8e84c440dbd29d590002d', "aria-hidden": "true", class: "w-20 h-20 mt-8" }, index.h("eds-icon-wrapper", { key: '051fa9c714d5c077d5d96ec9b92f8a744ec123bc', icon: this.copied ? 'success' : 'copy', onClick: () => this.copyToClipboard() })), index.h("span", { key: '707950ce89cb0c24b1afac42a8801d13659b6bab', class: "sr-only" }, "Copy Code")), this.language && (index.h("pre", { key: '59923dd4c16cfecafffa2edaaac5ef7579c3f128', class: `language-${this.language} bg-stronger pl-8 pb-8`, role: "region", "aria-label": `Code block in ${this.language}` }, index.h("code", { key: '8c708992c04029d71685ad8922383ecdda05ac3c', innerHTML: this.getHighlightedCode() })))));
|
|
3068
|
+
}
|
|
3069
|
+
get el() { return index.getElement(this); }
|
|
3070
|
+
};
|
|
3071
|
+
EdsCodeBlock.style = EdsCodeBlockStyle0;
|
|
3072
|
+
|
|
258
3073
|
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}";
|
|
259
3074
|
const EdsDropdownStyle0 = edsDropdownCss;
|
|
260
3075
|
|
|
@@ -360,14 +3175,14 @@ const EdsDropdown = class {
|
|
|
360
3175
|
* @returns {JSX.Element} The rendered dropdown component.
|
|
361
3176
|
*/
|
|
362
3177
|
render() {
|
|
363
|
-
return (index.h("div", { key: '
|
|
3178
|
+
return (index.h("div", { key: '31e8b1fd4e146cbcad4d74bd78dff1cd1e1950bd', class: "z-focus relative", ref: (el) => (this.dropdownContent = el) }, index.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" }), index.h("nav", { key: '904fd2a7f727a8b3966eab6cf9ebdb0efa474ae0', role: "menu", class: {
|
|
364
3179
|
'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,
|
|
365
3180
|
'left-4': this.dropdownPos === 'left' && this.dropdownOffset,
|
|
366
3181
|
'left-0': this.dropdownPos === 'left' && !this.dropdownOffset,
|
|
367
3182
|
'right-4': this.dropdownPos === 'right' && this.dropdownOffset,
|
|
368
3183
|
'right-0': this.dropdownPos === 'right' && !this.dropdownOffset,
|
|
369
3184
|
'rounded-lg': this.rounded
|
|
370
|
-
}, style: { display: this.isOpen ? 'block' : 'none' }, "aria-label": "Dropdown", "aria-hidden": !this.isOpen }, index.h("slot", { key: '
|
|
3185
|
+
}, style: { display: this.isOpen ? 'block' : 'none' }, "aria-label": "Dropdown", "aria-hidden": !this.isOpen }, index.h("slot", { key: 'b416621930c7117775fef2ee91bdca0f660302f5' }))));
|
|
371
3186
|
}
|
|
372
3187
|
get host() { return index.getElement(this); }
|
|
373
3188
|
};
|
|
@@ -458,6 +3273,13 @@ function findRatingElement(formEl) {
|
|
|
458
3273
|
}
|
|
459
3274
|
return null;
|
|
460
3275
|
}
|
|
3276
|
+
function findNpsElement(formEl) {
|
|
3277
|
+
const elements = Array.from(formEl.querySelectorAll('eds-nps'));
|
|
3278
|
+
for (const element of elements) {
|
|
3279
|
+
return element;
|
|
3280
|
+
}
|
|
3281
|
+
return null;
|
|
3282
|
+
}
|
|
461
3283
|
/**
|
|
462
3284
|
* Validates all fields and returns an object containing the errors and a flag indicating any errors.
|
|
463
3285
|
*/
|
|
@@ -467,6 +3289,7 @@ isFieldVisible) {
|
|
|
467
3289
|
const errors = {};
|
|
468
3290
|
let hasError = false;
|
|
469
3291
|
parsedFields.forEach((field) => {
|
|
3292
|
+
var _a;
|
|
470
3293
|
// Only validate fields that are visible.
|
|
471
3294
|
if (!isFieldVisible(field, values)) {
|
|
472
3295
|
// If a field is hidden, clear its error.
|
|
@@ -502,6 +3325,29 @@ isFieldVisible) {
|
|
|
502
3325
|
}
|
|
503
3326
|
}
|
|
504
3327
|
}
|
|
3328
|
+
// NPS type
|
|
3329
|
+
else if (field.type === 'nps') {
|
|
3330
|
+
const npsEl = findNpsElement(formEl);
|
|
3331
|
+
if (npsEl && npsEl.shadowRoot) {
|
|
3332
|
+
const raw = (_a = npsEl.shadowRoot
|
|
3333
|
+
.querySelector('eds-button[tabindex="0"]')) === null || _a === void 0 ? void 0 : _a.getAttribute('aria-label');
|
|
3334
|
+
const parsed = raw !== null ? parseInt(raw, 10) : NaN;
|
|
3335
|
+
const value = Number.isInteger(parsed) && parsed >= 0 && parsed <= 10 ? parsed : NaN;
|
|
3336
|
+
if (isNaN(value)) {
|
|
3337
|
+
// eslint-disable-next-line
|
|
3338
|
+
if (field.required) {
|
|
3339
|
+
errors[field.name] = ['This field is required.'];
|
|
3340
|
+
hasError = true;
|
|
3341
|
+
}
|
|
3342
|
+
}
|
|
3343
|
+
}
|
|
3344
|
+
else if (field.required) {
|
|
3345
|
+
// No NPS component found but required
|
|
3346
|
+
errors[field.name] = ['This field is required.'];
|
|
3347
|
+
hasError = true;
|
|
3348
|
+
}
|
|
3349
|
+
return;
|
|
3350
|
+
}
|
|
505
3351
|
else {
|
|
506
3352
|
// For all other types, find the first matching element.
|
|
507
3353
|
const inputEl = findFieldElement(formEl, field.name);
|
|
@@ -553,7 +3399,7 @@ function getFormInitData({ initData, parsedFields, currentValues
|
|
|
553
3399
|
return { updatedValues };
|
|
554
3400
|
}
|
|
555
3401
|
|
|
556
|
-
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}";
|
|
3402
|
+
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}";
|
|
557
3403
|
const EdsFormStyle0 = edsFormCss;
|
|
558
3404
|
|
|
559
3405
|
const EdsForm = class {
|
|
@@ -561,13 +3407,17 @@ const EdsForm = class {
|
|
|
561
3407
|
index.registerInstance(this, hostRef);
|
|
562
3408
|
this.form = index.createEvent(this, "form", 7);
|
|
563
3409
|
this.name = 'eds-form';
|
|
3410
|
+
this.title = undefined;
|
|
3411
|
+
this.description = undefined;
|
|
564
3412
|
this.setFormUrl = true;
|
|
565
3413
|
this.formBtn = true;
|
|
566
3414
|
this.formBtnLabel = 'Submit';
|
|
3415
|
+
this.buttonIntent = 'primary';
|
|
567
3416
|
this.errorMessage = 'Some fields in your form are incorrect.';
|
|
568
3417
|
this.fields = [];
|
|
569
3418
|
this.groups = [];
|
|
570
3419
|
this.initData = {};
|
|
3420
|
+
this.formStyle = 'default';
|
|
571
3421
|
this.values = {};
|
|
572
3422
|
this.isSubmitting = false;
|
|
573
3423
|
this.hasError = false;
|
|
@@ -791,6 +3641,25 @@ const EdsForm = class {
|
|
|
791
3641
|
message: `${field.name} updated`
|
|
792
3642
|
});
|
|
793
3643
|
}
|
|
3644
|
+
handleNPS(e, field) {
|
|
3645
|
+
const score = e.detail;
|
|
3646
|
+
this.values = Object.assign(Object.assign({}, this.values), { [field.name]: score });
|
|
3647
|
+
const newErrors = Object.assign({}, this.errors);
|
|
3648
|
+
if (field.required && score === null) {
|
|
3649
|
+
newErrors[field.name] = ['This field is required'];
|
|
3650
|
+
}
|
|
3651
|
+
else {
|
|
3652
|
+
delete newErrors[field.name];
|
|
3653
|
+
}
|
|
3654
|
+
this.errors = newErrors;
|
|
3655
|
+
this.hasError = Object.keys(newErrors).length > 0;
|
|
3656
|
+
this.form.emit({
|
|
3657
|
+
event: 'change',
|
|
3658
|
+
field: field.name,
|
|
3659
|
+
value: score,
|
|
3660
|
+
message: `${field.name} updated`
|
|
3661
|
+
});
|
|
3662
|
+
}
|
|
794
3663
|
handleSubmit() {
|
|
795
3664
|
var _a, _b;
|
|
796
3665
|
if (this.isSubmitting) {
|
|
@@ -846,10 +3715,15 @@ const EdsForm = class {
|
|
|
846
3715
|
}
|
|
847
3716
|
get groupedFields() {
|
|
848
3717
|
const map = {};
|
|
849
|
-
// initialize buckets for each group
|
|
3718
|
+
// initialize buckets for each declared group
|
|
850
3719
|
this.parsedGroups.forEach((g) => (map[g.id] = []));
|
|
3720
|
+
// always keep an ungrouped bucket
|
|
851
3721
|
map['__ungrouped'] = [];
|
|
3722
|
+
// only bucket fields that are currently visible
|
|
852
3723
|
this.parsedFields.forEach((f) => {
|
|
3724
|
+
if (!this.isFieldVisible(f)) {
|
|
3725
|
+
return;
|
|
3726
|
+
}
|
|
853
3727
|
const gid = f.groupId || '__ungrouped';
|
|
854
3728
|
if (!map[gid]) {
|
|
855
3729
|
map[gid] = [];
|
|
@@ -859,7 +3733,7 @@ const EdsForm = class {
|
|
|
859
3733
|
return map;
|
|
860
3734
|
}
|
|
861
3735
|
renderField(field) {
|
|
862
|
-
var _a, _b;
|
|
3736
|
+
var _a, _b, _c;
|
|
863
3737
|
if (!this.isFieldVisible(field)) {
|
|
864
3738
|
return null;
|
|
865
3739
|
}
|
|
@@ -869,7 +3743,10 @@ const EdsForm = class {
|
|
|
869
3743
|
const val = this.values[field.name] || 0;
|
|
870
3744
|
return (index.h("div", { class: "form-group rating-field", key: field.name }, index.h("div", { class: "flex justify-between" }, field && (index.h("eds-input-label", { name: `rating-${field.name}`, label: field.label, disabled: field.disabled, required: field.required }))), index.h("eds-rating", { id: `rating-${field.name}`, "rating-type": field.ratingType, "rating-count": field.ratingCount, "selected-rating": val, onRating: (e) => this.handleRating(e, field) }), index.h("div", { class: "mt-6" }, index.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 }))));
|
|
871
3745
|
}
|
|
872
|
-
|
|
3746
|
+
else if (field.type === 'nps') {
|
|
3747
|
+
return (index.h("div", { class: "form-group nps-field", key: field.name }, index.h("div", { class: "flex justify-between" }, field && (index.h("eds-input-label", { name: `nps-${field.name}`, label: field.question, disabled: field.disabled, required: field.required }))), index.h("eds-nps", { id: `nps-${field.name}`, "right-label": field.rightLabel, "left-label": field.leftLabel, onNps: (e) => this.handleNPS(e, field) }), index.h("div", { class: "mt-6" }, index.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] }))));
|
|
3748
|
+
}
|
|
3749
|
+
return (index.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) }));
|
|
873
3750
|
}
|
|
874
3751
|
async getData() {
|
|
875
3752
|
return this.makeFormData();
|
|
@@ -878,9 +3755,13 @@ const EdsForm = class {
|
|
|
878
3755
|
const hiddenFields = this.parsedFields.filter((field) => field.type === 'hidden');
|
|
879
3756
|
//const otherFields = this.parsedFields.filter((field) => field.type !== 'hidden');
|
|
880
3757
|
const buckets = this.groupedFields;
|
|
881
|
-
|
|
3758
|
+
// build the shadow/bg classes if formStyle="shadow"
|
|
3759
|
+
const styleClasses = this.formStyle === 'shadow'
|
|
3760
|
+
? 'bg-inverse effect-shadow shadow-hover border-softer relative rounded-lg border-2 p-32'
|
|
3761
|
+
: '';
|
|
3762
|
+
return (index.h("form", { key: 'ecf49eb81f18b444d059d3bdea4600f4ae594ea9', class: styleClasses, ref: (el) => (this.formEl = el), autocomplete: "on", onSubmit: this.handleSubmit }, index.h("div", { key: '65137fb770f274431c7906326cdf49e0fee73b18', class: "flex flex-col gap-y-24" }, this.title && (index.h("span", { key: 'e4c5b4a7883c4569a657cc234f18f995480ec8df', role: "heading", class: "f-heading-04" }, this.title)), this.description && index.h("span", { key: '65528e4600127f1cff4ce0e5be6f8a6bddc4c864', class: "f-body-02 text-light" }, this.description), index.h("slot", { key: '6230035a050386763723c2b60bd5e81b912762d7' })), hiddenFields.map((field, index$1) => (index.h("eds-input", { key: index$1, type: "hidden", name: field.name, value: field.value }))), this.parsedGroups
|
|
882
3763
|
.filter((g) => Array.isArray(buckets[g.id]) && buckets[g.id].length > 0)
|
|
883
|
-
.map((g) => (index.h("div", { class: "container mt-
|
|
3764
|
+
.map((g) => (index.h("div", { class: "container mt-32", key: g.id }, index.h("span", { class: "f-body-02" }, index.h("b", null, g.title)), index.h("div", { class: "border-group mt-32 mb-32 flex flex-col gap-y-24" }, buckets[g.id].map((f) => this.renderField(f)))))), index.h("div", { key: '8116d30248f8461a842365470da9915200531028', class: "flex flex-col mt-32 gap-y-24" }, buckets['__ungrouped'].map((f) => this.renderField(f))), this.formBtn && (index.h("div", { key: 'e2f1d3ca6a9f6a3b44c45e576150505c49e41dd1', class: "mt-32" }, index.h("eds-button", { key: 'e312bf08b5db526c00497fafaa9476a225919aaf', intent: this.buttonIntent, label: this.formBtnLabel, disabled: this.isSubmitting, loading: this.isSubmitting, onClick: () => this.handleSubmit() })))));
|
|
884
3765
|
}
|
|
885
3766
|
get el() { return index.getElement(this); }
|
|
886
3767
|
static get watchers() { return {
|
|
@@ -938,7 +3819,7 @@ const EdsHeader = class {
|
|
|
938
3819
|
const classes = variantClasses[this.headerVariant] || variantClasses.default;
|
|
939
3820
|
// Logo color variant: default and inverse use 'color', strong uses 'color-white'
|
|
940
3821
|
const logoType = this.headerVariant === 'strong' ? 'color-white' : 'color';
|
|
941
|
-
return (index.h("header", { key: '
|
|
3822
|
+
return (index.h("header", { key: 'a0f5bb7d9e850e9414db804019674d6bcbc8ea0b', class: `flex items-center justify-between relative z-10 ${classes}` }, index.h("div", { key: '678d5b1583e6fa47c0eac8ce734e8ec34cd76ad9', class: "mr-auto w-[200px] h-[85px]" }, index.h("eds-logo", { key: '12ce9c42b266bbddfd75d2a8f0097708480a2490', type: logoType, href: this.homeUrl })), this.parsedLinks && (index.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" }, index.h("ul", { key: 'c3f8689bb257166c50dd678287c8ad4f54eb315a', class: "flex gap-x-2" }, this.parsedLinks.map((link) => (index.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" })))))), index.h("slot", { key: '3f689a811a60052393a795937a908cf7d0604cc6' }), this.menuEnabled && (index.h("div", { key: '506b953b455b72085d83bdaafc6855992075ddbe', class: "md:hidden flex overflow-hidden px-16" }, index.h("eds-button", { key: '5b526affd813549a6142efab255d6486a5e2dd66', "aria-label": "Menu", intent: this.headerVariant === 'default' ? 'ghost' : 'ghostInverse', icon: "menu", size: "small", onClick: () => this.handleToggleMenu() })))));
|
|
942
3823
|
}
|
|
943
3824
|
get hostEl() { return index.getElement(this); }
|
|
944
3825
|
};
|
|
@@ -1020,10 +3901,10 @@ const EdsImg = class {
|
|
|
1020
3901
|
imgOpts['loading'] = 'lazy';
|
|
1021
3902
|
imgOpts['decoding'] = 'async';
|
|
1022
3903
|
}
|
|
1023
|
-
return (index.h("div", { key: '
|
|
3904
|
+
return (index.h("div", { key: 'fec0dcf2ec178a953f4ced8a71b037030983670d', class: {
|
|
1024
3905
|
'items-center justify-center': true,
|
|
1025
3906
|
'effect-bg-pattern': this.lazyload && this.showBg
|
|
1026
|
-
} }, index.h("picture", { key: '
|
|
3907
|
+
} }, index.h("picture", { key: '0df010a6ed50519be0a2017bf12db7d1ab2fb208' }, this.formats.map((format) => (index.h("source", { type: format.type, srcSet: format.srcset, media: format.media, sizes: this.sizes }))), index.h("img", Object.assign({ key: 'ea4275b2cc6be0cce5ab63f97d05454e3c4ee1dc', ref: (el) => (this.img = el), class: {
|
|
1027
3908
|
'effect-opacity object-cover object-center': true,
|
|
1028
3909
|
'opacity-100': this.loaded,
|
|
1029
3910
|
'opacity-0': !this.loaded
|
|
@@ -1082,7 +3963,7 @@ const EdsInput = class {
|
|
|
1082
3963
|
render() {
|
|
1083
3964
|
const withIcon = !!this.icon;
|
|
1084
3965
|
const describedBy = this.hasMessage || this.error ? `${this.name}-error` : '';
|
|
1085
|
-
return (index.h("div", { key: '
|
|
3966
|
+
return (index.h("div", { key: '0a6386205f78655569bf93960a4e2664563e4014', class: "relative flex items-center" }, this.type === 'textarea' ? (index.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' ? (index.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) => (index.h("option", { value: option.value, selected: option.value === this.innerVal, key: option.value }, option.label))))) : (index.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'
|
|
1086
3967
|
? {
|
|
1087
3968
|
min: this.min,
|
|
1088
3969
|
max: this.max,
|
|
@@ -1093,7 +3974,7 @@ const EdsInput = class {
|
|
|
1093
3974
|
input ${this.type === 'radio' ? 'input-radio' : this.type === 'checkbox' ? 'input-checkbox' : ''}
|
|
1094
3975
|
${withIcon && this.type !== 'radio' && this.type !== 'checkbox' ? 'input-icon pl-36' : ''}
|
|
1095
3976
|
${this.error ? 'input-error' : ''}
|
|
1096
|
-
`, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, maxlength: this.maxLength, onInput: this.handleInput, onChange: this.handleInput }))), this.maxLength && this.type === 'textarea' && (index.h("span", { key: '
|
|
3977
|
+
`, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, maxlength: this.maxLength, onInput: this.handleInput, onChange: this.handleInput }))), this.maxLength && this.type === 'textarea' && (index.h("span", { key: 'c78bf1501f682cde9a193ea6726baf2433566516', class: `input-counter f-ui-05 absolute bottom-8 right-8 ${this.maxLengthReached ? 'input-counter-error' : ''}` }, this.maxLength)), this.icon && (index.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 }))));
|
|
1097
3978
|
}
|
|
1098
3979
|
get el() { return index.getElement(this); }
|
|
1099
3980
|
static get watchers() { return {
|
|
@@ -1204,7 +4085,7 @@ const EdsInputField = class {
|
|
|
1204
4085
|
}
|
|
1205
4086
|
render() {
|
|
1206
4087
|
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 } : {}));
|
|
1207
|
-
return (index.h("div", { key: '
|
|
4088
|
+
return (index.h("div", { key: 'eaa1d9c1095204c82bd01eab0f19f80eeee64d05' }, this.type === 'checkbox' || this.type === 'radio' ? (this.parsedOptions.length > 0 ? (index.h("fieldset", { class: "space-y-4 mt-8" }, index.h("div", { class: "flex justify-between mb-4" }, this.label && (index.h("eds-input-label", { name: this.inputId || this.name, label: this.label, required: this.required })), this.hint && (index.h("p", { id: `${this.name}-hint`, class: "f-ui-05 text-lighter mt-8 ml-8" }, this.hint))), this.parsedOptions.map((option) => (index.h("div", { class: "flex items-center gap-x-4 gap-y-4", key: option.value }, index.h("eds-input", Object.assign({}, inputOpts, { value: option.value, checked: typeof this.value === 'string' && this.value.split(',').includes(String(option.value)) })), index.h("label", { htmlFor: this.name, class: `input-label-options ${this.disabled ? 'text-lighter' : ''}` }, option.label)))))) : (index.h("div", { class: "flex items-center gap-x-8" }, index.h("eds-input", Object.assign({}, inputOpts, { value: this.value, checked: this.value === 'on' || this.checked })), this.label && (index.h("eds-input-label", { name: this.inputId || this.name, label: this.label, disabled: this.disabled, required: this.required }))))) : (index.h("div", null, index.h("div", { class: "flex justify-between mb-4" }, this.label && (index.h("eds-input-label", { name: this.inputId || this.name, label: this.label, disabled: this.disabled, required: this.required })), this.hint && (index.h("p", { id: `${this.name}-hint`, class: "f-ui-05 text-lighter mt-8 ml-8" }, this.hint))), this.type === 'select' ? (index.h("eds-input-select", Object.assign({}, inputOpts, { options: this.parsedOptions }))) : this.type === 'file' ? (index.h("input", { type: "file", id: this.inputId || this.name, name: this.name, onChange: this.onChangeNative, disabled: this.disabled, required: this.required })) : this.type === 'search' ? (index.h("eds-input-search", { name: "search-box" })) : this.type === 'range' ? ((() => {
|
|
1208
4089
|
var _a, _b, _c;
|
|
1209
4090
|
const rangeProps = {
|
|
1210
4091
|
name: inputOpts.name,
|
|
@@ -1217,8 +4098,9 @@ const EdsInputField = class {
|
|
|
1217
4098
|
const opt = this.parsedOptions;
|
|
1218
4099
|
const numberValue = typeof this.value === 'string' ? parseFloat(this.value) : this.value || 0;
|
|
1219
4100
|
return (index.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 })));
|
|
1220
|
-
})()) : (index.h("eds-input", Object.assign({}, inputOpts))))), index.h("div", { key: '
|
|
4101
|
+
})()) : (index.h("eds-input", Object.assign({}, inputOpts))))), index.h("div", { key: '60e6c848d41591b2e9ec8c5cf8dd656ec8562c38', class: "mt-6" }, index.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 }))));
|
|
1221
4102
|
}
|
|
4103
|
+
static get delegatesFocus() { return true; }
|
|
1222
4104
|
get hostEl() { return index.getElement(this); }
|
|
1223
4105
|
};
|
|
1224
4106
|
EdsInputField.style = EdsInputFieldStyle0;
|
|
@@ -1236,7 +4118,7 @@ const EdsInputFooter = class {
|
|
|
1236
4118
|
this.link = undefined;
|
|
1237
4119
|
}
|
|
1238
4120
|
render() {
|
|
1239
|
-
return (index.h("div", { key: '
|
|
4121
|
+
return (index.h("div", { key: '54571d8f3c08a7a4f12e40728e02a7210ab0d345' }, this.error && this.errorMessage && (index.h("div", { key: 'db35f0c0dfa931d55d57a9c4ad3fffaeb4cea914', id: `error_${this.name}`, class: "text-error flex items-center" }, index.h("eds-icon-wrapper", { key: '63e401d86876829d8d2bbab887a66ef0dbd1837f', icon: "warning" }), index.h("p", { key: '81f8b0819a7cb119353c8ac38ab1df0cafb9d36f', class: "f-ui-04 ml-4 mb-4", innerHTML: this.errorMessage }))), this.message && index.h("p", { key: 'e5018623e2d8578864dc1f0b06d54e4a60ff9020', id: `desc_${this.name}`, class: "f-ui-05 text-lighter", innerHTML: this.message }), this.link && (index.h("a", { key: 'e7b6bde26ae02cf07ac8b8e6461282a4ba1355ed', href: this.link.url, class: "f-ui-05 effect-color hover:text-lighter underline underline-offset-4" }, this.link.label))));
|
|
1240
4122
|
}
|
|
1241
4123
|
};
|
|
1242
4124
|
EdsInputFooter.style = EdsInputFooterStyle0;
|
|
@@ -1253,7 +4135,7 @@ const EdsInputLabel = class {
|
|
|
1253
4135
|
this.disabled = false;
|
|
1254
4136
|
}
|
|
1255
4137
|
render() {
|
|
1256
|
-
return (index.h("label", { key: '
|
|
4138
|
+
return (index.h("label", { key: '90e0659383fd3be9a166457de5429385fe3bfe02', htmlFor: this.name, class: `input-label ${this.disabled ? 'text-lighter' : ''}` }, this.label, this.required && (index.h("span", { key: '4d417c45dd636bfd5872d846e5eb89ff3694a4d4' }, index.h("span", { key: '3924011891ee03e530fe25b269bf4231f3acd9cb', "aria-hidden": "true" }, "*"), index.h("span", { key: '2f343b6b4ab4cbd538189cfa404210cf676eefe7', class: "sr-only" }, "required")))));
|
|
1257
4139
|
}
|
|
1258
4140
|
};
|
|
1259
4141
|
EdsInputLabel.style = EdsInputLabelStyle0;
|
|
@@ -1300,7 +4182,7 @@ const EdsInputRange = class {
|
|
|
1300
4182
|
return this.inputElement;
|
|
1301
4183
|
}
|
|
1302
4184
|
render() {
|
|
1303
|
-
return (index.h("div", { key: '
|
|
4185
|
+
return (index.h("div", { key: '3fa2ef579847e66bcacc35afe202192b78a06975', class: "relative flex flex-col items-start" }, index.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 }), index.h("p", { key: 'b3865e1bfacb423da277f4b76dfd0f3294f96cc6', id: `desc_${this.name}`, class: "block f-ui-05 mt-4 text-lighter" }, "Current value: ", this.sliderVal)));
|
|
1304
4186
|
}
|
|
1305
4187
|
get el() { return index.getElement(this); }
|
|
1306
4188
|
static get watchers() { return {
|
|
@@ -1369,7 +4251,7 @@ const EdsInputSearch = class {
|
|
|
1369
4251
|
return this.inputElement;
|
|
1370
4252
|
}
|
|
1371
4253
|
render() {
|
|
1372
|
-
return (index.h("div", { key: '
|
|
4254
|
+
return (index.h("div", { key: 'ad7c42baf7c54ede5dca7dd2a6916557f46d33d6', class: "relative flex items-center" }, index.h("eds-icon-wrapper", { key: '6de80c397bae5e541de1ce3c2937bed860b58363', icon: "search", class: "absolute top-1/2 left-[4px] -translate-y-1/2 text-lightest", "aria-hidden": "true" }), index.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}`,
|
|
1373
4255
|
//onInput={this.onInput}
|
|
1374
4256
|
onChange: this.onChange })));
|
|
1375
4257
|
}
|
|
@@ -1398,12 +4280,12 @@ const EdsInputSelect = class {
|
|
|
1398
4280
|
const selectId = this.inputId || this.name;
|
|
1399
4281
|
const placeholderText = this.placeholder || `Pick from the list`;
|
|
1400
4282
|
const describedBy = this.hasMessage || this.error ? `${this.name}-error` : undefined;
|
|
1401
|
-
return (index.h("div", { key: '
|
|
4283
|
+
return (index.h("div", { key: '06be08db809ec9970ca4d7bdbdcdf1c8f2bc8840', class: "relative" }, index.h("select", { key: 'e4319592e6c2f0c71e0dc75ca2d854506bda70bc', id: selectId, name: this.name, class: {
|
|
1402
4284
|
input: true,
|
|
1403
4285
|
'input-error': this.error,
|
|
1404
4286
|
'px-4': true,
|
|
1405
4287
|
'py-2': true
|
|
1406
|
-
}, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, disabled: this.disabled, required: this.required, onChange: this.handleChange }, index.h("option", { key: '
|
|
4288
|
+
}, "aria-invalid": this.error ? 'true' : 'false', "aria-describedby": describedBy, disabled: this.disabled, required: this.required, onChange: this.handleChange }, index.h("option", { key: 'a0ece38948f84a10ea8cd4c0a01b3f8b9730c7ef', value: "", disabled: true, hidden: true }, placeholderText), this.options.map((opt, index$1) => (index.h("option", { key: index$1, value: opt.value, selected: opt.value === this.value }, opt.label)))), index.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" }, index.h("eds-icon-wrapper", { key: '8b91b3fa3a819d04ede5d7816fcb2f04e66fd03b', class: "w-20 h-20", icon: "chevron-right" }))));
|
|
1407
4289
|
}
|
|
1408
4290
|
};
|
|
1409
4291
|
|
|
@@ -1571,20 +4453,42 @@ const EdsLink = class {
|
|
|
1571
4453
|
event.preventDefault();
|
|
1572
4454
|
return;
|
|
1573
4455
|
}
|
|
1574
|
-
analytics.sendAnalytics({
|
|
1575
|
-
category: 'ui-component',
|
|
1576
|
-
parentContext: this.parentContext,
|
|
1577
|
-
tag: this.el.tagName.toLowerCase(),
|
|
1578
|
-
name: ((_a = this.label) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || ((_b = this.ariaLabel) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || '',
|
|
1579
|
-
action: 'click'
|
|
1580
|
-
});
|
|
4456
|
+
analytics.sendAnalytics({
|
|
4457
|
+
category: 'ui-component',
|
|
4458
|
+
parentContext: this.parentContext,
|
|
4459
|
+
tag: this.el.tagName.toLowerCase(),
|
|
4460
|
+
name: ((_a = this.label) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || ((_b = this.ariaLabel) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || '',
|
|
4461
|
+
action: 'click'
|
|
4462
|
+
});
|
|
4463
|
+
}
|
|
4464
|
+
handleKeyDown(event) {
|
|
4465
|
+
if (this.disabled) {
|
|
4466
|
+
return;
|
|
4467
|
+
}
|
|
4468
|
+
// Handle Enter and Space keys for activation
|
|
4469
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
4470
|
+
event.preventDefault();
|
|
4471
|
+
this.handleClick(event);
|
|
4472
|
+
// For actual navigation, trigger the native link behavior
|
|
4473
|
+
if (this.url && !this.disabled) {
|
|
4474
|
+
if (this.external) {
|
|
4475
|
+
window.open(this.url, '_blank', 'noopener,noreferrer');
|
|
4476
|
+
}
|
|
4477
|
+
else {
|
|
4478
|
+
window.location.href = this.url;
|
|
4479
|
+
}
|
|
4480
|
+
}
|
|
4481
|
+
}
|
|
1581
4482
|
}
|
|
1582
4483
|
getLinkSize() {
|
|
4484
|
+
if (this.intent === 'underline') {
|
|
4485
|
+
return 'underline';
|
|
4486
|
+
}
|
|
1583
4487
|
return this.size;
|
|
1584
4488
|
}
|
|
1585
4489
|
renderLeftIcon() {
|
|
1586
4490
|
if (this.icon && this.iconPos === 'left') {
|
|
1587
|
-
return (index.h("span", { class:
|
|
4491
|
+
return (index.h("span", { class: "flex" }, index.h("eds-icon-wrapper", { "aria-hidden": "true", class: `
|
|
1588
4492
|
flex inline-flex items-center justify-center
|
|
1589
4493
|
${this.size === 'large' ? 'h-24 w-24' : 'h-20 w-20'}
|
|
1590
4494
|
`, icon: this.icon })));
|
|
@@ -1593,7 +4497,7 @@ const EdsLink = class {
|
|
|
1593
4497
|
}
|
|
1594
4498
|
renderRightIcon() {
|
|
1595
4499
|
if (this.icon && this.iconPos === 'right') {
|
|
1596
|
-
return (index.h("span", { class:
|
|
4500
|
+
return (index.h("span", { class: "flex" }, index.h("eds-icon-wrapper", { "aria-hidden": "true", class: `
|
|
1597
4501
|
flex inline-flex items-center justify-center
|
|
1598
4502
|
${this.size === 'large' ? 'h-24 w-24' : 'h-20 w-20'}
|
|
1599
4503
|
`, icon: this.icon })));
|
|
@@ -1601,8 +4505,6 @@ const EdsLink = class {
|
|
|
1601
4505
|
return null;
|
|
1602
4506
|
}
|
|
1603
4507
|
render() {
|
|
1604
|
-
// If the link is disabled, use a <span>; otherwise, use an <a> element.
|
|
1605
|
-
const ComponentType = this.disabled ? 'span' : 'a';
|
|
1606
4508
|
const classes = linkStyles({
|
|
1607
4509
|
intent: this.intent,
|
|
1608
4510
|
size: this.getLinkSize(),
|
|
@@ -1610,12 +4512,12 @@ const EdsLink = class {
|
|
|
1610
4512
|
isActive: this.current,
|
|
1611
4513
|
hasIcon: !!this.icon
|
|
1612
4514
|
});
|
|
1613
|
-
|
|
1614
|
-
const
|
|
4515
|
+
const isInteractive = !this.disabled;
|
|
4516
|
+
const isIconOnly = !this.label || (this.hideLabelOnSmallScreen && this.icon);
|
|
1615
4517
|
const labelClasses = this.hideLabelOnSmallScreen
|
|
1616
4518
|
? 'hidden lg:flex' // Tailwind example: hidden on small screens, visible on larger
|
|
1617
4519
|
: '';
|
|
1618
|
-
return (index.h(
|
|
4520
|
+
return (index.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) }, index.h("span", { key: 'eed89377d27a476a7d7e70a8c40f3100b8089a0b', class: "z-1 relative inline-flex items-center justify-center" }, this.renderLeftIcon(), this.label && index.h("span", { key: 'c6d09f0c54e092e53350014d6d89b67c35a8be71', class: labelClasses }, this.label), this.renderRightIcon())));
|
|
1619
4521
|
}
|
|
1620
4522
|
get el() { return index.getElement(this); }
|
|
1621
4523
|
};
|
|
@@ -1683,29 +4585,273 @@ const EdsLogo = class {
|
|
|
1683
4585
|
}
|
|
1684
4586
|
render() {
|
|
1685
4587
|
const logoContent = this.getLogo();
|
|
1686
|
-
return (index.h("a", { key: '
|
|
4588
|
+
return (index.h("a", { key: 'e5c4e4701d698282dc85561c8c434f0790fb2401', href: this.href, onClick: () => this.handleClick(), class: "eds-logo-wrapper", "aria-label": this.label }, index.h("div", { key: '32cc8649fe67b6c4a874b5c1aaa6d4d793b4c4c7', innerHTML: logoContent })));
|
|
1687
4589
|
}
|
|
1688
4590
|
get el() { return index.getElement(this); }
|
|
1689
4591
|
};
|
|
1690
4592
|
EdsLogo.style = EdsLogoStyle0;
|
|
1691
4593
|
|
|
1692
|
-
const
|
|
4594
|
+
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))}}";
|
|
4595
|
+
const EdsMatomoNoticeStyle0 = edsMatomoNoticeCss;
|
|
4596
|
+
|
|
4597
|
+
const EdsMatomoNotice = class {
|
|
4598
|
+
constructor(hostRef) {
|
|
4599
|
+
index.registerInstance(this, hostRef);
|
|
4600
|
+
this.consent = index.createEvent(this, "consent", 7);
|
|
4601
|
+
this.heading = 'Analytics Consent';
|
|
4602
|
+
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.";
|
|
4603
|
+
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.";
|
|
4604
|
+
this.forceShow = false;
|
|
4605
|
+
this.showNotice = true;
|
|
4606
|
+
}
|
|
4607
|
+
/**
|
|
4608
|
+
* Listens for global custom events to open the matomo-consent.
|
|
4609
|
+
*/
|
|
4610
|
+
toggleCookiesConsent() {
|
|
4611
|
+
this.showNotice = !this.showNotice;
|
|
4612
|
+
}
|
|
4613
|
+
/**
|
|
4614
|
+
* Checks if the consent cookie exists.
|
|
4615
|
+
*/
|
|
4616
|
+
hasCookieConsent() {
|
|
4617
|
+
return !!document.cookie.split('; ').find((row) => row.startsWith('mtm_consent='));
|
|
4618
|
+
}
|
|
4619
|
+
/**
|
|
4620
|
+
* Checks if the user has opted out after has opted in.
|
|
4621
|
+
*/
|
|
4622
|
+
optedOut() {
|
|
4623
|
+
return !!document.cookie.split('; ').find((row) => row.startsWith('mtm_consent_removed'));
|
|
4624
|
+
}
|
|
4625
|
+
/**
|
|
4626
|
+
* Generate a unique storage key based on appId or the app's domain.
|
|
4627
|
+
*/
|
|
4628
|
+
getStorageKey() {
|
|
4629
|
+
return `${window.location.host}-matomo-deferred`;
|
|
4630
|
+
}
|
|
4631
|
+
/**
|
|
4632
|
+
* Check cookies and sessionStorage (unless forceShow is true) to decide if the notice should be shown.
|
|
4633
|
+
*/
|
|
4634
|
+
componentWillLoad() {
|
|
4635
|
+
// If a decision has been made previously (opted in or out), don't show the notice.
|
|
4636
|
+
const consentGiven = localStorage.getItem(`${window.location.host}-matomo-consent-given`);
|
|
4637
|
+
if (consentGiven === 'out' || this.optedOut()) {
|
|
4638
|
+
this.showNotice = false;
|
|
4639
|
+
return;
|
|
4640
|
+
}
|
|
4641
|
+
if (this.forceShow) {
|
|
4642
|
+
// If forceShow is true, always show the notice
|
|
4643
|
+
this.showNotice = true;
|
|
4644
|
+
}
|
|
4645
|
+
else {
|
|
4646
|
+
// If user has already consented, hide the notice
|
|
4647
|
+
// eslint-disable-next-line
|
|
4648
|
+
if (this.hasCookieConsent()) {
|
|
4649
|
+
this.showNotice = false;
|
|
4650
|
+
}
|
|
4651
|
+
else {
|
|
4652
|
+
// Otherwise check if user deferred in this session
|
|
4653
|
+
const sessionDeferred = sessionStorage.getItem(this.getStorageKey());
|
|
4654
|
+
this.showNotice = !sessionDeferred;
|
|
4655
|
+
}
|
|
4656
|
+
}
|
|
4657
|
+
}
|
|
4658
|
+
componentDidLoad() {
|
|
4659
|
+
const btns = this.el.shadowRoot.querySelectorAll('eds-button');
|
|
4660
|
+
btns.forEach((b) => {
|
|
4661
|
+
this.emitContext(b);
|
|
4662
|
+
});
|
|
4663
|
+
}
|
|
4664
|
+
emitContext(linkElement) {
|
|
4665
|
+
const event = new CustomEvent('parentContext', {
|
|
4666
|
+
detail: {
|
|
4667
|
+
componentName: this.el.tagName.toLowerCase(),
|
|
4668
|
+
identifier: null
|
|
4669
|
+
}
|
|
4670
|
+
});
|
|
4671
|
+
linkElement.dispatchEvent(event);
|
|
4672
|
+
}
|
|
4673
|
+
optInAnalytics() {
|
|
4674
|
+
analytics.matomoOptIn();
|
|
4675
|
+
localStorage.removeItem(`${window.location.host}-matomo-consent-given`);
|
|
4676
|
+
this.hideNotice();
|
|
4677
|
+
this.consent.emit('in');
|
|
4678
|
+
}
|
|
4679
|
+
optOutAnalytics() {
|
|
4680
|
+
analytics.matomoOptOut();
|
|
4681
|
+
this.hideNotice();
|
|
4682
|
+
this.consent.emit('out');
|
|
4683
|
+
}
|
|
4684
|
+
noThanks() {
|
|
4685
|
+
analytics.matomoOptOut();
|
|
4686
|
+
localStorage.setItem(`${window.location.host}-matomo-consent-given`, 'out');
|
|
4687
|
+
this.hideNotice();
|
|
4688
|
+
this.consent.emit('out');
|
|
4689
|
+
}
|
|
4690
|
+
/*private deferDecision() {
|
|
4691
|
+
sessionStorage.setItem(this.getStorageKey(), 'true');
|
|
4692
|
+
this.hideNotice();
|
|
4693
|
+
this.consent.emit('defer');
|
|
4694
|
+
}*/
|
|
4695
|
+
keepMeIn() {
|
|
4696
|
+
this.hideNotice();
|
|
4697
|
+
}
|
|
4698
|
+
hideNotice() {
|
|
4699
|
+
this.showNotice = false;
|
|
4700
|
+
}
|
|
4701
|
+
render() {
|
|
4702
|
+
if (!this.showNotice) {
|
|
4703
|
+
return null;
|
|
4704
|
+
}
|
|
4705
|
+
return (index.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" }, index.h("eds-accordion", { title: this.heading, description: this.hasCookieConsent() ? this.optOutMessage : this.description, switchBg: true, expanded: true }, this.hasCookieConsent() ? (index.h("div", { class: "flex items-center gap-4" }, this.optedOut() ? (index.h("eds-button", { intent: "primary", label: "Opt me in again", "aria-label": "Opt me in again", onClick: () => this.optInAnalytics() })) : (index.h("eds-button", { intent: "primary", label: "Keep Me In", "aria-label": "Keep Me In", onClick: () => this.keepMeIn() })), index.h("eds-button", { intent: "ghostInverse", label: "Opt-out", "aria-label": "Opt-out from analytics", onClick: () => this.optOutAnalytics() }))) : (index.h("div", { class: "flex items-center gap-4" }, index.h("eds-button", { intent: "primary", label: "I agree", "aria-label": "Opt-in for analytics", onClick: () => this.optInAnalytics() }), index.h("eds-button", { intent: "ghost", label: "No, thanks", "aria-label": "Opt-out from analytics", onClick: () => this.noThanks() }))))));
|
|
4706
|
+
}
|
|
4707
|
+
get el() { return index.getElement(this); }
|
|
4708
|
+
};
|
|
4709
|
+
EdsMatomoNotice.style = EdsMatomoNoticeStyle0;
|
|
4710
|
+
|
|
4711
|
+
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)}";
|
|
4712
|
+
const EdsNpsStyle0 = edsNpsCss;
|
|
4713
|
+
|
|
4714
|
+
const EdsNps = class {
|
|
4715
|
+
constructor(hostRef) {
|
|
4716
|
+
index.registerInstance(this, hostRef);
|
|
4717
|
+
this.nps = index.createEvent(this, "nps", 7);
|
|
4718
|
+
this.min = 0;
|
|
4719
|
+
this.max = 10;
|
|
4720
|
+
this.question = undefined;
|
|
4721
|
+
this.leftLabel = undefined;
|
|
4722
|
+
this.rightLabel = undefined;
|
|
4723
|
+
this.selectedValue = null;
|
|
4724
|
+
}
|
|
4725
|
+
handleClick(value) {
|
|
4726
|
+
this.selectedValue = value;
|
|
4727
|
+
this.nps.emit(value);
|
|
4728
|
+
}
|
|
4729
|
+
handleKeyNav(e) {
|
|
4730
|
+
const radios = Array.from(this.el.shadowRoot.querySelectorAll('eds-button'));
|
|
4731
|
+
const currentIndex = radios.findIndex((r) => r.tabIndex === 0);
|
|
4732
|
+
switch (e.key) {
|
|
4733
|
+
case 'ArrowRight':
|
|
4734
|
+
case 'ArrowLeft': {
|
|
4735
|
+
e.preventDefault();
|
|
4736
|
+
const delta = e.key === 'ArrowRight' ? 1 : -1;
|
|
4737
|
+
const nextIndex = Math.min(this.max, Math.max(0, currentIndex + delta));
|
|
4738
|
+
this.activateRadio(radios, nextIndex);
|
|
4739
|
+
break;
|
|
4740
|
+
}
|
|
4741
|
+
case 'Home': {
|
|
4742
|
+
e.preventDefault();
|
|
4743
|
+
this.activateRadio(radios, 0);
|
|
4744
|
+
break;
|
|
4745
|
+
}
|
|
4746
|
+
case 'End': {
|
|
4747
|
+
e.preventDefault();
|
|
4748
|
+
this.activateRadio(radios, this.max);
|
|
4749
|
+
break;
|
|
4750
|
+
}
|
|
4751
|
+
case 'Enter':
|
|
4752
|
+
case ' ': {
|
|
4753
|
+
e.preventDefault();
|
|
4754
|
+
if (currentIndex >= 0) {
|
|
4755
|
+
this.handleClick(this.min + currentIndex);
|
|
4756
|
+
}
|
|
4757
|
+
break;
|
|
4758
|
+
}
|
|
4759
|
+
case 'Escape': {
|
|
4760
|
+
e.preventDefault();
|
|
4761
|
+
if (currentIndex >= 0) {
|
|
4762
|
+
radios[currentIndex].blur();
|
|
4763
|
+
}
|
|
4764
|
+
break;
|
|
4765
|
+
}
|
|
4766
|
+
default:
|
|
4767
|
+
return;
|
|
4768
|
+
}
|
|
4769
|
+
}
|
|
4770
|
+
activateRadio(radios, index) {
|
|
4771
|
+
const target = radios[index];
|
|
4772
|
+
const value = this.min + index;
|
|
4773
|
+
this.handleClick(value);
|
|
4774
|
+
target.focus();
|
|
4775
|
+
}
|
|
4776
|
+
render() {
|
|
4777
|
+
const count = this.max - this.min + 1;
|
|
4778
|
+
//onst fallback = 0;
|
|
4779
|
+
return (index.h("div", { key: '3831baab086cbf44a3d1511885f15bbab23c9cd2', class: "eds-nps" }, index.h("eds-input-label", { key: 'f9bd8a812d1b65a634dfaa7aae704218dc79468c', id: "nps-question", name: "nps-question", label: this.question }), index.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) => {
|
|
4780
|
+
const val = this.min + i;
|
|
4781
|
+
const isSelected = val === this.selectedValue;
|
|
4782
|
+
const tabIndex = isSelected ? 0 : -1;
|
|
4783
|
+
return (index.h("div", { class: "grid-col-span-1", key: val }, index.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) })));
|
|
4784
|
+
})), index.h("div", { key: '0acafaae3f2ce522ffbc245c5733ca509d4bf3c1', class: "flex justify-between mt-8" }, index.h("span", { key: '001e0be00b07ae2e831ea6af0c577a5eeecb9a56', class: "f-ui-04 text-light ml-4" }, this.leftLabel), index.h("span", { key: '99a12d89ea577fb2bb9c34241a2b9f0f254c284a', class: "f-ui-04 text-light mr-4" }, this.rightLabel))));
|
|
4785
|
+
}
|
|
4786
|
+
get el() { return index.getElement(this); }
|
|
4787
|
+
};
|
|
4788
|
+
EdsNps.style = EdsNpsStyle0;
|
|
4789
|
+
|
|
4790
|
+
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}}";
|
|
1693
4791
|
const EdsPaginationStyle0 = edsPaginationCss;
|
|
1694
4792
|
|
|
1695
4793
|
const EdsPagination = class {
|
|
1696
4794
|
constructor(hostRef) {
|
|
1697
4795
|
index.registerInstance(this, hostRef);
|
|
4796
|
+
/**
|
|
4797
|
+
* Handles keyboard navigation within the pagination
|
|
4798
|
+
*/
|
|
4799
|
+
this.handleKeyDown = (e) => {
|
|
4800
|
+
if (this.mode !== 'default' || !this.useButtons) {
|
|
4801
|
+
return;
|
|
4802
|
+
}
|
|
4803
|
+
const navigableItems = this.getNavigableItems();
|
|
4804
|
+
if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
|
|
4805
|
+
e.preventDefault();
|
|
4806
|
+
const increment = e.key === 'ArrowRight' ? 1 : -1;
|
|
4807
|
+
let currentIndex = this.focusedIndex;
|
|
4808
|
+
// If no item is focused, start from current page or first item
|
|
4809
|
+
if (currentIndex === -1) {
|
|
4810
|
+
const currentPageIndex = navigableItems.findIndex((item) => item.type === 'page' && item.page === this.currentPage);
|
|
4811
|
+
currentIndex = currentPageIndex !== -1 ? currentPageIndex : 0;
|
|
4812
|
+
}
|
|
4813
|
+
let newIndex = currentIndex + increment;
|
|
4814
|
+
// Wrap around navigation
|
|
4815
|
+
if (newIndex >= navigableItems.length) {
|
|
4816
|
+
newIndex = 0;
|
|
4817
|
+
}
|
|
4818
|
+
else if (newIndex < 0) {
|
|
4819
|
+
newIndex = navigableItems.length - 1;
|
|
4820
|
+
}
|
|
4821
|
+
this.focusedIndex = newIndex;
|
|
4822
|
+
this.focusPaginationItem(newIndex);
|
|
4823
|
+
}
|
|
4824
|
+
else if (e.key === 'Home') {
|
|
4825
|
+
e.preventDefault();
|
|
4826
|
+
this.focusedIndex = 0;
|
|
4827
|
+
this.focusPaginationItem(0);
|
|
4828
|
+
}
|
|
4829
|
+
else if (e.key === 'End') {
|
|
4830
|
+
e.preventDefault();
|
|
4831
|
+
const lastIndex = navigableItems.length - 1;
|
|
4832
|
+
this.focusedIndex = lastIndex;
|
|
4833
|
+
this.focusPaginationItem(lastIndex);
|
|
4834
|
+
}
|
|
4835
|
+
};
|
|
4836
|
+
/**
|
|
4837
|
+
* Handles focus events for pagination items
|
|
4838
|
+
*/
|
|
4839
|
+
this.handleItemFocus = (index) => {
|
|
4840
|
+
this.focusedIndex = index;
|
|
4841
|
+
};
|
|
1698
4842
|
this.currentPage = undefined;
|
|
1699
4843
|
this.lastPage = undefined;
|
|
1700
4844
|
this.perPage = 10;
|
|
1701
4845
|
this.total = 0;
|
|
1702
4846
|
this.url = '';
|
|
1703
4847
|
this.mode = 'default';
|
|
4848
|
+
this.useButtons = true;
|
|
1704
4849
|
this.prevLabel = 'Prev';
|
|
1705
4850
|
this.nextLabel = 'Next';
|
|
1706
4851
|
this.prevUrl = '';
|
|
1707
4852
|
this.nextUrl = '';
|
|
1708
4853
|
this.links = [];
|
|
4854
|
+
this.focusedIndex = -1;
|
|
1709
4855
|
}
|
|
1710
4856
|
/** Lifecycle hook to generate pagination links on component load */
|
|
1711
4857
|
componentWillLoad() {
|
|
@@ -1714,24 +4860,17 @@ const EdsPagination = class {
|
|
|
1714
4860
|
}
|
|
1715
4861
|
}
|
|
1716
4862
|
componentDidLoad() {
|
|
1717
|
-
//
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
this.emitContext(links[0]);
|
|
1725
|
-
|
|
1726
|
-
// Emit context for the last link, if it's different from the first
|
|
1727
|
-
if (links.length > 1) {
|
|
1728
|
-
this.emitContext(links[links.length - 1]);
|
|
1729
|
-
}
|
|
1730
|
-
}*/
|
|
4863
|
+
// Only emit context for links, not buttons
|
|
4864
|
+
if (!this.useButtons) {
|
|
4865
|
+
const links = this.hostEl.shadowRoot.querySelectorAll('eds-link');
|
|
4866
|
+
links.forEach((lnk) => {
|
|
4867
|
+
this.emitContext(lnk);
|
|
4868
|
+
});
|
|
4869
|
+
}
|
|
1731
4870
|
}
|
|
1732
4871
|
/**
|
|
1733
4872
|
* Emits a custom event called `parentContext` for a given link element.
|
|
1734
|
-
* This event provides context information about the
|
|
4873
|
+
* This event provides context information about the pagination component.
|
|
1735
4874
|
*
|
|
1736
4875
|
* @param linkElement - The link element to which the event will be dispatched.
|
|
1737
4876
|
*/
|
|
@@ -1749,6 +4888,34 @@ const EdsPagination = class {
|
|
|
1749
4888
|
this.generateLinks();
|
|
1750
4889
|
}
|
|
1751
4890
|
}
|
|
4891
|
+
/**
|
|
4892
|
+
* Gets all navigable pagination items for keyboard navigation
|
|
4893
|
+
*/
|
|
4894
|
+
getNavigableItems() {
|
|
4895
|
+
const items = [];
|
|
4896
|
+
// Previous button
|
|
4897
|
+
items.push({ type: 'prev', disabled: this.isFirstPage() });
|
|
4898
|
+
// Page numbers
|
|
4899
|
+
this.links.forEach((link) => {
|
|
4900
|
+
if (typeof link === 'object') {
|
|
4901
|
+
items.push({ type: 'page', page: parseInt(link.label), disabled: false });
|
|
4902
|
+
}
|
|
4903
|
+
});
|
|
4904
|
+
// Next button
|
|
4905
|
+
items.push({ type: 'next', disabled: this.isLastPage() });
|
|
4906
|
+
return items.filter((item) => !item.disabled);
|
|
4907
|
+
}
|
|
4908
|
+
/**
|
|
4909
|
+
* Focuses a specific pagination item by index
|
|
4910
|
+
*/
|
|
4911
|
+
focusPaginationItem(index) {
|
|
4912
|
+
var _a;
|
|
4913
|
+
const buttons = (_a = this.hostEl.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.pagination-button');
|
|
4914
|
+
const targetButton = buttons === null || buttons === void 0 ? void 0 : buttons[index];
|
|
4915
|
+
if (targetButton) {
|
|
4916
|
+
targetButton.focus();
|
|
4917
|
+
}
|
|
4918
|
+
}
|
|
1752
4919
|
/**
|
|
1753
4920
|
* Checks if the current page is the first page
|
|
1754
4921
|
* @returns {boolean} - true if current page is the first page
|
|
@@ -1771,7 +4938,7 @@ const EdsPagination = class {
|
|
|
1771
4938
|
generateLink(page) {
|
|
1772
4939
|
const urlHasQuery = this.url.includes('?');
|
|
1773
4940
|
return {
|
|
1774
|
-
ariaLabel: `
|
|
4941
|
+
ariaLabel: `Go to page ${page}`,
|
|
1775
4942
|
url: `${this.url}${urlHasQuery ? '&' : '?'}page=${page}`,
|
|
1776
4943
|
label: page.toString(),
|
|
1777
4944
|
current: this.currentPage === page,
|
|
@@ -1791,7 +4958,6 @@ const EdsPagination = class {
|
|
|
1791
4958
|
* Creates a pagination range based on delta, current, and total pages
|
|
1792
4959
|
* @param {number} current - Current page number
|
|
1793
4960
|
* @param {number} total - Total number of pages
|
|
1794
|
-
* @param {number} delta - Range of pages to display around the current page
|
|
1795
4961
|
* @returns {(number | string)[]} - Range of page numbers or ellipses
|
|
1796
4962
|
*/
|
|
1797
4963
|
getPaginationGenerator(current, total) {
|
|
@@ -1806,7 +4972,7 @@ const EdsPagination = class {
|
|
|
1806
4972
|
else {
|
|
1807
4973
|
// Always show the first page
|
|
1808
4974
|
range.push(1);
|
|
1809
|
-
// Add ellipsis if there
|
|
4975
|
+
// Add ellipsis if there's a gap between the first page and the current range start
|
|
1810
4976
|
if (current - delta > 2) {
|
|
1811
4977
|
range.push('...');
|
|
1812
4978
|
}
|
|
@@ -1814,7 +4980,7 @@ const EdsPagination = class {
|
|
|
1814
4980
|
for (let i = Math.max(2, current - delta); i <= Math.min(total - 1, current + delta); i++) {
|
|
1815
4981
|
range.push(i);
|
|
1816
4982
|
}
|
|
1817
|
-
// Add ellipsis if there
|
|
4983
|
+
// Add ellipsis if there's a gap between the current range end and the last page
|
|
1818
4984
|
if (current + delta < total - 1) {
|
|
1819
4985
|
range.push('...');
|
|
1820
4986
|
}
|
|
@@ -1829,9 +4995,11 @@ const EdsPagination = class {
|
|
|
1829
4995
|
*/
|
|
1830
4996
|
pageResults() {
|
|
1831
4997
|
if (this.total > 0) {
|
|
4998
|
+
const start = this.perPage * ((this.currentPage || 1) - 1) + 1;
|
|
4999
|
+
const end = Math.min(this.perPage * (this.currentPage || 1), this.total);
|
|
1832
5000
|
return this.total > this.perPage
|
|
1833
|
-
?
|
|
1834
|
-
:
|
|
5001
|
+
? `Showing ${start} to ${end} of ${this.total} results`
|
|
5002
|
+
: `Showing ${this.total} result${this.total !== 1 ? 's' : ''}`;
|
|
1835
5003
|
}
|
|
1836
5004
|
return '';
|
|
1837
5005
|
}
|
|
@@ -1844,11 +5012,13 @@ const EdsPagination = class {
|
|
|
1844
5012
|
if (this.mode === 'navigator') {
|
|
1845
5013
|
return; // No page clicking logic for navigator mode
|
|
1846
5014
|
}
|
|
1847
|
-
|
|
5015
|
+
if (this.useButtons) {
|
|
5016
|
+
event.preventDefault(); // Prevent default for buttons
|
|
5017
|
+
}
|
|
1848
5018
|
if (newPage !== this.currentPage) {
|
|
1849
5019
|
this.links = this.links.map((link) => typeof link === 'object' ? Object.assign(Object.assign({}, link), { current: parseInt(link.label) === newPage }) : link);
|
|
1850
5020
|
const pageChangeEvent = new CustomEvent('page', {
|
|
1851
|
-
detail: newPage,
|
|
5021
|
+
detail: { value: newPage },
|
|
1852
5022
|
bubbles: true,
|
|
1853
5023
|
composed: true
|
|
1854
5024
|
});
|
|
@@ -1857,38 +5027,25 @@ const EdsPagination = class {
|
|
|
1857
5027
|
}
|
|
1858
5028
|
}
|
|
1859
5029
|
render() {
|
|
1860
|
-
|
|
1861
|
-
|
|
5030
|
+
const navigableIndex = -1; // Track index for keyboard navigation
|
|
5031
|
+
return (index.h("div", { key: '9379c40daaca176e67fb59918f1ca387cb4759b9' }, this.total > 0 && this.mode === 'default' && (index.h("p", { key: 'd09f7f6b7de136987d5b52564bc60afb3775299a', class: "f-ui-03 text-light mb-28 w-full text-center", "aria-live": "polite", id: "pagination-info" }, index.h("span", { key: '4af8f097a79c8fb0495838f06424f43e5e5dcddc', class: "text-light sr-only" }, "Results:"), this.pageResults())), this.mode === 'navigator' || (this.lastPage && this.lastPage > 1) ? (index.h("nav", { "aria-label": "Pagination Navigation", "aria-describedby": this.mode === 'default' ? 'pagination-info' : undefined, onKeyDown: this.handleKeyDown }, index.h("ul", { class: "flex items-center justify-center gap-x-8", role: "list" }, index.h("li", { class: "mr-auto" }, this.useButtons ? (index.h("div", { class: "pagination-button-wrapper", onFocus: () => this.handleItemFocus(navigableIndex) }, index.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) => {
|
|
5032
|
+
if (this.mode === 'default' && !this.isFirstPage()) {
|
|
5033
|
+
this.handlePageClick(event, (this.currentPage || 1) - 1);
|
|
5034
|
+
}
|
|
5035
|
+
} }))) : (index.h("eds-link", { label: this.prevLabel, url: this.mode === 'navigator'
|
|
5036
|
+
? this.prevUrl || '#'
|
|
1862
5037
|
: this.isFirstPage()
|
|
1863
5038
|
? '#'
|
|
1864
|
-
: this.generateLink(this.currentPage - 1).url, disabled: this.mode === 'navigator'
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
if (this.isFirstPage()) {
|
|
1869
|
-
event.preventDefault(); // Prevent click if disabled
|
|
1870
|
-
}
|
|
1871
|
-
else {
|
|
1872
|
-
this.handlePageClick(event, (this.currentPage || 1) - 1);
|
|
1873
|
-
}
|
|
5039
|
+
: 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' &&
|
|
5040
|
+
this.links.map((link, index$1) => (index.h("li", { key: index$1, class: "f-ui-02 flex h-36 items-center justify-center" }, typeof link === 'string' ? (index.h("span", { class: "flex items-center justify-center", "aria-hidden": "true" }, link)) : this.useButtons ? (index.h("div", { class: "pagination-button-wrapper", onFocus: () => this.handleItemFocus(navigableIndex) }, index.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)) }))) : (index.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)) }))))), index.h("li", { class: "ml-auto" }, this.useButtons ? (index.h("div", { class: "pagination-button-wrapper", onFocus: () => this.handleItemFocus(navigableIndex) }, index.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) => {
|
|
5041
|
+
if (this.mode === 'default' && !this.isLastPage()) {
|
|
5042
|
+
this.handlePageClick(event, (this.currentPage || 1) + 1);
|
|
1874
5043
|
}
|
|
1875
|
-
} })), this.mode === '
|
|
1876
|
-
|
|
1877
|
-
? this.nextUrl || '#' // Use nextUrl if provided, otherwise disable with '#'
|
|
5044
|
+
} }))) : (index.h("eds-link", { label: this.nextLabel, url: this.mode === 'navigator'
|
|
5045
|
+
? this.nextUrl || '#'
|
|
1878
5046
|
: this.isLastPage()
|
|
1879
5047
|
? '#'
|
|
1880
|
-
: this.generateLink(this.currentPage + 1).url, disabled: this.mode === 'navigator'
|
|
1881
|
-
? !this.nextUrl // Disable if nextUrl is not provided
|
|
1882
|
-
: 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) => {
|
|
1883
|
-
if (this.mode === 'default') {
|
|
1884
|
-
if (this.isLastPage()) {
|
|
1885
|
-
event.preventDefault(); // Prevent click if disabled
|
|
1886
|
-
}
|
|
1887
|
-
else {
|
|
1888
|
-
this.handlePageClick(event, (this.currentPage || 1) + 1);
|
|
1889
|
-
}
|
|
1890
|
-
}
|
|
1891
|
-
} }))))) : null));
|
|
5048
|
+
: 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));
|
|
1892
5049
|
}
|
|
1893
5050
|
get hostEl() { return index.getElement(this); }
|
|
1894
5051
|
static get watchers() { return {
|
|
@@ -1905,6 +5062,7 @@ const EdsRating = class {
|
|
|
1905
5062
|
constructor(hostRef) {
|
|
1906
5063
|
index.registerInstance(this, hostRef);
|
|
1907
5064
|
this.rating = index.createEvent(this, "rating", 7);
|
|
5065
|
+
this.buttonRefs = [];
|
|
1908
5066
|
this.ratingType = 'star';
|
|
1909
5067
|
this.ratingCount = 5;
|
|
1910
5068
|
this.selectedRating = 0;
|
|
@@ -1938,16 +5096,37 @@ const EdsRating = class {
|
|
|
1938
5096
|
* Handles the click event on a star.
|
|
1939
5097
|
* @param rating - The selected rating value.
|
|
1940
5098
|
*/
|
|
1941
|
-
|
|
5099
|
+
onSelect(rating) {
|
|
1942
5100
|
this.selectedRating = rating;
|
|
1943
5101
|
this.rating.emit(rating);
|
|
5102
|
+
setTimeout(() => {
|
|
5103
|
+
const btn = this.buttonRefs[rating - 1];
|
|
5104
|
+
btn === null || btn === void 0 ? void 0 : btn.focus();
|
|
5105
|
+
}, 0);
|
|
5106
|
+
}
|
|
5107
|
+
handleKeyNav(e) {
|
|
5108
|
+
const { key } = e;
|
|
5109
|
+
if (!['ArrowRight', 'ArrowLeft', 'ArrowDown', 'ArrowUp'].includes(key)) {
|
|
5110
|
+
return;
|
|
5111
|
+
}
|
|
5112
|
+
e.preventDefault();
|
|
5113
|
+
const increment = key === 'ArrowRight' || key === 'ArrowDown' ? 1 : -1;
|
|
5114
|
+
let next = (this.selectedRating || 1) + increment;
|
|
5115
|
+
if (next > this.ratingCount) {
|
|
5116
|
+
next = 1;
|
|
5117
|
+
}
|
|
5118
|
+
if (next < 1) {
|
|
5119
|
+
next = this.ratingCount;
|
|
5120
|
+
}
|
|
5121
|
+
this.onSelect(next);
|
|
1944
5122
|
}
|
|
1945
5123
|
render() {
|
|
1946
|
-
return (index.h("div", { key: '
|
|
5124
|
+
return (index.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$1) => {
|
|
1947
5125
|
const starRating = index$1 + 1;
|
|
1948
5126
|
const isSelected = starRating <= this.selectedRating;
|
|
1949
5127
|
// Use the mapping text if available; otherwise, fall back to a generic label.
|
|
1950
|
-
|
|
5128
|
+
const checked = this.selectedRating === starRating;
|
|
5129
|
+
return (index.h("eds-button", { ref: (el) => (this.buttonRefs[index$1] = el), icon: this.ratingType, "aria-label": `${starRating} ${this.ratingType}${starRating > 1 ? 's' : ''}`, onClick: () => this.onSelect(starRating), tabIndex: checked || (this.selectedRating === 0 && index$1 === 0) ? 0 : -1, intent: isSelected ? 'primary' : 'ghost', size: "large", "extra-class": "p-2" // Optional padding or styling for the star button
|
|
1951
5130
|
}));
|
|
1952
5131
|
})));
|
|
1953
5132
|
}
|
|
@@ -1955,40 +5134,60 @@ const EdsRating = class {
|
|
|
1955
5134
|
};
|
|
1956
5135
|
EdsRating.style = EdsRatingStyle0;
|
|
1957
5136
|
|
|
1958
|
-
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
|
|
5137
|
+
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}";
|
|
1959
5138
|
const EdsStepsStyle0 = edsStepsCss;
|
|
1960
5139
|
|
|
1961
5140
|
const EdsSteps = class {
|
|
1962
5141
|
constructor(hostRef) {
|
|
1963
5142
|
index.registerInstance(this, hostRef);
|
|
1964
5143
|
this.step = index.createEvent(this, "step", 7);
|
|
5144
|
+
this.finished = index.createEvent(this, "finished", 7);
|
|
5145
|
+
this.next = index.createEvent(this, "next", 7);
|
|
5146
|
+
this.back = index.createEvent(this, "back", 7);
|
|
1965
5147
|
this.handleNext = () => {
|
|
1966
|
-
|
|
1967
|
-
if (this.activeStep
|
|
1968
|
-
this.
|
|
5148
|
+
const lastIndex = this.parsedSteps.length - 1;
|
|
5149
|
+
if (this.activeStep >= lastIndex) {
|
|
5150
|
+
this.finished.emit();
|
|
5151
|
+
return;
|
|
5152
|
+
}
|
|
5153
|
+
const target = this.activeStep + 1;
|
|
5154
|
+
this.next.emit(target);
|
|
5155
|
+
if (this.isNextDisabledFor(this.activeStep)) {
|
|
5156
|
+
return;
|
|
5157
|
+
} // block advance only if current is disabled
|
|
5158
|
+
this.activeStep = target;
|
|
5159
|
+
this.step.emit(this.activeStep);
|
|
5160
|
+
// 2) if using the boolean form, clear it when moving away from a step
|
|
5161
|
+
if (!Array.isArray(this.disableNext)) {
|
|
5162
|
+
this.disableNext = false;
|
|
1969
5163
|
}
|
|
1970
5164
|
};
|
|
1971
5165
|
this.handleBack = () => {
|
|
1972
5166
|
if (this.activeStep > 0) {
|
|
1973
|
-
|
|
5167
|
+
const target = this.activeStep - 1;
|
|
5168
|
+
this.back.emit(target);
|
|
5169
|
+
this.activeStep = target;
|
|
1974
5170
|
this.step.emit(this.activeStep);
|
|
5171
|
+
// also clear boolean form on back
|
|
5172
|
+
if (!Array.isArray(this.disableNext)) {
|
|
5173
|
+
this.disableNext = false;
|
|
5174
|
+
}
|
|
1975
5175
|
}
|
|
1976
5176
|
};
|
|
1977
5177
|
this.steps = [];
|
|
1978
5178
|
this.type = 'static';
|
|
5179
|
+
this.nextLabel = 'Next';
|
|
5180
|
+
this.backLabel = 'Back';
|
|
5181
|
+
this.finishLabel = 'Finish';
|
|
5182
|
+
this.disableNext = false;
|
|
5183
|
+
this.headingLevel = 'h4';
|
|
1979
5184
|
this.activeStep = 0;
|
|
1980
5185
|
}
|
|
1981
|
-
/**
|
|
1982
|
-
* Lifecycle method that runs when the component has fully loaded.
|
|
1983
|
-
* It emits a custom event for each `eds-button` element contained within the breadcrumb.
|
|
1984
|
-
*/
|
|
1985
5186
|
componentDidLoad() {
|
|
1986
5187
|
var _a;
|
|
1987
5188
|
if (this.type === 'linear') {
|
|
1988
5189
|
const btns = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('eds-button');
|
|
1989
|
-
btns === null || btns === void 0 ? void 0 : btns.forEach((btn) =>
|
|
1990
|
-
this.emitContext(btn);
|
|
1991
|
-
});
|
|
5190
|
+
btns === null || btns === void 0 ? void 0 : btns.forEach((btn) => this.emitContext(btn));
|
|
1992
5191
|
}
|
|
1993
5192
|
}
|
|
1994
5193
|
activeStepChanged(newValue) {
|
|
@@ -1996,19 +5195,10 @@ const EdsSteps = class {
|
|
|
1996
5195
|
var _a;
|
|
1997
5196
|
const activeStepContainer = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.step')[newValue];
|
|
1998
5197
|
if (activeStepContainer) {
|
|
1999
|
-
|
|
2000
|
-
btns.forEach((btn) => {
|
|
2001
|
-
this.emitContext(btn);
|
|
2002
|
-
});
|
|
5198
|
+
activeStepContainer.querySelectorAll('eds-button').forEach((btn) => this.emitContext(btn));
|
|
2003
5199
|
}
|
|
2004
5200
|
}, 50);
|
|
2005
5201
|
}
|
|
2006
|
-
/**
|
|
2007
|
-
* Emits a custom event called `parentContext` for a given link element.
|
|
2008
|
-
* This event provides context information about the breadcrumb component.
|
|
2009
|
-
*
|
|
2010
|
-
* @param linkElement - The link element to which the event will be dispatched.
|
|
2011
|
-
*/
|
|
2012
5202
|
emitContext(linkElement) {
|
|
2013
5203
|
const event = new CustomEvent('parentContext', {
|
|
2014
5204
|
detail: {
|
|
@@ -2018,26 +5208,29 @@ const EdsSteps = class {
|
|
|
2018
5208
|
});
|
|
2019
5209
|
linkElement.dispatchEvent(event);
|
|
2020
5210
|
}
|
|
2021
|
-
handleStepClick(index) {
|
|
2022
|
-
this.step.emit(index);
|
|
2023
|
-
// In linear mode, update the active step on header click.
|
|
2024
|
-
if (this.type === 'linear') {
|
|
2025
|
-
this.activeStep = index;
|
|
2026
|
-
}
|
|
2027
|
-
}
|
|
2028
|
-
/**
|
|
2029
|
-
* Parse the JSON string into an array of steps.
|
|
2030
|
-
*/
|
|
2031
5211
|
get parsedSteps() {
|
|
2032
5212
|
return sharedUtils.parseData(this.steps);
|
|
2033
5213
|
}
|
|
5214
|
+
isNextDisabledFor(index) {
|
|
5215
|
+
return Array.isArray(this.disableNext)
|
|
5216
|
+
? !!this.disableNext[index] // per-step
|
|
5217
|
+
: index === this.activeStep && !!this.disableNext; // only active step
|
|
5218
|
+
}
|
|
5219
|
+
/** Render the semantic heading element */
|
|
5220
|
+
renderHeading(title) {
|
|
5221
|
+
const Tag = this.headingLevel;
|
|
5222
|
+
return index.h(Tag, null, title);
|
|
5223
|
+
}
|
|
2034
5224
|
render() {
|
|
2035
5225
|
const steps = this.parsedSteps;
|
|
2036
5226
|
if (this.type === 'linear') {
|
|
2037
|
-
return (index.h("div",
|
|
5227
|
+
return (index.h("div", { class: "steps" }, steps.map((step, index$1) => {
|
|
5228
|
+
const isLast = index$1 === steps.length - 1;
|
|
5229
|
+
return (index.h("div", { class: "step mb-28", key: index$1 }, this.renderHeading(step.title), this.activeStep === index$1 && (index.h("div", { class: "content grid gap-y-16" }, index.h("slot", { name: `step-${index$1}` }, index.h("div", { class: isLast ? 'f-body-02 text-lighter' : 'f-body-02 text-lighter', innerHTML: step.content })), index.h("div", { class: "flex items-center mt-16" }, index.h("eds-button", { label: this.backLabel, intent: "ghost", icon: "chevron-left", iconPos: "left", iconSmall: true, onClick: this.handleBack, disabled: index$1 === 0, class: index$1 === 0 ? 'hidden' : 'block', size: "small" }), index.h("eds-button", { label: isLast ? this.finishLabel : this.nextLabel, intent: "primary", icon: "chevron-right", iconSmall: true, onClick: this.handleNext, disabled: this.isNextDisabledFor(index$1), size: "small", class: "ml-8" })), index.h("slot", { name: `actions-${index$1}` })))));
|
|
5230
|
+
})));
|
|
2038
5231
|
}
|
|
2039
|
-
// Static
|
|
2040
|
-
return (index.h("div", { class: "steps" }, steps.map((step, index$1) => (index.h("div", { class: "step mb-28", key: index$1 },
|
|
5232
|
+
// Static: no navigation buttons
|
|
5233
|
+
return (index.h("div", { class: "steps" }, steps.map((step, index$1) => (index.h("div", { class: "step mb-28", key: index$1 }, this.renderHeading(step.title), index.h("div", { class: "content" }, index.h("slot", { name: `step-${index$1}` }, index.h("div", { class: index$1 === steps.length - 1 ? 'f-body-02 text-lighter mt-16' : 'f-body-02 text-lighter my-16', innerHTML: step.content }))))))));
|
|
2041
5234
|
}
|
|
2042
5235
|
get el() { return index.getElement(this); }
|
|
2043
5236
|
static get watchers() { return {
|
|
@@ -2046,22 +5239,36 @@ const EdsSteps = class {
|
|
|
2046
5239
|
};
|
|
2047
5240
|
EdsSteps.style = EdsStepsStyle0;
|
|
2048
5241
|
|
|
2049
|
-
const edsStepsV2Css = "
|
|
5242
|
+
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}";
|
|
2050
5243
|
const EdsStepsV2Style0 = edsStepsV2Css;
|
|
2051
5244
|
|
|
2052
5245
|
const EdsStepsV2 = class {
|
|
2053
5246
|
constructor(hostRef) {
|
|
2054
5247
|
index.registerInstance(this, hostRef);
|
|
2055
5248
|
this.step = index.createEvent(this, "step", 7);
|
|
5249
|
+
this.finished = index.createEvent(this, "finished", 7);
|
|
5250
|
+
this.next = index.createEvent(this, "next", 7);
|
|
5251
|
+
this.back = index.createEvent(this, "back", 7);
|
|
2056
5252
|
this.handleNext = () => {
|
|
2057
|
-
|
|
2058
|
-
if (this.activeStep
|
|
5253
|
+
const lastIndex = this.parsedSteps.length - 1;
|
|
5254
|
+
if (this.activeStep >= lastIndex) {
|
|
5255
|
+
// Finish
|
|
5256
|
+
this.finished.emit();
|
|
5257
|
+
return;
|
|
5258
|
+
}
|
|
5259
|
+
// Next
|
|
5260
|
+
const target = this.activeStep + 1;
|
|
5261
|
+
this.next.emit(target);
|
|
5262
|
+
if (!this.disableNext) {
|
|
5263
|
+
this.activeStep = target;
|
|
2059
5264
|
this.step.emit(this.activeStep);
|
|
2060
5265
|
}
|
|
2061
5266
|
};
|
|
2062
5267
|
this.handleBack = () => {
|
|
2063
5268
|
if (this.activeStep > 0) {
|
|
2064
|
-
|
|
5269
|
+
const target = this.activeStep - 1;
|
|
5270
|
+
this.back.emit(target);
|
|
5271
|
+
this.activeStep = target;
|
|
2065
5272
|
this.step.emit(this.activeStep);
|
|
2066
5273
|
}
|
|
2067
5274
|
};
|
|
@@ -2071,6 +5278,11 @@ const EdsStepsV2 = class {
|
|
|
2071
5278
|
this.imageWidth = undefined;
|
|
2072
5279
|
this.bg = true;
|
|
2073
5280
|
this.message = undefined;
|
|
5281
|
+
this.nextLabel = 'Next';
|
|
5282
|
+
this.backLabel = 'Back';
|
|
5283
|
+
this.finishLabel = 'Finish';
|
|
5284
|
+
this.disableNext = false;
|
|
5285
|
+
this.headingLevel = 'h4';
|
|
2074
5286
|
this.activeStep = 0;
|
|
2075
5287
|
}
|
|
2076
5288
|
componentDidLoad() {
|
|
@@ -2109,24 +5321,22 @@ const EdsStepsV2 = class {
|
|
|
2109
5321
|
'border-softer effect-focus-within relative rounded-lg border-2'
|
|
2110
5322
|
].join(' ');
|
|
2111
5323
|
}
|
|
2112
|
-
handleStepClick(index) {
|
|
2113
|
-
this.step.emit(index);
|
|
2114
|
-
// In linear mode, update the active step on header click.
|
|
2115
|
-
if (this.type === 'linear') {
|
|
2116
|
-
this.activeStep = index;
|
|
2117
|
-
}
|
|
2118
|
-
}
|
|
2119
5324
|
/**
|
|
2120
5325
|
* Parses the steps property into an array of Step objects.
|
|
2121
5326
|
*/
|
|
2122
5327
|
get parsedSteps() {
|
|
2123
5328
|
return sharedUtils.parseData(this.steps);
|
|
2124
5329
|
}
|
|
5330
|
+
/** Render the semantic heading element */
|
|
5331
|
+
renderHeading(title) {
|
|
5332
|
+
const Tag = this.headingLevel;
|
|
5333
|
+
return index.h(Tag, null, title);
|
|
5334
|
+
}
|
|
2125
5335
|
render() {
|
|
2126
5336
|
const steps = this.parsedSteps;
|
|
2127
|
-
return (index.h("div", { key: '
|
|
5337
|
+
return (index.h("div", { key: '1ff00f17a85e9a3a9d7bef23694560acd77e7ee4', class: this.articleClasses() }, this.imageSrc ? (index.h("div", { class: "w-full mb-12 rounded-t-lg overflow-hidden border-2" }, index.h("eds-img", { src: this.imageSrc, width: this.imageWidth, "with-bg": "true", "lazy-load": "true", alt: "Step illustration" }))) : (this.message && (index.h("div", { class: "w-full bg-[#00A595] rounded-t-lg border-2" }, index.h("div", { class: "p-24" }, index.h("span", { class: "text-inverse f-heading-04 " }, this.message))))), index.h("div", { key: 'a0328e80df5d9447cfa5378eb9e45925f1f68c69', class: "pb-20 px-8" }, this.type === 'linear' ? (index.h("div", { class: "steps" }, steps.map((step, index$1) => (index.h("div", { class: index$1 === 0 ? 'step' : 'step space-y-16', key: index$1 }, this.renderHeading(step.title), this.activeStep === index$1 && (index.h("div", { class: "content grid gap-y-16" }, index.h("slot", { name: `step-${index$1}` }, index.h("div", { class: index$1 === steps.length - 1 ? 'f-body-02 text-lighter' : 'f-body-02 text-lighter', innerHTML: step.content })), index.h("div", { class: "flex items-center" }, index.h("eds-button", { label: this.backLabel, intent: "ghost", icon: "chevron-left", iconPos: "left", iconSmall: true, onClick: this.handleBack, disabled: index$1 === 0, class: index$1 === 0 ? 'hidden' : 'block', size: "small" }), index.h("eds-button", { label: index$1 === 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" }))))))))) : (
|
|
2128
5338
|
// Static mode: show all steps with their content.
|
|
2129
|
-
index.h("div", { class: "steps space-y-8" }, steps.map((step, index$1) => (index.h("div", { class: "step", key: index$1 },
|
|
5339
|
+
index.h("div", { class: "steps space-y-8" }, steps.map((step, index$1) => (index.h("div", { class: "step", key: index$1 }, this.renderHeading(step.title), index.h("div", { class: "content" }, index.h("slot", { name: `step-${index$1}` }, index.h("div", { class: index$1 === steps.length - 1 ? 'f-body-02 text-lighter mt-16' : 'f-body-02 text-lighter', innerHTML: step.content })))))))))));
|
|
2130
5340
|
}
|
|
2131
5341
|
get el() { return index.getElement(this); }
|
|
2132
5342
|
static get watchers() { return {
|
|
@@ -2135,7 +5345,67 @@ const EdsStepsV2 = class {
|
|
|
2135
5345
|
};
|
|
2136
5346
|
EdsStepsV2.style = EdsStepsV2Style0;
|
|
2137
5347
|
|
|
2138
|
-
const
|
|
5348
|
+
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)}";
|
|
5349
|
+
const EdsSwitchStyle0 = edsSwitchCss;
|
|
5350
|
+
|
|
5351
|
+
const EdsSwitch = class {
|
|
5352
|
+
constructor(hostRef) {
|
|
5353
|
+
index.registerInstance(this, hostRef);
|
|
5354
|
+
this.uiswitch = index.createEvent(this, "uiswitch", 7);
|
|
5355
|
+
this.toggleSwitch = () => {
|
|
5356
|
+
if (this.disabled) {
|
|
5357
|
+
return;
|
|
5358
|
+
}
|
|
5359
|
+
this.checked = !this.checked;
|
|
5360
|
+
this.uiswitch.emit({ value: this.checked });
|
|
5361
|
+
analytics.sendAnalytics({
|
|
5362
|
+
category: 'ui-component',
|
|
5363
|
+
tag: this.el.tagName.toLowerCase(),
|
|
5364
|
+
name: this.checked ? this.labelOn : this.labelOff || '',
|
|
5365
|
+
action: 'checked'
|
|
5366
|
+
});
|
|
5367
|
+
};
|
|
5368
|
+
this.handleKeyDown = (e) => {
|
|
5369
|
+
if (this.disabled) {
|
|
5370
|
+
return;
|
|
5371
|
+
}
|
|
5372
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
5373
|
+
e.preventDefault();
|
|
5374
|
+
this.toggleSwitch();
|
|
5375
|
+
}
|
|
5376
|
+
};
|
|
5377
|
+
this.checked = false;
|
|
5378
|
+
this.disabled = false;
|
|
5379
|
+
this.labelOn = '';
|
|
5380
|
+
this.labelOff = '';
|
|
5381
|
+
}
|
|
5382
|
+
render() {
|
|
5383
|
+
const switchId = `switch-${Math.random().toString(36).substr(2, 9)}`;
|
|
5384
|
+
const labelledBy = [];
|
|
5385
|
+
if (this.labelOff) {
|
|
5386
|
+
labelledBy.push(`${switchId}-off`);
|
|
5387
|
+
}
|
|
5388
|
+
if (this.labelOn) {
|
|
5389
|
+
labelledBy.push(`${switchId}-on`);
|
|
5390
|
+
}
|
|
5391
|
+
const accessibleLabel = labelledBy.length === 0
|
|
5392
|
+
? this.labelOn || this.labelOff
|
|
5393
|
+
? this.checked
|
|
5394
|
+
? this.labelOn
|
|
5395
|
+
: this.labelOff
|
|
5396
|
+
: 'Toggle switch'
|
|
5397
|
+
: undefined;
|
|
5398
|
+
return (index.h("div", { key: '95a833cbe8e736d7e747f6fdd8504dd8c169ea60', class: "switch-container" }, this.labelOff && (index.h("span", { key: 'a88de63c35409ab244a6cba5bd70a10728a08b2a', id: `${switchId}-off`, class: "switch-label switch-label--off mr-8" }, this.labelOff)), index.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: {
|
|
5399
|
+
switch: true,
|
|
5400
|
+
'switch--checked': this.checked,
|
|
5401
|
+
'switch--disabled': this.disabled
|
|
5402
|
+
}, onClick: this.toggleSwitch, onKeyDown: this.handleKeyDown, disabled: this.disabled }, index.h("span", { key: '35e6da3bb76779bfaad04d8990dec419524fb543', class: "switch-handle" })), this.labelOn && (index.h("span", { key: 'b14243d9d45dbdddb9473ad2c5696e07be9831d3', id: `${switchId}-on`, class: "switch-label switch-label--on ml-8" }, this.labelOn))));
|
|
5403
|
+
}
|
|
5404
|
+
get el() { return index.getElement(this); }
|
|
5405
|
+
};
|
|
5406
|
+
EdsSwitch.style = EdsSwitchStyle0;
|
|
5407
|
+
|
|
5408
|
+
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}";
|
|
2139
5409
|
const EdsTableStyle0 = edsTableCss;
|
|
2140
5410
|
|
|
2141
5411
|
const EdsTable = class {
|
|
@@ -2145,8 +5415,33 @@ const EdsTable = class {
|
|
|
2145
5415
|
this.handleResize = () => {
|
|
2146
5416
|
this.updateContainerWidth();
|
|
2147
5417
|
};
|
|
5418
|
+
this.onActionKeyDown = (e) => {
|
|
5419
|
+
var _a;
|
|
5420
|
+
if (e.key !== 'ArrowRight' && e.key !== 'ArrowLeft') {
|
|
5421
|
+
return;
|
|
5422
|
+
}
|
|
5423
|
+
e.preventDefault();
|
|
5424
|
+
const currentButton = e.target;
|
|
5425
|
+
const toolbar = currentButton.closest('[role="toolbar"]');
|
|
5426
|
+
if (!toolbar) {
|
|
5427
|
+
return;
|
|
5428
|
+
}
|
|
5429
|
+
// Find all focusable action buttons in this row
|
|
5430
|
+
const actionButtons = Array.from(toolbar.querySelectorAll('eds-button'));
|
|
5431
|
+
const currentIndex = actionButtons.indexOf(currentButton);
|
|
5432
|
+
if (currentIndex === -1) {
|
|
5433
|
+
return;
|
|
5434
|
+
}
|
|
5435
|
+
let nextIndex;
|
|
5436
|
+
if (e.key === 'ArrowRight') {
|
|
5437
|
+
nextIndex = (currentIndex + 1) % actionButtons.length;
|
|
5438
|
+
}
|
|
5439
|
+
else {
|
|
5440
|
+
nextIndex = (currentIndex - 1 + actionButtons.length) % actionButtons.length;
|
|
5441
|
+
}
|
|
5442
|
+
(_a = actionButtons[nextIndex]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
5443
|
+
};
|
|
2148
5444
|
this.data = null;
|
|
2149
|
-
this.endpoint = null;
|
|
2150
5445
|
this.config = {};
|
|
2151
5446
|
this.rowsPerPage = 10;
|
|
2152
5447
|
this.paginationEnabled = true;
|
|
@@ -2184,7 +5479,7 @@ const EdsTable = class {
|
|
|
2184
5479
|
componentWillLoad() {
|
|
2185
5480
|
this.parseConfig();
|
|
2186
5481
|
this.handleActionsChange();
|
|
2187
|
-
this.
|
|
5482
|
+
this.parseData();
|
|
2188
5483
|
}
|
|
2189
5484
|
componentDidLoad() {
|
|
2190
5485
|
this.updateContainerWidth();
|
|
@@ -2232,24 +5527,13 @@ const EdsTable = class {
|
|
|
2232
5527
|
this.parsedConfig = {};
|
|
2233
5528
|
}
|
|
2234
5529
|
}
|
|
2235
|
-
async fetchData() {
|
|
2236
|
-
try {
|
|
2237
|
-
const response = await fetch(this.endpoint);
|
|
2238
|
-
const data = await response.json();
|
|
2239
|
-
this.data = data;
|
|
2240
|
-
}
|
|
2241
|
-
catch (error) {
|
|
2242
|
-
// eslint-disable-next-line
|
|
2243
|
-
console.error('Failed to fetch data:', error);
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
5530
|
setupPaginationListener() {
|
|
2247
5531
|
if (!this.shouldEnablePagination()) {
|
|
2248
5532
|
return;
|
|
2249
5533
|
}
|
|
2250
5534
|
const paginationEl = this.hostEl.shadowRoot.querySelector('eds-pagination');
|
|
2251
5535
|
if (paginationEl && !paginationEl.hasAttribute('listener-attached')) {
|
|
2252
|
-
paginationEl.addEventListener('page', (event) => this.handlePageChange(event.detail));
|
|
5536
|
+
paginationEl.addEventListener('page', (event) => this.handlePageChange(event.detail.value));
|
|
2253
5537
|
paginationEl.setAttribute('listener-attached', 'true');
|
|
2254
5538
|
}
|
|
2255
5539
|
}
|
|
@@ -2297,7 +5581,10 @@ const EdsTable = class {
|
|
|
2297
5581
|
const checked = !!row[boundField];
|
|
2298
5582
|
return (index.h("eds-input-field", { name: `chc-${actionName}`, label: act.label, type: "checkbox", checked: checked, onChange: (e) => this.emitAction(act.name, row, e.target.checked) }));
|
|
2299
5583
|
}
|
|
2300
|
-
|
|
5584
|
+
// Let all action buttons be focusable naturally
|
|
5585
|
+
const showLabel = act.showLabel === true;
|
|
5586
|
+
const btn = (index.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) }));
|
|
5587
|
+
return showLabel ? btn : index.h("eds-tooltip", { content: act.label }, btn);
|
|
2301
5588
|
}
|
|
2302
5589
|
emitAction(actionName, row, checked) {
|
|
2303
5590
|
analytics.sendAnalytics({
|
|
@@ -2343,7 +5630,7 @@ const EdsTable = class {
|
|
|
2343
5630
|
const columnWidth = visibleColumnsCount > 0 ? Math.floor((currentContainerWidth / visibleColumnsCount) * this.divisionFactor()) : 100;
|
|
2344
5631
|
const paginatedRows = this.getPaginatedRows();
|
|
2345
5632
|
const lastPage = Math.ceil(this.totalRows / this.rowsPerPage);
|
|
2346
|
-
return (index.h("div", { key: '
|
|
5633
|
+
return (index.h("div", { key: '67cfdabc741af13585699e43e67ba0d204a60706' }, this.searchEnabled && (index.h("div", { key: '208240b9832f9b2e9645cc9d7315a43bd47b54b3' }, index.h("eds-input-field", { key: 1, icon: "search", name: "search", "aria-label": "Search", type: "text", placeholder: "Search...", onInput: (event) => this.handleSearch(event) }))), index.h("div", { key: '893924497d1535b7d29bc0b64ba48f4a3e366c43', class: "mt-20" }, index.h("table", { key: 'a019fa4f2886d4c2aa4bddc88dc7b6d7aa63fdcb', class: "block overflow-x-auto mt-6 p-0" }, index.h("thead", { key: 'a6360fea59c605878e443a23cf45d0f8a9644140' }, index.h("tr", { key: '09702e8838f32c52bf6314b59ec598c6fa55d609', class: "m-0 p-0 border border-softer even:bg-inverse-softer" }, this.columns.map((col) => {
|
|
2347
5634
|
var _a;
|
|
2348
5635
|
if (col === 'actions') {
|
|
2349
5636
|
return (index.h("th", { class: "m-0 py-8 border border-softer f-ui-02 break-words", style: { minWidth: `${columnWidth - 4}px` } }));
|
|
@@ -2352,17 +5639,22 @@ const EdsTable = class {
|
|
|
2352
5639
|
return (index.h("th", { class: "m-0 py-8 border border-softer f-ui-02 break-words", style: { minWidth: `${columnWidth - 4}px` } }, this.capitalize(col)));
|
|
2353
5640
|
}
|
|
2354
5641
|
return null;
|
|
2355
|
-
}))), index.h("tbody", { key: '
|
|
5642
|
+
}))), index.h("tbody", { key: '5cdb3697e6c84921a823b40714a497f02c82e360' }, paginatedRows.map((row) => (index.h("tr", { class: "m-0 p-0 border border-softer even:bg-inverse-softer" }, this.columns.map((col) => {
|
|
2356
5643
|
var _a;
|
|
2357
5644
|
if (col === 'actions') {
|
|
2358
|
-
return (index.h("td", { class: "text-center border border-softer m-0 f-ui-02 break-words actions-cell", style: { minWidth: `${columnWidth - 4}px` } }, index.h("div", {
|
|
5645
|
+
return (index.h("td", { class: "text-center border border-softer m-0 f-ui-02 break-words actions-cell", style: { minWidth: `${columnWidth - 4}px` } }, index.h("div", { role: "toolbar", "aria-label": "Row actions", onKeyDown: this.onActionKeyDown, style: {
|
|
5646
|
+
display: 'flex',
|
|
5647
|
+
gap: '0.5rem',
|
|
5648
|
+
justifyContent: 'center',
|
|
5649
|
+
flexWrap: 'wrap'
|
|
5650
|
+
} }, this.parsedActions.map((act) => (index.h("span", { style: { whiteSpace: 'nowrap' } }, this.renderSingleActionCell(act.name, row)))))));
|
|
2359
5651
|
}
|
|
2360
5652
|
if (!((_a = this.parsedConfig[col]) === null || _a === void 0 ? void 0 : _a.hidden)) {
|
|
2361
5653
|
// Regular data cell
|
|
2362
5654
|
return (index.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)));
|
|
2363
5655
|
}
|
|
2364
5656
|
return null;
|
|
2365
|
-
}))))))), this.shouldEnablePagination() && (index.h("div", { key: '
|
|
5657
|
+
}))))))), this.shouldEnablePagination() && (index.h("div", { key: 'f5af2cd6e65c3ed55ec2810ec4b1e3f891866271', class: "mt-20" }, index.h("eds-pagination", { key: '32965384707df502fb197712c73bb290e38ce040', currentPage: this.currentPage, lastPage: lastPage, perPage: this.rowsPerPage, total: this.totalRows, mode: "default" })))));
|
|
2366
5658
|
}
|
|
2367
5659
|
get hostEl() { return index.getElement(this); }
|
|
2368
5660
|
static get watchers() { return {
|
|
@@ -2373,22 +5665,27 @@ const EdsTable = class {
|
|
|
2373
5665
|
};
|
|
2374
5666
|
EdsTable.style = EdsTableStyle0;
|
|
2375
5667
|
|
|
2376
|
-
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-
|
|
5668
|
+
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}}";
|
|
2377
5669
|
const EdsTabsStyle0 = edsTabsCss;
|
|
2378
5670
|
|
|
2379
5671
|
const EdsTabs = class {
|
|
2380
5672
|
constructor(hostRef) {
|
|
2381
5673
|
index.registerInstance(this, hostRef);
|
|
2382
5674
|
this.tab = index.createEvent(this, "tab", 7);
|
|
5675
|
+
this.tabRefs = [];
|
|
5676
|
+
// Store tab reference
|
|
5677
|
+
this.setTabRef = (el, index) => {
|
|
5678
|
+
if (el) {
|
|
5679
|
+
this.tabRefs[index] = el;
|
|
5680
|
+
}
|
|
5681
|
+
};
|
|
2383
5682
|
// cva configuration
|
|
2384
5683
|
this.tabCva = index$1.cva([
|
|
2385
5684
|
'relative py-12',
|
|
2386
5685
|
'f-ui-03 whitespace-nowrap',
|
|
2387
|
-
'effect-color',
|
|
5686
|
+
'effect-color effect-focus',
|
|
2388
5687
|
'focus-visible:text-default hover:text-default',
|
|
2389
|
-
'border-2'
|
|
2390
|
-
"after:content-[''] after:absolute after:inset-0 after:rounded-t-lg after:opacity-0",
|
|
2391
|
-
'outline-none focus:outline-none focus-visible:outline-none focus-visible:after:opacity-100'
|
|
5688
|
+
'border-2'
|
|
2392
5689
|
], {
|
|
2393
5690
|
variants: {
|
|
2394
5691
|
position: {
|
|
@@ -2398,7 +5695,10 @@ const EdsTabs = class {
|
|
|
2398
5695
|
right: 'pl-28 pr-16 rounded-tr-lg border-l-0 -ml-16 after:left-16'
|
|
2399
5696
|
},
|
|
2400
5697
|
active: {
|
|
2401
|
-
false:
|
|
5698
|
+
false: [
|
|
5699
|
+
'text-lighter bg-dark hover:bg-darker border-softest border-b-0 z-1',
|
|
5700
|
+
"after:content-[''] after:absolute after:bottom-0 after:inset-x-0 after:h-2 after:border-soft"
|
|
5701
|
+
],
|
|
2402
5702
|
true: [
|
|
2403
5703
|
'bg-default text-default z-99',
|
|
2404
5704
|
'rounded-t-lg',
|
|
@@ -2417,28 +5717,35 @@ const EdsTabs = class {
|
|
|
2417
5717
|
componentWillLoad() {
|
|
2418
5718
|
this.parseTabs();
|
|
2419
5719
|
this.setActiveIndex();
|
|
2420
|
-
this.tab.emit({ tabId: this.identifier, index:
|
|
5720
|
+
this.tab.emit({ tabId: this.identifier, index: this.activeIndex });
|
|
2421
5721
|
}
|
|
2422
5722
|
/**
|
|
2423
|
-
* Parses the `
|
|
2424
|
-
* Returns an empty array if parsing fails or if `
|
|
2425
|
-
*
|
|
2426
|
-
* @returns {any[]} Array of parsed link objects
|
|
2427
|
-
*/
|
|
2428
|
-
/**
|
|
2429
|
-
* Parses the `links` prop into an array of link objects.
|
|
2430
|
-
* Returns an empty array if parsing fails or if `links` is not a valid JSON string or object.
|
|
5723
|
+
* Parses the `tabs` prop into an array of tab objects.
|
|
5724
|
+
* Returns an empty array if parsing fails or if `tabs` is not a valid JSON string or object.
|
|
2431
5725
|
*
|
|
2432
|
-
* @returns {any[]} Array of parsed
|
|
5726
|
+
* @returns {any[]} Array of parsed tab objects
|
|
2433
5727
|
*/
|
|
2434
5728
|
parseTabs() {
|
|
2435
5729
|
this.parsedTabs = sharedUtils.parseData(this.tabs);
|
|
5730
|
+
// Reset tab refs when tabs change
|
|
5731
|
+
this.tabRefs = [];
|
|
2436
5732
|
}
|
|
2437
5733
|
componentDidLoad() {
|
|
2438
5734
|
this.scrollToActiveTab();
|
|
2439
5735
|
}
|
|
5736
|
+
componentDidUpdate() {
|
|
5737
|
+
// Ensure we have the correct number of tab refs after render
|
|
5738
|
+
if (this.tabRefs.length !== this.parsedTabs.length) {
|
|
5739
|
+
this.tabRefs = new Array(this.parsedTabs.length).fill(null);
|
|
5740
|
+
}
|
|
5741
|
+
}
|
|
2440
5742
|
setActiveIndex() {
|
|
2441
5743
|
this.activeIndex = this.parsedTabs.findIndex((tab) => tab.active);
|
|
5744
|
+
// If no active tab found, default to first tab
|
|
5745
|
+
if (this.activeIndex === -1 && this.parsedTabs.length > 0) {
|
|
5746
|
+
this.activeIndex = 0;
|
|
5747
|
+
this.parsedTabs[0].active = true;
|
|
5748
|
+
}
|
|
2442
5749
|
}
|
|
2443
5750
|
scrollToActiveTab() {
|
|
2444
5751
|
var _a;
|
|
@@ -2460,31 +5767,74 @@ const EdsTabs = class {
|
|
|
2460
5767
|
: index < this.activeIndex
|
|
2461
5768
|
? 'left'
|
|
2462
5769
|
: 'right';
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
5770
|
+
const rawZ = position === 'left' ? index : this.parsedTabs.length + 1 - index;
|
|
5771
|
+
// clamp inactive to at least 1
|
|
5772
|
+
const z = active ? this.parsedTabs.length + 99 : Math.max(rawZ, 1);
|
|
5773
|
+
return Object.assign({ class: this.tabCva({ active, position }), style: {
|
|
5774
|
+
// stringify the number so it matches { [key: string]: string }
|
|
5775
|
+
zIndex: `${z}`
|
|
2468
5776
|
} }, (active ? { 'data-tab-active': 'true' } : {}));
|
|
2469
5777
|
}
|
|
2470
|
-
handleTabClick(index, tabLabel) {
|
|
5778
|
+
handleTabClick(index, tabLabel, shouldFocus = true) {
|
|
5779
|
+
// Validate index
|
|
5780
|
+
if (index < 0 || index >= this.parsedTabs.length) {
|
|
5781
|
+
return;
|
|
5782
|
+
}
|
|
2471
5783
|
// Update the active index and set all tabs' active state accordingly
|
|
2472
5784
|
this.activeIndex = index;
|
|
2473
5785
|
this.parsedTabs = this.parsedTabs.map((tab, tabIndex) => (Object.assign(Object.assign({}, tab), { active: tabIndex === index })));
|
|
2474
5786
|
this.tab.emit({ tabId: this.identifier, index: index, name: tabLabel });
|
|
2475
|
-
analytics
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
5787
|
+
// Only send analytics for actual clicks, not keyboard navigation
|
|
5788
|
+
if (shouldFocus) {
|
|
5789
|
+
analytics.sendAnalytics({
|
|
5790
|
+
category: 'ui-component',
|
|
5791
|
+
tag: this.el.tagName.toLowerCase(),
|
|
5792
|
+
name: (tabLabel === null || tabLabel === void 0 ? void 0 : tabLabel.toLowerCase()) || '',
|
|
5793
|
+
action: 'click'
|
|
5794
|
+
});
|
|
5795
|
+
}
|
|
5796
|
+
// Focus management for keyboard navigation
|
|
5797
|
+
if (shouldFocus && this.tabRefs[index]) {
|
|
5798
|
+
// Use a small timeout to ensure the DOM has updated
|
|
5799
|
+
setTimeout(() => {
|
|
5800
|
+
var _a;
|
|
5801
|
+
(_a = this.tabRefs[index]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
5802
|
+
}, 0);
|
|
5803
|
+
}
|
|
5804
|
+
}
|
|
5805
|
+
onKeyDown(ev, idx) {
|
|
5806
|
+
let newIndex = idx;
|
|
5807
|
+
switch (ev.key) {
|
|
5808
|
+
case 'ArrowRight':
|
|
5809
|
+
newIndex = (idx + 1) % this.parsedTabs.length;
|
|
5810
|
+
ev.preventDefault();
|
|
5811
|
+
break;
|
|
5812
|
+
case 'ArrowLeft':
|
|
5813
|
+
newIndex = (idx - 1 + this.parsedTabs.length) % this.parsedTabs.length;
|
|
5814
|
+
ev.preventDefault();
|
|
5815
|
+
break;
|
|
5816
|
+
case 'Home':
|
|
5817
|
+
newIndex = 0;
|
|
5818
|
+
ev.preventDefault();
|
|
5819
|
+
break;
|
|
5820
|
+
case 'End':
|
|
5821
|
+
newIndex = this.parsedTabs.length - 1;
|
|
5822
|
+
ev.preventDefault();
|
|
5823
|
+
break;
|
|
5824
|
+
default:
|
|
5825
|
+
return; // Don't handle other keys
|
|
5826
|
+
}
|
|
5827
|
+
if (newIndex !== idx) {
|
|
5828
|
+
this.handleTabClick(newIndex, this.parsedTabs[newIndex].label, true);
|
|
5829
|
+
}
|
|
2481
5830
|
}
|
|
2482
5831
|
render() {
|
|
2483
|
-
return (index.h("div", { key: '
|
|
2484
|
-
const TabComponent =
|
|
5832
|
+
return (index.h("div", { key: '7cb51cf475d45ee3e43877ee4d42565f5930613a', id: `${this.identifier}` }, index.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-['']" }, index.h("nav", { key: '4d55e72e9f437cef8be06931445f619196a973a7', role: "tablist", ref: (el) => (this.tabContainer = el), class: "inline-flex", "aria-label": this.navAriaLabel }, this.parsedTabs.map((tab, index$1) => {
|
|
5833
|
+
const TabComponent = 'button';
|
|
2485
5834
|
const tabProps = this.getTabOptions(tab.active, index$1);
|
|
2486
|
-
|
|
2487
|
-
|
|
5835
|
+
const isActive = index$1 === this.activeIndex;
|
|
5836
|
+
return (index.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$1}`, id: `tab-${index$1}`, ref: (el) => this.setTabRef(el, index$1), onClick: () => this.handleTabClick(index$1, tab.label, true), onKeyDown: (e) => this.onKeyDown(e, index$1) }), tab.label || tab.ariaLabel));
|
|
5837
|
+
}))), index.h("div", { key: 'e75f877da39c25e912853fea5dc2438fc15c67b5', class: "tab-panels" }, this.parsedTabs.map((_, index$1) => (index.h("div", { role: "tabpanel", id: `panel-${index$1}`, "aria-labelledby": `tab-${index$1}`, hidden: index$1 !== this.activeIndex, tabIndex: index$1 === this.activeIndex ? 0 : -1, class: "effect-focus" }, index.h("slot", { name: `panel-${index$1}` })))))));
|
|
2488
5838
|
}
|
|
2489
5839
|
get el() { return index.getElement(this); }
|
|
2490
5840
|
static get watchers() { return {
|
|
@@ -2529,7 +5879,7 @@ const EdsTag = class {
|
|
|
2529
5879
|
}
|
|
2530
5880
|
render() {
|
|
2531
5881
|
const classes = tagStyles({ intent: this.intent, size: this.size });
|
|
2532
|
-
return index.h("span", { key: '
|
|
5882
|
+
return index.h("span", { key: 'e3fe041e8783a7d1bb5a281eb154e3c07851da38', class: classes }, this.label);
|
|
2533
5883
|
}
|
|
2534
5884
|
};
|
|
2535
5885
|
EdsTag.style = EdsTagStyle0;
|
|
@@ -2605,13 +5955,48 @@ const EdsToast = class {
|
|
|
2605
5955
|
};
|
|
2606
5956
|
EdsToast.style = EdsToastStyle0;
|
|
2607
5957
|
|
|
5958
|
+
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%}";
|
|
5959
|
+
const EdsTooltipStyle0 = edsTooltipCss;
|
|
5960
|
+
|
|
5961
|
+
const EdsTooltip = class {
|
|
5962
|
+
constructor(hostRef) {
|
|
5963
|
+
index.registerInstance(this, hostRef);
|
|
5964
|
+
this.content = undefined;
|
|
5965
|
+
this.position = 'top';
|
|
5966
|
+
}
|
|
5967
|
+
/** fire analytics on every hover */
|
|
5968
|
+
handleHover() {
|
|
5969
|
+
analytics.sendAnalytics({
|
|
5970
|
+
category: 'ui-component',
|
|
5971
|
+
tag: this.el.tagName.toLowerCase(),
|
|
5972
|
+
name: this.content.toLowerCase(),
|
|
5973
|
+
action: 'hover'
|
|
5974
|
+
});
|
|
5975
|
+
}
|
|
5976
|
+
render() {
|
|
5977
|
+
const positionClass = this.position === 'bottom' ? 'top-full mt-2' : 'bottom-full mb-2';
|
|
5978
|
+
return (index.h("div", { key: '135df7d17db03fb3bb7bbcc50ad9ee5d84a2bca2', class: "relative w-full inline-block group" }, index.h("slot", { key: '4c12874eeb942e33f9c62ea6f1077fd051f683b6' }), index.h("div", { key: '8bb7173d16889b2ae550dc0269d9e47e1dae00ac', class: `absolute ${positionClass}
|
|
5979
|
+
rounded-xs bg-strongest text-inverse
|
|
5980
|
+
f-ui-03-light pointer-events-none
|
|
5981
|
+
z-10 px-4 opacity-0 transition-opacity duration-150 ease-in-out
|
|
5982
|
+
group-hover:opacity-100 whitespace-normal break-words`, role: "tooltip" }, this.content)));
|
|
5983
|
+
}
|
|
5984
|
+
get el() { return index.getElement(this); }
|
|
5985
|
+
};
|
|
5986
|
+
EdsTooltip.style = EdsTooltipStyle0;
|
|
5987
|
+
|
|
2608
5988
|
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}";
|
|
2609
5989
|
const EdsUserStyle0 = edsUserCss;
|
|
2610
5990
|
|
|
2611
5991
|
const EdsUser = class {
|
|
2612
5992
|
constructor(hostRef) {
|
|
2613
5993
|
index.registerInstance(this, hostRef);
|
|
5994
|
+
this.handleDropdown = (e) => {
|
|
5995
|
+
this.expanded = e.detail.expanded;
|
|
5996
|
+
};
|
|
2614
5997
|
this.user = undefined;
|
|
5998
|
+
this.intent = 'tertiary';
|
|
5999
|
+
this.expanded = false;
|
|
2615
6000
|
}
|
|
2616
6001
|
/**
|
|
2617
6002
|
* Helper getter to ensure we work with a User object.
|
|
@@ -2637,15 +6022,20 @@ const EdsUser = class {
|
|
|
2637
6022
|
}
|
|
2638
6023
|
render() {
|
|
2639
6024
|
const user = this.parsedUser;
|
|
2640
|
-
|
|
6025
|
+
const iconName = this.expanded ? 'chevron-down' : 'chevron-right';
|
|
6026
|
+
return (index.h("div", { key: '965387104c4bd6cd3223c08f16d90146c098594c', class: "block" }, index.h("div", { key: '37fe5539cb058112ebe0d910439acb55b5abccd8', class: "flex items-center" }, index.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 }, index.h("div", { key: '0228c1728b0b73e2504d2608339f9be408be09b8', class: "min-w-[280px] p-8" }, index.h("div", { key: 'b83148ff8249bde91842b036da5506f9f5cbb145', class: "flex gap-x-16" }, index.h("eds-avatar", { key: '243a05bae2e4e592dc386b1897d824232d0bcfa6', "first-name": user.given_name, "last-name": user.family_name, initials: this.initials, color: "black" }), index.h("div", { key: '6938f54621aa89e61aa6639e8c88af4e262e0fec', class: "max-w-full" }, user.name && index.h("p", { key: '224ce5cf6819a9dd0c3794410a94da30cc4213bf', class: "f-ui-01 text-default w-full text-ellipsis" }, user.name), user.preferred_username && index.h("p", { key: '096ac761149763ef4305ef5e9bf1f4b593a0fe4f', class: "f-ui-03-light text-light mt-4" }, user.preferred_username), user.email && index.h("p", { key: '79f7da3c6c5efc1f521991c403184cf050b3d2e7', class: "f-ui-03-light text-light mt-4" }, user.email))), index.h("div", { key: '52ce98bcc290902605ebd427ee8ab72ac9af3d62', class: "text-default flex w-full flex-col gap-y-8" }, index.h("slot", { key: '88d1b250c434830347e0eb813214382ce899c485' })))))));
|
|
2641
6027
|
}
|
|
2642
6028
|
get hostEl() { return index.getElement(this); }
|
|
2643
6029
|
};
|
|
2644
6030
|
EdsUser.style = EdsUserStyle0;
|
|
2645
6031
|
|
|
6032
|
+
exports.eds_accordion = EdsAccordion;
|
|
6033
|
+
exports.eds_alert = EdsAlert;
|
|
2646
6034
|
exports.eds_avatar = EdsAvatar;
|
|
2647
6035
|
exports.eds_block_break = EdsBlockBreak;
|
|
6036
|
+
exports.eds_breadcrumb = EdsBreadcrumb;
|
|
2648
6037
|
exports.eds_button = EdsButton;
|
|
6038
|
+
exports.eds_code_block = EdsCodeBlock;
|
|
2649
6039
|
exports.eds_dropdown = EdsDropdown;
|
|
2650
6040
|
exports.eds_form = EdsForm;
|
|
2651
6041
|
exports.eds_header = EdsHeader;
|
|
@@ -2660,12 +6050,16 @@ exports.eds_input_search = EdsInputSearch;
|
|
|
2660
6050
|
exports.eds_input_select = EdsInputSelect;
|
|
2661
6051
|
exports.eds_link = EdsLink;
|
|
2662
6052
|
exports.eds_logo = EdsLogo;
|
|
6053
|
+
exports.eds_matomo_notice = EdsMatomoNotice;
|
|
6054
|
+
exports.eds_nps = EdsNps;
|
|
2663
6055
|
exports.eds_pagination = EdsPagination;
|
|
2664
6056
|
exports.eds_rating = EdsRating;
|
|
2665
6057
|
exports.eds_steps = EdsSteps;
|
|
2666
6058
|
exports.eds_steps_v2 = EdsStepsV2;
|
|
6059
|
+
exports.eds_switch = EdsSwitch;
|
|
2667
6060
|
exports.eds_table = EdsTable;
|
|
2668
6061
|
exports.eds_tabs = EdsTabs;
|
|
2669
6062
|
exports.eds_tag = EdsTag;
|
|
2670
6063
|
exports.eds_toast = EdsToast;
|
|
6064
|
+
exports.eds_tooltip = EdsTooltip;
|
|
2671
6065
|
exports.eds_user = EdsUser;
|