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,194 @@
1
+ @layer normalize {
2
+ *,
3
+ ::before,
4
+ ::after {
5
+ box-sizing: border-box;
6
+ }
7
+
8
+ * {
9
+ scrollbar-width: thin;
10
+ }
11
+
12
+ :where(html) {
13
+ --_page-bg-color: var(--surface-default);
14
+
15
+ accent-color: var(--primary);
16
+ background-color: var(--_page-bg-color);
17
+ block-size: 100%;
18
+ caret-color: var(--primary);
19
+ color: var(--text-color-2);
20
+ font-family: var(--font-sans);
21
+ interpolate-size: allow-keywords;
22
+ line-height: var(--font-lineheight-4);
23
+
24
+ /* https://kilianvalkhof.com/2022/css-html/your-css-reset-needs-text-size-adjust-probably/ */
25
+ -moz-text-size-adjust: none;
26
+ -webkit-text-size-adjust: none;
27
+ text-size-adjust: none;
28
+
29
+ @media (--motionOK) {
30
+ scroll-behavior: smooth;
31
+ }
32
+ }
33
+
34
+ :where(body) {
35
+ -moz-osx-font-smoothing: grayscale;
36
+ -webkit-font-smoothing: antialiased;
37
+ container-type: inline-size;
38
+ font-size: 16px;
39
+ font-synthesis: style;
40
+ font-weight: 400;
41
+ inline-size: 100%;
42
+ margin: 0;
43
+ min-block-size: 100%;
44
+ min-inline-size: 320px;
45
+ position: relative;
46
+ text-rendering: optimizeLegibility;
47
+ }
48
+
49
+ /* TODO */
50
+ :where(:not(dialog, popover)) {
51
+ margin: 0;
52
+ }
53
+
54
+ :where(:not(fieldset, progress, meter)) {
55
+ background-origin: border-box;
56
+ background-repeat: no-repeat;
57
+ border-style: solid;
58
+ border-width: 0;
59
+ }
60
+
61
+ :where(fieldset) {
62
+ border: var(--field-border-width) solid var(--field-border-color);
63
+ border-radius: var(--field-border-radius);
64
+ padding: var(--size-3);
65
+ display: grid;
66
+ gap: var(--size-3);
67
+ }
68
+
69
+ :where(input, button, textarea),
70
+ :where(input[type="file"])::-webkit-file-upload-button {
71
+ color: inherit;
72
+ font-size: inherit;
73
+ font: inherit;
74
+ letter-spacing: inherit;
75
+ }
76
+
77
+ :where(input):-webkit-autofill,
78
+ :where(input):-webkit-autofill:hover,
79
+ :where(input):-webkit-autofill:focus,
80
+ :where(textarea):-webkit-autofill,
81
+ :where(textarea):-webkit-autofill:hover,
82
+ :where(textarea):-webkit-autofill:focus,
83
+ :where(select):-webkit-autofill,
84
+ :where(select):-webkit-autofill:hover,
85
+ :where(select):-webkit-autofill:focus,
86
+ :where(input):autofill,
87
+ :where(input):autofill:hover,
88
+ :where(input):autofill:focus,
89
+ :where(textarea):autofill,
90
+ :where(textarea):autofill:hover,
91
+ :where(textarea):autofill:focus,
92
+ :where(select):autofill,
93
+ :where(select):autofill:hover,
94
+ :where(select):autofill:focus {
95
+ -webkit-text-fill-color: var(--text-color-2);
96
+ -webkit-box-shadow: 0 0 0px 1e5px var(--well-1) inset;
97
+ transition: background-color 5000s ease-in-out 0s;
98
+ }
99
+
100
+ ::placeholder {
101
+ color: var(--text-color-2);
102
+ }
103
+
104
+ ::-moz-placeholder {
105
+ opacity: 1;
106
+ }
107
+
108
+ :focus-visible {
109
+ /* Inverts the --_page-bg-color */
110
+ --_focus-visible-color: rgb(
111
+ from var(--_page-bg-color) calc(255 - r) calc(255 - g) calc(255 - b)
112
+ );
113
+
114
+ border-radius: var(--border-radius, 0px);
115
+ outline: 2px solid var(--_focus-visible-color);
116
+ outline-offset: 2px;
117
+ }
118
+
119
+ @media (--motionOK) {
120
+ :where(:focus-visible) {
121
+ transition: outline-offset 145ms var(--ease-2);
122
+ }
123
+ :where(:not(:active):focus-visible) {
124
+ transition-duration: 0.15s;
125
+ }
126
+ }
127
+
128
+ :where(:not(:active):focus-visible) {
129
+ outline-offset: var(--outline-offset, 0px);
130
+ }
131
+
132
+ :where(
133
+ a[href],
134
+ area,
135
+ button,
136
+ input:not(
137
+ [type="text"],
138
+ [type="email"],
139
+ [type="number"],
140
+ [type="password"],
141
+ [type=""],
142
+ [type="tel"],
143
+ [type="url"]
144
+ ),
145
+ label[for],
146
+ select,
147
+ summary
148
+ ) {
149
+ cursor: pointer;
150
+ }
151
+
152
+ :where(
153
+ a[href],
154
+ area,
155
+ button,
156
+ [role="button"],
157
+ input,
158
+ label[for],
159
+ select,
160
+ summary,
161
+ textarea,
162
+ [tabindex]:not([tabindex*="-"])
163
+ ) {
164
+ -webkit-tap-highlight-color: transparent;
165
+ touch-action: manipulation;
166
+ }
167
+
168
+ :where(img, svg, video, canvas, audio, iframe, embed, object) {
169
+ display: block;
170
+ }
171
+
172
+ :where(img, svg, video) {
173
+ block-size: auto;
174
+ max-inline-size: 100%;
175
+ }
176
+
177
+ :where(svg:not([width])) {
178
+ inline-size: var(--size-7);
179
+ }
180
+
181
+ :where(dt:not(:first-of-type)) {
182
+ margin-block-start: var(--size-5);
183
+ }
184
+
185
+ :where(figure) {
186
+ display: grid;
187
+ gap: var(--size-2);
188
+ place-items: center;
189
+ }
190
+
191
+ :target {
192
+ scroll-margin-block-start: 2rem;
193
+ }
194
+ }
package/src/theme.css ADDED
@@ -0,0 +1,160 @@
1
+ @layer theme {
2
+ .light {
3
+ --color-scheme: light;
4
+ }
5
+ .dark {
6
+ --color-scheme: dark;
7
+ }
8
+
9
+ :where(html) {
10
+ color-scheme: var(--color-scheme, light dark);
11
+
12
+ --palette-hue: var(--oklch-teal);
13
+ --palette-hue-rotate-by: 5;
14
+ --palette-chroma: 0.89;
15
+
16
+ /* Primary */
17
+ --primary: var(--color-8);
18
+ --primary-light: oklch(from var(--primary) calc(l * 1.25) c h);
19
+ --primary-dark: oklch(from var(--primary) calc(l * 0.75) c h);
20
+ --primary-contrast: var(--gray-1);
21
+
22
+ /* Text */
23
+ --text-color-1: light-dark(var(--gray-15), var(--gray-1));
24
+ --text-color-1-contrast: light-dark(var(--gray-2), var(--gray-15));
25
+ --text-color-2: light-dark(var(--gray-13), var(--gray-4));
26
+ --text-color-2-contrast: light-dark(var(--gray-4), var(--gray-13));
27
+
28
+ /* Surface */
29
+ --surface-default: light-dark(var(--gray-1), var(--gray-13));
30
+ --surface-filled: light-dark(var(--gray-3), var(--gray-15));
31
+ --surface-tonal: light-dark(var(--gray-3), var(--gray-12));
32
+ --surface-elevated: light-dark(var(--gray-1), var(--gray-12));
33
+
34
+ /* Shadows */
35
+ --shadow-color: light-dark(220 3% 15%, 220 40% 2%);
36
+ --shadow-strength: light-dark(1%, 10%);
37
+ --inner-shadow-highlight: light-dark(
38
+ inset 0 -0.5px 0 0 #fff,
39
+ inset 0 0.5px 0 0 #0001,
40
+ inset 0 -0.5px 0 0 #fff1,
41
+ inset 0 0.5px 0 0 #0007
42
+ );
43
+
44
+ /* Typography */
45
+ --font-size-h1: var(--font-size-fluid-3, 3.5rem);
46
+ --font-size-h2: var(--font-size-fluid-2, 2rem);
47
+ --font-size-h3: var(--font-size-fluid-1, 1.5rem);
48
+ --font-size-h4: var(--font-size-3, 1.25rem);
49
+ --font-size-h5: var(--font-size-2, 1.1rem);
50
+ --font-size-h6: var(--font-size-fluid-0, 1rem);
51
+ --font-size-lg: var(--font-size-3, 1.25rem);
52
+ --font-size-md: var(--font-size-fluid-0, 1rem);
53
+ --font-size-sm: 0.875rem;
54
+ --font-size-xs: var(--font-size-0, 0.75rem);
55
+
56
+ /* Borders */
57
+ --border-color: light-dark(var(--gray-4), var(--gray-12));
58
+ --border-radius: var(--size-1);
59
+ --border-width: 1px;
60
+
61
+ /* Input Field */
62
+ --field-border-color: var(--border-color);
63
+ --field-border-radius: var(--size-1);
64
+ --field-border-width: 1px;
65
+ --field-size: 2.3lh;
66
+ --field-size-small: 1.9lh;
67
+
68
+ /* Button */
69
+ --button-border-radius: var(--radius-round);
70
+ /* Ripple effect */
71
+ @media (prefers-reduced-motion: no-preference) {
72
+ --button-ripple-size: 100%;
73
+ --button-ripple-duration: 0.5s;
74
+ }
75
+ }
76
+
77
+ /* Highlight colors */
78
+ :where(.red, .error, del) {
79
+ --palette-hue: var(--oklch-red, 25);
80
+ --palette-chroma: 1;
81
+ --palette-hue-rotate-by: 1;
82
+ }
83
+ :where(.blue, .ok, abbr, dfn) {
84
+ --palette-hue: var(--oklch-blue, 210);
85
+ --palette-chroma: 1;
86
+ --palette-hue-rotate-by: 1;
87
+ }
88
+ :where(.green, .good, ins) {
89
+ --palette-hue: var(--oklch-green, 145);
90
+ --palette-chroma: 1;
91
+ --palette-hue-rotate-by: 1;
92
+ }
93
+ :where(.orange, .warning) {
94
+ --palette-hue: var(--oklch-orange, 75);
95
+ --palette-chroma: 1;
96
+ --palette-hue-rotate-by: 1;
97
+ }
98
+
99
+ :where(html) {
100
+ --red: oklch(from var(--color-9) l 0.2 25);
101
+ --blue: oklch(from var(--color-9) l 0.2 210);
102
+ --green: oklch(from var(--color-9) l 0.2 145);
103
+ --orange: oklch(from var(--color-7) l 0.2 75);
104
+ }
105
+
106
+ /* Gray palette */
107
+ :where(html) {
108
+ --gray-chroma: 0.01;
109
+ --gray-lightness: 255;
110
+
111
+ --gray-1: oklch(
112
+ from var(--color-1) l var(--gray-chroma) var(--gray-lightness)
113
+ );
114
+ --gray-2: oklch(
115
+ from var(--color-2) l var(--gray-chroma) var(--gray-lightness)
116
+ );
117
+ --gray-3: oklch(
118
+ from var(--color-3) l var(--gray-chroma) var(--gray-lightness)
119
+ );
120
+ --gray-4: oklch(
121
+ from var(--color-4) l var(--gray-chroma) var(--gray-lightness)
122
+ );
123
+ --gray-5: oklch(
124
+ from var(--color-5) l var(--gray-chroma) var(--gray-lightness)
125
+ );
126
+ --gray-6: oklch(
127
+ from var(--color-6) l var(--gray-chroma) var(--gray-lightness)
128
+ );
129
+ --gray-7: oklch(
130
+ from var(--color-7) l var(--gray-chroma) var(--gray-lightness)
131
+ );
132
+ --gray-8: oklch(
133
+ from var(--color-8) l var(--gray-chroma) var(--gray-lightness)
134
+ );
135
+ --gray-9: oklch(
136
+ from var(--color-9) l var(--gray-chroma) var(--gray-lightness)
137
+ );
138
+ --gray-10: oklch(
139
+ from var(--color-10) l var(--gray-chroma) var(--gray-lightness)
140
+ );
141
+ --gray-11: oklch(
142
+ from var(--color-11) l var(--gray-chroma) var(--gray-lightness)
143
+ );
144
+ --gray-12: oklch(
145
+ from var(--color-12) l var(--gray-chroma) var(--gray-lightness)
146
+ );
147
+ --gray-13: oklch(
148
+ from var(--color-13) l var(--gray-chroma) var(--gray-lightness)
149
+ );
150
+ --gray-14: oklch(
151
+ from var(--color-14) l var(--gray-chroma) var(--gray-lightness)
152
+ );
153
+ --gray-15: oklch(
154
+ from var(--color-15) l var(--gray-chroma) var(--gray-lightness)
155
+ );
156
+ --gray-16: oklch(
157
+ from var(--color-16) l var(--gray-chroma) var(--gray-lightness)
158
+ );
159
+ }
160
+ }
package/src/utils.css ADDED
@@ -0,0 +1,60 @@
1
+ @layer utils {
2
+ /*
3
+ Screen-reader only
4
+ When you visibly want to hide an element but make it accessible for screen readers.
5
+ */
6
+ .sr-only {
7
+ block-size: 1px;
8
+ clip-path: inset(50%);
9
+ inline-size: 1px;
10
+ overflow: hidden;
11
+ position: absolute;
12
+ white-space: nowrap;
13
+ }
14
+
15
+ /* Hover and active effect for checkbox, radio and icon buttons */
16
+ :where(.checkbox input, .radio input, .icon-button) {
17
+ --isLTR: 1;
18
+ --isRTL: -1;
19
+
20
+ position: relative;
21
+ transform-style: preserve-3d;
22
+
23
+ &:dir(rtl) {
24
+ --isLTR: -1;
25
+ --isRTL: 1;
26
+ }
27
+
28
+ &:where(:not([disabled])) {
29
+ &:hover:before {
30
+ --thumb-scale: 1;
31
+ }
32
+
33
+ &:active:before {
34
+ --thumb-scale: 1.1;
35
+ }
36
+
37
+ &::before {
38
+ --thumb-scale: 0.01;
39
+ --highlight-size: 150%;
40
+
41
+ background-color: oklch(0.6 0 0 / 0.2);
42
+ block-size: var(--highlight-size);
43
+ clip-path: circle(50%);
44
+ content: "";
45
+ inline-size: var(--highlight-size);
46
+ inset-block-start: 50%;
47
+ inset-inline-start: 50%;
48
+ position: absolute;
49
+ transform-origin: center center;
50
+ transform: translateX(calc(var(--isRTL) * 50%)) translateY(-50%)
51
+ translateZ(-1px) scale(var(--thumb-scale));
52
+ will-change: transform;
53
+
54
+ @media (prefers-reduced-motion: no-preference) {
55
+ transition: transform 0.2s ease;
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }