@sqrzro/ui 4.0.0-alpha.13 → 4.0.0-alpha.15
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.d.ts +4 -4
- package/dist/components/buttons/Button/index.js +5 -14
- package/dist/components/collections/Collection/index.d.ts +4 -1
- package/dist/components/collections/Collection/index.js +2 -2
- package/dist/components/collections/DataTable/index.d.ts +2 -2
- package/dist/components/collections/DataTable/index.js +5 -4
- package/dist/components/collections/EmptyMessage/index.d.ts +1 -1
- package/dist/components/collections/EmptyMessage/index.js +3 -4
- package/dist/components/collections/List/index.d.ts +2 -1
- package/dist/components/collections/ListClientComponent/index.d.ts +6 -2
- package/dist/components/collections/ListClientComponent/index.js +4 -2
- package/dist/components/collections/ListItem/index.d.ts +1 -1
- package/dist/components/collections/ListItem/index.js +5 -5
- package/dist/components/collections/ListItemMeta/index.d.ts +6 -4
- package/dist/components/collections/ListItemMeta/index.js +12 -7
- package/dist/components/collections/ListItemSecondary/index.d.ts +1 -1
- package/dist/components/collections/ListItemSecondary/index.js +3 -4
- package/dist/components/collections/Pagination/index.d.ts +1 -1
- package/dist/components/collections/Pagination/index.js +5 -6
- package/dist/components/collections/PaginationLink/index.d.ts +9 -0
- package/dist/components/collections/PaginationLink/index.js +8 -0
- package/dist/components/collections/TableClientComponent/index.d.ts +1 -1
- package/dist/components/collections/TableClientComponent/index.js +4 -7
- package/dist/components/collections/TableRow/index.d.ts +12 -0
- package/dist/components/collections/TableRow/index.js +9 -0
- package/dist/components/collections/interfaces.d.ts +5 -12
- package/dist/components/collections/utility/is-data-table-array.d.ts +3 -0
- package/dist/components/collections/utility/is-data-table-array.js +5 -0
- package/dist/components/collections/utility/is-data-table-object.d.ts +3 -0
- package/dist/components/collections/utility/is-data-table-object.js +4 -0
- package/dist/components/errors/AppError/index.d.ts +19 -0
- package/dist/components/errors/AppError/index.js +8 -0
- package/dist/components/errors/AppForbiddenError/index.d.ts +7 -0
- package/dist/components/errors/AppForbiddenError/index.js +6 -0
- package/dist/components/errors/AppNotFoundError/index.d.ts +7 -0
- package/dist/components/errors/AppNotFoundError/index.js +6 -0
- package/dist/components/errors/AppServerError/index.d.ts +8 -0
- package/dist/components/errors/AppServerError/index.js +17 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +3 -0
- package/dist/components/modals/ConfirmModal/index.js +1 -1
- package/dist/components/modals/Modal/index.d.ts +1 -1
- package/dist/components/modals/Modal/index.js +3 -3
- package/dist/components/modals/ModalActions/index.d.ts +1 -1
- package/dist/components/modals/ModalActions/index.js +3 -3
- package/dist/components/utility/ActionList/index.d.ts +1 -1
- package/dist/components/utility/ActionList/index.js +2 -2
- package/dist/components/utility/ClassNamesClientComponent/index.d.ts +6 -0
- package/dist/components/utility/ClassNamesClientComponent/index.js +7 -0
- package/dist/components/utility/Container/index.d.ts +1 -1
- package/dist/components/utility/Container/index.js +2 -2
- package/dist/components/utility/Link/index.d.ts +1 -1
- package/dist/components/utility/Link/index.js +3 -3
- package/dist/components/utility/Loader/index.d.ts +1 -1
- package/dist/components/utility/Loader/index.js +4 -4
- package/dist/components/utility/Popover/index.d.ts +1 -1
- package/dist/components/utility/Popover/index.js +4 -4
- package/dist/components/utility/RootLayout/index.d.ts +2 -2
- package/dist/components/utility/RootLayout/index.js +6 -5
- package/dist/components/utility/Toast/index.d.ts +1 -1
- package/dist/components/utility/Toast/index.js +2 -2
- package/dist/filters/components/FilterBarClientComponent/index.d.ts +1 -1
- package/dist/filters/components/FilterBarClientComponent/index.js +2 -2
- package/dist/filters/components/FilterControl/index.d.ts +1 -1
- package/dist/filters/components/FilterControl/index.js +7 -4
- package/dist/filters/components/FilterItem/index.d.ts +1 -1
- package/dist/filters/components/FilterItem/index.js +2 -2
- package/dist/filters/components/FilterPanel/index.d.ts +1 -1
- package/dist/filters/filters/Filter/index.d.ts +1 -1
- package/dist/filters/filters/Filter/index.js +3 -4
- package/dist/filters/filters/SearchFilter/index.js +1 -1
- package/dist/filters/index.d.ts +1 -0
- package/dist/filters/index.js +1 -0
- package/dist/forms/components/Autocomplete/index.d.ts +1 -1
- package/dist/forms/components/Dropdown/index.d.ts +1 -1
- package/dist/forms/components/Dropdown/index.js +7 -4
- package/dist/forms/components/DropdownItem/index.d.ts +9 -0
- package/dist/forms/components/DropdownItem/index.js +8 -0
- package/dist/forms/components/DropdownList/index.d.ts +1 -1
- package/dist/forms/components/DropdownList/index.js +5 -10
- package/dist/forms/components/EditableForm/index.d.ts +1 -1
- package/dist/forms/components/EditableForm/index.js +3 -4
- package/dist/forms/components/EditableFormField/index.d.ts +1 -1
- package/dist/forms/components/EditableFormField/index.js +2 -2
- package/dist/forms/components/Form/index.d.ts +1 -1
- package/dist/forms/components/Form/index.js +3 -3
- package/dist/forms/components/FormError/index.d.ts +1 -1
- package/dist/forms/components/FormError/index.js +3 -3
- package/dist/forms/components/FormField/index.d.ts +2 -2
- package/dist/forms/components/FormField/index.js +7 -6
- package/dist/forms/components/FormLabel/index.d.ts +1 -1
- package/dist/forms/components/FormLabel/index.js +3 -3
- package/dist/forms/components/ModalForm/index.js +1 -1
- package/dist/forms/components/NumberInput/index.d.ts +1 -1
- package/dist/forms/components/PasswordComplexity/index.d.ts +9 -0
- package/dist/forms/components/PasswordComplexity/index.js +10 -0
- package/dist/forms/components/PasswordInput/index.d.ts +1 -1
- package/dist/forms/components/PasswordInput/index.js +4 -5
- package/dist/forms/components/StaticTextInput/index.d.ts +1 -1
- package/dist/forms/components/StaticTextInput/index.js +4 -7
- package/dist/forms/components/Switch/index.d.ts +1 -1
- package/dist/forms/components/Switch/index.js +4 -4
- package/dist/forms/components/TextInput/index.d.ts +1 -1
- package/dist/forms/components/TextInput/index.js +4 -4
- package/dist/forms/hooks/useForm.js +1 -1
- package/dist/forms/index.d.ts +4 -2
- package/dist/forms/index.js +2 -1
- package/dist/navigation/components/AppNavigation/index.d.ts +1 -1
- package/dist/navigation/components/AppNavigation/index.js +2 -2
- package/dist/navigation/components/AppNavigationItem/index.d.ts +1 -1
- package/dist/navigation/components/AppNavigationItem/index.js +3 -4
- package/dist/navigation/components/Tabs/index.js +2 -2
- package/dist/navigation/hooks/useNavigation.js +5 -5
- package/dist/styles/classnames/apply-variants.d.ts +3 -0
- package/dist/styles/classnames/apply-variants.js +25 -0
- package/dist/styles/classnames/config.d.ts +67 -0
- package/dist/styles/classnames/index.d.ts +7 -0
- package/dist/styles/classnames/index.js +37 -0
- package/dist/styles/classnames/interfaces.d.ts +56 -0
- package/dist/styles/classnames/interfaces.js +1 -0
- package/dist/styles/classnames/utility/is-classname-object.d.ts +3 -0
- package/dist/styles/classnames/utility/is-classname-object.js +7 -0
- package/dist/styles/icons/config.d.ts +9 -0
- package/dist/styles/icons/config.js +1 -0
- package/dist/styles/icons/index.d.ts +4 -0
- package/dist/styles/icons/interfaces.d.ts +4 -0
- package/dist/styles/icons/interfaces.js +1 -0
- package/dist/styles/index.d.ts +2 -2
- package/dist/styles/index.js +1 -1
- package/dist/styles/styles.css +59 -0
- package/dist/utility/interfaces.d.ts +1 -2
- package/package.json +9 -4
- package/dist/components/utility/ClassNames/index.d.ts +0 -6
- package/dist/components/utility/ClassNames/index.js +0 -7
- package/dist/styles/config.d.ts +0 -66
- package/dist/styles/config.js +0 -43
- package/dist/styles/icons.d.ts +0 -15
- package/dist/styles/interfaces.d.ts +0 -41
- /package/dist/styles/{interfaces.js → classnames/config.js} +0 -0
- /package/dist/styles/{tw.d.ts → classnames/tw.d.ts} +0 -0
- /package/dist/styles/{tw.js → classnames/tw.js} +0 -0
- /package/dist/styles/{icons.js → icons/index.js} +0 -0
|
@@ -9,7 +9,7 @@ function ConfirmModal({ confirmable, ...modalProps }) {
|
|
|
9
9
|
setConfirmText(event.target.value?.toUpperCase() || '');
|
|
10
10
|
}
|
|
11
11
|
return (_jsxs(Modal, { ...modalProps, actions: [
|
|
12
|
-
{ label: 'Cancel'
|
|
12
|
+
{ label: 'Cancel' },
|
|
13
13
|
...(confirmable.actions || []),
|
|
14
14
|
{
|
|
15
15
|
isDisabled: Boolean(confirmable.confirmText &&
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useRef } from 'react';
|
|
4
|
-
import { getClassNames } from '../../../styles/
|
|
5
|
-
import tw from '../../../styles/tw';
|
|
4
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
5
|
+
import tw from '../../../styles/classnames/tw';
|
|
6
6
|
import ModalActions from '../ModalActions';
|
|
7
7
|
function Modal({ actions, children, classNames, classNameProps, icon, isLoading, title, }) {
|
|
8
|
-
const componentClassNames =
|
|
8
|
+
const componentClassNames = getClassNames('modal', { props: classNameProps }, classNames);
|
|
9
9
|
const ref = useRef(null);
|
|
10
10
|
useEffect(() => {
|
|
11
11
|
if (ref.current) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ClassNameProps } from '../../../styles/interfaces';
|
|
1
|
+
import type { ClassNameProps } from '../../../styles/classnames/interfaces';
|
|
2
2
|
import { Action } from '../../../utility/interfaces';
|
|
3
3
|
import type { ModalClassNames } from '../Modal';
|
|
4
4
|
export interface ModalActionsProps extends ClassNameProps<ModalClassNames> {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import ActionList from '../../../components/utility/ActionList';
|
|
3
|
-
import { getClassNames } from '../../../styles/
|
|
3
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
4
4
|
function ModalActions({ actions, classNameProps, classNames, isLoading, }) {
|
|
5
|
-
const componentClassNames =
|
|
6
|
-
return (_jsx("footer", { className: componentClassNames?.actions, children: _jsx(ActionList, { actions: actions, classNameProps: { ...
|
|
5
|
+
const componentClassNames = getClassNames('modal', { props: classNameProps }, classNames);
|
|
6
|
+
return (_jsx("footer", { className: componentClassNames?.actions, children: _jsx(ActionList, { actions: actions, classNameProps: { ...classNameProps, isModal: true }, isLoading: isLoading }) }));
|
|
7
7
|
}
|
|
8
8
|
export default ModalActions;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { filterNull } from '@sqrzro/utility';
|
|
3
3
|
import ActionButton from '../../../components/buttons/ActionButton';
|
|
4
|
-
import { getClassNames } from '../../../styles/
|
|
4
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
5
5
|
function ActionList({ actions, classNameProps, classNames, isLoading, }) {
|
|
6
|
-
const componentClassNames =
|
|
6
|
+
const componentClassNames = getClassNames('actionList', { props: classNameProps }, classNames);
|
|
7
7
|
return (_jsx("ul", { className: componentClassNames?.root, children: filterNull(actions).map((action, index) => (_jsx("li", { className: componentClassNames?.item, children: _jsx(ActionButton, { ...action, isLoading: Boolean(isLoading || action.isDisabled) }) }, index))) }));
|
|
8
8
|
}
|
|
9
9
|
export default ActionList;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RegisteredClassNames } from '../../../styles/classnames/config';
|
|
2
|
+
export interface ClassNamesClientComponentProps {
|
|
3
|
+
data: RegisteredClassNames;
|
|
4
|
+
}
|
|
5
|
+
declare function ClassNamesClientComponent({ data }: ClassNamesClientComponentProps): null;
|
|
6
|
+
export default ClassNamesClientComponent;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { getClassNames } from '../../../styles/
|
|
3
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
4
4
|
function Container({ children, classNameProps, classNames, }) {
|
|
5
|
-
const componentClassNames =
|
|
5
|
+
const componentClassNames = getClassNames('container', { props: classNameProps }, classNames);
|
|
6
6
|
return _jsx("div", { className: componentClassNames?.root, children: children });
|
|
7
7
|
}
|
|
8
8
|
export default Container;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import NextLink from 'next/link';
|
|
3
|
-
import { getClassNames } from '../../../styles/
|
|
4
|
-
import tw from '../../../styles/tw';
|
|
3
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
4
|
+
import tw from '../../../styles/classnames/tw';
|
|
5
5
|
function normalizeHref(href) {
|
|
6
6
|
if (!href) {
|
|
7
7
|
return '';
|
|
@@ -12,7 +12,7 @@ function normalizeHref(href) {
|
|
|
12
12
|
return /^\//u.exec(href) ? href : `/${href}`;
|
|
13
13
|
}
|
|
14
14
|
function Link({ children, className, classNames, classNameProps, isNewWindow, href = '/', id, onClick, scroll, style, ...dataProps }) {
|
|
15
|
-
const componentClassNames =
|
|
15
|
+
const componentClassNames = getClassNames('link', { props: classNameProps }, classNames);
|
|
16
16
|
const newWindowProps = isNewWindow
|
|
17
17
|
? { rel: 'noopener noreferrer', target: '_blank' }
|
|
18
18
|
: {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ClassNameProps, SizableClassName } from '../../../styles/interfaces';
|
|
1
|
+
import type { ClassNameProps, SizableClassName } from '../../../styles/classnames/interfaces';
|
|
2
2
|
export interface LoaderClassNames {
|
|
3
3
|
root?: SizableClassName;
|
|
4
4
|
inner?: SizableClassName;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { getClassNames } from '../../../styles/
|
|
3
|
-
import tw from '../../../styles/tw';
|
|
2
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
3
|
+
import tw from '../../../styles/classnames/tw';
|
|
4
4
|
import Assistive from '../Assistive';
|
|
5
5
|
function Loader({ classNameProps, classNames }) {
|
|
6
|
-
const componentClassNames =
|
|
7
|
-
return (_jsxs("div", { className: tw(componentClassNames?.root
|
|
6
|
+
const componentClassNames = getClassNames('loader', { props: classNameProps }, classNames);
|
|
7
|
+
return (_jsxs("div", { className: tw(componentClassNames?.root), children: [_jsx("div", { className: tw(componentClassNames?.inner) }), _jsx(Assistive, { children: "Loading..." })] }));
|
|
8
8
|
}
|
|
9
9
|
export default Loader;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useRef, useState } from 'react';
|
|
4
|
-
import { getClassNames } from '../../../styles/
|
|
5
|
-
import tw from '../../../styles/tw';
|
|
4
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
5
|
+
import tw from '../../../styles/classnames/tw';
|
|
6
6
|
const HORIZONTAL_THRESHOLD = 40;
|
|
7
7
|
const VERTICAL_THRESHOLD = 40;
|
|
8
8
|
function getPositionStyles(align = 'left', vAlign = 'top') {
|
|
@@ -22,7 +22,7 @@ function getPositionStyles(align = 'left', vAlign = 'top') {
|
|
|
22
22
|
: 'left-1/2 -translate-x-1/2 origin-top top-full';
|
|
23
23
|
}
|
|
24
24
|
function Popover({ align: initialAlign = 'left', children, classNames, classNameProps, isOpen, isScrollable, vAlign: initialVAlign = 'bottom', }) {
|
|
25
|
-
const componentClassNames =
|
|
25
|
+
const componentClassNames = getClassNames('popover', { props: classNameProps, states: { isFocused: isOpen ?? false } }, classNames);
|
|
26
26
|
const [align, setAlign] = useState(initialAlign);
|
|
27
27
|
const [vAlign, setVAlign] = useState(initialVAlign);
|
|
28
28
|
const ref = useRef(null);
|
|
@@ -66,6 +66,6 @@ function Popover({ align: initialAlign = 'left', children, classNames, className
|
|
|
66
66
|
window.removeEventListener('scroll', handleResize);
|
|
67
67
|
};
|
|
68
68
|
}, []);
|
|
69
|
-
return (_jsx("div", { ref: ref, className: tw('absolute', getPositionStyles(align, vAlign), componentClassNames?.root
|
|
69
|
+
return (_jsx("div", { ref: ref, className: tw('absolute', getPositionStyles(align, vAlign), componentClassNames?.root), style: { display: isOpen ? 'block' : 'none' }, children: isScrollable ? (_jsx("div", { className: componentClassNames?.scroll, children: children })) : (children) }));
|
|
70
70
|
}
|
|
71
71
|
export default Popover;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ClassNameProps } from '../../../styles/interfaces';
|
|
1
|
+
import type { RegisteredClassNames } from '../../../styles/classnames/config';
|
|
2
|
+
import type { ClassNameProps } from '../../../styles/classnames/interfaces';
|
|
3
3
|
export interface RootLayoutClassNames {
|
|
4
4
|
root: string;
|
|
5
5
|
content: string;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { getClassNames, registerClassNames } from '../../../styles/
|
|
3
|
-
import
|
|
2
|
+
import { getClassNames, registerClassNames } from '../../../styles/classnames';
|
|
3
|
+
import ClassNamesClientComponent from '../ClassNamesClientComponent';
|
|
4
4
|
import Toaster from '../Toaster';
|
|
5
|
+
import tw from '../../../styles/classnames/tw';
|
|
5
6
|
function RootLayout({ children, classNameConfig, classNameProps, classNames, font, }) {
|
|
6
7
|
if (classNameConfig) {
|
|
7
8
|
registerClassNames(classNameConfig);
|
|
8
9
|
}
|
|
9
|
-
const componentClassNames =
|
|
10
|
-
return (_jsxs("html", { lang: "en", className: font?.variable, children: [_jsx("head", { children: _jsx("link", { href: "/images/favicon.svg", rel: "icon" }) }), _jsxs("body", { className: componentClassNames?.root, children: [_jsx("script", { dangerouslySetInnerHTML: {
|
|
10
|
+
const componentClassNames = getClassNames('rootLayout', { props: classNameProps }, classNames);
|
|
11
|
+
return (_jsxs("html", { lang: "en", className: font?.variable, children: [_jsx("head", { children: _jsx("link", { href: "/images/favicon.svg", rel: "icon" }) }), _jsxs("body", { className: tw('overflow-x-hidden overflow-y-scroll has-[[data-modal][open]]:overflow-hidden', componentClassNames?.root), children: [_jsx("script", { dangerouslySetInnerHTML: {
|
|
11
12
|
__html: "(function(d){var v=d.createElement('div'),t=d.createElement('style'),s=v.style;s.overflowY='scroll';s.width='50';s.height='50';d.body.append(v);t.innerHTML='body:has([data-modal][open]){padding-right:'+(v.offsetWidth-v.clientWidth)+'px}';d.body.append(t);v.remove()}(document))",
|
|
12
|
-
} }), classNameConfig ? _jsx(
|
|
13
|
+
} }), classNameConfig ? _jsx(ClassNamesClientComponent, { data: classNameConfig }) : null, _jsx("div", { className: tw('flex min-h-screen flex-col', componentClassNames?.content), children: children }), _jsx(Toaster, {})] })] }));
|
|
13
14
|
}
|
|
14
15
|
export default RootLayout;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ClassNameProps, StylableClassName } from '../../../styles/interfaces';
|
|
1
|
+
import type { ClassNameProps, StylableClassName } from '../../../styles/classnames/interfaces';
|
|
2
2
|
import type { StyleVariant } from '../../../utility/interfaces';
|
|
3
3
|
export interface ToastClassNames {
|
|
4
4
|
root: StylableClassName;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { getClassNames } from '../../../styles/
|
|
3
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
4
4
|
function Toast({ children, classNames, classNameProps, }) {
|
|
5
|
-
const componentClassNames =
|
|
5
|
+
const componentClassNames = getClassNames('toast', { props: classNameProps }, classNames);
|
|
6
6
|
if (!children) {
|
|
7
7
|
return null;
|
|
8
8
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TableColumnObject } from '../../../components/collections/interfaces';
|
|
2
|
-
import type { ClassNameProps } from '../../../styles/interfaces';
|
|
2
|
+
import type { ClassNameProps } from '../../../styles/classnames/interfaces';
|
|
3
3
|
import type { ClientFilterMap } from '../../interfaces';
|
|
4
4
|
export interface FilterBarClassNames {
|
|
5
5
|
root: string;
|
|
@@ -10,12 +10,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
// import type { ClassNameProps } from '../../../utility/interfaces';
|
|
11
11
|
import { getEntries } from '@sqrzro/utility';
|
|
12
12
|
import useFilters from '../../../filters/hooks/useFilters';
|
|
13
|
-
import { getClassNames } from '../../../styles/
|
|
13
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
14
14
|
import SearchFilter from '../../filters/SearchFilter';
|
|
15
15
|
import FilterItem from '../FilterItem';
|
|
16
16
|
const FILTERED_TYPES = ['assistive', 'search'];
|
|
17
17
|
function FilterBarClientComponent({ classNames, classNameProps, columns, map, }) {
|
|
18
|
-
const componentClassNames =
|
|
18
|
+
const componentClassNames = getClassNames('filterBar', { props: classNameProps }, classNames);
|
|
19
19
|
const [filters, setFilter] = useFilters();
|
|
20
20
|
const mapArray = map ? getEntries(map) : [];
|
|
21
21
|
const hasSearch = mapArray.some(([, item]) => item?.type === 'search');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClassNameProps } from '../../../styles/interfaces';
|
|
1
|
+
import { ClassNameProps } from '../../../styles/classnames/interfaces';
|
|
2
2
|
import type { FilterItemClassNames } from '../FilterItem';
|
|
3
3
|
interface FilterControlProps extends ClassNameProps<FilterItemClassNames> {
|
|
4
4
|
children: React.ReactNode;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// import FilterClearButton from '../FilterClearButton';
|
|
3
|
-
import { getClassNames } from '../../../styles/
|
|
4
|
-
import tw from '../../../styles/tw';
|
|
3
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
4
|
+
import tw from '../../../styles/classnames/tw';
|
|
5
5
|
import FilterClearButton from '../FilterClearButton';
|
|
6
6
|
function FilterControl({ classNameProps, classNames, children, isDisabled, isFocused, isHighlighted, onClear, onClick, }) {
|
|
7
|
-
const componentClassNames =
|
|
8
|
-
|
|
7
|
+
const componentClassNames = getClassNames('filterItem', {
|
|
8
|
+
props: classNameProps,
|
|
9
|
+
states: { isFocused: isFocused ?? false, isHighlighted: isHighlighted ?? false },
|
|
10
|
+
}, classNames);
|
|
11
|
+
return (_jsxs("div", { className: tw(componentClassNames?.root, isDisabled ? 'pointer-events-none opacity-30' : null), children: [children, isFocused && onClear ? _jsx(FilterClearButton, { onClick: onClear }) : null, onClick ? (_jsx("button", { className: "absolute -inset-1 z-10 select-none text-transparent", disabled: isDisabled, onClick: onClick, type: "button", children: "Edit" })) : null] }));
|
|
9
12
|
}
|
|
10
13
|
export default FilterControl;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InputProps } from '../../../forms/interfaces';
|
|
2
|
-
import { ClassNameProps, FocusableClassName, HighlightableClassName } from '../../../styles/interfaces';
|
|
2
|
+
import { ClassNameProps, FocusableClassName, HighlightableClassName } from '../../../styles/classnames/interfaces';
|
|
3
3
|
import { ClientFilterObject, FilterType } from '../../interfaces';
|
|
4
4
|
export interface FilterItemClassNames {
|
|
5
5
|
root: FocusableClassName & HighlightableClassName;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
4
|
import useClickOutside from '../../../hooks/useClickOutside';
|
|
5
|
-
import { getClassNames } from '../../../styles/
|
|
5
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
6
6
|
import renderValue from '../../utility/render-value';
|
|
7
7
|
import FilterControl from '../FilterControl';
|
|
8
8
|
import FilterPanel from '../FilterPanel';
|
|
9
9
|
function FilterItem({ align, classNameProps, classNames, config, icon, isDisabled, label, name, onChange, title, type, value, }) {
|
|
10
|
-
const componentClassNames =
|
|
10
|
+
const componentClassNames = getClassNames('filterItem', { props: classNameProps }, classNames);
|
|
11
11
|
const [isOpen, setIsOpen, node] = useClickOutside();
|
|
12
12
|
// const { dynamicConfig } = useDynamicData(config);
|
|
13
13
|
const [pendingValue, setPendingValue] = useState(value);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InputProps } from '../../../forms/interfaces';
|
|
2
|
-
import { SizableClassName } from '../../../styles/interfaces';
|
|
2
|
+
import { SizableClassName } from '../../../styles/classnames/interfaces';
|
|
3
3
|
import type { ClientFilterObject, FilterType } from '../../interfaces';
|
|
4
4
|
export interface FilterPanelClassNames {
|
|
5
5
|
content: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ClientFilterObject, FilterType } from '../../../filters/interfaces';
|
|
3
|
-
import { ClassNameProps } from '../../../styles/interfaces';
|
|
3
|
+
import type { ClassNameProps } from '../../../styles/classnames/interfaces';
|
|
4
4
|
import { FilterPanelClassNames } from '../../components/FilterPanel';
|
|
5
5
|
import { FilterComponentSize } from '../interfaces';
|
|
6
6
|
interface FilterProps<F extends FilterType> extends ClassNameProps<FilterPanelClassNames>, ClientFilterObject<F> {
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import Button from '../../../components/buttons/Button';
|
|
4
4
|
import Popover from '../../../components/utility/Popover';
|
|
5
|
-
import { getClassNames } from '../../../styles/
|
|
5
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
6
6
|
import { getIcon } from '../../../styles/icons';
|
|
7
|
-
import tw from '../../../styles/tw';
|
|
8
7
|
function Filter({ align, children, classNameProps, classNames, icon, isOpen, label, onApply, size, title, }) {
|
|
9
|
-
const componentClassNames =
|
|
8
|
+
const componentClassNames = getClassNames('filterPanel', { props: classNameProps }, classNames);
|
|
10
9
|
const DefaultIcon = getIcon('filter.panel');
|
|
11
|
-
return (_jsx(Popover, { align: align, isOpen: isOpen, children: _jsxs("div", { className:
|
|
10
|
+
return (_jsx(Popover, { align: align, isOpen: isOpen, children: _jsxs("div", { className: componentClassNames?.root, children: [_jsxs("p", { className: componentClassNames?.title, children: [icon === false ? null : (_jsx("span", { className: componentClassNames?.icon, children: icon || (DefaultIcon ? _jsx(DefaultIcon, {}) : null) })), title || (label ? `Filter by ${label}` : 'Filter')] }), _jsx("div", { className: componentClassNames?.content, children: children }), _jsx("div", { className: componentClassNames?.footer, children: _jsx(Button, { isFullWidth: true, onClick: onApply, variant: "primary", children: "Apply" }) })] }) }));
|
|
12
11
|
}
|
|
13
12
|
export default Filter;
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Fragment, useState } from 'react';
|
|
3
3
|
import FilterClearButton from '../../../filters/components/FilterClearButton';
|
|
4
4
|
import TextInput from '../../../forms/components/TextInput';
|
|
5
|
+
import tw from '../../../styles/classnames/tw';
|
|
5
6
|
import { getIcon } from '../../../styles/icons';
|
|
6
|
-
import tw from '../../../styles/tw';
|
|
7
7
|
function SearchFilter({ onChange, value }) {
|
|
8
8
|
const Icon = getIcon('filter.search');
|
|
9
9
|
const [pendingValue, setPendingValue] = useState(value);
|
package/dist/filters/index.d.ts
CHANGED
package/dist/filters/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClassNameProps } from '../../../styles/interfaces';
|
|
1
|
+
import { ClassNameProps } from '../../../styles/classnames/interfaces';
|
|
2
2
|
import type { DropdownObject, InputProps } from '../../interfaces';
|
|
3
3
|
import { DropdownClassNames, DropdownComponentProps } from '../Dropdown';
|
|
4
4
|
export interface AutocompleteComponentProps<T> extends DropdownComponentProps<T> {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ClassNameProps, ErrorableClassName, FocusableClassName, SelectableClassName } from '../../../styles/interfaces';
|
|
1
|
+
import type { ClassNameProps, ErrorableClassName, FocusableClassName, SelectableClassName } from '../../../styles/classnames/interfaces';
|
|
2
2
|
import type { DropdownObject, InputProps } from '../../interfaces';
|
|
3
3
|
export interface DropdownClassNames {
|
|
4
4
|
root: ErrorableClassName & FocusableClassName;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import Popover from '../../../components/utility/Popover';
|
|
4
4
|
import useClickOutside from '../../../hooks/useClickOutside';
|
|
5
|
-
import tw from '../../../styles/tw';
|
|
6
|
-
import { getClassNames } from '../../../styles/
|
|
5
|
+
import tw from '../../../styles/classnames/tw';
|
|
6
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
7
7
|
import DropdownList from '../DropdownList';
|
|
8
8
|
import StaticTextInput from '../StaticTextInput';
|
|
9
9
|
function findByValue(options, value) {
|
|
@@ -16,8 +16,11 @@ export function renderDetails(options, value) {
|
|
|
16
16
|
return findByValue(options, value)?.details || '';
|
|
17
17
|
}
|
|
18
18
|
function Dropdown({ classNames, classNameProps, hasError, isDisabled, isOptional, isPanelOnly, name, onChange, options = [], placeholder, value, }) {
|
|
19
|
-
const componentClassNames = classNames || getClassNames('dropdown')?.(classNameProps);
|
|
20
19
|
const [isOpen, setIsOpen, node] = useClickOutside({ shouldHandleEnterKey: true });
|
|
20
|
+
const componentClassNames = getClassNames('dropdown', {
|
|
21
|
+
props: classNameProps,
|
|
22
|
+
states: { isError: hasError ?? false, isFocused: isOpen && !isDisabled },
|
|
23
|
+
}, classNames);
|
|
21
24
|
function toggleIsOpen() {
|
|
22
25
|
setIsOpen(!isOpen);
|
|
23
26
|
}
|
|
@@ -33,7 +36,7 @@ function Dropdown({ classNames, classNameProps, hasError, isDisabled, isOptional
|
|
|
33
36
|
if (isPanelOnly) {
|
|
34
37
|
return _jsx(DropdownList, { name: name, onChange: handleChange, options: options, value: value });
|
|
35
38
|
}
|
|
36
|
-
return (_jsxs("div", { ref: node, className: tw('relative', componentClassNames?.root
|
|
39
|
+
return (_jsxs("div", { ref: node, className: tw('relative', componentClassNames?.root), children: [_jsx(StaticTextInput, { classNames: {
|
|
37
40
|
clear: componentClassNames?.clear,
|
|
38
41
|
icon: componentClassNames?.icon,
|
|
39
42
|
}, details: renderDetails(options, value), hasError: hasError, isDisabled: isDisabled || !options?.length, isOptional: isOptional, label: renderLabel(options, value), name: name, onClear: handleClear, onClick: toggleIsOpen, placeholder: placeholder || 'Select...', value: value ? String(value) : '' }), _jsx(Popover, { align: "center", isOpen: isOpen ? !isDisabled : false, isScrollable: true, children: _jsx(DropdownList, { name: name, onChange: handleChange, options: options, value: value }) })] }));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DropdownObject } from '../../../forms/interfaces';
|
|
2
|
+
import type { ClassNameProps } from '../../../styles/classnames/interfaces';
|
|
3
|
+
import type { DropdownClassNames } from '../Dropdown';
|
|
4
|
+
interface DropdownItemProps<T> extends ClassNameProps<DropdownClassNames>, DropdownObject<T> {
|
|
5
|
+
isSelected: boolean;
|
|
6
|
+
onChange: (item: Pick<DropdownObject<T>, '$data' | 'value'>) => () => void;
|
|
7
|
+
}
|
|
8
|
+
declare function DropdownItem<T>({ $data, classNameProps, classNames, details, isDisabled, isSelected, label, onChange, value, }: DropdownItemProps<T>): React.ReactElement;
|
|
9
|
+
export default DropdownItem;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
3
|
+
import tw from '../../../styles/classnames/tw';
|
|
4
|
+
function DropdownItem({ $data, classNameProps, classNames, details, isDisabled, isSelected, label, onChange, value, }) {
|
|
5
|
+
const componentClassNames = getClassNames('dropdown', { props: classNameProps, states: { isSelected } }, classNames);
|
|
6
|
+
return (_jsx("li", { "aria-selected": isSelected, role: "option", children: _jsxs("button", { className: tw('relative w-full text-left', componentClassNames?.item, isDisabled ? 'pointer-events-none opacity-30' : null), onClick: onChange({ $data, value }), tabIndex: -1, type: "button", children: [_jsx("span", { className: tw('whitespace-nowrap', componentClassNames?.title), children: label }), details ? (_jsx("small", { className: tw(componentClassNames?.details), children: details })) : null] }) }));
|
|
7
|
+
}
|
|
8
|
+
export default DropdownItem;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DropdownObject, InputProps } from '../../../forms/interfaces';
|
|
2
|
-
import type { ClassNameProps } from '../../../styles/interfaces';
|
|
2
|
+
import type { ClassNameProps } from '../../../styles/classnames/interfaces';
|
|
3
3
|
import type { DropdownClassNames } from '../Dropdown';
|
|
4
4
|
export interface DropdownListProps<T> extends ClassNameProps<DropdownClassNames>, InputProps<T | null> {
|
|
5
5
|
options: DropdownObject<T>[];
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import { getClassNames } from '../../../styles/
|
|
3
|
-
import
|
|
4
|
-
function isSelected(id, value) {
|
|
5
|
-
return Boolean(value) && value === id;
|
|
6
|
-
}
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
3
|
+
import DropdownItem from '../DropdownItem';
|
|
7
4
|
function DropdownList({ classNames, classNameProps, name, onChange, options, value, }) {
|
|
8
|
-
const componentClassNames =
|
|
5
|
+
const componentClassNames = getClassNames('dropdown', { props: classNameProps }, classNames);
|
|
9
6
|
// const checkboxClassNames = getClassNames('checkboxInput')?.(classNameProps);
|
|
10
7
|
function handleChange(item) {
|
|
11
8
|
return () => {
|
|
@@ -15,8 +12,6 @@ function DropdownList({ classNames, classNameProps, name, onChange, options, val
|
|
|
15
12
|
});
|
|
16
13
|
};
|
|
17
14
|
}
|
|
18
|
-
return (_jsx("ul", { className: componentClassNames?.list, role: "listbox", children: options.map((item, index) => (_jsx(
|
|
19
|
-
? componentClassNames?.item?.selected
|
|
20
|
-
: null), onClick: handleChange(item), tabIndex: -1, type: "button", children: [_jsx("span", { className: tw('whitespace-nowrap' /*componentClassNames?.label*/), children: item.label }), item.details ? (_jsx("small", { className: tw(componentClassNames?.details), children: item.details })) : null] }) }, index))) }));
|
|
15
|
+
return (_jsx("ul", { className: componentClassNames?.list, role: "listbox", children: options.map((item, index) => (_jsx(DropdownItem, { ...item, isSelected: Boolean(value) && value === item.value, onChange: handleChange }, index))) }));
|
|
21
16
|
}
|
|
22
17
|
export default DropdownList;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ClassNameProps } from '../../../styles/interfaces';
|
|
1
|
+
import type { ClassNameProps } from '../../../styles/classnames/interfaces';
|
|
2
2
|
import type { Action } from '../../../utility/interfaces';
|
|
3
3
|
import type { EditingStatus } from '../../interfaces';
|
|
4
4
|
import type { FormProps } from '../Form';
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import ActionList from '../../../components/utility/ActionList';
|
|
3
|
-
import { getClassNames } from '../../../styles/
|
|
4
|
-
import tw from '../../../styles/tw';
|
|
3
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
5
4
|
import Form from '../Form';
|
|
6
5
|
function EditableForm({ classNameProps, classNames, children, formProps, onCancel, onEdit, setStatus, status, title, }) {
|
|
7
|
-
const componentClassNames =
|
|
6
|
+
const componentClassNames = getClassNames('editableForm', { props: classNameProps }, classNames);
|
|
8
7
|
function setCancelled() {
|
|
9
8
|
onCancel?.();
|
|
10
9
|
setStatus?.('CANCELLED');
|
|
@@ -13,7 +12,7 @@ function EditableForm({ classNameProps, classNames, children, formProps, onCance
|
|
|
13
12
|
onEdit?.();
|
|
14
13
|
setStatus?.('EDITING');
|
|
15
14
|
}
|
|
16
|
-
return (_jsx(Form, { ...formProps, children: _jsxs("fieldset", { className: componentClassNames?.root, children: [title ? _jsx("header", { className:
|
|
15
|
+
return (_jsx(Form, { ...formProps, children: _jsxs("fieldset", { className: componentClassNames?.root, children: [title ? (_jsx("header", { className: componentClassNames?.header, children: _jsx("legend", { className: componentClassNames?.title, children: title }) })) : null, _jsxs("div", { className: componentClassNames?.content, children: [children, _jsx("footer", { className: componentClassNames?.actions, children: _jsx(ActionList, { actions: status === 'EDITING'
|
|
17
16
|
? [
|
|
18
17
|
{ label: 'Cancel', onClick: setCancelled },
|
|
19
18
|
{ isSubmittable: true, label: 'Save' },
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ClassNameProps } from '../../../styles/interfaces';
|
|
1
|
+
import type { ClassNameProps } from '../../../styles/classnames/interfaces';
|
|
2
2
|
import { FormFieldProps } from '../FormField';
|
|
3
3
|
import { EditingStatus } from '../../interfaces';
|
|
4
4
|
export interface EditableFormFieldClassNames {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { isValidElement, useEffect, useRef } from 'react';
|
|
4
4
|
import FormField from '../FormField';
|
|
5
|
-
import { getClassNames } from '../../../styles/
|
|
5
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
6
6
|
function getRenderedValue(value, renderValue) {
|
|
7
7
|
if (renderValue) {
|
|
8
8
|
if (typeof renderValue === 'function') {
|
|
@@ -19,7 +19,7 @@ function getRenderedValue(value, renderValue) {
|
|
|
19
19
|
return value ? String(value) : '-';
|
|
20
20
|
}
|
|
21
21
|
function EditableFormField({ classNameProps, classNames, renderValue, status, ...props }) {
|
|
22
|
-
const componentClassNames =
|
|
22
|
+
const componentClassNames = getClassNames('editableFormField', { props: classNameProps }, classNames);
|
|
23
23
|
const cachedValue = useRef(props.value);
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
if (status === 'CANCELLED') {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { getClassNames } from '../../../styles/
|
|
4
|
-
import tw from '../../../styles/tw';
|
|
3
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
4
|
+
import tw from '../../../styles/classnames/tw';
|
|
5
5
|
function Form({ action, children, classNames, classNameProps, id, onSubmit, ref, }) {
|
|
6
|
-
const componentClassNames =
|
|
6
|
+
const componentClassNames = getClassNames('form', { props: classNameProps }, classNames);
|
|
7
7
|
return (_jsx("form", { ref: ref, action: action, className: tw(componentClassNames?.root), id: id, onSubmit: onSubmit, children: children }));
|
|
8
8
|
}
|
|
9
9
|
export default Form;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ClassNameProps } from '../../../styles/interfaces';
|
|
1
|
+
import type { ClassNameProps } from '../../../styles/classnames/interfaces';
|
|
2
2
|
import type { FormFieldClassNames } from '../FormField';
|
|
3
3
|
interface FormErrorProps extends ClassNameProps<FormFieldClassNames> {
|
|
4
4
|
children: React.ReactNode;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { getClassNames } from '../../../styles/
|
|
3
|
-
import tw from '../../../styles/tw';
|
|
2
|
+
import { getClassNames } from '../../../styles/classnames';
|
|
3
|
+
import tw from '../../../styles/classnames/tw';
|
|
4
4
|
function FormError({ children, classNames, classNameProps, id, isAssistive, }) {
|
|
5
|
-
const componentClassNames =
|
|
5
|
+
const componentClassNames = getClassNames('formField', { props: classNameProps }, classNames);
|
|
6
6
|
return (_jsx("div", { className: tw(componentClassNames?.error, isAssistive ? 'sr-only' : null), id: `${id}_err`, children: children }));
|
|
7
7
|
}
|
|
8
8
|
export default FormError;
|