@ids-group-ltd/ids-design-system 0.7.0 → 0.8.0

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,58 @@
1
+ // Focus-indicator style, switched in ONE place: `<html data-focus="…">`.
2
+ //
3
+ // The library ships two families — a soft halo on fields (`--focus-field`) and a
4
+ // crisp double ring on controls (`--focus-ring`) — and 20 components already
5
+ // resolve through the `--ds-field-focus-shadow` / `--ds-control-focus-shadow`
6
+ // roles, so retargeting the roles is all a brand-wide switch needs. Absent
7
+ // attribute keeps today's split.
8
+ //
9
+ // `outline` cannot be a box-shadow token, which is why that style also emits a
10
+ // rule: the roles go to `none` and the indicator becomes a real `outline`.
11
+ // `:where()` keeps that rule at zero specificity so a component or a consumer
12
+ // still wins.
13
+ //
14
+ // The forced-colors block is not part of the switch and applies to every style:
15
+ // Windows High Contrast DROPS box-shadow, so a shadow-only indicator disappears
16
+ // entirely there. This is the one place that gap can be closed once.
17
+
18
+ :root[data-focus='ring'] {
19
+ --ds-field-focus-shadow: var(--focus-ring);
20
+ --ds-field-focus-shadow-error: var(--focus-ring-error);
21
+ }
22
+
23
+ :root[data-focus='field'] {
24
+ --ds-control-focus-shadow: var(--focus-field);
25
+ --ds-control-focus-shadow-error: var(--focus-field-error);
26
+ }
27
+
28
+ // Contiguous primary edge — a hairline flush against the element, no gap, from
29
+ // the pin-475 prototype.
30
+ :root[data-focus='edge'] {
31
+ --ds-field-focus-shadow: 0 0 0 var(--border-width-default) var(--primary);
32
+ --ds-field-focus-shadow-error: 0 0 0 var(--border-width-default) var(--error);
33
+ --ds-control-focus-shadow: 0 0 0 var(--border-width-default) var(--primary);
34
+ --ds-control-focus-shadow-error: 0 0 0 var(--border-width-default)
35
+ var(--error);
36
+ }
37
+
38
+ :root[data-focus='outline'] {
39
+ --ds-field-focus-shadow: none;
40
+ --ds-field-focus-shadow-error: none;
41
+ --ds-control-focus-shadow: none;
42
+ --ds-control-focus-shadow-error: none;
43
+ }
44
+
45
+ :root[data-focus='outline'] :where(:focus-visible) {
46
+ outline: var(--border-width-strong) solid var(--primary);
47
+ outline-offset: var(--focus-ring-offset);
48
+ }
49
+
50
+ @media (forced-colors: active) {
51
+ // CanvasText, not a brand colour: forced-colors replaces the palette, and a
52
+ // system keyword is the only value guaranteed to contrast with the forced
53
+ // background.
54
+ :where(:focus-visible) {
55
+ outline: var(--border-width-strong) solid CanvasText;
56
+ outline-offset: var(--focus-ring-offset);
57
+ }
58
+ }
@@ -1,17 +1,88 @@
1
1
  // Enter motion for CDK-overlay panels that carry the `ds-overlay-pane`
2
2
  // panelClass (select, autocomplete, multi-select, date-picker, time-picker,
3
- // color-picker, popover, tooltip). Animates the panel's ROOT CHILD, not the
4
- // pane itself, so CDK's positioning transforms on `.cdk-overlay-pane` are left
5
- // untouched. The leave/exit animation was removed (close is instant) — see the
6
- // TODO(overlay-leave) in components/overlay-motion.ts to reinstate it.
3
+ // color-picker, popover, tooltip, menu submenu). Animates the panel's ROOT
4
+ // CHILD, not the pane itself, so CDK's positioning transforms on
5
+ // `.cdk-overlay-pane` are left untouched. The leave/exit animation was removed
6
+ // (close is instant) — see the TODO(overlay-leave) in components/overlay-motion.ts
7
+ // to reinstate it.
8
+ //
9
+ // `data-ds-placement` names WHERE the panel sits relative to its trigger and is
10
+ // stamped by `prepareOverlayEnter()` before the panel is attached, so the panel
11
+ // always enters FROM the trigger edge: the offset axis/sign and the scale origin
12
+ // both follow it. The keyframe name never changes with placement, so a mid-scroll
13
+ // CDK flip redirects the motion instead of restarting it.
14
+ //
15
+ // Duration/easing stay longhands the library owns: reduced motion zeroes the
16
+ // duration rather than dropping the animation, which keeps `animationend`-driven
17
+ // teardown working and outranks a consumer keyframe carrying its own timing.
7
18
 
