@rolemodel/optics 0.2.4 → 0.3.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.
@@ -7,174 +7,270 @@
7
7
  // A theme comprised of a primary, neutral, warning, danger, info, and notice colors.
8
8
  @mixin color-varieties {
9
9
  // Basic Colors
10
- --rm-color-white: hsl(0deg 100% 100%);
11
- --rm-color-black: hsl(0deg 0% 0%);
12
10
 
13
- // Primary HSL
14
- --rm-color-primary-h: 216;
15
- --rm-color-primary-s: 58%;
16
- --rm-color-primary-l: 48%;
17
-
18
- // Neutral HSL
19
- --rm-color-neutral-h: var(--rm-color-primary-h);
20
- --rm-color-neutral-s: 4%;
21
- --rm-color-neutral-l: var(--rm-color-primary-l);
22
-
23
- // Alerts Warning HSL
24
- --rm-color-alerts-warning-h: 47;
25
- --rm-color-alerts-warning-s: 100%;
26
- --rm-color-alerts-warning-l: 61%;
27
-
28
- // Alerts Danger HSL
29
- --rm-color-alerts-danger-h: 0;
30
- --rm-color-alerts-danger-s: 99%;
31
- --rm-color-alerts-danger-l: 76%;
32
-
33
- // Alerts Info HSL
34
- --rm-color-alerts-info-h: 216;
35
- --rm-color-alerts-info-s: 58%;
36
- --rm-color-alerts-info-l: 48%;
37
-
38
- // Alerts Notice HSL
39
- --rm-color-alerts-notice-h: 130;
40
- --rm-color-alerts-notice-s: 61%;
41
- --rm-color-alerts-notice-l: 64%;
11
+ /**
12
+ * @tokens Basic Colors
13
+ * @presenter Color
14
+ */
15
+ --op-color-white: hsl(0deg 100% 100%);
16
+ --op-color-black: hsl(0deg 0% 0%);
17
+
18
+ /**
19
+ * @tokens Primary Colors
20
+ * @presenter Color
21
+ */
22
+ --op-color-primary-h: 216;
23
+ --op-color-primary-s: 58%;
24
+ --op-color-primary-l: 48%;
25
+
26
+ /**
27
+ * @tokens Neutral Colors
28
+ * @presenter Color
29
+ */
30
+ --op-color-neutral-h: var(--op-color-primary-h);
31
+ --op-color-neutral-s: 4%;
32
+ --op-color-neutral-l: var(--op-color-primary-l);
33
+
34
+ /**
35
+ * @tokens Alerts Warning Colors
36
+ * @presenter Color
37
+ */
38
+ --op-color-alerts-warning-h: 47;
39
+ --op-color-alerts-warning-s: 100%;
40
+ --op-color-alerts-warning-l: 61%;
41
+
42
+ /**
43
+ * @tokens Alerts Danger Colors
44
+ * @presenter Color
45
+ */
46
+ --op-color-alerts-danger-h: 0;
47
+ --op-color-alerts-danger-s: 99%;
48
+ --op-color-alerts-danger-l: 76%;
49
+
50
+ /**
51
+ * @tokens Alerts Info Colors
52
+ * @presenter Color
53
+ */
54
+ --op-color-alerts-info-h: 216;
55
+ --op-color-alerts-info-s: 58%;
56
+ --op-color-alerts-info-l: 48%;
57
+
58
+ /**
59
+ * @tokens Alerts Notice Colors
60
+ * @presenter Color
61
+ */
62
+ --op-color-alerts-notice-h: 130;
63
+ --op-color-alerts-notice-s: 61%;
64
+ --op-color-alerts-notice-l: 64%;
42
65
  }
43
66
 
44
67
  @mixin border-radius {
45
- --rm-radius-small: 2px;
46
- --rm-radius-medium: 4px;
47
- --rm-radius-large: 8px;
48
- --rm-radius-x-large: 16px;
49
- --rm-radius-circle: 50%;
50
- --rm-radius-pill: 9999px;
68
+ /**
69
+ * @tokens Border Radius
70
+ * @presenter BorderRadius
71
+ */
72
+ --op-radius-small: 2px;
73
+ --op-radius-medium: 4px;
74
+ --op-radius-large: 8px;
75
+ --op-radius-x-large: 12px;
76
+ --op-radius-2x-large: 16px;
77
+ --op-radius-circle: 50%;
78
+ --op-radius-pill: 9999px;
51
79
  }
52
80
 
