@ilo-org/styles 0.8.3 → 0.9.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.
Files changed (45) hide show
  1. package/build/css/components/index.css +460 -277
  2. package/build/css/components/index.css.map +1 -1
  3. package/build/css/global.css +1 -1
  4. package/build/css/global.css.map +1 -1
  5. package/build/css/index.css +460 -277
  6. package/build/css/index.css.map +1 -1
  7. package/build/css/monorepo.css +460 -277
  8. package/build/css/monorepo.css.map +1 -1
  9. package/build/minified/index.css +1 -1
  10. package/build/minified/index.css.map +1 -1
  11. package/build/minified/monorepo.css +1 -1
  12. package/build/minified/monorepo.css.map +1 -1
  13. package/css/components/cardgroup.css +1 -1
  14. package/css/components/checkbox.css +1 -1
  15. package/css/components/datepicker.css +1 -1
  16. package/css/components/fieldset.css +1 -1
  17. package/css/components/file-upload.css +1 -1
  18. package/css/components/form.css +1 -1
  19. package/css/components/formcontrol.css +1 -0
  20. package/css/components/hero.css +1 -1
  21. package/css/components/navigation.css +1 -1
  22. package/css/components/radio.css +1 -1
  23. package/css/components/textarea.css +1 -1
  24. package/css/components/textinput.css +1 -0
  25. package/css/components/toggle.css +1 -0
  26. package/css/global.css.map +1 -1
  27. package/css/index.css +1 -1
  28. package/css/index.css.map +1 -1
  29. package/css/monorepo.css +1 -1
  30. package/css/monorepo.css.map +1 -1
  31. package/package.json +3 -3
  32. package/scss/components/_cardgroup.scss +12 -43
  33. package/scss/components/_checkbox.scss +5 -36
  34. package/scss/components/_datepicker.scss +3 -23
  35. package/scss/components/_fieldset.scss +74 -53
  36. package/scss/components/_file-upload.scss +26 -57
  37. package/scss/components/_form.scss +37 -16
  38. package/scss/components/_formcontrol.scss +137 -0
  39. package/scss/components/_hero.scss +1 -0
  40. package/scss/components/_navigation.scss +4 -0
  41. package/scss/components/_radio.scss +4 -52
  42. package/scss/components/_textarea.scss +2 -2
  43. package/scss/components/_textinput.scss +65 -0
  44. package/scss/components/_toggle.scss +135 -0
  45. package/scss/components/index.scss +3 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ilo-org/styles",
3
3
  "description": "Styles for products using ILO's Design System",
4
- "version": "0.8.3",
4
+ "version": "0.9.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/international-labour-organization/designsystem.git",
@@ -19,8 +19,8 @@
19
19
  ],
20
20
  "dependencies": {
21
21
  "@ilo-org/fonts": "0.1.0",
22
- "@ilo-org/icons": "0.2.1",
23
- "@ilo-org/themes": "0.2.0"
22
+ "@ilo-org/themes": "0.2.0",
23
+ "@ilo-org/icons": "0.2.1"
24
24
  },
25
25
  "devDependencies": {
26
26
  "cssnano": "^5.1.13",
@@ -4,6 +4,7 @@
4
4
 
5
5
  .ilo--cardgroup {
6
6
  $c: &;
7
+ $gap-size: px-to-rem(32px);
7
8
 
8
9
  &__collapsed {
9
10
  #{$c}--inner {
@@ -11,74 +12,40 @@
11
12
  }
12
13
  }
13
14
 
14
- &__justify {
15
- &__start {
16
- #{$c}--inner {
17
- justify-content: flex-start;
18
- }
19
- }
20
-
21
- &__between {
22
- #{$c}--inner {
23
- justify-content: space-between;
24
- }
25
- }
26
-
27
- &__center {
28
- #{$c}--inner {
29
- justify-content: center;
30
- }
31
- }
32
- }
33
-
34
15
  &__count {
35
16
  @include breakpoint("large") {
36
17
  &__one {
37
18
  #{$c}--inner {
38
- gap: 0;
39
- }
40
-
41
- #{$c}--card {
42
- flex: 1 1 100%;
19
+ grid-template-columns: 1fr;
43
20
  }
44
21
  }
