@midas-ds/layout 0.2.0 → 0.2.2

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/assets/header.css +1 -0
  3. package/assets/layout.css +1 -0
  4. package/assets/main.css +1 -0
  5. package/assets/navbar.css +1 -0
  6. package/assets/navigation.css +1 -0
  7. package/assets/panel.css +1 -0
  8. package/assets/sidebar.css +1 -0
  9. package/chunks/clsx-CbxlCXZ3.js +16 -0
  10. package/chunks/createLucideIcon-BgluSHFG.js +39 -0
  11. package/chunks/header--aFkqcRB.js +86 -0
  12. package/chunks/layout-BL0juoss.js +27 -0
  13. package/chunks/main-BHQLIt4r.js +8 -0
  14. package/chunks/navbar-C63VGKFb.js +8 -0
  15. package/chunks/navigation-C27FuxMS.js +96 -0
  16. package/chunks/panel-CJr6C1-h.js +165 -0
  17. package/chunks/sidebar-BhbGgFMU.js +93 -0
  18. package/chunks/utils-B0BlrR1T.js +23 -0
  19. package/header/index.js +2 -9
  20. package/index.js +8 -39
  21. package/layout/index.js +2 -5
  22. package/main/index.js +2 -4
  23. package/navbar/index.js +2 -4
  24. package/navigation/index.js +2 -9
  25. package/package.json +2 -2
  26. package/panel/index.js +2 -14
  27. package/sidebar/index.js +2 -6
  28. package/utils/index.js +2 -4
  29. package/assets/Header.css +0 -1
  30. package/assets/LayoutContent.css +0 -1
  31. package/assets/Main.css +0 -1
  32. package/assets/Navbar.css +0 -1
  33. package/assets/NavigationSubMenu.css +0 -1
  34. package/assets/PanelRegion.css +0 -1
  35. package/assets/PanelTitle.css +0 -1
  36. package/assets/Sidebar.css +0 -1
  37. package/chunks/Header-Wswx-yQj.js +0 -107
  38. package/chunks/LayoutContent-DDWtDRL5.js +0 -53
  39. package/chunks/Main-BVvbCTMX.js +0 -14
  40. package/chunks/MobileMenuContext-Coj0sJ0N.js +0 -6
  41. package/chunks/Navbar-Do2dFMRr.js +0 -14
  42. package/chunks/NavigationSubMenu-DabVRyqI.js +0 -166
  43. package/chunks/PanelRegion-X9t7HDPS.js +0 -193
  44. package/chunks/PanelTitle-CSjU7dUj.js +0 -51
  45. package/chunks/Sidebar-uZAklu0a.js +0 -91
  46. package/chunks/SidebarContext-CoDRKR2m.js +0 -8
  47. package/chunks/clsx-OuTLNxxd.js +0 -16
  48. package/chunks/createLucideIcon-CP-mMPfa.js +0 -75
  49. package/chunks/useIsMobileDevice-D0iMVFPx.js +0 -25
