@soxa-ui/theme-base 0.4.1 → 0.6.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.
Files changed (47) hide show
  1. package/README.md +46 -0
  2. package/package.json +3 -3
  3. package/src/caption.css +10 -10
  4. package/src/components/accordion.css +52 -6
  5. package/src/components/alert-dialog.css +38 -0
  6. package/src/components/alert.css +37 -7
  7. package/src/components/avatar-group.css +42 -2
  8. package/src/components/avatar.css +10 -0
  9. package/src/components/badge.css +35 -10
  10. package/src/components/breadcrumbs.css +37 -0
  11. package/src/components/button.css +36 -21
  12. package/src/components/calendar.css +25 -0
  13. package/src/components/check-box.css +16 -0
  14. package/src/components/code-block.css +25 -0
  15. package/src/components/date-input.css +40 -10
  16. package/src/components/date-picker.css +57 -5
  17. package/src/components/dialog.css +23 -0
  18. package/src/components/drag-and-drop.css +37 -0
  19. package/src/components/drawer.css +38 -7
  20. package/src/components/field.css +24 -12
  21. package/src/components/input.css +41 -17
  22. package/src/components/label.css +27 -12
  23. package/src/components/list-box.css +74 -10
  24. package/src/components/menu.css +54 -9
  25. package/src/components/number-input.css +53 -11
  26. package/src/components/pagination.css +49 -6
  27. package/src/components/popover.css +34 -3
  28. package/src/components/radio-group.css +57 -5
  29. package/src/components/rating.css +10 -0
  30. package/src/components/scroller.css +33 -5
  31. package/src/components/select.css +63 -9
  32. package/src/components/skeleton.css +25 -0
  33. package/src/components/slider.css +31 -13
  34. package/src/components/switch.css +10 -0
  35. package/src/components/table.css +44 -10
  36. package/src/components/tabs.css +99 -14
  37. package/src/components/tags.css +79 -40
  38. package/src/components/textarea.css +34 -6
  39. package/src/components/toasts.css +65 -13
  40. package/src/components/toggle-group.css +49 -2
  41. package/src/components/tooltip.css +32 -3
  42. package/src/group.css +20 -5
  43. package/src/index.css +2 -1
  44. package/src/modal.css +100 -71
  45. package/src/settings.css +98 -0
  46. package/theme-contract.json +12 -40
  47. package/theme-variables.json +185 -90
package/README.md CHANGED
@@ -403,3 +403,49 @@ the application uses Tailwind, name the order before any stylesheet loads, so th
403
403
 
404
404
  Breadcrumbs provides an ordered navigation trail with native links, localized accessible names
405
405
  and an overflow menu. See the [API and examples](../../../docs/api/breadcrumbs.md).
