@canonical/maas-react-components 2.9.12 → 2.9.14
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.
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { t as ContentSection, c as DynamicTable, r as ExternalLink, u as FileUpload, a as FormSection, S as GenericTable, O as InputGroup, p as Layout, m as MainToolbar, n as Meter, b as MultiSelect, C as MultiSelectDropdown, x as Navigation, v as NavigationBar, f as NestedFormGroup, T as Pagination, d as PaginationContainer, D as Placeholder, o as ProgressIndicator, y as QueryInput, l as SidePanel, E as SidePanelContextProvider, _ as Stepper, h as TableCaption, i as defaultFilledColors, w as formatBytes, s as lazyLoadSidePanel, g as meterColor, e as testIds, k as useSidePanel };
|
|
1
|
+
export { C as ContentSection, a as DynamicTable, E as ExternalLink, c as FileUpload, S as FormSection, r as GenericTable, x as InputGroup, g as Layout, h as MainToolbar, D as Meter, o as MultiSelect, s as MultiSelectDropdown, p as Navigation, m as NavigationBar, f as NestedFormGroup, u as Pagination, d as PaginationContainer, w as Placeholder, T as ProgressIndicator, n as QueryInput, b as SidePanel, v as SidePanelContextProvider, l as Stepper, i as TableCaption, O as defaultFilledColors, t as formatBytes, _ as lazyLoadSidePanel, k as meterColor, A as testIds, y as useSidePanel } from "../lib-CsaaxjyP.mjs";
|
|
@@ -6,7 +6,7 @@ import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
|
6
6
|
import { useLocation as re } from "react-router";
|
|
7
7
|
import { useDropzone as ie } from "react-dropzone";
|
|
8
8
|
import { flexRender as I, getCoreRowModel as ae, getExpandedRowModel as oe, getGroupedRowModel as se, useReactTable as ce } from "@tanstack/react-table";
|
|
9
|
-
|
|
9
|
+
// src/lib/elements/Meter/Meter.tsx
|
|
10
10
|
var L = {
|
|
11
11
|
caution: "#F99B11",
|
|
12
12
|
light: "#F7F7F7",
|
|
@@ -96,8 +96,7 @@ fe.Label = ({ className: e, children: t }) => /* @__PURE__ */ P("div", {
|
|
|
96
96
|
"data-testid": H.label,
|
|
97
97
|
children: t
|
|
98
98
|
});
|
|
99
|
-
|
|
100
|
-
//#region src/lib/elements/ExternalLink/ExternalLink.tsx
|
|
99
|
+
// src/lib/elements/ExternalLink/ExternalLink.tsx
|
|
101
100
|
var he = ({ children: e, to: t, ...n }) => /* @__PURE__ */ P(E, {
|
|
102
101
|
...n,
|
|
103
102
|
href: t,
|
|
@@ -176,8 +175,7 @@ W.Title = ({ children: e, className: t, as: n, ...r }) => /* @__PURE__ */ P(n ||
|
|
|
176
175
|
className: M("content-section__footer", t),
|
|
177
176
|
children: e
|
|
178
177
|
});
|
|
179
|
-
|
|
180
|
-
//#region src/lib/sections/FormSection/FormSection.tsx
|
|
178
|
+
// src/lib/sections/FormSection/FormSection.tsx
|
|
181
179
|
var G = ({ children: e }) => /* @__PURE__ */ P("div", {
|
|
182
180
|
className: "p-form-section",
|
|
183
181
|
children: e
|
|
@@ -192,8 +190,7 @@ G.Title = ({ children: e }) => /* @__PURE__ */ P("h5", {
|
|
|
192
190
|
className: "p-form-section__content",
|
|
193
191
|
children: e
|
|
194
192
|
});
|
|
195
|
-
|
|
196
|
-
//#region src/lib/sections/InputGroup/InputGroup.tsx
|
|
193
|
+
// src/lib/sections/InputGroup/InputGroup.tsx
|
|
197
194
|
var _e = a(null), ve = ({ children: e }) => {
|
|
198
195
|
let t = u();
|
|
199
196
|
return /* @__PURE__ */ P(_e.Provider, {
|
|
@@ -221,8 +218,7 @@ ve.Label = ({ children: e }) => {
|
|
|
221
218
|
children: e
|
|
222
219
|
});
|
|
223
220
|
};
|
|
224
|
-
|
|
225
|
-
//#region src/lib/sections/Layout/components/DocumentTitle/DocumentTitle.tsx
|
|
221
|
+
// src/lib/sections/Layout/components/DocumentTitle/DocumentTitle.tsx
|
|
226
222
|
var ye = ({ children: e }) => (l(() => {
|
|
227
223
|
document.title = t.toArray(e).join("");
|
|
228
224
|
}, [e]), null), be = () => {
|
|
@@ -317,8 +313,7 @@ K.Skeleton = ({ hasTitle: e }) => /* @__PURE__ */ F(W, {
|
|
|
317
313
|
})
|
|
318
314
|
]
|
|
319
315
|
});
|
|
320
|
-
|
|
321
|
-
//#region src/lib/sections/SidePanel/SidePanelContextProvider/SidePanelContextProvider.tsx
|
|
316
|
+
// src/lib/sections/SidePanel/SidePanelContextProvider/SidePanelContextProvider.tsx
|
|
322
317
|
var Ce = a(null), q = () => {
|
|
323
318
|
let e = c(Ce);
|
|
324
319
|
if (!e) throw Error("useSidePanel must be used within a SidePanelProvider");
|
|
@@ -550,8 +545,7 @@ var Ce = a(null), q = () => {
|
|
|
550
545
|
})] })]
|
|
551
546
|
});
|
|
552
547
|
Ee.Skeleton = De;
|
|
553
|
-
|
|
554
|
-
//#region src/lib/sections/MainToolbar/MainToolbar.tsx
|
|
548
|
+
// src/lib/sections/MainToolbar/MainToolbar.tsx
|
|
555
549
|
function Oe(t) {
|
|
556
550
|
let [n, r] = e.useState(null), i = e.useRef(null), a = e.useCallback(() => {
|
|
557
551
|
if (t.current) {
|
|
@@ -590,7 +584,7 @@ je.Title = ({ as: e, children: t, className: n, ...r }) => /* @__PURE__ */ P(e |
|
|
|
590
584
|
}), je.Controls = ({ children: t }) => {
|
|
591
585
|
let n = e.useContext(ke), [r, i] = e.useContext(Ae), a = e.useRef(null);
|
|
592
586
|
return e.useEffect(() => {
|
|
593
|
-
|
|
587
|
+
a.current && n && i(a.current.getBoundingClientRect().width > n.width);
|
|
594
588
|
}, [
|
|
595
589
|
i,
|
|
596
590
|
n,
|
|
@@ -609,8 +603,7 @@ je.Title = ({ as: e, children: t, className: n, ...r }) => /* @__PURE__ */ P(e |
|
|
|
609
603
|
children: t
|
|
610
604
|
})] });
|
|
611
605
|
};
|
|
612
|
-
|
|
613
|
-
//#region src/lib/sections/Navigation/Banner/Banner.tsx
|
|
606
|
+
// src/lib/sections/Navigation/Banner/Banner.tsx
|
|
614
607
|
var Me = ({ children: e }) => /* @__PURE__ */ P(N, { children: e }), Ne = ({ isCollapsed: e, setIsCollapsed: t, className: n }) => /* @__PURE__ */ P(A, {
|
|
615
608
|
className: "p-side-navigation__tooltip-wrapper",
|
|
616
609
|
message: /* @__PURE__ */ F(N, { children: [
|
|
@@ -728,8 +721,7 @@ var Me = ({ children: e }) => /* @__PURE__ */ P(N, { children: e }), Ne = ({ isC
|
|
|
728
721
|
})
|
|
729
722
|
});
|
|
730
723
|
J.Header = Ue, J.Banner = Me, J.Drawer = Ie, J.Controls = Fe, J.CollapseToggle = Ne, J.Content = Pe, J.Footer = Le, J.List = Ve, J.Item = ze, J.Group = He, J.Link = We, J.Text = Ze, J.Icon = Re, J.Label = Be, J.Logo = Ge, J.LogoTag = Je, J.LogoIcon = Ke, J.LogoName = qe, J.LogoText = Ye, Qe.MenuButton = Xe;
|
|
731
|
-
|
|
732
|
-
//#region src/lib/components/FadeInDown/FadeInDown.tsx
|
|
724
|
+
// src/lib/components/FadeInDown/FadeInDown.tsx
|
|
733
725
|
var $e = ({ children: e, className: t, isVisible: n }) => /* @__PURE__ */ P("div", {
|
|
734
726
|
className: M("fade-in--down", t),
|
|
735
727
|
"aria-hidden": n ? "false" : "true",
|
|
@@ -1142,8 +1134,7 @@ var $e = ({ children: e, className: t, isVisible: n }) => /* @__PURE__ */ P("div
|
|
|
1142
1134
|
});
|
|
1143
1135
|
};
|
|
1144
1136
|
Y.Body = ht, Y.Loading = mt;
|
|
1145
|
-
|
|
1146
|
-
//#region src/lib/components/TableCaption/TableCaption.tsx
|
|
1137
|
+
// src/lib/components/TableCaption/TableCaption.tsx
|
|
1147
1138
|
var gt = ({ children: e }) => /* @__PURE__ */ P("caption", { children: /* @__PURE__ */ P("div", {
|
|
1148
1139
|
className: "p-strip",
|
|
1149
1140
|
children: e
|
|
@@ -1164,8 +1155,7 @@ gt.Title = ({ children: e }) => /* @__PURE__ */ P("div", {
|
|
|
1164
1155
|
children: /* @__PURE__ */ P("p", { children: e })
|
|
1165
1156
|
})
|
|
1166
1157
|
});
|
|
1167
|
-
|
|
1168
|
-
//#region src/lib/components/GenericTable/components/SortingIndicator/SortingIndicator.tsx
|
|
1158
|
+
// src/lib/components/GenericTable/components/SortingIndicator/SortingIndicator.tsx
|
|
1169
1159
|
var _t = ({ header: e }) => ({
|
|
1170
1160
|
asc: /* @__PURE__ */ P(C, {
|
|
1171
1161
|
name: "chevron-up",
|
|
@@ -1208,8 +1198,7 @@ X.Left = ({ children: e }) => /* @__PURE__ */ P("strong", {
|
|
|
1208
1198
|
className: "u-flex u-flex--wrap u-flex--column-x-small controls-bar__right",
|
|
1209
1199
|
children: e
|
|
1210
1200
|
});
|
|
1211
|
-
|
|
1212
|
-
//#region src/lib/components/GenericTable/components/PaginationBar/PaginationBar.tsx
|
|
1201
|
+
// src/lib/components/GenericTable/components/PaginationBar/PaginationBar.tsx
|
|
1213
1202
|
var yt = ({ currentPage: e, itemsPerPage: t, totalItems: n, handlePageSizeChange: r, dataContext: i, setCurrentPage: a, isPending: o, pageSizes: s = [
|
|
1214
1203
|
20,
|
|
1215
1204
|
30,
|
|
@@ -1285,15 +1274,7 @@ var yt = ({ currentPage: e, itemsPerPage: t, totalItems: n, handlePageSizeChange
|
|
|
1285
1274
|
let t = m(null), n = m(null);
|
|
1286
1275
|
return l(() => {
|
|
1287
1276
|
let n = t.current;
|
|
1288
|
-
|
|
1289
|
-
let r = [
|
|
1290
|
-
"button:not([disabled])",
|
|
1291
|
-
"input:not([disabled])",
|
|
1292
|
-
"select:not([disabled])",
|
|
1293
|
-
"textarea:not([disabled])",
|
|
1294
|
-
"a[href]"
|
|
1295
|
-
].join(", ");
|
|
1296
|
-
n.querySelectorAll(r).forEach((e) => {
|
|
1277
|
+
n && !e && n.querySelectorAll("button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href]").forEach((e) => {
|
|
1297
1278
|
e.getAttribute("tabindex") !== "-1" && (e.tabIndex = 0);
|
|
1298
1279
|
});
|
|
1299
1280
|
}), d(() => {
|
|
@@ -1508,8 +1489,7 @@ var yt = ({ currentPage: e, itemsPerPage: t, totalItems: n, handlePageSizeChange
|
|
|
1508
1489
|
});
|
|
1509
1490
|
};
|
|
1510
1491
|
Z.All = Tt, Z.Group = Et;
|
|
1511
|
-
|
|
1512
|
-
//#region src/lib/components/GenericTable/utils/processColumnDefs.tsx
|
|
1492
|
+
// src/lib/components/GenericTable/utils/processColumnDefs.tsx
|
|
1513
1493
|
var Dt = ({ canSelect: e, initialColumns: t, groupBy: n, getSubRows: r, selection: i, showChevron: a }) => {
|
|
1514
1494
|
let o = [...t];
|
|
1515
1495
|
if (e && i) {
|
|
@@ -2036,5 +2016,4 @@ var Dt = ({ canSelect: e, initialColumns: t, groupBy: n, getSubRows: r, selectio
|
|
|
2036
2016
|
unit: l[d]
|
|
2037
2017
|
};
|
|
2038
2018
|
};
|
|
2039
|
-
//#endregion
|
|
2040
2019
|
export { H as A, W as C, fe as D, he as E, le as O, G as S, ge as T, Te as _, Y as a, K as b, at as c, nt as d, et as f, Ee as g, je as h, gt as i, L as k, rt as l, Qe as m, Lt as n, ut as o, J as p, Mt as r, lt as s, Rt as t, tt as u, we as v, U as w, ve as x, q as y };
|
package/dist/testing/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as e } from "../lib-
|
|
1
|
+
import { v as e } from "../lib-CsaaxjyP.mjs";
|
|
2
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
3
3
|
import { RouterProvider as n, createMemoryRouter as r } from "react-router";
|
|
4
4
|
import { render as i, renderHook as a, screen as o } from "@testing-library/react";
|
|
@@ -6,7 +6,7 @@ import s from "@testing-library/user-event";
|
|
|
6
6
|
import { vi as c } from "vitest";
|
|
7
7
|
import { QueryClient as l, QueryClientProvider as u } from "@tanstack/react-query";
|
|
8
8
|
import { setupServer as d } from "msw/node";
|
|
9
|
-
|
|
9
|
+
// src/lib/testing/expectTooltipOnHover.ts
|
|
10
10
|
var f = async (e, t) => {
|
|
11
11
|
if (expect(o.queryByRole("tooltip", { name: t })).not.toBeInTheDocument(), !e) throw Error("expectTooltipOnHover: the element was null or undefined");
|
|
12
12
|
await s.hover(e), e.querySelector("i") && await s.hover(e.querySelector("i")), await c.waitFor(() => expect(o.getAllByRole("tooltip", { name: t })).toHaveLength(1));
|
|
@@ -108,5 +108,4 @@ var f = async (e, t) => {
|
|
|
108
108
|
c.clearAllMocks();
|
|
109
109
|
}), n;
|
|
110
110
|
}, y = async (e = "Loading", t) => await c.waitFor(() => expect(o.queryByText(new RegExp(e, "i"))).not.toBeInTheDocument(), t);
|
|
111
|
-
//#endregion
|
|
112
111
|
export { f as expectTooltipOnHover, p as mockIsPending, m as mockSidePanel, h as renderHookWithProviders, g as renderWithProviders, _ as setupMockServer, v as spyOnMutation, y as waitForLoading };
|
package/package.json
CHANGED