@altinn/altinn-components 0.29.4 → 0.30.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/dist/assets/Banner.css +1 -0
- package/dist/components/Banner/Banner.js +64 -0
- package/dist/components/Banner/index.js +5 -0
- package/dist/components/Menu/MenuOption.js +12 -22
- package/dist/types/lib/components/Banner/Banner.d.ts +16 -0
- package/dist/types/lib/components/Banner/Banner.stories.d.ts +18 -0
- package/dist/types/lib/components/Banner/index.d.ts +1 -0
- package/dist/types/lib/components/Layout/Layout.stories.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._banner_1of7r_1{background-color:var(--ds-color-base-default);color:var(--ds-color-base-contrast-default);margin-top:0;padding:.5rem;display:flex;justify-content:space-between;align-items:center;column-gap:.5rem}._sticky_1of7r_12{position:sticky;top:0;z-index:1000}._title_1of7r_18{margin:0;padding:1rem;font-size:1rem;font-weight:500;line-height:1.5rem}._infoIcon_1of7r_25{min-height:1.5rem;max-height:1.5rem;min-width:1.5rem;max-width:1.5rem;margin-right:.5rem;vertical-align:bottom}._closeIcon_1of7r_34{min-height:1.5rem;max-height:1.5rem;min-width:1.5rem;max-width:1.5rem;color:var(--ds-color-warning-text-default);font-size:1.5rem}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as s, jsx as l } from "react/jsx-runtime";
|
|
3
|
+
import { c as f } from "../../index-L8X2o7IH.js";
|
|
4
|
+
import * as c from "react";
|
|
5
|
+
import { forwardRef as d } from "react";
|
|
6
|
+
import "../RootProvider/RootProvider.js";
|
|
7
|
+
import "../Searchbar/AutocompleteBase.js";
|
|
8
|
+
import "../Snackbar/useSnackbar.js";
|
|
9
|
+
import { IconButton as m } from "../Button/IconButton.js";
|
|
10
|
+
import { u as p } from "../../useId-BVFxCjkq.js";
|
|
11
|
+
import { S as u } from "../../XMark-DIqxCTTQ.js";
|
|
12
|
+
import '../../assets/Banner.css';var v = function(e, o) {
|
|
13
|
+
var n = {};
|
|
14
|
+
for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && o.indexOf(t) < 0 && (n[t] = e[t]);
|
|
15
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
16
|
+
for (var r = 0, t = Object.getOwnPropertySymbols(e); r < t.length; r++)
|
|
17
|
+
o.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[r]) && (n[t[r]] = e[t[r]]);
|
|
18
|
+
return n;
|
|
19
|
+
};
|
|
20
|
+
const h = d((e, o) => {
|
|
21
|
+
var { title: n, titleId: t } = e, r = v(e, ["title", "titleId"]);
|
|
22
|
+
let a = p();
|
|
23
|
+
return a = n ? t || "title-" + a : void 0, c.createElement(
|
|
24
|
+
"svg",
|
|
25
|
+
Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24", focusable: !1, role: "img", ref: o, "aria-labelledby": a }, r),
|
|
26
|
+
n ? c.createElement("title", { id: a }, n) : null,
|
|
27
|
+
c.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M4 3.25a.75.75 0 0 0-.75.75v16c0 .414.336.75.75.75h16a.75.75 0 0 0 .75-.75V4a.75.75 0 0 0-.75-.75zm.75 16V4.75h14.5v14.5zM11 7.75a1 1 0 1 1 2 0 1 1 0 0 1-2 0M10.5 10a.75.75 0 0 0 0 1.5h.75v4h-.75a.75.75 0 0 0 0 1.5h3a.75.75 0 0 0 0-1.5h-.75v-4.75A.75.75 0 0 0 12 10z", clipRule: "evenodd" })
|
|
28
|
+
);
|
|
29
|
+
}), _ = "_banner_1of7r_1", b = "_sticky_1of7r_12", g = "_title_1of7r_18", y = "_infoIcon_1of7r_25", i = {
|
|
30
|
+
banner: _,
|
|
31
|
+
sticky: b,
|
|
32
|
+
title: g,
|
|
33
|
+
infoIcon: y
|
|
34
|
+
};
|
|
35
|
+
var w = /* @__PURE__ */ ((e) => (e.accent = "accent", e.success = "success", e.warning = "warning", e.danger = "danger", e.info = "info", e))(w || {});
|
|
36
|
+
const z = ({ closeTitle: e = "close", onClose: o, text: n, color: t, sticky: r = !0 }) => /* @__PURE__ */ s(
|
|
37
|
+
"section",
|
|
38
|
+
{
|
|
39
|
+
className: f(i.banner, { [i.sticky]: r }),
|
|
40
|
+
role: "status",
|
|
41
|
+
"aria-live": "polite",
|
|
42
|
+
"data-color": t,
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ s("div", { className: i.title, children: [
|
|
45
|
+
/* @__PURE__ */ l(h, { className: i.infoIcon, "aria-hidden": !0 }),
|
|
46
|
+
/* @__PURE__ */ l("span", { children: n })
|
|
47
|
+
] }),
|
|
48
|
+
/* @__PURE__ */ l(
|
|
49
|
+
m,
|
|
50
|
+
{
|
|
51
|
+
icon: u,
|
|
52
|
+
variant: "solid",
|
|
53
|
+
onClick: o,
|
|
54
|
+
className: i.dismiss,
|
|
55
|
+
iconAltText: e
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
export {
|
|
62
|
+
z as Banner,
|
|
63
|
+
w as BannerColorEnum
|
|
64
|
+
};
|
|
@@ -1,39 +1,29 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as u, jsx as m } from "react/jsx-runtime";
|
|
2
2
|
import "../../index-L8X2o7IH.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "../RootProvider/RootProvider.js";
|
|
5
|
-
import { MenuItemBase as
|
|
5
|
+
import { MenuItemBase as x } from "./MenuItemBase.js";
|
|
6
6
|
import { MenuItemLabel as I } from "./MenuItemLabel.js";
|
|
7
7
|
import "../Searchbar/AutocompleteBase.js";
|
|
8
8
|
import "../Snackbar/useSnackbar.js";
|
|
9
9
|
import { Label as M } from "../Forms/Label.js";
|
|
10
10
|
import { Input as b } from "../Forms/Input.js";
|
|
11
11
|
const y = ({
|
|
12
|
-
size:
|
|
13
|
-
type:
|
|
12
|
+
size: t = "md",
|
|
13
|
+
type: o,
|
|
14
14
|
name: e,
|
|
15
15
|
value: i,
|
|
16
16
|
label: p,
|
|
17
|
-
title:
|
|
17
|
+
title: d,
|
|
18
18
|
description: s,
|
|
19
|
-
badge:
|
|
20
|
-
checked:
|
|
19
|
+
badge: n,
|
|
20
|
+
checked: r = !1,
|
|
21
21
|
disabled: l,
|
|
22
|
-
onChange:
|
|
23
|
-
...
|
|
24
|
-
}) => /* @__PURE__ */ x
|
|
25
|
-
/* @__PURE__ */ o
|
|
26
|
-
|
|
27
|
-
{
|
|
28
|
-
size: "xs",
|
|
29
|
-
name: e,
|
|
30
|
-
value: i,
|
|
31
|
-
type: t,
|
|
32
|
-
checked: m,
|
|
33
|
-
onChange: a
|
|
34
|
-
}
|
|
35
|
-
),
|
|
36
|
-
/* @__PURE__ */ o(I, { title: n, description: s, size: r, badge: f, children: p })
|
|
22
|
+
onChange: f,
|
|
23
|
+
...a
|
|
24
|
+
}) => /* @__PURE__ */ u(x, { disabled: l, selected: r, size: t, as: M, ...a, children: [
|
|
25
|
+
/* @__PURE__ */ m(b, { size: "xs", name: e, value: i, type: o, checked: r, onChange: f }),
|
|
26
|
+
/* @__PURE__ */ m(I, { title: p, description: s, size: t, badge: n })
|
|
37
27
|
] });
|
|
38
28
|
export {
|
|
39
29
|
y as MenuOption
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare enum BannerColorEnum {
|
|
2
|
+
accent = "accent",
|
|
3
|
+
success = "success",
|
|
4
|
+
warning = "warning",
|
|
5
|
+
danger = "danger",
|
|
6
|
+
info = "info"
|
|
7
|
+
}
|
|
8
|
+
export type BannerColor = keyof typeof BannerColorEnum;
|
|
9
|
+
export interface BannerProps {
|
|
10
|
+
onClose?: () => void;
|
|
11
|
+
closeTitle?: string;
|
|
12
|
+
text?: string | React.ReactNode;
|
|
13
|
+
color?: BannerColor;
|
|
14
|
+
sticky?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const Banner: ({ closeTitle, onClose, text, color, sticky }: BannerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { BannerProps } from './Banner';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: ({ closeTitle, onClose, text, color, sticky }: BannerProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
tags: string[];
|
|
7
|
+
parameters: {};
|
|
8
|
+
args: {
|
|
9
|
+
sticky: true;
|
|
10
|
+
closeTitle: string;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
text: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
export declare const Default: Story;
|
|
18
|
+
export declare const Colors: (args: BannerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Banner.tsx';
|
|
@@ -19,3 +19,4 @@ export default meta;
|
|
|
19
19
|
export declare const Preview: (args: LayoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
export declare const HiddenSidebar: (args: LayoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
21
|
export declare const Fullscreen: (args: LayoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const WithBanner: (args: LayoutProps) => import("react/jsx-runtime").JSX.Element;
|