406
+
407
+ ## Shared radius and spacing settings
408
+
409
+ The base declares optional settings in [settings.css](./src/settings.css) with `initial`.
410
+ For a custom property this means unset, so a consuming `var()` can use its fallback.
411
+ An empty token list (`--setting: ;`) would suppress that fallback. A visual theme supplies
412
+ the radius, spacing unit and family multipliers; the base retains structural fallbacks.
413
+
414
+ - `--so-radius`: shared corner radius. Visual themes read it at the styled node,
415
+ after an optional final override such as `--so-input-radius` or `--so-list-box-radius`.
416
+ Round indicators and explicit circle/square shapes keep their shape. Oren preserves
417
+ relative radii: larger panels use 4/3 of the shared radius; small inner corners use less.
418
+ - `--so-spacing`: shared spacing unit, with a structural fallback of 0.25rem.
419
+ - `--so-<family>-scale-<size>`: spacing multiplier for `field`, `control`,
420
+ `collection`, `message` or `surface`, and `sm`, `normal`, `lg`, `xl`, `2xl`.
421
+ - `--so-<component>-spacing-scale`: optional multiplier overriding that component's family.
422
+
423
+ Resolve calculations on the component, rather than in root aliases, so changing a setting
424
+ on a subtree affects its components. Exact component lengths override calculated defaults
425
+ and are never multiplied again. Font sizes, heights, minimum pointer targets, viewport
426
+ offsets and circular shapes keep their own contracts. Values already expressed in em
427
+ continue to follow their surrounding font.
428
+
429
+ Input, DateInput, NumberInput, Textarea, Select, DatePicker, Field and Label use `field`.
430
+ Button and small controls use `control`; lists, menus, tabs, tags, tables, calendars,
431
+ accordions and breadcrumbs use `collection`. Alert and Toasts use `message`.
432
+ Overlay panels and other standalone surfaces use `surface`. A multiplier affects only
433
+ spacing that a component actually has. An overlay follows settings at its DOM target;
434
+ set shared settings on the document or on its teleport container when needed.
435
+
436
+ ### Migration for direct variable reads
437
+
438
+ Spacing variables that previously held fixed root defaults now describe optional final
439
+ overrides. Setting an existing variable to a length still wins, including zero. When a
440
+ custom theme reads one directly, supply a fallback or use the component's computed CSS
441
+ property. For example, replace `gap: var(--so-input-slot-spacing)` with
442
+ `gap: var(--so-input-slot-spacing, calc(var(--so-spacing, 0.25rem) * var(--so-input-spacing-scale, var(--so-field-scale-normal, 1))))`
443
+ for an independently styled normal field. Choose the appropriate size when styling others.
444
+ The same optional-override rule applies to `--so-code-block-radius`; use
445
+ `var(--so-code-block-radius, calc(var(--so-radius, 0px) * 4 / 3))`.
446
+ The full variable list and descriptions are in [theme-variables.json](./theme-variables.json).
447
+
448
+ Alert uses the original compact Toasts spacing as its message reference: 0.875rem block
449
+ padding, 1rem inline padding and 0.125rem between title and description at normal size.
450
+ The message scale multiplies these defaults. `--so-alert-padding` remains an exact CSS
451
+ padding shorthand; `--so-alert-body-gap` overrides only the title-to-description gap.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soxa-ui/theme-base",
3
- "version": "0.4.1",
3
+ "version": "0.6.0",
4
4
  "description": "Общий слой тем Soxa UI: сброс частей библиотеки, знак направления письма и структура частей с числами в переменных — чистый CSS, без препроцессора, — и плагины раскладки для поведения темы",
5
5
  "keywords": [
6
6
  "soxa",
@@ -47,8 +47,8 @@
47
47
  "test": "vitest run"
48
48
  },
49
49
  "peerDependencies": {
50
- "@soxa-ui/core": "^0.4.1",
51
- "@soxa-ui/plugins": "^0.4.1"
50
+ "@soxa-ui/core": "^0.6.0",
51
+ "@soxa-ui/plugins": "^0.6.0"
52
52
  },
