@onereach/styles 2.19.1-beta.1277.0 → 2.19.1-beta.1279.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/styles",
3
- "version": "2.19.1-beta.1277.0",
3
+ "version": "2.19.1-beta.1279.0",
4
4
  "description": "Styles for or-ui-next",
5
5
  "main": "./main.css",
6
6
  "unpkg": "./main.css",
@@ -24,42 +24,56 @@ module.exports = {
24
24
  darkMode: ['class', '[data-theme="dark"]'],
25
25
 
26
26
  theme: {
27
+ screens: {
28
+ 'sm': '640px',
29
+ 'md': '768px',
30
+ 'lg': '1024px',
31
+ 'xl': '1280px',
32
+ '2xl': '1536px',
33
+ },
34
+
27
35
  spacing: parseSpacingTokens(spacingTokens),
28
36
 
29
37
  backgroundColor: {
30
38
  // Avoid using `text` colors as a background (only for corner cases)
31
39
  ...parseColorTokens(colorTokens, ['generic', 'background', 'text']),
32
40
  'transparent': 'transparent',
41
+ 'current': 'currentColor',
33
42
  'inherit': 'inherit',
34
43
  },
35
44
 
36
45
  textColor: {
37
46
  ...parseColorTokens(colorTokens, ['generic', 'text']),
38
47
  'transparent': 'transparent',
48
+ 'current': 'currentColor',
39
49
  'inherit': 'inherit',
40
50
  },
41
51
 
42
52
  borderColor: {
43
53
  ...parseColorTokens(colorTokens, ['generic']),
44
54
  'transparent': 'transparent',
55
+ 'current': 'currentColor',
45
56
  'inherit': 'inherit',
46
57
  },
47
58
 
48
59
  outlineColor: {
49
60
  ...parseColorTokens(colorTokens, ['generic']),
50
61
  'transparent': 'transparent',
62
+ 'current': 'currentColor',
51
63
  'inherit': 'inherit',
52
64
  },
53
65
 
54
66
  fill: {
55
67
  ...parseColorTokens(colorTokens, ['generic', 'background', 'text']),
56
68
  'transparent': 'transparent',
69
+ 'current': 'currentColor',
57
70
  'inherit': 'inherit',
58
71
  },
59
72
 
60
73
  stroke: {
61
74
  ...parseColorTokens(colorTokens, ['generic', 'background', 'text']),
62
75
  'transparent': 'transparent',
76
+ 'current': 'currentColor',
63
77
  'inherit': 'inherit',
64
78
  },
65
79
 
@@ -119,8 +133,8 @@ module.exports = {
119
133
  },
120
134
 
121
135
  boxShadow: {
136
+ 'generic': '0 1px 1px rgba(0 0 0 / 0.24), 0 0 1px rgba(0 0 0 / 0.16)',
122
137
  ...parseBoxShadowTokens(boxShadowTokens),
123
- DEFAULT: '0 1px 1px rgba(0 0 0 / 0.24), 0 0 1px rgba(0 0 0 / 0.16)',
124
138
  },
125
139
 
126
140
  fontFamily: {
@@ -132,87 +146,24 @@ module.exports = {
132
146
  fontSize: {
133
147
  ...parseFontSizeTokens(typographyTokens),
134
148
  'icon': ['1.15em', { lineHeight: 1 }],
135
- 'inherit': ['inherit', { lineHeight: 'inherit' }],
149
+ 'inherit': 'inherit',
136
150
  },
137
151
 
138
152
  fontWeight: {
139
153
  ...parseFontWeightTokens(typographyTokens),
140
- 'icon': undefined,
141
154
  'inherit': 'inherit',
142
155
  },
143
156
 
144
- transitionDuration: {
145
- 'short': '100ms',
146
- 'medium': '250ms',
147
- 'long': '400ms',
148
- },
157
+ letterSpacing: false,
149
158
 
150
- transitionTimingFunction: {
151
- 'standard': 'cubic-bezier(0.2, 0, 0, 1)',
159
+ lineHeight: {
160
+ 'inherit': 'inherit',
152
161
  },
153
162
  },
154
163
 
155
164
  plugins: [
156
- // Core
157
- plugin(({ addUtilities, addVariant }) => {
158
- addVariant('enabled', ['&:not([disabled])', '&:enabled']);
159
- addVariant('disabled', ['&[disabled]', '&:disabled']);
160
-
161
- addVariant('read-write', ['&:not([readonly])', '&:read-write']);
162
- addVariant('read-only', ['&[readonly]', '&:read-only']);
163
-
164
- addVariant('valid', ['&:not([invalid])', '&:valid']);
165
- addVariant('invalid', ['&[invalid]', '&:invalid']);
166
-
167
- addVariant('required', ['&[required]', '&:required']);
168
- addVariant('optional', ['&:not([required])', '&:optional']);
169
-
170
- addVariant('checked', ['&[checked]', '&:checked']);
171
- addVariant('selected', ['&[selected]', '&:checked']);
172
- addVariant('activated', ['&[activated]']);
173
-
174
- addVariant('hover', '&:hover:not(.interactivity-none)');
175
- addVariant('focus', '&:focus-visible:not(.interactivity-none)');
176
- addVariant('focus-within', '&:focus-within:not(.interactivity-none)');
177
- addVariant('active', '&:active:not(.interactivity-none)');
178
-
179
- // TODO: Remove when migration complete
180
- addUtilities({
181
- '.visually-hidden': {
182
- width: 0,
183
- height: 0,
184
- visibility: 'hidden',
185
- },
186
- });
187
- }),
188
-
189
- // Interactivity
190
- plugin(({ addUtilities }) => {
191
- addUtilities({
192
- '.interactivity-auto': {
193
- pointerEvents: 'auto',
194
- cursor: 'pointer',
195
-
196
- '&[disabled]': {
197
- pointerEvents: 'none',
198
- cursor: 'default',
199
- },
200
- },
201
-
202
- '.interactivity-none': {
203
- pointerEvents: 'none',
204
- cursor: 'default',
205
- },
206
- });
207
- }),
208
-
209
- // Typography
210
- plugin(({ addBase, matchUtilities, theme }) => {
165
+ plugin(({ addBase, addUtilities, addVariant, theme }) => {
211
166
  addBase({
212
- '*': {
213
- userSelect: 'none',
214
- },
215
-
216
167
  ':root': {
217
168
  fontFamily: theme('fontFamily.body-1-regular'),
218
169
  fontSize: theme('fontSize.body-1-regular'),
@@ -220,381 +171,62 @@ module.exports = {
220
171
  },
221
172
  });
222
173
 
223
- matchUtilities({
224
- 'typography': (value) => {
225
- const fontSizeConfig = theme('fontSize');
226
-
227
- const [fontSizeDesktop, optionsDesktop] = fontSizeConfig[value] ?? [];
228
- const [fontSizeMobile, optionsMobile] = fontSizeConfig[`mobile-${value}`] ?? [];
229
-
230
- return {
231
- fontFamily: theme(`fontFamily.mobile-${value}`) ?? theme(`fontFamily.${value}`),
232
- fontWeight: theme(`fontWeight.mobile-${value}`) ?? theme(`fontWeight.${value}`),
233
- fontSize: fontSizeMobile ?? fontSizeDesktop,
234
- lineHeight: optionsMobile?.lineHeight ?? optionsDesktop?.lineHeight,
235
-
236
- [`@media (min-width: ${theme('screens.md')})`]: {
237
- fontFamily: theme(`fontFamily.${value}`),
238
- fontWeight: theme(`fontWeight.${value}`),
239
- fontSize: fontSizeDesktop,
240
- lineHeight: optionsDesktop?.lineHeight,
241
- },
242
- };
243
- },
244
- }, {
245
- values: {
246
- 'headline-1': 'headline-1',
247
- 'headline-2': 'headline-2',
248
- 'headline-3': 'headline-3',
249
- 'headline-4': 'headline-4',
250
- 'body-1-regular': 'body-1-regular',
251
- 'body-1-semibold': 'body-1-semibold',
252
- 'body-1-bold': 'body-1-bold',
253
- 'body-2-regular': 'body-2-regular',
254
- 'body-2-semibold': 'body-2-semibold',
255
- 'body-2-bold': 'body-2-bold',
256
- 'caption-regular': 'caption-regular',
257
- 'caption-semibold': 'caption-semibold',
258
- 'caption-bold': 'caption-bold',
259
- 'button': 'button',
260
- 'icon': 'icon',
261
-
262
- 'inherit': 'inherit',
263
- },
264
- });
265
- }),
266
-
267
- // Iconography
268
- plugin(({ matchUtilities }) => {
269
- matchUtilities({
270
- 'iconography': (value) => ({
271
- fontVariationSettings: value,
272
- }),
273
- }, {
274
- values: {
275
- 'outlined': '"opsz" 48, "wght" 400, "FILL" 0, "GRAD" 0',
276
- 'outlined-bold': '"opsz" 24, "wght" 700, "FILL" 0, "GRAD" 0',
277
- 'filled': '"opsz" 48, "wght" 400, "FILL" 1, "GRAD" 0',
278
- 'filled-bold': '"opsz" 24, "wght" 700, "FILL" 1, "GRAD" 0',
279
-
280
- 'inherit': 'inherit',
281
- },
282
- });
283
- }),
284
-
285
- // Theme
286
- plugin(({ matchUtilities, theme }) => {
287
- // Presets
288
- matchUtilities({
289
- 'theme-preset-1': (value) => {
290
- const [color, suffix = ''] = value.split('..');
291
-
292
- return {
293
- backgroundColor: theme(`backgroundColor.${color}` + suffix),
294
- color: theme(`textColor.on-${color}` + suffix),
295
-
296
- borderStyle: 'none',
297
- outlineStyle: 'none',
298
-
299
- '&[disabled]': {
300
- backgroundColor: theme('backgroundColor.disabled' + suffix),
301
- color: theme('textColor.on-disabled' + suffix),
302
- },
303
-
304
- '&:not(.interactivity-none)': {
305
- '&:hover, &:focus-visible': {
306
- backgroundColor: theme(`backgroundColor.${color}-hover` + suffix),
307
- },
308
-
309
- '&:active': {
310
- backgroundColor: theme(`backgroundColor.${color}` + suffix),
311
- },
312
- },
313
-
314
- transitionProperty: 'all',
315
- transitionDuration: theme('transitionDuration.short'),
316
- transitionTimingFunction: theme('transitionTimingFunction.standard'),
317
- };
318
- },
319
-
320
- 'theme-preset-2': (value) => {
321
- const [color, suffix = ''] = value.split('..');
322
-
323
- return {
324
- backgroundColor: theme(`backgroundColor.${color}-opacity-0-08` + suffix),
325
- color: theme(`textColor.${color}` + suffix),
326
-
327
- borderStyle: 'none',
328
- outlineStyle: 'none',
329
-
330
- '&[disabled]': {
331
- backgroundColor: theme('backgroundColor.disabled' + suffix),
332
- color: theme('textColor.on-disabled' + suffix),
333
- },
334
-
335
- '&:not(.interactivity-none)': {
336
- '&:hover, &:focus-visible': {
337
- backgroundColor: theme(`backgroundColor.${color}-opacity-0-12` + suffix),
338
- },
339
-
340
- '&:active': {
341
- backgroundColor: theme(`backgroundColor.${color}-opacity-0-16` + suffix),
342
- },
343
- },
344
-
345
- transitionProperty: 'all',
346
- transitionDuration: theme('transitionDuration.short'),
347
- transitionTimingFunction: theme('transitionTimingFunction.standard'),
348
- };
349
- },
350
-
351
- 'theme-preset-3': (value) => {
352
- const [color, suffix = ''] = value.split('..');
353
-
354
- return {
355
- backgroundColor: 'transparent',
356
- color: theme(`textColor.${color}` + suffix),
357
-
358
- borderStyle: 'none',
359
- outlineStyle: 'none',
360
-
361
- '&[disabled]': {
362
- color: theme('textColor.on-disabled' + suffix),
363
- },
364
-
365
- '&:not(.interactivity-none)': {
366
- '&:hover, &:focus-visible': {
367
- backgroundColor: theme(`backgroundColor.${color}-opacity-0-08` + suffix),
368
- },
369
-
370
- '&:active': {
371
- backgroundColor: theme(`backgroundColor.${color}-opacity-0-16` + suffix),
372
- },
373
- },
374
-
375
- transitionProperty: 'all',
376
- transitionDuration: theme('transitionDuration.short'),
377
- transitionTimingFunction: theme('transitionTimingFunction.standard'),
378
- };
379
- },
380
-
381
- 'theme-preset-4': (value) => {
382
- const [color, suffix = ''] = value.split('..');
383
-
384
- return {
385
- backgroundColor: 'transparent',
386
- color: theme(`textColor.${color}` + suffix),
387
-
388
- borderStyle: 'none',
389
- outlineStyle: 'none',
390
-
391
- '&[disabled]': {
392
- color: theme('textColor.on-disabled' + suffix),
393
- },
394
-
395
- '&:not(.interactivity-none)': {
396
- '&:hover, &:focus-visible': {
397
- color: theme(`textColor.${color}-hover` + suffix),
398
- },
399
-
400
- '&:active': {
401
- color: theme(`textColor.${color}` + suffix),
402
- },
403
- },
404
-
405
- transitionProperty: 'all',
406
- transitionDuration: theme('transitionDuration.short'),
407
- transitionTimingFunction: theme('transitionTimingFunction.standard'),
408
- };
174
+ addUtilities({
175
+ '.font-icon-outlined': {
176
+ fontVariationSettings: '"opsz" 48, "wght" 400, "FILL" 0, "GRAD" 0',
409
177
  },
410
- }, {
411
- values: {
412
- 'primary': 'primary',
413
- 'primary-dark': 'primary..-dark',
414
-
415
- 'success': 'success',
416
- 'success-dark': 'success..-dark',
417
-
418
- 'warning': 'warning',
419
- 'warning-dark': 'warning..-dark',
420
178
 
421
- 'error': 'error',
422
- 'error-dark': 'error..-dark',
179
+ '.font-icon-outlined-bold': {
180
+ fontVariationSettings: '"opsz" 24, "wght" 700, "FILL" 0, "GRAD" 0',
423
181
  },
424
- });
425
-
426
- // Backgrounds
427
- matchUtilities({
428
- 'theme-background': (value) => {
429
- const [color, suffix = ''] = value.split('..');
430
182
 
431
- return {
432
- backgroundColor: theme(`backgroundColor.${color}` + suffix),
433
-
434
- '&[disabled]': {
435
- backgroundColor: theme('backgroundColor.disabled' + suffix),
436
- },
437
- };
183
+ '.font-icon-filled': {
184
+ fontVariationSettings: '"opsz" 48, "wght" 400, "FILL" 1, "GRAD" 0',
438
185
  },
439
- }, {
440
- values: {
441
- 'default': 'background',
442
- 'default-dark': 'background..-dark',
443
-
444
- 'primary': 'primary',
445
- 'primary-dark': 'primary..-dark',
446
-
447
- 'primary-container': 'primary-container',
448
- 'primary-container-dark': 'primary-container..-dark',
449
-
450
- 'success': 'success',
451
- 'success-dark': 'success..-dark',
452
-
453
- 'success-container': 'success-container',
454
- 'success-container-dark': 'success-container..-dark',
455
186
 
456
- 'warning': 'warning',
457
- 'warning-dark': 'warning..-dark',
458
-
459
- 'warning-container': 'warning-container',
460
- 'warning-container-dark': 'warning-container..-dark',
461
-
462
- 'error': 'error',
463
- 'error-dark': 'error..-dark',
464
-
465
- 'error-container': 'error-container',
466
- 'error-container-dark': 'error-container..-dark',
467
-
468
- 'inherit': 'inherit',
187
+ '.font-icon-filled-bold': {
188
+ fontVariationSettings: '"opsz" 24, "wght" 700, "FILL" 1, "GRAD" 0',
469
189
  },
470
190
  });
471
191
 
472
- // Foregrounds
473
- matchUtilities({
474
- 'theme-foreground': (value) => {
475
- const [color, suffix = ''] = value.split('..');
476
-
477
- return {
478
- color: theme(`textColor.${color}` + suffix),
479
-
480
- '&[disabled]': {
481
- color: theme('textColor.on-disabled' + suffix),
482
- },
483
- };
484
- },
485
- }, {
486
- values: {
487
- 'default': 'on-background',
488
- 'default-dark': 'on-background..-dark',
489
-
490
- 'primary': 'primary',
491
- 'primary-dark': 'primary..-dark',
492
-
493
- 'on-primary': 'on-primary',
494
- 'on-primary-dark': 'on-primary..-dark',
495
-
496
- 'on-primary-container': 'on-primary-container',
497
- 'on-primary-container-dark': 'on-primary-container..-dark',
498
-
499
- 'success': 'success',
500
- 'success-dark': 'success..-dark',
501
-
502
- 'on-success': 'on-success',
503
- 'on-success-dark': 'on-success..-dark',
504
-
505
- 'on-success-container': 'on-success-container',
506
- 'on-success-container-dark': 'on-success-container..-dark',
507
-
508
- 'warning': 'warning',
509
- 'warning-dark': 'warning..-dark',
510
-
511
- 'on-warning': 'on-warning',
512
- 'on-warning-dark': 'on-warning..-dark',
513
-
514
- 'on-warning-container': 'on-warning-container',
515
- 'on-warning-container-dark': 'on-warning-container..-dark',
516
-
517
- 'error': 'error',
518
- 'error-dark': 'error..-dark',
519
-
520
- 'on-error': 'on-error',
521
- 'on-error-dark': 'on-error..-dark',
522
-
523
- 'on-error-container': 'on-error-container',
524
- 'on-error-container-dark': 'on-error-container..-dark',
525
-
526
- 'outline': 'outline',
527
- 'outline-dark': 'outline..-dark',
528
-
529
- 'inherit': 'inherit',
192
+ // TODO: Remove when migration complete
193
+ addUtilities({
194
+ '.visually-hidden': {
195
+ width: 0,
196
+ height: 0,
197
+ visibility: 'hidden',
530
198
  },
531
199
  });
532
200
 
533
- // Borders
534
- matchUtilities({
535
- 'theme-border': (value) => {
536
- const [color, suffix = ''] = value.split('..');
537
-
538
- return {
539
- borderColor: theme(`borderColor.${color}` + suffix),
540
- borderStyle: 'solid',
541
- borderWidth: 1,
201
+ addVariant('hover', '&:hover:not(.pointer-events-none)');
202
+ addVariant('focus-visible', '&:focus-visible:not(.pointer-events-none)');
203
+ addVariant('focus-within', '&:focus-within:not(.pointer-events-none)');
542
204
 
543
- '&[disabled]': {
544
- borderColor: theme('borderColor.disabled' + suffix),
545
- },
546
- };
547
- },
548
- }, {
549
- values: {
550
- 'primary': 'primary',
551
- 'primary-dark': 'primary..-dark',
205
+ addVariant('active', [
206
+ '&:active:not(.pointer-events-none)',
207
+ '&[active]:not(.pointer-events-none)',
208
+ ]);
552
209
 
553
- 'success': 'success',
554
- 'success-dark': 'success..-dark',
210
+ addVariant('enabled', '&:not([disabled])');
211
+ addVariant('disabled', '&[disabled]');
555
212
 
556
- 'warning': 'warning',
557
- 'warning-dark': 'warning..-dark',
213
+ addVariant('valid', '&:not([invalid])');
214
+ addVariant('invalid', '&[invalid]');
558
215
 
559
- 'error': 'error',
560
- 'error-dark': 'error..-dark',
216
+ addVariant('readwrite', '&:not([readonly])');
217
+ addVariant('readonly', '&[readonly]');
561
218
 
562
- 'outline': 'outline',
563
- 'outline-dark': 'outline..-dark',
564
-
565
- 'inherit': 'inherit',
566
- },
567
- });
568
-
569
- // Outlines
570
- matchUtilities({
571
- 'theme-outline': (value) => {
572
- const [color, suffix = ''] = value.split('..');
573
-
574
- return {
575
- outlineColor: theme(`outlineColor.${color}-opacity-0-16` + suffix),
576
- outlineStyle: 'solid',
577
- outlineWidth: 2,
578
- outlineOffset: 0,
579
- };
580
- },
581
- }, {
582
- values: {
583
- 'primary': 'primary',
584
- 'primary-dark': 'primary..-dark',
585
-
586
- 'success': 'success',
587
- 'success-dark': 'success..-dark',
588
-
589
- 'warning': 'warning',
590
- 'warning-dark': 'warning..-dark',
591
-
592
- 'error': 'error',
593
- 'error-dark': 'error..-dark',
594
-
595
- 'inherit': 'inherit',
596
- },
597
- });
219
+ addVariant('checked', [
220
+ '&[type="checkbox"]:checked:not(:indeterminate)',
221
+ '&[type="radio"]:checked',
222
+ ]);
598
223
  }),
599
224
  ],
225
+
226
+ safelist: [
227
+ {
228
+ pattern: /^text-(.+)$/,
229
+ variants: ['hover'],
230
+ },
231
+ ],
600
232
  };