@crystal-neuo/css 4.0.1 → 4.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.
@@ -1672,6 +1672,14 @@ pre {
1672
1672
  font-weight: var(--weight-medium);
1673
1673
  color: var(--state-danger-content);
1674
1674
  }
1675
+ /* A row of fields: bottoms line up, so an unlabelled control (button, switch,
1676
+ bare select) sits level with the inputs, not with their labels. */
1677
+ .cn-field-row {
1678
+ display: flex;
1679
+ flex-wrap: wrap;
1680
+ align-items: end;
1681
+ gap: var(--space-3);
1682
+ }
1675
1683
 
1676
1684
  .cn-input,
1677
1685
  .cn-textarea,
@@ -1735,6 +1743,78 @@ pre {
1735
1743
  border-color: var(--state-danger-content);
1736
1744
  }
1737
1745
 
1746
+ /* ============================================================ Input start and end slots
1747
+ Content inside the input's box: a search or currency icon at the start, a
1748
+ reveal or clear button at the end. The group wraps only the input, so a slot
1749
+ centres on the input, never on the label, hint, or message. Each slot in use
1750
+ makes the input reserve one control height on its side, room for one square
1751
+ one inset smaller than the input: a button fills it (corners concentric to
1752
+ the input's), a bare icon sits centred in it. Icons are small (medium at lg). */
1753
+ .cn-input-group {
1754
+ --cn-input-h: var(--size-control-md);
1755
+ --cn-slot-box: calc(var(--cn-input-h) - 2 * var(--space-1));
1756
+ --cn-slot-icon: var(--size-icon-sm);
1757
+ position: relative;
1758
+ display: flex;
1759
+ }
1760
+ .cn-input-group--size-sm {
1761
+ --cn-input-h: var(--size-control-sm);
1762
+ }
1763
+ .cn-input-group--size-lg {
1764
+ --cn-input-h: var(--size-control-lg);
1765
+ --cn-slot-icon: var(--size-icon-md);
1766
+ }
1767
+ .cn-input-group:has(> .cn-input-group__start) > .cn-input {
1768
+ padding-inline-start: var(--cn-input-h);
1769
+ }
1770
+ .cn-input-group:has(> .cn-input-group__end) > .cn-input {
1771
+ padding-inline-end: var(--cn-input-h);
1772
+ }
1773
+ .cn-input-group__start,
1774
+ .cn-input-group__end {
1775
+ position: absolute;
1776
+ inset-block: 0;
1777
+ display: flex;
1778
+ align-items: center;
1779
+ gap: var(--space-1);
1780
+ color: var(--content-secondary);
1781
+ /* clicks on the slot's empty space and on bare icons reach the input */
1782
+ pointer-events: none;
1783
+ }
1784
+ :is(.cn-input-group__start, .cn-input-group__end) > :not(svg) {
1785
+ pointer-events: auto;
1786
+ }
1787
+ .cn-input-group__start {
1788
+ inset-inline-start: var(--space-1);
1789
+ }
1790
+ .cn-input-group__end {
1791
+ inset-inline-end: var(--space-1);
1792
+ }
1793
+ :is(.cn-input-group__start, .cn-input-group__end) > .cn-button {
1794
+ inline-size: var(--cn-slot-box);
1795
+ block-size: var(--cn-slot-box);
1796
+ min-height: 0;
1797
+ min-block-size: 0;
1798
+ padding: 0;
1799
+ border-radius: max(0px, calc(var(--radius-md) - var(--space-1)));
1800
+ }
1801
+ /* the field already draws the box: a ghost button inside it keeps its hover
1802
+ state layer and focus ring but not a second border, and takes the slot's colour */
1803
+ :is(.cn-input-group__start, .cn-input-group__end) > .cn-button--ghost {
1804
+ border-color: transparent;
1805
+ color: inherit;
1806
+ }
1807
+ :is(.cn-input-group__start, .cn-input-group__end) > .cn-button svg,
1808
+ :is(.cn-input-group__start, .cn-input-group__end) > svg {
1809
+ inline-size: var(--cn-slot-icon);
1810
+ block-size: var(--cn-slot-icon);
1811
+ flex: none;
1812
+ }
1813
+ /* a bare icon is decoration, centred where a button would be */
1814
+ :is(.cn-input-group__start, .cn-input-group__end) > svg {
1815
+ margin-inline: calc((var(--cn-slot-box) - var(--cn-slot-icon)) / 2);
1816
+ }
1817
+
1738
1818
  /* ============================================================ Select */