53
53
  "devDependencies": {
54
54
  "postcss": "^8.5.9",
package/src/caption.css CHANGED
@@ -25,17 +25,17 @@
25
25
  * одном расстоянии, как бы ни отличалась их высота. */
26
26
 
27
27
  :root {
28
- --so-caption-gap-sm: 0.375rem;
29
- --so-caption-gap-normal: 0.5rem;
30
- --so-caption-gap-lg: 0.625rem;
31
- --so-caption-gap-xl: 0.75rem;
32
- --so-caption-gap-2xl: 0.875rem;
28
+ --so-caption-gap-sm: initial;
29
+ --so-caption-gap-normal: initial;
30
+ --so-caption-gap-lg: initial;
31
+ --so-caption-gap-xl: initial;
32
+ --so-caption-gap-2xl: initial;
33
33
 
34
- --so-caption-stack-sm: 0.1875rem;
35
- --so-caption-stack-normal: 0.25rem;
36
- --so-caption-stack-lg: 0.3125rem;
37
- --so-caption-stack-xl: 0.375rem;
38
- --so-caption-stack-2xl: 0.4375rem;
34
+ --so-caption-stack-sm: initial;
35
+ --so-caption-stack-normal: initial;
36
+ --so-caption-stack-lg: initial;
37
+ --so-caption-stack-xl: initial;
38
+ --so-caption-stack-2xl: initial;
39
39
 
40
40
  /* The caption counts from the font of the place, which `normal` takes as is:
41
41
  * `sm` is 2px smaller, `lg`, `xl` and `2xl` 2px, 4px and 8px larger — 14 /
@@ -22,15 +22,18 @@
22
22
  * переходом (движение) — рисует тема. */
23
23
 
24
24
  :root {
25
- --so-accordion-gap: 0.25rem;
26
- --so-accordion-header-padding: 0.5rem;
27
- --so-accordion-content-padding: 0.5rem;
25
+ --so-accordion-gap: initial;
26
+ --so-accordion-header-padding: initial;
27
+ --so-accordion-content-padding: initial;
28
28
  }
29
29
 
30
30
  .so-accordion {
31
31
  display: flex;
32
32
  flex-direction: column;
33
- gap: var(--so-accordion-gap);
33
+ gap: var(
34
+ --so-accordion-gap,
35
+ calc(var(--so-spacing, 0.25rem) * var(--so-accordion-spacing-factor, 1))
36
+ );
34
37
  }
35
38
 
36
39
  .so-accordion-item {
@@ -47,7 +50,10 @@
47
50
  .so-accordion-item__header {
48
51
  justify-content: flex-start;
49
52
  width: 100%;
50
- padding-block: var(--so-accordion-header-padding);
53
+ padding-block: var(
54
+ --so-accordion-header-padding,
55
+ calc(var(--so-spacing, 0.25rem) * 2 * var(--so-accordion-spacing-factor, 1))
56
+ );
51
57
  }
52
58
 
53
59
  .so-accordion-item__header > .so-button__text {
@@ -92,5 +98,45 @@
92
98
  }
93
99
 
94
100
  .so-accordion-item[data-selected='true'] > .so-accordion-item__body > .so-accordion-item__content {
95
- padding-block: var(--so-accordion-content-padding);
101
+ padding-block: var(
102
+ --so-accordion-content-padding,
103
+ calc(var(--so-spacing, 0.25rem) * 2 * var(--so-accordion-spacing-factor, 1))
104
+ );
105
+ }
106
+
107
+ /* Resolve the family scale here; explicit length variables remain final overrides. */
108
+ .so-accordion--size-sm {
109
+ --so-accordion-spacing-factor: var(
110
+ --so-accordion-spacing-scale,
111
+ var(--so-collection-scale-sm, 1)
112
+ );
113
+ }
114
+
115
+ :where(.so-accordion),
116
+ .so-accordion--size-normal {
117
+ --so-accordion-spacing-factor: var(
118
+ --so-accordion-spacing-scale,
119
+ var(--so-collection-scale-normal, 1)
120
+ );
121
+ }
122
+
123
+ .so-accordion--size-lg {
124
+ --so-accordion-spacing-factor: var(
125
+ --so-accordion-spacing-scale,
126
+ var(--so-collection-scale-lg, 1)
127
+ );
128
+ }
129
+
130
+ .so-accordion--size-xl {
131
+ --so-accordion-spacing-factor: var(
132
+ --so-accordion-spacing-scale,
133
+ var(--so-collection-scale-xl, 1)
134
+ );
135
+ }
136
+
137
+ .so-accordion--size-2xl {
138
+ --so-accordion-spacing-factor: var(
139
+ --so-accordion-spacing-scale,
140
+ var(--so-collection-scale-2xl, 1)
141
+ );
96
142
  }
@@ -6,6 +6,7 @@
6
6
  }
7
7
 
8
8
  .so-alert-dialog {
9
+ --so-modal-spacing-factor: var(--so-alert-dialog-spacing-factor);
9
10
  position: fixed;
10
11
  inset: var(--so-alert-dialog-offset);
11
12
  margin: auto;
@@ -17,3 +18,40 @@
17
18
  max-width: calc(100% - 2 * var(--so-alert-dialog-offset));
18
19
  max-height: calc(100% - 2 * var(--so-alert-dialog-offset));
19
20
  }
21
+
22
+ /* Resolve the family scale here; explicit length variables remain final overrides. */
23
+ .so-alert-dialog--size-sm {
24
+ --so-alert-dialog-spacing-factor: var(
25
+ --so-alert-dialog-spacing-scale,
26
+ var(--so-surface-scale-sm, 1)
27
+ );
28
+ }
29
+
30
+ :where(.so-alert-dialog),
31
+ .so-alert-dialog--size-normal {
32
+ --so-alert-dialog-spacing-factor: var(
33
+ --so-alert-dialog-spacing-scale,
34
+ var(--so-surface-scale-normal, 1)
35
+ );
36
+ }
37
+
38
+ .so-alert-dialog--size-lg {
39
+ --so-alert-dialog-spacing-factor: var(
40
+ --so-alert-dialog-spacing-scale,
41
+ var(--so-surface-scale-lg, 1)
42
+ );
43
+ }
44
+
45
+ .so-alert-dialog--size-xl {
46
+ --so-alert-dialog-spacing-factor: var(
47
+ --so-alert-dialog-spacing-scale,
48
+ var(--so-surface-scale-xl, 1)
49
+ );
50
+ }
51
+
52
+ .so-alert-dialog--size-2xl {
53
+ --so-alert-dialog-spacing-factor: var(
54
+ --so-alert-dialog-spacing-scale,
55
+ var(--so-surface-scale-2xl, 1)
56
+ );
57
+ }
@@ -1,17 +1,25 @@
1
1
  /* Geometry stays independent of the theme's colors and visual variants. */
2
2
  :root {
3
- --so-alert-padding: 1rem;
4
- --so-alert-gap: 0.75rem;
3
+ --so-alert-padding: initial;
4
+ --so-alert-gap: initial;
5
5
  --so-alert-icon-size: 1.25em;
6
6
  --so-alert-close-size: var(--so-button-height-sm);
7
+ --so-alert-body-gap: initial;
7
8
  }
8
9
 
9
10
  .so-alert {
10
11
  display: grid;
11
12
  grid-template-columns: minmax(0, 1fr);
12
13
  align-items: start;
13
- column-gap: var(--so-alert-gap);
14
- padding: var(--so-alert-padding);
14
+ column-gap: var(
15
+ --so-alert-gap,
16
+ calc(var(--so-spacing, 0.25rem) * 3 * var(--so-alert-spacing-factor, 1))
17
+ );
18
+ padding: var(
19
+ --so-alert-padding,
20
+ calc(var(--so-spacing, 0.25rem) * 3.5 * var(--so-alert-spacing-factor, 1))
21
+ calc(var(--so-spacing, 0.25rem) * 4 * var(--so-alert-spacing-factor, 1))
22
+ );
15
23
  min-inline-size: 0;
16
24
  overflow-wrap: anywhere;
17
25
  }
@@ -62,12 +70,24 @@
62
70
  display: flex;
63
71
  flex-wrap: wrap;
64
72
  align-items: center;
65
- gap: calc(var(--so-alert-gap) / 2);
73
+ gap: calc(
74
+ var(
75
+ --so-alert-gap,
76
+ calc(var(--so-spacing, 0.25rem) * 3 * var(--so-alert-spacing-factor, 1))
77
+ ) /
78
+ 2
79
+ );
66
80
  grid-row: 2;
67
- margin-block-start: var(--so-alert-gap);
81
+ margin-block-start: var(
82
+ --so-alert-gap,
83
+ calc(var(--so-spacing, 0.25rem) * 3 * var(--so-alert-spacing-factor, 1))
84
+ );
68
85
  }
69
86
  .so-alert__title:not(:empty) + .so-alert__content:not(:empty) {
70
- margin-block-start: calc(var(--so-alert-gap) / 2);
87
+ margin-block-start: var(
88
+ --so-alert-body-gap,
89
+ calc(var(--so-spacing, 0.25rem) * 0.5 * var(--so-alert-spacing-factor, 1))
90
+ );
71
91
  }
72
92
 
73
93
  .so-alert__icon:empty,
@@ -99,18 +119,28 @@
99
119
  }
