@sqrzro/ui 4.0.0-alpha.77 → 4.0.0-alpha.79

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 (172) hide show
  1. package/dist/components/buttons/ActionButton/index.d.ts +3 -3
  2. package/dist/components/buttons/ActionButton/index.js +3 -3
  3. package/dist/components/buttons/Button/index.d.ts +2 -2
  4. package/dist/components/buttons/Button/index.js +3 -3
  5. package/dist/components/collections/Collection/index.d.ts +2 -2
  6. package/dist/components/collections/Collection/index.js +5 -5
  7. package/dist/components/collections/DataTable/index.d.ts +2 -2
  8. package/dist/components/collections/DataTable/index.js +2 -2
  9. package/dist/components/collections/DefinitionList/index.d.ts +2 -2
  10. package/dist/components/collections/DefinitionList/index.js +1 -1
  11. package/dist/components/collections/EmptyMessage/index.d.ts +2 -2
  12. package/dist/components/collections/EmptyMessage/index.js +2 -2
  13. package/dist/components/collections/EmptyMessageAction/index.d.ts +1 -1
  14. package/dist/components/collections/EmptyMessageAction/index.js +2 -2
  15. package/dist/components/collections/List/index.d.ts +1 -1
  16. package/dist/components/collections/ListClientComponent/index.d.ts +1 -1
  17. package/dist/components/collections/ListClientComponent/index.js +2 -2
  18. package/dist/components/collections/ListItem/index.d.ts +2 -2
  19. package/dist/components/collections/ListItem/index.js +4 -4
  20. package/dist/components/collections/ListItemMenu/index.d.ts +1 -1
  21. package/dist/components/collections/ListItemMeta/index.d.ts +2 -2
  22. package/dist/components/collections/ListItemMeta/index.js +2 -2
  23. package/dist/components/collections/ListItemSecondary/index.d.ts +1 -1
  24. package/dist/components/collections/ListItemSecondary/index.js +1 -1
  25. package/dist/components/collections/Pagination/index.d.ts +1 -1
  26. package/dist/components/collections/Pagination/index.js +3 -3
  27. package/dist/components/collections/PaginationLink/index.d.ts +1 -1
  28. package/dist/components/collections/PaginationLink/index.js +1 -1
  29. package/dist/components/collections/TableClientComponent/index.d.ts +1 -1
  30. package/dist/components/collections/TableClientComponent/index.js +4 -4
  31. package/dist/components/collections/TableRow/index.d.ts +2 -2
  32. package/dist/components/collections/TableRow/index.js +3 -3
  33. package/dist/components/collections/interfaces.d.ts +1 -1
  34. package/dist/components/collections/utility/render-cell.js +3 -3
  35. package/dist/components/elements/Badge/index.d.ts +2 -2
  36. package/dist/components/elements/Badge/index.js +2 -2
  37. package/dist/components/elements/ContentLink/index.js +1 -1
  38. package/dist/components/elements/InfoPanel/index.d.ts +2 -2
  39. package/dist/components/elements/InfoPanel/index.js +2 -2
  40. package/dist/components/elements/Link/index.d.ts +1 -1
  41. package/dist/components/elements/Link/index.js +2 -2
  42. package/dist/components/elements/Menu/index.d.ts +2 -2
  43. package/dist/components/elements/Menu/index.js +4 -4
  44. package/dist/components/elements/MenuItem/index.d.ts +1 -1
  45. package/dist/components/elements/MenuItem/index.js +2 -2
  46. package/dist/components/elements/Page/index.d.ts +2 -2
  47. package/dist/components/elements/Reference/index.d.ts +2 -2
  48. package/dist/components/elements/Reference/index.js +1 -1
  49. package/dist/components/elements/Summary/index.d.ts +2 -2
  50. package/dist/components/elements/Summary/index.js +2 -2
  51. package/dist/components/errors/AppError/index.d.ts +2 -2
  52. package/dist/components/errors/AppError/index.js +2 -2
  53. package/dist/components/modals/ConfirmModal/index.d.ts +1 -1
  54. package/dist/components/modals/ConfirmModal/index.js +1 -1
  55. package/dist/components/modals/Modal/index.d.ts +2 -2
  56. package/dist/components/modals/Modal/index.js +2 -2
  57. package/dist/components/modals/ModalActions/index.d.ts +2 -2
  58. package/dist/components/modals/ModalActions/index.js +2 -2
  59. package/dist/components/utility/Action/index.d.ts +1 -1
  60. package/dist/components/utility/Action/index.js +2 -2
  61. package/dist/components/utility/ActionList/index.d.ts +2 -2
  62. package/dist/components/utility/ActionList/index.js +2 -2
  63. package/dist/components/utility/AppBody/index.js +1 -1
  64. package/dist/components/utility/Calendar/index.d.ts +1 -1
  65. package/dist/components/utility/Calendar/index.js +5 -5
  66. package/dist/components/utility/CalendarDay/index.d.ts +2 -2
  67. package/dist/components/utility/CalendarDay/index.js +1 -1
  68. package/dist/components/utility/Confirmable/index.d.ts +2 -2
  69. package/dist/components/utility/Confirmable/index.js +1 -1
  70. package/dist/components/utility/Container/index.d.ts +1 -1
  71. package/dist/components/utility/Container/index.js +1 -1
  72. package/dist/components/utility/Loader/index.d.ts +1 -1
  73. package/dist/components/utility/Loader/index.js +2 -2
  74. package/dist/components/utility/Popover/index.d.ts +1 -1
  75. package/dist/components/utility/Popover/index.js +2 -2
  76. package/dist/components/utility/Toast/index.d.ts +2 -2
  77. package/dist/components/utility/Toast/index.js +3 -3
  78. package/dist/filters/components/FilterBar/index.d.ts +2 -2
  79. package/dist/filters/components/FilterBarClientComponent/index.d.ts +2 -2
  80. package/dist/filters/components/FilterBarClientComponent/index.js +2 -2
  81. package/dist/filters/components/FilterClearButton/index.d.ts +1 -1
  82. package/dist/filters/components/FilterClearButton/index.js +1 -1
  83. package/dist/filters/components/FilterControl/index.d.ts +1 -1
  84. package/dist/filters/components/FilterControl/index.js +2 -2
  85. package/dist/filters/components/FilterItem/index.d.ts +2 -2
  86. package/dist/filters/components/FilterItem/index.js +2 -2
  87. package/dist/filters/components/FilterPanel/index.d.ts +2 -2
  88. package/dist/filters/filters/BooleanFilter/index.js +1 -1
  89. package/dist/filters/filters/CalendarFilter/index.js +1 -1
  90. package/dist/filters/filters/DropdownFilter/index.js +1 -1
  91. package/dist/filters/filters/Filter/index.d.ts +3 -3
  92. package/dist/filters/filters/Filter/index.js +4 -4
  93. package/dist/filters/filters/SearchFilter/index.d.ts +2 -2
  94. package/dist/filters/filters/SearchFilter/index.js +4 -4
  95. package/dist/filters/filters/interfaces.d.ts +1 -1
  96. package/dist/filters/interfaces.d.ts +1 -1
  97. package/dist/filters/utility/get-quick-dates.d.ts +1 -1
  98. package/dist/forms/components/Autocomplete/index.d.ts +1 -1
  99. package/dist/forms/components/Autocomplete/index.js +2 -2
  100. package/dist/forms/components/BaseCalendarInput/index.js +2 -2
  101. package/dist/forms/components/CSVInput/index.d.ts +2 -2
  102. package/dist/forms/components/CSVInput/index.js +2 -2
  103. package/dist/forms/components/CalendarInput/index.js +1 -1
  104. package/dist/forms/components/CheckboxInput/index.d.ts +2 -2
  105. package/dist/forms/components/CheckboxInput/index.js +1 -1
  106. package/dist/forms/components/ChkRad/index.d.ts +4 -3
  107. package/dist/forms/components/ChkRad/index.js +9 -6
  108. package/dist/forms/components/ColorInput/index.d.ts +2 -2
  109. package/dist/forms/components/ColorInput/index.js +3 -3
  110. package/dist/forms/components/Dropdown/index.d.ts +1 -1
  111. package/dist/forms/components/Dropdown/index.js +4 -4
  112. package/dist/forms/components/DropdownItem/index.d.ts +2 -2
  113. package/dist/forms/components/DropdownItem/index.js +2 -2
  114. package/dist/forms/components/DropdownList/index.d.ts +2 -2
  115. package/dist/forms/components/DropdownList/index.js +1 -1
  116. package/dist/forms/components/EditableForm/index.d.ts +4 -3
  117. package/dist/forms/components/EditableForm/index.js +14 -10
  118. package/dist/forms/components/EditableFormField/index.d.ts +1 -1
  119. package/dist/forms/components/EditableFormField/index.js +1 -1
  120. package/dist/forms/components/EditableFormFields/index.js +4 -3
  121. package/dist/forms/components/Form/index.d.ts +1 -1
  122. package/dist/forms/components/Form/index.js +3 -3
  123. package/dist/forms/components/FormError/index.d.ts +1 -1
  124. package/dist/forms/components/FormError/index.js +2 -2
  125. package/dist/forms/components/FormField/index.d.ts +3 -3
  126. package/dist/forms/components/FormField/index.js +3 -3
  127. package/dist/forms/components/FormLabel/index.d.ts +1 -1
  128. package/dist/forms/components/FormLabel/index.js +2 -2
  129. package/dist/forms/components/FormSubmit/index.d.ts +1 -1
  130. package/dist/forms/components/FormSubmit/index.js +1 -1
  131. package/dist/forms/components/ImageInput/index.d.ts +3 -3
  132. package/dist/forms/components/ImageInput/index.js +3 -3
  133. package/dist/forms/components/ImageInputPanel/index.d.ts +1 -1
  134. package/dist/forms/components/ImageInputPanel/index.js +1 -1
  135. package/dist/forms/components/ModalForm/index.d.ts +1 -1
  136. package/dist/forms/components/ModalForm/index.js +4 -4
  137. package/dist/forms/components/NumberInput/index.d.ts +1 -1
  138. package/dist/forms/components/PasswordComplexity/index.d.ts +1 -1
  139. package/dist/forms/components/PasswordComplexity/index.js +1 -1
  140. package/dist/forms/components/PasswordComplexityItem/index.d.ts +1 -1
  141. package/dist/forms/components/PasswordComplexityItem/index.js +1 -1
  142. package/dist/forms/components/PasswordInput/index.d.ts +2 -2
  143. package/dist/forms/components/PasswordInput/index.js +1 -1
  144. package/dist/forms/components/RangeCalendarInput/index.js +1 -1
  145. package/dist/forms/components/StaticTextInput/index.d.ts +2 -2
  146. package/dist/forms/components/StaticTextInput/index.js +3 -3
  147. package/dist/forms/components/Switch/index.d.ts +2 -2
  148. package/dist/forms/components/Switch/index.js +3 -3
  149. package/dist/forms/components/TextArea/index.d.ts +2 -2
  150. package/dist/forms/components/TextArea/index.js +2 -2
  151. package/dist/forms/components/TextInput/index.d.ts +2 -2
  152. package/dist/forms/components/TextInput/index.js +2 -2
  153. package/dist/forms/hooks/useEditableForm.d.ts +2 -1
  154. package/dist/forms/hooks/useEditableForm.js +7 -3
  155. package/dist/forms/hooks/useForm.d.ts +2 -2
  156. package/dist/forms/hooks/useForm.js +2 -2
  157. package/dist/forms/hooks/useModalForm.d.ts +1 -1
  158. package/dist/forms/hooks/useModalForm.js +1 -1
  159. package/dist/forms/interfaces.d.ts +1 -0
  160. package/dist/hooks/useConfirmable.d.ts +1 -1
  161. package/dist/hooks/useSelected.d.ts +1 -1
  162. package/dist/hooks/useSuccess.js +1 -1
  163. package/dist/navigation/components/AppNavigation/index.d.ts +1 -1
  164. package/dist/navigation/components/AppNavigation/index.js +1 -1
  165. package/dist/navigation/components/AppNavigationItem/index.d.ts +2 -2
  166. package/dist/navigation/components/AppNavigationItem/index.js +6 -6
  167. package/dist/navigation/hooks/useNavigation.d.ts +1 -1
  168. package/dist/styles/classnames/config.d.ts +47 -47
  169. package/dist/styles/classnames/utility/apply-sizes.d.ts +1 -1
  170. package/dist/styles/classnames/utility/apply-variants.d.ts +1 -1
  171. package/dist/utility/interfaces.d.ts +1 -1
  172. package/package.json +17 -17
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import Popover from '../../../components/utility/Popover';
4
- import useClickOutside from '../../../hooks/useClickOutside';
5
- import tw from '../../../styles/classnames/utility/tw';
6
- import { useClassNames, useIcon } from '../../../styles/context';
3
+ import Popover from '../../../components/utility/Popover/index.js';
4
+ import useClickOutside from '../../../hooks/useClickOutside.js';
5
+ import tw from '../../../styles/classnames/utility/tw.js';
6
+ import { useClassNames, useIcon } from '../../../styles/context.js';
7
7
  import DropdownList from '../DropdownList';
