opui-css 3.3.4 → 4.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 (174) hide show
  1. package/CHANGELOG.md +235 -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 +53 -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 +5135 -0
  109. package/dist/opui.components.css.map +1 -0
  110. package/dist/opui.css +6604 -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 +64 -55
  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
@@ -1,163 +0,0 @@
1
- @layer components.extended {
2
- :where(.field > select) {
3
- position: relative;
4
-
5
- /* Default arrow */
6
- &::picker-icon {
7
- block-size: 0;
8
- border-block-start: 5px solid;
9
- border-inline: 5px solid transparent;
10
- color: currentColor;
11
- content: "";
12
- inline-size: 0;
13
- inset: 50% var(--size-3) auto auto;
14
- pointer-events: none;
15
- position: absolute;
16
- translate: 0 -50%;
17
- }
18
-
19
- &:open {
20
- &::picker-icon {
21
- rotate: 180deg;
22
- }
23
- }
24
-
25
- /* Select popover */
26
- &::picker(select) {
27
- /* Animation on-stage styles */
28
- border: 0;
29
- box-shadow: var(--shadow-2);
30
- opacity: 1;
31
- padding: 0;
32
- scale: 1;
33
-
34
- /* Animation starting styles */
35
- @starting-style {
36
- opacity: 0;
37
- transform: scale(0.9);
38
- }
39
-
40
- @media (prefers-reduced-motion: no-preference) {
41
- transition: display 0.2s allow-discrete, opacity 0.2s var(--ease-3),
42
- overlay 0.2s allow-discrete, scale 0.2s var(--ease-3);
43
- }
44
- }
45
-
46
- /* Animation off-stage styles */
47
- &:not(:open)::picker(select) {
48
- opacity: 0;
49
- scale: 0.9;
50
- }
51
-
52
- button {
53
- background-color: transparent;
54
- display: flex;
55
- inline-size: 100%;
56
- margin: 0;
57
- position: relative;
58
-
59
- selectedcontent {
60
- overflow: hidden;
61
- text-overflow: ellipsis;
62
- white-space: nowrap;
63
- }
64
- }
65
-
66
- .list {
67
- /* Groups */
68
- [role="group"] {
69
- label {
70
- background-color: light-dark(var(--gray-3), var(--gray-13));
71
- color: light-dark(
72
- oklch(from var(--text-color-1) calc(l * 0.75) c h),
73
- oklch(from var(--text-color-1) calc(l * 1.25) c h)
74
- );
75
- font-weight: 500;
76
- overflow: hidden;
77
- padding-inline: var(--size-2);
78
- text-overflow: ellipsis;
79
- white-space: nowrap;
80
- }
81
-
82
- &:not(:first-child),
83
- option:first-of-type {
84
- margin-block-start: var(--size-2);
85
- }
86
-
87
- option:last-of-type,
88
- &:last-child {
89
- option:last-of-type {
90
- margin-block-end: 0;
91
- }
92
- }
93
- }
94
-
95
- /* Option */
96
- option {
97
- /* Checkmark */
98
- /* TODO - checkmark should be the final version of the checkmark API. Follow the development of this and remove redundant psuedo stuff. */
99
- &::check {
100
- display: none;
101
- }
102
- &::checkmark {
103
- display: none;
104
- }
105
- &::before {
106
- display: none;
107
- }
108
-
109
- &:focus-visible {
110
- outline-offset: -1px;
111
- }
112
- }
113
- }
114
- }
115
-
116
- :where(.field:has(> select)) {
117
- /* Size */
118
- &.small {
119
- button {
120
- padding-block: var(--size-1);
121
- padding-inline: var(--size-2) var(--size-7);
122
-
123
- &::after {
124
- inset-inline-end: var(--size-2);
125
- }
126
- }
127
- }
128
-
129
- /*
130
- * Non-experimental Select
131
- *
132
- * Hack to get the arrow working. Pseudo elements aren't allowed on the `<select>` element, so need to add it on the `.field` class instead. Noting this down if an `:after` element would be needed on a `.field`.
133
- */
134
- &:not(:has(button)) {
135
- select {
136
- appearance: none;
137
- }
138
-
139
- /* Arrow */
140
- &::after {
141
- align-self: center;
142
- block-size: 0;
143
- border-block-start: 5px solid;
144
- border-inline: 5px solid transparent;
145
- content: "";
146
- display: inline-block;
147
- flex-shrink: 0;
148
- grid-column: 1/-1;
149
- grid-row: 1;
150
- inline-size: 0;
151
- inset-inline-end: var(--size-3);
152
- justify-self: end;
153
- pointer-events: none;
154
- position: relative;
155
- }
156
- }
157
- }
158
-
159
- select:has(button),
160
- ::picker(select) {
161
- appearance: base-select;
162
- }
163
- }
@@ -1,148 +0,0 @@
1
- @layer components.extended {
2
- :where(.snackbar) {
3
- align-items: center;
4
- /* Inverse surface-filled */
5
- background-color: light-dark(var(--gray-15), var(--gray-2));
6
- border-radius: var(--border-radius);
7
- box-shadow: var(--shadow-2);
8
- color: var(--text-color-1-contrast);
9
- display: flex;
10
- font-size: var(--font-size-sm);
11
- gap: var(--size-3);
12
- inset-block: auto var(--size-3);
13
- inset-inline: var(--size-3) auto;
14
- justify-content: space-between;
15
- min-inline-size: min(100%, 37ch);
16
- padding: var(--size-2) var(--size-3);
17
- position: fixed;
18
- inline-size: calc(100% - var(--size-6, 1.75rem));
19
- z-index: 100;
20
-
21
- &::backdrop {
22
- display: none;
23
- }
24
-
25
- * {
26
- word-break: break-word;
27
- }
28
-
29
- /* Global positioning (in relation to the window) */
30
- /*** Default (end-start) */
31
- inset-block: auto var(--size-3);
32
- inset-inline: 50% 0;
33
- translate: -50% 0;
34
-
35
- &.start-start,
36
- &.start-center,
37
- &.start-end {
38
- inset-block: var(--size-3) auto;
39
- }
40
-
41
- /* TODO use @custom-media instead? */
42
- @container (width > 480px) {
43
- /* Default (end-start) */
44
- inset-block: auto var(--size-7, 2rem);
45
- inset-inline: var(--size-7, 2rem) auto;
46
- translate: revert;
47
- inline-size: fit-content;
48
-
49
- &.end-start,
50
- &.end-end,
51
- &.start-start,
52
- &.start-end {
53
- translate: revert;
54
- }
55
-
56
- &.start-start {
57
- inset-block: var(--size-7, 2rem) auto;
58
- inset-inline: var(--size-7, 2rem) auto;
59
- }
60
- &.start-center {
61
- inset-block: var(--size-7, 2rem) auto;
62
- inset-inline: 50% 0;
63
- translate: -50% 0;
64
- }
65
- &.start-end {
66
- inset-block: var(--size-7, 2rem) auto;
67
- inset-inline: auto var(--size-7, 2rem);
68
- }
69
- &.end-start {
70
- inset-block-end: var(--size-7, 2rem);
71
- inset-inline: var(--size-7, 2rem) auto;
72
- }
73
- &.end-center {
74
- inset-block: auto var(--size-7, 2rem);
75
- inset-inline: 50% 0;
76
- translate: -50% 0;
77
- }
78
- &.end-end {
79
- inset-block: auto var(--size-7, 2rem);
80
- inset-inline: auto var(--size-7, 2rem);
81
- }
82
- }
83
-
84
- /* Absolute positioning */
85
- &.absolute {
86
- position: absolute;
87
- }
88
-
89
- /* Actions */
90
- .actions {
91
- align-items: center;
92
- display: flex;
93
- flex-shrink: 0;
94
- gap: var(--size-3);
95
- padding-inline: 0;
96
-
97
- button {
98
- /* Inverse hover and active backgrounds */
99
- &:where(:not([disabled])) {
100
- &:where(:not(:active):hover) {
101
- --_bg-color: light-dark(
102
- color-mix(in oklch, white 40%, black),
103
- color-mix(in oklch, white 85%, black)
104
- );
105
- }
106
-
107
- &:where(:hover:active) {
108
- --_bg-color: light-dark(
109
- color-mix(in oklch, white 45%, black),
110
- color-mix(in oklch, white 80%, black)
111
- );
112
- }
113
- }
114
- }
115
-
116
- button:not(:has(svg)) {
117
- border-radius: var(--border-radius);
118
- font-size: inherit;
119
- max-block-size: var(--size-6, 1.5rem);
120
- padding: 1ex;
121
- }
122
-
123
- button:has(svg) {
124
- color: inherit;
125
- max-inline-size: var(--size-6, 1.75rem);
126
- margin: var(--size-00);
127
- padding: var(--size-1);
128
- }
129
- }
130
-
131
- /* Animations */
132
- opacity: 0;
133
- transition: display 0.075s allow-discrete, overlay 0.075s allow-discrete,
134
- opacity 0.075s var(--ease-out-1);
135
-
136
- &:popover-open,
137
- &:popover-open::backdrop,
138
- &.visible {
139
- opacity: 1;
140
- transition: display 0.25s allow-discrete, overlay 0.25s allow-discrete,
141
- opacity 0.25s var(--ease-out-1);
142
-
143
- @starting-style {
144
- opacity: 0;
145
- }
146
- }
147
- }
148
- }
@@ -1,38 +0,0 @@
1
- @layer components.root {
2
- [aria-busy="true"]:not(
3
- input,
4
- select,
5
- textarea,
6
- html,
7
- progress,
8
- [aria-describedby]
9
- ) {
10
- position: relative;
11
-
12
- &::before {
13
- animation: spin 0.7s linear infinite;
14
- border-color: transparent currentColor currentColor;
15
- border-radius: 50%;
16
- border-style: solid;
17
- border-width: 3px;
18
- content: "";
19
- display: inline-block;
20
- block-size: 1em;
21
- opacity: 0.5;
22
- vertical-align: -0.14em;
23
- inline-size: 1em;
24
- }
25
-
26
- &:not(button.button):not(:empty) {
27
- &::before {
28
- margin-inline-end: 0.5em;
29
- }
30
- }
31
- }
32
-
33
- @keyframes spin {
34
- to {
35
- transform: rotate(1turn);
36
- }
37
- }
38
- }
@@ -1,225 +0,0 @@
1
- @layer components.root {
2
- :where(.switch) {
3
- --_accent-color: var(--primary);
4
- --_accent-contrast: var(--primary-contrast);
5
-
6
- --_dot-bg-color: light-dark(var(--gray-11), var(--gray-14));
7
- --_dot-inset: var(--size-1) auto auto var(--size-1);
8
- --_dot-outline-size: 0;
9
- --_dot-size: var(--size-3);
10
-
11
- --_track-bg-color: light-dark(var(--gray-3), var(--gray-8));
12
- --_track-height: var(--size-5);
13
- --_track-width: var(--size-8);
14
- --_transition-tf: var(--ease-4);
15
- --_transition-time: 0.2s;
16
-
17
- align-items: center;
18
- color: var(--text-color-1);
19
- display: inline-grid;
20
- gap: 0 var(--size-2);
21
- grid-auto-columns: auto;
22
- grid-auto-flow: column;
23
- inline-size: fit-content;
24
-
25
- input[type="checkbox"][role="switch"] {
26
- appearance: none;
27
- block-size: var(--_track-height);
28
- cursor: pointer;
29
- inline-size: var(--_track-width);
30
- margin: 0;
31
- position: relative;
32
-
33
- /* Track */
34
- &::before {
35
- background-color: var(--_track-bg-color);
36
- block-size: var(--_track-height);
37
- border: 1px solid var(--_dot-bg-color);
38
- border-radius: 100vmax;
39
- content: "";
40
- inline-size: var(--_track-width);
41
- inset: 0;
42
- position: absolute;
43
- }
44
-
45
- &:focus-visible {
46
- outline-offset: 2px;
47
- outline: 2px solid currentColor;
48
- }
49
-
50
- /* Dot */
51
- &::after {
52
- background-color: var(--_dot-bg-color);
53
- block-size: var(--_dot-size);
54
- border-radius: 100vmax;
55
- content: "";
56
- inline-size: var(--_dot-size);
57
- inset: var(--_dot-inset);
58
- outline-offset: -1px;
59
- outline: var(--_dot-outline-size) solid var(--_dot-bg-color);
60
- position: absolute;
61
- }
62
-
63
- /* Checked */
64
- &:checked {
65
- &::before {
66
- background-color: var(--_accent-color);
67
- border-color: var(--_accent-color);
68
- transition:
69
- background-color var(--_transition-time) var(--_transition-tf),
70
- border-color var(--_transition-time) var(--_transition-tf);
71
- }
72
-
73
- /* Dot */
74
- &::after {
75
- --_dot-bg-color: var(--_accent-contrast);
76
- --_dot-outline-size: calc(var(--size-1) - 1px);
77
-
78
- inset-inline-start: calc(
79
- var(--_track-width) - var(--_dot-size) - var(--size-1)
80
- );
81
- }
82
- }
83
-
84
- /* Animation */
85
- @media (prefers-reduced-motion: no-preference) {
86
- /* Track */
87
- &::before {
88
- transition:
89
- background-color var(--_transition-time) var(--_transition-tf),
90
- border-color var(--_transition-time) var(--_transition-tf);
91
- }
92
-
93
- /* Dot */
94
- &::after {
95
- transition: all var(--_transition-time) var(--_transition-tf);
96
- }
97
-
98
- &:active:after {
99
- --_dot-outline-size: calc(var(--size-1) + 1px);
100
- }
101
-
102
- &:checked {
103
- &:active:after {
104
- --_dot-outline-size: calc(var(--size-1) + 1px);
105
- }
106
- }
107
- }
108
- }
109
-
110
- /* Icons */
111
- &:has(.icon-checked, .icon-unchecked) {
112
- [role="switch"] {
113
- grid-column: 1 / -1;
114
- grid-row: 1;
115
- }
116
-
117
- &:has([role="switch"]:checked) {
118
- .icon-unchecked {
119
- display: none;
120
- }
121
- .icon-checked {
122
- display: block;
123
- }
124
- }
125
-
126
- .icon-checked {
127
- display: none;
128
- }
129
-
130
- svg {
131
- grid-column: 1;
132
- grid-row: 1;
133
- inline-size: var(--_dot-size);
134
- margin-inline-start: calc(
135
- var(--_track-width) - var(--_dot-size) - var(--size-1)
136
- );
137
- pointer-events: none;
138
- z-index: 1;
139
-
140
- &.icon-checked {
141
- margin-inline-start: var(--size-1);
142
- }
143
- }
144
- }
145
-
146
- /* Required dot */
147
- &:has([required]:not(:checked)) {
148
- .label:after {
149
- color: var(--red);
150
- content: "*";
151
- inset: 0 -0.25ex auto auto;
152
- position: absolute;
153
- }
154
- }
155
-
156
- /* Disabled */
157
- &:has([disabled]) {
158
- cursor: not-allowed;
159
- opacity: 0.64;
160
- user-select: none;
161
-
162
- input {
163
- cursor: not-allowed;
164
- }
165
- }
166
-
167
- /* Label */
168
- .label {
169
- grid-column: 2;
170
- grid-row: 1;
171
- min-width: 0;
172
- padding-inline: 0 1ex;
173
- position: relative;
174
- user-select: none;
175
- }
176
-
177
- /* Supporting text */
178
- .supporting-text {
179
- color: var(--text-color-2);
180
- font-size: var(--font-size-xs);
181
- grid-column: 2;
182
- grid-row: 2;
183
- line-height: 1.5;
184
- z-index: 1;
185
- }
186
-
187
- /* Size */
188
- &.small {
189
- --_dot-size: 0.75rem;
190
- --_track-height: var(--size-4);
191
- --_track-width: 2.5rem;
192
- }
193
-
194
- /* Stacked layout */
195
- &.stack {
196
- justify-items: center;
197
- grid-auto-columns: unset;
198
-
199
- .label {
200
- grid-column: 1/-1;
201
- grid-row: 2;
202
- margin-block-start: var(--size-1);
203
- padding-inline: 1ex;
204
- }
205
-
206
- .supporting-text {
207
- grid-column: 1/-1;
208
- grid-row: 3;
209
- }
210
- }
211
-
212
- /* Validation */
213
- &.error {
214
- input {
215
- outline: 2px solid var(--color-9);
216
- border-radius: var(--radius-round);
217
- }
218
-
219
- .label,
220
- .supporting-text {
221
- color: var(--color-9);
222
- }
223
- }
224
- }
225
- }
@@ -1,120 +0,0 @@
1
- @layer components.root {
2
- :where(nav.tabs) {
3
- --_bg-color: transparent;
4
-
5
- & > [role="tablist"] {
6
- button {
7
- outline-color: transparent;
8
- outline-offset: -4px;
9
-
10
- &[aria-selected="true"] {
11
- &:focus-visible {
12
- outline: 2px solid var(--text-color-1);
13
- }
14
- }
15
- }
16
- }
17
-
18
- /* Underlined */
19
- &.underlined {
20
- /* Tab list */
21
- & > [role="tablist"] {
22
- border-bottom: 1px solid var(--border-color);
23
-
24
- button {
25
- --_ripple-color: light-dark(
26
- color-mix(in oklch, var(--gray-2) 80%, var(--color-8)),
27
- color-mix(in oklch, var(--gray-13) 80%, var(--color-8))
28
- );
29
-
30
- background: var(--_bg-color) var(--ripple, none);
31
- font-weight: 500;
32
- line-height: var(--font-lineheight-4);
33
- padding: var(--size-2) var(--size-3);
34
-
35
- &:focus-visible {
36
- border-radius: 0;
37
- }
38
-
39
- &[aria-selected="true"] {
40
- border-block-end: 2px solid var(--primary);
41
- color: var(--primary);
42
- }
43
-
44
- @media (prefers-reduced-motion: no-preference) {
45
- transition: background-color 0.2s var(--ease-out-3),
46
- border-color 0.2s var(--ease-out-3), color 0.2s var(--ease-out-3),
47
- outline-offset 0.05s var(--ease-1);
48
-
49
- /*** Ripple effect */
50
- background-position: center;
51
- transition: background var(--button-ripple-duration);
52
- &:where(:not(:active):hover) {
53
- --ripple: radial-gradient(
54
- circle,
55
- transparent 1%,
56
- var(--_ripple-color) 1%
57
- )
58
- center/15000%;
59
- }
60
-
61
- &:where(:hover:active) {
62
- background-size: var(--button-ripple-size);
63
- transition: background 0s;
64
- }
65
-
66
- &:hover {
67
- background-color: light-dark(
68
- oklch(from var(--primary) calc(l * 0.75) none h / 5%),
69
- oklch(from var(--primary) calc(l * 1.25) none h / 5%)
70
- );
71
- }
72
- }
73
- }
74
- }
75
- }
76
-
77
- /* Filled */
78
- &.filled {
79
- --_bg-color: var(--surface-default);
80
- --_radius: var(--border-radius);
81
- --_selected-bg: var(--surface-filled);
82
-
83
- & > [role="tablist"] {
84
- background-color: var(--_bg-color);
85
- border: var(--border-width) solid var(--border-color);
86
- border-radius: var(--_radius);
87
- overflow: hidden;
88
- padding: 0.792ex;
89
- width: fit-content;
90
-
91
- button {
92
- background-color: var(--_bg-color);
93
- border-radius: var(--_radius);
94
- line-height: var(--font-lineheight-4);
95
- padding-inline: var(--size-3);
96
-
97
- &:hover {
98
- background-color: oklch(from var(--_bg-color) calc(l * 1.25) c h);
99
- }
100
-
101
- &[aria-selected="true"] {
102
- background-color: var(--_selected-bg);
103
-
104
- &:hover {
105
- background-color: oklch(
106
- from var(--_selected-bg) calc(l * 1.25) c h
107
- );
108
- }
109
- }
110
-
111
- @media (prefers-reduced-motion: no-preference) {
112
- transition: background-color 0.2s var(--ease-out-3),
113
- border-color 0.2s var(--ease-out-3), color 0.2s var(--ease-out-3),
114
- outline-offset 0.05s var(--ease-1);
115
- }
116
- }
117
- }
118
- }
119
- }
120
- }