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,64 +1,68 @@
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
+ :where(
3
+ .ui-text-field:has(
4
+ :where(
5
+ input[type="date"],
6
+ input[type="datetime-local"],
7
+ input[type="email"],
8
+ input[type="month"],
9
+ input[type="number"],
10
+ input[type="password"],
11
+ input[type="search"],
12
+ input[type="tel"],
13
+ input[type="text"],
14
+ input[type="time"],
15
+ input[type="url"],
16
+ input[type="week"]
17
+ )
18
+ )
19
+ ) {
20
+ /* Sizes */
21
+ &.ui-small {
22
+ input {
23
+ padding-inline: var(--size-2);
24
+ }
25
+ }
26
+ }
27
+
28
+ /* Autosuggest */
29
+ :where(.ui-text-field:has(input[list])) {
30
+ .ui-field {
31
+ position: relative;
32
+ }
33
+
34
+ /* Hide native arrow */
35
+ input[list]::-webkit-calendar-picker-indicator {
36
+ cursor: pointer;
37
+ opacity: 0;
38
+ pointer-events: none;
39
+ position: absolute;
40
+ }
41
+
42
+ input[list] {
43
+ padding-inline-end: var(--size-8);
44
+ }
45
+
46
+ .ui-field::after {
47
+ block-size: 0;
48
+ border-block-start: 5px solid;
49
+ border-inline: 5px solid transparent;
50
+ content: "";
51
+ inline-size: 0;
52
+ inset: 50% var(--size-3) auto auto;
53
+ pointer-events: none;
54
+ position: absolute;
55
+ translate: 0 -50%;
56
+ }
57
+
58
+ &.ui-small {
59
+ input[list] {
60
+ padding-inline-end: var(--size-7);
61
+ }
62
+
63
+ .ui-field::after {
64
+ inset-inline-end: var(--size-2);
65
+ }
66
+ }
67
+ }
68
+ }
@@ -1,24 +1,26 @@
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(
7
+ var(--_field-padding-block) * 2 + (var(--border-width) * 2) + 3lh
8
+ );
9
+ resize: vertical;
10
+ }
11
+
12
+ /* Size */
13
+ &.ui-small {
14
+ textarea {
15
+ min-block-size: var(--size-9);
16
+ }
17
+ }
18
+
19
+ /* Auto-fit */
20
+ &.ui-auto-fit {
21
+ textarea {
22
+ resize: both;
23
+ }
24
+ }
25
+ }
26
+ }
@@ -1,161 +1,160 @@
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, var(--_anim-enter),
43
+ calc(var(--_anim-enter) + attr(data-duration type(<time>), 5s));
44
+ background-color: light-dark(var(--gray-15), var(--gray-2));
45
+ border-radius: var(--border-radius);
46
+ box-shadow: var(--shadow-3);
47
+ color: var(--text-primary-contrast);
48
+ display: flex;
49
+ gap: var(--size-3);
50
+ justify-content: space-between;
51
+ min-inline-size: 30ch;
52
+ padding: var(--size-3) var(--size-4);
53
+ pointer-events: auto;
54
+
55
+ &:hover {
56
+ animation-play-state: paused;
57
+ }
58
+
59
+ &.ui-exiting {
60
+ animation: toast-exit var(--_anim-exit) var(--ease-in-3) forwards;
61
+ }
62
+
63
+ .ui-icon {
64
+ background: no-repeat center / contain;
65
+ block-size: var(--size-4);
66
+ flex-shrink: 0;
67
+ inline-size: var(--size-4);
68
+ }
69
+
70
+ /* Hide the icon slot when there's no severity to render against. */
71
+ &:not([data-severity]) .ui-icon {
72
+ display: none;
73
+ }
74
+
75
+ .ui-content {
76
+ font-size: var(--font-size-05);
77
+ word-break: break-word;
78
+ }
79
+
80
+ .ui-title {
81
+ font-weight: 600;
82
+ }
83
+
84
+ .ui-description {
85
+ color: oklch(from currentColor l c h / 75%);
86
+ font-size: var(--font-size-0);
87
+ }
88
+
89
+ .ui-close-button {
90
+ background: none;
91
+ border: none;
92
+ color: inherit;
93
+ cursor: pointer;
94
+ display: grid;
95
+ opacity: 0.7;
96
+ padding: var(--size-1);
97
+ place-items: center;
98
+ transition: opacity 0.2s;
99
+
100
+ &:hover {
101
+ opacity: 1;
102
+ }
103
+ }
104
+
105
+ /* Severity icons via CSS data URIs — keeps icon assets out of JS strings. */
106
+ &[data-severity="success"] .ui-icon {
107
+ 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>");
108
+ }
109
+
110
+ &[data-severity="info"] .ui-icon {
111
+ 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>");
112
+ }
113
+
114
+ &[data-severity="warning"] .ui-icon {
115
+ 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>");
116
+ }
117
+
118
+ &[data-severity="critical"] .ui-icon {
119
+ 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>");
120
+ }
121
+ }
122
+
123
+ @keyframes toast-enter {
124
+ from {
125
+ opacity: 0;
126
+ translate: var(--size-4) 0;
127
+ }
128
+
129
+ to {
130
+ opacity: 1;
131
+ translate: 0 0;
132
+ }
133
+ }
134
+
135
+ /* Identity keyframe — only purpose is to delay the exit animation by the
136
+ author-defined duration. */
137
+ @keyframes toast-hold {
138
+ from {
139
+ opacity: 1;
140
+ }
141
+
142
+ to {
143
+ opacity: 1;
144
+ }
145
+ }
146
+
147
+ @keyframes toast-exit {
148
+ from {
149
+ opacity: 1;
150
+ scale: 1;
151
+ translate: 0 0;
152
+ }
153
+
154
+ to {
155
+ opacity: 0;
156
+ scale: 0.9;
157
+ translate: 0 var(--size-4);
158
+ }
159
+ }
160
+ }