8
8
  import StaticTextInput from '../StaticTextInput';
9
9
  function findByValue(options, value) {
@@ -1,5 +1,5 @@
1
- import type { DropdownObject } from '../../../forms/interfaces';
2
- import type { ClassNameProps } from '../../../styles/classnames/interfaces';
1
+ import type { DropdownObject } from '../../interfaces.js';
2
+ import type { ClassNameProps } from '../../../styles/classnames/interfaces.js';
3
3
  import type { DropdownClassNames } from '../Dropdown';
4
4
  interface DropdownItemProps<T> extends ClassNameProps<DropdownClassNames>, DropdownObject<T> {
5
5
  isSelected: boolean;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useClassNames } from '../../../styles/context';
4
- import tw from '../../../styles/classnames/utility/tw';
3
+ import { useClassNames } from '../../../styles/context.js';
4
+ import tw from '../../../styles/classnames/utility/tw.js';
5
5
  function DropdownItem({ $data, classNameProps, classNames, details, isDisabled, isSelected, label, onChange, value, }) {
6
6
  const componentClassNames = useClassNames('dropdown', { props: classNameProps, states: { isSelected } }, classNames);
7
7
  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] }) }));
@@ -1,5 +1,5 @@
1
- import type { DropdownObject, InputProps } from '../../../forms/interfaces';
2
- import type { ClassNameProps } from '../../../styles/classnames/interfaces';
1
+ import type { DropdownObject, InputProps } from '../../interfaces.js';
2
+ import type { ClassNameProps } from '../../../styles/classnames/interfaces.js';
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,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useClassNames } from '../../../styles/context';
3
+ import { useClassNames } from '../../../styles/context.js';
4
4
  import DropdownItem from '../DropdownItem';
