opui-css 5.0.0 → 5.1.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 (114) hide show
  1. package/CHANGELOG.md +317 -276
  2. package/LICENSE +21 -21
  3. package/MIGRATING.md +138 -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 +52 -42
  8. package/components/Anchor/Anchor.astro +55 -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 +36 -29
  13. package/components/Callout/Callout.astro +75 -75
  14. package/components/Card/Card.astro +38 -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 +43 -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 +200 -194
  65. package/core/palette.css +110 -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 +193 -179
  72. package/css/components/button.css +227 -215
  73. package/css/components/callout.css +112 -109
  74. package/css/components/card.css +115 -117
  75. package/css/components/checkbox.css +211 -205
  76. package/css/components/chip.css +92 -87
  77. package/css/components/description-list.css +81 -80
  78. package/css/components/dialog.css +69 -68
  79. package/css/components/divider.css +20 -20
  80. package/css/components/drawer.css +171 -171
  81. package/css/components/form.css +147 -146
  82. package/css/components/icon-button.css +158 -139
  83. package/css/components/link.css +21 -21
  84. package/css/components/list.css +343 -345
  85. package/css/components/progress.css +103 -97
  86. package/css/components/radio.css +170 -172
  87. package/css/components/range.css +342 -337
  88. package/css/components/select.css +172 -169
  89. package/css/components/spinner.css +38 -37
  90. package/css/components/switch.css +271 -268
  91. package/css/components/table.css +173 -179
  92. package/css/components/tabs.css +84 -83
  93. package/css/components/text-field.css +449 -450
  94. package/css/components/text-input.css +68 -64
  95. package/css/components/textarea.css +26 -24
  96. package/css/components/toast.css +160 -161
  97. package/css/components/toggle-button.css +91 -87
  98. package/css/components/toggle-group.css +56 -56
  99. package/css/components/tooltip.css +70 -67
  100. package/css/components/typography.css +585 -585
  101. package/css/components.css +41 -41
  102. package/css/imports.css +17 -16
  103. package/css/js/checkbox.js +21 -21
  104. package/css/js/toast.js +94 -94
  105. package/css/theme.css +133 -132
  106. package/dist/op.css +4 -66
  107. package/dist/op.css.map +1 -1
  108. package/dist/opui.components.css +5234 -5154
  109. package/dist/opui.components.css.map +1 -1
  110. package/dist/opui.css +5798 -5663
  111. package/dist/opui.css.map +1 -1
  112. package/env.d.ts +14 -14
  113. package/open-props.css +8 -9
  114. package/package.json +81 -81