100
120
 
101
121
  .so-alert--size-sm {
122
+ --so-alert-spacing-factor: var(--so-alert-spacing-scale, var(--so-message-scale-sm, 1));
102
123
  font-size: var(--so-button-font-size-sm);
103
124
  line-height: var(--so-button-line-height-sm);
104
125
  }
105
126
  .so-alert--size-lg {
127
+ --so-alert-spacing-factor: var(--so-alert-spacing-scale, var(--so-message-scale-lg, 1));
106
128
  font-size: var(--so-button-font-size-lg);
107
129
  line-height: var(--so-button-line-height-lg);
108
130
  }
109
131
  .so-alert--size-xl {
132
+ --so-alert-spacing-factor: var(--so-alert-spacing-scale, var(--so-message-scale-xl, 1));
110
133
  font-size: var(--so-button-font-size-xl);
111
134
  line-height: var(--so-button-line-height-xl);
112
135
  }
113
136
  .so-alert--size-2xl {
137
+ --so-alert-spacing-factor: var(--so-alert-spacing-scale, var(--so-message-scale-2xl, 1));
114
138
  font-size: var(--so-button-font-size-2xl);
115
139
  line-height: var(--so-button-line-height-2xl);
116
140
  }
141
+
142
+ /* Use the normal family scale when the size modifier is absent. */
143
+ :where(.so-alert),
144
+ .so-alert--size-normal {
145
+ --so-alert-spacing-factor: var(--so-alert-spacing-scale, var(--so-message-scale-normal, 1));
146
+ }
@@ -1,6 +1,6 @@
1
1
  :root {
2
2
  --so-avatar-group-overlap: 0.25rem;
3
- --so-avatar-group-count-padding: 0.375rem;
3
+ --so-avatar-group-count-padding: initial;
4
4
  }
