@ds-autonomie/web-components 1.0.1
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/CHANGELOG.md +318 -0
- package/LICENSE +8 -0
- package/README.md +3 -0
- package/dist/chunks/chunk.23TOS4ZE.js +29 -0
- package/dist/chunks/chunk.2FK6USFR.js +63 -0
- package/dist/chunks/chunk.2HUORR44.js +76 -0
- package/dist/chunks/chunk.3BL7JA77.js +59 -0
- package/dist/chunks/chunk.3RBCYA4F.js +147 -0
- package/dist/chunks/chunk.3XRQRY25.js +25 -0
- package/dist/chunks/chunk.42W4S2HN.js +145 -0
- package/dist/chunks/chunk.4A3WMGMZ.js +79 -0
- package/dist/chunks/chunk.4A57I2HX.js +241 -0
- package/dist/chunks/chunk.4XT2OJD2.js +75 -0
- package/dist/chunks/chunk.5LT3B7MI.js +372 -0
- package/dist/chunks/chunk.5WAZTHII.js +37 -0
- package/dist/chunks/chunk.5XL2LZLC.js +100 -0
- package/dist/chunks/chunk.5XUV3SRW.js +420 -0
- package/dist/chunks/chunk.6FAUBLR3.js +84 -0
- package/dist/chunks/chunk.6M63UXML.js +35 -0
- package/dist/chunks/chunk.6PS5KB3O.js +53 -0
- package/dist/chunks/chunk.6ZQ4OQ2C.js +51 -0
- package/dist/chunks/chunk.73T7TU6S.js +24 -0
- package/dist/chunks/chunk.7J7CS3BK.js +43 -0
- package/dist/chunks/chunk.7NWAYDYI.js +168 -0
- package/dist/chunks/chunk.7ZCCXTFG.js +301 -0
- package/dist/chunks/chunk.A2PAK6VF.js +206 -0
- package/dist/chunks/chunk.ABGBXXKA.js +164 -0
- package/dist/chunks/chunk.AQRNB4GJ.js +33 -0
- package/dist/chunks/chunk.AR5HJD7F.js +111 -0
- package/dist/chunks/chunk.B4BZKR24.js +16 -0
- package/dist/chunks/chunk.BD63GRU5.js +132 -0
- package/dist/chunks/chunk.BEB47LM2.js +278 -0
- package/dist/chunks/chunk.BLPP3Q5H.js +555 -0
- package/dist/chunks/chunk.CJIL3BLA.js +45 -0
- package/dist/chunks/chunk.CPXD6UYZ.js +34 -0
- package/dist/chunks/chunk.D7CATJYB.js +36 -0
- package/dist/chunks/chunk.DC6CT5PU.js +109 -0
- package/dist/chunks/chunk.DRGGQ4WL.js +9 -0
- package/dist/chunks/chunk.DSGUQNN4.js +26 -0
- package/dist/chunks/chunk.DURVPB6M.js +391 -0
- package/dist/chunks/chunk.DXVNWE2M.js +166 -0
- package/dist/chunks/chunk.EFQHAGXP.js +26 -0
- package/dist/chunks/chunk.EHVJT7BH.js +215 -0
- package/dist/chunks/chunk.EKWYMXQO.js +166 -0
- package/dist/chunks/chunk.EMIT7S33.js +71 -0
- package/dist/chunks/chunk.EMJZLQCL.js +60 -0
- package/dist/chunks/chunk.ENKP2IFW.js +361 -0
- package/dist/chunks/chunk.EU56EW33.js +91 -0
- package/dist/chunks/chunk.EYZGEU3G.js +45 -0
- package/dist/chunks/chunk.FDYFSRSX.js +33 -0
- package/dist/chunks/chunk.FIGO7UV2.js +77 -0
- package/dist/chunks/chunk.G7AELPSO.js +131 -0
- package/dist/chunks/chunk.GI7VDIWX.js +24 -0
- package/dist/chunks/chunk.GYTA2LJC.js +145 -0
- package/dist/chunks/chunk.HAL7R4WT.js +0 -0
- package/dist/chunks/chunk.HC5BO5YV.js +405 -0
- package/dist/chunks/chunk.HH63FIEF.js +122 -0
- package/dist/chunks/chunk.HLYGKGDG.js +308 -0
- package/dist/chunks/chunk.I33L3NO6.js +122 -0
- package/dist/chunks/chunk.IGYXUK7A.js +19 -0
- package/dist/chunks/chunk.INCGVIAQ.js +61 -0
- package/dist/chunks/chunk.IOFPPNUO.js +25 -0
- package/dist/chunks/chunk.IRQOFNJE.js +317 -0
- package/dist/chunks/chunk.ISAFRNR2.js +112 -0
- package/dist/chunks/chunk.J2XNYTTZ.js +715 -0
- package/dist/chunks/chunk.JETXIC4F.js +150 -0
- package/dist/chunks/chunk.JT7UJED5.js +33 -0
- package/dist/chunks/chunk.K6WCEYZI.js +52 -0
- package/dist/chunks/chunk.KBT2EKLF.js +25 -0
- package/dist/chunks/chunk.KDAK2GXX.js +58 -0
- package/dist/chunks/chunk.KHIMMW3T.js +33 -0
- package/dist/chunks/chunk.KIFBWPW5.js +298 -0
- package/dist/chunks/chunk.KOH5V4C6.js +552 -0
- package/dist/chunks/chunk.LC54322H.js +99 -0
- package/dist/chunks/chunk.LMJPQPQT.js +26 -0
- package/dist/chunks/chunk.LT7JMZ3T.js +371 -0
- package/dist/chunks/chunk.M245ZGRR.js +80 -0
- package/dist/chunks/chunk.MOWTZFON.js +63 -0
- package/dist/chunks/chunk.MY434P47.js +125 -0
- package/dist/chunks/chunk.N6VVY6XD.js +91 -0
- package/dist/chunks/chunk.NDEZEB3Z.js +402 -0
- package/dist/chunks/chunk.NHRDZGLI.js +81 -0
- package/dist/chunks/chunk.NKKVGICB.js +114 -0
- package/dist/chunks/chunk.NNBOLKWI.js +17 -0
- package/dist/chunks/chunk.O73OYTYJ.js +319 -0
- package/dist/chunks/chunk.OBU65KDL.js +29 -0
- package/dist/chunks/chunk.ODSCDJDO.js +91 -0
- package/dist/chunks/chunk.OVK7QCA7.js +441 -0
- package/dist/chunks/chunk.PQWQ42E2.js +150 -0
- package/dist/chunks/chunk.PULHNCDM.js +98 -0
- package/dist/chunks/chunk.PWWER3ZK.js +806 -0
- package/dist/chunks/chunk.QFJA3MTV.js +66 -0
- package/dist/chunks/chunk.QKNNLZ2M.js +361 -0
- package/dist/chunks/chunk.QL5C2XOW.js +0 -0
- package/dist/chunks/chunk.RDGMZ5XB.js +24 -0
- package/dist/chunks/chunk.RIJQGADY.js +108 -0
- package/dist/chunks/chunk.RMCOWJOW.js +17 -0
- package/dist/chunks/chunk.RY4QCT3T.js +29 -0
- package/dist/chunks/chunk.S4ATPBQN.js +89 -0
- package/dist/chunks/chunk.SGIGGO5M.js +86 -0
- package/dist/chunks/chunk.SQMWMSBA.js +207 -0
- package/dist/chunks/chunk.TJOP7HQP.js +14 -0
- package/dist/chunks/chunk.TUVJKY7S.js +21 -0
- package/dist/chunks/chunk.UA32LJYW.js +230 -0
- package/dist/chunks/chunk.UEUTSYIH.js +60 -0
- package/dist/chunks/chunk.UPYCV66H.js +111 -0
- package/dist/chunks/chunk.UV53JTE3.js +128 -0
- package/dist/chunks/chunk.UZLQVFDR.js +386 -0
- package/dist/chunks/chunk.V7RJROLH.js +48 -0
- package/dist/chunks/chunk.VFYKLPN2.js +144 -0
- package/dist/chunks/chunk.VRY3E2XG.js +196 -0
- package/dist/chunks/chunk.WE6IG5XG.js +164 -0
- package/dist/chunks/chunk.WFHOSUOX.js +263 -0
- package/dist/chunks/chunk.WHK7EFIM.js +264 -0
- package/dist/chunks/chunk.WIEJJS3W.js +88 -0
- package/dist/chunks/chunk.WK7RWLAK.js +54 -0
- package/dist/chunks/chunk.WNHQYL5W.js +298 -0
- package/dist/chunks/chunk.WSVP75MH.js +102 -0
- package/dist/chunks/chunk.XNEONNEJ.js +23 -0
- package/dist/chunks/chunk.XSCX6TC5.js +127 -0
- package/dist/chunks/chunk.XWUQFDIN.js +15 -0
- package/dist/chunks/chunk.Y3ZUFLVS.js +90 -0
- package/dist/chunks/chunk.YCXTCVAZ.js +30 -0
- package/dist/chunks/chunk.YIY5RM53.js +66 -0
- package/dist/chunks/chunk.YL3TSWVM.js +17 -0
- package/dist/chunks/chunk.YS7MY5CH.js +512 -0
- package/dist/chunks/chunk.YY6AEXJK.js +33 -0
- package/dist/chunks/chunk.YZHDFJWJ.js +17 -0
- package/dist/chunks/chunk.Z6TBD2AC.js +125 -0
- package/dist/chunks/chunk.ZKYSHEVZ.js +22 -0
- package/dist/chunks/chunk.ZVGZDTBF.js +104 -0
- package/dist/components/accordion/accordion.d.ts +49 -0
- package/dist/components/accordion/accordion.js +23 -0
- package/dist/components/accordion/accordion.styles.d.ts +2 -0
- package/dist/components/accordion/accordion.styles.js +8 -0
- package/dist/components/alert/alert.d.ts +52 -0
- package/dist/components/alert/alert.js +25 -0
- package/dist/components/alert/alert.styles.d.ts +2 -0
- package/dist/components/alert/alert.styles.js +8 -0
- package/dist/components/animation/animation.d.ts +81 -0
- package/dist/components/animation/animation.js +12 -0
- package/dist/components/animation/animation.styles.d.ts +2 -0
- package/dist/components/animation/animation.styles.js +8 -0
- package/dist/components/animation/animations.d.ts +6 -0
- package/dist/components/animation/animations.js +11 -0
- package/dist/components/avatar/avatar.d.ts +42 -0
- package/dist/components/avatar/avatar.js +19 -0
- package/dist/components/avatar/avatar.styles.d.ts +2 -0
- package/dist/components/avatar/avatar.styles.js +8 -0
- package/dist/components/avatar-group/avatar-group.d.ts +21 -0
- package/dist/components/avatar-group/avatar-group.js +9 -0
- package/dist/components/avatar-group/avatar-group.styles.d.ts +2 -0
- package/dist/components/avatar-group/avatar-group.styles.js +7 -0
- package/dist/components/badge/badge.d.ts +23 -0
- package/dist/components/badge/badge.js +10 -0
- package/dist/components/badge/badge.styles.d.ts +2 -0
- package/dist/components/badge/badge.styles.js +8 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +23 -0
- package/dist/components/breadcrumb/breadcrumb.js +20 -0
- package/dist/components/breadcrumb/breadcrumb.styles.d.ts +2 -0
- package/dist/components/breadcrumb/breadcrumb.styles.js +8 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.d.ts +30 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.js +12 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.styles.d.ts +2 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.styles.js +8 -0
- package/dist/components/button/button.d.ts +120 -0
- package/dist/components/button/button.js +24 -0
- package/dist/components/button/button.styles.d.ts +2 -0
- package/dist/components/button/button.styles.js +8 -0
- package/dist/components/card/card.d.ts +22 -0
- package/dist/components/card/card.js +11 -0
- package/dist/components/card/card.styles.d.ts +2 -0
- package/dist/components/card/card.styles.js +8 -0
- package/dist/components/checkbox/checkbox.d.ts +93 -0
- package/dist/components/checkbox/checkbox.js +24 -0
- package/dist/components/checkbox/checkbox.styles.d.ts +2 -0
- package/dist/components/checkbox/checkbox.styles.js +9 -0
- package/dist/components/checkbox-button/checkbox-button.d.ts +48 -0
- package/dist/components/checkbox-button/checkbox-button.js +21 -0
- package/dist/components/checkbox-button/checkbox-button.styles.d.ts +2 -0
- package/dist/components/checkbox-button/checkbox-button.styles.js +9 -0
- package/dist/components/checkbox-group/checkbox-group.d.ts +85 -0
- package/dist/components/checkbox-group/checkbox-group.js +16 -0
- package/dist/components/checkbox-group/checkbox-group.styles.d.ts +2 -0
- package/dist/components/checkbox-group/checkbox-group.styles.js +9 -0
- package/dist/components/dialog/dialog.d.ts +70 -0
- package/dist/components/dialog/dialog.js +28 -0
- package/dist/components/dialog/dialog.styles.d.ts +2 -0
- package/dist/components/dialog/dialog.styles.js +8 -0
- package/dist/components/divider/divider.d.ts +17 -0
- package/dist/components/divider/divider.js +10 -0
- package/dist/components/divider/divider.styles.d.ts +2 -0
- package/dist/components/divider/divider.styles.js +8 -0
- package/dist/components/drawer/drawer.d.ts +77 -0
- package/dist/components/drawer/drawer.js +28 -0
- package/dist/components/drawer/drawer.styles.d.ts +2 -0
- package/dist/components/drawer/drawer.styles.js +8 -0
- package/dist/components/dropdown/dropdown.d.ts +87 -0
- package/dist/components/dropdown/dropdown.js +15 -0
- package/dist/components/dropdown/dropdown.styles.d.ts +2 -0
- package/dist/components/dropdown/dropdown.styles.js +8 -0
- package/dist/components/error-text/error-text.d.ts +18 -0
- package/dist/components/error-text/error-text.js +9 -0
- package/dist/components/error-text/error-text.styles.d.ts +2 -0
- package/dist/components/error-text/error-text.styles.js +7 -0
- package/dist/components/format-bytes/format-bytes.d.ts +22 -0
- package/dist/components/format-bytes/format-bytes.js +9 -0
- package/dist/components/format-date/format-date.d.ts +42 -0
- package/dist/components/format-date/format-date.js +9 -0
- package/dist/components/format-number/format-number.d.ts +36 -0
- package/dist/components/format-number/format-number.js +9 -0
- package/dist/components/icon/icon.d.ts +40 -0
- package/dist/components/icon/icon.js +17 -0
- package/dist/components/icon/icon.styles.d.ts +2 -0
- package/dist/components/icon/icon.styles.js +8 -0
- package/dist/components/icon/library.d.ts +21 -0
- package/dist/components/icon/library.default.d.ts +3 -0
- package/dist/components/icon/library.default.js +8 -0
- package/dist/components/icon/library.js +18 -0
- package/dist/components/icon/library.system.d.ts +3 -0
- package/dist/components/icon/library.system.js +7 -0
- package/dist/components/icon/request.d.ts +11 -0
- package/dist/components/icon/request.js +8 -0
- package/dist/components/icon-button/icon-button.d.ts +59 -0
- package/dist/components/icon-button/icon-button.js +19 -0
- package/dist/components/icon-button/icon-button.styles.d.ts +2 -0
- package/dist/components/icon-button/icon-button.styles.js +8 -0
- package/dist/components/include/include.d.ts +32 -0
- package/dist/components/include/include.js +12 -0
- package/dist/components/include/include.styles.d.ts +2 -0
- package/dist/components/include/include.styles.js +8 -0
- package/dist/components/include/request.d.ts +8 -0
- package/dist/components/include/request.js +7 -0
- package/dist/components/input/input.d.ts +165 -0
- package/dist/components/input/input.js +27 -0
- package/dist/components/input/input.styles.d.ts +2 -0
- package/dist/components/input/input.styles.js +9 -0
- package/dist/components/input/input.utils.d.ts +4 -0
- package/dist/components/input/input.utils.js +9 -0
- package/dist/components/input-mask/input-mask.configs.d.ts +42 -0
- package/dist/components/input-mask/input-mask.configs.js +11 -0
- package/dist/components/input-mask/input-mask.d.ts +127 -0
- package/dist/components/input-mask/input-mask.js +19 -0
- package/dist/components/input-mask/input-mask.styles.d.ts +2 -0
- package/dist/components/input-mask/input-mask.styles.js +9 -0
- package/dist/components/input-mask/input-mask.utils.d.ts +7 -0
- package/dist/components/input-mask/input-mask.utils.js +19 -0
- package/dist/components/input-phone/input-phone.configs.d.ts +14 -0
- package/dist/components/input-phone/input-phone.configs.js +7 -0
- package/dist/components/input-phone/input-phone.d.ts +138 -0
- package/dist/components/input-phone/input-phone.js +49 -0
- package/dist/components/input-phone/input-phone.styles.d.ts +2 -0
- package/dist/components/input-phone/input-phone.styles.js +9 -0
- package/dist/components/input-phone/input-phone.utils.d.ts +9 -0
- package/dist/components/input-phone/input-phone.utils.js +13 -0
- package/dist/components/menu/menu.d.ts +43 -0
- package/dist/components/menu/menu.js +10 -0
- package/dist/components/menu/menu.styles.d.ts +2 -0
- package/dist/components/menu/menu.styles.js +8 -0
- package/dist/components/menu-item/menu-item.d.ts +44 -0
- package/dist/components/menu-item/menu-item.js +20 -0
- package/dist/components/menu-item/menu-item.styles.d.ts +2 -0
- package/dist/components/menu-item/menu-item.styles.js +8 -0
- package/dist/components/menu-label/menu-label.d.ts +17 -0
- package/dist/components/menu-label/menu-label.js +10 -0
- package/dist/components/menu-label/menu-label.styles.d.ts +2 -0
- package/dist/components/menu-label/menu-label.styles.js +8 -0
- package/dist/components/mutation-observer/mutation-observer.d.ts +44 -0
- package/dist/components/mutation-observer/mutation-observer.js +11 -0
- package/dist/components/mutation-observer/mutation-observer.styles.d.ts +2 -0
- package/dist/components/mutation-observer/mutation-observer.styles.js +8 -0
- package/dist/components/option/option.d.ts +50 -0
- package/dist/components/option/option.js +20 -0
- package/dist/components/option/option.styles.d.ts +2 -0
- package/dist/components/option/option.styles.js +8 -0
- package/dist/components/popup/popup.d.ts +123 -0
- package/dist/components/popup/popup.js +10 -0
- package/dist/components/popup/popup.styles.d.ts +2 -0
- package/dist/components/popup/popup.styles.js +8 -0
- package/dist/components/progress-bar/progress-bar.d.ts +23 -0
- package/dist/components/progress-bar/progress-bar.js +11 -0
- package/dist/components/progress-bar/progress-bar.styles.d.ts +2 -0
- package/dist/components/progress-bar/progress-bar.styles.js +8 -0
- package/dist/components/progress-ring/progress-ring.d.ts +25 -0
- package/dist/components/progress-ring/progress-ring.js +11 -0
- package/dist/components/progress-ring/progress-ring.styles.d.ts +2 -0
- package/dist/components/progress-ring/progress-ring.styles.js +8 -0
- package/dist/components/radio/radio.d.ts +46 -0
- package/dist/components/radio/radio.js +19 -0
- package/dist/components/radio/radio.styles.d.ts +2 -0
- package/dist/components/radio/radio.styles.js +8 -0
- package/dist/components/radio-button/radio-button.d.ts +47 -0
- package/dist/components/radio-button/radio-button.js +13 -0
- package/dist/components/radio-button/radio-button.styles.d.ts +2 -0
- package/dist/components/radio-button/radio-button.styles.js +9 -0
- package/dist/components/radio-group/radio-group.d.ts +91 -0
- package/dist/components/radio-group/radio-group.js +16 -0
- package/dist/components/radio-group/radio-group.styles.d.ts +2 -0
- package/dist/components/radio-group/radio-group.styles.js +9 -0
- package/dist/components/relative-time/relative-time.d.ts +34 -0
- package/dist/components/relative-time/relative-time.js +9 -0
- package/dist/components/resize-observer/resize-observer.d.ts +31 -0
- package/dist/components/resize-observer/resize-observer.js +11 -0
- package/dist/components/resize-observer/resize-observer.styles.d.ts +2 -0
- package/dist/components/resize-observer/resize-observer.styles.js +8 -0
- package/dist/components/select/select.d.ts +166 -0
- package/dist/components/select/select.js +36 -0
- package/dist/components/select/select.styles.d.ts +2 -0
- package/dist/components/select/select.styles.js +9 -0
- package/dist/components/skeleton/skeleton.d.ts +21 -0
- package/dist/components/skeleton/skeleton.js +10 -0
- package/dist/components/skeleton/skeleton.styles.d.ts +2 -0
- package/dist/components/skeleton/skeleton.styles.js +8 -0
- package/dist/components/spinner/spinner.d.ts +21 -0
- package/dist/components/spinner/spinner.js +11 -0
- package/dist/components/spinner/spinner.styles.d.ts +2 -0
- package/dist/components/spinner/spinner.styles.js +8 -0
- package/dist/components/tab/tab.d.ts +44 -0
- package/dist/components/tab/tab.js +12 -0
- package/dist/components/tab/tab.styles.d.ts +2 -0
- package/dist/components/tab/tab.styles.js +8 -0
- package/dist/components/tab-group/tab-group.d.ts +61 -0
- package/dist/components/tab-group/tab-group.js +13 -0
- package/dist/components/tab-group/tab-group.styles.d.ts +2 -0
- package/dist/components/tab-group/tab-group.styles.js +8 -0
- package/dist/components/tab-panel/tab-panel.d.ts +25 -0
- package/dist/components/tab-panel/tab-panel.js +11 -0
- package/dist/components/tab-panel/tab-panel.styles.d.ts +2 -0
- package/dist/components/tab-panel/tab-panel.styles.js +8 -0
- package/dist/components/tag/tag.d.ts +34 -0
- package/dist/components/tag/tag.js +22 -0
- package/dist/components/tag/tag.styles.d.ts +2 -0
- package/dist/components/tag/tag.styles.js +8 -0
- package/dist/components/textarea/textarea.d.ts +137 -0
- package/dist/components/textarea/textarea.js +17 -0
- package/dist/components/textarea/textarea.styles.d.ts +2 -0
- package/dist/components/textarea/textarea.styles.js +9 -0
- package/dist/components/tooltip/tooltip.d.ts +80 -0
- package/dist/components/tooltip/tooltip.js +17 -0
- package/dist/components/tooltip/tooltip.styles.d.ts +2 -0
- package/dist/components/tooltip/tooltip.styles.js +8 -0
- package/dist/components/tree/tree.d.ts +53 -0
- package/dist/components/tree/tree.js +33 -0
- package/dist/components/tree/tree.styles.d.ts +2 -0
- package/dist/components/tree/tree.styles.js +8 -0
- package/dist/components/tree-item/tree-item.d.ts +69 -0
- package/dist/components/tree-item/tree-item.js +31 -0
- package/dist/components/tree-item/tree-item.styles.d.ts +2 -0
- package/dist/components/tree-item/tree-item.styles.js +8 -0
- package/dist/components/visually-hidden/visually-hidden.d.ts +17 -0
- package/dist/components/visually-hidden/visually-hidden.js +10 -0
- package/dist/components/visually-hidden/visually-hidden.styles.d.ts +2 -0
- package/dist/components/visually-hidden/visually-hidden.styles.js +8 -0
- package/dist/custom-elements.json +14628 -0
- package/dist/design-system-autoloader.d.ts +4 -0
- package/dist/design-system-autoloader.js +46 -0
- package/dist/design-system.d.ts +58 -0
- package/dist/design-system.js +309 -0
- package/dist/events/dsa-after-collapse.d.ts +7 -0
- package/dist/events/dsa-after-collapse.js +1 -0
- package/dist/events/dsa-after-expand.d.ts +7 -0
- package/dist/events/dsa-after-expand.js +1 -0
- package/dist/events/dsa-after-hide.d.ts +7 -0
- package/dist/events/dsa-after-hide.js +1 -0
- package/dist/events/dsa-after-show.d.ts +7 -0
- package/dist/events/dsa-after-show.js +1 -0
- package/dist/events/dsa-blur.d.ts +7 -0
- package/dist/events/dsa-blur.js +1 -0
- package/dist/events/dsa-cancel.d.ts +7 -0
- package/dist/events/dsa-cancel.js +1 -0
- package/dist/events/dsa-change.d.ts +7 -0
- package/dist/events/dsa-change.js +1 -0
- package/dist/events/dsa-clear.d.ts +7 -0
- package/dist/events/dsa-clear.js +1 -0
- package/dist/events/dsa-close.d.ts +7 -0
- package/dist/events/dsa-close.js +1 -0
- package/dist/events/dsa-collapse.d.ts +7 -0
- package/dist/events/dsa-collapse.js +1 -0
- package/dist/events/dsa-error.d.ts +9 -0
- package/dist/events/dsa-error.js +1 -0
- package/dist/events/dsa-expand.d.ts +7 -0
- package/dist/events/dsa-expand.js +1 -0
- package/dist/events/dsa-finish.d.ts +7 -0
- package/dist/events/dsa-finish.js +1 -0
- package/dist/events/dsa-focus.d.ts +7 -0
- package/dist/events/dsa-focus.js +1 -0
- package/dist/events/dsa-hide.d.ts +7 -0
- package/dist/events/dsa-hide.js +1 -0
- package/dist/events/dsa-hover.d.ts +10 -0
- package/dist/events/dsa-hover.js +1 -0
- package/dist/events/dsa-initial-focus.d.ts +7 -0
- package/dist/events/dsa-initial-focus.js +1 -0
- package/dist/events/dsa-input.d.ts +7 -0
- package/dist/events/dsa-input.js +1 -0
- package/dist/events/dsa-invalid.d.ts +7 -0
- package/dist/events/dsa-invalid.js +1 -0
- package/dist/events/dsa-lazy-change.d.ts +7 -0
- package/dist/events/dsa-lazy-change.js +1 -0
- package/dist/events/dsa-lazy-load.d.ts +7 -0
- package/dist/events/dsa-lazy-load.js +1 -0
- package/dist/events/dsa-load.d.ts +7 -0
- package/dist/events/dsa-load.js +1 -0
- package/dist/events/dsa-mutation.d.ts +9 -0
- package/dist/events/dsa-mutation.js +1 -0
- package/dist/events/dsa-remove.d.ts +7 -0
- package/dist/events/dsa-remove.js +1 -0
- package/dist/events/dsa-reposition.d.ts +7 -0
- package/dist/events/dsa-reposition.js +1 -0
- package/dist/events/dsa-request-close.d.ts +9 -0
- package/dist/events/dsa-request-close.js +1 -0
- package/dist/events/dsa-resize.d.ts +9 -0
- package/dist/events/dsa-resize.js +1 -0
- package/dist/events/dsa-select.d.ts +10 -0
- package/dist/events/dsa-select.js +1 -0
- package/dist/events/dsa-selection-change.d.ts +10 -0
- package/dist/events/dsa-selection-change.js +1 -0
- package/dist/events/dsa-show.d.ts +7 -0
- package/dist/events/dsa-show.js +1 -0
- package/dist/events/dsa-start.d.ts +7 -0
- package/dist/events/dsa-start.js +1 -0
- package/dist/events/dsa-tab-hide.d.ts +9 -0
- package/dist/events/dsa-tab-hide.js +1 -0
- package/dist/events/dsa-tab-show.d.ts +9 -0
- package/dist/events/dsa-tab-show.js +1 -0
- package/dist/events/events.d.ts +32 -0
- package/dist/events/events.js +1 -0
- package/dist/internal/animate.d.ts +22 -0
- package/dist/internal/animate.js +56 -0
- package/dist/internal/components/button-group/button-group.d.ts +34 -0
- package/dist/internal/components/button-group/button-group.js +110 -0
- package/dist/internal/components/button-group/button-group.styles.d.ts +2 -0
- package/dist/internal/components/button-group/button-group.styles.js +19 -0
- package/dist/internal/debounce.d.ts +1 -0
- package/dist/internal/debounce.js +26 -0
- package/dist/internal/default-value.d.ts +2 -0
- package/dist/internal/default-value.js +38 -0
- package/dist/internal/drag.d.ts +15 -0
- package/dist/internal/drag.js +27 -0
- package/dist/internal/event.d.ts +2 -0
- package/dist/internal/event.js +12 -0
- package/dist/internal/form.d.ts +73 -0
- package/dist/internal/form.js +328 -0
- package/dist/internal/math.d.ts +2 -0
- package/dist/internal/math.js +11 -0
- package/dist/internal/modal.d.ts +12 -0
- package/dist/internal/modal.js +51 -0
- package/dist/internal/offset.d.ts +11 -0
- package/dist/internal/offset.js +13 -0
- package/dist/internal/scroll.d.ts +11 -0
- package/dist/internal/scroll.js +63 -0
- package/dist/internal/shoelace-element.d.ts +43 -0
- package/dist/internal/shoelace-element.js +21 -0
- package/dist/internal/slot.d.ts +23 -0
- package/dist/internal/slot.js +84 -0
- package/dist/internal/string.d.ts +2 -0
- package/dist/internal/string.js +4 -0
- package/dist/internal/tabbable.d.ts +8 -0
- package/dist/internal/tabbable.js +79 -0
- package/dist/internal/test/data-testid-helpers.d.ts +12 -0
- package/dist/internal/test/data-testid-helpers.js +14 -0
- package/dist/internal/test/element-visible-overflow.d.ts +11 -0
- package/dist/internal/test/element-visible-overflow.js +18 -0
- package/dist/internal/test/form-control-base-tests.d.ts +7 -0
- package/dist/internal/test/form-control-base-tests.js +262 -0
- package/dist/internal/test/wait-for-scrolling.d.ts +9 -0
- package/dist/internal/test/wait-for-scrolling.js +34 -0
- package/dist/internal/test.d.ts +20 -0
- package/dist/internal/test.js +71 -0
- package/dist/internal/watch.d.ts +26 -0
- package/dist/internal/watch.js +38 -0
- package/dist/styles/component.styles.d.ts +2 -0
- package/dist/styles/component.styles.js +16 -0
- package/dist/styles/form-control.styles.d.ts +2 -0
- package/dist/styles/form-control.styles.js +142 -0
- package/dist/themes/dsa-wc-theme.css +1218 -0
- package/dist/themes/dsa-wc-theme.min.css +1 -0
- package/dist/themes/dsa-wc-theme.styles.js +1229 -0
- package/dist/translations/en-gb.d.ts +3 -0
- package/dist/translations/en-gb.js +21 -0
- package/dist/translations/en.d.ts +3 -0
- package/dist/translations/en.js +7 -0
- package/dist/translations/fr.d.ts +3 -0
- package/dist/translations/fr.js +7 -0
- package/dist/utilities/animation-registry.d.ts +24 -0
- package/dist/utilities/animation-registry.js +11 -0
- package/dist/utilities/animation.d.ts +1 -0
- package/dist/utilities/animation.js +10 -0
- package/dist/utilities/base-path.d.ts +18 -0
- package/dist/utilities/base-path.js +9 -0
- package/dist/utilities/form.d.ts +11 -0
- package/dist/utilities/form.js +43 -0
- package/dist/utilities/icon-library.d.ts +1 -0
- package/dist/utilities/icon-library.js +13 -0
- package/dist/utilities/localize.d.ts +39 -0
- package/dist/utilities/localize.js +9 -0
- package/dist/utilities/storybook.d.ts +46 -0
- package/dist/utilities/storybook.js +54 -0
- package/dist/vscode.html-custom-data.json +2392 -0
- package/dist/web-types.json +8687 -0
- package/package.json +109 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
/** A reactive controller that determines when slots exist. */
|
|
3
|
+
export declare class HasSlotController implements ReactiveController {
|
|
4
|
+
host: ReactiveControllerHost & Element;
|
|
5
|
+
slotNames: string[];
|
|
6
|
+
constructor(host: ReactiveControllerHost & Element, ...slotNames: string[]);
|
|
7
|
+
private hasDefaultSlot;
|
|
8
|
+
private hasNamedSlot;
|
|
9
|
+
test(slotName: string): boolean;
|
|
10
|
+
hostConnected(): void;
|
|
11
|
+
hostDisconnected(): void;
|
|
12
|
+
handleSlotChange(event: Event): void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Given a slot, this function iterates over all of its assigned element and text nodes and returns the concatenated
|
|
16
|
+
* HTML as a string. This is useful because we can't use slot.innerHTML as an alternative.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getInnerHTML(slot: HTMLSlotElement): string;
|
|
19
|
+
/**
|
|
20
|
+
* Given a slot, this function iterates over all of its assigned text nodes and returns the concatenated text as a
|
|
21
|
+
* string. This is useful because we can't use slot.textContent as an alternative.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getTextContent(slot: HTMLSlotElement | undefined | null): string;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/** A reactive controller that determines when slots exist. */
|
|
2
|
+
export class HasSlotController {
|
|
3
|
+
constructor(host, ...slotNames) {
|
|
4
|
+
this.slotNames = [];
|
|
5
|
+
(this.host = host).addController(this);
|
|
6
|
+
this.slotNames = slotNames;
|
|
7
|
+
this.handleSlotChange = this.handleSlotChange.bind(this);
|
|
8
|
+
}
|
|
9
|
+
hasDefaultSlot() {
|
|
10
|
+
return [...this.host.childNodes].some((node) => {
|
|
11
|
+
if (node.nodeType === node.TEXT_NODE && node.textContent.trim() !== '') {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
if (node.nodeType === node.ELEMENT_NODE) {
|
|
15
|
+
const el = node;
|
|
16
|
+
const tagName = el.tagName.toLowerCase();
|
|
17
|
+
// Ignore visually hidden elements since they aren't rendered
|
|
18
|
+
if (tagName === 'dsa-visually-hidden') {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
// If it doesn't have a slot attribute, it's part of the default slot
|
|
22
|
+
if (!el.hasAttribute('slot')) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
hasNamedSlot(name) {
|
|
30
|
+
return this.host.querySelector(`:scope > [slot="${name}"]`) !== null;
|
|
31
|
+
}
|
|
32
|
+
test(slotName) {
|
|
33
|
+
return slotName === '[default]'
|
|
34
|
+
? this.hasDefaultSlot()
|
|
35
|
+
: this.hasNamedSlot(slotName);
|
|
36
|
+
}
|
|
37
|
+
hostConnected() {
|
|
38
|
+
this.host.shadowRoot.addEventListener('slotchange', this.handleSlotChange);
|
|
39
|
+
}
|
|
40
|
+
hostDisconnected() {
|
|
41
|
+
this.host.shadowRoot.removeEventListener('slotchange', this.handleSlotChange);
|
|
42
|
+
}
|
|
43
|
+
handleSlotChange(event) {
|
|
44
|
+
const slot = event.target;
|
|
45
|
+
if ((this.slotNames.includes('[default]') && !slot.name) ||
|
|
46
|
+
(slot.name && this.slotNames.includes(slot.name))) {
|
|
47
|
+
this.host.requestUpdate();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Given a slot, this function iterates over all of its assigned element and text nodes and returns the concatenated
|
|
53
|
+
* HTML as a string. This is useful because we can't use slot.innerHTML as an alternative.
|
|
54
|
+
*/
|
|
55
|
+
export function getInnerHTML(slot) {
|
|
56
|
+
const nodes = slot.assignedNodes({ flatten: true });
|
|
57
|
+
let html = '';
|
|
58
|
+
[...nodes].forEach((node) => {
|
|
59
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
60
|
+
html += node.outerHTML;
|
|
61
|
+
}
|
|
62
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
63
|
+
html += node.textContent;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return html;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Given a slot, this function iterates over all of its assigned text nodes and returns the concatenated text as a
|
|
70
|
+
* string. This is useful because we can't use slot.textContent as an alternative.
|
|
71
|
+
*/
|
|
72
|
+
export function getTextContent(slot) {
|
|
73
|
+
if (!slot) {
|
|
74
|
+
return '';
|
|
75
|
+
}
|
|
76
|
+
const nodes = slot.assignedNodes({ flatten: true });
|
|
77
|
+
let text = '';
|
|
78
|
+
[...nodes].forEach((node) => {
|
|
79
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
80
|
+
text += node.textContent;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return text;
|
|
84
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the first and last bounding elements that are tabbable. This is more performant than checking every single
|
|
3
|
+
* element because it short-circuits after finding the first and last ones.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getTabbableBoundary(root: HTMLElement | ShadowRoot): {
|
|
6
|
+
start: HTMLElement | null;
|
|
7
|
+
end: HTMLElement | null;
|
|
8
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/** Determines if the specified element is tabbable using heuristics inspired by https://github.com/focus-trap/tabbable */
|
|
2
|
+
function isTabbable(el) {
|
|
3
|
+
const tag = el.tagName.toLowerCase();
|
|
4
|
+
// Elements with a -1 tab index are not tabbable
|
|
5
|
+
if (el.getAttribute('tabindex') === '-1') {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
// Elements with a disabled attribute are not tabbable
|
|
9
|
+
if (el.hasAttribute('disabled')) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
// Elements with aria-disabled are not tabbable
|
|
13
|
+
if (el.hasAttribute('aria-disabled') &&
|
|
14
|
+
el.getAttribute('aria-disabled') !== 'false') {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
// Radios without a checked attribute are not tabbable
|
|
18
|
+
if (tag === 'input' &&
|
|
19
|
+
el.getAttribute('type') === 'radio' &&
|
|
20
|
+
!el.hasAttribute('checked')) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
// Elements that are hidden have no offsetParent and are not tabbable
|
|
24
|
+
if (el.offsetParent === null) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
// Elements without visibility are not tabbable
|
|
28
|
+
if (window.getComputedStyle(el).visibility === 'hidden') {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
// Audio and video elements with the controls attribute are tabbable
|
|
32
|
+
if ((tag === 'audio' || tag === 'video') && el.hasAttribute('controls')) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
// Elements with a tabindex other than -1 are tabbable
|
|
36
|
+
if (el.hasAttribute('tabindex')) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
// Elements with a contenteditable attribute are tabbable
|
|
40
|
+
if (el.hasAttribute('contenteditable') &&
|
|
41
|
+
el.getAttribute('contenteditable') !== 'false') {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
// At this point, the following elements are considered tabbable
|
|
45
|
+
return [
|
|
46
|
+
'button',
|
|
47
|
+
'input',
|
|
48
|
+
'select',
|
|
49
|
+
'textarea',
|
|
50
|
+
'a',
|
|
51
|
+
'audio',
|
|
52
|
+
'video',
|
|
53
|
+
'summary',
|
|
54
|
+
].includes(tag);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Returns the first and last bounding elements that are tabbable. This is more performant than checking every single
|
|
58
|
+
* element because it short-circuits after finding the first and last ones.
|
|
59
|
+
*/
|
|
60
|
+
export function getTabbableBoundary(root) {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
const allElements = [];
|
|
63
|
+
function walk(el) {
|
|
64
|
+
if (el instanceof HTMLElement) {
|
|
65
|
+
allElements.push(el);
|
|
66
|
+
if (el.shadowRoot !== null && el.shadowRoot.mode === 'open') {
|
|
67
|
+
walk(el.shadowRoot);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// @ts-expect-error cleanup upon implementation
|
|
71
|
+
[...el.children].forEach((e) => walk(e));
|
|
72
|
+
}
|
|
73
|
+
// Collect all elements including the root
|
|
74
|
+
walk(root);
|
|
75
|
+
// Find the first and last tabbable elements
|
|
76
|
+
const start = (_a = allElements.find((el) => isTabbable(el))) !== null && _a !== void 0 ? _a : null;
|
|
77
|
+
const end = (_b = allElements.reverse().find((el) => isTabbable(el))) !== null && _b !== void 0 ? _b : null;
|
|
78
|
+
return { start, end };
|
|
79
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allows you to find a DOM element based on the value of its `data-testid` attribute.
|
|
3
|
+
* This attribute can be used to decouple identifying dom elements for testing from
|
|
4
|
+
* styling (which is typically done via class selectors) or other ids which serve
|
|
5
|
+
* different purposes.
|
|
6
|
+
* See also https://kentcdodds.com/blog/making-your-ui-tests-resilient-to-change
|
|
7
|
+
* Inspired by https://testing-library.com/docs/queries/bytestid/
|
|
8
|
+
* @param {HTMLElement} container - A parent element of the DOM element to find
|
|
9
|
+
* @param {string} testId - The value of the `data-testid` attribute of the component to find.
|
|
10
|
+
* @returns The found element or null if there was no such element
|
|
11
|
+
*/
|
|
12
|
+
export declare const queryByTestId: <T extends Element>(container: HTMLElement, testId: string) => T | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allows you to find a DOM element based on the value of its `data-testid` attribute.
|
|
3
|
+
* This attribute can be used to decouple identifying dom elements for testing from
|
|
4
|
+
* styling (which is typically done via class selectors) or other ids which serve
|
|
5
|
+
* different purposes.
|
|
6
|
+
* See also https://kentcdodds.com/blog/making-your-ui-tests-resilient-to-change
|
|
7
|
+
* Inspired by https://testing-library.com/docs/queries/bytestid/
|
|
8
|
+
* @param {HTMLElement} container - A parent element of the DOM element to find
|
|
9
|
+
* @param {string} testId - The value of the `data-testid` attribute of the component to find.
|
|
10
|
+
* @returns The found element or null if there was no such element
|
|
11
|
+
*/
|
|
12
|
+
export const queryByTestId = (container, testId) => {
|
|
13
|
+
return container.querySelector(`[data-testid="${testId}"]`);
|
|
14
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Given a parent element featuring `overflow: hidden` and a child element inside the parent, this
|
|
3
|
+
* function determines whether the child will be visible taking only the overflow of the parent into account
|
|
4
|
+
* Id does NOT check whether it is hidden or overlapped by another element
|
|
5
|
+
* It basically checks whether the bounding rects of the parent and the child overlap
|
|
6
|
+
*
|
|
7
|
+
* @param {HTMLElement} outerElement - The parent element
|
|
8
|
+
* @param {HTMLElement} innerElement - the child element
|
|
9
|
+
* @returns {Boolean} whether the two elements overlap
|
|
10
|
+
*/
|
|
11
|
+
export declare const isElementVisibleFromOverflow: (outerElement: Element, innerElement: Element) => boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Given a parent element featuring `overflow: hidden` and a child element inside the parent, this
|
|
3
|
+
* function determines whether the child will be visible taking only the overflow of the parent into account
|
|
4
|
+
* Id does NOT check whether it is hidden or overlapped by another element
|
|
5
|
+
* It basically checks whether the bounding rects of the parent and the child overlap
|
|
6
|
+
*
|
|
7
|
+
* @param {HTMLElement} outerElement - The parent element
|
|
8
|
+
* @param {HTMLElement} innerElement - the child element
|
|
9
|
+
* @returns {Boolean} whether the two elements overlap
|
|
10
|
+
*/
|
|
11
|
+
export const isElementVisibleFromOverflow = (outerElement, innerElement) => {
|
|
12
|
+
const outerRect = outerElement.getBoundingClientRect();
|
|
13
|
+
const innerRect = innerElement.getBoundingClientRect();
|
|
14
|
+
return (outerRect.top <= innerRect.bottom &&
|
|
15
|
+
innerRect.top <= outerRect.bottom &&
|
|
16
|
+
outerRect.left <= innerRect.right &&
|
|
17
|
+
innerRect.left <= outerRect.right);
|
|
18
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ShoelaceFormControl } from '../shoelace-element';
|
|
2
|
+
/** Runs a set of generic tests for Shoelace form controls */
|
|
3
|
+
export declare function runFormControlBaseTests<T extends ShoelaceFormControl = ShoelaceFormControl>(tagNameOrConfig: string | {
|
|
4
|
+
tagName: string;
|
|
5
|
+
init?: (control: T) => void;
|
|
6
|
+
variantName: string;
|
|
7
|
+
}): void;
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { expect, fixture } from '@open-wc/testing';
|
|
11
|
+
/** Runs a set of generic tests for Shoelace form controls */
|
|
12
|
+
export function runFormControlBaseTests(tagNameOrConfig) {
|
|
13
|
+
const isStringArg = typeof tagNameOrConfig === 'string';
|
|
14
|
+
const tagName = isStringArg ? tagNameOrConfig : tagNameOrConfig.tagName;
|
|
15
|
+
// component initialization function or null
|
|
16
|
+
const init = isStringArg || !tagNameOrConfig.init //
|
|
17
|
+
? null
|
|
18
|
+
: tagNameOrConfig.init || null;
|
|
19
|
+
// either `<tagName>` or `<tagName> (<variantName>)
|
|
20
|
+
const displayName = isStringArg //
|
|
21
|
+
? tagName
|
|
22
|
+
: `${tagName} (${tagNameOrConfig.variantName})`;
|
|
23
|
+
// creates a testable form control instance
|
|
24
|
+
const createControl = () => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const control = yield createFormControl(tagName);
|
|
26
|
+
init === null || init === void 0 ? void 0 : init(control);
|
|
27
|
+
return control;
|
|
28
|
+
});
|
|
29
|
+
runAllValidityTests(tagName, displayName, createControl);
|
|
30
|
+
}
|
|
31
|
+
//
|
|
32
|
+
// Applicable for all Shoelace form controls. This function checks the behavior of:
|
|
33
|
+
// - `.validity`
|
|
34
|
+
// - `.validationMessage`,
|
|
35
|
+
// - `.checkValidity()`
|
|
36
|
+
// - `.reportValidity()`
|
|
37
|
+
// - `.setCustomValidity(msg)`
|
|
38
|
+
//
|
|
39
|
+
function runAllValidityTests(tagName, //
|
|
40
|
+
displayName, createControl) {
|
|
41
|
+
// will be used later to retrieve meta information about the control
|
|
42
|
+
describe(`Form validity base test for ${displayName}`, () => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
it('should have a property `validity` of type `object`', () => __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const control = yield createControl();
|
|
45
|
+
expect(control).satisfy(() => control.validity !== null && typeof control.validity === 'object');
|
|
46
|
+
}));
|
|
47
|
+
it('should have a property `validationMessage` of type `string`', () => __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const control = yield createControl();
|
|
49
|
+
expect(control).satisfy(() => typeof control.validationMessage === 'string');
|
|
50
|
+
}));
|
|
51
|
+
it('should implement method `checkValidity`', () => __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
const control = yield createControl();
|
|
53
|
+
expect(control).satisfies(() => typeof control.checkValidity === 'function');
|
|
54
|
+
}));
|
|
55
|
+
it('should implement method `setCustomValidity`', () => __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const control = yield createControl();
|
|
57
|
+
expect(control).satisfies(() => typeof control.setCustomValidity === 'function');
|
|
58
|
+
}));
|
|
59
|
+
it('should implement method `reportValidity`', () => __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const control = yield createControl();
|
|
61
|
+
expect(control).satisfies(() => typeof control.reportValidity === 'function');
|
|
62
|
+
}));
|
|
63
|
+
it('should be valid initially', () => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const control = yield createControl();
|
|
65
|
+
expect(control.validity.valid).to.equal(true);
|
|
66
|
+
}));
|
|
67
|
+
it('should make sure that calling `.checkValidity()` will return `true` when valid', () => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
const control = yield createControl();
|
|
69
|
+
expect(control.checkValidity()).to.equal(true);
|
|
70
|
+
}));
|
|
71
|
+
it('should make sure that calling `.reportValidity()` will return `true` when valid', () => __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
const control = yield createControl();
|
|
73
|
+
expect(control.reportValidity()).to.equal(true);
|
|
74
|
+
}));
|
|
75
|
+
it('should not emit an `dsa-invalid` event when `.checkValidity()` is called while valid', () => __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const control = yield createControl();
|
|
77
|
+
const emittedEvents = checkEventEmissions(control, 'dsa-invalid', () => control.checkValidity());
|
|
78
|
+
expect(emittedEvents.length).to.equal(0);
|
|
79
|
+
}));
|
|
80
|
+
it('should not emit an `dsa-invalid` event when `.reportValidity()` is called while valid', () => __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
const control = yield createControl();
|
|
82
|
+
const emittedEvents = checkEventEmissions(control, 'dsa-invalid', () => control.reportValidity());
|
|
83
|
+
expect(emittedEvents.length).to.equal(0);
|
|
84
|
+
}));
|
|
85
|
+
// TODO: As soon as `DSARadioGroup` has a property `disabled` this
|
|
86
|
+
// condition can be removed
|
|
87
|
+
if (tagName !== 'dsa-radio-group' && tagName !== 'dsa-checkbox-group') {
|
|
88
|
+
it('should not emit an `dsa-invalid` event when `.checkValidity()` is called in custom error case while disabled', () => __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
const control = yield createControl();
|
|
90
|
+
control.setCustomValidity('error');
|
|
91
|
+
control.disabled = true;
|
|
92
|
+
yield control.updateComplete;
|
|
93
|
+
const emittedEvents = checkEventEmissions(control, 'dsa-invalid', () => control.checkValidity());
|
|
94
|
+
expect(emittedEvents.length).to.equal(0);
|
|
95
|
+
}));
|
|
96
|
+
it('should not emit an `dsa-invalid` event when `.reportValidity()` is called in custom error case while disabled', () => __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
const control = yield createControl();
|
|
98
|
+
control.setCustomValidity('error');
|
|
99
|
+
control.disabled = true;
|
|
100
|
+
yield control.updateComplete;
|
|
101
|
+
const emittedEvents = checkEventEmissions(control, 'dsa-invalid', () => control.reportValidity());
|
|
102
|
+
expect(emittedEvents.length).to.equal(0);
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
// Run special tests depending on component type
|
|
106
|
+
const mode = getMode(yield createControl());
|
|
107
|
+
if (mode === 'slButtonOfTypeButton') {
|
|
108
|
+
runSpecialTests_slButtonOfTypeButton(createControl);
|
|
109
|
+
}
|
|
110
|
+
else if (mode === 'slButtonWithHRef') {
|
|
111
|
+
runSpecialTests_slButtonWithHref(createControl);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
runSpecialTests_standard(createControl);
|
|
115
|
+
}
|
|
116
|
+
}));
|
|
117
|
+
}
|
|
118
|
+
//
|
|
119
|
+
// Special tests for <dsa-button type="button">
|
|
120
|
+
//
|
|
121
|
+
function runSpecialTests_slButtonOfTypeButton(createControl) {
|
|
122
|
+
it('should make sure that `.validity.valid` is `false` in custom error case', () => __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
const control = yield createControl();
|
|
124
|
+
control.setCustomValidity('error');
|
|
125
|
+
expect(control.validity.valid).to.equal(false);
|
|
126
|
+
}));
|
|
127
|
+
it('should make sure that calling `.checkValidity()` will still return `true` when custom error has been set', () => __awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
const control = yield createControl();
|
|
129
|
+
control.setCustomValidity('error');
|
|
130
|
+
expect(control.checkValidity()).to.equal(true);
|
|
131
|
+
}));
|
|
132
|
+
it('should make sure that calling `.reportValidity()` will still return `true` when custom error has been set', () => __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
const control = yield createControl();
|
|
134
|
+
control.setCustomValidity('error');
|
|
135
|
+
expect(control.reportValidity()).to.equal(true);
|
|
136
|
+
}));
|
|
137
|
+
it('should not emit an `dsa-invalid` event when `.checkValidity()` is called in custom error case, and not disabled', () => __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
const control = yield createControl();
|
|
139
|
+
control.setCustomValidity('error');
|
|
140
|
+
control.disabled = false;
|
|
141
|
+
yield control.updateComplete;
|
|
142
|
+
const emittedEvents = checkEventEmissions(control, 'dsa-invalid', () => control.checkValidity());
|
|
143
|
+
expect(emittedEvents.length).to.equal(0);
|
|
144
|
+
}));
|
|
145
|
+
it('should not emit an `dsa-invalid` event when `.reportValidity()` is called in custom error case, and not disabled', () => __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
const control = yield createControl();
|
|
147
|
+
control.setCustomValidity('error');
|
|
148
|
+
control.disabled = false;
|
|
149
|
+
yield control.updateComplete;
|
|
150
|
+
const emittedEvents = checkEventEmissions(control, 'dsa-invalid', () => control.reportValidity());
|
|
151
|
+
expect(emittedEvents.length).to.equal(0);
|
|
152
|
+
}));
|
|
153
|
+
}
|
|
154
|
+
//
|
|
155
|
+
// Special tests for <dsa-button href="...">
|
|
156
|
+
//
|
|
157
|
+
function runSpecialTests_slButtonWithHref(createControl) {
|
|
158
|
+
it('should make sure that calling `.checkValidity()` will return `true` in custom error case', () => __awaiter(this, void 0, void 0, function* () {
|
|
159
|
+
const control = yield createControl();
|
|
160
|
+
control.setCustomValidity('error');
|
|
161
|
+
expect(control.checkValidity()).to.equal(true);
|
|
162
|
+
}));
|
|
163
|
+
it('should make sure that calling `.reportValidity()` will return `true` in custom error case', () => __awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
const control = yield createControl();
|
|
165
|
+
control.setCustomValidity('error');
|
|
166
|
+
expect(control.reportValidity()).to.equal(true);
|
|
167
|
+
}));
|
|
168
|
+
it('should not emit an `dsa-invalid` event when `.checkValidity()` is called in custom error case', () => __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
const control = yield createControl();
|
|
170
|
+
control.setCustomValidity('error');
|
|
171
|
+
yield control.updateComplete;
|
|
172
|
+
const emittedEvents = checkEventEmissions(control, 'dsa-invalid', () => control.checkValidity());
|
|
173
|
+
expect(emittedEvents.length).to.equal(0);
|
|
174
|
+
}));
|
|
175
|
+
it('should not emit an `dsa-invalid` event when `.reportValidity()` is called in custom error case', () => __awaiter(this, void 0, void 0, function* () {
|
|
176
|
+
const control = yield createControl();
|
|
177
|
+
control.setCustomValidity('error');
|
|
178
|
+
yield control.updateComplete;
|
|
179
|
+
const emittedEvents = checkEventEmissions(control, 'dsa-invalid', () => control.reportValidity());
|
|
180
|
+
expect(emittedEvents.length).to.equal(0);
|
|
181
|
+
}));
|
|
182
|
+
}
|
|
183
|
+
//
|
|
184
|
+
// Special tests for all components with standard behavior
|
|
185
|
+
//
|
|
186
|
+
function runSpecialTests_standard(createControl) {
|
|
187
|
+
it('should make sure that `.validity.valid` is `false` in custom error case', () => __awaiter(this, void 0, void 0, function* () {
|
|
188
|
+
const control = yield createControl();
|
|
189
|
+
control.setCustomValidity('error');
|
|
190
|
+
expect(control.validity.valid).to.equal(false);
|
|
191
|
+
}));
|
|
192
|
+
it('should make sure that calling `.checkValidity()` will return `false` in custom error case', () => __awaiter(this, void 0, void 0, function* () {
|
|
193
|
+
const control = yield createControl();
|
|
194
|
+
control.setCustomValidity('error');
|
|
195
|
+
expect(control.checkValidity()).to.equal(false);
|
|
196
|
+
}));
|
|
197
|
+
it('should make sure that calling `.reportValidity()` will return `false` in custom error case', () => __awaiter(this, void 0, void 0, function* () {
|
|
198
|
+
const control = yield createControl();
|
|
199
|
+
control.setCustomValidity('error');
|
|
200
|
+
expect(control.reportValidity()).to.equal(false);
|
|
201
|
+
}));
|
|
202
|
+
it('should emit an `dsa-invalid` event when `.checkValidity()` is called in custom error case and not disabled', () => __awaiter(this, void 0, void 0, function* () {
|
|
203
|
+
const control = yield createControl();
|
|
204
|
+
control.setCustomValidity('error');
|
|
205
|
+
control.disabled = false;
|
|
206
|
+
yield control.updateComplete;
|
|
207
|
+
const emittedEvents = checkEventEmissions(control, 'dsa-invalid', () => control.checkValidity());
|
|
208
|
+
expect(emittedEvents.length).to.equal(1);
|
|
209
|
+
}));
|
|
210
|
+
it('should emit an `dsa-invalid` event when `.reportValidity()` is called in custom error case and not disabled', () => __awaiter(this, void 0, void 0, function* () {
|
|
211
|
+
const control = yield createControl();
|
|
212
|
+
control.setCustomValidity('error');
|
|
213
|
+
control.disabled = false;
|
|
214
|
+
yield control.updateComplete;
|
|
215
|
+
const emittedEvents = checkEventEmissions(control, 'dsa-invalid', () => control.reportValidity());
|
|
216
|
+
expect(emittedEvents.length).to.equal(1);
|
|
217
|
+
}));
|
|
218
|
+
}
|
|
219
|
+
//
|
|
220
|
+
// Local helper functions
|
|
221
|
+
//
|
|
222
|
+
// Creates a testable Shoelace form control instance
|
|
223
|
+
function createFormControl(tagName) {
|
|
224
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
225
|
+
return yield fixture(`<${tagName}></${tagName}>`);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
// Runs an action while listening for emitted events of a given type. Returns an array of all events of the given type
|
|
229
|
+
// that have been been emitted while the action was running.
|
|
230
|
+
function checkEventEmissions(control, eventType, action) {
|
|
231
|
+
const emittedEvents = [];
|
|
232
|
+
const eventHandler = (event) => {
|
|
233
|
+
emittedEvents.push(event);
|
|
234
|
+
};
|
|
235
|
+
try {
|
|
236
|
+
control.addEventListener(eventType, eventHandler);
|
|
237
|
+
action();
|
|
238
|
+
}
|
|
239
|
+
finally {
|
|
240
|
+
control.removeEventListener(eventType, eventHandler);
|
|
241
|
+
}
|
|
242
|
+
return emittedEvents;
|
|
243
|
+
}
|
|
244
|
+
// Component `dsa-button` behaves quite different to the other components. To keep things simple we use simple conditions
|
|
245
|
+
// here. `dsa-button` might stay the only component in Shoelace core behaves that way, so we just hard code it here.
|
|
246
|
+
function getMode(control) {
|
|
247
|
+
if (control.localName === 'dsa-button' && //
|
|
248
|
+
'href' in control &&
|
|
249
|
+
'type' in control &&
|
|
250
|
+
control.type === 'button' &&
|
|
251
|
+
!control.href) {
|
|
252
|
+
return 'slButtonOfTypeButton';
|
|
253
|
+
}
|
|
254
|
+
// <dsa-button href="...">
|
|
255
|
+
if (control.localName === 'dsa-button' &&
|
|
256
|
+
'href' in control &&
|
|
257
|
+
!!control.href) {
|
|
258
|
+
return 'slButtonWithHRef';
|
|
259
|
+
}
|
|
260
|
+
// all other components
|
|
261
|
+
return 'standard';
|
|
262
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wait until an element has stopped scrolling
|
|
3
|
+
* This considers the element to have stopped scrolling, as soon as it did not change its
|
|
4
|
+
* scroll position for 20 successive animation frames
|
|
5
|
+
* @param {HTMLElement} element - The element which is scrolled
|
|
6
|
+
* @param {numeric} timeoutInMs - A timeout in ms. If the timeout has elapsed, the promise rejects
|
|
7
|
+
* @returns A promise which resolves after the scrolling has stopped
|
|
8
|
+
*/
|
|
9
|
+
export declare const waitForScrollingToEnd: (element: Element, timeoutInMs?: number) => Promise<void>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wait until an element has stopped scrolling
|
|
3
|
+
* This considers the element to have stopped scrolling, as soon as it did not change its
|
|
4
|
+
* scroll position for 20 successive animation frames
|
|
5
|
+
* @param {HTMLElement} element - The element which is scrolled
|
|
6
|
+
* @param {numeric} timeoutInMs - A timeout in ms. If the timeout has elapsed, the promise rejects
|
|
7
|
+
* @returns A promise which resolves after the scrolling has stopped
|
|
8
|
+
*/
|
|
9
|
+
export const waitForScrollingToEnd = (element, timeoutInMs = 500) => {
|
|
10
|
+
let lastLeft = element.scrollLeft;
|
|
11
|
+
let lastTop = element.scrollTop;
|
|
12
|
+
let framesWithoutChange = 0;
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
const timeout = window.setTimeout(() => {
|
|
15
|
+
reject(new Error('Waiting for scroll end timed out'));
|
|
16
|
+
}, timeoutInMs);
|
|
17
|
+
function checkScrollingChanged() {
|
|
18
|
+
if (element.scrollLeft !== lastLeft || element.scrollTop !== lastTop) {
|
|
19
|
+
framesWithoutChange = 0;
|
|
20
|
+
lastLeft = window.scrollX;
|
|
21
|
+
lastTop = window.scrollY;
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
framesWithoutChange++;
|
|
25
|
+
if (framesWithoutChange >= 20) {
|
|
26
|
+
clearTimeout(timeout);
|
|
27
|
+
resolve();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
window.requestAnimationFrame(checkScrollingChanged);
|
|
31
|
+
}
|
|
32
|
+
checkScrollingChanged();
|
|
33
|
+
});
|
|
34
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** A testing utility that measures an element's position and clicks on it. */
|
|
2
|
+
export declare function clickOnElement(
|
|
3
|
+
/** The element to click */
|
|
4
|
+
el: Element,
|
|
5
|
+
/** The location of the element to click */
|
|
6
|
+
position?: 'top' | 'right' | 'bottom' | 'left' | 'center',
|
|
7
|
+
/** The horizontal offset to apply to the position when clicking */
|
|
8
|
+
offsetX?: number,
|
|
9
|
+
/** The vertical offset to apply to the position when clicking */
|
|
10
|
+
offsetY?: number): Promise<void>;
|
|
11
|
+
/** A testing utility that moves the mouse onto an element. */
|
|
12
|
+
export declare function moveMouseOnElement(
|
|
13
|
+
/** The element to click */
|
|
14
|
+
el: Element,
|
|
15
|
+
/** The location of the element to click */
|
|
16
|
+
position?: 'top' | 'right' | 'bottom' | 'left' | 'center',
|
|
17
|
+
/** The horizontal offset to apply to the position when clicking */
|
|
18
|
+
offsetX?: number,
|
|
19
|
+
/** The vertical offset to apply to the position when clicking */
|
|
20
|
+
offsetY?: number): Promise<void>;
|