@fairfox/polly 0.87.0 → 0.88.1

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.
@@ -203,23 +203,27 @@
203
203
  @layer polly-components {
204
204
  .root_-n6UrQ {
205
205
  box-sizing: border-box;
206
- padding: var(--polly-space-sm) var(--polly-space-md);
206
+ min-block-size: var(--polly-control-height-md);
207
+ padding-block-start: 0;
208
+ padding-block-end: 0;
209
+ padding-inline: var(--polly-field-padding);
207
210
  font: inherit;
208
211
  font-family: var(--polly-font-sans);
209
212
  color: var(--polly-text);
210
213
  line-height: var(--polly-line-height-base);
211
214
  border: var(--polly-border-width-default) solid transparent;
212
- border-radius: var(--polly-radius-md);
213
- min-block-size: calc(1.5em + 2 * var(--polly-space-sm) + 2 * var(--polly-border-width-default));
215
+ border-radius: var(--polly-control-radius);
214
216
  inline-size: 100%;
215
217
  }
216
218
 
217
219
  .view_-n6UrQ {
220
+ display: flex;
218
221
  cursor: text;
219
222
  white-space: pre-wrap;
220
223
  word-break: break-word;
221
224
  transition: background var(--polly-motion-fast) ease, border-color var(--polly-motion-fast) ease;
222
225
  background: none;
226
+ align-items: center;
223
227
  }
224
228
 
225
229
  .view_-n6UrQ:hover {
@@ -238,7 +242,9 @@
238
242
  }
239
243
 
240
244
  .root_-n6UrQ[data-variant="multi"] {
245
+ display: block;
241
246
  field-sizing: content;
247
+ padding-block: calc((var(--polly-control-height-md) - 1.5em - 2 * var(--polly-border-width-default)) / 2);
242
248
  resize: vertical;
243
249
  max-block-size: 40em;
244
250
  }
@@ -252,7 +258,8 @@
252
258
  }
253
259
 
254
260
  .trigger_HX48zA {
255
- display: inline-block;
261
+ display: inline-flex;
262
+ align-items: center;
256
263
  }
257
264
 
258
265
  .menu_HX48zA {
@@ -349,10 +356,13 @@
349
356
  display: inline-flex;
350
357
  align-items: center;
351
358
  gap: var(--polly-space-sm);
359
+ min-block-size: var(--polly-control-height-md);
352
360
  max-width: min(100%, var(--polly-control-max-width));
353
- padding: var(--polly-space-sm) var(--polly-space-md);
361
+ padding-block-start: 0;
362
+ padding-block-end: 0;
363
+ padding-inline: var(--polly-field-padding);
354
364
  border: var(--polly-border-width-default) solid var(--polly-border);
355
- border-radius: var(--polly-radius-sm);
365
+ border-radius: var(--polly-control-radius);
356
366
  background-color: var(--polly-surface);
357
367
  font-family: inherit;
358
368
  font-size: var(--polly-text-md);
@@ -406,7 +416,7 @@
406
416
  }
407
417
 
