@energie360/ui-library 0.0.4 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,30 @@
1
+ @use '../../base/abstracts' as a;
2
+ @use '@energie360/design-tokens/dist/scss' as dt;
3
+
4
+ // TODO: Move this mixin to abstratcs?
5
+ @mixin grid-container {
6
+ margin: 0 auto;
7
+ max-width: a.rem(dt.$layout-site-width);
8
+ width: 100%;
9
+ padding-left: a.rem(a.$container-edge-2xl);
10
+ padding-right: a.rem(a.$container-edge-2xl);
11
+
12
+ @include a.bp(lg) {
13
+ padding-left: a.rem(a.$container-edge-lg);
14
+ padding-right: a.rem(a.$container-edge-lg);
15
+ }
16
+
17
+ @include a.bp(m) {
18
+ padding-left: a.rem(a.$container-edge-m);
19
+ padding-right: a.rem(a.$container-edge-m);
20
+ }
21
+
22
+ @include a.bp(s) {
23
+ padding-left: a.rem(a.$container-edge-s);
24
+ padding-right: a.rem(a.$container-edge-s);
25
+ }
26
+ }
27
+
28
+ .container {
29
+ @include grid-container;
30
+ }
@@ -0,0 +1,10 @@
1
+ @use 'sass:math';
2
+ @use './grid.mixin' as g;
3
+
4
+ .row {
5
+ @include g.grid-row;
6
+
7
+ &.row--centered {
8
+ justify-content: center;
9
+ }
10
+ }
@@ -0,0 +1,90 @@
1
+ @use 'sass:math';
2
+ @use '../../base/abstracts' as a;
3
+
4
+ /**
5
+ Helper to colculate col width in %.
6
+ Looks complicated because we use grid-gap on the row, which takes away from available width.
7
+ */
8
+ @function col-width($size, $columns, $gutter) {
9
+ @return math.div(100% - (($columns - 1) * $gutter), $columns) * $size +
10
+ (($size - 1) * $gutter);
11
+ }
12
+
13
+ @mixin grid-row() {
14
+ display: flex;
15
+ flex-wrap: wrap;
16
+ grid-gap: a.$grid-gutter-2xl;
17
+
18
+ @include a.bp(lg) {
19
+ grid-gap: a.$grid-gutter-lg;
20
+ }
21
+
22
+ @include a.bp(m) {
23
+ grid-gap: a.$grid-gutter-m;
24
+ }
25
+
26
+ @include a.bp(s) {
27
+ grid-gap: a.$grid-gutter-s;
28
+ }
29
+ }
30
+
31
+ /**
32
+ Mixin to create a grid column cell.
33
+
34
+ $cols: Column width of cell.
35
+ $columns: Grid size (in columns). Default is set by global variable $grid-columns (defined via design token).
36
+ */
37
+ @mixin grid-col($cols, $columns: a.$grid-columns) {
38
+ $width-2xl: col-width($cols, $columns, a.$grid-gutter-2xl);
39
+
40
+ flex: 0 0 $width-2xl;
41
+ max-width: $width-2xl;
42
+
43
+ @include a.bp(lg) {
44
+ $width-lg: col-width($cols, $columns, a.$grid-gutter-lg);
45
+
46
+ flex: 0 0 $width-lg;
47
+ max-width: $width-lg;
48
+ }
49
+
50
+ @include a.bp(m) {
51
+ $width-m: col-width($cols, $columns, a.$grid-gutter-m);
52
+
53
+ flex: 0 0 $width-m;
54
+ max-width: $width-m;
55
+ }
56
+
57
+ @include a.bp(s) {
58
+ $width-s: col-width($cols, $columns, a.$grid-gutter-s);
59
+
60
+ flex: 0 0 $width-s;
61
+ max-width: $width-s;
62
+ }
63
+ }
64
+
65
+ // TODO: Change args order -> $prop, $indent, $columns
66
+ @mixin grid-col-space(
67
+ $indent,
68
+ $columns: a.$grid-columns,
69
+ $prop: 'margin-left'
70
+ ) {
71
+ #{$prop}: col-width($indent, $columns, a.$grid-gutter-2xl) +
72
+ a.$grid-gutter-2xl;
73
+
74
+ @include a.bp(lg) {
75
+ #{$prop}: col-width($indent, $columns, a.$grid-gutter-lg) +
76
+ a.$grid-gutter-lg;
77
+ }
78
+
79
+ @include a.bp(m) {
80
+ #{$prop}: col-width($indent, $columns, a.$grid-gutter-m) + a.$grid-gutter-m;
81
+ }
82
+
83
+ @include a.bp(s) {
84
+ #{$prop}: col-width($indent, $columns, a.$grid-gutter-s) + a.$grid-gutter-s;
85
+ }
86
+ }
87
+
88
+ @mixin grid-col-indent($indent, $columns: a.$grid-columns) {
89
+ @include grid-col-space($indent, $columns);
90
+ }
@@ -0,0 +1,122 @@
1
+ @use 'sass:math';
2
+ @use '../../base/abstracts' as a;
3
+ @use 'grid.mixin' as *;
4
+
5
+ @use 'grid-row';
6
+
7
+ // These loops create column classes for the breakpoints 2xl, xl, lg, m and s.
8
+ // Obviously it will create classes that will probably never be used (CSS bloat).
9
+ // We could be using only the grid-col mixins.
10
+ // Or also define some commonly used responsive column configurations.
11
+ // We'll have to figure it out...
12
+ @for $i from 1 through a.$grid-columns {
13
+ .col-#{$i} {
14
+ @include grid-col($i);
15
+ }
16
+
17
+ @if ($i < a.$grid-columns) {
18
+ .col-indent-#{$i} {
19
+ @include grid-col-indent($i);
20
+ }
21
+ }
22
+ }
23
+
24
+ // For "2xl" breakpoint
25
+ @include a.bp('2xl') {
26
+ @for $i from 1 through a.$grid-columns {
27
+ .col-2xl-#{$i} {
28
+ @include grid-col($i);
29
+ }
30
+
31
+ @if ($i < a.$grid-columns) {
32
+ .col-indent-2xl-#{$i} {
33
+ @include grid-col-indent($i);
34
+ }
35
+ }
36
+
37
+ // To clear indent on breakpoint xl
38
+ .col-indent-2xl-0 {
39
+ margin-left: 0;
40
+ }
41
+ }
42
+ }
43
+
44
+ // For "xl" breakpoint
45
+ @include a.bp(xl) {
46
+ @for $i from 1 through a.$grid-columns {
47
+ .col-xl-#{$i} {
48
+ @include grid-col($i);
49
+ }
50
+
51
+ @if ($i < a.$grid-columns) {
52
+ .col-indent-xl-#{$i} {
53
+ @include grid-col-indent($i);
54
+ }
55
+ }
56
+
57
+ // To clear indent on breakpoint xl
58
+ .col-indent-xl-0 {
59
+ margin-left: 0;
60
+ }
61
+ }
62
+ }
63
+
64
+ // For "lg" breakpoint
65
+ @include a.bp(lg) {
66
+ @for $i from 1 through a.$grid-columns {
67
+ .col-lg-#{$i} {
68
+ @include grid-col($i);
69
+ }
70
+
71
+ @if ($i < a.$grid-columns) {
72
+ .col-indent-lg-#{$i} {
73
+ @include grid-col-indent($i);
74
+ }
75
+ }
76
+
77
+ // To clear indent on breakpoint lg
78
+ .col-indent-lg-0 {
79
+ margin-left: 0;
80
+ }
81
+ }
82
+ }
83
+
84
+ // For "m" breakpoint
85
+ @include a.bp(m) {
86
+ @for $i from 1 through a.$grid-columns {
87
+ .col-m-#{$i} {
88
+ @include grid-col($i);
89
+ }
90
+
91
+ @if ($i < a.$grid-columns) {
92
+ .col-indent-m-#{$i} {
93
+ @include grid-col-indent($i);
94
+ }
95
+ }
96
+
97
+ // To clear indent on breakpoint m
98
+ .col-indent-m-0 {
99
+ margin-left: 0;
100
+ }
101
+ }
102
+ }
103
+
104
+ // For "s" breakpoint
105
+ @include a.bp(s) {
106
+ @for $i from 1 through a.$grid-columns {
107
+ .col-s-#{$i} {
108
+ @include grid-col($i);
109
+ }
110
+
111
+ @if ($i < a.$grid-columns) {
112
+ .col-indent-s-#{$i} {
113
+ @include grid-col-indent($i);
114
+ }
115
+ }
116
+
117
+ // To clear indent on breakpoint s
118
+ .col-indent-s-0 {
119
+ margin-left: 0;
120
+ }
121
+ }
122
+ }
package/package.json CHANGED
@@ -1,12 +1,14 @@
1
1
  {
2
2
  "name": "@energie360/ui-library",
3
- "version": "0.0.4",
3
+ "version": "0.1.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
7
7
  ".": "./dist/index.js",
8
8
  "./base-style.css": "./dist/base-style.css",
9
- "./elements/*": "./elements/*"
9
+ "./elements/*": "./elements/*",
10
+ "./components/*": "./components/*",
11
+ "./wizard/*": "./wizard/*"
10
12
  },
