@sqrzro/ui 4.0.0-alpha.25 → 4.0.0-alpha.27
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/components/buttons/ActionButton/index.d.ts +4 -2
- package/dist/components/buttons/ActionButton/index.js +2 -2
- package/dist/components/buttons/Button/index.js +1 -1
- package/dist/components/collections/DataTable/index.d.ts +3 -3
- package/dist/components/collections/DataTable/index.js +5 -1
- package/dist/components/collections/List/index.d.ts +3 -2
- package/dist/components/collections/List/index.js +4 -5
- package/dist/components/collections/ListItem/index.d.ts +1 -1
- package/dist/components/collections/ListItem/index.js +3 -3
- package/dist/components/collections/ListItemMenu/index.js +1 -1
- package/dist/components/collections/ListItemMeta/index.d.ts +2 -2
- package/dist/components/collections/ListItemMeta/index.js +1 -1
- package/dist/components/collections/Pagination/index.js +1 -1
- package/dist/components/collections/PaginationLink/index.js +1 -1
- package/dist/components/collections/interfaces.d.ts +3 -7
- package/dist/components/elements/Badge/index.d.ts +12 -0
- package/dist/components/elements/Badge/index.js +8 -0
- package/dist/components/elements/InfoPanel/index.d.ts +11 -0
- package/dist/components/elements/InfoPanel/index.js +8 -0
- package/dist/components/elements/Menu/index.d.ts +18 -0
- package/dist/components/elements/Menu/index.js +20 -0
- package/dist/components/elements/MenuItem/index.d.ts +7 -0
- package/dist/components/elements/MenuItem/index.js +11 -0
- package/dist/components/elements/Summary/index.d.ts +13 -0
- package/dist/components/elements/Summary/index.js +21 -0
- package/dist/components/index.d.ts +14 -8
- package/dist/components/index.js +7 -4
- package/dist/navigation/components/AppNavigationItem/index.js +2 -2
- package/dist/styles/classnames/apply-variants.d.ts +1 -1
- package/dist/styles/classnames/config.d.ts +10 -2
- package/dist/styles/styles.css +1 -0
- package/dist/utility/interfaces.d.ts +18 -18
- package/dist/utility/is-data-object-array.d.ts +3 -0
- package/dist/utility/is-data-object-array.js +5 -0
- package/dist/utility/is-data-object.d.ts +3 -0
- package/dist/{components/collections/utility/is-data-table-object.js → utility/is-data-object.js} +2 -2
- package/package.json +14 -14
- package/dist/components/collections/utility/is-data-table-array.d.ts +0 -3
- package/dist/components/collections/utility/is-data-table-array.js +0 -5
- package/dist/components/collections/utility/is-data-table-object.d.ts +0 -3
- package/dist/components/utility/Menu/index.d.ts +0 -11
- package/dist/components/utility/Menu/index.js +0 -17
- package/dist/components/utility/MenuItem/index.d.ts +0 -4
- package/dist/components/utility/MenuItem/index.js +0 -9
- /package/dist/components/{utility → elements}/Link/index.d.ts +0 -0
- /package/dist/components/{utility → elements}/Link/index.js +0 -0
- /package/dist/components/{utility → elements}/Page/index.d.ts +0 -0
- /package/dist/components/{utility → elements}/Page/index.js +0 -0
- /package/dist/components/{utility → elements}/Reference/index.d.ts +0 -0
- /package/dist/components/{utility → elements}/Reference/index.js +0 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { ButtonClassNames } from '../../../components/buttons/Button';
|
|
1
2
|
import { ActionComponentProps } from '../../../components/utility/Action';
|
|
2
|
-
|
|
3
|
+
import type { ClassNameProps } from '../../../styles/classnames/interfaces';
|
|
4
|
+
export interface ActionButtonProps<Data extends object | null = null> extends ClassNameProps<ButtonClassNames>, Omit<ActionComponentProps<Data>, 'children'> {
|
|
3
5
|
children?: React.ReactNode;
|
|
4
6
|
label?: React.ReactNode;
|
|
5
7
|
}
|
|
6
|
-
declare function ActionButton<Data extends object | null = null>({ isSubmittable, ...props }: ActionButtonProps<Data>): React.ReactElement;
|
|
8
|
+
declare function ActionButton<Data extends object | null = null>({ classNameProps, isSubmittable, ...props }: ActionButtonProps<Data>): React.ReactElement;
|
|
7
9
|
export default ActionButton;
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import Button from '../../../components/buttons/Button';
|
|
4
4
|
import Action from '../../../components/utility/Action';
|
|
5
5
|
import FormSubmit from '../../../forms/components/FormSubmit';
|
|
6
|
-
function ActionButton({ isSubmittable, ...props }) {
|
|
7
|
-
return _jsx(Action, { ...props, render: isSubmittable ? FormSubmit : Button });
|
|
6
|
+
function ActionButton({ classNameProps, isSubmittable, ...props }) {
|
|
7
|
+
return (_jsx(Action, { ...props, render: (renderProps) => isSubmittable ? (_jsx(FormSubmit, { ...renderProps, classNameProps: classNameProps })) : (_jsx(Button, { ...renderProps, classNameProps: classNameProps })) }));
|
|
8
8
|
}
|
|
9
9
|
export default ActionButton;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useRef } from 'react';
|
|
4
|
-
import Link from '../../../components/utility/Link';
|
|
5
4
|
import { getClassNames } from '../../../styles/classnames';
|
|
6
5
|
import applyVariants from '../../../styles/classnames/apply-variants';
|
|
7
6
|
import tw from '../../../styles/classnames/tw';
|
|
7
|
+
import Link from '../../elements/Link';
|
|
8
8
|
/**
|
|
9
9
|
* Either a `Link` component or a `button` element, depending on whether a `href` prop is specified.
|
|
10
10
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ClassNameProps } from '../../../styles/classnames/interfaces';
|
|
2
|
-
import type {
|
|
2
|
+
import type { DataObject } from '../../../utility/interfaces';
|
|
3
3
|
export interface DataTableClassNames {
|
|
4
4
|
root: string;
|
|
5
5
|
row: string;
|
|
@@ -8,7 +8,7 @@ export interface DataTableClassNames {
|
|
|
8
8
|
value: string;
|
|
9
9
|
}
|
|
10
10
|
export interface DataTableProps extends ClassNameProps<DataTableClassNames> {
|
|
11
|
-
readonly data: (
|
|
11
|
+
readonly data: (DataObject | null)[];
|
|
12
12
|
}
|
|
13
|
-
declare function DataTable({ classNameProps, classNames, data }: DataTableProps): React.ReactElement;
|
|
13
|
+
declare function DataTable({ classNameProps, classNames, data, }: DataTableProps): React.ReactElement | null;
|
|
14
14
|
export default DataTable;
|
|
@@ -2,8 +2,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { filterNull } from '@sqrzro/utility';
|
|
3
3
|
import { getClassNames } from '../../../styles/classnames';
|
|
4
4
|
import tw from '../../../styles/classnames/tw';
|
|
5
|
-
function DataTable({ classNameProps, classNames, data }) {
|
|
5
|
+
function DataTable({ classNameProps, classNames, data, }) {
|
|
6
6
|
const componentClassNames = getClassNames('dataTable', { props: classNameProps }, classNames);
|
|
7
|
+
const filtered = filterNull(data);
|
|
8
|
+
if (!filtered.length) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
7
11
|
return (_jsx("table", { className: tw('w-full', componentClassNames?.root), children: _jsx("tbody", { children: filterNull(data).map(({ label, value }, index) => (_jsxs("tr", { className: componentClassNames?.row, children: [_jsx("th", { className: tw(componentClassNames?.cell, componentClassNames?.label), children: label }), _jsx("td", { className: tw(componentClassNames?.cell, componentClassNames?.value), children: value })] }, index))) }) }));
|
|
8
12
|
}
|
|
9
13
|
export default DataTable;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { ClassNameProps } from '../../../styles/classnames/interfaces';
|
|
1
2
|
import { CollectionComponentProps } from '../Collection';
|
|
2
3
|
import type { ListItemObject } from '../interfaces';
|
|
3
4
|
export interface ListClassNames {
|
|
4
5
|
root: string;
|
|
5
6
|
}
|
|
6
|
-
export type ListProps<Item, Filters = null, Data extends object | null = null> = CollectionComponentProps<Item, ListItemObject<Data>, Filters>;
|
|
7
|
-
declare function List<Item extends object, Filters = null, Data extends object | null = null>(props: ListProps<Item, Filters, Data>): React.ReactElement;
|
|
7
|
+
export type ListProps<Item, Filters = null, Data extends object | null = null> = ClassNameProps<ListClassNames> & CollectionComponentProps<Item, ListItemObject<Data>, Filters>;
|
|
8
|
+
declare function List<Item extends object, Filters = null, Data extends object | null = null>({ classNameProps, classNames, ...props }: ListProps<Item, Filters, Data>): React.ReactElement;
|
|
8
9
|
export default List;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment } from 'react';
|
|
3
2
|
import { getClassNames } from '../../../styles/classnames';
|
|
4
3
|
import Collection from '../Collection';
|
|
5
4
|
import ListItem from '../ListItem';
|
|
@@ -9,11 +8,11 @@ function defaultTransformer(item) {
|
|
|
9
8
|
title: 'title' in item ? String(item.title) : '',
|
|
10
9
|
};
|
|
11
10
|
}
|
|
12
|
-
function ListComponent({ classNameProps, classNames, data,
|
|
11
|
+
function ListComponent({ classNameProps, classNames, data, }) {
|
|
13
12
|
const componentClassNames = getClassNames('list', { props: classNameProps }, classNames);
|
|
14
|
-
return (_jsx("ul", { className: componentClassNames?.root, children: data.map((item) => (_jsx(
|
|
13
|
+
return (_jsx("ul", { className: componentClassNames?.root, children: data.map((item) => (_jsx(ListItem, { classNameProps: classNameProps, ...item }, item.id))) }));
|
|
15
14
|
}
|
|
16
|
-
function List(props) {
|
|
17
|
-
return (_jsx(Collection, { ...props, render: (data) => _jsx(ListComponent, { data: data }), transformer: props.transformer ?? defaultTransformer }));
|
|
15
|
+
function List({ classNameProps, classNames, ...props }) {
|
|
16
|
+
return (_jsx(Collection, { ...props, render: (data) => (_jsx(ListComponent, { classNameProps: classNameProps, classNames: classNames, data: data })), transformer: props.transformer ?? defaultTransformer }));
|
|
18
17
|
}
|
|
19
18
|
export default List;
|
|
@@ -10,5 +10,5 @@ export interface ListItemClassNames {
|
|
|
10
10
|
}
|
|
11
11
|
export interface ListItemProps<Data extends object | null = null> extends ClassNameProps<ListItemClassNames>, ListItemObject<Data> {
|
|
12
12
|
}
|
|
13
|
-
declare function ListItem<Data extends object | null = null>({ $data, actions,
|
|
13
|
+
declare function ListItem<Data extends object | null = null>({ $data, actions, classNameProps, classNames, description, href, id, isLoading, meta, secondary, tertiary, title, variant, }: Readonly<ListItemProps<Data>>): React.ReactElement;
|
|
14
14
|
export default ListItem;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { filterNull } from '@sqrzro/utility';
|
|
3
3
|
import { getClassNames } from '../../../styles/classnames';
|
|
4
4
|
import tw from '../../../styles/classnames/tw';
|
|
5
|
-
import Link from '
|
|
5
|
+
import Link from '../../elements/Link';
|
|
6
6
|
import ListItemSecondary from '../ListItemSecondary';
|
|
7
7
|
import ListItemMeta from '../ListItemMeta';
|
|
8
8
|
import ListItemMenu from '../ListItemMenu';
|
|
@@ -15,12 +15,12 @@ function getLayout(layout) {
|
|
|
15
15
|
const count = layout.filter(Boolean).length;
|
|
16
16
|
return colMap[count];
|
|
17
17
|
}
|
|
18
|
-
function ListItem({ $data, actions,
|
|
18
|
+
function ListItem({ $data, actions, classNameProps, classNames, description, href, id, isLoading, meta, secondary, tertiary, title, variant, }) {
|
|
19
19
|
const componentClassNames = getClassNames('listItem', { props: classNameProps }, classNames);
|
|
20
20
|
const hasPrimary = Boolean(title || description || meta);
|
|
21
21
|
const hasSecondary = Boolean(secondary);
|
|
22
22
|
const hasTertiary = Boolean(tertiary);
|
|
23
23
|
const filteredActions = filterNull(actions || []);
|
|
24
|
-
return (_jsx("li", { className: tw('
|
|
24
|
+
return (_jsx("li", { className: tw('relative grid', componentClassNames?.root, isLoading ? 'pointer-events-none animate-pulse' : null, filteredActions.length ? 'grid-cols-[1fr_auto] gap-4' : 'grid-cols-1'), children: _jsxs("article", { className: "contents", children: [_jsxs("div", { className: tw('grid gap-x-6 gap-y-4', getLayout([hasPrimary, hasSecondary, hasTertiary])), children: [_jsxs("div", { className: componentClassNames?.primary, children: [title ? (_jsx("h2", { className: componentClassNames?.title, children: href ? (_jsx(Link, { className: "hover:text-link", href: href, children: title })) : (title) })) : null, description ? (_jsx("div", { className: componentClassNames?.description, children: description })) : null, _jsx(ListItemMeta, { classNameProps: classNameProps, data: meta })] }), tertiary ? (_jsx("div", { className: componentClassNames?.tertiary, children: tertiary })) : null, _jsx(ListItemSecondary, { classNameProps: classNameProps, classNames: classNames, data: secondary?.data, variant: variant })] }), filteredActions.length ? (_jsx(ListItemMenu, { actions: filteredActions, data: $data })) : null] }) }));
|
|
25
25
|
}
|
|
26
26
|
export default ListItem;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import Menu from '
|
|
3
|
+
import Menu from '../../elements/Menu';
|
|
4
4
|
function ListItemMenu({ actions, data, }) {
|
|
5
5
|
return _jsx(Menu, { actions: actions, data: data, label: "\u2022\u2022\u2022" });
|
|
6
6
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ClassNameProps } from '../../../styles/classnames/interfaces';
|
|
2
|
-
import type {
|
|
2
|
+
import type { DataObject } from '../../../utility/interfaces';
|
|
3
3
|
export interface ListItemMetaClassNames {
|
|
4
4
|
root: string;
|
|
5
5
|
row: string;
|
|
@@ -7,7 +7,7 @@ export interface ListItemMetaClassNames {
|
|
|
7
7
|
value: string;
|
|
8
8
|
}
|
|
9
9
|
export type ListItemMetaProps = ClassNameProps<ListItemMetaClassNames> & {
|
|
10
|
-
data?: React.ReactNode[] | (
|
|
10
|
+
data?: React.ReactNode[] | (DataObject | null)[];
|
|
11
11
|
};
|
|
12
12
|
declare function ListItemMeta({ classNameProps, classNames, data, }: Readonly<ListItemMetaProps>): React.ReactElement | null;
|
|
13
13
|
export default ListItemMeta;
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { isValidElement } from 'react';
|
|
3
3
|
import { filterNull } from '@sqrzro/utility';
|
|
4
4
|
import { getClassNames } from '../../../styles/classnames';
|
|
5
|
+
import isDataTableArray from '../../../utility/is-data-object-array';
|
|
5
6
|
import DataTable from '../DataTable';
|
|
6
|
-
import isDataTableArray from '../utility/is-data-table-array';
|
|
7
7
|
function getKey(item) {
|
|
8
8
|
if (isValidElement(item)) {
|
|
9
9
|
return item.key || '-';
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import usePagination from '../../../hooks/usePagination';
|
|
4
4
|
import { getClassNames } from '../../../styles/classnames';
|
|
5
5
|
import tw from '../../../styles/classnames/tw';
|
|
6
|
-
import Link from '
|
|
6
|
+
import Link from '../../elements/Link';
|
|
7
7
|
import PaginationLink from '../PaginationLink';
|
|
8
8
|
function Pagination({ classNames, classNameProps, gapLabel = '•••', limit, nextLabel, page, previousLabel, total, }) {
|
|
9
9
|
const componentClassNames = getClassNames('pagination', { props: classNameProps }, classNames);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import Link from '../../../components/utility/Link';
|
|
3
2
|
import { getClassNames } from '../../../styles/classnames';
|
|
3
|
+
import Link from '../../elements/Link';
|
|
4
4
|
function PaginationLink({ classNameProps, classNames, href, isCurrent, label, }) {
|
|
5
5
|
const componentClassNames = getClassNames('pagination', { props: classNameProps, states: { isHighlighted: isCurrent } }, classNames);
|
|
6
6
|
return (_jsx(Link, { className: componentClassNames?.link, href: href, children: label }));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionObject, StyleVariant } from '../../utility/interfaces';
|
|
1
|
+
import type { ActionObject, DataObject, StyleVariant } from '../../utility/interfaces';
|
|
2
2
|
export interface CollectionFunctionConfig<Filters = null> {
|
|
3
3
|
filters?: Partial<Filters> | null;
|
|
4
4
|
params?: Record<string, string> | null;
|
|
@@ -14,12 +14,12 @@ export interface ListItemObject<Data extends object | null = null> {
|
|
|
14
14
|
image?: string | null;
|
|
15
15
|
imageHref?: string | null;
|
|
16
16
|
isLoading?: boolean;
|
|
17
|
-
meta?: React.ReactNode[] | (
|
|
17
|
+
meta?: React.ReactNode[] | (DataObject | null)[];
|
|
18
18
|
permission?: string;
|
|
19
19
|
secondary?: {
|
|
20
20
|
data?: React.ReactElement | {
|
|
21
21
|
description?: React.ReactNode;
|
|
22
|
-
meta?: React.ReactNode[] | (
|
|
22
|
+
meta?: React.ReactNode[] | (DataObject | null)[];
|
|
23
23
|
title?: React.ReactNode;
|
|
24
24
|
} | null;
|
|
25
25
|
variant?: StyleVariant | null;
|
|
@@ -53,7 +53,3 @@ export interface Paginated<T> {
|
|
|
53
53
|
total: number;
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
export interface DataTableObject {
|
|
57
|
-
label: React.ReactNode;
|
|
58
|
-
value: React.ReactNode;
|
|
59
|
-
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ClassNameProps, StylableClassName } from '../../../styles/classnames/interfaces';
|
|
2
|
+
import type { StyleVariant } from '../../../utility/interfaces';
|
|
3
|
+
export interface BadgeClassNames {
|
|
4
|
+
root: StylableClassName;
|
|
5
|
+
dot: StylableClassName;
|
|
6
|
+
}
|
|
7
|
+
export interface BadgeProps extends ClassNameProps<BadgeClassNames> {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
variant?: StyleVariant[] | StyleVariant | null;
|
|
10
|
+
}
|
|
11
|
+
declare function Badge({ classNameProps, classNames, children, variant }: BadgeProps): React.ReactElement;
|
|
12
|
+
export default Badge;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
3
|
+
import applyVariants from '../../../styles/classnames/apply-variants';
|
|
4
|
+
function Badge({ classNameProps, classNames, children, variant }) {
|
|
5
|
+
const componentClassNames = getClassNames('badge', { props: { ...classNameProps, ...applyVariants(variant) } }, classNames);
|
|
6
|
+
return (_jsxs("strong", { className: componentClassNames?.root, children: [_jsx("svg", { "aria-hidden": "true", className: componentClassNames?.dot, viewBox: "0 0 6 6", children: _jsx("circle", { cx: "3", cy: "3", r: "3" }) }), children] }));
|
|
7
|
+
}
|
|
8
|
+
export default Badge;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ClassNameProps, StylableClassName } from '../../../styles/classnames/interfaces';
|
|
2
|
+
import type { StyleVariant } from '../../../utility/interfaces';
|
|
3
|
+
export interface InfoPanelClassNames {
|
|
4
|
+
root: StylableClassName;
|
|
5
|
+
}
|
|
6
|
+
export interface InfoPanelProps extends ClassNameProps<InfoPanelClassNames> {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
variant?: StyleVariant[] | StyleVariant | null;
|
|
9
|
+
}
|
|
10
|
+
declare function InfoPanel({ classNameProps, classNames, children, variant, }: InfoPanelProps): React.ReactElement;
|
|
11
|
+
export default InfoPanel;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
3
|
+
import applyVariants from '../../../styles/classnames/apply-variants';
|
|
4
|
+
function InfoPanel({ classNameProps, classNames, children, variant, }) {
|
|
5
|
+
const componentClassNames = getClassNames('infoPanel', { props: { ...classNameProps, ...applyVariants(variant) } }, classNames);
|
|
6
|
+
return _jsx("aside", { className: componentClassNames?.root, children: children });
|
|
7
|
+
}
|
|
8
|
+
export default InfoPanel;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ClassNameProps } from '../../../styles/classnames/interfaces';
|
|
2
|
+
import type { ActionObject } from '../../../utility/interfaces';
|
|
3
|
+
import { PopoverProps } from '../../utility/Popover';
|
|
4
|
+
export interface MenuClassNames {
|
|
5
|
+
root: string;
|
|
6
|
+
list: string;
|
|
7
|
+
item: string;
|
|
8
|
+
link: string;
|
|
9
|
+
}
|
|
10
|
+
export interface MenuProps<Data extends object | null = null> extends ClassNameProps<MenuClassNames> {
|
|
11
|
+
actions: (ActionObject<Data> | null)[];
|
|
12
|
+
align?: PopoverProps['align'];
|
|
13
|
+
data?: Data;
|
|
14
|
+
label: React.ReactNode;
|
|
15
|
+
vAlign?: PopoverProps['vAlign'];
|
|
16
|
+
}
|
|
17
|
+
declare function Menu<Data extends object | null = null>({ actions, align, classNameProps, classNames, data, label, vAlign, }: MenuProps<Data>): React.ReactElement;
|
|
18
|
+
export default Menu;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { filterNull } from '@sqrzro/utility';
|
|
4
|
+
import Button from '../../../components/buttons/Button';
|
|
5
|
+
import useClickOutside from '../../../hooks/useClickOutside';
|
|
6
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
7
|
+
import tw from '../../../styles/classnames/tw';
|
|
8
|
+
import Action from '../../utility/Action';
|
|
9
|
+
import Popover from '../../utility/Popover';
|
|
10
|
+
import MenuItem from '../MenuItem';
|
|
11
|
+
function Menu({ actions, align, classNameProps, classNames, data, label, vAlign, }) {
|
|
12
|
+
const componentClassNames = getClassNames('menu', { props: classNameProps }, classNames);
|
|
13
|
+
const [isOpen, setIsOpen, ref] = useClickOutside();
|
|
14
|
+
function toggleIsOpen() {
|
|
15
|
+
setIsOpen(!isOpen);
|
|
16
|
+
}
|
|
17
|
+
const filteredActions = filterNull(actions);
|
|
18
|
+
return (_jsxs("div", { className: tw('relative', componentClassNames?.root), ref: ref, children: [_jsx(Button, { classNameProps: classNameProps, onClick: toggleIsOpen, children: label }), _jsx(Popover, { align: align, classNameProps: classNameProps, isOpen: isOpen, vAlign: vAlign, children: _jsx("ul", { className: componentClassNames?.list, children: filteredActions.map((item, index) => (_jsx("li", { className: componentClassNames?.item, children: _jsx(Action, { ...item, data: data, render: (props) => (_jsx(MenuItem, { ...props, classNameProps: classNameProps })) }) }, index))) }) })] }));
|
|
19
|
+
}
|
|
20
|
+
export default Menu;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ClassNameProps } from '../../../styles/classnames/interfaces';
|
|
2
|
+
import type { ActionComponentProps } from '../../utility/Action';
|
|
3
|
+
import type { MenuClassNames } from '../Menu';
|
|
4
|
+
interface MenuItemProps<Data extends object | null = null> extends ClassNameProps<MenuClassNames>, ActionComponentProps<Data> {
|
|
5
|
+
}
|
|
6
|
+
declare function MenuItem<Data extends object | null = null>({ children, classNameProps, classNames, href, onClick, }: MenuItemProps<Data>): React.ReactElement;
|
|
7
|
+
export default MenuItem;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
3
|
+
import Link from '../Link';
|
|
4
|
+
function MenuItem({ children, classNameProps, classNames, href, onClick, }) {
|
|
5
|
+
const componentClassNames = getClassNames('menu', { props: classNameProps }, classNames);
|
|
6
|
+
if (href) {
|
|
7
|
+
return (_jsx(Link, { className: componentClassNames?.link, href: href, onClick: onClick, children: children }));
|
|
8
|
+
}
|
|
9
|
+
return (_jsx("button", { className: componentClassNames?.link, onClick: onClick, type: "button", children: children }));
|
|
10
|
+
}
|
|
11
|
+
export default MenuItem;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DataObject } from '../../../utility/interfaces';
|
|
2
|
+
import type { ClassNameProps } from '../../../styles/classnames/interfaces';
|
|
3
|
+
export interface SummaryClassNames {
|
|
4
|
+
root: string;
|
|
5
|
+
item: string;
|
|
6
|
+
label: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
9
|
+
export interface SummaryProps extends ClassNameProps<SummaryClassNames> {
|
|
10
|
+
data: (DataObject | null)[];
|
|
11
|
+
}
|
|
12
|
+
declare function Summary({ classNameProps, classNames, data, }: Readonly<SummaryProps>): React.ReactElement | null;
|
|
13
|
+
export default Summary;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { filterNull } from '@sqrzro/utility';
|
|
3
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
4
|
+
import tw from '../../../styles/classnames/tw';
|
|
5
|
+
const colMap = {
|
|
6
|
+
1: 'grid-cols-1',
|
|
7
|
+
2: 'grid-cols-2',
|
|
8
|
+
3: 'grid-cols-3',
|
|
9
|
+
4: 'grid-cols-4',
|
|
10
|
+
5: 'grid-cols-5',
|
|
11
|
+
6: 'grid-cols-6',
|
|
12
|
+
};
|
|
13
|
+
function Summary({ classNameProps, classNames, data, }) {
|
|
14
|
+
const componentClassNames = getClassNames('summary', { props: classNameProps }, classNames);
|
|
15
|
+
const filtered = filterNull(data);
|
|
16
|
+
if (!filtered.length) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return (_jsx("dl", { className: tw(componentClassNames?.root, colMap[Object.keys(filtered).length]), children: filtered.map(({ label, value }, index) => (_jsxs("div", { className: componentClassNames?.item, children: [_jsx("dt", { className: componentClassNames?.label, children: label }), _jsx("dd", { className: componentClassNames?.value, children: value })] }, index))) }));
|
|
20
|
+
}
|
|
21
|
+
export default Summary;
|
|
@@ -9,6 +9,20 @@ export type { ListProps } from './collections/List';
|
|
|
9
9
|
export { default as List } from './collections/List';
|
|
10
10
|
export type { TableProps } from './collections/Table';
|
|
11
11
|
export { default as Table } from './collections/Table';
|
|
12
|
+
export type { BadgeProps } from './elements/Badge';
|
|
13
|
+
export { default as Badge } from './elements/Badge';
|
|
14
|
+
export type { InfoPanelProps } from './elements/InfoPanel';
|
|
15
|
+
export { default as InfoPanel } from './elements/InfoPanel';
|
|
16
|
+
export type { LinkProps } from './elements/Link';
|
|
17
|
+
export { default as Link } from './elements/Link';
|
|
18
|
+
export type { MenuProps } from './elements/Menu';
|
|
19
|
+
export { default as Menu } from './elements/Menu';
|
|
20
|
+
export type { PageProps } from './elements/Page';
|
|
21
|
+
export { default as Page } from './elements/Page';
|
|
22
|
+
export type { ReferenceProps } from './elements/Reference';
|
|
23
|
+
export { default as Reference } from './elements/Reference';
|
|
24
|
+
export type { SummaryProps } from './elements/Summary';
|
|
25
|
+
export { default as Summary } from './elements/Summary';
|
|
12
26
|
export type { AppErrorProps } from './errors/AppError';
|
|
13
27
|
export { default as AppError } from './errors/AppError';
|
|
14
28
|
export type { AppForbiddenErrorProps } from './errors/AppForbiddenError';
|
|
@@ -21,15 +35,7 @@ export type { ModalLauncherProps } from './modals/ModalLauncher';
|
|
|
21
35
|
export { default as ModalLauncher } from './modals/ModalLauncher';
|
|
22
36
|
export type { ContainerProps } from './utility/Container';
|
|
23
37
|
export { default as Container } from './utility/Container';
|
|
24
|
-
export type { LinkProps } from './utility/Link';
|
|
25
|
-
export { default as Link } from './utility/Link';
|
|
26
|
-
export type { MenuProps } from './utility/Menu';
|
|
27
|
-
export { default as Menu } from './utility/Menu';
|
|
28
|
-
export type { PageProps } from './utility/Page';
|
|
29
|
-
export { default as Page } from './utility/Page';
|
|
30
38
|
export type { PopoverProps } from './utility/Popover';
|
|
31
39
|
export { default as Popover } from './utility/Popover';
|
|
32
|
-
export type { ReferenceProps } from './utility/Reference';
|
|
33
|
-
export { default as Reference } from './utility/Reference';
|
|
34
40
|
export type { RootLayoutProps } from './utility/RootLayout';
|
|
35
41
|
export { default as RootLayout } from './utility/RootLayout';
|
package/dist/components/index.js
CHANGED
|
@@ -4,15 +4,18 @@ export { default as Button } from './buttons/Button';
|
|
|
4
4
|
export { default as DataTable } from './collections/DataTable';
|
|
5
5
|
export { default as List } from './collections/List';
|
|
6
6
|
export { default as Table } from './collections/Table';
|
|
7
|
+
export { default as Badge } from './elements/Badge';
|
|
8
|
+
export { default as InfoPanel } from './elements/InfoPanel';
|
|
9
|
+
export { default as Link } from './elements/Link';
|
|
10
|
+
export { default as Menu } from './elements/Menu';
|
|
11
|
+
export { default as Page } from './elements/Page';
|
|
12
|
+
export { default as Reference } from './elements/Reference';
|
|
13
|
+
export { default as Summary } from './elements/Summary';
|
|
7
14
|
export { default as AppError } from './errors/AppError';
|
|
8
15
|
export { default as AppForbiddenError } from './errors/AppForbiddenError';
|
|
9
16
|
export { default as AppNotFoundError } from './errors/AppNotFoundError';
|
|
10
17
|
export { default as Modal } from './modals/Modal';
|
|
11
18
|
export { default as ModalLauncher } from './modals/ModalLauncher';
|
|
12
19
|
export { default as Container } from './utility/Container';
|
|
13
|
-
export { default as Link } from './utility/Link';
|
|
14
|
-
export { default as Menu } from './utility/Menu';
|
|
15
|
-
export { default as Page } from './utility/Page';
|
|
16
20
|
export { default as Popover } from './utility/Popover';
|
|
17
|
-
export { default as Reference } from './utility/Reference';
|
|
18
21
|
export { default as RootLayout } from './utility/RootLayout';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Link from '../../../components/elements/Link';
|
|
3
|
+
import MenuItem from '../../../components/elements/MenuItem';
|
|
2
4
|
import Action from '../../../components/utility/Action';
|
|
3
|
-
import Link from '../../../components/utility/Link';
|
|
4
|
-
import MenuItem from '../../../components/utility/MenuItem';
|
|
5
5
|
import Popover from '../../../components/utility/Popover';
|
|
6
6
|
import usePopover from '../../../hooks/usePopover';
|
|
7
7
|
import { getClassNames } from '../../../styles/classnames';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { StyleVariant } from '../../utility/interfaces';
|
|
2
|
-
declare function applyVariants(variants?: StyleVariant[] | StyleVariant): Record<string, boolean>;
|
|
2
|
+
declare function applyVariants(variants?: StyleVariant[] | StyleVariant | null): Record<string, boolean>;
|
|
3
3
|
export default applyVariants;
|
|
@@ -7,14 +7,18 @@ import type { ListItemClassNames } from '../../components/collections/ListItem';
|
|
|
7
7
|
import type { ListItemMetaClassNames } from '../../components/collections/ListItemMeta';
|
|
8
8
|
import type { PaginationClassNames } from '../../components/collections/Pagination';
|
|
9
9
|
import type { TableClassNames } from '../../components/collections/Table';
|
|
10
|
+
import type { BadgeClassNames } from '../../components/elements/Badge';
|
|
11
|
+
import type { InfoPanelClassNames } from '../../components/elements/InfoPanel';
|
|
12
|
+
import type { LinkClassNames } from '../../components/elements/Link';
|
|
13
|
+
import type { MenuClassNames } from '../../components/elements/Menu';
|
|
14
|
+
import type { ReferenceClassNames } from '../../components/elements/Reference';
|
|
15
|
+
import type { SummaryClassNames } from '../../components/elements/Summary';
|
|
10
16
|
import type { AppErrorClassNames } from '../../components/errors/AppError';
|
|
11
17
|
import type { ModalClassNames } from '../../components/modals/Modal';
|
|
12
18
|
import type { ActionListClassNames } from '../../components/utility/ActionList';
|
|
13
19
|
import type { ContainerClassNames } from '../../components/utility/Container';
|
|
14
|
-
import type { LinkClassNames } from '../../components/utility/Link';
|
|
15
20
|
import type { LoaderClassNames } from '../../components/utility/Loader';
|
|
16
21
|
import type { PopoverClassNames } from '../../components/utility/Popover';
|
|
17
|
-
import type { ReferenceClassNames } from '../../components/utility/Reference';
|
|
18
22
|
import type { RootLayoutClassNames } from '../../components/utility/RootLayout';
|
|
19
23
|
import type { ToastClassNames } from '../../components/utility/Toast';
|
|
20
24
|
import type { FilterBarClassNames } from '../../filters/components/FilterBar';
|
|
@@ -37,6 +41,7 @@ export interface RegisteredClassNames {
|
|
|
37
41
|
actionList?: ComponentClassNames<ActionListClassNames>;
|
|
38
42
|
appError?: ComponentClassNames<AppErrorClassNames>;
|
|
39
43
|
appNavigation?: ComponentClassNames<AppNavigationClassNames>;
|
|
44
|
+
badge?: ComponentClassNames<BadgeClassNames>;
|
|
40
45
|
button?: ComponentClassNames<ButtonClassNames>;
|
|
41
46
|
container?: ComponentClassNames<ContainerClassNames>;
|
|
42
47
|
csvInput?: ComponentClassNames<CSVInputClassNames>;
|
|
@@ -50,11 +55,13 @@ export interface RegisteredClassNames {
|
|
|
50
55
|
filterPanel?: ComponentClassNames<FilterPanelClassNames>;
|
|
51
56
|
form?: ComponentClassNames<FormClassNames>;
|
|
52
57
|
formField?: ComponentClassNames<FormFieldClassNames>;
|
|
58
|
+
infoPanel?: ComponentClassNames<InfoPanelClassNames>;
|
|
53
59
|
link?: ComponentClassNames<LinkClassNames>;
|
|
54
60
|
list?: ComponentClassNames<ListClassNames>;
|
|
55
61
|
listItem?: ComponentClassNames<ListItemClassNames>;
|
|
56
62
|
listItemMeta?: ComponentClassNames<ListItemMetaClassNames>;
|
|
57
63
|
loader?: ComponentClassNames<LoaderClassNames>;
|
|
64
|
+
menu?: ComponentClassNames<MenuClassNames>;
|
|
58
65
|
modal?: ComponentClassNames<ModalClassNames>;
|
|
59
66
|
pagination?: ComponentClassNames<PaginationClassNames>;
|
|
60
67
|
passwordInput?: ComponentClassNames<PasswordInputClassNames>;
|
|
@@ -62,6 +69,7 @@ export interface RegisteredClassNames {
|
|
|
62
69
|
reference?: ComponentClassNames<ReferenceClassNames>;
|
|
63
70
|
rootLayout?: ComponentClassNames<RootLayoutClassNames>;
|
|
64
71
|
staticTextInput?: ComponentClassNames<StaticTextInputClassNames>;
|
|
72
|
+
summary?: ComponentClassNames<SummaryClassNames>;
|
|
65
73
|
switch?: ComponentClassNames<SwitchClassNames>;
|
|
66
74
|
table?: ComponentClassNames<TableClassNames>;
|
|
67
75
|
tabs?: ComponentClassNames<TabsClassNames>;
|
package/dist/styles/styles.css
CHANGED
|
@@ -6,6 +6,22 @@ export interface AppConfigObject {
|
|
|
6
6
|
};
|
|
7
7
|
navigation: NavigationObject[];
|
|
8
8
|
}
|
|
9
|
+
export type ActionEvent = React.MouseEvent<HTMLAnchorElement> | React.MouseEvent<HTMLButtonElement>;
|
|
10
|
+
export interface ActionObject<Data extends object | null = null> {
|
|
11
|
+
action?: (data: Data) => Promise<void>;
|
|
12
|
+
confirmable?: ConfirmableObject;
|
|
13
|
+
data?: Data;
|
|
14
|
+
details?: React.ReactNode;
|
|
15
|
+
href?: string;
|
|
16
|
+
icon?: React.ReactNode;
|
|
17
|
+
isDisabled?: boolean;
|
|
18
|
+
isLoading?: boolean;
|
|
19
|
+
isSubmittable?: boolean;
|
|
20
|
+
label: React.ReactNode;
|
|
21
|
+
onClick?: (event?: ActionEvent) => void;
|
|
22
|
+
searchParams?: Record<string, string>;
|
|
23
|
+
variant?: StyleVariant[] | StyleVariant;
|
|
24
|
+
}
|
|
9
25
|
export interface ConfirmableObject {
|
|
10
26
|
actions?: Omit<ActionObject, 'confirmable'>[];
|
|
11
27
|
confirmText?: string;
|
|
@@ -21,30 +37,14 @@ export interface ConfirmableObject {
|
|
|
21
37
|
submitLabel?: string;
|
|
22
38
|
title?: React.ReactNode;
|
|
23
39
|
}
|
|
24
|
-
export
|
|
25
|
-
export interface ActionObject<Data extends object | null = null> {
|
|
26
|
-
action?: (data: Data) => Promise<void>;
|
|
27
|
-
confirmable?: ConfirmableObject;
|
|
28
|
-
data?: Data;
|
|
29
|
-
details?: React.ReactNode;
|
|
30
|
-
href?: string;
|
|
31
|
-
icon?: React.ReactNode;
|
|
32
|
-
isDisabled?: boolean;
|
|
33
|
-
isLoading?: boolean;
|
|
34
|
-
isSubmittable?: boolean;
|
|
40
|
+
export interface DataObject {
|
|
35
41
|
label: React.ReactNode;
|
|
36
|
-
|
|
37
|
-
searchParams?: Record<string, string>;
|
|
38
|
-
variant?: StyleVariant[] | StyleVariant;
|
|
42
|
+
value: React.ReactNode;
|
|
39
43
|
}
|
|
40
44
|
export interface NextLayoutProps {
|
|
41
45
|
children: React.ReactNode;
|
|
42
46
|
params?: Promise<Record<string, string>> | null;
|
|
43
47
|
}
|
|
44
|
-
export interface AwaitedNextPageProps {
|
|
45
|
-
params?: Record<string, string> | null;
|
|
46
|
-
searchParams?: Record<string, string> | null;
|
|
47
|
-
}
|
|
48
48
|
export interface NextPageProps {
|
|
49
49
|
params?: Promise<Record<string, string>> | null;
|
|
50
50
|
searchParams?: Promise<Record<string, string>> | null;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqrzro/ui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.0-alpha.
|
|
4
|
+
"version": "4.0.0-alpha.27",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "ISC",
|
|
@@ -45,29 +45,29 @@
|
|
|
45
45
|
"clsx": "^2.1.1",
|
|
46
46
|
"next": "^16.1.6",
|
|
47
47
|
"react": "^19.2.4",
|
|
48
|
-
"react-dom": "^19.2.
|
|
49
|
-
"tailwind-merge": "^3.
|
|
48
|
+
"react-dom": "^19.2.4",
|
|
49
|
+
"tailwind-merge": "^3.5.0",
|
|
50
50
|
"use-deep-compare-effect": "^1.8.1",
|
|
51
|
-
"@sqrzro/utility": "^4.0.0-alpha.
|
|
51
|
+
"@sqrzro/utility": "^4.0.0-alpha.10"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@storybook/addon-a11y": "^10.
|
|
55
|
-
"@storybook/addon-docs": "^10.
|
|
56
|
-
"@storybook/nextjs": "^10.
|
|
57
|
-
"@testing-library/react": "^16.3.
|
|
54
|
+
"@storybook/addon-a11y": "^10.2.14",
|
|
55
|
+
"@storybook/addon-docs": "^10.2.14",
|
|
56
|
+
"@storybook/nextjs": "^10.2.14",
|
|
57
|
+
"@testing-library/react": "^16.3.2",
|
|
58
58
|
"@testing-library/user-event": "^14.6.1",
|
|
59
|
-
"@types/react": "^19.2.
|
|
59
|
+
"@types/react": "^19.2.14",
|
|
60
60
|
"@types/react-dom": "^19.2.3",
|
|
61
61
|
"concurrently": "^9.2.1",
|
|
62
62
|
"cpx": "^1.5.0",
|
|
63
|
-
"next-router-mock": "^1.0.
|
|
64
|
-
"prettier": "^3.
|
|
65
|
-
"rimraf": "^6.1.
|
|
66
|
-
"storybook": "^10.
|
|
63
|
+
"next-router-mock": "^1.0.5",
|
|
64
|
+
"prettier": "^3.8.1",
|
|
65
|
+
"rimraf": "^6.1.3",
|
|
66
|
+
"storybook": "^10.2.14",
|
|
67
67
|
"tsc-alias": "^1.8.16",
|
|
68
68
|
"tslib": "^2.8.1",
|
|
69
69
|
"typescript": "^5.9.3",
|
|
70
|
-
"@sqrzro/prettier-config": "^4.0.0-alpha.
|
|
70
|
+
"@sqrzro/prettier-config": "^4.0.0-alpha.2"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"build": "pnpm clean && tsc -p tsconfig.build.json && tsc-alias && pnpm build:css",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ActionObject } from '../../../utility/interfaces';
|
|
2
|
-
import { PopoverProps } from '../Popover';
|
|
3
|
-
export interface MenuProps<Data extends object | null = null> {
|
|
4
|
-
actions: (ActionObject<Data> | null)[];
|
|
5
|
-
align?: PopoverProps['align'];
|
|
6
|
-
data?: Data;
|
|
7
|
-
label: React.ReactNode;
|
|
8
|
-
vAlign?: PopoverProps['vAlign'];
|
|
9
|
-
}
|
|
10
|
-
declare function Menu<Data extends object | null = null>({ actions, align, data, label, vAlign, }: MenuProps<Data>): React.ReactElement;
|
|
11
|
-
export default Menu;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { filterNull } from '@sqrzro/utility';
|
|
4
|
-
import Button from '../../../components/buttons/Button';
|
|
5
|
-
import useClickOutside from '../../../hooks/useClickOutside';
|
|
6
|
-
import Action from '../Action';
|
|
7
|
-
import MenuItem from '../MenuItem';
|
|
8
|
-
import Popover from '../Popover';
|
|
9
|
-
function Menu({ actions, align, data, label, vAlign, }) {
|
|
10
|
-
const [isOpen, setIsOpen, ref] = useClickOutside();
|
|
11
|
-
function toggleIsOpen() {
|
|
12
|
-
setIsOpen(!isOpen);
|
|
13
|
-
}
|
|
14
|
-
const filteredActions = filterNull(actions);
|
|
15
|
-
return (_jsxs("div", { className: "relative", ref: ref, children: [_jsx(Button, { onClick: toggleIsOpen, children: label }), _jsx(Popover, { align: align, isOpen: isOpen, vAlign: vAlign, children: _jsx("ul", { children: filteredActions.map((item, index) => (_jsx("li", { children: _jsx(Action, { ...item, data: data, render: MenuItem }) }, index))) }) })] }));
|
|
16
|
-
}
|
|
17
|
-
export default Menu;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ActionComponentProps } from '../Action';
|
|
2
|
-
type MenuItemProps<Data extends object | null = null> = ActionComponentProps<Data>;
|
|
3
|
-
declare function MenuItem<Data extends object | null = null>({ children, href, onClick, }: MenuItemProps<Data>): React.ReactElement;
|
|
4
|
-
export default MenuItem;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import Link from '../Link';
|
|
3
|
-
function MenuItem({ children, href, onClick, }) {
|
|
4
|
-
if (href) {
|
|
5
|
-
return (_jsx(Link, { href: href, onClick: onClick, children: children }));
|
|
6
|
-
}
|
|
7
|
-
return (_jsx("button", { onClick: onClick, type: "button", children: children }));
|
|
8
|
-
}
|
|
9
|
-
export default MenuItem;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|