opui-css 2.4.0 → 3.0.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 (80) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +23 -7
  3. package/dist/op.css +1 -14
  4. package/dist/{op+ui.css → theme-one.css} +4378 -4155
  5. package/dist/{ui.css → theme-two.css} +4097 -4100
  6. package/package.json +10 -8
  7. package/src/core/normalize.css +196 -196
  8. package/src/core/utils.css +60 -60
  9. package/src/open-props.css +1 -1
  10. package/src/{components → themes/theme-one/components}/accordion.css +172 -172
  11. package/src/{components → themes/theme-one/components}/alert.css +85 -85
  12. package/src/{components → themes/theme-one/components}/avatar.css +68 -68
  13. package/src/{components → themes/theme-one/components}/badge.css +101 -101
  14. package/src/{components → themes/theme-one/components}/button-group.css +69 -69
  15. package/src/{components → themes/theme-one/components}/button.css +267 -267
  16. package/src/{components → themes/theme-one/components}/card.css +82 -82
  17. package/src/{components → themes/theme-one/components}/checkbox-radio.css +123 -123
  18. package/src/{components → themes/theme-one/components}/chip.css +135 -135
  19. package/src/{components → themes/theme-one/components}/definition-list.css +65 -65
  20. package/src/{components → themes/theme-one/components}/dialog.css +59 -59
  21. package/src/{components → themes/theme-one/components}/divider.css +7 -7
  22. package/src/{components → themes/theme-one/components}/field-group.css +83 -83
  23. package/src/{components → themes/theme-one/components}/field.css +494 -494
  24. package/src/{components → themes/theme-one/components}/icon-button.css +40 -40
  25. package/src/{components → themes/theme-one/components}/link.css +21 -21
  26. package/src/{components → themes/theme-one/components}/list.css +317 -317
  27. package/src/{components → themes/theme-one/components}/progress.css +83 -83
  28. package/src/{components → themes/theme-one/components}/range.css +121 -121
  29. package/src/{components → themes/theme-one/components}/rich-text.css +210 -210
  30. package/src/{components → themes/theme-one/components}/select.css +163 -163
  31. package/src/{components → themes/theme-one/components}/snackbar.css +148 -148
  32. package/src/{components → themes/theme-one/components}/spinner.css +38 -38
  33. package/src/{components → themes/theme-one/components}/switch.css +189 -189
  34. package/src/{components → themes/theme-one/components}/tab-buttons.css +120 -120
  35. package/src/themes/theme-one/components/table.css +100 -0
  36. package/src/{components → themes/theme-one/components}/text-field.css +57 -57
  37. package/src/{components → themes/theme-one/components}/textarea.css +25 -25
  38. package/src/{components → themes/theme-one/components}/toggle-button-group.css +135 -139
  39. package/src/{components → themes/theme-one/components}/tooltip.css +94 -94
  40. package/src/{components → themes/theme-one/components}/typography.css +209 -209
  41. package/src/themes/theme-one/components.css +37 -0
  42. package/src/themes/theme-one/imports.css +16 -0
  43. package/src/{theme.css → themes/theme-one/theme.css} +163 -163
  44. package/src/themes/theme-two/components/accordion.css +172 -0
  45. package/src/themes/theme-two/components/alert.css +85 -0
  46. package/src/themes/theme-two/components/avatar.css +68 -0
  47. package/src/themes/theme-two/components/badge.css +101 -0
  48. package/src/themes/theme-two/components/button-group.css +50 -0
  49. package/src/themes/theme-two/components/button.css +217 -0
  50. package/src/themes/theme-two/components/card.css +82 -0
  51. package/src/themes/theme-two/components/checkbox-radio.css +123 -0
  52. package/src/themes/theme-two/components/chip.css +135 -0
  53. package/src/themes/theme-two/components/definition-list.css +65 -0
  54. package/src/themes/theme-two/components/dialog.css +59 -0
  55. package/src/themes/theme-two/components/divider.css +7 -0
  56. package/src/themes/theme-two/components/field-group.css +83 -0
  57. package/src/themes/theme-two/components/field.css +281 -0
  58. package/src/themes/theme-two/components/icon-button.css +40 -0
  59. package/src/themes/theme-two/components/link.css +21 -0
  60. package/src/themes/theme-two/components/list.css +317 -0
  61. package/src/themes/theme-two/components/progress.css +83 -0
  62. package/src/themes/theme-two/components/range.css +121 -0
  63. package/src/themes/theme-two/components/rich-text.css +210 -0
  64. package/src/themes/theme-two/components/select.css +162 -0
  65. package/src/themes/theme-two/components/snackbar.css +148 -0
  66. package/src/themes/theme-two/components/spinner.css +38 -0
  67. package/src/themes/theme-two/components/switch.css +189 -0
  68. package/src/themes/theme-two/components/tab-buttons.css +120 -0
  69. package/src/{components → themes/theme-two/components}/table.css +107 -107
  70. package/src/themes/theme-two/components/text-field.css +57 -0
  71. package/src/themes/theme-two/components/textarea.css +25 -0
  72. package/src/themes/theme-two/components/toggle-button-group.css +135 -0
  73. package/src/themes/theme-two/components/tooltip.css +94 -0
  74. package/src/themes/theme-two/components/typography.css +209 -0
  75. package/src/themes/theme-two/components.css +37 -0
  76. package/src/themes/theme-two/imports.css +16 -0
  77. package/src/themes/theme-two/theme.css +158 -0
  78. package/src/core/components.css +0 -37
  79. package/src/main.css +0 -13
  80. package/src/opui.css +0 -10
