opui-css 1.2.4

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 (40) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +59 -0
  3. package/dist/ui.css +4417 -0
  4. package/package.json +33 -0
  5. package/src/components/accordion.css +172 -0
  6. package/src/components/alert.css +85 -0
  7. package/src/components/avatar.css +68 -0
  8. package/src/components/badge.css +101 -0
  9. package/src/components/button-group.css +69 -0
  10. package/src/components/button.css +272 -0
  11. package/src/components/card.css +82 -0
  12. package/src/components/checkbox-radio.css +123 -0
  13. package/src/components/chip.css +135 -0
  14. package/src/components/definition-list.css +65 -0
  15. package/src/components/description-list.css +0 -0
  16. package/src/components/dialog.css +61 -0
  17. package/src/components/divider.css +7 -0
  18. package/src/components/field-group.css +83 -0
  19. package/src/components/field.css +500 -0
  20. package/src/components/icon-button.css +40 -0
  21. package/src/components/link.css +21 -0
  22. package/src/components/list.css +317 -0
  23. package/src/components/progress.css +80 -0
  24. package/src/components/range.css +121 -0
  25. package/src/components/rich-text.css +210 -0
  26. package/src/components/select.css +166 -0
  27. package/src/components/snackbar.css +152 -0
  28. package/src/components/spinner.css +38 -0
  29. package/src/components/switch.css +189 -0
  30. package/src/components/tab-buttons.css +124 -0
  31. package/src/components/table.css +107 -0
  32. package/src/components/text-field.css +57 -0
  33. package/src/components/textarea.css +25 -0
  34. package/src/components/toggle-button-group.css +142 -0
  35. package/src/components/tooltip.css +94 -0
  36. package/src/components/typography.css +209 -0
  37. package/src/main.css +59 -0
  38. package/src/normalize.css +194 -0
  39. package/src/theme.css +160 -0
  40. package/src/utils.css +60 -0
