@galaxy-io/dls 2.14.0 → 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.
- package/dist/feedback/Alert.d.ts +5 -0
- package/dist/feedback/Alert.js +42 -13
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/feedback/Alert.d.ts
CHANGED
|
@@ -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>`. */
|
package/dist/feedback/Alert.js
CHANGED
|
@@ -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).
|
|
33
|
-
*
|
|
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
|
|
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
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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
|
});
|