@olenbetong/appframe-ds 1.3.8 → 1.4.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @olenbetong/appframe-ds
2
2
 
3
+ ## 1.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - b0630e5: Dialog motion: the opening transition now also plays for `ob-dialog-motion` elements (the app menu). Their starting style was a separate, less specific rule than the open state and lost to it, so they appeared without the transition and only faded on close.
8
+
9
+ ## 1.4.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 8ec7b62: One open and close motion for centred dialogs: Designsystemet's `Dialog` (the filter builder and every other centred one) and anything with the new `ob-dialog-motion` class now fade and rise in over 180 ms and play the same motion in reverse over 140 ms when closed, using transitions with `@starting-style` and `allow-discrete` instead of Designsystemet's open-only keyframes. Reduced motion keeps the fade and drops the movement. The filter builder now closes on a backdrop click, and the page content slides back when a docked `AppMenuDrawer` closes instead of jumping.
14
+
3
15
  ## 1.3.8
4
16
 
5
17
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olenbetong/appframe-ds",
3
- "version": "1.3.8",
3
+ "version": "1.4.1",
4
4
  "description": "Components that bind Designsystemet components to Appframe data objects",
5
5
  "type": "module",
6
6
  "types": "./es/index.d.ts",
@@ -402,7 +402,7 @@ export function FilterBuilder({
402
402
  return (
403
403
  <Dialog
404
404
  open={open}
405
- closedby="closerequest"
405
+ closedby="any"
406
406
  closeButton={false}
407
407
  data-size={size}
408
408
  className="ObFilterBuilder-dialog"
@@ -18,7 +18,8 @@
18
18
  background-color: var(--ds-color-neutral-background-default, #fff);
19
19
  color: var(--ds-color-neutral-text-default, #1e2b3c);
20
20
  transform: translateX(-100%);
21
- transition: transform 225ms cubic-bezier(0, 0, 0.2, 1);
21
+ /* Same timing as the content offset in Page.css, so the two edges move together. */
22
+ transition: transform 225ms cubic-bezier(0.4, 0, 0.2, 1);
22
23
  overflow: hidden;
23
24
  display: flex;
24
25
  flex-direction: column;
@@ -0,0 +1,79 @@
1
+ /*
2
+ * One open and close motion for every centred modal: Designsystemet's Dialog (the filter builder,
3
+ * the site search, the report launcher and any app's own dialogs) and anything else that opts in
4
+ * with the `ob-dialog-motion` class (the chrome's app menu, which is a plain <dialog>).
5
+ *
6
+ * Designsystemet animates the opening with keyframes only, 300 ms, and nothing on close. This
7
+ * replaces that with transitions, so the close plays the same motion in reverse:
8
+ * - @starting-style gives the first frame after showModal() something to transition from;
9
+ * - `display` and `overlay` transition with `allow-discrete`, which keeps the dialog in the top
10
+ * layer until the fade out has finished after close().
11
+ * Browsers without `overlay` (Firefox, Safari at the time of writing) still animate the opening
12
+ * and close without the fade; nothing breaks.
13
+ *
14
+ * A dialog only fades out when it is closed with close() and stays mounted. One that React
15
+ * removes on close disappears at once.
16
+ *
17
+ * Reduced motion keeps a short fade and drops the movement.
18
+ */
19
+
20
+ :root {
21
+ --ob-dialog-enter-duration: 180ms;
22
+ --ob-dialog-exit-duration: 140ms;
23
+ --ob-dialog-offset: 1rem;
24
+ }
25
+
26
+ @media (prefers-reduced-motion: reduce) {
27
+ :root {
28
+ --ob-dialog-offset: 0;
29
+ }
30
+ }
31
+
32
+ .ds-dialog:is(:not([data-placement]), [data-placement="center"]),
33
+ .ob-dialog-motion {
34
+ opacity: 0;
35
+ translate: 0 var(--ob-dialog-offset);
36
+ transition-property: opacity, translate, overlay, display;
37
+ transition-duration: var(--ob-dialog-exit-duration);
38
+ transition-timing-function: ease-in;
39
+ transition-behavior: allow-discrete;
40
+
41
+ &[open] {
42
+ opacity: 1;
43
+ translate: 0 0;
44
+ /* Designsystemet's keyframes would play on top of the transition. */
45
+ animation: none;
46
+ transition-duration: var(--ob-dialog-enter-duration);
47
+ transition-timing-function: ease-out;
48
+
49
+ /*
50
+ * Nested so it has exactly this rule's selector. A separate @starting-style rule for
51
+ * `.ob-dialog-motion[open]` is less specific than this one, whose `:is()` takes the
52
+ * specificity of `.ds-dialog:is(...)`, and loses to it: the dialog then has no
53
+ * starting frame and appears without the transition.
54
+ */
55
+ @starting-style {
56
+ opacity: 0;
57
+ translate: 0 var(--ob-dialog-offset);
58
+ }
59
+ }
60
+
61
+ &::backdrop {
62
+ opacity: 0;
63
+ animation: none;
64
+ transition-property: opacity, overlay, display;
65
+ transition-duration: var(--ob-dialog-exit-duration);
66
+ transition-timing-function: ease-in;
67
+ transition-behavior: allow-discrete;
68
+ }
69
+
70
+ &[open]::backdrop {
71
+ opacity: 1;
72
+ transition-duration: var(--ob-dialog-enter-duration);
73
+ transition-timing-function: ease-out;
74
+
75
+ @starting-style {
76
+ opacity: 0;
77
+ }
78
+ }
79
+ }
@@ -1,4 +1,5 @@
1
1
  import "./index.css";
2
+ import "./DialogMotion.css";
2
3
 
3
4
  import { useEffect, useState } from "react";
4
5
  import type React from "react";
package/src/page/Page.css CHANGED
@@ -16,6 +16,11 @@
16
16
  rather than the viewport. That is what keeps it clear of a site toolbar rendered
17
17
  above the app, without needing to know the toolbar's height. */
18
18
  position: relative;
19
+ /* On the base rule, not the drawer-open one below: the content has to slide back when the
20
+ drawer closes too, and a transition declared only where the padding is set stops
21
+ applying the moment that rule stops matching. Same timing as the drawer itself
22
+ (AppMenuDrawer.css), so the content edge follows the drawer edge. */
23
+ transition: padding-left 225ms cubic-bezier(0.4, 0, 0.2, 1);
19
24
  }
20
25
 
21
26
  .ObPage-document {
@@ -35,7 +40,6 @@
35
40
  /* Offset content when a docked Page.Header drawer is open (desktop) */
36
41
  .ObPage-root:has(.ObPageHeader-drawer.ObPageHeader-drawerDocked.ObPageHeader-drawerOpen) {
37
42
  padding-left: var(--ob-page-drawer-width, 20rem);
38
- transition: padding-left 225ms cubic-bezier(0.4, 0, 0.2, 1);
39
43
  }
40
44
  }
41
45