5
5
 
6
6
  .so-avatar-group {
@@ -27,10 +27,50 @@
27
27
  justify-content: center;
28
28
  min-inline-size: var(--so-avatar-size-normal);
29
29
  block-size: var(--so-avatar-size-normal);
30
- padding-inline: var(--so-avatar-group-count-padding);
30
+ padding-inline: var(
31
+ --so-avatar-group-count-padding,
32
+ calc(var(--so-spacing, 0.25rem) * 1.5 * var(--so-avatar-group-spacing-factor, 1))
33
+ );
31
34
  font-size: var(--so-avatar-font-size-normal);
32
35
  line-height: 1;
33
36
  white-space: nowrap;
34
37
  direction: ltr;
35
38
  unicode-bidi: isolate;
36
39
  }
40
+
41
+ /* Resolve the family scale here; explicit length variables remain final overrides. */
42
+ .so-avatar-group--size-sm {
43
+ --so-avatar-group-spacing-factor: var(
44
+ --so-avatar-group-spacing-scale,
45
+ var(--so-surface-scale-sm, 1)
46
+ );
47
+ }
48
+
49
+ :where(.so-avatar-group),
50
+ .so-avatar-group--size-normal {
51
+ --so-avatar-group-spacing-factor: var(
52
+ --so-avatar-group-spacing-scale,
53
+ var(--so-surface-scale-normal, 1)
54
+ );
55
+ }
56
+
57
+ .so-avatar-group--size-lg {
58
+ --so-avatar-group-spacing-factor: var(
59
+ --so-avatar-group-spacing-scale,
60
+ var(--so-surface-scale-lg, 1)
61
+ );
62
+ }
63
+
64
+ .so-avatar-group--size-xl {
65
+ --so-avatar-group-spacing-factor: var(
66
+ --so-avatar-group-spacing-scale,
67
+ var(--so-surface-scale-xl, 1)
68
+ );
69
+ }
70
+
71
+ .so-avatar-group--size-2xl {
72
+ --so-avatar-group-spacing-factor: var(
73
+ --so-avatar-group-spacing-scale,
74
+ var(--so-surface-scale-2xl, 1)
75
+ );
76
+ }
@@ -27,21 +27,25 @@
27
27
  }
28
28
 
29
29
  .so-avatar--size-sm {
30
+ --so-avatar-spacing-factor: var(--so-avatar-spacing-scale, var(--so-surface-scale-sm, 1));
30
31
  --so-avatar-size: var(--so-avatar-size-sm);
31
32
  --so-avatar-font-size: var(--so-avatar-font-size-sm);
32
33
  }
33
34
 
34
35
  .so-avatar--size-lg {
36
+ --so-avatar-spacing-factor: var(--so-avatar-spacing-scale, var(--so-surface-scale-lg, 1));
35
37
  --so-avatar-size: var(--so-avatar-size-lg);
36
38
  --so-avatar-font-size: var(--so-avatar-font-size-lg);
37
39
  }
38
40
 
39
41
  .so-avatar--size-xl {
42
+ --so-avatar-spacing-factor: var(--so-avatar-spacing-scale, var(--so-surface-scale-xl, 1));
40
43
  --so-avatar-size: var(--so-avatar-size-xl);
41
44
  --so-avatar-font-size: var(--so-avatar-font-size-xl);
42
45
  }
