@codenhub/styles 0.0.4 → 0.1.1
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.
- package/LICENSE +201 -201
- package/NOTICE +27 -0
- package/README.md +22 -116
- package/dist/aesthetics/chunky-tile.css +1 -0
- package/dist/aesthetics/glass.css +1 -0
- package/dist/aesthetics/index.css +2 -0
- package/dist/aesthetics/neobrutalism.css +1 -0
- package/dist/aesthetics/pixel.css +1 -0
- package/dist/components.css +2 -2
- package/dist/index.css +2 -2
- package/dist/native.css +2 -0
- package/dist/theme.css +2 -2
- package/dist/tw/aesthetics/chunky-tile.css +109 -0
- package/dist/tw/aesthetics/glass.css +66 -0
- package/dist/tw/aesthetics/index.css +9 -0
- package/dist/tw/aesthetics/neobrutalism.css +63 -0
- package/dist/tw/aesthetics/pixel.css +88 -0
- package/dist/tw/box.css +206 -0
- package/dist/tw/components/button.css +108 -0
- package/dist/tw/components/feedback.css +163 -0
- package/dist/tw/components/form.css +599 -0
- package/dist/tw/components/index.css +28 -0
- package/dist/tw/components/loader.css +122 -0
- package/dist/tw/components/surface.css +122 -0
- package/dist/tw/components/tooltip.css +132 -0
- package/dist/tw/elevation.css +46 -0
- package/dist/tw/index.css +27 -0
- package/dist/tw/intent.css +209 -0
- package/dist/tw/native.css +187 -0
- package/dist/tw/presentation.css +77 -0
- package/dist/tw/reset.css +129 -0
- package/dist/tw/theme.css +223 -0
- package/dist/tw/typography.css +34 -0
- package/dist/tw/utilities/content.css +361 -0
- package/dist/tw/utilities/index.css +6 -0
- package/dist/tw/utilities/layout.css +107 -0
- package/docs/accessibility.md +92 -0
- package/docs/changelog/0.1.0.md +37 -0
- package/docs/changelog/0.1.1.md +10 -0
- package/docs/changelog/index.md +10 -0
- package/docs/concepts.md +68 -0
- package/docs/index.md +35 -0
- package/docs/integrating/astro.md +35 -0
- package/docs/integrating/index.md +41 -0
- package/docs/integrating/nextjs.md +67 -0
- package/docs/integrating/svelte.md +43 -0
- package/docs/integrating/tailwind.md +56 -0
- package/docs/integrating/vue.md +31 -0
- package/docs/setup.md +96 -0
- package/docs/usage/aesthetics.md +120 -0
- package/docs/usage/buttons.md +58 -0
- package/docs/usage/composing.md +143 -0
- package/docs/usage/content-and-layout.md +175 -0
- package/docs/usage/customizing.md +148 -0
- package/docs/usage/feedback.md +79 -0
- package/docs/usage/forms.md +135 -0
- package/docs/usage/index.md +24 -0
- package/docs/usage/theming.md +154 -0
- package/docs/usage/tooltips.md +39 -0
- package/llms-full.txt +1676 -0
- package/llms.txt +26 -0
- package/package.json +176 -33
- package/src/components/button.css +0 -155
- package/src/components/feedback.css +0 -214
- package/src/components/form.css +0 -303
- package/src/components/index.css +0 -9
- package/src/components/loader.css +0 -56
- package/src/components/surface.css +0 -6
- package/src/components/tooltip.css +0 -60
- package/src/index.css +0 -7
- package/src/overrides.css +0 -76
- package/src/theme.css +0 -234
- package/src/typography.css +0 -30
- package/src/utilities.css +0 -40
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
@reference "tailwindcss";
|
|
2
|
+
@import "../theme.css";
|
|
3
|
+
@reference "./loader.css";
|
|
4
|
+
@reference "../box.css";
|
|
5
|
+
|
|
6
|
+
/* A filled, edgeless, raised box you can press. `box` paints it; everything
|
|
7
|
+
here is what makes it a button rather than some other box.
|
|
8
|
+
|
|
9
|
+
The resting values are the published default: a button with no presentation
|
|
10
|
+
class is solid and edgeless, and that is a decision written on three lines
|
|
11
|
+
rather than a `var()` fallback buried in an expression. */
|
|
12
|
+
@utility btn {
|
|
13
|
+
--_d-fill: 100%;
|
|
14
|
+
--_d-fg-on-fill: 100%;
|
|
15
|
+
--_d-border: 0%;
|
|
16
|
+
--_d-elevation: 1;
|
|
17
|
+
|
|
18
|
+
@apply box box-hover box-active relative inline-flex w-fit cursor-pointer items-center justify-center gap-2 px-4 py-2 font-semibold whitespace-nowrap no-underline select-none;
|
|
19
|
+
|
|
20
|
+
min-height: var(--control-height);
|
|
21
|
+
|
|
22
|
+
&.sm {
|
|
23
|
+
@apply min-h-8 px-3 py-1 text-sm;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.lg {
|
|
27
|
+
@apply min-h-12 px-5 py-2.5 text-[1.0625rem];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&.icon {
|
|
31
|
+
@apply aspect-square p-2;
|
|
32
|
+
|
|
33
|
+
min-width: var(--control-height);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* `.p-xs`/`.p-sm`/`.p-lg` are the canonical names, matching the `sm`/`md`/`lg`
|
|
37
|
+
vocabulary the elevation modifier uses; `.dense`/`.compact`/`.spacious` are
|
|
38
|
+
first-class aliases, not a deprecation shim -- the same pattern
|
|
39
|
+
`.destructive`/`.danger`/`.error` uses on the intent axis. Bare `sm`/`lg`
|
|
40
|
+
are already the size modifier's class names, so `p-` prefixes here to
|
|
41
|
+
avoid colliding with a button's own size. `.p-xs` is the tightest step,
|
|
42
|
+
below `.compact`: a chip-sized button in a toolbar or a table cell. */
|
|
43
|
+
&.p-xs,
|
|
44
|
+
&.dense {
|
|
45
|
+
@apply px-2 py-0.5;
|
|
46
|
+
|
|
47
|
+
/* The one padding step that also drops the size floor. At this tier the
|
|
48
|
+
button is a chip in a toolbar or a table cell, where `--control-height`
|
|
49
|
+
is taller than the row it sits in; every other size and padding class
|
|
50
|
+
keeps the floor, so a plain button stays a comfortable target. The icon
|
|
51
|
+
variant gives up `min-width` with it -- with no floor on either axis the
|
|
52
|
+
box is padding around whatever the consumer sized their glyph to. */
|
|
53
|
+
min-height: 0;
|
|
54
|
+
|
|
55
|
+
&.icon {
|
|
56
|
+
@apply p-0.5;
|
|
57
|
+
|
|
58
|
+
min-width: 0;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&.p-sm,
|
|
63
|
+
&.compact {
|
|
64
|
+
@apply px-2.5 py-1;
|
|
65
|
+
|
|
66
|
+
&.icon {
|
|
67
|
+
@apply p-1;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&.p-lg,
|
|
72
|
+
&.spacious {
|
|
73
|
+
@apply px-6 py-3;
|
|
74
|
+
|
|
75
|
+
&.icon {
|
|
76
|
+
@apply p-3;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&.pill {
|
|
81
|
+
@apply rounded-full;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&.loading {
|
|
85
|
+
/* `text-transparent!` forces the label invisible whatever the intent
|
|
86
|
+
resolved to, so the spinner is the only thing left to read. */
|
|
87
|
+
@apply pointer-events-none text-transparent!;
|
|
88
|
+
|
|
89
|
+
& > * {
|
|
90
|
+
opacity: 0 !important;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* The spinner takes the label's colour, which `box` already resolved
|
|
94
|
+
against this button's own intent and presentation. It reads `--_fg`
|
|
95
|
+
rather than `currentColor`: the rule above forces `color` to transparent
|
|
96
|
+
to hide the label, and a spinner painted in `currentColor` inherits that
|
|
97
|
+
and paints nothing at all. */
|
|
98
|
+
&::after {
|
|
99
|
+
@apply loader-mask absolute block size-4 -translate-x-1/2 -translate-y-1/2;
|
|
100
|
+
|
|
101
|
+
background-color: var(--_fg);
|
|
102
|
+
|
|
103
|
+
top: calc(50% + var(--border-width));
|
|
104
|
+
left: calc(50% + var(--border-width));
|
|
105
|
+
content: "";
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
@reference "tailwindcss";
|
|
2
|
+
@import "../theme.css";
|
|
3
|
+
@reference "../box.css";
|
|
4
|
+
@reference "./surface.css";
|
|
5
|
+
|
|
6
|
+
@keyframes anim-skeleton {
|
|
7
|
+
0% {
|
|
8
|
+
background-position: 200% 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
100% {
|
|
12
|
+
background-position: -200% 0;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@keyframes anim-progress-indeterminate {
|
|
17
|
+
0% {
|
|
18
|
+
inset-inline-start: -33%;
|
|
19
|
+
width: 33%;
|
|
20
|
+
}
|
|
21
|
+
50% {
|
|
22
|
+
width: 40%;
|
|
23
|
+
}
|
|
24
|
+
100% {
|
|
25
|
+
inset-inline-start: 100%;
|
|
26
|
+
width: 33%;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* A soft, edged surface, so an aesthetic that blurs surfaces blurs this too: an
|
|
31
|
+
alert is a container carrying a message, not a control. */
|
|
32
|
+
@utility alert {
|
|
33
|
+
@apply surface flex p-4 leading-5;
|
|
34
|
+
|
|
35
|
+
--_d-fill: 12%;
|
|
36
|
+
--_d-fg-on-fill: 0%;
|
|
37
|
+
--_d-border: 100%;
|
|
38
|
+
--_d-elevation: 0;
|
|
39
|
+
|
|
40
|
+
&.icon {
|
|
41
|
+
@apply relative ps-11;
|
|
42
|
+
|
|
43
|
+
&::before {
|
|
44
|
+
@apply absolute start-4 top-4 block size-5 bg-current;
|
|
45
|
+
|
|
46
|
+
content: "";
|
|
47
|
+
mask-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M12 16v-4'/><path d='M12 8h.01'/></svg>");
|
|
48
|
+
-webkit-mask-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M12 16v-4'/><path d='M12 8h.01'/></svg>");
|
|
49
|
+
mask-size: contain;
|
|
50
|
+
-webkit-mask-size: contain;
|
|
51
|
+
mask-repeat: no-repeat;
|
|
52
|
+
-webkit-mask-repeat: no-repeat;
|
|
53
|
+
mask-position: center;
|
|
54
|
+
-webkit-mask-position: center;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&.success::before {
|
|
58
|
+
mask-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='m9 12 2 2 4-4'/></svg>");
|
|
59
|
+
-webkit-mask-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='m9 12 2 2 4-4'/></svg>");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&.warning::before {
|
|
63
|
+
mask-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z'/><path d='M12 9v4'/><path d='M12 17h.01'/></svg>");
|
|
64
|
+
-webkit-mask-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z'/><path d='M12 9v4'/><path d='M12 17h.01'/></svg>");
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&.destructive::before,
|
|
68
|
+
&.danger::before,
|
|
69
|
+
&.error::before {
|
|
70
|
+
mask-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='m15 9-6 6'/><path d='m9 9 6 6'/></svg>");
|
|
71
|
+
-webkit-mask-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='m15 9-6 6'/><path d='m9 9 6 6'/></svg>");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&.info::before {
|
|
75
|
+
mask-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M12 16v-4'/><path d='M12 8h.01'/></svg>");
|
|
76
|
+
-webkit-mask-image: url("data:image/svg+xml;charset=utf-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><path d='M12 16v-4'/><path d='M12 8h.01'/></svg>");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/* A soft, edgeless chip. Small enough that the structural silhouette would be
|
|
82
|
+
most of its height, so it takes the tight one where an aesthetic ships a pair. */
|
|
83
|
+
@utility badge {
|
|
84
|
+
--_d-fill: 12%;
|
|
85
|
+
--_d-fg-on-fill: 0%;
|
|
86
|
+
--_d-border: 0%;
|
|
87
|
+
--_d-elevation: 0;
|
|
88
|
+
|
|
89
|
+
@apply box inline-flex min-h-6 w-fit items-center gap-1 px-2.5 text-xs font-bold;
|
|
90
|
+
|
|
91
|
+
/* Pill by default, but an aesthetic that declares no radius has to mean it, so
|
|
92
|
+
the round corner is this component's fallback rather than a hardcoded value. */
|
|
93
|
+
border-radius: var(--ui-radius, calc(infinity * 1px));
|
|
94
|
+
clip-path: var(--ui-clip-tight, var(--ui-clip, none));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* An indicator reads intent and no presentation token at all. It is a stand-in
|
|
98
|
+
for content rather than a box with a look of its own, so there is nothing for
|
|
99
|
+
a container's `.solid` or `.edgeless` to say about it -- which is also what
|
|
100
|
+
removes the visibility floor that used to fight `--ui-fill` for control of the
|
|
101
|
+
base tone, and the transparent border that only ever appeared if something up
|
|
102
|
+
the tree asked for an edge. */
|
|
103
|
+
@utility skeleton {
|
|
104
|
+
--skeleton-base: color-mix(in oklab, var(--intent-color) 6%, var(--intent-subtle));
|
|
105
|
+
--skeleton-sheen: color-mix(in oklab, var(--intent-color) 10%, var(--color-foreground));
|
|
106
|
+
|
|
107
|
+
@apply min-h-4 w-full;
|
|
108
|
+
|
|
109
|
+
animation: anim-skeleton calc(var(--motion-duration-slow) * 4) linear infinite;
|
|
110
|
+
background: linear-gradient(90deg, var(--skeleton-base), var(--skeleton-sheen), var(--skeleton-base));
|
|
111
|
+
background-size: 200% 100%;
|
|
112
|
+
border-radius: var(--ui-radius, var(--radius-control));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* The same: intent only. The track is 10px tall, which is most of a border under
|
|
116
|
+
any aesthetic thick enough to have an opinion, so the bar draws no edge and the
|
|
117
|
+
ceilings that used to keep one survivable are gone with it. */
|
|
118
|
+
@utility progress {
|
|
119
|
+
--progress-color: var(--intent-color);
|
|
120
|
+
--progress-surface: color-mix(in srgb, var(--intent-subtle) 60%, transparent);
|
|
121
|
+
|
|
122
|
+
@apply relative h-2.5 w-full overflow-hidden bg-(--progress-surface);
|
|
123
|
+
/* Round by default; an aesthetic that declares no radius squares the track and
|
|
124
|
+
its fill together. */
|
|
125
|
+
border-radius: var(--ui-radius, calc(infinity * 1px));
|
|
126
|
+
|
|
127
|
+
&::after {
|
|
128
|
+
content: "";
|
|
129
|
+
@apply absolute start-0 top-0 bottom-0 block h-full transition-[width] duration-(--motion-duration-slow) ease-(--motion-ease);
|
|
130
|
+
|
|
131
|
+
border-radius: var(--ui-radius, calc(infinity * 1px));
|
|
132
|
+
background-color: var(--progress-color);
|
|
133
|
+
width: var(--progress-value, 0%);
|
|
134
|
+
z-index: 2;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&.active::before {
|
|
138
|
+
content: "";
|
|
139
|
+
@apply absolute inset-0 block h-full;
|
|
140
|
+
animation: anim-skeleton calc(var(--motion-duration-slow) * 4) linear infinite;
|
|
141
|
+
background: linear-gradient(
|
|
142
|
+
90deg,
|
|
143
|
+
transparent,
|
|
144
|
+
color-mix(in srgb, var(--progress-color) 15%, transparent),
|
|
145
|
+
transparent
|
|
146
|
+
);
|
|
147
|
+
background-size: 200% 100%;
|
|
148
|
+
z-index: 1;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&.indeterminate::after {
|
|
152
|
+
width: 33%;
|
|
153
|
+
animation: anim-progress-indeterminate 1.5s infinite ease-in-out;
|
|
154
|
+
/* No logical form exists for transform-origin, so the inline-start edge
|
|
155
|
+
is named directly and mirrored under :dir(rtl) to match the
|
|
156
|
+
inset-inline-start positioning above. */
|
|
157
|
+
transform-origin: left;
|
|
158
|
+
|
|
159
|
+
:dir(rtl) & {
|
|
160
|
+
transform-origin: right;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|