opui-css 5.0.0 → 5.0.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.
Files changed (114) hide show
  1. package/CHANGELOG.md +282 -276
  2. package/LICENSE +21 -21
  3. package/MIGRATING.md +127 -127
  4. package/README.md +87 -87
  5. package/astro/index.ts +46 -46
  6. package/components/AGENTS.md +248 -248
  7. package/components/Accordion/Accordion.astro +42 -42
  8. package/components/Anchor/Anchor.astro +51 -51
  9. package/components/Avatar/Avatar.astro +38 -38
  10. package/components/Badge/Badge.astro +59 -59
  11. package/components/Button/Button.astro +45 -45
  12. package/components/ButtonGroup/ButtonGroup.astro +29 -29
  13. package/components/Callout/Callout.astro +75 -75
  14. package/components/Card/Card.astro +36 -36
  15. package/components/Checkbox/Checkbox.astro +76 -76
  16. package/components/Checkbox/CheckboxInput.astro +32 -32
  17. package/components/Chip/Chip.astro +37 -37
  18. package/components/ClassicSelect/ClassicSelect.astro +83 -83
  19. package/components/DescriptionList/Description.astro +12 -12
  20. package/components/DescriptionList/DescriptionList.astro +22 -22
  21. package/components/DescriptionList/Item.astro +12 -12
  22. package/components/DescriptionList/Term.astro +12 -12
  23. package/components/DescriptionList/index.ts +12 -12
  24. package/components/Dialog/Dialog.astro +41 -41
  25. package/components/Divider/Divider.astro +17 -17
  26. package/components/Drawer/Drawer.astro +49 -49
  27. package/components/Drawer/DrawerFooter.astro +14 -14
  28. package/components/Drawer/DrawerHeader.astro +31 -31
  29. package/components/FieldDescription/FieldDescription.astro +13 -13
  30. package/components/FieldGroup/FieldGroup.astro +31 -31
  31. package/components/FieldLegend/FieldLegend.astro +15 -15
  32. package/components/FieldSet/FieldSet.astro +15 -15
  33. package/components/Form/Form.astro +15 -15
  34. package/components/IconButton/IconButton.astro +26 -26
  35. package/components/List/List.astro +36 -36
  36. package/components/ListItem/ListItem.astro +118 -118
  37. package/components/Progress/Progress.astro +41 -40
  38. package/components/Radio/Radio.astro +70 -70
  39. package/components/Radio/RadioInput.astro +24 -24
  40. package/components/Range/Range.astro +136 -136
  41. package/components/Select/Select.astro +106 -106
  42. package/components/Switch/Switch.astro +101 -101
  43. package/components/Switch/SwitchInput.astro +25 -25
  44. package/components/Table/Body.astro +13 -13
  45. package/components/Table/Cell.astro +13 -13
  46. package/components/Table/Column.astro +15 -15
  47. package/components/Table/ColumnGroup.astro +13 -13
  48. package/components/Table/Head.astro +13 -13
  49. package/components/Table/HeaderCell.astro +13 -13
  50. package/components/Table/Row.astro +13 -13
  51. package/components/Table/Table.astro +18 -18
  52. package/components/Table/index.ts +20 -20
  53. package/components/Tabs/Tabs.astro +28 -28
  54. package/components/Tabs/TabsItem.astro +47 -47
  55. package/components/Tabs/TabsPanel.astro +21 -21
  56. package/components/Tabs/TabsTab.astro +19 -19
  57. package/components/Tabs/index.ts +14 -14
  58. package/components/TextField/TextField.astro +128 -128
  59. package/components/Textarea/Textarea.astro +106 -106
  60. package/components/Toast/Toast.astro +42 -42
  61. package/components/ToggleButton/ToggleButton.astro +53 -53
  62. package/components/ToggleGroup/ToggleGroup.astro +49 -49
  63. package/components/Tooltip/Tooltip.astro +30 -30
  64. package/core/normalize.css +194 -194
  65. package/core/palette.css +59 -59
  66. package/core/utils.css +71 -71
  67. package/css/components/accordion.css +174 -174
  68. package/css/components/anchor.css +27 -27
  69. package/css/components/avatar.css +65 -65
  70. package/css/components/badge.css +107 -107
  71. package/css/components/button-group.css +179 -179
  72. package/css/components/button.css +215 -215
  73. package/css/components/callout.css +109 -109
  74. package/css/components/card.css +117 -117
  75. package/css/components/checkbox.css +205 -205
  76. package/css/components/chip.css +87 -87
  77. package/css/components/description-list.css +80 -80
  78. package/css/components/dialog.css +68 -68
  79. package/css/components/divider.css +20 -20
  80. package/css/components/drawer.css +171 -171
  81. package/css/components/form.css +146 -146
  82. package/css/components/icon-button.css +139 -139
  83. package/css/components/link.css +21 -21
  84. package/css/components/list.css +345 -345
  85. package/css/components/progress.css +102 -97
  86. package/css/components/radio.css +172 -172
  87. package/css/components/range.css +337 -337
  88. package/css/components/select.css +169 -169
  89. package/css/components/spinner.css +37 -37
  90. package/css/components/switch.css +268 -268
  91. package/css/components/table.css +179 -179
  92. package/css/components/tabs.css +83 -83
  93. package/css/components/text-field.css +450 -450
  94. package/css/components/text-input.css +64 -64
  95. package/css/components/textarea.css +24 -24
  96. package/css/components/toast.css +161 -161
  97. package/css/components/toggle-button.css +87 -87
  98. package/css/components/toggle-group.css +56 -56
  99. package/css/components/tooltip.css +67 -67
  100. package/css/components/typography.css +585 -585
  101. package/css/components.css +41 -41
  102. package/css/imports.css +16 -16
  103. package/css/js/checkbox.js +21 -21
  104. package/css/js/toast.js +94 -94
  105. package/css/theme.css +132 -132
  106. package/dist/op.css +65 -65
  107. package/dist/op.css.map +1 -1
  108. package/dist/opui.components.css +5159 -5154
  109. package/dist/opui.components.css.map +1 -1
  110. package/dist/opui.css +5668 -5663
  111. package/dist/opui.css.map +1 -1
  112. package/env.d.ts +14 -14
  113. package/open-props.css +9 -9
  114. package/package.json +81 -81