45
22
 
46
23
  &__two {
47
24
  #{$c}--inner {
48
- gap: 16px;
49
- }
50
-
51
- #{$c}--card {
52
- flex: 0 1 calc(50% - 16px);
25
+ grid-template-columns: repeat(2, 1fr);
53
26
  }
54
27
  }
55
28
 
56
29
  &__three {
57
30
  #{$c}--inner {
58
- gap: 21px;
59
- }
60
-
61
- #{$c}--card {
62
- flex: 0 1 calc(33.3333% - 21px);
31
+ grid-template-columns: repeat(3, 1fr);
63
32
  }
64
33
  }
65
34
 
66
35
  &__four {
67
36
  #{$c}--inner {
68
- gap: 24px;
69
- }
70
-
71
- #{$c}--card {
72
- flex: 0 1 calc(25% - 24px);
37
+ grid-template-columns: repeat(4, 1fr);
73
38
  }
74
39
  }
75
40
  }
76
41
  }
77
42
 
78
43
  &--inner {
79
- display: flex;
80
- flex-flow: row wrap;
81
- justify-content: center;
44
+ display: grid;
45
+ grid-template-columns: 1fr;
46
+ grid-template-rows: auto;
47
+ column-gap: $gap-size;
48
+ row-gap: $gap-size;
82
49
  margin: auto;
83
50
  width: 100%;
84
51
 
@@ -90,6 +57,8 @@
90
57
  .ilo--card,
91
58
  .ilo--card--wrapper {
92
59
  height: 100%;
60
+ width: 100%;
61
+ max-width: 100%;
93
62
  }
94
63
 
95
64
  &--button-wrap {
@@ -5,15 +5,16 @@
5
5
  .ilo--checkbox {
6
6
  -webkit-appearance: none;
7
7
  -moz-appearance: none;
8
+ appearance: none;
8
9
  border: none;
9
10
  display: grid;
10
11
  height: px-to-rem(24px);
11
12
  margin: 0;
12
- order: 1;
13
13
  position: relative;
14
14
  place-content: center;
15
15
  width: px-to-rem(24px);
16
16
  transform: none;
17
+ cursor: pointer;
17
18
 
18
19
  &:before {
19
20
  content: "";
@@ -74,10 +75,10 @@
74
75
  }
75
76
 
76
77
  &:invalid,
77
- &.error,
78
- .error & {
78
+ &__error,
79
+ &__error & {
79
80
  &:after {
80
- background-color: $color-base-red-medium;
81
+ border-color: $color-base-red-medium;
81
82
  }
82
83
 
83
84
  &:checked {
@@ -87,35 +88,3 @@
87
88
  }
88
89
  }
89
90
  }
90
-
91
- .ilo--fieldset--input--checkbox {
92
- align-items: center;
93
- clear: both;
94
- display: flex;
95
- flex-wrap: wrap;
96
- justify-content: flex-start;
97
- margin-bottom: px-to-rem(22px);
98
-
99
- .ilo--fieldset--label {
100
- color: $color-base-neutrals-black;
101
- font-family: $fonts-copy;
102
- font-size: 14.9px;
103
- font-weight: 400;
104
- line-height: 1;
105
- margin-left: px-to-rem($spacing-padding-1);
106
- margin-bottom: 0;
107
- margin-top: 1px;
108
- order: 2;
109
-
110
- .right-to-left & {
111
- margin-left: 0;
112
- margin-right: px-to-rem($spacing-padding-1);
113
- }
114
- }
115
-
116
- .ilo--fieldset--error,
117
- .ilo--fieldset--helper {
118
- order: 3;
119
- width: 100%;
120
- }
121
- }
@@ -3,29 +3,9 @@
3
3
  @import "../mixins";
4
4
 
5
5
  .ilo--datepicker {
6
- &--range {
7
- display: flex;
6
+ cursor: pointer;
8
7
 
9
- & > .ilo--fieldset {
10
- width: 50%;
11
-
12
- &:nth-of-type(1) {
13
- .ilo--input {
14
- border-right: none;
15
- }
16
- }
17
- }
18
- }
19
-
20
- .right-to-left & {
21
- direction: rtl;
8
+ &::-webkit-calendar-picker-indicator {
9
+ cursor: pointer;
22
10
  }
23
11
  }
24
-
25
- .right-to-left
26
- .ilo--datepicker--range
27
- > .ilo--fieldset:nth-of-type(1)
28
- .ilo--input {
29
- border-left: none;
30
- border-right: 0.1071811361rem solid rgb(184, 196, 204);
31
- }
@@ -3,36 +3,79 @@
3
3
  @import "../mixins";
4
4
 
5
5
  .ilo--fieldset {
6
- -webkit-appearance: none;
7
- -moz-appearance: none;
6
+ $gap: 24px;
7
+
8
+ @mixin flex($value) {
9
+ display: flex;
10
+ justify-content: flex-start;
11
+ align-items: flex-start;
12
+ flex-direction: $value;
13
+ @include textmargin("gap", $gap, "label-medium", "display", 0, 0);
14
+ }
15
+
8
16
  appearance: none;
9
- @include textmargin("margin-bottom", 34px, "label-medium", "display", 0, 0);
17
+ $c: &;
10
18
 
11
- &--label {
12
- display: inline-flex;
13
- float: left;
19
+ &--legend-wrapper {
20
+ @include textmargin("margin-bottom", $gap, "label-medium", "display", 0, 0);
21
+ }
22
+
23
+ &--legend {
14
24
  font-family: $fonts-display;
15
25
  font-weight: map-get($type, "weights", "label");
16
26
  @include font-styles("label-medium");
17
- @include textmargin("margin-bottom", 14px, "label-medium", "display", 0, 0);
18
27
  }
19
28
 
20
- &--helper {
21
- color: $color-base-neutrals-medium;
22
- font-family: $fonts-copy;
23
- @include font-styles("body-xxs");
24
- @include textmargin(
25
- "margin-top",
26
- map-get($spacing, "padding-1-5"),
27
- "body-xxs",
28
- "copy",
29
- 0,
30
- 0
31
- );
29
+ &--direction__column {
30
+ > #{$c}--elements {
31
+ @include flex(column);
32
+ }
32
33
  }
33
34
 
34
- &--error {
35
- color: $color-base-red-dark;
35
+ &--direction__row {
36
+ > #{$c}--elements {
37
+ @include flex(row);
38
+ }
39
+ }
40
+
41
+ &--direction__row-reverse {
42
+ > #{$c}--elements {
43
+ @include flex(row-reverse);
44
+ }
45
+ }
46
+
47
+ &--direction__column-reverse {
48
+ > #{$c}--elements {
49
+ @include flex(column-reverse);
50
+ }
51
+ }
52
+
53
+ &--wrap__nowrap {
54
+ > #{$c}--elements {
55
+ flex-wrap: nowrap;
56
+ }
57
+ }
58
+
59
+ &--wrap__wrap {
60
+ > #{$c}--elements {
61
+ flex-wrap: wrap;
62
+ }
63
+ }
64
+
65
+ &--wrap__wrap-reverse {
66
+ > #{$c}--elements {
67
+ flex-wrap: wrap-reverse;
68
+ }
69
+ }
70
+
71
+ &--wrap__reverse {
72
+ > #{$c}--elements {
73
+ flex-wrap: reverse;
74
+ }
75
+ }
76
+
77
+ &--helper,
78
+ &__error {
36
79
  font-family: $fonts-copy;
37
80
  @include font-styles("body-xxs");
38
81
  @include textmargin(
@@ -45,43 +88,21 @@
45
88
  );
46
89
  }
