@midas-ds/layout 0.0.1-beta.1 → 0.0.4

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 (80) hide show
  1. package/CHANGELOG.md +40 -2
  2. package/README.md +7 -0
  3. package/assets/Layout.css +1 -0
  4. package/assets/Main.css +1 -0
  5. package/assets/MobileMenu.css +1 -0
  6. package/assets/Navbar.css +1 -0
  7. package/assets/Navigation.css +1 -0
  8. package/assets/Panel.css +1 -0
  9. package/assets/PanelContext.css +1 -0
  10. package/assets/useIsMobileDevice.css +1 -0
  11. package/chunks/Layout-16EqvEZN.js +23 -0
  12. package/chunks/Main-QnNDtP6N.js +13 -0
  13. package/chunks/MobileMenu-DcQpdykm.js +86 -0
  14. package/chunks/MobileMenuContext-Coj0sJ0N.js +6 -0
  15. package/chunks/Navbar-wOOCcsru.js +13 -0
  16. package/chunks/Navigation-Cq0h2Nt9.js +212 -0
  17. package/chunks/Panel-C1MEWSWX.js +147 -0
  18. package/chunks/PanelContext-D2ADxgo6.js +44 -0
  19. package/chunks/clsx-AexbMWKp.js +24 -0
  20. package/chunks/useIsMobileDevice-DhQB0ae2.js +213 -0
  21. package/header/Header.d.ts +3 -0
  22. package/header/header-actions/HeaderActions.d.ts +10 -0
  23. package/header/header-actions/HeaderActions.stories.d.ts +24 -0
  24. package/header/header-actions/index.d.ts +1 -0
  25. package/header/index.d.ts +3 -0
  26. package/header/index.js +8 -0
  27. package/header/mobile-menu/MobileMenu.d.ts +8 -0
  28. package/header/mobile-menu/MobileMenuContext.d.ts +1 -0
  29. package/header/mobile-menu/index.d.ts +2 -0
  30. package/index.d.ts +6 -1
  31. package/index.js +27 -77
  32. package/layout/Layout.d.ts +7 -0
  33. package/layout/Layout.stories.d.ts +17 -0
  34. package/layout/index.d.ts +1 -0
  35. package/layout/index.js +5 -0
  36. package/main/Main.d.ts +3 -0
  37. package/main/index.d.ts +1 -0
  38. package/main/index.js +4 -0
  39. package/navbar/Navbar.d.ts +3 -0
  40. package/navbar/index.d.ts +1 -0
  41. package/navbar/index.js +4 -0
  42. package/navigation/Navigation.d.ts +9 -0
  43. package/navigation/Navigation.stories.d.ts +13 -0
  44. package/navigation/components/header/NavigationHeader.d.ts +3 -0
  45. package/navigation/components/header/index.d.ts +1 -0
  46. package/navigation/components/index.d.ts +5 -0
  47. package/navigation/components/item/NavigationItem.d.ts +3 -0
  48. package/navigation/components/item/index.d.ts +1 -0
  49. package/navigation/components/link/NavigationLink.d.ts +13 -0
  50. package/navigation/components/link/NavigationLink.stories.d.ts +21 -0
  51. package/navigation/components/link/index.d.ts +1 -0
  52. package/navigation/components/section/NavigationSection.d.ts +6 -0
  53. package/navigation/components/section/index.d.ts +1 -0
  54. package/navigation/components/sub-menu/NavigationSubMenu.d.ts +4 -0
  55. package/navigation/components/sub-menu/index.d.ts +1 -0
  56. package/navigation/index.d.ts +2 -0
  57. package/navigation/index.js +9 -0
  58. package/package.json +33 -12
  59. package/panel/Panel.d.ts +7 -0
  60. package/panel/Panel.stories.d.ts +16 -0
  61. package/panel/PanelContext.d.ts +5 -0
  62. package/panel/components/collapse-panel/CollapsePanel.d.ts +7 -0
  63. package/panel/components/collapse-panel/index.d.ts +1 -0
  64. package/panel/components/dismiss-panel/DismissPanel.d.ts +7 -0
  65. package/panel/components/dismiss-panel/index.d.ts +1 -0
  66. package/panel/components/index.d.ts +5 -0
  67. package/panel/components/panel-body/PanelBody.d.ts +3 -0
  68. package/panel/components/panel-body/index.d.ts +1 -0
  69. package/panel/components/panel-header/PanelHeader.d.ts +3 -0
  70. package/panel/components/panel-header/index.d.ts +1 -0
  71. package/panel/components/panel-title/PanelTitle.d.ts +5 -0
  72. package/panel/components/panel-title/index.d.ts +1 -0
  73. package/panel/index.d.ts +2 -0
  74. package/panel/index.js +7 -0
  75. package/panel/intl/translations.json.d.ts +15 -0
  76. package/utils/useIsMobileDevice.d.ts +1 -0
  77. package/index.css +0 -1
  78. package/index.mjs +0 -6621
  79. package/lib/Layout.d.ts +0 -51
  80. 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,3 @@
1
+ import { DetailedHTMLProps, HTMLAttributes } from 'react';
2
+ export type HeaderProps = DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
3
+ export declare const Header: ({ className, ...rest }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
@@ -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';
@@ -0,0 +1,3 @@
1
+ export * from './Header';
2
+ export * from './header-actions';
3
+ export * from './mobile-menu';
@@ -0,0 +1,8 @@
1
+ import { H as a, a as r, M } from "../chunks/MobileMenu-DcQpdykm.js";
2
+ import { M as t } from "../chunks/MobileMenuContext-Coj0sJ0N.js";
3
+ export {
4
+ a as Header,
5
+ r as HeaderActions,
6
+ M as MobileMenu,
7
+ t as MobileMenuContext
8
+ };
@@ -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>;
@@ -0,0 +1,2 @@
1
+ export * from './MobileMenu';
2
+ export * from './MobileMenuContext';
package/index.d.ts CHANGED
@@ -1 +1,6 @@
1
- export * from './lib/Layout';
1
+ export * from './header';
2
+ export * from './layout';
3
+ export * from './main';
4
+ export * from './navigation';
5
+ export * from './panel';
6
+ export * from './navbar';