@energie360/ui-library 0.0.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.
Files changed (67) hide show
  1. package/.browserslistrc +1 -0
  2. package/README.md +3 -0
  3. package/base/_accessibility.scss +5 -0
  4. package/base/_base.scss +104 -0
  5. package/base/_body.scss +7 -0
  6. package/base/_focus-handling.scss +18 -0
  7. package/base/_html.scss +11 -0
  8. package/base/_input-resets.scss +49 -0
  9. package/base/_print.scss +6 -0
  10. package/base/_resets.scss +53 -0
  11. package/base/abstracts/_functions.scss +21 -0
  12. package/base/abstracts/_layers.scss +6 -0
  13. package/base/abstracts/_mixins.scss +80 -0
  14. package/base/abstracts/_resets.scss +11 -0
  15. package/base/abstracts/_variables.scss +42 -0
  16. package/base/abstracts/index.scss +5 -0
  17. package/base/base-v2.scss +35 -0
  18. package/base/custom-element-base.scss +14 -0
  19. package/base/index.scss +5 -0
  20. package/base/main.scss +14 -0
  21. package/dist/index.css +1 -0
  22. package/dist/index.js +5182 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/style.css +20 -0
  25. package/dist/style.js +2 -0
  26. package/dist/style.js.map +1 -0
  27. package/elements/button/_button-base.scss +49 -0
  28. package/elements/button/_button-filled-inverted.scss +41 -0
  29. package/elements/button/_button-filled.scss +32 -0
  30. package/elements/button/_button-outlined-inverted.scss +38 -0
  31. package/elements/button/_button-outlined.scss +38 -0
  32. package/elements/button/_button-plain-small.scss +7 -0
  33. package/elements/button/_button-plain.scss +49 -0
  34. package/elements/button/_button-secondary-outlined.scss +38 -0
  35. package/elements/button/button.js +12 -0
  36. package/elements/button/button.scss +68 -0
  37. package/elements/button/button.vue +42 -0
  38. package/elements/icon/icon.ce.scss +6 -0
  39. package/elements/icon/icon.js +13 -0
  40. package/elements/icon/icon.scss +25 -0
  41. package/elements/icon/icon.vue +80 -0
  42. package/elements/icon-button/_icon-button-base.scss +59 -0
  43. package/elements/icon-button/_icon-button-filled-inverted.scss +42 -0
  44. package/elements/icon-button/_icon-button-filled.scss +32 -0
  45. package/elements/icon-button/_icon-button-outlined-inverted.scss +34 -0
  46. package/elements/icon-button/_icon-button-outlined.scss +38 -0
  47. package/elements/icon-button/_icon-button-plain-inverted.scss +32 -0
  48. package/elements/icon-button/_icon-button-plain.scss +32 -0
  49. package/elements/icon-button/icon-button.js +12 -0
  50. package/elements/icon-button/icon-button.scss +51 -0
  51. package/elements/icon-button/icon-button.vue +41 -0
  52. package/elements/index.js +11 -0
  53. package/elements/loader/loader.ce.scss +5 -0
  54. package/elements/loader/loader.js +13 -0
  55. package/elements/loader/loader.scss +106 -0
  56. package/elements/loader/loader.vue +18 -0
  57. package/globals.js +4 -0
  58. package/index.js +1 -0
  59. package/package.json +30 -0
  60. package/style.js +2 -0
  61. package/utils/math/clamp.js +14 -0
  62. package/utils/math/index.js +1 -0
  63. package/utils/object/deep-get.js +26 -0
  64. package/utils/object/index.js +2 -0
  65. package/utils/translations/index.js +1 -0
  66. package/utils/translations/translate.js +10 -0
  67. package/vite.config.js +31 -0
