@nordcode/ui 2.1.8 → 2.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## 2.2.0 (2026-01-03)
2
+
3
+ ### features
4
+
5
+ - simplify dialog styles
6
+ - use ch/lh in few select places (measures, tracking)
7
+ - extend `nc-segmented-control` to be usable for button groups, tabgroups and horizontal controls
8
+
9
+ ## 2.1.9 (2026-01-02)
10
+
11
+ ### fixes
12
+
13
+ - fix dialog styles
14
+
1
15
  ## 2.1.8 (2026-01-02)
2
16
 
3
17
  ### features
package/out/bundle.css CHANGED
@@ -12,11 +12,11 @@
12
12
  --line-height-base: 1.55;
13
13
  --line-height-small: 1.1;
14
14
  --tracking-base: normal;
15
- --tracking-tight: -.02em;
16
- --tracking-wide: .03em;
17
- --measure-large: 56em;
18
- --measure-base: 44em;
19
- --measure-small: 28em;
15
+ --tracking-tight: -.04ch;
16
+ --tracking-wide: .06ch;
17
+ --measure-large: 88ch;
18
+ --measure-base: 72ch;
19
+ --measure-small: 44ch;
20
20
  --font-size-smallest: max(.75rem, 12px);
21
21
  --font-size-small: max(.875rem, 14px);
22
22
  --font-size-base: 1rem;
@@ -468,7 +468,7 @@
468
468
  grid-column: 1 / 1;
469
469
  min-block-size: 100%;
470
470
  padding-block-end: 0;
471
- padding-inline-end: 1em;
471
+ padding-inline-end: var(--control-spacing-base, 1em);
472
472
  }
473
473
 
474
474
  :where(dt):not(:last-of-type) {
@@ -966,11 +966,11 @@
966
966
  }
967
967
 
968
968
  :where(.nc-flow) > * {
969
- max-inline-size: var(--flow-base-meassure, 44em);
969
+ max-inline-size: var(--flow-base-meassure, 72ch);
970
970
  }
971
971
 
972
972
  :where(.nc-flow) > :is(h1, h2, h3, h4, h5, h6) {
973
- max-inline-size: var(--flow-headline-meassure, 22em);
973
+ max-inline-size: var(--flow-headline-meassure, 32ch);
974
974
  --flow-gap: 1.5lh;
975
975
  }
976
976
 
@@ -252,7 +252,7 @@
252
252
  grid-column: 1 / 1;
253
253
  min-block-size: 100%;
254
254
  padding-block-end: 0;
255
- padding-inline-end: 1em;
255
+ padding-inline-end: var(--control-spacing-base, 1em);
256
256
  }
257
257
 
258
258
  :where(dt):not(:last-of-type) {
@@ -750,11 +750,11 @@
750
750
  }
751
751
 
752
752
  :where(.nc-flow) > * {
753
- max-inline-size: var(--flow-base-meassure, 44em);
753
+ max-inline-size: var(--flow-base-meassure, 72ch);
754
754
  }
755
755
 
756
756
  :where(.nc-flow) > :is(h1, h2, h3, h4, h5, h6) {
757
- max-inline-size: var(--flow-headline-meassure, 22em);
757
+ max-inline-size: var(--flow-headline-meassure, 32ch);
758
758
  --flow-gap: 1.5lh;
759
759
  }
760
760
 
package/out/complete.css CHANGED
@@ -12,11 +12,11 @@
12
12
  --line-height-base: 1.55;
13
13
  --line-height-small: 1.1;
14
14
  --tracking-base: normal;
15
- --tracking-tight: -.02em;
16
- --tracking-wide: .03em;
17
- --measure-large: 56em;
18
- --measure-base: 44em;
19
- --measure-small: 28em;
15
+ --tracking-tight: -.04ch;
16
+ --tracking-wide: .06ch;
17
+ --measure-large: 88ch;
18
+ --measure-base: 72ch;
19
+ --measure-small: 44ch;
20
20
  --font-size-smallest: max(.75rem, 12px);
21
21
  --font-size-small: max(.875rem, 14px);
22
22
  --font-size-base: 1rem;
@@ -468,7 +468,7 @@
468
468
  grid-column: 1 / 1;
469
469
  min-block-size: 100%;
470
470
  padding-block-end: 0;
471
- padding-inline-end: 1em;
471
+ padding-inline-end: var(--control-spacing-base, 1em);
472
472
  }
473
473
 
474
474
  :where(dt):not(:last-of-type) {
@@ -966,11 +966,11 @@
966
966
  }
967
967
 
968
968
  :where(.nc-flow) > * {
969
- max-inline-size: var(--flow-base-meassure, 44em);
969
+ max-inline-size: var(--flow-base-meassure, 72ch);
970
970
  }
