@galaxy-io/dls 2.13.0 → 2.13.2

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.
@@ -19,7 +19,7 @@ interface ModalBaseProps extends AriaAttributes {
19
19
  footer?: ReactNode;
20
20
  /** A strip between the title row and the body that stays in place while the body scrolls: an `Alert isBanner`. */
21
21
  banner?: ReactNode;
22
- /** A navigation column at the panel's start, its full height: a `SidebarNav` with `hasDividers={false}`, a vertical `Stepper`. The title row, body and footer sit in the column beside it, and the panel holds a fixed height (480 / 560 / 640 / 720px by `size`, less on a shorter viewport). */
22
+ /** A navigation column at the panel's start, its full height: a `SidebarNav` with `hasDividers={false}`, a vertical `Stepper`. The title row, body and footer sit in the column beside it, and the panel holds a fixed height (480 / 560 / 640 / 720px by `size`, less on a shorter viewport). Slides in when set and back out when `null`, like `aside`; below 768px, where it stacks above the content, it fades instead. */
23
23
  sidebar?: ReactNode;
24
24
  /** A second panel beside the dialog's end edge, for context on the body (a preview, the matches for what was typed). Slides out when set and back in when `null`. It takes its child's width (set it with `Box width`), at most half the viewport, and shares the panel's height; no padding: the app pads it. */
25
25
  aside?: ReactNode;
@@ -37,11 +37,14 @@ import { AnimatePresence, motion } from "framer-motion";
37
37
  * Two slots change the panel's shape without leaving the frame. `sidebar` is a navigation column
38
38
  * at the panel's start, its full height (settings sections, the steps of a wizard); the title row,
39
39
  * body and footer move into the column beside it, and the panel holds a fixed height so switching
40
- * sections never resizes it. `aside` is a second panel outside the dialog's end edge, for context
41
- * on what the body is doing (a preview, the matches for what was typed): it slides out from behind
42
- * the panel when set and back in when `null`, and the panel and the aside center as a pair. It
43
- * takes its child's width (`Box width`), at most half the viewport, and the panel gives way. Below
44
- * 768px the aside stacks under the panel instead, so the field that feeds it stays in view.
40
+ * sections never resizes it. It slides in from behind the panel's start edge when set and back out
41
+ * when `null`, taking its hairline with it, while the column beside it grows and shrinks (a wizard
42
+ * can drop its steps while an aside is open). `aside` is a second panel outside the dialog's end
43
+ * edge, for context on what the body is doing (a preview, the matches for what was typed): it
44
+ * slides out from behind the panel when set and back in when `null`, and the panel and the aside
45
+ * center as a pair. It takes its child's width (`Box width`), at most half the viewport, and the
46
+ * panel gives way. Below 768px the sidebar stacks above the content and the aside under the panel,
47
+ * so the field that feeds it stays in view; there both fade in and out at full width.
45
48
  *
46
49
  * Sizes are widths: 400 / 560 / 720 / 960px. `X_LARGE` also holds a fixed height (720px, less
47
50
  * when the viewport is shorter). `isFullscreen` fills the viewport less 32px on each side.
@@ -67,6 +70,7 @@ var ModalSize = /* @__PURE__ */ function(ModalSize) {
67
70
  /** The close button's accessible name (fixed English, as Input's "Clear"). */
68
71
  var CLOSE_LABEL = "Close";
69
72
  /** The `sidebar` column's width: AppFrame's sidebar column. */
73
+ var SIDEBAR_WIDTH_PX = 220;
70
74
  /** Below this viewport width the aside stacks under the panel and the sidebar above the content. */
71
75
  /**
72
76
  * Scroll lock: while any modal backdrop is mounted (open or exiting) the page does not scroll.
@@ -125,42 +129,51 @@ var Panel = /*#__PURE__*/ styled("div")({
125
129
  propsAsIs: false
126
130
  });
127
131
  /**
132
+ * The sidebar's slot: its width runs from 0 to the column's 220px, so the content beside it grows
133
+ * and shrinks, while the slot clips the column against its end edge: the column slides in from
134
+ * behind the panel's start edge with its hairline leading, and never reflows. Below 768px it
135
+ * stacks above the content at full width (the `!important` beats the slide's inline width), so
136
+ * there it only fades, as the aside does.
137
+ */
138
+ var SIDEBAR_SLOT_CSS = "gx-Modal-SIDEBAR_SLOT_CSS-s1vc3s89";
139
+ /**
128
140
  * `sidebar`: the navigation column, its full height, a hairline at its end. Below 768px it stacks
129
141
  * above the content at full width, at most 40% of the viewport height, with the hairline under it.
142
+ * It reads the content-first exit itself: its slot's inline opacity hides the panel's rule.
130
143
  */
131
144
  var Sidebar = /*#__PURE__*/ styled("div")({
132
145
  name: "Sidebar",
133
- class: "gx-Modal-Sidebar-s1vc3s89",
146
+ class: "gx-Modal-Sidebar-s1kofw5u",
134
147
  propsAsIs: false
135
148
  });
136
149
  /** The title row, banner, body and footer, in a column. */
137
150
  var Content = /*#__PURE__*/ styled("div")({
138
151
  name: "Content",
139
- class: "gx-Modal-Content-c1kofw5u",
152
+ class: "gx-Modal-Content-curevkp",
140
153
  propsAsIs: false
141
154
  });
142
155
  var Body = /*#__PURE__*/ styled("div")({
143
156
  name: "Body",
144
- class: "gx-Modal-Body-burevkp",
157
+ class: "gx-Modal-Body-b11dq6j2",
145
158
  propsAsIs: false
146
159
  });
147
160
  /** `isFlush`: the body has no inset; the content pads itself. */
148
- var FLUSH_BODY_CSS = "gx-Modal-FLUSH_BODY_CSS-f11dq6j2";
161
+ var FLUSH_BODY_CSS = "gx-Modal-FLUSH_BODY_CSS-f6mxmup";
149
162
  /** `banner`: a strip pinned between the title row and the body; it never shrinks or scrolls. */
150
163
  var Banner = /*#__PURE__*/ styled("div")({
151
164
  name: "Banner",
152
- class: "gx-Modal-Banner-b6mxmup",
165
+ class: "gx-Modal-Banner-b9gpbdm",
153
166
  propsAsIs: false
154
167
  });
155
168
  var Footer = /*#__PURE__*/ styled("div")({
156
169
  name: "Footer",
157
- class: "gx-Modal-Footer-f9gpbdm",
170
+ class: "gx-Modal-Footer-ffsn1gx",
158
171
  propsAsIs: false
159
172
  });
160
173
  /** Pinned 12px from the panel's top-end corner. */
161
174
  var CloseSlot = /*#__PURE__*/ styled("span")({
162
175
  name: "CloseSlot",
163
- class: "gx-Modal-CloseSlot-cfsn1gx",
176
+ class: "gx-Modal-CloseSlot-c1jg9rc6",
164
177
  propsAsIs: false
165
178
  });
166
179
  /**
@@ -170,7 +183,7 @@ var CloseSlot = /*#__PURE__*/ styled("span")({
170
183
  * stacks under the panel at full width (the `!important` beats the slide's inline width) and takes
171
184
  * at most 40% of the viewport height.
172
185
  */
173
- var ASIDE_SLOT_CSS = "gx-Modal-ASIDE_SLOT_CSS-a1jg9rc6";
186
+ var ASIDE_SLOT_CSS = "gx-Modal-ASIDE_SLOT_CSS-a7k0w0q";
174
187
  /**
175
188
  * The aside takes its child's width (`flex: none`, so the slide clips it rather than squeezing
176
189
  * it), at most half the viewport less the positioner's 32px inset and the gap: the panel always
@@ -178,7 +191,7 @@ var ASIDE_SLOT_CSS = "gx-Modal-ASIDE_SLOT_CSS-a1jg9rc6";
178
191
  */
179
192
  var Aside = /*#__PURE__*/ styled("div")({
180
193
  name: "Aside",
181
- class: "gx-Modal-Aside-a7k0w0q",
194
+ class: "gx-Modal-Aside-addv16",
182
195
  propsAsIs: false
183
196
  });
184
197
  /**
@@ -193,8 +206,17 @@ var ASIDE_SHOWN = {
193
206
  width: "auto",
194
207
  opacity: 1
195
208
  };
196
- /** The aside's slide: `duration.base` (a transform-like move), snapped under reduced motion. */
197
- var ASIDE_TRANSITION = {
209
+ /** The sidebar's slide: its slot's width runs from 0 to the column's as it fades in. */
210
+ var SIDEBAR_HIDDEN = {
211
+ width: 0,
212
+ opacity: 0
213
+ };
214
+ var SIDEBAR_SHOWN = {
215
+ width: SIDEBAR_WIDTH_PX,
216
+ opacity: 1
217
+ };
218
+ /** The sidebar's and the aside's slide: `duration.base` (a transform-like move), snapped under reduced motion. */
219
+ var SLOT_TRANSITION = {
198
220
  duration: Number.parseFloat(DURATION.base) / 1e3,
199
221
  ease: "easeOut"
200
222
  };
@@ -230,11 +252,13 @@ var Modal = forwardRef(function Modal({ children, header, subheader, icon, foote
230
252
  isBackdropPressRef.current = false;
231
253
  if (isBackdropPress && isDismissable) close();
232
254
  };
255
+ const hasSidebar = sidebar !== void 0 && sidebar !== null && sidebar !== false;
256
+ const [isSidebarMounted, setIsSidebarMounted] = useState(hasSidebar);
257
+ if (isSidebarMounted !== hasSidebar && (hasSidebar || !isOpen)) setIsSidebarMounted(hasSidebar);
233
258
  if (!hasOpened) return null;
234
259
  const hasHeaderRow = header !== void 0;
235
- const hasSidebar = sidebar !== void 0 && sidebar !== null && sidebar !== false;
236
260
  const hasAside = aside !== void 0 && aside !== null && aside !== false;
237
- const hasFixedHeight = !isFullscreen && (size === "X_LARGE" || hasSidebar);
261
+ const hasFixedHeight = !isFullscreen && (size === "X_LARGE" || isSidebarMounted);
238
262
  const labelling = ariaLabel !== void 0 ? { "aria-label": ariaLabel } : rest["aria-labelledby"] !== void 0 || header === void 0 ? {} : { "aria-labelledby": titleId };
239
263
  const describing = subheader !== void 0 && header !== void 0 && rest["aria-describedby"] === void 0 ? { "aria-describedby": subheaderId } : {};
240
264
  const zStyle = { "--gx-modal-z": zIndex };
@@ -272,7 +296,18 @@ var Modal = forwardRef(function Modal({ children, header, subheader, icon, foote
272
296
  children: [/* @__PURE__ */ jsxs(Panel, {
273
297
  className: isFullscreen ? FULLSCREEN_PANEL_CSS : MODAL_SIZE_TO_CSS_MAP[size],
274
298
  children: [
275
- hasSidebar && /* @__PURE__ */ jsx(Sidebar, { children: sidebar }),
299
+ /* @__PURE__ */ jsx(AnimatePresence, {
300
+ initial: false,
301
+ onExitComplete: () => setIsSidebarMounted(false),
302
+ children: hasSidebar && /* @__PURE__ */ jsx(motion.div, {
303
+ className: SIDEBAR_SLOT_CSS,
304
+ initial: SIDEBAR_HIDDEN,
305
+ animate: SIDEBAR_SHOWN,
306
+ exit: SIDEBAR_HIDDEN,
307
+ transition: isReducedMotion ? REDUCED_TRANSITION : SLOT_TRANSITION,
308
+ children: /* @__PURE__ */ jsx(Sidebar, { children: sidebar })
309
+ }, "sidebar")
310
+ }),
276
311
  /* @__PURE__ */ jsxs(Content, { children: [
277
312
  hasHeaderRow && /* @__PURE__ */ jsx(OverlayTitleRow, {
278
313
  header,
@@ -305,7 +340,7 @@ var Modal = forwardRef(function Modal({ children, header, subheader, icon, foote
305
340
  initial: ASIDE_HIDDEN,
306
341
  animate: ASIDE_SHOWN,
307
342
  exit: ASIDE_HIDDEN,
308
- transition: isReducedMotion ? REDUCED_TRANSITION : ASIDE_TRANSITION,
343
+ transition: isReducedMotion ? REDUCED_TRANSITION : SLOT_TRANSITION,
309
344
  children: /* @__PURE__ */ jsx(Aside, { children: aside })
310
345
  }, "aside")
311
346
  })]