@rolemodel/optics 1.9.0 → 1.11.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.
@@ -1,5 +1,5 @@
1
- %form-control-global {
2
- // Public API (allowed to be overridden)
1
+ .form-control {
2
+ /* Public API (customizable component options) */
3
3
  --_op-form-control-height-small: var(--op-input-height-small);
4
4
  --_op-form-control-height-medium: var(--op-input-height-medium);
5
5
  --_op-form-control-height-large: var(--op-input-height-large);
@@ -7,14 +7,14 @@
7
7
  --_op-form-control-font-medium: var(--op-font-small);
8
8
  --_op-form-control-font-large: var(--op-font-small);
9
9
 
10
- // Private API (don't touch these)
10
+ /* Private API (component option defaults) */
11
11
  --__op-form-control-height: var(--_op-form-control-height-large);
12
12
  --__op-form-control-font-size: var(--_op-form-control-font-large);
13
13
 
14
14
  min-width: var(--__op-form-control-height);
15
15
  height: var(--__op-form-control-height);
16
16
 
17
- // Size Modifiers
17
+ /* Size Modifiers */
18
18
  &.form-control--small {
19
19
  --__op-form-control-height: var(--_op-form-control-height-small);
20
20
  --__op-form-control-font-size: var(--_op-form-control-font-small);
@@ -29,20 +29,61 @@
29
29
  --__op-form-control-height: var(--_op-form-control-height-large);
30
30
  --__op-form-control-font-size: var(--_op-form-control-font-large);
31
31
  }
32
+
33
+ /* Disabled State */
34
+ &:disabled {
35
+ cursor: not-allowed;
36
+ opacity: var(--_op-form-control-opacity-disabled);
37
+ }
38
+
39
+ /* Readonly State */
40
+ &[readonly] {
41
+ padding: 0;
42
+ background: transparent;
43
+ box-shadow: none;
44
+ color: var(--op-color-on-background);
45
+ pointer-events: none;
46
+ user-select: none;
47
+
48
+ /* stylelint-disable selector-no-vendor-prefix */
49
+ &::-webkit-input-placeholder {
50
+ color: var(--op-color-on-background);
51
+ }
52
+ /* stylelint-enable selector-no-vendor-prefix */
53
+ }
54
+ }
55
+
56
+ /* Radio or Checkbox Form Control */
57
+ .form-control:is([type='radio'], [type='checkbox']) {
58
+ /* Public API (customizable component options) */
59
+ --_op-form-control-height-small: var(--op-space-medium);
60
+ --_op-form-control-height-medium: var(--op-space-large);
61
+ --_op-form-control-height-large: var(--op-space-x-large);
62
+
63
+ width: var(--__op-form-control-height);
64
+ height: var(--__op-form-control-height);
65
+ align-self: center;
66
+ margin: 0;
67
+ accent-color: var(--op-color-primary-base);
68
+ cursor: pointer;
69
+
70
+ & + label {
71
+ align-self: center;
72
+ }
32
73
  }
33
74
 
34
- %form-control-input-global {
35
- // Public API (allowed to be overridden)
75
+ /* Any Form Control that is not a radio or checkbox */
76
+ .form-control:not([type='radio'], [type='checkbox']) {
77
+ /* Public API (customizable component options) */
36
78
  --_op-form-control-opacity-disabled: var(--op-opacity-disabled);
37
79
 
38
- // Private API (don't touch these)
80
+ /* Private API (component option defaults) */
39
81
  --__op-form-control-border-color: var(--op-color-neutral-plus-four);
40
82
 
41
83
  display: block;
42
84
  width: 100%;
43
85
  min-width: var(--__op-form-control-height);
44
86
  height: var(--__op-form-control-height);
45
- padding: var(--op-space-2x-small) var(--op-space-x-small) var(--op-space-2x-small) var(--op-space-small);
46
87
  border: none;
47
88
  border-radius: var(--op-radius-medium);
48
89
  appearance: none;
@@ -52,26 +93,28 @@
52
93
  cursor: text;
53
94
  font-size: var(--__op-form-control-font-size);
54
95
  line-height: var(--op-line-height-base);
96
+ padding-block: var(--op-space-2x-small);
97
+ padding-inline: var(--op-space-small) var(--op-space-x-small);
55
98
 
56
- // Hover State
57
- &:hover:not(:disabled, [readonly]) {
58
- box-shadow: var(--op-border-all) var(--op-color-primary-plus-three);
59
- }
60
-
61
- // Focus State
99
+ /* Focus State */
62
100
  &:focus,
63
101
  &:focus-within,
64
102
  &:focus-visible {
65
103
  outline: none;
66
104
  }
67
105
 
106
+ /* Hover State */
107
+ &:hover:not(:disabled, [readonly]) {
108
+ box-shadow: var(--op-border-all) var(--op-color-primary-plus-three);
109
+ }
110
+
68
111
  &:focus-visible:not([readonly]) {
69
112
  background-color: var(--op-color-primary-plus-seven);
70
113
  box-shadow: var(--op-input-focus-primary);
71
114
  color: var(--op-color-primary-on-plus-seven);
72
115
  }
73
116
 
74
- // Borderless State
117
+ /* Borderless State */
75
118
  &.form-control--no-border {
76
119
  background-color: transparent;
77
120
  box-shadow: none;
@@ -83,7 +126,7 @@
83
126
  color: var(--op-color-primary-on-plus-seven);
84
127
  }
85
128
 
86
- // Borderless + Hover State
129
+ /* Borderless + Hover State */
87
130
  &:hover:not(:disabled, [readonly]) {
88
131
  background-color: var(--op-color-primary-plus-eight);
89
132
  box-shadow: inset var(--op-border-all) var(--op-color-primary-plus-two);
@@ -92,129 +135,67 @@
92
135
  }
93
136
  }
94
137
 
95
- %form-control-inline-global {
96
- // Public API (allowed to be overridden)
97
- --_op-form-control-height-small: var(--op-space-medium);
98
- --_op-form-control-height-medium: var(--op-space-large);
99
- --_op-form-control-height-large: var(--op-space-x-large);
100
-
101
- width: var(--__op-form-control-height);
102
- height: var(--__op-form-control-height);
103
- align-self: center;
104
- margin: 0;
105
- accent-color: var(--op-color-primary-base);
138
+ /* Color Form Control */
139
+ .form-control[type='color'] {
140
+ padding: var(--op-space-2x-small);
106
141
  cursor: pointer;
107
142
 
108
- & + label {
109
- align-self: center;
143
+ &::-webkit-color-swatch-wrapper {
144
+ padding: 0;
110
145
  }
111
- }
112
146
 
113
- %dropdown-arrow {
114
- padding-right: var(--op-space-3x-large);
115
- appearance: none;
116
- background-image: var(--op-encoded-images-dropdown-arrow);
117
- background-position: center right;
118
- background-position-x: calc(
119
- 100% - ((var(--op-space-3x-large) / 2) - (var(--op-encoded-images-dropdown-arrow-width) / 2))
120
- );
121
- background-repeat: no-repeat;
122
- cursor: pointer;
123
- }
124
-
125
- .form-label {
126
- color: var(--op-color-on-background);
127
- font-size: var(--op-font-x-small);
128
- font-weight: var(--op-font-weight-normal);
129
- letter-spacing: var(--op-letter-spacing-label);
130
- line-height: var(--op-line-height-base);
131
- }
132
-
133
- .form-control {
134
- @extend %form-control-global;
135
-
136
- &:not([type='radio'], [type='checkbox']) {
137
- @extend %form-control-input-global;
147
+ &::-webkit-color-swatch {
148
+ border: none;
149
+ border-radius: var(--op-radius-medium);
138
150
  }
151
+ }
139
152
 
140
- &[type='color'] {
141
- padding: var(--op-space-2x-small);
153
+ /* File Form Control */
154
+ .form-control[type='file'] {
155
+ padding-block: 0;
156
+
157
+ &::file-selector-button {
158
+ --__op-btn-base-height: var(--op-input-height-small);
159
+ --__op-btn-height: var(--__op-btn-base-height);
160
+
161
+ display: inline-flex;
162
+ min-height: var(--__op-btn-height);
163
+ align-items: center;
164
+ justify-content: center;
165
+ border: none;
166
+ border-radius: var(--op-radius-medium);
167
+ appearance: none;
168
+ background-color: var(--op-color-neutral-plus-eight);
169
+ box-shadow: inset var(--op-border-all) var(--op-color-neutral-plus-four);
170
+ color: var(--op-color-neutral-on-plus-eight);
142
171
  cursor: pointer;
143
-
144
- &::-webkit-color-swatch-wrapper {
145
- padding: 0;
146
- }
147
-
148
- &::-webkit-color-swatch {
149
- border: none;
150
- border-radius: var(--op-radius-medium);
151
- }
152
- }
153
-
154
- &[type='radio'],
155
- &[type='checkbox'] {
156
- @extend %form-control-inline-global;
157
- }
158
-
159
- &[type='file'] {
172
+ font-size: var(--op-font-x-small);
173
+ font-weight: var(--op-font-weight-normal);
174
+ gap: var(--op-space-x-small);
175
+ margin-block: calc((var(--__op-form-control-height) / 2) - (var(--__op-btn-height) / 2));
160
176
  padding-block: 0;
161
-
162
- &::file-selector-button {
163
- --__op-btn-base-height: var(--op-input-height-small);
164
- --__op-btn-height: var(--__op-btn-base-height);
165
-
166
- display: inline-flex;
167
- min-height: var(--__op-btn-height);
168
- align-items: center;
169
- justify-content: center;
170
- padding: 0 var(--op-space-x-small);
171
- border: none;
172
- border-radius: var(--op-radius-medium);
173
- appearance: none;
174
- background-color: var(--op-color-neutral-plus-eight);
175
- box-shadow: inset var(--op-border-all) var(--op-color-neutral-plus-four);
176
- color: var(--op-color-neutral-on-plus-eight);
177
- cursor: pointer;
178
- font-size: var(--op-font-x-small);
179
- font-weight: var(--op-font-weight-normal);
180
- gap: var(--op-space-x-small);
181
- margin-block: calc((var(--__op-form-control-height) / 2) - (var(--__op-btn-height) / 2));
182
- text-align: center;
183
- text-decoration: none;
184
- transition: var(--op-transition-input);
185
- white-space: nowrap;
186
- }
187
-
188
- &.form-control--small::file-selector-button {
189
- --__op-btn-height: calc(var(--__op-btn-base-height) - var(--op-space-x-small));
190
- }
177
+ padding-inline: var(--op-space-x-small);
178
+ text-align: center;
179
+ text-decoration: none;
180
+ transition: var(--op-transition-input);
181
+ white-space: nowrap;
191
182
  }
192
183
 
193
- // Disabled State
194
- &:disabled {
195
- cursor: not-allowed;
196
- opacity: var(--_op-form-control-opacity-disabled);
197
- }
198
-
199
- // Readonly State
200
- &[readonly] {
201
- padding: 0;
202
- background: transparent;
203
- box-shadow: none;
204
- color: var(--op-color-on-background);
205
- pointer-events: none;
206
- user-select: none;
207
-
208
- /* stylelint-disable selector-no-vendor-prefix */
209
- &::-webkit-input-placeholder {
210
- color: var(--op-color-on-background);
211
- }
212
- /* stylelint-enable selector-no-vendor-prefix */
184
+ &.form-control--small::file-selector-button {
185
+ --__op-btn-height: calc(var(--__op-btn-base-height) - var(--op-space-x-small));
213
186
  }
214
187
  }
215
188
 
216
189
  select.form-control:not([multiple], [type='radio'], [type='checkbox']) {
217
- @extend %dropdown-arrow;
190
+ appearance: none;
191
+ background-image: var(--op-encoded-images-dropdown-arrow);
192
+ background-position: center right;
193
+ background-position-x: calc(
194
+ 100% - ((var(--op-space-3x-large) / 2) - (var(--op-encoded-images-dropdown-arrow-width) / 2))
195
+ );
196
+ background-repeat: no-repeat;
197
+ cursor: pointer;
198
+ padding-inline-end: var(--op-space-3x-large);
218
199
  }
219
200
 
220
201
  select.form-control[multiple] {
@@ -227,66 +208,12 @@ textarea.form-control:not([type='radio'], [type='checkbox']) {
227
208
  min-height: var(--__op-form-control-height);
228
209
  }
229
210
 
230
- .form-group--error {
231
- /* stylelint-disable no-descending-specificity */
232
- .form-control {
233
- box-shadow: var(--op-border-all) var(--op-color-alerts-danger-base);
234
-
235
- &[type='radio'],
236
- &[type='checkbox'] {
237
- box-shadow: none;
238
-
239
- & + label {
240
- color: var(--op-color-alerts-danger-minus-three);
241
- font-weight: var(--op-font-weight-bold);
242
- }
243
- }
244
-
245
- // Error + Hover State
246
- &:hover:not(:disabled, [readonly]) {
247
- background-color: var(--op-color-alerts-danger-plus-seven);
248
- box-shadow: var(--op-border-all) var(--op-color-alerts-danger-minus-two);
249
- color: var(--op-color-alerts-danger-on-plus-seven);
250
- }
251
-
252
- // Readonly State
253
- &[readonly] {
254
- box-shadow: none;
255
- }
256
-
257
- // Error + Focus State
258
- &:focus-visible:not([readonly]) {
259
- background-color: var(--op-color-alerts-danger-plus-seven);
260
- box-shadow: var(--op-input-focus-danger);
261
- color: var(--op-color-alerts-danger-on-plus-seven);
262
- }
263
-
264
- // Borderless State
265
- &.form-control--no-border {
266
- border-radius: 0;
267
- box-shadow: var(--op-border-bottom) var(--op-color-alerts-danger-base);
268
-
269
- // Readonly State
270
- &[readonly] {
271
- box-shadow: none;
272
- }
273
-
274
- // Borderless + Focus State
275
- &:focus-visible:not([readonly]) {
276
- background-color: var(--op-color-alerts-danger-plus-seven);
277
- box-shadow: var(--op-border-bottom) var(--op-color-alerts-danger-base);
278
- color: var(--op-color-alerts-danger-on-plus-seven);
279
- }
280
-
281
- // Borderless + Hover State
282
- &:hover:not(:disabled, [readonly]) {
283
- background-color: var(--op-color-alerts-danger-plus-eight);
284
- box-shadow: var(--op-border-bottom) var(--op-color-alerts-danger-base);
285
- color: var(--op-color-alerts-danger-on-plus-eight);
286
- }
287
- }
288
- }
289
- /* stylelint-enable no-descending-specificity */
211
+ .form-label {
212
+ color: var(--op-color-on-background);
213
+ font-size: var(--op-font-x-small);
214
+ font-weight: var(--op-font-weight-normal);
215
+ letter-spacing: var(--op-letter-spacing-label);
216
+ line-height: var(--op-line-height-base);
290
217
  }
291
218
 
292
219
  .form-error {
@@ -304,29 +231,30 @@ textarea.form-control:not([type='radio'], [type='checkbox']) {
304
231
  .form-error-summary {
305
232
  padding: var(--op-space-large);
306
233
  border-radius: var(--op-radius-large);
307
- margin-bottom: var(--op-space-large);
308
234
  background-color: var(--op-color-alerts-danger-plus-seven);
309
235
  box-shadow: var(--op-border-all) var(--op-color-alerts-danger-on-plus-seven);
310
236
  color: var(--op-color-alerts-danger-on-plus-seven);
237
+ margin-block-end: var(--op-space-large);
311
238
 
312
239
  h2 {
313
240
  font-size: var(--op-font-medium);
314
241
  }
315
242
 
316
243
  ul {
317
- margin-bottom: 0;
244
+ margin-block-end: 0;
318
245
  }
319
246
  }
320
247
 
321
248
  .form-group {
322
249
  display: grid;
323
250
  align-content: baseline;
324
- padding: var(--op-space-small) 0;
325
251
  gap: var(--op-space-x-small);
326
252
  grid-auto-rows: auto;
327
253
  grid-template-columns: auto 1fr;
254
+ padding-block: var(--op-space-small) 0;
255
+ padding-inline: 0;
328
256
 
329
- // Group Alignment
257
+ /* Group Alignment */
330
258
  /* stylelint-disable no-descending-specificity */
331
259
  .form-label,
332
260
  .form-error,
@@ -350,7 +278,8 @@ textarea.form-control:not([type='radio'], [type='checkbox']) {
350
278
  .form-group--inline {
351
279
  align-items: center;
352
280
 
353
- // Group Alignment
281
+ /* Group Alignment */
282
+
354
283
  /* stylelint-disable no-descending-specificity */
355
284
  .form-label {
356
285
  grid-column: unset;
@@ -367,3 +296,65 @@ textarea.form-control:not([type='radio'], [type='checkbox']) {
367
296
  }
368
297
  /* stylelint-enable no-descending-specificity */
369
298
  }
299
+
300
+ .form-group--error {
301
+ /* stylelint-disable no-descending-specificity */
302
+ .form-control {
303
+ box-shadow: var(--op-border-all) var(--op-color-alerts-danger-base);
304
+
305
+ &[type='radio'],
306
+ &[type='checkbox'] {
307
+ box-shadow: none;
308
+
309
+ & + label {
310
+ color: var(--op-color-alerts-danger-minus-three);
311
+ font-weight: var(--op-font-weight-bold);
312
+ }
313
+ }
314
+
315
+ /* Error + Hover State */
316
+ &:hover:not(:disabled, [readonly]) {
317
+ background-color: var(--op-color-alerts-danger-plus-seven);
318
+ box-shadow: var(--op-border-all) var(--op-color-alerts-danger-minus-two);
319
+ color: var(--op-color-alerts-danger-on-plus-seven);
320
+ }
321
+
322
+ /* Readonly State */
323
+ &[readonly] {
324
+ box-shadow: none;
325
+ }
326
+
327
+ /* Error + Focus State */
328
+ &:focus-visible:not([readonly]) {
329
+ background-color: var(--op-color-alerts-danger-plus-seven);
330
+ box-shadow: var(--op-input-focus-danger);
331
+ color: var(--op-color-alerts-danger-on-plus-seven);
332
+ }
333
+
334
+ /* Borderless State */
335
+ &.form-control--no-border {
336
+ border-radius: 0;
337
+ box-shadow: var(--op-border-bottom) var(--op-color-alerts-danger-base);
338
+
339
+ /* Readonly State */
340
+ &[readonly] {
341
+ box-shadow: none;
342
+ }
343
+
344
+ /* Borderless + Focus State */
345
+ &:focus-visible:not([readonly]) {
346
+ background-color: var(--op-color-alerts-danger-plus-seven);
347
+ box-shadow: var(--op-border-bottom) var(--op-color-alerts-danger-base);
348
+ color: var(--op-color-alerts-danger-on-plus-seven);
349
+ }
350
+
351
+ /* Borderless + Hover State */
352
+ &:hover:not(:disabled, [readonly]) {
353
+ background-color: var(--op-color-alerts-danger-plus-eight);
354
+ box-shadow: var(--op-border-bottom) var(--op-color-alerts-danger-base);
355
+ color: var(--op-color-alerts-danger-on-plus-eight);
356
+ }
357
+ }
358
+ }
359
+ /* stylelint-enable no-descending-specificity */
360
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolemodel/optics",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "packageManager": "yarn@4.2.2",
5
5
  "description": "Optics is an scss package that provides base styles and components that can be integrated and customized in a variety of projects.",
6
6
  "main": "dist/scss/optics.scss",