971
971
 
972
972
  :where(.nc-flow) > :is(h1, h2, h3, h4, h5, h6) {
973
- max-inline-size: var(--flow-headline-meassure, 22em);
973
+ max-inline-size: var(--flow-headline-meassure, 32ch);
974
974
  --flow-gap: 1.5lh;
975
975
  }
976
976
 
@@ -1852,34 +1852,22 @@
1852
1852
  @layer components.dialogs {
1853
1853
  :where(.nc-dialog) {
1854
1854
  --_dialog-padding-inline: var(--dialog-padding-inline, var(--spacing-base));
1855
- --_dialog-layout-padding: var(--layout-padding, var(--spacing-base));
1856
1855
  --_dialog-close-size: var(--dialog-close-size, var(--control-height-base));
1857
- --_dialog-max-block-size: var(--dialog-max-block-size, 90dvh);
1858
- --_dialog-max-inline-size: var(--dialog-max-inline-size, 28rem);
1859
- --_dialog-radius: 0;
1860
- z-index: var(--layer-important);
1861
1856
  border: var(--border-width-thin) solid var(--color-border-base);
1862
1857
  block-size: max-content;
1863
1858
  inline-size: 100dvw;
1864
- max-inline-size: var(--_dialog-max-inline-size);
1859
+ max-inline-size: var(--dialog-max-inline-size, 28rem);
1865
1860
  background: var(--color-surface-base);
1866
- border-radius: var(--_dialog-radius);
1867
- overflow-clip-margin: var(--control-spacing-far, 1em);
1868
- pointer-events: all;
1861
+ border-radius: var(--dialog-radius, var(--border-radius-medium));
1869
1862
  max-block-size: 100dvh;
1870
- margin: auto 0;
1871
1863
  padding: 0;
1872
- display: block;
1873
- position: fixed;
1874
- inset: 0;
1875
- overflow: clip;
1864
+ overflow: hidden;
1876
1865
  }
1877
1866
 
1878
1867
  @media (width >= 36rem) {
1879
1868
  :where(.nc-dialog) {
1880
- --_dialog-radius: var(--dialog-radius, var(--border-radius-medium));
1881
- inline-size: calc(100dvw - 2 * var(--_dialog-layout-padding));
1882
- max-block-size: var(--_dialog-max-block-size);
1869
+ inline-size: calc(100dvw - 2 * var(--layout-padding, var(--spacing-base)));
1870
+ max-block-size: var(--dialog-max-block-size, 90dvh);
1883
1871
  box-shadow: var(--shadow-medium);
1884
1872
  margin-inline: auto;
1885
1873
  }
@@ -1936,14 +1924,12 @@
1936
1924
  :where(.nc-dialog) :where(.dialog-container) {
1937
1925
  block-size: max-content;
1938
1926
  inline-size: 100%;
1939
- max-block-size: var(--_dialog-max-block-size);
1940
- overflow-clip-margin: var(--control-spacing-far, 1em);
1927
+ max-block-size: inherit;
1941
1928
  grid-template: "header header"
1942
1929
  "content content" 1fr
1943
1930
  "footer footer"
1944
1931
  / 1fr 1fr;
1945
1932
  display: grid;
1946
- overflow: clip;
1947
1933
  }
1948
1934
 
1949
1935
  :where(.nc-dialog) :where(.dialog-container) > :first-child {
@@ -1983,6 +1969,8 @@
1983
1969
  :where(.nc-dialog) :where(.dialog-content) {
1984
1970
  padding-inline: var(--_dialog-padding-inline);
1985
1971
  padding-block: var(--spacing-near);
1972
+ overscroll-behavior: contain;
1973
+ scroll-behavior: smooth;
1986
1974
  grid-area: content;
1987
1975
  overflow: auto;
1988
1976
  }
@@ -2471,86 +2459,145 @@
2471
2459
  outline-offset: 0;
2472
2460
  }
2473
2461
 
2462
+ :where(.nc-segmented-control):focus-within:has( > button) {
2463
+ outline: none;
2464
+ }
2465
+
2474
2466
  :where(.nc-segmented-control) input {
2475
2467
  opacity: 0;
2476
2468
  position: absolute;
2477
2469
  }
2478
2470
 
2479
- :where(.nc-segmented-control) label {
2471
+ :where(.nc-segmented-control) > * {
2480
2472
  padding-inline: var(--_input-padding-inline);
2481
2473
  padding-block: var(--_input-padding-block);
2482
2474
  min-block-size: var(--segmented-control-min-height, var(--control-height-base));
2483
2475
  color: var(--_input-color);
2484
2476
  border: var(--_input-border);
2477
+ cursor: pointer;
2478
+ background: none;
2485
2479
  justify-content: center;
2486
2480
  align-items: center;
2487
2481
  display: flex;
2488
2482
  }
2489
2483
 
2490
- :where(.nc-segmented-control) label > .nc-input-label {
2484
+ :where(.nc-segmented-control) > * > .nc-input-label {
2491
2485
  color: inherit;
2492
2486
  }
2493
2487
 
2494
- :where(.nc-segmented-control) label:hover {
2488
+ button:is(:where(.nc-segmented-control) > *) {
2489
+ box-shadow: none;
2490
+ border-radius: 0;
2491
+ transform: none;
2492
+ }
2493
+
2494
+ button:is(:where(.nc-segmented-control) > *):active {
2495
+ scale: 1;
2496
+ }
2497
+
2498
+ button:is(:where(.nc-segmented-control) > *):focus-within {
2499
+ outline-offset: 0;
2500
+ outline: 1px auto;
2501
+ }
2502
+
2503
+ :where(.nc-segmented-control) > *:hover {
2495
2504
  --current-background: var(--_input-hover-background);
2496
2505
  background-color: var(--_input-hover-background);
2497
2506
  }
2498
2507
 
2499
- :where(.nc-segmented-control) label:first-child {
2508
+ :where(.nc-segmented-control) > *:first-child {
2500
2509
  border-radius: var(--_segmented-control-border-radius) var(--_segmented-control-border-radius) 0 0;
2501
2510
  }
2502
2511
 
2503
- :where(.nc-segmented-control) label:last-child {
2512
+ :where(.nc-segmented-control) > *:last-child {
2504
2513
  border-radius: 0 0 var(--_segmented-control-border-radius) var(--_segmented-control-border-radius);
2505
2514
  }
2506
2515
 
2507
- :where(.nc-segmented-control) label:not(:last-child) {
2516
+ :where(.nc-segmented-control) > *:not(:last-child) {
2508
2517
  border-block-end: var(--border-width-thin) solid var(--color-border-muted);
2509
2518
  }
2510
2519
 
2511
- :where(.nc-segmented-control) label:not(:first-child) {
2520
+ :where(.nc-segmented-control) > *:not(:first-child) {
2512
2521
  border-block-start: none;
2513
2522
  }
2514
2523
 
2515
- :where(.nc-segmented-control) label:has(input:checked) {
2524
+ :where(.nc-segmented-control) > *[aria-pressed="true"], :where(.nc-segmented-control) > *[aria-current] {
2525
+ background: var(--_segmented-control-checked-surface-color);
2526
+ color: var(--_segmented-control-checked-text-color);
2527
+ box-shadow: var(--shadow-near);
2528
+ font-weight: var(--font-weight-default);
2529
+ }
2530
+
2531
+ :where(.nc-segmented-control) > *:has(input:checked) {
2516
2532
  background: var(--_segmented-control-checked-surface-color);
2517
2533
  color: var(--_segmented-control-checked-text-color);
2518
2534
  box-shadow: var(--shadow-near);
2535
+ font-weight: var(--font-weight-default);
2519
2536
  }
2520
2537
 
2521
- :where(.nc-segmented-control) label:focus-within {
2538
+ :where(.nc-segmented-control) > *:focus-within {
2522
2539
  outline: none;
2523
2540
  }
2524
2541
 
2525
- :where(.nc-segmented-control) label:has(input:disabled) {
2542
+ :where(.nc-segmented-control) > *:disabled, :where(.nc-segmented-control) > *[aria-disabled="true"] {
2526
2543
  filter: var(--_input-disabled-filter);
2527
2544
  cursor: not-allowed;
2528
2545
  }
2529
2546
 
2530
- @container segmented-control (width >= 32rem) {
2547
+ :where(.nc-segmented-control) > *:has(input:disabled) {
2548
+ filter: var(--_input-disabled-filter);
2549
+ cursor: not-allowed;
2550
+ }
2551
+
2552
+ @container segmented-control (width >= 32rem) or style(--horizontal: true) {
2531
2553
  :where(.nc-segmented-control) {
2532
2554
  grid-auto-columns: 1fr;
2533
2555
  grid-auto-flow: column;
2556
+ inline-size: auto;
2534
2557
  }
2535
2558
 
2536
- :where(.nc-segmented-control) > label:first-child {
2559
+ :where(.nc-segmented-control) > *:first-child {
2537
2560
  border-radius: var(--_segmented-control-border-radius) 0 0 var(--_segmented-control-border-radius);
2538
2561
  }
2539
2562
 
2540
- :where(.nc-segmented-control) > label:last-child {
2563
+ :where(.nc-segmented-control) > *:last-child {
2541
2564
  border-radius: 0 var(--_segmented-control-border-radius) var(--_segmented-control-border-radius) 0;
2542
2565
  }
2543
2566
 
2544
- :where(.nc-segmented-control) > label:not(:last-child) {
2567
+ :where(.nc-segmented-control) > *:not(:last-child) {
2545
2568
  border-block-end: var(--_input-border);
2546
2569
  border-inline-end: var(--border-width-thin) solid var(--color-border-muted);
2547
2570
  }
2548
2571
 
2549
- :where(.nc-segmented-control) > label:not(:first-child) {
2572
+ :where(.nc-segmented-control) > *:not(:first-child) {
2550
2573
  border-block-start: var(--_input-border);
2551
2574
  border-inline-start: none;
2552
2575
  }
2553
2576
  }
2577
+
2578
+ :where(.nc-segmented-control-group.-horizontal) :where(.nc-segmented-control) {
2579
+ grid-auto-columns: 1fr;
2580
+ grid-auto-flow: column;
2581
+ inline-size: auto;
2582
+ }
2583
+
2584
+ :where(.nc-segmented-control-group.-horizontal) :where(.nc-segmented-control) > *:first-child {
2585
+ border-radius: var(--_segmented-control-border-radius) 0 0 var(--_segmented-control-border-radius);
2586
+ }
2587
+
2588
+ :where(.nc-segmented-control-group.-horizontal) :where(.nc-segmented-control) > *:last-child {
2589
+ border-radius: 0 var(--_segmented-control-border-radius) var(--_segmented-control-border-radius) 0;
2590
+ }
2591
+
2592
+ :where(.nc-segmented-control-group.-horizontal) :where(.nc-segmented-control) > *:not(:last-child) {
2593
+ border-block-end: var(--_input-border);
2594
+ border-inline-end: var(--border-width-thin) solid var(--color-border-muted);
2595
+ }
2596
+
2597
+ :where(.nc-segmented-control-group.-horizontal) :where(.nc-segmented-control) > *:not(:first-child) {
2598
+ border-block-start: var(--_input-border);
2599
+ border-inline-start: none;
2600
+ }
2554
2601
  }
2555
2602
 
2556
2603
  @layer components.input-switch {
@@ -252,7 +252,7 @@
252
252
  grid-column: 1 / 1;
253
253
  min-block-size: 100%;
254
254
  padding-block-end: 0;
255
- padding-inline-end: 1em;
255
+ padding-inline-end: var(--control-spacing-base, 1em);
256
256
  }
257
257
 
258
258
  :where(dt):not(:last-of-type) {
@@ -750,11 +750,11 @@
750
750
  }
751
751
 
752
752
  :where(.nc-flow) > * {
753
- max-inline-size: var(--flow-base-meassure, 44em);
753
+ max-inline-size: var(--flow-base-meassure, 72ch);
754
754
  }
755
755
 
756
756
  :where(.nc-flow) > :is(h1, h2, h3, h4, h5, h6) {
757
- max-inline-size: var(--flow-headline-meassure, 22em);
757
+ max-inline-size: var(--flow-headline-meassure, 32ch);
758
758
  --flow-gap: 1.5lh;
759
759
  }
760
760
 
@@ -1636,34 +1636,22 @@
1636
1636
  @layer components.dialogs {
1637
1637
  :where(.nc-dialog) {
1638
1638
  --_dialog-padding-inline: var(--dialog-padding-inline, var(--spacing-base));
1639
- --_dialog-layout-padding: var(--layout-padding, var(--spacing-base));
1640
1639
  --_dialog-close-size: var(--dialog-close-size, var(--control-height-base));
1641
- --_dialog-max-block-size: var(--dialog-max-block-size, 90dvh);
1642
- --_dialog-max-inline-size: var(--dialog-max-inline-size, 28rem);
1643
- --_dialog-radius: 0;
1644
- z-index: var(--layer-important);
1645
1640
  border: var(--border-width-thin) solid var(--color-border-base);
1646
1641
  block-size: max-content;
1647
1642
  inline-size: 100dvw;
1648
- max-inline-size: var(--_dialog-max-inline-size);
1643
+ max-inline-size: var(--dialog-max-inline-size, 28rem);
1649
1644
  background: var(--color-surface-base);
1650
- border-radius: var(--_dialog-radius);
1651
- overflow-clip-margin: var(--control-spacing-far, 1em);
1652
- pointer-events: all;
1645
+ border-radius: var(--dialog-radius, var(--border-radius-medium));
1653
1646
  max-block-size: 100dvh;
1654
- margin: auto 0;
1655
1647
  padding: 0;
1656
- display: block;
1657
- position: fixed;
1658
- inset: 0;
1659
- overflow: clip;
1648
+ overflow: hidden;
1660
1649
  }
1661
1650
 
1662
1651
  @media (width >= 36rem) {
1663
1652
  :where(.nc-dialog) {
1664
- --_dialog-radius: var(--dialog-radius, var(--border-radius-medium));
1665
- inline-size: calc(100dvw - 2 * var(--_dialog-layout-padding));
1666
- max-block-size: var(--_dialog-max-block-size);
1653
+ inline-size: calc(100dvw - 2 * var(--layout-padding, var(--spacing-base)));
1654
+ max-block-size: var(--dialog-max-block-size, 90dvh);
1667
1655
  box-shadow: var(--shadow-medium);
1668
1656
  margin-inline: auto;
1669
1657
  }
@@ -1720,14 +1708,12 @@
1720
1708
  :where(.nc-dialog) :where(.dialog-container) {
1721
1709
  block-size: max-content;
1722
1710
  inline-size: 100%;
1723
- max-block-size: var(--_dialog-max-block-size);
1724
- overflow-clip-margin: var(--control-spacing-far, 1em);
1711
+ max-block-size: inherit;
1725
1712
  grid-template: "header header"
1726
1713
  "content content" 1fr
1727
1714
  "footer footer"
1728
1715
  / 1fr 1fr;
1729
1716
  display: grid;
1730
- overflow: clip;
1731
1717
  }
1732
1718
 
1733
1719
  :where(.nc-dialog) :where(.dialog-container) > :first-child {
@@ -1767,6 +1753,8 @@
1767
1753
  :where(.nc-dialog) :where(.dialog-content) {
1768
1754
  padding-inline: var(--_dialog-padding-inline);
1769
1755
  padding-block: var(--spacing-near);
1756
+ overscroll-behavior: contain;
1757
+ scroll-behavior: smooth;
1770
1758
  grid-area: content;
1771
1759
  overflow: auto;
1772
1760
  }
@@ -2255,86 +2243,145 @@
2255
2243
  outline-offset: 0;
2256
2244
  }
2257
2245
 
2246
+ :where(.nc-segmented-control):focus-within:has( > button) {
2247
+ outline: none;
2248
+ }
2249
+
2258
2250
  :where(.nc-segmented-control) input {
2259
2251
  opacity: 0;
2260
2252
  position: absolute;
2261
2253
  }
2262
2254
 
2263
- :where(.nc-segmented-control) label {
2255
+ :where(.nc-segmented-control) > * {
2264
2256
  padding-inline: var(--_input-padding-inline);
2265
2257
  padding-block: var(--_input-padding-block);
2266
2258
  min-block-size: var(--segmented-control-min-height, var(--control-height-base));
2267
2259
  color: var(--_input-color);
2268
2260
  border: var(--_input-border);
2261
+ cursor: pointer;
2262
+ background: none;
2269
2263
  justify-content: center;
2270
2264
  align-items: center;
2271
2265
  display: flex;
2272
2266
  }
2273
2267
 
2274
- :where(.nc-segmented-control) label > .nc-input-label {
2268
+ :where(.nc-segmented-control) > * > .nc-input-label {
2275
2269
  color: inherit;
2276
2270
  }
2277
2271
 
2278
- :where(.nc-segmented-control) label:hover {
2272
+ button:is(:where(.nc-segmented-control) > *) {
2273
+ box-shadow: none;
2274
+ border-radius: 0;
2275
+ transform: none;
2276
+ }
2277
+
2278
+ button:is(:where(.nc-segmented-control) > *):active {
2279
+ scale: 1;
2280
+ }
2281
+
2282
+ button:is(:where(.nc-segmented-control) > *):focus-within {
2283
+ outline-offset: 0;
2284
+ outline: 1px auto;
2285
+ }
2286
+
2287
+ :where(.nc-segmented-control) > *:hover {
2279
2288
  --current-background: var(--_input-hover-background);
2280
2289
  background-color: var(--_input-hover-background);
2281
2290
  }
2282
2291
 
2283
- :where(.nc-segmented-control) label:first-child {
2292
+ :where(.nc-segmented-control) > *:first-child {
2284
2293
  border-radius: var(--_segmented-control-border-radius) var(--_segmented-control-border-radius) 0 0;
2285
2294
  }
2286
2295
 
2287
- :where(.nc-segmented-control) label:last-child {
2296
+ :where(.nc-segmented-control) > *:last-child {
2288
2297
  border-radius: 0 0 var(--_segmented-control-border-radius) var(--_segmented-control-border-radius);
2289
2298
  }
2290
2299
 
2291
- :where(.nc-segmented-control) label:not(:last-child) {
2300
+ :where(.nc-segmented-control) > *:not(:last-child) {
2292
2301
  border-block-end: var(--border-width-thin) solid var(--color-border-muted);
2293
2302
  }
2294
2303
 
2295
- :where(.nc-segmented-control) label:not(:first-child) {
2304
+ :where(.nc-segmented-control) > *:not(:first-child) {
2296
2305
  border-block-start: none;
2297
2306
  }
2298
2307
 
2299
- :where(.nc-segmented-control) label:has(input:checked) {
2308
+ :where(.nc-segmented-control) > *[aria-pressed="true"], :where(.nc-segmented-control) > *[aria-current] {
2309
+ background: var(--_segmented-control-checked-surface-color);
2310
+ color: var(--_segmented-control-checked-text-color);
2311
+ box-shadow: var(--shadow-near);
2312
+ font-weight: var(--font-weight-default);
2313
+ }
2314
+
2315
+ :where(.nc-segmented-control) > *:has(input:checked) {
2300
2316
  background: var(--_segmented-control-checked-surface-color);
2301
2317
  color: var(--_segmented-control-checked-text-color);
2302
2318
  box-shadow: var(--shadow-near);
2319
+ font-weight: var(--font-weight-default);
2303
2320
  }
2304
2321
 
2305
- :where(.nc-segmented-control) label:focus-within {
2322
+ :where(.nc-segmented-control) > *:focus-within {
2306
2323
  outline: none;
2307
2324
  }
2308
2325
 
2309
- :where(.nc-segmented-control) label:has(input:disabled) {
2326
+ :where(.nc-segmented-control) > *:disabled, :where(.nc-segmented-control) > *[aria-disabled="true"] {
2310
2327
  filter: var(--_input-disabled-filter);
2311
2328
  cursor: not-allowed;
2312
2329
  }
2313
2330
 
2314
- @container segmented-control (width >= 32rem) {
2331
+ :where(.nc-segmented-control) > *:has(input:disabled) {
2332
+ filter: var(--_input-disabled-filter);
2333
+ cursor: not-allowed;
2334
+ }
2335
+
2336
+ @container segmented-control (width >= 32rem) or style(--horizontal: true) {
2315
2337
  :where(.nc-segmented-control) {
2316
2338
  grid-auto-columns: 1fr;
2317
2339
  grid-auto-flow: column;
2340
+ inline-size: auto;
2318
2341
  }
2319
2342
 
2320
- :where(.nc-segmented-control) > label:first-child {
2343
+ :where(.nc-segmented-control) > *:first-child {
2321
2344
  border-radius: var(--_segmented-control-border-radius) 0 0 var(--_segmented-control-border-radius);
2322
2345
  }
2323
2346
 
2324
- :where(.nc-segmented-control) > label:last-child {
2347
+ :where(.nc-segmented-control) > *:last-child {
2325
2348
  border-radius: 0 var(--_segmented-control-border-radius) var(--_segmented-control-border-radius) 0;
2326
2349
  }
2327
2350
 
2328
- :where(.nc-segmented-control) > label:not(:last-child) {
2351
+ :where(.nc-segmented-control) > *:not(:last-child) {
2329
2352
  border-block-end: var(--_input-border);
2330
2353
  border-inline-end: var(--border-width-thin) solid var(--color-border-muted);
2331
2354
  }
2332
2355
 
2333
- :where(.nc-segmented-control) > label:not(:first-child) {
2356
+ :where(.nc-segmented-control) > *:not(:first-child) {
2334
2357
  border-block-start: var(--_input-border);
2335
2358
  border-inline-start: none;
2336
2359
  }
2337
2360
  }
2361
+
2362
+ :where(.nc-segmented-control-group.-horizontal) :where(.nc-segmented-control) {
2363
+ grid-auto-columns: 1fr;
2364
+ grid-auto-flow: column;
2365
+ inline-size: auto;
2366
+ }
2367
+
2368
+ :where(.nc-segmented-control-group.-horizontal) :where(.nc-segmented-control) > *:first-child {
2369
+ border-radius: var(--_segmented-control-border-radius) 0 0 var(--_segmented-control-border-radius);
2370
+ }
2371
+
2372
+ :where(.nc-segmented-control-group.-horizontal) :where(.nc-segmented-control) > *:last-child {
2373
+ border-radius: 0 var(--_segmented-control-border-radius) var(--_segmented-control-border-radius) 0;
2374
+ }
2375
+
2376
+ :where(.nc-segmented-control-group.-horizontal) :where(.nc-segmented-control) > *:not(:last-child) {
2377
+ border-block-end: var(--_input-border);
2378
+ border-inline-end: var(--border-width-thin) solid var(--color-border-muted);
2379
+ }
2380
+
2381
+ :where(.nc-segmented-control-group.-horizontal) :where(.nc-segmented-control) > *:not(:first-child) {
2382
+ border-block-start: var(--_input-border);
2383
+ border-inline-start: none;
2384
+ }
2338
2385
  }
2339
2386
 
2340
2387
  @layer components.input-switch {
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "type": "git",
13
13
  "url": "https://github.com/nordcode-agency/nordcode/tree/main/packages/ui"
14
14
  },
15
- "version": "2.1.8",
15
+ "version": "2.2.0",
16
16
  "publishConfig": {
17
17
  "access": "public"
18
18
  },
@@ -1,34 +1,21 @@
1
1
  @layer components.dialogs {
2
2
  :where(.nc-dialog) {
3
3
  --_dialog-padding-inline: var(--dialog-padding-inline, var(--spacing-base));
4
- --_dialog-layout-padding: var(--layout-padding, var(--spacing-base));
5
4
  --_dialog-close-size: var(--dialog-close-size, var(--control-height-base));
6
5
 
7
- --_dialog-max-block-size: var(--dialog-max-block-size, 90dvh);
8
- --_dialog-max-inline-size: var(--dialog-max-inline-size, 28rem);
9
-
10
- --_dialog-radius: 0;
11
- display: block;
12
- z-index: var(--layer-important);
13
- position: fixed;
14
- inset: 0;
15
6
  border: var(--border-width-thin) solid var(--color-border-base);
16
7
  inline-size: 100dvw;
17
8
  block-size: max-content;
18
- max-inline-size: var(--_dialog-max-inline-size);
9
+ max-inline-size: var(--dialog-max-inline-size, 28rem);
19
10
  max-block-size: 100dvh;
20
11
  background: var(--color-surface-base);
21
- margin: auto 0;
22
12
  padding: 0;
23
- border-radius: var(--_dialog-radius);
24
- overflow: clip;
25
- overflow-clip-margin: var(--control-spacing-far, 1em);
26
- pointer-events: all;
13
+ overflow: hidden;
14
+ border-radius: var(--dialog-radius, var(--border-radius-medium));
27
15
 
28
16
  @media (min-width: 36rem) {
29
- --_dialog-radius: var(--dialog-radius, var(--border-radius-medium));
30
- inline-size: calc(100dvw - 2 * var(--_dialog-layout-padding));
31
- max-block-size: var(--_dialog-max-block-size);
17
+ inline-size: calc(100dvw - 2 * var(--layout-padding, var(--spacing-base)));
18
+ max-block-size: var(--dialog-max-block-size, 90dvh);
32
19
  margin-inline: auto;
33
20
  box-shadow: var(--shadow-medium);
34
21
  }
@@ -102,9 +89,7 @@
102
89
  "footer footer" auto / 1fr 1fr;
103
90
  inline-size: 100%;
104
91
  block-size: max-content;
105
- max-block-size: var(--_dialog-max-block-size);
106
- overflow: clip;
107
- overflow-clip-margin: var(--control-spacing-far, 1em);
92
+ max-block-size: inherit;
108
93
 
109
94
  & > *:first-child {
110
95
  border-radius: var(--_dialog-radius) var(--_dialog-radius) 0 0;
@@ -146,6 +131,8 @@
146
131
  padding-inline: var(--_dialog-padding-inline);
147
132
  padding-block: var(--spacing-near);
148
133
  overflow: auto;
134
+ overscroll-behavior: contain;
135
+ scroll-behavior: smooth;
149
136
  }
150
137
 
151
138
  :where(.dialog-actions) {
@@ -34,12 +34,16 @@
34
34
  outline-offset: 0;
35
35
  }
36
36
 
37
+ &:focus-within:has(> button) {
38
+ outline: none;
39
+ }
40
+
37
41
  & input {
38
42
  opacity: 0;
39
43
  position: absolute;
40
44
  }
41
45
 
42
- & label {
46
+ & > * {
43
47
  display: flex;
44
48
  padding-inline: var(--_input-padding-inline);
45
49
  padding-block: var(--_input-padding-block);
@@ -48,11 +52,28 @@
48
52
  border: var(--_input-border);
49
53
  align-items: center;
50
54
  justify-content: center;
55
+ cursor: pointer;
56
+ background: none;
51
57
 
52
58
  > .nc-input-label {
53
59
  color: inherit;
54
60
  }
55
61
 
62
+ &button {
63
+ transform: none;
64
+ box-shadow: none;
65
+ border-radius: 0;
66
+
67
+ &:active {
68
+ scale: 1;
69
+ }
70
+
71
+ &:focus-within {
72
+ outline-offset: 0;
73
+ outline: 1px auto;
74
+ }
75
+ }
76
+
56
77
  &:hover {
57
78
  --current-background: var(--_input-hover-background);
58
79
  background-color: var(--_input-hover-background);
@@ -74,29 +95,60 @@
74
95
  border-block-start: none;
75
96
  }
76
97
 
77
- &:has(input:checked) {
98
+ &:has(input:checked), &[aria-pressed="true"], &[aria-current] {
78
99
  background: var(--_segmented-control-checked-surface-color);
79
100
  color: var(--_segmented-control-checked-text-color);
80
101
  box-shadow: var(--shadow-near);
102
+ font-weight: var(--font-weight-default);
81
103
  }
82
104
 
83
105
  &:focus-within {
84
106
  outline: none;
85
107
  }
86
108
 
87
- &:has(input:disabled) {
109
+ &:has(input:disabled), &:disabled, &[aria-disabled="true"] {
88
110
  filter: var(--_input-disabled-filter);
89
111
  cursor: not-allowed;
90
112
  }
91
113
  }
92
114
  }
93
115
 
94
- @container segmented-control (min-width: 32rem) {
116
+ @container segmented-control (min-width: 32rem) or style(--horizontal: true) {
117
+ :where(.nc-segmented-control) {
118
+ grid-auto-columns: 1fr;
119
+ grid-auto-flow: column;
120
+ inline-size: auto;
121
+
122
+ > * {
123
+ &:first-child {
124
+ border-radius: var(--_segmented-control-border-radius) 0 0 var(--_segmented-control-border-radius);
125
+ }
126
+
127
+ &:last-child {
128
+ border-radius: 0 var(--_segmented-control-border-radius) var(--_segmented-control-border-radius) 0;
129
+ }
130
+
131
+ &:not(:last-child) {
132
+ border-block-end: var(--_input-border);
133
+ border-inline-end: var(--border-width-thin) solid var(--color-border-muted);
134
+ }
135
+
136
+ &:not(:first-child) {
137
+ border-block-start: var(--_input-border);
138
+ border-inline-start: none;
139
+ }
140
+ }
141
+ }
142
+ }
143
+
144
+ /* @todo: remove once style container queries are widely supported */
145
+ :where(.nc-segmented-control-group.-horizontal) {
95
146
  :where(.nc-segmented-control) {
96
147
  grid-auto-columns: 1fr;
97
148
  grid-auto-flow: column;
149
+ inline-size: auto;
98
150
 
99
- > label {
151
+ > * {
100
152
  &:first-child {
101
153
  border-radius: var(--_segmented-control-border-radius) 0 0 var(--_segmented-control-border-radius);
102
154
  }
@@ -17,12 +17,12 @@
17
17
  --line-height-small: 1.1;
18
18
 
19
19
  --tracking-base: normal;
20
- --tracking-tight: -0.02em;
21
- --tracking-wide: 0.03em;
20
+ --tracking-tight: -0.04ch;
21
+ --tracking-wide: 0.06ch;
22
22
 
23
- --measure-large: 56em;
24
- --measure-base: 44em;
25
- --measure-small: 28em;
23
+ --measure-large: 88ch;
24
+ --measure-base: 72ch;
25
+ --measure-small: 44ch;
26
26
 
27
27
  --font-size-smallest: max(0.75rem, 12px);
28
28
  --font-size-small: max(0.875rem, 14px);
@@ -113,7 +113,6 @@
113
113
  --lightness-diff: calc(var(--lightness-max) - var(--lightness-min));
114
114
  --lightness-contrast-cutoff: calc(var(--lightness-min) + var(--lightness-diff) * 0.5 + 0.05);
115
115
  --neutral-chroma-scale: 0.95;
116
- --transparency-weaker: 0.8;
117
116
  --c-brand-primary: 0.3;
118
117
  --h-brand-primary: 265;
119
118
  --l-brand-primary-light: 0.56;
@@ -39,7 +39,7 @@
39
39
  @container description-list (min-width: 30rem) {
40
40
  :where(dt) {
41
41
  grid-column: 1 / 1;
42
- padding-inline-end: 1em;
42
+ padding-inline-end: var(--control-spacing-base, 1em);
43
43
  padding-block-end: 0;
44
44
  min-block-size: 100%;
45
45
 
@@ -58,11 +58,11 @@
58
58
  }
59
59
 
60
60
  > * {
61
- max-inline-size: var(--flow-base-meassure, 44em);
61
+ max-inline-size: var(--flow-base-meassure, 72ch);
62
62
  }
63
63
 
64
64
  > *:is(h1, h2, h3, h4, h5, h6) {
65
- max-inline-size: var(--flow-headline-meassure, 22em);
65
+ max-inline-size: var(--flow-headline-meassure, 32ch);
66
66
  --flow-gap: 1.5lh;
67
67
  }
68
68