package/dist/style.css ADDED
@@ -0,0 +1,20 @@
1
+ @import"//hello.myfonts.net/count/3c2a64";/**
2
+ * @license
3
+ * MyFonts Webfont Build ID 3943012, 2020-09-02T07:30:46-0400
4
+ *
5
+ * The fonts listed in this notice are subject to the End User License
6
+ * Agreement(s) entered into by the website owner. All other parties are
7
+ * explicitly restricted from using the Licensed Webfonts(s).
8
+ *
9
+ * Webfont: Glober-Bold by Fontfabric
10
+ * URL: https://www.myfonts.com/fonts/font-fabric/glober/bold/
11
+ * Copyright: Copyright (c) 2019 by Svet Simov. All rights reserved.
12
+ *
13
+ *
14
+ * Webfont: Glober-Regular by Fontfabric
15
+ * URL: https://www.myfonts.com/fonts/font-fabric/glober/regular/
16
+ * Copyright: Copyright (c) 2019 by Svet Simov. All rights reserved.
17
+ *
18
+ *
19
+ * © 2020 MyFonts Inc
20
+ */@font-face{font-family:Glober;font-weight:400;font-style:normal;font-display:swap;src:url(/static/ui-assets/fonts/Glober/Glober-Regular/font.woff2) format("woff2"),url(/static/ui-assets/fonts/Glober/Glober-Regular/font.woff) format("woff")}@font-face{font-family:Glober;font-weight:700;font-style:normal;font-display:swap;src:url(/static/ui-assets/fonts/Glober/Glober-Bold/font.woff2) format("woff2"),url(/static/ui-assets/fonts/Glober/Glober-Bold/font.woff) format("woff")}:root{--e-c-primary-01-50: #edf6e9;--e-c-primary-01-50-rgb: 237, 246, 233;--e-c-primary-01-100: #dbedd4;--e-c-primary-01-100-rgb: 219, 237, 212;--e-c-primary-01-200: #9cce89;--e-c-primary-01-200-rgb: 156, 206, 137;--e-c-primary-01-500: #4ba528;--e-c-primary-01-500-rgb: 75, 165, 40;--e-c-primary-01-700: #3c8420;--e-c-primary-01-700-rgb: 60, 132, 32;--e-c-primary-01-900: #316b1a;--e-c-primary-01-900-rgb: 49, 107, 26;--e-c-secondary-01-50: #e5f2eb;--e-c-secondary-01-50-rgb: 229, 242, 235;--e-c-secondary-01-100: #cce5d8;--e-c-secondary-01-100-rgb: 204, 229, 216;--e-c-secondary-01-200: #73b894;--e-c-secondary-01-200-rgb: 115, 184, 148;--e-c-secondary-01-500: #007d3c;--e-c-secondary-01-500-rgb: 0, 125, 60;--e-c-secondary-01-700: #006430;--e-c-secondary-01-700-rgb: 0, 100, 48;--e-c-secondary-01-900: #005127;--e-c-secondary-01-900-rgb: 0, 81, 39;--e-c-secondary-02-50: #ede9ee;--e-c-secondary-02-50-rgb: 237, 233, 238;--e-c-secondary-02-100: #dcd3de;--e-c-secondary-02-100-rgb: 220, 211, 222;--e-c-secondary-02-200: #9f86a4;--e-c-secondary-02-200-rgb: 159, 134, 164;--e-c-secondary-02-500: #50235a;--e-c-secondary-02-500-rgb: 80, 35, 90;--e-c-secondary-02-700: #401c48;--e-c-secondary-02-700-rgb: 64, 28, 72;--e-c-secondary-02-900: #34173b;--e-c-secondary-02-900-rgb: 52, 23, 59;--e-c-secondary-03-50: #f8e7ed;--e-c-secondary-03-50-rgb: 248, 231, 237;--e-c-secondary-03-100: #f1cfdb;--e-c-secondary-03-100-rgb: 241, 207, 219;--e-c-secondary-03-200: #d97b9c;--e-c-secondary-03-200-rgb: 217, 123, 156;--e-c-secondary-03-500: #b90f4b;--e-c-secondary-03-500-rgb: 185, 15, 75;--e-c-secondary-03-700: #940c3c;--e-c-secondary-03-700-rgb: 148, 12, 60;--e-c-secondary-03-900: #780a31;--e-c-secondary-03-900-rgb: 120, 10, 49;--e-c-secondary-04-50: #fffbe5;--e-c-secondary-04-50-rgb: 255, 251, 229;--e-c-secondary-04-100: #fff7cc;--e-c-secondary-04-100-rgb: 255, 247, 204;--e-c-secondary-04-200: #ffe973;--e-c-secondary-04-200-rgb: 255, 233, 115;--e-c-secondary-04-500: #ffd700;--e-c-secondary-04-500-rgb: 255, 215, 0;--e-c-secondary-04-700: #ccac00;--e-c-secondary-04-700-rgb: 204, 172, 0;--e-c-secondary-04-900: #a68c00;--e-c-secondary-04-900-rgb: 166, 140, 0;--e-c-secondary-05-50: #e5f5fc;--e-c-secondary-05-50-rgb: 229, 245, 252;--e-c-secondary-05-100: #cceaf8;--e-c-secondary-05-100-rgb: 204, 234, 248;--e-c-secondary-05-200: #73c5ec;--e-c-secondary-05-200-rgb: 115, 197, 236;--e-c-secondary-05-500: #0096dc;--e-c-secondary-05-500-rgb: 0, 150, 220;--e-c-secondary-05-700: #0078b0;--e-c-secondary-05-700-rgb: 0, 120, 176;--e-c-secondary-05-900: #00618f;--e-c-secondary-05-900-rgb: 0, 97, 143;--e-c-secondary-06-50: #f4e6e5;--e-c-secondary-06-50-rgb: 244, 230, 229;--e-c-secondary-06-100: #e9cdcc;--e-c-secondary-06-100-rgb: 233, 205, 204;--e-c-secondary-06-200: #c27673;--e-c-secondary-06-200-rgb: 194, 118, 115;--e-c-secondary-06-500: #910500;--e-c-secondary-06-500-rgb: 145, 5, 0;--e-c-secondary-06-700: #740400;--e-c-secondary-06-700-rgb: 116, 4, 0;--e-c-secondary-06-900: #5e0300;--e-c-secondary-06-900-rgb: 94, 3, 0;--e-c-mono-50: #f5f5f5;--e-c-mono-50-rgb: 245, 245, 245;--e-c-mono-100: #ececec;--e-c-mono-100-rgb: 236, 236, 236;--e-c-mono-200: #dddddd;--e-c-mono-200-rgb: 221, 221, 221;--e-c-mono-500: #b3b3b3;--e-c-mono-500-rgb: 179, 179, 179;--e-c-mono-700: #6b6b6b;--e-c-mono-700-rgb: 107, 107, 107;--e-c-mono-900: #333333;--e-c-mono-900-rgb: 51, 51, 51;--e-c-mono-00: #ffffff;--e-c-mono-00-rgb: 255, 255, 255;--e-c-signal-01-100: #b6e6cf;--e-c-signal-01-100-rgb: 182, 230, 207;--e-c-signal-01-500: #1aa764;--e-c-signal-01-500-rgb: 26, 167, 100;--e-c-signal-01-700: #0e6f41;--e-c-signal-01-700-rgb: 14, 111, 65;--e-c-signal-01-900: #004926;--e-c-signal-01-900-rgb: 0, 73, 38;--e-c-signal-02-100: #ffe2b6;--e-c-signal-02-100-rgb: 255, 226, 182;--e-c-signal-02-500: #ff9800;--e-c-signal-02-500-rgb: 255, 152, 0;--e-c-signal-02-700: #cc7a00;--e-c-signal-02-700-rgb: 204, 122, 0;--e-c-signal-02-900: #703600;--e-c-signal-02-900-rgb: 112, 54, 0;--e-c-signal-03-100: #ffb5c4;--e-c-signal-03-100-rgb: 255, 181, 196;--e-c-signal-03-500: #ff0c3e;--e-c-signal-03-500-rgb: 255, 12, 62;--e-c-signal-03-700: #b90d31;--e-c-signal-03-700-rgb: 185, 13, 49;--e-c-signal-03-900: #790019;--e-c-signal-03-900-rgb: 121, 0, 25;--e-space-1: 4px;--e-space-2: 8px;--e-space-3: 12px;--e-space-4: 16px;--e-space-5: 20px;--e-space-6: 24px;--e-space-7: 28px;--e-space-8: 32px;--e-space-9: 36px;--e-space-10: 40px;--e-space-11: 44px;--e-space-12: 48px;--e-space-14: 56px;--e-space-16: 64px;--e-space-20: 80px;--e-space-24: 96px;--e-space-28: 112px;--e-space-30: 120px;--e-space-32: 128px;--e-space-36: 144px;--e-space-40: 160px;--e-space-44: 176px;--e-space-48: 192px;--e-space-52: 208px;--e-space-56: 224px;--e-space-60: 240px;--e-space-64: 256px;--e-space-72: 288px;--e-space-80: 320px;--e-space-96: 384px;--e-space-0_5: 2px;--e-space-1_5: 6px;--e-space-2_5: 10px;--e-space-3_5: 14px;--e-type-font-body: Glober;--e-type-font-fallback: "Helvetica Neue", helvetica, arial, sans-serif;--e-type-font-base-size: 16px;--e-type-size-50: 12px;--e-type-size-100: 14px;--e-type-size-200: 16px;--e-type-size-300: 18px;--e-type-size-400: 20px;--e-type-size-500: 22px;--e-type-size-600: 26px;--e-type-size-700: 26px;--e-type-size-800: 32px;--e-type-size-900: 48px;--e-type-size-1000: 56px;--e-type-line-height-50: 1.5 ;--e-type-line-height-100: calc(22 / 14);--e-type-line-height-200: 1.5 ;--e-type-line-height-300: calc(28 / 18);--e-type-line-height-400: 1.3 ;--e-type-line-height-500: calc(30 / 22);--e-type-line-height-600: calc(36 / 26);--e-type-line-height-700: calc(34 / 26);--e-type-line-height-800: 1.1875 ;--e-type-line-height-900: 1.125 ;--e-type-line-height-1000: calc(62 / 56);--e-type-weight-weak: 400;--e-type-weight-strong: 700;--e-type-decoration-enhance: underline;--e-trs-duration-fastest: .1s;--e-trs-duration-faster: .2s;--e-trs-duration-fast: .4s;--e-trs-duration-slow: .6s;--e-trs-duration-slower: .8s;--e-trs-duration-slowest: 1s;--e-trs-easing-default: ease-in-out;--e-brd-radius-1: 4px;--e-brd-radius-2: 8px;--e-brd-radius-3: 12px;--e-brd-radius-4: 16px;--e-brd-radius-5: 20px;--e-brd-radius-6: 24px;--e-mq-breakpoint-xs: 480px;--e-mq-breakpoint-s: 520px;--e-mq-breakpoint-m: 740px;--e-mq-breakpoint-lg: 1020px;--e-mq-breakpoint-xl: 1240px;--e-mq-breakpoint-2xl: 1520px;--e-layout-site-width: 1680px;--e-layout-site-width-lg: 1020px;--e-layout-site-width-m: 740px;--e-layout-site-width-s: 520px;--e-layout-grid-columns: 12;--e-elevation-xs: 0px 1px 2px rgba(0, 0, 0, .05);--e-elevation-sm: 0px 1px 3px rgba(0, 0, 0, .1), 0px 1px 2px -1px rgba(0, 0, 0, .1);--e-elevation-md: 0px 4px 6px -1px rgba(0, 0, 0, .1), 0px 2px 4px -2px rgba(0, 0, 0, .1);--e-elevation-lg: 0px 10px 15px -3px rgba(0, 0, 0, .1), 0px 4px 6px -4px rgba(0, 0, 0, .1);--e-elevation-xl: 0px 20px 25px -5px rgba(0, 0, 0, .1), 0px 8px 10px -6px rgba(0, 0, 0, .1);--e-elevation-2xl: 0px 25px 50px -12px rgba(0, 0, 0, .25)}body{margin:0;min-height:100vh}h1,h2,h3,h4,h5,h6{margin:0;text-wrap:balance}p,figure,blockquote{margin:0}button{padding:0;margin:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:0;font-family:inherit;font-size:inherit;background:none}ul,ol{list-style:none;padding:0;margin:0}dl,dt,dd{margin:0}address{font-style:normal}img,picture{max-width:100%;display:block}fieldset{padding:0;margin:0;border:0}html{box-sizing:border-box;scroll-behavior:smooth;min-height:100vh}*,*:before,*:after{box-sizing:inherit}body{font-family:var(--e-type-font-body),var(--e-type-font-fallback);font-size:var(--e-type-size-300);font-weight:var(--e-type-weight-weak);line-height:var(--e-type-line-height-300);color:var(--e-c-mono-900)}*{outline:none}*:focus-visible{outline-style:solid;outline-offset:4px;outline-color:#b3b3b3cc}[data-whatintent=mouse] *:focus{outline:none}e-button:not(:defined),e-icon-button:not(:defined),e-loader:not(:defined){opacity:0}
package/dist/style.js ADDED
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,49 @@
1
+ @use '../../base/abstracts' as a;
2
+
3
+ @mixin button-base {
4
+ position: relative;
5
+ display: inline-flex;
6
+ align-items: center;
7
+ justify-content: center;
8
+ padding: a.rem(10) a.rem(30);
9
+ grid-gap: var(--e-space-2);
10
+ border-radius: 24px;
11
+ transition:
12
+ background-color a.$trs-default,
13
+ box-shadow a.$trs-default,
14
+ color a.$trs-default,
15
+ border a.$trs-default;
16
+ border-width: 2px;
17
+ border-style: solid;
18
+ text-decoration: none;
19
+ vertical-align: middle;
20
+ text-align: center;
21
+ cursor: pointer;
22
+
23
+ @include a.type(200, strong);
24
+
25
+ .button__loader {
26
+ position: absolute;
27
+ top: 0;
28
+ left: 0;
29
+ display: flex;
30
+ align-items: center;
31
+ justify-content: center;
32
+ width: 100%;
33
+ height: 100%;
34
+ }
35
+
36
+ &.disabled,
37
+ &:disabled {
38
+ pointer-events: none;
39
+ }
40
+
41
+ &[loading] {
42
+ cursor: default;
43
+ }
44
+
45
+ .icon,
46
+ e-icon {
47
+ --icon-transition: fill #{a.$trs-default};
48
+ }
49
+ }
@@ -0,0 +1,41 @@
1
+ @mixin button-filled-inverted {
2
+ background-color: var(--e-c-mono-00);
3
+ border-color: var(--e-c-mono-00);
4
+ color: var(--e-c-primary-01-700);
5
+
6
+ e-loader {
7
+ --dot-color: var(--e-c-secondary-01-900);
8
+ }
9
+
10
+ .icon,
11
+ e-icon {
12
+ --icon-fill-color: var(--e-c-primary-01-700);
13
+ }
14
+
15
+ &:hover {
16
+ background-color: var(--e-c-primary-01-100);
17
+ border-color: var(--e-c-primary-01-100);
18
+ color: var(--e-c-secondary-01-700);
19
+
20
+ .icon,
21
+ e-icon {
22
+ --icon-fill-color: var(--e-c-secondary-01-700);
23
+ }
24
+ }
25
+
26
+ &:active,
27
+ &[loading] {
28
+ background-color: var(--e-c-primary-01-200);
29
+ border-color: var(--e-c-primary-01-200);
30
+ }
31
+
32
+ &.disabled:not([loading]),
33
+ &:disabled:not([loading]) {
34
+ color: var(--e-c-mono-700);
35
+
36
+ .icon,
37
+ e-icon {
38
+ --icon-fill-color: var(--e-c-mono-700);
39
+ }
40
+ }
41
+ }
@@ -0,0 +1,32 @@
1
+ @mixin button-filled {
2
+ background-color: var(--e-c-primary-01-700);
3
+ color: var(--e-c-mono-00);
4
+ border-color: var(--e-c-primary-01-700);
5
+
6
+ .icon,
7
+ e-icon {
8
+ --icon-fill-color: var(--e-c-mono-00);
9
+ }
10
+
11
+ .loader,
12
+ e-loader {
13
+ --dot-color: var(--e-c-mono-00);
14
+ }
15
+
16
+ &:hover {
17
+ background-color: var(--e-c-secondary-01-900);
18
+ border-color: var(--e-c-secondary-01-900);
19
+ }
20
+
21
+ &:active,
22
+ &[loading] {
23
+ background-color: var(--e-c-secondary-01-700);
24
+ border-color: var(--e-c-secondary-01-700);
25
+ }
26
+
27
+ &.disabled:not([loading]),
28
+ &:disabled:not([loading]) {
29
+ background-color: var(--e-c-mono-500);
30
+ border-color: var(--e-c-mono-500);
31
+ }
32
+ }
@@ -0,0 +1,38 @@
1
+ @mixin button-outlined-inverted {
2
+ background-color: transparent;
3
+ border-color: var(--e-c-mono-00);
4
+ color: var(--e-c-mono-00);
5
+
6
+ .icon,
7
+ e-icon {
8
+ --icon-fill-color: var(--e-c-mono-00);
9
+ }
10
+
11
+ .loader,
12
+ e-loader {
13
+ --dot-color: var(--e-c-mono-00);
14
+ }
15
+
16
+ &:hover {
17
+ background-color: rgba(var(--e-c-primary-01-900-rgb), 0.7);
18
+ border-color: var(--e-c-primary-01-200);
19
+ }
20
+
21
+ &:active,
22
+ &[loading] {
23
+ background-color: transparent;
24
+ border-color: var(--e-c-primary-01-500);
25
+ }
26
+
27
+ &.disabled:not([loading]),
28
+ &:disabled:not([loading]) {
29
+ color: var(--e-c-mono-500);
30
+ border: 2px solid var(--e-c-mono-500);
31
+ background-color: transparent;
32
+
33
+ .icon,
34
+ e-icon {
35
+ --icon-fill-color: var(--e-c-mono-500);
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,38 @@
1
+ @mixin button-outlined {
2
+ background-color: transparent;
3
+ color: var(--e-c-primary-01-700);
4
+ border: 2px solid var(--e-c-primary-01-700);
5
+
6
+ .icon,
7
+ e-icon {
8
+ --icon-fill-color: var(--e-c-primary-01-700);
9
+ }
10
+
11
+ .loader,
12
+ e-loader {
13
+ --dot-color: var(--e-c-primary-01-500);
14
+ }
15
+
16
+ &:hover {
17
+ background-color: var(--e-c-primary-01-50);
18
+ border-color: var(--e-c-primary-01-200);
19
+ }
20
+
21
+ &:active,
22
+ &[loading] {
23
+ background-color: transparent;
24
+ border-color: var(--e-c-primary-01-500);
25
+ }
26
+
27
+ &.disabled:not([loading]),
28
+ &:disabled:not([loading]) {
29
+ border-color: var(--e-c-mono-500);
30
+ background-color: transparent;
31
+ color: var(--e-c-mono-500);
32
+
33
+ .icon,
34
+ e-icon {
35
+ --icon-fill-color: var(--e-c-mono-500);
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,7 @@
1
+ @use '../../base/abstracts' as a;
2
+ @use './button-plain' as *;
3
+
4
+ @mixin button-plain-small {
5
+ @include button-plain;
6
+ @include a.type(100, strong);
7
+ }
@@ -0,0 +1,49 @@
1
+ @mixin button-plain {
2
+ padding: var(--e-space-2) var(--e-space-3);
3
+ color: var(--e-c-primary-01-700);
4
+ background: none;
5
+ border: 0;
6
+ text-decoration: none;
7
+ grid-gap: var(--e-space-1);
8
+
9
+ .icon,
10
+ e-icon {
11
+ --icon-fill-color: var(--e-c-primary-01-700);
12
+ }
13
+
14
+ &:hover {
15
+ color: var(--e-c-secondary-01-900);
16
+
17
+ .icon,
18
+ e-icon {
19
+ --icon-fill-color: var(--e-c-secondary-01-900);
20
+ }
21
+ }
22
+
23
+ &:active {
24
+ color: var(--e-c-secondary-01-700);
25
+
26
+ .icon,
27
+ e-icon {
28
+ --icon-fill-color: var(--e-c-secondary-01-700);
29
+ }
30
+ }
31
+
32
+ &.disabled:not([loading]),
33
+ &:disabled:not([loading]) {
34
+ background: none;
35
+ color: var(--e-c-mono-500);
36
+
37
+ .icon,
38
+ e-icon {
39
+ --icon-fill-color: var(--e-c-mono-500);
40
+ }
41
+ }
42
+
43
+ &[loading] {
44
+ .loader,
45
+ e-loader {
46
+ --dot-color: var(--e-c-secondary-01-700);
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,38 @@
1
+ @mixin button-secondary-outlined {
2
+ background-color: transparent;
3
+ color: var(--e-c-secondary-02-500);
4
+ border: 2px solid var(--e-c-secondary-02-500);
5
+
6
+ .icon,
7
+ e-icon {
8
+ --icon-fill-color: var(--e-c-secondary-02-500);
9
+ }
10
+
11
+ .loader,
12
+ e-loader {
13
+ --dot-color: var(--e-c-secondary-02-500);
14
+ }
15
+
16
+ &:hover {
17
+ background-color: var(--e-c-secondary-02-50);
18
+ border-color: var(--e-c-secondary-02-200);
19
+ }
20
+
21
+ &:active,
22
+ &[loading] {
23
+ background-color: transparent;
24
+ border-color: var(--e-c-secondary-02-200);
25
+ }
26
+
27
+ &.disabled:not([loading]),
28
+ &:disabled:not([loading]) {
29
+ border-color: var(--e-c-mono-500);
30
+ background-color: transparent;
31
+ color: var(--e-c-mono-500);
32
+
33
+ .icon,
34
+ e-icon {
35
+ --icon-fill-color: var(--e-c-mono-500);
36
+ }
37
+ }
38
+ }
@@ -0,0 +1,12 @@
1
+ import { defineCustomElement } from 'vue'
2
+ import Button from './button.vue'
3
+ import customElementBaseStyle from '../../base/custom-element-base.scss?inline'
4
+ import styles from './button.scss?inline'
5
+
6
+ Button.styles = [customElementBaseStyle, styles]
7
+
8
+ export const ButtonElement = {
9
+ register: () => {
10
+ customElements.define('e-button', defineCustomElement(Button))
11
+ },
12
+ }
@@ -0,0 +1,68 @@
1
+ @use 'button-base' as *;
2
+ @use 'button-filled' as *;
3
+ @use 'button-outlined' as *;
4
+ @use 'button-plain' as *;
5
+ @use 'button-plain-small' as *;
6
+ @use 'button-filled-inverted' as *;
7
+ @use 'button-outlined-inverted' as *;
8
+ @use 'button-secondary-outlined' as *;
9
+ @use '../../base/abstracts' as a;
10
+ @include a.button-reset;
11
+
12
+ .button {
13
+ .icon,
14
+ e-icon {
15
+ // Icons must always have this size in button.
16
+ width: 24px;
17
+ height: 24px;
18
+ }
19
+
20
+ @include button-base;
21
+
22
+ // ---- PRIMARY ----
23
+ & {
24
+ @include button-filled;
25
+ }
26
+
27
+ &.outlined {
28
+ @include button-outlined;
29
+ }
30
+
31
+ &.plain {
32
+ @include button-plain;
33
+ }
34
+
35
+ &.plain-small {
36
+ @include button-plain-small;
37
+ }
38
+
39
+ &.filled-inverted {
40
+ @include button-filled-inverted;
41
+ }
42
+
43
+ &.outlined-inverted {
44
+ @include button-outlined-inverted;
45
+ }
46
+
47
+ // ---- SECONDARY ----
48
+ &.secondary-outlined {
49
+ @include button-secondary-outlined;
50
+ }
51
+
52
+ &.secondary-outlined-small {
53
+ padding: var(--e-space-2_5) var(--e-space-6); // stylelint-disable custom-property-pattern
54
+
55
+ @include button-secondary-outlined;
56
+ @include a.type(100, strong);
57
+ }
58
+
59
+ // States
60
+ &[loading] {
61
+ color: transparent;
62
+
63
+ .icon,
64
+ e-icon {
65
+ --icon-fill-color: transparent;
66
+ }
67
+ }
68
+ }
@@ -0,0 +1,42 @@
1
+ <script setup>
2
+ import Icon from '../icon/icon.vue'
3
+ import Loader from '../loader/loader.vue'
4
+
5
+ defineProps({
6
+ label: String,
7
+ loading: Boolean,
8
+ disabled: Boolean,
9
+ icon: String,
10
+ href: String,
11
+ target: String,
12
+ variant: String,
13
+ })
14
+ </script>
15
+
16
+ <template>
17
+ <template v-if="href">
18
+ <a :class="['button', variant]" :href="href" :target="target">
19
+ <Icon v-if="icon" :name="icon"></Icon>
20
+ <slot>{{ label }}</slot>
21
+ </a>
22
+ </template>
23
+
24
+ <template v-else>
25
+ <button
26
+ :class="['button', variant]"
27
+ :disabled="disabled || null"
28
+ :loading="loading || null"
29
+ >
30
+ <Icon v-if="icon" :name="icon" />
31
+ <slot>{{ label }}</slot>
32
+
33
+ <span class="button__loader" v-if="loading">
34
+ <Loader />
35
+ </span>
36
+ </button>
37
+ </template>
38
+ </template>
39
+
40
+ <style lang="scss" scoped>
41
+ @use './button.scss';
42
+ </style>
@@ -0,0 +1,6 @@
1
+ :host {
2
+ --icon-fill-color: currentcolor;
3
+ --icon-transition: none;
4
+ --icon-width: 24px;
5
+ --icon-height: 24px;
6
+ }
@@ -0,0 +1,13 @@
1
+ import { defineCustomElement } from 'vue'
2
+ import Icon from './icon.vue'
3
+ import customElementBaseStyle from '../../base/custom-element-base.scss?inline'
4
+ import ceStyles from './icon.ce.scss?inline'
5
+ import styles from './icon.scss?inline'
6
+
7
+ Icon.styles = [customElementBaseStyle, ceStyles, styles]
8
+
9
+ export const IconElement = {
10
+ register: () => {
11
+ customElements.define('e-icon', defineCustomElement(Icon))
12
+ },
13
+ }
@@ -0,0 +1,25 @@
1
+ .icon {
2
+ display: block;
3
+ fill: var(--icon-fill-color, currentColor);
4
+
5
+ // Default dimension, in case the given icon doesn't exist. Else the svg would use the default size 300x150px.
6
+ width: var(--icon-width, 24px);
7
+ height: var(--icon-height, 24px);
8
+
9
+ // TODO: refactor this. per default there should be no transitions. (buttons need transition on icons.)
10
+
11
+ // transition: fill var(--e-trs-duration-faster) var(--e-trs-easing-default);
12
+
13
+ // solution for the above
14
+ transition: var(--icon-transition, none);
15
+
16
+ &.icon--custom-size {
17
+ width: 100%;
18
+ height: 100%;
19
+ }
20
+
21
+ &.icon--inline {
22
+ display: inline-block;
23
+ vertical-align: baseline;
24
+ }
25
+ }
@@ -0,0 +1,80 @@
1
+ <script setup>
2
+ import { ref } from 'vue'
3
+ import { assetsPath } from '../../globals.js'
4
+
5
+ /**
6
+ * Path prefix for icons.
7
+ */
8
+ const iconPath = assetsPath + '/icons/'
9
+
10
+ /**
11
+ * This map will hold all fetched icons. Should minimize unnecesary requests. It's just a cache.
12
+ */
13
+ const iconMap = new Map()
14
+
15
+ /**
16
+ * A simple (non-visible) placeholder, which will is used when an error happened or the icon couldn't be found.
17
+ */
18
+ const svgPlaceholder = `
19
+ <svg width="24" height="24"></svg>
20
+ `
21
+
22
+ /**
23
+ * @typedef { import('vue').Ref } Ref
24
+ */
25
+ let svgContent = ref(svgPlaceholder)
26
+
27
+ /**
28
+ * Fetches an icon from the assets folder. Or if already fecthed gets it from `iconMap`.
29
+ *
30
+ * @param {string} name - Icon name (without extension)
31
+ * @returns {Ref}
32
+ */
33
+ const getIcon = (name) => {
34
+ // Check if icon has already been fetched.
35
+ if (iconMap.has(name)) {
36
+ svgContent.value = iconMap.get(name)
37
+ return svgContent.value
38
+ }
39
+
40
+ fetch(`${iconPath}${name}.svg`)
41
+ .then((response) => {
42
+ if (!response.ok) {
43
+ throw new Error('Something went wrong when fetching the icon.')
44
+ }
45
+
46
+ return response.text()
47
+ })
48
+ .then((text) => {
49
+ iconMap.set(name, text)
50
+ svgContent.value = text
51
+ })
52
+ .catch((err) => {
53
+ svgContent.value = svgPlaceholder
54
+ })
55
+
56
+ return svgContent.value
57
+ }
58
+
59
+ defineProps({
60
+ name: String,
61
+ inline: Boolean,
62
+ width: Number,
63
+ height: Number,
64
+ })
65
+ </script>
66
+
67
+ <template>
68
+ <svg
69
+ aria-hidden="true"
70
+ :style="
71
+ width && height ? { width: width + 'px', height: height + 'px' } : false
72
+ "
73
+ :class="['icon', { 'icon-inline': inline }]"
74
+ v-html="getIcon(name)"
75
+ ></svg>
76
+ </template>
77
+
78
+ <style lang="scss" scoped>
79
+ @use './icon.scss';
80
+ </style>
@@ -0,0 +1,59 @@
1
+ @use '../../base/abstracts' as a;
2
+
3
+ $icon-button-size: 48px;
4
+
5
+ @mixin icon-button-hover-state {
6
+ &::before {
7
+ transform: scale(1.05);
8
+ }
9
+ }
10
+
11
+ @mixin icon-button-base {
12
+ position: relative;
13
+ display: inline-flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ width: a.rem($icon-button-size);
17
+ height: a.rem($icon-button-size);
18
+ border-radius: 100%;
19
+ color: transparent;
20
+
21
+ // Pointer should only be used for actual 'links'.
22
+ // And buttons shouldn't have a pointer cursor. But it seems people still want this.
23
+ cursor: pointer;
24
+
25
+ .icon,
26
+ e-icon {
27
+ position: relative;
28
+ }
29
+
30
+ &::before {
31
+ content: '';
32
+ position: absolute;
33
+ top: 0;
34
+ left: 0;
35
+ width: 100%;
36
+ height: 100%;
37
+ border-radius: 100%;
38
+ border-width: 2px;
39
+ border-style: solid;
40
+ transition:
41
+ background-color a.$trs-default,
42
+ border-color a.$trs-default,
43
+ transform a.$trs-default;
44
+ }
45
+
46
+ &:hover:not(:disabled) {
47
+ @include icon-button-hover-state;
48
+ }
49
+
50
+ &:active {
51
+ &::before {
52
+ transform: scale(1);
53
+ }
54
+ }
55
+
56
+ &:disabled {
57
+ cursor: default;
58
+ }
59
+ }