43
46
 
44
47
  .so-avatar--size-2xl {
48
+ --so-avatar-spacing-factor: var(--so-avatar-spacing-scale, var(--so-surface-scale-2xl, 1));
45
49
  --so-avatar-size: var(--so-avatar-size-2xl);
46
50
  --so-avatar-font-size: var(--so-avatar-font-size-2xl);
47
51
  }
@@ -73,3 +77,9 @@
73
77
  .so-avatar[data-status='loaded'] > .so-avatar__fallback {
74
78
  display: none;
75
79
  }
80
+
81
+ /* Use the normal family scale when the size modifier is absent. */
82
+ :where(.so-avatar),
83
+ .so-avatar--size-normal {
84
+ --so-avatar-spacing-factor: var(--so-avatar-spacing-scale, var(--so-surface-scale-normal, 1));
85
+ }
@@ -12,11 +12,11 @@
12
12
  --so-badge-font-size-xl: 1rem;
13
13
  --so-badge-font-size-2xl: 1.125rem;
14
14
 
15
- --so-badge-padding-sm: 0.25rem;
16
- --so-badge-padding-normal: 0.375rem;
17
- --so-badge-padding-lg: 0.4375rem;
18
- --so-badge-padding-xl: 0.5rem;
19
- --so-badge-padding-2xl: 0.625rem;
15
+ --so-badge-padding-sm: initial;
16
+ --so-badge-padding-normal: initial;
17
+ --so-badge-padding-lg: initial;
18
+ --so-badge-padding-xl: initial;
19
+ --so-badge-padding-2xl: initial;
20
20
 
21
21
  --so-badge-dot-size-sm: 0.375rem;
22
22
  --so-badge-dot-size-normal: 0.5rem;
@@ -29,7 +29,10 @@
29
29
  .so-badge {
30
30
  --so-badge-height: var(--so-badge-height-normal);
31
31
  --so-badge-font-size: var(--so-badge-font-size-normal);
32
- --so-badge-padding: var(--so-badge-padding-normal);
32
+ --so-badge-padding: var(
33
+ --so-badge-padding-normal,
34
+ calc(var(--so-spacing, 0.25rem) * 1.5 * var(--so-badge-spacing-factor, 1))
35
+ );
33
36
  --so-badge-dot-size: var(--so-badge-dot-size-normal);
34
37
 
35
38
  position: relative;
@@ -38,30 +41,46 @@
38
41
  }
39
42
 
40
43
  .so-badge--size-sm {
44
+ --so-badge-spacing-factor: var(--so-badge-spacing-scale, var(--so-surface-scale-sm, 1));
41
45
  --so-badge-height: var(--so-badge-height-sm);
42
46
  --so-badge-font-size: var(--so-badge-font-size-sm);
43
- --so-badge-padding: var(--so-badge-padding-sm);
47
+ --so-badge-padding: var(
48
+ --so-badge-padding-sm,
49
+ calc(var(--so-spacing, 0.25rem) * 1.5 * var(--so-badge-spacing-factor, 1))
50
+ );
44
51
  --so-badge-dot-size: var(--so-badge-dot-size-sm);
45
52
  }
46
53
 
47
54
  .so-badge--size-lg {
55
+ --so-badge-spacing-factor: var(--so-badge-spacing-scale, var(--so-surface-scale-lg, 1));
48
56
  --so-badge-height: var(--so-badge-height-lg);
49
57
  --so-badge-font-size: var(--so-badge-font-size-lg);
50
- --so-badge-padding: var(--so-badge-padding-lg);
58
+ --so-badge-padding: var(
59
+ --so-badge-padding-lg,
60
+ calc(var(--so-spacing, 0.25rem) * 1.5 * var(--so-badge-spacing-factor, 1))
61
+ );
51
62
  --so-badge-dot-size: var(--so-badge-dot-size-lg);
52
63
  }
53
64
 
