@galaxy-io/dls 2.13.1 → 2.13.3

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.
@@ -1,4 +1,4 @@
1
- import { type AriaAttributes, type CSSProperties } from "react";
1
+ import { type AriaAttributes, type CSSProperties, type ReactNode } from "react";
2
2
  /** The product whose wordmark the credit shows. */
3
3
  export declare enum PoweredByWordmark {
4
4
  /** `GalaxyFilamentWordmark`. */
@@ -13,6 +13,13 @@ export interface PoweredByProps extends AriaAttributes {
13
13
  href: string;
14
14
  /** The link's name ("Powered by Filament"); " (opens in a new tab)" is appended. The wordmark itself is decorative. */
15
15
  ariaLabel: string;
16
+ /** The text before the wordmark; `null` (or `""`) draws the wordmark alone. @default "Powered by" */
17
+ label?: string | null;
18
+ /**
19
+ * Content after the wordmark, 8px on, in the label's `body_sm` tertiary style (a version: "v2.13").
20
+ * Inside the link, so nothing interactive; `ariaLabel` is the name, so add it there if it should be heard.
21
+ */
22
+ trailing?: ReactNode;
16
23
  /** DOM id on the `<a>`. */
17
24
  id?: string;
18
25
  /** Any `data-*` attribute, forwarded to the `<a>`. */
@@ -22,6 +29,6 @@ export interface PoweredByProps extends AriaAttributes {
22
29
  /** Inline style on the `<a>`; only for setting CSS custom properties. */
23
30
  style?: CSSProperties;
24
31
  }
25
- /** The sidebar credit: "Powered by" and a product wordmark, linking to the product in a new tab. */
32
+ /** The sidebar credit: a label, a product wordmark and optional trailing content, linking to the product in a new tab. */
26
33
  declare const PoweredBy: import("react").ForwardRefExoticComponent<PoweredByProps & import("react").RefAttributes<HTMLAnchorElement>>;
27
34
  export default PoweredBy;
@@ -9,15 +9,17 @@ import { jsx, jsxs } from "react/jsx-runtime";
9
9
  import { cx } from "@linaria/core";
10
10
  //#region src/brand/PoweredBy.tsx
11
11
  /**
12
- * The credit at the foot of a Galaxy module's sidebar: "Powered by" and the product wordmark, as
13
- * one link that opens the product's site in a new tab. A 40px row (tall enough to centre on the
12
+ * The credit at the foot of a Galaxy module's sidebar: a label ("Powered by" by default) and the
13
+ * product wordmark, as one link that opens the product's site in a new tab. `label={null}` drops the
14
+ * text and leaves the wordmark alone in the row; `trailing` (a version, say) follows the wordmark on
15
+ * the same baseline. A 40px row (tall enough to centre on the
14
16
  * Galaxy host's 24px theme toggle beside it) with `body_sm` tertiary text and the wordmark sized so
15
17
  * every product reads at the same x-height (Filament 15px, Alchemy 12px), its letters on the text's
16
18
  * baseline (an inline mark shifted by its own descent, not two boxes centred); its accessible name is
17
19
  * `ariaLabel` plus " (opens in a new tab)".
18
20
  *
19
21
  * `wordmark` is an enum of the product wordmarks, never a node: a product wordmark always stands
20
- * alone (AGENTS.md "Marks"), so no logomark can be passed in. There is no trailing arrow either
22
+ * alone (AGENTS.md "Marks"), so no logomark can be passed in. There is no external-link arrow either
21
23
  * (`Link isExternal` would draw one after the logo); the new tab is in the name.
22
24
  *
23
25
  * Hover is a monochrome step on the mark, `text.tertiary` to `text.secondary`, the DLS's own hover
@@ -60,6 +62,8 @@ var POWERED_BY_WORDMARK_TO_BASELINE_CSS_MAP = {
60
62
  ["FILAMENT"]: "gx-PoweredBy-FILAMENT-f1hilrad",
61
63
  ["ALCHEMY"]: "gx-PoweredBy-ALCHEMY-a1s356ob"
62
64
  };
65
+ /** The text before the wordmark when `label` is unset. */
66
+ var DEFAULT_LABEL = "Powered by";
63
67
  /** What is appended to the name, as `Link isExternal` does. */
64
68
  var NEW_TAB_SUFFIX = " (opens in a new tab)";
65
69
  /**
@@ -83,23 +87,30 @@ var POWERED_BY_WORDMARK_TO_COMPONENT_MAP = {
83
87
  ["ALCHEMY"]: GalaxyAlchemyWordmark
84
88
  };
85
89
  /**
86
- * The line holding "Powered by" and the mark. It never wraps or shrinks, and its line height is the
90
+ * The line holding the label, the mark and the trailing content. It never wraps or shrinks, and its line height is the
87
91
  * row's 40px, so the mark's descent stays inside the line box and never moves the text: the baseline
88
92
  * lands where a centred `body_sm` line puts it, level with the middle of an icon beside the row.
89
93
  * Declared after Text's own CSS (this module imports it), so the line height wins.
90
94
  */
91
95
  var LABEL_CSS = "gx-PoweredBy-LABEL_CSS-llnwtgc";
92
- /** The 8px between "Powered by" and the mark, as inline padding (no margins). */
93
- var MarkSlot = /*#__PURE__*/ styled("span")({
94
- name: "MarkSlot",
95
- class: "gx-PoweredBy-MarkSlot-mh367b4",
96
+ /** An item after another on the line, 8px on, as inline padding (no margins): the mark after a label, the trailing content after the mark. */
97
+ var Slot = /*#__PURE__*/ styled("span")({
98
+ name: "Slot",
99
+ class: "gx-PoweredBy-Slot-sh367b4",
96
100
  propsAsIs: false
97
101
  });
98
- /** The sidebar credit: "Powered by" and a product wordmark, linking to the product in a new tab. */
99
- var PoweredBy = forwardRef(function PoweredBy({ wordmark, href, ariaLabel, id, className, style, ...rest }, ref) {
102
+ /** Whether a slot has something to draw, so an empty one adds no 8px. */
103
+ var hasContent = (node) => node != null && node !== false && node !== "";
104
+ /** The sidebar credit: a label, a product wordmark and optional trailing content, linking to the product in a new tab. */
105
+ var PoweredBy = forwardRef(function PoweredBy({ wordmark, href, ariaLabel, label = DEFAULT_LABEL, trailing, id, className, style, ...rest }, ref) {
100
106
  const frame = useAppFrameContext();
101
107
  const Wordmark = POWERED_BY_WORDMARK_TO_COMPONENT_MAP[wordmark];
102
108
  if (frame?.isCollapsed) return null;
109
+ const mark = /* @__PURE__ */ jsx(Wordmark, {
110
+ size: POWERED_BY_WORDMARK_TO_SIZE_PX_MAP[wordmark],
111
+ ariaLabel: "",
112
+ className: cx(MARK_CSS, POWERED_BY_WORDMARK_TO_BASELINE_CSS_MAP[wordmark])
113
+ });
103
114
  return /* @__PURE__ */ jsx(Root, {
104
115
  "aria-label": `${ariaLabel}${NEW_TAB_SUFFIX}`,
105
116
  ...rest,
@@ -115,11 +126,11 @@ var PoweredBy = forwardRef(function PoweredBy({ wordmark, href, ariaLabel, id, c
115
126
  size: TextSize.BODY_SM,
116
127
  variant: TextVariant.TERTIARY,
117
128
  className: LABEL_CSS,
118
- children: ["Powered by", /* @__PURE__ */ jsx(MarkSlot, { children: /* @__PURE__ */ jsx(Wordmark, {
119
- size: POWERED_BY_WORDMARK_TO_SIZE_PX_MAP[wordmark],
120
- ariaLabel: "",
121
- className: cx(MARK_CSS, POWERED_BY_WORDMARK_TO_BASELINE_CSS_MAP[wordmark])
122
- }) })]
129
+ children: [
130
+ label,
131
+ label ? /* @__PURE__ */ jsx(Slot, { children: mark }) : mark,
132
+ hasContent(trailing) && /* @__PURE__ */ jsx(Slot, { children: trailing })
133
+ ]
123
134
  })
124
135
  });
125
136
  });
@@ -8,7 +8,7 @@ export type PasswordInputProps = Omit<InputProps, "type" | "trailing" | "isClear
8
8
  autoComplete?: InputProps["autoComplete"];
9
9
  };
10
10
  /** A masked single-line field with a "Show password" toggle: `Input` with `type="password"`. */
11
- declare const PasswordInput: import("react").ForwardRefExoticComponent<Omit<InputProps, "type" | "spellCheck" | "prefix" | "inputMode" | "trailing" | "suffix" | "autoComplete" | "isClearable"> & {
11
+ declare const PasswordInput: import("react").ForwardRefExoticComponent<Omit<InputProps, "type" | "trailing" | "spellCheck" | "prefix" | "inputMode" | "suffix" | "autoComplete" | "isClearable"> & {
12
12
  /**
13
13
  * Password-manager hint. Use `"new-password"` on sign-up and change-password forms.
14
14
  * @default "current-password"
@@ -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
  })]