@pagamio/frontend-commons-lib 0.8.297 → 0.8.299

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.
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import type { InputProps } from '../../../types';
3
- declare const TimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
3
+ declare const TimeInput: React.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
4
4
  export default TimeInput;
@@ -1,17 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { TimePicker } from '@mantine/dates';
2
+ import { TimeInput as MantineTimeInput } from '@mantine/dates';
3
3
  import React from 'react';
4
4
  const TimeInput = React.forwardRef(({ field, error, ...props }, ref) => {
5
5
  const { value, onChange, onBlur, name } = props;
6
- const handleChange = (newValue) => {
6
+ const handleChange = (event) => {
7
7
  if (onChange) {
8
- const syntheticEvent = {
9
- target: { value: newValue, name: name || field.name },
10
- currentTarget: { value: newValue, name: name || field.name },
11
- };
12
- onChange(syntheticEvent);
8
+ onChange(event);
13
9
  }
14
10
  };
15
- return (_jsx(TimePicker, { ref: ref, label: field.label, value: value ? String(value) : '', onChange: handleChange, onBlur: onBlur, name: name || field.name, error: error?.message, disabled: field.disabled, withDropdown: true, minutesStep: 5, clearable: true }));
11
+ return (_jsx(MantineTimeInput, { ref: ref, label: field.label, value: value ? String(value) : '', onChange: handleChange, onBlur: onBlur, name: name || field.name, error: error?.message, disabled: field.disabled }));
16
12
  });
17
13
  export default TimeInput;
@@ -123,12 +123,16 @@ const formatUrlString = (value) => {
123
123
  const formatNumberValue = (value, columnKey) => {
124
124
  if (columnKey && (columnKey.toLowerCase().includes('amount') || columnKey.toLowerCase().includes('price'))) {
125
125
  // Format as currency with proper symbol
126
+ // Replace non-breaking spaces (U+00A0) with regular spaces to prevent
127
+ // encoding corruption when CSV is opened in Excel with non-UTF-8 encoding
126
128
  return new Intl.NumberFormat('en-ZA', {
127
129
  style: 'currency',
128
130
  currency: 'ZAR',
129
131
  minimumFractionDigits: 2,
130
132
  maximumFractionDigits: 2,
131
- }).format(value);
133
+ })
134
+ .format(value)
135
+ .replace(/\u00A0/g, ' ');
132
136
  }
133
137
  return value.toString();
134
138
  };
@@ -276,8 +280,8 @@ export const exportToCsv = (data, columns, options = {}) => {
276
280
  }
277
281
  // Combine metadata comments with CSV content
278
282
  const finalContent = csvRows.length > 0 ? csvRows.join('\n') + '\n' + csvContent : csvContent;
279
- // Create and download file
280
- const blob = new Blob([finalContent], { type: 'text/csv;charset=utf-8;' });
283
+ // Create and download file — prepend UTF-8 BOM so Excel detects encoding correctly
284
+ const blob = new Blob(['\uFEFF' + finalContent], { type: 'text/csv;charset=utf-8;' });
281
285
  const link = document.createElement('a');
282
286
  link.href = URL.createObjectURL(blob);
283
287
  // Generate filename with timestamp if not provided
@@ -839,7 +843,7 @@ export const generateExportAsFile = async (data, columns, format, options) => {
839
843
  return value !== null && value !== undefined ? String(value) : '';
840
844
  }));
841
845
  const csvContent = Papa.unparse({ fields: headers, data: rows });
842
- const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
846
+ const blob = new Blob(['\uFEFF' + csvContent], { type: 'text/csv;charset=utf-8;' });
843
847
  return new File([blob], `${baseFilename}.csv`, { type: 'text/csv' });
844
848
  }
845
849
  if (format === 'xlsx') {
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.297",
4
+ "version": "0.8.299",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "provenance": false