wj-elements 0.1.121 → 0.1.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/styles.css +11 -0
- package/dist/wje-animation.js +1 -1
- package/dist/wje-element.js +15 -4
- package/dist/wje-radio-group.js +155 -18
- package/dist/wje-sliding-container.js +26 -22
- package/dist/wje-toast.js +201 -23
- package/package.json +1 -1
package/dist/styles.css
CHANGED
|
@@ -823,4 +823,15 @@ z = font size
|
|
|
823
823
|
content: attr(data-text);
|
|
824
824
|
padding: 0 1rem;
|
|
825
825
|
text-transform: uppercase;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
.wje-toast-stack {
|
|
829
|
+
position: fixed;
|
|
830
|
+
top: 0;
|
|
831
|
+
margin: 0 .5rem;
|
|
832
|
+
width: 300px;
|
|
833
|
+
max-width: 100%;
|
|
834
|
+
max-height: 100%;
|
|
835
|
+
overflow: auto;
|
|
836
|
+
z-index: 9999;
|
|
826
837
|
}
|
package/dist/wje-animation.js
CHANGED
|
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
import WJElement from "./wje-element.js";
|
|
8
8
|
import { fetchAndParseCSS } from "./wje-fetchAndParseCSS.js";
|
|
9
|
-
const styles = '/*\r\n[ Standard Element ]\r\n*/\r\n\r\nhtml {\r\n font-size: 100%;\r\n -ms-text-size-adjust: 100%;\r\n -webkit-text-size-adjust: 100%;\r\n}\r\nbody {\r\n color: var(--wje-color-contrast-8);\r\n font-family: var(--wje-font-family);\r\n font-size: var(--wje-font-size);\r\n font-weight: normal;\r\n letter-spacing: 0.01em;\r\n -webkit-font-smoothing: antialiased;\r\n -webkit-text-size-adjust: 100%;\r\n -ms-text-size-adjust: 100%;\r\n -webkit-font-feature-settings: "kern" 1;\r\n -moz-font-feature-settings: "kern" 1;\r\n margin: 0;\r\n padding: 0 !important;\r\n}\r\n/* Headings\r\n------------------------------------\r\n*/\r\nh1,\r\nh2,\r\nh3,\r\nh4,\r\nh5,\r\nh6 {\r\n margin: .625rem 0;\r\n font-family: var(--wje-font-family);\r\n -webkit-font-smoothing: antialiased;\r\n -webkit-text-size-adjust: 100%;\r\n -ms-text-size-adjust: 100%;\r\n font-weight: 500;\r\n color: inherit;\r\n display: inline-block;\r\n}\r\nh1 {\r\n font-size: var(--wje-font-size-2x-large);\r\n line-height: 44px;\r\n letter-spacing: -0.0141279em;\r\n}\r\nh2 {\r\n font-size: var(--wje-font-size-x-large);\r\n line-height: 34px;\r\n letter-spacing: -0.021em;\r\n}\r\nh3 {\r\n font-size: var(--wje-font-size-large);\r\n line-height: 28px;\r\n letter-spacing: -0.0114923em;\r\n}\r\nh4 {\r\n font-size: var(--wje-font-size-large);\r\n line-height: 26px;\r\n letter-spacing: -0.00865734em;\r\n}\r\nh5 {\r\n font-size: var(--wje-font-size-medium);\r\n line-height: 24px;\r\n letter-spacing: -0.00630069em;\r\n}\r\nh3 small,\r\nh4 small,\r\nh5 small {\r\n font-weight: 300;\r\n}\r\nh1.block,\r\nh2.block,\r\nh3.block,\r\nh4.block,\r\nh5.block,\r\nh6.block {\r\n padding-bottom: .625rem;\r\n}\r\n/* Lins and Others\r\n------------------------------------\r\n*/\r\na {\r\n text-shadow: none !important;\r\n color: var(--wje-color-primary-11);\r\n transition: color 0.1s linear 0s, background-color 0.1s linear 0s,\r\n opacity 0.2s linear 0s !important;\r\n font-weight: 500;\r\n}\r\na:focus,\r\na:hover,\r\na:active {\r\n color: var(--wje-color-primary);\r\n}\r\n\r\na,\r\na:focus,\r\na:hover,\r\na:active {\r\n outline: 0 !important;\r\n text-decoration: none;\r\n}\r\n\r\na.no-style{\r\n color: inherit;\r\n font-weight: normal;\r\n}\r\n\r\nbr {\r\n line-height: normal;\r\n clear: both;\r\n}\r\n\r\np {\r\n display: block;\r\n color: inherit;\r\n font-size: var(--wje-font-size);\r\n font-weight: normal;\r\n letter-spacing: 0.00177646em;\r\n line-height: 21px;\r\n margin: 0 0 .625rem 0;\r\n font-style: normal;\r\n white-space: normal;\r\n}\r\n\r\nsmall,\r\n.small {\r\n line-height: 18px;\r\n font-size: 85.714%;\r\n}\r\n\r\nlabel {\r\n &.inline {\r\n display: inline-block;\r\n position: relative;\r\n top: 0;\r\n font-size: 13px;\r\n }\r\n}\r\n\r\nul,\r\nol {\r\n margin-bottom: .625rem;\r\n & > li {\r\n padding-left: 3px;\r\n line-height: 24px;\r\n }\r\n &.lg-icon {\r\n & > li {\r\n font-size: 21px;\r\n & span {\r\n font-size: 14px;\r\n }\r\n }\r\n }\r\n &.no-style {\r\n list-style: none;\r\n padding-left: 5px;\r\n }\r\n}\r\n\r\naddress {\r\n margin-bottom: 0;\r\n a {\r\n color: var(--wje-color-contrast-8);\r\n }\r\n}\r\n\r\nblockquote {\r\n padding: 4px 0 0 18px;\r\n border-left: 0;\r\n &:before {\r\n content: "\\e95d";\r\n font-size: 20px;\r\n margin-right: 6px;\r\n float: left;\r\n position: relative;\r\n top: -12px;\r\n }\r\n p {\r\n font-size: 16px;\r\n margin-bottom: 4px;\r\n }\r\n small {\r\n line-height: 29px;\r\n color: var(--wje-color-contrast-8);\r\n &:before {\r\n content: "—";\r\n margin-right: 6px;\r\n }\r\n }\r\n &.pull-right {\r\n border-right: 0;\r\n &:before {\r\n float: right;\r\n content: "";\r\n margin-left: 6px;\r\n margin-right: 0;\r\n }\r\n small {\r\n padding-right: 30px;\r\n &:after {\r\n content: "";\r\n }\r\n }\r\n }\r\n}\r\nhr {\r\n border-color: var(--wje-border-color);\r\n &.double {\r\n border-width: 2px;\r\n }\r\n &.dotted {\r\n border-style: dotted none none;\r\n }\r\n}\r\n\r\n.ff-sup {\r\n font-feature-settings: "kern" 1, "sups" 1;\r\n -webkit-font-feature-settings: "kern" 1, "sups" 1;\r\n -moz-font-feature-settings: "kern" 1, "sups" 1;\r\n}\r\n\r\n.ff-sub {\r\n font-feature-settings: "kern" 1, "subs" 1;\r\n -webkit-font-feature-settings: "kern" 1, "subs" 1;\r\n -moz-font-feature-settings: "kern" 1, "subs" 1;\r\n}\r\n\r\n/* Standard HTML Typography tags\r\n------------------------------------\r\n*/\r\n\r\ncode {\r\n color: var(--wje-color-contrast-6);\r\n background-color: var(--wje-color);\r\n font-size: 97%;\r\n position: relative;\r\n line-height: inherit;\r\n border-radius: 3px;\r\n padding: 5px 7px;\r\n margin: 0;\r\n &:hover {\r\n color: var(--wje-color-complete);\r\n }\r\n &.code-sm{\r\n padding: 3px 6px;\r\n }\r\n}\r\n\r\nfigcaption {\r\n font-size: 13px;\r\n margin-top: .625rem;\r\n font-weight: 400;\r\n display: block;\r\n letter-spacing: 0.008em;\r\n text-align: center;\r\n color: var(--wje-color-contrast-6);\r\n line-height: 1.46;\r\n}\r\n\r\nem {\r\n font-style: italic !important;\r\n font-family: inherit;\r\n font-weight: inherit;\r\n}\r\n\r\nins {\r\n font-family: var(--wje-font-family);\r\n border-bottom: 1px solid #d0d0d0;\r\n text-decoration: none;\r\n color: var(--wje-color-contrast-8);\r\n font-weight: normal;\r\n font-size: 94%;\r\n}\r\n\r\ncite {\r\n font-family: var(--wje-font-family);\r\n font-weight: 300;\r\n color: var(--wje-color-contrast-6);\r\n text-decoration: none;\r\n font-style: normal;\r\n hanging-punctuation: first;\r\n}\r\n\r\nsup {\r\n top: -0.28em;\r\n font-size: 70%;\r\n}\r\n\r\nsub {\r\n bottom: 0.03em;\r\n}\r\n\r\nvar {\r\n font-family: var(--wje-font-family);\r\n font-feature-settings: "calt" 1, "tnum" 1, "frac" 1, "case" 1, "ss01" 1,\r\n "cv11" 1;\r\n}\r\n\r\nabbr {\r\n text-decoration: none;\r\n letter-spacing: 0.01em;\r\n background-color: transparent;\r\n border-bottom: 2px solid #ffba5a;\r\n transition-property: color, background, border;\r\n transition-duration: 0.15s;\r\n transition-timing-function: linear;\r\n color: var(--wje-color-contrast-8);\r\n}\r\n\r\nq {\r\n font-family: var(--wje-font-family);\r\n font-weight: 500;\r\n font-size: 20px;\r\n hanging-punctuation: first;\r\n\r\n &:before {\r\n content: "\\201C";\r\n color: rgba(0, 0, 0, 0.44);\r\n font-size: 35px;\r\n }\r\n\r\n &:after {\r\n content: "\\201D";\r\n font-size: 35px;\r\n color: rgba(0, 0, 0, 0.44);\r\n }\r\n}\r\naudio {\r\n margin-top: 42px;\r\n}\r\nhr {\r\n clear: both;\r\n margin-bottom: 42px;\r\n margin-top: 42px;\r\n border: 0;\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.13);\r\n}\r\naddress {\r\n font-family: var(--wje-font-family);\r\n font-style: normal;\r\n margin: 0 0 1.75em;\r\n font-size: 14px;\r\n line-height: 24px;\r\n margin-top: 24px;\r\n}\r\nabbr {\r\n text-decoration: none;\r\n letter-spacing: 0.01em;\r\n background-color: transparent;\r\n border-bottom: 2px solid #ffba5a;\r\n transition-property: color, background, border;\r\n transition-duration: 0.15s;\r\n transition-timing-function: linear;\r\n color: var(--wje-color-contrast-8);\r\n}\r\n\r\nacronym {\r\n text-decoration: none;\r\n text-transform: uppercase;\r\n letter-spacing: 0.06em;\r\n background-color: transparent;\r\n border-bottom: 2px solid #ffba5a;\r\n transition-property: color, background, border;\r\n transition-duration: 0.15s;\r\n transition-timing-function: linear;\r\n color: var(--wje-color-contrast-8);\r\n}\r\n\r\npre {\r\n tab-size: 4;\r\n font-size: 85.714%;\r\n overflow-x: auto;\r\n font-family: monospace, monospace;\r\n line-height: 1.7;\r\n counter-reset: line;\r\n background-color: var(--wje-color-contrast-3)er;\r\n color: var(--wje-color-contrast-8);\r\n margin-inline: 0;\r\n padding: 1rem 1.25rem;\r\n border-radius: 3px;\r\n margin-top: 1rem;\r\n margin-bottom: 1rem;\r\n}\r\n\r\ndt {\r\n font-weight: 700;\r\n margin-bottom: 5px;\r\n}\r\n\r\ndd {\r\n margin: 0 0 1.75em;\r\n}\r\n\r\nkbd {\r\n font-size: 85.714%;\r\n font-family: var(--wje-font-family);\r\n position: relative;\r\n line-height: 34px;\r\n top: -3px;\r\n letter-spacing: 0.01em;\r\n padding: 5px 7px;\r\n margin: 0;\r\n color: rgba(0, 0, 0, 0.53);\r\n background-color: #fff;\r\n border-radius: 3px;\r\n box-shadow: 0 2px 0 1px #c7c7c7, 0 1px 0 1px rgba(0, 0, 0, 0.15),\r\n 0 0 0 1px #ececec;\r\n}\r\n\r\n/* Types\r\n------------------------------------\r\n*/\r\n\r\n.overline {\r\n text-transform: uppercase;\r\n display: inline-block;\r\n letter-spacing: 0.06em;\r\n font-size: 11px;\r\n}\r\n\r\n/* Font Sizes\r\n------------------------------------\r\n*/\r\n\r\n.small-text {\r\n font-size: 12px !important;\r\n letter-spacing: 0.00849077em;\r\n line-height: 18px;\r\n a {\r\n text-decoration: underline;\r\n }\r\n}\r\n.normal-text {\r\n font-size: 13px !important;\r\n}\r\n.large-text {\r\n font-size: 15px !important;\r\n}\r\n\r\n/* Font Weights\r\n------------------------------------\r\n */\r\n\r\n.normal {\r\n font-weight: normal !important;\r\n}\r\n.semi-bold {\r\n font-weight: 500 !important;\r\n}\r\n.bold {\r\n font-weight: 600 !important;\r\n}\r\n.light {\r\n font-weight: 300 !important;\r\n}\r\n\r\n/* Misc\r\n------------------------------------\r\n*/\r\n\r\n.all-caps {\r\n text-transform: uppercase;\r\n letter-spacing: 0.07em !important;\r\n}\r\n.text-uppercase {\r\n text-transform: uppercase !important;\r\n letter-spacing: 0.07em !important;\r\n}\r\n.muted {\r\n color: var(--wje-color-contrast-6);\r\n}\r\n.hint-text {\r\n opacity: 0.76 !important;\r\n}\r\n.no-decoration {\r\n text-decoration: none !important;\r\n}\r\n\r\n.text-ellipsis {\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n}\r\n\r\n/* Gradients\r\n------------------------------------\r\n*/\r\n.gradient-grey {\r\n background: -webkit-linear-gradient(\r\n top,\r\n rgba(0, 0, 0, 0) 0%,\r\n rgba(0, 0, 0, 0.8) 75%\r\n );\r\n background: linear-gradient(\r\n to bottom,\r\n rgba(0, 0, 0, 0) 0%,\r\n rgba(0, 0, 0, 0.8) 75%\r\n );\r\n}\r\n.gradient-black {\r\n background: -webkit-linear-gradient(\r\n top,\r\n rgba(0, 0, 0, 0) 0%,\r\n rgba(0, 0, 0, 0.8) 75%\r\n );\r\n background: linear-gradient(\r\n to bottom,\r\n rgba(0, 0, 0, 0) 0%,\r\n rgba(0, 0, 0, 0.8) 75%\r\n );\r\n}\r\n\r\n/* Other Colors\r\n------------------------------------\r\n*/\r\n.bg-black {\r\n background-color: var(--wje-color-black) !important;\r\n color: var(--wje-color-contrast-0);\r\n}\r\n.bg-white {\r\n background-color: var(--wje-color-contrast-0) !important;\r\n color: var(--wje-color-contrast-8);\r\n}\r\n.bg-transparent {\r\n background-color: transparent !important;\r\n}\r\n\r\n/* Text Colors */\r\n.link {\r\n opacity: 0.7;\r\n &:hover {\r\n opacity: 1;\r\n }\r\n}\r\n\r\n/* Text Aligngments\r\n------------------------------------\r\n*/\r\n\r\n.text-right {\r\n text-align: right !important;\r\n}\r\n.text-left {\r\n text-align: left !important;\r\n}\r\n.text-center {\r\n text-align: center !important;\r\n}\r\n\r\n/* Strokes\r\n------------------------------------\r\n*/\r\n\r\n.stroke-primary {\r\n stroke: var(--wje-color-primary) !important;\r\n}\r\n.stroke-complete {\r\n stroke: var(--wje-color-complete) !important;\r\n}\r\n.stroke-success {\r\n stroke: var(--wje-color-success) !important;\r\n}\r\n.stroke-info {\r\n stroke: var(--wje-color-info) !important;\r\n}\r\n.stroke-warning {\r\n stroke: var(--wje-color-warning) !important;\r\n}\r\n.stroke-danger {\r\n stroke: var(--wje-color-danger) !important;\r\n}\r\n\r\n/* Font Sizes\r\n------------------------------------\r\ntracking =a+b×e(c × z)\r\n\r\na, b and c are constants\r\na = -0.0223\r\nb = 0.185\r\nc = -0.1745\r\nz = font size\r\n\r\n*/\r\n.fs-x-small {\r\n font-size: var(--wje-font-size-x-small) !important;\r\n letter-spacing: 0.0180093em;\r\n line-height: 15px;\r\n}\r\n.fs-small {\r\n font-size: var(--wje-font-size-small) !important;\r\n letter-spacing: 0.00849077em;\r\n line-height: 18px;\r\n}\r\n.fs {\r\n font-size: var(--wje-font-size) !important;\r\n letter-spacing: 0.00177646em;\r\n line-height: 22px;\r\n}\r\n\r\n.fs-medium {\r\n font-size: var(--wje-font-size-medium) !important;\r\n letter-spacing: -0.00295978em;\r\n line-height: 24px;\r\n}\r\n\r\n.fs-large {\r\n font-size: var(--wje-font-size-large) !important;\r\n letter-spacing: normal;\r\n line-height: normal;\r\n}\r\n\r\n.fs-x-large {\r\n font-size: var(--wje-font-size-x-large) !important;\r\n letter-spacing: normal;\r\n line-height: normal;\r\n}\r\n\r\n.fs-2x-large {\r\n font-size: var(--wje-font-size-2x-large) !important;\r\n letter-spacing: normal;\r\n line-height: normal;\r\n}\r\n\r\n.fs-3x-large {\r\n font-size: var(--wje-font-size-3x-large) !important;\r\n letter-spacing: normal;\r\n line-height: normal;\r\n}\r\n\r\n.fs-4x-large {\r\n font-size: var(--wje-font-size-4x-large) !important;\r\n letter-spacing: normal;\r\n line-height: normal;\r\n}\r\n\r\n/* Line-heights\r\n------------------------------------\r\n*/\r\n.lh-normal {\r\n line-height: normal;\r\n}\r\n.lh-10 {\r\n line-height: 10px;\r\n}\r\n.lh-11 {\r\n line-height: 11px;\r\n}\r\n.lh-12 {\r\n line-height: 12px;\r\n}\r\n.lh-13 {\r\n line-height: 13px;\r\n}\r\n.lh-14 {\r\n line-height: 14px;\r\n}\r\n.lh-15 {\r\n line-height: 15px;\r\n}\r\n.lh-16 {\r\n line-height: 16px;\r\n}\r\n\r\n/* Font Faces\r\n------------------------------------\r\n*/\r\n\r\n.font-arial {\r\n font-family: Arial, sans-serif !important;\r\n}\r\n.font-montserrat {\r\n font-family: var(--wje-font-family-secondary) !important;\r\n}\r\n.font-heading {\r\n font-family: var(--wje-font-family-secondary);\r\n}\r\n.font-secondary {\r\n font-family: var(--wje-font-family-secondary);\r\n}\r\n\r\n/* Wells\r\n------------------------------------\r\n*/\r\n.well {\r\n background-color: var(--wje-color-contrast-3);\r\n -webkit-border-radius: 3px;\r\n -moz-border-radius: 3px;\r\n border-radius: 3px;\r\n -webkit-box-shadow: none !important;\r\n -moz-box-shadow: none !important;\r\n box-shadow: none !important;\r\n border: none;\r\n background-image: none;\r\n &.well-large {\r\n padding: 24px;\r\n width: auto;\r\n }\r\n &.well-small {\r\n padding: 13px;\r\n width: auto;\r\n }\r\n &.green {\r\n background-color: var(--wje-color-complete);\r\n color: var(--wje-color-contrast-0);\r\n border: none;\r\n }\r\n}\r\n.overflow-ellipsis {\r\n text-overflow: ellipsis;\r\n overflow: hidden;\r\n white-space: nowrap;\r\n}\r\n\r\n/* Responsive Handlers : Typo\r\n------------------------------------\r\n*/\r\n\r\n@media (max-width: 1024px) {\r\n body,\r\n p {\r\n font-size: var(--wje-font-size-small);\r\n line-height: 20px;\r\n }\r\n\r\n h1 {\r\n font-size: var(--wje-font-size-2x-large);\r\n line-height: 44px;\r\n letter-spacing: -0.08px;\r\n }\r\n h2 {\r\n font-size: var(--wje-font-size-x-large);\r\n line-height: 40px;\r\n }\r\n h3 {\r\n font-size: var(--wje-font-size-large);\r\n line-height: 35.88px;\r\n }\r\n h4 {\r\n font-size: var(--wje-font-size-large);\r\n line-height: 33.88px;\r\n }\r\n h5 {\r\n font-size: var(--wje-font-size-medium);\r\n line-height: 25.88px;\r\n }\r\n small,\r\n .small {\r\n font-size: 89%;\r\n line-height: 17px;\r\n }\r\n}\r\n\r\n.alert {\r\n & > p,\r\n & > ul {\r\n margin-bottom: 0;\r\n }\r\n}\r\n.table {\r\n & > tbody {\r\n & > tr {\r\n & > td,\r\n & > th {\r\n line-height: 1.42857143;\r\n }\r\n }\r\n }\r\n & > tfoot {\r\n & > tr {\r\n & > td,\r\n & > th {\r\n line-height: 1.42857143;\r\n }\r\n }\r\n }\r\n & > thead {\r\n & > tr {\r\n & > td,\r\n & > th {\r\n line-height: 1.42857143;\r\n }\r\n }\r\n }\r\n}\r\n\r\n/* For Windows : Fixes\r\n------------------------------------\r\n*/\r\n\r\n\r\n.line-clamp-2 {\r\n display: -webkit-box;\r\n -webkit-line-clamp: 2;\r\n -webkit-box-orient: vertical;\r\n overflow: hidden;\r\n}\r\n\r\n.line-clamp-3 {\r\n display: -webkit-box;\r\n -webkit-line-clamp: 3;\r\n -webkit-box-orient: vertical;\r\n overflow: hidden;\r\n}\r\n\r\n.line-clamp-5 {\r\n display: -webkit-box;\r\n -webkit-line-clamp: 5;\r\n -webkit-box-orient: vertical;\r\n overflow: hidden;\r\n}\r\n\r\n.text-separator {\r\n display: block;\r\n text-align: center;\r\n margin: 1.5rem 0;\r\n width: 100%;\r\n background: linear-gradient(to top, transparent 0%, transparent calc(50% - 1px), var(--wje-border-color) calc(50% - 1px), var(--wje-border-color) calc(50% + 1px), transparent calc(50% + 1px), transparent 100%);\r\n}\r\n.text-separator::before {\r\n background: #fff;\r\n content: attr(data-text);\r\n padding: 0 1rem;\r\n text-transform: uppercase;\r\n}';
|
|
9
|
+
const styles = '/*\r\n[ Standard Element ]\r\n*/\r\n\r\nhtml {\r\n font-size: 100%;\r\n -ms-text-size-adjust: 100%;\r\n -webkit-text-size-adjust: 100%;\r\n}\r\nbody {\r\n color: var(--wje-color-contrast-8);\r\n font-family: var(--wje-font-family);\r\n font-size: var(--wje-font-size);\r\n font-weight: normal;\r\n letter-spacing: 0.01em;\r\n -webkit-font-smoothing: antialiased;\r\n -webkit-text-size-adjust: 100%;\r\n -ms-text-size-adjust: 100%;\r\n -webkit-font-feature-settings: "kern" 1;\r\n -moz-font-feature-settings: "kern" 1;\r\n margin: 0;\r\n padding: 0 !important;\r\n}\r\n/* Headings\r\n------------------------------------\r\n*/\r\nh1,\r\nh2,\r\nh3,\r\nh4,\r\nh5,\r\nh6 {\r\n margin: .625rem 0;\r\n font-family: var(--wje-font-family);\r\n -webkit-font-smoothing: antialiased;\r\n -webkit-text-size-adjust: 100%;\r\n -ms-text-size-adjust: 100%;\r\n font-weight: 500;\r\n color: inherit;\r\n display: inline-block;\r\n}\r\nh1 {\r\n font-size: var(--wje-font-size-2x-large);\r\n line-height: 44px;\r\n letter-spacing: -0.0141279em;\r\n}\r\nh2 {\r\n font-size: var(--wje-font-size-x-large);\r\n line-height: 34px;\r\n letter-spacing: -0.021em;\r\n}\r\nh3 {\r\n font-size: var(--wje-font-size-large);\r\n line-height: 28px;\r\n letter-spacing: -0.0114923em;\r\n}\r\nh4 {\r\n font-size: var(--wje-font-size-large);\r\n line-height: 26px;\r\n letter-spacing: -0.00865734em;\r\n}\r\nh5 {\r\n font-size: var(--wje-font-size-medium);\r\n line-height: 24px;\r\n letter-spacing: -0.00630069em;\r\n}\r\nh3 small,\r\nh4 small,\r\nh5 small {\r\n font-weight: 300;\r\n}\r\nh1.block,\r\nh2.block,\r\nh3.block,\r\nh4.block,\r\nh5.block,\r\nh6.block {\r\n padding-bottom: .625rem;\r\n}\r\n/* Lins and Others\r\n------------------------------------\r\n*/\r\na {\r\n text-shadow: none !important;\r\n color: var(--wje-color-primary-11);\r\n transition: color 0.1s linear 0s, background-color 0.1s linear 0s,\r\n opacity 0.2s linear 0s !important;\r\n font-weight: 500;\r\n}\r\na:focus,\r\na:hover,\r\na:active {\r\n color: var(--wje-color-primary);\r\n}\r\n\r\na,\r\na:focus,\r\na:hover,\r\na:active {\r\n outline: 0 !important;\r\n text-decoration: none;\r\n}\r\n\r\na.no-style{\r\n color: inherit;\r\n font-weight: normal;\r\n}\r\n\r\nbr {\r\n line-height: normal;\r\n clear: both;\r\n}\r\n\r\np {\r\n display: block;\r\n color: inherit;\r\n font-size: var(--wje-font-size);\r\n font-weight: normal;\r\n letter-spacing: 0.00177646em;\r\n line-height: 21px;\r\n margin: 0 0 .625rem 0;\r\n font-style: normal;\r\n white-space: normal;\r\n}\r\n\r\nsmall,\r\n.small {\r\n line-height: 18px;\r\n font-size: 85.714%;\r\n}\r\n\r\nlabel {\r\n &.inline {\r\n display: inline-block;\r\n position: relative;\r\n top: 0;\r\n font-size: 13px;\r\n }\r\n}\r\n\r\nul,\r\nol {\r\n margin-bottom: .625rem;\r\n & > li {\r\n padding-left: 3px;\r\n line-height: 24px;\r\n }\r\n &.lg-icon {\r\n & > li {\r\n font-size: 21px;\r\n & span {\r\n font-size: 14px;\r\n }\r\n }\r\n }\r\n &.no-style {\r\n list-style: none;\r\n padding-left: 5px;\r\n }\r\n}\r\n\r\naddress {\r\n margin-bottom: 0;\r\n a {\r\n color: var(--wje-color-contrast-8);\r\n }\r\n}\r\n\r\nblockquote {\r\n padding: 4px 0 0 18px;\r\n border-left: 0;\r\n &:before {\r\n content: "\\e95d";\r\n font-size: 20px;\r\n margin-right: 6px;\r\n float: left;\r\n position: relative;\r\n top: -12px;\r\n }\r\n p {\r\n font-size: 16px;\r\n margin-bottom: 4px;\r\n }\r\n small {\r\n line-height: 29px;\r\n color: var(--wje-color-contrast-8);\r\n &:before {\r\n content: "—";\r\n margin-right: 6px;\r\n }\r\n }\r\n &.pull-right {\r\n border-right: 0;\r\n &:before {\r\n float: right;\r\n content: "";\r\n margin-left: 6px;\r\n margin-right: 0;\r\n }\r\n small {\r\n padding-right: 30px;\r\n &:after {\r\n content: "";\r\n }\r\n }\r\n }\r\n}\r\nhr {\r\n border-color: var(--wje-border-color);\r\n &.double {\r\n border-width: 2px;\r\n }\r\n &.dotted {\r\n border-style: dotted none none;\r\n }\r\n}\r\n\r\n.ff-sup {\r\n font-feature-settings: "kern" 1, "sups" 1;\r\n -webkit-font-feature-settings: "kern" 1, "sups" 1;\r\n -moz-font-feature-settings: "kern" 1, "sups" 1;\r\n}\r\n\r\n.ff-sub {\r\n font-feature-settings: "kern" 1, "subs" 1;\r\n -webkit-font-feature-settings: "kern" 1, "subs" 1;\r\n -moz-font-feature-settings: "kern" 1, "subs" 1;\r\n}\r\n\r\n/* Standard HTML Typography tags\r\n------------------------------------\r\n*/\r\n\r\ncode {\r\n color: var(--wje-color-contrast-6);\r\n background-color: var(--wje-color);\r\n font-size: 97%;\r\n position: relative;\r\n line-height: inherit;\r\n border-radius: 3px;\r\n padding: 5px 7px;\r\n margin: 0;\r\n &:hover {\r\n color: var(--wje-color-complete);\r\n }\r\n &.code-sm{\r\n padding: 3px 6px;\r\n }\r\n}\r\n\r\nfigcaption {\r\n font-size: 13px;\r\n margin-top: .625rem;\r\n font-weight: 400;\r\n display: block;\r\n letter-spacing: 0.008em;\r\n text-align: center;\r\n color: var(--wje-color-contrast-6);\r\n line-height: 1.46;\r\n}\r\n\r\nem {\r\n font-style: italic !important;\r\n font-family: inherit;\r\n font-weight: inherit;\r\n}\r\n\r\nins {\r\n font-family: var(--wje-font-family);\r\n border-bottom: 1px solid #d0d0d0;\r\n text-decoration: none;\r\n color: var(--wje-color-contrast-8);\r\n font-weight: normal;\r\n font-size: 94%;\r\n}\r\n\r\ncite {\r\n font-family: var(--wje-font-family);\r\n font-weight: 300;\r\n color: var(--wje-color-contrast-6);\r\n text-decoration: none;\r\n font-style: normal;\r\n hanging-punctuation: first;\r\n}\r\n\r\nsup {\r\n top: -0.28em;\r\n font-size: 70%;\r\n}\r\n\r\nsub {\r\n bottom: 0.03em;\r\n}\r\n\r\nvar {\r\n font-family: var(--wje-font-family);\r\n font-feature-settings: "calt" 1, "tnum" 1, "frac" 1, "case" 1, "ss01" 1,\r\n "cv11" 1;\r\n}\r\n\r\nabbr {\r\n text-decoration: none;\r\n letter-spacing: 0.01em;\r\n background-color: transparent;\r\n border-bottom: 2px solid #ffba5a;\r\n transition-property: color, background, border;\r\n transition-duration: 0.15s;\r\n transition-timing-function: linear;\r\n color: var(--wje-color-contrast-8);\r\n}\r\n\r\nq {\r\n font-family: var(--wje-font-family);\r\n font-weight: 500;\r\n font-size: 20px;\r\n hanging-punctuation: first;\r\n\r\n &:before {\r\n content: "\\201C";\r\n color: rgba(0, 0, 0, 0.44);\r\n font-size: 35px;\r\n }\r\n\r\n &:after {\r\n content: "\\201D";\r\n font-size: 35px;\r\n color: rgba(0, 0, 0, 0.44);\r\n }\r\n}\r\naudio {\r\n margin-top: 42px;\r\n}\r\nhr {\r\n clear: both;\r\n margin-bottom: 42px;\r\n margin-top: 42px;\r\n border: 0;\r\n border-bottom: 1px solid rgba(0, 0, 0, 0.13);\r\n}\r\naddress {\r\n font-family: var(--wje-font-family);\r\n font-style: normal;\r\n margin: 0 0 1.75em;\r\n font-size: 14px;\r\n line-height: 24px;\r\n margin-top: 24px;\r\n}\r\nabbr {\r\n text-decoration: none;\r\n letter-spacing: 0.01em;\r\n background-color: transparent;\r\n border-bottom: 2px solid #ffba5a;\r\n transition-property: color, background, border;\r\n transition-duration: 0.15s;\r\n transition-timing-function: linear;\r\n color: var(--wje-color-contrast-8);\r\n}\r\n\r\nacronym {\r\n text-decoration: none;\r\n text-transform: uppercase;\r\n letter-spacing: 0.06em;\r\n background-color: transparent;\r\n border-bottom: 2px solid #ffba5a;\r\n transition-property: color, background, border;\r\n transition-duration: 0.15s;\r\n transition-timing-function: linear;\r\n color: var(--wje-color-contrast-8);\r\n}\r\n\r\npre {\r\n tab-size: 4;\r\n font-size: 85.714%;\r\n overflow-x: auto;\r\n font-family: monospace, monospace;\r\n line-height: 1.7;\r\n counter-reset: line;\r\n background-color: var(--wje-color-contrast-3)er;\r\n color: var(--wje-color-contrast-8);\r\n margin-inline: 0;\r\n padding: 1rem 1.25rem;\r\n border-radius: 3px;\r\n margin-top: 1rem;\r\n margin-bottom: 1rem;\r\n}\r\n\r\ndt {\r\n font-weight: 700;\r\n margin-bottom: 5px;\r\n}\r\n\r\ndd {\r\n margin: 0 0 1.75em;\r\n}\r\n\r\nkbd {\r\n font-size: 85.714%;\r\n font-family: var(--wje-font-family);\r\n position: relative;\r\n line-height: 34px;\r\n top: -3px;\r\n letter-spacing: 0.01em;\r\n padding: 5px 7px;\r\n margin: 0;\r\n color: rgba(0, 0, 0, 0.53);\r\n background-color: #fff;\r\n border-radius: 3px;\r\n box-shadow: 0 2px 0 1px #c7c7c7, 0 1px 0 1px rgba(0, 0, 0, 0.15),\r\n 0 0 0 1px #ececec;\r\n}\r\n\r\n/* Types\r\n------------------------------------\r\n*/\r\n\r\n.overline {\r\n text-transform: uppercase;\r\n display: inline-block;\r\n letter-spacing: 0.06em;\r\n font-size: 11px;\r\n}\r\n\r\n/* Font Sizes\r\n------------------------------------\r\n*/\r\n\r\n.small-text {\r\n font-size: 12px !important;\r\n letter-spacing: 0.00849077em;\r\n line-height: 18px;\r\n a {\r\n text-decoration: underline;\r\n }\r\n}\r\n.normal-text {\r\n font-size: 13px !important;\r\n}\r\n.large-text {\r\n font-size: 15px !important;\r\n}\r\n\r\n/* Font Weights\r\n------------------------------------\r\n */\r\n\r\n.normal {\r\n font-weight: normal !important;\r\n}\r\n.semi-bold {\r\n font-weight: 500 !important;\r\n}\r\n.bold {\r\n font-weight: 600 !important;\r\n}\r\n.light {\r\n font-weight: 300 !important;\r\n}\r\n\r\n/* Misc\r\n------------------------------------\r\n*/\r\n\r\n.all-caps {\r\n text-transform: uppercase;\r\n letter-spacing: 0.07em !important;\r\n}\r\n.text-uppercase {\r\n text-transform: uppercase !important;\r\n letter-spacing: 0.07em !important;\r\n}\r\n.muted {\r\n color: var(--wje-color-contrast-6);\r\n}\r\n.hint-text {\r\n opacity: 0.76 !important;\r\n}\r\n.no-decoration {\r\n text-decoration: none !important;\r\n}\r\n\r\n.text-ellipsis {\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n}\r\n\r\n/* Gradients\r\n------------------------------------\r\n*/\r\n.gradient-grey {\r\n background: -webkit-linear-gradient(\r\n top,\r\n rgba(0, 0, 0, 0) 0%,\r\n rgba(0, 0, 0, 0.8) 75%\r\n );\r\n background: linear-gradient(\r\n to bottom,\r\n rgba(0, 0, 0, 0) 0%,\r\n rgba(0, 0, 0, 0.8) 75%\r\n );\r\n}\r\n.gradient-black {\r\n background: -webkit-linear-gradient(\r\n top,\r\n rgba(0, 0, 0, 0) 0%,\r\n rgba(0, 0, 0, 0.8) 75%\r\n );\r\n background: linear-gradient(\r\n to bottom,\r\n rgba(0, 0, 0, 0) 0%,\r\n rgba(0, 0, 0, 0.8) 75%\r\n );\r\n}\r\n\r\n/* Other Colors\r\n------------------------------------\r\n*/\r\n.bg-black {\r\n background-color: var(--wje-color-black) !important;\r\n color: var(--wje-color-contrast-0);\r\n}\r\n.bg-white {\r\n background-color: var(--wje-color-contrast-0) !important;\r\n color: var(--wje-color-contrast-8);\r\n}\r\n.bg-transparent {\r\n background-color: transparent !important;\r\n}\r\n\r\n/* Text Colors */\r\n.link {\r\n opacity: 0.7;\r\n &:hover {\r\n opacity: 1;\r\n }\r\n}\r\n\r\n/* Text Aligngments\r\n------------------------------------\r\n*/\r\n\r\n.text-right {\r\n text-align: right !important;\r\n}\r\n.text-left {\r\n text-align: left !important;\r\n}\r\n.text-center {\r\n text-align: center !important;\r\n}\r\n\r\n/* Strokes\r\n------------------------------------\r\n*/\r\n\r\n.stroke-primary {\r\n stroke: var(--wje-color-primary) !important;\r\n}\r\n.stroke-complete {\r\n stroke: var(--wje-color-complete) !important;\r\n}\r\n.stroke-success {\r\n stroke: var(--wje-color-success) !important;\r\n}\r\n.stroke-info {\r\n stroke: var(--wje-color-info) !important;\r\n}\r\n.stroke-warning {\r\n stroke: var(--wje-color-warning) !important;\r\n}\r\n.stroke-danger {\r\n stroke: var(--wje-color-danger) !important;\r\n}\r\n\r\n/* Font Sizes\r\n------------------------------------\r\ntracking =a+b×e(c × z)\r\n\r\na, b and c are constants\r\na = -0.0223\r\nb = 0.185\r\nc = -0.1745\r\nz = font size\r\n\r\n*/\r\n.fs-x-small {\r\n font-size: var(--wje-font-size-x-small) !important;\r\n letter-spacing: 0.0180093em;\r\n line-height: 15px;\r\n}\r\n.fs-small {\r\n font-size: var(--wje-font-size-small) !important;\r\n letter-spacing: 0.00849077em;\r\n line-height: 18px;\r\n}\r\n.fs {\r\n font-size: var(--wje-font-size) !important;\r\n letter-spacing: 0.00177646em;\r\n line-height: 22px;\r\n}\r\n\r\n.fs-medium {\r\n font-size: var(--wje-font-size-medium) !important;\r\n letter-spacing: -0.00295978em;\r\n line-height: 24px;\r\n}\r\n\r\n.fs-large {\r\n font-size: var(--wje-font-size-large) !important;\r\n letter-spacing: normal;\r\n line-height: normal;\r\n}\r\n\r\n.fs-x-large {\r\n font-size: var(--wje-font-size-x-large) !important;\r\n letter-spacing: normal;\r\n line-height: normal;\r\n}\r\n\r\n.fs-2x-large {\r\n font-size: var(--wje-font-size-2x-large) !important;\r\n letter-spacing: normal;\r\n line-height: normal;\r\n}\r\n\r\n.fs-3x-large {\r\n font-size: var(--wje-font-size-3x-large) !important;\r\n letter-spacing: normal;\r\n line-height: normal;\r\n}\r\n\r\n.fs-4x-large {\r\n font-size: var(--wje-font-size-4x-large) !important;\r\n letter-spacing: normal;\r\n line-height: normal;\r\n}\r\n\r\n/* Line-heights\r\n------------------------------------\r\n*/\r\n.lh-normal {\r\n line-height: normal;\r\n}\r\n.lh-10 {\r\n line-height: 10px;\r\n}\r\n.lh-11 {\r\n line-height: 11px;\r\n}\r\n.lh-12 {\r\n line-height: 12px;\r\n}\r\n.lh-13 {\r\n line-height: 13px;\r\n}\r\n.lh-14 {\r\n line-height: 14px;\r\n}\r\n.lh-15 {\r\n line-height: 15px;\r\n}\r\n.lh-16 {\r\n line-height: 16px;\r\n}\r\n\r\n/* Font Faces\r\n------------------------------------\r\n*/\r\n\r\n.font-arial {\r\n font-family: Arial, sans-serif !important;\r\n}\r\n.font-montserrat {\r\n font-family: var(--wje-font-family-secondary) !important;\r\n}\r\n.font-heading {\r\n font-family: var(--wje-font-family-secondary);\r\n}\r\n.font-secondary {\r\n font-family: var(--wje-font-family-secondary);\r\n}\r\n\r\n/* Wells\r\n------------------------------------\r\n*/\r\n.well {\r\n background-color: var(--wje-color-contrast-3);\r\n -webkit-border-radius: 3px;\r\n -moz-border-radius: 3px;\r\n border-radius: 3px;\r\n -webkit-box-shadow: none !important;\r\n -moz-box-shadow: none !important;\r\n box-shadow: none !important;\r\n border: none;\r\n background-image: none;\r\n &.well-large {\r\n padding: 24px;\r\n width: auto;\r\n }\r\n &.well-small {\r\n padding: 13px;\r\n width: auto;\r\n }\r\n &.green {\r\n background-color: var(--wje-color-complete);\r\n color: var(--wje-color-contrast-0);\r\n border: none;\r\n }\r\n}\r\n.overflow-ellipsis {\r\n text-overflow: ellipsis;\r\n overflow: hidden;\r\n white-space: nowrap;\r\n}\r\n\r\n/* Responsive Handlers : Typo\r\n------------------------------------\r\n*/\r\n\r\n@media (max-width: 1024px) {\r\n body,\r\n p {\r\n font-size: var(--wje-font-size-small);\r\n line-height: 20px;\r\n }\r\n\r\n h1 {\r\n font-size: var(--wje-font-size-2x-large);\r\n line-height: 44px;\r\n letter-spacing: -0.08px;\r\n }\r\n h2 {\r\n font-size: var(--wje-font-size-x-large);\r\n line-height: 40px;\r\n }\r\n h3 {\r\n font-size: var(--wje-font-size-large);\r\n line-height: 35.88px;\r\n }\r\n h4 {\r\n font-size: var(--wje-font-size-large);\r\n line-height: 33.88px;\r\n }\r\n h5 {\r\n font-size: var(--wje-font-size-medium);\r\n line-height: 25.88px;\r\n }\r\n small,\r\n .small {\r\n font-size: 89%;\r\n line-height: 17px;\r\n }\r\n}\r\n\r\n.alert {\r\n & > p,\r\n & > ul {\r\n margin-bottom: 0;\r\n }\r\n}\r\n.table {\r\n & > tbody {\r\n & > tr {\r\n & > td,\r\n & > th {\r\n line-height: 1.42857143;\r\n }\r\n }\r\n }\r\n & > tfoot {\r\n & > tr {\r\n & > td,\r\n & > th {\r\n line-height: 1.42857143;\r\n }\r\n }\r\n }\r\n & > thead {\r\n & > tr {\r\n & > td,\r\n & > th {\r\n line-height: 1.42857143;\r\n }\r\n }\r\n }\r\n}\r\n\r\n/* For Windows : Fixes\r\n------------------------------------\r\n*/\r\n\r\n\r\n.line-clamp-2 {\r\n display: -webkit-box;\r\n -webkit-line-clamp: 2;\r\n -webkit-box-orient: vertical;\r\n overflow: hidden;\r\n}\r\n\r\n.line-clamp-3 {\r\n display: -webkit-box;\r\n -webkit-line-clamp: 3;\r\n -webkit-box-orient: vertical;\r\n overflow: hidden;\r\n}\r\n\r\n.line-clamp-5 {\r\n display: -webkit-box;\r\n -webkit-line-clamp: 5;\r\n -webkit-box-orient: vertical;\r\n overflow: hidden;\r\n}\r\n\r\n.text-separator {\r\n display: block;\r\n text-align: center;\r\n margin: 1.5rem 0;\r\n width: 100%;\r\n background: linear-gradient(to top, transparent 0%, transparent calc(50% - 1px), var(--wje-border-color) calc(50% - 1px), var(--wje-border-color) calc(50% + 1px), transparent calc(50% + 1px), transparent 100%);\r\n}\r\n.text-separator::before {\r\n background: #fff;\r\n content: attr(data-text);\r\n padding: 0 1rem;\r\n text-transform: uppercase;\r\n}\r\n\r\n.wje-toast-stack {\r\n position: fixed;\r\n top: 0;\r\n margin: 0 .5rem;\r\n width: 300px;\r\n max-width: 100%;\r\n max-height: 100%;\r\n overflow: auto;\r\n z-index: 9999;\r\n}';
|
|
10
10
|
const animations = `@charset "UTF-8";/*!
|
|
11
11
|
* animate.css - https://animate.style/
|
|
12
12
|
* Version - 4.1.1
|
package/dist/wje-element.js
CHANGED
|
@@ -534,6 +534,15 @@ const _WJElement = class _WJElement extends HTMLElement {
|
|
|
534
534
|
}
|
|
535
535
|
beforeDisconnect() {
|
|
536
536
|
}
|
|
537
|
+
afterDisconnect() {
|
|
538
|
+
}
|
|
539
|
+
beforeRedraw() {
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Cleans up the component.
|
|
543
|
+
*/
|
|
544
|
+
componentCleanup() {
|
|
545
|
+
}
|
|
537
546
|
disconnectedCallback() {
|
|
538
547
|
var _a, _b;
|
|
539
548
|
(_a = this.beforeDisconnect) == null ? void 0 : _a.call(this);
|
|
@@ -542,6 +551,7 @@ const _WJElement = class _WJElement extends HTMLElement {
|
|
|
542
551
|
this.isAttached = false;
|
|
543
552
|
(_b = this.afterDisconnect) == null ? void 0 : _b.call(this);
|
|
544
553
|
this.drawingStatus = this.drawingStatuses.DISCONNECTED;
|
|
554
|
+
this.componentCleanup();
|
|
545
555
|
}
|
|
546
556
|
async enqueueUpdate() {
|
|
547
557
|
try {
|
|
@@ -564,11 +574,12 @@ const _WJElement = class _WJElement extends HTMLElement {
|
|
|
564
574
|
}
|
|
565
575
|
}
|
|
566
576
|
async refresh() {
|
|
567
|
-
var _a, _b;
|
|
577
|
+
var _a, _b, _c;
|
|
568
578
|
if (this.drawingStatus && this.drawingStatus >= this.drawingStatuses.START) {
|
|
569
|
-
(_a = this.
|
|
579
|
+
(_a = this.beforeRedraw) == null ? void 0 : _a.call(this);
|
|
580
|
+
(_b = this.beforeDisconnect) == null ? void 0 : _b.call(this);
|
|
570
581
|
this.refreshUpdatePromise();
|
|
571
|
-
(
|
|
582
|
+
(_c = this.afterDisconnect) == null ? void 0 : _c.call(this);
|
|
572
583
|
return this.initWjElement(true);
|
|
573
584
|
}
|
|
574
585
|
}
|
|
@@ -596,7 +607,7 @@ const _WJElement = class _WJElement extends HTMLElement {
|
|
|
596
607
|
}
|
|
597
608
|
}
|
|
598
609
|
async render() {
|
|
599
|
-
this.drawingStatus =
|
|
610
|
+
this.drawingStatus = this.drawingStatuses.DRAWING;
|
|
600
611
|
let _draw = this.draw(this.context, this.store, WjElementUtils.getAttributes(this));
|
|
601
612
|
if (_draw instanceof Promise) {
|
|
602
613
|
_draw = await _draw;
|
package/dist/wje-radio-group.js
CHANGED
|
@@ -16,6 +16,7 @@ class RadioGroup extends WJElement {
|
|
|
16
16
|
constructor() {
|
|
17
17
|
super();
|
|
18
18
|
__publicField(this, "className", "RadioGroup");
|
|
19
|
+
this.internals = this.attachInternals();
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
22
|
* Returns the CSS styles for the component.
|
|
@@ -27,13 +28,82 @@ class RadioGroup extends WJElement {
|
|
|
27
28
|
return styles;
|
|
28
29
|
}
|
|
29
30
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
* Setter for the value attribute.
|
|
32
|
+
* @param {string} value - The value to set.
|
|
33
|
+
*/
|
|
34
|
+
set value(value) {
|
|
35
|
+
if (this.checkRadio(value)) {
|
|
36
|
+
this.setAttribute("value", value);
|
|
37
|
+
this.internals.setFormValue(value);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Getter for the value attribute.
|
|
42
|
+
* @returns {string} The value of the attribute.
|
|
43
|
+
*/
|
|
44
|
+
get value() {
|
|
45
|
+
return this.getAttribute("value");
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Getter for the form attribute.
|
|
49
|
+
* @returns {HTMLFormElement} The form the input is associated with.
|
|
50
|
+
*/
|
|
51
|
+
get form() {
|
|
52
|
+
return this.internals.form;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Getter for the name attribute.
|
|
56
|
+
* @returns {string} The name of the input.
|
|
57
|
+
*/
|
|
58
|
+
get name() {
|
|
59
|
+
return this.getAttribute("name");
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Getter for the type attribute.
|
|
63
|
+
* @returns {string} The type of the input.
|
|
64
|
+
*/
|
|
65
|
+
get type() {
|
|
66
|
+
return this.localName;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Getter for the validity attribute.
|
|
70
|
+
* @returns {ValidityState} The validity state of the input.
|
|
71
|
+
*/
|
|
72
|
+
get validity() {
|
|
73
|
+
return this.internals.validity;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Getter for the validationMessage attribute.
|
|
77
|
+
* @returns {string} The validation message of the input.
|
|
78
|
+
*/
|
|
79
|
+
get validationMessage() {
|
|
80
|
+
return this.internals.validationMessage;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Getter for the willValidate attribute.
|
|
84
|
+
* @returns {boolean} Whether the input will be validated.
|
|
85
|
+
*/
|
|
86
|
+
get willValidate() {
|
|
87
|
+
return this.internals.willValidate;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @summary Getter for the defaultValue attribute.
|
|
91
|
+
* This method retrieves the 'value' attribute of the custom input element.
|
|
92
|
+
* The 'value' attribute represents the default value of the input element.
|
|
93
|
+
* If the 'value' attribute is not set, it returns an empty string.
|
|
94
|
+
* @returns {string} The default value of the input element.
|
|
34
95
|
*/
|
|
35
|
-
|
|
36
|
-
return
|
|
96
|
+
get defaultValue() {
|
|
97
|
+
return this.getAttribute("value") ?? "";
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @summary Setter for the defaultValue attribute.
|
|
101
|
+
* This method sets the 'value' attribute of the custom input element to the provided value.
|
|
102
|
+
* The 'value' attribute represents the default value of the input element.
|
|
103
|
+
* @param {string} value - The value to set as the default value.
|
|
104
|
+
*/
|
|
105
|
+
set defaultValue(value) {
|
|
106
|
+
this.setAttribute("value", value);
|
|
37
107
|
}
|
|
38
108
|
/**
|
|
39
109
|
* Sets up the attributes for the component.
|
|
@@ -54,6 +124,13 @@ class RadioGroup extends WJElement {
|
|
|
54
124
|
let native = document.createElement("div");
|
|
55
125
|
native.classList.add("native-radio-group", this.hasAttribute("inline") ? "wje-inline" : "ddd");
|
|
56
126
|
let slot = document.createElement("slot");
|
|
127
|
+
let label = document.createElement("label");
|
|
128
|
+
label.innerText = this.label;
|
|
129
|
+
if (this.value && !this.hasAttribute("error"))
|
|
130
|
+
label.classList.add("fade");
|
|
131
|
+
if (this.label) {
|
|
132
|
+
native.appendChild(label);
|
|
133
|
+
}
|
|
57
134
|
native.appendChild(slot);
|
|
58
135
|
fragment.appendChild(native);
|
|
59
136
|
return fragment;
|
|
@@ -63,12 +140,11 @@ class RadioGroup extends WJElement {
|
|
|
63
140
|
* Handles the selection of radio buttons.
|
|
64
141
|
*/
|
|
65
142
|
afterDraw() {
|
|
66
|
-
|
|
67
|
-
this.setRadioToChekced(this.getRadioByValue(this.value));
|
|
68
|
-
}
|
|
143
|
+
this.checkRadio(this.value);
|
|
69
144
|
this.addEventListener("wje-radio:input", (e) => {
|
|
70
|
-
this.
|
|
71
|
-
|
|
145
|
+
if (this.checkRadio(e.detail.context.value)) {
|
|
146
|
+
this.value = e.detail.context.value;
|
|
147
|
+
}
|
|
72
148
|
});
|
|
73
149
|
}
|
|
74
150
|
/**
|
|
@@ -78,7 +154,7 @@ class RadioGroup extends WJElement {
|
|
|
78
154
|
* @returns {Radio} The radio button.
|
|
79
155
|
*/
|
|
80
156
|
getRadioByValue(value) {
|
|
81
|
-
return this.getAllElements().
|
|
157
|
+
return this.getAllElements().find((el) => el instanceof Radio && el.value === value);
|
|
82
158
|
}
|
|
83
159
|
/**
|
|
84
160
|
* Removes the check from all radio buttons.
|
|
@@ -91,14 +167,16 @@ class RadioGroup extends WJElement {
|
|
|
91
167
|
}
|
|
92
168
|
/**
|
|
93
169
|
* Sets the given radio button to checked.
|
|
94
|
-
*
|
|
95
|
-
* @param {Radio} radio - The radio button to check.
|
|
96
170
|
*/
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
171
|
+
checkRadio(value) {
|
|
172
|
+
this.removeCheck();
|
|
173
|
+
const radio = this.getRadioByValue(value);
|
|
174
|
+
if (radio) {
|
|
100
175
|
radio.checked = true;
|
|
176
|
+
return true;
|
|
101
177
|
}
|
|
178
|
+
console.error(`Radio with value ${value} not found`);
|
|
179
|
+
return false;
|
|
102
180
|
}
|
|
103
181
|
/**
|
|
104
182
|
* Returns all the elements in the radio group.
|
|
@@ -106,9 +184,68 @@ class RadioGroup extends WJElement {
|
|
|
106
184
|
* @returns {Array<Element>} The elements.
|
|
107
185
|
*/
|
|
108
186
|
getAllElements() {
|
|
109
|
-
return Array.from(this.
|
|
187
|
+
return Array.from(this.children);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* @summary Callback function that is called when the custom element is associated with a form.
|
|
191
|
+
* This function adds an event listener to the form's submit event, which validates the input and propagates the validation.
|
|
192
|
+
* @param {HTMLFormElement} form - The form the custom element is associated with.
|
|
193
|
+
*/
|
|
194
|
+
formAssociatedCallback(form) {
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* The formResetCallback method is a built-in lifecycle callback that gets called when a form gets reset.
|
|
198
|
+
* This method is responsible for resetting the value of the custom input element to its default value.
|
|
199
|
+
* It also resets the form value and validity state in the form internals.
|
|
200
|
+
*
|
|
201
|
+
* @method
|
|
202
|
+
*/
|
|
203
|
+
formResetCallback() {
|
|
204
|
+
this.value = this.defaultValue;
|
|
205
|
+
this.internals.setFormValue(this.defaultValue);
|
|
206
|
+
this.internals.setValidity({});
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The formStateRestoreCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is restored.
|
|
210
|
+
* This method is responsible for restoring the value of the custom input element to its saved state.
|
|
211
|
+
* It also restores the form value and validity state in the form internals to their saved states.
|
|
212
|
+
*
|
|
213
|
+
* @param {Object} state - The saved state of the custom input element.
|
|
214
|
+
* @method
|
|
215
|
+
*/
|
|
216
|
+
formStateRestoreCallback(state) {
|
|
217
|
+
this.value = state.value;
|
|
218
|
+
this.internals.setFormValue(state.value);
|
|
219
|
+
this.internals.setValidity({});
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* The formStateSaveCallback method is a built-in lifecycle callback that gets called when the state of a form-associated custom element is saved.
|
|
223
|
+
* This method is responsible for saving the value of the custom input element.
|
|
224
|
+
*
|
|
225
|
+
* @returns {Object} The saved state of the custom input element.
|
|
226
|
+
* @method
|
|
227
|
+
*/
|
|
228
|
+
formStateSaveCallback() {
|
|
229
|
+
return {
|
|
230
|
+
value: this.value
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* The formDisabledCallback method is a built-in lifecycle callback that gets called when the disabled state of a form-associated custom element changes.
|
|
235
|
+
* This method is not implemented yet.
|
|
236
|
+
*
|
|
237
|
+
* @param {boolean} disabled - The new disabled state of the custom input element.
|
|
238
|
+
* @method
|
|
239
|
+
*/
|
|
240
|
+
formDisabledCallback(disabled) {
|
|
241
|
+
console.warn("formDisabledCallback not implemented yet");
|
|
110
242
|
}
|
|
111
243
|
}
|
|
244
|
+
/**
|
|
245
|
+
* Whether the input is associated with a form.
|
|
246
|
+
* @type {boolean}
|
|
247
|
+
*/
|
|
248
|
+
__publicField(RadioGroup, "formAssociated", true);
|
|
112
249
|
RadioGroup.define("wje-radio-group", RadioGroup);
|
|
113
250
|
export {
|
|
114
251
|
RadioGroup as default
|
|
@@ -337,22 +337,24 @@ class SlidingContainer extends WJElement {
|
|
|
337
337
|
*/
|
|
338
338
|
async open(event) {
|
|
339
339
|
await Promise.resolve(this.beforeOpen(event)).then(async () => {
|
|
340
|
-
|
|
341
|
-
|
|
340
|
+
if (!this._isOpen) {
|
|
341
|
+
this.dispatchEvent(
|
|
342
|
+
new CustomEvent("wje-sliding-container:beforeOpen", {
|
|
343
|
+
bubbles: true,
|
|
344
|
+
composed: true
|
|
345
|
+
})
|
|
346
|
+
);
|
|
347
|
+
await this.doAnimateTransition();
|
|
348
|
+
await Promise.resolve(this.afterOpen(event)).then(() => {
|
|
349
|
+
this._isOpen = true;
|
|
342
350
|
this.dispatchEvent(
|
|
343
351
|
new CustomEvent("wje-sliding-container:open", {
|
|
344
352
|
bubbles: true,
|
|
345
353
|
composed: true
|
|
346
354
|
})
|
|
347
355
|
);
|
|
348
|
-
this.doAnimateTransition();
|
|
349
|
-
})() : () => {
|
|
350
|
-
}
|
|
351
|
-
).then(async () => {
|
|
352
|
-
await Promise.resolve(this.afterOpen(event)).then(() => {
|
|
353
|
-
this._isOpen = true;
|
|
354
356
|
});
|
|
355
|
-
}
|
|
357
|
+
}
|
|
356
358
|
});
|
|
357
359
|
}
|
|
358
360
|
/**
|
|
@@ -362,18 +364,14 @@ class SlidingContainer extends WJElement {
|
|
|
362
364
|
*/
|
|
363
365
|
async close(event) {
|
|
364
366
|
await Promise.resolve(this.beforeClose(event)).then(async () => {
|
|
365
|
-
|
|
366
|
-
this.
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
this.doAnimateTransition();
|
|
374
|
-
})() : () => {
|
|
375
|
-
}
|
|
376
|
-
).then(async () => {
|
|
367
|
+
if (this._isOpen) {
|
|
368
|
+
this.dispatchEvent(
|
|
369
|
+
new CustomEvent("wje-sliding-container:beforeClose", {
|
|
370
|
+
bubbles: true,
|
|
371
|
+
composed: true
|
|
372
|
+
})
|
|
373
|
+
);
|
|
374
|
+
await this.doAnimateTransition();
|
|
377
375
|
await Promise.resolve(this.afterClose(event)).then(() => {
|
|
378
376
|
if (this.removeChildAfterClose) {
|
|
379
377
|
this.childNodes.forEach((child) => {
|
|
@@ -381,8 +379,14 @@ class SlidingContainer extends WJElement {
|
|
|
381
379
|
});
|
|
382
380
|
}
|
|
383
381
|
this._isOpen = false;
|
|
382
|
+
this.dispatchEvent(
|
|
383
|
+
new CustomEvent("wje-sliding-container:close", {
|
|
384
|
+
bubbles: true,
|
|
385
|
+
composed: true
|
|
386
|
+
})
|
|
387
|
+
);
|
|
384
388
|
});
|
|
385
|
-
}
|
|
389
|
+
}
|
|
386
390
|
});
|
|
387
391
|
}
|
|
388
392
|
/**
|
package/dist/wje-toast.js
CHANGED
|
@@ -4,8 +4,8 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import WJElement from "./wje-element.js";
|
|
8
|
-
const styles = '/*\r\n[ TOAST ]\r\n*/\r\n\r\n:host {\r\n position: fixed;\r\n z-index: 999;\r\n}\r\n\r\n:host([data-position$="-left"]) {\r\n left: 0;\r\n}\r\n\r\n:host([data-position$="-right"]) {\r\n right: 0;\r\n}\r\n\r\n:host([data-position^="top-"]) {\r\n top: 0;\r\n}\r\n\r\n:host([data-position^="bottom-"]) {\r\n bottom: 0;\r\n}\r\n\r\n:host([data-position="top"]) {\r\n top: 0;\r\n left: 0;\r\n right: 0;\r\n}\r\n\r\n:host([data-position="bottom"]) {\r\n bottom: 0;\r\n left: 0;\r\n right: 0;\r\n}\r\n\r\n.pgn {\r\n position: relative;\r\n margin: 10px;\r\n}\r\n\r\n.pgn.pgn-flip{\r\n /*margin-top: 0;*/\r\n}\r\n\r\n.pgn .alert {\r\n margin: 0;\r\n margin-bottom: 4px;\r\n}\r\n\r\n/* Simple\r\n------------------------------------\r\n*/\r\n\r\n.pgn-simple .alert {\r\n padding-top: 13px;\r\n padding-bottom: 13px;\r\n max-width: 500px;\r\n animation: fadeIn 0.3s cubic-bezier(0.05, 0.74, 0.27, 0.99) forwards;\r\n -webkit-animation: fadeIn 0.3s cubic-bezier(0.05, 0.74, 0.27, 0.99) forwards;\r\n max-height: 250px;\r\n overflow: hidden;\r\n}\r\n\r\n/* Bar\r\n------------------------------------\r\n*/\r\n\r\n.pgn-bar {\r\n overflow: hidden;\r\n margin: 0;\r\n}\r\n\r\n.pgn-bar .alert {\r\n border-radius: 0;\r\n padding-top: 13px;\r\n padding-bottom: 13px;\r\n max-height: 91px;\r\n}\r\n\r\n:host([data-position="top"]) .pgn-bar .alert {\r\n animation: slideInFromTop 0.5s cubic-bezier(0.05, 0.74, 0.27, 0.99) forwards;\r\n -webkit-animation: slideInFromTop 0.5s cubic-bezier(0.05, 0.74, 0.27, 0.99) forwards;\r\n transform-origin: top left;\r\n -webkit-transform-origin: top left;\r\n}\r\n\r\n:host([data-position="bottom"]) .pgn-bar .alert {\r\n animation: slideInFromBottom 0.5s cubic-bezier(0.05, 0.74, 0.27, 0.99) forwards;\r\n -webkit-animation: slideInFromBottom 0.5s cubic-bezier(0.05, 0.74, 0.27, 0.99) forwards;\r\n transform-origin: bottom left;\r\n -webkit-transform-origin: bottom left;\r\n}\r\n\r\n.pgn-bar .alert span {\r\n opacity: 0;\r\n animation: fadeIn 0.3s cubic-bezier(0.05, 0.74, 0.27, 0.99) forwards;\r\n -webkit-animation: fadeIn 0.3s cubic-bezier(0.05, 0.74, 0.27, 0.99) forwards;\r\n}\r\n\r\n@keyframes slideInFromTop {\r\n 0% {\r\n transform: translateY(-100%);\r\n }\r\n 100% {\r\n transform: translateY(0);\r\n }\r\n}\r\n@-webkit-keyframes slideInFromTop {\r\n 0% {\r\n -webkit-transform: translateY(-100%);\r\n }\r\n 100% {\r\n -webkit-transform: translateY(0);\r\n }\r\n}\r\n@keyframes slideInFromBottom {\r\n 0% {\r\n transform: translateY(100%);\r\n }\r\n 100% {\r\n transform: translateY(0);\r\n }\r\n}\r\n@-webkit-keyframes slideInFromBottom {\r\n 0% {\r\n -webkit-transform: translateY(100%);\r\n }\r\n 100% {\r\n -webkit-transform: translateY(0);\r\n }\r\n}\r\n /* Circle\r\n ------------------------------------\r\n */\r\n\r\n .pgn-circle .alert {\r\n margin-bottom: 10px;\r\n border-radius: 300px;\r\n animation: fadeInCircle 0.3s ease forwards,\r\n resizeCircle 0.3s 0.4s cubic-bezier(0.25, 0.25, 0.4, 1.6) forwards;\r\n -webkit-animation: fadeInCircle 0.3s ease forwards,\r\n resizeCircle 0.3s 0.4s cubic-bezier(0.25, 0.25, 0.4, 1.6) forwards;\r\n height: 48px;\r\n overflow: hidden;\r\n padding: 6px 55px 6px 6px;\r\n -webkit-transform: translateZ(0);\r\n position: relative;\r\n display: flex;\r\n }\r\n :host {\r\n &[data-position$="-right"] .pgn-circle .alert {\r\n float: right;\r\n }\r\n\r\n &[data-position$="-left"] .pgn-circle .alert {\r\n float: left;\r\n }\r\n\r\n &[data-position^="bottom-"] .pgn-circle .alert {\r\n margin-bottom: 20px;\r\n }\r\n }\r\n\r\n wje-avatar:first-child {\r\n margin-right: 8px;\r\n }\r\n\r\n .pgn-circle .alert .close {\r\n margin-top: -12px;\r\n position: absolute;\r\n right: 18px;\r\n top: 50%;\r\n opacity: 0;\r\n animation: fadeIn 0.3s 0.5s ease forwards;\r\n -webkit-animation: fadeIn 0.3s 0.5s ease forwards;\r\n }\r\n .pgn-circle .alert p {\r\n margin: 0;\r\n }\r\n .pgn-circle .alert > div {\r\n display: flex;\r\n flex-direction: column;\r\n justify-content: center;\r\n }\r\n .pgn-circle .alert > div > div {\r\n display: table-cell;\r\n vertical-align: middle;\r\n }\r\n @keyframes fadeInCircle {\r\n 0% {\r\n opacity: 0;\r\n width: 60px;\r\n }\r\n 100% {\r\n opacity: 1;\r\n width: 60px;\r\n }\r\n }\r\n @-webkit-keyframes fadeInCircle {\r\n 0% {\r\n opacity: 0;\r\n width: 60px;\r\n }\r\n 100% {\r\n opacity: 1;\r\n width: 60px;\r\n }\r\n }\r\n @keyframes resizeCircle {\r\n 0% {\r\n width: 60px;\r\n }\r\n 100% {\r\n width: 300px;\r\n }\r\n }\r\n @-webkit-keyframes resizeCircle {\r\n 0% {\r\n width: 60px;\r\n }\r\n 100% {\r\n width: 300px;\r\n }\r\n }\r\n\r\n /* Flip\r\n ------------------------------------\r\n */\r\n\r\n :host[data-position^="bottom-"] .pgn-flip .alert {\r\n -webkit-transform-origin: 50% 100%;\r\n transform-origin: 50% 100%;\r\n }\r\n .pgn-flip .alert {\r\n -webkit-transform-origin: 50% 0%;\r\n transform-origin: 50% 0%;\r\n -webkit-animation-name: flipInX;\r\n animation-name: flipInX;\r\n -webkit-animation-duration: 0.8s;\r\n animation-duration: 0.8s;\r\n border-radius: 0;\r\n padding: 25px 35px;\r\n max-width: 500px;\r\n max-height: 250px;\r\n overflow: hidden;\r\n }\r\n @-webkit-keyframes flipInX {\r\n 0% {\r\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -90deg);\r\n -webkit-transition-timing-function: ease-in;\r\n }\r\n 40% {\r\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 20deg);\r\n -webkit-transition-timing-function: ease-out;\r\n }\r\n 60% {\r\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -10deg);\r\n -webkit-transition-timing-function: ease-in;\r\n opacity: 1;\r\n }\r\n 80% {\r\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 5deg);\r\n -webkit-transition-timing-function: ease-out;\r\n }\r\n 100% {\r\n -webkit-transform: perspective(400px);\r\n }\r\n }\r\n @keyframes flipInX {\r\n 0% {\r\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -90deg);\r\n transform: perspective(400px) rotate3d(1, 0, 0, -90deg);\r\n -webkit-transition-timing-function: ease-in;\r\n transition-timing-function: ease-in;\r\n }\r\n 40% {\r\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 20deg);\r\n transform: perspective(400px) rotate3d(1, 0, 0, 20deg);\r\n -webkit-transition-timing-function: ease-out;\r\n transition-timing-function: ease-out;\r\n }\r\n 60% {\r\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -10deg);\r\n transform: perspective(400px) rotate3d(1, 0, 0, -10deg);\r\n -webkit-transition-timing-function: ease-in;\r\n transition-timing-function: ease-in;\r\n opacity: 1;\r\n }\r\n 80% {\r\n -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 5deg);\r\n transform: perspective(400px) rotate3d(1, 0, 0, 5deg);\r\n -webkit-transition-timing-function: ease-out;\r\n transition-timing-function: ease-out;\r\n }\r\n 100% {\r\n -webkit-transform: perspective(400px);\r\n transform: perspective(400px);\r\n }\r\n }\r\n @keyframes fadeIn {\r\n 0% {\r\n opacity: 0;\r\n }\r\n 100% {\r\n opacity: 1;\r\n }\r\n }\r\n @-webkit-keyframes fadeIn {\r\n 0% {\r\n opacity: 0;\r\n }\r\n 100% {\r\n opacity: 1;\r\n }\r\n }\r\n\r\n /* Pages Notification customizations */\r\n :host([data-position="top"]) {\r\n top: 60px;\r\n left: 0;\r\n }\r\n :host([data-position="bottom"]) {\r\n left: 0;\r\n }\r\n\r\n :host([data-position$="-left"]) {\r\n left: 0;\r\n right: auto;\r\n }\r\n\r\n :host([data-position^="top-"]) {\r\n bottom: auto;\r\n }\r\n\r\n :host {\r\n z-index: 999;\r\n }\r\n\r\n @media (max-width: 979px) {\r\n body .pgn-wrapper[data-position="top"] {\r\n left: 0 !important;\r\n }\r\n body .pgn-wrapper[data-position="bottom"] {\r\n left: 0 !important;\r\n }\r\n }\r\n @media (max-width: 767px) {\r\n body .pgn-wrapper[data-position$="-left"],\r\n body .pgn-wrapper[data-position$="-right"] {\r\n left: 10px !important;\r\n right: 10px !important;\r\n }\r\n body .pgn-wrapper[data-position$="-right"] .alert,\r\n body .pgn-wrapper[data-position$="-left"] .alert {\r\n max-width: 100%;\r\n width: 100%;\r\n }\r\n }\r\n\r\n.alert {\r\n background-image: none;\r\n box-shadow: none;\r\n text-shadow: none;\r\n padding: 9px 19px 9px 15px;\r\n border-radius: 3px;\r\n font-size: 13px;\r\n border-width: 0;\r\n transition: all 0.2s linear 0s;\r\n display: flex;\r\n align-items: center;\r\n &.bordered {\r\n border-width: 1px;\r\n }\r\n\r\n .link {\r\n color: #ce8f22;\r\n font-weight: bold;\r\n }\r\n\r\n .alert-heading {\r\n color: #ce8f22 !important;\r\n margin-bottom: 5px;\r\n font-weight: 600;\r\n }\r\n\r\n .btn-small {\r\n position: relative;\r\n top: -3.5px;\r\n }\r\n\r\n .button-set {\r\n .btn {\r\n position: relative;\r\n top: 8px;\r\n }\r\n }\r\n}\r\n\r\n/* Alert : Color Options\r\n------------------------------------\r\n*/\r\n.alert-danger,\r\n.alert-error,\r\n.alert-danger.btn,\r\n.alert-error.btn {\r\n background-color: var(--wje-color-primary-2) !important;\r\n color: var(--wje-color-primary-11)!important;\r\n border-color: var(--wje-color-primary-9)!important;\r\n\r\n .close {\r\n background-position: -95px -10px !important;\r\n }\r\n}\r\n\r\n.alert-warning {\r\n\r\n background-color: var(--wje-color-warning-2) !important;\r\n color: var(--wje-color-warning-11)!important;\r\n border-color: var(--wje-color-warning-9)!important;\r\n}\r\n\r\n.alert-info {\r\n background-color: var(--wje-color-complete-2) !important;\r\n color: var(--wje-color-complete-11) !important;\r\n border-color: var(--wje-color-complete-9) !important;\r\n\r\n .close {\r\n background-position: -67px -10px !important;\r\n }\r\n}\r\n\r\n.alert-success, .alert-success.btn {\r\n background-color: var(--wje-color-success-2) !important;\r\n color: var(--wje-color-success-11) !important;\r\n border-color: var(--wje-color-success-9) !important;\r\n .close {\r\n background-position: -38px -10px !important;\r\n }\r\n}\r\n\r\n.alert-default {\r\n background-color: var(--wje-color-contrast-2) !important;\r\n color: var(--wje-color-contrast-11)!important;\r\n border-color: var(--wje-color-contrast-9)!important;\r\n\r\n .close {\r\n background-position: -67px -10px !important;\r\n }\r\n}\r\n';
|
|
7
|
+
import WJElement, { event } from "./wje-element.js";
|
|
8
|
+
const styles = '/*\r\n[ WJ Toast ]\r\n*/\r\n\r\n:host {\r\n position: relative;\r\n z-index: 9999;\r\n width: 300px;\r\n margin: .5rem 0;\r\n display: block;\r\n}\r\n\r\n.native-toast {\r\n display: flex;\r\n align-items: center;\r\n padding: 1rem;\r\n overflow: hidden;\r\n margin: 0;\r\n border-width: 1px;\r\n border-style: solid;\r\n border-radius: var(--wje-border-radius-large);\r\n position: relative;\r\n\r\n slot[name="avatar"]::slotted(wje-avatar) {\r\n margin-right: .5rem;\r\n }\r\n\r\n .content {\r\n font-size: var(--wje-font-size-small);\r\n .headline {\r\n font-size: var(--wje-font-size);\r\n font-weight: var(--wje-font-weight-bold);\r\n }\r\n }\r\n\r\n wje-button {\r\n --wje-button-margin-inline: auto 0;\r\n margin-left: auto !important;\r\n }\r\n\r\n .countdown {\r\n position: absolute;\r\n left: 0;\r\n bottom: 0;\r\n width: 100%;\r\n height: 4px;\r\n .countdown-bar {\r\n height: 100%;\r\n }\r\n }\r\n}\r\n\r\n:host([position=top]) {\r\n animation: slideDown .3s ease-out forwards;\r\n top: 1rem;\r\n left: auto;\r\n right: auto;\r\n}\r\n\r\n@keyframes slideDown {\r\n 0% {\r\n transform: translateY(-100%);\r\n }\r\n 100% {\r\n transform: translateY(0);\r\n }\r\n}\r\n\r\n/*PRIMARY*/\r\n:host([color=primary]) .native-toast {\r\n background-color: var(--wje-color-primary-1);\r\n color: var(--wje-color-primary-9);\r\n border-color: var(--wje-color-primary-3);\r\n}\r\n\r\n/*COMPLETE*/\r\n:host([color=complete]) .native-toast {\r\n background-color: var(--wje-color-complete-1);\r\n color: var(--wje-color-complete-9);\r\n border-color: var(--wje-color-complete-3);\r\n}\r\n\r\n/*SUCCESS*/\r\n:host([color=success]) .native-toast {\r\n background-color: var(--wje-color-success-1);\r\n color: var(--wje-color-success-9);\r\n border-color: var(--wje-color-success-3);\r\n}\r\n\r\n/*WARNING*/\r\n:host([color=warning]) .native-toast{\r\n background-color: var(--wje-color-warning-1);\r\n color: var(--wje-color-warning-11);\r\n border-color: var(--wje-color-warning-3);\r\n}\r\n\r\n/*DANGER*/\r\n:host([color=danger]) .native-toast {\r\n background-color: var(--wje-color-danger-1);\r\n color: var(--wje-color-danger-9);\r\n border-color: var(--wje-color-danger-3);\r\n}\r\n\r\n/*INFO*/\r\n:host([color=info]) .native-toast {\r\n background-color: var(--wje-color-info-1);\r\n color: var(--wje-color-info-11);\r\n border-color: var(--wje-color-info-4);\r\n}\r\n\r\n/*CONTRAST*/\r\n:host([color=contrast]) .native-toast {\r\n background-color: var(--wje-color-contrast-2);\r\n color: var(--wje-color-contrast-9);\r\n border-color: var(--wje-color-contrast-3);\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n/*PRIMARY*/\r\n:host([color=primary]) .countdown-bar {\r\n background-color: var(--wje-color-primary-9);\r\n}\r\n\r\n/*COMPLETE*/\r\n:host([color=complete]) .countdown-bar {\r\n background-color: var(--wje-color-complete-9);\r\n}\r\n\r\n/*SUCCESS*/\r\n:host([color=success]) .countdown-bar {\r\n background-color: var(--wje-color-success-9);\r\n}\r\n\r\n/*WARNING*/\r\n:host([color=warning]) .countdown-bar{\r\n background-color: var(--wje-color-warning-9);\r\n}\r\n\r\n/*DANGER*/\r\n:host([color=danger]) .countdown-bar {\r\n background-color: var(--wje-color-danger-9);\r\n}\r\n\r\n/*INFO*/\r\n:host([color=info]) .countdown-bar {\r\n background-color: var(--wje-color-info-9);\r\n}\r\n\r\n/*CONTRAST*/\r\n:host([color=contrast]) .countdown-bar {\r\n background-color: var(--wje-color-contrast-9);\r\n}';
|
|
9
9
|
class Toast extends WJElement {
|
|
10
10
|
/**
|
|
11
11
|
* Toast constructor
|
|
@@ -18,10 +18,86 @@ class Toast extends WJElement {
|
|
|
18
18
|
* @type {string}
|
|
19
19
|
*/
|
|
20
20
|
__publicField(this, "className", "Toast");
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Asynchronously shows the toast notification.
|
|
23
|
+
*
|
|
24
|
+
* This method sets the `open` property to `true` and dispatches the
|
|
25
|
+
* `wje-toast:after-show` custom event. If the toast is already open,
|
|
26
|
+
* the method returns `undefined`.
|
|
27
|
+
*/
|
|
28
|
+
__publicField(this, "show", () => {
|
|
29
|
+
if (this.open) {
|
|
30
|
+
return void 0;
|
|
31
|
+
}
|
|
32
|
+
this.open = true;
|
|
33
|
+
event.dispatchCustomEvent(this, "wje-toast:after-show");
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Asynchronously hides the toast notification.
|
|
37
|
+
*
|
|
38
|
+
* This method sets the `open` property to `false` and dispatches the
|
|
39
|
+
* `wje-toast:after-hide` custom event. If the toast is already hidden,
|
|
40
|
+
* the method returns `undefined`.
|
|
41
|
+
*/
|
|
42
|
+
__publicField(this, "hide", () => {
|
|
43
|
+
if (!this.open) {
|
|
44
|
+
return void 0;
|
|
45
|
+
}
|
|
46
|
+
this.open = false;
|
|
47
|
+
event.dispatchCustomEvent(this, "wje-toast:after-hide");
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Pauses the countdown animation and stops the timer.
|
|
51
|
+
*/
|
|
52
|
+
__publicField(this, "pause", async () => {
|
|
53
|
+
var _a;
|
|
54
|
+
(_a = this.countdownAnimation) == null ? void 0 : _a.pause();
|
|
55
|
+
this.stopTimer();
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Resumes the countdown animation and resumes the timer.
|
|
59
|
+
*/
|
|
60
|
+
__publicField(this, "resume", async () => {
|
|
61
|
+
var _a;
|
|
62
|
+
(_a = this.countdownAnimation) == null ? void 0 : _a.play();
|
|
63
|
+
this.resumeTimer();
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* Asynchronously starts the toast notification.
|
|
67
|
+
*
|
|
68
|
+
* This method appends the toast notification to the document body and
|
|
69
|
+
* shows the toast notification. The method returns a promise that
|
|
70
|
+
* resolves when the toast notification is shown.
|
|
71
|
+
*
|
|
72
|
+
* @returns {Promise<unknown>}
|
|
73
|
+
*/
|
|
74
|
+
__publicField(this, "start", () => {
|
|
75
|
+
return new Promise((resolve) => {
|
|
76
|
+
let stack = document.body.querySelector(".wje-toast-stack");
|
|
77
|
+
if (stack) {
|
|
78
|
+
this.toastStack = stack;
|
|
79
|
+
}
|
|
80
|
+
if (this.toastStack.parentElement === null) {
|
|
81
|
+
document.body.append(this.toastStack);
|
|
82
|
+
}
|
|
83
|
+
this.toastStack.appendChild(this);
|
|
84
|
+
this.show();
|
|
85
|
+
this.addEventListener("wje-toast:after-hide", this.removeChildAndStack);
|
|
86
|
+
});
|
|
24
87
|
});
|
|
88
|
+
this.toastStack = Object.assign(document.createElement("div"), { className: "wje-toast-stack" });
|
|
89
|
+
}
|
|
90
|
+
set headline(value) {
|
|
91
|
+
this.setAttribute("headline", value);
|
|
92
|
+
}
|
|
93
|
+
get headline() {
|
|
94
|
+
return this.getAttribute("headline");
|
|
95
|
+
}
|
|
96
|
+
set open(value) {
|
|
97
|
+
this.setAttribute("open", value);
|
|
98
|
+
}
|
|
99
|
+
get open() {
|
|
100
|
+
return this.getAttribute("open");
|
|
25
101
|
}
|
|
26
102
|
set duration(value) {
|
|
27
103
|
this.setAttribute("duration", value);
|
|
@@ -29,17 +105,25 @@ class Toast extends WJElement {
|
|
|
29
105
|
get duration() {
|
|
30
106
|
return +this.getAttribute("duration");
|
|
31
107
|
}
|
|
32
|
-
set
|
|
33
|
-
|
|
108
|
+
set closable(value) {
|
|
109
|
+
if (value)
|
|
110
|
+
this.setAttribute("closable", value);
|
|
34
111
|
}
|
|
35
|
-
get
|
|
36
|
-
return this.getAttribute("
|
|
112
|
+
get closable() {
|
|
113
|
+
return this.getAttribute("closable");
|
|
37
114
|
}
|
|
38
|
-
set
|
|
39
|
-
this.setAttribute("
|
|
115
|
+
set color(value) {
|
|
116
|
+
this.setAttribute("color", value);
|
|
40
117
|
}
|
|
41
|
-
get
|
|
42
|
-
return this.getAttribute("
|
|
118
|
+
get color() {
|
|
119
|
+
return this.getAttribute("color");
|
|
120
|
+
}
|
|
121
|
+
set countdown(value) {
|
|
122
|
+
if (value)
|
|
123
|
+
this.setAttribute("countdown", value);
|
|
124
|
+
}
|
|
125
|
+
get countdown() {
|
|
126
|
+
return this.hasAttribute("countdown");
|
|
43
127
|
}
|
|
44
128
|
/**
|
|
45
129
|
* Get CSS stylesheet
|
|
@@ -56,7 +140,16 @@ class Toast extends WJElement {
|
|
|
56
140
|
* @returns {Array<string>}
|
|
57
141
|
*/
|
|
58
142
|
static get observedAttributes() {
|
|
59
|
-
return ["
|
|
143
|
+
return ["open", "color", "duration"];
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Called when an attribute changes.
|
|
147
|
+
*
|
|
148
|
+
* @param {string} name - The name of the attribute.
|
|
149
|
+
* @param {string} old - The old value of the attribute.
|
|
150
|
+
* @param {string} newName - The new value of the attribute.
|
|
151
|
+
*/
|
|
152
|
+
attributeChangedCallback(name, old, newName) {
|
|
60
153
|
}
|
|
61
154
|
/**
|
|
62
155
|
* Setup attributes
|
|
@@ -81,34 +174,119 @@ class Toast extends WJElement {
|
|
|
81
174
|
avatarSlot.classList.add("avatar");
|
|
82
175
|
let content = document.createElement("div");
|
|
83
176
|
content.classList.add("content");
|
|
84
|
-
content.innerHTML = `<div class="
|
|
177
|
+
content.innerHTML = `<div class="headline">${this.headline}</div><div class="message"><slot></slot></div>`;
|
|
85
178
|
let icon = document.createElement("wje-icon");
|
|
86
179
|
icon.setAttribute("name", "x");
|
|
87
180
|
let closeBtn = document.createElement("wje-button");
|
|
88
181
|
closeBtn.setAttribute("fill", "link");
|
|
89
|
-
closeBtn.setAttribute("color", this.
|
|
182
|
+
closeBtn.setAttribute("color", this.color);
|
|
90
183
|
closeBtn.setAttribute("size", "small");
|
|
91
184
|
closeBtn.classList.add("close");
|
|
185
|
+
let countdownEl = document.createElement("div");
|
|
186
|
+
countdownEl.classList.add("countdown");
|
|
187
|
+
let countdownBar = document.createElement("div");
|
|
188
|
+
countdownBar.classList.add("countdown-bar");
|
|
92
189
|
closeBtn.appendChild(icon);
|
|
190
|
+
countdownEl.appendChild(countdownBar);
|
|
93
191
|
native.appendChild(avatarSlot);
|
|
94
192
|
native.appendChild(content);
|
|
95
|
-
if (this.hasAttribute("
|
|
193
|
+
if (this.hasAttribute("closable"))
|
|
96
194
|
native.appendChild(closeBtn);
|
|
195
|
+
if (this.hasAttribute("countdown"))
|
|
196
|
+
native.appendChild(countdownEl);
|
|
97
197
|
fragment.appendChild(native);
|
|
98
198
|
this.closeBtn = closeBtn;
|
|
199
|
+
this.countdownBar = countdownBar;
|
|
99
200
|
return fragment;
|
|
100
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* After draw method
|
|
204
|
+
* @param {Object} context - The context
|
|
205
|
+
* @param {Object} store - The store
|
|
206
|
+
* @param {Object} params - The parameters
|
|
207
|
+
*/
|
|
101
208
|
afterDraw() {
|
|
102
|
-
this.closeBtn.addEventListener("wje-button:click", this.
|
|
209
|
+
this.closeBtn.addEventListener("wje-button:click", this.hide);
|
|
210
|
+
this.addEventListener("mouseenter", this.pause);
|
|
211
|
+
this.addEventListener("mouseleave", this.resume);
|
|
212
|
+
if (this.hasAttribute("countdown")) {
|
|
213
|
+
const startWidth = "100%";
|
|
214
|
+
const endWidth = "0";
|
|
215
|
+
this.countdownAnimation = this.countdownBar.animate([{ width: startWidth }, { width: endWidth }], {
|
|
216
|
+
duration: this.duration,
|
|
217
|
+
easing: "linear"
|
|
218
|
+
});
|
|
219
|
+
}
|
|
103
220
|
if (this.duration > 0) {
|
|
104
|
-
this.
|
|
105
|
-
|
|
106
|
-
}, this.duration);
|
|
221
|
+
this.remainingTime = this.duration;
|
|
222
|
+
this.startTimer();
|
|
107
223
|
}
|
|
108
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Before disconnect method
|
|
227
|
+
*
|
|
228
|
+
* This method is called before the element is disconnected from the document.
|
|
229
|
+
*/
|
|
109
230
|
beforeDisconnect() {
|
|
110
|
-
this.closeBtn.removeEventListener("wje-button:click", this.
|
|
111
|
-
|
|
231
|
+
this.closeBtn.removeEventListener("wje-button:click", this.hide);
|
|
232
|
+
this.removeEventListener("wje-toast:after-hide", this.removeChildAndStack);
|
|
233
|
+
this.removeEventListener("mouseenter", this.pause);
|
|
234
|
+
this.removeEventListener("mouseleave", this.resume);
|
|
235
|
+
clearTimeout(this.timeoutID);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Starts the timer.
|
|
239
|
+
*
|
|
240
|
+
* This method sets the `startTime` property to the current time and sets
|
|
241
|
+
* the `timeoutID` property to the ID of the timeout. The method also
|
|
242
|
+
* dispatches the `wje-toast:after-hide` custom event when the timeout
|
|
243
|
+
* expires.
|
|
244
|
+
*/
|
|
245
|
+
startTimer() {
|
|
246
|
+
this.startTime = Date.now();
|
|
247
|
+
if (this.timeoutID) {
|
|
248
|
+
clearTimeout(this.timeoutID);
|
|
249
|
+
}
|
|
250
|
+
this.timeoutID = window.setTimeout(() => {
|
|
251
|
+
this.hide();
|
|
252
|
+
}, this.remainingTime);
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Stops the timer.
|
|
256
|
+
*
|
|
257
|
+
* This method clears the timeout and calculates the remaining time.
|
|
258
|
+
* The method is called when the toast notification is paused.
|
|
259
|
+
*/
|
|
260
|
+
stopTimer() {
|
|
261
|
+
if (this.timeoutID) {
|
|
262
|
+
window.clearTimeout(this.timeoutID);
|
|
263
|
+
}
|
|
264
|
+
const elapsedTime = Date.now() - this.startTime;
|
|
265
|
+
this.remainingTime -= elapsedTime;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Resumes the timer.
|
|
269
|
+
*
|
|
270
|
+
* This method resumes the timer if the remaining time is greater
|
|
271
|
+
* than zero. The method is called when the toast notification is resumed.
|
|
272
|
+
*/
|
|
273
|
+
resumeTimer() {
|
|
274
|
+
if (this.remainingTime > 0) {
|
|
275
|
+
this.startTimer();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Removes the toast notification and the toast stack.
|
|
280
|
+
*
|
|
281
|
+
* This method removes the toast notification from the toast stack and
|
|
282
|
+
* removes the toast stack from the document body if the toast stack is
|
|
283
|
+
* empty.
|
|
284
|
+
*/
|
|
285
|
+
removeChildAndStack() {
|
|
286
|
+
this.toastStack.removeChild(this);
|
|
287
|
+
if (this.toastStack.querySelector("wje-toast") === null) {
|
|
288
|
+
this.toastStack.remove();
|
|
289
|
+
}
|
|
112
290
|
}
|
|
113
291
|
}
|
|
114
292
|
Toast.define("wje-toast", Toast);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wj-elements",
|
|
3
3
|
"description": "WebJET Elements is a modern set of user interface tools harnessing the power of web components designed to simplify web application development.",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.123",
|
|
5
5
|
"homepage": "https://github.com/lencys/wj-elements",
|
|
6
6
|
"author": "Lukáš Ondrejček <lukas.ondrejcek@gmail.com>",
|
|
7
7
|
"license": "MIT",
|