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,146 @@
1
+ @layer components.extended {
2
+
3
+ /* Form */
4
+ :where(.form) {
5
+ display: grid;
6
+ gap: var(--size-8);
7
+
8
+ hr {
9
+ margin-block: 0;
10
+ }
11
+ }
12
+
13
+ /* Fieldset */
14
+ :where(.fieldset) {
15
+ all: unset;
16
+ border: 0;
17
+ border-radius: 0;
18
+ display: grid;
19
+ gap: var(--size-1);
20
+ margin: 0;
21
+ min-inline-size: 0;
22
+ padding: 0;
23
+
24
+ /* Legend */
25
+ :where(legend, .legend) {
26
+ all: unset;
27
+ color: var(--text-primary);
28
+ font-weight: 600;
29
+ margin-block-end: var(--size-3);
30
+ padding: 0;
31
+
32
+ &:has(+ :where(.field-description)) {
33
+ margin-block-end: 0;
34
+ }
35
+ }
36
+
37
+ /* Field description / supporting text */
38
+ :where(.field-description) {
39
+ color: var(--text-muted);
40
+ font-size: var(--font-size-05);
41
+ line-height: var(--font-lineheight-3);
42
+
43
+ &:has(+ *) {
44
+ margin-block-end: var(--size-3);
45
+ }
46
+ }
47
+
48
+ /* End text */
49
+ :where(.end-text) {
50
+ color: var(--text-muted);
51
+ font-size: var(--font-size-0);
52
+ line-height: var(--font-lineheight-3);
53
+ }
54
+
55
+ &:has(.text-field.row) {
56
+ row-gap: var(--size-7);
57
+ }
58
+
59
+ /* Disabled */
60
+ &[disabled] {
61
+ opacity: 0.64;
62
+ user-select: none;
63
+
64
+ input,
65
+ label,
66
+ .label {
67
+ cursor: not-allowed;
68
+ }
69
+ }
70
+
71
+ /* Error / validation */
72
+ &[data-invalid] {
73
+ :where(.end-text) {
74
+ color: var(--primary);
75
+ }
76
+
77
+ :where(.checkbox, .radio, .switch) {
78
+ --palette-source: oklch(0.58 0.21 var(--hue-red));
79
+
80
+ :where(.end-text) {
81
+ color: var(--primary);
82
+ }
83
+ }
84
+
85
+ :where(.switch) {
86
+ input {
87
+ border-radius: var(--radius-round);
88
+ outline: 2px solid var(--primary);
89
+ }
90
+ }
91
+ }
92
+
93
+ /* Required */
94
+ &:has(:invalid) {
95
+ :where(legend, .legend) {
96
+ padding-inline-end: 1ex;
97
+ position: relative;
98
+
99
+ &::after {
100
+ color: var(--red);
101
+ content: "*";
102
+ inset: 0 -0.25ex auto auto;
103
+ position: absolute;
104
+ }
105
+ }
106
+ }
107
+ }
108
+
109
+ /* Field group */
110
+ :where(.field-group) {
111
+ display: flex;
112
+ flex-direction: column;
113
+ gap: var(--size-4);
114
+
115
+ /* If it only has checkboxes, radios, or switches */
116
+ &:has(> :where(.checkbox, .radio, .switch)):not(:has(> :not(.checkbox, .radio, .switch))) {
117
+ gap: var(--size-2);
118
+ }
119
+
120
+ /* If it only has buttons */
121
+ &:has(.button):not(:has(*:not(.button))) {
122
+ align-items: center;
123
+ flex-direction: row;
124
+ gap: var(--size-2);
125
+
126
+ /* If it's not preceeded by an hr */
127
+ &:not(hr + &) {
128
+ margin-block-start: var(--size-4);
129
+ }
130
+ }
131
+
132
+ &+& {
133
+ margin-block-start: var(--size-5);
134
+ }
135
+
136
+ /* Directions */
137
+ &.row {
138
+ flex-direction: row;
139
+ flex-wrap: wrap;
140
+
141
+ &:has(> :where(.checkbox, .radio, .switch)) {
142
+ gap: var(--size-4);
143
+ }
144
+ }
145
+ }
146
+ }
@@ -0,0 +1,139 @@
1
+ @layer components.root {
2
+ :where(.icon-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
+ --_default-hover-bg-color: light-dark(oklch(from var(--_accent) l 0.01 h / 10%),
12
+ oklch(from var(--_accent) l 0.01 h / 20%));
13
+ --_default-active-bg-color: light-dark(oklch(from var(--_accent) l 0.06 h / 20%),
14
+ oklch(from var(--_accent) l 0.06 h / 30%));
15
+ --_filled-hover-bg-color: light-dark(oklch(from var(--_accent) calc(l + 0.2) c h),
16
+ oklch(from var(--_accent) calc(l - 0.1) c h));
17
+ --_filled-active-bg-color: light-dark(oklch(from var(--_accent) calc(l + 0.3) c h),
18
+ oklch(from var(--_accent) calc(l - 0.15) c h));
19
+ --_outlined-active-bg-color: var(--_filled-active-bg-color);
20
+
21
+ --_bg-color: transparent;
22
+ --_border-color: transparent;
23
+ --_border-width: var(--border-size-1);
24
+ --_text-color: inherit;
25
+
26
+ align-items: center;
27
+ aspect-ratio: 1;
28
+ background-color: var(--_bg-color);
29
+ block-size: var(--size-6);
30
+ border: var(--_border-width) solid var(--_border-color);
31
+ border-radius: var(--radius-round);
32
+ color: var(--_text-color);
33
+ display: inline-flex;
34
+ inline-size: var(--size-6);
35
+ justify-content: center;
36
+ padding: 0;
37
+ transform-style: preserve-3d;
38
+ transition: background-color .1s ease, color .1s ease,
39
+ border-color .1s ease, box-shadow .1s ease;
40
+
41
+ &:where([disabled]) {
42
+ --_text-color: light-dark(rgb(0, 0, 0/0.3), rgb(255, 255, 255/0.26));
43
+ cursor: not-allowed;
44
+ opacity: 0.64;
45
+ }
46
+
47
+ svg {
48
+ block-size: auto;
49
+ inline-size: auto;
50
+ max-block-size: var(--size-5);
51
+ max-inline-size: var(--size-5);
52
+ pointer-events: none;
53
+ }
54
+
55
+ /* Ripple effect, utils.css */
56
+ &::before {
57
+ --highlight-size: 130%;
58
+ background-color: transparent;
59
+
60
+ @media (prefers-reduced-motion: no-preference) {
61
+ transition: transform 0.2s ease, background-color .1s ease;
62
+ }
63
+ }
64
+
65
+ /* Colors — shared interaction model for critical and primary.
66
+ Each color modifier below only swaps --_color; the tonal surface,
67
+ contrast text, and hover/active strategy are identical.
68
+ The .critical scope class in theme.css redirects --palette-source so
69
+ --color-6 below becomes a tint of the active color. */
70
+ &.critical,
71
+ &.primary {
72
+ --_color-contrast: var(--gray-1);
73
+ --_color-tonal: var(--color-6);
74
+ --_accent-tonal-contrast: var(--text-primary-contrast);
75
+
76
+ --_default-hover-bg-color: oklch(from var(--_accent) l c h / 15%);
77
+ --_default-active-bg-color: oklch(from var(--_accent) l c h / 25%);
78
+
79
+ --_filled-hover-bg-color: oklch(from var(--_accent) calc(l - 0.1) c h);
80
+ --_filled-active-bg-color: oklch(from var(--_accent) calc(l - 0.15) c h);
81
+
82
+ --_outlined-active-bg-color: oklch(from var(--_accent) calc(l - 0.1) c h);
83
+ }
84
+
85
+ &.critical {
86
+ --_color: var(--critical);
87
+ }
88
+
89
+ &.primary {
90
+ --_color: var(--primary);
91
+ }
92
+
93
+ /* Element states */
94
+ &:where(:not([disabled])) {
95
+ &:where(:not(:active):hover) {
96
+ &::before {
97
+ background-color: var(--_interaction-hover-color, var(--_default-hover-bg-color));
98
+ }
99
+ }
100
+
101
+ &:where(:hover:active),
102
+ &[aria-current="page"] {
103
+ &::before {
104
+ background-color: var(--_interaction-active-color, var(--_default-active-bg-color));
105
+ }
106
+ }
107
+ }
108
+
109
+ /* Size */
110
+ &.small {
111
+ block-size: var(--size-4);
112
+ inline-size: var(--size-4);
113
+
114
+ svg {
115
+ max-block-size: var(--size-4);
116
+ max-inline-size: var(--size-4);
117
+ }
118
+ }
119
+
120
+ /* Variants */
121
+ &.outlined {
122
+ --_bg-color: transparent;
123
+ --_border-color: var(--_accent);
124
+ --_text-color: var(--_accent);
125
+ }
126
+
127
+ &.tonal {
128
+ --_bg-color: var(--_accent-tonal);
129
+ --_text-color: var(--_accent-tonal-contrast);
130
+ }
131
+
132
+ &.filled {
133
+ --_bg-color: var(--_accent);
134
+ --_interaction-active-color: var(--_filled-active-bg-color);
135
+ --_interaction-hover-color: var(--_filled-hover-bg-color);
136
+ --_text-color: var(--_accent-contrast);
137
+ }
138
+ }
139
+ }
@@ -1,21 +1,21 @@
1
- @layer components.root {
2
- :where(.link) {
3
- color: var(--primary);
4
- cursor: pointer;
5
- font-weight: 700;
6
- text-decoration: underline;
7
- text-decoration-color: var(--primary);
8
- text-underline-offset: 2px;
9
-
10
- &[href] {
11
- &:hover,
12
- &:focus-visible {
13
- color: var(--primary-light);
14
- }
15
- }
16
-
17
- @supports (-moz-appearance: none) {
18
- text-underline-offset: 2px;
19
- }
20
- }
21
- }
1
+ @layer components.root {
2
+ :where(.link) {
3
+ color: var(--primary);
4
+ cursor: pointer;
5
+ font-weight: 700;
6
+ text-decoration: underline;
7
+ text-decoration-color: var(--primary);
8
+ text-underline-offset: 2px;
9
+
10
+ &[href] {
11
+ &:hover,
12
+ &:focus-visible {
13
+ color: var(--primary-light);
14
+ }
15
+ }
16
+
17
+ @supports (-moz-appearance: none) {
18
+ text-underline-offset: 2px;
19
+ }
20
+ }
21
+ }