@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,146 @@
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-code-block,
7
+ .atl-code-block * {
8
+ box-sizing: border-box;
9
+ }
10
+
11
+ /* ============================================================
12
+ atl-code-block.css
13
+ ============================================================ */
14
+
15
+ .atl-code-block {
16
+ display: block;
17
+ border: var(--ui-border-width) solid var(--ui-color-border);
18
+ border-radius: var(--ui-radius-lg);
19
+ overflow: hidden;
20
+ font-family: var(--ui-font-family);
21
+ /* The leading every descendant inherits, stated so the component keeps its
22
+ own rhythm rather than the consuming app's prose leading (ADR-0052).
23
+ Chrome around the code, so tight — the code element states the code leading itself. */
24
+ line-height: var(--ui-line-height-tight);
25
+ }
26
+
27
+ /* ---------------------------------------------------------------------------
28
+ Header
29
+ --------------------------------------------------------------------------- */
30
+
31
+ .atl-code-block > .code-block-header {
32
+ display: flex;
33
+ align-items: center;
34
+ justify-content: space-between;
35
+ /* No block padding: the row is a centred flex line, so `min-height` alone
36
+ * decides the height. Authoring 12+12 around the 0.72rem mono label rendered
37
+ * 43px against a 40px token, and deriving the padding from the label's metrics
38
+ * only moves the guess — the label's line box is not the header's business.
39
+ * See ADR-0047. */
40
+ /* Stated, not inherited: an inherited line-height makes the box grow with the
41
+ * text metrics, which is how three controls measured right on one machine and
42
+ * wrong on another (ADR-0048). */
43
+ line-height: var(--ui-line-height-tight);
44
+ padding: 0 var(--ui-spacing-4);
45
+ background: var(--ui-color-surface-raised);
46
+ border-bottom: var(--ui-border-width) solid var(--ui-color-border);
47
+ min-height: var(--ui-control-height-md);
48
+ }
49
+
50
+ .atl-code-block > .code-block-header > .code-block-label {
51
+ font-family: var(--ui-font-mono);
52
+ font-size: var(--ui-font-size-xs);
53
+ font-weight: var(--ui-font-weight-semibold);
54
+ letter-spacing: 0.03em;
55
+ color: var(--ui-color-text-muted);
56
+ text-transform: lowercase;
57
+ user-select: none;
58
+ }
59
+
60
+ /* ---------------------------------------------------------------------------
61
+ Copy button
62
+ --------------------------------------------------------------------------- */
63
+
64
+ .atl-code-block > .code-block-header > .code-block-copy {
65
+ display: inline-flex;
66
+ align-items: center;
67
+ gap: var(--ui-spacing-1);
68
+ padding: var(--ui-spacing-1) var(--ui-spacing-2);
69
+ border: var(--ui-border-width) solid var(--ui-color-border);
70
+ border-radius: var(--ui-radius-sm);
71
+ background: transparent;
72
+ color: var(--ui-color-text-muted);
73
+ font-family: inherit;
74
+ font-size: var(--ui-font-size-xs);
75
+ font-weight: var(--ui-font-weight-medium);
76
+ cursor: pointer;
77
+ transition:
78
+ color var(--ui-transition-fast),
79
+ background var(--ui-transition-fast),
80
+ border-color var(--ui-transition-fast);
81
+ white-space: nowrap;
82
+ }
83
+
84
+ .atl-code-block > .code-block-header > .code-block-copy:hover {
85
+ color: var(--ui-color-text);
86
+ background: var(--ui-color-surface);
87
+ border-color: var(--ui-color-input-border);
88
+ }
89
+
90
+ .atl-code-block > .code-block-header > .code-block-copy:focus-visible {
91
+ outline: none;
92
+ box-shadow: var(--ui-focus-ring);
93
+ }
94
+
95
+ /* ---------------------------------------------------------------------------
96
+ Code body
97
+ --------------------------------------------------------------------------- */
98
+
99
+ .atl-code-block > .code-block-body {
100
+ background: var(--ui-color-surface);
101
+ overflow-x: auto;
102
+ }
103
+
104
+ .atl-code-block > .code-block-body > .code-block-pre {
105
+ margin: 0;
106
+ padding: var(--ui-spacing-4);
107
+ font: var(--ui-type-code);
108
+ color: var(--ui-color-text);
109
+ white-space: pre;
110
+ tab-size: 2;
111
+ }
112
+
113
+ /* ---------------------------------------------------------------------------
114
+ Line numbers
115
+ --------------------------------------------------------------------------- */
116
+
117
+ .atl-code-block > .code-block-body > .code-block-pre > code > .code-line {
118
+ display: flex;
119
+ }
120
+
121
+ .atl-code-block
122
+ > .code-block-body
123
+ > .code-block-pre
124
+ > code
125
+ > .code-line
126
+ > .code-line-number {
127
+ display: inline-block;
128
+ min-width: 2rem;
129
+ padding-right: var(--ui-spacing-3);
130
+ color: var(--ui-color-text-muted);
131
+ text-align: right;
132
+ user-select: none;
133
+ border-right: var(--ui-border-width) solid var(--ui-color-border);
134
+ margin-right: var(--ui-spacing-3);
135
+ flex-shrink: 0;
136
+ opacity: 0.6;
137
+ }
138
+
139
+ .atl-code-block
140
+ > .code-block-body
141
+ > .code-block-pre
142
+ > code
143
+ > .code-line
144
+ > .code-line-text {
145
+ flex: 1;
146
+ }
@@ -0,0 +1,258 @@
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(
7
+ .atl-combobox,
8
+ .atl-combobox-error-message,
9
+ .atl-combobox-errors,
10
+ .atl-combobox-icon,
11
+ .atl-combobox-input,
12
+ .atl-combobox-no-results,
13
+ .atl-combobox-option,
14
+ .atl-combobox-panel,
15
+ .atl-combobox-wrapper
16
+ ),
17
+ :is(
18
+ .atl-combobox,
19
+ .atl-combobox-error-message,
20
+ .atl-combobox-errors,
21
+ .atl-combobox-icon,
22
+ .atl-combobox-input,
23
+ .atl-combobox-no-results,
24
+ .atl-combobox-option,
25
+ .atl-combobox-panel,
26
+ .atl-combobox-wrapper
27
+ )
28
+ * {
29
+ box-sizing: border-box;
30
+ }
31
+
32
+ /* ============================================================
33
+ atl-combobox.css
34
+ ============================================================ */
35
+
36
+ .atl-combobox {
37
+ display: block;
38
+ position: relative;
39
+ font-family: var(--ui-font-family);
40
+ /* The leading every descendant inherits, stated so the component keeps its
41
+ own rhythm rather than the consuming app's prose leading (ADR-0052).
42
+ A single-line field over a list of rows, so tight. */
43
+ line-height: var(--ui-line-height-tight);
44
+ font-size: var(--ui-font-size-md);
45
+ }
46
+
47
+ /* ---------------------------------------------------------------------------
48
+ Input wrapper
49
+ --------------------------------------------------------------------------- */
50
+ .atl-combobox-wrapper {
51
+ position: relative;
52
+ display: flex;
53
+ align-items: center;
54
+ }
55
+
56
+ .atl-combobox-input {
57
+ width: 100%;
58
+ min-height: var(--ui-control-height-md);
59
+ box-sizing: border-box;
60
+ /* Control line-height plus padding derived from the height, so the box does not
61
+ * depend on which font is installed. Authored 0.625rem padding with an inherited
62
+ * line-height rendered 40px with Instrument Sans and 41px with the fallback — the
63
+ * defect only appeared in CI. See ADR-0048. */
64
+ line-height: var(--ui-line-height-tight);
65
+ padding: calc(
66
+ (
67
+ var(--ui-control-height-md) - var(--ui-line-height-tight) *
68
+ var(--ui-font-size-md)
69
+ ) /
70
+ 2 - var(--ui-border-width)
71
+ )
72
+ calc(var(--ui-spacing-4) + 1.25rem + var(--ui-spacing-5))
73
+ calc(
74
+ (
75
+ var(--ui-control-height-md) - var(--ui-line-height-tight) *
76
+ var(--ui-font-size-md)
77
+ ) /
78
+ 2 - var(--ui-border-width)
79
+ )
80
+ var(--ui-spacing-4);
81
+ font-family: inherit;
82
+ font-size: inherit;
83
+ color: var(--ui-color-text);
84
+ background-color: var(--ui-color-input-bg);
85
+ border: var(--ui-border-width) solid var(--ui-color-input-border);
86
+ border-radius: var(--ui-radius-md);
87
+ outline: none;
88
+ transition:
89
+ border-color var(--ui-transition-fast),
90
+ box-shadow var(--ui-transition-fast),
91
+ background-color var(--ui-transition-fast);
92
+ cursor: text;
93
+ }
94
+
95
+ .atl-combobox-input::placeholder {
96
+ color: var(--ui-color-placeholder);
97
+ }
98
+
99
+ .atl-combobox-input:hover:not(:disabled) {
100
+ border-color: var(--ui-color-input-border-hover);
101
+ }
102
+
103
+ .atl-combobox-input:focus-visible,
104
+ .atl-combobox.is-open .atl-combobox-input {
105
+ border-color: var(--ui-color-input-border-focus);
106
+ box-shadow: var(--ui-focus-ring);
107
+ }
108
+
109
+ .atl-combobox.is-invalid .atl-combobox-input {
110
+ border-color: var(--ui-color-input-border-invalid);
111
+ }
112
+
113
+ .atl-combobox.is-invalid .atl-combobox-input:focus-visible {
114
+ border-color: var(--ui-color-input-border-invalid);
115
+ box-shadow: var(--ui-focus-ring-danger);
116
+ }
117
+
118
+ .atl-combobox.is-disabled {
119
+ opacity: var(--ui-opacity-disabled);
120
+ cursor: not-allowed;
121
+ }
122
+
123
+ .atl-combobox.is-disabled .atl-combobox-input {
124
+ cursor: not-allowed;
125
+ }
126
+
127
+ /* ---------------------------------------------------------------------------
128
+ Chevron icon
129
+ --------------------------------------------------------------------------- */
130
+ .atl-combobox-icon {
131
+ position: absolute;
132
+ inset-inline-end: var(--ui-spacing-4);
133
+ pointer-events: none;
134
+ color: var(--ui-color-text-muted);
135
+ transition: transform var(--ui-transition-fast);
136
+ display: flex;
137
+ align-items: center;
138
+ }
139
+
140
+ .atl-combobox.is-open .atl-combobox-icon {
141
+ transform: rotate(180deg);
142
+ }
143
+
144
+ /* ---------------------------------------------------------------------------
145
+ Panel
146
+ --------------------------------------------------------------------------- */
147
+ .atl-combobox-panel {
148
+ position: absolute;
149
+ left: 0;
150
+ top: calc(100% + var(--ui-spacing-2));
151
+ width: 100%;
152
+ max-height: 16rem;
153
+ overflow-y: auto;
154
+ margin: 0;
155
+ padding: var(--ui-spacing-2) 0;
156
+ background-color: var(--ui-color-surface-raised);
157
+ border: var(--ui-border-width) solid var(--ui-color-border);
158
+ border-radius: var(--ui-radius-md);
159
+ box-shadow: var(--ui-shadow-lg);
160
+ z-index: var(--ui-z-dropdown);
161
+ list-style: none;
162
+ }
163
+
164
+ /* ---------------------------------------------------------------------------
165
+ Options
166
+ --------------------------------------------------------------------------- */
167
+ .atl-combobox-option {
168
+ display: flex;
169
+ align-items: center;
170
+ justify-content: space-between;
171
+ /* Row recipe (ADR-0052): the height is stated, the block padding is zero and the
172
+ * content is centred. A row centres, a control pads — ADR-0041's derived-padding
173
+ * formula produces the wrong box here. The line-height is stated so the box does
174
+ * not follow the installed font (ADR-0048).
175
+ */
176
+ min-height: var(--ui-row-height-sm);
177
+ padding-block: 0;
178
+ line-height: var(--ui-line-height-tight);
179
+ padding-inline: var(--ui-spacing-4);
180
+ cursor: pointer;
181
+ color: var(--ui-color-text);
182
+ font-size: var(--ui-font-size-md);
183
+ transition: background-color var(--ui-transition-fast);
184
+ }
185
+
186
+ .atl-combobox-option:hover:not(.is-disabled) {
187
+ background-color: var(--ui-color-surface-sunken);
188
+ }
189
+
190
+ .atl-combobox-option.is-active {
191
+ background-color: var(--ui-color-primary-light);
192
+ color: var(--ui-color-primary);
193
+ }
194
+
195
+ .atl-combobox-option.is-selected {
196
+ font-weight: var(--ui-font-weight-semibold);
197
+ }
198
+
199
+ .atl-combobox-option.is-disabled {
200
+ opacity: var(--ui-opacity-disabled);
201
+ cursor: not-allowed;
202
+ }
203
+
204
+ /* Two classes deep on purpose: the check is an <atl-icon>, and the icon's own
205
+ * `.atl-icon { color: currentColor }` has the same one-class specificity, so a bare
206
+ * `.atl-combobox-check` was decided by which stylesheet was inserted last (Angular
207
+ * emulation hid that, since it added an attribute and so won outright). */
208
+ .atl-combobox-option > .atl-combobox-check {
209
+ color: var(--ui-color-primary);
210
+ flex-shrink: 0;
211
+ }
212
+
213
+ /* ---------------------------------------------------------------------------
214
+ No results
215
+ --------------------------------------------------------------------------- */
216
+ .atl-combobox-no-results {
217
+ padding: var(--ui-spacing-4);
218
+ text-align: center;
219
+ color: var(--ui-color-text-muted);
220
+ font-size: var(--ui-font-size-sm);
221
+ }
222
+
223
+ /* ---------------------------------------------------------------------------
224
+ Errors
225
+ --------------------------------------------------------------------------- */
226
+ .atl-combobox-errors {
227
+ margin-top: var(--ui-spacing-2);
228
+ }
229
+
230
+ .atl-combobox-error-message {
231
+ margin: 0;
232
+ font-size: var(--ui-font-size-sm);
233
+ color: var(--ui-color-error-text);
234
+ line-height: var(--ui-line-height-normal);
235
+ }
236
+
237
+ /* Readonly state — content, not a control: the interactive edge goes away while
238
+ * the filled surface stays. Transparent rather than removed so the 1px border
239
+ * keeps its space and the height stays put (ADR-0045). */
240
+ .atl-combobox.is-readonly .atl-combobox-input {
241
+ border-color: transparent;
242
+ cursor: default;
243
+ }
244
+
245
+ /* The invalid indicator sits inline-end, left of the chevron, and the field reserves
246
+ * the space for it unconditionally so nothing shifts when the state flips. Slot:
247
+ * 16px inset + 16px chevron + 4px gap + 16px indicator + 4px = 56px.
248
+ * AtlInput and AtlTextarea already showed this indicator; carrying invalid on border
249
+ * colour alone left AtlSelect and AtlCombobox failing WCAG 1.4.1 whenever a consumer
250
+ * set invalid without passing errors (ADR-0055). */
251
+ .atl-combobox.is-invalid > .atl-combobox-wrapper > .invalid-icon {
252
+ position: absolute;
253
+ top: 50%;
254
+ transform: translateY(-50%);
255
+ inset-inline-end: calc(var(--ui-spacing-4) + var(--ui-spacing-5));
256
+ color: var(--ui-color-danger);
257
+ pointer-events: none;
258
+ }
@@ -0,0 +1,197 @@
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-dialog, .atl-dialog-content, .atl-dialog-footer, .atl-dialog-header),
7
+ :is(.atl-dialog, .atl-dialog-content, .atl-dialog-footer, .atl-dialog-header)
8
+ * {
9
+ box-sizing: border-box;
10
+ }
11
+
12
+ /* ── Native <dialog> reset + base ──────────────────────────────────────────── */
13
+ .atl-dialog {
14
+ all: unset;
15
+ /* Restated after `all: unset`, which resets the box model too — the component's
16
+ * geometry contract has the same specificity and loses on source order, so this
17
+ * element was content-box and 2px taller than its own CSS said (ADR-0051). */
18
+ box-sizing: border-box;
19
+ /* After `all: unset`, which would otherwise reset it. The library states its own
20
+ * typeface (ADR-0035); without this the dialog renders in the consuming app's
21
+ * font while its neighbours render Instrument Sans (ADR-0049). */
22
+ font-family: var(--ui-font-family);
23
+ /* The leading every descendant inherits. Stated here so the component keeps
24
+ its own vertical rhythm instead of adopting the consuming app's prose
25
+ leading — the defect that made the row boxes measure differently in a
26
+ Storybook page and in a docs page (ADR-0052). This one carries prose, so normal. */
27
+ line-height: var(--ui-line-height-normal);
28
+ position: fixed;
29
+ inset: 0;
30
+ margin: auto;
31
+ width: fit-content;
32
+ height: fit-content;
33
+ display: none; /* hidden by default; showModal() moves to top layer */
34
+ flex-direction: column;
35
+ max-width: 100vw;
36
+ max-height: calc(100dvh - var(--ui-spacing-8));
37
+ border-radius: var(--ui-radius-lg);
38
+ background: var(--ui-color-surface);
39
+ box-shadow: var(--ui-shadow-xl, 0 20px 60px rgba(0, 0, 0, 0.3));
40
+ color: var(--ui-color-text);
41
+ overflow: hidden;
42
+
43
+ /* Open/close animation */
44
+ opacity: 0;
45
+ transform: scale(0.95);
46
+ transition:
47
+ opacity var(--ui-duration-slow) var(--ui-ease-out, ease-out),
48
+ transform var(--ui-duration-slow) var(--ui-ease-out, ease-out),
49
+ display var(--ui-duration-slow) allow-discrete,
50
+ overlay var(--ui-duration-slow) allow-discrete;
51
+ }
52
+
53
+ .atl-dialog[open] {
54
+ display: flex;
55
+ opacity: 1;
56
+ transform: scale(1);
57
+ }
58
+
59
+ @starting-style {
60
+ .atl-dialog[open] {
61
+ opacity: 0;
62
+ transform: scale(0.95);
63
+ }
64
+ }
65
+
66
+ /* ── Backdrop ────────────────────────────────────────────────────────────── */
67
+ .atl-dialog::backdrop {
68
+ background: var(--ui-color-overlay);
69
+ backdrop-filter: blur(2px);
70
+ transition:
71
+ opacity var(--ui-duration-slow) var(--ui-ease-out, ease-out),
72
+ display var(--ui-duration-slow) allow-discrete,
73
+ overlay var(--ui-duration-slow) allow-discrete;
74
+ }
75
+
76
+ @starting-style {
77
+ .atl-dialog[open]::backdrop {
78
+ opacity: 0;
79
+ }
80
+ }
81
+
82
+ @media (prefers-color-scheme: dark) {
83
+ .atl-dialog::backdrop {
84
+ background: var(--ui-color-overlay);
85
+ }
86
+ }
87
+
88
+ [data-theme='dark'] .atl-dialog::backdrop {
89
+ background: var(--ui-color-overlay);
90
+ }
91
+
92
+ /* ── Panel (inner wrapper) ───────────────────────────────────────────────── */
93
+ .atl-dialog > .panel {
94
+ display: flex;
95
+ flex-direction: column;
96
+ width: 100%;
97
+ max-height: inherit;
98
+ overflow: hidden;
99
+ }
100
+
101
+ /* ── Size variants ───────────────────────────────────────────────────────────
102
+ * Scoped to the dialog. React applies size-* on the <dialog class="atl-dialog">
103
+ * itself; Angular/Vue apply it on the inner .panel, a direct child of that same
104
+ * <dialog class="atl-dialog"> — hence the selector pair. Bare `.size-*` selectors
105
+ * leaked globally and resized unrelated elements (e.g. `atl-button size-md`). */
106
+ .atl-dialog.size-sm,
107
+ .atl-dialog > .panel.size-sm {
108
+ width: min(24rem, 90vw);
109
+ }
110
+
111
+ .atl-dialog.size-md,
112
+ .atl-dialog > .panel.size-md {
113
+ width: min(36rem, 90vw);
114
+ }
115
+
116
+ .atl-dialog.size-lg,
117
+ .atl-dialog > .panel.size-lg {
118
+ width: min(48rem, 90vw);
119
+ }
120
+
121
+ .atl-dialog.size-xl,
122
+ .atl-dialog > .panel.size-xl {
123
+ width: min(64rem, 90vw);
124
+ }
125
+
126
+ .atl-dialog.size-full,
127
+ .atl-dialog > .panel.size-full {
128
+ width: 100vw;
129
+ height: 100dvh;
130
+ max-width: 100vw;
131
+ max-height: 100dvh;
132
+ border-radius: 0;
133
+ margin: 0;
134
+ }
135
+
136
+ /* ── Sub-components ──────────────────────────────────────────────────────── */
137
+ .atl-dialog-header {
138
+ display: flex;
139
+ align-items: center;
140
+ justify-content: space-between;
141
+ padding: var(--ui-spacing-5) var(--ui-spacing-6);
142
+ border-bottom: var(--ui-border-width) solid var(--ui-color-border);
143
+ font-size: var(--ui-font-size-xl);
144
+ font-weight: var(--ui-font-weight-semibold);
145
+ letter-spacing: var(--ui-letter-spacing-tight);
146
+ color: var(--ui-color-text);
147
+ flex-shrink: 0;
148
+ }
149
+
150
+ .atl-dialog-content {
151
+ display: block;
152
+ padding: var(--ui-spacing-6);
153
+ overflow-y: auto;
154
+ flex: 1;
155
+ color: var(--ui-color-text);
156
+ }
157
+
158
+ .atl-dialog-footer {
159
+ display: flex;
160
+ align-items: center;
161
+ justify-content: flex-end;
162
+ gap: var(--ui-spacing-3);
163
+ padding: var(--ui-spacing-5) var(--ui-spacing-6);
164
+ border-top: var(--ui-border-width) solid var(--ui-color-border);
165
+ flex-shrink: 0;
166
+ }
167
+
168
+ /* ── Close button ──────────────────────────────────────────────────────────── */
169
+ .atl-dialog-header > .close-btn {
170
+ display: inline-flex;
171
+ align-items: center;
172
+ justify-content: center;
173
+ flex-shrink: 0;
174
+ width: var(--ui-control-height-sm);
175
+ height: var(--ui-control-height-sm);
176
+ padding: 0;
177
+ margin-left: var(--ui-spacing-3);
178
+ background: transparent;
179
+ border: none;
180
+ border-radius: var(--ui-radius-sm);
181
+ cursor: pointer;
182
+ color: var(--ui-color-text-muted);
183
+ transition:
184
+ background-color var(--ui-transition-fast),
185
+ color var(--ui-transition-fast);
186
+ line-height: 1;
187
+ }
188
+
189
+ .atl-dialog-header > .close-btn:hover {
190
+ background-color: var(--ui-color-surface-sunken);
191
+ color: var(--ui-color-text);
192
+ }
193
+
194
+ .atl-dialog-header > .close-btn:focus-visible {
195
+ outline: none;
196
+ box-shadow: var(--ui-focus-ring);
197
+ }