408
418
  .actionBtn_daofbw {
409
- display: inline-block;
419
+ display: block;
410
420
  padding: var(--polly-space-xs) var(--polly-space-sm);
411
421
  border-radius: var(--polly-radius-sm);
412
422
  font-family: inherit;
@@ -449,6 +459,8 @@
449
459
 
450
460
  .optionCheck_daofbw {
451
461
  accent-color: var(--polly-accent);
462
+ inline-size: var(--polly-checkbox-size);
463
+ block-size: var(--polly-checkbox-size);
452
464
  vertical-align: middle;
453
465
  pointer-events: none;
454
466
  margin-inline-end: var(--polly-space-sm);
@@ -494,20 +506,26 @@
494
506
  /* src/polly-ui/Button.module.css */
495
507
  @layer polly-components {
496
508
  .btn_c4HKfA {
497
- display: inline-block;
498
- padding: var(--polly-space-sm) var(--polly-space-lg);
509
+ display: inline-flex;
510
+ justify-content: center;
511
+ align-items: center;
512
+ gap: var(--polly-space-sm);
513
+ min-block-size: var(--polly-control-height-md);
514
+ padding-block-start: 0;
515
+ padding-block-end: 0;
516
+ padding-inline: var(--polly-control-padding-md);
499
517
  border: var(--polly-border-width-default) solid transparent;
500
- border-radius: var(--polly-radius-sm);
518
+ border-radius: var(--polly-control-radius);
501
519
  font-family: inherit;
502
520
  font-size: var(--polly-text-md);
503
521
  font-weight: var(--polly-weight-medium);
522
+ line-height: var(--polly-line-height-tight);
504
523
  text-align: center;
505
524
  text-decoration: none;
506
525
  cursor: pointer;
507
526
  user-select: none;
508
527
  box-sizing: border-box;
509
528
  transition: background-color var(--polly-motion-fast), border-color var(--polly-motion-fast), color var(--polly-motion-fast);
510
- line-height: 1.2;
511
529
  }
512
530
 
513
531
  .btn_c4HKfA:disabled, .btn_c4HKfA[aria-disabled="true"] {
@@ -582,20 +600,31 @@
582
600
  }
583
601
 
584
602
  .btnSmall_c4HKfA {
585
- padding: var(--polly-space-xs) var(--polly-space-md);
603
+ min-block-size: var(--polly-control-height-sm);
604
+ padding-inline: var(--polly-control-padding-sm);
586
605
  font-size: var(--polly-text-sm);
587
606
  }
588
607
 
589
608
  .btnLarge_c4HKfA {
590
- padding: var(--polly-space-md) var(--polly-space-xl);
609
+ min-block-size: var(--polly-control-height-lg);
610
+ padding-inline: var(--polly-control-padding-lg);
591
611
  font-size: var(--polly-text-lg);
592
612
  }
593
613
 
594
614
  .btnCircle_c4HKfA {
595
615
  border-radius: var(--polly-radius-full);
596
616
  aspect-ratio: 1;
597
- width: var(--polly-control-height-md);
598
- padding: 0;
617
+ inline-size: var(--polly-control-height-md);
618
+ padding-inline-start: 0;
619
+ padding-inline-end: 0;
620
+ }
621
+
622
+ .btnSmall_c4HKfA.btnCircle_c4HKfA {
623
+ inline-size: var(--polly-control-height-sm);
624
+ }
625
+
626
+ .btnLarge_c4HKfA.btnCircle_c4HKfA {
627
+ inline-size: var(--polly-control-height-lg);
599
628
  }
600
629
 
601
630
  .btnFullWidth_c4HKfA {
@@ -608,6 +637,22 @@
608
637
  text-overflow: ellipsis;
609
638
  white-space: nowrap;
610
639
  }
640
+
641
+ .icon_c4HKfA {
642
+ display: inline-flex;
643
+ flex: none;
644
+ align-items: center;
645
+ }
646
+
647
+ .label_c4HKfA {
648
+ min-inline-size: 0;
649
+ }
650
+
651
+ .btnBounded_c4HKfA .label_c4HKfA {
652
+ overflow: hidden;
653
+ text-overflow: ellipsis;
654
+ white-space: nowrap;
655
+ }
611
656
  }
612
657
 
613
658
  /* src/polly-ui/Surface.module.css */
@@ -691,7 +736,11 @@
691
736
  /* src/polly-ui/Checkbox.module.css */
692
737
  @layer polly-components {
693
738
  .checkbox_EKE5sg {
694
- display: inline-block;
739
+ display: inline-flex;
740
+ align-items: center;
741
+ gap: var(--polly-space-sm);
742
+ box-sizing: border-box;
743
+ min-block-size: var(--polly-control-height-md);
695
744
  cursor: pointer;
696
745
  font-family: inherit;
697
746
  font-size: var(--polly-text-md);
@@ -706,14 +755,15 @@
706
755
 
707
756
  .input_EKE5sg {
708
757
  accent-color: var(--polly-accent);
709
- vertical-align: middle;
758
+ inline-size: var(--polly-checkbox-size);
759
+ block-size: var(--polly-checkbox-size);
710
760
  cursor: inherit;
761
+ flex: none;
711
762
  margin: 0;
712
763
  }
713
764
 
714
765
  .label_EKE5sg {
715
- vertical-align: middle;
716
- margin-inline-start: var(--polly-space-sm);
766
+ min-inline-size: 0;
717
767
  }
718
768
  }
719
769
 
@@ -831,13 +881,19 @@
831
881
 
832
882
  .cancel_ZfTX4A, .confirm_ZfTX4A, .confirmDanger_ZfTX4A {
833
883
  appearance: none;
834
- padding: var(--polly-space-sm) var(--polly-space-lg);
884
+ display: inline-flex;
885
+ min-block-size: var(--polly-control-height-md);
886
+ padding-block-start: 0;
887
+ padding-block-end: 0;
888
+ padding-inline: var(--polly-control-padding-md);
835
889
  font: inherit;
836
890
  font-weight: var(--polly-weight-medium);
837
891
  border: var(--polly-border-width-default) solid var(--polly-border);
838
- border-radius: var(--polly-radius-md);
892
+ border-radius: var(--polly-control-radius);
839
893
  cursor: pointer;
840
894
  transition: background var(--polly-motion-fast) ease;
895
+ justify-content: center;
896
+ align-items: center;
841
897
  }
842
898
 
843
899
  .cancel_ZfTX4A {
@@ -918,14 +974,20 @@
918
974
 
919
975
  .close_fLMrWA {
920
976
  appearance: none;
977
+ display: inline-flex;
978
+ min-block-size: var(--polly-control-height-md);
921
979
  color: var(--polly-text);
922
980
  border: var(--polly-border-width-default) solid transparent;
923
- border-radius: var(--polly-radius-md);
924
- padding: var(--polly-space-sm) var(--polly-space-md);
981
+ border-radius: var(--polly-control-radius);
982
+ padding-block-start: 0;
983
+ padding-block-end: 0;
984
+ padding-inline: var(--polly-field-padding);
925
985
  font: inherit;
926
986
  cursor: pointer;
927
987
  transition: background var(--polly-motion-fast) ease, border-color var(--polly-motion-fast) ease;
928
988
  background: none;
989
+ justify-content: center;
990
+ align-items: center;
929
991
  }
930
992
 
931
993
  .close_fLMrWA:hover {
@@ -949,10 +1011,13 @@
949
1011
  display: inline-flex;
950
1012
  align-items: center;
951
1013
  gap: var(--polly-space-sm);
1014
+ box-sizing: border-box;
952
1015
  min-block-size: var(--polly-control-height-md);
953
- padding: var(--polly-space-sm) var(--polly-space-md);
1016
+ padding-block-start: 0;
1017
+ padding-block-end: 0;
1018
+ padding-inline: var(--polly-control-padding-md);
954
1019
  border: var(--polly-border-width-default) solid var(--polly-border);
955
- border-radius: var(--polly-radius-sm);
1020
+ border-radius: var(--polly-control-radius);
956
1021
  background-color: var(--polly-surface);
957
1022
  font-family: inherit;
958
1023
  font-size: var(--polly-text-md);
@@ -1083,8 +1148,11 @@
1083
1148
  }
1084
1149
 
1085
1150
  .tab_xKO6GA {
1086
- display: inline-block;
1087
- padding: var(--polly-space-sm) var(--polly-space-lg);
1151
+ display: inline-flex;
1152
+ min-block-size: var(--polly-control-height-md);
1153
+ padding-block-start: 0;
1154
+ padding-block-end: 0;
1155
+ padding-inline: var(--polly-control-padding-md);
1088
1156
  border: none;
1089
1157
  border-bottom: var(--polly-border-width-medium) solid transparent;
1090
1158
  font-family: inherit;
@@ -1095,6 +1163,8 @@
1095
1163
  white-space: nowrap;
1096
1164
  transition: color var(--polly-motion-fast), border-color var(--polly-motion-fast);
1097
1165
  background: none;
1166
+ justify-content: center;
1167
+ align-items: center;
1098
1168
  }
1099
1169
 
1100
1170
  .tab_xKO6GA:hover:not(:disabled) {
@@ -1192,13 +1262,16 @@
1192
1262
  @layer polly-components {
1193
1263
  .input_ez4_Vg {
1194
1264
  box-sizing: border-box;
1195
- padding: var(--polly-space-sm) var(--polly-space-md);
1265
+ min-block-size: var(--polly-control-height-md);
1266
+ padding-block-start: 0;
1267
+ padding-block-end: 0;
1268
+ padding-inline: var(--polly-field-padding);
1196
1269
  font: inherit;
1197
1270
  font-family: var(--polly-font-sans);
1198
1271
  color: var(--polly-text);
1199
1272
  background: var(--polly-surface);
1200
1273
  border: var(--polly-border-width-default) solid var(--polly-border);
1201
- border-radius: var(--polly-radius-md);
1274
+ border-radius: var(--polly-control-radius);
1202
1275
  transition: border-color var(--polly-motion-fast) ease, background var(--polly-motion-fast) ease;
1203
1276
  inline-size: 100%;
1204
1277
  }
@@ -1218,7 +1291,8 @@
1218
1291
 
1219
1292
  .input_ez4_Vg[data-polly-input-variant="multi"] {
1220
1293
  field-sizing: content;
1221
- min-block-size: calc(1.5em + 2 * var(--polly-space-sm) + 2 * var(--polly-border-width-default));
1294
+ padding-block: calc((var(--polly-control-height-md) - 1.5em - 2 * var(--polly-border-width-default)) / 2);
1295
+ min-block-size: var(--polly-control-height-md);
1222
1296
  resize: vertical;
1223
1297
  max-block-size: 40em;
1224
1298
  }
@@ -1266,13 +1340,19 @@
1266
1340
 
1267
1341
  .close_xVzRuA {
1268
1342
  appearance: none;
1343
+ display: inline-flex;
1344
+ min-block-size: var(--polly-control-height-sm);
1269
1345
  color: inherit;
1270
1346
  border: var(--polly-border-width-default) solid transparent;
1271
- border-radius: var(--polly-radius-sm);
1272
- padding: var(--polly-space-xs) var(--polly-space-sm);
1347
+ border-radius: var(--polly-control-radius);
1348
+ padding-block-start: 0;
1349
+ padding-block-end: 0;
1350
+ padding-inline: var(--polly-space-sm);
1273
1351
  font: inherit;
1274
1352
  cursor: pointer;
1275
1353
  background: none;
1354
+ justify-content: center;
1355
+ align-items: center;
1276
1356
  }
1277
1357
 
1278
1358
  .close_xVzRuA:hover {
@@ -1283,13 +1363,16 @@
1283
1363
  /* src/polly-ui/Toggle.module.css */
1284
1364
  @layer polly-components {
1285
1365
  .toggle_rnf-SQ {
1286
- display: inline-block;
1366
+ display: inline-flex;
1367
+ align-items: center;
1368
+ gap: var(--polly-space-sm);
1369
+ box-sizing: border-box;
1370
+ min-block-size: var(--polly-control-height-md);
1287
1371
  cursor: pointer;
1288
1372
  font-family: inherit;
1289
1373
  font-size: var(--polly-text-md);
1290
1374
  color: var(--polly-text);
1291
1375
  user-select: none;
1292
- vertical-align: middle;
1293
1376
  }
1294
1377
 
1295
1378
  .disabled_rnf-SQ {
@@ -1310,12 +1393,12 @@
1310
1393
  }
1311
1394
 
1312
1395
  .track_rnf-SQ {
1313
- display: inline-block;
1396
+ display: block;
1314
1397
  position: relative;
1315
1398
  border-radius: var(--polly-radius-full);
1316
1399
  background-color: var(--polly-border);
1317
- vertical-align: middle;
1318
1400
  transition: background-color var(--polly-motion-fast);
1401
+ flex: none;
1319
1402
  width: 36px;
1320
1403
  height: 20px;
1321
1404
  }
@@ -1350,7 +1433,6 @@
1350
1433
  }
1351
1434
 
1352
1435
  .label_rnf-SQ {
1353
- vertical-align: middle;
1354
- margin-inline-start: var(--polly-space-sm);
1436
+ min-inline-size: 0;
1355
1437
  }
1356
1438
  }
@@ -14,6 +14,13 @@
14
14
 
15
15
  @layer polly-defaults {
16
16
  :root {
17
+ /* Tell the UA which schemes the page supports, so native controls —
18
+ * date and time pickers, the checkbox box, scrollbars, autofill —
19
+ * follow the palette instead of staying light on a dark page
20
+ * (polly#179). The media query below asks what the user prefers;
21
+ * this property answers what the page can render. */
22
+ color-scheme: light dark;
23
+
17
24
  /* Surfaces */
18
25
  --polly-surface: #ffffff;
19
26
  --polly-surface-raised: #ffffff;
@@ -75,10 +82,39 @@
75
82
  --polly-measure-prose: 68ch;
76
83
  --polly-measure-page: 1040px;
77
84
 
78
- /* Control heights — used by Button, Input, Select. */
79
- --polly-control-height-sm: 1.75rem;
80
- --polly-control-height-md: 2.25rem;
81
- --polly-control-height-lg: 2.75rem;
85
+ /* Control heights — the single source of truth for how tall an
86
+ * interactive control is. Button, TextInput, ActionInput, Select,
87
+ * FileInput, Dropdown, Checkbox, Toggle and Tabs all set
88
+ * `min-block-size` from this ladder, so a row of mixed controls
89
+ * lines up without the consumer measuring anything. The ladder used to
90
+ * exist without anything reading it, and the same row held five different
91
+ * heights (37.19 / 40 / 42 / 42 / 54 px).
92
+ *
93
+ * Control text is centred by the flex/native box rather than by
94
+ * vertical padding, so changing a height here moves every control
95
+ * together and never re-cuts the text position. */
96
+ --polly-control-height-sm: 2rem;
97
+ --polly-control-height-md: 2.5rem;
98
+ --polly-control-height-lg: 3rem;
99
+
100
+ /* Control corner — one radius for every control, so a Button beside
101
+ * a TextInput has the same corner. Containers (Collapsible, the
102
+ * Dropdown menu, Output, a code block) keep --polly-radius-md
103
+ * independently; this token exists so a consumer can re-cut control
104
+ * corners without touching container corners. */
105
+ --polly-control-radius: var(--polly-radius-md);
106
+
107
+ /* Control inline padding — buttons carry more air than fields, and
108
+ * the ladder tracks the height ladder. */
109
+ --polly-control-padding-sm: var(--polly-space-md);
110
+ --polly-control-padding-md: var(--polly-space-lg);
111
+ --polly-control-padding-lg: var(--polly-space-xl);
112
+ --polly-field-padding: var(--polly-space-md);
113
+
114
+ /* Native checkbox box. The UA default is 13x13, which reads small
115
+ * beside 16px text; Checkbox and the Select option check both size
116
+ * from this. */
117
+ --polly-checkbox-size: 1.125rem;
82
118
 
83
119
  /* Control widths — caps and floors for Button, Select, Dropdown
84
120
  * triggers so semi-dynamic labels (multi-select joins, user-
@@ -194,6 +230,7 @@
194
230
 
195
231
  /* Explicit mode override — wins over prefers-color-scheme. */
196
232
  [data-polly-theme="light"] {
233
+ color-scheme: light;
197
234
  --polly-surface: #ffffff;
198
235
  --polly-surface-raised: #ffffff;
199
236
  --polly-surface-sunken: #f4f5f7;
@@ -225,6 +262,7 @@
225
262
  }
226
263
 
227
264
  [data-polly-theme="dark"] {
265
+ color-scheme: dark;
228
266
  --polly-surface: #14171c;
229
267
  --polly-surface-raised: #1c2027;
230
268
  --polly-surface-sunken: #0f1216;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fairfox/polly",
3
- "version": "0.87.0",
3
+ "version": "0.88.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Multi-execution-context framework with reactive state and cross-context messaging for Chrome extensions, PWAs, and worker-based applications",