@sqrzro/ui 4.0.0-alpha.38 → 4.0.0-alpha.39
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/Button/index.js +3 -3
- package/dist/components/collections/Collection/index.js +0 -3
- package/dist/components/collections/DataTable/index.js +2 -2
- package/dist/components/collections/EmptyMessage/index.js +6 -3
- package/dist/components/collections/ListClientComponent/index.js +1 -1
- package/dist/components/collections/ListItem/index.js +6 -11
- package/dist/components/collections/ListItemMeta/index.js +1 -1
- package/dist/components/collections/ListItemSecondary/index.js +1 -1
- package/dist/components/collections/Pagination/index.js +2 -2
- package/dist/components/collections/PaginationLink/index.js +1 -1
- package/dist/components/collections/TableClientComponent/index.js +2 -2
- package/dist/components/collections/TableRow/index.js +2 -2
- package/dist/components/collections/utility/normalize-href.d.ts +2 -0
- package/dist/components/collections/utility/normalize-href.js +8 -0
- package/dist/components/collections/utility/render-cell.js +8 -4
- package/dist/components/elements/Badge/index.js +2 -2
- package/dist/components/elements/InfoPanel/index.js +2 -2
- package/dist/components/elements/Link/index.js +2 -2
- package/dist/components/elements/Menu/index.js +2 -2
- package/dist/components/elements/MenuItem/index.js +1 -1
- package/dist/components/elements/Reference/index.js +1 -1
- package/dist/components/elements/Summary/index.js +2 -2
- package/dist/components/errors/AppError/index.js +1 -1
- package/dist/components/index.d.ts +2 -3
- package/dist/components/index.js +1 -2
- package/dist/components/mail/Mail/index.d.ts +4 -15
- package/dist/components/mail/Mail/index.js +80 -43
- package/dist/components/mail/MailButton/index.d.ts +3 -10
- package/dist/components/mail/MailButton/index.js +17 -13
- package/dist/components/modals/Modal/index.js +2 -2
- package/dist/components/modals/ModalActions/index.js +1 -1
- package/dist/components/utility/ActionList/index.js +1 -1
- package/dist/components/utility/AppBody/index.d.ts +5 -0
- package/dist/components/utility/AppBody/index.js +9 -0
- package/dist/components/utility/Calendar/index.d.ts +1 -0
- package/dist/components/utility/Calendar/index.js +6 -6
- package/dist/components/utility/CalendarDay/index.js +2 -2
- package/dist/components/utility/Container/index.js +1 -1
- package/dist/components/utility/Loader/index.js +2 -2
- package/dist/components/utility/Popover/index.js +3 -3
- package/dist/components/utility/Toast/index.d.ts +1 -1
- package/dist/components/utility/Toast/index.js +6 -4
- package/dist/filters/components/FilterBarClientComponent/index.js +1 -41
- package/dist/filters/components/FilterClearButton/index.js +3 -4
- package/dist/filters/components/FilterControl/index.js +2 -2
- package/dist/filters/components/FilterItem/index.js +1 -1
- package/dist/filters/filters/CalendarFilter/index.js +1 -1
- package/dist/filters/filters/Filter/index.d.ts +4 -1
- package/dist/filters/filters/Filter/index.js +7 -7
- package/dist/filters/filters/SearchFilter/index.js +4 -5
- package/dist/forms/components/CSVInput/index.d.ts +4 -8
- package/dist/forms/components/CSVInput/index.js +7 -5
- package/dist/forms/components/Dropdown/index.js +4 -6
- package/dist/forms/components/DropdownItem/index.js +2 -2
- package/dist/forms/components/DropdownList/index.js +1 -1
- package/dist/forms/components/EditableForm/index.js +1 -1
- package/dist/forms/components/EditableFormField/index.js +2 -2
- package/dist/forms/components/Form/index.js +2 -2
- package/dist/forms/components/FormError/index.js +2 -2
- package/dist/forms/components/FormField/index.js +2 -1
- package/dist/forms/components/FormFields/index.d.ts +1 -2
- package/dist/forms/components/FormLabel/index.js +2 -2
- package/dist/forms/components/PasswordComplexity/index.d.ts +9 -2
- package/dist/forms/components/PasswordComplexity/index.js +6 -2
- package/dist/forms/components/PasswordComplexityItem/index.d.ts +8 -0
- package/dist/forms/components/PasswordComplexityItem/index.js +10 -0
- package/dist/forms/components/PasswordInput/index.js +4 -3
- package/dist/forms/components/StaticTextInput/index.js +5 -3
- package/dist/forms/components/Switch/index.js +2 -2
- package/dist/forms/components/TextArea/index.js +2 -2
- package/dist/forms/components/TextInput/index.js +2 -2
- package/dist/hooks/usePopover.d.ts +1 -0
- package/dist/hooks/usePopover.js +1 -0
- package/dist/navigation/components/AppNavigation/index.d.ts +2 -1
- package/dist/navigation/components/AppNavigation/index.js +1 -1
- package/dist/navigation/components/AppNavigationItem/index.js +5 -4
- package/dist/styles/classnames/config.d.ts +2 -2
- package/dist/styles/classnames/utility/apply-sizes.d.ts +3 -0
- package/dist/styles/classnames/utility/apply-sizes.js +21 -0
- package/dist/styles/classnames/{apply-variants.d.ts → utility/apply-variants.d.ts} +1 -1
- package/dist/styles/classnames/utility/parse-classnames.js +1 -1
- package/dist/styles/context.d.ts +28 -0
- package/dist/styles/context.js +19 -0
- package/dist/styles/icons/config.d.ts +10 -2
- package/dist/styles/index.d.ts +5 -4
- package/dist/styles/index.js +2 -4
- package/dist/utility/convert-to-datauri.d.ts +2 -0
- package/dist/utility/convert-to-datauri.js +16 -0
- package/dist/utility/interfaces.d.ts +1 -8
- package/package.json +3 -2
- package/dist/components/errors/GlobalError/index.d.ts +0 -8
- package/dist/components/errors/GlobalError/index.js +0 -6
- package/dist/components/utility/RootLayout/index.d.ts +0 -13
- package/dist/components/utility/RootLayout/index.js +0 -14
- package/dist/styles/classnames/context.d.ts +0 -20
- package/dist/styles/classnames/context.js +0 -15
- package/dist/styles/classnames/index.d.ts +0 -2
- package/dist/styles/classnames/index.js +0 -10
- package/dist/styles/icons/index.d.ts +0 -4
- package/dist/styles/icons/index.js +0 -7
- /package/dist/styles/classnames/{apply-variants.js → utility/apply-variants.js} +0 -0
- /package/dist/styles/classnames/{tw.d.ts → utility/tw.d.ts} +0 -0
- /package/dist/styles/classnames/{tw.js → utility/tw.js} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
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 { useClassNames } from '../../../styles/
|
|
5
|
-
import applyVariants from '../../../styles/classnames/apply-variants';
|
|
6
|
-
import tw from '../../../styles/classnames/tw';
|
|
4
|
+
import { useClassNames } from '../../../styles/context';
|
|
5
|
+
import applyVariants from '../../../styles/classnames/utility/apply-variants';
|
|
6
|
+
import tw from '../../../styles/classnames/utility/tw';
|
|
7
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.
|
|
@@ -5,13 +5,11 @@ import FilterBar from '../../../filters/components/FilterBar';
|
|
|
5
5
|
import checkHasFilters from '../../../filters/utility/check-has-filters';
|
|
6
6
|
import parseFilters from '../../../filters/utility/parse-filters';
|
|
7
7
|
import parsePage from '../../../filters/utility/parse-page';
|
|
8
|
-
import { getIcon } from '../../../styles/icons';
|
|
9
8
|
import EmptyMessage from '../EmptyMessage';
|
|
10
9
|
import Pagination from '../Pagination';
|
|
11
10
|
import isPaginated from '../utility/is-paginated';
|
|
12
11
|
import { messages } from '../lang';
|
|
13
12
|
async function CollectionComponent({ data, defaultFilters, emptyMessageProps, filterMap, fn, pageProps, render, transformer, }) {
|
|
14
|
-
const EmptyIcon = getIcon('collection.empty');
|
|
15
13
|
const awaitedParams = pageProps?.params ? await pageProps.params : null;
|
|
16
14
|
const awaitedSearchParams = pageProps?.searchParams ? await pageProps.searchParams : null;
|
|
17
15
|
async function getResponse() {
|
|
@@ -34,7 +32,6 @@ async function CollectionComponent({ data, defaultFilters, emptyMessageProps, fi
|
|
|
34
32
|
const componentEmptyMessageProps = checkHasFilters(awaitedSearchParams)
|
|
35
33
|
? {
|
|
36
34
|
children: messages.EMPTY_FILTER_DESCRIPTION,
|
|
37
|
-
icon: EmptyIcon ? _jsx(EmptyIcon, {}) : null,
|
|
38
35
|
title: messages.EMPTY_FILTER_TITLE,
|
|
39
36
|
}
|
|
40
37
|
: emptyMessageProps;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { filterNull } from '@sqrzro/utility';
|
|
4
|
-
import { useClassNames } from '../../../styles/
|
|
5
|
-
import tw from '../../../styles/classnames/tw';
|
|
4
|
+
import { useClassNames } from '../../../styles/context';
|
|
5
|
+
import tw from '../../../styles/classnames/utility/tw';
|
|
6
6
|
function DataTable({ classNameProps, classNames, data, }) {
|
|
7
7
|
const componentClassNames = useClassNames('dataTable', { props: classNameProps }, classNames);
|
|
8
8
|
const filtered = filterNull(data);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useClassNames } from '../../../styles/
|
|
3
|
+
import { useClassNames, useIcon } from '../../../styles/context';
|
|
4
|
+
import applyVariants from '../../../styles/classnames/utility/apply-variants';
|
|
4
5
|
import EmptyMessageAction from '../EmptyMessageAction';
|
|
5
6
|
export const DEFAULT_TITLE = 'No results found';
|
|
6
7
|
export const DEFAULT_CHILDREN = 'If you think this is an error, please contact the site administrator.';
|
|
@@ -10,7 +11,9 @@ export const DEFAULT_CHILDREN = 'If you think this is an error, please contact t
|
|
|
10
11
|
* component to be used for any situation where a standout message is required.
|
|
11
12
|
*/
|
|
12
13
|
function EmptyMessage({ action, children = DEFAULT_CHILDREN, classNameProps, classNames, icon, title = DEFAULT_TITLE, variant, }) {
|
|
13
|
-
const componentClassNames = useClassNames('emptyMessage', { props: classNameProps }, classNames);
|
|
14
|
-
|
|
14
|
+
const componentClassNames = useClassNames('emptyMessage', { props: { ...classNameProps, ...applyVariants(variant) } }, classNames);
|
|
15
|
+
const DefaultIcon = useIcon('collection.empty');
|
|
16
|
+
const iconComponent = icon ?? (DefaultIcon ? _jsx(DefaultIcon, {}) : null);
|
|
17
|
+
return (_jsxs("section", { className: componentClassNames?.root, children: [iconComponent ? (_jsx("div", { className: componentClassNames?.icon, children: iconComponent })) : null, _jsx("h2", { className: componentClassNames?.title, children: title }), _jsx("div", { className: componentClassNames?.description, children: children }), action ? (_jsx("div", { className: componentClassNames?.action, children: _jsx(EmptyMessageAction, { action: action }) })) : null] }));
|
|
15
18
|
}
|
|
16
19
|
export default EmptyMessage;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import useSelected from '../../../hooks/useSelected';
|
|
4
|
-
import { useClassNames } from '../../../styles/
|
|
4
|
+
import { useClassNames } from '../../../styles/context';
|
|
5
5
|
import ListItem from '../ListItem';
|
|
6
6
|
function ListClientComponent({ classNameProps, classNames, data, }) {
|
|
7
7
|
const componentClassNames = useClassNames('list', { props: classNameProps }, classNames);
|
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { filterNull
|
|
3
|
+
import { filterNull } from '@sqrzro/utility';
|
|
4
|
+
import { usePathname } from 'next/navigation';
|
|
4
5
|
import Switch from '../../../forms/components/Switch';
|
|
5
|
-
import { useClassNames } from '../../../styles/
|
|
6
|
-
import tw from '../../../styles/classnames/tw';
|
|
6
|
+
import { useClassNames } from '../../../styles/context';
|
|
7
|
+
import tw from '../../../styles/classnames/utility/tw';
|
|
7
8
|
import Link from '../../elements/Link';
|
|
9
|
+
import normalizeHref from '../utility/normalize-href';
|
|
8
10
|
import ListItemSecondary from '../ListItemSecondary';
|
|
9
11
|
import ListItemMeta from '../ListItemMeta';
|
|
10
12
|
import ListItemMenu from '../ListItemMenu';
|
|
11
|
-
import { usePathname } from 'next/navigation';
|
|
12
|
-
function normalizeHref(href, pathname) {
|
|
13
|
-
if (href.startsWith('./')) {
|
|
14
|
-
return joinURL(pathname, href.slice(2));
|
|
15
|
-
}
|
|
16
|
-
return joinURL(href);
|
|
17
|
-
}
|
|
18
13
|
function ListItem({ classNameProps, classNames, data, hasActions, isSelected, onSelect, }) {
|
|
19
14
|
const pathname = usePathname();
|
|
20
15
|
const componentClassNames = useClassNames('listItem', { props: { ...classNameProps, isSelected } }, classNames);
|
|
21
16
|
const filteredActions = filterNull(data.actions || []);
|
|
22
17
|
//filteredActions.length ? 'grid-cols-[1fr_auto] gap-4' : 'grid-cols-1'
|
|
23
|
-
return (_jsx("li", { className: tw('relative grid', componentClassNames?.root), children: _jsx("article", { className: "contents", children: _jsxs("div", { className: "grid gap-6 has-[
|
|
18
|
+
return (_jsx("li", { className: tw('relative grid', componentClassNames?.root), children: _jsx("article", { className: "contents", children: _jsxs("div", { className: "grid gap-6 has-[>:nth-child(2)]:grid-cols-[max-content_auto]", children: [data.isSelectable ? (_jsx("div", { className: componentClassNames?.select, children: _jsx(Switch, { name: data.id, onChange: onSelect, value: isSelected }) })) : null, _jsxs("div", { className: "grid gap-6 has-[>:nth-child(2)]:grid-cols-[auto_max-content]", children: [_jsxs("div", { className: 'grid grid-cols-1 gap-6 has-[>:nth-child(2)]:grid-cols-[1fr_1fr] has-[>:nth-child(3)]:grid-cols-[2fr_1fr_1fr]', children: [_jsxs("div", { className: componentClassNames?.primary, children: [data.title ? (_jsx("h2", { className: componentClassNames?.title, children: data.href ? (_jsx(Link, { className: "hover:text-link", href: normalizeHref(data.href, pathname), children: data.title })) : (data.title) })) : null, data.description ? (_jsx("div", { className: componentClassNames?.description, children: data.description })) : null, _jsx(ListItemMeta, { classNameProps: classNameProps, data: data.meta })] }), data.tertiary ? (_jsx("div", { className: componentClassNames?.tertiary, children: data.tertiary })) : null, _jsx(ListItemSecondary, { classNameProps: classNameProps, classNames: classNames, data: data.secondary })] }), hasActions ? (_jsx("div", { className: componentClassNames?.actions, children: _jsx(ListItemMenu, { actions: filteredActions, data: data.$data, isDisabled: !filteredActions.length }) })) : null] })] }) }) }));
|
|
24
19
|
}
|
|
25
20
|
export default ListItem;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { isValidElement } from 'react';
|
|
4
4
|
import { filterNull } from '@sqrzro/utility';
|
|
5
|
-
import { useClassNames } from '../../../styles/
|
|
5
|
+
import { useClassNames } from '../../../styles/context';
|
|
6
6
|
import isDataTableArray from '../../../utility/is-data-object-array';
|
|
7
7
|
import DataTable from '../DataTable';
|
|
8
8
|
function getKey(item) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { isValidElement } from 'react';
|
|
4
|
-
import { useClassNames } from '../../../styles/
|
|
4
|
+
import { useClassNames } from '../../../styles/context';
|
|
5
5
|
import ListItemMeta from '../ListItemMeta';
|
|
6
6
|
function ListItemSecondary({ classNameProps, classNames, data, }) {
|
|
7
7
|
const componentClassNames = useClassNames('listItem', { props: classNameProps }, classNames);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import usePagination from '../../../hooks/usePagination';
|
|
4
|
-
import { useClassNames } from '../../../styles/
|
|
5
|
-
import tw from '../../../styles/classnames/tw';
|
|
4
|
+
import { useClassNames } from '../../../styles/context';
|
|
5
|
+
import tw from '../../../styles/classnames/utility/tw';
|
|
6
6
|
import Link from '../../elements/Link';
|
|
7
7
|
import PaginationLink from '../PaginationLink';
|
|
8
8
|
function Pagination({ classNames, classNameProps, gapLabel = '•••', limit, nextLabel, page, previousLabel, total, }) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useClassNames } from '../../../styles/
|
|
3
|
+
import { useClassNames } from '../../../styles/context';
|
|
4
4
|
import Link from '../../elements/Link';
|
|
5
5
|
function PaginationLink({ classNameProps, classNames, href, isCurrent, label, }) {
|
|
6
6
|
const componentClassNames = useClassNames('pagination', { props: classNameProps, states: { isHighlighted: isCurrent } }, classNames);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import useSelected from '../../../hooks/useSelected';
|
|
4
|
-
import { useClassNames } from '../../../styles/
|
|
5
|
-
import tw from '../../../styles/classnames/tw';
|
|
4
|
+
import { useClassNames } from '../../../styles/context';
|
|
5
|
+
import tw from '../../../styles/classnames/utility/tw';
|
|
6
6
|
import isRightAligned from '../utility/is-right-aligned';
|
|
7
7
|
import TableRow from '../TableRow';
|
|
8
8
|
import Switch from '../../../forms/components/Switch';
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { filterNull } from '@sqrzro/utility';
|
|
4
4
|
import Switch from '../../../forms/components/Switch';
|
|
5
|
-
import { useClassNames } from '../../../styles/
|
|
6
|
-
import tw from '../../../styles/classnames/tw';
|
|
5
|
+
import { useClassNames } from '../../../styles/context';
|
|
6
|
+
import tw from '../../../styles/classnames/utility/tw';
|
|
7
7
|
import isRightAligned from '../utility/is-right-aligned';
|
|
8
8
|
import renderCell from '../utility/render-cell';
|
|
9
9
|
import ListItemMenu from '../ListItemMenu';
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { formatDate, formatDatetime, formatMoney, formatPoints, formatTime } from '@sqrzro/utility';
|
|
4
|
+
import { usePathname } from 'next/navigation';
|
|
3
5
|
import Link from '../../../components/elements/Link';
|
|
4
6
|
import Reference from '../../../components/elements/Reference';
|
|
7
|
+
import normalizeHref from './normalize-href';
|
|
5
8
|
function renderDefault(value) {
|
|
6
9
|
return value;
|
|
7
10
|
}
|
|
8
|
-
function renderLink(value) {
|
|
11
|
+
function renderLink(value, pathname) {
|
|
9
12
|
const match = value.match(/^\[([^\]]+)\]\(([^)]+)\)$/);
|
|
10
|
-
return match ? _jsx(Link, { href: match[2], children: match[1] }) : value;
|
|
13
|
+
return match ? _jsx(Link, { href: normalizeHref(match[2], pathname), children: match[1] }) : value;
|
|
11
14
|
}
|
|
12
15
|
const renderers = {
|
|
13
16
|
date: (value) => formatDate(value),
|
|
14
17
|
datetime: (value) => formatDatetime(value),
|
|
15
18
|
decimal: (value) => value.toFixed(2),
|
|
16
|
-
link: (value) => renderLink(value),
|
|
19
|
+
link: (value, pathname) => renderLink(value, pathname),
|
|
17
20
|
money: (value) => formatMoney(value),
|
|
18
21
|
number: (value) => renderDefault(value),
|
|
19
22
|
percentage: (value) => `${value.toFixed(2)}%`,
|
|
@@ -24,6 +27,7 @@ const renderers = {
|
|
|
24
27
|
time: (value) => formatTime(value),
|
|
25
28
|
};
|
|
26
29
|
function renderCell(column, value) {
|
|
27
|
-
|
|
30
|
+
const pathname = usePathname();
|
|
31
|
+
return renderers[column.type](value, pathname);
|
|
28
32
|
}
|
|
29
33
|
export default renderCell;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useClassNames } from '../../../styles/
|
|
4
|
-
import applyVariants from '../../../styles/classnames/apply-variants';
|
|
3
|
+
import { useClassNames } from '../../../styles/context';
|
|
4
|
+
import applyVariants from '../../../styles/classnames/utility/apply-variants';
|
|
5
5
|
function Badge({ classNameProps, classNames, children, variant }) {
|
|
6
6
|
const componentClassNames = useClassNames('badge', { props: { ...classNameProps, ...applyVariants(variant) } }, classNames);
|
|
7
7
|
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] }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useClassNames } from '../../../styles/
|
|
4
|
-
import applyVariants from '../../../styles/classnames/apply-variants';
|
|
3
|
+
import { useClassNames } from '../../../styles/context';
|
|
4
|
+
import applyVariants from '../../../styles/classnames/utility/apply-variants';
|
|
5
5
|
function InfoPanel({ classNameProps, classNames, children, variant, }) {
|
|
6
6
|
const componentClassNames = useClassNames('infoPanel', { props: { ...classNameProps, ...applyVariants(variant) } }, classNames);
|
|
7
7
|
return _jsx("aside", { className: componentClassNames?.root, children: children });
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { joinURL } from '@sqrzro/utility';
|
|
4
4
|
import NextLink from 'next/link';
|
|
5
|
-
import { useClassNames } from '../../../styles/
|
|
6
|
-
import tw from '../../../styles/classnames/tw';
|
|
5
|
+
import { useClassNames } from '../../../styles/context';
|
|
6
|
+
import tw from '../../../styles/classnames/utility/tw';
|
|
7
7
|
function normalizeHref(href) {
|
|
8
8
|
if (href.startsWith('#')) {
|
|
9
9
|
return href;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { filterNull } from '@sqrzro/utility';
|
|
4
4
|
import Button from '../../../components/buttons/Button';
|
|
5
|
-
import { useClassNames } from '../../../styles/
|
|
6
|
-
import tw from '../../../styles/classnames/tw';
|
|
5
|
+
import { useClassNames } from '../../../styles/context';
|
|
6
|
+
import tw from '../../../styles/classnames/utility/tw';
|
|
7
7
|
import Action from '../../utility/Action';
|
|
8
8
|
import Popover from '../../utility/Popover';
|
|
9
9
|
import MenuItem from '../MenuItem';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useClassNames } from '../../../styles/
|
|
3
|
+
import { useClassNames } from '../../../styles/context';
|
|
4
4
|
import Link from '../Link';
|
|
5
5
|
function MenuItem({ children, classNameProps, classNames, href, isLoading, onClick, }) {
|
|
6
6
|
const componentClassNames = useClassNames('menu', { props: classNameProps }, classNames);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { joinURL } from '@sqrzro/utility';
|
|
4
|
-
import { useClassNames } from '../../../styles/
|
|
4
|
+
import { useClassNames } from '../../../styles/context';
|
|
5
5
|
import Link from '../Link';
|
|
6
6
|
function Reference({ classNameProps, classNames, id, name, path, reference, }) {
|
|
7
7
|
const componentClassNames = useClassNames('reference', { props: classNameProps }, classNames);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { filterNull } from '@sqrzro/utility';
|
|
4
|
-
import { useClassNames } from '../../../styles/
|
|
5
|
-
import tw from '../../../styles/classnames/tw';
|
|
4
|
+
import { useClassNames } from '../../../styles/context';
|
|
5
|
+
import tw from '../../../styles/classnames/utility/tw';
|
|
6
6
|
const colMap = {
|
|
7
7
|
1: 'grid-cols-1',
|
|
8
8
|
2: 'grid-cols-2',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import ActionButton from '../../../components/buttons/ActionButton';
|
|
4
|
-
import { useClassNames } from '../../../styles/
|
|
4
|
+
import { useClassNames } from '../../../styles/context';
|
|
5
5
|
function AppError({ action, classNameProps, classNames, description, error, title, }) {
|
|
6
6
|
const componentClassNames = useClassNames('appError', { props: classNameProps }, classNames);
|
|
7
7
|
return (_jsx("div", { className: componentClassNames?.root, children: _jsxs("section", { className: componentClassNames?.panel, children: [_jsx("h2", { className: componentClassNames?.title, children: title }), _jsxs("div", { className: componentClassNames?.description, children: [description, error?.digest ? _jsxs("small", { children: ["Error code: ", error.digest] }) : null] }), action ? (_jsx("footer", { className: componentClassNames?.action, children: _jsx(ActionButton, { ...action }) })) : null] }) }));
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './collections/interfaces';
|
|
2
2
|
export type { ActionButtonProps } from './buttons/ActionButton';
|
|
3
3
|
export { default as ActionButton } from './buttons/ActionButton';
|
|
4
|
+
export type { AppBodyProps } from './utility/AppBody';
|
|
5
|
+
export { default as AppBody } from './utility/AppBody';
|
|
4
6
|
export type { ButtonProps } from './buttons/Button';
|
|
5
7
|
export { default as Button } from './buttons/Button';
|
|
6
8
|
export type { DataTableProps } from './collections/DataTable';
|
|
@@ -29,7 +31,6 @@ export type { AppForbiddenErrorProps } from './errors/AppForbiddenError';
|
|
|
29
31
|
export { default as AppForbiddenError } from './errors/AppForbiddenError';
|
|
30
32
|
export type { AppNotFoundErrorProps } from './errors/AppNotFoundError';
|
|
31
33
|
export { default as AppNotFoundError } from './errors/AppNotFoundError';
|
|
32
|
-
export { default as GlobalError } from './errors/GlobalError';
|
|
33
34
|
export type { MailProps } from './mail/Mail';
|
|
34
35
|
export { default as Mail } from './mail/Mail';
|
|
35
36
|
export type { MailBlockProps } from './mail/MailBlock';
|
|
@@ -46,5 +47,3 @@ export type { ContainerProps } from './utility/Container';
|
|
|
46
47
|
export { default as Container } from './utility/Container';
|
|
47
48
|
export type { PopoverProps } from './utility/Popover';
|
|
48
49
|
export { default as Popover } from './utility/Popover';
|
|
49
|
-
export type { RootLayoutProps } from './utility/RootLayout';
|
|
50
|
-
export { default as RootLayout } from './utility/RootLayout';
|
package/dist/components/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './collections/interfaces';
|
|
2
2
|
export { default as ActionButton } from './buttons/ActionButton';
|
|
3
|
+
export { default as AppBody } from './utility/AppBody';
|
|
3
4
|
export { default as Button } from './buttons/Button';
|
|
4
5
|
export { default as DataTable } from './collections/DataTable';
|
|
5
6
|
export { default as List } from './collections/List';
|
|
@@ -14,7 +15,6 @@ export { default as Summary } from './elements/Summary';
|
|
|
14
15
|
export { default as AppError } from './errors/AppError';
|
|
15
16
|
export { default as AppForbiddenError } from './errors/AppForbiddenError';
|
|
16
17
|
export { default as AppNotFoundError } from './errors/AppNotFoundError';
|
|
17
|
-
export { default as GlobalError } from './errors/GlobalError';
|
|
18
18
|
export { default as Mail } from './mail/Mail';
|
|
19
19
|
export { default as MailBlock } from './mail/MailBlock';
|
|
20
20
|
export { default as MailButton } from './mail/MailButton';
|
|
@@ -23,4 +23,3 @@ export { default as Modal } from './modals/Modal';
|
|
|
23
23
|
export { default as ModalLauncher } from './modals/ModalLauncher';
|
|
24
24
|
export { default as Container } from './utility/Container';
|
|
25
25
|
export { default as Popover } from './utility/Popover';
|
|
26
|
-
export { default as RootLayout } from './utility/RootLayout';
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
panel: string;
|
|
4
|
-
}
|
|
5
|
-
interface MailSizes {
|
|
6
|
-
panel: number;
|
|
7
|
-
}
|
|
8
|
-
export interface MailProps {
|
|
1
|
+
import type { AppConfig } from '@sqrzro/config';
|
|
2
|
+
export type MailProps = AppConfig['mail'] & {
|
|
9
3
|
children: React.ReactNode;
|
|
10
|
-
logoURL?: string;
|
|
11
|
-
styles?: Partial<{
|
|
12
|
-
colors: Partial<MailColors>;
|
|
13
|
-
sizes: Partial<MailSizes>;
|
|
14
|
-
}>;
|
|
15
4
|
title: string;
|
|
16
|
-
}
|
|
17
|
-
declare function Mail({ children,
|
|
5
|
+
};
|
|
6
|
+
declare function Mail({ children, logo, styles, title, }: Readonly<MailProps>): Promise<React.ReactElement>;
|
|
18
7
|
export default Mail;
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
const
|
|
7
|
-
|
|
2
|
+
/* eslint-disable max-lines-per-function, react/jsx-max-depth, react/no-danger */
|
|
3
|
+
import { Fragment } from 'react';
|
|
4
|
+
import { getAppConfig } from '@sqrzro/config';
|
|
5
|
+
import { deepMerge } from '@sqrzro/utility';
|
|
6
|
+
const DEFAULT_STYLES = {
|
|
7
|
+
styles: {
|
|
8
|
+
root: {
|
|
9
|
+
backgroundColor: '#f5f5f5',
|
|
10
|
+
},
|
|
11
|
+
panel: {
|
|
12
|
+
backgroundColor: '#ffffff',
|
|
13
|
+
padding: 40,
|
|
14
|
+
},
|
|
15
|
+
title: {
|
|
16
|
+
color: '#62748e',
|
|
17
|
+
fontSize: 20,
|
|
18
|
+
fontWeight: 'bold',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
8
21
|
};
|
|
9
22
|
const HALF = 2;
|
|
10
|
-
function Mail({ children,
|
|
11
|
-
const
|
|
12
|
-
const
|
|
23
|
+
async function Mail({ children, logo, styles, title, }) {
|
|
24
|
+
const styleConfig = deepMerge(DEFAULT_STYLES?.styles || {}, getAppConfig().mail?.styles || {}, styles || {});
|
|
25
|
+
const logoData = await (await import('../../../utility/convert-to-datauri')).default(logo ?? getAppConfig().mail?.logo ?? '');
|
|
13
26
|
return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx("meta", { charSet: "utf-8" }), _jsx("style", { dangerouslySetInnerHTML: {
|
|
14
27
|
__html: `
|
|
15
28
|
body {
|
|
16
|
-
color: #
|
|
29
|
+
color: #0f172b !important;
|
|
17
30
|
font-family: -apple-system, 'SF Pro Display', 'SF Pro Text', 'Helvetica', sans-serif;
|
|
18
31
|
font-size: 16px;
|
|
19
32
|
font-weight:400;
|
|
@@ -35,42 +48,66 @@ function Mail({ children, logoURL, styles, title }) {
|
|
|
35
48
|
}
|
|
36
49
|
}
|
|
37
50
|
`,
|
|
38
|
-
} })] }), _jsx("body", { children: _jsx("table", { border: 0, cellPadding: 0, cellSpacing: 0, width: "100%", children: _jsxs("tbody", { children: [_jsx("tr", { children: _jsx("td", { className: "padding", colSpan: 3, height: "20", style: { backgroundColor:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
} })] }), _jsx("body", { children: _jsx("table", { border: 0, cellPadding: 0, cellSpacing: 0, width: "100%", children: _jsxs("tbody", { children: [_jsx("tr", { children: _jsx("td", { className: "padding", colSpan: 3, height: "20", style: { backgroundColor: styleConfig.root.backgroundColor } }) }), _jsxs("tr", { children: [_jsx("td", { className: "padding", style: { backgroundColor: styleConfig.root.backgroundColor }, width: "20" }), _jsx("td", { align: "center", style: { backgroundColor: styleConfig.root.backgroundColor }, children: _jsx("table", { border: 0, cellPadding: 0, cellSpacing: 0, className: "container", width: "650", children: _jsxs("tbody", { children: [_jsxs("tr", { children: [_jsx("td", { className: "padding", height: "20", style: {
|
|
52
|
+
backgroundColor: styleConfig.panel.backgroundColor,
|
|
53
|
+
}, width: "20", children: _jsx("div", { className: "padding", style: {
|
|
54
|
+
backgroundColor: styleConfig.root.backgroundColor,
|
|
55
|
+
height: styleConfig.panel.padding,
|
|
56
|
+
width: styleConfig.panel.padding,
|
|
42
57
|
}, children: _jsx("div", { className: "padding", style: {
|
|
43
|
-
backgroundColor:
|
|
44
|
-
borderTopLeftRadius:
|
|
45
|
-
height:
|
|
46
|
-
width:
|
|
47
|
-
} }) }) }), _jsx("td", { className: "container", style: {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
58
|
+
backgroundColor: styleConfig.panel.backgroundColor,
|
|
59
|
+
borderTopLeftRadius: styleConfig.panel.padding / HALF,
|
|
60
|
+
height: styleConfig.panel.padding,
|
|
61
|
+
width: styleConfig.panel.padding,
|
|
62
|
+
} }) }) }), _jsx("td", { className: "container", style: {
|
|
63
|
+
backgroundColor: styleConfig.panel.backgroundColor,
|
|
64
|
+
}, width: "610" }), _jsx("td", { className: "padding", height: styleConfig.panel.padding, style: {
|
|
65
|
+
backgroundColor: styleConfig.panel.backgroundColor,
|
|
66
|
+
}, width: styleConfig.panel.padding, children: _jsx("div", { className: "padding", style: {
|
|
67
|
+
backgroundColor: styleConfig.root.backgroundColor,
|
|
68
|
+
height: styleConfig.panel.padding,
|
|
69
|
+
width: styleConfig.panel.padding,
|
|
51
70
|
}, children: _jsx("div", { className: "padding", style: {
|
|
52
|
-
backgroundColor:
|
|
53
|
-
borderTopRightRadius:
|
|
54
|
-
height:
|
|
55
|
-
width:
|
|
56
|
-
} }) }) })] }), _jsxs("tr", { children: [_jsx("td", { className: "padding", style: {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
71
|
+
backgroundColor: styleConfig.panel.backgroundColor,
|
|
72
|
+
borderTopRightRadius: styleConfig.panel.padding / HALF,
|
|
73
|
+
height: styleConfig.panel.padding,
|
|
74
|
+
width: styleConfig.panel.padding,
|
|
75
|
+
} }) }) })] }), _jsxs("tr", { children: [_jsx("td", { className: "padding", style: {
|
|
76
|
+
backgroundColor: styleConfig.panel.backgroundColor,
|
|
77
|
+
}, width: styleConfig.panel.padding }), _jsx("td", { style: {
|
|
78
|
+
backgroundColor: styleConfig.panel.backgroundColor,
|
|
79
|
+
}, children: _jsx("table", { border: 0, cellPadding: 0, cellSpacing: 0, width: "100%", children: _jsxs("tbody", { children: [logoData ? (_jsxs(Fragment, { children: [_jsx("tr", { children: _jsx("td", { children: _jsx("table", { border: 0, cellPadding: 0, cellSpacing: 0, width: 240, children: _jsx("tbody", { children: _jsx("tr", { children: _jsx("td", { children: _jsx("img", { alt: "Logo", src: logoData, width: 240 }) }) }) }) }) }) }), _jsx("tr", { children: _jsx("td", { height: styleConfig.panel
|
|
80
|
+
.padding }) })] })) : null, _jsx("tr", { children: _jsx("td", { style: {
|
|
81
|
+
color: styleConfig.title.color,
|
|
82
|
+
fontSize: styleConfig.title.fontSize,
|
|
83
|
+
fontWeight: styleConfig.title
|
|
84
|
+
.fontWeight,
|
|
85
|
+
}, children: title }) }), _jsx("tr", { children: _jsx("td", { height: styleConfig.panel.padding }) }), _jsx("tr", { children: _jsx("td", { children: children }) })] }) }) }), _jsx("td", { className: "padding", style: {
|
|
86
|
+
backgroundColor: styleConfig.panel.backgroundColor,
|
|
87
|
+
}, width: styleConfig.panel.padding })] }), _jsxs("tr", { children: [_jsx("td", { className: "padding", height: styleConfig.panel.padding, style: {
|
|
88
|
+
backgroundColor: styleConfig.panel.backgroundColor,
|
|
89
|
+
}, width: styleConfig.panel.padding, children: _jsx("div", { className: "padding", style: {
|
|
90
|
+
backgroundColor: styleConfig.root.backgroundColor,
|
|
91
|
+
height: styleConfig.panel.padding,
|
|
92
|
+
width: styleConfig.panel.padding,
|
|
60
93
|
}, children: _jsx("div", { className: "padding", style: {
|
|
61
|
-
backgroundColor:
|
|
62
|
-
borderBottomLeftRadius:
|
|
63
|
-
height:
|
|
64
|
-
width:
|
|
65
|
-
} }) }) }), _jsx("td", { className: "container", style: {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
94
|
+
backgroundColor: styleConfig.panel.backgroundColor,
|
|
95
|
+
borderBottomLeftRadius: styleConfig.panel.padding / HALF,
|
|
96
|
+
height: styleConfig.panel.padding,
|
|
97
|
+
width: styleConfig.panel.padding,
|
|
98
|
+
} }) }) }), _jsx("td", { className: "container", style: {
|
|
99
|
+
backgroundColor: styleConfig.panel.backgroundColor,
|
|
100
|
+
}, width: "610" }), _jsx("td", { className: "padding", height: styleConfig.panel.padding, style: {
|
|
101
|
+
backgroundColor: styleConfig.panel.backgroundColor,
|
|
102
|
+
}, width: styleConfig.panel.padding, children: _jsx("div", { className: "padding", style: {
|
|
103
|
+
backgroundColor: styleConfig.root.backgroundColor,
|
|
104
|
+
height: styleConfig.panel.padding,
|
|
105
|
+
width: styleConfig.panel.padding,
|
|
69
106
|
}, children: _jsx("div", { className: "padding", style: {
|
|
70
|
-
backgroundColor:
|
|
71
|
-
borderBottomRightRadius:
|
|
72
|
-
height:
|
|
73
|
-
width:
|
|
74
|
-
} }) }) })] })] }) }) }), _jsx("td", { className: "padding", style: { backgroundColor:
|
|
107
|
+
backgroundColor: styleConfig.panel.backgroundColor,
|
|
108
|
+
borderBottomRightRadius: styleConfig.panel.padding / HALF,
|
|
109
|
+
height: styleConfig.panel.padding,
|
|
110
|
+
width: styleConfig.panel.padding,
|
|
111
|
+
} }) }) })] })] }) }) }), _jsx("td", { className: "padding", style: { backgroundColor: styleConfig.root.backgroundColor }, width: "20" })] }), _jsx("tr", { children: _jsx("td", { className: "padding", colSpan: 3, height: "20", style: { backgroundColor: styleConfig.root.backgroundColor } }) })] }) }) })] }));
|
|
75
112
|
}
|
|
76
113
|
export default Mail;
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
borderRadius: number;
|
|
4
|
-
color: string;
|
|
5
|
-
height: number;
|
|
6
|
-
width: number;
|
|
7
|
-
}
|
|
8
|
-
export interface MailButtonProps {
|
|
1
|
+
import type { AppConfig } from '@sqrzro/config';
|
|
2
|
+
export type MailButtonProps = AppConfig['mail'] & {
|
|
9
3
|
children: string;
|
|
10
4
|
href: string;
|
|
11
|
-
|
|
12
|
-
}
|
|
5
|
+
};
|
|
13
6
|
declare function MailButton({ children, href, styles }: Readonly<MailButtonProps>): React.ReactElement;
|
|
14
7
|
export default MailButton;
|