@redvars/peacock 3.1.2 → 3.1.3
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/.rollup.cache/E/git/redvars/peacock/components/dist/src/LoaderUtils.d.ts +0 -1
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/LoaderUtils.js +0 -1
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/LoaderUtils.js.map +1 -1
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/avatar/avatar.d.ts +1 -1
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/avatar/avatar.js +1 -1
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/avatar/avatar.js.map +1 -1
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/badge/badge.d.ts +1 -1
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/badge/badge.js +1 -1
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/badge/badge.js.map +1 -1
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/button/button.d.ts +99 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/button/button.js +292 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/button/button.js.map +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/button/index.d.ts +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/button/index.js +2 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/button/index.js.map +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/clock/ClockController.d.ts +10 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/clock/ClockController.js +22 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/clock/ClockController.js.map +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/clock/clock.d.ts +4 -6
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/clock/clock.js +8 -25
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/clock/clock.js.map +1 -1
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/code-highlighter/code-highlighter.d.ts +26 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/code-highlighter/code-highlighter.js +60 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/code-highlighter/code-highlighter.js.map +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/code-highlighter/index.d.ts +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/code-highlighter/index.js +2 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/code-highlighter/index.js.map +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/code-highlighter/local.d.ts +6 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/code-highlighter/local.js +7 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/code-highlighter/local.js.map +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/divider/divider.d.ts +1 -2
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/divider/divider.js +1 -8
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/divider/divider.js.map +1 -1
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/elevation/elevation.css.d.ts +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/elevation/elevation.css.js +47 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/elevation/elevation.css.js.map +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/elevation/elevation.d.ts +27 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/elevation/elevation.js +31 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/elevation/elevation.js.map +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/elevation/index.d.ts +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/elevation/index.js +2 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/elevation/index.js.map +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/focus-ring/FocusAttachableController.d.ts +9 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/focus-ring/FocusAttachableController.js +25 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/focus-ring/FocusAttachableController.js.map +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/focus-ring/focus-ring.d.ts +35 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/focus-ring/focus-ring.js +81 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/focus-ring/focus-ring.js.map +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/focus-ring/index.d.ts +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/focus-ring/index.js +2 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/focus-ring/index.js.map +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/icon/icon.d.ts +3 -2
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/icon/icon.js +4 -4
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/icon/icon.js.map +1 -1
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/index.d.ts +4 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/index.js +4 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/index.js.map +1 -1
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/peacock-loader.js +24 -18
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/peacock-loader.js.map +1 -1
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/ripple/index.d.ts +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/ripple/index.js +2 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/ripple/index.js.map +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/ripple/ripple.d.ts +9 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/ripple/ripple.js +125 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/ripple/ripple.js.map +1 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/utils.d.ts +4 -0
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/utils.js +22 -1
- package/.rollup.cache/E/git/redvars/peacock/components/dist/src/utils.js.map +1 -1
- package/.rollup.cache/E/git/redvars/peacock/components/dist/tsconfig.tsbuildinfo +1 -1
- package/bin/typedoc-gen.mjs +3 -4
- package/demo/index.html +45 -41
- package/dist/LoaderUtils.d.ts +23 -0
- package/dist/LoaderUtils.d.ts.map +1 -0
- package/dist/assets/styles/tokens.css +21 -53
- package/dist/avatar/avatar.d.ts +28 -0
- package/dist/avatar/avatar.d.ts.map +1 -0
- package/dist/avatar/index.d.ts +2 -0
- package/dist/avatar/index.d.ts.map +1 -0
- package/dist/avatar/p-avatar.d.ts +4 -0
- package/dist/avatar/p-avatar.d.ts.map +1 -0
- package/dist/avatar.js +42 -40
- package/dist/avatar.js.map +1 -1
- package/dist/badge/badge.d.ts +24 -0
- package/dist/badge/badge.d.ts.map +1 -0
- package/dist/badge/index.d.ts +2 -0
- package/dist/badge/index.d.ts.map +1 -0
- package/dist/badge/p-badge.d.ts +4 -0
- package/dist/badge/p-badge.d.ts.map +1 -0
- package/dist/badge.js +37 -36
- package/dist/badge.js.map +1 -1
- package/dist/button/button.d.ts +103 -0
- package/dist/button/button.d.ts.map +1 -0
- package/dist/button/index.d.ts +2 -0
- package/dist/button/index.d.ts.map +1 -0
- package/dist/button.js +710 -0
- package/dist/button.js.map +1 -0
- package/dist/class-map-BzIzngvN.js +89 -0
- package/dist/class-map-BzIzngvN.js.map +1 -0
- package/dist/class-map-CBk4-iMN.js +11 -0
- package/dist/class-map-CBk4-iMN.js.map +1 -0
- package/dist/class-map-Cavm-B1S.js +11 -0
- package/dist/class-map-Cavm-B1S.js.map +1 -0
- package/dist/class-map-DL5vM0J2.js +11 -0
- package/dist/class-map-DL5vM0J2.js.map +1 -0
- package/dist/class-map-IbP5VjmB.js +11 -0
- package/dist/class-map-IbP5VjmB.js.map +1 -0
- package/dist/clock/ClockController.d.ts +11 -0
- package/dist/clock/ClockController.d.ts.map +1 -0
- package/dist/clock/clock.d.ts +26 -0
- package/dist/clock/clock.d.ts.map +1 -0
- package/dist/clock/index.d.ts +2 -0
- package/dist/clock/index.d.ts.map +1 -0
- package/dist/clock.js +42 -35
- package/dist/clock.js.map +1 -1
- package/dist/code-highlighter/code-highlighter.d.ts +27 -0
- package/dist/code-highlighter/code-highlighter.d.ts.map +1 -0
- package/dist/code-highlighter/index.d.ts +2 -0
- package/dist/code-highlighter/index.d.ts.map +1 -0
- package/dist/code-highlighter/local.d.ts +7 -0
- package/dist/code-highlighter/local.d.ts.map +1 -0
- package/dist/code-highlighter.js +66 -0
- package/dist/code-highlighter.js.map +1 -0
- package/dist/custom-elements-jsdocs.json +589 -34
- package/dist/directive-CkFJvUQK.js +45 -0
- package/dist/directive-CkFJvUQK.js.map +1 -0
- package/dist/divider/divider.d.ts +28 -0
- package/dist/divider/divider.d.ts.map +1 -0
- package/dist/divider/index.d.ts +2 -0
- package/dist/divider/index.d.ts.map +1 -0
- package/dist/divider.js +55 -61
- package/dist/divider.js.map +1 -1
- package/dist/elevation/elevation.d.ts +28 -0
- package/dist/elevation/elevation.d.ts.map +1 -0
- package/dist/elevation/index.d.ts +2 -0
- package/dist/elevation/index.d.ts.map +1 -0
- package/dist/elevation-Bl1N6qEq.js +100 -0
- package/dist/elevation-Bl1N6qEq.js.map +1 -0
- package/dist/elevation-CbF5he8B.js +103 -0
- package/dist/elevation-CbF5he8B.js.map +1 -0
- package/dist/elevation-D3F6Z1jU.js +100 -0
- package/dist/elevation-D3F6Z1jU.js.map +1 -0
- package/dist/elevation.js +77 -0
- package/dist/elevation.js.map +1 -0
- package/dist/focus-ring/FocusAttachableController.d.ts +10 -0
- package/dist/focus-ring/FocusAttachableController.d.ts.map +1 -0
- package/dist/focus-ring/focus-ring.d.ts +36 -0
- package/dist/focus-ring/focus-ring.d.ts.map +1 -0
- package/dist/focus-ring/index.d.ts +2 -0
- package/dist/focus-ring/index.d.ts.map +1 -0
- package/dist/focus-ring.js +105 -0
- package/dist/focus-ring.js.map +1 -0
- package/dist/icon/datasource.d.ts +3 -0
- package/dist/icon/datasource.d.ts.map +1 -0
- package/dist/icon/icon.d.ts +42 -0
- package/dist/icon/icon.d.ts.map +1 -0
- package/dist/icon/index.d.ts +2 -0
- package/dist/icon/index.d.ts.map +1 -0
- package/dist/icon/p-icon.d.ts +4 -0
- package/dist/icon/p-icon.d.ts.map +1 -0
- package/dist/icon.js +26 -26
- package/dist/icon.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/dist/link/link.css.d.ts +3 -0
- package/dist/link/link.css.d.ts.map +1 -0
- package/dist/lit-element-B7NX__Gq.js +2851 -0
- package/dist/lit-element-B7NX__Gq.js.map +1 -0
- package/dist/lit-element-Bq5B2QNv.js +28 -0
- package/dist/lit-element-Bq5B2QNv.js.map +1 -0
- package/dist/lit-element-CkD27PXL.js +28 -0
- package/dist/lit-element-CkD27PXL.js.map +1 -0
- package/dist/lit-element-DHH1_Q-3.js +28 -0
- package/dist/lit-element-DHH1_Q-3.js.map +1 -0
- package/dist/peacock-loader.d.ts +2 -0
- package/dist/peacock-loader.d.ts.map +1 -0
- package/dist/peacock-loader.js +465 -116
- package/dist/peacock-loader.js.map +1 -1
- package/dist/property-BXcRN0hQ.js +39 -0
- package/dist/property-BXcRN0hQ.js.map +1 -0
- package/dist/property-CR1ZrEd9.js +45 -0
- package/dist/property-CR1ZrEd9.js.map +1 -0
- package/dist/property-CqSbFxyM.js +45 -0
- package/dist/property-CqSbFxyM.js.map +1 -0
- package/dist/property-DNaigT7h.js +39 -0
- package/dist/property-DNaigT7h.js.map +1 -0
- package/dist/property-yt9tIYgR.js +39 -0
- package/dist/property-yt9tIYgR.js.map +1 -0
- package/dist/query-CV342L_h.js +189 -0
- package/dist/query-CV342L_h.js.map +1 -0
- package/dist/ripple-Blc5Rqhb.js +102 -0
- package/dist/ripple-Blc5Rqhb.js.map +1 -0
- package/dist/ripple-BqTcEQAP.js +102 -0
- package/dist/ripple-BqTcEQAP.js.map +1 -0
- package/dist/ripple-BqUjb18i.js +105 -0
- package/dist/ripple-BqUjb18i.js.map +1 -0
- package/dist/ripple-Buzs-MON.js +106 -0
- package/dist/ripple-Buzs-MON.js.map +1 -0
- package/dist/ripple-Bz5B_LoE.js +102 -0
- package/dist/ripple-Bz5B_LoE.js.map +1 -0
- package/dist/ripple-CAq7Ix6x.js +106 -0
- package/dist/ripple-CAq7Ix6x.js.map +1 -0
- package/dist/ripple-CDqSm_Vy.js +106 -0
- package/dist/ripple-CDqSm_Vy.js.map +1 -0
- package/dist/ripple-CJtPH28B.js +102 -0
- package/dist/ripple-CJtPH28B.js.map +1 -0
- package/dist/ripple-CKTd8obC.js +92 -0
- package/dist/ripple-CKTd8obC.js.map +1 -0
- package/dist/ripple-CKnDWTVQ.js +107 -0
- package/dist/ripple-CKnDWTVQ.js.map +1 -0
- package/dist/ripple-CeR8eLuc.js +93 -0
- package/dist/ripple-CeR8eLuc.js.map +1 -0
- package/dist/ripple-Czp3eR6w.js +127 -0
- package/dist/ripple-Czp3eR6w.js.map +1 -0
- package/dist/ripple-DIab1MaY.js +106 -0
- package/dist/ripple-DIab1MaY.js.map +1 -0
- package/dist/ripple-DUFMimxZ.js +120 -0
- package/dist/ripple-DUFMimxZ.js.map +1 -0
- package/dist/ripple-DVmDdoNV.js +102 -0
- package/dist/ripple-DVmDdoNV.js.map +1 -0
- package/dist/ripple-DYnhXK5d.js +118 -0
- package/dist/ripple-DYnhXK5d.js.map +1 -0
- package/dist/ripple-DnudV47f.js +102 -0
- package/dist/ripple-DnudV47f.js.map +1 -0
- package/dist/ripple-DsC-h31M.js +119 -0
- package/dist/ripple-DsC-h31M.js.map +1 -0
- package/dist/ripple-DvM0SPd9.js +128 -0
- package/dist/ripple-DvM0SPd9.js.map +1 -0
- package/dist/ripple-NWIiDgX2.js +128 -0
- package/dist/ripple-NWIiDgX2.js.map +1 -0
- package/dist/ripple-X3U_R8lT.js +106 -0
- package/dist/ripple-X3U_R8lT.js.map +1 -0
- package/dist/ripple.js +128 -0
- package/dist/ripple.js.map +1 -0
- package/dist/src/LoaderUtils.d.ts +0 -1
- package/dist/src/avatar/avatar.d.ts +1 -1
- package/dist/src/badge/badge.d.ts +1 -1
- package/dist/src/button/button.d.ts +99 -0
- package/dist/src/button/index.d.ts +1 -0
- package/dist/src/clock/ClockController.d.ts +10 -0
- package/dist/src/clock/clock.d.ts +4 -6
- package/dist/src/code-highlighter/code-highlighter.d.ts +26 -0
- package/dist/src/code-highlighter/index.d.ts +1 -0
- package/dist/src/code-highlighter/local.d.ts +6 -0
- package/dist/src/divider/divider.d.ts +1 -2
- package/dist/src/elevation/elevation.css.d.ts +1 -0
- package/dist/src/elevation/elevation.d.ts +27 -0
- package/dist/src/elevation/index.d.ts +1 -0
- package/dist/src/focus-ring/FocusAttachableController.d.ts +9 -0
- package/dist/src/focus-ring/focus-ring.d.ts +35 -0
- package/dist/src/focus-ring/index.d.ts +1 -0
- package/dist/src/icon/icon.d.ts +3 -2
- package/dist/src/index.d.ts +4 -0
- package/dist/src/ripple/index.d.ts +1 -0
- package/dist/src/ripple/ripple.d.ts +9 -0
- package/dist/src/utils.d.ts +4 -0
- package/dist/state-BXOdKkbT.js +10 -0
- package/dist/state-BXOdKkbT.js.map +1 -0
- package/dist/state-BfUul2Gq.js +10 -0
- package/dist/state-BfUul2Gq.js.map +1 -0
- package/dist/state-CNX6DhqO.js +10 -0
- package/dist/state-CNX6DhqO.js.map +1 -0
- package/dist/state-Cl3mjeR1.js +10 -0
- package/dist/state-Cl3mjeR1.js.map +1 -0
- package/dist/state-WDFgnqnd.js +36 -0
- package/dist/state-WDFgnqnd.js.map +1 -0
- package/dist/style-inject.es--nCJ9F_D.js +55 -0
- package/dist/style-inject.es--nCJ9F_D.js.map +1 -0
- package/dist/style-inject.es-tgCJW-Cu.js +29 -0
- package/dist/style-inject.es-tgCJW-Cu.js.map +1 -0
- package/dist/styleMixins.css-0Uq-6ouM.js +14 -0
- package/dist/styleMixins.css-0Uq-6ouM.js.map +1 -0
- package/dist/styleMixins.css-B8H9wDNA.js +17 -0
- package/dist/styleMixins.css-B8H9wDNA.js.map +1 -0
- package/dist/styleMixins.css-DrUsqddl.js +17 -0
- package/dist/styleMixins.css-DrUsqddl.js.map +1 -0
- package/dist/styleMixins.css-fokZCyF-.js +17 -0
- package/dist/styleMixins.css-fokZCyF-.js.map +1 -0
- package/dist/styleMixins.css.d.ts +10 -0
- package/dist/styleMixins.css.d.ts.map +1 -0
- package/dist/text/text.css.d.ts +3 -0
- package/dist/text/text.css.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/typedoc.json +340489 -0
- package/dist/utils-BVap5huR.js +157 -0
- package/dist/utils-BVap5huR.js.map +1 -0
- package/dist/utils-CY3RyfcA.js +157 -0
- package/dist/utils-CY3RyfcA.js.map +1 -0
- package/dist/utils-CdOdn2dW.js +149 -0
- package/dist/utils-CdOdn2dW.js.map +1 -0
- package/dist/utils-DD_cg6Ms.js +157 -0
- package/dist/utils-DD_cg6Ms.js.map +1 -0
- package/dist/utils.d.ts +8 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +4 -2
- package/readme.md +1 -1
- package/rollup.config.js +9 -1
- package/scss/mixin.scss +50 -0
- package/src/LoaderUtils.ts +122 -122
- package/src/avatar/avatar.scss +38 -0
- package/src/avatar/avatar.ts +1 -1
- package/src/badge/badge.scss +31 -0
- package/src/badge/badge.ts +1 -1
- package/src/button/_button-sizes.scss +59 -0
- package/src/button/button.scss +430 -0
- package/src/button/button.ts +304 -0
- package/src/button/demo/index.html +42 -0
- package/src/button/index.ts +1 -0
- package/src/clock/ClockController.ts +32 -0
- package/src/clock/clock.scss +9 -0
- package/src/clock/clock.ts +39 -57
- package/src/code-highlighter/code-highlighter.scss +0 -0
- package/src/code-highlighter/code-highlighter.ts +58 -0
- package/src/code-highlighter/demo/index.html +58 -0
- package/src/code-highlighter/index.ts +1 -0
- package/src/code-highlighter/local.ts +11 -0
- package/src/divider/divider.scss +56 -0
- package/src/divider/divider.ts +1 -7
- package/src/elevation/demo/index.html +58 -0
- package/src/elevation/elevation.scss +61 -0
- package/src/elevation/elevation.ts +32 -0
- package/src/elevation/index.ts +1 -0
- package/src/focus-ring/FocusAttachableController.ts +36 -0
- package/src/focus-ring/demo/index.html +58 -0
- package/src/focus-ring/focus-ring.scss +22 -0
- package/src/focus-ring/focus-ring.ts +83 -0
- package/src/focus-ring/index.ts +1 -0
- package/src/icon/icon.scss +19 -0
- package/src/icon/icon.ts +131 -131
- package/src/index.ts +9 -5
- package/src/link/demo/index.html +34 -0
- package/src/link/link.scss +24 -0
- package/src/peacock-loader.ts +69 -64
- package/src/ripple/index.ts +1 -0
- package/src/ripple/ripple.ts +134 -0
- package/src/styles.d.ts +3 -1
- package/src/text/text.scss +48 -0
- package/src/utils.ts +29 -1
- package/tsconfig.json +23 -22
- package/demo/int.html +0 -31
- package/src/avatar/avatar.css.ts +0 -41
- package/src/badge/badge.css.ts +0 -34
- package/src/clock/clock.css.ts +0 -12
- package/src/divider/divider.css.ts +0 -58
- package/src/icon/icon.css.ts +0 -22
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { html, LitElement } from 'lit';
|
|
2
|
+
import { property, query, state } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import styles from './button.scss';
|
|
5
|
+
import { observerSlotChangesWithCallback, throttle } from '../utils.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @label Button
|
|
9
|
+
* @tag p-button
|
|
10
|
+
* @rawTag button
|
|
11
|
+
*
|
|
12
|
+
* @summary Buttons help people initiate actions, from sending an email, to sharing a document, to liking a post.
|
|
13
|
+
* @overview
|
|
14
|
+
* <p>Buttons are clickable elements that are used to trigger actions. They communicate calls to action to the user and allow users to interact with pages in a variety of ways. Button labels express what action will occur when the user interacts with it.</p>
|
|
15
|
+
*
|
|
16
|
+
* @cssprop --divider-color - Controls the color of the divider.
|
|
17
|
+
* @cssprop --divider-padding - Controls the padding of the divider.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```html
|
|
21
|
+
* <pc-button>Button</pc-button>
|
|
22
|
+
* ```
|
|
23
|
+
* @tags display
|
|
24
|
+
*/
|
|
25
|
+
export class Button extends LitElement {
|
|
26
|
+
static override styles = [styles];
|
|
27
|
+
|
|
28
|
+
#id = crypto.randomUUID();
|
|
29
|
+
|
|
30
|
+
#tabindex?: number = 0;
|
|
31
|
+
|
|
32
|
+
@query('.button') private readonly buttonElement!: HTMLElement | null;
|
|
33
|
+
|
|
34
|
+
@property({ type: String }) htmlType: 'button' | 'submit' | 'reset' =
|
|
35
|
+
'button';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The visual style of the button.
|
|
39
|
+
*
|
|
40
|
+
* Possible variant values:
|
|
41
|
+
* `"filled"` is a filled button.
|
|
42
|
+
* `"outlined"` is an outlined button.
|
|
43
|
+
* `"text"` is a transparent button.
|
|
44
|
+
* `"tonal"` is a light color button.
|
|
45
|
+
*
|
|
46
|
+
*/
|
|
47
|
+
@property() variant:
|
|
48
|
+
| 'elevated'
|
|
49
|
+
| 'filled'
|
|
50
|
+
| 'tonal'
|
|
51
|
+
| 'outlined'
|
|
52
|
+
| 'text'
|
|
53
|
+
| 'neo' = 'filled';
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Button size.
|
|
57
|
+
* Possible values are `"sm"`, `"md"`, `"lg"`. Defaults to `"md"`.
|
|
58
|
+
*/
|
|
59
|
+
@property() size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* If true, the user cannot interact with the button. Defaults to `false`.
|
|
63
|
+
*/
|
|
64
|
+
@property({ reflect: true }) disabled: boolean = false;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* If true, the user cannot interact with the button and the button is visually styled as disabled. But the button is still focusable. Defaults to `false`.
|
|
68
|
+
*/
|
|
69
|
+
@property({ reflect: true }) softDisabled: boolean = false;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* If button is disabled, the reason why it is disabled.
|
|
73
|
+
*/
|
|
74
|
+
@property() disabledReason: string = '';
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.
|
|
78
|
+
*/
|
|
79
|
+
@property({ reflect: true }) color:
|
|
80
|
+
| 'primary'
|
|
81
|
+
| 'secondary'
|
|
82
|
+
| 'success'
|
|
83
|
+
| 'danger'
|
|
84
|
+
| 'warning'
|
|
85
|
+
| 'white'
|
|
86
|
+
| 'black' = 'primary';
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Icon alignment.
|
|
90
|
+
* Possible values are `"start"`, `"end"`. Defaults to `"end"`.
|
|
91
|
+
*/
|
|
92
|
+
@property() iconAlign: 'start' | 'end' = 'end';
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Hyperlink to navigate to on click.
|
|
96
|
+
*/
|
|
97
|
+
@property({ reflect: true }) href?: string;
|
|
98
|
+
|
|
99
|
+
@property({ reflect: true }) configAria?: { [key: string]: any };
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Sets or retrieves the window or frame at which to target content.
|
|
103
|
+
*/
|
|
104
|
+
@property() target: string = '_self';
|
|
105
|
+
|
|
106
|
+
@property() selected: boolean = false;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Sets the delay for throttle in milliseconds. Defaults to 200 milliseconds.
|
|
110
|
+
*/
|
|
111
|
+
@property() throttleDelay = 200;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* States
|
|
115
|
+
*/
|
|
116
|
+
@state()
|
|
117
|
+
private isPressed = false;
|
|
118
|
+
|
|
119
|
+
@state()
|
|
120
|
+
private slotHasContent = false;
|
|
121
|
+
|
|
122
|
+
override focus() {
|
|
123
|
+
this.buttonElement?.focus();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
override blur() {
|
|
127
|
+
this.buttonElement?.blur();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
override connectedCallback() {
|
|
131
|
+
super.connectedCallback();
|
|
132
|
+
window.addEventListener('mouseup', this.__handlePress);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
override disconnectedCallback() {
|
|
136
|
+
window.removeEventListener('mouseup', this.__handlePress);
|
|
137
|
+
super.disconnectedCallback();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
override firstUpdated() {
|
|
141
|
+
this.__dispatchClickWithThrottle = throttle(
|
|
142
|
+
this.__dispatchClick,
|
|
143
|
+
this.throttleDelay,
|
|
144
|
+
);
|
|
145
|
+
observerSlotChangesWithCallback(
|
|
146
|
+
this.renderRoot.querySelector('slot'),
|
|
147
|
+
hasContent => {
|
|
148
|
+
this.slotHasContent = hasContent;
|
|
149
|
+
this.requestUpdate();
|
|
150
|
+
},
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
private __dispatchClickWithThrottle: (
|
|
155
|
+
event: MouseEvent | KeyboardEvent,
|
|
156
|
+
) => void = event => {
|
|
157
|
+
this.__dispatchClick(event);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
__dispatchClick = (event: MouseEvent | KeyboardEvent) => {
|
|
161
|
+
// If the button is soft-disabled or a disabled link, we need to explicitly
|
|
162
|
+
// prevent the click from propagating to other event listeners as well as
|
|
163
|
+
// prevent the default action.
|
|
164
|
+
if (this.softDisabled || (this.disabled && this.href)) {
|
|
165
|
+
event.stopImmediatePropagation();
|
|
166
|
+
event.preventDefault();
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
this.focus();
|
|
171
|
+
this.dispatchEvent(
|
|
172
|
+
new CustomEvent('button:click', {
|
|
173
|
+
bubbles: true,
|
|
174
|
+
composed: true,
|
|
175
|
+
}),
|
|
176
|
+
);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
__renderDisabledReason() {
|
|
180
|
+
if (this.disabled && this.disabledReason)
|
|
181
|
+
return html`<div
|
|
182
|
+
id="disabled-reason-${this.#id}"
|
|
183
|
+
role="tooltip"
|
|
184
|
+
aria-label=${this.disabledReason}
|
|
185
|
+
class="sr-only"
|
|
186
|
+
>
|
|
187
|
+
{this.disabledReason}
|
|
188
|
+
</div>`;
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
__handlePress = (event: KeyboardEvent | MouseEvent) => {
|
|
193
|
+
if (
|
|
194
|
+
event instanceof KeyboardEvent &&
|
|
195
|
+
event.type === 'keydown' &&
|
|
196
|
+
(event.key === 'Enter' || event.key === ' ')
|
|
197
|
+
) {
|
|
198
|
+
this.isPressed = true;
|
|
199
|
+
} else if (event.type === 'mousedown') {
|
|
200
|
+
this.isPressed = true;
|
|
201
|
+
} else {
|
|
202
|
+
this.isPressed = false;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
/* @ts-ignore */
|
|
207
|
+
private __isLink() {
|
|
208
|
+
return !!this.href;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
override render() {
|
|
212
|
+
const isLink = this.__isLink();
|
|
213
|
+
const { variant, subVariant } = this.getVariant();
|
|
214
|
+
|
|
215
|
+
const cssClasses = {
|
|
216
|
+
button: true,
|
|
217
|
+
'button-element': true,
|
|
218
|
+
[`size-${this.size}`]: true,
|
|
219
|
+
[`variant-${variant}`]: true,
|
|
220
|
+
[`variant-${subVariant}`]: !!subVariant,
|
|
221
|
+
[`color-${this.color}`]: true,
|
|
222
|
+
disabled: this.disabled || this.softDisabled,
|
|
223
|
+
pressed: this.isPressed,
|
|
224
|
+
'has-content': this.slotHasContent,
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
if (!isLink) {
|
|
228
|
+
return html`<button
|
|
229
|
+
class=${classMap(cssClasses)}
|
|
230
|
+
tabindex=${this.#tabindex}
|
|
231
|
+
type=${this.htmlType}
|
|
232
|
+
@click=${this.__dispatchClickWithThrottle}
|
|
233
|
+
@mousedown=${this.__handlePress}
|
|
234
|
+
@keydown=${this.__handlePress}
|
|
235
|
+
@keyup=${this.__handlePress}
|
|
236
|
+
?aria-describedby=${(this.disabled || this.softDisabled) &&
|
|
237
|
+
this.disabledReason
|
|
238
|
+
? `disabled-reason-${this.#id}`
|
|
239
|
+
: null}
|
|
240
|
+
aria-disabled=${`${this.disabled || this.softDisabled}`}
|
|
241
|
+
?disabled=${this.disabled}
|
|
242
|
+
>
|
|
243
|
+
${this.renderButtonContent()}
|
|
244
|
+
</button>`;
|
|
245
|
+
}
|
|
246
|
+
return html`<a
|
|
247
|
+
class=${classMap(cssClasses)}
|
|
248
|
+
tabindex=${this.#tabindex}
|
|
249
|
+
href=${this.href}
|
|
250
|
+
target=${this.target}
|
|
251
|
+
@click=${this.__dispatchClickWithThrottle}
|
|
252
|
+
@mousedown=${this.__handlePress}
|
|
253
|
+
@keydown=${this.__handlePress}
|
|
254
|
+
@keyup=${this.__handlePress}
|
|
255
|
+
role="button"
|
|
256
|
+
aria-describedby=${this.disabled && this.disabledReason
|
|
257
|
+
? `disabled-reason-${this.#id}`
|
|
258
|
+
: null}
|
|
259
|
+
aria-disabled=${`${this.disabled}`}
|
|
260
|
+
>
|
|
261
|
+
<div class="icon">
|
|
262
|
+
<slot name="icon"></slot>
|
|
263
|
+
</div>
|
|
264
|
+
|
|
265
|
+
<div class="slot-container">
|
|
266
|
+
<slot></slot>
|
|
267
|
+
</div>
|
|
268
|
+
</a>`;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
getVariant() {
|
|
272
|
+
const variants = this.variant?.split('.');
|
|
273
|
+
if (!['filled', 'outlined', 'text', 'tonal', 'neo'].includes(variants[0])) {
|
|
274
|
+
variants.unshift('filled');
|
|
275
|
+
}
|
|
276
|
+
const [variant, subVariant] = variants as [string, string?];
|
|
277
|
+
return { variant, subVariant };
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
renderButtonContent() {
|
|
281
|
+
return html`
|
|
282
|
+
<p-focus-ring class="focus-ring" .control=${this}></p-focus-ring>
|
|
283
|
+
<p-elevation class="elevation"></p-elevation>
|
|
284
|
+
<div class="neo-background"></div>
|
|
285
|
+
<div class="background"></div>
|
|
286
|
+
<div class="outline"></div>
|
|
287
|
+
<p-ripple class="ripple"></p-ripple>
|
|
288
|
+
|
|
289
|
+
<div class="button-content">
|
|
290
|
+
${this.iconAlign === 'start'
|
|
291
|
+
? html`<slot name="icon"></slot></div>`
|
|
292
|
+
: null}
|
|
293
|
+
|
|
294
|
+
<div class="slot-container">
|
|
295
|
+
<slot></slot>
|
|
296
|
+
</div>
|
|
297
|
+
|
|
298
|
+
${this.iconAlign === 'end' ? html`<slot name="icon"></slot>` : null}
|
|
299
|
+
</div>
|
|
300
|
+
|
|
301
|
+
${this.__renderDisabledReason()}
|
|
302
|
+
`;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang='en-GB'>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset='utf-8'>
|
|
5
|
+
<link rel='stylesheet' href='/dist/assets/styles/tokens.css' />
|
|
6
|
+
<meta name='viewport' content='width=device-width, initial-scale=1.0, viewport-fit=cover' />
|
|
7
|
+
<link rel='stylesheet' href='/dist/assets/styles/tokens.css' />
|
|
8
|
+
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
|
|
9
|
+
|
|
10
|
+
<style>
|
|
11
|
+
body {
|
|
12
|
+
background: #fafafa;
|
|
13
|
+
}
|
|
14
|
+
</style>
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
|
|
18
|
+
<a href='#'>Back</a>
|
|
19
|
+
|
|
20
|
+
<p-button>Click</p-button>
|
|
21
|
+
|
|
22
|
+
<p-button variant='elevated' iconAlign='start'><p-icon slot='icon' name='home'></p-icon> Click</p-button>
|
|
23
|
+
|
|
24
|
+
<p-button variant='tonal'>Click</p-button>
|
|
25
|
+
|
|
26
|
+
<p-button variant='outlined'>Click</p-button>
|
|
27
|
+
|
|
28
|
+
<p-button variant='text'>Click</p-button>
|
|
29
|
+
|
|
30
|
+
<p-button variant='neo'>Click</p-button>
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
<script type='module'>
|
|
34
|
+
import { Button, Elevation, FocusRing, Ripple, Icon } from '/dist/index.js';
|
|
35
|
+
window.customElements.define('p-button', Button);
|
|
36
|
+
window.customElements.define('p-elevation', Elevation);
|
|
37
|
+
window.customElements.define('p-focus-ring', FocusRing);
|
|
38
|
+
window.customElements.define('p-ripple', Ripple);
|
|
39
|
+
window.customElements.define('p-icon', Icon);
|
|
40
|
+
</script>
|
|
41
|
+
</body>
|
|
42
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Button } from './button.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
+
|
|
3
|
+
export class ClockController implements ReactiveController {
|
|
4
|
+
host: ReactiveControllerHost;
|
|
5
|
+
|
|
6
|
+
value = new Date();
|
|
7
|
+
|
|
8
|
+
timeout: number;
|
|
9
|
+
|
|
10
|
+
private _timerID?: any;
|
|
11
|
+
|
|
12
|
+
constructor(host: ReactiveControllerHost, timeout = 1000) {
|
|
13
|
+
this.host = host;
|
|
14
|
+
this.host.addController(this);
|
|
15
|
+
this.timeout = timeout;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
hostConnected() {
|
|
19
|
+
// Start a timer when the host is connected
|
|
20
|
+
this._timerID = setInterval(() => {
|
|
21
|
+
this.value = new Date();
|
|
22
|
+
// Update the host with new value
|
|
23
|
+
this.host.requestUpdate();
|
|
24
|
+
}, this.timeout);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
hostDisconnected() {
|
|
28
|
+
// Clear the timer when the host is disconnected
|
|
29
|
+
clearInterval(this._timerID);
|
|
30
|
+
this._timerID = undefined;
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/clock/clock.ts
CHANGED
|
@@ -1,57 +1,39 @@
|
|
|
1
|
-
import { html, LitElement } from 'lit';
|
|
2
|
-
import { property
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* @
|
|
8
|
-
* @
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @
|
|
12
|
-
*
|
|
13
|
-
* -
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
disconnectedCallback() {
|
|
42
|
-
if (this._timerId) {
|
|
43
|
-
clearInterval(this._timerId);
|
|
44
|
-
}
|
|
45
|
-
super.disconnectedCallback();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
__updateCurrentTime() {
|
|
49
|
-
this.currentTime = new Date().toLocaleTimeString('en-US', {
|
|
50
|
-
timeZone: this.timezone,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
render() {
|
|
55
|
-
return html`<div class="current-time">${this.currentTime}</div>`;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
1
|
+
import { html, LitElement } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import styles from './clock.scss';
|
|
4
|
+
import { ClockController } from './ClockController.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @label Clock
|
|
8
|
+
* @tag p-clock
|
|
9
|
+
* @rawTag clock
|
|
10
|
+
*
|
|
11
|
+
* @summary Displays the current time in a given timezone.
|
|
12
|
+
* @overview
|
|
13
|
+
* - Clocks are used to display the current time in a specified timezone.
|
|
14
|
+
* - They can be displayed in various formats, including 12-hour and 24-hour time.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```html
|
|
18
|
+
* <p-clock></p-clock>
|
|
19
|
+
* ```
|
|
20
|
+
* @tags display
|
|
21
|
+
*/
|
|
22
|
+
export class Clock extends LitElement {
|
|
23
|
+
static styles = [styles];
|
|
24
|
+
|
|
25
|
+
clockController = new ClockController(this, 100);
|
|
26
|
+
|
|
27
|
+
@property() timezone?: string;
|
|
28
|
+
|
|
29
|
+
__formatDate(date: Date) {
|
|
30
|
+
return date.toLocaleTimeString('en-US', {
|
|
31
|
+
timeZone: this.timezone,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
render() {
|
|
36
|
+
const currentDate = this.__formatDate(this.clockController.value);
|
|
37
|
+
return html`<div class="current-time">${currentDate}</div>`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { html, LitElement } from 'lit';
|
|
2
|
+
import { property, state } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import styles from './code-highlighter.scss';
|
|
5
|
+
import { observerSlotChangesWithCallback } from '../utils.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @label Code Highlighter
|
|
9
|
+
* @tag p-code-highlighter
|
|
10
|
+
* @rawTag code-highlighter
|
|
11
|
+
*
|
|
12
|
+
* @summary The code highlighter component is used to display code snippets with syntax highlighting.
|
|
13
|
+
* @overview
|
|
14
|
+
* <p>The <strong>Code Highlighter</strong> component allows you to display code snippets with syntax highlighting for various programming languages. It supports features like line numbers, code formatting, and a copy-to-clipboard button.</p>
|
|
15
|
+
*
|
|
16
|
+
* @cssprop --divider-color - Controls the color of the divider.
|
|
17
|
+
* @cssprop --divider-padding - Controls the padding of the divider.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```html
|
|
21
|
+
* <p-divider style="width: 12rem;">or</p-divider>
|
|
22
|
+
* ```
|
|
23
|
+
* @tags display
|
|
24
|
+
*/
|
|
25
|
+
export class CodeHighlighter extends LitElement {
|
|
26
|
+
static styles = [styles];
|
|
27
|
+
|
|
28
|
+
@property({ type: Boolean, reflect: true }) vertical = false;
|
|
29
|
+
|
|
30
|
+
@state()
|
|
31
|
+
slotHasContent = false;
|
|
32
|
+
|
|
33
|
+
firstUpdated() {
|
|
34
|
+
observerSlotChangesWithCallback(
|
|
35
|
+
this.renderRoot.querySelector('slot'),
|
|
36
|
+
hasContent => {
|
|
37
|
+
this.slotHasContent = hasContent;
|
|
38
|
+
this.requestUpdate();
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
render() {
|
|
44
|
+
return html`<div
|
|
45
|
+
class=${classMap({
|
|
46
|
+
divider: true,
|
|
47
|
+
vertical: this.vertical,
|
|
48
|
+
'slot-has-content': this.slotHasContent,
|
|
49
|
+
})}
|
|
50
|
+
>
|
|
51
|
+
<div class="line"></div>
|
|
52
|
+
<div class="slot-container">
|
|
53
|
+
<slot></slot>
|
|
54
|
+
</div>
|
|
55
|
+
<div class="line"></div>
|
|
56
|
+
</div>`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang='en-GB'>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset='utf-8'>
|
|
5
|
+
<meta name='viewport' content='width=device-width, initial-scale=1.0, viewport-fit=cover' />
|
|
6
|
+
<link rel='stylesheet' href='/dist/assets/styles/tokens.css' />
|
|
7
|
+
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
|
|
8
|
+
|
|
9
|
+
<style>
|
|
10
|
+
body {
|
|
11
|
+
background: #fafafa;
|
|
12
|
+
}
|
|
13
|
+
</style>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
<style>
|
|
19
|
+
.container-horizontal {
|
|
20
|
+
display: inline-block;
|
|
21
|
+
margin-right: 1rem;
|
|
22
|
+
padding: 1rem;
|
|
23
|
+
width: 200px;
|
|
24
|
+
border: 1px solid var(--color-outline);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.container-vertical {
|
|
28
|
+
display: flex;
|
|
29
|
+
height: 150px;
|
|
30
|
+
margin-bottom: 1rem;
|
|
31
|
+
padding: 1rem;
|
|
32
|
+
width: 250px;
|
|
33
|
+
border: 1px solid var(--color-outline);
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
<div class="container-horizontal">
|
|
40
|
+
<p>Content A</p>
|
|
41
|
+
<p-divider>or</p-divider>
|
|
42
|
+
<p>Content B</p>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<div class="container-vertical">
|
|
46
|
+
<p>Content A</p>
|
|
47
|
+
<p-divider vertical="true">or</p-divider>
|
|
48
|
+
<p>Content B</p>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
<script type='module'>
|
|
54
|
+
import { Divider } from '/dist/index.js';
|
|
55
|
+
window.customElements.define('p-divider', Divider);
|
|
56
|
+
</script>
|
|
57
|
+
</body>
|
|
58
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CodeHighlighter } from './code-highlighter.js';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
@use '../../scss/mixin';
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
|
|
6
|
+
--divider-color: var(--color-outline-variant);
|
|
7
|
+
--divider-padding: var(--spacing-200);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.divider {
|
|
11
|
+
display: flex;
|
|
12
|
+
margin: 0;
|
|
13
|
+
@include mixin.get-typography(body-small-emphasized);
|
|
14
|
+
color: var(--divider-color);
|
|
15
|
+
|
|
16
|
+
&:not(.vertical) {
|
|
17
|
+
width: 100%;
|
|
18
|
+
padding: var(--divider-padding) 0;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
|
|
22
|
+
.line {
|
|
23
|
+
width: 100%;
|
|
24
|
+
border-top: 1px solid var(--divider-color);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&.slot-has-content .slot-container {
|
|
28
|
+
padding: 0 var(--spacing-200);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.vertical {
|
|
33
|
+
height: 100%;
|
|
34
|
+
padding: 0 var(--divider-padding);
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
|
|
39
|
+
.line {
|
|
40
|
+
height: 100%;
|
|
41
|
+
border-right: 1px solid var(--divider-color);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&.slot-has-content .slot-container {
|
|
45
|
+
padding: var(--spacing-200) 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
:host(:not([vertical])) {
|
|
51
|
+
width: auto;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
:host([vertical]) {
|
|
55
|
+
height: auto;
|
|
56
|
+
}
|