@enigmatry/scss-foundation 17.1.0 → 17.1.1-preview.2

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.
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1721034934764" clover="3.2.0">
3
- <project timestamp="1721034934764" name="All files">
2
+ <coverage generated="1723191416291" clover="3.2.0">
3
+ <project timestamp="1723191416291" name="All files">
4
4
  <metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0" elements="0" coveredelements="0" complexity="0" loc="0" ncloc="0" packages="0" files="0" classes="0"/>
5
5
  </project>
6
6
  </coverage>
@@ -86,7 +86,7 @@
86
86
  <div class='footer quiet pad2 space-top1 center small'>
87
87
  Code coverage generated by
88
88
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
89
- at 2024-07-15T09:15:34.760Z
89
+ at 2024-08-09T08:16:56.287Z
90
90
  </div>
91
91
  <script src="prettify.js"></script>
92
92
  <script>
@@ -0,0 +1,42 @@
1
+ # Sizing methods
2
+
3
+ Utilities for setting various sizing properties for elements.
4
+
5
+ ## Set sizes
6
+
7
+ @use scss-foundation/src/modules/sizes/set-sizes;
8
+
9
+ ### Box dimensions
10
+
11
+ - Mixin for easily applying specified dimensions for width and height of an element and optional min/max constraints to shrink depending on the screen resizing.
12
+
13
+ ```
14
+ @include set-sizes.box-dimensions(width, 100px, 50px, 200px);
15
+ ```
16
+
17
+ Sets width property and their min and max values.
18
+
19
+ ```
20
+ width: 100px;
21
+ min-width: 50px;
22
+ max-width: 200px;
23
+ ```
24
+
25
+ ### Box definition
26
+
27
+ - A comprehensive mixin for defining both the width and height properties of an element. Sets width and height along with optional min and max values for both dimensions, providing a flexible way to manage element sizing.
28
+
29
+ ```
30
+ @include set-sizes.box-definition(300px, 200px, 250px, 350px, 150px, 250px);
31
+ ```
32
+
33
+ Sets width and height along with their respective min and max values.
34
+
35
+ ```
36
+ width: 300px;
37
+ min-width: 250px;
38
+ max-width: 350px;
39
+ height: 200px;
40
+ min-height: 150px;
41
+ max-height: 250px;
42
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enigmatry/scss-foundation",
3
- "version": "17.1.0",
3
+ "version": "17.1.1-preview.2",
4
4
  "author": "Enigmatry",
5
5
  "description": "Collection of SCSS utilities useful for the most of projects.",
6
6
  "homepage": "https://github.com/enigmatry/entry-angular-building-blocks/tree/master/libs/scss-foundation#readme",
@@ -1,6 +1,7 @@
1
1
  @use 'display';
2
2
  @use 'layout';
3
3
  @use 'position';
4
+ @use 'sizes';
4
5
  @use 'responsiveness';
5
6
  @use 'text';
6
7
  @use 'lists';
@@ -0,0 +1 @@
1
+ @use 'set-size';
@@ -0,0 +1,15 @@
1
+ @mixin box-dimensions($property, $value, $min-value: null, $max-value: null) {
2
+ #{$property}: $value;
3
+
4
+ @if $min-value {
5
+ min-#{$property}: $min-value;
6
+ }
7
+ @if $max-value {
8
+ max-#{$property}: $max-value;
9
+ }
10
+ }
11
+
12
+ @mixin box-definition($width: null, $height: null, $min-width: null, $max-width: null, $min-height: null, $max-height: null) {
13
+ @include box-dimensions(width, $width, $min-width, $max-width);
14
+ @include box-dimensions(height, $height, $min-height, $max-height);
15
+ }
@@ -0,0 +1,77 @@
1
+ @use 'sass-true/sass/true';
2
+ @use '../../src/modules/sizes/set-size';
3
+
4
+ @include true.describe('box-dimensions()') {
5
+
6
+ @include true.it('should set the box height property and value') {
7
+ @include true.assert() {
8
+ @include true.output() {
9
+ @include set-size.box-dimensions(height, 200px);
10
+ }
11
+ @include true.expect() {
12
+ height: 200px;
13
+ }
14
+ }
15
+ }
16
+
17
+ @include true.it('should set only the box width property and value') {
18
+ @include true.assert() {
19
+ @include true.output() {
20
+ @include set-size.box-dimensions(width, 100%);
21
+ }
22
+ @include true.expect() {
23
+ width: 100%;
24
+ }
25
+ }
26
+ }
27
+
28
+ @include true.it('should set the height property of box and values for min-height and max-height') {
29
+ @include true.assert() {
30
+ @include true.output() {
31
+ @include set-size.box-dimensions(height, 300px, 3rem, 8em);
32
+ }
33
+ @include true.expect() {
34
+ height: 300px;
35
+ min-height: 3rem;
36
+ max-height: 8em;
37
+ }
38
+ }
39
+ }
40
+
41
+ @include true.it('should set the height of box and min-height') {
42
+ @include true.assert() {
43
+ @include true.output() {
44
+ @include set-size.box-dimensions(height, 300px, 3rem);
45
+ }
46
+ @include true.expect() {
47
+ height: 300px;
48
+ min-height: 3rem;
49
+ }
50
+ }
51
+ }
52
+
53
+ @include true.it('should set the width of box and min-width') {
54
+ @include true.assert() {
55
+ @include true.output() {
56
+ @include set-size.box-dimensions(width, 300px, 3rem);
57
+ }
58
+ @include true.expect() {
59
+ width: 300px;
60
+ min-width: 3rem;
61
+ }
62
+ }
63
+ }
64
+
65
+ @include true.it('should set the width of box and min-width and max-width in given order') {
66
+ @include true.assert() {
67
+ @include true.output() {
68
+ @include set-size.box-dimensions(width, 400px, 2rem, 6em);
69
+ }
70
+ @include true.expect() {
71
+ width: 400px;
72
+ min-width: 2rem;
73
+ max-width: 6em;
74
+ }
75
+ }
76
+ }
77
+ }
@@ -0,0 +1,78 @@
1
+ /* stylelint-disable scss/no-unused-private-members */
2
+ /* stylelint-disable scss/load-no-partial-leading-underscore */
3
+ /* stylelint-disable scss/block-no-redundant-nesting */
4
+ @use 'sass-true/sass/true';
5
+ @use '../../src/modules/sizes/set-size';
6
+
7
+ @include true.describe('box-definition()') {
8
+
9
+ @include true.it('should handle only width and height.') {
10
+ @include true.assert() {
11
+ @include true.output() {
12
+ @include set-size.box-definition(200px, 3rem);
13
+ }
14
+ @include true.expect() {
15
+ width: 200px;
16
+ height: 3rem;
17
+ }
18
+ }
19
+ }
20
+
21
+ @include true.it('should handle equal width and height with min and max values.') {
22
+ @include true.assert() {
23
+ @include true.output() {
24
+ @include set-size.box-definition(100%, 150px, 100px, 200px, 100px, 200px);
25
+ }
26
+ @include true.expect() {
27
+ width: 100%;
28
+ min-width: 100px;
29
+ max-width: 200px;
30
+ height: 150px;
31
+ min-height: 100px;
32
+ max-height: 200px;
33
+ }
34
+ }
35
+ }
36
+
37
+ @include true.it('should handle only width with min and max values.') {
38
+ @include true.assert() {
39
+ @include true.output() {
40
+ @include set-size.box-definition($width: 300px, $min-width: 200px, $max-width: 400px);
41
+ }
42
+ @include true.expect() {
43
+ width: 300px;
44
+ min-width: 200px;
45
+ max-width: 400px;
46
+ }
47
+ }
48
+ }
49
+
50
+ @include true.it('should handle only height with min and max values.') {
51
+ @include true.assert() {
52
+ @include true.output() {
53
+ @include set-size.box-definition($height: 150px, $min-height: 100px, $max-height: 200px);
54
+ }
55
+ @include true.expect() {
56
+ height: 150px;
57
+ min-height: 100px;
58
+ max-height: 200px;
59
+ }
60
+ }
61
+ }
62
+
63
+ @include true.it('should handle all parameters with different width and height values.') {
64
+ @include true.assert() {
65
+ @include true.output() {
66
+ @include set-size.box-definition($width: 250px, $height: auto, $min-width: 3em, $max-width: 350px, $min-height: 200px, $max-height: 400px);
67
+ }
68
+ @include true.expect() {
69
+ width: 250px;
70
+ min-width: 3em;
71
+ max-width: 350px;
72
+ height: auto;
73
+ min-height: 200px;
74
+ max-height: 400px;
75
+ }
76
+ }
77
+ }
78
+ }