11
13
  "keywords": [],
12
14
  "author": "",
@@ -0,0 +1,39 @@
1
+ @use '../../base/abstracts' as a;
2
+
3
+ .wizard-intro {
4
+ display: grid;
5
+ grid-template-columns: repeat(2, 1fr);
6
+ column-gap: var(--e-space-10);
7
+
8
+ @include a.bp(lg) {
9
+ row-gap: var(--e-space-12);
10
+ grid-template-columns: 1fr;
11
+ }
12
+ }
13
+
14
+ .left-col {
15
+ display: flex;
16
+ align-items: center;
17
+ }
18
+
19
+ .title-slot {
20
+ @include a.type(1000, strong);
21
+
22
+ @include a.bp(lg) {
23
+ @include a.type(800, strong);
24
+ }
25
+ }
26
+
27
+ .description-slot {
28
+ margin-top: var(--e-space-6);
29
+
30
+ @include a.type(300);
31
+
32
+ @include a.bp(m) {
33
+ @include a.type(200);
34
+ }
35
+ }
36
+
37
+ .cta-slot {
38
+ margin-top: var(--e-space-16);
39
+ }
@@ -0,0 +1,37 @@
1
+ <script setup>
2
+ defineProps({
3
+ title: String,
4
+ description: String,
5
+ ctaText: String
6
+ })
7
+ </script>
8
+
9
+ <template>
10
+ <div class="wizard-intro">
11
+ <div class="left-col">
12
+ <div>
13
+ <div class="title-slot">
14
+ <slot name="title"><h1>{{ title }}</h1></slot>
15
+ </div>
16
+
17
+ <div class="description-slot">
18
+ <slot name="description">
19
+ <p v-html="description"/>
20
+ </slot>
21
+ </div>
22
+
23
+ <div class="cta-slot">
24
+ <slot name="cta"></slot>
25
+ </div>
26
+ </div>
27
+ </div>
28
+
29
+ <div class="right-col">
30
+ <slot name="content-right"></slot>
31
+ </div>
32
+ </div>
33
+ </template>
34
+
35
+ <style lang="scss" scoped>
36
+ @use './wizard-intro.scss';
37
+ </style>
@@ -0,0 +1,45 @@
1
+ @use '../../base/abstracts' as a;
2
+ @use '../../layout/grid/grid-row';
3
+ @use '../../layout/grid/grid.mixin' as g;
4
+
5
+ .wizard-layout-block + .wizard-layout-block {
6
+ margin-top: var(--e-wizard-block-bottom);
7
+ }
8
+
9
+ .wizard-layout-block {
10
+ .col-6 {
11
+ @include g.grid-col(6);
12
+
13
+ @include a.bp(xl) {
14
+ @include g.grid-col(8);
15
+ }
16
+
17
+ @include a.bp(m) {
18
+ @include g.grid-col(12);
19
+ }
20
+ }
21
+
22
+ .col-8 {
23
+ @include g.grid-col(8);
24
+
25
+ @include a.bp(m) {
26
+ @include g.grid-col(12);
27
+ }
28
+ }
29
+
30
+ .col-10 {
31
+ @include g.grid-col(10);
32
+
33
+ @include a.bp(lg) {
34
+ @include g.grid-col(8);
35
+ }
36
+
37
+ @include a.bp(m) {
38
+ @include g.grid-col(12);
39
+ }
40
+ }
41
+
42
+ .col-12 {
43
+ @include g.grid-col(12);
44
+ }
45
+ }
@@ -0,0 +1,19 @@
1
+ <script setup>
2
+ defineProps({
3
+ columns: [Number, String],
4
+ })
5
+ </script>
6
+
7
+ <template>
8
+ <div class="wizard-layout-block">
9
+ <div class="row row--centered">
10
+ <div :class="[`col-${columns}`]">
11
+ <slot></slot>
12
+ </div>
13
+ </div>
14
+ </div>
15
+ </template>
16
+
17
+ <style scoped lang="scss">
18
+ @use './wizard-layout-block.scss';
19
+ </style>
@@ -0,0 +1,3 @@
1
+ .wizard-layout-element + .wizard-layout-element {
2
+ margin-top: var(--e-wizard-block-between);
3
+ }
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <div class="wizard-layout-element">
3
+ <slot></slot>
4
+ </div>
5
+ </template>
6
+
7
+ <style scoped lang="scss">
8
+ @use './wizard-layout-element.scss';
9
+ </style>
@@ -0,0 +1,40 @@
1
+ @use '@energie360/design-tokens/dist/scss/index' as dt;
2
+ @use '../../base/abstracts' as a;
3
+ @use '../../layout/container/container' as c;
4
+
5
+ .container {
6
+ @include c.grid-container;
7
+
8
+ // TODO: Can we do this differently?
9
+ &.embedded {
10
+ padding-left: 0;
11
+ padding-right: 0;
12
+ }
13
+ }
14
+
15
+ .wizard-layout {
16
+ --e-wizard-wrapper-top: #{a.rem(dt.$space-28)};
17
+ --e-wizard-wrapper-bottom: #{a.rem(dt.$space-28)};
18
+ --e-wizard-block-bottom: #{a.rem(dt.$space-16)};
19
+ --e-wizard-block-between: #{a.rem(dt.$space-6)};
20
+
21
+ @include a.bp(lg) {
22
+ --e-wizard-wrapper-top: #{a.rem(dt.$space-12)};
23
+ --e-wizard-wrapper-bottom: #{a.rem(dt.$space-20)};
24
+ --e-wizard-block-bottom: #{a.rem(dt.$space-12)};
25
+ }
26
+
27
+ padding-top: var(--e-wizard-wrapper-top);
28
+ padding-bottom: var(--e-wizard-wrapper-bottom);
29
+
30
+ // Spacing rules
31
+ .wizard-layout-block + .wizard-layout-block {
32
+ margin-top: var(--e-wizard-block-bottom);
33
+ }
34
+
35
+ .wizard-layout-block {
36
+ .wizard-layout-element + .wizard-layout-element {
37
+ margin-top: var(--e-wizard-block-between);
38
+ }
39
+ }
40
+ }
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <div class="container">
3
+ <div class="wizard-layout">
4
+ <slot></slot>
5
+ </div>
6
+ </div>
7
+ </template>
8
+
9
+ <style scoped lang="scss">
10
+ @use './wizard-layout.scss';
11
+ </style>