@@ -1,64 +1,64 @@
1
- @layer components.extended {
2
-
3
- :where(.ui-text-field:has( :where(input[type="date"],
4
- input[type="datetime-local"],
5
- input[type="email"],
6
- input[type="month"],
7
- input[type="number"],
8
- input[type="password"],
9
- input[type="search"],
10
- input[type="tel"],
11
- input[type="text"],
12
- input[type="time"],
13
- input[type="url"],
14
- input[type="week"]))) {
15
-
16
- /* Sizes */
17
- &.ui-small {
18
- input {
19
- padding-inline: var(--size-2);
20
- }
21
- }
22
- }
23
-
24
- /* Autosuggest */
25
- :where(.ui-text-field:has(input[list])) {
26
- .ui-field {
27
- position: relative;
28
- }
29
-
30
- /* Hide native arrow */
31
- input[list]::-webkit-calendar-picker-indicator {
32
- cursor: pointer;
33
- opacity: 0;
34
- pointer-events: none;
35
- position: absolute;
36
- }
37
-
38
- input[list] {
39
- padding-inline-end: var(--size-8);
40
- }
41
-
42
- .ui-field::after {
43
- block-size: 0;
44
- border-block-start: 5px solid;
45
- border-inline: 5px solid transparent;
46
- content: "";
47
- inline-size: 0;
48
- inset: 50% var(--size-3) auto auto;
49
- pointer-events: none;
50
- position: absolute;
51
- translate: 0 -50%;
52
- }
53
-
54
- &.ui-small {
55
- input[list] {
56
- padding-inline-end: var(--size-7);
57
- }
58
-
59
- .ui-field::after {
60
- inset-inline-end: var(--size-2);
61
- }
62
- }
63
- }
64
- }
1
+ @layer components.extended {
2
+
3
+ :where(.ui-text-field:has( :where(input[type="date"],
4
+ input[type="datetime-local"],
5
+ input[type="email"],
6
+ input[type="month"],
7
+ input[type="number"],
8
+ input[type="password"],
9
+ input[type="search"],
10
+ input[type="tel"],
11
+ input[type="text"],
12
+ input[type="time"],
13
+ input[type="url"],
14
+ input[type="week"]))) {
15
+
16
+ /* Sizes */
17
+ &.ui-small {
18
+ input {
19
+ padding-inline: var(--size-2);
20
+ }
21
+ }
22
+ }
23
+
24
+ /* Autosuggest */
25
+ :where(.ui-text-field:has(input[list])) {
26
+ .ui-field {
27
+ position: relative;
28
+ }
29
+
30
+ /* Hide native arrow */
31
+ input[list]::-webkit-calendar-picker-indicator {
32
+ cursor: pointer;
33
+ opacity: 0;
34
+ pointer-events: none;
35
+ position: absolute;
36
+ }
37
+
38
+ input[list] {
39
+ padding-inline-end: var(--size-8);
40
+ }
41
+
42
+ .ui-field::after {
43
+ block-size: 0;
44
+ border-block-start: 5px solid;
45
+ border-inline: 5px solid transparent;
46
+ content: "";
47
+ inline-size: 0;
48
+ inset: 50% var(--size-3) auto auto;
49
+ pointer-events: none;
50
+ position: absolute;
51
+ translate: 0 -50%;
52
+ }
53
+
54
+ &.ui-small {
55
+ input[list] {
56
+ padding-inline-end: var(--size-7);
57
+ }
58
+
59
+ .ui-field::after {
60
+ inset-inline-end: var(--size-2);
61
+ }
62
+ }
63
+ }
64
+ }
@@ -1,24 +1,24 @@
1
- @layer components.extended {
2
- :where(.ui-textarea) {
3
- textarea {
4
- block-size: auto;
5
- field-sizing: content;
6
- min-block-size: calc(var(--_field-padding-block) * 2 + (var(--border-width) * 2) + 3lh);
7
- resize: vertical;
8
- }
9
-
10
- /* Size */
11
- &.ui-small {
12
- textarea {
13
- min-block-size: var(--size-9);
14
- }
15
- }
16
-
17
- /* Auto-fit */
18
- &.ui-auto-fit {
19
- textarea {
20
- resize: both;
21
- }
22
- }
23
- }
24
- }
1
+ @layer components.extended {
2
+ :where(.ui-textarea) {
3
+ textarea {
4
+ block-size: auto;
5
+ field-sizing: content;
6
+ min-block-size: calc(var(--_field-padding-block) * 2 + (var(--border-width) * 2) + 3lh);
7
+ resize: vertical;
8
+ }
9
+
10
+ /* Size */
11
+ &.ui-small {
12
+ textarea {
13
+ min-block-size: var(--size-9);
14
+ }
15
+ }
16
+
17
+ /* Auto-fit */
18
+ &.ui-auto-fit {
19
+ textarea {
20
+ resize: both;
21
+ }
22
+ }
23
+ }
24
+ }
@@ -1,161 +1,161 @@
1
- @layer components.extended {
2
- :where(#toast-manager) {
3
- background: none;
4
- block-size: auto;
5
- border: none;
6
- display: none;
7
- flex-direction: column-reverse;
8
- gap: var(--size-3);
9
- inline-size: auto;
10
- inset: auto var(--size-4) var(--size-4) auto;
11
- margin: 0;
12
- max-inline-size: calc(100vi - var(--size-8));
13
- overflow: visible;
14
- padding: 0;
15
- pointer-events: none;
16
- position: fixed;
17
- z-index: 1000;
18
-
19
- &:popover-open {
20
- display: flex;
21
- }
22
-
23
- &::backdrop {
24
- display: none;
25
- }
26
-
27
- /* Optional cap on visible toasts. Older toasts beyond this depth are hidden
28
- but still in the DOM so they animate cleanly when newer ones are removed. */
29
- /* > .toast:nth-last-child(n + 6) { display: none; } */
30
- }
31
-
32
- :where(.ui-toast) {
33
- --_anim-enter: 0.3s;
34
- --_anim-exit: 0.3s;
35
-
36
- align-items: center;
37
- animation:
38
- toast-enter var(--_anim-enter) var(--ease-out-3) both,
39
- toast-hold attr(data-duration type(<time>), 5s) linear both,
40
- toast-exit var(--_anim-exit) var(--ease-in-3) both;
41
- animation-delay:
42
- 0s,
43
- var(--_anim-enter),
44
- calc(var(--_anim-enter) + attr(data-duration type(<time>), 5s));
45
- background-color: light-dark(var(--gray-15), var(--gray-2));
46
- border-radius: var(--border-radius);
47
- box-shadow: var(--shadow-3);
48
- color: var(--text-primary-contrast);
49
- display: flex;
50
- gap: var(--size-3);
51
- justify-content: space-between;
52
- min-inline-size: 30ch;
53
- padding: var(--size-3) var(--size-4);
54
- pointer-events: auto;
55
-
56
- &:hover {
57
- animation-play-state: paused;
58
- }
59
-
60
- &.ui-exiting {
61
- animation: toast-exit var(--_anim-exit) var(--ease-in-3) forwards;
62
- }
63
-
64
- .ui-icon {
65
- background: no-repeat center / contain;
66
- block-size: var(--size-4);
67
- flex-shrink: 0;
68
- inline-size: var(--size-4);
69
- }
70
-
71
- /* Hide the icon slot when there's no severity to render against. */
72
- &:not([data-severity]) .ui-icon {
73
- display: none;
74
- }
75
-
76
- .ui-content {
77
- font-size: var(--font-size-05);
78
- word-break: break-word;
79
- }
80
-
81
- .ui-title {
82
- font-weight: 600;
83
- }
84
-
85
- .ui-description {
86
- color: oklch(from currentColor l c h / 75%);
87
- font-size: var(--font-size-0);
88
- }
89
-
90
- .ui-close-button {
91
- background: none;
92
- border: none;
93
- color: inherit;
94
- cursor: pointer;
95
- display: grid;
96
- opacity: 0.7;
97
- padding: var(--size-1);
98
- place-items: center;
99
- transition: opacity 0.2s;
100
-
101
- &:hover {
102
- opacity: 1;
103
- }
104
- }
105
-
106
- /* Severity icons via CSS data URIs — keeps icon assets out of JS strings. */
107
- &[data-severity="success"] .ui-icon {
108
- background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/><path d='m9 11 3 3L22 4'/></svg>");
109
- }
110
-
111
- &[data-severity="info"] .ui-icon {
112
- background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M12 16v-4'/><path d='M12 8h.01'/></svg>");
113
- }
114
-
115
- &[data-severity="warning"] .ui-icon {
116
- background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/><path d='M12 9v4'/><path d='M12 17h.01'/></svg>");
117
- }
118
-
119
- &[data-severity="critical"] .ui-icon {
120
- background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='m15 9-6 6'/><path d='m9 9 6 6'/></svg>");
121
- }
122
- }
123
-
124
- @keyframes toast-enter {
125
- from {
126
- opacity: 0;
127
- translate: var(--size-4) 0;
128
- }
129
-
130
- to {
131
- opacity: 1;
132
- translate: 0 0;
133
- }
134
- }
135
-
136
- /* Identity keyframe — only purpose is to delay the exit animation by the
137
- author-defined duration. */
138
- @keyframes toast-hold {
139
- from {
140
- opacity: 1;
141
- }
142
-
143
- to {
144
- opacity: 1;
145
- }
146
- }
147
-
148
- @keyframes toast-exit {
149
- from {
150
- opacity: 1;
151
- scale: 1;
152
- translate: 0 0;
153
- }
154
-
155
- to {
156
- opacity: 0;
157
- scale: 0.9;
158
- translate: 0 var(--size-4);
159
- }
160
- }
161
- }
1
+ @layer components.extended {
2
+ :where(#toast-manager) {
3
+ background: none;
4
+ block-size: auto;
5
+ border: none;
6
+ display: none;
7
+ flex-direction: column-reverse;
8
+ gap: var(--size-3);
9
+ inline-size: auto;
10
+ inset: auto var(--size-4) var(--size-4) auto;
11
+ margin: 0;
12
+ max-inline-size: calc(100vi - var(--size-8));
13
+ overflow: visible;
14
+ padding: 0;
15
+ pointer-events: none;
16
+ position: fixed;
17
+ z-index: 1000;
18
+
19
+ &:popover-open {
20
+ display: flex;
21
+ }
22
+
23
+ &::backdrop {
24
+ display: none;
25
+ }
26
+
27
+ /* Optional cap on visible toasts. Older toasts beyond this depth are hidden
28
+ but still in the DOM so they animate cleanly when newer ones are removed. */
29
+ /* > .toast:nth-last-child(n + 6) { display: none; } */
30
+ }
31
+
32
+ :where(.ui-toast) {
33
+ --_anim-enter: 0.3s;
34
+ --_anim-exit: 0.3s;
35
+
36
+ align-items: center;
37
+ animation:
38
+ toast-enter var(--_anim-enter) var(--ease-out-3) both,
39
+ toast-hold attr(data-duration type(<time>), 5s) linear both,
40
+ toast-exit var(--_anim-exit) var(--ease-in-3) both;
41
+ animation-delay:
42
+ 0s,
43
+ var(--_anim-enter),
44
+ calc(var(--_anim-enter) + attr(data-duration type(<time>), 5s));
45
+ background-color: light-dark(var(--gray-15), var(--gray-2));
46
+ border-radius: var(--border-radius);
47
+ box-shadow: var(--shadow-3);
48
+ color: var(--text-primary-contrast);
49
+ display: flex;
50
+ gap: var(--size-3);
51
+ justify-content: space-between;
52
+ min-inline-size: 30ch;
53
+ padding: var(--size-3) var(--size-4);
54
+ pointer-events: auto;
55
+
56
+ &:hover {
57
+ animation-play-state: paused;
58
+ }
59
+
60
+ &.ui-exiting {
61
+ animation: toast-exit var(--_anim-exit) var(--ease-in-3) forwards;
62
+ }
63
+
64
+ .ui-icon {
65
+ background: no-repeat center / contain;
66
+ block-size: var(--size-4);
67
+ flex-shrink: 0;
68
+ inline-size: var(--size-4);
69
+ }
70
+
71
+ /* Hide the icon slot when there's no severity to render against. */
72
+ &:not([data-severity]) .ui-icon {
73
+ display: none;
74
+ }
75
+
76
+ .ui-content {
77
+ font-size: var(--font-size-05);
78
+ word-break: break-word;
79
+ }
80
+
81
+ .ui-title {
82
+ font-weight: 600;
83
+ }
84
+
85
+ .ui-description {
86
+ color: oklch(from currentColor l c h / 75%);
87
+ font-size: var(--font-size-0);
88
+ }
89
+
90
+ .ui-close-button {
91
+ background: none;
92
+ border: none;
93
+ color: inherit;
94
+ cursor: pointer;
95
+ display: grid;
96
+ opacity: 0.7;
97
+ padding: var(--size-1);
98
+ place-items: center;
99
+ transition: opacity 0.2s;
100
+
101
+ &:hover {
102
+ opacity: 1;
103
+ }
104
+ }
105
+
106
+ /* Severity icons via CSS data URIs — keeps icon assets out of JS strings. */
107
+ &[data-severity="success"] .ui-icon {
108
+ background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2322c55e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/><path d='m9 11 3 3L22 4'/></svg>");
109
+ }
110
+
111
+ &[data-severity="info"] .ui-icon {
112
+ background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%233b82f6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M12 16v-4'/><path d='M12 8h.01'/></svg>");
113
+ }
114
+
115
+ &[data-severity="warning"] .ui-icon {
116
+ background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/><path d='M12 9v4'/><path d='M12 17h.01'/></svg>");
117
+ }
118
+
119
+ &[data-severity="critical"] .ui-icon {
120
+ background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ef4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='m15 9-6 6'/><path d='m9 9 6 6'/></svg>");
121
+ }
122
+ }
123
+
124
+ @keyframes toast-enter {
125
+ from {
126
+ opacity: 0;
127
+ translate: var(--size-4) 0;
128
+ }
129
+
130
+ to {
131
+ opacity: 1;
132
+ translate: 0 0;
133
+ }
134
+ }
135
+
136
+ /* Identity keyframe — only purpose is to delay the exit animation by the
137
+ author-defined duration. */
138
+ @keyframes toast-hold {
139
+ from {
140
+ opacity: 1;
141
+ }
142
+
143
+ to {
144
+ opacity: 1;
145
+ }
146
+ }
147
+
148
+ @keyframes toast-exit {
149
+ from {
150
+ opacity: 1;
151
+ scale: 1;
152
+ translate: 0 0;
153
+ }
154
+
155
+ to {
156
+ opacity: 0;
157
+ scale: 0.9;
158
+ translate: 0 var(--size-4);
159
+ }
160
+ }
161
+ }
@@ -1,87 +1,87 @@
1
- /* TODO:
2
- * Somehow handle when a group gets too wide for its container. Should it be handled?
3
- */
4
- @layer components.root {
5
- :where(.ui-toggle-button) {
6
- --_button-bg-color: transparent;
7
- --_size: var(--field-size);
8
- --_svg-size: var(--size-4);
9
-
10
- align-items: center;
11
- background-color: var(--_button-bg-color);
12
- block-size: var(--_size);
13
- border: 1px solid var(--border-color);
14
- border-radius: var(--button-border-radius);
15
- color: var(--text-primary);
16
- cursor: pointer;
17
- display: inline-flex;
18
- flex: auto;
19
- gap: var(--size-2);
20
- inline-size: fit-content;
21
- justify-content: center;
22
- min-inline-size: var(--_size);
23
- outline-offset: calc(-1 * var(--size-2));
24
- padding: 0 var(--size-2);
25
- position: relative;
26
- user-select: none;
27
-
28
- input[type="checkbox"],
29
- input[type="radio"] {
30
- /* utils.css > .ui-sr-only */
31
- block-size: 1px;
32
- clip-path: inset(50%);
33
- inline-size: 1px;
34
- overflow: hidden;
35
- position: absolute;
36
- white-space: nowrap;
37
- }
38
-
39
- /* Element states */
40
- @media (pointer: fine) {
41
- &:hover:not(.ui-disabled) {
42
- --_button-bg-color: light-dark(oklch(0% 0 0 / 0.04), oklch(100% 0 0 / 0.08));
43
- }
44
- }
45
-
46
- &:has(input:focus-visible) {
47
- --focus-ring-color: var(--text-muted);
48
- --focus-ring-offset: -6px;
49
- outline: var(--focus-ring-width) var(--focus-ring-style) var(--focus-ring-color);
50
- outline-offset: var(--focus-ring-offset);
51
- }
52
-
53
- /* Disabled */
54
- &.ui-disabled {
55
- border-color: color-mix(in oklch, var(--border-color) 50%, transparent);
56
- color: color-mix(in oklch, var(--text-primary) 30%, transparent);
57
- cursor: not-allowed;
58
- }
59
-
60
- /* svgs */
61
- svg {
62
- block-size: var(--_svg-size);
63
- flex-shrink: 0;
64
- inline-size: var(--_svg-size);
65
- }
66
-
67
- /* Selected */
68
- &:has(:where(input[type="checkbox"], input[type="radio"]):checked) {
69
- --_button-bg-color: oklch(from var(--primary) l c h / 25%);
70
-
71
- @media (pointer: fine) {
72
- &:hover {
73
- --_button-bg-color: oklch(from var(--primary) l c h / 35%);
74
- }
75
- }
76
- }
77
-
78
- /* Sizes */
79
- &.ui-small {
80
- --_size: var(--field-size-small);
81
- }
82
-
83
- &.ui-x-small {
84
- --_size: var(--field-size-x-small);
85
- }
86
- }
87
- }
1
+ /* TODO:
2
+ * Somehow handle when a group gets too wide for its container. Should it be handled?
3
+ */
4
+ @layer components.root {
5
+ :where(.ui-toggle-button) {
6
+ --_button-bg-color: transparent;
7
+ --_size: var(--field-size);
8
+ --_svg-size: var(--size-4);
9
+
10
+ align-items: center;
11
+ background-color: var(--_button-bg-color);
12
+ block-size: var(--_size);
13
+ border: 1px solid var(--border-color);
14
+ border-radius: var(--button-border-radius);
15
+ color: var(--text-primary);
16
+ cursor: pointer;
17
+ display: inline-flex;
18
+ flex: auto;
19
+ gap: var(--size-2);
20
+ inline-size: fit-content;
21
+ justify-content: center;
22
+ min-inline-size: var(--_size);
23
+ outline-offset: calc(-1 * var(--size-2));
24
+ padding: 0 var(--size-2);
25
+ position: relative;
26
+ user-select: none;
27
+
28
+ input[type="checkbox"],
29
+ input[type="radio"] {
30
+ /* utils.css > .ui-sr-only */
31
+ block-size: 1px;
32
+ clip-path: inset(50%);
33
+ inline-size: 1px;
34
+ overflow: hidden;
35
+ position: absolute;
36
+ white-space: nowrap;
37
+ }
38
+
39
+ /* Element states */
40
+ @media (pointer: fine) {
41
+ &:hover:not(.ui-disabled) {
42
+ --_button-bg-color: light-dark(oklch(0% 0 0 / 0.04), oklch(100% 0 0 / 0.08));
43
+ }
44
+ }
45
+
46
+ &:has(input:focus-visible) {
47
+ --focus-ring-color: var(--text-muted);
48
+ --focus-ring-offset: -6px;
49
+ outline: var(--focus-ring-width) var(--focus-ring-style) var(--focus-ring-color);
50
+ outline-offset: var(--focus-ring-offset);
51
+ }
52
+
53
+ /* Disabled */
54
+ &.ui-disabled {
55
+ border-color: color-mix(in oklch, var(--border-color) 50%, transparent);
56
+ color: color-mix(in oklch, var(--text-primary) 30%, transparent);
57
+ cursor: not-allowed;
58
+ }
59
+
60
+ /* svgs */
61
+ svg {
62
+ block-size: var(--_svg-size);
63
+ flex-shrink: 0;
64
+ inline-size: var(--_svg-size);
65
+ }
66
+
67
+ /* Selected */
68
+ &:has(:where(input[type="checkbox"], input[type="radio"]):checked) {
69
+ --_button-bg-color: oklch(from var(--primary) l c h / 25%);
70
+
71
+ @media (pointer: fine) {
72
+ &:hover {
73
+ --_button-bg-color: oklch(from var(--primary) l c h / 35%);
74
+ }
75
+ }
76
+ }
77
+
78
+ /* Sizes */
79
+ &.ui-small {
80
+ --_size: var(--field-size-small);
81
+ }
82
+
83
+ &.ui-x-small {
84
+ --_size: var(--field-size-x-small);
85
+ }
86
+ }
87
+ }