@galaxy-io/dls 2.13.7 → 2.14.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.
@@ -32,6 +32,11 @@ interface AlertBaseProps extends AriaAttributes {
32
32
  * @default false
33
33
  */
34
34
  isBanner?: boolean;
35
+ /**
36
+ * Banner only: centers the icon, header, body and actions as one group; the dismiss button stays on the end edge. No effect inline.
37
+ * @default false
38
+ */
39
+ isCentered?: boolean;
35
40
  /** DOM id on the root `<div>`. */
36
41
  id?: string;
37
42
  /** Any `data-*` attribute, forwarded to the root `<div>`. */
@@ -29,8 +29,10 @@ import { CheckCircleIcon, InfoIcon, WarningCircleIcon, WarningIcon, XIcon } from
29
29
  * `variant` and `color` are exclusive by type (the Chip union).
30
30
  *
31
31
  * Inline it is a rounded panel; `isBanner` makes it a full-width strip across the top of a page
32
- * or panel (square corners, bottom hairline only, one line). No motion of its own: wrap it in
33
- * `Fade` (or the app's own height animation) for an animated dismiss.
32
+ * or panel (square corners, bottom hairline only, one line). `isCentered` centers a banner's icon,
33
+ * text and actions as one group (a site-wide notice); the dismiss button stays on the end edge,
34
+ * balanced by an empty slot on the start edge so the group sits on the strip's true center. No
35
+ * motion of its own: wrap it in `Fade` (or the app's own height animation) for an animated dismiss.
34
36
  */
35
37
  /** Severity (AGENTS.md "Variant": color set, subset). */
36
38
  var AlertVariant = /* @__PURE__ */ function(AlertVariant) {
@@ -125,12 +127,32 @@ var BANNER_CSS = "gx-Alert-BANNER_CSS-b11mdnwt";
125
127
  var BANNER_CONTENT_CSS = "gx-Alert-BANNER_CONTENT_CSS-by507ww";
126
128
  /** Banner: the actions trail and never shrink. */
127
129
  var BANNER_ACTIONS_CSS = "gx-Alert-BANNER_ACTIONS_CSS-b1imlr6o";
130
+ /** Centered banner: the group sits in the middle and its wrapped lines center. */
131
+ var CENTERED_CSS = "gx-Alert-CENTERED_CSS-c1pceass";
132
+ /** Centered banner: the content keeps its own width instead of filling the row. */
133
+ var CENTERED_CONTENT_CSS = "gx-Alert-CENTERED_CONTENT_CSS-cy6g2k6";
134
+ /**
135
+ * Centered banner with a dismiss: the start slot and the dismiss slot take equal shares of the
136
+ * leftover width (never less than the 20px button), so the group between them is on the true center.
137
+ */
138
+ var CENTERED_EDGE_CSS = "gx-Alert-CENTERED_EDGE_CSS-c4jovzi";
139
+ /** Centered banner: the dismiss button sits on the end edge of its growing slot. */
140
+ var CENTERED_DISMISS_CSS = "gx-Alert-CENTERED_DISMISS_CSS-c1sqe4o4";
141
+ /** The empty start slot that balances the dismiss slot of a centered banner. */
142
+ var BalanceSlot = /*#__PURE__*/ styled("span")({
143
+ name: "BalanceSlot",
144
+ class: "gx-Alert-BalanceSlot-bxnotxo",
145
+ propsAsIs: false
146
+ });
128
147
  /** A tinted, bordered message with a severity icon, optional header, actions and dismiss. */
129
- var Alert = forwardRef(function Alert({ variant = "PRIMARY", color, header, children, icon, actions, onDismiss, isBanner = false, id, className, style, ...rest }, ref) {
148
+ var Alert = forwardRef(function Alert({ variant = "PRIMARY", color, header, children, icon, actions, onDismiss, isBanner = false, isCentered = false, id, className, style, ...rest }, ref) {
130
149
  const hasColor = color !== void 0;
131
150
  const hasHeader = header !== void 0 && header !== "";
132
151
  const hasBody = children !== void 0 && children !== null && children !== false;
133
- const actionsRow = actions !== void 0 && actions !== null && actions !== false && /* @__PURE__ */ jsx(Actions, {
152
+ const hasActions = actions !== void 0 && actions !== null && actions !== false;
153
+ const hasDismiss = onDismiss !== void 0;
154
+ const isCenteredBanner = isBanner && isCentered;
155
+ const actionsRow = hasActions && /* @__PURE__ */ jsx(Actions, {
134
156
  className: cx(isBanner && BANNER_ACTIONS_CSS),
135
157
  children: actions
136
158
  });
@@ -139,9 +161,13 @@ var Alert = forwardRef(function Alert({ variant = "PRIMARY", color, header, chil
139
161
  ...rest,
140
162
  ref,
141
163
  id,
142
- className: cx(hasColor ? cx(ROLE_COLOR_TO_CSS_MAP[color], COLOR_CSS) : ALERT_VARIANT_TO_CSS_MAP[variant], isBanner && BANNER_CSS, className),
164
+ className: cx(hasColor ? cx(ROLE_COLOR_TO_CSS_MAP[color], COLOR_CSS) : ALERT_VARIANT_TO_CSS_MAP[variant], isBanner && BANNER_CSS, isCenteredBanner && CENTERED_CSS, className),
143
165
  style,
144
166
  children: [
167
+ isCenteredBanner && hasDismiss && /* @__PURE__ */ jsx(BalanceSlot, {
168
+ "aria-hidden": true,
169
+ className: CENTERED_EDGE_CSS
170
+ }),
145
171
  /* @__PURE__ */ jsx(IconSlot, { children: hasColor ? /* @__PURE__ */ jsx(Icon, {
146
172
  component: icon ?? InfoIcon,
147
173
  size: 16,
@@ -156,7 +182,7 @@ var Alert = forwardRef(function Alert({ variant = "PRIMARY", color, header, chil
156
182
  ariaLabel: ALERT_VARIANT_TO_SEVERITY_LABEL_MAP[variant]
157
183
  }) }),
158
184
  /* @__PURE__ */ jsxs(Content, {
159
- className: cx(isBanner && BANNER_CONTENT_CSS),
185
+ className: cx(isBanner && BANNER_CONTENT_CSS, isCenteredBanner && CENTERED_CONTENT_CSS),
160
186
  children: [
161
187
  hasHeader && /* @__PURE__ */ jsx(Text, {
162
188
  as: "p",
@@ -175,13 +201,16 @@ var Alert = forwardRef(function Alert({ variant = "PRIMARY", color, header, chil
175
201
  ]
176
202
  }),
177
203
  isBanner && actionsRow,
178
- onDismiss !== void 0 && /* @__PURE__ */ jsx(DismissSlot, { children: /* @__PURE__ */ jsx(Button, {
179
- icon: XIcon,
180
- variant: ButtonVariant.TERTIARY,
181
- size: ButtonSize.X_SMALL,
182
- ariaLabel: "Dismiss",
183
- onClick: () => onDismiss()
184
- }) })
204
+ hasDismiss && /* @__PURE__ */ jsx(DismissSlot, {
205
+ className: cx(isCenteredBanner && cx(CENTERED_EDGE_CSS, CENTERED_DISMISS_CSS)),
206
+ children: /* @__PURE__ */ jsx(Button, {
207
+ icon: XIcon,
208
+ variant: ButtonVariant.TERTIARY,
209
+ size: ButtonSize.X_SMALL,
210
+ ariaLabel: "Dismiss",
211
+ onClick: () => onDismiss?.()
212
+ })
213
+ })
185
214
  ]
186
215
  });
187
216
  });
@@ -10,6 +10,16 @@ export declare const INTERACTIVE_RESET = "appearance: none; background: none; bo
10
10
  * draws one edge or subtracts its border in `calc()`.
11
11
  */
12
12
  export declare const HAIRLINE_WIDTH = "1px";
13
+ /**
14
+ * The DLS text underline, shared by every line drawn under text (`Link`, `isUnderlined`,
15
+ * `hasTooltip`, `EditableText`): `HAIRLINE_WIDTH` thick, so it never thickens with the font's own
16
+ * underline metric on large steps, and `0.25em` below the baseline, so it drops with the type step
17
+ * (2.5px at caption, 3px at body_sm, 3.5px at body_lg, 4px at heading_sm) and clears descenders.
18
+ * `em`, not a space token: a `Span` inherits its step and cannot pick a px value per size.
19
+ * Interpolate it first, then set `text-decoration-style` (solid link and emphasis, dashed
20
+ * editable, dotted tooltip trigger) and `text-decoration-color`.
21
+ */
22
+ export declare const UNDERLINE = "text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: 0.25em;";
13
23
  /** The DLS hairline: a `HAIRLINE_WIDTH` `border.primary` border on every side. */
14
24
  export declare const HAIRLINE_BORDER: string;
15
25
  /**
@@ -30,6 +30,16 @@ var INTERACTIVE_RESET = `appearance: none; background: none; border: 0; padding:
30
30
  * draws one edge or subtracts its border in `calc()`.
31
31
  */
32
32
  var HAIRLINE_WIDTH = "1px";
33
+ /**
34
+ * The DLS text underline, shared by every line drawn under text (`Link`, `isUnderlined`,
35
+ * `hasTooltip`, `EditableText`): `HAIRLINE_WIDTH` thick, so it never thickens with the font's own
36
+ * underline metric on large steps, and `0.25em` below the baseline, so it drops with the type step
37
+ * (2.5px at caption, 3px at body_sm, 3.5px at body_lg, 4px at heading_sm) and clears descenders.
38
+ * `em`, not a space token: a `Span` inherits its step and cannot pick a px value per size.
39
+ * Interpolate it first, then set `text-decoration-style` (solid link and emphasis, dashed
40
+ * editable, dotted tooltip trigger) and `text-decoration-color`.
41
+ */
42
+ var UNDERLINE = `text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: 0.25em;`;
33
43
  /** The DLS hairline: a `HAIRLINE_WIDTH` `border.primary` border on every side. */
34
44
  var HAIRLINE_BORDER = `border: 1px solid ${t.color.border.primary};`;
35
45
  /**
@@ -64,4 +74,4 @@ var VISUALLY_HIDDEN = `position: absolute; width: 1px; height: 1px; padding: 0;
64
74
  */
65
75
  var REDUCED_MOTION = `@media (prefers-reduced-motion: reduce) { transition: none !important; animation: none !important; }`;
66
76
  //#endregion
67
- export { FIELD_FOCUS, FOCUS_RING, HAIRLINE_BORDER, HAIRLINE_WIDTH, INTERACTIVE_RESET, REDUCED_MOTION, TRUNCATE, VISUALLY_HIDDEN };
77
+ export { FIELD_FOCUS, FOCUS_RING, HAIRLINE_BORDER, HAIRLINE_WIDTH, INTERACTIVE_RESET, REDUCED_MOTION, TRUNCATE, UNDERLINE, VISUALLY_HIDDEN };