5
5
  function DropdownList({ classNames, classNameProps, name, onChange, options, value, }) {
6
6
  const componentClassNames = useClassNames('dropdown', { props: classNameProps }, classNames);
@@ -1,5 +1,5 @@
1
- import type { ClassNameProps } from '../../../styles/classnames/interfaces';
2
- import type { SimpleActionObject } from '../../../utility/interfaces';
1
+ import type { ClassNameProps } from '../../../styles/classnames/interfaces.js';
2
+ import type { SimpleActionObject } from '../../../utility/interfaces.js';
3
3
  import type { EditingStatus } from '../../interfaces';
4
4
  import type { FormProps } from '../Form';
5
5
  export interface EditableFormClassNames {
@@ -15,11 +15,12 @@ export interface EditableFormProps extends ClassNameProps<EditableFormClassNames
15
15
  actions?: SimpleActionObject[] | false;
16
16
  children: React.ReactNode;
17
17
  formProps: Omit<FormProps, 'children'>;
18
+ isEditable?: boolean;
18
19
  onCancel?: () => void;
19
20
  onEdit?: () => void;
20
21
  setStatus?: (status: EditingStatus | null) => void;
21
22
  status?: EditingStatus | null;
22
23
  title?: string;
23
24
  }
24
- declare function EditableForm({ classNameProps, classNames, children, formProps, onCancel, onEdit, setStatus, status, title, }: Readonly<EditableFormProps>): React.ReactElement;
25
+ declare function EditableForm({ classNameProps, classNames, children, formProps, isEditable, onCancel, onEdit, setStatus, status, title, }: Readonly<EditableFormProps>): React.ReactElement;
25
26
  export default EditableForm;
@@ -1,23 +1,27 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import ActionList from '../../../components/utility/ActionList';
4
- import { useClassNames } from '../../../styles/context';
3
+ import ActionList from '../../../components/utility/ActionList/index.js';
4
+ import { useClassNames } from '../../../styles/context.js';
5
5
  import Form from '../Form';
6
- function EditableForm({ classNameProps, classNames, children, formProps, onCancel, onEdit, setStatus, status, title, }) {
7
- const componentClassNames = useClassNames('editableForm', { props: classNameProps }, classNames);
6
+ function EditableForm({ classNameProps, classNames, children, formProps, isEditable = true, onCancel, onEdit, setStatus, status, title, }) {
7
+ const componentClassNames = useClassNames('editableForm', { props: { ...classNameProps, hasTitle: Boolean(title), isEditable } }, classNames);
8
8
  function setCancelled() {
9
- onCancel?.();
10
- setStatus?.('CANCELLED');
9
+ if (isEditable) {
10
+ onCancel?.();
11
+ setStatus?.('CANCELLED');
12
+ }
11
13
  }
12
14
  function setEditing() {
13
- onEdit?.();
14
- setStatus?.('EDITING');
15
+ if (isEditable) {
16
+ onEdit?.();
17
+ setStatus?.('EDITING');
18
+ }
15
19
  }
16
- return (_jsxs(Form, { ...formProps, classNames: { root: componentClassNames?.root, errors: componentClassNames?.errors }, 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'
20
+ return (_jsxs(Form, { ...formProps, classNames: { root: componentClassNames?.root, errors: componentClassNames?.errors }, children: [title ? (_jsx("header", { className: componentClassNames?.header, children: _jsx("legend", { className: componentClassNames?.title, children: title }) })) : null, _jsxs("div", { className: componentClassNames?.content, children: [children, isEditable ? (_jsx("footer", { className: componentClassNames?.actions, children: _jsx(ActionList, { actions: status === 'EDITING'
17
21
  ? [
18
22
  { label: 'Cancel', onClick: setCancelled },
19
23
  { isSubmittable: true, label: 'Save' },
20
24
  ]
21
- : [{ label: 'Edit', onClick: setEditing }] }) })] })] }));
25
+ : [{ label: 'Edit', onClick: setEditing }] }) })) : null] })] }));
22
26
  }