47
90
 
48
- &.ilo--choice-group {
49
- .ilo--fieldset--legend {
50
- display: inline-flex;
51
- float: left;
52
- font-family: $fonts-display;
53
- font-weight: map-get($type, "weights", "label");
54
- @include font-styles("label-medium");
55
- margin: 0;
56
-
57
- & + .ilo--fieldset--helper,
58
- & + .ilo--fieldset--error {
59
- clear: both;
60
- display: block;
61
- }
62
- }
91
+ &--helper {
92
+ color: $color-base-neutrals-medium;
93
+ }
63
94
 
64
- div[class^="ilo--fieldset--input"]:first-of-type,
65
- div[class*=" ilo--fieldset--input"]:first-of-type {
66
- clear: both;
67
- padding-top: px-to-rem($spacing-padding-3);
68
- }
95
+ &__error {
96
+ color: $color-base-red-dark;
97
+ }
98
+
99
+ &__disabled {
100
+ opacity: 50%;
101
+ pointer-events: none;
69
102
  }
70
103
 
71
104
  .ilo--tooltip--wrapper {
72
105
  margin-left: 8px;
73
106
  margin-top: 3px;
74
107
  }
75
-
76
- .right-to-left & {
77
- direction: rtl;
78
-
79
- .ilo--fieldset--label {
80
- float: right;
81
- }
82
-
83
- &.ilo--choice-group .ilo--fieldset--legend {
84
- float: right;
85
- }
86
- }
87
108
  }
