@rikstv/shared-components 3.3.2 → 3.3.3-alpha.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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # 📖 Changelog
2
2
 
3
+ ## 3.3.3
4
+
5
+ - Add possibility to hide alert heading
6
+
3
7
  ## 3.3.0
4
8
 
5
9
  - update `vite` to v6 (uses `sass` modern compiler by default)
@@ -0,0 +1,69 @@
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
+ };
@@ -35,6 +35,10 @@ export interface Props extends HTMLAttributes<HTMLDivElement> {
35
35
  * Optional Heading, defaults are provided per "intent"
36
36
  */
37
37
  heading?: string;
38
+ /**
39
+ * Hide heading
40
+ */
41
+ noHeading?: boolean;
38
42
  /**
39
43
  * Text contents
40
44
  */
@@ -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-BiVxm3um.mjs";
9
+ import { A as z } from "./components/alert/Alert-BnRnv73N.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.2",
3
+ "version": "3.3.3-alpha.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,68 +0,0 @@
1
- import { jsxs as a, jsx as s } from "react/jsx-runtime";
2
- import { forwardRef as B, useState as o } from "react";
3
- import { H as F, B as T } from "../typography/Typography-CXNJ1SFo.mjs";
4
- import "../icons/HeartToggle-Bwgo4FxH.mjs";
5
- import { S as b, a as d, b as x, c as O } from "../icons/Icons-2z4jxD15.mjs";
6
- const H = "_rds-alert--icon_m8jce_67", R = "_rds-alert--content-title_m8jce_79", D = "_rds-alert--content_m8jce_79", E = "_rds-alert--dismiss_m8jce_109", M = "_dismissed_m8jce_138", V = "_dismiss-fade-out_m8jce_1", e = {
7
- rdsAlertIcon: H,
8
- rdsAlertContentTitle: R,
9
- rdsAlertContent: D,
10
- rdsAlertDismiss: E,
11
- dismissed: M,
12
- dismissFadeOut: V
13
- }, q = {
14
- warning: { title: "Advarsel", Icon: x },
15
- error: { title: "Feil", Icon: d },
16
- info: { title: "Informasjon", Icon: d },
17
- success: { title: "Vellykket", Icon: b }
18
- }, z = B(
19
- ({
20
- className: c,
21
- intent: r = "warning",
22
- variant: i = "filled",
23
- testId: m = "rds-alert",
24
- heading: A,
25
- children: f,
26
- dismissible: _ = !0,
27
- lightBackground: v,
28
- onDismissed: t,
29
- LinkToDetails: u,
30
- ...C
31
- }, j) => {
32
- const [p, l] = o(!1), [I, n] = o(!1), g = ["rds-alert", v ? "rds-light" : "", p ? e.dismissed : "", c].filter(Boolean).join(" ");
33
- if (I)
34
- return null;
35
- const h = () => {
36
- l(!1), n(!1);
37
- }, { title: N, Icon: S } = q[r], k = (y) => {
38
- y.animationName === e.dismissFadeOut && (n(!0), t == null || t(h));
39
- }, w = _ && i !== "inline";
40
- return /* @__PURE__ */ a(
41
- "div",
42
- {
43
- role: "alert",
44
- "aria-live": "polite",
45
- ref: j,
46
- className: g,
47
- "data-testid": m,
48
- "data-intent": r,
49
- "data-variant": i,
50
- onAnimationEnd: k,
51
- ...C,
52
- children: [
53
- /* @__PURE__ */ s(S, { className: e.rdsAlertIcon }),
54
- /* @__PURE__ */ a("div", { className: e.rdsAlertContent, children: [
55
- /* @__PURE__ */ s(F, { className: e.rdsAlertContentTitle, as: "span", children: A || N }),
56
- /* @__PURE__ */ s(T, { as: "div", children: f }),
57
- u
58
- ] }),
59
- w && /* @__PURE__ */ s("div", { className: e.rdsAlertDismiss, children: /* @__PURE__ */ s("button", { "aria-label": "Avvis varsel", onClick: () => l(!0), children: /* @__PURE__ */ s(O, {}) }) })
60
- ]
61
- }
62
- );
63
- }
64
- );
65
- z.displayName = "Alert";
66
- export {
67
- z as A
68
- };