opui-css 3.3.5 → 4.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 (174) hide show
  1. package/CHANGELOG.md +241 -0
  2. package/LICENSE +21 -21
  3. package/MIGRATING.md +105 -0
  4. package/README.md +66 -29
  5. package/astro/index.ts +46 -0
  6. package/components/AGENTS.md +247 -0
  7. package/components/Accordion/Accordion.astro +42 -0
  8. package/components/Anchor/Anchor.astro +51 -0
  9. package/components/Avatar/Avatar.astro +44 -0
  10. package/components/Badge/Badge.astro +54 -0
  11. package/components/Button/Button.astro +45 -0
  12. package/components/ButtonGroup/ButtonGroup.astro +29 -0
  13. package/components/Callout/Callout.astro +75 -0
  14. package/components/Card/Card.astro +38 -0
  15. package/components/Checkbox/Checkbox.astro +76 -0
  16. package/components/Checkbox/CheckboxInput.astro +32 -0
  17. package/components/Chip/Chip.astro +37 -0
  18. package/components/ClassicSelect/ClassicSelect.astro +83 -0
  19. package/components/DescriptionList/Description.astro +12 -0
  20. package/components/DescriptionList/DescriptionList.astro +22 -0
  21. package/components/DescriptionList/Item.astro +12 -0
  22. package/components/DescriptionList/Term.astro +12 -0
  23. package/components/DescriptionList/index.ts +12 -0
  24. package/components/Dialog/Dialog.astro +43 -0
  25. package/components/Divider/Divider.astro +14 -0
  26. package/components/Drawer/Drawer.astro +49 -0
  27. package/components/Drawer/DrawerFooter.astro +14 -0
  28. package/components/Drawer/DrawerHeader.astro +31 -0
  29. package/components/FieldDescription/FieldDescription.astro +13 -0
  30. package/components/FieldGroup/FieldGroup.astro +31 -0
  31. package/components/FieldLegend/FieldLegend.astro +15 -0
  32. package/components/FieldSet/FieldSet.astro +15 -0
  33. package/components/Form/Form.astro +15 -0
  34. package/components/IconButton/IconButton.astro +26 -0
  35. package/components/List/List.astro +36 -0
  36. package/components/ListItem/ListItem.astro +118 -0
  37. package/components/Progress/Progress.astro +40 -0
  38. package/components/Radio/Radio.astro +70 -0
  39. package/components/Radio/RadioInput.astro +24 -0
  40. package/components/Range/Range.astro +136 -0
  41. package/components/Select/Select.astro +106 -0
  42. package/components/Switch/Switch.astro +101 -0
  43. package/components/Switch/SwitchInput.astro +25 -0
  44. package/components/Table/Body.astro +13 -0
  45. package/components/Table/Cell.astro +13 -0
  46. package/components/Table/Column.astro +15 -0
  47. package/components/Table/ColumnGroup.astro +13 -0
  48. package/components/Table/Head.astro +13 -0
  49. package/components/Table/HeaderCell.astro +13 -0
  50. package/components/Table/Row.astro +13 -0
  51. package/components/Table/Table.astro +15 -0
  52. package/components/Table/index.ts +20 -0
  53. package/components/Tabs/Tabs.astro +28 -0
  54. package/components/Tabs/TabsItem.astro +47 -0
  55. package/components/Tabs/TabsPanel.astro +21 -0
  56. package/components/Tabs/TabsTab.astro +19 -0
  57. package/components/Tabs/index.ts +14 -0
  58. package/components/TextField/TextField.astro +128 -0
  59. package/components/Textarea/Textarea.astro +106 -0
  60. package/components/Toast/Toast.astro +42 -0
  61. package/components/ToggleButton/ToggleButton.astro +53 -0
  62. package/components/ToggleGroup/ToggleGroup.astro +49 -0
  63. package/components/Tooltip/Tooltip.astro +30 -0
  64. package/{src/core → core}/normalize.css +194 -196
  65. package/core/palette.css +59 -0
  66. package/{src/core → core}/utils.css +71 -60
  67. package/css/components/accordion.css +174 -0
  68. package/css/components/anchor.css +27 -0
  69. package/{src/themes/theme-two → css}/components/avatar.css +65 -68
  70. package/css/components/badge.css +107 -0
  71. package/css/components/button-group.css +179 -0
  72. package/css/components/button.css +215 -0
  73. package/css/components/callout.css +109 -0
  74. package/css/components/card.css +117 -0
  75. package/css/components/checkbox.css +205 -0
  76. package/{src/themes/theme-one → css}/components/chip.css +87 -135
  77. package/{src/themes/theme-two/components/definition-list.css → css/components/description-list.css} +77 -68
  78. package/{src/themes/theme-two → css}/components/dialog.css +68 -59
  79. package/css/components/divider.css +20 -0
  80. package/css/components/drawer.css +171 -0
  81. package/css/components/form.css +146 -0
  82. package/css/components/icon-button.css +139 -0
  83. package/{src/themes/theme-two → css}/components/link.css +21 -21
  84. package/{src/themes/theme-two → css}/components/list.css +345 -318
  85. package/{src/themes/theme-one → css}/components/progress.css +97 -83
  86. package/css/components/radio.css +172 -0
  87. package/css/components/range.css +337 -0
  88. package/{src/themes/theme-two → css}/components/select.css +169 -162
  89. package/{src/themes/theme-two → css}/components/spinner.css +37 -38
  90. package/{src/themes/theme-two → css}/components/switch.css +268 -225
  91. package/css/components/table.css +179 -0
  92. package/css/components/tabs.css +77 -0
  93. package/css/components/text-field.css +450 -0
  94. package/css/components/text-input.css +64 -0
  95. package/{src/themes/theme-two → css}/components/textarea.css +24 -25
  96. package/css/components/toast.css +161 -0
  97. package/css/components/toggle-button.css +87 -0
  98. package/css/components/toggle-group.css +56 -0
  99. package/css/components/tooltip.css +67 -0
  100. package/css/components/typography.css +585 -0
  101. package/{src/themes/theme-two → css}/components.css +41 -37
  102. package/{src/themes/theme-two → css}/imports.css +16 -16
  103. package/css/js/checkbox.js +21 -0
  104. package/css/js/toast.js +94 -0
  105. package/css/theme.css +132 -0
  106. package/dist/op.css +1001 -32
  107. package/dist/op.css.map +1 -0
  108. package/dist/opui.components.css +5146 -0
  109. package/dist/opui.components.css.map +1 -0
  110. package/dist/opui.css +6615 -0
  111. package/dist/opui.css.map +1 -0
  112. package/env.d.ts +14 -0
  113. package/open-props.css +9 -0
  114. package/package.json +81 -72
  115. package/dist/theme-one/components.css +0 -3869
  116. package/dist/theme-one/theme-one.css +0 -4424
  117. package/dist/theme-two/components.css +0 -3591
  118. package/dist/theme-two/theme-two.css +0 -4141
  119. package/src/open-props.css +0 -10
  120. package/src/themes/theme-one/components/accordion.css +0 -172
  121. package/src/themes/theme-one/components/alert.css +0 -85
  122. package/src/themes/theme-one/components/avatar.css +0 -68
  123. package/src/themes/theme-one/components/badge.css +0 -101
  124. package/src/themes/theme-one/components/button-group.css +0 -69
  125. package/src/themes/theme-one/components/button.css +0 -281
  126. package/src/themes/theme-one/components/card.css +0 -82
  127. package/src/themes/theme-one/components/checkbox-radio.css +0 -123
  128. package/src/themes/theme-one/components/definition-list.css +0 -68
  129. package/src/themes/theme-one/components/dialog.css +0 -59
  130. package/src/themes/theme-one/components/divider.css +0 -7
  131. package/src/themes/theme-one/components/field-group.css +0 -83
  132. package/src/themes/theme-one/components/field.css +0 -494
  133. package/src/themes/theme-one/components/icon-button.css +0 -40
  134. package/src/themes/theme-one/components/link.css +0 -21
  135. package/src/themes/theme-one/components/list.css +0 -318
  136. package/src/themes/theme-one/components/range.css +0 -121
  137. package/src/themes/theme-one/components/rich-text.css +0 -210
  138. package/src/themes/theme-one/components/select.css +0 -163
  139. package/src/themes/theme-one/components/snackbar.css +0 -148
  140. package/src/themes/theme-one/components/spinner.css +0 -38
  141. package/src/themes/theme-one/components/switch.css +0 -225
  142. package/src/themes/theme-one/components/tab-buttons.css +0 -120
  143. package/src/themes/theme-one/components/table.css +0 -92
  144. package/src/themes/theme-one/components/text-field.css +0 -57
  145. package/src/themes/theme-one/components/textarea.css +0 -25
  146. package/src/themes/theme-one/components/toggle-button-group.css +0 -135
  147. package/src/themes/theme-one/components/tooltip.css +0 -94
  148. package/src/themes/theme-one/components/typography.css +0 -209
  149. package/src/themes/theme-one/components.css +0 -37
  150. package/src/themes/theme-one/imports.css +0 -16
  151. package/src/themes/theme-one/theme.css +0 -163
  152. package/src/themes/theme-two/components/accordion.css +0 -172
  153. package/src/themes/theme-two/components/alert.css +0 -85
  154. package/src/themes/theme-two/components/badge.css +0 -101
  155. package/src/themes/theme-two/components/button-group.css +0 -50
  156. package/src/themes/theme-two/components/button.css +0 -229
  157. package/src/themes/theme-two/components/card.css +0 -82
  158. package/src/themes/theme-two/components/checkbox-radio.css +0 -123
  159. package/src/themes/theme-two/components/chip.css +0 -135
  160. package/src/themes/theme-two/components/divider.css +0 -7
  161. package/src/themes/theme-two/components/field-group.css +0 -83
  162. package/src/themes/theme-two/components/field.css +0 -281
  163. package/src/themes/theme-two/components/icon-button.css +0 -40
  164. package/src/themes/theme-two/components/progress.css +0 -83
  165. package/src/themes/theme-two/components/range.css +0 -121
  166. package/src/themes/theme-two/components/rich-text.css +0 -210
  167. package/src/themes/theme-two/components/snackbar.css +0 -148
  168. package/src/themes/theme-two/components/tab-buttons.css +0 -120
  169. package/src/themes/theme-two/components/table.css +0 -99
  170. package/src/themes/theme-two/components/text-field.css +0 -57
  171. package/src/themes/theme-two/components/toggle-button-group.css +0 -135
  172. package/src/themes/theme-two/components/tooltip.css +0 -94
  173. package/src/themes/theme-two/components/typography.css +0 -209
  174. package/src/themes/theme-two/theme.css +0 -158
