@postenbring/hedwig-react 0.0.70 → 0.0.72
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/dist/_tsup-dts-rollup.d.mts +89 -28
- package/dist/_tsup-dts-rollup.d.ts +89 -28
- package/dist/accordion/index.mjs +5 -5
- package/dist/{breadcrumb/index.js → breadcrumbs/breadcrumbs.js} +12 -11
- package/dist/breadcrumbs/breadcrumbs.js.map +1 -0
- package/dist/{breadcrumb/breadcrumb.mjs → breadcrumbs/breadcrumbs.mjs} +2 -2
- package/dist/{breadcrumb/breadcrumb.js → breadcrumbs/index.js} +14 -9
- package/dist/breadcrumbs/index.js.map +1 -0
- package/dist/breadcrumbs/index.mjs +9 -0
- package/dist/button/button.js +1 -4
- package/dist/button/button.js.map +1 -1
- package/dist/button/button.mjs +1 -1
- package/dist/button/index.js +1 -4
- package/dist/button/index.js.map +1 -1
- package/dist/button/index.mjs +1 -1
- package/dist/{chunk-XYIY6FHW.mjs → chunk-3FRCJ3RH.mjs} +7 -7
- package/dist/chunk-3LYJRAOC.mjs +1 -0
- package/dist/{chunk-O32FZU7E.mjs → chunk-BFNITN5E.mjs} +5 -5
- package/dist/{chunk-OUHO4LGN.mjs → chunk-BWFFP6BB.mjs} +2 -5
- package/dist/chunk-BWFFP6BB.mjs.map +1 -0
- package/dist/chunk-CFAH2LID.mjs +1 -0
- package/dist/{chunk-ZRFDCZ62.mjs → chunk-CSFSJGLY.mjs} +5 -5
- package/dist/{chunk-K2HG7WRK.mjs → chunk-CU56G5WS.mjs} +2 -2
- package/dist/chunk-E5O6ID3L.mjs +54 -0
- package/dist/chunk-E5O6ID3L.mjs.map +1 -0
- package/dist/chunk-EMI7NAO2.mjs +45 -0
- package/dist/chunk-EMI7NAO2.mjs.map +1 -0
- package/dist/chunk-GGEQEVZ4.mjs +22 -0
- package/dist/chunk-GGEQEVZ4.mjs.map +1 -0
- package/dist/chunk-HSIL53A5.mjs +118 -0
- package/dist/chunk-HSIL53A5.mjs.map +1 -0
- package/dist/chunk-ISAHCU7C.mjs +1 -0
- package/dist/chunk-ISAHCU7C.mjs.map +1 -0
- package/dist/chunk-JBWAZQKM.mjs +1 -0
- package/dist/chunk-JBWAZQKM.mjs.map +1 -0
- package/dist/{chunk-FOZSX44S.mjs → chunk-VM345XBI.mjs} +6 -6
- package/dist/chunk-Z753E3XF.mjs +33 -0
- package/dist/chunk-Z753E3XF.mjs.map +1 -0
- package/dist/description-list/description-list.d.mts +1 -1
- package/dist/description-list/description-list.d.ts +1 -1
- package/dist/description-list/description-list.js +19 -21
- package/dist/description-list/description-list.js.map +1 -1
- package/dist/description-list/description-list.mjs +1 -1
- package/dist/description-list/index.js +19 -21
- package/dist/description-list/index.js.map +1 -1
- package/dist/description-list/index.mjs +1 -1
- package/dist/footer/footer.js +1 -4
- package/dist/footer/footer.js.map +1 -1
- package/dist/footer/footer.mjs +5 -5
- package/dist/footer/index.js +1 -4
- package/dist/footer/index.js.map +1 -1
- package/dist/footer/index.mjs +6 -6
- package/dist/form/index.mjs +14 -14
- package/dist/help-text/help-text.d.mts +1 -0
- package/dist/help-text/help-text.d.ts +1 -0
- package/dist/help-text/help-text.js +186 -0
- package/dist/help-text/help-text.js.map +1 -0
- package/dist/help-text/help-text.mjs +10 -0
- package/dist/help-text/help-text.mjs.map +1 -0
- package/dist/help-text/index.d.mts +1 -0
- package/dist/help-text/index.d.ts +1 -0
- package/dist/help-text/index.js +188 -0
- package/dist/help-text/index.js.map +1 -0
- package/dist/help-text/index.mjs +11 -0
- package/dist/help-text/index.mjs.map +1 -0
- package/dist/index-no-css.d.mts +2 -0
- package/dist/index-no-css.d.ts +2 -0
- package/dist/index-no-css.js +414 -316
- package/dist/index-no-css.js.map +1 -1
- package/dist/index-no-css.mjs +113 -103
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +414 -316
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +113 -103
- package/dist/index.mjs.map +1 -1
- package/dist/layout/index.mjs +6 -6
- package/dist/navbar/index.mjs +5 -5
- package/dist/show-more/index.js +91 -39
- package/dist/show-more/index.js.map +1 -1
- package/dist/show-more/index.mjs +2 -1
- package/dist/table/index.d.mts +1 -0
- package/dist/table/index.d.ts +1 -0
- package/dist/table/index.js +94 -0
- package/dist/table/index.js.map +1 -0
- package/dist/table/index.mjs +9 -0
- package/dist/table/index.mjs.map +1 -0
- package/dist/table/table.d.mts +1 -0
- package/dist/table/table.d.ts +1 -0
- package/dist/table/table.js +92 -0
- package/dist/table/table.js.map +1 -0
- package/dist/table/table.mjs +8 -0
- package/dist/table/table.mjs.map +1 -0
- package/dist/tabs/index.mjs +5 -5
- package/dist/utilities/auto-animate-height.js +89 -37
- package/dist/utilities/auto-animate-height.js.map +1 -1
- package/dist/utilities/auto-animate-height.mjs +2 -1
- package/dist/utilities/index.js +89 -37
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/index.mjs +2 -1
- package/package.json +7 -6
- package/dist/breadcrumb/breadcrumb.js.map +0 -1
- package/dist/breadcrumb/index.js.map +0 -1
- package/dist/breadcrumb/index.mjs +0 -9
- package/dist/chunk-AKYK3XFN.mjs +0 -95
- package/dist/chunk-AKYK3XFN.mjs.map +0 -1
- package/dist/chunk-OUHO4LGN.mjs.map +0 -1
- package/dist/chunk-XMB45ILT.mjs +0 -35
- package/dist/chunk-XMB45ILT.mjs.map +0 -1
- package/dist/chunk-YKDKFWP2.mjs +0 -19
- package/dist/chunk-YKDKFWP2.mjs.map +0 -1
- package/dist/chunk-YWNVB7TY.mjs +0 -1
- package/dist/chunk-ZOCMUEOX.mjs +0 -1
- package/dist/{breadcrumb/breadcrumb.d.mts → breadcrumbs/breadcrumbs.d.mts} +1 -1
- package/dist/{breadcrumb/breadcrumb.d.ts → breadcrumbs/breadcrumbs.d.ts} +1 -1
- /package/dist/{breadcrumb/breadcrumb.mjs.map → breadcrumbs/breadcrumbs.mjs.map} +0 -0
- /package/dist/{breadcrumb → breadcrumbs}/index.d.mts +0 -0
- /package/dist/{breadcrumb → breadcrumbs}/index.d.ts +0 -0
- /package/dist/{breadcrumb → breadcrumbs}/index.mjs.map +0 -0
- /package/dist/{chunk-XYIY6FHW.mjs.map → chunk-3FRCJ3RH.mjs.map} +0 -0
- /package/dist/{chunk-YWNVB7TY.mjs.map → chunk-3LYJRAOC.mjs.map} +0 -0
- /package/dist/{chunk-O32FZU7E.mjs.map → chunk-BFNITN5E.mjs.map} +0 -0
- /package/dist/{chunk-ZOCMUEOX.mjs.map → chunk-CFAH2LID.mjs.map} +0 -0
- /package/dist/{chunk-ZRFDCZ62.mjs.map → chunk-CSFSJGLY.mjs.map} +0 -0
- /package/dist/{chunk-K2HG7WRK.mjs.map → chunk-CU56G5WS.mjs.map} +0 -0
- /package/dist/{chunk-FOZSX44S.mjs.map → chunk-VM345XBI.mjs.map} +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
var __export = (target, all) => {
|
|
36
|
+
for (var name in all)
|
|
37
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
38
|
+
};
|
|
39
|
+
var __copyProps = (to, from, except, desc) => {
|
|
40
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
+
for (let key of __getOwnPropNames(from))
|
|
42
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
43
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
44
|
+
}
|
|
45
|
+
return to;
|
|
46
|
+
};
|
|
47
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
|
+
|
|
49
|
+
// src/table/index.ts
|
|
50
|
+
var table_exports = {};
|
|
51
|
+
__export(table_exports, {
|
|
52
|
+
Table: () => Table
|
|
53
|
+
});
|
|
54
|
+
module.exports = __toCommonJS(table_exports);
|
|
55
|
+
|
|
56
|
+
// src/table/table.tsx
|
|
57
|
+
var import_typed_classname = require("@postenbring/hedwig-css/typed-classname");
|
|
58
|
+
var import_react = require("react");
|
|
59
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
60
|
+
var Table = (0, import_react.forwardRef)(
|
|
61
|
+
(_a, ref) => {
|
|
62
|
+
var _b = _a, { children, className, size, caption, description } = _b, rest = __objRest(_b, ["children", "className", "size", "caption", "description"]);
|
|
63
|
+
const descriptionId = (0, import_react.useId)();
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
65
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
66
|
+
"table",
|
|
67
|
+
__spreadProps(__spreadValues({
|
|
68
|
+
"aria-describedby": description ? descriptionId : void 0,
|
|
69
|
+
ref,
|
|
70
|
+
className: (0, import_typed_classname.clsx)(
|
|
71
|
+
"hds-table",
|
|
72
|
+
{
|
|
73
|
+
"hds-table--compressed": size === "compressed",
|
|
74
|
+
"hds-table--mobile-compressed": size === "mobile-compressed"
|
|
75
|
+
},
|
|
76
|
+
className
|
|
77
|
+
)
|
|
78
|
+
}, rest), {
|
|
79
|
+
children: [
|
|
80
|
+
caption ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("caption", { children: caption }) : null,
|
|
81
|
+
children
|
|
82
|
+
]
|
|
83
|
+
})
|
|
84
|
+
),
|
|
85
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: (0, import_typed_classname.clsx)("hds-table-description"), id: descriptionId, children: description }) : null
|
|
86
|
+
] });
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
Table.displayName = "Table";
|
|
90
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
+
0 && (module.exports = {
|
|
92
|
+
Table
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/table/index.ts","../../src/table/table.tsx"],"sourcesContent":["export { Table } from \"./table\";\nexport type * from \"./table\";\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, useId } from \"react\";\n\ninterface TableProps extends React.HTMLAttributes<HTMLTableElement> {\n className?: string;\n\n /**\n * Size of the table\n *\n * Use `compressed` for a more compact table, or `mobile-compressed` for a compact table on mobile screens only.\n */\n size?: \"default\" | \"compressed\" | \"mobile-compressed\";\n\n /**\n * The table caption\n *\n * You can also set this by passing `<caption>` as a first child of the table\n */\n caption?: React.ReactNode;\n\n /**\n * Optional description of the table displayed underneath the table\n *\n * Ensures the `aria-describedby` attribute is set on the table, making it accessible for screen readers.\n */\n description?: React.ReactNode;\n}\n\nexport const Table = forwardRef<HTMLTableElement, TableProps>(\n ({ children, className, size, caption, description, ...rest }, ref) => {\n const descriptionId = useId();\n return (\n <>\n <table\n aria-describedby={description ? descriptionId : undefined}\n ref={ref}\n className={clsx(\n \"hds-table\",\n {\n \"hds-table--compressed\": size === \"compressed\",\n \"hds-table--mobile-compressed\": size === \"mobile-compressed\",\n },\n className as undefined,\n )}\n {...rest}\n >\n {caption ? <caption>{caption}</caption> : null}\n {children}\n </table>\n {description ? (\n <p className={clsx(\"hds-table-description\")} id={descriptionId}>\n {description}\n </p>\n ) : null}\n </>\n );\n },\n);\nTable.displayName = \"Table\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,6BAAqB;AACrB,mBAAkC;AA+B5B;AAJC,IAAM,YAAQ;AAAA,EACnB,CAAC,IAA8D,QAAQ;AAAtE,iBAAE,YAAU,WAAW,MAAM,SAAS,YA7BzC,IA6BG,IAAsD,iBAAtD,IAAsD,CAApD,YAAU,aAAW,QAAM,WAAS;AACrC,UAAM,oBAAgB,oBAAM;AAC5B,WACE,4EACE;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,oBAAkB,cAAc,gBAAgB;AAAA,UAChD;AAAA,UACA,eAAW;AAAA,YACT;AAAA,YACA;AAAA,cACE,yBAAyB,SAAS;AAAA,cAClC,gCAAgC,SAAS;AAAA,YAC3C;AAAA,YACA;AAAA,UACF;AAAA,WACI,OAXL;AAAA,UAaE;AAAA,sBAAU,4CAAC,aAAS,mBAAQ,IAAa;AAAA,YACzC;AAAA;AAAA;AAAA,MACH;AAAA,MACC,cACC,4CAAC,OAAE,eAAW,6BAAK,uBAAuB,GAAG,IAAI,eAC9C,uBACH,IACE;AAAA,OACN;AAAA,EAEJ;AACF;AACA,MAAM,cAAc;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Table_alias_3 as Table } from '../_tsup-dts-rollup';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Table_alias_3 as Table } from '../_tsup-dts-rollup';
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __objRest = (source, exclude) => {
|
|
24
|
+
var target = {};
|
|
25
|
+
for (var prop in source)
|
|
26
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
27
|
+
target[prop] = source[prop];
|
|
28
|
+
if (source != null && __getOwnPropSymbols)
|
|
29
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
30
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
31
|
+
target[prop] = source[prop];
|
|
32
|
+
}
|
|
33
|
+
return target;
|
|
34
|
+
};
|
|
35
|
+
var __export = (target, all) => {
|
|
36
|
+
for (var name in all)
|
|
37
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
38
|
+
};
|
|
39
|
+
var __copyProps = (to, from, except, desc) => {
|
|
40
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
+
for (let key of __getOwnPropNames(from))
|
|
42
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
43
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
44
|
+
}
|
|
45
|
+
return to;
|
|
46
|
+
};
|
|
47
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
|
+
|
|
49
|
+
// src/table/table.tsx
|
|
50
|
+
var table_exports = {};
|
|
51
|
+
__export(table_exports, {
|
|
52
|
+
Table: () => Table
|
|
53
|
+
});
|
|
54
|
+
module.exports = __toCommonJS(table_exports);
|
|
55
|
+
var import_typed_classname = require("@postenbring/hedwig-css/typed-classname");
|
|
56
|
+
var import_react = require("react");
|
|
57
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
58
|
+
var Table = (0, import_react.forwardRef)(
|
|
59
|
+
(_a, ref) => {
|
|
60
|
+
var _b = _a, { children, className, size, caption, description } = _b, rest = __objRest(_b, ["children", "className", "size", "caption", "description"]);
|
|
61
|
+
const descriptionId = (0, import_react.useId)();
|
|
62
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
63
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
64
|
+
"table",
|
|
65
|
+
__spreadProps(__spreadValues({
|
|
66
|
+
"aria-describedby": description ? descriptionId : void 0,
|
|
67
|
+
ref,
|
|
68
|
+
className: (0, import_typed_classname.clsx)(
|
|
69
|
+
"hds-table",
|
|
70
|
+
{
|
|
71
|
+
"hds-table--compressed": size === "compressed",
|
|
72
|
+
"hds-table--mobile-compressed": size === "mobile-compressed"
|
|
73
|
+
},
|
|
74
|
+
className
|
|
75
|
+
)
|
|
76
|
+
}, rest), {
|
|
77
|
+
children: [
|
|
78
|
+
caption ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("caption", { children: caption }) : null,
|
|
79
|
+
children
|
|
80
|
+
]
|
|
81
|
+
})
|
|
82
|
+
),
|
|
83
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: (0, import_typed_classname.clsx)("hds-table-description"), id: descriptionId, children: description }) : null
|
|
84
|
+
] });
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
Table.displayName = "Table";
|
|
88
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
89
|
+
0 && (module.exports = {
|
|
90
|
+
Table
|
|
91
|
+
});
|
|
92
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/table/table.tsx"],"sourcesContent":["import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, useId } from \"react\";\n\ninterface TableProps extends React.HTMLAttributes<HTMLTableElement> {\n className?: string;\n\n /**\n * Size of the table\n *\n * Use `compressed` for a more compact table, or `mobile-compressed` for a compact table on mobile screens only.\n */\n size?: \"default\" | \"compressed\" | \"mobile-compressed\";\n\n /**\n * The table caption\n *\n * You can also set this by passing `<caption>` as a first child of the table\n */\n caption?: React.ReactNode;\n\n /**\n * Optional description of the table displayed underneath the table\n *\n * Ensures the `aria-describedby` attribute is set on the table, making it accessible for screen readers.\n */\n description?: React.ReactNode;\n}\n\nexport const Table = forwardRef<HTMLTableElement, TableProps>(\n ({ children, className, size, caption, description, ...rest }, ref) => {\n const descriptionId = useId();\n return (\n <>\n <table\n aria-describedby={description ? descriptionId : undefined}\n ref={ref}\n className={clsx(\n \"hds-table\",\n {\n \"hds-table--compressed\": size === \"compressed\",\n \"hds-table--mobile-compressed\": size === \"mobile-compressed\",\n },\n className as undefined,\n )}\n {...rest}\n >\n {caption ? <caption>{caption}</caption> : null}\n {children}\n </table>\n {description ? (\n <p className={clsx(\"hds-table-description\")} id={descriptionId}>\n {description}\n </p>\n ) : null}\n </>\n );\n },\n);\nTable.displayName = \"Table\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAqB;AACrB,mBAAkC;AA+B5B;AAJC,IAAM,YAAQ;AAAA,EACnB,CAAC,IAA8D,QAAQ;AAAtE,iBAAE,YAAU,WAAW,MAAM,SAAS,YA7BzC,IA6BG,IAAsD,iBAAtD,IAAsD,CAApD,YAAU,aAAW,QAAM,WAAS;AACrC,UAAM,oBAAgB,oBAAM;AAC5B,WACE,4EACE;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,oBAAkB,cAAc,gBAAgB;AAAA,UAChD;AAAA,UACA,eAAW;AAAA,YACT;AAAA,YACA;AAAA,cACE,yBAAyB,SAAS;AAAA,cAClC,gCAAgC,SAAS;AAAA,YAC3C;AAAA,YACA;AAAA,UACF;AAAA,WACI,OAXL;AAAA,UAaE;AAAA,sBAAU,4CAAC,aAAS,mBAAQ,IAAa;AAAA,YACzC;AAAA;AAAA;AAAA,MACH;AAAA,MACC,cACC,4CAAC,OAAE,eAAW,6BAAK,uBAAuB,GAAG,IAAI,eAC9C,uBACH,IACE;AAAA,OACN;AAAA,EAEJ;AACF;AACA,MAAM,cAAc;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/tabs/index.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TabsComponent
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import {
|
|
5
|
-
TabsContent,
|
|
6
|
-
TabsContents
|
|
7
|
-
} from "../chunk-UWTGHSWT.mjs";
|
|
3
|
+
} from "../chunk-CSFSJGLY.mjs";
|
|
8
4
|
import {
|
|
9
5
|
TabsList,
|
|
10
6
|
TabsTab
|
|
11
7
|
} from "../chunk-B56JZJOS.mjs";
|
|
12
8
|
import "../chunk-XVFQWVHO.mjs";
|
|
9
|
+
import {
|
|
10
|
+
TabsContent,
|
|
11
|
+
TabsContents
|
|
12
|
+
} from "../chunk-UWTGHSWT.mjs";
|
|
13
13
|
import "../chunk-KQITCS3U.mjs";
|
|
14
14
|
import "../chunk-ZL56N4UK.mjs";
|
|
15
15
|
import "../chunk-R4SQKVDQ.mjs";
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __defProps = Object.defineProperties;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
8
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
11
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
12
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -44,6 +46,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
44
46
|
}
|
|
45
47
|
return to;
|
|
46
48
|
};
|
|
49
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
+
mod
|
|
56
|
+
));
|
|
47
57
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
48
58
|
|
|
49
59
|
// src/utilities/auto-animate-height.tsx
|
|
@@ -52,67 +62,109 @@ __export(auto_animate_height_exports, {
|
|
|
52
62
|
AutoAnimateHeight: () => AutoAnimateHeight
|
|
53
63
|
});
|
|
54
64
|
module.exports = __toCommonJS(auto_animate_height_exports);
|
|
65
|
+
var import_react2 = require("react");
|
|
66
|
+
|
|
67
|
+
// src/utils.ts
|
|
68
|
+
var React = __toESM(require("react"));
|
|
55
69
|
var import_react = require("react");
|
|
56
|
-
|
|
70
|
+
function useMergeRefs(refs) {
|
|
71
|
+
return React.useMemo(() => {
|
|
72
|
+
if (refs.every((ref) => ref === null)) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
return (value) => {
|
|
76
|
+
refs.forEach((ref) => {
|
|
77
|
+
if (typeof ref === "function") {
|
|
78
|
+
ref(value);
|
|
79
|
+
} else if (ref !== null) {
|
|
80
|
+
ref.current = value;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
}, refs);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// src/utilities/auto-animate-height.tsx
|
|
57
88
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
58
|
-
var
|
|
59
|
-
quick: 100,
|
|
60
|
-
normal: 300,
|
|
61
|
-
slow: 700
|
|
62
|
-
};
|
|
63
|
-
var AutoAnimateHeight = (0, import_react.forwardRef)(
|
|
89
|
+
var AutoAnimateHeight = (0, import_react2.forwardRef)(
|
|
64
90
|
(_a, ref) => {
|
|
65
91
|
var _b = _a, {
|
|
66
92
|
as: Component = "div",
|
|
67
93
|
children,
|
|
68
94
|
style,
|
|
69
95
|
animationDuration = "quick",
|
|
70
|
-
animationEasing = "normal"
|
|
96
|
+
animationEasing = "normal",
|
|
97
|
+
onTransitionEnd
|
|
71
98
|
} = _b, rest = __objRest(_b, [
|
|
72
99
|
"as",
|
|
73
100
|
"children",
|
|
74
101
|
"style",
|
|
75
102
|
"animationDuration",
|
|
76
|
-
"animationEasing"
|
|
103
|
+
"animationEasing",
|
|
104
|
+
"onTransitionEnd"
|
|
77
105
|
]);
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
|
|
106
|
+
var _a2, _b2;
|
|
107
|
+
const rootRef = (0, import_react2.useRef)(null);
|
|
108
|
+
const mergedRef = useMergeRefs([rootRef, ref]);
|
|
109
|
+
const measurementRef = (0, import_react2.useRef)(null);
|
|
110
|
+
const [height, setHeight] = (0, import_react2.useState)(
|
|
111
|
+
void 0
|
|
83
112
|
);
|
|
84
|
-
(0,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
113
|
+
const [clonedChildren, setClonedChildren] = (0, import_react2.useState)(
|
|
114
|
+
() => (0, import_react2.cloneElement)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children }), {})
|
|
115
|
+
);
|
|
116
|
+
(0, import_react2.useEffect)(() => {
|
|
117
|
+
var _a3;
|
|
118
|
+
if (!rootRef.current)
|
|
119
|
+
return;
|
|
120
|
+
if (!measurementRef.current)
|
|
121
|
+
return;
|
|
122
|
+
if (document.body.scrollHeight === 0)
|
|
123
|
+
return;
|
|
124
|
+
const currentMeasurement = measurementRef.current;
|
|
125
|
+
const { height: newHeight } = currentMeasurement.getBoundingClientRect();
|
|
126
|
+
let previouslyObservedHeight = newHeight;
|
|
127
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
128
|
+
const { height: resizedHeight } = currentMeasurement.getBoundingClientRect();
|
|
129
|
+
if (resizedHeight === previouslyObservedHeight)
|
|
130
|
+
return;
|
|
131
|
+
previouslyObservedHeight = resizedHeight;
|
|
132
|
+
setHeight({ height: resizedHeight, shouldAnimate: false });
|
|
133
|
+
});
|
|
134
|
+
resizeObserver.observe(currentMeasurement);
|
|
135
|
+
setHeight({ height: newHeight, shouldAnimate: true });
|
|
136
|
+
const nextClonedChildren = (0, import_react2.cloneElement)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children }), {});
|
|
137
|
+
if (newHeight >= ((_a3 = height == null ? void 0 : height.height) != null ? _a3 : 0)) {
|
|
138
|
+
setClonedChildren(nextClonedChildren);
|
|
139
|
+
return () => {
|
|
140
|
+
resizeObserver.disconnect();
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
const currentRoot = rootRef.current;
|
|
144
|
+
function onTransitionEndHandler(e) {
|
|
145
|
+
if (e.propertyName !== "height")
|
|
146
|
+
return;
|
|
147
|
+
setClonedChildren(nextClonedChildren);
|
|
103
148
|
}
|
|
149
|
+
currentRoot.addEventListener("transitionend", onTransitionEndHandler);
|
|
150
|
+
return () => {
|
|
151
|
+
resizeObserver.disconnect();
|
|
152
|
+
currentRoot.removeEventListener("transitionend", onTransitionEndHandler);
|
|
153
|
+
};
|
|
104
154
|
}, [children]);
|
|
105
155
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
106
156
|
Component,
|
|
107
157
|
__spreadProps(__spreadValues({
|
|
108
|
-
ref,
|
|
158
|
+
ref: mergedRef,
|
|
159
|
+
onTransitionEnd,
|
|
109
160
|
style: __spreadValues({
|
|
110
161
|
position: "relative",
|
|
111
162
|
overflow: "hidden",
|
|
112
|
-
height,
|
|
113
|
-
transitionProperty: "height",
|
|
163
|
+
height: (_b2 = height == null ? void 0 : height.height) != null ? _b2 : (_a2 = measurementRef.current) == null ? void 0 : _a2.getBoundingClientRect().height,
|
|
164
|
+
transitionProperty: (height == null ? void 0 : height.shouldAnimate) ? "height" : "none",
|
|
114
165
|
transitionDuration: `var(--hds-micro-animation-duration-${animationDuration})`,
|
|
115
|
-
transitionTimingFunction: `var(--hds-micro-animation-easing-${animationEasing})
|
|
166
|
+
transitionTimingFunction: `var(--hds-micro-animation-easing-${animationEasing})`,
|
|
167
|
+
willChange: "height"
|
|
116
168
|
}, style)
|
|
117
169
|
}, rest), {
|
|
118
170
|
children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/auto-animate-height.tsx"],"sourcesContent":["import { cloneElement, forwardRef, useEffect, useRef, useState } from \"react\";\nimport { flushSync } from \"react-dom\";\nimport type { OverridableComponent } from \"../utils\";\n\nconst animationDurationToValue = {\n quick: 100,\n normal: 300,\n slow: 700,\n};\n\nexport interface AutoAnimateHeightProps {\n /**\n * Time of the animation, using the hedwig animation tokens\n * quick: 0.1s\n * normal: 0.3s\n * slow: 0.7s\n *\n * default is \"quick\"\n */\n animationDuration?: \"quick\" | \"normal\" | \"slow\";\n\n /**\n * Which hedwig easing function to use, default is \"normal\"\n */\n animationEasing?: \"in\" | \"out\" | \"normal\";\n children: React.ReactNode;\n style?: React.CSSProperties;\n}\n\n/**\n * Helper component to animate the height of the children when they change\n * It's done by rendering two versions of the passed children,\n * one hidden to measure the height and one visible to only changes after the height is measured.\n *\n * **IMPORTANT** Do not pass any components with effects (like data fetching), as they will trigger twice.\n */\nexport const AutoAnimateHeight: OverridableComponent<AutoAnimateHeightProps, HTMLDivElement> =\n forwardRef(\n (\n {\n as: Component = \"div\",\n children,\n style,\n animationDuration = \"quick\",\n animationEasing = \"normal\",\n ...rest\n },\n ref,\n ) => {\n const timeoutRef = useRef<NodeJS.Timeout | null>(null);\n const measurementRef = useRef<HTMLDivElement>(null);\n const [height, setHeight] = useState<number | undefined>(undefined);\n const [clonedChildren, setClonedChildren] = useState<React.ReactNode>(() =>\n cloneElement(<>{children}</>, {}),\n );\n useEffect(() => {\n if (measurementRef.current) {\n const { height: newHeight } = measurementRef.current.getBoundingClientRect();\n\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n if (newHeight < (height ?? 0)) {\n // If the children are shrinking, hold off on replacing until the animation is done\n // This way we don't get a sudden flash of empty content\n setTimeout(() => {\n flushSync(() => {\n setHeight(newHeight);\n });\n timeoutRef.current = setTimeout(() => {\n setClonedChildren(cloneElement(<>{children}</>, {}));\n }, animationDurationToValue[animationDuration]);\n });\n } else {\n setHeight(newHeight);\n setClonedChildren(cloneElement(<>{children}</>, {}));\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- I know better\n }, [children]);\n\n return (\n <Component\n ref={ref}\n style={{\n position: \"relative\",\n overflow: \"hidden\",\n height,\n transitionProperty: \"height\",\n transitionDuration: `var(--hds-micro-animation-duration-${animationDuration})`,\n transitionTimingFunction: `var(--hds-micro-animation-easing-${animationEasing})`,\n ...style,\n }}\n {...rest}\n >\n <div\n aria-hidden\n ref={measurementRef}\n style={{\n position: \"absolute\",\n visibility: \"hidden\",\n }}\n >\n {children}\n </div>\n {clonedChild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AK,CAAC,CAAC,CAAC;AAAA,QACrD;AAAA,MACF;AAAA,IAEF,GAAG,CAAC,QAAQ,CAAC;AAEb,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,OAAO;AAAA,UACL,UAAU;AAAA,UACV,UAAU;AAAA,UACV;AAAA,UACA,oBAAoB;AAAA,UACpB,oBAAoB,sCAAsC,iBAAiB;AAAA,UAC3E,0BAA0B,oCAAoC,eAAe;AAAA,WAC1E;AAAA,SAED,OAXL;AAAA,QAaC;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,eAAW;AAAA,cACX,KAAK;AAAA,cACL,OAAO;AAAA,gBACL,UAAU;AAAA,gBACV,YAAY;AAAA,cACd;AAAA,cAEC;AAAA;AAAA,UACH;AAAA,UACC;AAAA;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACF,kBAAkB,cAAc;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/auto-animate-height.tsx","../../src/utils.ts"],"sourcesContent":["import { cloneElement, forwardRef, useEffect, useRef, useState } from \"react\";\nimport { useMergeRefs, type OverridableComponent } from \"../utils\";\n\nexport interface AutoAnimateHeightProps {\n /**\n * Time of the animation, using the hedwig animation tokens\n * quick: 0.1s\n * normal: 0.3s\n * slow: 0.7s\n *\n * default is \"quick\"\n */\n animationDuration?: \"quick\" | \"normal\" | \"slow\";\n\n /**\n * Callback fired when animiation transition ends\n * Use this to do effects after resizing is done, e.g. scrolling to the element\n * using `element.scrollIntoView()`\n */\n onTransitionEnd?: () => void;\n\n /**\n * Which hedwig easing function to use, default is \"normal\"\n */\n animationEasing?: \"in\" | \"out\" | \"normal\";\n children: React.ReactNode;\n style?: React.CSSProperties;\n}\n\n/**\n * Helper component to animate the height of the children when they change\n * It's done by rendering two versions of the passed children,\n * one hidden to measure the height and one visible to only changes after the height is measured.\n *\n * **IMPORTANT** Do not pass any components with effects (like data fetching), as they will trigger twice.\n */\nexport const AutoAnimateHeight: OverridableComponent<AutoAnimateHeightProps, HTMLDivElement> =\n forwardRef(\n (\n {\n as: Component = \"div\",\n children,\n style,\n animationDuration = \"quick\",\n animationEasing = \"normal\",\n onTransitionEnd,\n ...rest\n },\n ref,\n ) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs([rootRef, ref]);\n const measurementRef = useRef<HTMLDivElement>(null);\n const [height, setHeight] = useState<{ height: number; shouldAnimate: boolean } | undefined>(\n undefined,\n );\n const [clonedChildren, setClonedChildren] = useState<React.ReactNode>(() =>\n cloneElement(<>{children}</>, {}),\n );\n\n useEffect(() => {\n if (!rootRef.current) return;\n if (!measurementRef.current) return;\n if (document.body.scrollHeight === 0) return;\n const currentMeasurement = measurementRef.current;\n const { height: newHeight } = currentMeasurement.getBoundingClientRect();\n\n // Listen for resize events on the measurement element\n // Keep the children in sync with the height\n // But don't animate it.\n let previouslyObservedHeight = newHeight;\n const resizeObserver = new ResizeObserver(() => {\n const { height: resizedHeight } = currentMeasurement.getBoundingClientRect();\n if (resizedHeight === previouslyObservedHeight) return;\n previouslyObservedHeight = resizedHeight;\n setHeight({ height: resizedHeight, shouldAnimate: false });\n });\n resizeObserver.observe(currentMeasurement); // This is cleaned up down below in the return functions\n\n // Set the new height when children changes\n setHeight({ height: newHeight, shouldAnimate: true });\n\n // Update children\n const nextClonedChildren = cloneElement(<>{children}</>, {});\n\n // When increasing in height update immediately so the new content is shown during the animation\n if (newHeight >= (height?.height ?? 0)) {\n setClonedChildren(nextClonedChildren);\n return () => {\n resizeObserver.disconnect();\n };\n }\n\n // When decreasing in height, wait until the animation is done so that we don't get a sudden flash of empty content\n const currentRoot = rootRef.current;\n function onTransitionEndHandler(e: TransitionEvent) {\n if (e.propertyName !== \"height\") return;\n setClonedChildren(nextClonedChildren);\n }\n currentRoot.addEventListener(\"transitionend\", onTransitionEndHandler);\n return () => {\n resizeObserver.disconnect();\n currentRoot.removeEventListener(\"transitionend\", onTransitionEndHandler);\n };\n\n // eslint-disable-next-line react-hooks/exhaustive-deps -- I know better\n }, [children]);\n\n return (\n <Component\n ref={mergedRef}\n onTransitionEnd={onTransitionEnd}\n style={{\n position: \"relative\",\n overflow: \"hidden\",\n height: height?.height ?? measurementRef.current?.getBoundingClientRect().height,\n transitionProperty: height?.shouldAnimate ? \"height\" : \"none\",\n transitionDuration: `var(--hds-micro-animation-duration-${animationDuration})`,\n transitionTimingFunction: `var(--hds-micro-animation-easing-${animationEasing})`,\n willChange: \"height\",\n ...style,\n }}\n {...rest}\n >\n <div\n aria-hidden\n ref={measurementRef}\n style={{\n position: \"absolute\",\n visibility: \"hidden\",\n }}\n >\n {children}\n </div>\n {clonedChildren}\n </Component>\n );\n },\n );\nAutoAnimateHeight.displayName = \"AutoAnimateHeight\";\n","import type { ComponentPropsWithRef, ElementType, FC, RefAttributes } from \"react\";\nimport * as React from \"react\";\nimport { useCallback, useEffect, useState } from \"react\";\n\n/**\n * OverridableComponent makes the `as` prop available,\n * to be used to override the html element being used for a component\n *\n * Taken from digdir design system: https://github.com/digdir/designsystem/blob/main/packages/react/src/types/OverridableComponent.ts\n */\nexport type OverridableComponent<ComponentProps, Element extends HTMLElement> = {\n (props: ComponentProps & RefAttributes<Element>): ReturnType<FC>;\n\n <As extends ElementType>(\n props: {\n /** Override html element */\n as?: As;\n } & ComponentProps &\n Omit<ComponentPropsWithRef<As>, keyof ComponentProps>,\n ): ReturnType<FC>;\n} & Pick<FC, \"displayName\">;\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAAsE;;;ACCtE,YAAuB;AACvB,mBAAiD;AAwB1C,SAAS,aACd,MACoC;AACpC,SAAa,cAAQ,MAAM;AACzB,QAAI,KAAK,MAAM,CAAC,QAAQ,QAAQ,IAAI,GAAG;AACrC,aAAO;AAAA,IACT;AAEA,WAAO,CAAC,UAAU;AAChB,WAAK,QAAQ,CAAC,QAAQ;AACpB,YAAI,OAAO,QAAQ,YAAY;AAC7B,cAAI,KAAK;AAAA,QACX,WAAW,QAAQ,MAAM;AACvB,UAAC,IAAgD,UAAU;AAAA,QAC7D;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EAEF,GAAG,IAAI;AACT;;;ADYqB;AArBd,IAAM,wBACX;AAAA,EACE,CACE,IASA,QACG;AAVH,iBACE;AAAA,UAAI,YAAY;AAAA,MAChB;AAAA,MACA;AAAA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