@node-core/ui-components 1.5.4 → 1.5.6
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/Common/Banner/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import styles from './index.module.css';
|
|
3
|
-
const Banner = ({ type = 'default', children, }) => (_jsx("
|
|
3
|
+
const Banner = ({ type = 'default', children, ...props }) => (_jsx("section", { className: `${styles.banner} ${styles[type] || styles.default}`, ...props, children: children }));
|
|
4
4
|
export default Banner;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import styles from './index.module.css';
|
|
4
|
+
const depthClasses = {
|
|
5
|
+
3: styles.depthThree,
|
|
6
|
+
4: styles.depthFour,
|
|
7
|
+
};
|
|
8
|
+
const TableOfContents = ({ headings, summaryTitle, minDepth = 2, className, maxDepth = 4, as: Component = 'a', ...props }) => {
|
|
9
|
+
const filteredHeadings = headings.filter(({ depth }) => depth >= minDepth && depth <= maxDepth);
|
|
10
|
+
return (_jsxs("details", { className: classNames(styles.details, className), ...props, children: [_jsx("summary", { className: styles.summary, children: summaryTitle }), _jsx("ul", { className: styles.list, children: filteredHeadings.map((head, index) => (_jsx("li", { children: _jsx(Component, { href: head.data?.id && `#${head.data.id}`, className: classNames(styles.link, depthClasses[head.depth]), children: head.value }) }, head.data?.id ?? index))) })] }));
|
|
11
|
+
};
|
|
12
|
+
export default TableOfContents;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! tailwindcss v4.1.18 | MIT License | https://tailwindcss.com */
|
|
2
|
+
.details{margin-block:calc(var(--spacing,.25rem)*2);border-radius:var(--radius-md,.375rem);background-color:var(--color-neutral-200,#e9edf0);display:block}@media (min-width:64rem){.details{display:none}}.details:where([data-theme=dark],[data-theme=dark] *){background-color:var(--color-neutral-900,#2c3437)}.details .summary{padding-inline:calc(var(--spacing,.25rem)*4);padding-block:calc(var(--spacing,.25rem)*2)}:where(.details .list>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing,.25rem)*1*var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing,.25rem)*1*(1 - var(--tw-space-y-reverse)))}.details .list{padding-inline:calc(var(--spacing,.25rem)*4);padding-bottom:calc(var(--spacing,.25rem)*2)}.details .link{font-size:var(--text-sm,.875rem);line-height:var(--tw-leading,var(--text-sm--line-height,1.42857));--tw-font-weight:var(--font-weight-semibold,600);font-weight:var(--font-weight-semibold,600);color:var(--color-neutral-900,#2c3437);text-decoration-line:underline}@media (hover:hover){.details .link:hover{color:var(--color-neutral-700,#6e7b83)}}.details .link:where([data-theme=dark],[data-theme=dark] *){color:var(--color-white,#fff)}@media (hover:hover){.details .link:where([data-theme=dark],[data-theme=dark] *):hover{color:var(--color-neutral-500,#b1bcc2)}}.details .depthThree{padding-left:calc(var(--spacing,.25rem)*2)}.details .depthFour{padding-left:calc(var(--spacing,.25rem)*4)}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-font-weight{syntax:"*";inherits:false}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment, useMemo } from 'react';
|
|
3
3
|
import styles from './index.module.css';
|
|
4
|
-
const MetaBar = ({ items, headings, as: Component = 'a', heading, }) => {
|
|
4
|
+
const MetaBar = ({ items, headings, as: Component = 'a', heading, ...props }) => {
|
|
5
5
|
// The default depth of headings to display in the table of contents.
|
|
6
6
|
const { minDepth = 2, items: headingItems = [] } = headings || {};
|
|
7
7
|
const filteredHeadings = useMemo(() => headingItems.filter(({ depth }) => depth >= minDepth && depth <= 4), [minDepth, headingItems]);
|
|
8
|
-
return (_jsx("
|
|
8
|
+
return (_jsx("aside", { className: styles.wrapper, ...props, children: _jsxs("dl", { children: [Object.entries(items)
|
|
9
9
|
.filter(([, value]) => !!value)
|
|
10
10
|
.map(([key, value]) => (_jsxs(Fragment, { children: [_jsx("dt", { children: key }), _jsx("dd", { children: value })] }, key))), filteredHeadings.length > 0 && (_jsxs(_Fragment, { children: [_jsx("dt", { children: heading }), _jsx("dd", { children: _jsx("ol", { children: filteredHeadings.map(head => (_jsx("li", { className: head.depth === 3 ? 'pl-2' : head.depth === 4 ? 'pl-4' : '', children: _jsxs(Component, { href: `#${head.data?.id}`, children: [' ', head.value] }) }, head.data?.id))) }) })] }))] }) }));
|
|
11
11
|
};
|