@nldd/design-system 0.20.0 → 0.21.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/custom-elements.json +204 -8
- package/dist/cdn/autoloader.js +181 -0
- package/dist/cdn/chunks/activity-indicator-JglZJ8dh.js +356 -0
- package/dist/cdn/chunks/activity-indicator.i18n-D7mCy6d2.js +3 -0
- package/dist/cdn/chunks/avatar-ASqePVhU.js +308 -0
- package/dist/cdn/chunks/avatar-group-rknt4FBO.js +338 -0
- package/dist/cdn/chunks/avatar-group.i18n-BYw_9wt_.js +7 -0
- package/dist/cdn/chunks/avatar.i18n-CMwQjBkS.js +7 -0
- package/dist/cdn/chunks/badge-Cc2Nufoc.js +323 -0
- package/dist/cdn/chunks/badge.i18n-DqW7hLQj.js +3 -0
- package/dist/cdn/chunks/banner-BLVKM07M.js +325 -0
- package/dist/cdn/chunks/banner.i18n-BOCM9rGN.js +3 -0
- package/dist/cdn/chunks/bar-split-view-Clbg-p9H.js +259 -0
- package/dist/cdn/chunks/base-CfuoYRhN.js +3 -0
- package/dist/cdn/chunks/blockquote-BoOqbGdm.js +189 -0
- package/dist/cdn/chunks/box-WkhyjQVy.js +88 -0
- package/dist/cdn/chunks/breadcrumbs-D9YxZzRj.js +162 -0
- package/dist/cdn/chunks/breadcrumbs.i18n-zmO8jaTO.js +3 -0
- package/dist/cdn/chunks/breakpoints-Cwor8TRP.js +15 -0
- package/dist/cdn/chunks/button-DO90Lo6q.js +863 -0
- package/dist/cdn/chunks/button-bar-Bxgdbyh3.js +225 -0
- package/dist/cdn/chunks/button-group-BYGPPLmZ.js +205 -0
- package/dist/{components/button.i18n-DiDGynnq.js → cdn/chunks/button.i18n-BGFt7Z9u.js} +2 -2
- package/dist/cdn/chunks/card-BP0jfOkS.js +262 -0
- package/dist/cdn/chunks/card.i18n-CpafLm3i.js +8 -0
- package/dist/cdn/chunks/carried-context-DlMSujiJ.js +37 -0
- package/dist/cdn/chunks/cell-BRD2ilQh.js +144 -0
- package/dist/cdn/chunks/checkbox-Cazx8CQn.js +296 -0
- package/dist/cdn/chunks/checkbox-field-DDZ-B6vH.js +157 -0
- package/dist/cdn/chunks/class-map-CXSdNjt8.js +26 -0
- package/dist/cdn/chunks/code-editor-D6Q55oaY.js +286 -0
- package/dist/cdn/chunks/code-viewer-DspLH2T1.js +766 -0
- package/dist/cdn/chunks/code-viewer.i18n-BHfSDRbK.js +13 -0
- package/dist/cdn/chunks/codemirror-input-Db65x22n.js +1232 -0
- package/dist/cdn/chunks/collection-NVtkvDls.js +396 -0
- package/dist/cdn/chunks/collection.i18n-DqWPGnZO.js +8 -0
- package/dist/cdn/chunks/combo-box-DyBQSaQl.js +512 -0
- package/dist/cdn/chunks/combo-box.i18n-BorzYnJ2.js +6 -0
- package/dist/cdn/chunks/container-rrbwk0z4.js +602 -0
- package/dist/cdn/chunks/custom-element-BW8Ua4c7.js +7 -0
- package/dist/cdn/chunks/custom-element-q6NzoL5b.js +301 -0
- package/dist/cdn/chunks/custom-font-size-D7KNr84p.js +57 -0
- package/dist/cdn/chunks/date-field-Clti_wKN.js +654 -0
- package/dist/cdn/chunks/date-field.i18n-BTzc0E9a.js +15 -0
- package/dist/cdn/chunks/date-picker-2TCQLd5D.js +993 -0
- package/dist/cdn/chunks/date-picker.i18n-Dsc_M5QK.js +82 -0
- package/dist/cdn/chunks/decorate-TduJMFD_.js +280 -0
- package/dist/cdn/chunks/defer-focus-F73ud2D9.js +9 -0
- package/dist/cdn/chunks/described-by-mixin-daRE7orX.js +32 -0
- package/dist/cdn/chunks/description-cell-CQwOj_rN.js +166 -0
- package/dist/cdn/chunks/dev-checks-zW_W-hnh.js +2695 -0
- package/dist/cdn/chunks/directive-CwRgozUW.js +27 -0
- package/dist/cdn/chunks/dismiss-from-title-bar-C6mP7sWP.js +5 -0
- package/dist/cdn/chunks/dist-3C80SZN9.js +849 -0
- package/dist/cdn/chunks/dist-A7_1pHX0.js +379 -0
- package/dist/cdn/chunks/dist-BEfLdOvy.js +1346 -0
- package/dist/cdn/chunks/dist-BTUxFM2V.js +268 -0
- package/dist/cdn/chunks/dist-CP3G1pSK.js +1037 -0
- package/dist/cdn/chunks/dist-C_dGY6zR.js +468 -0
- package/dist/{components/dist-B9YBOGFW.js → cdn/chunks/dist-ChmCRv39.js} +109 -153
- package/dist/{components/dist-CJm4tkNC.js → cdn/chunks/dist-D2qap2OY.js} +23 -31
- package/dist/cdn/chunks/dist-DPUBF0MZ.js +1593 -0
- package/dist/{components/dist-4g23YHP0.js → cdn/chunks/dist-DrTzvgE7.js} +291 -404
- package/dist/cdn/chunks/dist-EM4MWLQq.js +385 -0
- package/dist/cdn/chunks/dist-EgIBI-FG.js +293 -0
- package/dist/{components/dist-Bf823YyL.js → cdn/chunks/dist-Rm6FvrSR.js} +272 -551
- package/dist/cdn/chunks/divider-CCNbnplA.js +53 -0
- package/dist/cdn/chunks/document-tab-bar-CUc4WWY3.js +973 -0
- package/dist/cdn/chunks/document-tab-bar.i18n-DKrA9TnB.js +9 -0
- package/dist/cdn/chunks/drag-handle-cell-CbzDYebG.js +206 -0
- package/dist/cdn/chunks/drag-handle-cell.i18n-CKUrbm2q.js +3 -0
- package/dist/cdn/chunks/dropdown-DZTZtkm5.js +350 -0
- package/dist/cdn/chunks/element-state-B-44fVqq.js +20 -0
- package/dist/cdn/chunks/file-field-Bff6_1pp.js +1484 -0
- package/dist/cdn/chunks/file-field.i18n-pDM7Utud.js +40 -0
- package/dist/cdn/chunks/floating-ui.dom-B8J1rV2c.js +753 -0
- package/dist/cdn/chunks/focus-target-DSLGcCWq.js +24 -0
- package/dist/cdn/chunks/form-actions-C_7hINq-.js +90 -0
- package/dist/cdn/chunks/form-associated-mixin--GIbl98p.js +62 -0
- package/dist/cdn/chunks/form-field--4nWJ_DK.js +364 -0
- package/dist/cdn/chunks/form-hXLgy_tY.js +84 -0
- package/dist/cdn/chunks/form-section-By-D4un0.js +64 -0
- package/dist/cdn/chunks/full-bleed-section-Dg4sIJG1.js +161 -0
- package/dist/cdn/chunks/gherkin-eseYvsxh.js +29 -0
- package/dist/cdn/chunks/hero-CQQMNCT_.js +761 -0
- package/dist/{components/icon-_Eox7ZfO.js → cdn/chunks/icon-BORlalt0.js} +298 -308
- package/dist/cdn/chunks/icon-button-rKiIHs7A.js +632 -0
- package/dist/{components/icon-button.i18n-1_N-wN6x.js → cdn/chunks/icon-button.i18n-DpZOfIS4.js} +2 -4
- package/dist/cdn/chunks/icon-cell-rk4NQid2.js +156 -0
- package/dist/cdn/chunks/identity-Cg1l0HhB.js +187 -0
- package/dist/cdn/chunks/if-defined-CaKKERku.js +4 -0
- package/dist/cdn/chunks/image-DZMW6JgL.js +659 -0
- package/dist/cdn/chunks/image.i18n-ONcm1h7o.js +3 -0
- package/dist/cdn/chunks/implicit-submission-Csbcor_E.js +27 -0
- package/dist/cdn/chunks/inline-dialog-WlqtPBPJ.js +259 -0
- package/dist/cdn/chunks/input-modality-XE0B7yCn.js +42 -0
- package/dist/cdn/chunks/just-in-time-education-DRcb5g7x.js +611 -0
- package/dist/cdn/chunks/just-in-time-education.i18n-CW_dsaxf.js +6 -0
- package/dist/cdn/chunks/kanban-Ca_mfqsA.js +400 -0
- package/dist/cdn/chunks/kanban-column-fgIMc7pw.js +375 -0
- package/dist/cdn/chunks/kanban.i18n-CWqc3e0B.js +11 -0
- package/dist/cdn/chunks/keyboard-shortcut-EknnW7Ub.js +267 -0
- package/dist/cdn/chunks/languages-yKikVFv_.js +8893 -0
- package/dist/cdn/chunks/link-FBSAJ3UC.js +229 -0
- package/dist/cdn/chunks/link-group-90qVfKa0.js +111 -0
- package/dist/cdn/chunks/link-hint-KFhgr5Ng.js +24 -0
- package/dist/cdn/chunks/link-rel-DvrTEfVT.js +8 -0
- package/dist/cdn/chunks/link.i18n-DJPobGmu.js +8 -0
- package/dist/cdn/chunks/list-CaWl3q0Z.js +880 -0
- package/dist/cdn/chunks/list-item-Cagnf6eG.js +802 -0
- package/dist/cdn/chunks/list-item-segment-BRzBF1y_.js +315 -0
- package/dist/cdn/chunks/list-item-segment.i18n-DHnrQL4V.js +8 -0
- package/dist/{components/list-item.i18n-89uqlBMK.js → cdn/chunks/list-item.i18n-Br6J5Ev9.js} +2 -2
- package/dist/cdn/chunks/list-items-Du0RCWsY.js +6 -0
- package/dist/{components/list.i18n-CKqbhFQ_.js → cdn/chunks/list.i18n-C40ltgdI.js} +2 -2
- package/dist/cdn/chunks/loading-tags-DtUr-DR7.js +3 -0
- package/dist/cdn/chunks/menu-BOu_pD1Q.js +719 -0
- package/dist/cdn/chunks/menu-bar-0NFXvq-v.js +253 -0
- package/dist/cdn/chunks/menu-bar-item-DGSC_ETi.js +365 -0
- package/dist/cdn/chunks/menu-bar.i18n-BoMu4Eoz.js +3 -0
- package/dist/cdn/chunks/menu-divider-CLLRgMll.js +15 -0
- package/dist/cdn/chunks/menu-group-BL24ChpR.js +23 -0
- package/dist/cdn/chunks/menu-item-CooKfrFa.js +140 -0
- package/dist/cdn/chunks/menu.i18n-C6uYJsG3.js +10 -0
- package/dist/cdn/chunks/menu.template-C6rbfI-u.js +642 -0
- package/dist/cdn/chunks/modal-dialog-BrUMP4Jm.js +240 -0
- package/dist/cdn/chunks/multi-line-text-field-D7hXhyOn.js +318 -0
- package/dist/cdn/chunks/navigation-split-view-B2ZQhxEb.js +621 -0
- package/dist/cdn/chunks/nl.generated-D6T41jG3.js +112 -0
- package/dist/cdn/chunks/notification-DSGP14d1.js +492 -0
- package/dist/cdn/chunks/notification.i18n-BKUSLN5c.js +6 -0
- package/dist/cdn/chunks/number-field-B8op14Y_.js +301 -0
- package/dist/cdn/chunks/number-field.i18n-BS0bINWY.js +7 -0
- package/dist/cdn/chunks/one-half-one-half-section-ZYmHYf4Q.js +213 -0
- package/dist/cdn/chunks/one-third-two-thirds-section-Ds10K6AS.js +213 -0
- package/dist/cdn/chunks/one-time-code-field-Cgy_tTS4.js +693 -0
- package/dist/cdn/chunks/open-when-rendered-CW_2_WUZ.js +20 -0
- package/dist/cdn/chunks/owned-attribute-x9OCTy_4.js +6 -0
- package/dist/cdn/chunks/owner-form-Cq8tT7ac.js +7 -0
- package/dist/cdn/chunks/page-CBf_Decp.js +431 -0
- package/dist/cdn/chunks/page-footer-CSv1dU7M.js +396 -0
- package/dist/cdn/chunks/page-footer.i18n-pbdr4lN3.js +3 -0
- package/dist/cdn/chunks/page-section-mixin-Dp6X8GKd.js +132 -0
- package/dist/cdn/chunks/pagination-CMUcFB53.js +485 -0
- package/dist/cdn/chunks/pagination.i18n-QQMx14CQ.js +9 -0
- package/dist/cdn/chunks/password-field-C76Vm3rm.js +368 -0
- package/dist/cdn/chunks/password-field.i18n-CzdBn-1b.js +8 -0
- package/dist/cdn/chunks/popover-C-CVVtfl.js +334 -0
- package/dist/cdn/chunks/popover-target-B25dxnmt.js +10 -0
- package/dist/cdn/chunks/popover.i18n-DmFBHUvB.js +3 -0
- package/dist/cdn/chunks/popup-anchor-controller-VZw0bXf2.js +30 -0
- package/dist/cdn/chunks/progress-bar-BLiHaRUS.js +674 -0
- package/dist/cdn/chunks/progress-bar.i18n-Cr5miGTx.js +8 -0
- package/dist/cdn/chunks/progress-circle-CjkovRbL.js +667 -0
- package/dist/cdn/chunks/progress-circle.i18n-CRrXuY4V.js +8 -0
- package/dist/cdn/chunks/query-ChDzi9FQ.js +28 -0
- package/dist/cdn/chunks/radio-button-GHyO-GQB.js +338 -0
- package/dist/cdn/chunks/radio-button-field-C-Z6Lnd4.js +192 -0
- package/dist/cdn/chunks/radio-button-group-ChTqBCnQ.js +118 -0
- package/dist/cdn/chunks/radio-position-CXWYAjaz.js +10 -0
- package/dist/cdn/chunks/reflect-non-default-Bu3rpCvg.js +9 -0
- package/dist/cdn/chunks/render-marked-DX_5ISZE.js +37 -0
- package/dist/cdn/chunks/repeat-Ch_5OsXE.js +76 -0
- package/dist/cdn/chunks/return-focus-Xmagtk6r.js +52 -0
- package/dist/cdn/chunks/rich-text-CQ2uwMSp.js +47 -0
- package/dist/cdn/chunks/rich-text.i18n-BlJ68YuU.js +3 -0
- package/dist/cdn/chunks/row-header-mixin-CgqvREoV.js +16 -0
- package/dist/cdn/chunks/sanitize-url-CBuGmY0W.js +7 -0
- package/dist/cdn/chunks/scroll-mode-controller-COUD1-3P.js +42 -0
- package/dist/cdn/chunks/search-field-BGNfERhn.js +396 -0
- package/dist/cdn/chunks/search-field.i18n-B_Oc7hc-.js +6 -0
- package/dist/cdn/chunks/segmented-control-BYAG4VRp.js +671 -0
- package/dist/cdn/chunks/shadow-resets-6SToDsPu.js +12 -0
- package/dist/cdn/chunks/sheet-BdVCqm2H.js +340 -0
- package/dist/cdn/chunks/shell-C9rds_D9.js +146 -0
- package/dist/cdn/chunks/shell-DmJOYhyF.js +108 -0
- package/dist/cdn/chunks/side-by-side-split-view-C5oX4c6Z.js +166 -0
- package/dist/cdn/chunks/sidebar-section-DP4jnS7g.js +353 -0
- package/dist/cdn/chunks/sidebar-section.i18n-BuGfRMpD.js +6 -0
- package/dist/cdn/chunks/simple-section-qrCqXeBa.js +192 -0
- package/dist/cdn/chunks/skip-link-DWh4W6-J.js +161 -0
- package/dist/cdn/chunks/skip-link.i18n--PbEdAmJ.js +3 -0
- package/dist/cdn/chunks/slider--hODfOwh.js +772 -0
- package/dist/cdn/chunks/slider.i18n-DVw0c8AG.js +6 -0
- package/dist/cdn/chunks/slot-content-BLuPqVXw.js +13 -0
- package/dist/cdn/chunks/spacer-CFzq_JCh.js +237 -0
- package/dist/cdn/chunks/spacer-cell-DuVOgIj8.js +68 -0
- package/dist/cdn/chunks/spacing-scale-SufIjHeN.js +28 -0
- package/dist/cdn/chunks/split-button-BeXnOUTt.js +268 -0
- package/dist/cdn/chunks/split-button.i18n-DtClSMga.js +3 -0
- package/dist/cdn/chunks/split-view-divider-jzcPmnMh.js +100 -0
- package/dist/cdn/chunks/split-view-pane-BLsZz263.js +128 -0
- package/dist/cdn/chunks/stacked-split-view-CcOR8LrJ.js +157 -0
- package/dist/cdn/chunks/static-html-Cf4ccUIg.js +26 -0
- package/dist/cdn/chunks/status-bar-CINbOihq.js +284 -0
- package/dist/cdn/chunks/status-bar-change-CR9l0Gyk.js +3 -0
- package/dist/cdn/chunks/step-bar-6FvZL1Ti.js +474 -0
- package/dist/cdn/chunks/step-bar.i18n-DocExlD7.js +9 -0
- package/dist/cdn/chunks/step-cell-CejRisgS.js +287 -0
- package/dist/cdn/chunks/stepper-CY2rJWOJ.js +223 -0
- package/dist/cdn/chunks/stepper.i18n-COOAkaBl.js +7 -0
- package/dist/cdn/chunks/style-map-DsIw6lkq.js +29 -0
- package/dist/cdn/chunks/style-mod-DGMhzWuk.js +1583 -0
- package/dist/cdn/chunks/swatch-picker-BY3DBIl6.js +430 -0
- package/dist/cdn/chunks/swatch-picker.i18n-_G0nmnGe.js +22 -0
- package/dist/cdn/chunks/switch-DDSsZFwK.js +275 -0
- package/dist/cdn/chunks/switch-field-CMoM9I38.js +137 -0
- package/dist/cdn/chunks/tab-bar-DmslEoPD.js +697 -0
- package/dist/cdn/chunks/tab-bar.i18n-Crsc7ShA.js +3 -0
- package/dist/cdn/chunks/table-DwXjCSD5.js +308 -0
- package/dist/cdn/chunks/table.i18n-Bmb_uw_w.js +3 -0
- package/dist/cdn/chunks/tag-DM3APy3B.js +306 -0
- package/dist/cdn/chunks/text-B1CatNR1.js +421 -0
- package/dist/cdn/chunks/text-cell-BkEsGI3g.js +299 -0
- package/dist/cdn/chunks/text-editor-BvTiMeNV.js +3743 -0
- package/dist/cdn/chunks/text-editor.i18n-sJKiRQ4i.js +17 -0
- package/dist/cdn/chunks/text-field-CUyh1-V8.js +398 -0
- package/dist/cdn/chunks/time-field-Cj5WojfO.js +597 -0
- package/dist/cdn/chunks/time-field.i18n-CLH5vmS7.js +11 -0
- package/dist/cdn/chunks/time-picker-W0xYXLy8.js +508 -0
- package/dist/cdn/chunks/time-picker.i18n-BilOCXlS.js +7 -0
- package/dist/cdn/chunks/title-BuT7tWqN.js +437 -0
- package/dist/cdn/chunks/title-bar-label-controller-DSxdKZOg.js +24 -0
- package/dist/cdn/chunks/title-cell-8d8psUBX.js +327 -0
- package/dist/cdn/chunks/toggle-button-DNXWXZpE.js +528 -0
- package/dist/cdn/chunks/toggle-button-group-ByowJYgs.js +156 -0
- package/dist/cdn/chunks/token-CnkEB3hB.js +266 -0
- package/dist/cdn/chunks/token-field-hvDB3l6O.js +664 -0
- package/dist/cdn/chunks/token-field.i18n-BclzoR8F.js +9 -0
- package/dist/cdn/chunks/token.i18n-RGD5zAtl.js +7 -0
- package/dist/cdn/chunks/toml-w97zZfFO.js +27 -0
- package/dist/cdn/chunks/toolbar-iNd1VmuG.js +408 -0
- package/dist/cdn/chunks/toolbar-item-DpPfPxCi.js +50 -0
- package/dist/cdn/chunks/toolbar-title-KBMpfL9d.js +84 -0
- package/dist/cdn/chunks/toolbar.i18n-QwS37CBC.js +8 -0
- package/dist/cdn/chunks/toolbar.styles-BQkG4gVc.js +383 -0
- package/dist/cdn/chunks/tooltip-BsAHJjci.js +325 -0
- package/dist/cdn/chunks/top-navigation-bar-D1hjWIF3.js +925 -0
- package/dist/cdn/chunks/top-navigation-bar.i18n-C-lcH1nB.js +10 -0
- package/dist/cdn/chunks/top-title-bar-iNFB2zQL.js +344 -0
- package/dist/cdn/chunks/translations-wxBSz213.js +8 -0
- package/dist/cdn/chunks/two-thirds-one-third-section-D-UANbHC.js +213 -0
- package/dist/cdn/chunks/validation-list-C5BhHZIG.js +202 -0
- package/dist/cdn/chunks/validation-list.i18n-CM6In8zD.js +12 -0
- package/dist/cdn/chunks/visibility-mixin-COAZ9pON.js +74 -0
- package/dist/cdn/chunks/visually-hidden-BPgATaH0.js +43 -0
- package/dist/cdn/chunks/window-t5iFkMLY.js +227 -0
- package/dist/cdn/chunks/window.i18n-CsEnUPAk.js +3 -0
- package/dist/cdn/chunks/with-translations-XX14GKFh.js +16 -0
- package/dist/components/actions/menu/menu-item.d.ts +6 -2
- package/dist/components/actions/menu/menu-item.d.ts.map +1 -1
- package/dist/components/actions/menu/menu-item.js +12 -1
- package/dist/components/actions/menu/menu-item.js.map +1 -1
- package/dist/components/actions/menu/menu.js +1 -1
- package/dist/components/actions/menu/menu.js.map +1 -1
- package/dist/components/actions/menu/menu.template.d.ts.map +1 -1
- package/dist/components/actions/menu/menu.template.js +2 -1
- package/dist/components/actions/menu/menu.template.js.map +1 -1
- package/dist/components/inputs/dropdown/dropdown.d.ts +22 -2
- package/dist/components/inputs/dropdown/dropdown.d.ts.map +1 -1
- package/dist/components/inputs/dropdown/dropdown.js +67 -11
- package/dist/components/inputs/dropdown/dropdown.js.map +1 -1
- package/dist/components/layout/container/container.d.ts +15 -2
- package/dist/components/layout/container/container.d.ts.map +1 -1
- package/dist/components/layout/container/container.js +38 -3
- package/dist/components/layout/container/container.js.map +1 -1
- package/dist/components/layout/container/container.styles.js +1 -1
- package/dist/components/layout/container/container.template.js +1 -1
- package/dist/components/layout/container/container.template.js.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.d.ts +7 -0
- package/dist/components/lists-and-tables/list-item/list-item.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list-item/list-item.js +13 -3
- package/dist/components/lists-and-tables/list-item/list-item.js.map +1 -1
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.d.ts +11 -1
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.d.ts.map +1 -1
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.js +19 -3
- package/dist/components/lists-and-tables/list-item-segment/list-item-segment.js.map +1 -1
- package/dist/nldd.min.js +298 -298
- package/dist/types/react.d.ts +3323 -0
- package/dist/types/vue.d.ts +11 -3
- package/dist/utilities/autoloader.d.ts +33 -0
- package/dist/utilities/autoloader.d.ts.map +1 -0
- package/dist/utilities/autoloader.generated.d.ts +3 -0
- package/dist/utilities/autoloader.generated.d.ts.map +1 -0
- package/dist/utilities/autoloader.generated.js +141 -0
- package/dist/utilities/autoloader.generated.js.map +1 -0
- package/dist/utilities/autoloader.js +94 -0
- package/dist/utilities/autoloader.js.map +1 -0
- package/dist/utilities/dev-checks.d.ts +9 -0
- package/dist/utilities/dev-checks.d.ts.map +1 -1
- package/dist/utilities/dev-checks.js +45 -3
- package/dist/utilities/dev-checks.js.map +1 -1
- package/dist/utilities/dev-rules.generated.d.ts.map +1 -1
- package/dist/utilities/dev-rules.generated.js +12 -2
- package/dist/utilities/dev-rules.generated.js.map +1 -1
- package/dist/utilities/loading-tags.d.ts +7 -0
- package/dist/utilities/loading-tags.d.ts.map +1 -0
- package/dist/utilities/loading-tags.js +7 -0
- package/dist/utilities/loading-tags.js.map +1 -0
- package/dist/utilities/owner-form.d.ts +3 -3
- package/dist/utilities/owner-form.d.ts.map +1 -1
- package/dist/utilities/owner-form.js +6 -3
- package/dist/utilities/owner-form.js.map +1 -1
- package/lint/data.generated.json +1 -1
- package/package.json +50 -11
- package/dist/components/breakpoints-DtL62nLI.js +0 -45
- package/dist/components/components.js +0 -68243
- package/dist/components/decorate-DD7uUxHb.js +0 -51
- package/dist/components/defer-focus-dzorHsCQ.js +0 -176
- package/dist/components/dev-checks-CLB9G43h.js +0 -2711
- package/dist/components/dist-245LaK9m.js +0 -1479
- package/dist/components/dist-BFZM0YsR.js +0 -15772
- package/dist/components/dist-BNkeFjc3.js +0 -1180
- package/dist/components/dist-CSC1dG3L.js +0 -365
- package/dist/components/dist-CeMOOqgP.js +0 -1509
- package/dist/components/dist-DFjwTlJV.js +0 -624
- package/dist/components/dist-DHhnz3Gv.js +0 -381
- package/dist/components/dist-PeUX4vPq.js +0 -2857
- package/dist/components/dist-m70B83qb.js +0 -463
- package/dist/components/element-state-BnarBv0M.js +0 -42
- package/dist/components/gherkin-DzYbEwDO.js +0 -107
- package/dist/components/icon-button-8gvQCwCW.js +0 -2305
- package/dist/components/input-modality-D_CY185R.js +0 -48
- package/dist/components/just-in-time-education.i18n-BqU1ImP4.js +0 -423
- package/dist/components/nl.generated-DzZkOgnP.js +0 -64
- package/dist/components/rolldown-runtime-D8jQpDG7.js +0 -12
- package/dist/components/shadow-resets-BwOyyZFH.js +0 -60
- package/dist/components/shell-Dh5IwHd-.js +0 -222
- package/dist/components/toml-D0Pix_8Q.js +0 -58
- package/dist/components/visibility-mixin-Dzn48SL8.js +0 -153
|
@@ -1,2305 +0,0 @@
|
|
|
1
|
-
import { n as reflectNonDefault, r as customElement, t as __decorate } from "./decorate-DD7uUxHb.js";
|
|
2
|
-
import { t as inheritedTextReset } from "./shadow-resets-BwOyyZFH.js";
|
|
3
|
-
import { a as downloadLinkHintKey, c as linkRel, i as translate, n as withTranslations, s as markDownloadTarget, t as deferFocus } from "./defer-focus-dzorHsCQ.js";
|
|
4
|
-
import { n as internalsOf } from "./element-state-BnarBv0M.js";
|
|
5
|
-
import "./icon-_Eox7ZfO.js";
|
|
6
|
-
import { n as nlddActivityIndicatorTranslations, t as nlddIconButtonTranslations } from "./icon-button.i18n-1_N-wN6x.js";
|
|
7
|
-
import { r as isTouchMode } from "./input-modality-D_CY185R.js";
|
|
8
|
-
import { LitElement, css, html, nothing } from "lit";
|
|
9
|
-
import { property, state } from "lit/decorators.js";
|
|
10
|
-
import { classMap } from "lit/directives/class-map.js";
|
|
11
|
-
import { computePosition, flip, offset, shift } from "@floating-ui/dom";
|
|
12
|
-
// src/utilities/os.ts
|
|
13
|
-
var cached = null;
|
|
14
|
-
var override = null;
|
|
15
|
-
function classify(platform) {
|
|
16
|
-
const p = platform.toLowerCase();
|
|
17
|
-
if (/mac|iphone|ipad|ipod|ios/.test(p)) return "mac";
|
|
18
|
-
if (/win/.test(p)) return "windows";
|
|
19
|
-
if (/android/.test(p)) return "other";
|
|
20
|
-
if (/linux|cros/.test(p)) return "linux";
|
|
21
|
-
return "other";
|
|
22
|
-
}
|
|
23
|
-
function detectOS() {
|
|
24
|
-
if (override !== null) return override;
|
|
25
|
-
if (cached !== null) return cached;
|
|
26
|
-
if (typeof navigator === "undefined") {
|
|
27
|
-
cached = "other";
|
|
28
|
-
return cached;
|
|
29
|
-
}
|
|
30
|
-
const nav = navigator;
|
|
31
|
-
cached = classify(nav.userAgentData?.platform || nav.platform || "");
|
|
32
|
-
return cached;
|
|
33
|
-
}
|
|
34
|
-
// src/utilities/shortcut.ts
|
|
35
|
-
function hasShortcut(hint) {
|
|
36
|
-
return Boolean(hint.shortcut || hint.shortcutMac || hint.shortcutWindows || hint.shortcutLinux);
|
|
37
|
-
}
|
|
38
|
-
/** The key spec for this OS, with `keys` as the fallback. */
|
|
39
|
-
function resolveKeys(spec, os) {
|
|
40
|
-
if (os === "mac" && spec.macKeys) return spec.macKeys;
|
|
41
|
-
if (os === "windows" && spec.windowsKeys) return spec.windowsKeys;
|
|
42
|
-
if (os === "linux" && spec.linuxKeys) return spec.linuxKeys;
|
|
43
|
-
return spec.keys;
|
|
44
|
-
}
|
|
45
|
-
/** Splits 'Ctrl+Shift+P' into keys; a trailing '++' ('Ctrl++') or '+++' is a literal '+' key. */
|
|
46
|
-
function parseKeys(spec) {
|
|
47
|
-
if (!spec) return [];
|
|
48
|
-
const compact = spec.trim().replace(/\s*\+\s*/g, "+");
|
|
49
|
-
if (compact === "+") return ["+"];
|
|
50
|
-
const MARKER = "\0";
|
|
51
|
-
return compact.replace(/\+\+\+/g, `+${MARKER}+`).replace(/\+\+$/, `+${MARKER}`).split("+").map((k) => k.trim().split(MARKER).join("+")).filter(Boolean);
|
|
52
|
-
}
|
|
53
|
-
var NO_SHORTCUTS_QUERY = "(any-hover: none)";
|
|
54
|
-
/** Whether a keyboard shortcut can be used on this device, so a hint for it is worth showing. */
|
|
55
|
-
function shortcutsAvailable() {
|
|
56
|
-
return typeof matchMedia !== "function" || !matchMedia(NO_SHORTCUTS_QUERY).matches;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Renders the host again when shortcuts become available or unavailable, such
|
|
60
|
-
* as when a pointer is attached or removed, so a shortcut in its accessible
|
|
61
|
-
* name follows the visible hint. Pass `onChange` for work that a render does
|
|
62
|
-
* not redo.
|
|
63
|
-
*/
|
|
64
|
-
var ShortcutAvailabilityController = class {
|
|
65
|
-
constructor(host, onChange) {
|
|
66
|
-
this._query = typeof matchMedia === "function" ? matchMedia(NO_SHORTCUTS_QUERY) : null;
|
|
67
|
-
this._handleChange = () => this._onChange();
|
|
68
|
-
this._onChange = onChange ?? (() => host.requestUpdate());
|
|
69
|
-
host.addController(this);
|
|
70
|
-
}
|
|
71
|
-
hostConnected() {
|
|
72
|
-
this._query?.addEventListener("change", this._handleChange);
|
|
73
|
-
}
|
|
74
|
-
hostDisconnected() {
|
|
75
|
-
this._query?.removeEventListener("change", this._handleChange);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* The shortcut as words for an accessible name ("Ctrl Z"), matching how
|
|
80
|
-
* nldd-menu-item is announced. Empty without a shortcut, and where
|
|
81
|
-
* shortcutsAvailable() says the key cannot be pressed, as the hint is hidden
|
|
82
|
-
* there too. Read when the component renders; ShortcutAvailabilityController
|
|
83
|
-
* renders it again when that changes.
|
|
84
|
-
*/
|
|
85
|
-
function shortcutLabel(hint) {
|
|
86
|
-
if (!hasShortcut(hint) || !shortcutsAvailable()) return "";
|
|
87
|
-
return parseKeys(resolveKeys({
|
|
88
|
-
keys: hint.shortcut,
|
|
89
|
-
macKeys: hint.shortcutMac,
|
|
90
|
-
windowsKeys: hint.shortcutWindows,
|
|
91
|
-
linuxKeys: hint.shortcutLinux
|
|
92
|
-
}, detectOS())).join(" ");
|
|
93
|
-
}
|
|
94
|
-
// src/components/content/keyboard-shortcut/keyboard-shortcut.styles.ts
|
|
95
|
-
var keyboardShortcutStyles = css`
|
|
96
|
-
:host {
|
|
97
|
-
box-sizing: border-box;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
/* # Host */
|
|
102
|
-
|
|
103
|
-
:host {
|
|
104
|
-
--_keyboard-shortcut-size: var(--primitives-space-24);
|
|
105
|
-
--_keyboard-shortcut-inline-padding: var(--primitives-space-4);
|
|
106
|
-
--_keyboard-shortcut-font-family: var(--primitives-font-family-monospace);
|
|
107
|
-
--_keyboard-shortcut-font-size: var(--primitives-font-size-80);
|
|
108
|
-
--_keyboard-shortcut-font-weight: var(--primitives-font-weight-body-regular);
|
|
109
|
-
--_keyboard-shortcut-line-height: var(--primitives-line-height-flat);
|
|
110
|
-
--_keyboard-shortcut-content-color: var(--semantics-content-color);
|
|
111
|
-
--_keyboard-shortcut-separator-color: var(--semantics-content-secondary-color);
|
|
112
|
-
--_keyboard-shortcut-highlight-border-color: light-dark(var(--primitives-color-neutral-150), var(--primitives-color-neutral-250));
|
|
113
|
-
--_keyboard-shortcut-background-color: var(--semantics-surfaces-tinted-background-color);
|
|
114
|
-
--_keyboard-shortcut-border-width: var(--primitives-border-width-thin);
|
|
115
|
-
--_keyboard-shortcut-corner-radius: var(--primitives-corner-radius-xs);
|
|
116
|
-
|
|
117
|
-
${inheritedTextReset}
|
|
118
|
-
display: inline-flex;
|
|
119
|
-
vertical-align: middle;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
:host([color="inherit"]) {
|
|
123
|
-
--_keyboard-shortcut-content-color: currentColor;
|
|
124
|
-
--_keyboard-shortcut-separator-color: currentColor;
|
|
125
|
-
--_keyboard-shortcut-highlight-border-color: color-mix(in oklab, var(--semantics-content-contrast-color) 10%, transparent);
|
|
126
|
-
--_keyboard-shortcut-background-color: color-mix(in oklab, var(--semantics-content-contrast-color) 20%, transparent);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
:host([size="sm"]) {
|
|
130
|
-
--_keyboard-shortcut-size: var(--primitives-space-20);
|
|
131
|
-
--_keyboard-shortcut-font-size: var(--primitives-font-size-70);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
:host([size="inherit"]) {
|
|
135
|
-
--_keyboard-shortcut-size: 1.5em;
|
|
136
|
-
--_keyboard-shortcut-inline-padding: 0.35em;
|
|
137
|
-
--_keyboard-shortcut-font-size: 0.75em;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
:host([appearance="simple"]) {
|
|
141
|
-
--_keyboard-shortcut-font-family: var(--primitives-font-family-body);
|
|
142
|
-
--_keyboard-shortcut-font-size: var(--primitives-font-size-100);
|
|
143
|
-
|
|
144
|
-
vertical-align: baseline;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
:host([appearance="simple"][size="sm"]) {
|
|
148
|
-
--_keyboard-shortcut-font-size: var(--primitives-font-size-90);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
:host([appearance="simple"][size="inherit"]) {
|
|
152
|
-
--_keyboard-shortcut-font-size: inherit;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
:host([hidden]) {
|
|
156
|
-
display: none;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
/* Same query as shortcutsAvailable() in utilities/shortcut.ts. */
|
|
160
|
-
@media (any-hover: none) {
|
|
161
|
-
:host(:not([always-visible])) {
|
|
162
|
-
display: none;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
/* # Block */
|
|
168
|
-
|
|
169
|
-
.keyboard-shortcut {
|
|
170
|
-
display: inline-flex;
|
|
171
|
-
gap: var(--primitives-space-2);
|
|
172
|
-
align-items: center;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
:host([size="inherit"]) .keyboard-shortcut {
|
|
176
|
-
position: relative;
|
|
177
|
-
top: -0.05em;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
:host([size="inherit"][appearance="simple"]) .keyboard-shortcut {
|
|
181
|
-
position: static;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
/* # Elements */
|
|
186
|
-
|
|
187
|
-
.keyboard-shortcut__key {
|
|
188
|
-
box-sizing: border-box;
|
|
189
|
-
display: inline-flex;
|
|
190
|
-
box-shadow: inset 0 0 0 var(--_keyboard-shortcut-border-width) var(--_keyboard-shortcut-highlight-border-color);
|
|
191
|
-
border-radius: var(--_keyboard-shortcut-corner-radius);
|
|
192
|
-
background-color: var(--_keyboard-shortcut-background-color);
|
|
193
|
-
min-width: var(--_keyboard-shortcut-size);
|
|
194
|
-
height: var(--_keyboard-shortcut-size);
|
|
195
|
-
padding: 0 var(--_keyboard-shortcut-inline-padding);
|
|
196
|
-
align-items: center;
|
|
197
|
-
justify-content: center;
|
|
198
|
-
color: var(--_keyboard-shortcut-content-color);
|
|
199
|
-
font-family: var(--_keyboard-shortcut-font-family);
|
|
200
|
-
font-size: var(--_keyboard-shortcut-font-size);
|
|
201
|
-
font-weight: var(--_keyboard-shortcut-font-weight);
|
|
202
|
-
line-height: var(--_keyboard-shortcut-line-height);
|
|
203
|
-
white-space: nowrap;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
:host([appearance="simple"]) .keyboard-shortcut {
|
|
207
|
-
gap: 0;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
:host([appearance="simple"]) .keyboard-shortcut__key {
|
|
211
|
-
box-shadow: none;
|
|
212
|
-
background-color: transparent;
|
|
213
|
-
border-radius: 0;
|
|
214
|
-
min-width: 0;
|
|
215
|
-
height: auto;
|
|
216
|
-
padding: 0;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
@media (forced-colors: active) {
|
|
220
|
-
.keyboard-shortcut__key {
|
|
221
|
-
color: CanvasText;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
:host(:not([appearance="simple"])) .keyboard-shortcut__key {
|
|
225
|
-
border: var(--_keyboard-shortcut-border-width) solid CanvasText;
|
|
226
|
-
background-color: Canvas;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.keyboard-shortcut__separator {
|
|
231
|
-
color: var(--_keyboard-shortcut-separator-color);
|
|
232
|
-
font-family: var(--_keyboard-shortcut-font-family);
|
|
233
|
-
font-size: var(--_keyboard-shortcut-font-size);
|
|
234
|
-
font-weight: var(--_keyboard-shortcut-font-weight);
|
|
235
|
-
line-height: var(--_keyboard-shortcut-line-height);
|
|
236
|
-
}
|
|
237
|
-
`;
|
|
238
|
-
// src/components/content/keyboard-shortcut/keyboard-shortcut.template.ts
|
|
239
|
-
function template$1(component) {
|
|
240
|
-
const keys = component._parsedKeys;
|
|
241
|
-
if (keys.length === 0) return html`
|
|
242
|
-
<kbd class="keyboard-shortcut">
|
|
243
|
-
<slot></slot>
|
|
244
|
-
</kbd>
|
|
245
|
-
`;
|
|
246
|
-
return html`
|
|
247
|
-
<kbd class="keyboard-shortcut">
|
|
248
|
-
${keys.map((key, index) => html`
|
|
249
|
-
${index > 0 ? html`<span class="keyboard-shortcut__separator"
|
|
250
|
-
aria-hidden="true"
|
|
251
|
-
>+</span>` : ""}
|
|
252
|
-
<kbd class="keyboard-shortcut__key">${key}</kbd>
|
|
253
|
-
`)}
|
|
254
|
-
</kbd>
|
|
255
|
-
`;
|
|
256
|
-
}
|
|
257
|
-
// src/components/content/keyboard-shortcut/keyboard-shortcut.ts
|
|
258
|
-
/**
|
|
259
|
-
* Nederlandse Digitale Dienst Keyboard Shortcut Component (Lit + TypeScript)
|
|
260
|
-
*
|
|
261
|
-
* Shows a key combination (such as Cmd+K or Ctrl+Shift+P) in one combined
|
|
262
|
-
* container with a semantic <kbd> element per key.
|
|
263
|
-
*
|
|
264
|
-
* On touch-only devices (no hover-capable input) the shortcut is hidden by
|
|
265
|
-
* default, because it cannot be invoked there. Use the `always-visible`
|
|
266
|
-
* attribute when the shortcut is purely informative and should stay visible.
|
|
267
|
-
*
|
|
268
|
-
* For cross-platform shortcuts you can set `mac-keys`, `windows-keys` and
|
|
269
|
-
* `linux-keys`. The component picks the right one from the detected OS, with
|
|
270
|
-
* `keys` as the fallback for unknown platforms.
|
|
271
|
-
*
|
|
272
|
-
* @element nldd-keyboard-shortcut
|
|
273
|
-
* @attr {string} keys - Keys separated by '+' (e.g. 'Cmd+K' or 'Ctrl+Shift+P').
|
|
274
|
-
* End with '++' for a literal '+' key: 'Ctrl++' becomes 'Ctrl' + '+' ('Ctrl+++'
|
|
275
|
-
* works too). For more complex cases, such as a combo with several '+' keys,
|
|
276
|
-
* use the default slot with your own <kbd> elements instead of the keys attribute.
|
|
277
|
-
* @attr {string} mac-keys - Optional override for macOS (iPhone/iPad/iPod included).
|
|
278
|
-
* @attr {string} windows-keys - Optional override for Windows.
|
|
279
|
-
* @attr {string} linux-keys - Optional override for Linux/ChromeOS.
|
|
280
|
-
* @attr {string} size - Size: 'sm' | 'md' | 'inherit' (default: 'md'). 'inherit' takes the
|
|
281
|
-
* font-size from the container; in the box variant the keycaps then scale along in em.
|
|
282
|
-
* @attr {string} appearance - 'box' (default) shows each key as a keycap with a fill and a
|
|
283
|
-
* highlight edge. 'simple' shows the keys as plain text with separators: lighter, for
|
|
284
|
-
* inline use such as in a menu item.
|
|
285
|
-
* @attr {boolean} always-visible - Show on touch-only devices too, where shortcuts cannot be invoked.
|
|
286
|
-
* @attr {string} color - 'neutral' (default) uses the component colors of its own. 'inherit'
|
|
287
|
-
* lets the keys and separators follow the surrounding text color (currentColor), with a
|
|
288
|
-
* translucent contrast fill and highlight edge. Useful on a filled surface color or a
|
|
289
|
-
* highlighted row.
|
|
290
|
-
* @attr {'mac'|'windows'|'linux'|'other'} debug-os - Development aid: overrides the OS
|
|
291
|
-
* detection for this instance, so you can show several platform variants side by side in
|
|
292
|
-
* Storybook or documentation. Not meant for production use; leave it empty (default) so
|
|
293
|
-
* the real OS detection applies.
|
|
294
|
-
*
|
|
295
|
-
* @slot - Optional custom <kbd> elements. Ignored when keys is set.
|
|
296
|
-
*/
|
|
297
|
-
var _NLDDKeyboardShortcut = class NLDDKeyboardShortcut extends LitElement {
|
|
298
|
-
constructor(..._args) {
|
|
299
|
-
super(..._args);
|
|
300
|
-
this.keys = "";
|
|
301
|
-
this.macKeys = "";
|
|
302
|
-
this.windowsKeys = "";
|
|
303
|
-
this.linuxKeys = "";
|
|
304
|
-
this.size = "md";
|
|
305
|
-
this.appearance = "box";
|
|
306
|
-
this.color = "neutral";
|
|
307
|
-
this.alwaysVisible = false;
|
|
308
|
-
this.debugOS = "";
|
|
309
|
-
}
|
|
310
|
-
/** @internal Resolved OS — the debug override when set, else detection. */
|
|
311
|
-
get _resolvedOS() {
|
|
312
|
-
return this.debugOS || detectOS();
|
|
313
|
-
}
|
|
314
|
-
get _resolvedKeys() {
|
|
315
|
-
return resolveKeys(this, this._resolvedOS);
|
|
316
|
-
}
|
|
317
|
-
get _parsedKeys() {
|
|
318
|
-
return parseKeys(this._resolvedKeys);
|
|
319
|
-
}
|
|
320
|
-
render() {
|
|
321
|
-
return template$1(this);
|
|
322
|
-
}
|
|
323
|
-
};
|
|
324
|
-
var NLDDKeyboardShortcut = (_NLDDKeyboardShortcut.styles = keyboardShortcutStyles, _NLDDKeyboardShortcut);
|
|
325
|
-
__decorate([property({
|
|
326
|
-
reflect: true,
|
|
327
|
-
converter: reflectNonDefault("")
|
|
328
|
-
})], NLDDKeyboardShortcut.prototype, "keys", void 0);
|
|
329
|
-
__decorate([property({
|
|
330
|
-
reflect: true,
|
|
331
|
-
attribute: "mac-keys",
|
|
332
|
-
converter: reflectNonDefault("")
|
|
333
|
-
})], NLDDKeyboardShortcut.prototype, "macKeys", void 0);
|
|
334
|
-
__decorate([property({
|
|
335
|
-
reflect: true,
|
|
336
|
-
attribute: "windows-keys",
|
|
337
|
-
converter: reflectNonDefault("")
|
|
338
|
-
})], NLDDKeyboardShortcut.prototype, "windowsKeys", void 0);
|
|
339
|
-
__decorate([property({
|
|
340
|
-
reflect: true,
|
|
341
|
-
attribute: "linux-keys",
|
|
342
|
-
converter: reflectNonDefault("")
|
|
343
|
-
})], NLDDKeyboardShortcut.prototype, "linuxKeys", void 0);
|
|
344
|
-
__decorate([property({
|
|
345
|
-
reflect: true,
|
|
346
|
-
converter: reflectNonDefault("md")
|
|
347
|
-
})], NLDDKeyboardShortcut.prototype, "size", void 0);
|
|
348
|
-
__decorate([property({
|
|
349
|
-
reflect: true,
|
|
350
|
-
converter: reflectNonDefault("box")
|
|
351
|
-
})], NLDDKeyboardShortcut.prototype, "appearance", void 0);
|
|
352
|
-
__decorate([property({
|
|
353
|
-
reflect: true,
|
|
354
|
-
converter: reflectNonDefault("neutral")
|
|
355
|
-
})], NLDDKeyboardShortcut.prototype, "color", void 0);
|
|
356
|
-
__decorate([property({
|
|
357
|
-
type: Boolean,
|
|
358
|
-
reflect: true,
|
|
359
|
-
attribute: "always-visible"
|
|
360
|
-
})], NLDDKeyboardShortcut.prototype, "alwaysVisible", void 0);
|
|
361
|
-
__decorate([property({
|
|
362
|
-
type: String,
|
|
363
|
-
attribute: "debug-os"
|
|
364
|
-
})], NLDDKeyboardShortcut.prototype, "debugOS", void 0);
|
|
365
|
-
NLDDKeyboardShortcut = __decorate([customElement("nldd-keyboard-shortcut")], NLDDKeyboardShortcut);
|
|
366
|
-
// src/utilities/popover-target.ts
|
|
367
|
-
/**
|
|
368
|
-
* The popover a component's inner button invokes, from `popovertarget` or
|
|
369
|
-
* `popoverTargetElement` on the host.
|
|
370
|
-
*
|
|
371
|
-
* An id written on the inner button is looked up in the component's own
|
|
372
|
-
* shadow root, where the popover never is, so the button opened nothing. The
|
|
373
|
-
* id is looked up here in the tree of the host instead, and the inner button
|
|
374
|
-
* gets the element. The element wins when both are set.
|
|
375
|
-
*
|
|
376
|
-
* Look it up again on click: a popover rendered after the button is not there
|
|
377
|
-
* yet on the button's first render.
|
|
378
|
-
*/
|
|
379
|
-
function popoverTargetOf(host, id, element) {
|
|
380
|
-
if (element) return element;
|
|
381
|
-
if (!id) return null;
|
|
382
|
-
return host.getRootNode().getElementById?.(id) ?? null;
|
|
383
|
-
}
|
|
384
|
-
/** The overlay each host anchored, so it can let go again. */
|
|
385
|
-
var anchoredBy = /* @__PURE__ */ new WeakMap();
|
|
386
|
-
/**
|
|
387
|
-
* Positions an `nldd-menu` or `nldd-popover` that `popovertarget` points at
|
|
388
|
-
* against the control that opens it, so the overlay needs no `anchor` of its
|
|
389
|
-
* own. The browser already opens and closes it; this adds where it stands and
|
|
390
|
-
* the ARIA link back to the control, as a slotted overlay gets.
|
|
391
|
-
*
|
|
392
|
-
* An overlay with an `anchor` id, or anchored to another element, is
|
|
393
|
-
* left alone: someone chose where it goes. Pass `null` to let go, as on
|
|
394
|
-
* disconnect or when `popovertarget` changes.
|
|
395
|
-
*/
|
|
396
|
-
function anchorPopoverTarget(host, target) {
|
|
397
|
-
const previous = anchoredBy.get(host);
|
|
398
|
-
const next = target?.matches("nldd-menu, nldd-popover") && !target.getAttribute("anchor") ? target : null;
|
|
399
|
-
if (previous && previous !== next && previous.anchorElement === host) previous.anchorElement = null;
|
|
400
|
-
if (next && (next.anchorElement === null || next.anchorElement === host)) {
|
|
401
|
-
next.anchorElement = host;
|
|
402
|
-
anchoredBy.set(host, next);
|
|
403
|
-
} else anchoredBy.delete(host);
|
|
404
|
-
}
|
|
405
|
-
// src/utilities/popup-anchor-controller.ts
|
|
406
|
-
var OVERLAY_SELECTOR = "nldd-menu, nldd-popover";
|
|
407
|
-
var PopupAnchorController = class {
|
|
408
|
-
constructor(host, options = {}) {
|
|
409
|
-
this._overlay = null;
|
|
410
|
-
this._wasOpenOnPointerdown = false;
|
|
411
|
-
this.handleSlotChange = (event) => {
|
|
412
|
-
const overlay = event.target.assignedElements({ flatten: true }).find((el) => el.matches(OVERLAY_SELECTOR)) ?? null;
|
|
413
|
-
this.setOverlay(overlay);
|
|
414
|
-
};
|
|
415
|
-
this.handlePointerdown = () => {
|
|
416
|
-
const overlay = this._overlay;
|
|
417
|
-
if (!overlay) {
|
|
418
|
-
this._wasOpenOnPointerdown = false;
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
this._wasOpenOnPointerdown = "_shownForInvoker" in overlay ? overlay._shownForInvoker() : overlay.matches(":popover-open");
|
|
422
|
-
};
|
|
423
|
-
this._anchorFor = options.anchorFor ?? (() => host);
|
|
424
|
-
this._onChange = options.onChange;
|
|
425
|
-
}
|
|
426
|
-
/** The slotted overlay, or null when none is slotted. */
|
|
427
|
-
get overlay() {
|
|
428
|
-
return this._overlay;
|
|
429
|
-
}
|
|
430
|
-
/** Adopt an overlay (or none). Releases the previous one first: left
|
|
431
|
-
* anchored, a removed overlay keeps positioning against this control and
|
|
432
|
-
* syncing `expanded` onto it, and the pair can never be collected. */
|
|
433
|
-
setOverlay(overlay) {
|
|
434
|
-
if (overlay === this._overlay) return;
|
|
435
|
-
const previous = this._overlay;
|
|
436
|
-
if (previous) previous.anchorElement = null;
|
|
437
|
-
this._overlay = overlay;
|
|
438
|
-
this.anchor();
|
|
439
|
-
this._onChange?.(overlay, previous);
|
|
440
|
-
}
|
|
441
|
-
/** (Re-)anchor the current overlay. Call once the anchor target exists when
|
|
442
|
-
* it resolves later than the first `slotchange`. */
|
|
443
|
-
anchor() {
|
|
444
|
-
const target = this._anchorFor();
|
|
445
|
-
if (this._overlay && target) this._overlay.anchorElement = target;
|
|
446
|
-
}
|
|
447
|
-
/** Call from the control's click handler. Returns true when the click was
|
|
448
|
-
* consumed (an overlay is slotted, so the control is its invoker and
|
|
449
|
-
* neither submits a form nor navigates); false to fall through. */
|
|
450
|
-
handleClick(event) {
|
|
451
|
-
if (!this._overlay) return false;
|
|
452
|
-
const wasOpen = event.detail > 0 && this._wasOpenOnPointerdown;
|
|
453
|
-
this._wasOpenOnPointerdown = false;
|
|
454
|
-
if ("_endInvokerGesture" in this._overlay) this._overlay._endInvokerGesture();
|
|
455
|
-
if (!wasOpen && !this._overlay.matches(":popover-open")) this._overlay.showPopover();
|
|
456
|
-
return true;
|
|
457
|
-
}
|
|
458
|
-
};
|
|
459
|
-
// src/components/status-and-feedback/activity-indicator/activity-indicator.styles.ts
|
|
460
|
-
var activityIndicatorStyles = css`
|
|
461
|
-
:host {
|
|
462
|
-
box-sizing: border-box;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
/* # Host */
|
|
467
|
-
|
|
468
|
-
:host {
|
|
469
|
-
--_activity-indicator-circle-size: var(--primitives-space-32);
|
|
470
|
-
--_activity-indicator-color: var(--context-content-color, currentColor);
|
|
471
|
-
--_activity-indicator-track-opacity: 0.25;
|
|
472
|
-
--_activity-indicator-stroke-width: 2;
|
|
473
|
-
--_activity-indicator-rotation-duration: 0.8s;
|
|
474
|
-
--_activity-indicator-fade-duration: var(--primitives-transition-duration-slow);
|
|
475
|
-
--_activity-indicator-fade-easing: ease-out;
|
|
476
|
-
--_activity-indicator-pulse-duration: 2s;
|
|
477
|
-
--_activity-indicator-pulse-easing: ease-in-out;
|
|
478
|
-
--_activity-indicator-max-width: var(--primitives-area-240);
|
|
479
|
-
--_activity-indicator-gap: var(--primitives-space-4);
|
|
480
|
-
--_activity-indicator-text-font: var(--primitives-font-body-md-regular-flat);
|
|
481
|
-
--_activity-indicator-backdrop-blur: 3px;
|
|
482
|
-
--_activity-indicator-overlay-panel-padding: var(--primitives-space-12);
|
|
483
|
-
--_activity-indicator-overlay-panel-corner-radius: var(--primitives-corner-radius-md);
|
|
484
|
-
|
|
485
|
-
${inheritedTextReset}
|
|
486
|
-
box-sizing: border-box;
|
|
487
|
-
display: flex;
|
|
488
|
-
flex-grow: 1;
|
|
489
|
-
flex-shrink: 1;
|
|
490
|
-
flex-basis: auto;
|
|
491
|
-
width: 100%;
|
|
492
|
-
height: 100%;
|
|
493
|
-
align-items: center;
|
|
494
|
-
justify-content: center;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
/* Overlay mode (content in the default slot): the host wraps the content and
|
|
498
|
-
is the containing block for the absolutely-positioned indicator + backdrop,
|
|
499
|
-
so it sizes to the content instead of filling its parent. */
|
|
500
|
-
:host([has-content]) {
|
|
501
|
-
display: block;
|
|
502
|
-
position: relative;
|
|
503
|
-
height: auto;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
:host([hidden]) {
|
|
507
|
-
display: none;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
/* ## Sizes (icon scale) */
|
|
512
|
-
|
|
513
|
-
:host([size="16"]) { --_activity-indicator-circle-size: var(--primitives-space-16); }
|
|
514
|
-
:host([size="20"]) { --_activity-indicator-circle-size: var(--primitives-space-20); }
|
|
515
|
-
:host([size="24"]) { --_activity-indicator-circle-size: var(--primitives-space-24); }
|
|
516
|
-
:host([size="28"]) { --_activity-indicator-circle-size: var(--primitives-space-28); }
|
|
517
|
-
:host([size="40"]) { --_activity-indicator-circle-size: var(--primitives-space-40); }
|
|
518
|
-
:host([size="44"]) { --_activity-indicator-circle-size: var(--primitives-space-44); }
|
|
519
|
-
:host([size="48"]) { --_activity-indicator-circle-size: var(--primitives-space-48); }
|
|
520
|
-
:host([size="56"]) { --_activity-indicator-circle-size: var(--primitives-space-56); }
|
|
521
|
-
:host([size="64"]) { --_activity-indicator-circle-size: var(--primitives-space-64); }
|
|
522
|
-
:host([size="80"]) { --_activity-indicator-circle-size: var(--primitives-space-80); }
|
|
523
|
-
:host([size="96"]) { --_activity-indicator-circle-size: var(--primitives-space-96); }
|
|
524
|
-
|
|
525
|
-
:host([size="16"]),
|
|
526
|
-
:host([size="20"]) {
|
|
527
|
-
--_activity-indicator-text-font: var(--primitives-font-body-xs-regular-flat);
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
:host([size="24"]),
|
|
531
|
-
:host([size="28"]) {
|
|
532
|
-
--_activity-indicator-text-font: var(--primitives-font-body-sm-regular-flat);
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
/* # Block
|
|
537
|
-
Stacks the circle + label as a centered column; max-width wraps a long
|
|
538
|
-
label. */
|
|
539
|
-
|
|
540
|
-
.activity-indicator {
|
|
541
|
-
/* position:relative so it paints above the absolutely-positioned backdrop
|
|
542
|
-
(both are z-index:auto; the backdrop comes first in the DOM). Laid out
|
|
543
|
-
but invisible during the delay, so the host holds its size until complete. */
|
|
544
|
-
position: relative;
|
|
545
|
-
display: flex;
|
|
546
|
-
visibility: hidden;
|
|
547
|
-
opacity: 0;
|
|
548
|
-
pointer-events: none;
|
|
549
|
-
width: 100%;
|
|
550
|
-
max-width: var(--_activity-indicator-max-width);
|
|
551
|
-
flex-direction: column;
|
|
552
|
-
align-items: center;
|
|
553
|
-
gap: var(--_activity-indicator-gap);
|
|
554
|
-
transition-property: opacity, visibility, display;
|
|
555
|
-
transition-duration: var(--_activity-indicator-fade-duration);
|
|
556
|
-
transition-timing-function: var(--_activity-indicator-fade-easing);
|
|
557
|
-
transition-behavior: allow-discrete;
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
:host([loading]) .activity-indicator {
|
|
561
|
-
visibility: visible;
|
|
562
|
-
opacity: 1;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
:host([complete]) .activity-indicator {
|
|
566
|
-
display: none;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
@starting-style {
|
|
570
|
-
:host([loading]) .activity-indicator {
|
|
571
|
-
opacity: 0;
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
/* Overlay mode: the wrapped content flows normally; the indicator + backdrop
|
|
576
|
-
sit on top as absolute layers that fill the host. */
|
|
577
|
-
.activity-indicator__content {
|
|
578
|
-
display: block;
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
/* Overlay mode: the indicator + label sit on a small rounded base-surface
|
|
582
|
-
panel that hugs them with padding (not the full component width) so they
|
|
583
|
-
keep contrast over the dimmed content, and read in the content color
|
|
584
|
-
instead of inheriting currentColor. */
|
|
585
|
-
:host([has-content]) .activity-indicator {
|
|
586
|
-
box-sizing: border-box;
|
|
587
|
-
position: absolute;
|
|
588
|
-
top: 50%;
|
|
589
|
-
left: 50%;
|
|
590
|
-
border-radius: var(--_activity-indicator-overlay-panel-corner-radius);
|
|
591
|
-
background-color: var(--semantics-surfaces-base-background-color);
|
|
592
|
-
width: max-content;
|
|
593
|
-
max-width: calc(100% - var(--primitives-space-32));
|
|
594
|
-
padding: var(--_activity-indicator-overlay-panel-padding);
|
|
595
|
-
color: var(--semantics-content-color);
|
|
596
|
-
transform: translate(-50%, -50%);
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
/* Dimming layer (overlay mode, on by default; opt out with no-backdrop): the
|
|
600
|
-
context parent background color — fallback the base surface — at one minus
|
|
601
|
-
the disabled opacity, so the content underneath reads as inactive while
|
|
602
|
-
loading. Fades in and out with the indicator via the loading attribute. */
|
|
603
|
-
.activity-indicator__backdrop {
|
|
604
|
-
position: absolute;
|
|
605
|
-
inset: 0;
|
|
606
|
-
display: none;
|
|
607
|
-
opacity: 0;
|
|
608
|
-
/* Frosted dim: the parent surface — fallback base surface — as a
|
|
609
|
-
translucent fill at one minus the disabled opacity (a translucent
|
|
610
|
-
color, not element opacity, which would hide the blur), plus a blur so
|
|
611
|
-
the content behind reads as inactive. backdrop-filter degrades
|
|
612
|
-
gracefully where unsupported, leaving just the translucent fill. */
|
|
613
|
-
background-color: color-mix(in oklab, var(--context-parent-background-color, var(--semantics-surfaces-base-background-color)) calc((1 - var(--primitives-opacity-disabled)) * 100%), transparent);
|
|
614
|
-
-webkit-backdrop-filter: blur(var(--_activity-indicator-backdrop-blur));
|
|
615
|
-
backdrop-filter: blur(var(--_activity-indicator-backdrop-blur));
|
|
616
|
-
pointer-events: none;
|
|
617
|
-
transition-property: opacity, display;
|
|
618
|
-
transition-duration: var(--_activity-indicator-fade-duration);
|
|
619
|
-
transition-timing-function: var(--_activity-indicator-fade-easing);
|
|
620
|
-
transition-behavior: allow-discrete;
|
|
621
|
-
}
|
|
622
|
-
|
|
623
|
-
:host([loading]) .activity-indicator__backdrop {
|
|
624
|
-
display: block;
|
|
625
|
-
opacity: 1;
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
@starting-style {
|
|
629
|
-
:host([loading]) .activity-indicator__backdrop {
|
|
630
|
-
opacity: 0;
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
/* # Elements */
|
|
635
|
-
|
|
636
|
-
/* The whole SVG (stroke included) scales with the size, like an icon. */
|
|
637
|
-
.activity-indicator__circle {
|
|
638
|
-
display: block;
|
|
639
|
-
width: var(--_activity-indicator-circle-size);
|
|
640
|
-
height: var(--_activity-indicator-circle-size);
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
.activity-indicator__track {
|
|
644
|
-
opacity: var(--_activity-indicator-track-opacity);
|
|
645
|
-
stroke: var(--_activity-indicator-color);
|
|
646
|
-
stroke-width: var(--_activity-indicator-stroke-width);
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
/* Rotate only the arc inside the SVG (around the view-box center via
|
|
650
|
-
transform-origin) rather than the whole <svg> element — rotating the
|
|
651
|
-
element visibly wobbles when it sits at a sub-pixel position (next to a
|
|
652
|
-
label, or overlaid on a button). Mirrors nldd-progress-circle. */
|
|
653
|
-
.activity-indicator__indicator {
|
|
654
|
-
stroke: var(--_activity-indicator-color);
|
|
655
|
-
stroke-width: var(--_activity-indicator-stroke-width);
|
|
656
|
-
stroke-linecap: round;
|
|
657
|
-
stroke-dasharray: 25 100;
|
|
658
|
-
transform-origin: 50% 50%;
|
|
659
|
-
animation: activity-indicator-rotate var(--_activity-indicator-rotation-duration) linear infinite;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
@keyframes activity-indicator-rotate {
|
|
663
|
-
to { transform: rotate(360deg); }
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
.activity-indicator__text {
|
|
667
|
-
color: currentColor;
|
|
668
|
-
font: var(--_activity-indicator-text-font);
|
|
669
|
-
text-align: center;
|
|
670
|
-
text-wrap: balance;
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
/* show-text off (default): the label still renders as the announced
|
|
674
|
-
content of the role="status" host, but is visually hidden.
|
|
675
|
-
Standard visually-hidden recipe. */
|
|
676
|
-
.activity-indicator__text--visually-hidden {
|
|
677
|
-
position: absolute;
|
|
678
|
-
width: 1px;
|
|
679
|
-
height: 1px;
|
|
680
|
-
overflow: hidden;
|
|
681
|
-
clip-path: inset(50%);
|
|
682
|
-
white-space: nowrap;
|
|
683
|
-
}
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
/* # Reduced Motion */
|
|
687
|
-
|
|
688
|
-
@media (prefers-reduced-motion: reduce) {
|
|
689
|
-
.activity-indicator,
|
|
690
|
-
.activity-indicator__backdrop {
|
|
691
|
-
transition: none;
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
.activity-indicator__indicator {
|
|
695
|
-
/* Drop the rotation (vestibular safety); keep the 25 / 100 arc and
|
|
696
|
-
pulse its opacity instead, mirroring nldd-progress-circle. */
|
|
697
|
-
animation: activity-indicator-pulse var(--_activity-indicator-pulse-duration) var(--_activity-indicator-pulse-easing) infinite;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
@keyframes activity-indicator-pulse {
|
|
701
|
-
0%, 100% { opacity: 0.3; }
|
|
702
|
-
50% { opacity: 0.7; }
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
`;
|
|
706
|
-
// src/components/status-and-feedback/activity-indicator/activity-indicator.template.ts
|
|
707
|
-
function activityIndicatorTemplate(component) {
|
|
708
|
-
const disableContent = component._visible && !component.complete && component._hasContent;
|
|
709
|
-
const renderBackdrop = component._hasContent && !component.noBackdrop;
|
|
710
|
-
const text = component._accessibleName;
|
|
711
|
-
return html`
|
|
712
|
-
<div class="activity-indicator__content"
|
|
713
|
-
?inert=${disableContent}
|
|
714
|
-
aria-busy=${disableContent ? "true" : "false"}
|
|
715
|
-
>
|
|
716
|
-
<slot @slotchange=${component._onContentSlotChange}></slot>
|
|
717
|
-
</div>
|
|
718
|
-
${renderBackdrop ? html`<div class="activity-indicator__backdrop" aria-hidden="true"></div>` : nothing}
|
|
719
|
-
<div class="activity-indicator">
|
|
720
|
-
<svg class="activity-indicator__circle"
|
|
721
|
-
viewBox="0 0 24 24"
|
|
722
|
-
fill="none"
|
|
723
|
-
aria-hidden="true"
|
|
724
|
-
focusable="false"
|
|
725
|
-
>
|
|
726
|
-
<circle class="activity-indicator__track"
|
|
727
|
-
cx="12"
|
|
728
|
-
cy="12"
|
|
729
|
-
r="9"
|
|
730
|
-
></circle>
|
|
731
|
-
<circle class="activity-indicator__indicator"
|
|
732
|
-
cx="12"
|
|
733
|
-
cy="12"
|
|
734
|
-
r="9"
|
|
735
|
-
pathLength="100"
|
|
736
|
-
></circle>
|
|
737
|
-
</svg>
|
|
738
|
-
<span class=${classMap({
|
|
739
|
-
"activity-indicator__text": true,
|
|
740
|
-
"activity-indicator__text--visually-hidden": !component.showText
|
|
741
|
-
})}>${text}</span>
|
|
742
|
-
</div>
|
|
743
|
-
`;
|
|
744
|
-
}
|
|
745
|
-
// src/components/status-and-feedback/activity-indicator/activity-indicator.ts
|
|
746
|
-
/**
|
|
747
|
-
* Nederlandse Digitale Dienst Activity Indicator Component (Lit + TypeScript)
|
|
748
|
-
*
|
|
749
|
-
* Layout placeholder that fills its parent and centers an indeterminate
|
|
750
|
-
* activity indicator. By default the indicator is held back for 1000ms so
|
|
751
|
-
* brief loading states don't flash; once the delay passes it fades in. Set
|
|
752
|
-
* `timing="instant"` to skip the delay (the fade-in still plays) — this is
|
|
753
|
-
* what embedding components such as `nldd-button` use for their loading state.
|
|
754
|
-
*
|
|
755
|
-
* Sizing: fills its parent where the parent lets it (a flex column such as
|
|
756
|
-
* `nldd-container`, a grid, or a fixed height) and centers itself there. Where
|
|
757
|
-
* the parent has no height of its own, give it one: a `min-height` matching
|
|
758
|
-
* the content you expect, such as `<nldd-container min-height="240px">`. As a
|
|
759
|
-
* safety net the host already takes the indicator's size (circle, plus the
|
|
760
|
-
* label with `show-text`) during the delay, so nothing shifts when it fades
|
|
761
|
-
* in; once `complete` is set it gives that space up.
|
|
762
|
-
*
|
|
763
|
-
* Label size follows `size`, not the surrounding text, so the circle and its
|
|
764
|
-
* label keep the same proportion everywhere: body-xs at 16 and 20, body-sm at
|
|
765
|
-
* 24 and 28, body-md from 32. Keep the label short; a longer explanation
|
|
766
|
-
* belongs in the area as regular text.
|
|
767
|
-
*
|
|
768
|
-
* The default indicator is a simple icon-sized circle that follows the shared
|
|
769
|
-
* `--context-content-color` channel (set by list-item / table / menu on their
|
|
770
|
-
* content), falling back to `currentColor` wherever that channel is unset
|
|
771
|
-
* (buttons, rich-text, standalone) — so a spinner inside a cell tracks the
|
|
772
|
-
* row's state-aware content color, while embedders relying on currentColor are
|
|
773
|
-
* unaffected. An optional label sits below (hidden unless `show-text` is set).
|
|
774
|
-
* The indicator is always indeterminate; when you know the progress, show
|
|
775
|
-
* `nldd-progress-bar` or `nldd-progress-circle` instead.
|
|
776
|
-
*
|
|
777
|
-
* Icon alignment: the visible ring already sits at 5/6 of its box (the SVG's
|
|
778
|
-
* r=9 plus a 2-unit stroke in a 24 view-box, the same optical inset a filled
|
|
779
|
-
* icon glyph has), so a standalone spinner lines up with an icon or an
|
|
780
|
-
* `icon-aligned` `nldd-avatar` on the same grid — no extra option needed
|
|
781
|
-
* (unlike `nldd-avatar`, which fills edge-to-edge and opts in via
|
|
782
|
-
* `icon-aligned`).
|
|
783
|
-
*
|
|
784
|
-
* Overlay mode: put content in the default slot and the indicator wraps it — it
|
|
785
|
-
* becomes a `position: relative` container, renders the spinner over a dimming
|
|
786
|
-
* backdrop (opt out with `no-backdrop`), and makes the content `inert` so its
|
|
787
|
-
* controls can't be focused or clicked. Toggle loading with `complete`
|
|
788
|
-
* (`?complete=${!isLoading}`). With no slotted content it stays the standalone
|
|
789
|
-
* placeholder described above.
|
|
790
|
-
*
|
|
791
|
-
* Reconnect behavior: every `connectedCallback` resets the timer and hides
|
|
792
|
-
* the indicator again. If a consumer toggles the element via a conditional
|
|
793
|
-
* render (remove + re-insert) the indicator disappears and re-fades after
|
|
794
|
-
* another delay. Keep the element mounted and toggle visibility / `hidden`
|
|
795
|
-
* instead if you want the timer to run only once.
|
|
796
|
-
*
|
|
797
|
-
* Accessibility: while connected and not `complete` the host is a polite live
|
|
798
|
-
* region (`role="status"`). The label (`text`, or the translated "Laden"
|
|
799
|
-
* fallback) always renders as the region's content — visually hidden when
|
|
800
|
-
* `show-text` is off (the default) — so assistive tech announces the loading
|
|
801
|
-
* state when the indicator appears. Set `complete` (or unmount) to clear it.
|
|
802
|
-
*
|
|
803
|
-
* @element nldd-activity-indicator
|
|
804
|
-
*
|
|
805
|
-
* @attr {string} size - Circle diameter on the icon scale: 16,20,24,28,32,40,44,48,56,64,80,96 (default '32')
|
|
806
|
-
* @attr {boolean} show-text - Show the label under the indicator (default false; the label still feeds the accessible name)
|
|
807
|
-
* @attr {string} text - Label text. Falls back to the translated "Laden" when unset.
|
|
808
|
-
* @attr {'delay'|'instant'} timing - 'delay' (the default) waits 1000ms before showing (anti-flash); 'instant' shows immediately (the fade-in still plays).
|
|
809
|
-
* @attr {boolean} complete - Mark the loader as finished while keeping the element mounted; clears aria-busy and hides the indicator.
|
|
810
|
-
* @attr {boolean} no-backdrop - Overlay mode dims and blurs the wrapped content with a frosted backdrop by default; set this to show only the indicator panel without dimming. No effect in standalone mode.
|
|
811
|
-
* @attr {object} translations - Override translation keys; unset keys fall back to Dutch
|
|
812
|
-
*
|
|
813
|
-
* @slot - Content to wrap (overlay mode); made inert while loading. Leave empty
|
|
814
|
-
* for the standalone placeholder.
|
|
815
|
-
*
|
|
816
|
-
* @migration The `indicator` slot has been removed. Show a known progress with `nldd-progress-bar` or `nldd-progress-circle` directly, without the activity indicator around it.
|
|
817
|
-
*/
|
|
818
|
-
var _NLDDActivityIndicator;
|
|
819
|
-
/** Delay before the indicator fades in. Brief loading states finish within
|
|
820
|
-
* this window and the indicator is never shown — avoids a jarring flash. */
|
|
821
|
-
var SHOW_DELAY_MS = 1e3;
|
|
822
|
-
var NLDDActivityIndicator = (_NLDDActivityIndicator = class NLDDActivityIndicator extends LitElement {
|
|
823
|
-
constructor(..._args) {
|
|
824
|
-
super(..._args);
|
|
825
|
-
this.size = "32";
|
|
826
|
-
this.showText = false;
|
|
827
|
-
this.text = "";
|
|
828
|
-
this.timing = "delay";
|
|
829
|
-
this.complete = false;
|
|
830
|
-
this.noBackdrop = false;
|
|
831
|
-
this.translations = {};
|
|
832
|
-
this._visible = false;
|
|
833
|
-
this._hasContent = false;
|
|
834
|
-
this._onContentSlotChange = (e) => {
|
|
835
|
-
const slot = e.target;
|
|
836
|
-
this._hasContent = slot.assignedElements().length > 0;
|
|
837
|
-
};
|
|
838
|
-
}
|
|
839
|
-
_t(key) {
|
|
840
|
-
return translate(this.translations, nlddActivityIndicatorTranslations, key);
|
|
841
|
-
}
|
|
842
|
-
/** Accessible name announced while loading. */
|
|
843
|
-
get _accessibleName() {
|
|
844
|
-
return this.text || this._t("components.activity-indicator.loading-label");
|
|
845
|
-
}
|
|
846
|
-
connectedCallback() {
|
|
847
|
-
super.connectedCallback();
|
|
848
|
-
this._syncAria();
|
|
849
|
-
this._visible = this.timing === "instant";
|
|
850
|
-
if (!this._visible && !this.complete) this._scheduleDelay();
|
|
851
|
-
}
|
|
852
|
-
willUpdate(changed) {
|
|
853
|
-
if (changed.has("complete")) this._syncAria();
|
|
854
|
-
if (changed.has("timing")) {
|
|
855
|
-
this._clearDelay();
|
|
856
|
-
if (this.timing === "instant") this._visible = true;
|
|
857
|
-
else if (!this._visible && !this.complete) this._scheduleDelay();
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
disconnectedCallback() {
|
|
861
|
-
super.disconnectedCallback();
|
|
862
|
-
this._clearDelay();
|
|
863
|
-
}
|
|
864
|
-
_clearDelay() {
|
|
865
|
-
if (this._delayTimeout) {
|
|
866
|
-
clearTimeout(this._delayTimeout);
|
|
867
|
-
this._delayTimeout = void 0;
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
_scheduleDelay() {
|
|
871
|
-
this._delayTimeout = setTimeout(() => {
|
|
872
|
-
this._visible = true;
|
|
873
|
-
this._delayTimeout = void 0;
|
|
874
|
-
}, SHOW_DELAY_MS);
|
|
875
|
-
}
|
|
876
|
-
/** A polite live region (role="status") while loading; cleared when
|
|
877
|
-
* complete. The announced text is the visually-hidden label rendered by
|
|
878
|
-
* the template — not an aria-label, and without aria-busy, since a busy
|
|
879
|
-
* live region would defer the very announcement we want. */
|
|
880
|
-
_syncAria() {
|
|
881
|
-
if (this.complete) this.removeAttribute("role");
|
|
882
|
-
else this.setAttribute("role", "status");
|
|
883
|
-
}
|
|
884
|
-
updated() {
|
|
885
|
-
this.toggleAttribute("loading", this._visible && !this.complete);
|
|
886
|
-
this.toggleAttribute("has-content", this._hasContent);
|
|
887
|
-
}
|
|
888
|
-
render() {
|
|
889
|
-
return activityIndicatorTemplate(this);
|
|
890
|
-
}
|
|
891
|
-
}, _NLDDActivityIndicator.styles = activityIndicatorStyles, _NLDDActivityIndicator);
|
|
892
|
-
__decorate([property({
|
|
893
|
-
reflect: true,
|
|
894
|
-
converter: reflectNonDefault("32")
|
|
895
|
-
})], NLDDActivityIndicator.prototype, "size", void 0);
|
|
896
|
-
__decorate([property({
|
|
897
|
-
type: Boolean,
|
|
898
|
-
reflect: true,
|
|
899
|
-
attribute: "show-text"
|
|
900
|
-
})], NLDDActivityIndicator.prototype, "showText", void 0);
|
|
901
|
-
__decorate([property({
|
|
902
|
-
reflect: true,
|
|
903
|
-
converter: reflectNonDefault("")
|
|
904
|
-
})], NLDDActivityIndicator.prototype, "text", void 0);
|
|
905
|
-
__decorate([property({
|
|
906
|
-
reflect: true,
|
|
907
|
-
converter: reflectNonDefault("delay")
|
|
908
|
-
})], NLDDActivityIndicator.prototype, "timing", void 0);
|
|
909
|
-
__decorate([property({
|
|
910
|
-
type: Boolean,
|
|
911
|
-
reflect: true
|
|
912
|
-
})], NLDDActivityIndicator.prototype, "complete", void 0);
|
|
913
|
-
__decorate([property({
|
|
914
|
-
type: Boolean,
|
|
915
|
-
reflect: true,
|
|
916
|
-
attribute: "no-backdrop"
|
|
917
|
-
})], NLDDActivityIndicator.prototype, "noBackdrop", void 0);
|
|
918
|
-
__decorate([property({ type: Object })], NLDDActivityIndicator.prototype, "translations", void 0);
|
|
919
|
-
__decorate([state()], NLDDActivityIndicator.prototype, "_visible", void 0);
|
|
920
|
-
__decorate([state()], NLDDActivityIndicator.prototype, "_hasContent", void 0);
|
|
921
|
-
NLDDActivityIndicator = __decorate([customElement("nldd-activity-indicator")], NLDDActivityIndicator);
|
|
922
|
-
// src/components/actions/icon-button/icon-button.styles.ts
|
|
923
|
-
var iconButtonStyles = css`
|
|
924
|
-
:host {
|
|
925
|
-
box-sizing: border-box;
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
/* # Host */
|
|
930
|
-
|
|
931
|
-
:host {
|
|
932
|
-
--_icon-button-corner-radius: var(--semantics-controls-md-corner-radius);
|
|
933
|
-
--_icon-button-width: auto;
|
|
934
|
-
--_icon-button-min-size: var(--semantics-controls-md-min-size);
|
|
935
|
-
--_icon-button-block-padding: var(--semantics-buttons-md-is-icon-only-inline-padding);
|
|
936
|
-
--_icon-button-inline-padding: var(--semantics-buttons-md-is-icon-only-inline-padding);
|
|
937
|
-
--_icon-button-size: var(--semantics-buttons-md-is-icon-only-icon-size);
|
|
938
|
-
--_icon-button-disclosure-icon-margin-right: calc(var(--primitives-space-2) * -1);
|
|
939
|
-
--_icon-button-disclosure-icon-size: var(--primitives-space-20);
|
|
940
|
-
--_icon-button-text-display: none;
|
|
941
|
-
--_icon-button-text-font: var(--primitives-font-body-xxs-medium-flat);
|
|
942
|
-
--_icon-button-background-color: var(--semantics-buttons-neutral-tinted-background-color);
|
|
943
|
-
--_icon-button-primary-content-color: var(--semantics-buttons-neutral-tinted-content-color);
|
|
944
|
-
--_icon-button-highlight-border-color: var(--semantics-buttons-neutral-tinted-highlight-border-color);
|
|
945
|
-
--_icon-button-is-hovered-background-color: var(--semantics-buttons-neutral-tinted-is-hovered-background-color);
|
|
946
|
-
--_icon-button-is-hovered-primary-content-color: var(--semantics-buttons-neutral-tinted-is-hovered-content-color);
|
|
947
|
-
--_icon-button-is-hovered-highlight-border-color: var(--semantics-buttons-neutral-tinted-is-hovered-highlight-border-color);
|
|
948
|
-
--_icon-button-is-active-background-color: var(--semantics-buttons-neutral-tinted-is-active-background-color);
|
|
949
|
-
--_icon-button-is-active-primary-content-color: var(--semantics-buttons-neutral-tinted-is-active-content-color);
|
|
950
|
-
--_icon-button-is-active-highlight-border-color: var(--semantics-buttons-neutral-tinted-is-active-highlight-border-color);
|
|
951
|
-
|
|
952
|
-
${inheritedTextReset}
|
|
953
|
-
/* inline-flex, not inline-block: a block container puts the control on a
|
|
954
|
-
line, and the strut's descender then grows the host with the inherited
|
|
955
|
-
line-height, so the same button is taller in body text than in a form. */
|
|
956
|
-
display: inline-flex;
|
|
957
|
-
position: relative;
|
|
958
|
-
max-width: 100%;
|
|
959
|
-
-webkit-user-select: none;
|
|
960
|
-
user-select: none;
|
|
961
|
-
-webkit-tap-highlight-color: transparent;
|
|
962
|
-
}
|
|
963
|
-
|
|
964
|
-
:host([size="xs"]) {
|
|
965
|
-
--_icon-button-corner-radius: var(--semantics-controls-xs-corner-radius);
|
|
966
|
-
--_icon-button-min-size: var(--semantics-controls-xs-min-size);
|
|
967
|
-
--_icon-button-block-padding: var(--semantics-buttons-xs-is-icon-only-inline-padding);
|
|
968
|
-
--_icon-button-inline-padding: var(--semantics-buttons-xs-is-icon-only-inline-padding);
|
|
969
|
-
--_icon-button-size: var(--semantics-buttons-xs-is-icon-only-icon-size);
|
|
970
|
-
--_icon-button-disclosure-icon-margin-right: 0;
|
|
971
|
-
--_icon-button-disclosure-icon-size: var(--primitives-space-16);
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
:host([size="sm"]) {
|
|
975
|
-
--_icon-button-corner-radius: var(--semantics-controls-sm-corner-radius);
|
|
976
|
-
--_icon-button-min-size: var(--semantics-controls-sm-min-size);
|
|
977
|
-
--_icon-button-block-padding: var(--semantics-buttons-sm-is-icon-only-inline-padding);
|
|
978
|
-
--_icon-button-inline-padding: var(--semantics-buttons-sm-is-icon-only-inline-padding);
|
|
979
|
-
--_icon-button-size: var(--semantics-buttons-sm-is-icon-only-icon-size);
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
:host([size="lg"]) {
|
|
983
|
-
--_icon-button-corner-radius: var(--semantics-controls-lg-corner-radius);
|
|
984
|
-
--_icon-button-min-size: var(--semantics-controls-lg-min-size);
|
|
985
|
-
--_icon-button-block-padding: var(--primitives-space-8);
|
|
986
|
-
--_icon-button-inline-padding: var(--primitives-space-8);
|
|
987
|
-
--_icon-button-text-display: block;
|
|
988
|
-
}
|
|
989
|
-
|
|
990
|
-
:host([size="lg"][hide-lg-text]) {
|
|
991
|
-
--_icon-button-block-padding: var(--semantics-buttons-lg-is-icon-only-inline-padding);
|
|
992
|
-
--_icon-button-inline-padding: var(--semantics-buttons-lg-is-icon-only-inline-padding);
|
|
993
|
-
--_icon-button-size: var(--semantics-buttons-lg-is-icon-only-icon-size);
|
|
994
|
-
--_icon-button-text-display: none;
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
:host([appearance="neutral-base"]) {
|
|
998
|
-
--_icon-button-background-color: var(--semantics-buttons-neutral-base-background-color);
|
|
999
|
-
--_icon-button-primary-content-color: var(--semantics-buttons-neutral-base-content-color);
|
|
1000
|
-
--_icon-button-highlight-border-color: var(--semantics-buttons-neutral-base-highlight-border-color);
|
|
1001
|
-
--_icon-button-is-hovered-background-color: var(--semantics-buttons-neutral-base-is-hovered-background-color);
|
|
1002
|
-
--_icon-button-is-hovered-primary-content-color: var(--semantics-buttons-neutral-base-is-hovered-content-color);
|
|
1003
|
-
--_icon-button-is-hovered-highlight-border-color: var(--semantics-buttons-neutral-base-is-hovered-highlight-border-color);
|
|
1004
|
-
--_icon-button-is-active-background-color: var(--semantics-buttons-neutral-base-is-active-background-color);
|
|
1005
|
-
--_icon-button-is-active-primary-content-color: var(--semantics-buttons-neutral-base-is-active-content-color);
|
|
1006
|
-
--_icon-button-is-active-highlight-border-color: var(--semantics-buttons-neutral-base-is-active-highlight-border-color);
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
:host([appearance="neutral-transparent"]) {
|
|
1010
|
-
--_icon-button-background-color: transparent;
|
|
1011
|
-
--_icon-button-primary-content-color: var(--semantics-buttons-neutral-transparent-content-color);
|
|
1012
|
-
--_icon-button-highlight-border-color: transparent;
|
|
1013
|
-
--_icon-button-is-hovered-background-color: transparent;
|
|
1014
|
-
--_icon-button-is-hovered-primary-content-color: var(--semantics-buttons-neutral-transparent-is-hovered-content-color);
|
|
1015
|
-
--_icon-button-is-hovered-highlight-border-color: transparent;
|
|
1016
|
-
--_icon-button-is-active-background-color: transparent;
|
|
1017
|
-
--_icon-button-is-active-primary-content-color: var(--semantics-buttons-neutral-transparent-is-active-content-color);
|
|
1018
|
-
--_icon-button-is-active-highlight-border-color: transparent;
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
:host([appearance="accent-filled"]),
|
|
1022
|
-
:host([appearance="primary"]) {
|
|
1023
|
-
--_icon-button-background-color: var(--semantics-buttons-accent-filled-background-color);
|
|
1024
|
-
--_icon-button-primary-content-color: var(--semantics-buttons-accent-filled-content-color);
|
|
1025
|
-
--_icon-button-highlight-border-color: var(--semantics-buttons-accent-filled-highlight-border-color);
|
|
1026
|
-
--_icon-button-is-hovered-background-color: var(--semantics-buttons-accent-filled-is-hovered-background-color);
|
|
1027
|
-
--_icon-button-is-hovered-primary-content-color: var(--semantics-buttons-accent-filled-is-hovered-content-color);
|
|
1028
|
-
--_icon-button-is-hovered-highlight-border-color: var(--semantics-buttons-accent-filled-is-hovered-highlight-border-color);
|
|
1029
|
-
--_icon-button-is-active-background-color: var(--semantics-buttons-accent-filled-is-active-background-color);
|
|
1030
|
-
--_icon-button-is-active-primary-content-color: var(--semantics-buttons-accent-filled-is-active-content-color);
|
|
1031
|
-
--_icon-button-is-active-highlight-border-color: var(--semantics-buttons-accent-filled-is-active-highlight-border-color);
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
:host([appearance="accent-transparent"]) {
|
|
1035
|
-
--_icon-button-background-color: transparent;
|
|
1036
|
-
--_icon-button-primary-content-color: var(--semantics-buttons-accent-transparent-content-color);
|
|
1037
|
-
--_icon-button-highlight-border-color: transparent;
|
|
1038
|
-
--_icon-button-is-hovered-background-color: transparent;
|
|
1039
|
-
--_icon-button-is-hovered-primary-content-color: var(--semantics-buttons-accent-transparent-is-hovered-content-color);
|
|
1040
|
-
--_icon-button-is-hovered-highlight-border-color: transparent;
|
|
1041
|
-
--_icon-button-is-active-background-color: transparent;
|
|
1042
|
-
--_icon-button-is-active-primary-content-color: var(--semantics-buttons-accent-transparent-is-active-content-color);
|
|
1043
|
-
--_icon-button-is-active-highlight-border-color: transparent;
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
:host([appearance="critical-tinted"]),
|
|
1047
|
-
:host([appearance="destructive"]) {
|
|
1048
|
-
--_icon-button-background-color: var(--semantics-buttons-critical-tinted-background-color);
|
|
1049
|
-
--_icon-button-primary-content-color: var(--semantics-buttons-critical-tinted-content-color);
|
|
1050
|
-
--_icon-button-highlight-border-color: var(--semantics-buttons-critical-tinted-highlight-border-color);
|
|
1051
|
-
--_icon-button-is-hovered-background-color: var(--semantics-buttons-critical-tinted-is-hovered-background-color);
|
|
1052
|
-
--_icon-button-is-hovered-primary-content-color: var(--semantics-buttons-critical-tinted-is-hovered-content-color);
|
|
1053
|
-
--_icon-button-is-hovered-highlight-border-color: var(--semantics-buttons-critical-tinted-is-hovered-highlight-border-color);
|
|
1054
|
-
--_icon-button-is-active-background-color: var(--semantics-buttons-critical-tinted-is-active-background-color);
|
|
1055
|
-
--_icon-button-is-active-primary-content-color: var(--semantics-buttons-critical-tinted-is-active-content-color);
|
|
1056
|
-
--_icon-button-is-active-highlight-border-color: var(--semantics-buttons-critical-tinted-is-active-highlight-border-color);
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
:host([appearance="critical-transparent"]) {
|
|
1060
|
-
--_icon-button-background-color: transparent;
|
|
1061
|
-
--_icon-button-primary-content-color: var(--semantics-buttons-critical-transparent-content-color);
|
|
1062
|
-
--_icon-button-highlight-border-color: transparent;
|
|
1063
|
-
--_icon-button-is-hovered-background-color: transparent;
|
|
1064
|
-
--_icon-button-is-hovered-primary-content-color: var(--semantics-buttons-critical-transparent-is-hovered-content-color);
|
|
1065
|
-
--_icon-button-is-hovered-highlight-border-color: transparent;
|
|
1066
|
-
--_icon-button-is-active-background-color: transparent;
|
|
1067
|
-
--_icon-button-is-active-primary-content-color: var(--semantics-buttons-critical-transparent-is-active-content-color);
|
|
1068
|
-
--_icon-button-is-active-highlight-border-color: transparent;
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
/* The on-color variants derive from currentColor; see nldd-button for
|
|
1072
|
-
the full rationale. The filled label resolves the context var here on
|
|
1073
|
-
the host, with the tokens' white/black contrast flip as fallback. */
|
|
1074
|
-
|
|
1075
|
-
:host([appearance="inherit-tinted"]),
|
|
1076
|
-
:host([expanded][appearance="inherit-tinted"]) {
|
|
1077
|
-
--_icon-button-background-color: var(--context-button-background-color, var(--semantics-buttons-inherit-tinted-background-color));
|
|
1078
|
-
--_icon-button-primary-content-color: var(--semantics-buttons-inherit-tinted-content-color);
|
|
1079
|
-
--_icon-button-highlight-border-color: var(--semantics-buttons-inherit-tinted-highlight-border-color);
|
|
1080
|
-
--_icon-button-is-hovered-background-color: var(--_icon-button-background-color);
|
|
1081
|
-
--_icon-button-is-hovered-primary-content-color: var(--_icon-button-primary-content-color);
|
|
1082
|
-
--_icon-button-is-hovered-highlight-border-color: var(--_icon-button-highlight-border-color);
|
|
1083
|
-
--_icon-button-is-active-background-color: var(--_icon-button-background-color);
|
|
1084
|
-
--_icon-button-is-active-primary-content-color: var(--_icon-button-primary-content-color);
|
|
1085
|
-
--_icon-button-is-active-highlight-border-color: var(--_icon-button-highlight-border-color);
|
|
1086
|
-
}
|
|
1087
|
-
|
|
1088
|
-
:host([appearance="inherit-filled"]),
|
|
1089
|
-
:host([expanded][appearance="inherit-filled"]) {
|
|
1090
|
-
--_icon-button-background-color: var(--semantics-buttons-inherit-filled-background-color);
|
|
1091
|
-
--_icon-button-primary-content-color: var(--context-parent-background-color, var(--semantics-buttons-inherit-filled-content-color));
|
|
1092
|
-
--_icon-button-highlight-border-color: var(--semantics-buttons-inherit-filled-highlight-border-color);
|
|
1093
|
-
--_icon-button-is-hovered-background-color: var(--_icon-button-background-color);
|
|
1094
|
-
--_icon-button-is-hovered-primary-content-color: var(--_icon-button-primary-content-color);
|
|
1095
|
-
--_icon-button-is-hovered-highlight-border-color: var(--_icon-button-highlight-border-color);
|
|
1096
|
-
--_icon-button-is-active-background-color: var(--_icon-button-background-color);
|
|
1097
|
-
--_icon-button-is-active-primary-content-color: var(--_icon-button-primary-content-color);
|
|
1098
|
-
--_icon-button-is-active-highlight-border-color: var(--_icon-button-highlight-border-color);
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
/* For inherit-filled the inner button keeps the inherited on-color:
|
|
1102
|
-
its currentColor background and the label's contrast flip resolve
|
|
1103
|
-
against it, and would otherwise self-reference the label. The label
|
|
1104
|
-
color moves to the content layer instead; see nldd-button. */
|
|
1105
|
-
:host([appearance="inherit-filled"]) .icon-button {
|
|
1106
|
-
color: inherit;
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
:host([appearance="inherit-filled"]) .icon-button > * {
|
|
1110
|
-
color: var(--_icon-button-primary-content-color);
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
/* ## Expanded — default (incl. unknown variant) */
|
|
1114
|
-
|
|
1115
|
-
:host([expanded]) {
|
|
1116
|
-
--_icon-button-background-color: var(--semantics-buttons-neutral-tinted-is-expanded-background-color);
|
|
1117
|
-
--_icon-button-primary-content-color: var(--semantics-buttons-neutral-tinted-is-expanded-content-color);
|
|
1118
|
-
--_icon-button-highlight-border-color: var(--semantics-buttons-neutral-tinted-is-expanded-highlight-border-color);
|
|
1119
|
-
--_icon-button-is-hovered-background-color: var(--semantics-buttons-neutral-tinted-is-expanded-is-hovered-background-color);
|
|
1120
|
-
--_icon-button-is-hovered-primary-content-color: var(--semantics-buttons-neutral-tinted-is-expanded-is-hovered-content-color);
|
|
1121
|
-
--_icon-button-is-hovered-highlight-border-color: var(--semantics-buttons-neutral-tinted-is-expanded-is-hovered-highlight-border-color);
|
|
1122
|
-
--_icon-button-is-active-background-color: var(--semantics-buttons-neutral-tinted-is-expanded-is-active-background-color);
|
|
1123
|
-
--_icon-button-is-active-primary-content-color: var(--semantics-buttons-neutral-tinted-is-expanded-is-active-content-color);
|
|
1124
|
-
--_icon-button-is-active-highlight-border-color: var(--semantics-buttons-neutral-tinted-is-expanded-is-active-highlight-border-color);
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
:host([expanded][appearance="neutral-base"]) {
|
|
1128
|
-
--_icon-button-background-color: var(--semantics-buttons-neutral-base-is-expanded-background-color);
|
|
1129
|
-
--_icon-button-primary-content-color: var(--semantics-buttons-neutral-base-is-expanded-content-color);
|
|
1130
|
-
--_icon-button-highlight-border-color: var(--semantics-buttons-neutral-base-is-expanded-highlight-border-color);
|
|
1131
|
-
--_icon-button-is-hovered-background-color: var(--semantics-buttons-neutral-base-is-expanded-is-hovered-background-color);
|
|
1132
|
-
--_icon-button-is-hovered-primary-content-color: var(--semantics-buttons-neutral-base-is-expanded-is-hovered-content-color);
|
|
1133
|
-
--_icon-button-is-hovered-highlight-border-color: var(--semantics-buttons-neutral-base-is-expanded-is-hovered-highlight-border-color);
|
|
1134
|
-
--_icon-button-is-active-background-color: var(--semantics-buttons-neutral-base-is-expanded-is-active-background-color);
|
|
1135
|
-
--_icon-button-is-active-primary-content-color: var(--semantics-buttons-neutral-base-is-expanded-is-active-content-color);
|
|
1136
|
-
--_icon-button-is-active-highlight-border-color: var(--semantics-buttons-neutral-base-is-expanded-is-active-highlight-border-color);
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
:host([expanded][appearance="neutral-transparent"]) {
|
|
1140
|
-
--_icon-button-background-color: transparent;
|
|
1141
|
-
--_icon-button-primary-content-color: var(--semantics-buttons-neutral-transparent-content-color);
|
|
1142
|
-
--_icon-button-highlight-border-color: transparent;
|
|
1143
|
-
--_icon-button-is-hovered-background-color: transparent;
|
|
1144
|
-
--_icon-button-is-hovered-primary-content-color: var(--semantics-buttons-neutral-transparent-is-hovered-content-color);
|
|
1145
|
-
--_icon-button-is-hovered-highlight-border-color: transparent;
|
|
1146
|
-
--_icon-button-is-active-background-color: transparent;
|
|
1147
|
-
--_icon-button-is-active-primary-content-color: var(--semantics-buttons-neutral-transparent-is-active-content-color);
|
|
1148
|
-
--_icon-button-is-active-highlight-border-color: transparent;
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
:host([expanded][appearance="accent-filled"]),
|
|
1152
|
-
:host([expanded][appearance="primary"]) {
|
|
1153
|
-
--_icon-button-background-color: var(--semantics-buttons-accent-filled-is-expanded-background-color);
|
|
1154
|
-
--_icon-button-primary-content-color: var(--semantics-buttons-accent-filled-is-expanded-content-color);
|
|
1155
|
-
--_icon-button-highlight-border-color: var(--semantics-buttons-accent-filled-is-expanded-highlight-border-color);
|
|
1156
|
-
--_icon-button-is-hovered-background-color: var(--semantics-buttons-accent-filled-is-expanded-is-hovered-background-color);
|
|
1157
|
-
--_icon-button-is-hovered-primary-content-color: var(--semantics-buttons-accent-filled-is-expanded-is-hovered-content-color);
|
|
1158
|
-
--_icon-button-is-hovered-highlight-border-color: var(--semantics-buttons-accent-filled-is-expanded-is-hovered-highlight-border-color);
|
|
1159
|
-
--_icon-button-is-active-background-color: var(--semantics-buttons-accent-filled-is-expanded-is-active-background-color);
|
|
1160
|
-
--_icon-button-is-active-primary-content-color: var(--semantics-buttons-accent-filled-is-expanded-is-active-content-color);
|
|
1161
|
-
--_icon-button-is-active-highlight-border-color: var(--semantics-buttons-accent-filled-is-expanded-is-active-highlight-border-color);
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
:host([expanded][appearance="accent-transparent"]) {
|
|
1165
|
-
--_icon-button-background-color: transparent;
|
|
1166
|
-
--_icon-button-primary-content-color: var(--semantics-buttons-accent-transparent-content-color);
|
|
1167
|
-
--_icon-button-highlight-border-color: transparent;
|
|
1168
|
-
--_icon-button-is-hovered-background-color: transparent;
|
|
1169
|
-
--_icon-button-is-hovered-primary-content-color: var(--semantics-buttons-accent-transparent-is-hovered-content-color);
|
|
1170
|
-
--_icon-button-is-hovered-highlight-border-color: transparent;
|
|
1171
|
-
--_icon-button-is-active-background-color: transparent;
|
|
1172
|
-
--_icon-button-is-active-primary-content-color: var(--semantics-buttons-accent-transparent-is-active-content-color);
|
|
1173
|
-
--_icon-button-is-active-highlight-border-color: transparent;
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
:host([expanded][appearance="critical-tinted"]),
|
|
1177
|
-
:host([expanded][appearance="destructive"]) {
|
|
1178
|
-
--_icon-button-background-color: var(--semantics-buttons-critical-tinted-is-expanded-background-color);
|
|
1179
|
-
--_icon-button-primary-content-color: var(--semantics-buttons-critical-tinted-is-expanded-content-color);
|
|
1180
|
-
--_icon-button-highlight-border-color: var(--semantics-buttons-critical-tinted-is-expanded-highlight-border-color);
|
|
1181
|
-
--_icon-button-is-hovered-background-color: var(--semantics-buttons-critical-tinted-is-expanded-is-hovered-background-color);
|
|
1182
|
-
--_icon-button-is-hovered-primary-content-color: var(--semantics-buttons-critical-tinted-is-expanded-is-hovered-content-color);
|
|
1183
|
-
--_icon-button-is-hovered-highlight-border-color: var(--semantics-buttons-critical-tinted-is-expanded-is-hovered-highlight-border-color);
|
|
1184
|
-
--_icon-button-is-active-background-color: var(--semantics-buttons-critical-tinted-is-expanded-is-active-background-color);
|
|
1185
|
-
--_icon-button-is-active-primary-content-color: var(--semantics-buttons-critical-tinted-is-expanded-is-active-content-color);
|
|
1186
|
-
--_icon-button-is-active-highlight-border-color: var(--semantics-buttons-critical-tinted-is-expanded-is-active-highlight-border-color);
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
:host([expanded][appearance="critical-transparent"]) {
|
|
1190
|
-
--_icon-button-background-color: transparent;
|
|
1191
|
-
--_icon-button-primary-content-color: var(--semantics-buttons-critical-transparent-content-color);
|
|
1192
|
-
--_icon-button-highlight-border-color: transparent;
|
|
1193
|
-
--_icon-button-is-hovered-background-color: transparent;
|
|
1194
|
-
--_icon-button-is-hovered-primary-content-color: var(--semantics-buttons-critical-transparent-is-hovered-content-color);
|
|
1195
|
-
--_icon-button-is-hovered-highlight-border-color: transparent;
|
|
1196
|
-
--_icon-button-is-active-background-color: transparent;
|
|
1197
|
-
--_icon-button-is-active-primary-content-color: var(--semantics-buttons-critical-transparent-is-active-content-color);
|
|
1198
|
-
--_icon-button-is-active-highlight-border-color: transparent;
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
:host([width="full"]) {
|
|
1202
|
-
display: block;
|
|
1203
|
-
width: 100%;
|
|
1204
|
-
flex-grow: 1;
|
|
1205
|
-
}
|
|
1206
|
-
|
|
1207
|
-
:host([hidden]) {
|
|
1208
|
-
display: none;
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
:host([disabled]) {
|
|
1212
|
-
opacity: var(--primitives-opacity-disabled);
|
|
1213
|
-
pointer-events: none;
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
:host([no-highlight-border]),
|
|
1217
|
-
:host([no-highlight-border][expanded]) {
|
|
1218
|
-
--_icon-button-highlight-border-color: transparent;
|
|
1219
|
-
--_icon-button-is-hovered-highlight-border-color: transparent;
|
|
1220
|
-
--_icon-button-is-active-highlight-border-color: transparent;
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
/* # Block */
|
|
1225
|
-
|
|
1226
|
-
.icon-button {
|
|
1227
|
-
box-sizing: border-box;
|
|
1228
|
-
display: inline-flex;
|
|
1229
|
-
margin: 0;
|
|
1230
|
-
border: none;
|
|
1231
|
-
border-radius: var(--_icon-button-corner-radius);
|
|
1232
|
-
background: none;
|
|
1233
|
-
background-color: var(--_icon-button-background-color);
|
|
1234
|
-
box-shadow: inset 0 0 0 var(--primitives-border-width-thin) var(--_icon-button-highlight-border-color);
|
|
1235
|
-
width: var(--_icon-button-width);
|
|
1236
|
-
min-width: var(--_icon-button-min-size);
|
|
1237
|
-
height: var(--_icon-button-min-size);
|
|
1238
|
-
min-height: var(--_icon-button-min-size);
|
|
1239
|
-
padding: var(--_icon-button-block-padding) var(--_icon-button-inline-padding);
|
|
1240
|
-
flex-direction: column;
|
|
1241
|
-
align-items: center;
|
|
1242
|
-
justify-content: center;
|
|
1243
|
-
color: var(--_icon-button-primary-content-color);
|
|
1244
|
-
font: inherit;
|
|
1245
|
-
text-decoration: none;
|
|
1246
|
-
transition:
|
|
1247
|
-
background-color var(--primitives-transition-duration-fast) var(--primitives-transition-easing-default),
|
|
1248
|
-
color var(--primitives-transition-duration-fast) var(--primitives-transition-easing-default)
|
|
1249
|
-
;
|
|
1250
|
-
appearance: none;
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
a.icon-button {
|
|
1254
|
-
cursor: var(--semantics-controls-link-cursor);
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
@media (prefers-reduced-motion: reduce) {
|
|
1258
|
-
.icon-button,
|
|
1259
|
-
.icon-button__icon-area,
|
|
1260
|
-
.icon-button__text {
|
|
1261
|
-
transition: none;
|
|
1262
|
-
}
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
.icon-button:focus-visible {
|
|
1266
|
-
outline: var(--semantics-focus-ring-outline);
|
|
1267
|
-
outline-offset: var(--semantics-focus-ring-outline-offset);
|
|
1268
|
-
box-shadow: var(--semantics-focus-ring-box-shadow), inset 0 0 0 var(--primitives-border-width-thin) var(--_icon-button-highlight-border-color);
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
.icon-button:focus:not(:focus-visible) {
|
|
1272
|
-
outline: none;
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
@media (hover: hover) {
|
|
1276
|
-
.icon-button:hover {
|
|
1277
|
-
background-color: var(--_icon-button-is-hovered-background-color);
|
|
1278
|
-
color: var(--_icon-button-is-hovered-primary-content-color);
|
|
1279
|
-
--_icon-button-highlight-border-color: var(--_icon-button-is-hovered-highlight-border-color);
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
.icon-button:active {
|
|
1284
|
-
background-color: var(--_icon-button-is-active-background-color);
|
|
1285
|
-
color: var(--_icon-button-is-active-primary-content-color);
|
|
1286
|
-
--_icon-button-highlight-border-color: var(--_icon-button-is-active-highlight-border-color);
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
/* Loading keeps the control focusable (not disabled); activation is blocked in JS. */
|
|
1290
|
-
:host([loading]) .icon-button {
|
|
1291
|
-
cursor: default;
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
/* # Elements */
|
|
1296
|
-
|
|
1297
|
-
.icon-button__icon-area {
|
|
1298
|
-
display: inline-flex;
|
|
1299
|
-
flex-direction: row;
|
|
1300
|
-
align-items: center;
|
|
1301
|
-
justify-content: center;
|
|
1302
|
-
transition: opacity var(--primitives-transition-duration-slow) var(--primitives-transition-easing-default);
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
/* Loading crossfades the content out (opacity, not visibility, so the control
|
|
1306
|
-
keeps its accessible name) while the indicator fades in. The content stays
|
|
1307
|
-
laid out, so the control keeps its size. */
|
|
1308
|
-
:host([loading]) .icon-button__icon-area {
|
|
1309
|
-
opacity: 0;
|
|
1310
|
-
}
|
|
1311
|
-
|
|
1312
|
-
.icon-button__icon {
|
|
1313
|
-
display: flex;
|
|
1314
|
-
width: var(--_icon-button-size);
|
|
1315
|
-
height: var(--_icon-button-size);
|
|
1316
|
-
flex-shrink: 0;
|
|
1317
|
-
align-items: center;
|
|
1318
|
-
justify-content: center;
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
.icon-button__disclosure-icon {
|
|
1322
|
-
display: flex;
|
|
1323
|
-
margin-right: var(--_icon-button-disclosure-icon-margin-right);
|
|
1324
|
-
width: var(--_icon-button-disclosure-icon-size);
|
|
1325
|
-
height: var(--_icon-button-disclosure-icon-size);
|
|
1326
|
-
flex-shrink: 0;
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
.icon-button__text {
|
|
1330
|
-
display: var(--_icon-button-text-display);
|
|
1331
|
-
text-align: center;
|
|
1332
|
-
color: inherit;
|
|
1333
|
-
font: var(--_icon-button-text-font);
|
|
1334
|
-
white-space: nowrap;
|
|
1335
|
-
transition: opacity var(--primitives-transition-duration-slow) var(--primitives-transition-easing-default);
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
:host([loading]) .icon-button__text {
|
|
1339
|
-
opacity: 0;
|
|
1340
|
-
}
|
|
1341
|
-
|
|
1342
|
-
/* Wrapper overlaid on the control, positioned against the host (which is
|
|
1343
|
-
position:relative). It lives outside the <button>/<a> and the tooltip
|
|
1344
|
-
wrapper so the indicator's role="status" live region works reliably. The
|
|
1345
|
-
activity-indicator inside fills it and centers its circle, which inherits
|
|
1346
|
-
the content color via currentColor. */
|
|
1347
|
-
.icon-button__activity-indicator {
|
|
1348
|
-
position: absolute;
|
|
1349
|
-
inset: 0;
|
|
1350
|
-
color: var(--_icon-button-primary-content-color);
|
|
1351
|
-
}
|
|
1352
|
-
`;
|
|
1353
|
-
// src/components/content/tooltip/tooltip.styles.ts
|
|
1354
|
-
var tooltipStyles = css`
|
|
1355
|
-
:host {
|
|
1356
|
-
box-sizing: border-box;
|
|
1357
|
-
}
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
/* # Host */
|
|
1361
|
-
|
|
1362
|
-
:host {
|
|
1363
|
-
--_tooltip-hide-duration: var(--primitives-transition-duration-fast);
|
|
1364
|
-
--_tooltip-show-duration: var(--primitives-transition-duration-fast);
|
|
1365
|
-
--_tooltip-max-width: var(--primitives-area-280);
|
|
1366
|
-
--_tooltip-z-index: 10000;
|
|
1367
|
-
--_tooltip-show-delay: 700ms;
|
|
1368
|
-
--_tooltip-box-shadow: var(--semantics-tooltips-box-shadow);
|
|
1369
|
-
--_tooltip-background-color: var(--semantics-tooltips-background-color);
|
|
1370
|
-
--_tooltip-content-color: var(--semantics-tooltips-content-color);
|
|
1371
|
-
--_tooltip-shortcut-gap: var(--primitives-space-8);
|
|
1372
|
-
--_tooltip-hide-delay: 50; /* unitless ms, read by JavaScript */
|
|
1373
|
-
--_tooltip-offset: 4; /* px, unitless — read by JS */
|
|
1374
|
-
--_tooltip-shift-padding: 8; /* px, unitless — read by JS */
|
|
1375
|
-
|
|
1376
|
-
${inheritedTextReset}
|
|
1377
|
-
display: contents;
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
:host([timing="instant"]) {
|
|
1381
|
-
--_tooltip-hide-duration: 0s;
|
|
1382
|
-
--_tooltip-show-duration: 0s;
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
:host([hidden]) {
|
|
1386
|
-
display: none;
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
/* # Block */
|
|
1391
|
-
|
|
1392
|
-
/* A parent whose triggers sit close together sets
|
|
1393
|
-
--context-tooltip-pointer-events to none, so a click on the tooltip
|
|
1394
|
-
reaches the control underneath. Unset, the tooltip inherits as before. */
|
|
1395
|
-
.tooltip {
|
|
1396
|
-
pointer-events: var(--context-tooltip-pointer-events);
|
|
1397
|
-
position: fixed;
|
|
1398
|
-
opacity: 0;
|
|
1399
|
-
margin: 0;
|
|
1400
|
-
border: none;
|
|
1401
|
-
background: none;
|
|
1402
|
-
padding: 0;
|
|
1403
|
-
transition:
|
|
1404
|
-
opacity var(--_tooltip-hide-duration) ease,
|
|
1405
|
-
display var(--_tooltip-hide-duration) allow-discrete,
|
|
1406
|
-
overlay var(--_tooltip-hide-duration) allow-discrete;
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
|
-
.tooltip:popover-open {
|
|
1410
|
-
opacity: 1;
|
|
1411
|
-
transition:
|
|
1412
|
-
opacity var(--_tooltip-show-duration) ease,
|
|
1413
|
-
display var(--_tooltip-show-duration) allow-discrete,
|
|
1414
|
-
overlay var(--_tooltip-show-duration) allow-discrete;
|
|
1415
|
-
}
|
|
1416
|
-
|
|
1417
|
-
/* Stay invisible (no fade) until Floating UI has placed it, so the fade-in plays at
|
|
1418
|
-
the final position rather than flashing at the popover's default spot. The
|
|
1419
|
-
positioned attribute is set once _updatePosition writes the coordinates. */
|
|
1420
|
-
.tooltip:popover-open:not([positioned]) {
|
|
1421
|
-
/* visibility (like nldd-menu/nldd-popover) keeps the not-yet-placed tooltip out
|
|
1422
|
-
of hit-testing at its stale default spot; opacity still drives the fade. */
|
|
1423
|
-
visibility: hidden;
|
|
1424
|
-
opacity: 0;
|
|
1425
|
-
transition: none;
|
|
1426
|
-
}
|
|
1427
|
-
|
|
1428
|
-
@starting-style {
|
|
1429
|
-
.tooltip:popover-open {
|
|
1430
|
-
opacity: 0;
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
@media (prefers-reduced-motion: reduce) {
|
|
1435
|
-
.tooltip,
|
|
1436
|
-
.tooltip.is-visible,
|
|
1437
|
-
.tooltip.is-focus-visible {
|
|
1438
|
-
transition: none;
|
|
1439
|
-
}
|
|
1440
|
-
}
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
/* ## Tooltip body */
|
|
1444
|
-
|
|
1445
|
-
.tooltip__body {
|
|
1446
|
-
display: flex;
|
|
1447
|
-
border-radius: var(--semantics-tooltips-corner-radius);
|
|
1448
|
-
box-shadow: var(--_tooltip-box-shadow);
|
|
1449
|
-
background-color: var(--_tooltip-background-color);
|
|
1450
|
-
width: max-content;
|
|
1451
|
-
max-width: var(--_tooltip-max-width);
|
|
1452
|
-
padding-block: var(--semantics-tooltips-padding-block);
|
|
1453
|
-
padding-inline: var(--semantics-tooltips-padding-inline);
|
|
1454
|
-
flex-wrap: wrap;
|
|
1455
|
-
column-gap: var(--_tooltip-shortcut-gap);
|
|
1456
|
-
align-items: baseline;
|
|
1457
|
-
color: var(--_tooltip-content-color);
|
|
1458
|
-
font: var(--semantics-tooltips-font);
|
|
1459
|
-
overflow-wrap: break-word;
|
|
1460
|
-
}
|
|
1461
|
-
|
|
1462
|
-
.tooltip__text {
|
|
1463
|
-
min-width: 0;
|
|
1464
|
-
text-wrap: pretty;
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
|
-
.tooltip__shortcut {
|
|
1468
|
-
white-space: nowrap;
|
|
1469
|
-
}
|
|
1470
|
-
|
|
1471
|
-
@media (forced-colors: active) {
|
|
1472
|
-
.tooltip__body {
|
|
1473
|
-
border: 1px solid CanvasText;
|
|
1474
|
-
}
|
|
1475
|
-
}
|
|
1476
|
-
`;
|
|
1477
|
-
// src/components/content/tooltip/tooltip.template.ts
|
|
1478
|
-
function tooltipTemplate(component) {
|
|
1479
|
-
return html`
|
|
1480
|
-
<slot
|
|
1481
|
-
@mouseenter=${component._handleTriggerEnter}
|
|
1482
|
-
@mouseleave=${component._handleTriggerLeave}
|
|
1483
|
-
@focusin=${component._handleFocusIn}
|
|
1484
|
-
@focusout=${component._handleFocusOut}
|
|
1485
|
-
@click=${component._handleTriggerActivate}
|
|
1486
|
-
></slot>
|
|
1487
|
-
<div class="tooltip"
|
|
1488
|
-
popover="manual"
|
|
1489
|
-
aria-hidden="true"
|
|
1490
|
-
@mouseenter=${component._handleTooltipEnter}
|
|
1491
|
-
@mouseleave=${component._handleTooltipLeave}
|
|
1492
|
-
>
|
|
1493
|
-
<div class="tooltip__body">
|
|
1494
|
-
${component.text ? html`<span class="tooltip__text">${component.text}</span>` : nothing}
|
|
1495
|
-
${hasShortcut(component) ? html`
|
|
1496
|
-
<span class="tooltip__shortcut">
|
|
1497
|
-
<nldd-keyboard-shortcut
|
|
1498
|
-
size="inherit"
|
|
1499
|
-
appearance="simple"
|
|
1500
|
-
color="inherit"
|
|
1501
|
-
keys=${component.shortcut || nothing}
|
|
1502
|
-
mac-keys=${component.shortcutMac || nothing}
|
|
1503
|
-
windows-keys=${component.shortcutWindows || nothing}
|
|
1504
|
-
linux-keys=${component.shortcutLinux || nothing}
|
|
1505
|
-
></nldd-keyboard-shortcut>
|
|
1506
|
-
</span>
|
|
1507
|
-
` : nothing}
|
|
1508
|
-
</div>
|
|
1509
|
-
</div>
|
|
1510
|
-
`;
|
|
1511
|
-
}
|
|
1512
|
-
// src/utilities/carried-context.ts
|
|
1513
|
-
/**
|
|
1514
|
-
* The color scheme and language an element had in its place on the page,
|
|
1515
|
-
* carried along when a component moves it somewhere else: a submenu into
|
|
1516
|
-
* `<body>` for a drill-in, an overflow menu or sheet that lives in `<body>`, a
|
|
1517
|
-
* notification into the shared area.
|
|
1518
|
-
*
|
|
1519
|
-
* Both inherit, so a moved element takes those of its new parent. A submenu
|
|
1520
|
-
* from a dark section of the page turns light, and a screen reader reads an
|
|
1521
|
-
* English menu with Dutch pronunciation. A theme needs nothing: it sits on
|
|
1522
|
-
* `:root`, which is the same everywhere.
|
|
1523
|
-
*
|
|
1524
|
-
* Only what this helper wrote itself is ever overwritten or taken back: a
|
|
1525
|
-
* `lang` or `color-scheme` set on the element by its author stays.
|
|
1526
|
-
*/
|
|
1527
|
-
var carried = /* @__PURE__ */ new WeakMap();
|
|
1528
|
-
/** The language of an element, looking past shadow roots to their hosts. */
|
|
1529
|
-
function langOf(el) {
|
|
1530
|
-
let node = el;
|
|
1531
|
-
while (node) {
|
|
1532
|
-
const owner = node.closest("[lang]");
|
|
1533
|
-
if (owner) return owner.getAttribute("lang");
|
|
1534
|
-
const root = node.getRootNode();
|
|
1535
|
-
node = root instanceof ShadowRoot ? root.host : null;
|
|
1536
|
-
}
|
|
1537
|
-
return null;
|
|
1538
|
-
}
|
|
1539
|
-
/**
|
|
1540
|
-
* Gives `element` the color scheme and language of `origin`. Call it each time
|
|
1541
|
-
* the element shows, since the page around the origin may have changed.
|
|
1542
|
-
*
|
|
1543
|
-
* Reading the color scheme takes `getComputedStyle`, which recalculates the
|
|
1544
|
-
* styles of the page when they are dirty. An element nobody sees, such as the
|
|
1545
|
-
* hidden description of a tooltip, only needs the language: pass
|
|
1546
|
-
* `{ scheme: false }` and nothing is recalculated.
|
|
1547
|
-
*/
|
|
1548
|
-
function carryContext(element, origin, { scheme: withScheme = true } = {}) {
|
|
1549
|
-
if (!origin?.isConnected) return;
|
|
1550
|
-
const previous = carried.get(element) ?? {
|
|
1551
|
-
scheme: null,
|
|
1552
|
-
lang: null
|
|
1553
|
-
};
|
|
1554
|
-
const next = {
|
|
1555
|
-
scheme: previous.scheme,
|
|
1556
|
-
lang: previous.lang
|
|
1557
|
-
};
|
|
1558
|
-
const ownScheme = element.style.colorScheme;
|
|
1559
|
-
if (withScheme && (!ownScheme || ownScheme === previous.scheme)) {
|
|
1560
|
-
const scheme = getComputedStyle(origin).colorScheme;
|
|
1561
|
-
if (scheme && scheme !== "normal") {
|
|
1562
|
-
element.style.colorScheme = scheme;
|
|
1563
|
-
next.scheme = element.style.colorScheme;
|
|
1564
|
-
} else {
|
|
1565
|
-
if (previous.scheme) element.style.removeProperty("color-scheme");
|
|
1566
|
-
next.scheme = null;
|
|
1567
|
-
}
|
|
1568
|
-
}
|
|
1569
|
-
const ownLang = element.getAttribute("lang");
|
|
1570
|
-
if (ownLang === null || ownLang === previous.lang) {
|
|
1571
|
-
const lang = langOf(origin);
|
|
1572
|
-
if (lang) {
|
|
1573
|
-
element.setAttribute("lang", lang);
|
|
1574
|
-
next.lang = lang;
|
|
1575
|
-
} else {
|
|
1576
|
-
if (previous.lang) element.removeAttribute("lang");
|
|
1577
|
-
next.lang = null;
|
|
1578
|
-
}
|
|
1579
|
-
}
|
|
1580
|
-
carried.set(element, next);
|
|
1581
|
-
}
|
|
1582
|
-
/** Takes back what `carryContext` wrote, for an element returned to its place. */
|
|
1583
|
-
function releaseContext(element) {
|
|
1584
|
-
const previous = carried.get(element);
|
|
1585
|
-
if (!previous) return;
|
|
1586
|
-
if (previous.scheme && element.style.colorScheme === previous.scheme) element.style.removeProperty("color-scheme");
|
|
1587
|
-
if (previous.lang && element.getAttribute("lang") === previous.lang) element.removeAttribute("lang");
|
|
1588
|
-
carried.delete(element);
|
|
1589
|
-
}
|
|
1590
|
-
// src/components/content/tooltip/tooltip.ts
|
|
1591
|
-
/**
|
|
1592
|
-
* Nederlandse Digitale Dienst Tooltip Component (Lit + TypeScript)
|
|
1593
|
-
*
|
|
1594
|
-
* A wrapper that shows a tooltip on hover or focus of its child element. It
|
|
1595
|
-
* uses `display: contents`, so it does not affect the child's layout.
|
|
1596
|
-
*
|
|
1597
|
-
* @element nldd-tooltip
|
|
1598
|
-
* @attr {string} text - Tooltip text
|
|
1599
|
-
* @attr {string} shortcut - Keyboard shortcut hint shown after the text, e.g. 'Cmd+P'. Display only (rendered via nldd-keyboard-shortcut): it does not bind the key. Joins the description of a light-DOM trigger. Hidden on touch-only devices, where it isn't invokable.
|
|
1600
|
-
* @attr {string} shortcut-mac - Override of `shortcut` on macOS, where the keys differ (falls back to `shortcut`).
|
|
1601
|
-
* @attr {string} shortcut-windows - Override of `shortcut` on Windows (falls back to `shortcut`).
|
|
1602
|
-
* @attr {string} shortcut-linux - Override of `shortcut` on Linux (falls back to `shortcut`).
|
|
1603
|
-
* @attr {boolean} open - Forces the tooltip visible, whatever hover or focus does. Use it for programmatic feedback ("Copied", for instance). Reset it to false to restore the hover behavior.
|
|
1604
|
-
* @attr {string} placement - Position: 'top' | 'bottom' | 'left' | 'right' (default: 'bottom'; automatically 'top' on touch devices)
|
|
1605
|
-
* @attr {string} timing - When the tooltip appears on hover: 'instant' — right away, without a show delay or a fade, also on the way out. 'delay' (the default) — after the standard show delay (700ms). 'never' — the tooltip is never shown; hover and focus events are ignored, aria-describedby is suppressed, and a tooltip that is already visible disappears. The hide delay and the touch suppression stay in force under every value. A focus trigger is always instant.
|
|
1606
|
-
*
|
|
1607
|
-
* Escape closes a tooltip that hover or focus opened, wherever focus is: the
|
|
1608
|
-
* pointer can rest on a button while focus sits somewhere else (WCAG 1.4.13).
|
|
1609
|
-
* That press closes the tooltip only. A dialog, sheet or menu around it stays
|
|
1610
|
-
* open and takes the next one. The tooltip takes the key in the capture phase
|
|
1611
|
-
* on `document` and stops it there, so a handler of your own for Escape does
|
|
1612
|
-
* not hear that press either.
|
|
1613
|
-
*
|
|
1614
|
-
* @slot - The element the tooltip is shown for
|
|
1615
|
-
*
|
|
1616
|
-
* @fires nldd-tooltip-dismiss - When a user presses Escape while `open=true`.
|
|
1617
|
-
* The consumer owns the open lifecycle from there (we cannot clear `open`
|
|
1618
|
-
* on our own), so this event is the consumer's chance to set `open` back to
|
|
1619
|
-
* `false`. WCAG 1.4.13: a persistent hover or focus overlay has to be
|
|
1620
|
-
* dismissible without moving focus.
|
|
1621
|
-
*
|
|
1622
|
-
* @note A parent whose triggers sit close together, such as nldd-swatch-picker,
|
|
1623
|
-
* can set `--context-tooltip-pointer-events: none` on the trigger. A click on
|
|
1624
|
-
* the tooltip then reaches the control underneath instead of selecting the
|
|
1625
|
-
* trigger, and the pointer cannot rest on the tooltip itself.
|
|
1626
|
-
*
|
|
1627
|
-
* @note It renders through the native Popover API (`popover="manual"`) in the
|
|
1628
|
-
* top layer. That escapes every ancestor stacking context and `overflow:
|
|
1629
|
-
* hidden` clipping, so no more z-index fights with overlay containers, panes
|
|
1630
|
-
* or transform containers. Positioning still goes through Floating UI with
|
|
1631
|
-
* `strategy: 'fixed'`.
|
|
1632
|
-
*
|
|
1633
|
-
* @note aria-describedby only works when the trigger element is in the light
|
|
1634
|
-
* DOM. With a web component as the trigger (with a shadow DOM of its own) the
|
|
1635
|
-
* link is a known shadow DOM plus ARIA limitation. For nldd-icon-button that
|
|
1636
|
-
* does not matter, because aria-label already sits on the inner button. Tooltip
|
|
1637
|
-
* text on an icon-button must therefore hold nothing that aria-label does not
|
|
1638
|
-
* already say.
|
|
1639
|
-
*
|
|
1640
|
-
* @note With a disabled trigger (a disabled nldd-icon-button, for instance) the
|
|
1641
|
-
* tooltip is not shown, because disabled buttons fire no mouseenter or focusin
|
|
1642
|
-
* and `display: contents` has no layout box of its own to catch events on.
|
|
1643
|
-
*/
|
|
1644
|
-
var _NLDDTooltip;
|
|
1645
|
-
var tooltipCounter = 0;
|
|
1646
|
-
var coarsePointerQuery = matchMedia("(pointer: coarse)");
|
|
1647
|
-
var DEFAULT_SHOW_DELAY_MS = 700;
|
|
1648
|
-
var DEFAULT_HIDE_DELAY_MS = 50;
|
|
1649
|
-
var NLDDTooltip = (_NLDDTooltip = class NLDDTooltip extends LitElement {
|
|
1650
|
-
constructor(..._args) {
|
|
1651
|
-
super(..._args);
|
|
1652
|
-
this.text = "";
|
|
1653
|
-
this.shortcut = "";
|
|
1654
|
-
this.shortcutMac = "";
|
|
1655
|
-
this.shortcutWindows = "";
|
|
1656
|
-
this.shortcutLinux = "";
|
|
1657
|
-
this.open = false;
|
|
1658
|
-
this.placement = "bottom";
|
|
1659
|
-
this.timing = "delay";
|
|
1660
|
-
this._visible = false;
|
|
1661
|
-
this._tooltipId = `nldd-tooltip-${++tooltipCounter}`;
|
|
1662
|
-
this._hideTimeout = null;
|
|
1663
|
-
this._showTimeout = null;
|
|
1664
|
-
this._descriptionEl = null;
|
|
1665
|
-
this._currentTrigger = null;
|
|
1666
|
-
this._boundSlotChange = () => this._syncAriaDescribedBy();
|
|
1667
|
-
this._shortcutAvailability = new ShortcutAvailabilityController(this, () => this._syncAriaDescribedBy());
|
|
1668
|
-
this._positionVersion = 0;
|
|
1669
|
-
this._shownByHover = false;
|
|
1670
|
-
this._handleScroll = () => {
|
|
1671
|
-
if (this.open || !this._shownByHover) {
|
|
1672
|
-
this._updatePosition();
|
|
1673
|
-
return;
|
|
1674
|
-
}
|
|
1675
|
-
if (this._hideTimeout) {
|
|
1676
|
-
clearTimeout(this._hideTimeout);
|
|
1677
|
-
this._hideTimeout = null;
|
|
1678
|
-
}
|
|
1679
|
-
this._visible = false;
|
|
1680
|
-
};
|
|
1681
|
-
this._handleKeyDown = (e) => {
|
|
1682
|
-
if (e.key !== "Escape" || !this._visible) return;
|
|
1683
|
-
if (this.open) {
|
|
1684
|
-
if (!e.composedPath().includes(this)) return;
|
|
1685
|
-
this.dispatchEvent(new CustomEvent("nldd-tooltip-dismiss", {
|
|
1686
|
-
bubbles: true,
|
|
1687
|
-
composed: true
|
|
1688
|
-
}));
|
|
1689
|
-
e.preventDefault();
|
|
1690
|
-
e.stopPropagation();
|
|
1691
|
-
return;
|
|
1692
|
-
}
|
|
1693
|
-
this._visible = false;
|
|
1694
|
-
e.preventDefault();
|
|
1695
|
-
e.stopPropagation();
|
|
1696
|
-
};
|
|
1697
|
-
}
|
|
1698
|
-
get _effectivePlacement() {
|
|
1699
|
-
return this.placement;
|
|
1700
|
-
}
|
|
1701
|
-
connectedCallback() {
|
|
1702
|
-
super.connectedCallback();
|
|
1703
|
-
if (this._visible) {
|
|
1704
|
-
document.addEventListener("keydown", this._handleKeyDown, true);
|
|
1705
|
-
document.addEventListener("scroll", this._handleScroll, {
|
|
1706
|
-
capture: true,
|
|
1707
|
-
passive: true
|
|
1708
|
-
});
|
|
1709
|
-
}
|
|
1710
|
-
if (this.hasUpdated) this.shadowRoot?.querySelector("slot")?.addEventListener("slotchange", this._boundSlotChange);
|
|
1711
|
-
}
|
|
1712
|
-
firstUpdated() {
|
|
1713
|
-
this.shadowRoot?.querySelector("slot")?.addEventListener("slotchange", this._boundSlotChange);
|
|
1714
|
-
}
|
|
1715
|
-
updated(changed) {
|
|
1716
|
-
if (changed.has("open")) {
|
|
1717
|
-
if (this.open) {
|
|
1718
|
-
if (this._hideTimeout) {
|
|
1719
|
-
clearTimeout(this._hideTimeout);
|
|
1720
|
-
this._hideTimeout = null;
|
|
1721
|
-
}
|
|
1722
|
-
if (this._showTimeout) {
|
|
1723
|
-
clearTimeout(this._showTimeout);
|
|
1724
|
-
this._showTimeout = null;
|
|
1725
|
-
}
|
|
1726
|
-
this._shownByHover = false;
|
|
1727
|
-
this._visible = true;
|
|
1728
|
-
} else if (this._visible) this._visible = false;
|
|
1729
|
-
}
|
|
1730
|
-
if (changed.has("_visible")) {
|
|
1731
|
-
if (this._visible) {
|
|
1732
|
-
document.addEventListener("keydown", this._handleKeyDown, true);
|
|
1733
|
-
document.addEventListener("scroll", this._handleScroll, {
|
|
1734
|
-
capture: true,
|
|
1735
|
-
passive: true
|
|
1736
|
-
});
|
|
1737
|
-
} else {
|
|
1738
|
-
document.removeEventListener("keydown", this._handleKeyDown, true);
|
|
1739
|
-
document.removeEventListener("scroll", this._handleScroll, { capture: true });
|
|
1740
|
-
}
|
|
1741
|
-
const tooltip = this._getTooltipElement();
|
|
1742
|
-
if (tooltip) {
|
|
1743
|
-
if (this._visible) {
|
|
1744
|
-
if (!tooltip.matches(":popover-open")) {
|
|
1745
|
-
tooltip.removeAttribute("positioned");
|
|
1746
|
-
tooltip.showPopover();
|
|
1747
|
-
}
|
|
1748
|
-
this._updatePosition();
|
|
1749
|
-
} else if (tooltip.matches(":popover-open")) tooltip.hidePopover();
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
if (changed.has("text") || changed.has("timing") || changed.has("shortcut") || changed.has("shortcutMac") || changed.has("shortcutWindows") || changed.has("shortcutLinux")) this._syncAriaDescribedBy();
|
|
1753
|
-
if (changed.has("text") && this._visible) this._updatePosition();
|
|
1754
|
-
if (changed.has("timing") && this.timing === "never") {
|
|
1755
|
-
if (this._showTimeout) {
|
|
1756
|
-
clearTimeout(this._showTimeout);
|
|
1757
|
-
this._showTimeout = null;
|
|
1758
|
-
}
|
|
1759
|
-
if (this._visible) this._visible = false;
|
|
1760
|
-
}
|
|
1761
|
-
}
|
|
1762
|
-
_syncAriaDescribedBy() {
|
|
1763
|
-
const trigger = this._getTriggerElement();
|
|
1764
|
-
if (this._currentTrigger && this._currentTrigger !== trigger) this._currentTrigger.removeAttribute("aria-describedby");
|
|
1765
|
-
this._currentTrigger = trigger;
|
|
1766
|
-
if (!trigger) return;
|
|
1767
|
-
if (trigger.getRootNode() !== document) return;
|
|
1768
|
-
const description = [this.text, shortcutLabel(this)].filter(Boolean).join(" ");
|
|
1769
|
-
if (description && this.timing !== "never") {
|
|
1770
|
-
if (!this._descriptionEl) {
|
|
1771
|
-
this._descriptionEl = document.createElement("span");
|
|
1772
|
-
this._descriptionEl.id = this._tooltipId;
|
|
1773
|
-
Object.assign(this._descriptionEl.style, {
|
|
1774
|
-
position: "absolute",
|
|
1775
|
-
top: "0",
|
|
1776
|
-
left: "0",
|
|
1777
|
-
width: "1px",
|
|
1778
|
-
height: "1px",
|
|
1779
|
-
overflow: "hidden",
|
|
1780
|
-
clipPath: "inset(50%)",
|
|
1781
|
-
whiteSpace: "nowrap"
|
|
1782
|
-
});
|
|
1783
|
-
document.body.appendChild(this._descriptionEl);
|
|
1784
|
-
}
|
|
1785
|
-
carryContext(this._descriptionEl, this, { scheme: false });
|
|
1786
|
-
if (this._descriptionEl.textContent !== description) this._descriptionEl.textContent = description;
|
|
1787
|
-
if (trigger.getAttribute("aria-describedby") !== this._tooltipId) trigger.setAttribute("aria-describedby", this._tooltipId);
|
|
1788
|
-
} else {
|
|
1789
|
-
trigger.removeAttribute("aria-describedby");
|
|
1790
|
-
this._descriptionEl?.remove();
|
|
1791
|
-
this._descriptionEl = null;
|
|
1792
|
-
}
|
|
1793
|
-
}
|
|
1794
|
-
_getTriggerElement() {
|
|
1795
|
-
return ((this.shadowRoot?.querySelector("slot"))?.assignedElements({ flatten: true }))?.[0] ?? null;
|
|
1796
|
-
}
|
|
1797
|
-
_getTooltipElement() {
|
|
1798
|
-
return this.shadowRoot?.querySelector(".tooltip") ?? null;
|
|
1799
|
-
}
|
|
1800
|
-
/** Whether there is anything to show: the text, or a shortcut on a device
|
|
1801
|
-
* that shows one. */
|
|
1802
|
-
get _hasContent() {
|
|
1803
|
-
return Boolean(this.text || shortcutLabel(this));
|
|
1804
|
-
}
|
|
1805
|
-
_handleTriggerEnter() {
|
|
1806
|
-
if (this.timing === "never") return;
|
|
1807
|
-
this._syncAriaDescribedBy();
|
|
1808
|
-
if (!this._hasContent) return;
|
|
1809
|
-
if (coarsePointerQuery.matches) return;
|
|
1810
|
-
if (this._hideTimeout) {
|
|
1811
|
-
clearTimeout(this._hideTimeout);
|
|
1812
|
-
this._hideTimeout = null;
|
|
1813
|
-
}
|
|
1814
|
-
if (this._showTimeout) clearTimeout(this._showTimeout);
|
|
1815
|
-
if (this.timing === "instant") {
|
|
1816
|
-
this._showTimeout = null;
|
|
1817
|
-
this._shownByHover = !this._visible || this._shownByHover;
|
|
1818
|
-
this._visible = true;
|
|
1819
|
-
return;
|
|
1820
|
-
}
|
|
1821
|
-
const parsedShow = parseInt(getComputedStyle(this).getPropertyValue("--_tooltip-show-delay"), 10);
|
|
1822
|
-
const showDelay = Number.isFinite(parsedShow) ? parsedShow : DEFAULT_SHOW_DELAY_MS;
|
|
1823
|
-
this._showTimeout = setTimeout(() => {
|
|
1824
|
-
this._showTimeout = null;
|
|
1825
|
-
this._shownByHover = !this._visible || this._shownByHover;
|
|
1826
|
-
this._visible = true;
|
|
1827
|
-
}, showDelay);
|
|
1828
|
-
}
|
|
1829
|
-
_handleFocusIn() {
|
|
1830
|
-
if (this.timing === "never") return;
|
|
1831
|
-
this._syncAriaDescribedBy();
|
|
1832
|
-
if (!this._hasContent) return;
|
|
1833
|
-
if (isTouchMode()) return;
|
|
1834
|
-
if (this._hideTimeout) {
|
|
1835
|
-
clearTimeout(this._hideTimeout);
|
|
1836
|
-
this._hideTimeout = null;
|
|
1837
|
-
}
|
|
1838
|
-
if (this._showTimeout) {
|
|
1839
|
-
clearTimeout(this._showTimeout);
|
|
1840
|
-
this._showTimeout = null;
|
|
1841
|
-
}
|
|
1842
|
-
this._shownByHover = false;
|
|
1843
|
-
this._visible = true;
|
|
1844
|
-
}
|
|
1845
|
-
_handleTriggerLeave() {
|
|
1846
|
-
if (this._showTimeout) {
|
|
1847
|
-
clearTimeout(this._showTimeout);
|
|
1848
|
-
this._showTimeout = null;
|
|
1849
|
-
}
|
|
1850
|
-
if (this.open) return;
|
|
1851
|
-
if (this._hideTimeout) clearTimeout(this._hideTimeout);
|
|
1852
|
-
const parsedHide = parseInt(getComputedStyle(this).getPropertyValue("--_tooltip-hide-delay"), 10);
|
|
1853
|
-
const hideDelay = Number.isFinite(parsedHide) ? parsedHide : DEFAULT_HIDE_DELAY_MS;
|
|
1854
|
-
this._hideTimeout = setTimeout(() => {
|
|
1855
|
-
this._visible = false;
|
|
1856
|
-
this._hideTimeout = null;
|
|
1857
|
-
}, hideDelay);
|
|
1858
|
-
}
|
|
1859
|
-
/** Focus guard checks one shadow root level deep for composite triggers. */
|
|
1860
|
-
_handleFocusOut(e) {
|
|
1861
|
-
const assigned = (this.shadowRoot?.querySelector("slot"))?.assignedElements({ flatten: true }) ?? [];
|
|
1862
|
-
const related = e.relatedTarget;
|
|
1863
|
-
if (!(related && assigned.some((el) => el.contains(related) || el.shadowRoot?.contains(related)))) this._handleTriggerLeave();
|
|
1864
|
-
}
|
|
1865
|
-
_handleTriggerActivate() {
|
|
1866
|
-
if (this.open) return;
|
|
1867
|
-
if (this._showTimeout) {
|
|
1868
|
-
clearTimeout(this._showTimeout);
|
|
1869
|
-
this._showTimeout = null;
|
|
1870
|
-
}
|
|
1871
|
-
if (this._hideTimeout) {
|
|
1872
|
-
clearTimeout(this._hideTimeout);
|
|
1873
|
-
this._hideTimeout = null;
|
|
1874
|
-
}
|
|
1875
|
-
this._visible = false;
|
|
1876
|
-
}
|
|
1877
|
-
_handleTooltipEnter() {
|
|
1878
|
-
if (this._hideTimeout) {
|
|
1879
|
-
clearTimeout(this._hideTimeout);
|
|
1880
|
-
this._hideTimeout = null;
|
|
1881
|
-
}
|
|
1882
|
-
}
|
|
1883
|
-
_handleTooltipLeave() {
|
|
1884
|
-
this._handleTriggerLeave();
|
|
1885
|
-
}
|
|
1886
|
-
async _updatePosition() {
|
|
1887
|
-
const version = ++this._positionVersion;
|
|
1888
|
-
const trigger = this._getTriggerElement();
|
|
1889
|
-
const tooltip = this._getTooltipElement();
|
|
1890
|
-
if (!trigger || !tooltip) {
|
|
1891
|
-
tooltip?.setAttribute("positioned", "");
|
|
1892
|
-
return;
|
|
1893
|
-
}
|
|
1894
|
-
if (document.fonts?.status !== "loaded") {
|
|
1895
|
-
await document.fonts?.ready;
|
|
1896
|
-
if (version !== this._positionVersion) return;
|
|
1897
|
-
}
|
|
1898
|
-
const styles = getComputedStyle(this);
|
|
1899
|
-
const gap = parseInt(styles.getPropertyValue("--_tooltip-offset"), 10);
|
|
1900
|
-
const fingertip = parseFloat(styles.getPropertyValue("--context-tooltip-fingertip-size"));
|
|
1901
|
-
const distance = coarsePointerQuery.matches && Number.isFinite(fingertip) ? ({ placement, rects }) => {
|
|
1902
|
-
const across = /^(top|bottom)/.test(placement) ? rects.reference.height : rects.reference.width;
|
|
1903
|
-
return Math.max(gap, (fingertip - across) / 2);
|
|
1904
|
-
} : gap;
|
|
1905
|
-
const { x, y } = await computePosition(trigger, tooltip, {
|
|
1906
|
-
placement: this._effectivePlacement,
|
|
1907
|
-
strategy: "fixed",
|
|
1908
|
-
middleware: [
|
|
1909
|
-
offset(distance),
|
|
1910
|
-
flip(),
|
|
1911
|
-
shift({ padding: parseInt(styles.getPropertyValue("--_tooltip-shift-padding"), 10) })
|
|
1912
|
-
]
|
|
1913
|
-
});
|
|
1914
|
-
if (version !== this._positionVersion) return;
|
|
1915
|
-
tooltip.style.left = `${x}px`;
|
|
1916
|
-
tooltip.style.top = `${y}px`;
|
|
1917
|
-
tooltip.setAttribute("positioned", "");
|
|
1918
|
-
}
|
|
1919
|
-
disconnectedCallback() {
|
|
1920
|
-
super.disconnectedCallback();
|
|
1921
|
-
document.removeEventListener("keydown", this._handleKeyDown, true);
|
|
1922
|
-
document.removeEventListener("scroll", this._handleScroll, { capture: true });
|
|
1923
|
-
this.shadowRoot?.querySelector("slot")?.removeEventListener("slotchange", this._boundSlotChange);
|
|
1924
|
-
if (this._hideTimeout) {
|
|
1925
|
-
clearTimeout(this._hideTimeout);
|
|
1926
|
-
this._hideTimeout = null;
|
|
1927
|
-
}
|
|
1928
|
-
if (this._showTimeout) {
|
|
1929
|
-
clearTimeout(this._showTimeout);
|
|
1930
|
-
this._showTimeout = null;
|
|
1931
|
-
}
|
|
1932
|
-
this._currentTrigger?.removeAttribute("aria-describedby");
|
|
1933
|
-
this._currentTrigger = null;
|
|
1934
|
-
this._descriptionEl?.remove();
|
|
1935
|
-
this._descriptionEl = null;
|
|
1936
|
-
}
|
|
1937
|
-
render() {
|
|
1938
|
-
return tooltipTemplate(this);
|
|
1939
|
-
}
|
|
1940
|
-
}, _NLDDTooltip.styles = tooltipStyles, _NLDDTooltip);
|
|
1941
|
-
__decorate([property({
|
|
1942
|
-
reflect: true,
|
|
1943
|
-
converter: reflectNonDefault("")
|
|
1944
|
-
})], NLDDTooltip.prototype, "text", void 0);
|
|
1945
|
-
__decorate([property({
|
|
1946
|
-
reflect: true,
|
|
1947
|
-
converter: reflectNonDefault("")
|
|
1948
|
-
})], NLDDTooltip.prototype, "shortcut", void 0);
|
|
1949
|
-
__decorate([property({
|
|
1950
|
-
reflect: true,
|
|
1951
|
-
attribute: "shortcut-mac",
|
|
1952
|
-
converter: reflectNonDefault("")
|
|
1953
|
-
})], NLDDTooltip.prototype, "shortcutMac", void 0);
|
|
1954
|
-
__decorate([property({
|
|
1955
|
-
reflect: true,
|
|
1956
|
-
attribute: "shortcut-windows",
|
|
1957
|
-
converter: reflectNonDefault("")
|
|
1958
|
-
})], NLDDTooltip.prototype, "shortcutWindows", void 0);
|
|
1959
|
-
__decorate([property({
|
|
1960
|
-
reflect: true,
|
|
1961
|
-
attribute: "shortcut-linux",
|
|
1962
|
-
converter: reflectNonDefault("")
|
|
1963
|
-
})], NLDDTooltip.prototype, "shortcutLinux", void 0);
|
|
1964
|
-
__decorate([property({
|
|
1965
|
-
type: Boolean,
|
|
1966
|
-
reflect: true
|
|
1967
|
-
})], NLDDTooltip.prototype, "open", void 0);
|
|
1968
|
-
__decorate([property({
|
|
1969
|
-
reflect: true,
|
|
1970
|
-
converter: reflectNonDefault("bottom")
|
|
1971
|
-
})], NLDDTooltip.prototype, "placement", void 0);
|
|
1972
|
-
__decorate([property({
|
|
1973
|
-
reflect: true,
|
|
1974
|
-
converter: reflectNonDefault("delay")
|
|
1975
|
-
})], NLDDTooltip.prototype, "timing", void 0);
|
|
1976
|
-
__decorate([state()], NLDDTooltip.prototype, "_visible", void 0);
|
|
1977
|
-
NLDDTooltip = __decorate([customElement("nldd-tooltip")], NLDDTooltip);
|
|
1978
|
-
// src/components/actions/icon-button/icon-button.template.ts
|
|
1979
|
-
function renderContent(component) {
|
|
1980
|
-
return html`
|
|
1981
|
-
<span class="icon-button__icon-area">
|
|
1982
|
-
<span class="icon-button__icon">
|
|
1983
|
-
<slot name="icon" @slotchange=${component._onIconSlotChange}>${component.icon ? html`<nldd-icon icon=${component.icon}></nldd-icon>` : html`<nldd-icon icon="icon-placeholder"></nldd-icon>`}</slot>
|
|
1984
|
-
</span>
|
|
1985
|
-
${component.expandable ? html`
|
|
1986
|
-
<span class="icon-button__disclosure-icon">
|
|
1987
|
-
<nldd-icon icon="chevron-down-small"></nldd-icon>
|
|
1988
|
-
</span>
|
|
1989
|
-
` : nothing}
|
|
1990
|
-
</span>
|
|
1991
|
-
${component.text ? html`
|
|
1992
|
-
<span class="icon-button__text">${component.text}</span>
|
|
1993
|
-
` : ""}
|
|
1994
|
-
`;
|
|
1995
|
-
}
|
|
1996
|
-
function template() {
|
|
1997
|
-
const hintKey = downloadLinkHintKey(this.href, this.target, this.download);
|
|
1998
|
-
if (this.href) markDownloadTarget(this, this.download, this.target);
|
|
1999
|
-
const linkHint = hintKey ? this._t(`components.icon-button.${hintKey}`) : "";
|
|
2000
|
-
const label = [[this.accessibleLabel || this.text, shortcutLabel(this)].filter(Boolean).join(" "), linkHint].filter(Boolean).join(", ") || nothing;
|
|
2001
|
-
const content = renderContent(this);
|
|
2002
|
-
const tooltipText = this.accessibleLabel || (this.size !== "lg" || this.hideLgText ? this.text : "");
|
|
2003
|
-
const ariaExpanded = this.expandable || !!this.popupType ? String(this.expanded) : this.expanded ? "true" : nothing;
|
|
2004
|
-
const ariaBusy = this.loading ? "true" : nothing;
|
|
2005
|
-
const loadingSize = this.size === "xs" ? "16" : this.size === "sm" ? "20" : this.size === "lg" ? "28" : "24";
|
|
2006
|
-
const loadingIndicator = this.loading ? html`
|
|
2007
|
-
<div class="icon-button__activity-indicator">
|
|
2008
|
-
<nldd-activity-indicator
|
|
2009
|
-
timing="instant"
|
|
2010
|
-
size=${loadingSize}
|
|
2011
|
-
text=${this.loadingText || nothing}
|
|
2012
|
-
></nldd-activity-indicator>
|
|
2013
|
-
</div>
|
|
2014
|
-
` : nothing;
|
|
2015
|
-
const renderButton = () => {
|
|
2016
|
-
if (this.href) {
|
|
2017
|
-
const resolvedRel = linkRel(this.rel, this.target);
|
|
2018
|
-
return html`
|
|
2019
|
-
<a class="icon-button"
|
|
2020
|
-
href=${this.href}
|
|
2021
|
-
target=${this.target || nothing}
|
|
2022
|
-
rel=${resolvedRel || nothing}
|
|
2023
|
-
download=${this.download ?? nothing}
|
|
2024
|
-
aria-disabled=${this.disabled ? "true" : nothing}
|
|
2025
|
-
aria-label=${label}
|
|
2026
|
-
aria-haspopup=${this.popupType || nothing}
|
|
2027
|
-
aria-expanded=${ariaExpanded}
|
|
2028
|
-
aria-busy=${ariaBusy}
|
|
2029
|
-
tabindex=${this.noTab ? "-1" : nothing}
|
|
2030
|
-
@pointerdown=${this._popup.handlePointerdown}
|
|
2031
|
-
@click=${this._handleClick}
|
|
2032
|
-
>
|
|
2033
|
-
${content}
|
|
2034
|
-
</a>
|
|
2035
|
-
`;
|
|
2036
|
-
}
|
|
2037
|
-
return html`
|
|
2038
|
-
<button class="icon-button"
|
|
2039
|
-
type=${this.type}
|
|
2040
|
-
?disabled=${this.disabled}
|
|
2041
|
-
aria-disabled=${this.disabled ? "true" : nothing}
|
|
2042
|
-
aria-label=${label}
|
|
2043
|
-
aria-haspopup=${this.popupType || nothing}
|
|
2044
|
-
aria-expanded=${ariaExpanded}
|
|
2045
|
-
aria-busy=${ariaBusy}
|
|
2046
|
-
tabindex=${this.noTab ? "-1" : nothing}
|
|
2047
|
-
.popoverTargetElement=${popoverTargetOf(this, this.popovertarget, this.popoverTargetElement)}
|
|
2048
|
-
.popoverTargetAction=${this.popoverTargetAction}
|
|
2049
|
-
@pointerdown=${this._popup.handlePointerdown}
|
|
2050
|
-
@click=${this._handleClick}
|
|
2051
|
-
>
|
|
2052
|
-
${content}
|
|
2053
|
-
</button>
|
|
2054
|
-
`;
|
|
2055
|
-
};
|
|
2056
|
-
const control = (tooltipText || hasShortcut(this)) && this.tooltipTiming !== "never" ? html`
|
|
2057
|
-
<nldd-tooltip
|
|
2058
|
-
text=${tooltipText || nothing}
|
|
2059
|
-
timing=${this.tooltipTiming}
|
|
2060
|
-
shortcut=${this.shortcut || nothing}
|
|
2061
|
-
shortcut-mac=${this.shortcutMac || nothing}
|
|
2062
|
-
shortcut-windows=${this.shortcutWindows || nothing}
|
|
2063
|
-
shortcut-linux=${this.shortcutLinux || nothing}
|
|
2064
|
-
>
|
|
2065
|
-
${renderButton()}
|
|
2066
|
-
</nldd-tooltip>
|
|
2067
|
-
` : renderButton();
|
|
2068
|
-
const popupSlot = html`<slot name="popup" @slotchange=${this._popup.handleSlotChange}></slot>`;
|
|
2069
|
-
return html`${control}${loadingIndicator}${popupSlot}`;
|
|
2070
|
-
}
|
|
2071
|
-
// src/components/actions/icon-button/icon-button.ts
|
|
2072
|
-
/**
|
|
2073
|
-
* Nederlandse Digitale Dienst Icon Button Component (Lit + TypeScript)
|
|
2074
|
-
*
|
|
2075
|
-
* @element nldd-icon-button
|
|
2076
|
-
* @attr {string} appearance - Visual style, color included: 'accent-filled' | 'accent-transparent' | 'neutral-tinted' | 'neutral-transparent' | 'critical-tinted' | 'critical-transparent' | 'inherit-filled' | 'inherit-tinted' | 'primary' | 'secondary' | 'destructive'. The inherit appearances derive their colors from currentColor, for buttons on colored surfaces.
|
|
2077
|
-
* @attr {string} size - Button size: 'xs' | 'sm' | 'md' | 'lg' (default: 'md')
|
|
2078
|
-
* @attr {boolean} hide-lg-text - In lg size, hides the text label and enlarges the icon by one step (28px)
|
|
2079
|
-
* @attr {boolean} no-highlight-border - Removes the per-appearance highlight border (e.g. when a control group draws a single border instead).
|
|
2080
|
-
* @attr {boolean} loading - Loading state (default: false). Shows an activity indicator over the visually hidden icon, sets aria-busy on the inner control and blocks activation, without dropping the button from the tab order (unlike disabled). Meant for an action that has to wait for the server, such as sending an application. For most actions, show the result right away and confirm in the background, as the design guidelines describe.
|
|
2081
|
-
* @attr {string} loading-text - What the screen reader announces while `loading` is on, for a button that does more than load: "Aan het bewaren". Leave it out and the activity indicator says its translated "Laden".
|
|
2082
|
-
* @attr {boolean} disabled - Disabled state. Avoid it: let the action run and say afterwards what is missing; the design guidelines say why.
|
|
2083
|
-
* @attr {boolean} no-tab - Takes the button out of the tab order (tabindex="-1"), for a control owned by a roving container (an nldd-token in nldd-token-field, a button in a row of an nldd-list) that manages focus itself. Still mouse- and script-focusable.
|
|
2084
|
-
* @attr {string} type - Button type for form submission: 'button' | 'submit' | 'reset' (ignored when href is set)
|
|
2085
|
-
* @attr {boolean} expandable - Whether the button opens a menu or popover and shows chevron next to the icon
|
|
2086
|
-
* @attr {boolean} expanded - Whether the popover/menu controlled by this button is currently open. Forwarded as aria-expanded on the inner button; toggles the is-expanded visual state.
|
|
2087
|
-
* @attr {string} popup-type - Type of popup container this button opens: 'menu' | 'listbox' | 'dialog' | 'tree' | 'grid'. Sets aria-haspopup on the inner button and forces aria-expanded to always be present (true/false) so screen readers know the popup state. An nldd-menu or nldd-popover in the `popup` slot, or anchored to this button, sets it itself from the first render; set it only for another kind of popup.
|
|
2088
|
-
* @attr {string} width - Width mode: 'full' (stretches to container) or any CSS length (e.g. '240px')
|
|
2089
|
-
* @attr {string} text - Button text, used as aria-label and shown below the icon in lg size
|
|
2090
|
-
* @attr {string} icon - Icon name for the nldd-icon element. Defaults to a placeholder icon when neither this attribute nor the icon slot is set.
|
|
2091
|
-
* @attr {string} accessible-label - Accessible label for screen readers. Overrides text as aria-label and title tooltip. Use when the visible text alone lacks context for screen readers (e.g. text "Toon", accessible-label "Toon wachtwoord"). The text is still shown visually in lg size regardless.
|
|
2092
|
-
* @attr {string} tooltip-timing - Forwarded to the inner nldd-tooltip's `timing`: 'delay' (the default, a 700 ms show-delay), 'instant', or 'never' (suppress the visual tooltip; screen readers still get the aria-label). Use 'never' when the surrounding context already explains the button (e.g. spin buttons in nldd-number-field, the chevron in nldd-split-button).
|
|
2093
|
-
* @attr {string} shortcut - Keyboard shortcut hint shown in the tooltip after the text, e.g. 'Alt+P'. Display only (rendered via nldd-keyboard-shortcut): it does not bind the key, wire up the handling in your app. Part of the accessible name ("Presentatiemodus Alt P"), as in nldd-menu-item. Hidden on touch-only devices, where it isn't invokable.
|
|
2094
|
-
* @attr {string} shortcut-mac - Override of `shortcut` on macOS, where the keys differ (falls back to `shortcut`).
|
|
2095
|
-
* @attr {string} shortcut-windows - Override of `shortcut` on Windows (falls back to `shortcut`).
|
|
2096
|
-
* @attr {string} shortcut-linux - Override of `shortcut` on Linux (falls back to `shortcut`).
|
|
2097
|
-
* @attr {string} href - When set, renders an <a> element instead of <button>
|
|
2098
|
-
* @attr {string} target - Link target (e.g. '_blank'); only used when href is set. With '_blank' the "opens in new tab" announcement is folded into the aria-label for screen readers (WCAG 2.1 SC 3.2.2). An `href` to another origin than the page (another website, a subdomain too) adds a visually hidden "andere website", in one sentence with the new-tab announcement when both apply; there is no way to switch it off.
|
|
2099
|
-
* @attr {string} download - Saves the file the link points at instead of opening it; only used with href. Without a value the browser takes the name from the URL, with one that is the file name. A browser ignores it for a URL on another origin and opens the file there. Adds a visually hidden "downloadt bestand" for screen readers. Leave `target` off: a download opens no tab.
|
|
2100
|
-
* @attr {string} rel - Link rel attribute, used with href; with target '_blank', 'noopener noreferrer' is added to whatever you set
|
|
2101
|
-
* @attr {object} translations - Override translation keys (e.g. the "opens in new tab" announcement); unset keys fall back to Dutch.
|
|
2102
|
-
* @attr {string} popovertarget - ID of a popover element to toggle, looked up in the tree of this button; the inner <button> gets the element. An nldd-menu or nldd-popover it points at is also positioned against this control, so it needs no `anchor`.
|
|
2103
|
-
*
|
|
2104
|
-
* @slot icon - Slot for a custom icon (e.g. custom SVG). Wins over `icon`; falls back to a placeholder icon when neither is set.
|
|
2105
|
-
* @slot popup - A single `nldd-menu` or `nldd-popover` this button invokes. Slotting it auto-anchors the overlay to the button and toggles it on click (no id/anchor wiring). The overlay syncs `expanded` and `aria-haspopup` back onto the button. Add `expandable` for the disclosure chevron. Mirrors nldd-split-button; manual `popovertarget` wiring keeps working without a slotted overlay.
|
|
2106
|
-
*
|
|
2107
|
-
* @example
|
|
2108
|
-
* ```html
|
|
2109
|
-
* <nldd-icon-button
|
|
2110
|
-
* href="/aanvraag-a-1042.pdf"
|
|
2111
|
-
* download
|
|
2112
|
-
* text="Download"
|
|
2113
|
-
* icon="download"
|
|
2114
|
-
* ></nldd-icon-button>
|
|
2115
|
-
* ```
|
|
2116
|
-
*
|
|
2117
|
-
* @fires click - When button is clicked (not fired when disabled)
|
|
2118
|
-
*/
|
|
2119
|
-
var _NLDDIconButton = class NLDDIconButton extends withTranslations(LitElement, nlddIconButtonTranslations) {
|
|
2120
|
-
constructor(..._args) {
|
|
2121
|
-
super(..._args);
|
|
2122
|
-
this._internals = internalsOf(this);
|
|
2123
|
-
this.appearance = "neutral-tinted";
|
|
2124
|
-
this.size = "md";
|
|
2125
|
-
this.hideLgText = false;
|
|
2126
|
-
this.loading = false;
|
|
2127
|
-
this.loadingText = "";
|
|
2128
|
-
this.disabled = false;
|
|
2129
|
-
this.noHighlightBorder = false;
|
|
2130
|
-
this.type = "button";
|
|
2131
|
-
this.expandable = false;
|
|
2132
|
-
this.expanded = false;
|
|
2133
|
-
this.noTab = false;
|
|
2134
|
-
this.width = "";
|
|
2135
|
-
this.popovertarget = void 0;
|
|
2136
|
-
this.popoverTargetElement = null;
|
|
2137
|
-
this.popoverTargetAction = "toggle";
|
|
2138
|
-
this.text = "";
|
|
2139
|
-
this.icon = "";
|
|
2140
|
-
this.accessibleLabel = "";
|
|
2141
|
-
this.tooltipTiming = "delay";
|
|
2142
|
-
this.shortcut = "";
|
|
2143
|
-
this.shortcutMac = "";
|
|
2144
|
-
this.shortcutWindows = "";
|
|
2145
|
-
this.shortcutLinux = "";
|
|
2146
|
-
this.href = void 0;
|
|
2147
|
-
this.target = void 0;
|
|
2148
|
-
this.download = void 0;
|
|
2149
|
-
this.rel = void 0;
|
|
2150
|
-
this._popup = new PopupAnchorController(this);
|
|
2151
|
-
this._shortcutAvailability = new ShortcutAvailabilityController(this);
|
|
2152
|
-
}
|
|
2153
|
-
/** Whether an icon is present via attribute or slot. */
|
|
2154
|
-
get _hasIcon() {
|
|
2155
|
-
if (this.icon) return true;
|
|
2156
|
-
return ((this.shadowRoot?.querySelector("slot[name=\"icon\"]"))?.assignedElements().length ?? 0) > 0;
|
|
2157
|
-
}
|
|
2158
|
-
disconnectedCallback() {
|
|
2159
|
-
super.disconnectedCallback();
|
|
2160
|
-
anchorPopoverTarget(this, null);
|
|
2161
|
-
}
|
|
2162
|
-
updated(changedProperties) {
|
|
2163
|
-
anchorPopoverTarget(this, popoverTargetOf(this, this.popovertarget, this.popoverTargetElement));
|
|
2164
|
-
if (changedProperties.has("width")) {
|
|
2165
|
-
const w = this.width;
|
|
2166
|
-
const isFull = w === "full";
|
|
2167
|
-
const isValidLength = !!w && !isFull && CSS.supports("width", w);
|
|
2168
|
-
this.style.width = isValidLength ? w : "";
|
|
2169
|
-
if (isFull || isValidLength) this.style.setProperty("--_icon-button-width", "100%");
|
|
2170
|
-
else this.style.removeProperty("--_icon-button-width");
|
|
2171
|
-
}
|
|
2172
|
-
}
|
|
2173
|
-
_handleClick(e) {
|
|
2174
|
-
if (this.disabled || this.loading) {
|
|
2175
|
-
e.preventDefault();
|
|
2176
|
-
e.stopPropagation();
|
|
2177
|
-
return;
|
|
2178
|
-
}
|
|
2179
|
-
if (e.currentTarget instanceof HTMLButtonElement) {
|
|
2180
|
-
e.currentTarget.popoverTargetElement = popoverTargetOf(this, this.popovertarget, this.popoverTargetElement);
|
|
2181
|
-
anchorPopoverTarget(this, e.currentTarget.popoverTargetElement);
|
|
2182
|
-
}
|
|
2183
|
-
if (this._popup.handleClick(e)) {
|
|
2184
|
-
e.preventDefault();
|
|
2185
|
-
return;
|
|
2186
|
-
}
|
|
2187
|
-
if (this.href) return;
|
|
2188
|
-
if (this.type === "submit") this._internals.form?.requestSubmit();
|
|
2189
|
-
else if (this.type === "reset") this._internals.form?.reset();
|
|
2190
|
-
}
|
|
2191
|
-
/**
|
|
2192
|
-
* Delegates focus to the inner `<button>` (or `<a>` when `href` is set), so
|
|
2193
|
-
* consumers can call `iconButtonEl.focus()` without reaching into shadow DOM.
|
|
2194
|
-
*/
|
|
2195
|
-
focus(options) {
|
|
2196
|
-
if (deferFocus(this, options)) return;
|
|
2197
|
-
this.shadowRoot?.querySelector(".icon-button")?.focus(options);
|
|
2198
|
-
}
|
|
2199
|
-
_onIconSlotChange() {
|
|
2200
|
-
this.requestUpdate();
|
|
2201
|
-
}
|
|
2202
|
-
render() {
|
|
2203
|
-
return template.call(this);
|
|
2204
|
-
}
|
|
2205
|
-
};
|
|
2206
|
-
var NLDDIconButton = (_NLDDIconButton.styles = iconButtonStyles, _NLDDIconButton.formAssociated = true, _NLDDIconButton);
|
|
2207
|
-
__decorate([property({
|
|
2208
|
-
reflect: true,
|
|
2209
|
-
converter: reflectNonDefault("neutral-tinted")
|
|
2210
|
-
})], NLDDIconButton.prototype, "appearance", void 0);
|
|
2211
|
-
__decorate([property({
|
|
2212
|
-
reflect: true,
|
|
2213
|
-
converter: reflectNonDefault("md")
|
|
2214
|
-
})], NLDDIconButton.prototype, "size", void 0);
|
|
2215
|
-
__decorate([property({
|
|
2216
|
-
type: Boolean,
|
|
2217
|
-
reflect: true,
|
|
2218
|
-
attribute: "hide-lg-text"
|
|
2219
|
-
})], NLDDIconButton.prototype, "hideLgText", void 0);
|
|
2220
|
-
__decorate([property({
|
|
2221
|
-
type: Boolean,
|
|
2222
|
-
reflect: true
|
|
2223
|
-
})], NLDDIconButton.prototype, "loading", void 0);
|
|
2224
|
-
__decorate([property({ attribute: "loading-text" })], NLDDIconButton.prototype, "loadingText", void 0);
|
|
2225
|
-
__decorate([property({
|
|
2226
|
-
type: Boolean,
|
|
2227
|
-
reflect: true
|
|
2228
|
-
})], NLDDIconButton.prototype, "disabled", void 0);
|
|
2229
|
-
__decorate([property({
|
|
2230
|
-
type: Boolean,
|
|
2231
|
-
reflect: true,
|
|
2232
|
-
attribute: "no-highlight-border"
|
|
2233
|
-
})], NLDDIconButton.prototype, "noHighlightBorder", void 0);
|
|
2234
|
-
__decorate([property({
|
|
2235
|
-
reflect: true,
|
|
2236
|
-
converter: reflectNonDefault("button")
|
|
2237
|
-
})], NLDDIconButton.prototype, "type", void 0);
|
|
2238
|
-
__decorate([property({
|
|
2239
|
-
type: Boolean,
|
|
2240
|
-
reflect: true,
|
|
2241
|
-
attribute: "expandable"
|
|
2242
|
-
})], NLDDIconButton.prototype, "expandable", void 0);
|
|
2243
|
-
__decorate([property({
|
|
2244
|
-
type: Boolean,
|
|
2245
|
-
reflect: true
|
|
2246
|
-
})], NLDDIconButton.prototype, "expanded", void 0);
|
|
2247
|
-
__decorate([property({
|
|
2248
|
-
type: Boolean,
|
|
2249
|
-
reflect: true,
|
|
2250
|
-
attribute: "no-tab"
|
|
2251
|
-
})], NLDDIconButton.prototype, "noTab", void 0);
|
|
2252
|
-
__decorate([property({
|
|
2253
|
-
type: String,
|
|
2254
|
-
reflect: true,
|
|
2255
|
-
attribute: "popup-type"
|
|
2256
|
-
})], NLDDIconButton.prototype, "popupType", void 0);
|
|
2257
|
-
__decorate([property({
|
|
2258
|
-
reflect: true,
|
|
2259
|
-
converter: reflectNonDefault("")
|
|
2260
|
-
})], NLDDIconButton.prototype, "width", void 0);
|
|
2261
|
-
__decorate([property({ type: String })], NLDDIconButton.prototype, "popovertarget", void 0);
|
|
2262
|
-
__decorate([property({ attribute: false })], NLDDIconButton.prototype, "popoverTargetElement", void 0);
|
|
2263
|
-
__decorate([property({ attribute: false })], NLDDIconButton.prototype, "popoverTargetAction", void 0);
|
|
2264
|
-
__decorate([property({
|
|
2265
|
-
reflect: true,
|
|
2266
|
-
converter: reflectNonDefault("")
|
|
2267
|
-
})], NLDDIconButton.prototype, "text", void 0);
|
|
2268
|
-
__decorate([property({ type: String })], NLDDIconButton.prototype, "icon", void 0);
|
|
2269
|
-
__decorate([property({
|
|
2270
|
-
type: String,
|
|
2271
|
-
attribute: "accessible-label"
|
|
2272
|
-
})], NLDDIconButton.prototype, "accessibleLabel", void 0);
|
|
2273
|
-
__decorate([property({
|
|
2274
|
-
reflect: true,
|
|
2275
|
-
attribute: "tooltip-timing",
|
|
2276
|
-
converter: reflectNonDefault("delay")
|
|
2277
|
-
})], NLDDIconButton.prototype, "tooltipTiming", void 0);
|
|
2278
|
-
__decorate([property({
|
|
2279
|
-
reflect: true,
|
|
2280
|
-
converter: reflectNonDefault("")
|
|
2281
|
-
})], NLDDIconButton.prototype, "shortcut", void 0);
|
|
2282
|
-
__decorate([property({
|
|
2283
|
-
reflect: true,
|
|
2284
|
-
attribute: "shortcut-mac",
|
|
2285
|
-
converter: reflectNonDefault("")
|
|
2286
|
-
})], NLDDIconButton.prototype, "shortcutMac", void 0);
|
|
2287
|
-
__decorate([property({
|
|
2288
|
-
reflect: true,
|
|
2289
|
-
attribute: "shortcut-windows",
|
|
2290
|
-
converter: reflectNonDefault("")
|
|
2291
|
-
})], NLDDIconButton.prototype, "shortcutWindows", void 0);
|
|
2292
|
-
__decorate([property({
|
|
2293
|
-
reflect: true,
|
|
2294
|
-
attribute: "shortcut-linux",
|
|
2295
|
-
converter: reflectNonDefault("")
|
|
2296
|
-
})], NLDDIconButton.prototype, "shortcutLinux", void 0);
|
|
2297
|
-
__decorate([property({
|
|
2298
|
-
type: String,
|
|
2299
|
-
reflect: true
|
|
2300
|
-
})], NLDDIconButton.prototype, "href", void 0);
|
|
2301
|
-
__decorate([property({ type: String })], NLDDIconButton.prototype, "target", void 0);
|
|
2302
|
-
__decorate([property({ type: String })], NLDDIconButton.prototype, "download", void 0);
|
|
2303
|
-
__decorate([property({ type: String })], NLDDIconButton.prototype, "rel", void 0);
|
|
2304
|
-
NLDDIconButton = __decorate([customElement("nldd-icon-button")], NLDDIconButton);
|
|
2305
|
-
export { releaseContext as a, anchorPopoverTarget as c, ShortcutAvailabilityController as d, hasShortcut as f, langOf as i, popoverTargetOf as l, shortcutsAvailable as m, NLDDTooltip as n, NLDDActivityIndicator as o, shortcutLabel as p, carryContext as r, PopupAnchorController as s, NLDDIconButton as t, NLDDKeyboardShortcut as u };
|