@@ -3,14 +3,15 @@
3
3
  @import "../mixins";
4
4
 
5
5
  .ilo--file-upload {
6
- color: transparent;
7
- order: 3;
6
+ &--input {
7
+ order: 3;
8
8
 
9
- &::-webkit-file-upload-button {
10
- visibility: hidden;
11
- }
9
+ input {
10
+ visibility: hidden;
11
+ color: transparent;
12
+ width: 0;
13
+ }
12
14
 
13
- &:before {
14
15
  background-color: map-get($color, "ux", "background", "default");
15
16
  border: map-get($borders, "small")
16
17
  map-get($color, "ux", "borders", "default") solid;
@@ -23,10 +24,12 @@
23
24
  @include borderradius("button");
24
25
  @include boxpadding("button", "medium");
25
26
  @include font-styles("label-medium");
26
- }
27
27
 
28
- &:hover {
29
- &:before {
28
+ .ilo--form__theme__dark & {
29
+ color: map-get($color, "ux", "labels", "actionable");
30
+ }
31
+
32
+ &:hover {
30
33
  background-color: map-get($color, "ux", "background", "hover");
31
34
  border: map-get($borders, "small")
32
35
  map-get($color, "ux", "borders", "hover") solid;
@@ -34,40 +37,34 @@
34
37
  color: map-get($color, "ux", "labels", "hover");
35
38
  outline: none;
36
39
  }
37
- }
38
40
 
39
- &:focus {
40
- &:before {
41
+ &:focus {
41
42
  background-color: map-get($color, "ux", "background", "focus");
42
43
  border: map-get($borders, "small")
43
44
  map-get($color, "ux", "borders", "hover") solid;
44
45
  color: map-get($color, "ux", "labels", "focus");
45
46
  outline: none;
46
47
  }
47
- }
48
48
 
49
- &:focus-visible {
50
- outline: none;
51
- }
49
+ &:focus-visible {
50
+ outline: none;
51
+ }
52
52
 
53
- &:active {
54
- &:before {
53
+ &:active {
55
54
  background-color: map-get($color, "ux", "background", "active");
56
55
  border: map-get($borders, "base")
57
56
  map-get($color, "ux", "borders", "active") solid;
58
57
  color: map-get($color, "ux", "labels", "active");
59
58
  }
60
- }
61
59
 
62
- &:disabled {
63
- opacity: 45%;
64
- pointer-events: none;
65
- }
60
+ &:disabled {
61
+ opacity: 45%;
62
+ pointer-events: none;
63
+ }
66
64
 
67
- &:invalid,
68
- &.error,
69
- .error & {
70
- &:before {
65
+ &:invalid,
66
+ &.error,
67
+ .error & {
71
68
  background-color: map-get(
72
69
  $color,
73
70
  "formelements",
@@ -81,9 +78,11 @@
81
78
 
82
79
  &--list {
83
80
  order: 4;
81
+ grid-area: uploads;
84
82
  }
85
83
 
86
84
  &--list-item {
85
+ display: inline-block;
87
86
  background-color: $color-formelements-uploadedfile-default-background;
88
87
  @include bordervalues("uploadedfile", "formelements", "default");
89
88
  box-sizing: border-box;
@@ -96,35 +95,5 @@
96
95
  @include spacingvalues("margin", "uploadedfile", "formelements");
97
96
  outline: none;
98
97
  @include spacingvalues("padding", "uploadedfile", "formelements");
99
- width: map-get(
100
- $spacing,
101
- "formelements",
102
- "uploadedfile",
103
- "default",
104
- "width"
105
- );
106
- }
107
- }
108
-
109
- .file-upload div {
110
- display: flex;
111
- flex-direction: column;
112
-
113
- .ilo--fieldset--label {
114
- order: 1;
115
- }
116
-
117
- .ilo--fieldset--helper,
118
- .ilo--fieldset--error {
119
- margin-top: 0;
120
- @include textmargin(
121
- "margin-bottom",
122
- map-get($spacing, "padding-3"),
123
- "label-small",
124
- "display",
125
- 0,
126
- 0
127
- );
128
- order: 2;
129
98
  }
130
99
  }
@@ -2,23 +2,44 @@
2
2
  @use "../functions" as *;
3
3
  @import "../mixins";
4
4
 
5
- .ilo--formgroup {
6
- &--legend {
7
- display: block;
8
- font-family: $fonts-display;
9
- font-weight: map-get($type, "weights", "label");
10
- @include font-styles("legend");
11
- @include textmargin(
12
- "margin-bottom",
13
- map-get($spacing, "padding-5"),
14
- "legend",
15
- "display",
16
- "label-small",
17
- "display"
18
- );
5
+ .ilo--form {
6
+ $gap: 32px;
7
+ $c: &;
8
+
9
+ display: flex;
10
+ justify-content: flex-start;
11
+ align-items: flex-start;
12
+ flex-direction: column;
13
+ appearance: none;
14
+ gap: $gap;
15
+ color: $color-base-neutrals-black;
16
+
17
+ &__theme {
18
+ &__light {
19
+ color: $color-base-neutrals-black;
20
+
21
+ label,
22
+ p {
23
+ color: $color-base-neutrals-black;
24
+ }
25
+ }
26
+
27
+ &__dark {
28
+ color: $color-base-neutrals-lighter;
29
+
30
+ label,
31
+ p {
32
+ color: $color-base-neutrals-lighter;
33
+ }
34
+
35
+ legend {
36
+ color: $color-base-yellow;
37
+ }
38
+ }
19
39
  }
20
40
 
21
- .right-to-left & {
22
- direction: rtl;
41
+ &__disabled {
42
+ opacity: 50%;
43
+ pointer-events: none;
23
44
  }
24
45
  }
@@ -0,0 +1,137 @@
1
+ @use "../tokens" as *;
2
+ @use "../functions" as *;
3
+ @use "sass:math";
4
+ @import "../mixins";
5
+
6
+ .ilo--form-control {
7
+ $c: &;
8
+
9
+ display: inline-grid;
10
+ grid-area: input;
11
+
12
+ &__label-placement {
13
+ // Label is to the flex start of form element
14
+ &__start {
15
+ grid-template-rows: auto;
16
+ grid-template-columns: auto;
17
+ grid-template-areas:
18
+ "label input"
19
+ "helper ."
20
+ "uploads uploads";
21
+ column-gap: px-to-rem($spacing-padding-1);
22
+
23
+ #{$c}--helper {
24
+ text-align: right;
25
+ }
26
+ }
27
+
28
+ // Label is at the end of the form element
29
+ &__end {
30
+ grid-template-rows: auto;
31
+ grid-template-columns: auto;
32
+ grid-template-areas:
33
+ "input label"
34
+ ". helper"
35
+ "uploads uploads";
36
+ column-gap: px-to-rem($spacing-padding-1);
37
+ }
38
+
39
+ // Label is above form element
40
+ &__top {
41
+ grid-template-rows: auto auto auto;
42
+ grid-template-columns: auto;
43
+ grid-template-areas:
44
+ "label"
45
+ "input"
46
+ "downloads"
47
+ "helper";
48
+ row-gap: px-to-rem($spacing-padding-1);
49
+ }
50
+
51
+ // Label is below form element
52
+ &__bottom {
53
+ grid-template-rows: auto auto auto;
54
+ grid-template-columns: auto;
55
+ grid-template-areas:
56
+ "helper"
57
+ "input"
58
+ "downloads"
59
+ "label";
60
+ row-gap: px-to-rem($spacing-padding-1);
61
+ }
62
+ }
63
+
64
+ &__disabled {
65
+ #{$c}--label,
66
+ #{$c}--helper {
67
+ opacity: 0.5;
68
+ pointer-events: none;
69
+ }
70
+ }
71
+
72
+ &__error {
73
+ #{$c}--helper {
74
+ color: $color-base-red-dark;
75
+ }
76
+ }
77
+
78
+ &--label {
79
+ color: $color-base-neutrals-black;
80
+ grid-area: label;
81
+ display: flex;
82
+ flex-flow: row nowrap;
83
+ align-items: center;
84
+ justify-content: flex-start;
85
+
86
+ &__size {
87
+ &__small {
88
+ font-family: $fonts-copy;
89
+ font-size: px-to-rem(map-get($type, "label-small", "size"));
90
+ letter-spacing: px-to-rem(
91
+ map-get($type, "label-small", "letter-spacing")
92
+ );
93
+ line-height: px-to-rem(map-get($type, "label-small", "line-height"));
94
+ font-weight: 400;
95
+ }
96
+
97
+ &__medium {
98
+ font-family: $fonts-display;
99
+ font-size: px-to-rem(map-get($type, "label-medium", "size"));
100
+ letter-spacing: px-to-rem(
101
+ map-get($type, "label-medium", "letter-spacing")
102
+ );
103
+ line-height: px-to-rem(map-get($type, "label-medium", "line-height"));
104
+ font-weight: 700;
105
+ }
106
+
107
+ &__large {
108
+ font-family: $fonts-display;
109
+ font-size: px-to-rem(map-get($type, "label-large", "size"));
110
+ letter-spacing: px-to-rem(
111
+ map-get($type, "label-large", "letter-spacing")
112
+ );
113
+ line-height: px-to-rem(map-get($type, "label-large", "line-height"));
114
+ font-weight: 700;
115
+ }
116
+ }
117
+
118
+ label {
119
+ font-family: inherit;
120
+ font-size: inherit;
121
+ letter-spacing: inherit;
122
+ line-height: inherit;
123
+ font-weight: inherit;
124
+ }
125
+
126
+ div[class*="tooltip"] {
127
+ margin-left: px-to-rem(math.div($spacing-padding-1, 2));
128
+ }
129
+ }
130
+
131
+ &--helper {
132
+ grid-area: helper;
133
+ color: $color-base-neutrals-medium;
134
+ font-family: $fonts-copy;
135
+ @include font-styles("body-xxs");
136
+ }
137
+ }