@@ -1,107 +1,107 @@
1
- @layer components.root {
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
- }
1
+ @layer components.root {
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.extended {
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.extended {
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,135 @@
1
+ @layer components.root {
2
+ :where([role="group"].toggle-button-group) {
3
+ --_border-radius: var(--button-border-radius);
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: background-color 0.2s var(--ease-out-3),
58
+ box-shadow 0.2s var(--ease-out-3), border-color 0.2s var(--ease-out-3),
59
+ color 0.2s var(--ease-out-3), outline-offset 0.05s var(--ease-1);
60
+ }
61
+
62
+ /* Element states */
63
+ &:hover {
64
+ --_bg-color: light-dark(oklch(0% 0 0 / 0.04), oklch(100% 0 0 / 0.08));
65
+ }
66
+
67
+ &:focus-visible {
68
+ outline-offset: -6px;
69
+ }
70
+
71
+ /* Disabled */
72
+ &[disabled] {
73
+ border-color: color-mix(in oklch, var(--border-color) 50%, transparent);
74
+ cursor: not-allowed;
75
+ color: color-mix(in oklch, var(--text-color-1) 30%, transparent);
76
+ }
77
+
78
+ &[disabled] + &:not([disabled]):not(:last-of-type) {
79
+ border-inline-end-width: 1px;
80
+ }
81
+
82
+ /* Assign border radius for outline */
83
+ &:first-of-type {
84
+ border-bottom-left-radius: var(--_border-radius);
85
+ border-top-left-radius: var(--_border-radius);
86
+ }
87
+ &:last-of-type {
88
+ border-bottom-right-radius: var(--_border-radius);
89
+ border-top-right-radius: var(--_border-radius);
90
+ }
91
+
92
+ &:last-of-type {
93
+ border-inline-end-width: 0;
94
+ }
95
+
96
+ /* Ripple effect */
97
+ background-position: center;
98
+
99
+ &:where(:not([disabled])) {
100
+ &:where(:not(:active):hover) {
101
+ --ripple: radial-gradient(circle, transparent 1%, var(--_bg-color) 1%)
102
+ center/15000%;
103
+
104
+ transition: background var(--button-ripple-duration);
105
+ }
106
+
107
+ &:where(:hover:active) {
108
+ background-size: var(--button-ripple-size);
109
+ transition: background 0s;
110
+ }
111
+ }
112
+
113
+ /* Icons */
114
+ svg {
115
+ inline-size: var(--_icon-size);
116
+ inset-inline-start: calc(var(--_button-padding-inline));
117
+
118
+ & + svg {
119
+ max-block-size: var(--size-5);
120
+ max-inline-size: var(--size-7);
121
+ }
122
+ }
123
+
124
+ /* Selected */
125
+ &.selected {
126
+ --_bg-color: oklch(from var(--primary) l c h / 25%);
127
+
128
+ /* Checkmark */
129
+ svg:first-of-type {
130
+ margin-block-end: -3px;
131
+ }
132
+ }
133
+ }
134
+ }
135
+ }
@@ -0,0 +1,94 @@
1
+ @layer components.root {
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
+ }