23
27
  export default EditableForm;
@@ -1,4 +1,4 @@
1
- import type { ClassNameProps } from '../../../styles/classnames/interfaces';
1
+ import type { ClassNameProps } from '../../../styles/classnames/interfaces.js';
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 { useClassNames } from '../../../styles/context';
5
+ import { useClassNames } from '../../../styles/context.js';
6
6
  function getRenderedValue(value, renderValue) {
7
7
  if (renderValue) {
8
8
  if (typeof renderValue === 'function') {
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback } from 'react';
3
3
  import { formatMoney, formatPoints } from '@sqrzro/utility';
4
- import { useClassNames } from '../../../styles/context';
5
- import tw from '../../../styles/classnames/utility/tw';
4
+ import { useClassNames } from '../../../styles/context.js';
5
+ import tw from '../../../styles/classnames/utility/tw.js';
6
6
  import extractEditableInputProps from '../../utility/extract-editable-input-props';
7
7
  import CheckboxInput from '../CheckboxInput';
8
8
  import ColorInput from '../ColorInput';
@@ -14,6 +14,7 @@ import PointsInput from '../PointsInput';
14
14
  import Switch from '../Switch';
15
15
  import TextArea from '../TextArea';
16
16
  import TextInput from '../TextInput';
17
+ import ChkRad from '../ChkRad';
17
18
  export function EditableCheckboxFormField(props) {
18
19
  const classNames = useClassNames('checkboxInput');
19
20
  const { fieldProps, inputProps } = extractEditableInputProps(props);
@@ -24,7 +25,7 @@ export function EditableCheckboxFormField(props) {
24
25
  }
25
26
  return (_jsx("ul", { className: classNames?.root, role: "listbox", children: props.options
26
27
  ?.filter((option) => value.includes(option.value))
27
- .map((option) => (_jsx("li", { className: classNames?.item, children: option.label }, String(option.value)))) }));
28
+ .map((option) => (_jsx("li", { className: classNames?.item, children: _jsx(ChkRad, { isReadOnly: true, label: option.label, name: props.name, value: true }) }, String(option.value)))) }));
28
29
  }, [fieldProps.value]);
29
30
  return _jsx(EditableFormField, { ...fieldProps, render: renderInput, renderValue: renderValue });
30
31
  }
