@sqrzro/ui 4.0.0-alpha.2 → 4.0.0-alpha.21

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.
Files changed (193) hide show
  1. package/dist/components/buttons/ActionButton/index.d.ts +6 -6
  2. package/dist/components/buttons/ActionButton/index.js +3 -27
  3. package/dist/components/buttons/Button/index.d.ts +5 -5
  4. package/dist/components/buttons/Button/index.js +6 -16
  5. package/dist/components/collections/Collection/index.d.ts +9 -3
  6. package/dist/components/collections/Collection/index.js +4 -4
  7. package/dist/components/collections/DataTable/index.d.ts +14 -0
  8. package/dist/components/collections/DataTable/index.js +9 -0
  9. package/dist/components/collections/EmptyMessage/index.d.ts +1 -1
  10. package/dist/components/collections/EmptyMessage/index.js +3 -4
  11. package/dist/components/collections/EmptyMessageAction/index.d.ts +2 -2
  12. package/dist/components/collections/EmptyMessageAction/index.js +1 -1
  13. package/dist/components/collections/List/index.d.ts +5 -3
  14. package/dist/components/collections/List/index.js +8 -2
  15. package/dist/components/collections/ListItem/index.d.ts +2 -2
  16. package/dist/components/collections/ListItem/index.js +6 -10
  17. package/dist/components/collections/ListItemMenu/index.d.ts +7 -0
  18. package/dist/components/collections/ListItemMenu/index.js +7 -0
  19. package/dist/components/collections/ListItemMeta/index.d.ts +6 -4
  20. package/dist/components/collections/ListItemMeta/index.js +12 -7
  21. package/dist/components/collections/ListItemSecondary/index.d.ts +1 -1
  22. package/dist/components/collections/ListItemSecondary/index.js +3 -4
  23. package/dist/components/collections/Pagination/index.d.ts +1 -1
  24. package/dist/components/collections/Pagination/index.js +5 -6
  25. package/dist/components/collections/PaginationLink/index.d.ts +9 -0
  26. package/dist/components/collections/PaginationLink/index.js +8 -0
  27. package/dist/components/collections/Table/index.d.ts +3 -3
  28. package/dist/components/collections/Table/index.js +1 -1
  29. package/dist/components/collections/TableClientComponent/index.d.ts +4 -4
  30. package/dist/components/collections/TableClientComponent/index.js +5 -10
  31. package/dist/components/collections/TableRow/index.d.ts +13 -0
  32. package/dist/components/collections/TableRow/index.js +9 -0
  33. package/dist/components/collections/interfaces.d.ts +19 -17
  34. package/dist/components/collections/utility/is-data-table-array.d.ts +3 -0
  35. package/dist/components/collections/utility/is-data-table-array.js +5 -0
  36. package/dist/components/collections/utility/is-data-table-object.d.ts +3 -0
  37. package/dist/components/collections/utility/is-data-table-object.js +4 -0
  38. package/dist/components/errors/AppError/index.d.ts +19 -0
  39. package/dist/components/errors/AppError/index.js +8 -0
  40. package/dist/components/errors/AppForbiddenError/index.d.ts +7 -0
  41. package/dist/components/errors/AppForbiddenError/index.js +6 -0
  42. package/dist/components/errors/AppNotFoundError/index.d.ts +7 -0
  43. package/dist/components/errors/AppNotFoundError/index.js +6 -0
  44. package/dist/components/errors/AppServerError/index.d.ts +8 -0
  45. package/dist/components/errors/AppServerError/index.js +17 -0
  46. package/dist/components/index.d.ts +19 -0
  47. package/dist/components/index.js +9 -0
  48. package/dist/components/modals/ConfirmModal/index.d.ts +3 -1
  49. package/dist/components/modals/ConfirmModal/index.js +3 -3
  50. package/dist/components/modals/Modal/index.d.ts +4 -4
  51. package/dist/components/modals/Modal/index.js +3 -3
  52. package/dist/components/modals/ModalActions/index.d.ts +3 -3
  53. package/dist/components/modals/ModalActions/index.js +3 -3
  54. package/dist/components/utility/Action/index.d.ts +11 -0
  55. package/dist/components/utility/Action/index.js +44 -0
  56. package/dist/components/utility/ActionList/index.d.ts +3 -3
  57. package/dist/components/utility/ActionList/index.js +3 -3
  58. package/dist/components/utility/ClassNamesClientComponent/index.d.ts +6 -0
  59. package/dist/components/utility/ClassNamesClientComponent/index.js +7 -0
  60. package/dist/components/utility/Confirmable/index.d.ts +9 -0
  61. package/dist/components/utility/Confirmable/index.js +14 -0
  62. package/dist/components/utility/Container/index.d.ts +1 -1
  63. package/dist/components/utility/Container/index.js +2 -2
  64. package/dist/components/utility/Link/index.d.ts +1 -1
  65. package/dist/components/utility/Link/index.js +3 -3
  66. package/dist/components/utility/Loader/index.d.ts +1 -1
  67. package/dist/components/utility/Loader/index.js +4 -4
  68. package/dist/components/utility/Menu/index.d.ts +11 -0
  69. package/dist/components/utility/Menu/index.js +15 -0
  70. package/dist/components/utility/MenuItem/index.d.ts +4 -0
  71. package/dist/components/utility/MenuItem/index.js +9 -0
  72. package/dist/components/utility/Popover/index.d.ts +1 -1
  73. package/dist/components/utility/Popover/index.js +4 -4
  74. package/dist/components/utility/Reference/index.d.ts +9 -0
  75. package/dist/components/utility/Reference/index.js +15 -0
  76. package/dist/components/utility/RootLayout/index.d.ts +6 -3
  77. package/dist/components/utility/RootLayout/index.js +7 -6
  78. package/dist/components/utility/Toast/index.d.ts +1 -1
  79. package/dist/components/utility/Toast/index.js +2 -2
  80. package/dist/filters/components/FilterBarClientComponent/index.d.ts +1 -1
  81. package/dist/filters/components/FilterBarClientComponent/index.js +2 -2
  82. package/dist/filters/components/FilterControl/index.d.ts +1 -1
  83. package/dist/filters/components/FilterControl/index.js +7 -4
  84. package/dist/filters/components/FilterItem/index.d.ts +1 -1
  85. package/dist/filters/components/FilterItem/index.js +2 -2
  86. package/dist/filters/components/FilterPanel/index.d.ts +1 -1
  87. package/dist/filters/filters/Filter/index.d.ts +1 -1
  88. package/dist/filters/filters/Filter/index.js +3 -4
  89. package/dist/filters/filters/SearchFilter/index.js +1 -1
  90. package/dist/filters/index.d.ts +1 -0
  91. package/dist/filters/index.js +1 -0
  92. package/dist/filters/interfaces.d.ts +2 -2
  93. package/dist/filters/utility/parse-filters.d.ts +1 -1
  94. package/dist/filters/utility/parse-filters.js +3 -2
  95. package/dist/filters/utility/transform-boolean.d.ts +1 -1
  96. package/dist/filters/utility/transform-date.d.ts +1 -1
  97. package/dist/filters/utility/transform-multi.d.ts +1 -1
  98. package/dist/forms/components/Autocomplete/index.d.ts +11 -0
  99. package/dist/forms/components/Autocomplete/index.js +37 -0
  100. package/dist/forms/components/Dropdown/index.d.ts +1 -1
  101. package/dist/forms/components/Dropdown/index.js +8 -5
  102. package/dist/forms/components/DropdownItem/index.d.ts +9 -0
  103. package/dist/forms/components/DropdownItem/index.js +8 -0
  104. package/dist/forms/components/DropdownList/index.d.ts +1 -1
  105. package/dist/forms/components/DropdownList/index.js +5 -8
  106. package/dist/forms/components/EditableForm/index.d.ts +3 -3
  107. package/dist/forms/components/EditableForm/index.js +3 -4
  108. package/dist/forms/components/EditableFormField/index.d.ts +1 -1
  109. package/dist/forms/components/EditableFormField/index.js +2 -2
  110. package/dist/forms/components/Form/index.d.ts +3 -2
  111. package/dist/forms/components/Form/index.js +5 -5
  112. package/dist/forms/components/FormError/index.d.ts +1 -1
  113. package/dist/forms/components/FormError/index.js +3 -3
  114. package/dist/forms/components/FormField/index.d.ts +4 -4
  115. package/dist/forms/components/FormField/index.js +7 -6
  116. package/dist/forms/components/FormFields/index.d.ts +9 -0
  117. package/dist/forms/components/FormFields/index.js +18 -0
  118. package/dist/forms/components/FormLabel/index.d.ts +1 -1
  119. package/dist/forms/components/FormLabel/index.js +3 -3
  120. package/dist/forms/components/ModalForm/index.js +1 -1
  121. package/dist/forms/components/NumberInput/index.d.ts +7 -0
  122. package/dist/forms/components/NumberInput/index.js +27 -0
  123. package/dist/forms/components/PasswordComplexity/index.d.ts +9 -0
  124. package/dist/forms/components/PasswordComplexity/index.js +10 -0
  125. package/dist/forms/components/PasswordInput/index.d.ts +1 -1
  126. package/dist/forms/components/PasswordInput/index.js +4 -5
  127. package/dist/forms/components/PointsInput/index.d.ts +5 -0
  128. package/dist/forms/components/PointsInput/index.js +22 -0
  129. package/dist/forms/components/StaticTextInput/index.d.ts +2 -3
  130. package/dist/forms/components/StaticTextInput/index.js +5 -8
  131. package/dist/forms/components/Switch/index.d.ts +1 -1
  132. package/dist/forms/components/Switch/index.js +4 -4
  133. package/dist/forms/components/TextInput/index.d.ts +2 -2
  134. package/dist/forms/components/TextInput/index.js +6 -6
  135. package/dist/forms/hooks/useAutocomplete.d.ts +9 -0
  136. package/dist/forms/hooks/useAutocomplete.js +31 -0
  137. package/dist/forms/hooks/useDropdown.d.ts +2 -2
  138. package/dist/forms/hooks/useForm.d.ts +1 -1
  139. package/dist/forms/hooks/useForm.js +5 -4
  140. package/dist/forms/hooks/useModalForm.d.ts +2 -2
  141. package/dist/forms/index.d.ts +18 -2
  142. package/dist/forms/index.js +7 -2
  143. package/dist/forms/interfaces.d.ts +1 -0
  144. package/dist/hooks/index.d.ts +2 -0
  145. package/dist/hooks/index.js +2 -1
  146. package/dist/hooks/useConfirmable.d.ts +21 -0
  147. package/dist/hooks/useConfirmable.js +58 -0
  148. package/dist/hooks/usePopover.d.ts +11 -0
  149. package/dist/hooks/usePopover.js +17 -0
  150. package/dist/hooks/useServerAction.d.ts +9 -0
  151. package/dist/hooks/useServerAction.js +15 -0
  152. package/dist/navigation/components/AppNavigation/index.d.ts +2 -1
  153. package/dist/navigation/components/AppNavigation/index.js +4 -4
  154. package/dist/navigation/components/AppNavigationItem/index.d.ts +5 -3
  155. package/dist/navigation/components/AppNavigationItem/index.js +13 -6
  156. package/dist/navigation/components/Tabs/index.js +1 -4
  157. package/dist/navigation/hooks/useNavigation.d.ts +3 -3
  158. package/dist/navigation/hooks/useNavigation.js +5 -5
  159. package/dist/styles/classnames/apply-variants.d.ts +3 -0
  160. package/dist/styles/classnames/apply-variants.js +25 -0
  161. package/dist/styles/classnames/config.d.ts +69 -0
  162. package/dist/styles/classnames/index.d.ts +7 -0
  163. package/dist/styles/classnames/index.js +37 -0
  164. package/dist/styles/classnames/interfaces.d.ts +56 -0
  165. package/dist/styles/classnames/interfaces.js +1 -0
  166. package/dist/styles/classnames/utility/is-classname-object.d.ts +3 -0
  167. package/dist/styles/classnames/utility/is-classname-object.js +7 -0
  168. package/dist/styles/icons/config.d.ts +9 -0
  169. package/dist/styles/icons/config.js +1 -0
  170. package/dist/styles/icons/index.d.ts +4 -0
  171. package/dist/styles/icons/interfaces.d.ts +4 -0
  172. package/dist/styles/icons/interfaces.js +1 -0
  173. package/dist/styles/index.d.ts +2 -2
  174. package/dist/styles/index.js +1 -1
  175. package/dist/styles/styles.css +59 -0
  176. package/dist/utility/interfaces.d.ts +19 -8
  177. package/package.json +9 -4
  178. package/dist/components/buttons/ConfirmableButton/index.d.ts +0 -7
  179. package/dist/components/buttons/ConfirmableButton/index.js +0 -13
  180. package/dist/components/collections/ListClientComponent/index.d.ts +0 -7
  181. package/dist/components/collections/ListClientComponent/index.js +0 -9
  182. package/dist/components/collections/utility/filter-columns.d.ts +0 -3
  183. package/dist/components/collections/utility/filter-columns.js +0 -8
  184. package/dist/components/utility/ClassNames/index.d.ts +0 -6
  185. package/dist/components/utility/ClassNames/index.js +0 -7
  186. package/dist/styles/config.d.ts +0 -64
  187. package/dist/styles/config.js +0 -43
  188. package/dist/styles/icons.d.ts +0 -15
  189. package/dist/styles/interfaces.d.ts +0 -41
  190. /package/dist/styles/{interfaces.js → classnames/config.js} +0 -0
  191. /package/dist/styles/{tw.d.ts → classnames/tw.d.ts} +0 -0
  192. /package/dist/styles/{tw.js → classnames/tw.js} +0 -0
  193. /package/dist/styles/{icons.js → icons/index.js} +0 -0
