@midas-ds/layout 0.0.7 → 0.0.9

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 (67) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/assets/Button.css +1 -0
  3. package/assets/Header.css +1 -0
  4. package/assets/NavigationSubMenu.css +1 -0
  5. package/assets/Panel.css +1 -1
  6. package/chunks/Button-7IYEsEeT.js +192 -0
  7. package/chunks/Header-DjegZbd1.js +101 -0
  8. package/chunks/NavigationSubMenu-CpS-A3-h.js +208 -0
  9. package/chunks/Panel-BsVbn7nx.js +156 -0
  10. package/chunks/PanelContext-D6WQ7_yb.js +11 -0
  11. package/chunks/Text-B18MZHuN.js +56 -0
  12. package/chunks/useIsMobileDevice-D0iMVFPx.js +25 -0
  13. package/header/header-action/HeaderAction.d.ts +6 -0
  14. package/header/header-action/index.d.ts +1 -0
  15. package/header/header-actions/HeaderActions.d.ts +3 -10
  16. package/header/header-actions/HeaderActions.stories.d.ts +284 -10
  17. package/header/index.d.ts +2 -1
  18. package/header/index.js +7 -6
  19. package/header/mobile-menu/MobileMenu.d.ts +2 -1
  20. package/index.js +27 -21
  21. package/navigation/Navigation.d.ts +1 -6
  22. package/navigation/Navigation.stories.d.ts +1 -4
  23. package/navigation/index.d.ts +5 -1
  24. package/navigation/index.js +1 -1
  25. package/navigation/{components/header → navigation-header}/NavigationHeader.d.ts +1 -1
  26. package/navigation/{components/link → navigation-link}/NavigationLink.d.ts +1 -1
  27. package/navigation/{components/sub-menu → navigation-sub-menu}/NavigationSubMenu.d.ts +3 -2
  28. package/package.json +2 -2
  29. package/panel/Panel.d.ts +5 -2
  30. package/panel/Panel.stories.d.ts +1 -1
  31. package/panel/PanelContext.d.ts +0 -2
  32. package/panel/{components/collapse-panel → collapse-panel}/CollapsePanel.d.ts +1 -1
  33. package/panel/collapse-panel/CollapsePanelContext.d.ts +3 -0
  34. package/panel/collapse-panel/index.d.ts +2 -0
  35. package/panel/{components/dismiss-panel → dismiss-panel}/DismissPanel.d.ts +1 -1
  36. package/panel/index.d.ts +5 -0
  37. package/panel/index.js +10 -5
  38. package/panel/{components/panel-title → panel-title}/PanelTitle.d.ts +1 -1
  39. package/utils/index.d.ts +1 -0
  40. package/utils/index.js +4 -0
  41. package/assets/MobileMenu.css +0 -1
  42. package/assets/Navigation.css +0 -1
  43. package/assets/useIsMobileDevice.css +0 -1
  44. package/chunks/MobileMenu-DcQpdykm.js +0 -86
  45. package/chunks/Navigation-Cq0h2Nt9.js +0 -212
  46. package/chunks/Panel-C1MEWSWX.js +0 -147
  47. package/chunks/PanelContext-D2ADxgo6.js +0 -44
  48. package/chunks/clsx-AexbMWKp.js +0 -24
  49. package/chunks/useIsMobileDevice-DhQB0ae2.js +0 -213
  50. package/navigation/components/index.d.ts +0 -5
  51. package/panel/components/collapse-panel/index.d.ts +0 -1
  52. package/panel/components/index.d.ts +0 -5
  53. /package/assets/{PanelContext.css → Text.css} +0 -0
  54. /package/navigation/{components/header → navigation-header}/index.d.ts +0 -0
  55. /package/navigation/{components/item → navigation-item}/NavigationItem.d.ts +0 -0
  56. /package/navigation/{components/item → navigation-item}/index.d.ts +0 -0
  57. /package/navigation/{components/link → navigation-link}/NavigationLink.stories.d.ts +0 -0
  58. /package/navigation/{components/link → navigation-link}/index.d.ts +0 -0
  59. /package/navigation/{components/section → navigation-section}/NavigationSection.d.ts +0 -0
  60. /package/navigation/{components/section → navigation-section}/index.d.ts +0 -0
  61. /package/navigation/{components/sub-menu → navigation-sub-menu}/index.d.ts +0 -0
  62. /package/panel/{components/dismiss-panel → dismiss-panel}/index.d.ts +0 -0
  63. /package/panel/{components/panel-body → panel-body}/PanelBody.d.ts +0 -0
  64. /package/panel/{components/panel-body → panel-body}/index.d.ts +0 -0
  65. /package/panel/{components/panel-header → panel-header}/PanelHeader.d.ts +0 -0
  66. /package/panel/{components/panel-header → panel-header}/index.d.ts +0 -0
  67. /package/panel/{components/panel-title → panel-title}/index.d.ts +0 -0