@@ -0,0 +1,107 @@
1
+ @layer components.base {
2
+ :where(table) {
3
+ border-collapse: collapse;
4
+ display: block;
5
+ margin: var(--size-3) 0;
6
+ max-inline-size: 100%;
7
+ position: relative;
8
+
9
+ /* Rows */
10
+ tr {
11
+ background-color: var(--surface-default);
12
+ border-top: 1px solid var(--border-color);
13
+
14
+ &:hover {
15
+ background-color: oklch(from var(--surface-filled) l c h / 75%);
16
+ }
17
+ }
18
+
19
+ /* Cells */
20
+ th,
21
+ td {
22
+ border: 1px solid var(--border-color);
23
+ padding: var(--size-1) var(--size-2);
24
+ }
25
+
26
+ th {
27
+ background-color: var(--surface-filled);
28
+ color: var(--text-color-1);
29
+ font-size: var(--font-size-sm, 0.75rem);
30
+ font-weight: 600;
31
+ text-align: start;
32
+ }
33
+
34
+ td {
35
+ font-size: var(--font-size-sm, 0.75rem);
36
+ }
37
+
38
+ /* Caption */
39
+ caption {
40
+ caption-side: bottom;
41
+ color: var(--text-color-2);
42
+ font-size: var(--font-size-sm, 0.75rem);
43
+ padding: var(--size-2) 0;
44
+ text-align: start;
45
+ }
46
+
47
+ /* Header */
48
+ thead {
49
+ position: sticky;
50
+ top: 0;
51
+ z-index: 1;
52
+ }
53
+
54
+ /* Footer */
55
+ tfoot {
56
+ border-top: 2px solid var(--border-color);
57
+
58
+ tr {
59
+ background-color: var(--surface-filled);
60
+ }
61
+
62
+ td {
63
+ color: var(--text-color-1);
64
+ font-weight: 600;
65
+ }
66
+ }
67
+
68
+ /* Column group */
69
+ colgroup col {
70
+ border: none;
71
+ }
72
+
73
+ @container (width < 60ch) {
74
+ th,
75
+ td {
76
+ padding: var(--size-1) 0.875rem;
77
+ }
78
+ }
79
+
80
+ /* Sticky header */
81
+ &.sticky-header thead {
82
+ background-color: var(--surface-filled);
83
+ position: sticky;
84
+ inset-block-start: 0;
85
+ z-index: 1;
86
+ }
87
+
88
+ /* Dense */
89
+ &.dense {
90
+ th,
91
+ td {
92
+ padding: var(--size-1) var(--size-2);
93
+ }
94
+
95
+ caption {
96
+ padding: var(--size-1) 0;
97
+ }
98
+
99
+ @container (width < 60ch) {
100
+ th,
101
+ td {
102
+ padding: var(--size-1) var(--size-2);
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
@@ -0,0 +1,57 @@
1
+ @layer components.has-deps {
2
+ :where(
3
+ .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
+ &.small {
22
+ input {
23
+ padding-inline: var(--size-2);
24
+ }
25
+ }
26
+ }
27
+
28
+ /* Autosuggest */
29
+ :where(.field:has(input[list])) {
30
+ /* Hide native arrow */
31
+ input::-webkit-calendar-picker-indicator {
32
+ opacity: 0;
33
+ position: absolute;
34
+ cursor: pointer;
35
+ pointer-events: none;
36
+ }
37
+ }
38
+ :where(
39
+ .field:has(input[list]:placeholder-shown),
40
+ .field:has(input[list]):where(:focus-within, :hover)
41
+ ) {
42
+ /* Arrow */
43
+ &::after {
44
+ block-size: 0;
45
+ border-block-start: 5px solid;
46
+ border-inline: 5px solid transparent;
47
+ content: "";
48
+ display: inline-block;
49
+ flex-shrink: 0;
50
+ inline-size: 0;
51
+ inset: 50% var(--size-3) auto auto;
52
+ pointer-events: none;
53
+ position: absolute;
54
+ translate: 0 -50%;
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,25 @@
1
+ @layer components.has-deps {
2
+ :where(.field:has(textarea)) {
3
+ textarea {
4
+ block-size: auto;
5
+ field-sizing: content;
6
+ min-block-size: 5rem;
7
+ resize: vertical;
8
+ }
9
+
10
+ /* Size */
11
+ &.small {
12
+ textarea {
13
+ min-block-size: var(--_height);
14
+ }
15
+ }
16
+
17
+ /* Auto-fit */
18
+ &.auto-fit {
19
+ textarea {
20
+ min-block-size: var(--_height);
21
+ resize: both;
22
+ }
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,142 @@
1
+ @layer components.base {
2
+ :where([role="group"].toggle-button-group) {
3
+ --_border-radius: var(--radius-round);
4
+ --_button-padding-inline: clamp(var(--size-2), 3cqi, var(--size-4));
5
+ --_max-width: auto;
6
+ --_icon-size: var(--size-4);
7
+
8
+ background-color: var(--surface-default);
9
+ border: 1px solid var(--border-color);
10
+ border-radius: var(--_border-radius);
11
+ display: flex;
12
+ grid-auto-columns: 1fr;
13
+ grid-auto-flow: column;
14
+ max-inline-size: var(--_max-width);
15
+ min-inline-size: max-content;
16
+ overflow: clip;
17
+
18
+ /* Size */
19
+ &.small {
20
+ button {
21
+ min-block-size: 2.1875rem; /* 35px */
22
+ }
23
+ }
24
+
25
+ &.x-small {
26
+ button {
27
+ min-block-size: var(--size-6); /* 30px */
28
+ }
29
+ }
30
+
31
+ &.fullwidth {
32
+ inline-size: 100%;
33
+ }
34
+
35
+ /* Button */
36
+ button {
37
+ --_bg-color: transparent;
38
+
39
+ align-items: center;
40
+ background: var(--_bg-color) var(--ripple, none);
41
+ border-radius: 0;
42
+ border-inline: 1px solid var(--border-color);
43
+ border-inline-start-width: 0;
44
+ color: var(--text-color-1);
45
+ display: inline-flex;
46
+ flex: auto;
47
+ gap: 1ex;
48
+ justify-content: center;
49
+ min-block-size: 2.5rem; /* 40px */
50
+ min-inline-size: 5ex;
51
+ outline-offset: calc(-1 * var(--size-2));
52
+ padding: 0 var(--_button-padding-inline);
53
+ position: relative;
54
+ user-select: none;
55
+
56
+ @media (prefers-reduced-motion: no-preference) {
57
+ transition:
58
+ background-color 0.2s var(--ease-out-3),
59
+ box-shadow 0.2s var(--ease-out-3),
60
+ border-color 0.2s var(--ease-out-3),
61
+ color 0.2s var(--ease-out-3),
62
+ outline-offset 0.05s var(--ease-1);
63
+ }
64
+
65
+ /* Element states */
66
+ &:hover {
67
+ --_bg-color: light-dark(oklch(0% 0 0 / 0.04), oklch(100% 0 0 / 0.08));
68
+ }
69
+
70
+ &:focus-visible {
71
+ outline-offset: -6px;
72
+ }
73
+
74
+ /* Disabled */
75
+ &[disabled] {
76
+ border-color: color-mix(in oklch, var(--border-color) 50%, transparent);
77
+ cursor: not-allowed;
78
+ color: color-mix(in oklch, var(--text-color-1) 30%, transparent);
79
+ }
80
+
81
+ &[disabled] + &:not([disabled]):not(:last-of-type) {
82
+ border-inline-end-width: 1px;
83
+ }
84
+
85
+ /* Assign border radius for outline */
86
+ &:first-of-type {
87
+ border-bottom-left-radius: var(--_border-radius);
88
+ border-top-left-radius: var(--_border-radius);
89
+ }
90
+ &:last-of-type {
91
+ border-bottom-right-radius: var(--_border-radius);
92
+ border-top-right-radius: var(--_border-radius);
93
+ }
94
+
95
+ &:last-of-type {
96
+ border-inline-end-width: 0;
97
+ }
98
+
99
+ /* Ripple effect */
100
+ background-position: center;
101
+
102
+ &:where(:not([disabled])) {
103
+ &:where(:not(:active):hover) {
104
+ --ripple: radial-gradient(circle, transparent 1%, var(--_bg-color) 1%)
105
+ center/15000%;
106
+
107
+ transition: background var(--button-ripple-duration);
108
+ }
109
+
110
+ &:where(:hover:active) {
111
+ background-size: var(--button-ripple-size);
112
+ transition: background 0s;
113
+ }
114
+ }
115
+
116
+ /* Icons */
117
+ svg {
118
+ inline-size: var(--_icon-size);
119
+ inset-inline-start: calc(var(--_button-padding-inline));
120
+
121
+ & + svg {
122
+ max-block-size: var(--size-5);
123
+ max-inline-size: var(--size-7);
124
+ }
125
+ }
126
+
127
+ /* Selected */
128
+ &.selected {
129
+ --_bg-color: color-mix(
130
+ in oklch,
131
+ var(--primary) 12%,
132
+ var(--surface-default)
133
+ );
134
+
135
+ /* Checkmark */
136
+ svg:first-of-type {
137
+ margin-block-end: -3px;
138
+ }
139
+ }
140
+ }
141
+ }
142
+ }
@@ -0,0 +1,94 @@
1
+ @layer components.base {
2
+ :where(.tooltip) {
3
+ background-color: var(--surface-tonal);
4
+ border-radius: var(--radius-2);
5
+ font-size: var(--font-size-xs);
6
+ margin: var(--size-1);
7
+ opacity: 1;
8
+ padding: 0 var(--size-2);
9
+ position: absolute;
10
+ position-area: block-start;
11
+ position-try-fallbacks: flip-block;
12
+ /* position-try-order: most-height; */
13
+ view-transition-name: vt-tooltip;
14
+ z-index: 1;
15
+
16
+ &:hover {
17
+ opacity: 1;
18
+ }
19
+
20
+ &:where([class^="top"], [class^="bottom"]) {
21
+ background-color: red;
22
+ position-try-order: most-height;
23
+ }
24
+
25
+ &:where([class^="left"], [class^="right"]) {
26
+ background-color: red;
27
+ position-try-order: most-width;
28
+ }
29
+
30
+ &.top {
31
+ position-area: block-start;
32
+ }
33
+ &.top-start {
34
+ position-area: block-start span-inline-start;
35
+ }
36
+ &.top-end {
37
+ position-area: block-start span-inline-end;
38
+ }
39
+ &.right {
40
+ position-area: inline-end;
41
+ }
42
+ &.right-start {
43
+ position-area: inline-end span-block-start;
44
+ }
45
+ &.right-end {
46
+ position-area: inline-end span-block-end;
47
+ }
48
+ &.bottom {
49
+ position-area: block-end;
50
+ }
51
+ &.bottom-start {
52
+ position-area: block-end span-inline-start;
53
+ }
54
+ &.bottom-end {
55
+ position-area: block-end span-inline-end;
56
+ }
57
+ &.left {
58
+ position-area: inline-start;
59
+ }
60
+ &.left-start {
61
+ position-area: inline-start span-block-start;
62
+ }
63
+ &.left-end {
64
+ position-area: inline-start span-block-end;
65
+ }
66
+
67
+ /* Swap it around for rtl */
68
+ :dir(rtl) {
69
+ &.right {
70
+ position-area: inline-start;
71
+ }
72
+ &.right-start {
73
+ position-area: inline-start span-block-start;
74
+ }
75
+ &.right-end {
76
+ position-area: inline-start span-block-end;
77
+ }
78
+ &.left {
79
+ position-area: inline-end;
80
+ }
81
+ &.left-start {
82
+ position-area: inline-end span-block-start;
83
+ }
84
+ &.left-end {
85
+ position-area: inline-end span-block-end;
86
+ }
87
+ }
88
+ }
89
+
90
+ ::view-transition-old(vt-tooltip),
91
+ ::view-transition-new(vt-tooltip) {
92
+ height: 100%;
93
+ }
94
+ }
@@ -0,0 +1,209 @@
1
+ @layer components.base {
2
+ /* Base typography */
3
+ :where(h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6) {
4
+ color: var(--text-color-1);
5
+ font-weight: 700;
6
+ text-wrap: pretty;
7
+ }
8
+
9
+ :where(h1, .h1) {
10
+ font-size: var(--font-size-h1, var(--font-size-7));
11
+ letter-spacing: -0.02em;
12
+ line-height: 1.15;
13
+ }
14
+
15
+ :where(h2, .h2) {
16
+ font-size: var(--font-size-h2, var(--font-size-5, 2rem));
17
+ letter-spacing: -0.02em;
18
+ line-height: 1.2;
19
+ }
20
+
21
+ :where(h3, .h3) {
22
+ font-size: var(--font-size-h3, var(--font-size-4, 1.5rem));
23
+ letter-spacing: -0.01em;
24
+ line-height: 1.167;
25
+ }
26
+
27
+ :where(h4, .h4) {
28
+ font-size: var(--font-size-h4, var(--font-size-3, 1.25rem));
29
+ letter-spacing: -0.01em;
30
+ line-height: 1.235;
31
+ }
32
+
33
+ :where(h5, .h5) {
34
+ font-size: var(--font-size-h5, var(--font-size-2, 1.1rem));
35
+ line-height: 1.334;
36
+ }
37
+
38
+ :where(h6, .h6) {
39
+ font-size: var(--font-size-h6, var(--font-size-1, 1rem));
40
+ line-height: 1;
41
+ }
42
+
43
+ :where(hgroup) {
44
+ & > :where(p, .p) {
45
+ margin: 0;
46
+ }
47
+
48
+ & > :where(h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6) {
49
+ margin-block-end: 0.4em;
50
+ }
51
+
52
+ /* The second p element */
53
+ & > :where(p, .p):last-of-type:last-child:not(:first-child) {
54
+ color: oklch(from currentColor l c h / 75%);
55
+ font-size: var(--font-size-lg);
56
+ line-height: 1.6;
57
+ }
58
+ }
59
+
60
+ /** Overline */
61
+ :where(.overline, hgroup > :where(p, .p):first-of-type:first-child) {
62
+ color: light-dark(
63
+ oklch(from var(--text-color-2) calc(l * 1.25) c h),
64
+ oklch(from var(--text-color-2) calc(l * 0.75) c h)
65
+ );
66
+ font-size: var(--font-size-xs);
67
+ font-weight: 500;
68
+ letter-spacing: 0.06em;
69
+ line-height: 2.5;
70
+ text-transform: uppercase;
71
+ }
72
+
73
+ :where(p, .p) {
74
+ text-wrap: pretty;
75
+
76
+ &.small {
77
+ font-size: var(--font-size-md);
78
+ }
79
+ &.large {
80
+ font-size: var(--font-size-lg);
81
+ }
82
+ }
83
+
84
+ /* Inline text elements */
85
+ :where(ins, u, abbr, dfn) {
86
+ text-decoration: underline;
87
+ text-underline-offset: 1px;
88
+
89
+ @supports (-moz-appearance: none) {
90
+ text-underline-offset: 2px;
91
+ }
92
+ }
93
+
94
+ :where(abbr, dfn) {
95
+ font-style: normal;
96
+ text-decoration: var(--color-9) underline dotted;
97
+
98
+ &[title] {
99
+ cursor: help;
100
+ text-underline-offset: 1px;
101
+ }
102
+
103
+ @supports (-moz-appearance: none) {
104
+ text-underline-offset: 2px;
105
+ }
106
+ }
107
+
108
+ :where(sup) {
109
+ font-size: 0.5em;
110
+ }
111
+
112
+ :where(del, ins) {
113
+ color: var(--color-9);
114
+ }
115
+
116
+ :where(small) {
117
+ font-size: max(0.5em, var(--font-size-0, 0.75rem));
118
+ max-inline-size: var(--size-content-1);
119
+ }
120
+
121
+ :where(cite) {
122
+ font-style: italic;
123
+ }
124
+
125
+ /* Blockquote */
126
+ :where(blockquote) {
127
+ border-inline-start-width: var(--border-size-3);
128
+ display: grid;
129
+ gap: var(--size-3);
130
+ padding-block: var(--size-3);
131
+ padding-inline: var(--size-4);
132
+
133
+ :first-child {
134
+ margin-block-start: 0;
135
+ }
136
+
137
+ :last-child {
138
+ margin-block-end: 0;
139
+ }
140
+
141
+ footer {
142
+ color: var(--text-color-2);
143
+ }
144
+ }
145
+
146
+ /* Code */
147
+ :where(pre) {
148
+ border-radius: 0.375rem;
149
+ direction: ltr;
150
+ font-size: 0.875rem;
151
+ line-height: 1.7142857;
152
+ margin-block: 1.7142857em;
153
+ max-inline-size: max-content;
154
+ min-inline-size: 0;
155
+ padding-block: 0.8571429em;
156
+ padding-inline: 1.1428571em;
157
+ white-space: pre;
158
+ writing-mode: lr;
159
+ }
160
+
161
+ :where(code, kbd, samp, pre) {
162
+ font-family: var(--font-mono);
163
+ }
164
+
165
+ :where(code) {
166
+ background-color: oklch(00 0 0 /18%);
167
+ border-radius: var(--border-size-3);
168
+ font-size: 0.9em;
169
+ padding: 0.2ex 0.5ex;
170
+ }
171
+
172
+ :where(kbd, var) {
173
+ background-color: var(--text-color-2);
174
+ border-color: var(--text-color-2);
175
+ border-radius: var(--border-radius, var(--radius-2));
176
+ border-width: var(--border-size-1);
177
+ color: var(--text-color-2-contrast);
178
+ padding: calc(var(--size-1) / 2) var(--size-1);
179
+ }
180
+
181
+ :where(:not(pre) code, kbd) {
182
+ word-break: break-word;
183
+ }
184
+
185
+ :where(:not(pre) code) {
186
+ border-radius: var(--border-radius, var(--radius-2));
187
+ padding: var(--size-1) var(--size-2);
188
+ writing-mode: lr;
189
+ }
190
+
191
+ :where(mark) {
192
+ border-radius: var(--border-radius, 0);
193
+ box-decoration-break: clone;
194
+ padding: calc(var(--size-1) / 2) var(--size-1);
195
+ vertical-align: baseline;
196
+ }
197
+
198
+ /* Misc */
199
+ :where(dt) {
200
+ font-weight: 700;
201
+ }
202
+
203
+ :where(figure) {
204
+ & > :where(figcaption) {
205
+ font-size: var(--font-size-1, 1rem);
206
+ text-wrap: balance;
207
+ }
208
+ }
209
+ }
package/src/main.css ADDED
@@ -0,0 +1,59 @@
1
+ @layer openprops, normalize, utils, theme, components.base, components.has-deps;
2
+
3
+ /*
4
+ * Open Props
5
+ * Import as many props as you need here.
6
+ * https://unpkg.com/browse/open-props@2.0.0-beta.5/css
7
+ */
8
+ @import "open-props/css/media-queries.css";
9
+ @import "open-props/index.css" layer(openprops);
10
+ @import "open-props/css/sizes/media.css" layer(openprops);
11
+ @import "open-props/css/font/lineheight.css" layer(openprops);
12
+ @import "open-props/css/color/hues.oklch.css" layer(openprops);
13
+
14
+ /* Normalize */
15
+ @import "./normalize.css";
16
+
17
+ /* Utils */
18
+ @import "./utils.css";
19
+
20
+ /* Theme */
21
+ @import "./theme.css";
22
+
23
+ /*
24
+ * Components
25
+ * Components are divided into two categories - if they are stand-alone (base) or if they have dependencies (has-deps).
26
+ */
27
+ /*** Base components (no dependencies) */
28
+ @import "./components/button.css";
29
+ @import "./components/icon-button.css";
30
+ @import "./components/tab-buttons.css";
31
+ @import "./components/toggle-button-group.css";
32
+ @import "./components/avatar.css";
33
+ @import "./components/badge.css";
34
+ @import "./components/card.css";
35
+ @import "./components/chip.css";
36
+ @import "./components/definition-list.css";
37
+ @import "./components/divider.css";
38
+ @import "./components/link.css";
39
+ @import "./components/table.css";
40
+ @import "./components/progress.css";
41
+ @import "./components/spinner.css";
42
+ @import "./components/checkbox-radio.css";
43
+ @import "./components/switch.css";
44
+ @import "./components/range.css";
45
+ @import "./components/typography.css";
46
+
47
+ /*** Has dependencies */
48
+ @import "./components/button-group.css";
49
+ @import "./components/accordion.css";
50
+ @import "./components/list.css";
51
+ @import "./components/alert.css";
52
+ @import "./components/dialog.css";
53
+ @import "./components/snackbar.css";
54
+ @import "./components/field-group.css";
55
+ @import "./components/field.css";
56
+ @import "./components/select.css";
57
+ @import "./components/text-field.css";
58
+ @import "./components/textarea.css";
59
+ @import "./components/rich-text.css";