@@ -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/config';
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 = classNames || getClassNames('popover')?.(classNameProps);
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?.default, isOpen ? componentClassNames?.root?.focused : null), style: { display: isOpen ? 'block' : 'none' }, children: isScrollable ? (_jsx("div", { className: componentClassNames?.scroll, children: children })) : (children) }));
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;
@@ -0,0 +1,9 @@
1
+ import type { ClassNameProps } from '../../../styles/classnames/interfaces';
2
+ import type { ReferenceObject } from '../../../utility/interfaces';
3
+ export interface ReferenceClassNames {
4
+ root: string;
5
+ reference: string;
6
+ }
7
+ export type ReferenceProps = ClassNameProps<ReferenceClassNames> & ReferenceObject;
8
+ declare function Reference({ classNameProps, classNames, id, name, path, reference, }: Readonly<ReferenceProps>): React.ReactElement | string | null;
9
+ export default Reference;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import Link from '../Link';
3
+ import { joinURL } from '@sqrzro/utility';
4
+ import { getClassNames } from '../../../styles/classnames';
5
+ function Reference({ classNameProps, classNames, id, name, path, reference, }) {
6
+ const componentClassNames = getClassNames('reference', { props: classNameProps }, classNames);
7
+ if (!reference) {
8
+ return name;
9
+ }
10
+ if (id && path) {
11
+ return (_jsxs(Link, { className: componentClassNames?.root, href: joinURL(path, id), children: [name, _jsx("small", { className: componentClassNames?.reference, children: reference })] }));
12
+ }
13
+ return (_jsxs("span", { className: componentClassNames?.root, children: [name, _jsx("small", { className: componentClassNames?.reference, children: reference })] }));
14
+ }
15
+ export default Reference;
@@ -1,5 +1,5 @@
1
- import { type RegisteredClassNames } from '../../../styles/config';
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;
@@ -7,6 +7,9 @@ export interface RootLayoutClassNames {
7
7
  export interface RootLayoutProps extends ClassNameProps<RootLayoutClassNames> {
8
8
  readonly children: React.ReactNode;
9
9
  readonly classNameConfig?: RegisteredClassNames;
10
+ readonly font?: {
11
+ variable: string;
12
+ };
10
13
  }
11
- declare function RootLayout({ children, classNameConfig, classNameProps, classNames, }: RootLayoutProps): React.ReactElement;
14
+ declare function RootLayout({ children, classNameConfig, classNameProps, classNames, font, }: RootLayoutProps): React.ReactElement;
12
15
  export default RootLayout;
@@ -1,14 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { getClassNames, registerClassNames } from '../../../styles/config';
3
- import ClassNames from '../ClassNames';
2
+ import { getClassNames, registerClassNames } from '../../../styles/classnames';
3
+ import ClassNamesClientComponent from '../ClassNamesClientComponent';
4
4
  import Toaster from '../Toaster';
5
- function RootLayout({ children, classNameConfig, classNameProps, classNames, }) {
5
+ import tw from '../../../styles/classnames/tw';
6
+ function RootLayout({ children, classNameConfig, classNameProps, classNames, font, }) {
6
7
  if (classNameConfig) {
7
8
  registerClassNames(classNameConfig);
8
9
  }
9
- const componentClassNames = classNames || getClassNames('rootLayout')?.(classNameProps);
10
- return (_jsxs("html", { lang: "en", 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(ClassNames, { data: classNameConfig }) : null, _jsx("div", { className: componentClassNames?.content, children: children }), _jsx(Toaster, {})] })] }));
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/config';
3
+ import { getClassNames } from '../../../styles/classnames';
4
4
  function Toast({ children, classNames, classNameProps, }) {
5
- const componentClassNames = classNames || getClassNames('toast')?.(classNameProps);
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/config';
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 = classNames || getClassNames('filterBar')?.(classNameProps);
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/config';
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 = classNames || getClassNames('filterItem')?.(classNameProps);
8
- return (_jsxs("div", { className: tw(componentClassNames?.root?.default, isDisabled ? 'pointer-events-none opacity-30' : null, isFocused ? componentClassNames?.root?.focused : null, isHighlighted ? componentClassNames?.root?.highlighted : null), children: [children, isFocused && onClear ? _jsx(FilterClearButton, { onClick: onClear }) : null, onClick ? (_jsx("button", { className: tw('absolute -inset-1 z-10 select-none text-transparent'), disabled: isDisabled, onClick: onClick, type: "button", children: "Edit" })) : null] }));
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/config';
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 = classNames || getClassNames('filterItem')?.(classNameProps);
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/config';
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 = classNames || getClassNames('filterPanel')?.(classNameProps);
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: tw(componentClassNames?.root?.default, size ? componentClassNames?.root?.[size] : null), 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" }) })] }) }));
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);
@@ -1,2 +1,3 @@
1
1
  export * from './interfaces';