53
81
  @mixin border-widths {
54
- --rm-border-width: 1px;
55
- --rm-border-width-large: 2px;
56
- --rm-border-width-x-large: 4px;
82
+ /**
83
+ * @tokens Border Width
84
+ * @presenter Spacing
85
+ */
86
+ --op-border-width: 1px;
87
+ --op-border-width-large: 2px;
88
+ --op-border-width-x-large: 4px;
57
89
  }
58
90
 
59
91
  @mixin border-colors {
60
- --rm-border-color: var(--rm-color-neutral-plus-three);
92
+ /**
93
+ * @tokens Border Color
94
+ * @presenter Color
95
+ */
96
+ --op-border-color: var(--op-color-neutral-plus-five);
61
97
  }
62
98
 
63
99
  @mixin box-shadows {
64
- // E.G. box-shadow: var(--rm-border-top) var(--rm-border-color);
65
- --rm-border-none: 0 0 0 0;
66
- --rm-border-all: 0 0 0 var(--rm-border-width);
67
- --rm-border-top: 0 calc(-1 * var(--rm-border-width)) 0 0;
68
- --rm-border-right: var(--rm-border-width) 0 0 0;
69
- --rm-border-bottom: 0 var(--rm-border-width) 0 0;
70
- --rm-border-left: calc(-1 * var(--rm-border-width)) 0 0 0;
71
- --rm-border-y: var(--rm-border-top) var(--rm-border-color), var(--rm-border-bottom) var(--rm-border-color);
72
- --rm-border-x: var(--rm-border-left) var(--rm-border-color), var(--rm-border-right) var(--rm-border-color);
100
+ // E.G. box-shadow: var(--op-border-top) var(--op-border-color);
101
+
102
+ /**
103
+ * @tokens Border Shadow
104
+ * @presenter Shadow
105
+ */
106
+ --op-border-none: 0 0 0 0;
107
+ --op-border-all: 0 0 0 var(--op-border-width);
108
+ --op-border-top: 0 calc(-1 * var(--op-border-width)) 0 0;
109
+ --op-border-right: var(--op-border-width) 0 0 0;
110
+ --op-border-bottom: 0 var(--op-border-width) 0 0;
111
+ --op-border-left: calc(-1 * var(--op-border-width)) 0 0 0;
112
+ --op-border-y: var(--op-border-top) var(--op-border-color), var(--op-border-bottom) var(--op-border-color);
113
+ --op-border-x: var(--op-border-left) var(--op-border-color), var(--op-border-right) var(--op-border-color);
73
114
  }
74
115
 
75
116
  @mixin font-scales {
76
- --rm-font-scale-unit: 1rem; // 10px;
77
- --rm-font-x-small: calc(var(--rm-font-scale-unit) * 1.2); // 12px
78
- --rm-font-small: calc(var(--rm-font-scale-unit) * 1.4); // 14px
79
- --rm-font-medium: calc(var(--rm-font-scale-unit) * 1.6); // 16px
80
- --rm-font-large: calc(var(--rm-font-scale-unit) * 1.8); // 18px
81
- --rm-font-x-large: calc(var(--rm-font-scale-unit) * 2.4); // 24px
82
- --rm-font-2x-large: calc(var(--rm-font-scale-unit) * 2.8); // 28px
83
- --rm-font-3x-large: calc(var(--rm-font-scale-unit) * 3.2); // 32px
84
- --rm-font-4x-large: calc(var(--rm-font-scale-unit) * 3.6); // 36px
85
- --rm-font-5x-large: calc(var(--rm-font-scale-unit) * 4.8); // 48px
117
+ /**
118
+ * @tokens Font Scale
119
+ * @presenter FontSize
120
+ */
121
+ --op-font-scale-unit: 1rem; // 10px;
122
+ --op-font-2x-small: calc(var(--op-font-scale-unit) * 1); // 10px
123
+ --op-font-x-small: calc(var(--op-font-scale-unit) * 1.2); // 12px
124
+ --op-font-small: calc(var(--op-font-scale-unit) * 1.4); // 14px
125
+ --op-font-medium: calc(var(--op-font-scale-unit) * 1.6); // 16px
126
+ --op-font-large: calc(var(--op-font-scale-unit) * 1.8); // 18px
127
+ --op-font-x-large: calc(var(--op-font-scale-unit) * 2); // 20px
128
+ --op-font-2x-large: calc(var(--op-font-scale-unit) * 2.4); // 24px
129
+ --op-font-3x-large: calc(var(--op-font-scale-unit) * 2.8); // 28px
130
+ --op-font-4x-large: calc(var(--op-font-scale-unit) * 3.2); // 32px
131
+ --op-font-5x-large: calc(var(--op-font-scale-unit) * 3.6); // 36px
132
+ --op-font-6x-large: calc(var(--op-font-scale-unit) * 4.8); // 48px
86
133
  }