@@ -1,4 +1,4 @@
1
- import type { ClassNameProps } from '../../../styles/classnames/interfaces';
1
+ import type { ClassNameProps } from '../../../styles/classnames/interfaces.js';
2
2
  export interface FormClassNames {
3
3
  root: string;
4
4
  errors: string;
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useClassNames } from '../../../styles/context';
4
- import tw from '../../../styles/classnames/utility/tw';
5
- import { InfoPanel } from '../../../components';
3
+ import { useClassNames } from '../../../styles/context.js';
4
+ import tw from '../../../styles/classnames/utility/tw.js';
5
+ import { InfoPanel } from '../../../components/index.js';
6
6
  function Form({ action, children, classNames, classNameProps, id, onSubmit, uncaughtErrors, ref, }) {
7
7
  const componentClassNames = useClassNames('form', { props: classNameProps }, classNames);
8
8
  return (_jsxs("form", { ref: ref, action: action, className: tw(componentClassNames?.root), id: id, onSubmit: onSubmit, children: [uncaughtErrors && Object.keys(uncaughtErrors).length ? (_jsx("div", { className: tw(componentClassNames?.errors), children: _jsx(InfoPanel, { variant: "error", children: Object.values(uncaughtErrors).map((item, index) => (_jsx("p", { children: item }, index))) }) })) : null, children] }));
@@ -1,4 +1,4 @@
1
- import type { ClassNameProps } from '../../../styles/classnames/interfaces';
1
+ import type { ClassNameProps } from '../../../styles/classnames/interfaces.js';
2
2
  import type { FormFieldClassNames } from '../FormField';
3
3
  export interface FormErrorProps extends ClassNameProps<FormFieldClassNames> {
4
4
  children: React.ReactNode;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useClassNames, useIcon } from '../../../styles/context';
4
- import tw from '../../../styles/classnames/utility/tw';
3
+ import { useClassNames, useIcon } from '../../../styles/context.js';
4
+ import tw from '../../../styles/classnames/utility/tw.js';
5
5
  function FormError({ children, classNames, classNameProps, id, isAssistive, }) {
6
6
  const componentClassNames = useClassNames('formField', { props: classNameProps }, classNames);
7
7
  const Icon = useIcon('formField.error');
@@ -1,6 +1,6 @@
1
- import type { InputEvent, InputProps } from '../../../forms/interfaces';
2
- import type { ClassNameProps, ErrorableClassName } from '../../../styles/classnames/interfaces';
3
- import { SimpleActionObject } from '../../../utility/interfaces';
1
+ import type { InputEvent, InputProps } from '../../interfaces.js';
2
+ import type { ClassNameProps, ErrorableClassName } from '../../../styles/classnames/interfaces.js';
3
+ import { SimpleActionObject } from '../../../utility/interfaces.js';
4
4
  export interface FormFieldClassNames {
5
5
  root: ErrorableClassName;
6
6
  label: string;
@@ -1,11 +1,11 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from 'react';
4
- import { useClassNames } from '../../../styles/context';
5
- import tw from '../../../styles/classnames/utility/tw';
4
+ import { useClassNames } from '../../../styles/context.js';
5
+ import tw from '../../../styles/classnames/utility/tw.js';
6
6
  import FormError from '../FormError';
7
7
  import FormLabel from '../FormLabel';
8
- import ActionButton from '../../../components/buttons/ActionButton';
8
+ import ActionButton from '../../../components/buttons/ActionButton/index.js';
9
9
  function checkHasError(error) {
10
10
  return Boolean(error &&
11
11
  Object.keys(error).length > 0 &&
@@ -1,4 +1,4 @@
1
- import type { ClassNameProps } from '../../../styles/classnames/interfaces';
1
+ import type { ClassNameProps } from '../../../styles/classnames/interfaces.js';
2
2
  import type { FormFieldClassNames } from '../FormField';
3
3
  interface FormLabelProps extends ClassNameProps<FormFieldClassNames> {
4
4
  children: React.ReactNode;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useClassNames } from '../../../styles/context';
4
- import tw from '../../../styles/classnames/utility/tw';
3
+ import { useClassNames } from '../../../styles/context.js';
4
+ import tw from '../../../styles/classnames/utility/tw.js';
5
5
  function FormLabel({ children, classNames, classNameProps, htmlFor, isAssistive, isOptional, }) {
6
6
  const componentClassNames = useClassNames('formField', { props: classNameProps }, classNames);
7
7
  return (_jsxs("label", { className: tw(componentClassNames?.label, isAssistive ? 'sr-only' : null), htmlFor: htmlFor, children: [children, isOptional ? _jsx("small", { className: componentClassNames?.optional, children: "Optional" }) : null] }));
@@ -1,4 +1,4 @@
1
- import type { ButtonProps } from '../../../components/buttons/Button';
1
+ import type { ButtonProps } from '../../../components/buttons/Button/index.js';
2
2
  export type FormSubmitProps = Omit<ButtonProps, 'href' | 'isNewWindow' | 'isText'>;
3
3
  declare function FormSubmit({ isLoading, ...props }: Readonly<FormSubmitProps>): React.ReactElement;
4
4
  export default FormSubmit;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { useFormStatus } from 'react-dom';
4
- import Button from '../../../components/buttons/Button';
4
+ import Button from '../../../components/buttons/Button/index.js';
5
5
  function FormSubmit({ isLoading, ...props }) {
6
6
  const { pending } = useFormStatus();
7
7
  return _jsx(Button, { ...props, isLoading: isLoading || pending, type: "submit", variant: "primary" });
@@ -1,6 +1,6 @@
1
- import type { ImageTypeKey } from '../../../forms/utility/preprocess-image';
2
- import type { FormResponse, InputProps } from '../../../forms/interfaces';
3
- import type { ClassNameProps, HighlightableClassName } from '../../../styles/classnames/interfaces';
1
+ import type { ImageTypeKey } from '../../utility/preprocess-image.js';
2
+ import type { FormResponse, InputProps } from '../../interfaces.js';
3
+ import type { ClassNameProps, HighlightableClassName } from '../../../styles/classnames/interfaces.js';
4
4
  export interface ImageInputClassNames {
5
5
  description: string;
6
6
  icon: HighlightableClassName;
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from 'react';
4
- import preprocessImage from '../../../forms/utility/preprocess-image';
5
- import { useClassNames } from '../../../styles/context';
6
- import tw from '../../../styles/classnames/utility/tw';
4
+ import preprocessImage from '../../utility/preprocess-image.js';
5
+ import { useClassNames } from '../../../styles/context.js';
6
+ import tw from '../../../styles/classnames/utility/tw.js';
7
7
  import ImageInputPanel from '../ImageInputPanel';
8
8
  function ImageInput({ accept, classNames, classNameProps, format, id, isDisabled, maxSize, minSize, name, onChange, onUpload, value, }) {
9
9
  const [error, setError] = useState(null);
@@ -1,4 +1,4 @@
1
- import type { ClassNameProps } from '../../../styles/classnames/interfaces';
1
+ import type { ClassNameProps } from '../../../styles/classnames/interfaces.js';
2
2
  import type { ImageInputClassNames } from '../ImageInput';
3
3
  interface ImageInputPanelProps extends ClassNameProps<ImageInputClassNames> {
4
4
  error?: string | null;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useClassNames, useIcon } from '../../../styles/context';
2
+ import { useClassNames, useIcon } from '../../../styles/context.js';
3
3
  function renderMinSize(minSize) {
4
4
  if (!minSize) {
5
5
  return null;
@@ -1,4 +1,4 @@
1
- import type { ModalProps } from '../../../components/modals/Modal';
1
+ import type { ModalProps } from '../../../components/modals/Modal/index.js';
2
2
  import type { FormProps } from '../Form';
3
3
  export interface ModalFormProps {
4
4
  children: React.ReactNode;
@@ -1,10 +1,10 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import Modal from '../../../components/modals/Modal';
4
- import ModalActions from '../../../components/modals/ModalActions';
5
- import useSearchParamsHref from '../../../hooks/useSearchParamsHref';
3
+ import Modal from '../../../components/modals/Modal/index.js';
4
+ import ModalActions from '../../../components/modals/ModalActions/index.js';
5
+ import useSearchParamsHref from '../../../hooks/useSearchParamsHref.js';
6
6
  import Form from '../Form';
7
- import { InfoPanel } from '../../../components';
7
+ import { InfoPanel } from '../../../components/index.js';
8
8
  function ModalForm({ children, formProps, hasSubmit = true, isDisabled, modalProps, serverError, submitLabel, validationErrors, }) {
9
9
  const { setSearchParamsHref } = useSearchParamsHref();
10
10
  function handleCancel() {
@@ -1,4 +1,4 @@
1
- import { ClassNameProps } from '../../../styles/classnames/interfaces';
1
+ import { ClassNameProps } from '../../../styles/classnames/interfaces.js';
2
2
  import type { InputProps } from '../../interfaces';
3
3
  import type { TextInputClassNames, TextInputComponentProps } from '../TextInput';
4
4
  export type NumberInputComponentProps = TextInputComponentProps;
@@ -1,4 +1,4 @@
1
- import { ClassNameProps } from '../../../styles';
1
+ import { ClassNameProps } from '../../../styles/index.js';
2
2
  export interface PasswordComplexityClassNames {
3
3
  root: string;
4
4
  list: string;
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useClassNames } from '../../../styles';
3
+ import { useClassNames } from '../../../styles/index.js';
4
4
  import useDeepCompareEffect from 'use-deep-compare-effect';
5
5
  import PasswordComplexityItem from '../PasswordComplexityItem';
6
6
  function PasswordComplexity({ classNameProps, classNames, data, onComplexity, }) {
@@ -1,4 +1,4 @@
1
- import { ClassNameProps } from '../../../styles';
1
+ import { ClassNameProps } from '../../../styles/index.js';
2
2
  import type { PasswordComplexityClassNames } from '../PasswordComplexity';
3
3
  interface PasswordComplexityItemProps extends ClassNameProps<PasswordComplexityClassNames> {
4
4
  isValid: boolean;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useClassNames, useIcon } from '../../../styles';
2
+ import { useClassNames, useIcon } from '../../../styles/index.js';
3
3
  function PasswordComplexityItem({ classNameProps, classNames, isValid, value, }) {
4
4
  const componentClassNames = useClassNames('passwordComplexity', { props: { ...classNameProps, isValid } }, classNames);
5
5
  const InvalidIcon = useIcon('passwordComplexity.invalid');
@@ -1,5 +1,5 @@
1
- import { InputProps } from '../../../forms/interfaces';
2
- import type { ClassNameProps, SelectableClassName } from '../../../styles/classnames/interfaces';
1
+ import { InputProps } from '../../interfaces.js';
2
+ import type { ClassNameProps, SelectableClassName } from '../../../styles/classnames/interfaces.js';
3
3
  import type { TextInputComponentProps } from '../TextInput';
4
4
  export interface PasswordInputClassNames {
5
5
  action: string;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState } from 'react';
4
- import { useClassNames, useIcon } from '../../../styles/context';
4
+ import { useClassNames, useIcon } from '../../../styles/context.js';
5
5
  import TextInput from '../TextInput';
6
6
  function PasswordInput({ classNameProps, classNames, ...props }) {
7
7
  const [isVisible, setIsVisible] = useState(false);
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import Calendar from '../../../components/utility/Calendar';
3
+ import Calendar from '../../../components/utility/Calendar/index.js';
4
4
  import BaseCalendarInput from '../BaseCalendarInput';
5
5
  function RangeCalendarInput({ name, onChange, value, ...baseProps }) {
6
6
  function handleChange(eventValue) {
@@ -1,5 +1,5 @@
1
- import type { InputProps } from '../../../forms/interfaces';
2
- import type { ClassNameProps, ErrorableClassName } from '../../../styles/classnames/interfaces';
1
+ import type { InputProps } from '../../interfaces.js';
2
+ import type { ClassNameProps, ErrorableClassName } from '../../../styles/classnames/interfaces.js';
3
3
  export interface StaticTextInputClassNames {
4
4
  root: ErrorableClassName;
5
5
  placeholder: string;
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Fragment } from 'react';
4
- import Assistive from '../../../components/utility/Assistive';
5
- import { useClassNames, useIcon } from '../../../styles/context';
6
- import tw from '../../../styles/classnames/utility/tw';
4
+ import Assistive from '../../../components/utility/Assistive/index.js';
5
+ import { useClassNames, useIcon } from '../../../styles/context.js';
6
+ import tw from '../../../styles/classnames/utility/tw.js';
7
7
  function hasValue(value) {
8
8
  if (Array.isArray(value)) {
9
9
  return Boolean(value.filter((item) => Boolean(item)).length);
@@ -1,5 +1,5 @@
1
- import type { InputProps } from '../../../forms/interfaces';
2
- import { CheckableClassName, ClassNameProps } from '../../../styles/classnames/interfaces';
1
+ import type { InputProps } from '../../interfaces.js';
2
+ import { CheckableClassName, ClassNameProps } from '../../../styles/classnames/interfaces.js';
3
3
  export interface SwitchClassNames {
4
4
  root: string;
5
5
  control: string;
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Fragment } from 'react';
4
- import Assistive from '../../../components/utility/Assistive';
5
- import { useClassNames } from '../../../styles/context';
6
- import tw from '../../../styles/classnames/utility/tw';
4
+ import Assistive from '../../../components/utility/Assistive/index.js';
5
+ import { useClassNames } from '../../../styles/context.js';
6
+ import tw from '../../../styles/classnames/utility/tw.js';
7
7
  function Switch({ classNameProps, classNames, details, id, isDisabled, label, name, onChange, value, }) {
8
8
  const componentClassNames = useClassNames('switch', { props: classNameProps, states: { isChecked: Boolean(value) } }, classNames);
9
9
  function handleChange(event) {
@@ -1,5 +1,5 @@
1
- import type { InputProps } from '../../../forms/interfaces';
2
- import type { ClassNameProps, ErrorableClassName } from '../../../styles/classnames/interfaces';
1
+ import type { InputProps } from '../../interfaces.js';
2
+ import type { ClassNameProps, ErrorableClassName } from '../../../styles/classnames/interfaces.js';
3
3
  export interface TextAreaClassNames {
4
4
  root: ErrorableClassName;
5
5
  }
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useClassNames } from '../../../styles/context';
4
- import tw from '../../../styles/classnames/utility/tw';
3
+ import { useClassNames } from '../../../styles/context.js';
4
+ import tw from '../../../styles/classnames/utility/tw.js';
5
5
  function TextArea({ classNames, classNameProps, hasError, id, isDisabled, name, onBlur, onChange, onFocus, onKeyDown, placeholder, rows = 4, value, }) {
6
6
  const componentClassNames = useClassNames('textArea', { props: classNameProps, states: { isError: hasError ?? false } }, classNames);
7
7
  function handleChange(event) {
@@ -1,5 +1,5 @@
1
- import type { InputProps } from '../../../forms/interfaces';
2
- import type { ClassNameProps, ErrorableClassName } from '../../../styles/classnames/interfaces';
1
+ import type { InputProps } from '../../interfaces.js';
2
+ import type { ClassNameProps, ErrorableClassName } from '../../../styles/classnames/interfaces.js';
3
3
  export interface TextInputClassNames {
4
4
  loading: string;
5
5
  prefix: ErrorableClassName;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useClassNames } from '../../../styles/context';
4
- import tw from '../../../styles/classnames/utility/tw';
3
+ import { useClassNames } from '../../../styles/context.js';
4
+ import tw from '../../../styles/classnames/utility/tw.js';
5
5
  /**
6
6
  *
7
7
  * ## ClassNames
@@ -6,6 +6,7 @@ export interface EditableFieldPropsReturn<Request, K extends keyof Request = key
6
6
  }
7
7
  export type UseEditableFormArgs<Request, Response> = UseFormArgs<Request, Response> & {
8
8
  defaultStatus?: EditingStatus;
9
+ isEditable?: boolean;
9
10
  onCancel?: () => void;
10
11
  onEdit?: () => void;
11
12
  title?: string;
@@ -20,5 +21,5 @@ export interface UseEditableFormReturn<Request> extends Omit<UseFormReturn<Reque
20
21
  setStatus: React.Dispatch<React.SetStateAction<EditingStatus | null>>;
21
22
  status: EditingStatus | null;
22
23
  }
23
- declare function useEditableForm<Request extends object, Response = Request>({ defaultStatus, onCancel, onEdit, onSuccess, title, ...args }: UseEditableFormArgs<Request, Response>): UseEditableFormReturn<Request>;
24
+ declare function useEditableForm<Request extends object, Response = Request>({ defaultStatus, isEditable, onCancel, onEdit, onSuccess, title, ...args }: UseEditableFormArgs<Request, Response>): UseEditableFormReturn<Request>;
24
25
  export default useEditableForm;
@@ -1,8 +1,11 @@
1
1
  import { useState } from 'react';
2
2
  import useForm from './useForm';
3
- function useEditableForm({ defaultStatus, onCancel, onEdit, onSuccess, title, ...args }) {
4
- const [status, setStatus] = useState(defaultStatus ?? null);
3
+ function useEditableForm({ defaultStatus, isEditable = true, onCancel, onEdit, onSuccess, title, ...args }) {
4
+ const [status, setStatus] = useState(isEditable ? (defaultStatus ?? null) : null);
5
5
  async function onEditableSuccess(response) {
6
+ if (!isEditable) {
7
+ return;
8
+ }
6
9
  if (onSuccess) {
7
10
  await onSuccess(response);
8
11
  }
@@ -15,7 +18,7 @@ function useEditableForm({ defaultStatus, onCancel, onEdit, onSuccess, title, ..
15
18
  });
16
19
  function editableFieldProps(name, label) {
17
20
  const fieldProps = useFormReturn.fieldProps(name, label);
18
- return { ...fieldProps, status };
21
+ return { ...fieldProps, status: isEditable ? status : null };
19
22
  }
20
23
  function handleCancel() {
21
24
  if (onCancel) {
@@ -29,6 +32,7 @@ function useEditableForm({ defaultStatus, onCancel, onEdit, onSuccess, title, ..
29
32
  fieldProps: editableFieldProps,
30
33
  formProps: {
31
34
  formProps: useFormReturn.formProps,
35
+ isEditable,
32
36
  onCancel: handleCancel,
33
37
  onEdit,
34
38
  status,
@@ -1,5 +1,5 @@
1
- import type { Default, FormResponse, InputEvent } from '../../forms/interfaces';
2
- import type { UseSuccessArgs } from '../../hooks/useSuccess';
1
+ import type { Default, FormResponse, InputEvent } from '../interfaces.js';
2
+ import type { UseSuccessArgs } from '../../hooks/useSuccess.js';
3
3
  import type { FormProps } from '../components/Form';
4
4
  export interface FieldPropsReturn<Request, K extends keyof Request = keyof Request> {
5
5
  error: Record<string, string> | null;
@@ -2,8 +2,8 @@
2
2
  import { useRef, useState, useTransition } from 'react';
3
3
  import { formatTitle } from '@sqrzro/utility';
4
4
  import useDeepCompareEffect from 'use-deep-compare-effect';
5
- import useSuccess from '../../hooks/useSuccess';
6
- import useToast from '../../hooks/useToast';
5
+ import useSuccess from '../../hooks/useSuccess.js';
6
+ import useToast from '../../hooks/useToast.js';
7
7
  export const DEFAULT_TOAST_MESSAGES = {
8
8
  server: 'There was a problem submitting your request. Please try again later.',
9
9
  success: 'Your request was submitted successfully.',
@@ -1,4 +1,4 @@
1
- import type { SimpleActionObject } from '../../utility/interfaces';
1
+ import type { SimpleActionObject } from '../../utility/interfaces.js';
2
2
  import type { ModalFormProps } from '../components/ModalForm';
3
3
  import type { UseFormArgs, UseFormReturn } from './useForm';
4
4
  export interface UseModalFormArgs<Request, Response> extends UseFormArgs<Request, Response> {
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { useState } from 'react';
3
3
  import { useRouter } from 'next/navigation';
4
- import useSearchParamsHref from '../../hooks/useSearchParamsHref';
4
+ import useSearchParamsHref from '../../hooks/useSearchParamsHref.js';
5
5
  import useForm, { DEFAULT_TOAST_MESSAGES } from './useForm';
6
6
  function useModalForm({ actions, icon, submitLabel, title, ...useFormArgs }) {
7
7
  const [serverError, setServerError] = useState(null);
@@ -31,6 +31,7 @@ export interface InputProps<V, T extends V = V> {
31
31
  hasError?: boolean;
32
32
  id?: string;
33
33
  isDisabled?: boolean;
34
+ isReadOnly?: boolean;
34
35
  name: string;
35
36
  ref?: React.Ref<HTMLInputElement>;
36
37
  onChange?: (event: InputEvent<T>) => void;
@@ -1,4 +1,4 @@
1
- import type { ActionEvent } from '../utility/interfaces';
1
+ import type { ActionEvent } from '../utility/interfaces.js';
2
2
  interface UseConfirmableArgs {
3
3
  isLoading?: boolean;
4
4
  onBeforeConfirm?: () => void;
@@ -1,4 +1,4 @@
1
- import type { InputEvent } from '../forms/interfaces';
1
+ import type { InputEvent } from '../forms/interfaces.js';
2
2
  interface UseSelectedReturn {
3
3
  checkSelected: (id: string) => boolean;
4
4
  isAllSelected: boolean;