2
+ export { default as FilterBar } from './components/FilterBar';
2
3
  export { default as filter } from './utility/filter';
@@ -1,2 +1,3 @@
1
1
  export * from './interfaces';
2
+ export { default as FilterBar } from './components/FilterBar';
2
3
  export { default as filter } from './utility/filter';
@@ -21,8 +21,8 @@ export type ClientFilterMap<T> = {
21
21
  [K in keyof T]?: ClientFilterObject<FilterType>;
22
22
  };
23
23
  export interface FilterObject<T, F extends FilterType> extends ClientFilterObject<F> {
24
- transformer: (value: string) => T;
24
+ transformer: (value: string | null) => T | null;
25
25
  }
26
26
  export type FilterMap<T> = {
27
- [K in keyof T]?: FilterObject<T[K], FilterType>;
27
+ [K in keyof T]?: FilterObject<T[K] | null, FilterType>;
28
28
  };
@@ -1,3 +1,3 @@
1
- import type { FilterMap } from "../interfaces";
1
+ import type { FilterMap } from '../interfaces';
2
2
  declare function parseFilters<T>(searchParams: Record<string, string> | null, map?: FilterMap<T> | null): Partial<T> | null;
3
3
  export default parseFilters;
@@ -6,8 +6,9 @@ function parseFilters(searchParams, map) {
6
6
  for (const key in map) {
7
7
  if (Object.hasOwn(map, key) && typeof map[key] !== 'undefined') {
8
8
  const value = searchParams[key];
9
- if (value) {
10
- out[key] = map[key].transformer(value);
9
+ const transformed = map[key].transformer(value);
10
+ if (transformed) {
11
+ out[key] = transformed;
11
12
  }
12
13
  }
13
14
  }
@@ -1,2 +1,2 @@
1
1
  export declare function transformFromBoolean(value?: boolean): string;
2
- export declare function transformToBoolean(value?: string): boolean;
2
+ export declare function transformToBoolean(value?: string | null): boolean;
@@ -1,2 +1,2 @@
1
1
  export declare function transformFromDate(value?: [Date, Date] | null): string;
2
- export declare function transformToDate(value?: string): [Date, Date] | null;
2
+ export declare function transformToDate(value?: string | null): [Date, Date] | null;
@@ -1,2 +1,2 @@
1
1
  export declare function transformFromMulti(value?: string[] | null): string;
2
- export declare function transformToMulti(value?: string): string[] | null;
2
+ export declare function transformToMulti(value?: string | null): string[] | null;
@@ -0,0 +1,11 @@
1
+ import { ClassNameProps } from '../../../styles/classnames/interfaces';
2
+ import type { DropdownObject, InputProps } from '../../interfaces';
3
+ import { DropdownClassNames, DropdownComponentProps } from '../Dropdown';
4
+ export interface AutocompleteComponentProps<T> extends DropdownComponentProps<T> {
5
+ isLoading?: boolean;
6
+ onSearch?: (search: string) => void;
7
+ selected?: DropdownObject<T> | null;
8
+ }
9
+ export type AutocompleteProps<T> = ClassNameProps<DropdownClassNames> & InputProps<T | null> & AutocompleteComponentProps<T>;
10
+ declare function Autocomplete<T>({ hasError, isDisabled, isLoading, isOptional, name, onChange, onSearch, options, selected, placeholder, value, }: Readonly<AutocompleteProps<T>>): React.ReactElement;
11
+ export default Autocomplete;
@@ -0,0 +1,37 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Fragment, useRef, useState } from 'react';
4
+ import Popover from '../../../components/utility/Popover';
5
+ import useClickOutside from '../../../hooks/useClickOutside';
6
+ import DropdownList from '../DropdownList';
7
+ import StaticTextInput from '../StaticTextInput';
8
+ import TextInput from '../TextInput';
9
+ function Autocomplete({ hasError, isDisabled, isLoading, isOptional, name, onChange, onSearch, options, selected, placeholder, value, }) {
10
+ const inputRef = useRef(null);
11
+ const [search, setSearch] = useState('');
12
+ const [isOpen, setIsOpen, ref] = useClickOutside();
13
+ function handleChange(event) {
14
+ if (onChange) {
15
+ onChange(event);
16
+ }
17
+ setIsOpen(false);
18
+ setSearch('');
19
+ }
20
+ function handleSearch(event) {
21
+ setSearch(event.target.value ?? '');
22
+ setIsOpen(true);
23
+ if (onSearch) {
24
+ onSearch(event.target.value ?? '');
25
+ }
26
+ }
27
+ function handleReset() {
28
+ if (onChange) {
29
+ onChange({ target: { name, value: null } });
30
+ }
31
+ setTimeout(() => {
32
+ inputRef.current?.focus();
33
+ }, 10);
34
+ }
35
+ return (_jsx("div", { ref: ref, className: "relative", children: selected ? (_jsx(StaticTextInput, { details: selected.details, hasError: hasError, isDisabled: isDisabled, isOptional: isOptional, label: selected.label, name: name, onClick: handleReset, placeholder: placeholder || 'Select...', value: value ? String(value) : '' })) : (_jsxs(Fragment, { children: [_jsx(TextInput, { ref: inputRef, hasError: hasError, isDisabled: isDisabled, name: `${name}_search`, onChange: handleSearch, onFocus: () => setIsOpen(Boolean(options?.length)), placeholder: "Start typing...", value: search }), _jsx(Popover, { align: "center", isOpen: isOpen, isScrollable: true, children: options?.length ? (_jsx(DropdownList, { name: name, onChange: handleChange, options: options ?? [], value: value })) : isLoading ? (_jsx("div", { children: "Loading..." })) : (_jsx("div", { children: "No results" })) })] })) }));
36
+ }
37
+ export default Autocomplete;
@@ -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/config';
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,9 +36,9 @@ 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?.default, hasError ? componentClassNames?.root?.error : null, isOpen && !isDisabled ? componentClassNames?.root?.focused : null), children: [_jsx(StaticTextInput, { classNames: {
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
- }, details: renderDetails(options, value), hasError: hasError, isDisabled: isDisabled || !options?.length, isOpen: isOpen, 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 }) })] }));
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 }) })] }));
40
43
  }
