@rikstv/shared-components 3.3.3 → 3.3.4-alpha.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # 📖 Changelog
2
2
 
3
+ ## 3.3.4
4
+
5
+ - Add title for screen readers when heading is hidden
6
+
3
7
  ## 3.3.3
4
8
 
5
9
  - Add possibility to hide alert heading
@@ -0,0 +1,70 @@
1
+ import { jsxs as d, jsx as s } from "react/jsx-runtime";
2
+ import { forwardRef as F, useState as c } from "react";
3
+ import { H as T, B as b } from "../typography/Typography-CXNJ1SFo.mjs";
4
+ import "../icons/HeartToggle-Bwgo4FxH.mjs";
5
+ import { S as x, a as m, b as O, c as R } from "../icons/Icons-2z4jxD15.mjs";
6
+ const D = "_rds-alert--icon_m8jce_67", E = "_rds-alert--content-title_m8jce_79", H = "_rds-alert--content_m8jce_79", M = "_rds-alert--dismiss_m8jce_109", V = "_dismissed_m8jce_138", q = "_dismiss-fade-out_m8jce_1", e = {
7
+ rdsAlertIcon: D,
8
+ rdsAlertContentTitle: E,
9
+ rdsAlertContent: H,
10
+ rdsAlertDismiss: M,
11
+ dismissed: V,
12
+ dismissFadeOut: q
13
+ }, z = {
14
+ warning: { title: "Advarsel", Icon: O },
15
+ error: { title: "Feil", Icon: m },
16
+ info: { title: "Informasjon", Icon: m },
17
+ success: { title: "Vellykket", Icon: x }
18
+ }, G = F(
19
+ ({
20
+ className: f,
21
+ intent: r = "warning",
22
+ variant: l = "filled",
23
+ testId: A = "rds-alert",
24
+ heading: _,
25
+ noHeading: i = !1,
26
+ children: v,
27
+ dismissible: u = !0,
28
+ lightBackground: p,
29
+ onDismissed: t,
30
+ LinkToDetails: C,
31
+ ...j
32
+ }, I) => {
33
+ const [h, n] = c(!1), [N, a] = c(!1), g = ["rds-alert", p ? "rds-light" : "", h ? e.dismissed : "", f].filter(Boolean).join(" ");
34
+ if (N)
35
+ return null;
36
+ const S = () => {
37
+ n(!1), a(!1);
38
+ }, { title: o, Icon: y } = z[r], k = (B) => {
39
+ B.animationName === e.dismissFadeOut && (a(!0), t == null || t(S));
40
+ }, w = u && l !== "inline";
41
+ return /* @__PURE__ */ d(
42
+ "div",
43
+ {
44
+ role: "alert",
45
+ "aria-live": "polite",
46
+ ref: I,
47
+ className: g,
48
+ "data-testid": A,
49
+ "data-intent": r,
50
+ "data-variant": l,
51
+ onAnimationEnd: k,
52
+ ...j,
53
+ children: [
54
+ /* @__PURE__ */ s(y, { className: e.rdsAlertIcon }),
55
+ /* @__PURE__ */ d("div", { className: e.rdsAlertContent, children: [
56
+ !i && /* @__PURE__ */ s(T, { className: e.rdsAlertContentTitle, as: "span", children: _ || o }),
57
+ i && /* @__PURE__ */ s("span", { className: "sr-only", children: o }),
58
+ /* @__PURE__ */ s(b, { as: "div", children: v }),
59
+ C
60
+ ] }),
61
+ w && /* @__PURE__ */ s("div", { className: e.rdsAlertDismiss, children: /* @__PURE__ */ s("button", { "aria-label": "Avvis varsel", onClick: () => n(!0), children: /* @__PURE__ */ s(R, {}) }) })
62
+ ]
63
+ }
64
+ );
65
+ }
66
+ );
67
+ G.displayName = "Alert";
68
+ export {
69
+ G as A
70
+ };
@@ -6,7 +6,7 @@ import { G as N } from "./components/spacing/GutterPadding-Bd7tSm3F.mjs";
6
6
  import { N as Q } from "./components/notificationDot/NotificationDot-C2_j4FdL.mjs";