54
65
  .so-badge--size-xl {
66
+ --so-badge-spacing-factor: var(--so-badge-spacing-scale, var(--so-surface-scale-xl, 1));
55
67
  --so-badge-height: var(--so-badge-height-xl);
56
68
  --so-badge-font-size: var(--so-badge-font-size-xl);
57
- --so-badge-padding: var(--so-badge-padding-xl);
69
+ --so-badge-padding: var(
70
+ --so-badge-padding-xl,
71
+ calc(var(--so-spacing, 0.25rem) * 1.5 * var(--so-badge-spacing-factor, 1))
72
+ );
58
73
  --so-badge-dot-size: var(--so-badge-dot-size-xl);
59
74
  }
60
75
 
61
76
  .so-badge--size-2xl {
77
+ --so-badge-spacing-factor: var(--so-badge-spacing-scale, var(--so-surface-scale-2xl, 1));
62
78
  --so-badge-height: var(--so-badge-height-2xl);
63
79
  --so-badge-font-size: var(--so-badge-font-size-2xl);
64
- --so-badge-padding: var(--so-badge-padding-2xl);
80
+ --so-badge-padding: var(
81
+ --so-badge-padding-2xl,
82
+ calc(var(--so-spacing, 0.25rem) * 1.5 * var(--so-badge-spacing-factor, 1))
83
+ );
65
84
  --so-badge-dot-size: var(--so-badge-dot-size-2xl);
66
85
  }
67
86
 
@@ -104,3 +123,9 @@
104
123
  inset-inline-end: 0;
105
124
  translate: calc(50% * var(--so-dir-sign)) -50%;
106
125
  }
126
+
127
+ /* Use the normal family scale when the size modifier is absent. */
128
+ :where(.so-badge),
129
+ .so-badge--size-normal {
130
+ --so-badge-spacing-factor: var(--so-badge-spacing-scale, var(--so-surface-scale-normal, 1));
131
+ }
@@ -101,3 +101,40 @@
101
101
  .so-breadcrumbs-item[data-disabled='true'] > * {
102
102
  --so-disabled-opacity: 1;
103
103
  }
104
+
105
+ /* Resolve the family scale here; explicit length variables remain final overrides. */
106
+ .so-breadcrumbs--size-sm {
107
+ --so-breadcrumbs-spacing-factor: var(
108
+ --so-breadcrumbs-spacing-scale,
109
+ var(--so-collection-scale-sm, 1)
110
+ );
111
+ }
112
+
113
+ :where(.so-breadcrumbs),
114
+ .so-breadcrumbs--size-normal {
115
+ --so-breadcrumbs-spacing-factor: var(
116
+ --so-breadcrumbs-spacing-scale,
117
+ var(--so-collection-scale-normal, 1)
118
+ );
119
+ }
120
+
121
+ .so-breadcrumbs--size-lg {
122
+ --so-breadcrumbs-spacing-factor: var(
123
+ --so-breadcrumbs-spacing-scale,
124
+ var(--so-collection-scale-lg, 1)
125
+ );
126
+ }
127
+
128
+ .so-breadcrumbs--size-xl {
129
+ --so-breadcrumbs-spacing-factor: var(
130
+ --so-breadcrumbs-spacing-scale,
131
+ var(--so-collection-scale-xl, 1)
132
+ );
133
+ }
134
+
135
+ .so-breadcrumbs--size-2xl {
136
+ --so-breadcrumbs-spacing-factor: var(
137
+ --so-breadcrumbs-spacing-scale,
138
+ var(--so-collection-scale-2xl, 1)
139
+ );
140
+ }
@@ -21,17 +21,17 @@
21
21
  --so-button-height-xl: 2.5rem;
22
22
  --so-button-height-2xl: 2.75rem;
23
23
 
24
- --so-button-padding-sm: 0.375rem;
25
- --so-button-padding-normal: 0.625rem;
26
- --so-button-padding-lg: 0.75rem;
27
- --so-button-padding-xl: 0.875rem;
28
- --so-button-padding-2xl: 1rem;
29
-
30
- --so-button-gap-sm: 0.25rem;
31
- --so-button-gap-normal: 0.375rem;
32
- --so-button-gap-lg: 0.5rem;
33
- --so-button-gap-xl: 0.625rem;
34
- --so-button-gap-2xl: 0.75rem;
24
+ --so-button-padding-sm: initial;
25
+ --so-button-padding-normal: initial;
26
+ --so-button-padding-lg: initial;
27
+ --so-button-padding-xl: initial;
28
+ --so-button-padding-2xl: initial;
29
+
30
+ --so-button-gap-sm: initial;
31
+ --so-button-gap-normal: initial;
32
+ --so-button-gap-lg: initial;
33
+ --so-button-gap-xl: initial;
34
+ --so-button-gap-2xl: initial;
35
35
 
