@atelier-ui/styles 0.3.5

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.
@@ -0,0 +1,173 @@
1
+ /* Geometry contract: every size this component states is a border-box size.
2
+ * Declared with the component rather than as a global reset, so it ships in the
3
+ * same file as the sizes it governs and no consuming app has to supply one.
4
+ * Gated by check:box-sizing; the resulting boxes are measured by check:geometry.
5
+ * See ADR-0043. */
6
+ .atl-button,
7
+ .atl-button * {
8
+ box-sizing: border-box;
9
+ }
10
+
11
+ .atl-button {
12
+ display: inline-flex;
13
+ align-items: center;
14
+ justify-content: center;
15
+ gap: var(--ui-spacing-2);
16
+ border: var(--ui-border-width) solid transparent;
17
+ border-radius: var(--ui-radius-md);
18
+ font-family: var(--ui-font-family);
19
+ font-size: var(--ui-font-size-md);
20
+ font-weight: var(--ui-font-weight-semibold);
21
+ line-height: var(--ui-line-height-tight);
22
+ letter-spacing: var(--ui-letter-spacing-tight);
23
+ cursor: pointer;
24
+ transition:
25
+ background-color var(--ui-transition-fast),
26
+ border-color var(--ui-transition-fast),
27
+ color var(--ui-transition-fast),
28
+ box-shadow var(--ui-transition-fast);
29
+ white-space: nowrap;
30
+ text-decoration: none;
31
+ user-select: none;
32
+ }
33
+
34
+ .atl-button:focus-visible {
35
+ outline: none;
36
+ box-shadow: var(--ui-focus-ring);
37
+ }
38
+
39
+ /* Variants — flat by default; subtle state shifts only */
40
+ .atl-button.variant-primary {
41
+ background-color: var(--ui-color-primary);
42
+ color: var(--ui-color-text-on-primary);
43
+ border-color: var(--ui-color-primary);
44
+ }
45
+
46
+ .atl-button.variant-primary:hover:not(.is-disabled) {
47
+ background-color: var(--ui-color-primary-hover);
48
+ border-color: var(--ui-color-primary-hover);
49
+ }
50
+
51
+ .atl-button.variant-primary:active:not(.is-disabled) {
52
+ background-color: var(--ui-color-primary-active);
53
+ border-color: var(--ui-color-primary-active);
54
+ }
55
+
56
+ .atl-button.variant-secondary {
57
+ background-color: var(--ui-color-secondary);
58
+ color: var(--ui-color-text-on-secondary);
59
+ border-color: var(--ui-color-secondary);
60
+ }
61
+
62
+ .atl-button.variant-secondary:hover:not(.is-disabled) {
63
+ background-color: var(--ui-color-secondary-hover);
64
+ border-color: var(--ui-color-secondary-hover);
65
+ }
66
+
67
+ .atl-button.variant-secondary:active:not(.is-disabled) {
68
+ background-color: var(--ui-color-secondary-active);
69
+ border-color: var(--ui-color-secondary-active);
70
+ }
71
+
72
+ .atl-button.variant-outline {
73
+ background-color: var(--ui-color-surface-raised);
74
+ color: var(--ui-color-primary);
75
+ border-color: var(--ui-color-border-strong);
76
+ }
77
+
78
+ .atl-button.variant-outline:hover:not(.is-disabled) {
79
+ background-color: var(--ui-color-surface-sunken);
80
+ border-color: var(--ui-color-primary);
81
+ }
82
+
83
+ .atl-button.variant-outline:active:not(.is-disabled) {
84
+ background-color: var(--ui-color-surface-sunken);
85
+ border-color: var(--ui-color-primary-active);
86
+ }
87
+
88
+ /* Non-color differentiation (WCAG 1.4.1): danger variant carries
89
+ * a darker inset border so its silhouette is recognizable in greyscale
90
+ * and color-blind simulations, not only by red fill. */
91
+ .atl-button.variant-danger {
92
+ background-color: var(--ui-color-danger);
93
+ color: var(--ui-color-text-on-danger);
94
+ border-color: var(--ui-color-danger);
95
+ box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
96
+ }
97
+
98
+ .atl-button.variant-danger:hover:not(.is-disabled) {
99
+ background-color: var(--ui-color-danger-hover);
100
+ border-color: var(--ui-color-danger-hover);
101
+ box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
102
+ }
103
+
104
+ .atl-button.variant-danger:active:not(.is-disabled) {
105
+ background-color: var(--ui-color-danger-active);
106
+ border-color: var(--ui-color-danger-active);
107
+ box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
108
+ }
109
+
110
+ /* Sizes — modern target heights (sm 32px / md 40px / lg 48px) */
111
+ .atl-button.size-sm {
112
+ padding: calc(
113
+ (
114
+ var(--ui-control-height-sm) - var(--ui-line-height-tight) *
115
+ var(--ui-font-size-sm)
116
+ ) /
117
+ 2 - 1px
118
+ )
119
+ 0.875rem;
120
+ font-size: var(--ui-font-size-sm);
121
+ min-height: var(--ui-control-height-sm);
122
+ }
123
+
124
+ .atl-button.size-md {
125
+ padding: calc(
126
+ (
127
+ var(--ui-control-height-md) - var(--ui-line-height-tight) *
128
+ var(--ui-font-size-md)
129
+ ) /
130
+ 2 - 1px
131
+ )
132
+ 1.125rem;
133
+ font-size: var(--ui-font-size-md);
134
+ min-height: var(--ui-control-height-md);
135
+ }
136
+
137
+ .atl-button.size-lg {
138
+ padding: calc(
139
+ (
140
+ var(--ui-control-height-lg) - var(--ui-line-height-tight) *
141
+ var(--ui-font-size-lg)
142
+ ) /
143
+ 2 - 1px
144
+ )
145
+ 1.5rem;
146
+ font-size: var(--ui-font-size-lg);
147
+ min-height: var(--ui-control-height-lg);
148
+ }
149
+
150
+ /* Disabled */
151
+ .atl-button.is-disabled {
152
+ opacity: var(--ui-opacity-disabled);
153
+ cursor: not-allowed;
154
+ pointer-events: none;
155
+ }
156
+
157
+ /* Loading spinner */
158
+ .atl-button > .spinner {
159
+ display: inline-block;
160
+ width: 1em;
161
+ height: 1em;
162
+ border: var(--ui-border-width-thick) solid currentColor;
163
+ border-top-color: transparent;
164
+ border-radius: var(--ui-radius-full);
165
+ animation: atl-spin 0.7s linear infinite;
166
+ flex-shrink: 0;
167
+ }
168
+
169
+ @keyframes atl-spin {
170
+ to {
171
+ transform: rotate(360deg);
172
+ }
173
+ }
@@ -0,0 +1,93 @@
1
+ /* Geometry contract: every size this component states is a border-box size.
2
+ * Declared with the component rather than as a global reset, so it ships in the
3
+ * same file as the sizes it governs and no consuming app has to supply one.
4
+ * Gated by check:box-sizing; the resulting boxes are measured by check:geometry.
5
+ * See ADR-0043. */
6
+ :is(.atl-card, .atl-card-content, .atl-card-footer, .atl-card-header),
7
+ :is(.atl-card, .atl-card-content, .atl-card-footer, .atl-card-header) * {
8
+ box-sizing: border-box;
9
+ }
10
+
11
+ .atl-card {
12
+ /* The library states its own typeface (ADR-0035). Without this the component
13
+ * renders in the consuming app's font while its neighbours render Instrument
14
+ * Sans — measured: a card next to a button showed two typefaces. Declared once
15
+ * per component root, never on a descendant (ADR-0049). */
16
+ font-family: var(--ui-font-family);
17
+ /* The leading every descendant inherits. Stated here so the component keeps
18
+ its own vertical rhythm instead of adopting the consuming app's prose
19
+ leading — the defect that made the row boxes measure differently in a
20
+ Storybook page and in a docs page (ADR-0052). This one carries prose, so normal. */
21
+ line-height: var(--ui-line-height-normal);
22
+ display: block;
23
+ border-radius: var(--ui-radius-xl);
24
+ background-color: var(--ui-color-surface-raised);
25
+ overflow: hidden;
26
+ }
27
+
28
+ /* Modernised variants — single soft shadow on elevated, no shadow on
29
+ * outlined or flat. Cards rest on the page; they don't float off it. */
30
+ .atl-card.variant-elevated {
31
+ box-shadow: var(--ui-shadow-sm);
32
+ border: var(--ui-border-width) solid var(--ui-color-border);
33
+ }
34
+
35
+ .atl-card.variant-outlined {
36
+ border: var(--ui-border-width) solid var(--ui-color-border);
37
+ background-color: var(--ui-color-surface-raised);
38
+ }
39
+
40
+ .atl-card.variant-flat {
41
+ background-color: var(--ui-color-surface-sunken);
42
+ }
43
+
44
+ /* Padding on .atl-card directly affects all slots. The child combinator keeps a
45
+ * nested card on its own padding: with a descendant selector an inner padding-sm
46
+ * card inside a padding-lg card would match both rules and take the later one. */
47
+ .atl-card.padding-none > .atl-card-header,
48
+ .atl-card.padding-none > .atl-card-content,
49
+ .atl-card.padding-none > .atl-card-footer {
50
+ padding: 0;
51
+ }
52
+
53
+ .atl-card.padding-sm > .atl-card-header,
54
+ .atl-card.padding-sm > .atl-card-content,
55
+ .atl-card.padding-sm > .atl-card-footer {
56
+ padding: var(--ui-spacing-4);
57
+ }
58
+
59
+ .atl-card.padding-md > .atl-card-header,
60
+ .atl-card.padding-md > .atl-card-content,
61
+ .atl-card.padding-md > .atl-card-footer {
62
+ padding: var(--ui-spacing-6);
63
+ }
64
+
65
+ .atl-card.padding-lg > .atl-card-header,
66
+ .atl-card.padding-lg > .atl-card-content,
67
+ .atl-card.padding-lg > .atl-card-footer {
68
+ padding: var(--ui-spacing-8);
69
+ }
70
+
71
+ /* Sub-component layouts */
72
+ .atl-card-header {
73
+ display: block;
74
+ font-size: var(--ui-font-size-lg);
75
+ font-weight: var(--ui-font-weight-semibold);
76
+ line-height: var(--ui-line-height-tight);
77
+ color: var(--ui-color-text);
78
+ border-bottom: var(--ui-border-width) solid var(--ui-color-border);
79
+ letter-spacing: var(--ui-letter-spacing-tight);
80
+ }
81
+
82
+ .atl-card-content {
83
+ display: block;
84
+ color: var(--ui-color-text);
85
+ line-height: var(--ui-line-height-normal);
86
+ }
87
+
88
+ .atl-card-footer {
89
+ display: flex;
90
+ align-items: center;
91
+ gap: var(--ui-spacing-3);
92
+ border-top: var(--ui-border-width) solid var(--ui-color-border);
93
+ }