87
134
 
88
135
  @mixin font-weights {
89
- --rm-font-weight-thin: 100;
90
- --rm-font-weight-extra-light: 200;
91
- --rm-font-weight-light: 300;
92
- --rm-font-weight-normal: 400;
93
- --rm-font-weight-medium: 500;
94
- --rm-font-weight-semi-bold: 600;
95
- --rm-font-weight-bold: 700;
96
- --rm-font-weight-extra-bold: 800;
97
- --rm-font-weight-black: 900;
136
+ /**
137
+ * @tokens Font Weight
138
+ * @presenter FontWeight
139
+ */
140
+ --op-font-weight-thin: 100;
141
+ --op-font-weight-extra-light: 200;
142
+ --op-font-weight-light: 300;
143
+ --op-font-weight-normal: 400;
144
+ --op-font-weight-medium: 500;
145
+ --op-font-weight-semi-bold: 600;
146
+ --op-font-weight-bold: 700;
147
+ --op-font-weight-extra-bold: 800;
148
+ --op-font-weight-black: 900;
98
149
  }
99
150
 
100
151
  @mixin line-heights {
101
- --rm-line-height-none: 0;
102
- --rm-line-height-densest: 1;
103
- --rm-line-height-denser: 1.15;
104
- --rm-line-height-dense: 1.3;
105
- --rm-line-height-base: 1.5;
106
- --rm-line-height-loose: 1.6;
107
- --rm-line-height-looser: 1.7;
108
- --rm-line-height-loosest: 1.8;
152
+ /**
153
+ * @tokens Line Height
154
+ * @presenter LineHeight
155
+ */
156
+ --op-line-height-none: 0;
157
+ --op-line-height-densest: 1;
158
+ --op-line-height-denser: 1.15;
159
+ --op-line-height-dense: 1.3;
160
+ --op-line-height-base: 1.5;
161
+ --op-line-height-loose: 1.6;
162
+ --op-line-height-looser: 1.7;
163
+ --op-line-height-loosest: 1.8;
109
164
  }
110
165
 
111
166
  @mixin letter-spacing {
112
- --rm-letter-spacing-navigation: 0.01rem;
113
- --rm-letter-spacing-label: 0.04rem;
167
+ /**
168
+ * @tokens Letter Spacing
169
+ * @presenter LetterSpacing
170
+ */
171
+ --op-letter-spacing-navigation: 0.01rem;
172
+ --op-letter-spacing-label: 0.04rem;
114
173
  }
115
174
 
116
175
  @mixin transitions {
117
- --rm-transition-input: 120ms;
118
- --rm-transition-navigation: 200ms;
119
- --rm-transition-sidebar: 300ms;
120
- --rm-transition-modal: 300ms;
121
- --rm-transition-panel: 400ms;
122
- --rm-transition-flash: 5s;
176
+ /**
177
+ * @tokens Transition
178
+ */
179
+ --op-transition-input: all 120ms ease-in;
180
+ --op-transition-sidebar: all 200ms ease-in-out;
181
+ --op-transition-modal: all 300ms ease-in;
182
+ --op-transition-panel: right 400ms ease-in;
183
+ }
184
+
185
+ @mixin animations {
186
+ /**
187
+ * @tokens Animation
188
+ * @presenter Animation
189
+ */
190
+ --op-animation-flash: rm-slide-in-out-flash 5s normal forwards;
123
191
  }
124
192
 
125
193
  @mixin encoded-images {
126
- --rm-form-dropdown-arrow-width: 1rem; // No way to string interpolate
127
- --rm-form-dropdown-arrow: url("data:image/svg+xml,%3Csvg viewBox='0 0 10 7' version='1.1' xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cg transform='matrix(0.983953,0,0,1.00934,-9.22679,-3.65885)'%3E%3Cpath fill='%23d1d1d1' d='M9.37727 3.625l5.08154 6.93523L19.54036 3.625'/%3E%3C/g%3E%3C/svg%3E%0A");
194
+ /**
195
+ * @tokens Encoded Images
196
+ */
197
+ --op-form-dropdown-arrow-width: 1rem; // No way to string interpolate
198
+ --op-form-dropdown-arrow: url("data:image/svg+xml,%3Csvg viewBox='0 0 10 7' version='1.1' xmlns='http://www.w3.org/2000/svg' width='10' height='7'%3E%3Cg transform='matrix(0.983953,0,0,1.00934,-9.22679,-3.65885)'%3E%3Cpath fill='%23d1d1d1' d='M9.37727 3.625l5.08154 6.93523L19.54036 3.625'/%3E%3C/g%3E%3C/svg%3E%0A");
128
199
  }