@@ -0,0 +1,215 @@
1
+ @layer components.root {
2
+ :where(.button) {
3
+ --_color: light-dark(var(--color-16), var(--color-1));
4
+ --_color-contrast: light-dark(var(--color-1), var(--color-16));
5
+ --_color-tonal: var(--surface-tonal);
6
+
7
+ --_accent: var(--_color);
8
+ --_accent-contrast: var(--_color-contrast);
9
+ --_accent-tonal: var(--_color-tonal);
10
+ --_accent-tonal-contrast: var(--_color);
11
+
12
+ --_default-hover-bg-color: light-dark(oklch(from var(--_accent) l 0.01 h / 10%),
13
+ oklch(from var(--_accent) l 0.01 h / 20%));
14
+ --_default-active-bg-color: light-dark(oklch(from var(--_accent) l 0.06 h / 20%),
15
+ oklch(from var(--_accent) l 0.06 h / 30%));
16
+
17
+ --_filled-hover-bg-color: light-dark(oklch(from var(--_accent) calc(l + 0.2) c h),
18
+ oklch(from var(--_accent) calc(l - 0.1) c h));
19
+ --_filled-active-bg-color: light-dark(oklch(from var(--_accent) calc(l + 0.3) c h),
20
+ oklch(from var(--_accent) calc(l - 0.15) c h));
21
+ --_outlined-active-bg-color: var(--_filled-active-bg-color);
22
+
23
+ --_bg-color: transparent;
24
+ --_border-color: transparent;
25
+ --_border-width: var(--border-size-1);
26
+ --_font-size: var(--font-size-1);
27
+ --_min-height: var(--button-size);
28
+ --_border-radius: var(--button-border-radius, var(--radius-2));
29
+ --_text-color: var(--_accent);
30
+
31
+ -webkit-tap-highlight-color: transparent;
32
+ -webkit-touch-callout: none;
33
+ align-items: center;
34
+ background-color: var(--_bg-color);
35
+ border: var(--_border-width) solid var(--_border-color);
36
+ border-radius: var(--_border-radius);
37
+ color: var(--_text-color);
38
+ display: inline-flex;
39
+ font-size: var(--_font-size);
40
+ font-weight: 700;
41
+ gap: var(--size-2);
42
+ justify-content: center;
43
+ min-block-size: var(--_min-height);
44
+ padding-block: 0.5ex;
45
+ padding-inline: 1.5ex;
46
+ text-align: center;
47
+ text-decoration: none;
48
+ transition: background-color .1s ease, color .1s ease,
49
+ border-color .1s ease, box-shadow .1s ease;
50
+ user-select: none;
51
+
52
+ /* Colors — shared interaction model for critical and primary.
53
+ Each color modifier below only swaps --_color; the tonal surface,
54
+ contrast text, and hover/active strategy are identical.
55
+ The .critical scope class in theme.css redirects --palette-source so
56
+ --color-6 below becomes a tint of the active color. */
57
+ &.critical,
58
+ &.primary {
59
+ --_color-contrast: var(--gray-1);
60
+ --_color-tonal: var(--color-6);
61
+ --_accent-tonal-contrast: var(--text-primary-contrast);
62
+
63
+ --_default-hover-bg-color: oklch(from var(--_accent) l c h / 15%);
64
+ --_default-active-bg-color: oklch(from var(--_accent) l c h / 25%);
65
+
66
+ --_filled-hover-bg-color: oklch(from var(--_accent) calc(l - 0.1) c h);
67
+ --_filled-active-bg-color: oklch(from var(--_accent) calc(l - 0.15) c h);
68
+
69
+ --_outlined-active-bg-color: oklch(from var(--_accent) calc(l - 0.1) c h);
70
+ }
71
+
72
+ &.critical {
73
+ --_color: var(--critical);
74
+ }
75
+
76
+ &.primary {
77
+ --_color: var(--primary);
78
+ }
79
+
80
+ /* Disabled */
81
+ &:where([disabled]) {
82
+ --_text-color: color-mix(in oklch,
83
+ var(--text-muted) 50%,
84
+ var(--surface-default));
85
+
86
+ cursor: not-allowed;
87
+ opacity: 0.64;
88
+ }
89
+
90
+ /* Hover & Active */
91
+ &:where(:not([disabled])) {
92
+ &:where(:not(:active):hover) {
93
+ --_bg-color: var(--_default-hover-bg-color);
94
+ }
95
+
96
+ &:where(:hover:active),
97
+ &[aria-current="page"] {
98
+ --_bg-color: var(--_default-active-bg-color);
99
+ }
100
+ }
101
+
102
+
103
+ /* Icons / Keyboard */
104
+ &:where(:has(svg), &.icon-only) {
105
+ gap: 1ex;
106
+
107
+ svg {
108
+ color: currentColor;
109
+ max-block-size: 0.7lh;
110
+ }
111
+ }
112
+
113
+ /* Keyboard input */
114
+ :is(kbd) {
115
+ background-color: oklch(from currentColor l c h / 10%);
116
+ border: 0;
117
+ color: oklch(from currentColor l c h / 80%);
118
+ font-size: 0.8em;
119
+ font-weight: 400;
120
+ line-height: 1.2;
121
+ }
122
+
123
+ /* Sizes — heights aliased from the shared --control-size scale.
124
+ Override --button-size-* in a parent scope to resize an entire region. */
125
+ &.x-small {
126
+ --_min-height: var(--button-size-x-small);
127
+ --_font-size: var(--font-size-0);
128
+ padding-block: 0;
129
+ padding-inline: .5ex;
130
+ }
131
+
132
+ &.small {
133
+ --_min-height: var(--button-size-small);
134
+ --_font-size: var(--font-size-05);
135
+ padding-block: 0;
136
+ padding-inline: .75ex;
137
+ }
138
+
139
+ &.large {
140
+ --_min-height: var(--button-size-large);
141
+ padding-inline: 4ex;
142
+ }
143
+
144
+ /* Variants */
145
+ &.outlined {
146
+ --_bg-color: transparent;
147
+ --_border-color: var(--_accent);
148
+ --_text-color: var(--_accent);
149
+
150
+ &:where(:not([disabled])) {
151
+ &:where(:not(:active):hover) {
152
+ --_bg-color: var(--_accent);
153
+ --_border-color: var(--_accent);
154
+ --_text-color: var(--_accent-contrast);
155
+ }
156
+
157
+ &:where(:active) {
158
+ --_bg-color: var(--_outlined-active-bg-color);
159
+ --_border-color: var(--_outlined-active-bg-color);
160
+ --_text-color: var(--_accent-contrast);
161
+ }
162
+ }
163
+ }
164
+
165
+ &.tonal {
166
+ --_bg-color: var(--_accent-tonal);
167
+ --_text-color: var(--_accent-tonal-contrast);
168
+
169
+ &:where(:not([disabled])) {
170
+ &:where(:not(:active):hover) {
171
+ --_bg-color: var(--_accent);
172
+ --_text-color: var(--_accent-contrast);
173
+ }
174
+
175
+ &:where(:active) {
176
+ --_bg-color: var(--_outlined-active-bg-color);
177
+ --_text-color: var(--_accent-contrast);
178
+ }
179
+ }
180
+ }
181
+
182
+ &.filled {
183
+ --_bg-color: var(--_accent);
184
+ --_text-color: var(--_accent-contrast);
185
+
186
+ &:where(:not([disabled])) {
187
+ &:where(:not(:active):hover) {
188
+ --_bg-color: var(--_filled-hover-bg-color);
189
+ }
190
+
191
+ &:where(:active) {
192
+ --_bg-color: var(--_filled-active-bg-color);
193
+ }
194
+ }
195
+ }
196
+ }
197
+
198
+ /* file input */
199
+ :where(input[type="file"]) {
200
+ align-self: flex-start;
201
+ border: var(--border-size-1) solid var(--surface-filled);
202
+ border-radius: var(--radius-2);
203
+ box-shadow: var(--inner-shadow-4);
204
+ color: var(--text-muted-contrast);
205
+ cursor: initial;
206
+ max-inline-size: 100%;
207
+ padding: 0;
208
+ }
209
+
210
+ :where(input[type="file"])::-webkit-file-upload-button,
211
+ :where(input[type="file"])::file-selector-button {
212
+ cursor: pointer;
213
+ margin-inline-end: var(--size-relative-6);
214
+ }
215
+ }
@@ -0,0 +1,109 @@
1
+ @layer components.root {
2
+ :where(.callout) {
3
+ --_bg-color: var(--surface-tonal);
4
+ --_border-color: var(--surface-tonal);
5
+ --_color: var(--text-primary);
6
+ --_icon-color: currentColor;
7
+ --_link-hover-color: var(--primary);
8
+ --_padding: var(--size-3);
9
+ --_border-radius: var(--border-radius);
10
+ --_gap: var(--size-3);
11
+ --_content-gap: var(--size-2);
12
+ --_font-size: var(--font-size-05);
13
+ --_title-font-size: var(--font-size-1);
14
+ --_icon-size: var(--size-4);
15
+ --_surface-bg: var(--surface-default);
16
+
17
+ --_outlined-bg-color: var(--surface-default);
18
+ --_outlined-border-color: var(--border-color);
19
+ --_outlined-color: var(--text-primary);
20
+ --_outlined-icon-color: currentColor;
21
+
22
+ background-color: var(--_bg-color, var(--_surface-bg));
23
+ border: 1px solid var(--_border-color, var(--border-color));
24
+ border-radius: var(--_border-radius);
25
+ color: var(--_color);
26
+ isolation: isolate;
27
+ padding: var(--_padding);
28
+ position: relative;
29
+
30
+ &.critical,
31
+ &.info,
32
+ &.neutral,
33
+ &.success,
34
+ &.warning {
35
+ --_bg-color: light-dark(oklch(from var(--color-2) l c h / 20%), oklch(from var(--color-6) l c h / 5%));
36
+ --_border-color: light-dark(var(--color-5), var(--color-11));
37
+ --_color: light-dark(var(--color-16), var(--color-1));
38
+ --_icon-color: var(--color-9);
39
+
40
+ --_outlined-bg-color: var(--surface-default);
41
+ --_outlined-border-color: var(--color-9);
42
+ --_outlined-color: light-dark(var(--color-15), var(--color-1));
43
+ --_outlined-icon-color: var(--color-9);
44
+ }
45
+
46
+ &.outlined {
47
+ --_bg-color: var(--_outlined-bg-color);
48
+ --_border-color: var(--_outlined-border-color);
49
+ --_color: var(--_outlined-color);
50
+ --_icon-color: var(--_outlined-icon-color);
51
+ }
52
+
53
+ &::before {
54
+ background-color: var(--_bg-color);
55
+ border-radius: inherit;
56
+ content: "";
57
+ inset: 0;
58
+ pointer-events: none;
59
+ position: absolute;
60
+ z-index: -1;
61
+ }
62
+
63
+ &>.content {
64
+ display: grid;
65
+ font-size: var(--_font-size);
66
+ gap: var(--_content-gap);
67
+
68
+ h1,
69
+ h2,
70
+ h3,
71
+ h4,
72
+ h5,
73
+ h6 {
74
+ color: inherit;
75
+ font-size: var(--_title-font-size);
76
+ font-weight: 600;
77
+
78
+ * {
79
+ font-size: inherit;
80
+ }
81
+ }
82
+ }
83
+
84
+ /* Links
85
+ * Can't make sure contrast will be acceptable (yet) so we use the current text color instead.
86
+ */
87
+ &:not(.outlined) {
88
+ a[href] {
89
+ color: inherit;
90
+
91
+ &:hover {
92
+ color: var(--_link-hover-color);
93
+ }
94
+ }
95
+ }
96
+
97
+ /* Icon */
98
+ &:has(svg) {
99
+ display: grid;
100
+ gap: var(--_gap);
101
+ grid-template-columns: var(--_icon-size) 1fr;
102
+
103
+ svg {
104
+ margin-block-start: 0.15rem;
105
+ stroke: var(--_icon-color);
106
+ }
107
+ }
108
+ }
109
+ }
@@ -0,0 +1,117 @@
1
+ @layer components.root {
2
+ :where(.card) {
3
+ --_bg-tonal: var(--surface-tonal);
4
+ --_bg-elevated: var(--surface-elevated);
5
+ --_bg-surface: var(--surface-default);
6
+ --_border-color: var(--border-color);
7
+ --_card-bg-color: var(--_bg-surface);
8
+ --_card-border-color: transparent;
9
+ --_card-border-width: 0;
10
+
11
+ --_card-shadow: none;
12
+ --_shadow-light: var(--shadow-3);
13
+ --_shadow-dark: var(--shadow-4);
14
+ --_shadow-elevated: var(--_shadow-light);
15
+
16
+ @container style(--color-scheme: dark) {
17
+ --_shadow-elevated: var(--_shadow-dark);
18
+ }
19
+
20
+ background-color: var(--_card-bg-color);
21
+ border-color: var(--_card-border-color);
22
+ border-radius: var(--border-radius);
23
+ border-style: solid;
24
+ border-width: var(--_card-border-width);
25
+ box-shadow: var(--_card-shadow);
26
+ display: flex;
27
+ flex-direction: column;
28
+ gap: var(--size-3);
29
+ overflow: hidden;
30
+ padding-inline: 0;
31
+ position: relative;
32
+
33
+ /* Variants */
34
+ &.text {
35
+ --_card-bg-color: transparent;
36
+ --_card-border-color: transparent;
37
+ --_card-border-width: 0;
38
+ --_card-shadow: none;
39
+ }
40
+
41
+ &.tonal {
42
+ --_card-bg-color: var(--_bg-tonal);
43
+ --_card-border-width: 1px;
44
+ }
45
+
46
+ &.elevated {
47
+ --_card-bg-color: var(--_bg-elevated);
48
+ --_card-shadow: var(--_shadow-elevated);
49
+ }
50
+
51
+ &.outlined {
52
+ --_card-bg-color: var(--_bg-surface);
53
+ --_card-border-color: var(--_border-color);
54
+ --_card-border-width: 1px;
55
+ }
56
+
57
+ &> :where(hgroup, .content) {
58
+ padding-inline: var(--size-3);
59
+
60
+ &:last-child {
61
+ padding-block-end: var(--size-3);
62
+ }
63
+ }
64
+
65
+ /* Header */
66
+ &>hgroup {
67
+ padding-block: var(--size-3) 0;
68
+
69
+ /* Top paragraph */
70
+ &>p:first-of-type:first-child {
71
+ line-height: 1.3;
72
+ }
73
+
74
+ :where(h1, h2, h3, h4, h5, h6):last-child {
75
+ margin-block-end: 0;
76
+ }
77
+
78
+ /* Bottom paragraph */
79
+ &>p:last-of-type:last-child:not(:first-child) {
80
+ font-size: var(--font-size-1);
81
+ }
82
+ }
83
+
84
+ /* Content */
85
+ &>.content:where(:only-child, :first-child) {
86
+ padding-block: var(--size-3) var(--size-4);
87
+ }
88
+
89
+ /* Actions */
90
+ &>.actions {
91
+ display: flex;
92
+ gap: var(--size-2);
93
+ margin-block: var(--size-2) 0;
94
+ padding-block-end: var(--size-2);
95
+ padding-inline: var(--size-3);
96
+
97
+ &:has(.button:first-child[class="button"]) {
98
+ padding-inline: var(--size-1) var(--size-3);
99
+ }
100
+
101
+ &:has(.button:not([class="button"])) {
102
+ padding-block-end: var(--size-2);
103
+ }
104
+
105
+ /* Alignment */
106
+ &.align-end {
107
+ justify-content: end;
108
+
109
+ &:has(.button:first-child[class="button"]) {
110
+ padding-inline: var(--size-3) var(--size-1);
111
+ }
112
+ }
113
+ }
114
+
115
+
116
+ }
117
+ }
@@ -0,0 +1,205 @@
1
+ @layer components.root {
2
+ label.checkbox {
3
+ --_input-size: var(--size-4);
4
+
5
+ align-items: center;
6
+ color: var(--text-primary);
7
+ cursor: pointer;
8
+ display: inline-grid;
9
+ gap: 0 var(--size-2);
10
+ grid-auto-columns: auto;
11
+ grid-auto-flow: column;
12
+ inline-size: fit-content;
13
+ line-height: 1.5;
14
+ transform: translateZ(0);
15
+ user-select: none;
16
+
17
+ /* Disabled */
18
+ &:has([disabled]) {
19
+ cursor: not-allowed;
20
+ opacity: 0.64;
21
+ user-select: none;
22
+
23
+ input {
24
+ cursor: not-allowed;
25
+ }
26
+ }
27
+
28
+ /* Required dot */
29
+ &:has(:invalid) {
30
+ .label:after {
31
+ color: var(--red);
32
+ content: "*";
33
+ inset: 0 -0.25ex auto auto;
34
+ position: absolute;
35
+ }
36
+ }
37
+
38
+ /* Label */
39
+ .label {
40
+ color: var(--text-primary);
41
+ font-size: var(--font-size-05);
42
+ grid-column: 2;
43
+ grid-row: 1;
44
+ position: relative;
45
+ padding-inline: 0 1ex;
46
+ }
47
+
48
+ /* End text */
49
+ :where(.end-text) {
50
+ color: var(--text-muted);
51
+ font-size: var(--font-size-0);
52
+ grid-column: 2;
53
+ grid-row: 2;
54
+ line-height: 1.5;
55
+ z-index: 1;
56
+ }
57
+
58
+ /* Spread layout */
59
+ &.spread {
60
+ align-items: center;
61
+ column-gap: var(--size-4);
62
+ grid-auto-flow: unset;
63
+ grid-template-columns: 1fr auto;
64
+ inline-size: 100%;
65
+
66
+ .label {
67
+ font-weight: 600;
68
+ grid-column: 1;
69
+ grid-row: 1;
70
+ inline-size: fit-content;
71
+ }
72
+
73
+ input {
74
+ grid-column: 2;
75
+ grid-row: 1;
76
+ }
77
+
78
+ :where(.end-text) {
79
+ grid-column: 1;
80
+ grid-row: 2;
81
+ }
82
+ }
83
+
84
+ /* Stacked layout */
85
+ &.stack {
86
+ justify-items: center;
87
+ grid-auto-columns: unset;
88
+
89
+ .label {
90
+ grid-column: 1/-1;
91
+ grid-row: 2;
92
+ margin-block-start: var(--size-1);
93
+ padding-inline: 1ex;
94
+
95
+ /* Required dot */
96
+ &::after {
97
+ inset: 0 -0.25ex auto auto;
98
+ }
99
+ }
100
+
101
+ .end-text {
102
+ grid-column: 1/-1;
103
+ grid-row: 3;
104
+ }
105
+ }
106
+
107
+ /* Input */
108
+ input[type="checkbox"] {
109
+ --_input-size: var(--size-4);
110
+
111
+ appearance: none;
112
+ aspect-ratio: 1;
113
+ background-color: var(--surface-default);
114
+ block-size: var(--_input-size);
115
+ border-radius: var(--radius-1);
116
+ border: 1px solid var(--border-color);
117
+ box-sizing: border-box;
118
+ cursor: pointer;
119
+ display: grid;
120
+ font-size: var(--_input-size);
121
+ inline-size: var(--_input-size);
122
+ margin: 0;
123
+ padding: 0;
124
+ place-items: center;
125
+ position: relative;
126
+
127
+ &:checked,
128
+ &:indeterminate {
129
+ background-color: var(--primary);
130
+ border-color: var(--primary);
131
+ }
132
+
133
+
134
+ /* Checkmark */
135
+ &::after {
136
+ background-color: var(--primary-contrast);
137
+ clip-path: polygon(15% 52%, 40% 77%, 85% 32%, 75% 22%, 40% 57%, 25% 42%);
138
+ content: "";
139
+ inset: 0;
140
+ opacity: 0;
141
+ position: absolute;
142
+ }
143
+
144
+ &:checked::after,
145
+ &:indeterminate::after {
146
+ opacity: 1;
147
+ }
148
+
149
+ /* Indeterminate dash */
150
+ &:indeterminate::after {
151
+ clip-path: polygon(20% 45%, 80% 45%, 80% 55%, 20% 55%);
152
+ }
153
+
154
+ &::before {
155
+ --highlight-size: 175%;
156
+ }
157
+ }
158
+
159
+ /* Sizes */
160
+ &.small {
161
+ input[type="checkbox"] {
162
+ --_input-size: var(--size-3);
163
+ }
164
+ }
165
+
166
+ &.large {
167
+ input[type="checkbox"] {
168
+ --_input-size: var(--size-5);
169
+ }
170
+ }
171
+
172
+ /* Validation */
173
+ &[data-invalid],
174
+ &:has(:user-invalid) {
175
+ --palette-source: oklch(0.58 0.21 var(--hue-red));
176
+
177
+ :where(.end-text) {
178
+ color: var(--primary);
179
+ }
180
+ }
181
+
182
+ /* Touch devices */
183
+ @media (pointer: coarse) {
184
+ input {
185
+ --_input-size: var(--size-4);
186
+ }
187
+ }
188
+
189
+ @media (forced-colors: active) {
190
+ input {
191
+ border: 1px solid CanvasText;
192
+
193
+ &:checked,
194
+ &:indeterminate {
195
+ background-color: SelectedItem;
196
+ border-color: SelectedItem;
197
+
198
+ &::after {
199
+ background-color: SelectedItemText;
200
+ }
201
+ }
202
+ }
203
+ }
204
+ }
205
+ }