8
- .cdk-overlay-pane.ds-overlay-pane > * {
9
- animation: ds-overlay-in var(--duration-fast) var(--ease-decelerate);
19
+ .cdk-overlay-pane.ds-overlay-pane {
20
+ /* Public --ds-overlay-* are read with fallbacks, never declared — consumer overrides inherit in. */
21
+ --_overlay-enter-keyframes: var(--ds-overlay-enter-keyframes, ds-slide-in);
22
+ --_overlay-enter-duration: var(--ds-overlay-enter-duration, var(--ds-motion-enter-panel-duration));
23
+ --_overlay-enter-easing: var(--ds-overlay-enter-easing, var(--ds-motion-enter-panel-easing));
24
+ --_overlay-enter-offset: var(--ds-overlay-enter-offset, 4px);
25
+ --_ds-enter-scale: var(--ds-overlay-enter-scale, 0.96);
26
+
27
+ --_overlay-leave-duration: var(--ds-overlay-leave-duration, var(--ds-motion-exit-duration));
28
+ --_overlay-leave-easing: var(--ds-overlay-leave-easing, var(--ds-motion-exit-easing));
29
+
30
+ --_ds-enter-x: 0px;
31
+ --_ds-enter-y: calc(-1 * var(--_overlay-enter-offset));
32
+ --_overlay-enter-origin: top center;
33
+
34
+ &[data-ds-placement='top'] {
35
+ --_ds-enter-y: var(--_overlay-enter-offset);
36
+ --_overlay-enter-origin: bottom center;
37
+ }
38
+
39
+ &[data-ds-placement='left'] {
40
+ --_ds-enter-x: var(--_overlay-enter-offset);
41
+ --_ds-enter-y: 0px;
42
+ --_overlay-enter-origin: center right;
43
+ }
44
+
45
+ &[data-ds-placement='right'] {
46
+ --_ds-enter-x: calc(-1 * var(--_overlay-enter-offset));
47
+ --_ds-enter-y: 0px;
48
+ --_overlay-enter-origin: center left;
49
+ }
50
+
51
+ @media (prefers-reduced-motion: reduce) {
52
+ --_overlay-enter-duration: 0ms;
53
+ }
54
+
55
+ > * {
56
+ animation-name: var(--_overlay-enter-keyframes);
57
+ animation-duration: var(--_overlay-enter-duration);
58
+ animation-timing-function: var(--_overlay-enter-easing);
59
+ transform-origin: var(--_overlay-enter-origin);
60
+ }
61
+
62
+ /* Leave, on an AMBIENT DISMISS only — Escape, a press outside, a scroll —
63
+ which `disposeWithLeave` marks by adding `ds-leaving`. Picking an option
64
+ still closes instantly: a fade on a deliberate choice reads as the panel
65
+ lagging behind it, which is why the old unconditional leave was cut. Opacity
66
+ only, no travel: a dismissal has nowhere to travel to, and movement would
67
+ re-add exactly the lag this avoids. Reduced motion zeroes the duration at
68
+ `:root`, so the animation still runs and `animationend` still tears down. */
69
+ &.ds-leaving {
70
+ /* A fading panel must not swallow the click aimed at what is behind it. */
71
+ pointer-events: none;
72
+
73
+ > * {
74
+ animation-name: ds-overlay-out;
75
+ animation-duration: var(--_overlay-leave-duration);
76
+ animation-timing-function: var(--_overlay-leave-easing);
77
+ animation-fill-mode: forwards;
78
+ }
79
+ }
10
80
  }
11
81
 
12
- @keyframes ds-overlay-in {
13
- from {
82
+ /* Global, like the enter presets: a keyframe declared in a component stylesheet
83
+ is renamed by emulated encapsulation. */
84
+ @keyframes ds-overlay-out {
85
+ to {
14
86
  opacity: 0;
15
- transform: translateY(-4px);
16
87
  }
17
88
  }
@@ -0,0 +1,50 @@
1
+ // Shared enter-motion presets — the vocabulary every DS surface picks from via
2
+ // `--ds-<surface>-enter-keyframes` (overlay panels, modal, drawer, bottom-sheet,
3
+ // toast, banner, alert, loading-overlay).
4
+ //
5
+ // They live GLOBALLY on purpose: emulated view encapsulation renames @keyframes
6
+ // declared inside a component stylesheet but leaves a name held in a custom
7
+ // property untouched, so a scoped default would resolve to a name that no longer
8
+ // exists. Global keyframes are also what lets a consumer point a surface at its
9
+ // own @keyframes — those must likewise be declared in global styles.
10
+ //
11
+ // Shape comes from the SURFACE, not the keyframe: each preset reads the private
12
+ // `--_ds-enter-*` hooks that a surface's token block fills from its public
13
+ // `--ds-<surface>-enter-offset` / `-scale`. One keyframe therefore serves every
14
+ // surface, and swapping presets never loses the surface's own geometry.
15
+ //
16
+ // Leave motion is deliberately absent: a closing modal/drawer/bottom-sheet is
17
+ // torn down on `animationend` matched BY NAME, so those keyframes stay local to
18
+ // their component and are not swappable.
19
+
20
+ /* Opacity only — the calmest entrance. */
21
+ @keyframes ds-fade-in {
22
+ from {
23
+ opacity: 0;
24
+ }
25
+ }
26
+
27
+ /* Grows into place from a micro-scale — reads --_ds-enter-scale, and the
28
+ surface's transform-origin decides what it grows out of. */
29
+ @keyframes ds-scale-in {
30
+ from {
31
+ opacity: 0;
32
+ transform: scale(var(--_ds-enter-scale, 0.96));
33
+ }
34
+ }
35
+
36
+ /* Travels a short distance while fading — reads --_ds-enter-x / --_ds-enter-y. */
37
+ @keyframes ds-slide-in {
38
+ from {
39
+ opacity: 0;
40
+ transform: translate(var(--_ds-enter-x, 0), var(--_ds-enter-y, 0));
41
+ }
42
+ }
43
+
44
+ /* Edge-anchored travel with NO fade, for panels that slide fully on-screen
45
+ (drawer, bottom-sheet) where a fade would read as a flicker. */
46
+ @keyframes ds-slide-edge-in {
47
+ from {
48
+ transform: translate(var(--_ds-enter-x, 0), var(--_ds-enter-y, 0));
49
+ }
50
+ }
@@ -68,6 +68,19 @@
68
68
  --radius-pill-value: 999px;
69
69
  --radius-pill: var(--radius-pill-value);
70
70
 
71
+ /* Radius ROLES — the layer a consumer retunes. Reading the raw scale directly
72
+ meant re-rounding "panels" also re-rounded every control sharing
73
+ --radius-md. Each role defaults to the value its members already used, so
74
+ nothing moves until one is set. Components resolve
75
+ --ds-<comp>-radius -> role -> value, so a per-component override still wins.
76
+ No `field` role: fields share --radius-md with buttons, so it would either
77
+ duplicate `control` or silently re-round every field. A consumer who wants
78
+ them apart scopes the role: `ds-input { --ds-radius-control: 4px; }`. */
79
+ --ds-radius-inner: var(--radius-sm);
80
+ --ds-radius-control: var(--radius-md);
81
+ --ds-radius-panel: var(--radius-lg);
82
+ --ds-radius-pill: var(--radius-pill);
83
+
71
84
  /* Component-scoped radius — kept only when the semantic intent matters
72
85
  beyond the value itself, OR when the global scale doesn't fit. */
73
86
  --radius-flat: var(--radius-0); /* explicit "intentionally squared" — middle of btn-group, in-range datepicker */
@@ -106,10 +119,21 @@
106
119
  0 16px 32px hsl(var(--shadow-tint-h) var(--shadow-tint-s) var(--shadow-tint-l) / 14%);
107
120
  --shadow-4: 0 16px 32px hsl(var(--shadow-tint-h) var(--shadow-tint-s) var(--shadow-tint-l) / 12%),
108
121
  0 24px 48px hsl(var(--shadow-tint-h) var(--shadow-tint-s) var(--shadow-tint-l) / 18%);
109
- --shadow-popover: var(--shadow-2);
110
- --shadow-modal: var(--shadow-4);
111
- --shadow-toast: var(--shadow-3);
112
- --shadow-card: var(--shadow-1);
122
+
123
+ /* Elevation ROLES, and the older --shadow-<surface> aliases now point AT them
124
+ rather than at a step: setting a role moves every surface at that height,
125
+ while an alias still retunes one family. Four roles, not the three first
126
+ sketched — the library genuinely uses four heights, and folding toast into
127
+ `overlay` would have changed its shadow. */
128
+ --ds-elevation-raised: var(--shadow-1);
129
+ --ds-elevation-overlay: var(--shadow-2);
130
+ --ds-elevation-floating: var(--shadow-3);
131
+ --ds-elevation-modal: var(--shadow-4);
132
+
133
+ --shadow-popover: var(--ds-elevation-overlay);
134
+ --shadow-modal: var(--ds-elevation-modal);
135
+ --shadow-toast: var(--ds-elevation-floating);
136
+ --shadow-card: var(--ds-elevation-raised);
113
137
 
114
138
  /* Backdrop blur */
115
139
  --blur-sm: 4px;
@@ -168,6 +192,27 @@
168
192
  --ease-accelerate: cubic-bezier(.3, 0, 1, 1);
169
193
  --ease-spring: cubic-bezier(.5, 1.5, .5, 1);
170
194
 
195
+ /* Motion ROLES — the per-surface --ds-<surface>-enter/leave-* hooks defaulted
196
+ straight to the raw scale, so "make every panel entrance snappier" meant
197
+ retuning each surface. A role names the intent once and every surface at that
198
+ scale follows. Defaults equal the values each surface already used, so nothing
199
+ moves until a role is set.
200
+ FIVE roles, not the four first sketched: panel LEAVES run at --duration-base,
201
+ not fast, so folding them into `exit` would have sped them up. Two resolvers
202
+ stay on the raw scale on purpose — ds-loading-overlay and the toast leave use
203
+ --ease-standard, which no role carries, and inventing a role for two sites
204
+ would be worse than naming the value. */
205
+ --ds-motion-enter-panel-duration: var(--duration-fast);
206
+ --ds-motion-enter-panel-easing: var(--ease-decelerate);
207
+ --ds-motion-enter-surface-duration: var(--duration-base);
208
+ --ds-motion-enter-surface-easing: var(--ease-decelerate);
209
+ --ds-motion-enter-large-duration: var(--duration-slow);
210
+ --ds-motion-enter-large-easing: var(--ease-decelerate);
211
+ --ds-motion-exit-duration: var(--duration-fast);
212
+ --ds-motion-exit-easing: var(--ease-accelerate);
213
+ --ds-motion-exit-large-duration: var(--duration-base);
214
+ --ds-motion-exit-large-easing: var(--ease-accelerate);
215
+
171
216
  /* Opacity — semantic, purpose-named (Material/Carbon/Polaris convention).
172
217
  Each token has a real consumer in the codebase; symmetric "unused"
173
218
  numeric stops are deliberately omitted. */
@@ -374,6 +419,9 @@
374
419
  --modal-w-fullscreen: calc(100vw - var(--space-6));
375
420
  --modal-h-fullscreen: calc(100vh - var(--space-6));
376
421
 
422
+ /* Auth shell */
423
+ --auth-card-w: 420px;
424
+
377
425
  /* Drawer */
378
426
  --drawer-w-sm: 320px;
379
427
  --drawer-w-md: 480px;
@@ -494,9 +542,9 @@
494
542
  --empty-icon-size: var(--space-16); /* 64px */
495
543
  --empty-body-maxw: 360px;
496
544
 
497
- /* Combobox */
498
- --combobox-offset: var(--space-1); /* gap below trigger */
499
- --combobox-maxh: 280px; /* listbox max height */
545
+ /* Pickers — the listbox panel shared by autocomplete and multi-select. */
546
+ --picker-offset: var(--space-1); /* gap below trigger */
547
+ --picker-maxh: 280px; /* listbox max height */
500
548
 
501
549
  /* Command palette (cmdk) */
502
550
  --cmdk-w: 560px;
@@ -153,7 +153,7 @@
153
153
  color: var(--ds-t-mono-inline-color, var(--text-primary));
154
154
  background-color: var(--ds-t-mono-inline-bg-color, var(--surface-secondary));
155
155
  padding: 1px var(--space-1);
156
- border-radius: var(--ds-t-mono-inline-radius, var(--radius-sm));
156
+ border-radius: var(--ds-t-mono-inline-radius, var(--ds-radius-inner));
157
157
  }
158
158
 
159
159
  .t-mono-block {
@@ -165,7 +165,7 @@
165
165
  border-width: var(--border-width-default);
166
166
  border-style: solid;
167
167
  border-color: var(--ds-t-mono-block-border-color, var(--border-divider));
168
- border-radius: var(--ds-t-mono-block-radius, var(--radius-md));
168
+ border-radius: var(--ds-t-mono-block-radius, var(--ds-radius-control));
169
169
  padding: var(--space-3) var(--space-4);
170
170
  max-width: 100%;
171
171
  overflow-x: auto;
package/styles/ds.scss CHANGED
@@ -23,6 +23,7 @@
23
23
  @forward 'reset';
24
24
  @forward 'typography';
25
25
  @forward 'link';
26
+ @forward 'focus';
26
27
  @forward 'ds-color';
27
28
  @forward 'layout-utils';
28
29
  @forward 'page-grid';
@@ -30,6 +31,7 @@
30
31
  @forward 'icon-base';
31
32
  @forward 'dropdown-overlay';
32
33
  @forward 'toast-overlay';
34
+ @forward 'surface-motion';
33
35
  @forward 'overlay-motion';
34
36
  @forward 'skeleton-shimmer';
35
37
  @include bp-emit.emit-vars;