129
200
 
130
201
  @mixin fonts {
131
- --rm-font-family: 'Noto Sans', 'Noto Serif', sans-serif;
202
+ /**
203
+ * @tokens Font Family
204
+ * @presenter FontFamily
205
+ */
206
+ --op-font-family: 'Noto Sans', 'Noto Serif', sans-serif;
132
207
  }
133
208
 
134
209
  @mixin spacing-scales {
135
- --rm-space-scale-unit: 1rem; // 10px;
136
- --rm-space-3x-small: calc(var(--rm-space-scale-unit) * 0.2); // 2px
137
- --rm-space-2x-small: calc(var(--rm-space-scale-unit) * 0.4); // 4px
138
- --rm-space-x-small: calc(var(--rm-space-scale-unit) * 0.8); // 8px
139
- --rm-space-small: calc(var(--rm-space-scale-unit) * 1.2); // 12px
140
- --rm-space-medium: calc(var(--rm-space-scale-unit) * 1.6); // 16px
141
- --rm-space-large: calc(var(--rm-space-scale-unit) * 2); // 20px
142
- --rm-space-x-large: calc(var(--rm-space-scale-unit) * 2.4); // 24px
143
- --rm-space-2x-large: calc(var(--rm-space-scale-unit) * 2.8); // 28px
144
- --rm-space-3x-large: calc(var(--rm-space-scale-unit) * 4); // 40px
145
- --rm-space-4x-large: calc(var(--rm-space-scale-unit) * 8); // 80px
210
+ /**
211
+ * @tokens Space Scale
212
+ * @presenter Spacing
213
+ */
214
+ --op-space-scale-unit: 1rem; // 10px;
215
+ --op-space-3x-small: calc(var(--op-space-scale-unit) * 0.2); // 2px
216
+ --op-space-2x-small: calc(var(--op-space-scale-unit) * 0.4); // 4px
217
+ --op-space-x-small: calc(var(--op-space-scale-unit) * 0.8); // 8px
218
+ --op-space-small: calc(var(--op-space-scale-unit) * 1.2); // 12px
219
+ --op-space-medium: calc(var(--op-space-scale-unit) * 1.6); // 16px
220
+ --op-space-large: calc(var(--op-space-scale-unit) * 2); // 20px
221
+ --op-space-x-large: calc(var(--op-space-scale-unit) * 2.4); // 24px
222
+ --op-space-2x-large: calc(var(--op-space-scale-unit) * 2.8); // 28px
223
+ --op-space-3x-large: calc(var(--op-space-scale-unit) * 4); // 40px
224
+ --op-space-4x-large: calc(var(--op-space-scale-unit) * 8); // 80px
146
225
  }
147
226
 
148
227
  @mixin shadows {
149
- --rm-shadow-x-small: 0 1px 2px hsl(0deg 0% 0% / 3%), 0 1px 3px hsl(0deg 0% 0% / 15%);
150
- --rm-shadow-small: 0 1px 2px hsl(0deg 0% 0% / 3%), 0 2px 6px hsl(0deg 0% 0% / 15%);
151
- --rm-shadow-medium: 0 4px 8px hsl(0deg 0% 0% / 15%), 0 1px 3px hsl(0deg 0% 0% / 3%);
152
- --rm-shadow-large: 0 6px 10px hsl(0deg 0% 0% / 15%), 0 2px 3px hsl(0deg 0% 0% / 3%);
153
- --rm-shadow-x-large: 0 8px 12px hsl(0deg 0% 0% / 15%), 0 4px 4px hsl(0deg 0% 0% / 3%);
228
+ /**
229
+ * @tokens Shadows
230
+ * @presenter Shadow
231
+ */
232
+ --op-shadow-x-small: 0 1px 2px hsl(0deg 0% 0% / 3%), 0 1px 3px hsl(0deg 0% 0% / 15%);
233
+ --op-shadow-small: 0 1px 2px hsl(0deg 0% 0% / 3%), 0 2px 6px hsl(0deg 0% 0% / 15%);
234
+ --op-shadow-medium: 0 4px 8px hsl(0deg 0% 0% / 15%), 0 1px 3px hsl(0deg 0% 0% / 3%);
235
+ --op-shadow-large: 0 6px 10px hsl(0deg 0% 0% / 15%), 0 2px 3px hsl(0deg 0% 0% / 3%);
236
+ --op-shadow-x-large: 0 8px 12px hsl(0deg 0% 0% / 15%), 0 4px 4px hsl(0deg 0% 0% / 3%);
154
237
  }