@@ -1,147 +0,0 @@
1
- 'use client';
2
- import { jsx as e, jsxs as i } from "react/jsx-runtime";
3
- import { T as g, C as B, P as f } from "./PanelContext-D2ADxgo6.js";
4
- import { c as _, a as v } from "./clsx-AexbMWKp.js";
5
- import { useControlledState as x } from "@react-stately/utils";
6
- import { c as y, a as T, u as M, B as b } from "./useIsMobileDevice-DhQB0ae2.js";
7
- import '../assets/Panel.css';const z = [
8
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
9
- ["path", { d: "M9 3v18", key: "fh3hqa" }],
10
- ["path", { d: "m16 15-3-3 3-3", key: "14y99z" }]
11
- ], H = y("panel-left-close", z);
12
- const j = [
13
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
14
- ["path", { d: "M9 3v18", key: "fh3hqa" }],
15
- ["path", { d: "m14 9 3 3-3 3", key: "8010ee" }]
16
- ], I = y("panel-left-open", j);
17
- const L = [
18
- ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
19
- ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
20
- ], O = y("x", L), q = "_panelBody_13l7o_1", w = {
21
- panelBody: q
22
- }, C = ({ className: s, ...l }) => /* @__PURE__ */ e(
23
- "aside",
24
- {
25
- className: _(s, w.panelBody),
26
- ...l
27
- }
28
- ), D = "_panelHeader_11qv1_1", E = {
29
- panelHeader: D
30
- }, N = ({ className: s, ...l }) => /* @__PURE__ */ e(
31
- "div",
32
- {
33
- className: _(s, E.panelHeader),
34
- ...l
35
- }
36
- ), F = "_panelTitle_w7y4m_1", X = {
37
- panelTitle: F
38
- }, k = ({ className: s, title: l, ...n }) => /* @__PURE__ */ e(
39
- g,
40
- {
41
- className: _(s, X.panelTitle),
42
- ...n,
43
- children: l
44
- }
45
- ), A = { expandSidebar: "Expand sidebar", collapseSidebar: "Collapse sidebar", closePanel: "Close panel" }, G = { expandSidebar: "Expandera sidopanel", collapseSidebar: "Minimera sidopanel", closePanel: "Stäng panel" }, S = {
46
- en: A,
47
- sv: G
48
- }, J = "_collapsePanel_1uy7t_1", K = "_collapsed_1uy7t_4", Q = "_panelTitle_1uy7t_17", P = {
49
- collapsePanel: J,
50
- collapsed: K,
51
- panelTitle: Q
52
- }, R = ({
53
- children: s,
54
- className: l,
55
- isCollapsed: n,
56
- defaultCollapsed: c = !1,
57
- onCollapseChange: d,
58
- title: o,
59
- ...r
60
- }) => {
61
- const t = T(S), p = M(), [a, m] = x(
62
- n,
63
- c,
64
- d
65
- ), h = () => m(($) => !$);
66
- return p ? null : /* @__PURE__ */ e(B.Provider, { value: { isCollapsed: a }, children: /* @__PURE__ */ i(
67
- C,
68
- {
69
- className: v(l, P.collapsePanel, {
70
- [P.collapsed]: a
71
- }),
72
- ...r,
73
- children: [
74
- /* @__PURE__ */ i(N, { children: [
75
- /* @__PURE__ */ e("div", { children: !a && o && /* @__PURE__ */ e(
76
- k,
77
- {
78
- className: P.panelTitle,
79
- title: o
80
- }
81
- ) }),
82
- /* @__PURE__ */ e(
83
- b,
84
- {
85
- variant: "icon",
86
- "aria-label": a ? t.format("expandSidebar") : t.format("collapseSidebar"),
87
- onPress: h,
88
- children: a ? /* @__PURE__ */ e(I, { size: 20 }) : /* @__PURE__ */ e(H, { size: 20 })
89
- }
90
- )
91
- ] }),
92
- s
93
- ]
94
- }
95
- ) });
96
- }, U = "_dismissPanel_dpjsv_1", V = "_panelTitle_dpjsv_18", u = {
97
- dismissPanel: U,
98
- panelTitle: V
99
- }, W = ({
100
- children: s,
101
- className: l,
102
- isOpen: n,
103
- defaultOpen: c = !1,
104
- onOpenChange: d,
105
- title: o,
106
- ...r
107
- }) => {
108
- const t = T(S), [p, a] = x(
109
- n,
110
- c,
111
- d
112
- ), m = () => a((h) => !h);
113
- return p ? /* @__PURE__ */ i(
114
- C,
115
- {
116
- className: v(l, u.dismissPanel),
117
- ...r,
118
- children: [
119
- /* @__PURE__ */ i(N, { children: [
120
- /* @__PURE__ */ e("div", { children: o && /* @__PURE__ */ e(
121
- k,
122
- {
123
- className: u.panelTitle,
124
- title: o
125
- }
126
- ) }),
127
- /* @__PURE__ */ e(
128
- b,
129
- {
130
- variant: "icon",
131
- "aria-label": t.format("closePanel"),
132
- onPress: m,
133
- children: /* @__PURE__ */ e(O, { size: 20 })
134
- }
135
- )
136
- ] }),
137
- s
138
- ]
139
- }
140
- ) : null;
141
- }, ae = ({
142
- variant: s = "collapse",
143
- ...l
144
- }) => s === "collapse" ? /* @__PURE__ */ e(f.Provider, { value: { variant: s }, children: /* @__PURE__ */ e(R, { ...l }) }) : s === "dismiss" ? /* @__PURE__ */ e(f.Provider, { value: { variant: s }, children: /* @__PURE__ */ e(W, { ...l }) }) : null;
145
- export {
146
- ae as P
147
- };
@@ -1,44 +0,0 @@
1
- 'use client';
2
- import { jsx as d } from "react/jsx-runtime";
3
- import { c as m } from "./clsx-AexbMWKp.js";
4
- import { Text as p } from "react-aria-components";
5
- import { createContext as e } from "react";
6
- import '../assets/PanelContext.css';const _ = "_body_g096r_1", b = "_description_g096r_3", x = "_bold_g096r_24", g = "_italic_g096r_28", s = {
7
- body: _,
8
- "body-small": "_body-small_g096r_2",
9
- description: b,
10
- "description-small": "_description-small_g096r_4",
11
- bold: x,
12
- italic: g
13
- }, l = "span", N = ({
14
- children: r,
15
- className: a,
16
- size: o,
17
- isExpressive: n = !1,
18
- elementType: t = l,
19
- ...i
20
- }) => {
21
- const c = {
22
- className: m(
23
- i.slot === "description" ? o === "small" ? s["description-small"] : s.description : o === "small" ? s["body-small"] : s.body,
24
- {
25
- [s.bold]: ["b", "strong"].includes(t),
26
- [s.italic]: ["i", "em"].includes(t)
27
- },
28
- a
29
- ),
30
- elementType: t || l,
31
- ...n && { "data-expressive": !0 },
32
- ...i
33
- };
34
- return /* @__PURE__ */ d(p, { ...c, children: r });
35
- }, P = e({
36
- variant: void 0
37
- }), v = e({
38
- isCollapsed: !1
39
- });
40
- export {
41
- v as C,
42
- P,
43
- N as T
44
- };
@@ -1,24 +0,0 @@
1
- function u(r) {
2
- var f, t, n = "";
3
- if (typeof r == "string" || typeof r == "number") n += 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] && (t = u(r[f])) && (n && (n += " "), n += t);
7
- } else for (t in r) r[t] && (n && (n += " "), n += t);
8
- return n;
9
- }
10
- function i() {
11
- for (var r, f, t = 0, n = "", o = arguments.length; t < o; t++) (r = arguments[t]) && (f = u(r)) && (n && (n += " "), n += f);
12
- return n;
13
- }
14
- function e(...r) {
15
- return r.some((f) => typeof f == "function") ? (f) => i(
16
- r.map(
17
- (t) => typeof t == "function" ? t(f) : t
18
- )
19
- ) : i(r);
20
- }
21
- export {
22
- i as a,
23
- e as c
24
- };
@@ -1,213 +0,0 @@
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
- };
@@ -1,5 +0,0 @@
1
- export * from './header';
2
- export * from './link';
3
- export * from './item';
4
- export * from './sub-menu';
5
- export * from './section';
@@ -1 +0,0 @@
1
- export * from './CollapsePanel';
@@ -1,5 +0,0 @@
1
- export * from './collapse-panel';
2
- export * from './dismiss-panel';
3
- export * from './panel-body';
4
- export * from './panel-header';
5
- export * from './panel-title';
File without changes