@codenhub/styles 0.0.3 → 0.0.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.
@@ -1,155 +1,155 @@
1
- @import "tailwindcss";
2
- @import "../theme.css";
3
-
4
- @utility btn {
5
- --button-color: var(--color-text);
6
- --button-contrast: var(--color-text-contrast);
7
- --button-hover: var(--color-text-hover);
8
- --button-subtle: var(--color-text-subtle);
9
- --button-strong: var(--color-text-strong);
10
- --button-bg: var(--button-color);
11
- --button-fg: var(--button-contrast);
12
- --button-border: var(--button-bg);
13
- --button-hover-bg: var(--button-hover);
14
- --button-hover-fg: var(--button-fg);
15
- --button-hover-border: var(--button-hover-bg);
16
- --button-text: var(--button-strong);
17
- --button-soft-bg: var(--button-subtle);
18
- --button-subtle-hover-bg: color-mix(in srgb, var(--button-soft-bg) 80%, transparent);
19
- --button-soft-hover-bg: color-mix(in srgb, var(--button-soft-bg) 84%, var(--button-text));
20
- --button-spinner: var(--button-fg);
21
-
22
- @apply relative inline-flex min-h-(--control-height,2.5rem) w-fit items-center justify-center gap-2 rounded-(--radius-control) bg-(--button-bg) px-4 py-2 font-semibold whitespace-nowrap text-(--button-fg) no-underline transition-[background-color,border-color,color,opacity,transform] duration-(--motion-duration-fast) ease-(--motion-ease) select-none;
23
- border: var(--border-width) solid var(--button-border);
24
-
25
- &.primary {
26
- --button-color: var(--color-primary);
27
- --button-contrast: var(--color-primary-contrast);
28
- --button-hover: var(--color-primary-hover);
29
- --button-subtle: var(--color-primary-subtle);
30
- --button-strong: var(--color-primary-strong);
31
- }
32
-
33
- &.secondary {
34
- --button-color: var(--color-accent);
35
- --button-contrast: var(--color-accent-contrast);
36
- --button-hover: var(--color-accent-hover);
37
- --button-subtle: var(--color-accent-subtle);
38
- --button-strong: var(--color-accent-strong);
39
- }
40
-
41
- &.success {
42
- --button-color: var(--color-success);
43
- --button-contrast: var(--color-success-contrast);
44
- --button-hover: var(--color-success-hover);
45
- --button-subtle: var(--color-success-subtle);
46
- --button-strong: var(--color-success-strong);
47
- }
48
-
49
- &.warning {
50
- --button-color: var(--color-warning);
51
- --button-contrast: var(--color-warning-contrast);
52
- --button-hover: var(--color-warning-hover);
53
- --button-subtle: var(--color-warning-subtle);
54
- --button-strong: var(--color-warning-strong);
55
- }
56
-
57
- &.destructive,
58
- &.danger,
59
- &.error {
60
- --button-color: var(--color-destructive);
61
- --button-contrast: var(--color-destructive-contrast);
62
- --button-hover: var(--color-destructive-hover);
63
- --button-subtle: var(--color-destructive-subtle);
64
- --button-strong: var(--color-destructive-strong);
65
- }
66
-
67
- &.info {
68
- --button-color: var(--color-info);
69
- --button-contrast: var(--color-info-contrast);
70
- --button-hover: var(--color-info-hover);
71
- --button-subtle: var(--color-info-subtle);
72
- --button-strong: var(--color-info-strong);
73
- }
74
-
75
- &.out {
76
- --button-spinner: var(--button-text);
77
-
78
- @apply bg-transparent text-(--button-color);
79
- border: calc(var(--border-width) * 2) solid var(--button-color);
80
-
81
- &:not(:disabled, .disabled, [aria-disabled="true"], [data-disabled]):hover {
82
- @apply border-(--button-color) bg-(--button-subtle) text-(--button-color);
83
- }
84
-
85
- &.fill {
86
- &:not(:disabled, .disabled, [aria-disabled="true"], [data-disabled]):hover {
87
- @apply border-(--button-color) bg-(--button-color) text-(--button-contrast);
88
- }
89
- }
90
- }
91
-
92
- &.ghost {
93
- --button-spinner: var(--button-text);
94
-
95
- @apply border-transparent bg-transparent text-(--button-text);
96
-
97
- &:not(:disabled, .disabled, [aria-disabled="true"], [data-disabled]):hover {
98
- @apply border-transparent bg-(--button-subtle-hover-bg) text-(--button-text);
99
- }
100
- }
101
-
102
- &.soft {
103
- --button-spinner: var(--button-text);
104
-
105
- @apply border-transparent bg-(--button-soft-bg) text-(--button-text);
106
-
107
- &:not(:disabled, .disabled, [aria-disabled="true"], [data-disabled]):hover {
108
- @apply border-transparent bg-(--button-soft-hover-bg) text-(--button-text);
109
- }
110
- }
111
-
112
- &.sm {
113
- @apply min-h-8 px-3 py-1 text-sm;
114
- }
115
-
116
- &.lg {
117
- @apply min-h-12 px-5 py-2.5 text-[1.0625rem];
118
- }
119
-
120
- &.icon {
121
- @apply aspect-square min-w-(--control-height,2.5rem) p-2;
122
-
123
- aspect-ratio: 1;
124
- }
125
-
126
- &.pill {
127
- @apply rounded-full;
128
- }
129
-
130
- &:not(:disabled, .disabled, [aria-disabled="true"], [data-disabled]):hover {
131
- &:not(.out, .ghost, .soft) {
132
- @apply border-(--button-hover-border) bg-(--button-hover-bg) text-(--button-hover-fg);
133
- }
134
- }
135
-
136
- &:disabled,
137
- &.disabled,
138
- &[aria-disabled="true"],
139
- &[data-disabled] {
140
- @apply cursor-not-allowed;
141
-
142
- opacity: 0.58;
143
- }
144
-
145
- &.loading {
146
- @apply pointer-events-none text-transparent! transition-[opacity,transform];
147
-
148
- &::after {
149
- @apply absolute top-[calc(50%+var(--border-width))] left-[calc(50%+var(--border-width))] block size-4 -translate-1/2 rounded-full bg-(--button-spinner);
150
-
151
- content: "";
152
- @apply ai;
153
- }
154
- }
155
- }
1
+ @import "tailwindcss";
2
+ @import "../theme.css";
3
+
4
+ @utility btn {
5
+ --button-color: var(--color-text);
6
+ --button-contrast: var(--color-text-contrast);
7
+ --button-hover: var(--color-text-hover);
8
+ --button-subtle: var(--color-text-subtle);
9
+ --button-strong: var(--color-text-strong);
10
+ --button-bg: var(--button-color);
11
+ --button-fg: var(--button-contrast);
12
+ --button-border: var(--button-bg);
13
+ --button-hover-bg: var(--button-hover);
14
+ --button-hover-fg: var(--button-fg);
15
+ --button-hover-border: var(--button-hover-bg);
16
+ --button-text: var(--button-strong);
17
+ --button-soft-bg: var(--button-subtle);
18
+ --button-subtle-hover-bg: color-mix(in srgb, var(--button-soft-bg) 80%, transparent);
19
+ --button-soft-hover-bg: color-mix(in srgb, var(--button-soft-bg) 84%, var(--button-text));
20
+ --button-spinner: var(--button-fg);
21
+
22
+ @apply relative inline-flex min-h-(--control-height,2.5rem) w-fit items-center justify-center gap-2 rounded-(--radius-control) bg-(--button-bg) px-4 py-2 font-semibold whitespace-nowrap text-(--button-fg) no-underline transition-[background-color,border-color,color,opacity,transform] duration-(--motion-duration-fast) ease-(--motion-ease) select-none;
23
+ border: var(--border-width) solid var(--button-border);
24
+
25
+ &.primary {
26
+ --button-color: var(--color-primary);
27
+ --button-contrast: var(--color-primary-contrast);
28
+ --button-hover: var(--color-primary-hover);
29
+ --button-subtle: var(--color-primary-subtle);
30
+ --button-strong: var(--color-primary-strong);
31
+ }
32
+
33
+ &.secondary {
34
+ --button-color: var(--color-accent);
35
+ --button-contrast: var(--color-accent-contrast);
36
+ --button-hover: var(--color-accent-hover);
37
+ --button-subtle: var(--color-accent-subtle);
38
+ --button-strong: var(--color-accent-strong);
39
+ }
40
+
41
+ &.success {
42
+ --button-color: var(--color-success);
43
+ --button-contrast: var(--color-success-contrast);
44
+ --button-hover: var(--color-success-hover);
45
+ --button-subtle: var(--color-success-subtle);
46
+ --button-strong: var(--color-success-strong);
47
+ }
48
+
49
+ &.warning {
50
+ --button-color: var(--color-warning);
51
+ --button-contrast: var(--color-warning-contrast);
52
+ --button-hover: var(--color-warning-hover);
53
+ --button-subtle: var(--color-warning-subtle);
54
+ --button-strong: var(--color-warning-strong);
55
+ }
56
+
57
+ &.destructive,
58
+ &.danger,
59
+ &.error {
60
+ --button-color: var(--color-destructive);
61
+ --button-contrast: var(--color-destructive-contrast);
62
+ --button-hover: var(--color-destructive-hover);
63
+ --button-subtle: var(--color-destructive-subtle);
64
+ --button-strong: var(--color-destructive-strong);
65
+ }
66
+
67
+ &.info {
68
+ --button-color: var(--color-info);
69
+ --button-contrast: var(--color-info-contrast);
70
+ --button-hover: var(--color-info-hover);
71
+ --button-subtle: var(--color-info-subtle);
72
+ --button-strong: var(--color-info-strong);
73
+ }
74
+
75
+ &.out {
76
+ --button-spinner: var(--button-text);
77
+
78
+ @apply bg-transparent text-(--button-color);
79
+ border: calc(var(--border-width) * 2) solid var(--button-color);
80
+
81
+ &:not(:disabled, .disabled, [aria-disabled="true"], [data-disabled]):hover {
82
+ @apply border-(--button-color) bg-(--button-subtle) text-(--button-color);
83
+ }
84
+
85
+ &.fill {
86
+ &:not(:disabled, .disabled, [aria-disabled="true"], [data-disabled]):hover {
87
+ @apply border-(--button-color) bg-(--button-color) text-(--button-contrast);
88
+ }
89
+ }
90
+ }
91
+
92
+ &.ghost {
93
+ --button-spinner: var(--button-text);
94
+
95
+ @apply border-transparent bg-transparent text-(--button-text);
96
+
97
+ &:not(:disabled, .disabled, [aria-disabled="true"], [data-disabled]):hover {
98
+ @apply border-transparent bg-(--button-subtle-hover-bg) text-(--button-text);
99
+ }
100
+ }
101
+
102
+ &.soft {
103
+ --button-spinner: var(--button-text);
104
+
105
+ @apply border-transparent bg-(--button-soft-bg) text-(--button-text);
106
+
107
+ &:not(:disabled, .disabled, [aria-disabled="true"], [data-disabled]):hover {
108
+ @apply border-transparent bg-(--button-soft-hover-bg) text-(--button-text);
109
+ }
110
+ }
111
+
112
+ &.sm {
113
+ @apply min-h-8 px-3 py-1 text-sm;
114
+ }
115
+
116
+ &.lg {
117
+ @apply min-h-12 px-5 py-2.5 text-[1.0625rem];
118
+ }
119
+
120
+ &.icon {
121
+ @apply aspect-square min-w-(--control-height,2.5rem) p-2;
122
+ }
123
+
124
+ &.pill {
125
+ @apply rounded-full;
126
+ }
127
+
128
+ &:not(:disabled, .disabled, [aria-disabled="true"], [data-disabled]):hover {
129
+ &:not(.out, .ghost, .soft) {
130
+ @apply border-(--button-hover-border) bg-(--button-hover-bg) text-(--button-hover-fg);
131
+ }
132
+ }
133
+
134
+ &:disabled,
135
+ &.disabled,
136
+ &[aria-disabled="true"],
137
+ &[data-disabled] {
138
+ @apply cursor-not-allowed;
139
+
140
+ opacity: 0.58;
141
+ }
142
+
143
+ &.loading {
144
+ @apply pointer-events-none text-transparent! transition-[opacity,transform];
145
+
146
+ &::after {
147
+ @apply absolute block size-4 -translate-x-1/2 -translate-y-1/2 rounded-full bg-(--button-spinner);
148
+
149
+ top: calc(50% + var(--border-width));
150
+ left: calc(50% + var(--border-width));
151
+ content: "";
152
+ @apply ai;
153
+ }
154
+ }
155
+ }