@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.
- package/.github/release.yml +53 -0
- package/.github/workflows/publish-storybook.yml +11 -3
- package/.storybook/documentation.scss +64 -36
- package/.storybook/main.js +1 -0
- package/.stylelintrc.json +1 -1
- package/README.md +15 -0
- package/dist/css/optics.css +1911 -1325
- package/dist/css/optics.css.map +1 -1
- package/dist/scss/addons/rails-modal-and-panel/modal.scss +38 -13
- package/dist/scss/addons/rails-modal-and-panel/panel.scss +38 -13
- package/dist/scss/addons/tom-select.scss +22 -22
- package/dist/scss/components/alert.scss +48 -48
- package/dist/scss/components/badge.scss +20 -20
- package/dist/scss/components/button.scss +72 -72
- package/dist/scss/components/card.scss +14 -14
- package/dist/scss/components/flash.scss +24 -24
- package/dist/scss/components/form.scss +48 -48
- package/dist/scss/components/icon.scss +32 -32
- package/dist/scss/components/sidebar.scss +67 -67
- package/dist/scss/components/table.scss +26 -26
- package/dist/scss/core/base.scss +16 -16
- package/dist/scss/core/layout.scss +8 -8
- package/dist/scss/core/tokens/base_tokens.scss +223 -123
- package/dist/scss/core/tokens/dark_mode_tokens.scss +409 -262
- package/dist/scss/core/tokens/scale_color_tokens.scss +408 -240
- package/dist/scss/core/utilities.scss +74 -70
- package/dist/scss/recipes/16six-sidebar.scss +17 -17
- package/dist/scss/recipes/domains-sidebar.scss +9 -9
- package/dist/tokens/tokens.json +567 -276
- package/package.json +4 -2
|
@@ -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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
--
|
|
25
|
-
--
|
|
26
|
-
--
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
--
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
--
|
|
41
|
-
--
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
--
|
|
50
|
-
--
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
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(--
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
--
|
|
71
|
-
--
|
|
72
|
-
--
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
--
|
|
81
|
-
--
|
|
82
|
-
--
|
|
83
|
-
--
|
|
84
|
-
--
|
|
85
|
-
--
|
|
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
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
--
|
|
94
|
-
--
|
|
95
|
-
--
|
|
96
|
-
--
|
|
97
|
-
--
|
|
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
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
--
|
|
106
|
-
--
|
|
107
|
-
--
|
|
108
|
-
--
|
|
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
|
-
|
|
113
|
-
|
|
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
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
--
|
|
121
|
-
--
|
|
122
|
-
--
|
|
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
|
-
|
|
127
|
-
|
|
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
|
-
|
|
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
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
--
|
|
140
|
-
--
|
|
141
|
-
--
|
|
142
|
-
--
|
|
143
|
-
--
|
|
144
|
-
--
|
|
145
|
-
--
|
|
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
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
--
|
|
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
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
--
|
|
161
|
-
--
|
|
162
|
-
--
|
|
163
|
-
--
|
|
164
|
-
--
|
|
165
|
-
--
|
|
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
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
--
|
|
177
|
-
--
|
|
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(--
|
|
339
|
+
right: var(--op-space-large);
|
|
240
340
|
}
|
|
241
341
|
|
|
242
342
|
// Stay on the screen for 3s
|
|
243
343
|
70% {
|
|
244
|
-
right: var(--
|
|
344
|
+
right: var(--op-space-large);
|
|
245
345
|
}
|
|
246
346
|
|
|
247
347
|
// Animate off the screen for 1.5s
|