@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,138 @@
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-toggle,
7
+ .atl-toggle * {
8
+ box-sizing: border-box;
9
+ }
10
+
11
+ .atl-toggle {
12
+ display: block;
13
+ font-family: var(--ui-font-family);
14
+ font-size: var(--ui-font-size-md);
15
+ /* The root is a block wrapping an inline-flex row, so it opens a line box and
16
+ its strut is sized by whatever leading it inherits. Without this the row is
17
+ 40px here and 48px inside an app with roomy prose leading. */
18
+ line-height: var(--ui-line-height-tight);
19
+ }
20
+
21
+ .atl-toggle > label {
22
+ display: inline-flex;
23
+ align-items: center;
24
+ gap: var(--ui-spacing-3);
25
+ cursor: pointer;
26
+ user-select: none;
27
+ color: var(--ui-color-text);
28
+ /* Row recipe (ADR-0052): the clickable line is a row — it states its height
29
+ and centres the control + text, rather than being sized by whichever of
30
+ the two happens to be taller. */
31
+ min-height: var(--ui-row-height-sm);
32
+ padding-block: 0;
33
+ line-height: var(--ui-line-height-tight);
34
+ }
35
+
36
+ /* Hide native checkbox visually but keep it accessible */
37
+ .atl-toggle > label > input[type='checkbox'] {
38
+ position: absolute;
39
+ width: 1px;
40
+ height: 1px;
41
+ padding: 0;
42
+ margin: -1px;
43
+ overflow: hidden;
44
+ clip: rect(0, 0, 0, 0);
45
+ white-space: nowrap;
46
+ border: 0;
47
+ }
48
+
49
+ /* Track — pill-shaped container */
50
+ .atl-toggle > label > .track {
51
+ position: relative;
52
+ display: inline-flex;
53
+ align-items: center;
54
+ flex-shrink: 0;
55
+ width: 2.75rem;
56
+ height: 1.5rem;
57
+ border-radius: var(--ui-radius-full);
58
+ border: var(--ui-border-width) solid var(--ui-color-border-strong);
59
+ background-color: var(--ui-color-input-bg);
60
+ transition:
61
+ background-color var(--ui-transition-fast),
62
+ border-color var(--ui-transition-fast),
63
+ box-shadow var(--ui-transition-fast);
64
+ cursor: pointer;
65
+ }
66
+
67
+ /* Thumb — circular slider */
68
+ .atl-toggle > label > .track > .thumb {
69
+ position: absolute;
70
+ left: 0.125rem;
71
+ width: 1.125rem;
72
+ height: 1.125rem;
73
+ border-radius: var(--ui-radius-full);
74
+ background-color: var(--ui-color-border-strong);
75
+ box-shadow: var(--ui-shadow-xs);
76
+ transition:
77
+ transform var(--ui-transition-normal) var(--ui-ease-out),
78
+ background-color var(--ui-transition-fast);
79
+ }
80
+
81
+ /* Hover state */
82
+ .atl-toggle > label:hover:not(:has(> input:disabled)) > .track {
83
+ border-color: var(--ui-color-primary);
84
+ }
85
+
86
+ /* Focus ring on track when native input is focused */
87
+ .atl-toggle > label > input[type='checkbox']:focus-visible + .track {
88
+ box-shadow: var(--ui-focus-ring);
89
+ border-color: var(--ui-color-primary);
90
+ }
91
+
92
+ /* Checked state — track */
93
+ .atl-toggle.is-checked > label > .track {
94
+ background-color: var(--ui-color-primary);
95
+ border-color: var(--ui-color-primary);
96
+ }
97
+
98
+ /* Checked state — thumb slides right */
99
+ .atl-toggle.is-checked > label > .track > .thumb {
100
+ transform: translateX(1.25rem);
101
+ background-color: var(--ui-color-text-on-primary);
102
+ }
103
+
104
+ /* Invalid state — track border */
105
+ .atl-toggle.is-invalid > label > .track {
106
+ border-color: var(--ui-color-input-border-invalid);
107
+ }
108
+
109
+ .atl-toggle.is-invalid > label > input[type='checkbox']:focus-visible + .track {
110
+ border-color: var(--ui-color-input-border-invalid);
111
+ box-shadow: var(--ui-focus-ring-danger);
112
+ }
113
+
114
+ /* Disabled state */
115
+ .atl-toggle.is-disabled {
116
+ opacity: var(--ui-opacity-disabled);
117
+ cursor: not-allowed;
118
+ }
119
+
120
+ .atl-toggle.is-disabled > label {
121
+ cursor: not-allowed;
122
+ }
123
+
124
+ .atl-toggle.is-disabled > label > .track {
125
+ cursor: not-allowed;
126
+ }
127
+
128
+ /* Error messages */
129
+ .atl-toggle > .errors {
130
+ margin-top: var(--ui-spacing-2);
131
+ }
132
+
133
+ .atl-toggle > .errors > .error-message {
134
+ margin: 0;
135
+ font-size: var(--ui-font-size-sm);
136
+ color: var(--ui-color-error-text);
137
+ line-height: var(--ui-line-height-normal);
138
+ }
@@ -0,0 +1,31 @@
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-tooltip,
7
+ .atl-tooltip * {
8
+ box-sizing: border-box;
9
+ }
10
+
11
+ /* Tooltip content — the visual every framework shares. How it is placed (a CDK
12
+ * overlay in Angular, a positioned sibling of the trigger in React and Vue) and
13
+ * how it animates in is per framework: atl-tooltip.<framework>.css. */
14
+ .atl-tooltip {
15
+ display: block;
16
+ padding: var(--ui-spacing-1) var(--ui-spacing-2);
17
+ background: var(--ui-color-text);
18
+ color: var(--ui-color-surface);
19
+ font-family: var(--ui-font-family);
20
+ font-size: var(--ui-font-size-xs);
21
+ line-height: var(--ui-line-height-normal);
22
+ border-radius: var(--ui-radius-sm);
23
+ box-shadow: var(--ui-shadow-md);
24
+ max-width: 20rem;
25
+ word-wrap: break-word;
26
+ pointer-events: none;
27
+
28
+ /* Entry animation; the keyframes are per framework. */
29
+ animation: atl-tooltip-enter var(--ui-duration-fast) var(--ui-ease-out)
30
+ forwards;
31
+ }
@@ -0,0 +1,89 @@
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-tooltip-wrapper,
7
+ .atl-tooltip-wrapper * {
8
+ box-sizing: border-box;
9
+ }
10
+
11
+ /* Served to React and Vue only, after atl-tooltip.css (the shared sheet): no overlay.
12
+ * The tooltip is a sibling of the trigger inside
13
+ * an inline-block wrapper, positioned against it with CSS (the Angular directive
14
+ * attaches the same visual to a CDK overlay instead — atl-tooltip.angular.css).
15
+ * That is why the wrapper, the position classes and the translate-carrying
16
+ * keyframes exist only here; the DOM difference is recorded in allowlists.js
17
+ * (VARIANT_AXIS_EXCEPTIONS, "angular:AtlTooltipPosition:*") and ADR-0148
18
+ * Decision 4. */
19
+
20
+ /* Tooltip wrapper — inline container */
21
+ .atl-tooltip-wrapper {
22
+ /* The library states its own typeface (ADR-0035). Without this the component
23
+ * renders in the consuming app's font while its neighbours render Instrument
24
+ * Sans — measured: a card next to a button showed two typefaces. Declared once
25
+ * per component root, never on a descendant (ADR-0049). */
26
+ font-family: var(--ui-font-family);
27
+ display: inline-block;
28
+ position: relative;
29
+ }
30
+
31
+ .atl-tooltip-wrapper > .atl-tooltip {
32
+ position: absolute;
33
+ z-index: var(--ui-z-dropdown);
34
+ white-space: nowrap;
35
+ }
36
+
37
+ /* Positioning */
38
+ .atl-tooltip.position-above {
39
+ bottom: calc(100% + 8px);
40
+ left: 50%;
41
+ transform: translateX(-50%);
42
+ }
43
+
44
+ .atl-tooltip.position-below {
45
+ top: calc(100% + 8px);
46
+ left: 50%;
47
+ transform: translateX(-50%);
48
+ }
49
+
50
+ .atl-tooltip.position-left {
51
+ right: calc(100% + 8px);
52
+ top: 50%;
53
+ transform: translateY(-50%);
54
+ }
55
+
56
+ .atl-tooltip.position-right {
57
+ left: calc(100% + 8px);
58
+ top: 50%;
59
+ transform: translateY(-50%);
60
+ }
61
+
62
+ @keyframes atl-tooltip-enter {
63
+ from {
64
+ opacity: 0;
65
+ transform: scale(0.95) translateX(-50%);
66
+ }
67
+ to {
68
+ opacity: 1;
69
+ transform: scale(1) translateX(-50%);
70
+ }
71
+ }
72
+
73
+ /* Left/right don't need translateX in animation */
74
+ .atl-tooltip.position-left,
75
+ .atl-tooltip.position-right {
76
+ animation: atl-tooltip-enter-side var(--ui-duration-fast) var(--ui-ease-out)
77
+ forwards;
78
+ }
79
+
80
+ @keyframes atl-tooltip-enter-side {
81
+ from {
82
+ opacity: 0;
83
+ transform: scale(0.95) translateY(-50%);
84
+ }
85
+ to {
86
+ opacity: 1;
87
+ transform: scale(1) translateY(-50%);
88
+ }
89
+ }