@trackunit/react-components 1.22.21 → 1.22.23
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/index.cjs.js +41 -1
- package/index.esm.js +41 -1
- package/package.json +5 -5
- package/src/common/PackageNameStoryComponent.d.ts +1 -0
package/index.cjs.js
CHANGED
|
@@ -329,11 +329,51 @@ const Tag = ({ className, "data-testid": dataTestId, children, size = "medium",
|
|
|
329
329
|
}), "data-testid": dataTestId, onMouseEnter: onMouseEnter, ref: ref, style: style, children: [icon !== null && icon !== undefined && size === "medium" ? (jsxRuntime.jsx("div", { className: cvaTagIconContainer(), "data-slot": "icon", children: icon })) : null, jsxRuntime.jsx("span", { className: cvaTagText({ truncate: shouldTruncate }), ref: textRef, children: children }), Boolean(onClickClose) && isSupportedDismissColor && size === "medium" && !disabled ? (jsxRuntime.jsx("div", { className: cvaTagIconContainer(), "data-slot": "dismiss", onClick: onClickClose, children: jsxRuntime.jsx(Icon, { className: cvaTagIcon(), "data-testid": dataTestId + "Icon", name: "XCircle", size: "small", style: { WebkitTransition: "-webkit-transform 0.150s" }, type: "solid" }) })) : null] }));
|
|
330
330
|
};
|
|
331
331
|
|
|
332
|
+
// Mirrors the slug logic in @trackunit/storybook-docs-components SectionName so anchors line up
|
|
333
|
+
// with the headings on the "Libraries" overview page
|
|
334
|
+
// (e.g. "@trackunit/react-components" -> "trackunitreactcomponents").
|
|
335
|
+
const toLibrarySlug = (name) => name
|
|
336
|
+
.replace(/[^a-zA-Z ]/g, "")
|
|
337
|
+
.toLowerCase()
|
|
338
|
+
.split(" ")
|
|
339
|
+
.join("-");
|
|
340
|
+
// Builds an absolute URL to the "Libraries" docs page anchored at the given slug,
|
|
341
|
+
// resolved against the parent Storybook manager (not the story preview iframe).
|
|
342
|
+
// Returning a real absolute URL means "open in new tab" / cmd+click / middle-click
|
|
343
|
+
// land on the correct page instead of the bare iframe.
|
|
344
|
+
const buildLibraryHref = (slug) => {
|
|
345
|
+
const top = typeof window !== "undefined" ? window.top : null;
|
|
346
|
+
if (!top)
|
|
347
|
+
return undefined;
|
|
348
|
+
try {
|
|
349
|
+
const url = new URL(top.location.href);
|
|
350
|
+
url.searchParams.set("path", "/docs/libraries--docs");
|
|
351
|
+
url.hash = slug;
|
|
352
|
+
return url.toString();
|
|
353
|
+
}
|
|
354
|
+
catch {
|
|
355
|
+
return undefined;
|
|
356
|
+
}
|
|
357
|
+
};
|
|
332
358
|
/**
|
|
333
359
|
* A component used to display the package name and version in the Storybook docs.
|
|
360
|
+
* The package-name tag links to the matching section on the "Libraries" overview page.
|
|
334
361
|
*/
|
|
335
362
|
const PackageNameStoryComponent = ({ packageJSON }) => {
|
|
336
|
-
|
|
363
|
+
const name = packageJSON?.name;
|
|
364
|
+
const slug = name ? toLibrarySlug(name) : undefined;
|
|
365
|
+
const href = slug ? buildLibraryHref(slug) : undefined;
|
|
366
|
+
const onClick = (event) => {
|
|
367
|
+
if (!href)
|
|
368
|
+
return;
|
|
369
|
+
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
|
|
370
|
+
return;
|
|
371
|
+
event.preventDefault();
|
|
372
|
+
const top = window.top;
|
|
373
|
+
if (top)
|
|
374
|
+
top.location.href = href;
|
|
375
|
+
};
|
|
376
|
+
return (jsxRuntime.jsxs("div", { className: "flex gap-2", children: [href ? (jsxRuntime.jsx("a", { "aria-label": `Learn more about ${name}`, className: "no-underline", href: href, onClick: onClick, target: "_top", title: `Learn more about ${name}`, children: jsxRuntime.jsx(Tag, { color: "neutral", children: name }) })) : (jsxRuntime.jsx(Tag, { color: "neutral", children: name })), packageJSON?.version ? jsxRuntime.jsxs(Tag, { color: "neutral", children: ["v", packageJSON.version] }) : null] }));
|
|
337
377
|
};
|
|
338
378
|
|
|
339
379
|
const docs = {
|
package/index.esm.js
CHANGED
|
@@ -327,11 +327,51 @@ const Tag = ({ className, "data-testid": dataTestId, children, size = "medium",
|
|
|
327
327
|
}), "data-testid": dataTestId, onMouseEnter: onMouseEnter, ref: ref, style: style, children: [icon !== null && icon !== undefined && size === "medium" ? (jsx("div", { className: cvaTagIconContainer(), "data-slot": "icon", children: icon })) : null, jsx("span", { className: cvaTagText({ truncate: shouldTruncate }), ref: textRef, children: children }), Boolean(onClickClose) && isSupportedDismissColor && size === "medium" && !disabled ? (jsx("div", { className: cvaTagIconContainer(), "data-slot": "dismiss", onClick: onClickClose, children: jsx(Icon, { className: cvaTagIcon(), "data-testid": dataTestId + "Icon", name: "XCircle", size: "small", style: { WebkitTransition: "-webkit-transform 0.150s" }, type: "solid" }) })) : null] }));
|
|
328
328
|
};
|
|
329
329
|
|
|
330
|
+
// Mirrors the slug logic in @trackunit/storybook-docs-components SectionName so anchors line up
|
|
331
|
+
// with the headings on the "Libraries" overview page
|
|
332
|
+
// (e.g. "@trackunit/react-components" -> "trackunitreactcomponents").
|
|
333
|
+
const toLibrarySlug = (name) => name
|
|
334
|
+
.replace(/[^a-zA-Z ]/g, "")
|
|
335
|
+
.toLowerCase()
|
|
336
|
+
.split(" ")
|
|
337
|
+
.join("-");
|
|
338
|
+
// Builds an absolute URL to the "Libraries" docs page anchored at the given slug,
|
|
339
|
+
// resolved against the parent Storybook manager (not the story preview iframe).
|
|
340
|
+
// Returning a real absolute URL means "open in new tab" / cmd+click / middle-click
|
|
341
|
+
// land on the correct page instead of the bare iframe.
|
|
342
|
+
const buildLibraryHref = (slug) => {
|
|
343
|
+
const top = typeof window !== "undefined" ? window.top : null;
|
|
344
|
+
if (!top)
|
|
345
|
+
return undefined;
|
|
346
|
+
try {
|
|
347
|
+
const url = new URL(top.location.href);
|
|
348
|
+
url.searchParams.set("path", "/docs/libraries--docs");
|
|
349
|
+
url.hash = slug;
|
|
350
|
+
return url.toString();
|
|
351
|
+
}
|
|
352
|
+
catch {
|
|
353
|
+
return undefined;
|
|
354
|
+
}
|
|
355
|
+
};
|
|
330
356
|
/**
|
|
331
357
|
* A component used to display the package name and version in the Storybook docs.
|
|
358
|
+
* The package-name tag links to the matching section on the "Libraries" overview page.
|
|
332
359
|
*/
|
|
333
360
|
const PackageNameStoryComponent = ({ packageJSON }) => {
|
|
334
|
-
|
|
361
|
+
const name = packageJSON?.name;
|
|
362
|
+
const slug = name ? toLibrarySlug(name) : undefined;
|
|
363
|
+
const href = slug ? buildLibraryHref(slug) : undefined;
|
|
364
|
+
const onClick = (event) => {
|
|
365
|
+
if (!href)
|
|
366
|
+
return;
|
|
367
|
+
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
|
|
368
|
+
return;
|
|
369
|
+
event.preventDefault();
|
|
370
|
+
const top = window.top;
|
|
371
|
+
if (top)
|
|
372
|
+
top.location.href = href;
|
|
373
|
+
};
|
|
374
|
+
return (jsxs("div", { className: "flex gap-2", children: [href ? (jsx("a", { "aria-label": `Learn more about ${name}`, className: "no-underline", href: href, onClick: onClick, target: "_top", title: `Learn more about ${name}`, children: jsx(Tag, { color: "neutral", children: name }) })) : (jsx(Tag, { color: "neutral", children: name })), packageJSON?.version ? jsxs(Tag, { color: "neutral", children: ["v", packageJSON.version] }) : null] }));
|
|
335
375
|
};
|
|
336
376
|
|
|
337
377
|
const docs = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-components",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.23",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"@floating-ui/react": "^0.26.25",
|
|
14
14
|
"string-ts": "^2.0.0",
|
|
15
15
|
"tailwind-merge": "^2.0.0",
|
|
16
|
-
"@trackunit/ui-design-tokens": "1.11.
|
|
17
|
-
"@trackunit/css-class-variance-utilities": "1.11.
|
|
18
|
-
"@trackunit/shared-utils": "1.13.
|
|
19
|
-
"@trackunit/ui-icons": "1.11.
|
|
16
|
+
"@trackunit/ui-design-tokens": "1.11.112",
|
|
17
|
+
"@trackunit/css-class-variance-utilities": "1.11.115",
|
|
18
|
+
"@trackunit/shared-utils": "1.13.115",
|
|
19
|
+
"@trackunit/ui-icons": "1.11.111",
|
|
20
20
|
"es-toolkit": "^1.39.10",
|
|
21
21
|
"@tanstack/react-virtual": "3.13.12",
|
|
22
22
|
"dequal": "^2.0.3",
|
|
@@ -7,6 +7,7 @@ interface PackageNameStoryComponentProps {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* A component used to display the package name and version in the Storybook docs.
|
|
10
|
+
* The package-name tag links to the matching section on the "Libraries" overview page.
|
|
10
11
|
*/
|
|
11
12
|
export declare const PackageNameStoryComponent: ({ packageJSON }: PackageNameStoryComponentProps) => ReactElement;
|
|
12
13
|
export {};
|