@@ -1,193 +0,0 @@
1
- 'use client';
2
- import { jsx as f, jsxs as g } from "react/jsx-runtime";
3
- import { useRef as E, useEffect as b, forwardRef as y, createContext as A, useState as C, useContext as N } from "react";
4
- import { c as O } from "./clsx-OuTLNxxd.js";
5
- import { useLocalizedStringFormatter as T, Button as I } from "@midas-ds/components";
6
- import { useControlledState as R } from "@react-stately/utils";
7
- import { useExitAnimation as j, useObjectRef as S, useEnterAnimation as k, filterDOMProps as z } from "@react-aria/utils";
8
- import { P as L, b as M, c as U, a as V } from "./PanelTitle-CSjU7dUj.js";
9
- import { c as w } from "./createLucideIcon-CP-mMPfa.js";
10
- import '../assets/PanelRegion.css';const D = [
11
- ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
12
- ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
13
- ], F = w("x", D), H = { closePanel: "Close panel" }, X = { closePanel: "Stäng panel" }, $ = {
14
- en: H,
15
- sv: X
16
- }, q = "_panel_11eci_6", B = "_panelActions_11eci_63", G = "_panelTitle_11eci_69", h = {
17
- panel: q,
18
- panelActions: B,
19
- panelTitle: G
20
- }, J = (a) => {
21
- const { onExited: l } = a, [o, d] = R(
22
- a.isOpen,
23
- a.defaultOpen || !1,
24
- a.onOpenChange
25
- ), r = E(null), s = j(r, o), m = () => d((u) => !u);
26
- return b(() => {
27
- !o && !s && l?.();
28
- }, [o, s, l]), !o && !s ? null : /* @__PURE__ */ f(
29
- K,
30
- {
31
- isExiting: s,
32
- onPress: m,
33
- ref: r,
34
- ...a
35
- }
36
- );
37
- }, K = y(
38
- ({
39
- className: a,
40
- title: l,
41
- actions: o,
42
- onPress: d,
43
- children: r,
44
- isExiting: s,
45
- defaultOpen: m,
46
- promoting: u,
47
- onPromotionEnd: p,
48
- "aria-hidden": c,
49
- ...t
50
- }, e) => {
51
- const n = T($), i = S(e), P = k(i, !m), v = (x) => {
52
- x.target === x.currentTarget && u && p?.();
53
- };
54
- return /* @__PURE__ */ g(
55
- L,
56
- {
57
- "aria-hidden": c || void 0,
58
- "aria-label": l,
59
- className: O(a, h.panel),
60
- ref: i,
61
- "data-entering": P || void 0,
62
- "data-exiting": s || void 0,
63
- "data-promoting": u || void 0,
64
- onAnimationEnd: v,
65
- ...z(t),
66
- children: [
67
- /* @__PURE__ */ g(M, { children: [
68
- /* @__PURE__ */ f(
69
- U,
70
- {
71
- className: h.panelTitle,
72
- title: l
73
- }
74
- ),
75
- /* @__PURE__ */ g("div", { className: h.panelActions, children: [
76
- o,
77
- /* @__PURE__ */ f(
78
- I,
79
- {
80
- "aria-label": n.format("closePanel"),
81
- onPress: d,
82
- size: "medium",
83
- variant: "icon",
84
- children: /* @__PURE__ */ f(F, { size: 20 })
85
- }
86
- )
87
- ] })
88
- ] }),
89
- /* @__PURE__ */ f(V, { children: r })
90
- ]
91
- }
92
- );
93
- }
94
- ), Q = (a) => null;
95
- Q.displayName = "usePanels";
96
- const _ = A({
97
- panels: [],
98
- panelVariant: "overlay",
99
- addPanel: () => {
100
- },
101
- closePanel: () => {
102
- },
103
- removePanel: () => {
104
- },
105
- resetPromoting: () => {
106
- }
107
- }), re = ({
108
- children: a,
109
- defaultPanels: l = [],
110
- panelBehavior: o = "replace",
111
- panelVariant: d = "overlay"
112
- }) => {
113
- const [r, s] = C(
114
- l.map((t) => ({ ...t, isOpen: !0, defaultOpen: !0 }))
115
- ), m = (t) => {
116
- s((e) => {
117
- if (o === "replace")
118
- return [{ ...t, isOpen: !0 }];
119
- const n = e.findIndex((i) => i.id === t.id);
120
- if (n === -1)
121
- return [...e, { ...t, isOpen: !0 }];
122
- if (o === "bring-to-front") {
123
- if (n === e.length - 1) return e;
124
- const i = e[n];
125
- return [
126
- ...e.filter((P) => P.id !== t.id),
127
- { ...i, isOpen: !0, promoting: !0 }
128
- ];
129
- }
130
- return o === "pop-to" ? e.map(
131
- (i, P) => P > n ? { ...i, isOpen: !1 } : i
132
- ) : e;
133
- });
134
- }, u = (t) => {
135
- s(
136
- (e) => e.map((n) => n.id === t ? { ...n, isOpen: !1 } : n)
137
- );
138
- }, p = (t) => {
139
- s((e) => e.filter((n) => n.id !== t));
140
- }, c = (t) => {
141
- s(
142
- (e) => e.map((n) => n.id === t ? { ...n, promoting: !1 } : n)
143
- );
144
- };
145
- return /* @__PURE__ */ f(
146
- _.Provider,
147
- {
148
- value: { panels: r, panelVariant: d, addPanel: m, closePanel: u, removePanel: p, resetPromoting: c },
149
- children: a
150
- }
151
- );
152
- }, W = () => N(_), Y = "_push_a83oo_1", Z = {
153
- push: Y
154
- }, ce = ({
155
- children: a,
156
- className: l,
157
- ...o
158
- }) => {
159
- const { panels: d, panelVariant: r, closePanel: s, removePanel: m, resetPromoting: u } = W(), p = d.length > 0;
160
- return /* @__PURE__ */ g(
161
- "div",
162
- {
163
- className: O(l, r === "push" && Z.push),
164
- "data-open": r === "push" && p ? !0 : void 0,
165
- ...o,
166
- children: [
167
- d.map(({ id: c, ...t }, e, { length: n }) => /* @__PURE__ */ f(
168
- J,
169
- {
170
- "aria-hidden": e < n - 1 || void 0,
171
- id: c,
172
- onOpenChange: (i) => {
173
- i || s(c);
174
- },
175
- onExited: () => m(c),
176
- onPromotionEnd: () => u(c),
177
- ...t
178
- },
179
- c
180
- )),
181
- a
182
- ]
183
- }
184
- );
185
- };
186
- export {
187
- J as P,
188
- Q as U,
189
- _ as a,
190
- re as b,
191
- ce as c,
192
- W as u
193
- };
@@ -1,51 +0,0 @@
1
- import { jsx as s } from "react/jsx-runtime";
2
- import { c as t } from "./clsx-OuTLNxxd.js";
3
- import { forwardRef as l } from "react";
4
- import { Text as o, clsx as c } from "@midas-ds/components";
5
- import '../assets/PanelTitle.css';const p = "_panelBody_1p0jk_1", r = {
6
- panelBody: p
7
- }, H = l(
8
- ({ className: e, ...n }, a) => /* @__PURE__ */ s(
9
- "aside",
10
- {
11
- ref: a,
12
- className: t(e, r.panelBody),
13
- ...n
14
- }
15
- )
16
- ), d = "_panelContent_1gfrc_1", i = {
17
- panelContent: d
18
- }, P = l(
19
- ({ className: e, ...n }, a) => /* @__PURE__ */ s(
20
- "div",
21
- {
22
- ref: a,
23
- tabIndex: 0,
24
- className: t(e, i.panelContent),
25
- ...n
26
- }
27
- )
28
- ), m = "_panelHeader_1g1ux_1", _ = {
29
- panelHeader: m
30
- }, N = ({ className: e, ...n }) => /* @__PURE__ */ s(
31
- "div",
32
- {
33
- className: t(e, _.panelHeader),
34
- ...n
35
- }
36
- ), y = "_panelTitle_w7y4m_1", x = {
37
- panelTitle: y
38
- }, $ = ({ className: e, title: n, ...a }) => /* @__PURE__ */ s(
39
- o,
40
- {
41
- className: c(e, x.panelTitle),
42
- ...a,
43
- children: n
44
- }
45
- );
46
- export {
47
- H as P,
48
- P as a,
49
- N as b,
50
- $ as c
51
- };
@@ -1,91 +0,0 @@
1
- 'use client';
2
- import { jsx as a, jsxs as d } from "react/jsx-runtime";
3
- import C from "react";
4
- import { c as o } from "./clsx-OuTLNxxd.js";
5
- import { useLocalizedStringFormatter as u, Button as x } from "@midas-ds/components";
6
- import { useControlledState as S } from "@react-stately/utils";
7
- import { filterDOMProps as g } from "@react-aria/utils";
8
- import { u as y } from "./useIsMobileDevice-D0iMVFPx.js";
9
- import { S as P } from "./SidebarContext-CoDRKR2m.js";
10
- import { c } from "./createLucideIcon-CP-mMPfa.js";
11
- import { P as z, b as T, c as N, a as k } from "./PanelTitle-CSjU7dUj.js";
12
- import '../assets/Sidebar.css';const M = [
13
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
14
- ["path", { d: "M9 3v18", key: "fh3hqa" }],
15
- ["path", { d: "m16 15-3-3 3-3", key: "14y99z" }]
16
- ], H = c("panel-left-close", M);
17
- const E = [
18
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
19
- ["path", { d: "M9 3v18", key: "fh3hqa" }],
20
- ["path", { d: "m14 9 3 3-3 3", key: "8010ee" }]
21
- ], I = c("panel-left-open", E), L = { expandSidebar: "Expand sidebar", collapseSidebar: "Collapse sidebar" }, w = { expandSidebar: "Expandera sidopanel", collapseSidebar: "Minimera sidopanel" }, D = {
22
- en: L,
23
- sv: w
24
- }, $ = "_sidebar_zlaev_1", j = "_collapsed_zlaev_8", q = "_sidebarHeader_zlaev_17", B = "_sidebarTitle_zlaev_26", F = "_sidebarContent_zlaev_49", s = {
25
- sidebar: $,
26
- collapsed: j,
27
- sidebarHeader: q,
28
- sidebarTitle: B,
29
- sidebarContent: F
30
- }, X = ({
31
- children: p,
32
- className: m,
33
- title: r,
34
- ...i
35
- }) => {
36
- const n = u(D), b = y(), [e, f] = S(
37
- i.isCollapsed,
38
- i.defaultCollapsed || !1,
39
- i.onCollapseChange
40
- ), [h, l] = C.useState(!1), _ = () => {
41
- l(!0), f((t) => !t);
42
- }, v = (t) => {
43
- t.propertyName === "width" && t.target === t.currentTarget && l(!1);
44
- };
45
- return b ? null : /* @__PURE__ */ a(P.Provider, { value: { isCollapsed: e }, children: /* @__PURE__ */ d(
46
- z,
47
- {
48
- className: o(m, s.sidebar, {
49
- [s.collapsed]: e
50
- }),
51
- "data-transitioning": h || void 0,
52
- onTransitionEnd: v,
53
- ...g(i),
54
- children: [
55
- /* @__PURE__ */ d(
56
- T,
57
- {
58
- className: o(s.sidebarHeader, {
59
- [s.collapsed]: e
60
- }),
61
- children: [
62
- r ? /* @__PURE__ */ a(
63
- N,
64
- {
65
- className: o(s.sidebarTitle, {
66
- [s.collapsed]: e
67
- }),
68
- title: r
69
- }
70
- ) : /* @__PURE__ */ a("div", {}),
71
- /* @__PURE__ */ a(
72
- x,
73
- {
74
- "aria-label": e ? n.format("expandSidebar") : n.format("collapseSidebar"),
75
- onPress: _,
76
- variant: "icon",
77
- size: e ? "large" : "medium",
78
- children: e ? /* @__PURE__ */ a(I, { size: 20 }) : /* @__PURE__ */ a(H, { size: 20 })
79
- }
80
- )
81
- ]
82
- }
83
- ),
84
- /* @__PURE__ */ a(k, { className: s.sidebarContent, children: p })
85
- ]
86
- }
87
- ) });
88
- };
89
- export {
90
- X as S
91
- };
@@ -1,8 +0,0 @@
1
- 'use client';
2
- import { createContext as t } from "react";
3
- const e = t(
4
- void 0
5
- );
6
- export {
7
- e as S
8
- };
@@ -1,16 +0,0 @@
1
- function a(r) {
2
- var f, n, t = "";
3
- if (typeof r == "string" || typeof r == "number") t += r;
4
- else if (typeof r == "object") if (Array.isArray(r)) {
5
- var o = r.length;
6
- for (f = 0; f < o; f++) r[f] && (n = a(r[f])) && (t && (t += " "), t += n);
7
- } else for (n in r) r[n] && (t && (t += " "), t += n);
8
- return t;
9
- }
10
- function i() {
11
- for (var r, f, n = 0, t = "", o = arguments.length; n < o; n++) (r = arguments[n]) && (f = a(r)) && (t && (t += " "), t += f);
12
- return t;
13
- }
14
- export {
15
- i as c
16
- };
@@ -1,75 +0,0 @@
1
- import { forwardRef as l, createElement as n } from "react";
2
- const u = (...t) => t.filter((e, r, o) => !!e && e.trim() !== "" && o.indexOf(e) === r).join(" ").trim();
3
- const w = (t) => t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
4
- const f = (t) => t.replace(
5
- /^([A-Z])|[\s-_]+(\w)/g,
6
- (e, r, o) => o ? o.toUpperCase() : r.toLowerCase()
7
- );
8
- const i = (t) => {
9
- const e = f(t);
10
- return e.charAt(0).toUpperCase() + e.slice(1);
11
- };
12
- var h = {
13
- xmlns: "http://www.w3.org/2000/svg",
14
- width: 24,
15
- height: 24,
16
- viewBox: "0 0 24 24",
17
- fill: "none",
18
- stroke: "currentColor",
19
- strokeWidth: 2,
20
- strokeLinecap: "round",
21
- strokeLinejoin: "round"
22
- };
23
- const g = (t) => {
24
- for (const e in t)
25
- if (e.startsWith("aria-") || e === "role" || e === "title")
26
- return !0;
27
- return !1;
28
- };
29
- const A = l(
30
- ({
31
- color: t = "currentColor",
32
- size: e = 24,
33
- strokeWidth: r = 2,
34
- absoluteStrokeWidth: o,
35
- className: s = "",
36
- children: a,
37
- iconNode: p,
38
- ...c
39
- }, m) => n(
40
- "svg",
41
- {
42
- ref: m,
43
- ...h,
44
- width: e,
45
- height: e,
46
- stroke: t,
47
- strokeWidth: o ? Number(r) * 24 / Number(e) : r,
48
- className: u("lucide", s),
49
- ...!a && !g(c) && { "aria-hidden": "true" },
50
- ...c
51
- },
52
- [
53
- ...p.map(([C, d]) => n(C, d)),
54
- ...Array.isArray(a) ? a : [a]
55
- ]
56
- )
57
- );
58
- const k = (t, e) => {
59
- const r = l(
60
- ({ className: o, ...s }, a) => n(A, {
61
- ref: a,
62
- iconNode: e,
63
- className: u(
64
- `lucide-${w(i(t))}`,
65
- `lucide-${t}`,
66
- o
67
- ),
68
- ...s
69
- })
70
- );
71
- return r.displayName = i(t), r;
72
- };
73
- export {
74
- k as c
75
- };
@@ -1,25 +0,0 @@
1
- 'use client';
2
- import { useState as r, useEffect as c } from "react";
3
- import { useIsSSR as d } from "@react-aria/ssr";
4
- import "@react-aria/utils";
5
- function f(e) {
6
- let t = typeof window < "u" && typeof window.matchMedia == "function", [n, o] = r(() => t ? window.matchMedia(e).matches : !1);
7
- return c(() => {
8
- if (!t) return;
9
- let i = window.matchMedia(e), a = (s) => {
10
- o(s.matches);
11
- };
12
- return i.addListener(a), () => {
13
- i.removeListener(a);
14
- };
15
- }, [
16
- t,
17
- e
18
- ]), d() ? !1 : n;
19
- }
20
- function w() {
21
- return f("(max-width: 640px)");
22
- }
23
- export {
24
- w as u
25
- };