7
7
  import { A as _ } from "./components/accordion/Accordion-rewqLwCV.mjs";
8
8
  import { P as U } from "./components/panel/Panel-drl2owId.mjs";
9
- import { A as z } from "./components/alert/Alert-BnRnv73N.mjs";
9
+ import { A as z } from "./components/alert/Alert-BDfwNOJx.mjs";
10
10
  import { B as K, a as X } from "./components/breadcrumb/Breadcrumb-BJNLZ7iB.mjs";
11
11
  import { P as Z } from "./components/progress/Progress-CjnegHvC.mjs";
12
12
  import { L as re } from "./components/loader/Loader-gjL6yh1f.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rikstv/shared-components",
3
- "version": "3.3.3",
3
+ "version": "3.3.4-alpha.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,69 +0,0 @@
1
- import { jsxs as a, jsx as s } from "react/jsx-runtime";
2
- import { forwardRef as F, useState as o } from "react";
3
- import { H as T, B as b } from "../typography/Typography-CXNJ1SFo.mjs";
4
- import "../icons/HeartToggle-Bwgo4FxH.mjs";
5
- import { S as x, a as d, b as O, c as H } from "../icons/Icons-2z4jxD15.mjs";
6
- const R = "_rds-alert--icon_m8jce_67", D = "_rds-alert--content-title_m8jce_79", E = "_rds-alert--content_m8jce_79", M = "_rds-alert--dismiss_m8jce_109", V = "_dismissed_m8jce_138", q = "_dismiss-fade-out_m8jce_1", e = {
7
- rdsAlertIcon: R,
8
- rdsAlertContentTitle: D,
9
- rdsAlertContent: E,
10
- rdsAlertDismiss: M,
11
- dismissed: V,
12
- dismissFadeOut: q
13
- }, z = {
14
- warning: { title: "Advarsel", Icon: O },
15
- error: { title: "Feil", Icon: d },
16
- info: { title: "Informasjon", Icon: d },
17
- success: { title: "Vellykket", Icon: x }
18
- }, G = F(
19
- ({
20
- className: c,
21
- intent: r = "warning",
22
- variant: i = "filled",
23
- testId: m = "rds-alert",
24
- heading: f,
25
- noHeading: A = !1,
26
- children: _,
27
- dismissible: v = !0,
28
- lightBackground: u,
29
- onDismissed: t,
30
- LinkToDetails: C,
31
- ...j
32
- }, p) => {
33
- const [I, l] = o(!1), [g, n] = o(!1), h = ["rds-alert", u ? "rds-light" : "", I ? e.dismissed : "", c].filter(Boolean).join(" ");
34
- if (g)
35
- return null;
36
- const N = () => {
37
- l(!1), n(!1);
38
- }, { title: S, Icon: k } = z[r], w = (B) => {
39
- B.animationName === e.dismissFadeOut && (n(!0), t == null || t(N));
40
- }, y = v && i !== "inline";
41
- return /* @__PURE__ */ a(
42
- "div",
43
- {
44
- role: "alert",
45
- "aria-live": "polite",
46
- ref: p,
47
- className: h,
48
- "data-testid": m,
49
- "data-intent": r,
50
- "data-variant": i,
51
- onAnimationEnd: w,
52
- ...j,
53
- children: [
54
- /* @__PURE__ */ s(k, { className: e.rdsAlertIcon }),
55
- /* @__PURE__ */ a("div", { className: e.rdsAlertContent, children: [
56
- !A && /* @__PURE__ */ s(T, { className: e.rdsAlertContentTitle, as: "span", children: f || S }),
57
- /* @__PURE__ */ s(b, { as: "div", children: _ }),
58
- C
59
- ] }),
60
- y && /* @__PURE__ */ s("div", { className: e.rdsAlertDismiss, children: /* @__PURE__ */ s("button", { "aria-label": "Avvis varsel", onClick: () => l(!0), children: /* @__PURE__ */ s(H, {}) }) })
61
- ]
62
- }
63
- );
64
- }
65
- );
66
- G.displayName = "Alert";
67
- export {
68
- G as A
69
- };