@pagamio/frontend-commons-lib 0.8.299 → 0.8.301
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.
|
@@ -12,6 +12,8 @@ export interface ModalProps extends Omit<FlowbiteModalProps, 'theme' | 'title'>
|
|
|
12
12
|
onClose: () => void;
|
|
13
13
|
/** Specify the size of the modal */
|
|
14
14
|
size?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl';
|
|
15
|
+
/** Whether clicking outside the modal closes it. Defaults to false. */
|
|
16
|
+
dismissible?: boolean;
|
|
15
17
|
/** Button for the primary action */
|
|
16
18
|
primaryButton?: {
|
|
17
19
|
/** Text to display on the button */
|
|
@@ -25,7 +25,7 @@ import Button from './Button';
|
|
|
25
25
|
* </Modal>
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
const Modal = ({ title, children, isOpen, onClose, size = 'md', primaryButton, secondaryButton, headerContent, footerContent, className, ...rest }) => {
|
|
29
|
-
return (_jsxs(FlowbiteModal, { show: isOpen, onClose: onClose, size: size, dismissible:
|
|
28
|
+
const Modal = ({ title, children, isOpen, onClose, size = 'md', dismissible = false, primaryButton, secondaryButton, headerContent, footerContent, className, ...rest }) => {
|
|
29
|
+
return (_jsxs(FlowbiteModal, { show: isOpen, onClose: onClose, size: size, dismissible: dismissible, className: cn('max-h-[90vh] mt-16 md:mt-0 md:max-h-full', className), ...rest, children: [(title ?? headerContent) && _jsx(FlowbiteModalHeader, { children: headerContent ?? title }), _jsx(FlowbiteModalBody, { children: _jsx("div", { className: "space-y-4", children: children }) }), (primaryButton || secondaryButton || footerContent) && (_jsx(FlowbiteModalFooter, { children: footerContent ?? (_jsxs("div", { className: "flex w-full justify-end gap-2", children: [secondaryButton && (_jsx(Button, { onClick: secondaryButton.onClick, variant: secondaryButton.variant ?? 'outline-primary', disabled: secondaryButton.loading ?? secondaryButton.disabled, className: secondaryButton.variant, children: secondaryButton.label })), primaryButton && (_jsx(Button, { onClick: primaryButton.onClick, variant: primaryButton.variant ?? 'primary', disabled: primaryButton.loading ?? primaryButton.disabled, className: primaryButton.variant, children: primaryButton.label }))] })) }))] }));
|
|
30
30
|
};
|
|
31
31
|
export default Modal;
|
|
@@ -74,7 +74,7 @@ const FormEngine = ({ fields, onSubmit, initialValues, layout = 'vertical', isNo
|
|
|
74
74
|
}, [allFields, persistenceKey, saveFormData]);
|
|
75
75
|
// Expose form control methods via ref
|
|
76
76
|
useEffect(() => {
|
|
77
|
-
if (formRef) {
|
|
77
|
+
if (formRef && 'current' in formRef) {
|
|
78
78
|
formRef.current = {
|
|
79
79
|
reset: () => reset(getEffectiveInitialValues()),
|
|
80
80
|
setValue: (name, value) => setValue(name, value),
|
|
@@ -122,17 +122,13 @@ const formatUrlString = (value) => {
|
|
|
122
122
|
};
|
|
123
123
|
const formatNumberValue = (value, columnKey) => {
|
|
124
124
|
if (columnKey && (columnKey.toLowerCase().includes('amount') || columnKey.toLowerCase().includes('price'))) {
|
|
125
|
-
// Format as currency with
|
|
126
|
-
//
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
maximumFractionDigits: 2,
|
|
133
|
-
})
|
|
134
|
-
.format(value)
|
|
135
|
-
.replace(/\u00A0/g, ' ');
|
|
125
|
+
// Format as currency with R symbol and en-US number formatting
|
|
126
|
+
// Uses period for decimal and comma for thousands: R 1,121.00
|
|
127
|
+
return ('R ' +
|
|
128
|
+
new Intl.NumberFormat('en-US', {
|
|
129
|
+
minimumFractionDigits: 2,
|
|
130
|
+
maximumFractionDigits: 2,
|
|
131
|
+
}).format(value));
|
|
136
132
|
}
|
|
137
133
|
return value.toString();
|
|
138
134
|
};
|
|
@@ -160,7 +160,7 @@ export interface PagamioTableProps<T extends Record<string, any>> {
|
|
|
160
160
|
positionActionsColumn?: 'first' | 'last';
|
|
161
161
|
renderTopToolbarCustomActions?: MRT_TableOptions<T>['renderTopToolbarCustomActions'];
|
|
162
162
|
renderBottomToolbarCustomActions?: MRT_TableOptions<T>['renderBottomToolbarCustomActions'];
|
|
163
|
-
layoutMode?: 'semantic' | 'grid'
|
|
163
|
+
layoutMode?: 'semantic' | 'grid';
|
|
164
164
|
defaultColumn?: Partial<MRT_ColumnDef<T>>;
|
|
165
165
|
mantineTableOptions?: Partial<MRT_TableOptions<T>>;
|
|
166
166
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagamio/frontend-commons-lib",
|
|
3
3
|
"description": "Pagamio library for Frontend reusable components like the form engine and table container",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.301",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
7
7
|
"provenance": false
|