@crystal-neuo/css 4.0.0 → 4.2.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.
@@ -1735,6 +1735,78 @@ pre {
1735
1735
  border-color: var(--state-danger-content);
1736
1736
  }
1737
1737
 
1738
+ /* ============================================================ Input start and end slots
1739
+ Content inside the input's box: a search or currency icon at the start, a
1740
+ reveal or clear button at the end. The group wraps only the input, so a slot
1741
+ centres on the input, never on the label, hint, or message. Each slot in use
1742
+ makes the input reserve one control height on its side, room for one square
1743
+ one inset smaller than the input: a button fills it (corners concentric to
1744
+ the input's), a bare icon sits centred in it. Icons are small (medium at lg). */
1745
+ .cn-input-group {
1746
+ --cn-input-h: var(--size-control-md);
1747
+ --cn-slot-box: calc(var(--cn-input-h) - 2 * var(--space-1));
1748
+ --cn-slot-icon: var(--size-icon-sm);
1749
+ position: relative;
1750
+ display: flex;
1751
+ }
1752
+ .cn-input-group--size-sm {
1753
+ --cn-input-h: var(--size-control-sm);
1754
+ }
1755
+ .cn-input-group--size-lg {
1756
+ --cn-input-h: var(--size-control-lg);
1757
+ --cn-slot-icon: var(--size-icon-md);
1758
+ }
1759
+ .cn-input-group:has(> .cn-input-group__start) > .cn-input {
1760
+ padding-inline-start: var(--cn-input-h);
1761
+ }
1762
+ .cn-input-group:has(> .cn-input-group__end) > .cn-input {
1763
+ padding-inline-end: var(--cn-input-h);
1764
+ }
1765
+ .cn-input-group__start,
1766
+ .cn-input-group__end {
1767
+ position: absolute;
1768
+ inset-block: 0;
1769
+ display: flex;
1770
+ align-items: center;
1771
+ gap: var(--space-1);
1772
+ color: var(--content-secondary);
1773
+ /* clicks on the slot's empty space and on bare icons reach the input */
1774
+ pointer-events: none;
1775
+ }
1776
+ :is(.cn-input-group__start, .cn-input-group__end) > :not(svg) {
1777
+ pointer-events: auto;
1778
+ }
1779
+ .cn-input-group__start {
1780
+ inset-inline-start: var(--space-1);
1781
+ }
1782
+ .cn-input-group__end {
1783
+ inset-inline-end: var(--space-1);
1784
+ }
1785
+ :is(.cn-input-group__start, .cn-input-group__end) > .cn-button {
1786
+ inline-size: var(--cn-slot-box);
1787
+ block-size: var(--cn-slot-box);
1788
+ min-height: 0;
1789
+ min-block-size: 0;
1790
+ padding: 0;
1791
+ border-radius: max(0px, calc(var(--radius-md) - var(--space-1)));
1792
+ }
1793
+ /* the field already draws the box: a ghost button inside it keeps its hover
1794
+ state layer and focus ring but not a second border, and takes the slot's colour */
1795
+ :is(.cn-input-group__start, .cn-input-group__end) > .cn-button--ghost {
1796
+ border-color: transparent;
1797
+ color: inherit;
1798
+ }
1799
+ :is(.cn-input-group__start, .cn-input-group__end) > .cn-button svg,
1800
+ :is(.cn-input-group__start, .cn-input-group__end) > svg {
1801
+ inline-size: var(--cn-slot-icon);
1802
+ block-size: var(--cn-slot-icon);
1803
+ flex: none;
1804
+ }
1805
+ /* a bare icon is decoration, centred where a button would be */
1806
+ :is(.cn-input-group__start, .cn-input-group__end) > svg {
1807
+ margin-inline: calc((var(--cn-slot-box) - var(--cn-slot-icon)) / 2);
1808
+ }
1809
+
1738
1810
  /* ============================================================ Select */