1739
1819
  .cn-select {
1740
1820
  position: relative;
@@ -2881,6 +2961,16 @@ html:has(dialog.cn-scrim[open]) {
2881
2961
  .cn-pagination__btn {
2882
2962
  min-inline-size: max(44px, var(--size-touch-min));
2883
2963
  }
2964
+ /* the input grew, so its end slot and the room it reserves grow with it */
2965
+ .cn-input-group {
2966
+ --cn-input-h: max(44px, var(--size-touch-min), var(--size-control-md));
2967
+ }
2968
+ .cn-input-group--size-sm {
2969
+ --cn-input-h: max(44px, var(--size-touch-min), var(--size-control-sm));
2970
+ }
2971
+ .cn-input-group--size-lg {
2972
+ --cn-input-h: max(44px, var(--size-touch-min), var(--size-control-lg));
2973
+ }
2884
2974
  }
2885
2975
 
2886
2976
  /* ============================================================ Forced colors
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystal-neuo/css",
3
- "version": "4.0.1",
3
+ "version": "4.3.0",
4
4
  "description": "Crystal Neuo framework-agnostic CSS: design tokens + component classes.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -25,7 +25,7 @@
25
25
  "typecheck": "tsc --noEmit"
26
26
  },
27
27
  "dependencies": {
28
- "@crystal-neuo/tokens": "4.0.1"
28
+ "@crystal-neuo/tokens": "4.3.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/bun": "1.4.4"
@@ -298,6 +298,14 @@
298
298
  font-weight: var(--weight-medium);
299
299
  color: var(--state-danger-content);
300
300
  }
301
+ /* A row of fields: bottoms line up, so an unlabelled control (button, switch,
302
+ bare select) sits level with the inputs, not with their labels. */
303
+ .cn-field-row {
304
+ display: flex;
305
+ flex-wrap: wrap;
306
+ align-items: end;
307
+ gap: var(--space-3);
308
+ }
301
309
 
302
310
  .cn-input,
303
311
  .cn-textarea,
@@ -361,6 +369,78 @@
361
369
  border-color: var(--state-danger-content);
362
370
  }
363
371
 
372
+ /* ============================================================ Input start and end slots
373
+ Content inside the input's box: a search or currency icon at the start, a
374
+ reveal or clear button at the end. The group wraps only the input, so a slot
375
+ centres on the input, never on the label, hint, or message. Each slot in use
376
+ makes the input reserve one control height on its side, room for one square
377
+ one inset smaller than the input: a button fills it (corners concentric to
378
+ the input's), a bare icon sits centred in it. Icons are small (medium at lg). */
379
+ .cn-input-group {
380
+ --cn-input-h: var(--size-control-md);
381
+ --cn-slot-box: calc(var(--cn-input-h) - 2 * var(--space-1));
382
+ --cn-slot-icon: var(--size-icon-sm);
383
+ position: relative;
384
+ display: flex;
385
+ }
386
+ .cn-input-group--size-sm {
387
+ --cn-input-h: var(--size-control-sm);
388
+ }
389
+ .cn-input-group--size-lg {
390
+ --cn-input-h: var(--size-control-lg);
391
+ --cn-slot-icon: var(--size-icon-md);
392
+ }
393
+ .cn-input-group:has(> .cn-input-group__start) > .cn-input {
394
+ padding-inline-start: var(--cn-input-h);
395
+ }
396
+ .cn-input-group:has(> .cn-input-group__end) > .cn-input {
397
+ padding-inline-end: var(--cn-input-h);
398
+ }
399
+ .cn-input-group__start,
400
+ .cn-input-group__end {
401
+ position: absolute;
402
+ inset-block: 0;
403
+ display: flex;
404
+ align-items: center;
405
+ gap: var(--space-1);
406
+ color: var(--content-secondary);
407
+ /* clicks on the slot's empty space and on bare icons reach the input */
408
+ pointer-events: none;
409
+ }
410
+ :is(.cn-input-group__start, .cn-input-group__end) > :not(svg) {
411
+ pointer-events: auto;
412
+ }
413
+ .cn-input-group__start {
414
+ inset-inline-start: var(--space-1);
415
+ }
416
+ .cn-input-group__end {
417
+ inset-inline-end: var(--space-1);
418
+ }
419
+ :is(.cn-input-group__start, .cn-input-group__end) > .cn-button {
420
+ inline-size: var(--cn-slot-box);
421
+ block-size: var(--cn-slot-box);
422
+ min-height: 0;
423
+ min-block-size: 0;
424
+ padding: 0;
425
+ border-radius: max(0px, calc(var(--radius-md) - var(--space-1)));
426
+ }
427
+ /* the field already draws the box: a ghost button inside it keeps its hover
428
+ state layer and focus ring but not a second border, and takes the slot's colour */
429
+ :is(.cn-input-group__start, .cn-input-group__end) > .cn-button--ghost {
430
+ border-color: transparent;
431
+ color: inherit;
432
+ }
433
+ :is(.cn-input-group__start, .cn-input-group__end) > .cn-button svg,
434
+ :is(.cn-input-group__start, .cn-input-group__end) > svg {
435
+ inline-size: var(--cn-slot-icon);
436
+ block-size: var(--cn-slot-icon);
437
+ flex: none;
438
+ }
439
+ /* a bare icon is decoration, centred where a button would be */
440
+ :is(.cn-input-group__start, .cn-input-group__end) > svg {
441
+ margin-inline: calc((var(--cn-slot-box) - var(--cn-slot-icon)) / 2);
442
+ }
443
+
364
444
  /* ============================================================ Select */
365
445
  .cn-select {
366
446
  position: relative;
@@ -1507,6 +1587,16 @@ html:has(dialog.cn-scrim[open]) {
1507
1587
  .cn-pagination__btn {
1508
1588
  min-inline-size: max(44px, var(--size-touch-min));
1509
1589
  }
1590
+ /* the input grew, so its end slot and the room it reserves grow with it */
1591
+ .cn-input-group {
1592
+ --cn-input-h: max(44px, var(--size-touch-min), var(--size-control-md));
1593
+ }
1594
+ .cn-input-group--size-sm {
1595
+ --cn-input-h: max(44px, var(--size-touch-min), var(--size-control-sm));
1596
+ }
1597
+ .cn-input-group--size-lg {
1598
+ --cn-input-h: max(44px, var(--size-touch-min), var(--size-control-lg));
1599
+ }
1510
1600
  }
1511
1601
 
1512
1602
  /* ============================================================ Forced colors