36
36
  /* The font of a Button counts from the font of the place, which `normal`
37
37
  * takes as is: `sm` is 2px smaller, `lg`, `xl` and `2xl` 2px, 4px and 8px
@@ -100,40 +100,55 @@
100
100
  --so-disabled-opacity: 1;
101
101
  }
102
102
 
103
+ /* Resolve the scaled spacing unit on each consuming node to preserve local settings. */
104
+ .so-button {
105
+ --so-button-space: calc(var(--so-spacing, 0.25rem) * var(--so-button-spacing-factor, 1));
106
+ }
107
+
103
108
  .so-button--size-sm {
109
+ --so-button-spacing-factor: var(--so-button-spacing-scale, var(--so-control-scale-sm, 1));
104
110
  height: var(--so-button-height-sm);
105
- padding-inline: var(--so-button-padding-sm);
106
- gap: var(--so-button-gap-sm);
111
+ padding-inline: var(--so-button-padding-sm, calc(var(--so-button-space) * 2.5));
112
+ gap: var(--so-button-gap-sm, calc(var(--so-button-space) * 1.5));
107
113
  font-size: var(--so-button-font-size-sm);
108
114
  line-height: var(--so-button-line-height-sm);
109
115
  }
110
116
 
111
117
  .so-button--size-normal {
112
118
  height: var(--so-button-height-normal);
113
- padding-inline: var(--so-button-padding-normal);
114
- gap: var(--so-button-gap-normal);
119
+ padding-inline: var(--so-button-padding-normal, calc(var(--so-button-space) * 2.5));
120
+ gap: var(--so-button-gap-normal, calc(var(--so-button-space) * 1.5));
115
121
  }
116
122
 
117
123
  .so-button--size-lg {
124
+ --so-button-spacing-factor: var(--so-button-spacing-scale, var(--so-control-scale-lg, 1));
118
125
  height: var(--so-button-height-lg);
119
- padding-inline: var(--so-button-padding-lg);
120
- gap: var(--so-button-gap-lg);
126
+ padding-inline: var(--so-button-padding-lg, calc(var(--so-button-space) * 2.5));
127
+ gap: var(--so-button-gap-lg, calc(var(--so-button-space) * 1.5));
121
128
  font-size: var(--so-button-font-size-lg);
122
129
  line-height: var(--so-button-line-height-lg);
123
130
  }
124
131
 
125
132
  .so-button--size-xl {
133
+ --so-button-spacing-factor: var(--so-button-spacing-scale, var(--so-control-scale-xl, 1));
126
134
  height: var(--so-button-height-xl);
127
- padding-inline: var(--so-button-padding-xl);
128
- gap: var(--so-button-gap-xl);
135
+ padding-inline: var(--so-button-padding-xl, calc(var(--so-button-space) * 2.5));
136
+ gap: var(--so-button-gap-xl, calc(var(--so-button-space) * 1.5));
129
137
  font-size: var(--so-button-font-size-xl);
130
138
  line-height: var(--so-button-line-height-xl);
131
139
  }
132
140
 
133
141
  .so-button--size-2xl {
142
+ --so-button-spacing-factor: var(--so-button-spacing-scale, var(--so-control-scale-2xl, 1));
134
143
  height: var(--so-button-height-2xl);
135
- padding-inline: var(--so-button-padding-2xl);
136
- gap: var(--so-button-gap-2xl);
144
+ padding-inline: var(--so-button-padding-2xl, calc(var(--so-button-space) * 2.5));
145
+ gap: var(--so-button-gap-2xl, calc(var(--so-button-space) * 1.5));
137
146
  font-size: var(--so-button-font-size-2xl);
138
147
  line-height: var(--so-button-line-height-2xl);
139
148
  }
149
+
150
+ /* Use the normal family scale when the size modifier is absent. */
151
+ :where(.so-button),
152
+ .so-button--size-normal {
153
+ --so-button-spacing-factor: var(--so-button-spacing-scale, var(--so-control-scale-normal, 1));
154
+ }