1739
1811
  .cn-select {
1740
1812
  position: relative;
@@ -2881,6 +2953,16 @@ html:has(dialog.cn-scrim[open]) {
2881
2953
  .cn-pagination__btn {
2882
2954
  min-inline-size: max(44px, var(--size-touch-min));
2883
2955
  }
2956
+ /* the input grew, so its end slot and the room it reserves grow with it */
2957
+ .cn-input-group {
2958
+ --cn-input-h: max(44px, var(--size-touch-min), var(--size-control-md));
2959
+ }
2960
+ .cn-input-group--size-sm {
2961
+ --cn-input-h: max(44px, var(--size-touch-min), var(--size-control-sm));
2962
+ }
2963
+ .cn-input-group--size-lg {
2964
+ --cn-input-h: max(44px, var(--size-touch-min), var(--size-control-lg));
2965
+ }
2884
2966
  }
2885
2967
 
2886
2968
  /* ============================================================ Forced colors
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystal-neuo/css",
3
- "version": "4.0.0",
3
+ "version": "4.2.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.0"
28
+ "@crystal-neuo/tokens": "4.2.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/bun": "1.4.4"
@@ -361,6 +361,78 @@
361
361
  border-color: var(--state-danger-content);
362
362
  }
363
363
 
364
+ /* ============================================================ Input start and end slots
365
+ Content inside the input's box: a search or currency icon at the start, a
366
+ reveal or clear button at the end. The group wraps only the input, so a slot
367
+ centres on the input, never on the label, hint, or message. Each slot in use
368
+ makes the input reserve one control height on its side, room for one square
369
+ one inset smaller than the input: a button fills it (corners concentric to
370
+ the input's), a bare icon sits centred in it. Icons are small (medium at lg). */
371
+ .cn-input-group {
372
+ --cn-input-h: var(--size-control-md);
373
+ --cn-slot-box: calc(var(--cn-input-h) - 2 * var(--space-1));
374
+ --cn-slot-icon: var(--size-icon-sm);
375
+ position: relative;
376
+ display: flex;
377
+ }
378
+ .cn-input-group--size-sm {
379
+ --cn-input-h: var(--size-control-sm);
380
+ }
381
+ .cn-input-group--size-lg {
382
+ --cn-input-h: var(--size-control-lg);
383
+ --cn-slot-icon: var(--size-icon-md);
384
+ }
385
+ .cn-input-group:has(> .cn-input-group__start) > .cn-input {
386
+ padding-inline-start: var(--cn-input-h);
387
+ }
388
+ .cn-input-group:has(> .cn-input-group__end) > .cn-input {
389
+ padding-inline-end: var(--cn-input-h);
390
+ }
391
+ .cn-input-group__start,
392
+ .cn-input-group__end {
393
+ position: absolute;
394
+ inset-block: 0;
395
+ display: flex;
396
+ align-items: center;
397
+ gap: var(--space-1);
398
+ color: var(--content-secondary);
399
+ /* clicks on the slot's empty space and on bare icons reach the input */
400
+ pointer-events: none;
401
+ }
402
+ :is(.cn-input-group__start, .cn-input-group__end) > :not(svg) {
403
+ pointer-events: auto;
404
+ }
405
+ .cn-input-group__start {
406
+ inset-inline-start: var(--space-1);
407
+ }
408
+ .cn-input-group__end {
409
+ inset-inline-end: var(--space-1);
410
+ }
411
+ :is(.cn-input-group__start, .cn-input-group__end) > .cn-button {
412
+ inline-size: var(--cn-slot-box);
413
+ block-size: var(--cn-slot-box);
414
+ min-height: 0;
415
+ min-block-size: 0;
416
+ padding: 0;
417
+ border-radius: max(0px, calc(var(--radius-md) - var(--space-1)));
418
+ }
419
+ /* the field already draws the box: a ghost button inside it keeps its hover
420
+ state layer and focus ring but not a second border, and takes the slot's colour */
421
+ :is(.cn-input-group__start, .cn-input-group__end) > .cn-button--ghost {
422
+ border-color: transparent;
423
+ color: inherit;
424
+ }
425
+ :is(.cn-input-group__start, .cn-input-group__end) > .cn-button svg,
426
+ :is(.cn-input-group__start, .cn-input-group__end) > svg {
427
+ inline-size: var(--cn-slot-icon);
428
+ block-size: var(--cn-slot-icon);
429
+ flex: none;
430
+ }
431
+ /* a bare icon is decoration, centred where a button would be */
432
+ :is(.cn-input-group__start, .cn-input-group__end) > svg {
433
+ margin-inline: calc((var(--cn-slot-box) - var(--cn-slot-icon)) / 2);
434
+ }
435
+
364
436
  /* ============================================================ Select */
365
437
  .cn-select {
366
438
  position: relative;
@@ -1507,6 +1579,16 @@ html:has(dialog.cn-scrim[open]) {
1507
1579
  .cn-pagination__btn {
1508
1580
  min-inline-size: max(44px, var(--size-touch-min));
1509
1581
  }
1582
+ /* the input grew, so its end slot and the room it reserves grow with it */
1583
+ .cn-input-group {
1584
+ --cn-input-h: max(44px, var(--size-touch-min), var(--size-control-md));
1585
+ }
1586
+ .cn-input-group--size-sm {
1587
+ --cn-input-h: max(44px, var(--size-touch-min), var(--size-control-sm));
1588
+ }
1589
+ .cn-input-group--size-lg {
1590
+ --cn-input-h: max(44px, var(--size-touch-min), var(--size-control-lg));
1591
+ }
1510
1592
  }
1511
1593
 
1512
1594
  /* ============================================================ Forced colors