@midas-ds/layout 0.0.43 → 0.0.44
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 +6 -0
- package/chunks/Header-B9ggmyIG.js +107 -0
- package/header/index.js +1 -1
- package/header/mobile-menu/MobileMenu.d.ts +5 -3
- package/header/mobile-menu/MobileMenu.stories.d.ts +14 -0
- package/header/mobile-menu/intl/translations.json.d.ts +11 -0
- package/index.js +1 -1
- package/package.json +1 -1
- package/chunks/Header-B1Nk3vII.js +0 -89
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as e, jsxs as l, Fragment as M } from "react/jsx-runtime";
|
|
3
|
+
import { c } from "./clsx-OuTLNxxd.js";
|
|
4
|
+
import { forwardRef as b } from "react";
|
|
5
|
+
import { composeRenderProps as d, ModalOverlay as f, Modal as y, Dialog as g } from "react-aria-components";
|
|
6
|
+
import { Button as m, useLocalizedStringFormatter as x, DialogTrigger as w, Text as N, clsx as k, LogoContext as A } from "@midas-ds/components";
|
|
7
|
+
import { u as h } from "./useIsMobileDevice-D0iMVFPx.js";
|
|
8
|
+
import { M as H } from "./MobileMenuContext-Coj0sJ0N.js";
|
|
9
|
+
import { c as D } from "./createLucideIcon-CP-mMPfa.js";
|
|
10
|
+
import '../assets/Header.css';const $ = "_headerActions_1rka5_1", j = {
|
|
11
|
+
headerActions: $
|
|
12
|
+
}, Z = ({ className: a, ...o }) => /* @__PURE__ */ e(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
className: c(a, j.headerActions),
|
|
16
|
+
...o
|
|
17
|
+
}
|
|
18
|
+
), P = "_label_1191f_1", z = {
|
|
19
|
+
label: P
|
|
20
|
+
}, L = b(
|
|
21
|
+
({ children: a, icon: o, ...r }, t) => (!a && !r["aria-label"] && process.env.NODE_ENV !== "production" && console.warn(
|
|
22
|
+
"Please provide an 'aria-label' for HeaderAction components that doesnt have a visible label (children)"
|
|
23
|
+
), /* @__PURE__ */ e(
|
|
24
|
+
m,
|
|
25
|
+
{
|
|
26
|
+
ref: t,
|
|
27
|
+
size: "medium",
|
|
28
|
+
variant: "tertiary",
|
|
29
|
+
...r,
|
|
30
|
+
children: d(a, (s) => /* @__PURE__ */ l(M, { children: [
|
|
31
|
+
o,
|
|
32
|
+
typeof s < "u" && /* @__PURE__ */ e("span", { className: z.label, children: s })
|
|
33
|
+
] }))
|
|
34
|
+
}
|
|
35
|
+
))
|
|
36
|
+
);
|
|
37
|
+
L.displayName = "HeaderAction";
|
|
38
|
+
const O = [
|
|
39
|
+
["path", { d: "M4 5h16", key: "1tepv9" }],
|
|
40
|
+
["path", { d: "M4 12h16", key: "1lakjw" }],
|
|
41
|
+
["path", { d: "M4 19h16", key: "1djgab" }]
|
|
42
|
+
], C = D("menu", O), E = { openMenu: "Open menu" }, F = { openMenu: "Öppna meny" }, I = {
|
|
43
|
+
en: E,
|
|
44
|
+
sv: F
|
|
45
|
+
}, R = "_overlay_1xtkw_1", T = "_drawer_1xtkw_19", B = "_dialog_1xtkw_44", S = "_header_1xtkw_50", n = {
|
|
46
|
+
overlay: R,
|
|
47
|
+
drawer: T,
|
|
48
|
+
dialog: B,
|
|
49
|
+
header: S
|
|
50
|
+
}, ee = ({
|
|
51
|
+
children: a,
|
|
52
|
+
className: o,
|
|
53
|
+
defaultOpen: r,
|
|
54
|
+
isOpen: t,
|
|
55
|
+
onOpenChange: s,
|
|
56
|
+
title: i,
|
|
57
|
+
...p
|
|
58
|
+
}) => {
|
|
59
|
+
const _ = h(), u = x(I);
|
|
60
|
+
return _ ? /* @__PURE__ */ e(H.Provider, { value: {}, children: /* @__PURE__ */ l(
|
|
61
|
+
w,
|
|
62
|
+
{
|
|
63
|
+
isOpen: t,
|
|
64
|
+
onOpenChange: s,
|
|
65
|
+
defaultOpen: r,
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ e(
|
|
68
|
+
m,
|
|
69
|
+
{
|
|
70
|
+
"aria-label": u.format("openMenu"),
|
|
71
|
+
icon: C,
|
|
72
|
+
variant: "icon"
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ e(
|
|
76
|
+
f,
|
|
77
|
+
{
|
|
78
|
+
className: k(o, n.overlay),
|
|
79
|
+
isDismissable: !0,
|
|
80
|
+
...p,
|
|
81
|
+
children: d(a, (v) => /* @__PURE__ */ e(y, { className: n.drawer, children: /* @__PURE__ */ l(g, { className: n.dialog, children: [
|
|
82
|
+
i && /* @__PURE__ */ e(N, { className: n.header, children: i }),
|
|
83
|
+
v
|
|
84
|
+
] }) }))
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
) }) : null;
|
|
90
|
+
}, V = "_header_105ne_1", q = {
|
|
91
|
+
header: V
|
|
92
|
+
}, ae = ({ className: a, ...o }) => {
|
|
93
|
+
const r = h();
|
|
94
|
+
return /* @__PURE__ */ e(A.Provider, { value: { size: r ? "x-small" : "large" }, children: /* @__PURE__ */ e(
|
|
95
|
+
"header",
|
|
96
|
+
{
|
|
97
|
+
className: c(a, q.header),
|
|
98
|
+
...o
|
|
99
|
+
}
|
|
100
|
+
) });
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
ae as H,
|
|
104
|
+
ee as M,
|
|
105
|
+
L as a,
|
|
106
|
+
Z as b
|
|
107
|
+
};
|
package/header/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { ModalOverlayProps } from 'react-aria-components';
|
|
2
|
-
|
|
1
|
+
import { DialogTriggerProps, ModalOverlayProps } from 'react-aria-components';
|
|
2
|
+
type StateValues = 'isOpen' | 'defaultOpen' | 'onOpenChange';
|
|
3
|
+
export interface MobileMenuProps extends Omit<ModalOverlayProps, StateValues>, Pick<DialogTriggerProps, StateValues> {
|
|
3
4
|
/**
|
|
4
5
|
* A visible title for the menu
|
|
5
6
|
*/
|
|
6
7
|
title?: string;
|
|
7
8
|
}
|
|
8
|
-
export declare const MobileMenu: ({ children, className, title, ...rest }: MobileMenuProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export declare const MobileMenu: ({ children, className, defaultOpen, isOpen, onOpenChange, title, ...rest }: MobileMenuProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { MobileMenu } from '.';
|
|
3
|
+
type Story = StoryObj<typeof MobileMenu>;
|
|
4
|
+
declare const _default: {
|
|
5
|
+
component: ({ children, className, defaultOpen, isOpen, onOpenChange, title, ...rest }: import('./MobileMenu').MobileMenuProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
title: string;
|
|
7
|
+
tags: string[];
|
|
8
|
+
args: {
|
|
9
|
+
children: import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
13
|
+
export declare const Primary: Story;
|
|
14
|
+
export declare const Controlled: Story;
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as o, a as t, b as r, M as n } from "./chunks/Header-
|
|
1
|
+
import { H as o, a as t, b as r, M as n } from "./chunks/Header-B9ggmyIG.js";
|
|
2
2
|
import { L as i, a as x } from "./chunks/LayoutContent-CvlzZxeo.js";
|
|
3
3
|
import { M as m } from "./chunks/Main-Dt0CIYBE.js";
|
|
4
4
|
import { N as b, a as d, b as f, c as p, d as M, e as N } from "./chunks/NavigationSubMenu-D3hvuVFG.js";
|
package/package.json
CHANGED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as e, jsxs as n, Fragment as _ } from "react/jsx-runtime";
|
|
3
|
-
import { c as i } from "./clsx-OuTLNxxd.js";
|
|
4
|
-
import { forwardRef as p } from "react";
|
|
5
|
-
import { composeRenderProps as c, ModalOverlay as u, Modal as v, Dialog as b } from "react-aria-components";
|
|
6
|
-
import { Button as d, DialogTrigger as M, Text as f, clsx as y, LogoContext as x } from "@midas-ds/components";
|
|
7
|
-
import { u as m } from "./useIsMobileDevice-D0iMVFPx.js";
|
|
8
|
-
import { M as g } from "./MobileMenuContext-Coj0sJ0N.js";
|
|
9
|
-
import { c as w } from "./createLucideIcon-CP-mMPfa.js";
|
|
10
|
-
import '../assets/Header.css';const N = "_headerActions_1rka5_1", k = {
|
|
11
|
-
headerActions: N
|
|
12
|
-
}, J = ({ className: a, ...o }) => /* @__PURE__ */ e(
|
|
13
|
-
"div",
|
|
14
|
-
{
|
|
15
|
-
className: i(a, k.headerActions),
|
|
16
|
-
...o
|
|
17
|
-
}
|
|
18
|
-
), A = "_label_1191f_1", H = {
|
|
19
|
-
label: A
|
|
20
|
-
}, D = p(
|
|
21
|
-
({ children: a, icon: o, ...r }, t) => (!a && !r["aria-label"] && process.env.NODE_ENV !== "production" && console.warn(
|
|
22
|
-
"Please provide an 'aria-label' for HeaderAction components that doesnt have a visible label (children)"
|
|
23
|
-
), /* @__PURE__ */ e(
|
|
24
|
-
d,
|
|
25
|
-
{
|
|
26
|
-
ref: t,
|
|
27
|
-
size: "medium",
|
|
28
|
-
variant: "tertiary",
|
|
29
|
-
...r,
|
|
30
|
-
children: c(a, (l) => /* @__PURE__ */ n(_, { children: [
|
|
31
|
-
o,
|
|
32
|
-
typeof l < "u" && /* @__PURE__ */ e("span", { className: H.label, children: l })
|
|
33
|
-
] }))
|
|
34
|
-
}
|
|
35
|
-
))
|
|
36
|
-
);
|
|
37
|
-
D.displayName = "HeaderAction";
|
|
38
|
-
const $ = [
|
|
39
|
-
["path", { d: "M4 5h16", key: "1tepv9" }],
|
|
40
|
-
["path", { d: "M4 12h16", key: "1lakjw" }],
|
|
41
|
-
["path", { d: "M4 19h16", key: "1djgab" }]
|
|
42
|
-
], j = w("menu", $), P = "_overlay_1xtkw_1", z = "_drawer_1xtkw_19", C = "_dialog_1xtkw_44", E = "_header_1xtkw_50", s = {
|
|
43
|
-
overlay: P,
|
|
44
|
-
drawer: z,
|
|
45
|
-
dialog: C,
|
|
46
|
-
header: E
|
|
47
|
-
}, K = ({
|
|
48
|
-
children: a,
|
|
49
|
-
className: o,
|
|
50
|
-
title: r,
|
|
51
|
-
...t
|
|
52
|
-
}) => m() ? /* @__PURE__ */ e(g.Provider, { value: {}, children: /* @__PURE__ */ n(M, { children: [
|
|
53
|
-
/* @__PURE__ */ e(
|
|
54
|
-
d,
|
|
55
|
-
{
|
|
56
|
-
icon: j,
|
|
57
|
-
variant: "icon"
|
|
58
|
-
}
|
|
59
|
-
),
|
|
60
|
-
/* @__PURE__ */ e(
|
|
61
|
-
u,
|
|
62
|
-
{
|
|
63
|
-
className: y(o, s.overlay),
|
|
64
|
-
isDismissable: !0,
|
|
65
|
-
...t,
|
|
66
|
-
children: c(a, (h) => /* @__PURE__ */ e(v, { className: s.drawer, children: /* @__PURE__ */ n(b, { className: s.dialog, children: [
|
|
67
|
-
r && /* @__PURE__ */ e(f, { className: s.header, children: r }),
|
|
68
|
-
h
|
|
69
|
-
] }) }))
|
|
70
|
-
}
|
|
71
|
-
)
|
|
72
|
-
] }) }) : null, I = "_header_105ne_1", L = {
|
|
73
|
-
header: I
|
|
74
|
-
}, Q = ({ className: a, ...o }) => {
|
|
75
|
-
const r = m();
|
|
76
|
-
return /* @__PURE__ */ e(x.Provider, { value: { size: r ? "x-small" : "large" }, children: /* @__PURE__ */ e(
|
|
77
|
-
"header",
|
|
78
|
-
{
|
|
79
|
-
className: i(a, L.header),
|
|
80
|
-
...o
|
|
81
|
-
}
|
|
82
|
-
) });
|
|
83
|
-
};
|
|
84
|
-
export {
|
|
85
|
-
Q as H,
|
|
86
|
-
K as M,
|
|
87
|
-
D as a,
|
|
88
|
-
J as b
|
|
89
|
-
};
|