@cityway/design-tokens 1.1.8

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,107 @@
1
+ @use "sass:map";
2
+ @use "primitives" as p;
3
+
4
+ @function size($key) {
5
+ @return map.get(p.$sizing, $key);
6
+ }
7
+
8
+ @function color($type, $variant) {
9
+ @return map.get(p.$colors, $type, $variant);
10
+ }
11
+
12
+ @function border($type, $variant) {
13
+ @return map.get(p.$border, $type, $variant);
14
+ }
15
+
16
+ @function font($type, $variant) {
17
+ @return map.get(p.$font, $type, $variant);
18
+ }
19
+
20
+ @function hex-to-rgb($hex) {
21
+ @return red($hex), green($hex), blue($hex);
22
+ }
23
+
24
+ [data-cw-theme="cw-fo"] {
25
+ --cw-base-dark: #1a1a1a;
26
+ --cw-base-dark-rgb: 26, 26, 26;
27
+ --cw-base-black: #000000;
28
+ --cw-base-black-rgb: 0, 0, 0;
29
+ --cw-base-white: #ffffff;
30
+ --cw-base-white-rgb: 255, 255, 255;
31
+ --cw-base-disabled: #696969;
32
+ --cw-base-disabled-rgb: 105, 105, 105;
33
+ --cw-primary: #107099;
34
+ --cw-primary-rgb: 16, 112, 153;
35
+ --cw-primary-hover: #0d5878;
36
+ --cw-primary-hover-rgb: 13, 88, 120;
37
+ --cw-primary-contrasted: #ffffff;
38
+ --cw-primary-contrasted-rgb: 255, 255, 255;
39
+ --cw-secondary: #107099;
40
+ --cw-secondary-rgb: 16, 112, 153;
41
+ --cw-secondary-hover: #0d5878;
42
+ --cw-secondary-hover-rgb: 13, 88, 120;
43
+ --cw-secondary-contrasted: #ffffff;
44
+ --cw-secondary-contrasted-rgb: 255, 255, 255;
45
+ --cw-success: #44853c;
46
+ --cw-success-rgb: 68, 133, 60;
47
+ --cw-success-hover: #366930;
48
+ --cw-success-hover-rgb: 54, 105, 48;
49
+ --cw-success-contrasted: #ffffff;
50
+ --cw-success-contrasted-rgb: 255, 255, 255;
51
+ --cw-success-light: #ebf5ea;
52
+ --cw-success-light-rgb: 235, 245, 234;
53
+ --cw-info: #0b40a2;
54
+ --cw-info-rgb: 11, 64, 162;
55
+ --cw-info-hover: #0f58e0;
56
+ --cw-info-hover-rgb: 15, 88, 224;
57
+ --cw-info-contrasted: #ffffff;
58
+ --cw-info-contrasted-rgb: 255, 255, 255;
59
+ --cw-info-light: #dee8fd;
60
+ --cw-info-light-rgb: 222, 232, 253;
61
+ --cw-warning: #e8580c;
62
+ --cw-warning-rgb: 232, 88, 12;
63
+ --cw-warning-hover: #df3603;
64
+ --cw-warning-hover-rgb: 223, 54, 3;
65
+ --cw-warning-contrasted: #1a1a1a;
66
+ --cw-warning-contrasted-rgb: 26, 26, 26;
67
+ --cw-warning-light: #fff9e6;
68
+ --cw-warning-light-rgb: 255, 249, 230;
69
+ --cw-danger: #e1001a;
70
+ --cw-danger-rgb: 225, 0, 26;
71
+ --cw-danger-hover: #b30015;
72
+ --cw-danger-hover-rgb: 179, 0, 21;
73
+ --cw-danger-contrasted: #ffffff;
74
+ --cw-danger-contrasted-rgb: 255, 255, 255;
75
+ --cw-danger-light: #ffe5e8;
76
+ --cw-danger-light-rgb: 255, 229, 232;
77
+ --cw-light: #f9f9f9;
78
+ --cw-light-rgb: 249, 249, 249;
79
+ --cw-light-hover: #f2f2f2;
80
+ --cw-light-hover-rgb: 242, 242, 242;
81
+ --cw-light-contrasted: #313131;
82
+ --cw-light-contrasted-rgb: 49, 49, 49;
83
+ --cw-dark: #1a1a1a;
84
+ --cw-dark-rgb: 26, 26, 26;
85
+ --cw-dark-hover: #1a1a1a;
86
+ --cw-dark-hover-rgb: 26, 26, 26;
87
+ --cw-dark-contrasted: #ffffff;
88
+ --cw-dark-contrasted-rgb: 255, 255, 255;
89
+ --cw-body-bg: #ffffff;
90
+ --cw-body-bg-rgb: 255, 255, 255;
91
+ --cw-body-color: #1a1a1a;
92
+ --cw-body-color-rgb: 26, 26, 26;
93
+ --cw-link-color: #107099;
94
+ --cw-link-color-rgb: 16, 112, 153;
95
+ --cw-link-hover: #0d5878;
96
+ --cw-link-hover-rgb: 13, 88, 120;
97
+ --cw-body-fs: 1rem;
98
+ --cw-body-fw: 400;
99
+ --cw-body-lh: 1.5;
100
+ --cw-body-ff-heading: Nunito, sans-serif;
101
+ --cw-body-ff-text: Nunito, sans-serif;
102
+ --cw-link-decoration: underline;
103
+ --cw-border-radius: 0.5rem;
104
+ --cw-border-radius-input: 6.25rem;
105
+ --cw-shadow-default: 0 0.25rem 1rem -0.063rem rgba(0, 0, 0, 0.1);
106
+ --cw-shadow-hover: 0 0.25rem 1rem -0.063rem rgba(0, 0, 0, 0.35);
107
+ }
package/_index.scss ADDED
@@ -0,0 +1,3 @@
1
+ @forward "primitives";
2
+ @forward "functions";
3
+ @forward "theme-mapping";
@@ -0,0 +1,207 @@
1
+ @use "sass:map";
2
+
3
+ $prefix: cw;
4
+
5
+ $dropshadow-blur: (
6
+ none: 0rem,
7
+ xs: 0.125rem,
8
+ sm: 0.25rem,
9
+ md: 0.5rem
10
+ );
11
+
12
+ $dropshadow-spread: (
13
+ none: 0rem,
14
+ xs: 0.125rem
15
+ );
16
+
17
+ $dropshadow-position: (
18
+ xs: 0.0625rem,
19
+ sm: 0.125rem,
20
+ md: 0.25rem
21
+ );
22
+
23
+ // Colors
24
+ // ---------------------------------
25
+ $colors: (
26
+ base: (
27
+ dark: #1A1A1A,
28
+ "black": #000000,
29
+ "white": #ffffff,
30
+ disabled: #696969,
31
+ w-overlay: rgba(#ffffff, 0),
32
+ w-overlay-90: rgba(#ffffff, 0.9)
33
+ ),
34
+ "grey": (
35
+ b-overlay-10: rgba(#000000, 0.1),
36
+ b-overlay-15: rgba(#000000, 0.15),
37
+ b-overlay-20: rgba(#000000, 0.2),
38
+ b-overlay-35: rgba(#000000, 0.35),
39
+ b-overlay-40: rgba(#000000, 0.4),
40
+ b-overlay-50: rgba(#000000, 0.5),
41
+ 50: #F9F9F9,
42
+ 100: #F2F2F2,
43
+ 200: #E6E6E6,
44
+ 250: #DFDFDF,
45
+ 300: #CCCCCC,
46
+ 400: #B5B5B5,
47
+ 500: #939393,
48
+ 600: #828282,
49
+ 700: #696969,
50
+ 800: #444444,
51
+ 900: #313131,
52
+ 950: #1A1A1A
53
+ ),
54
+ primary: (
55
+ p-overlay-25: rgba(#107099, 0.25),
56
+ p-overlay-50: rgba(#107099, 0.5),
57
+ 500: #107099,
58
+ 600: #0D5878
59
+ ),
60
+ info: (
61
+ 50: #DEE8FD,
62
+ 400: #0F58E0,
63
+ 500: #0B40A2
64
+ ),
65
+ success: (
66
+ s-overlay-50: rgba(#44853C, 0.5),
67
+ 50: #EBF5EA,
68
+ 500: #44853C,
69
+ 600: #366930
70
+ ),
71
+ warning: (
72
+ w-overlay-50: rgba(#E8580C, 0.5),
73
+ 50: #FFF9E6,
74
+ 500: #E8580C,
75
+ 600: #DF3603
76
+ ),
77
+ danger: (
78
+ d-overlay-50: rgba(#E1001A, 0.5),
79
+ 50: #FFE5E8,
80
+ 500: #E1001A,
81
+ 600: #B30015
82
+ ),
83
+ disruption: (
84
+ 50: #FFE5E8,
85
+ 500: #E1001A
86
+ ),
87
+ accessibility: (
88
+ 500: #387DA2
89
+ ),
90
+ carbon: (
91
+ success: #44853C,
92
+ warning: #E8580C,
93
+ danger: #E1001A
94
+ ),
95
+ loyalty: (
96
+ 500: #FDCC55
97
+ ),
98
+ poi: (
99
+ black-500: #1A1A1A,
100
+ black-overlay-50: rgba(#000000, 0.5),
101
+ blue-500: #115FC5,
102
+ blue-overlay-50: rgba(#115FC5, 0.5),
103
+ green-500: #007575,
104
+ green-overlay-50: rgba(#007575, 0.5),
105
+ purple-500: #9B51E0,
106
+ purple-overlay-50: rgba(#9B51E0, 0.5),
107
+ red-500: #B04A5A,
108
+ red-overlay-50: rgba(#B04A5A, 0.5),
109
+ ),
110
+ real-time: (
111
+ success: #7C9E71,
112
+ warning: #D97C4A,
113
+ danger: #E47185,
114
+ disabled: rgba(#696969, 0.5)
115
+ ),
116
+ );
117
+
118
+ // Colors
119
+ // ---------------------------------
120
+ $sizing: (
121
+ none: 0rem,
122
+ 5xs: 0.125rem,
123
+ 4xs: 0.25rem,
124
+ 3xs: 0.375rem,
125
+ 2xs: 0.5rem,
126
+ xs: 0.625rem,
127
+ sm: 0.75rem,
128
+ md: 1rem,
129
+ lg: 1.25rem,
130
+ xl: 1.5rem,
131
+ 2xl: 2rem,
132
+ 3xl: 2.5rem,
133
+ 4xl: 3rem,
134
+ 5xl: 3.5rem,
135
+ 6xl: 3.75rem,
136
+ 7xl: 5rem,
137
+ 8xl: 6.25rem
138
+ );
139
+
140
+ $border: (
141
+ br: ( // border-radius
142
+ none: map.get($sizing, none),
143
+ round: map.get($sizing, 8xl),
144
+ xs: map.get($sizing, 4xs),
145
+ md: map.get($sizing, 2xs),
146
+ xl: map.get($sizing, sm),
147
+ 2xl: map.get($sizing, md),
148
+ 3xl: map.get($sizing, lg),
149
+ 4xl: map.get($sizing, xl),
150
+ ),
151
+ bw: ( //border-width
152
+ none: map.get($sizing, none),
153
+ xs: 0.0625rem,
154
+ sm: map.get($sizing, 5xs),
155
+ md: 0.1875rem,
156
+ lg: map.get($sizing, 4xs)
157
+ ),
158
+ bs: ( // box-shadow
159
+ md: 0 0.25rem 1rem -0.063rem rgba(#000000, 0.1)
160
+ )
161
+ );
162
+
163
+ $font: (
164
+ ff: ( //font-family
165
+ nunito: "Nunito",
166
+ opensans: "Open Sans",
167
+ poppins: "Poppins",
168
+ helvetica: "Helvetica"
169
+ ),
170
+ fs: ( // font-size
171
+ 6xl: map.get($sizing, 7xl),
172
+ 5xl: map.get($sizing, 5xl),
173
+ 4xl: map.get($sizing, 3xl),
174
+ 3xl: map.get($sizing, 2xl),
175
+ 2xl: map.get($sizing, xl),
176
+ xl: map.get($sizing, lg),
177
+ lg: 1.125rem,
178
+ md: map.get($sizing, md),
179
+ md-rwd: map.get($sizing, md),
180
+ sm: 0.875rem,
181
+ xs: map.get($sizing, sm),
182
+ 2xs: map.get($sizing, xs),
183
+ 3xs: map.get($sizing, 2xs),
184
+ ),
185
+ fw: ( // font weight
186
+ light: 300,
187
+ regular: 400,
188
+ semibold: 600,
189
+ bold: 700,
190
+ extrabold: 800
191
+ ),
192
+ lh: ( // line-height
193
+ 6xl: 1.15,
194
+ 5xl: 1.25,
195
+ 4xl: 1.2,
196
+ 3xl: 1.25,
197
+ 2xl: 1.333,
198
+ xl: 1.4,
199
+ lg: 1.5,
200
+ md: 1.5,
201
+ md-rwd: 1.5,
202
+ sm: 1.43,
203
+ xs: 1.333,
204
+ 2xs: 1.4,
205
+ 3xs: 1.2
206
+ )
207
+ );
@@ -0,0 +1,220 @@
1
+ @use "sass:map";
2
+ @use "primitives" as *;
3
+ @use "functions" as *;
4
+
5
+
6
+ // THEME FO
7
+ ////////////////////////////////////////////////////////////////
8
+
9
+ $theme-fo-colors: (
10
+ base: (
11
+ dark: #1A1A1A,
12
+ "black": #000000,
13
+ "white": #ffffff,
14
+ disabled: #696969
15
+ ),
16
+ primary: (
17
+ base: color(primary, 500),
18
+ hover: color(primary, 600),
19
+ contrasted: color(base, "white")
20
+ ),
21
+ secondary: (
22
+ base: color(primary, 500),
23
+ hover: color(primary, 600),
24
+ contrasted: color(base, "white")
25
+ ),
26
+ success: (
27
+ base: color(success, 500),
28
+ hover: color(success, 600),
29
+ contrasted: color(base, "white"),
30
+ light: color(success, 50)
31
+ ),
32
+ info: (
33
+ base: color(info, 500),
34
+ hover: color(info, 400),
35
+ contrasted: color(base, "white"),
36
+ light: color(info, 50)
37
+ ),
38
+ warning: (
39
+ base: color(warning, 500),
40
+ hover: color(warning, 600),
41
+ contrasted: color("grey", 950),
42
+ light: color(warning, 50)
43
+ ),
44
+ danger: (
45
+ base: color(danger, 500),
46
+ hover: color(danger, 600),
47
+ contrasted: color(base, "white"),
48
+ light: color(danger, 50)
49
+ ),
50
+ light: (
51
+ base: color("grey", 50),
52
+ hover: color("grey", 100),
53
+ contrasted: color("grey", 900)
54
+ ),
55
+ dark: (
56
+ base: color(base, dark),
57
+ hover: color("grey", 950),
58
+ contrasted: color(base, "white")
59
+ ),
60
+ disabled: (
61
+ base: color(base, disabled),
62
+ contrasted: color(base, "white")
63
+ ),
64
+ body: (
65
+ bg: color(base, "white"),
66
+ color: color("grey", 950)
67
+ ),
68
+ link: (
69
+ color: color(primary, 500),
70
+ hover: color(primary, 600)
71
+ ),
72
+ );
73
+
74
+ $theme-fo-props: (
75
+ body: (
76
+ fs: 1rem,
77
+ fw: 400,
78
+ lh: 1.5,
79
+ ff-heading: ('"#{font(ff, nunito)}"', sans-serif),
80
+ ff-text: ('"#{font(ff, nunito)}"', sans-serif)
81
+ ),
82
+ link: (
83
+ decoration: underline
84
+ ),
85
+ border: (
86
+ radius: border(br, md),
87
+ radius-input: border(br, round)
88
+ ),
89
+ shadow: (
90
+ default: 0 0.25rem 1rem -0.063rem rgba(#000000, 0.1),
91
+ hover: 0 0.25rem 1rem -0.063rem rgba(#000000, 0.35),
92
+ )
93
+ );
94
+
95
+ // THEME BO
96
+ ////////////////////////////////////////////////////////////////
97
+
98
+ $theme-bo-colors: (
99
+ base: (
100
+ dark: #1A1A1A,
101
+ "black": #000000,
102
+ "white": #ffffff,
103
+ disabled: #696969
104
+ ),
105
+ primary: (
106
+ base: #02c0ce,
107
+ hover: #02aeba,
108
+ contrasted: color(base, "white")
109
+ ),
110
+ secondary: (
111
+ base: #777edd,
112
+ hover: #6c72c8,
113
+ contrasted: color(base, "white")
114
+ ),
115
+ success: (
116
+ base: #0acf97,
117
+ hover: #09bb89,
118
+ contrasted: color(base, "white"),
119
+ light: #daf8ef
120
+ ),
121
+ info: (
122
+ base: #45bbe0,
123
+ hover: #3ea9cb,
124
+ contrasted: color(base, "white"),
125
+ light: #e3f5fa
126
+ ),
127
+ warning: (
128
+ base: #f9bc0b,
129
+ hover: #e1aa0a,
130
+ contrasted: color("grey", 950),
131
+ light: #fef5da
132
+ ),
133
+ danger: (
134
+ base: #f1556c,
135
+ hover: #da4d62,
136
+ contrasted: color(base, "white"),
137
+ light: #fde6e9
138
+ ),
139
+ light: (
140
+ base: #eef2f7,
141
+ hover: color("grey", 100),
142
+ contrasted: color("grey", 900)
143
+ ),
144
+ dark: (
145
+ base: #313a46,
146
+ hover: color("grey", 950),
147
+ contrasted: color(base, "white")
148
+ ),
149
+ disabled: (
150
+ base: color(base, disabled),
151
+ contrasted: color(base, "white")
152
+ ),
153
+ body: (
154
+ bg: #f3f6f8,
155
+ color: #4c4c5c
156
+ ),
157
+ link: (
158
+ color: #02c0ce,
159
+ hover: color(primary, 600)
160
+ ),
161
+ );
162
+
163
+
164
+ $theme-bo-props: (
165
+ body: (
166
+ fs: 1rem,
167
+ fw: 400,
168
+ lh: 1.5,
169
+ ff-heading: ('"#{font(ff, nunito)}"', sans-serif),
170
+ ff-text: ('"#{font(ff, nunito)}"', sans-serif)
171
+ ),
172
+ link: (
173
+ decoration: underline
174
+ ),
175
+ border: (
176
+ radius: 0.3rem,
177
+ radius-input: 0.3rem
178
+ ),
179
+ shadow: (
180
+ default: 0 0 35px 0 rgba(154, 161, 171, .15),
181
+ hover: 0 0 35px 0 rgba(154, 161, 171, .35)
182
+ )
183
+ );
184
+
185
+ // MIXINS
186
+ ////////////////////////////////////////////////////////////////
187
+
188
+ @mixin color-with-rgb($name, $color) {
189
+ --#{$name}: #{$color};
190
+
191
+ // On génère la version RGB seulement si c'est une couleur sans alpha
192
+ @if type-of($color) == 'color' and alpha($color) == 1 {
193
+ --#{$name}-rgb: #{hex-to-rgb($color)};
194
+ }
195
+ }
196
+
197
+ @mixin generate-theme-colors($color-mapping) {
198
+ @each $color-name, $variants in $color-mapping {
199
+ @each $variant-name, $value in $variants {
200
+ @if $variant-name == 'base' {
201
+ @include color-with-rgb(#{$prefix}-#{$color-name}, $value);
202
+ } @else {
203
+ @include color-with-rgb(#{$prefix}-#{$color-name}-#{$variant-name}, $value);
204
+ }
205
+ }
206
+ }
207
+ }
208
+
209
+ @mixin generate-theme-props($props-mapping) {
210
+ @each $component-name, $properties in $props-mapping {
211
+ @each $prop-name, $value in $properties {
212
+ @if type-of($value) == 'list' {
213
+ // Pour les listes (comme font-family), on les joint avec des virgules
214
+ --#{$prefix}-#{$component-name}-#{$prop-name}: #{$value};
215
+ } @else {
216
+ --#{$prefix}-#{$component-name}-#{$prop-name}: #{$value};
217
+ }
218
+ }
219
+ }
220
+ }
package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "@cityway/design-tokens",
3
+ "version": "1.1.8",
4
+ "style": "_index.scss",
5
+ "files": [
6
+ "_index.scss",
7
+ "_primitives.scss",
8
+ "_functions.scss",
9
+ "_theme-mapping.scss"
10
+ ]
11
+ }