41
44
  export default Dropdown;
@@ -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, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { getClassNames } from '../../../styles/config';
3
- import tw from '../../../styles/tw';
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 = classNames || getClassNames('dropdown')?.(classNameProps);
5
+ const componentClassNames = getClassNames('dropdown', { props: classNameProps }, classNames);
9
6
  // const checkboxClassNames = getClassNames('checkboxInput')?.(classNameProps);
10
7
  function handleChange(item) {
11
8
  return () => {
@@ -15,6 +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("li", { "aria-selected": isSelected(item.value, value), className: tw('relative', item.isDisabled ? 'pointer-events-none opacity-30' : null, componentClassNames?.item?.default, isSelected(item.value, value) ? componentClassNames?.item?.selected : null), role: "option", children: _jsxs("button", { 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))) }));
19
16
  }
20
17
  export default DropdownList;
@@ -1,5 +1,5 @@
1
- import type { ClassNameProps } from '../../../styles/interfaces';
2
- import type { Action } from '../../../utility/interfaces';
1
+ import type { ClassNameProps } from '../../../styles/classnames/interfaces';
2
+ import type { ActionObject } from '../../../utility/interfaces';
3
3
  import type { EditingStatus } from '../../interfaces';
4
4
  import type { FormProps } from '../Form';
