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,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(.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
+ &.exiting {
61
+ animation: toast-exit var(--_anim-exit) var(--ease-in-3) forwards;
62
+ }
63
+
64
+ .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]) .icon {
73
+ display: none;
74
+ }
75
+
76
+ .content {
77
+ font-size: var(--font-size-05);
78
+ word-break: break-word;
79
+ }
80
+
81
+ .title {
82
+ font-weight: 600;
83
+ }
84
+
85
+ .description {
86
+ color: oklch(from currentColor l c h / 75%);
87
+ font-size: var(--font-size-0);
88
+ }
89
+
90
+ .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"] .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"] .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"] .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"] .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
+ }
@@ -0,0 +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(.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 > .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(.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
+ &.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
+ &.small {
80
+ --_size: var(--field-size-small);
81
+ }
82
+
83
+ &.x-small {
84
+ --_size: var(--field-size-x-small);
85
+ }
86
+ }
87
+ }
@@ -0,0 +1,56 @@
1
+ @layer components.root {
2
+ :where(.toggle-group) {
3
+ --_bg-color: var(--surface-default);
4
+ --_border-color: var(--border-color);
5
+ --_border-radius: var(--button-border-radius);
6
+
7
+ background-color: var(--_bg-color);
8
+ border: 1px solid var(--_border-color);
9
+ border-radius: var(--_border-radius);
10
+ display: inline-flex;
11
+ inline-size: fit-content;
12
+ overflow: hidden;
13
+
14
+ /* Sizes */
15
+ &.small {
16
+ .toggle-button {
17
+ --_size: var(--field-size-small);
18
+ }
19
+ }
20
+
21
+ &.x-small {
22
+ .toggle-button {
23
+ --_size: var(--field-size-x-small);
24
+ }
25
+ }
26
+
27
+ /* Toggle button */
28
+ .toggle-button {
29
+ border: 0;
30
+ border-radius: 0;
31
+ margin: 0;
32
+ }
33
+
34
+ &:not(.vertical) {
35
+ .toggle-button {
36
+ border-inline-end: 1px solid var(--_border-color);
37
+
38
+ &:last-of-type {
39
+ border-inline-end: 0;
40
+ }
41
+ }
42
+ }
43
+
44
+ &.vertical {
45
+ flex-direction: column;
46
+
47
+ .toggle-button {
48
+ border-block-end: 1px solid var(--_border-color);
49
+
50
+ &:last-of-type {
51
+ border-block-end: 0;
52
+ }
53
+ }
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,67 @@
1
+ @layer components.extended {
2
+ :where(.tooltip) {
3
+ --_tooltip-bg: light-dark(var(--gray-13), var(--gray-3));
4
+ --_tooltip-color: light-dark(var(--gray-1), var(--gray-15));
5
+ --_tooltip-offset: var(--size-2);
6
+
7
+ &>.anchor-floating {
8
+ background-color: var(--_tooltip-bg);
9
+ border-radius: var(--radius-2);
10
+ color: var(--_tooltip-color);
11
+ font-size: var(--font-size-05);
12
+ line-height: 1.3;
13
+ margin: var(--_tooltip-offset);
14
+ max-inline-size: 240px;
15
+ /* UA sets overflow: auto on [popover], which clips the arrow. */
16
+ overflow: visible;
17
+ padding-block: var(--size-1);
18
+ padding-inline: var(--size-2);
19
+ position-area: var(--anchor-position-area, block-start);
20
+ position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
21
+ position-visibility: anchors-visible;
22
+ text-align: center;
23
+ text-wrap: pretty;
24
+ }
25
+
26
+ /* Optional arrow pointing from the tooltip toward the trigger.
27
+ Anchored to the same --anchor so it flips together with the
28
+ tooltip when position-try-fallbacks kicks in. */
29
+ &.with-arrow {
30
+ --_arrow-size: var(--size-2);
31
+
32
+ &>.anchor-floating {
33
+ /* Reserve space so the arrow doesn't overlap the trigger. */
34
+ --_tooltip-offset: calc(var(--size-2) + var(--_arrow-size) / 2);
35
+ }
36
+
37
+ &>.anchor-floating::before {
38
+ background-color: var(--_tooltip-bg);
39
+ block-size: var(--_arrow-size);
40
+ content: "";
41
+ inline-size: var(--_arrow-size);
42
+ inset-block-end: calc(var(--_arrow-size) / -2);
43
+ inset-inline-start: 50%;
44
+ position: absolute;
45
+ rotate: 45deg;
46
+ translate: -50% 0;
47
+ }
48
+ }
49
+
50
+ /* Fade */
51
+ &>.anchor-floating[popover] {
52
+ opacity: 0;
53
+ transition:
54
+ display 0.15s allow-discrete,
55
+ opacity 0.15s var(--ease-out-1),
56
+ overlay 0.15s allow-discrete;
57
+
58
+ &:popover-open {
59
+ opacity: 1;
60
+
61
+ @starting-style {
62
+ opacity: 0;
63
+ }
64
+ }
65
+ }
66
+ }
67
+ }