@midas-ds/layout 0.0.1-beta.1 → 0.0.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/CHANGELOG.md +34 -2
- package/README.md +7 -0
- package/assets/Layout.css +1 -0
- package/assets/Main.css +1 -0
- package/assets/MobileMenu.css +1 -0
- package/assets/Navbar.css +1 -0
- package/assets/Navigation.css +1 -0
- package/assets/Panel.css +1 -0
- package/assets/PanelContext.css +1 -0
- package/assets/useIsMobileDevice.css +1 -0
- package/chunks/Layout-16EqvEZN.js +23 -0
- package/chunks/Main-QnNDtP6N.js +13 -0
- package/chunks/MobileMenu-DcQpdykm.js +86 -0
- package/chunks/MobileMenuContext-Coj0sJ0N.js +6 -0
- package/chunks/Navbar-wOOCcsru.js +13 -0
- package/chunks/Navigation-Cq0h2Nt9.js +212 -0
- package/chunks/Panel-C1MEWSWX.js +147 -0
- package/chunks/PanelContext-D2ADxgo6.js +44 -0
- package/chunks/clsx-AexbMWKp.js +24 -0
- package/chunks/useIsMobileDevice-DhQB0ae2.js +213 -0
- package/header/Header.d.ts +3 -0
- package/header/header-actions/HeaderActions.d.ts +10 -0
- package/header/header-actions/HeaderActions.stories.d.ts +24 -0
- package/header/header-actions/index.d.ts +1 -0
- package/header/index.d.ts +3 -0
- package/header/index.js +8 -0
- package/header/mobile-menu/MobileMenu.d.ts +8 -0
- package/header/mobile-menu/MobileMenuContext.d.ts +1 -0
- package/header/mobile-menu/index.d.ts +2 -0
- package/index.d.ts +6 -1
- package/index.js +27 -77
- package/layout/Layout.d.ts +7 -0
- package/layout/Layout.stories.d.ts +17 -0
- package/layout/index.d.ts +1 -0
- package/layout/index.js +5 -0
- package/main/Main.d.ts +3 -0
- package/main/index.d.ts +1 -0
- package/main/index.js +4 -0
- package/navbar/Navbar.d.ts +3 -0
- package/navbar/index.d.ts +1 -0
- package/navbar/index.js +4 -0
- package/navigation/Navigation.d.ts +9 -0
- package/navigation/Navigation.stories.d.ts +13 -0
- package/navigation/components/header/NavigationHeader.d.ts +3 -0
- package/navigation/components/header/index.d.ts +1 -0
- package/navigation/components/index.d.ts +5 -0
- package/navigation/components/item/NavigationItem.d.ts +3 -0
- package/navigation/components/item/index.d.ts +1 -0
- package/navigation/components/link/NavigationLink.d.ts +13 -0
- package/navigation/components/link/NavigationLink.stories.d.ts +21 -0
- package/navigation/components/link/index.d.ts +1 -0
- package/navigation/components/section/NavigationSection.d.ts +6 -0
- package/navigation/components/section/index.d.ts +1 -0
- package/navigation/components/sub-menu/NavigationSubMenu.d.ts +4 -0
- package/navigation/components/sub-menu/index.d.ts +1 -0
- package/navigation/index.d.ts +2 -0
- package/navigation/index.js +9 -0
- package/package.json +33 -12
- package/panel/Panel.d.ts +7 -0
- package/panel/Panel.stories.d.ts +16 -0
- package/panel/PanelContext.d.ts +5 -0
- package/panel/components/collapse-panel/CollapsePanel.d.ts +7 -0
- package/panel/components/collapse-panel/index.d.ts +1 -0
- package/panel/components/dismiss-panel/DismissPanel.d.ts +7 -0
- package/panel/components/dismiss-panel/index.d.ts +1 -0
- package/panel/components/index.d.ts +5 -0
- package/panel/components/panel-body/PanelBody.d.ts +3 -0
- package/panel/components/panel-body/index.d.ts +1 -0
- package/panel/components/panel-header/PanelHeader.d.ts +3 -0
- package/panel/components/panel-header/index.d.ts +1 -0
- package/panel/components/panel-title/PanelTitle.d.ts +5 -0
- package/panel/components/panel-title/index.d.ts +1 -0
- package/panel/index.d.ts +2 -0
- package/panel/index.js +7 -0
- package/panel/intl/translations.json.d.ts +15 -0
- package/utils/useIsMobileDevice.d.ts +1 -0
- package/index.css +0 -1
- package/index.mjs +0 -6621
- package/lib/Layout.d.ts +0 -51
- package/lib/Layout.stories.d.ts +0 -7
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs as x, jsx as l, Fragment as v } from "react/jsx-runtime";
|
|
3
|
+
import { useLocale as B, useContextProps as k, ButtonContext as q, Button as A } from "react-aria-components";
|
|
4
|
+
import { c as h } from "./clsx-AexbMWKp.js";
|
|
5
|
+
import { forwardRef as w, createElement as g, useMemo as M, useState as z, useEffect as N } from "react";
|
|
6
|
+
import { VisuallyHidden as P } from "react-aria";
|
|
7
|
+
import { LocalizedStringFormatter as R, LocalizedStringDictionary as $ } from "@internationalized/string";
|
|
8
|
+
import { useIsSSR as W } from "@react-aria/ssr";
|
|
9
|
+
import "@react-aria/utils";
|
|
10
|
+
import '../assets/useIsMobileDevice.css';const D = "_button_7n7qm_1", j = "_secondary_7n7qm_48", E = "_tertiary_7n7qm_71", F = "_iconBtn_7n7qm_91", I = "_medium_7n7qm_111", U = "_danger_7n7qm_116", G = "_iconRight_7n7qm_138", Z = "_fullwidth_7n7qm_142", H = "_primary_7n7qm_152", a = {
|
|
11
|
+
button: D,
|
|
12
|
+
secondary: j,
|
|
13
|
+
tertiary: E,
|
|
14
|
+
iconBtn: F,
|
|
15
|
+
medium: I,
|
|
16
|
+
danger: U,
|
|
17
|
+
iconRight: G,
|
|
18
|
+
fullwidth: Z,
|
|
19
|
+
primary: H
|
|
20
|
+
}, K = "_container_1qexx_1", O = "_spinner_1qexx_5", T = "_large_1qexx_18", f = {
|
|
21
|
+
container: K,
|
|
22
|
+
spinner: O,
|
|
23
|
+
large: T
|
|
24
|
+
};
|
|
25
|
+
const L = (...e) => e.filter((t, n, r) => !!t && t.trim() !== "" && r.indexOf(t) === n).join(" ").trim();
|
|
26
|
+
const V = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
27
|
+
const J = (e) => e.replace(
|
|
28
|
+
/^([A-Z])|[\s-_]+(\w)/g,
|
|
29
|
+
(t, n, r) => r ? r.toUpperCase() : n.toLowerCase()
|
|
30
|
+
);
|
|
31
|
+
const y = (e) => {
|
|
32
|
+
const t = J(e);
|
|
33
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
34
|
+
};
|
|
35
|
+
var Q = {
|
|
36
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
37
|
+
width: 24,
|
|
38
|
+
height: 24,
|
|
39
|
+
viewBox: "0 0 24 24",
|
|
40
|
+
fill: "none",
|
|
41
|
+
stroke: "currentColor",
|
|
42
|
+
strokeWidth: 2,
|
|
43
|
+
strokeLinecap: "round",
|
|
44
|
+
strokeLinejoin: "round"
|
|
45
|
+
};
|
|
46
|
+
const X = (e) => {
|
|
47
|
+
for (const t in e)
|
|
48
|
+
if (t.startsWith("aria-") || t === "role" || t === "title")
|
|
49
|
+
return !0;
|
|
50
|
+
return !1;
|
|
51
|
+
};
|
|
52
|
+
const Y = w(
|
|
53
|
+
({
|
|
54
|
+
color: e = "currentColor",
|
|
55
|
+
size: t = 24,
|
|
56
|
+
strokeWidth: n = 2,
|
|
57
|
+
absoluteStrokeWidth: r,
|
|
58
|
+
className: s = "",
|
|
59
|
+
children: o,
|
|
60
|
+
iconNode: c,
|
|
61
|
+
...i
|
|
62
|
+
}, u) => g(
|
|
63
|
+
"svg",
|
|
64
|
+
{
|
|
65
|
+
ref: u,
|
|
66
|
+
...Q,
|
|
67
|
+
width: t,
|
|
68
|
+
height: t,
|
|
69
|
+
stroke: e,
|
|
70
|
+
strokeWidth: r ? Number(n) * 24 / Number(t) : n,
|
|
71
|
+
className: L("lucide", s),
|
|
72
|
+
...!o && !X(i) && { "aria-hidden": "true" },
|
|
73
|
+
...i
|
|
74
|
+
},
|
|
75
|
+
[
|
|
76
|
+
...c.map(([p, m]) => g(p, m)),
|
|
77
|
+
...Array.isArray(o) ? o : [o]
|
|
78
|
+
]
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
const ee = (e, t) => {
|
|
82
|
+
const n = w(
|
|
83
|
+
({ className: r, ...s }, o) => g(Y, {
|
|
84
|
+
ref: o,
|
|
85
|
+
iconNode: t,
|
|
86
|
+
className: L(
|
|
87
|
+
`lucide-${V(y(e))}`,
|
|
88
|
+
`lucide-${e}`,
|
|
89
|
+
r
|
|
90
|
+
),
|
|
91
|
+
...s
|
|
92
|
+
})
|
|
93
|
+
);
|
|
94
|
+
return n.displayName = y(e), n;
|
|
95
|
+
};
|
|
96
|
+
const te = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]], ne = ee("loader-circle", te), _ = "sv", C = /* @__PURE__ */ new WeakMap();
|
|
97
|
+
function re(e) {
|
|
98
|
+
let t = C.get(e);
|
|
99
|
+
return t || (t = new $(e, _), C.set(e, t)), t;
|
|
100
|
+
}
|
|
101
|
+
function oe(e, t) {
|
|
102
|
+
return re(e);
|
|
103
|
+
}
|
|
104
|
+
function ae(e, t) {
|
|
105
|
+
if (!e || typeof e != "object" || !(_ in e))
|
|
106
|
+
throw new Error(
|
|
107
|
+
`useLocalizedStringFormatter: Default language "${_}" must be defined in dictionary.`
|
|
108
|
+
);
|
|
109
|
+
const { locale: n } = B(), r = oe(e);
|
|
110
|
+
return M(
|
|
111
|
+
() => new R(n, r),
|
|
112
|
+
[r, n]
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
const ie = { loadingPleaseWait: "Loading, please wait..." }, se = { loadingPleaseWait: "Laddar, vänligen vänta..." }, ce = {
|
|
116
|
+
en: ie,
|
|
117
|
+
sv: se
|
|
118
|
+
}, de = ({
|
|
119
|
+
small: e,
|
|
120
|
+
color: t,
|
|
121
|
+
className: n
|
|
122
|
+
}) => {
|
|
123
|
+
const r = ae(ce);
|
|
124
|
+
return /* @__PURE__ */ x(
|
|
125
|
+
"div",
|
|
126
|
+
{
|
|
127
|
+
className: h(f.container, n),
|
|
128
|
+
role: "status",
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ l(
|
|
131
|
+
ne,
|
|
132
|
+
{
|
|
133
|
+
className: h(f.spinner, !e && f.large),
|
|
134
|
+
size: e ? 20 : 96,
|
|
135
|
+
strokeWidth: e ? 2 : 8,
|
|
136
|
+
absoluteStrokeWidth: !0,
|
|
137
|
+
color: t
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
/* @__PURE__ */ l(P, { children: r.format("loadingPleaseWait") })
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
}, ye = w(
|
|
145
|
+
(e, t) => {
|
|
146
|
+
const [n, r] = k(e, t, q), {
|
|
147
|
+
children: s,
|
|
148
|
+
className: o,
|
|
149
|
+
fullwidth: c,
|
|
150
|
+
icon: i,
|
|
151
|
+
iconPlacement: u,
|
|
152
|
+
iconSize: p,
|
|
153
|
+
isPending: m,
|
|
154
|
+
size: S = "large",
|
|
155
|
+
variant: d = "primary",
|
|
156
|
+
...b
|
|
157
|
+
} = n;
|
|
158
|
+
return /* @__PURE__ */ l(
|
|
159
|
+
A,
|
|
160
|
+
{
|
|
161
|
+
className: h(
|
|
162
|
+
a.button,
|
|
163
|
+
d === "primary" && a.primary,
|
|
164
|
+
d === "secondary" && a.secondary,
|
|
165
|
+
d === "tertiary" && a.tertiary,
|
|
166
|
+
d === "danger" && a.danger,
|
|
167
|
+
d === "icon" && a.iconBtn,
|
|
168
|
+
c && a.fullwidth,
|
|
169
|
+
S === "medium" && a.medium,
|
|
170
|
+
u === "right" && a.iconRight,
|
|
171
|
+
o
|
|
172
|
+
),
|
|
173
|
+
ref: r,
|
|
174
|
+
...b,
|
|
175
|
+
children: /* @__PURE__ */ x(v, { children: [
|
|
176
|
+
i && !m && /* @__PURE__ */ l(
|
|
177
|
+
i,
|
|
178
|
+
{
|
|
179
|
+
"aria-hidden": !0,
|
|
180
|
+
size: p ?? 20
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
m && /* @__PURE__ */ l(de, { small: !0 }),
|
|
184
|
+
s
|
|
185
|
+
] })
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
function le(e) {
|
|
191
|
+
let t = typeof window < "u" && typeof window.matchMedia == "function", [n, r] = z(() => t ? window.matchMedia(e).matches : !1);
|
|
192
|
+
return N(() => {
|
|
193
|
+
if (!t) return;
|
|
194
|
+
let o = window.matchMedia(e), c = (i) => {
|
|
195
|
+
r(i.matches);
|
|
196
|
+
};
|
|
197
|
+
return o.addListener(c), () => {
|
|
198
|
+
o.removeListener(c);
|
|
199
|
+
};
|
|
200
|
+
}, [
|
|
201
|
+
t,
|
|
202
|
+
e
|
|
203
|
+
]), W() ? !1 : n;
|
|
204
|
+
}
|
|
205
|
+
function Ce() {
|
|
206
|
+
return le("(max-width: 640px)");
|
|
207
|
+
}
|
|
208
|
+
export {
|
|
209
|
+
ye as B,
|
|
210
|
+
ae as a,
|
|
211
|
+
ee as c,
|
|
212
|
+
Ce as u
|
|
213
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { MidasButton } from '../../../../components/src/index.ts';
|
|
3
|
+
export declare const HeaderActions: (({ children }: {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element) & {
|
|
6
|
+
Button: import('react').ForwardRefExoticComponent<Omit<MidasButton, "children" | "icon"> & {
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { HeaderActions } from '.';
|
|
3
|
+
type Story = StoryObj<typeof HeaderActions>;
|
|
4
|
+
declare const _default: {
|
|
5
|
+
component: (({ children }: {
|
|
6
|
+
children: import('react').ReactNode;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element) & {
|
|
8
|
+
Button: import('react').ForwardRefExoticComponent<Omit<import('../../../../components/src/index.ts').MidasButton, "children" | "icon"> & {
|
|
9
|
+
icon?: import('react').ReactNode;
|
|
10
|
+
children?: import('react').ReactNode;
|
|
11
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
};
|
|
13
|
+
title: string;
|
|
14
|
+
tags: string[];
|
|
15
|
+
parameters: {
|
|
16
|
+
layout: string;
|
|
17
|
+
};
|
|
18
|
+
decorators: ((Story: import('storybook/internal/csf').PartialStoryFn<import('@storybook/react').ReactRenderer, {
|
|
19
|
+
children: import('react').ReactNode;
|
|
20
|
+
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
21
|
+
};
|
|
22
|
+
export default _default;
|
|
23
|
+
export declare const Primary: Story;
|
|
24
|
+
export declare const IconOnly: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './HeaderActions';
|
package/header/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface MobileMenuProps {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
isDrawerOpen?: boolean;
|
|
5
|
+
defaultDrawerOpen?: boolean;
|
|
6
|
+
onDrawerOpenChange?: (isDrawerOpen: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const MobileMenu: ({ children, isDrawerOpen: isDrawerOpenProp, defaultDrawerOpen, onDrawerOpenChange, }: MobileMenuProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MobileMenuContext: import('react').Context<object | undefined>;
|