5
5
  export interface EditableFormClassNames {
@@ -11,7 +11,7 @@ export interface EditableFormClassNames {
11
11
  content: string;
12
12
  }
13
13
  export interface EditableFormProps extends ClassNameProps<EditableFormClassNames> {
14
- actions?: Action[] | false;
14
+ actions?: ActionObject[] | false;
15
15
  children: React.ReactNode;
16
16
  formProps: Omit<FormProps, 'children'>;
17
17
  onCancel?: () => void;
@@ -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/config';
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 = classNames || getClassNames('editableForm')?.(classNameProps);
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: tw(componentClassNames?.header), children: _jsx("legend", { className: componentClassNames?.title, children: title }) }) : null, _jsxs("div", { className: tw(componentClassNames?.content), children: [children, _jsx("footer", { className: componentClassNames?.actions, children: _jsx(ActionList, { actions: status === 'EDITING'
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/config';
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 = classNames || getClassNames('editableFormField')(classNameProps);
22
+ const componentClassNames = getClassNames('editableFormField', { props: classNameProps }, classNames);
23
23
  const cachedValue = useRef(props.value);
24
24
  useEffect(() => {
25
25
  if (status === 'CANCELLED') {
@@ -1,4 +1,4 @@
1
- import type { ClassNameProps } from '../../../styles/interfaces';
1
+ import type { ClassNameProps } from '../../../styles/classnames/interfaces';
2
2
  export interface FormClassNames {
3
3
  root: string;
4
4
  }
@@ -7,6 +7,7 @@ export interface FormProps extends ClassNameProps<FormClassNames> {
7
7
  children: React.ReactNode;
8
8
  id?: string;
9
9
  onSubmit?: React.FormEventHandler<HTMLFormElement>;
10
+ ref?: React.Ref<HTMLFormElement>;
10
11
  }
11
- declare function Form({ action, children, classNames, classNameProps, id, onSubmit, }: Readonly<FormProps>): React.ReactElement;
12
+ declare function Form({ action, children, classNames, classNameProps, id, onSubmit, ref, }: Readonly<FormProps>): React.ReactElement;
12
13
  export default Form;
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { getClassNames } from '../../../styles/config';
4
- import tw from '../../../styles/tw';
5
- function Form({ action, children, classNames, classNameProps, id, onSubmit, }) {
6
- const componentClassNames = classNames || getClassNames('form')?.(classNameProps);
7
- return (_jsx("form", { action: action, className: tw(componentClassNames?.root), id: id, onSubmit: onSubmit, children: children }));
3
+ import { getClassNames } from '../../../styles/classnames';
4
+ import tw from '../../../styles/classnames/tw';
5
+ function Form({ action, children, classNames, classNameProps, id, onSubmit, ref, }) {
6
+ const componentClassNames = getClassNames('form', { props: classNameProps }, classNames);
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/config';
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 = classNames || getClassNames('formField')?.(classNameProps);
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;
@@ -1,6 +1,6 @@
1
1
  import type { InputEvent, InputProps } from '../../../forms/interfaces';
2
- import type { ClassNameProps, ErrorableClassName } from '../../../styles/interfaces';
3
- import { Action } from '../../../utility/interfaces';
2
+ import type { ClassNameProps, ErrorableClassName } from '../../../styles/classnames/interfaces';
3
+ import { ActionObject } from '../../../utility/interfaces';
4
4
  export interface FormFieldClassNames {
5
5
  root: ErrorableClassName;
6
6
  label: string;
@@ -10,7 +10,7 @@ export interface FormFieldClassNames {
10
10
  error: string;
11
11
  }
12
12
  export interface FormFieldProps<T, V extends T> extends ClassNameProps<FormFieldClassNames>, InputProps<T, V> {
13
- action?: Action | null;
13
+ action?: ActionObject | null;
14
14
  details?: string | null;
15
15
  error?: Record<string, string> | null;
16
16
  hasAssistiveError?: boolean;
@@ -21,5 +21,5 @@ export interface FormFieldProps<T, V extends T> extends ClassNameProps<FormField
21
21
  onChange?: (event: InputEvent<T>) => void;
22
22
  render: (props: InputProps<T>) => React.ReactElement | null;
23
23
  }
24
- declare function FormField<T, V extends T>({ action, classNameProps, details, error, hasAssistiveError, hasAssistiveLabel, id, isContentOnly, isDisabled, isOptional, label, name, onChange, onKeyDown, render, value, }: Readonly<FormFieldProps<T, V>>): React.ReactElement | null;
24
+ declare function FormField<T, V extends T>({ action, classNameProps, classNames, details, error, hasAssistiveError, hasAssistiveLabel, id, isContentOnly, isDisabled, isOptional, label, name, onChange, onKeyDown, render, value, }: Readonly<FormFieldProps<T, V>>): React.ReactElement | null;
25
25
  export default FormField;