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,215 +1,227 @@
1
- @layer components.root {
2
- :where(.ui-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
- &.ui-critical,
58
- &.ui-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
- &.ui-critical {
73
- --_color: var(--critical);
74
- }
75
-
76
- &.ui-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), &.ui-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
- &.ui-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
- &.ui-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
- &.ui-large {
140
- --_min-height: var(--button-size-large);
141
- padding-inline: 4ex;
142
- }
143
-
144
- /* Variants */
145
- &.ui-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
- &.ui-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
- &.ui-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
- }
1
+ @layer components.root {
2
+ :where(.ui-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(
13
+ oklch(from var(--_accent) l 0.01 h / 10%),
14
+ oklch(from var(--_accent) l 0.01 h / 20%)
15
+ );
16
+ --_default-active-bg-color: light-dark(
17
+ oklch(from var(--_accent) l 0.06 h / 20%),
18
+ oklch(from var(--_accent) l 0.06 h / 30%)
19
+ );
20
+
21
+ --_filled-hover-bg-color: light-dark(
22
+ oklch(from var(--_accent) calc(l + 0.2) c h),
23
+ oklch(from var(--_accent) calc(l - 0.1) c h)
24
+ );
25
+ --_filled-active-bg-color: light-dark(
26
+ oklch(from var(--_accent) calc(l + 0.3) c h),
27
+ oklch(from var(--_accent) calc(l - 0.15) c h)
28
+ );
29
+ --_outlined-active-bg-color: var(--_filled-active-bg-color);
30
+
31
+ --_bg-color: transparent;
32
+ --_border-color: transparent;
33
+ --_border-width: var(--border-size-1);
34
+ --_font-size: var(--font-size-1);
35
+ --_min-height: var(--button-size);
36
+ --_border-radius: var(--button-border-radius, var(--radius-2));
37
+ --_text-color: var(--_accent);
38
+
39
+ -webkit-tap-highlight-color: transparent;
40
+ -webkit-touch-callout: none;
41
+ align-items: center;
42
+ background-color: var(--_bg-color);
43
+ border: var(--_border-width) solid var(--_border-color);
44
+ border-radius: var(--_border-radius);
45
+ color: var(--_text-color);
46
+ display: inline-flex;
47
+ font-size: var(--_font-size);
48
+ font-weight: 700;
49
+ gap: var(--size-2);
50
+ justify-content: center;
51
+ min-block-size: var(--_min-height);
52
+ padding-block: 0.5ex;
53
+ padding-inline: 1.5ex;
54
+ text-align: center;
55
+ text-decoration: none;
56
+ transition:
57
+ background-color 0.1s ease,
58
+ color 0.1s ease,
59
+ border-color 0.1s ease,
60
+ box-shadow 0.1s ease;
61
+ user-select: none;
62
+
63
+ /* Colors — shared interaction model for critical and primary.
64
+ Each color modifier below only swaps --_color; the tonal surface,
65
+ contrast text, and hover/active strategy are identical.
66
+ The .critical scope class in theme.css redirects --palette-source so
67
+ --color-6 below becomes a tint of the active color. */
68
+ &.ui-critical,
69
+ &.ui-primary {
70
+ --_color-contrast: var(--gray-1);
71
+ --_color-tonal: var(--color-6);
72
+ --_accent-tonal-contrast: var(--text-primary-contrast);
73
+
74
+ --_default-hover-bg-color: oklch(from var(--_accent) l c h / 15%);
75
+ --_default-active-bg-color: oklch(from var(--_accent) l c h / 25%);
76
+
77
+ --_filled-hover-bg-color: oklch(from var(--_accent) calc(l - 0.1) c h);
78
+ --_filled-active-bg-color: oklch(from var(--_accent) calc(l - 0.15) c h);
79
+
80
+ --_outlined-active-bg-color: oklch(from var(--_accent) calc(l - 0.1) c h);
81
+ }
82
+
83
+ &.ui-critical {
84
+ --_color: var(--critical);
85
+ }
86
+
87
+ &.ui-primary {
88
+ --_color: var(--primary);
89
+ }
90
+
91
+ /* Disabled */
92
+ &:where([disabled]) {
93
+ --_text-color: color-mix(
94
+ in oklch,
95
+ var(--text-muted) 50%,
96
+ var(--surface-default)
97
+ );
98
+
99
+ cursor: not-allowed;
100
+ opacity: 0.64;
101
+ }
102
+
103
+ /* Hover & Active */
104
+ &:where(:not([disabled])) {
105
+ &:where(:not(:active):hover) {
106
+ --_bg-color: var(--_default-hover-bg-color);
107
+ }
108
+
109
+ &:where(:hover:active),
110
+ &[aria-current="page"] {
111
+ --_bg-color: var(--_default-active-bg-color);
112
+ }
113
+ }
114
+
115
+ /* Icons / Keyboard */
116
+ &:where(:has(svg), &.ui-icon-only) {
117
+ gap: 1ex;
118
+
119
+ svg {
120
+ color: currentColor;
121
+ max-block-size: 0.7lh;
122
+ }
123
+ }
124
+
125
+ /* Keyboard input */
126
+ :is(kbd) {
127
+ background-color: oklch(from currentColor l c h / 10%);
128
+ border: 0;
129
+ color: oklch(from currentColor l c h / 80%);
130
+ font-size: 0.8em;
131
+ font-weight: 400;
132
+ line-height: 1.2;
133
+ }
134
+
135
+ /* Sizes — heights aliased from the shared --control-size scale.
136
+ Override --button-size-* in a parent scope to resize an entire region. */
137
+ &.ui-x-small {
138
+ --_min-height: var(--button-size-x-small);
139
+ --_font-size: var(--font-size-0);
140
+ padding-block: 0;
141
+ padding-inline: 0.5ex;
142
+ }
143
+
144
+ &.ui-small {
145
+ --_min-height: var(--button-size-small);
146
+ --_font-size: var(--font-size-05);
147
+ padding-block: 0;
148
+ padding-inline: 0.75ex;
149
+ }
150
+
151
+ &.ui-large {
152
+ --_min-height: var(--button-size-large);
153
+ padding-inline: 4ex;
154
+ }
155
+
156
+ /* Variants */
157
+ &.ui-outlined {
158
+ --_bg-color: transparent;
159
+ --_border-color: var(--_accent);
160
+ --_text-color: var(--_accent);
161
+
162
+ &:where(:not([disabled])) {
163
+ &:where(:not(:active):hover) {
164
+ --_bg-color: var(--_accent);
165
+ --_border-color: var(--_accent);
166
+ --_text-color: var(--_accent-contrast);
167
+ }
168
+
169
+ &:where(:active) {
170
+ --_bg-color: var(--_outlined-active-bg-color);
171
+ --_border-color: var(--_outlined-active-bg-color);
172
+ --_text-color: var(--_accent-contrast);
173
+ }
174
+ }
175
+ }
176
+
177
+ &.ui-tonal {
178
+ --_bg-color: var(--_accent-tonal);
179
+ --_text-color: var(--_accent-tonal-contrast);
180
+
181
+ &:where(:not([disabled])) {
182
+ &:where(:not(:active):hover) {
183
+ --_bg-color: var(--_accent);
184
+ --_text-color: var(--_accent-contrast);
185
+ }
186
+
187
+ &:where(:active) {
188
+ --_bg-color: var(--_outlined-active-bg-color);
189
+ --_text-color: var(--_accent-contrast);
190
+ }
191
+ }
192
+ }
193
+
194
+ &.ui-filled {
195
+ --_bg-color: var(--_accent);
196
+ --_text-color: var(--_accent-contrast);
197
+
198
+ &:where(:not([disabled])) {
199
+ &:where(:not(:active):hover) {
200
+ --_bg-color: var(--_filled-hover-bg-color);
201
+ }
202
+
203
+ &:where(:active) {
204
+ --_bg-color: var(--_filled-active-bg-color);
205
+ }
206
+ }
207
+ }
208
+ }
209
+
210
+ /* file input */
211
+ :where(input[type="file"]) {
212
+ align-self: flex-start;
213
+ border: var(--border-size-1) solid var(--surface-filled);
214
+ border-radius: var(--radius-2);
215
+ box-shadow: var(--inner-shadow-4);
216
+ color: var(--text-muted-contrast);
217
+ cursor: initial;
218
+ max-inline-size: 100%;
219
+ padding: 0;
220
+ }
221
+
222
+ :where(input[type="file"])::-webkit-file-upload-button,
223
+ :where(input[type="file"])::file-selector-button {
224
+ cursor: pointer;
225
+ margin-inline-end: var(--size-relative-6);
226
+ }
227
+ }