155
238
 
156
239
  @mixin z-indexes {
157
- --rm-z-index-header: 500;
158
- --rm-z-index-footer: 500;
159
- --rm-z-index-drawer: 700;
160
- --rm-z-index-dialog: 800;
161
- --rm-z-index-dialog-backdrop: 801;
162
- --rm-z-index-dialog-content: 802;
163
- --rm-z-index-dropdown: 900;
164
- --rm-z-index-alert-group: 950;
165
- --rm-z-index-tooltip: 1000;
240
+ /**
241
+ * @tokens Z-Index
242
+ */
243
+ --op-z-index-header: 500;
244
+ --op-z-index-footer: 500;
245
+ --op-z-index-drawer: 700;
246
+ --op-z-index-dialog: 800;
247
+ --op-z-index-dialog-backdrop: 801;
248
+ --op-z-index-dialog-content: 802;
249
+ --op-z-index-dropdown: 900;
250
+ --op-z-index-alert-group: 950;
251
+ --op-z-index-tooltip: 1000;
166
252
  }
167
253
 
168
254
  @mixin inputs {
169
255
  // This should follow multiples of 4
170
256
  // https: //uxdesign.cc/baseline-grids-design-systems-ae23b5af8cec See example 8
171
- --rm-input-height-small: 2.4rem; // 24px
172
- --rm-input-height-medium: 3.2rem; // 32px
173
- --rm-input-height-large: 4.4rem; // 44px
174
- --rm-input-height-x-large: 5.6rem; // 56px
175
- --rm-input-outer-focus: 0 0 0 var(--rm-border-width-large) var(--rm-color-primary-plus-four);
176
- --rm-input-inner-focus: inset var(--rm-border-all) var(--rm-color-primary-minus-three);
177
- --rm-input-focus: var(--rm-input-inner-focus), var(--rm-input-outer-focus);
257
+
258
+ /**
259
+ * @tokens Input Heights
260
+ * @presenter Spacing
261
+ */
262
+ --op-input-height-small: 2.8rem; // 28px
263
+ --op-input-height-medium: 3.6rem; // 36px
264
+ --op-input-height-large: 4rem; // 40px
265
+ --op-input-height-x-large: 8.4rem; // 84px
266
+
267
+ /**
268
+ * @tokens Input Focus
269
+ * @presenter Shadow
270
+ */
271
+ --op-input-outer-focus: 0 0 0 var(--op-border-width-large) var(--op-color-primary-plus-four);
272
+ --op-input-inner-focus: inset var(--op-border-all) var(--op-color-primary-minus-three);
273
+ --op-input-focus: var(--op-input-inner-focus), var(--op-input-outer-focus);
178
274
  }
179
275
 
180
276
  // We use SCSS variables outside the root since support for custom properties / css variables
@@ -182,6 +278,9 @@
182
278
  // https://drafts.csswg.org/css-env-1/
183
279
  // https://bholmes.dev/blog/alternative-to-css-variable-media-queries/
184
280
 
281
+ /**
282
+ * @tokens Breakpoints
283
+ */
185
284
  $breakpoint-x-small: 512px; // vertical phone
186
285
  $breakpoint-small: 768px; // vertical ipad
187
286
  $breakpoint-medium: 1024px; // landscape ipad
@@ -207,8 +306,9 @@ $breakpoint-x-large: 1440px; // medium laptop
207
306
  @include line-heights;
208
307
  @include letter-spacing;
209
308
 
210
- // Transitions
309
+ // Transitions and Animations
211
310
  @include transitions;
311
+ @include animations;
212
312
 
213
313
  // Encoded Images
214
314
  @include encoded-images;
@@ -236,12 +336,12 @@ $breakpoint-x-large: 1440px; // medium laptop
236
336
 
237
337
  // Animate onto the screen for 0.5s
238
338
  10% {
239
- right: var(--rm-space-large);
339
+ right: var(--op-space-large);
240
340
  }
241
341
 
242
342
  // Stay on the screen for 3s
243
343
  70% {
244
- right: var(--rm-space-large);
344
+ right: var(--op-space-large);
245
345
  }
246
346
 
247
347
  // Animate off the screen for 1.5s