@galaxy-io/dls 2.13.2 → 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"