@@ -1,268 +1,271 @@
1
- @layer components.root {
2
- :where(.ui-switch) {
3
- --_accent-color: var(--primary);
4
- --_accent-contrast: var(--primary-contrast);
5
-
6
- --_dot-bg-color: light-dark(var(--gray-11), var(--gray-14));
7
- --_dot-inset: var(--size-1) auto auto var(--size-1);
8
- --_dot-outline-size: 0;
9
- --_dot-size: var(--size-3);
10
-
11
- --_track-bg-color: light-dark(var(--gray-3), var(--gray-8));
12
- --_track-height: var(--size-5);
13
- --_track-width: var(--size-8);
14
- --_transition-tf: var(--ease-4);
15
- --_transition-time: 0.2s;
16
-
17
- align-items: center;
18
- color: var(--text-primary);
19
- display: inline-grid;
20
- gap: 0 var(--size-2);
21
- grid-auto-columns: auto;
22
- grid-auto-flow: column;
23
- inline-size: fit-content;
24
-
25
- :where(input[type="checkbox"][role="switch"]) {
26
- appearance: none;
27
- block-size: var(--_track-height);
28
- cursor: pointer;
29
- inline-size: var(--_track-width);
30
- margin: 0;
31
- position: relative;
32
-
33
- /* Track */
34
- &::before {
35
- background-color: var(--_track-bg-color);
36
- block-size: var(--_track-height);
37
- border: 1px solid var(--_dot-bg-color);
38
- border-radius: var(--radius-round);
39
- content: "";
40
- inline-size: var(--_track-width);
41
- inset: 0;
42
- position: absolute;
43
- }
44
-
45
- &:focus-visible {
46
- --focus-ring-color: currentColor;
47
- outline: var(--focus-ring-width) var(--focus-ring-style) var(--focus-ring-color);
48
- outline-offset: var(--focus-ring-offset);
49
- }
50
-
51
- /* Dot */
52
- &::after {
53
- background-color: var(--_dot-bg-color);
54
- block-size: var(--_dot-size);
55
- border-radius: var(--radius-round);
56
- content: "";
57
- inline-size: var(--_dot-size);
58
- inset: var(--_dot-inset);
59
- outline: var(--_dot-outline-size) solid var(--_dot-bg-color);
60
- outline-offset: -1px;
61
- position: absolute;
62
- }
63
-
64
- /* Checked */
65
- &:checked {
66
- &::before {
67
- background-color: var(--_accent-color);
68
- border-color: var(--_accent-color);
69
- transition:
70
- background-color var(--_transition-time) var(--_transition-tf),
71
- border-color var(--_transition-time) var(--_transition-tf);
72
- }
73
-
74
- /* Dot */
75
- &::after {
76
- --_dot-bg-color: var(--_accent-contrast);
77
- --_dot-outline-size: calc(var(--size-1) - 1px);
78
-
79
- inset-inline-start: calc(var(--_track-width) - var(--_dot-size) - var(--size-1));
80
- }
81
- }
82
-
83
- /* Animation */
84
- @media (prefers-reduced-motion: no-preference) {
85
-
86
- /* Track */
87
- &::before {
88
- transition:
89
- background-color var(--_transition-time) var(--_transition-tf),
90
- border-color var(--_transition-time) var(--_transition-tf);
91
- }
92
-
93
- /* Dot */
94
- &::after {
95
- transition: all var(--_transition-time) var(--_transition-tf);
96
- }
97
-
98
- &:active:after {
99
- --_dot-outline-size: calc(var(--size-1) + 1px);
100
- }
101
-
102
- &:checked {
103
- &:active:after {
104
- --_dot-outline-size: calc(var(--size-1) + 1px);
105
- }
106
- }
107
- }
108
- }
109
-
110
- /* Icons */
111
- &:has(.ui-icon-checked, .ui-icon-unchecked) {
112
- [role="switch"] {
113
- grid-column: 1 / -1;
114
- grid-row: 1;
115
- }
116
-
117
- &:has([role="switch"]:checked) {
118
- .ui-icon-unchecked {
119
- display: none;
120
- }
121
-
122
- .ui-icon-checked {
123
- display: block;
124
- }
125
- }
126
-
127
- .ui-icon-checked {
128
- display: none;
129
- }
130
-
131
- .ui-icon-unchecked,
132
- .ui-icon-checked {
133
- grid-column: 1;
134
- grid-row: 1;
135
- pointer-events: none;
136
- z-index: 1;
137
-
138
- svg {
139
- display: block;
140
- inline-size: var(--_dot-size);
141
- }
142
- }
143
-
144
- .ui-icon-unchecked {
145
- margin-inline-start: calc(var(--_track-width) - var(--_dot-size) - var(--size-1));
146
- }
147
-
148
- .ui-icon-checked {
149
- margin-inline-start: var(--size-1);
150
- }
151
- }
152
-
153
- /* Required dot */
154
- &:has(:invalid) {
155
- .ui-label:after {
156
- color: var(--red);
157
- content: "*";
158
- inset: 0 -0.25ex auto auto;
159
- position: absolute;
160
- }
161
- }
162
-
163
- /* Disabled */
164
- &:has([disabled]) {
165
- cursor: not-allowed;
166
- opacity: 0.64;
167
- user-select: none;
168
-
169
- input {
170
- cursor: not-allowed;
171
- }
172
- }
173
-
174
- /* Label */
175
- .ui-label {
176
- color: var(--text-primary);
177
- font-size: var(--font-size-05);
178
- grid-column: 2;
179
- grid-row: 1;
180
- min-width: 0;
181
- padding-inline: 0 1ex;
182
- position: relative;
183
- user-select: none;
184
- }
185
-
186
- /* End text */
187
- :where(.ui-end-text) {
188
- color: var(--text-muted);
189
- font-size: var(--font-size-0);
190
- grid-column: 2;
191
- grid-row: 2;
192
- line-height: 1.5;
193
- z-index: 1;
194
- }
195
-
196
- /* Size */
197
- &.ui-small {
198
- --_dot-size: 0.75rem;
199
- --_track-height: var(--size-4);
200
- --_track-width: 2.5rem;
201
- }
202
-
203
- /* Spread layout */
204
- &.ui-spread {
205
- align-items: center;
206
- column-gap: var(--size-4);
207
- grid-auto-flow: unset;
208
- grid-template-columns: 1fr auto;
209
- inline-size: 100%;
210
-
211
- .ui-label {
212
- font-weight: 600;
213
- grid-column: 1;
214
- grid-row: 1;
215
- inline-size: fit-content;
216
- }
217
-
218
- input[role="switch"] {
219
- grid-column: 2;
220
- grid-row: 1;
221
- }
222
-
223
- &:has(.ui-icon-checked, .ui-icon-unchecked) {
224
-
225
- input[role="switch"],
226
- .ui-icon-checked,
227
- .ui-icon-unchecked {
228
- grid-column: 2;
229
- }
230
- }
231
-
232
- :where(.ui-end-text) {
233
- grid-column: 1;
234
- grid-row: 2;
235
- }
236
- }
237
-
238
- /* Stacked layout */
239
- &.ui-stack {
240
- grid-auto-columns: unset;
241
- justify-items: center;
242
-
243
- .ui-label {
244
- grid-column: 1/-1;
245
- grid-row: 2;
246
- margin-block-start: var(--size-1);
247
- padding-inline: 1ex;
248
- }
249
-
250
- .ui-end-text {
251
- grid-column: 1/-1;
252
- grid-row: 3;
253
- }
254
- }
255
-
256
- /* Validation */
257
- &[data-invalid] {
258
- input {
259
- border-radius: var(--radius-round);
260
- outline: 2px solid var(--color-9);
261
- }
262
-
263
- .ui-end-text {
264
- color: var(--color-9);
265
- }
266
- }
267
- }
268
- }
1
+ @layer components.root {
2
+ :where(.ui-switch) {
3
+ --_accent-color: var(--primary);
4
+ --_accent-contrast: var(--primary-contrast);
5
+
6
+ --_dot-bg-color: light-dark(var(--gray-11), var(--gray-14));
7
+ --_dot-inset: var(--size-1) auto auto var(--size-1);
8
+ --_dot-outline-size: 0;
9
+ --_dot-size: var(--size-3);
10
+
11
+ --_track-bg-color: light-dark(var(--gray-3), var(--gray-8));
12
+ --_track-height: var(--size-5);
13
+ --_track-width: var(--size-8);
14
+ --_transition-tf: var(--ease-4);
15
+ --_transition-time: 0.2s;
16
+
17
+ align-items: center;
18
+ color: var(--text-primary);
19
+ display: inline-grid;
20
+ gap: 0 var(--size-2);
21
+ grid-auto-columns: auto;
22
+ grid-auto-flow: column;
23
+ inline-size: fit-content;
24
+
25
+ :where(input[type="checkbox"][role="switch"]) {
26
+ appearance: none;
27
+ block-size: var(--_track-height);
28
+ cursor: pointer;
29
+ inline-size: var(--_track-width);
30
+ margin: 0;
31
+ position: relative;
32
+
33
+ /* Track */
34
+ &::before {
35
+ background-color: var(--_track-bg-color);
36
+ block-size: var(--_track-height);
37
+ border: 1px solid var(--_dot-bg-color);
38
+ border-radius: var(--radius-round);
39
+ content: "";
40
+ inline-size: var(--_track-width);
41
+ inset: 0;
42
+ position: absolute;
43
+ }
44
+
45
+ &:focus-visible {
46
+ --focus-ring-color: currentColor;
47
+ outline: var(--focus-ring-width) var(--focus-ring-style)
48
+ var(--focus-ring-color);
49
+ outline-offset: var(--focus-ring-offset);
50
+ }
51
+
52
+ /* Dot */
53
+ &::after {
54
+ background-color: var(--_dot-bg-color);
55
+ block-size: var(--_dot-size);
56
+ border-radius: var(--radius-round);
57
+ content: "";
58
+ inline-size: var(--_dot-size);
59
+ inset: var(--_dot-inset);
60
+ outline: var(--_dot-outline-size) solid var(--_dot-bg-color);
61
+ outline-offset: -1px;
62
+ position: absolute;
63
+ }
64
+
65
+ /* Checked */
66
+ &:checked {
67
+ &::before {
68
+ background-color: var(--_accent-color);
69
+ border-color: var(--_accent-color);
70
+ transition:
71
+ background-color var(--_transition-time) var(--_transition-tf),
72
+ border-color var(--_transition-time) var(--_transition-tf);
73
+ }
74
+
75
+ /* Dot */
76
+ &::after {
77
+ --_dot-bg-color: var(--_accent-contrast);
78
+ --_dot-outline-size: calc(var(--size-1) - 1px);
79
+
80
+ inset-inline-start: calc(
81
+ var(--_track-width) - var(--_dot-size) - var(--size-1)
82
+ );
83
+ }
84
+ }
85
+
86
+ /* Animation */
87
+ @media (prefers-reduced-motion: no-preference) {
88
+ /* Track */
89
+ &::before {
90
+ transition:
91
+ background-color var(--_transition-time) var(--_transition-tf),
92
+ border-color var(--_transition-time) var(--_transition-tf);
93
+ }
94
+
95
+ /* Dot */
96
+ &::after {
97
+ transition: all var(--_transition-time) var(--_transition-tf);
98
+ }
99
+
100
+ &:active:after {
101
+ --_dot-outline-size: calc(var(--size-1) + 1px);
102
+ }
103
+
104
+ &:checked {
105
+ &:active:after {
106
+ --_dot-outline-size: calc(var(--size-1) + 1px);
107
+ }
108
+ }
109
+ }
110
+ }
111
+
112
+ /* Icons */
113
+ &:has(.ui-icon-checked, .ui-icon-unchecked) {
114
+ [role="switch"] {
115
+ grid-column: 1 / -1;
116
+ grid-row: 1;
117
+ }
118
+
119
+ &:has([role="switch"]:checked) {
120
+ .ui-icon-unchecked {
121
+ display: none;
122
+ }
123
+
124
+ .ui-icon-checked {
125
+ display: block;
126
+ }
127
+ }
128
+
129
+ .ui-icon-checked {
130
+ display: none;
131
+ }
132
+
133
+ .ui-icon-unchecked,
134
+ .ui-icon-checked {
135
+ grid-column: 1;
136
+ grid-row: 1;
137
+ pointer-events: none;
138
+ z-index: 1;
139
+
140
+ svg {
141
+ display: block;
142
+ inline-size: var(--_dot-size);
143
+ }
144
+ }
145
+
146
+ .ui-icon-unchecked {
147
+ margin-inline-start: calc(
148
+ var(--_track-width) - var(--_dot-size) - var(--size-1)
149
+ );
150
+ }
151
+
152
+ .ui-icon-checked {
153
+ margin-inline-start: var(--size-1);
154
+ }
155
+ }
156
+
157
+ /* Required dot */
158
+ &:has(:invalid) {
159
+ .ui-label:after {
160
+ color: var(--red);
161
+ content: "*";
162
+ inset: 0 -0.25ex auto auto;
163
+ position: absolute;
164
+ }
165
+ }
166
+
167
+ /* Disabled */
168
+ &:has([disabled]) {
169
+ cursor: not-allowed;
170
+ opacity: 0.64;
171
+ user-select: none;
172
+
173
+ input {
174
+ cursor: not-allowed;
175
+ }
176
+ }
177
+
178
+ /* Label */
179
+ .ui-label {
180
+ color: var(--text-primary);
181
+ font-size: var(--font-size-05);
182
+ grid-column: 2;
183
+ grid-row: 1;
184
+ min-width: 0;
185
+ padding-inline: 0 1ex;
186
+ position: relative;
187
+ user-select: none;
188
+ }
189
+
190
+ /* End text */
191
+ :where(.ui-end-text) {
192
+ color: var(--text-muted);
193
+ font-size: var(--font-size-0);
194
+ grid-column: 2;
195
+ grid-row: 2;
196
+ line-height: 1.5;
197
+ z-index: 1;
198
+ }
199
+
200
+ /* Size */
201
+ &.ui-small {
202
+ --_dot-size: 0.75rem;
203
+ --_track-height: var(--size-4);
204
+ --_track-width: 2.5rem;
205
+ }
206
+
207
+ /* Spread layout */
208
+ &.ui-spread {
209
+ align-items: center;
210
+ column-gap: var(--size-4);
211
+ grid-auto-flow: unset;
212
+ grid-template-columns: 1fr auto;
213
+ inline-size: 100%;
214
+
215
+ .ui-label {
216
+ font-weight: 600;
217
+ grid-column: 1;
218
+ grid-row: 1;
219
+ inline-size: fit-content;
220
+ }
221
+
222
+ input[role="switch"] {
223
+ grid-column: 2;
224
+ grid-row: 1;
225
+ }
226
+
227
+ &:has(.ui-icon-checked, .ui-icon-unchecked) {
228
+ input[role="switch"],
229
+ .ui-icon-checked,
230
+ .ui-icon-unchecked {
231
+ grid-column: 2;
232
+ }
233
+ }
234
+
235
+ :where(.ui-end-text) {
236
+ grid-column: 1;
237
+ grid-row: 2;
238
+ }
239
+ }
240
+
241
+ /* Stacked layout */
242
+ &.ui-stack {
243
+ grid-auto-columns: unset;
244
+ justify-items: center;
245
+
246
+ .ui-label {
247
+ grid-column: 1/-1;
248
+ grid-row: 2;
249
+ margin-block-start: var(--size-1);
250
+ padding-inline: 1ex;
251
+ }
252
+
253
+ .ui-end-text {
254
+ grid-column: 1/-1;
255
+ grid-row: 3;
256
+ }
257
+ }
258
+
259
+ /* Validation */
260
+ &[data-invalid] {
261
+ input {
262
+ border-radius: var(--radius-round);
263
+ outline: 2px solid var(--color-9);
264
+ }
265
+
266
+ .ui-end-text {
267
+ color: var(--color-9);
268
+ }
269
+ }
270
+ }
271
+ }