@tedi-design-system/react 18.0.0-rc.1 → 18.0.0-rc.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.
- package/_virtual/index.cjs10.js +1 -1
- package/_virtual/index.cjs11.js +1 -1
- package/_virtual/index.cjs12.js +1 -1
- package/_virtual/index.cjs13.js +1 -1
- package/_virtual/index.cjs5.js +1 -1
- package/_virtual/index.cjs6.js +1 -1
- package/_virtual/index.cjs7.js +1 -1
- package/_virtual/index.cjs8.js +1 -1
- package/_virtual/index.cjs9.js +1 -1
- package/_virtual/index.es10.js +1 -1
- package/_virtual/index.es11.js +1 -1
- package/_virtual/index.es12.js +1 -1
- package/_virtual/index.es13.js +2 -4
- package/_virtual/index.es14.js +2 -2
- package/_virtual/index.es5.js +4 -2
- package/_virtual/index.es6.js +1 -1
- package/_virtual/index.es7.js +1 -1
- package/_virtual/index.es8.js +1 -1
- package/_virtual/index.es9.js +1 -1
- package/bundle-stats.html +1 -1
- package/external/@mui/system/colorManipulator.cjs.js +1 -1
- package/external/@mui/system/colorManipulator.es.js +2 -2
- package/external/@mui/system/createStyled.cjs.js +1 -1
- package/external/@mui/system/createStyled.es.js +6 -6
- package/external/@mui/system/useThemeWithoutDefault.cjs.js +1 -1
- package/external/@mui/system/useThemeWithoutDefault.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
- package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
- package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
- package/external/prop-types/external/react-is/index.cjs.js +1 -1
- package/external/prop-types/external/react-is/index.es.js +1 -1
- package/external/react-is/index.cjs.js +1 -1
- package/external/react-is/index.es.js +1 -1
- package/external/toposort/index.cjs.js +1 -1
- package/external/toposort/index.es.js +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
- package/src/tedi/components/buttons/collapse/collapse.cjs.js +1 -1
- package/src/tedi/components/buttons/collapse/collapse.d.ts +8 -0
- package/src/tedi/components/buttons/collapse/collapse.es.js +48 -46
- package/src/tedi/components/buttons/collapse/collapse.module.scss.cjs.js +1 -1
- package/src/tedi/components/buttons/collapse/collapse.module.scss.es.js +2 -1
- package/src/tedi/components/notifications/alert/alert.cjs.js +1 -1
- package/src/tedi/components/notifications/alert/alert.d.ts +14 -1
- package/src/tedi/components/notifications/alert/alert.es.js +45 -42
- package/src/tedi/components/notifications/alert/alert.module.scss.cjs.js +1 -1
- package/src/tedi/components/notifications/alert/alert.module.scss.es.js +2 -1
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),n=require("../../../../../external/classnames/index.cjs.js"),_=require("react"),F=require("../../../../../external/react-animate-height/dist/esm/index.cjs.js"),G=require("../../../providers/printing-provider/printing-provider.cjs.js"),H=require("../../base/icon/icon.cjs.js"),J=require("../../base/typography/text/text.cjs.js"),Q=require("../../misc/print/print.cjs.js"),e=require("./collapse.module.scss.cjs.js"),U=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),V=require("../../../providers/label-provider/use-labels.cjs.js"),C=require("../../layout/grid/row.cjs.js"),o=require("../../layout/grid/col.cjs.js"),I=x=>{const{getCurrentBreakpointProps:N}=U.useBreakpointProps(x.defaultServerBreakpoint),{getLabel:h}=V.useLabels(),{id:r,children:w,className:P,openText:j=h("open"),closeText:g=h("close"),hideCollapseText:k=!1,title:d,titleRowProps:O,defaultOpen:$,open:c,onToggle:u,arrowType:s="default",size:i="default",underline:S=!0,toggleLabel:y,iconOnly:B=!1,inverted:M=!1,...R}=N(x),p=`${r}__trigger`,f=`${r}__content`,T=`${r}__animate`,[b,L]=_.useState(()=>$),m=G.usePrint(),a=_.useMemo(()=>m||(c!==void 0?c:b),[m,c,b]),D=B===!0&&!d,z=M&&s!=="secondary",E=n.default(e.default["tedi-collapse"],i==="small"&&e.default["tedi-collapse--small"],a&&e.default["tedi-collapse--is-open"],D&&e.default["tedi-collapse--icon-only"],z&&e.default["tedi-collapse--inverted"],e.default[`tedi-collapse--arrow-${s}`],P),v=()=>{const l=!a;L(l),u==null||u(l)},K=l=>{(l.key==="Enter"||l.key===" ")&&!l.repeat&&(l.preventDefault(),v())},A=y||(a?g:j),q=_.useMemo(()=>t.jsx("div",{id:f,role:"region","aria-labelledby":p,className:e.default["tedi-collapse__content"],children:w}),[w,f,p]);return t.jsxs("div",{"data-name":"collapse",...R,className:E,children:[t.jsx("button",{id:p,type:"button","data-name":"collapse-trigger",className:e.default["tedi-collapse__title"],"aria-label":A,"aria-expanded":a,"aria-controls":f,onKeyDown:K,onClick:v,children:t.jsxs(C.Row,{justifyContent:"between",alignItems:"center",wrap:"nowrap",...O,element:"span",children:[d&&t.jsx(o.Col,{"aria-hidden":"true",children:d}),t.jsx(o.Col,{width:"auto",children:t.jsxs(C.Row,{element:"span",alignItems:"center",gutter:0,wrap:"nowrap",children:[t.jsx(Q.Print,{visibility:"hide",children:t.jsx(o.Col,{width:"auto",className:n.default({"visually-hidden":k}),children:t.jsx(J.Text,{element:"span",className:n.default(e.default["tedi-collapse__text"],{[e.default["tedi-collapse__text--underline"]]:S}),children:a?g:j})})}),t.jsx(o.Col,{width:"auto",children:t.jsx("div",{className:n.default(e.default["tedi-collapse__icon-wrapper"],e.default[`tedi-collapse__icon-wrapper--${s}`],i==="small"&&e.default["tedi-collapse__icon-wrapper--small"]),children:t.jsx(H.Icon,{className:n.default(e.default["tedi-collapse__icon"],e.default[`tedi-collapse__icon--${s}`],i==="small"&&e.default["tedi-collapse__icon--small"]),name:"expand_more",size:i==="small"||s==="secondary"?18:24})})})]})})]})}),m?q:t.jsx(F.default,{id:T,duration:300,height:a?"auto":0,"data-testid":"collapse-inner",children:q})]})};exports.Collapse=I;exports.default=I;
|
|
@@ -40,6 +40,14 @@ type CollapseBreakpointProps = {
|
|
|
40
40
|
* @default false
|
|
41
41
|
*/
|
|
42
42
|
iconOnly?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Inverted color palette — flips the link / icon colors to their
|
|
45
|
+
* inverted-surface equivalents (white text + icon), for use on top of dark
|
|
46
|
+
* backgrounds. Pairs with both the with-text and icon-only variants; the
|
|
47
|
+
* secondary-arrow style has no inverted form in the design.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
inverted?: boolean;
|
|
43
51
|
};
|
|
44
52
|
export interface CollapseProps extends BreakpointSupport<CollapseBreakpointProps> {
|
|
45
53
|
/**
|
|
@@ -1,55 +1,57 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { usePrint as
|
|
6
|
-
import { Icon as
|
|
7
|
-
import { Text as
|
|
8
|
-
import { Print as
|
|
1
|
+
import { jsx as t, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import n from "../../../../../external/classnames/index.es.js";
|
|
3
|
+
import h from "react";
|
|
4
|
+
import q from "../../../../../external/react-animate-height/dist/esm/index.es.js";
|
|
5
|
+
import { usePrint as F } from "../../../providers/printing-provider/printing-provider.es.js";
|
|
6
|
+
import { Icon as G } from "../../base/icon/icon.es.js";
|
|
7
|
+
import { Text as J } from "../../base/typography/text/text.es.js";
|
|
8
|
+
import { Print as Q } from "../../misc/print/print.es.js";
|
|
9
9
|
import e from "./collapse.module.scss.es.js";
|
|
10
|
-
import { useBreakpointProps as
|
|
11
|
-
import { useLabels as
|
|
10
|
+
import { useBreakpointProps as U } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
11
|
+
import { useLabels as V } from "../../../providers/label-provider/use-labels.es.js";
|
|
12
12
|
import { Row as k } from "../../layout/grid/row.es.js";
|
|
13
13
|
import { Col as s } from "../../layout/grid/col.es.js";
|
|
14
|
-
const
|
|
15
|
-
const { getCurrentBreakpointProps: O } =
|
|
14
|
+
const ce = (w) => {
|
|
15
|
+
const { getCurrentBreakpointProps: O } = U(w.defaultServerBreakpoint), { getLabel: y } = V(), {
|
|
16
16
|
id: r,
|
|
17
17
|
children: g,
|
|
18
18
|
className: P,
|
|
19
19
|
openText: b = y("open"),
|
|
20
|
-
closeText:
|
|
20
|
+
closeText: v = y("close"),
|
|
21
21
|
hideCollapseText: $ = !1,
|
|
22
22
|
title: c,
|
|
23
23
|
titleRowProps: B,
|
|
24
24
|
defaultOpen: S,
|
|
25
25
|
open: d,
|
|
26
26
|
onToggle: p,
|
|
27
|
-
arrowType:
|
|
27
|
+
arrowType: o = "default",
|
|
28
28
|
size: i = "default",
|
|
29
29
|
underline: T = !0,
|
|
30
|
-
toggleLabel:
|
|
30
|
+
toggleLabel: x,
|
|
31
31
|
iconOnly: j = !1,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
inverted: D = !1,
|
|
33
|
+
...L
|
|
34
|
+
} = O(w), m = `${r}__trigger`, u = `${r}__content`, M = `${r}__animate`, [N, R] = h.useState(() => S), _ = F(), a = h.useMemo(
|
|
35
|
+
() => _ || (d !== void 0 ? d : N),
|
|
36
|
+
[_, d, N]
|
|
37
|
+
), z = j === !0 && !c, E = D && o !== "secondary", K = n(
|
|
37
38
|
e["tedi-collapse"],
|
|
38
39
|
i === "small" && e["tedi-collapse--small"],
|
|
39
40
|
a && e["tedi-collapse--is-open"],
|
|
40
|
-
|
|
41
|
-
e[
|
|
41
|
+
z && e["tedi-collapse--icon-only"],
|
|
42
|
+
E && e["tedi-collapse--inverted"],
|
|
43
|
+
e[`tedi-collapse--arrow-${o}`],
|
|
42
44
|
P
|
|
43
|
-
),
|
|
45
|
+
), C = () => {
|
|
44
46
|
const l = !a;
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
(l.key === "Enter" || l.key === " ") && !l.repeat && (l.preventDefault(),
|
|
48
|
-
},
|
|
47
|
+
R(l), p == null || p(l);
|
|
48
|
+
}, A = (l) => {
|
|
49
|
+
(l.key === "Enter" || l.key === " ") && !l.repeat && (l.preventDefault(), C());
|
|
50
|
+
}, H = x || (a ? v : b), I = h.useMemo(
|
|
49
51
|
() => /* @__PURE__ */ t("div", { id: u, role: "region", "aria-labelledby": m, className: e["tedi-collapse__content"], children: g }),
|
|
50
52
|
[g, u, m]
|
|
51
53
|
);
|
|
52
|
-
return /* @__PURE__ */
|
|
54
|
+
return /* @__PURE__ */ f("div", { "data-name": "collapse", ...L, className: K, children: [
|
|
53
55
|
/* @__PURE__ */ t(
|
|
54
56
|
"button",
|
|
55
57
|
{
|
|
@@ -57,42 +59,42 @@ const se = (w) => {
|
|
|
57
59
|
type: "button",
|
|
58
60
|
"data-name": "collapse-trigger",
|
|
59
61
|
className: e["tedi-collapse__title"],
|
|
60
|
-
"aria-label":
|
|
62
|
+
"aria-label": H,
|
|
61
63
|
"aria-expanded": a,
|
|
62
64
|
"aria-controls": u,
|
|
63
|
-
onKeyDown:
|
|
64
|
-
onClick:
|
|
65
|
-
children: /* @__PURE__ */
|
|
65
|
+
onKeyDown: A,
|
|
66
|
+
onClick: C,
|
|
67
|
+
children: /* @__PURE__ */ f(k, { justifyContent: "between", alignItems: "center", wrap: "nowrap", ...B, element: "span", children: [
|
|
66
68
|
c && /* @__PURE__ */ t(s, { "aria-hidden": "true", children: c }),
|
|
67
|
-
/* @__PURE__ */ t(s, { width: "auto", children: /* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */ t(
|
|
69
|
-
|
|
69
|
+
/* @__PURE__ */ t(s, { width: "auto", children: /* @__PURE__ */ f(k, { element: "span", alignItems: "center", gutter: 0, wrap: "nowrap", children: [
|
|
70
|
+
/* @__PURE__ */ t(Q, { visibility: "hide", children: /* @__PURE__ */ t(s, { width: "auto", className: n({ "visually-hidden": $ }), children: /* @__PURE__ */ t(
|
|
71
|
+
J,
|
|
70
72
|
{
|
|
71
73
|
element: "span",
|
|
72
|
-
className:
|
|
74
|
+
className: n(e["tedi-collapse__text"], {
|
|
73
75
|
[e["tedi-collapse__text--underline"]]: T
|
|
74
76
|
}),
|
|
75
|
-
children: a ?
|
|
77
|
+
children: a ? v : b
|
|
76
78
|
}
|
|
77
79
|
) }) }),
|
|
78
80
|
/* @__PURE__ */ t(s, { width: "auto", children: /* @__PURE__ */ t(
|
|
79
81
|
"div",
|
|
80
82
|
{
|
|
81
|
-
className:
|
|
83
|
+
className: n(
|
|
82
84
|
e["tedi-collapse__icon-wrapper"],
|
|
83
|
-
e[`tedi-collapse__icon-wrapper--${
|
|
85
|
+
e[`tedi-collapse__icon-wrapper--${o}`],
|
|
84
86
|
i === "small" && e["tedi-collapse__icon-wrapper--small"]
|
|
85
87
|
),
|
|
86
88
|
children: /* @__PURE__ */ t(
|
|
87
|
-
|
|
89
|
+
G,
|
|
88
90
|
{
|
|
89
|
-
className:
|
|
91
|
+
className: n(
|
|
90
92
|
e["tedi-collapse__icon"],
|
|
91
|
-
e[`tedi-collapse__icon--${
|
|
93
|
+
e[`tedi-collapse__icon--${o}`],
|
|
92
94
|
i === "small" && e["tedi-collapse__icon--small"]
|
|
93
95
|
),
|
|
94
96
|
name: "expand_more",
|
|
95
|
-
size: i === "small" ||
|
|
97
|
+
size: i === "small" || o === "secondary" ? 18 : 24
|
|
96
98
|
}
|
|
97
99
|
)
|
|
98
100
|
}
|
|
@@ -101,10 +103,10 @@ const se = (w) => {
|
|
|
101
103
|
] })
|
|
102
104
|
}
|
|
103
105
|
),
|
|
104
|
-
_ ? I : /* @__PURE__ */ t(
|
|
106
|
+
_ ? I : /* @__PURE__ */ t(q, { id: M, duration: 300, height: a ? "auto" : 0, "data-testid": "collapse-inner", children: I })
|
|
105
107
|
] });
|
|
106
108
|
};
|
|
107
109
|
export {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
ce as Collapse,
|
|
111
|
+
ce as default
|
|
110
112
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-collapse__title":"tedi-collapse__title-3e140e5c","tedi-collapse__text":"tedi-collapse__text-d150fea1","tedi-collapse__text--underline":"tedi-collapse__text--underline-73ca86bd","tedi-collapse__icon-wrapper":"tedi-collapse__icon-wrapper-d2b036ea","tedi-collapse__icon":"tedi-collapse__icon-5156e480","tedi-collapse__icon-wrapper--secondary":"tedi-collapse__icon-wrapper--secondary-3321348a","tedi-collapse__icon--secondary":"tedi-collapse__icon--secondary-f0f3125f","tedi-collapse__icon--default":"tedi-collapse__icon--default-9c7e19e4","tedi-collapse__icon-wrapper--default":"tedi-collapse__icon-wrapper--default-450808b2","tedi-collapse__icon-wrapper--small":"tedi-collapse__icon-wrapper--small-65e6d09a","tedi-collapse--icon-only":"tedi-collapse--icon-only-335962f8","tedi-collapse__content":"tedi-collapse__content-350b91f8","tedi-collapse--is-open":"tedi-collapse--is-open-b34b11c3"};exports.default=e;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-collapse__title":"tedi-collapse__title-3e140e5c","tedi-collapse__text":"tedi-collapse__text-d150fea1","tedi-collapse__text--underline":"tedi-collapse__text--underline-73ca86bd","tedi-collapse__icon-wrapper":"tedi-collapse__icon-wrapper-d2b036ea","tedi-collapse__icon":"tedi-collapse__icon-5156e480","tedi-collapse__icon-wrapper--secondary":"tedi-collapse__icon-wrapper--secondary-3321348a","tedi-collapse__icon--secondary":"tedi-collapse__icon--secondary-f0f3125f","tedi-collapse__icon--default":"tedi-collapse__icon--default-9c7e19e4","tedi-collapse__icon-wrapper--default":"tedi-collapse__icon-wrapper--default-450808b2","tedi-collapse__icon-wrapper--small":"tedi-collapse__icon-wrapper--small-65e6d09a","tedi-collapse--icon-only":"tedi-collapse--icon-only-335962f8","tedi-collapse__content":"tedi-collapse__content-350b91f8","tedi-collapse--is-open":"tedi-collapse--is-open-b34b11c3","tedi-collapse--inverted":"tedi-collapse--inverted-bd2d0e21"};exports.default=e;
|
|
@@ -11,7 +11,8 @@ const e = {
|
|
|
11
11
|
"tedi-collapse__icon-wrapper--small": "tedi-collapse__icon-wrapper--small-65e6d09a",
|
|
12
12
|
"tedi-collapse--icon-only": "tedi-collapse--icon-only-335962f8",
|
|
13
13
|
"tedi-collapse__content": "tedi-collapse__content-350b91f8",
|
|
14
|
-
"tedi-collapse--is-open": "tedi-collapse--is-open-b34b11c3"
|
|
14
|
+
"tedi-collapse--is-open": "tedi-collapse--is-open-b34b11c3",
|
|
15
|
+
"tedi-collapse--inverted": "tedi-collapse--inverted-bd2d0e21"
|
|
15
16
|
};
|
|
16
17
|
export {
|
|
17
18
|
e as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),N=require("../../../../../external/classnames/index.cjs.js"),S=require("react"),M=require("../../base/icon/icon.cjs.js"),P=require("../../base/typography/heading/heading.cjs.js"),k=require("../../buttons/closing-button/closing-button.cjs.js"),t=require("./alert.module.scss.cjs.js"),y=require("../../../helpers/hooks/use-is-mounted.cjs.js"),z=require("../../../helpers/hooks/use-breakpoint-props.cjs.js"),$=require("../../layout/vertical-spacing/vertical-spacing.cjs.js"),A=require("../../layout/grid/row.cjs.js"),n=require("../../layout/grid/col.cjs.js"),o=c=>{const{getCurrentBreakpointProps:h}=z.useBreakpointProps(c.defaultServerBreakpoint),{children:i,role:s="alert",title:r,className:m,type:d="info",icon:u,onClose:f,action:a,isGlobal:j=!1,noSideBorders:x=!1,titleElement:q="h3",size:v="default",..._}=h(c),B=N.default(t.default["tedi-alert"],t.default[`tedi-alert--${d}`],t.default[`tedi-alert--size-${v}`],{[t.default["tedi-alert--global"]]:j,[t.default["tedi-alert--no-side-borders"]]:x,[t.default["tedi-alert--has-action"]]:!!a},m),b=y.useIsMounted(),I=l=>{const g={size:18},C=typeof l=="string"?{...g,name:l}:{...g,...l};return e.jsx(M.Icon,{...C,className:t.default["tedi-alert__icon"]})},w=s==="alert"?"assertive":s==="status"?"polite":"off",p=S.useId();return b?e.jsx("div",{role:s,"data-name":"alert","aria-label":`${d} alert`,"aria-live":w,"aria-labelledby":r?p:void 0,..._,className:B,children:e.jsxs($.VerticalSpacing,{size:.25,children:[e.jsxs(A.Row,{gutterX:2,alignItems:r?"center":"start",children:[e.jsxs(n.Col,{grow:1,className:t.default["tedi-alert__content"],children:[u&&I(u),e.jsx("div",{className:"tedi-alert__content-wrapper",children:r?e.jsx(P.Heading,{element:q,id:p,modifiers:["h5"],children:r}):i})]}),a?e.jsx(n.Col,{width:"auto",children:a}):f&&e.jsx(n.Col,{width:"auto",children:e.jsx(k.ClosingButton,{onClick:f,iconSize:18})})]}),r&&i&&e.jsx("div",{className:"tedi-alert__content-wrapper",children:i})]})}):null};o.displayName="Alert";exports.Alert=o;exports.default=o;
|
|
@@ -54,8 +54,18 @@ export interface AlertProps extends BreakpointSupport<AlertBreakpointProps> {
|
|
|
54
54
|
* Callback function triggered when the close button is clicked.
|
|
55
55
|
* Adding this handler renders a close button in the alert.
|
|
56
56
|
* Useful for dismissible alerts.
|
|
57
|
+
*
|
|
58
|
+
* Ignored when `action` is also set — the consumer's slot wins, and is
|
|
59
|
+
* responsible for any close affordance it wants to expose.
|
|
57
60
|
*/
|
|
58
61
|
onClose?: () => void;
|
|
62
|
+
/**
|
|
63
|
+
* Custom content for the right-side slot of the alert (e.g. a CTA button,
|
|
64
|
+
* a link, or a small icon stack). Replaces the default close button when
|
|
65
|
+
* provided. Use this instead of squeezing buttons into `children` so the
|
|
66
|
+
* layout slot is reserved and aligned consistently.
|
|
67
|
+
*/
|
|
68
|
+
action?: React.ReactNode;
|
|
59
69
|
/**
|
|
60
70
|
* The ARIA role of the alert, informing screen readers about the alert's purpose.
|
|
61
71
|
* Options:
|
|
@@ -80,5 +90,8 @@ export interface AlertProps extends BreakpointSupport<AlertBreakpointProps> {
|
|
|
80
90
|
*/
|
|
81
91
|
titleElement?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
82
92
|
}
|
|
83
|
-
export declare const Alert:
|
|
93
|
+
export declare const Alert: {
|
|
94
|
+
(props: AlertProps): JSX.Element | null;
|
|
95
|
+
displayName: string;
|
|
96
|
+
};
|
|
84
97
|
export default Alert;
|
|
@@ -1,66 +1,69 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
2
|
import k from "../../../../../external/classnames/index.es.js";
|
|
3
|
-
import
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { Heading as
|
|
6
|
-
import { ClosingButton as
|
|
3
|
+
import P from "react";
|
|
4
|
+
import { Icon as S } from "../../base/icon/icon.es.js";
|
|
5
|
+
import { Heading as x } from "../../base/typography/heading/heading.es.js";
|
|
6
|
+
import { ClosingButton as M } from "../../buttons/closing-button/closing-button.es.js";
|
|
7
7
|
import t from "./alert.module.scss.es.js";
|
|
8
|
-
import { useIsMounted as
|
|
9
|
-
import { useBreakpointProps as
|
|
10
|
-
import { VerticalSpacing as
|
|
8
|
+
import { useIsMounted as $ } from "../../../helpers/hooks/use-is-mounted.es.js";
|
|
9
|
+
import { useBreakpointProps as j } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
10
|
+
import { VerticalSpacing as A } from "../../layout/vertical-spacing/vertical-spacing.es.js";
|
|
11
11
|
import { Row as E } from "../../layout/grid/row.es.js";
|
|
12
|
-
import { Col as
|
|
13
|
-
const
|
|
14
|
-
const { getCurrentBreakpointProps:
|
|
12
|
+
import { Col as n } from "../../layout/grid/col.es.js";
|
|
13
|
+
const R = (d) => {
|
|
14
|
+
const { getCurrentBreakpointProps: h } = j(d.defaultServerBreakpoint), {
|
|
15
15
|
children: o,
|
|
16
16
|
role: i = "alert",
|
|
17
17
|
title: r,
|
|
18
|
-
className:
|
|
19
|
-
type:
|
|
20
|
-
icon:
|
|
21
|
-
onClose:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
className: g,
|
|
19
|
+
type: c = "info",
|
|
20
|
+
icon: m,
|
|
21
|
+
onClose: p,
|
|
22
|
+
action: a,
|
|
23
|
+
isGlobal: _ = !1,
|
|
24
|
+
noSideBorders: v = !1,
|
|
25
|
+
titleElement: N = "h3",
|
|
26
|
+
size: B = "default",
|
|
27
|
+
...I
|
|
28
|
+
} = h(d), b = k(
|
|
28
29
|
t["tedi-alert"],
|
|
29
|
-
t[`tedi-alert--${
|
|
30
|
-
t[`tedi-alert--size-${
|
|
30
|
+
t[`tedi-alert--${c}`],
|
|
31
|
+
t[`tedi-alert--size-${B}`],
|
|
31
32
|
{
|
|
32
|
-
[t["tedi-alert--global"]]:
|
|
33
|
-
[t["tedi-alert--no-side-borders"]]:
|
|
33
|
+
[t["tedi-alert--global"]]: _,
|
|
34
|
+
[t["tedi-alert--no-side-borders"]]: v,
|
|
35
|
+
[t["tedi-alert--has-action"]]: !!a
|
|
34
36
|
},
|
|
35
|
-
|
|
36
|
-
),
|
|
37
|
-
const
|
|
38
|
-
return /* @__PURE__ */ e(
|
|
39
|
-
}, z = i === "alert" ? "assertive" : i === "status" ? "polite" : "off",
|
|
40
|
-
return
|
|
37
|
+
g
|
|
38
|
+
), w = $(), y = (l) => {
|
|
39
|
+
const u = { size: 18 }, C = typeof l == "string" ? { ...u, name: l } : { ...u, ...l };
|
|
40
|
+
return /* @__PURE__ */ e(S, { ...C, className: t["tedi-alert__icon"] });
|
|
41
|
+
}, z = i === "alert" ? "assertive" : i === "status" ? "polite" : "off", f = P.useId();
|
|
42
|
+
return w ? /* @__PURE__ */ e(
|
|
41
43
|
"div",
|
|
42
44
|
{
|
|
43
45
|
role: i,
|
|
44
46
|
"data-name": "alert",
|
|
45
|
-
"aria-label": `${
|
|
47
|
+
"aria-label": `${c} alert`,
|
|
46
48
|
"aria-live": z,
|
|
47
|
-
"aria-labelledby": r ?
|
|
48
|
-
...
|
|
49
|
+
"aria-labelledby": r ? f : void 0,
|
|
50
|
+
...I,
|
|
49
51
|
className: b,
|
|
50
|
-
children: /* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
|
|
54
|
-
/* @__PURE__ */ e("div", { className: "tedi-alert__content-wrapper", children: r ? /* @__PURE__ */ e(
|
|
52
|
+
children: /* @__PURE__ */ s(A, { size: 0.25, children: [
|
|
53
|
+
/* @__PURE__ */ s(E, { gutterX: 2, alignItems: r ? "center" : "start", children: [
|
|
54
|
+
/* @__PURE__ */ s(n, { grow: 1, className: t["tedi-alert__content"], children: [
|
|
55
|
+
m && y(m),
|
|
56
|
+
/* @__PURE__ */ e("div", { className: "tedi-alert__content-wrapper", children: r ? /* @__PURE__ */ e(x, { element: N, id: f, modifiers: ["h5"], children: r }) : o })
|
|
55
57
|
] }),
|
|
56
|
-
|
|
58
|
+
a ? /* @__PURE__ */ e(n, { width: "auto", children: a }) : p && /* @__PURE__ */ e(n, { width: "auto", children: /* @__PURE__ */ e(M, { onClick: p, iconSize: 18 }) })
|
|
57
59
|
] }),
|
|
58
60
|
r && o && /* @__PURE__ */ e("div", { className: "tedi-alert__content-wrapper", children: o })
|
|
59
61
|
] })
|
|
60
62
|
}
|
|
61
63
|
) : null;
|
|
62
64
|
};
|
|
65
|
+
R.displayName = "Alert";
|
|
63
66
|
export {
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
R as Alert,
|
|
68
|
+
R as default
|
|
66
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-alert":"tedi-alert-8ca3e7b9","tedi-alert__content":"tedi-alert__content-d480ed20","tedi-alert__icon":"tedi-alert__icon-f9ab1feb","tedi-alert--size-default":"tedi-alert--size-default-6a9ebe2c","tedi-alert--size-small":"tedi-alert--size-small-4c763cad","tedi-alert--info":"tedi-alert--info-bcd40044","tedi-alert--success":"tedi-alert--success-e6d21f49","tedi-alert--warning":"tedi-alert--warning-88456526","tedi-alert--danger":"tedi-alert--danger-b9a2aa60","tedi-alert--global":"tedi-alert--global-14ff86d0","tedi-alert--no-side-borders":"tedi-alert--no-side-borders-a15a1df0"};exports.default=e;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e={"tedi-alert":"tedi-alert-8ca3e7b9","tedi-alert__content":"tedi-alert__content-d480ed20","tedi-alert__icon":"tedi-alert__icon-f9ab1feb","tedi-alert--size-default":"tedi-alert--size-default-6a9ebe2c","tedi-alert--size-small":"tedi-alert--size-small-4c763cad","tedi-alert--info":"tedi-alert--info-bcd40044","tedi-alert--success":"tedi-alert--success-e6d21f49","tedi-alert--warning":"tedi-alert--warning-88456526","tedi-alert--danger":"tedi-alert--danger-b9a2aa60","tedi-alert--global":"tedi-alert--global-14ff86d0","tedi-alert--no-side-borders":"tedi-alert--no-side-borders-a15a1df0","tedi-alert--has-action":"tedi-alert--has-action-0140d06a"};exports.default=e;
|
|
@@ -9,7 +9,8 @@ const e = {
|
|
|
9
9
|
"tedi-alert--warning": "tedi-alert--warning-88456526",
|
|
10
10
|
"tedi-alert--danger": "tedi-alert--danger-b9a2aa60",
|
|
11
11
|
"tedi-alert--global": "tedi-alert--global-14ff86d0",
|
|
12
|
-
"tedi-alert--no-side-borders": "tedi-alert--no-side-borders-a15a1df0"
|
|
12
|
+
"tedi-alert--no-side-borders": "tedi-alert--no-side-borders-a15a1df0",
|
|
13
|
+
"tedi-alert--has-action": "tedi-alert--has-action-0140d06a"
|
|
13
14
|
};
|
|
14
15
|
export {
|
|
15
16
|
e as default
|