@activecollab/components 2.0.119 → 2.0.120

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.
@@ -6,19 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  var _exportNames = {
7
7
  useForkRef: true,
8
8
  useResizeObserver: true,
9
- decimalToHours: true,
10
9
  formatHours: true,
11
10
  formatNumber: true,
12
11
  formatCurrency: true,
13
12
  numberWithSeparator: true,
14
13
  getNumberFromString: true
15
14
  };
16
- Object.defineProperty(exports, "decimalToHours", {
17
- enumerable: true,
18
- get: function get() {
19
- return _timeUtils.decimalToHours;
20
- }
21
- });
22
15
  Object.defineProperty(exports, "formatCurrency", {
23
16
  enumerable: true,
24
17
  get: function get() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_layers","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_colors","_validation","_useForkRef","_interopRequireDefault","_useResizeObserver","_timeUtils","_currencyUtils","obj","__esModule","default"],"sources":["../../../src/utils/index.ts"],"sourcesContent":["export * from \"./layers\";\nexport * from \"./colors\";\nexport * from \"./validation\";\nexport { default as useForkRef } from \"./useForkRef\";\nexport { default as useResizeObserver } from \"./useResizeObserver\";\nexport { decimalToHours, formatHours } from \"./timeUtils\";\nexport {\n formatNumber,\n formatCurrency,\n numberWithSeparator,\n getNumberFromString,\n} from \"./currencyUtils\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IA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AA,GAAAnB,OAAA;AAKyB,SAAAgB,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
1
+ {"version":3,"file":"index.js","names":["_layers","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_colors","_validation","_useForkRef","_interopRequireDefault","_useResizeObserver","_timeUtils","_currencyUtils","obj","__esModule","default"],"sources":["../../../src/utils/index.ts"],"sourcesContent":["export * from \"./layers\";\nexport * from \"./colors\";\nexport * from \"./validation\";\nexport { default as useForkRef } from \"./useForkRef\";\nexport { default as useResizeObserver } from \"./useResizeObserver\";\nexport { formatHours } from \"./timeUtils\";\nexport {\n formatNumber,\n formatCurrency,\n numberWithSeparator,\n getNumberFromString,\n} from \"./currencyUtils\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,OAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAb,OAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,OAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,OAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,OAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAC,OAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,WAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,WAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAU,WAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAE,WAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AACA,IAAAW,WAAA,GAAAC,sBAAA,CAAAhB,OAAA;AACA,IAAAiB,kBAAA,GAAAD,sBAAA,CAAAhB,OAAA;AACA,IAAAkB,UAAA,GAAAlB,OAAA;AACA,IAAAmB,cAAA,GAAAnB,OAAA;AAKyB,SAAAgB,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.withLeadingZero = exports.isDecimal = exports.formatHours = exports.decimalToHours = void 0;
6
+ exports.withLeadingZero = exports.isDecimal = exports.formatHours = void 0;
7
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
8
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
9
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -76,75 +76,6 @@ var formatHours = exports.formatHours = function formatHours(num) {
76
76
  var minutes_formatted = Math.round(parseInt(minutes, 10) / 100 * 60);
77
77
  return "".concat(hours, ":").concat(withLeadingZero(minutes_formatted));
78
78
  };
79
-
80
- /**
81
- * @function decimalToHours
82
- * @deprecated
83
- * @description
84
- * Converts a decimal number representing hours into a formatted string (HH:MM).
85
- * The input can be a number, string, or undefined. The function handles various formats
86
- * and can optionally add a leading zero to the hours component.
87
- *
88
- * @param {number | string | undefined} num - The input representing the hours, which can be in decimal format, a time string, or undefined.
89
- * @param {boolean} [withLeadingZeroHours=false] - Whether to add a leading zero to the hours part of the output.
90
- *
91
- * @returns {string} - A formatted time string in HH:MM format.
92
- *
93
- * @example
94
- * decimalToHours(1.5) // "1:30"
95
- * decimalToHours("3.5", true) // "03:30"
96
- */
97
- var decimalToHours = exports.decimalToHours = function decimalToHours(num) {
98
- var withLeadingZeroHours = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
99
- console.warn("Deprecated. Please use formatHours from @activecollab/components.");
100
- if (!num) {
101
- return "";
102
- }
103
- if (typeof num === "string" && !num) {
104
- return withLeadingZeroHours ? "00:00" : "0:00";
105
- }
106
- if (typeof num === "string" && num.indexOf(":") >= 0) {
107
- //eslint-disable-next-line
108
- var _num$split3 = num.split(":"),
109
- _num$split4 = _slicedToArray(_num$split3, 2),
110
- _hours = _num$split4[0],
111
- _minutes = _num$split4[1];
112
- if (_minutes && _minutes.length === 1 && Number(_minutes) < 10) {
113
- _minutes = "".concat(Number(_minutes), "0");
114
- }
115
- if (_hours && _minutes) {
116
- if (withLeadingZeroHours) {
117
- return "".concat(withLeadingZero(_hours), ":").concat(_minutes);
118
- }
119
- return "".concat(_hours, ":").concat(_minutes);
120
- } else if (!_hours && _minutes) {
121
- return withLeadingZeroHours ? "00:".concat(_minutes) : "0:".concat(_minutes);
122
- } else if (!_minutes && _hours) {
123
- return withLeadingZeroHours ? "".concat(withLeadingZero(_hours), ":00") : "".concat(_hours, ":00");
124
- } else {
125
- return withLeadingZeroHours ? "00:00" : "0:00";
126
- }
127
- }
128
- if (typeof num === "string" && num.indexOf(",") >= 0) {
129
- num = num.replace(",", ".");
130
- }
131
- var input = typeof num === "string" ? parseFloat(num) : num;
132
- if (!isDecimal(input)) {
133
- if (withLeadingZeroHours) {
134
- return "".concat(withLeadingZero(input), ":00");
135
- }
136
- return "".concat(input, ":00");
137
- }
138
- var decimal = input.toFixed(2);
139
- var time = decimal.toString().split(".");
140
- var hours = time[0];
141
- if (withLeadingZeroHours) {
142
- hours = withLeadingZero(hours);
143
- }
144
- var minutes = time[1];
145
- var minutes_formatted = Math.round(parseInt(minutes, 10) / 100 * 60);
146
- return "".concat(hours, ":").concat(withLeadingZero(minutes_formatted));
147
- };
148
79
  var withLeadingZero = exports.withLeadingZero = function withLeadingZero(num) {
149
80
  var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
150
81
  var s = "".concat(num);
@@ -1 +1 @@
1
- {"version":3,"file":"timeUtils.js","names":["formatHours","exports","num","withLeadingZeroHours","arguments","length","undefined","indexOf","_num$split","split","_num$split2","_slicedToArray","_hours","_minutes","Number","concat","withLeadingZero","replace","input","parseFloat","isDecimal","decimal","toFixed","time","toString","hours","minutes","minutes_formatted","Math","round","parseInt","decimalToHours","console","warn","_num$split3","_num$split4","size","s","isInteger"],"sources":["../../../src/utils/timeUtils.ts"],"sourcesContent":["/**\n * @function formatHours\n * @description\n * Formats a decimal number representing hours into a formatted string (HH:MM).\n * The input can be a number, string, or undefined. The function handles various formats\n * and can optionally add a leading zero to the hours component.\n *\n * @param {number | string | undefined} num - The input representing the hours, which can be in decimal format, a time string, or undefined.\n * @param {boolean} [withLeadingZeroHours=false] - Whether to add a leading zero to the hours part of the output.\n *\n * @returns {string} - A formatted time string in HH:MM format.\n *\n * @example\n * formatHours(1.5) // \"1:30\"\n * formatHours(\"3.5\", true) // \"03:30\"\n */\nexport const formatHours = (\n num: number | string | undefined,\n withLeadingZeroHours = false\n): string => {\n if (!num) {\n return \"\";\n }\n if (typeof num === \"string\" && !num) {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n if (typeof num === \"string\" && num.indexOf(\":\") >= 0) {\n //eslint-disable-next-line\n let [_hours, _minutes] = num.split(\":\");\n if (_minutes && _minutes.length === 1 && Number(_minutes) < 10) {\n _minutes = `${Number(_minutes)}0`;\n }\n if (_hours && _minutes) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(_hours)}:${_minutes}`;\n }\n return `${_hours}:${_minutes}`;\n } else if (!_hours && _minutes) {\n return withLeadingZeroHours ? `00:${_minutes}` : `0:${_minutes}`;\n } else if (!_minutes && _hours) {\n return withLeadingZeroHours\n ? `${withLeadingZero(_hours)}:00`\n : `${_hours}:00`;\n } else {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n }\n if (typeof num === \"string\" && num.indexOf(\",\") >= 0) {\n num = num.replace(\",\", \".\");\n }\n const input = typeof num === \"string\" ? parseFloat(num) : num;\n\n if (!isDecimal(input)) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(input)}:00`;\n }\n return `${input}:00`;\n }\n\n const decimal = input.toFixed(2);\n const time = decimal.toString().split(\".\");\n let hours: string = time[0];\n if (withLeadingZeroHours) {\n hours = withLeadingZero(hours);\n }\n const minutes: string = time[1];\n const minutes_formatted = Math.round((parseInt(minutes, 10) / 100) * 60);\n\n return `${hours}:${withLeadingZero(minutes_formatted)}`;\n};\n\n/**\n * @function decimalToHours\n * @deprecated\n * @description\n * Converts a decimal number representing hours into a formatted string (HH:MM).\n * The input can be a number, string, or undefined. The function handles various formats\n * and can optionally add a leading zero to the hours component.\n *\n * @param {number | string | undefined} num - The input representing the hours, which can be in decimal format, a time string, or undefined.\n * @param {boolean} [withLeadingZeroHours=false] - Whether to add a leading zero to the hours part of the output.\n *\n * @returns {string} - A formatted time string in HH:MM format.\n *\n * @example\n * decimalToHours(1.5) // \"1:30\"\n * decimalToHours(\"3.5\", true) // \"03:30\"\n */\nexport const decimalToHours = (\n num: number | string | undefined,\n withLeadingZeroHours = false\n): string => {\n console.warn(\n \"Deprecated. Please use formatHours from @activecollab/components.\"\n );\n if (!num) {\n return \"\";\n }\n if (typeof num === \"string\" && !num) {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n if (typeof num === \"string\" && num.indexOf(\":\") >= 0) {\n //eslint-disable-next-line\n let [_hours, _minutes] = num.split(\":\");\n if (_minutes && _minutes.length === 1 && Number(_minutes) < 10) {\n _minutes = `${Number(_minutes)}0`;\n }\n if (_hours && _minutes) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(_hours)}:${_minutes}`;\n }\n return `${_hours}:${_minutes}`;\n } else if (!_hours && _minutes) {\n return withLeadingZeroHours ? `00:${_minutes}` : `0:${_minutes}`;\n } else if (!_minutes && _hours) {\n return withLeadingZeroHours\n ? `${withLeadingZero(_hours)}:00`\n : `${_hours}:00`;\n } else {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n }\n if (typeof num === \"string\" && num.indexOf(\",\") >= 0) {\n num = num.replace(\",\", \".\");\n }\n const input = typeof num === \"string\" ? parseFloat(num) : num;\n\n if (!isDecimal(input)) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(input)}:00`;\n }\n return `${input}:00`;\n }\n\n const decimal = input.toFixed(2);\n const time = decimal.toString().split(\".\");\n let hours: string = time[0];\n if (withLeadingZeroHours) {\n hours = withLeadingZero(hours);\n }\n const minutes: string = time[1];\n const minutes_formatted = Math.round((parseInt(minutes, 10) / 100) * 60);\n\n return `${hours}:${withLeadingZero(minutes_formatted)}`;\n};\n\nexport const withLeadingZero = (num: string | number, size = 2) => {\n let s = `${num}`;\n while (s.length < size) s = `0` + s;\n return s;\n};\n\nexport const isDecimal = (num: number): boolean => {\n return !Number.isInteger(num);\n};\n"],"mappings":";;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,SAAdA,WAAWA,CACtBE,GAAgC,EAErB;EAAA,IADXC,oBAAoB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAE5B,IAAI,CAACF,GAAG,EAAE;IACR,OAAO,EAAE;EACX;EACA,IAAI,OAAOA,GAAG,KAAK,QAAQ,IAAI,CAACA,GAAG,EAAE;IACnC,OAAOC,oBAAoB,aAAa,MAAM;EAChD;EACA,IAAI,OAAOD,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACK,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;IACpD;IACA,IAAAC,UAAA,GAAyBN,GAAG,CAACO,KAAK,CAAC,GAAG,CAAC;MAAAC,WAAA,GAAAC,cAAA,CAAAH,UAAA;MAAlCI,MAAM,GAAAF,WAAA;MAAEG,QAAQ,GAAAH,WAAA;IACrB,IAAIG,QAAQ,IAAIA,QAAQ,CAACR,MAAM,KAAK,CAAC,IAAIS,MAAM,CAACD,QAAQ,CAAC,GAAG,EAAE,EAAE;MAC9DA,QAAQ,MAAAE,MAAA,CAAMD,MAAM,CAACD,QAAQ,CAAC,MAAG;IACnC;IACA,IAAID,MAAM,IAAIC,QAAQ,EAAE;MACtB,IAAIV,oBAAoB,EAAE;QACxB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CAACS,KAAK,CAAC;EAChC;EACA,IAAMC,OAAe,GAAGH,IAAI,CAAC,CAAC,CAAC;EAC/B,IAAMI,iBAAiB,GAAGC,IAAI,CAACC,KAAK,CAAEC,QAAQ,CAACJ,OAAO,EAAE,EAAE,CAAC,GAAG,GAAG,GAAI,EAAE,CAAC;EAExE,UAAAX,MAAA,CAAUU,KAAK,OAAAV,MAAA,CAAIC,eAAe,CAACW,iBAAiB,CAAC;AACvD,CAAC;AAEM,IAAMX,eAAe,GAAAf,OAAA,CAAAe,eAAA,GAAG,SAAlBA,eAAeA,CAAId,GAAoB,EAAe;EAAA,IAAbkC,IAAI,GAAAhC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAC5D,IAAIiC,CAAC,MAAAtB,MAAA,CAAMb,GAAG,CAAE;EAChB,OAAOmC,CAAC,CAAChC,MAAM,GAAG+B,IAAI,EAAEC,CAAC,GAAG,MAAMA,CAAC;EACnC,OAAOA,CAAC;AACV,CAAC;AAEM,IAAMjB,SAAS,GAAAnB,OAAA,CAAAmB,SAAA,GAAG,SAAZA,SAASA,CAAIlB,GAAW,EAAc;EACjD,OAAO,CAACY,MAAM,CAACwB,SAAS,CAACpC,GAAG,CAAC;AAC/B,CAAC"}
1
+ {"version":3,"file":"timeUtils.js","names":["formatHours","exports","num","withLeadingZeroHours","arguments","length","undefined","indexOf","_num$split","split","_num$split2","_slicedToArray","_hours","_minutes","Number","concat","withLeadingZero","replace","input","parseFloat","isDecimal","decimal","toFixed","time","toString","hours","minutes","minutes_formatted","Math","round","parseInt","size","s","isInteger"],"sources":["../../../src/utils/timeUtils.ts"],"sourcesContent":["/**\n * @function formatHours\n * @description\n * Formats a decimal number representing hours into a formatted string (HH:MM).\n * The input can be a number, string, or undefined. The function handles various formats\n * and can optionally add a leading zero to the hours component.\n *\n * @param {number | string | undefined} num - The input representing the hours, which can be in decimal format, a time string, or undefined.\n * @param {boolean} [withLeadingZeroHours=false] - Whether to add a leading zero to the hours part of the output.\n *\n * @returns {string} - A formatted time string in HH:MM format.\n *\n * @example\n * formatHours(1.5) // \"1:30\"\n * formatHours(\"3.5\", true) // \"03:30\"\n */\nexport const formatHours = (\n num: number | string | undefined,\n withLeadingZeroHours = false\n): string => {\n if (!num) {\n return \"\";\n }\n if (typeof num === \"string\" && !num) {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n if (typeof num === \"string\" && num.indexOf(\":\") >= 0) {\n //eslint-disable-next-line\n let [_hours, _minutes] = num.split(\":\");\n if (_minutes && _minutes.length === 1 && Number(_minutes) < 10) {\n _minutes = `${Number(_minutes)}0`;\n }\n if (_hours && _minutes) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(_hours)}:${_minutes}`;\n }\n return `${_hours}:${_minutes}`;\n } else if (!_hours && _minutes) {\n return withLeadingZeroHours ? `00:${_minutes}` : `0:${_minutes}`;\n } else if (!_minutes && _hours) {\n return withLeadingZeroHours\n ? `${withLeadingZero(_hours)}:00`\n : `${_hours}:00`;\n } else {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n }\n if (typeof num === \"string\" && num.indexOf(\",\") >= 0) {\n num = num.replace(\",\", \".\");\n }\n const input = typeof num === \"string\" ? parseFloat(num) : num;\n\n if (!isDecimal(input)) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(input)}:00`;\n }\n return `${input}:00`;\n }\n\n const decimal = input.toFixed(2);\n const time = decimal.toString().split(\".\");\n let hours: string = time[0];\n if (withLeadingZeroHours) {\n hours = withLeadingZero(hours);\n }\n const minutes: string = time[1];\n const minutes_formatted = Math.round((parseInt(minutes, 10) / 100) * 60);\n\n return `${hours}:${withLeadingZero(minutes_formatted)}`;\n};\n\nexport const withLeadingZero = (num: string | number, size = 2) => {\n let s = `${num}`;\n while (s.length < size) s = `0` + s;\n return s;\n};\n\nexport const isDecimal = (num: number): boolean => {\n return !Number.isInteger(num);\n};\n"],"mappings":";;;;;;;;;;;;AAAA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A,GAAG,SAAlBA,eAAeA,CAAId,GAAoB,EAAe;EAAA,IAAb6B,IAAI,GAAA3B,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;EAC5D,IAAI4B,CAAC,MAAAjB,MAAA,CAAMb,GAAG,CAAE;EAChB,OAAO8B,CAAC,CAAC3B,MAAM,GAAG0B,IAAI,EAAEC,CAAC,GAAG,MAAMA,CAAC;EACnC,OAAOA,CAAC;AACV,CAAC;AAEM,IAAMZ,SAAS,GAAAnB,OAAA,CAAAmB,SAAA,GAAG,SAAZA,SAASA,CAAIlB,GAAW,EAAc;EACjD,OAAO,CAACY,MAAM,CAACmB,SAAS,CAAC/B,GAAG,CAAC;AAC/B,CAAC"}
@@ -3,6 +3,6 @@ export * from "./colors";
3
3
  export * from "./validation";
4
4
  export { default as useForkRef } from "./useForkRef";
5
5
  export { default as useResizeObserver } from "./useResizeObserver";
6
- export { decimalToHours, formatHours } from "./timeUtils";
6
+ export { formatHours } from "./timeUtils";
7
7
  export { formatNumber, formatCurrency, numberWithSeparator, getNumberFromString, } from "./currencyUtils";
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EACL,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC"}
@@ -3,6 +3,6 @@ export * from "./colors";
3
3
  export * from "./validation";
4
4
  export { default as useForkRef } from "./useForkRef";
5
5
  export { default as useResizeObserver } from "./useResizeObserver";
6
- export { decimalToHours, formatHours } from "./timeUtils";
6
+ export { formatHours } from "./timeUtils";
7
7
  export { formatNumber, formatCurrency, numberWithSeparator, getNumberFromString } from "./currencyUtils";
8
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["default","useForkRef","useResizeObserver","decimalToHours","formatHours","formatNumber","formatCurrency","numberWithSeparator","getNumberFromString"],"sources":["../../../src/utils/index.ts"],"sourcesContent":["export * from \"./layers\";\nexport * from \"./colors\";\nexport * from \"./validation\";\nexport { default as useForkRef } from \"./useForkRef\";\nexport { default as useResizeObserver } from \"./useResizeObserver\";\nexport { decimalToHours, formatHours } from \"./timeUtils\";\nexport {\n formatNumber,\n formatCurrency,\n numberWithSeparator,\n getNumberFromString,\n} from \"./currencyUtils\";\n"],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,SAASA,OAAO,IAAIC,UAAU,QAAQ,cAAc;AACpD,SAASD,OAAO,IAAIE,iBAAiB,QAAQ,qBAAqB;AAClE,SAASC,cAAc,EAAEC,WAAW,QAAQ,aAAa;AACzD,SACEC,YAAY,EACZC,cAAc,EACdC,mBAAmB,EACnBC,mBAAmB,QACd,iBAAiB"}
1
+ {"version":3,"file":"index.js","names":["default","useForkRef","useResizeObserver","formatHours","formatNumber","formatCurrency","numberWithSeparator","getNumberFromString"],"sources":["../../../src/utils/index.ts"],"sourcesContent":["export * from \"./layers\";\nexport * from \"./colors\";\nexport * from \"./validation\";\nexport { default as useForkRef } from \"./useForkRef\";\nexport { default as useResizeObserver } from \"./useResizeObserver\";\nexport { formatHours } from \"./timeUtils\";\nexport {\n formatNumber,\n formatCurrency,\n numberWithSeparator,\n getNumberFromString,\n} from \"./currencyUtils\";\n"],"mappings":"AAAA,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,SAASA,OAAO,IAAIC,UAAU,QAAQ,cAAc;AACpD,SAASD,OAAO,IAAIE,iBAAiB,QAAQ,qBAAqB;AAClE,SAASC,WAAW,QAAQ,aAAa;AACzC,SACEC,YAAY,EACZC,cAAc,EACdC,mBAAmB,EACnBC,mBAAmB,QACd,iBAAiB"}
@@ -15,24 +15,6 @@
15
15
  * formatHours("3.5", true) // "03:30"
16
16
  */
17
17
  export declare const formatHours: (num: number | string | undefined, withLeadingZeroHours?: boolean) => string;
18
- /**
19
- * @function decimalToHours
20
- * @deprecated
21
- * @description
22
- * Converts a decimal number representing hours into a formatted string (HH:MM).
23
- * The input can be a number, string, or undefined. The function handles various formats
24
- * and can optionally add a leading zero to the hours component.
25
- *
26
- * @param {number | string | undefined} num - The input representing the hours, which can be in decimal format, a time string, or undefined.
27
- * @param {boolean} [withLeadingZeroHours=false] - Whether to add a leading zero to the hours part of the output.
28
- *
29
- * @returns {string} - A formatted time string in HH:MM format.
30
- *
31
- * @example
32
- * decimalToHours(1.5) // "1:30"
33
- * decimalToHours("3.5", true) // "03:30"
34
- */
35
- export declare const decimalToHours: (num: number | string | undefined, withLeadingZeroHours?: boolean) => string;
36
18
  export declare const withLeadingZero: (num: string | number, size?: number) => string;
37
19
  export declare const isDecimal: (num: number) => boolean;
38
20
  //# sourceMappingURL=timeUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"timeUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/timeUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW,QACjB,MAAM,GAAG,MAAM,GAAG,SAAS,qCAE/B,MAkDF,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,cAAc,QACpB,MAAM,GAAG,MAAM,GAAG,SAAS,qCAE/B,MAqDF,CAAC;AAEF,eAAO,MAAM,eAAe,QAAS,MAAM,GAAG,MAAM,0BAInD,CAAC;AAEF,eAAO,MAAM,SAAS,QAAS,MAAM,KAAG,OAEvC,CAAC"}
1
+ {"version":3,"file":"timeUtils.d.ts","sourceRoot":"","sources":["../../../src/utils/timeUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW,QACjB,MAAM,GAAG,MAAM,GAAG,SAAS,qCAE/B,MAkDF,CAAC;AAEF,eAAO,MAAM,eAAe,QAAS,MAAM,GAAG,MAAM,0BAInD,CAAC;AAEF,eAAO,MAAM,SAAS,QAAS,MAAM,KAAG,OAEvC,CAAC"}
@@ -63,74 +63,6 @@ export const formatHours = function (num, withLeadingZeroHours) {
63
63
  const minutes_formatted = Math.round(parseInt(minutes, 10) / 100 * 60);
64
64
  return hours + ":" + withLeadingZero(minutes_formatted);
65
65
  };
66
-
67
- /**
68
- * @function decimalToHours
69
- * @deprecated
70
- * @description
71
- * Converts a decimal number representing hours into a formatted string (HH:MM).
72
- * The input can be a number, string, or undefined. The function handles various formats
73
- * and can optionally add a leading zero to the hours component.
74
- *
75
- * @param {number | string | undefined} num - The input representing the hours, which can be in decimal format, a time string, or undefined.
76
- * @param {boolean} [withLeadingZeroHours=false] - Whether to add a leading zero to the hours part of the output.
77
- *
78
- * @returns {string} - A formatted time string in HH:MM format.
79
- *
80
- * @example
81
- * decimalToHours(1.5) // "1:30"
82
- * decimalToHours("3.5", true) // "03:30"
83
- */
84
- export const decimalToHours = function (num, withLeadingZeroHours) {
85
- if (withLeadingZeroHours === void 0) {
86
- withLeadingZeroHours = false;
87
- }
88
- console.warn("Deprecated. Please use formatHours from @activecollab/components.");
89
- if (!num) {
90
- return "";
91
- }
92
- if (typeof num === "string" && !num) {
93
- return withLeadingZeroHours ? "00:00" : "0:00";
94
- }
95
- if (typeof num === "string" && num.indexOf(":") >= 0) {
96
- //eslint-disable-next-line
97
- let [_hours, _minutes] = num.split(":");
98
- if (_minutes && _minutes.length === 1 && Number(_minutes) < 10) {
99
- _minutes = Number(_minutes) + "0";
100
- }
101
- if (_hours && _minutes) {
102
- if (withLeadingZeroHours) {
103
- return withLeadingZero(_hours) + ":" + _minutes;
104
- }
105
- return _hours + ":" + _minutes;
106
- } else if (!_hours && _minutes) {
107
- return withLeadingZeroHours ? "00:" + _minutes : "0:" + _minutes;
108
- } else if (!_minutes && _hours) {
109
- return withLeadingZeroHours ? withLeadingZero(_hours) + ":00" : _hours + ":00";
110
- } else {
111
- return withLeadingZeroHours ? "00:00" : "0:00";
112
- }
113
- }
114
- if (typeof num === "string" && num.indexOf(",") >= 0) {
115
- num = num.replace(",", ".");
116
- }
117
- const input = typeof num === "string" ? parseFloat(num) : num;
118
- if (!isDecimal(input)) {
119
- if (withLeadingZeroHours) {
120
- return withLeadingZero(input) + ":00";
121
- }
122
- return input + ":00";
123
- }
124
- const decimal = input.toFixed(2);
125
- const time = decimal.toString().split(".");
126
- let hours = time[0];
127
- if (withLeadingZeroHours) {
128
- hours = withLeadingZero(hours);
129
- }
130
- const minutes = time[1];
131
- const minutes_formatted = Math.round(parseInt(minutes, 10) / 100 * 60);
132
- return hours + ":" + withLeadingZero(minutes_formatted);
133
- };
134
66
  export const withLeadingZero = function (num, size) {
135
67
  if (size === void 0) {
136
68
  size = 2;
@@ -1 +1 @@
1
- {"version":3,"file":"timeUtils.js","names":["formatHours","num","withLeadingZeroHours","indexOf","_hours","_minutes","split","length","Number","withLeadingZero","replace","input","parseFloat","isDecimal","decimal","toFixed","time","toString","hours","minutes","minutes_formatted","Math","round","parseInt","decimalToHours","console","warn","size","s","isInteger"],"sources":["../../../src/utils/timeUtils.ts"],"sourcesContent":["/**\n * @function formatHours\n * @description\n * Formats a decimal number representing hours into a formatted string (HH:MM).\n * The input can be a number, string, or undefined. The function handles various formats\n * and can optionally add a leading zero to the hours component.\n *\n * @param {number | string | undefined} num - The input representing the hours, which can be in decimal format, a time string, or undefined.\n * @param {boolean} [withLeadingZeroHours=false] - Whether to add a leading zero to the hours part of the output.\n *\n * @returns {string} - A formatted time string in HH:MM format.\n *\n * @example\n * formatHours(1.5) // \"1:30\"\n * formatHours(\"3.5\", true) // \"03:30\"\n */\nexport const formatHours = (\n num: number | string | undefined,\n withLeadingZeroHours = false\n): string => {\n if (!num) {\n return \"\";\n }\n if (typeof num === \"string\" && !num) {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n if (typeof num === \"string\" && num.indexOf(\":\") >= 0) {\n //eslint-disable-next-line\n let [_hours, _minutes] = num.split(\":\");\n if (_minutes && _minutes.length === 1 && Number(_minutes) < 10) {\n _minutes = `${Number(_minutes)}0`;\n }\n if (_hours && _minutes) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(_hours)}:${_minutes}`;\n }\n return `${_hours}:${_minutes}`;\n } else if (!_hours && _minutes) {\n return withLeadingZeroHours ? `00:${_minutes}` : `0:${_minutes}`;\n } else if (!_minutes && _hours) {\n return withLeadingZeroHours\n ? `${withLeadingZero(_hours)}:00`\n : `${_hours}:00`;\n } else {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n }\n if (typeof num === \"string\" && num.indexOf(\",\") >= 0) {\n num = num.replace(\",\", \".\");\n }\n const input = typeof num === \"string\" ? parseFloat(num) : num;\n\n if (!isDecimal(input)) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(input)}:00`;\n }\n return `${input}:00`;\n }\n\n const decimal = input.toFixed(2);\n const time = decimal.toString().split(\".\");\n let hours: string = time[0];\n if (withLeadingZeroHours) {\n hours = withLeadingZero(hours);\n }\n const minutes: string = time[1];\n const minutes_formatted = Math.round((parseInt(minutes, 10) / 100) * 60);\n\n return `${hours}:${withLeadingZero(minutes_formatted)}`;\n};\n\n/**\n * @function decimalToHours\n * @deprecated\n * @description\n * Converts a decimal number representing hours into a formatted string (HH:MM).\n * The input can be a number, string, or undefined. The function handles various formats\n * and can optionally add a leading zero to the hours component.\n *\n * @param {number | string | undefined} num - The input representing the hours, which can be in decimal format, a time string, or undefined.\n * @param {boolean} [withLeadingZeroHours=false] - Whether to add a leading zero to the hours part of the output.\n *\n * @returns {string} - A formatted time string in HH:MM format.\n *\n * @example\n * decimalToHours(1.5) // \"1:30\"\n * decimalToHours(\"3.5\", true) // \"03:30\"\n */\nexport const decimalToHours = (\n num: number | string | undefined,\n withLeadingZeroHours = false\n): string => {\n console.warn(\n \"Deprecated. Please use formatHours from @activecollab/components.\"\n );\n if (!num) {\n return \"\";\n }\n if (typeof num === \"string\" && !num) {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n if (typeof num === \"string\" && num.indexOf(\":\") >= 0) {\n //eslint-disable-next-line\n let [_hours, _minutes] = num.split(\":\");\n if (_minutes && _minutes.length === 1 && Number(_minutes) < 10) {\n _minutes = `${Number(_minutes)}0`;\n }\n if (_hours && _minutes) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(_hours)}:${_minutes}`;\n }\n return `${_hours}:${_minutes}`;\n } else if (!_hours && _minutes) {\n return withLeadingZeroHours ? `00:${_minutes}` : `0:${_minutes}`;\n } else if (!_minutes && _hours) {\n return withLeadingZeroHours\n ? `${withLeadingZero(_hours)}:00`\n : `${_hours}:00`;\n } else {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n }\n if (typeof num === \"string\" && num.indexOf(\",\") >= 0) {\n num = num.replace(\",\", \".\");\n }\n const input = typeof num === \"string\" ? parseFloat(num) : num;\n\n if (!isDecimal(input)) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(input)}:00`;\n }\n return `${input}:00`;\n }\n\n const decimal = input.toFixed(2);\n const time = decimal.toString().split(\".\");\n let hours: string = time[0];\n if (withLeadingZeroHours) {\n hours = withLeadingZero(hours);\n }\n const minutes: string = time[1];\n const minutes_formatted = Math.round((parseInt(minutes, 10) / 100) * 60);\n\n return `${hours}:${withLeadingZero(minutes_formatted)}`;\n};\n\nexport const withLeadingZero = (num: string | number, size = 2) => {\n let s = `${num}`;\n while (s.length < size) s = `0` + s;\n return s;\n};\n\nexport const isDecimal = (num: number): boolean => {\n return !Number.isInteger(num);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,GAAG,SAAAA,CACzBC,GAAgC,EAChCC,oBAAoB,EACT;EAAA,IADXA,oBAAoB;IAApBA,oBAAoB,GAAG,KAAK;EAAA;EAE5B,IAAI,CAACD,GAAG,EAAE;IACR,OAAO,EAAE;EACX;EACA,IAAI,OAAOA,GAAG,KAAK,QAAQ,IAAI,CAACA,GAAG,EAAE;IACnC,OAAOC,oBAAoB,aAAa,MAAM;EAChD;EACA,IAAI,OAAOD,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;IACpD;IACA,IAAI,CAACC,MAAM,EAAEC,QAAQ,CAAC,GAAGJ,GAAG,CAACK,KAAK,CAAC,GAAG,CAAC;IACvC,IAAID,QAAQ,IAAIA,QAAQ,CAACE,MAAM,KAAK,CAAC,IAAIC,MAAM,CAACH,QAAQ,CAAC,GAAG,EAAE,EAAE;MAC9DA,QAAQ,GAAMG,MAAM,CAACH,QAAQ,CAAC,MAAG;IACnC;IACA,IAAID,MAAM,IAAIC,QAAQ,EAAE;MACtB,IAAIH,oBAAoB,EAAE;QACxB,OAAUO,eAAe,CAACL,MAAM,CAAC,SAAIC,Q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AAC;AAED,OAAO,MAAMf,SAAS,GAAIZ,GAAW,IAAc;EACjD,OAAO,CAACO,MAAM,CAACqB,SAAS,CAAC5B,GAAG,CAAC;AAC/B,CAAC"}
1
+ {"version":3,"file":"timeUtils.js","names":["formatHours","num","withLeadingZeroHours","indexOf","_hours","_minutes","split","length","Number","withLeadingZero","replace","input","parseFloat","isDecimal","decimal","toFixed","time","toString","hours","minutes","minutes_formatted","Math","round","parseInt","size","s","isInteger"],"sources":["../../../src/utils/timeUtils.ts"],"sourcesContent":["/**\n * @function formatHours\n * @description\n * Formats a decimal number representing hours into a formatted string (HH:MM).\n * The input can be a number, string, or undefined. The function handles various formats\n * and can optionally add a leading zero to the hours component.\n *\n * @param {number | string | undefined} num - The input representing the hours, which can be in decimal format, a time string, or undefined.\n * @param {boolean} [withLeadingZeroHours=false] - Whether to add a leading zero to the hours part of the output.\n *\n * @returns {string} - A formatted time string in HH:MM format.\n *\n * @example\n * formatHours(1.5) // \"1:30\"\n * formatHours(\"3.5\", true) // \"03:30\"\n */\nexport const formatHours = (\n num: number | string | undefined,\n withLeadingZeroHours = false\n): string => {\n if (!num) {\n return \"\";\n }\n if (typeof num === \"string\" && !num) {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n if (typeof num === \"string\" && num.indexOf(\":\") >= 0) {\n //eslint-disable-next-line\n let [_hours, _minutes] = num.split(\":\");\n if (_minutes && _minutes.length === 1 && Number(_minutes) < 10) {\n _minutes = `${Number(_minutes)}0`;\n }\n if (_hours && _minutes) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(_hours)}:${_minutes}`;\n }\n return `${_hours}:${_minutes}`;\n } else if (!_hours && _minutes) {\n return withLeadingZeroHours ? `00:${_minutes}` : `0:${_minutes}`;\n } else if (!_minutes && _hours) {\n return withLeadingZeroHours\n ? `${withLeadingZero(_hours)}:00`\n : `${_hours}:00`;\n } else {\n return withLeadingZeroHours ? `00:00` : \"0:00\";\n }\n }\n if (typeof num === \"string\" && num.indexOf(\",\") >= 0) {\n num = num.replace(\",\", \".\");\n }\n const input = typeof num === \"string\" ? parseFloat(num) : num;\n\n if (!isDecimal(input)) {\n if (withLeadingZeroHours) {\n return `${withLeadingZero(input)}:00`;\n }\n return `${input}:00`;\n }\n\n const decimal = input.toFixed(2);\n const time = decimal.toString().split(\".\");\n let hours: string = time[0];\n if (withLeadingZeroHours) {\n hours = withLeadingZero(hours);\n }\n const minutes: string = time[1];\n const minutes_formatted = Math.round((parseInt(minutes, 10) / 100) * 60);\n\n return `${hours}:${withLeadingZero(minutes_formatted)}`;\n};\n\nexport const withLeadingZero = (num: string | number, size = 2) => {\n let s = `${num}`;\n while (s.length < size) s = `0` + s;\n return s;\n};\n\nexport const isDecimal = (num: number): boolean => {\n return !Number.isInteger(num);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,GAAG,SAAAA,CACzBC,GAAgC,EAChCC,oBAAoB,EACT;EAAA,IADXA,oBAAoB;IAApBA,oBAAoB,GAAG,KAAK;EAAA;EAE5B,IAAI,CAACD,GAAG,EAAE;IACR,OAAO,EAAE;EACX;EACA,IAAI,OAAOA,GAAG,KAAK,QAAQ,IAAI,CAACA,GAAG,EAAE;IACnC,OAAOC,oBAAoB,aAAa,MAAM;EAChD;EACA,IAAI,OAAOD,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;IACpD;IACA,IAAI,CAACC,MAAM,EAAEC,QAAQ,CAAC,GAAGJ,GAAG,CAACK,KAAK,CAAC,GAAG,CAAC;IACvC,IAAID,QAAQ,IAAIA,QAAQ,CAACE,MAAM,KAAK,CAAC,IAAIC,MAAM,CAACH,QAAQ,CAAC,GAAG,EAAE,EAAE;MAC9DA,QAAQ,GAAMG,MAAM,CAACH,QAAQ,CAAC,MAAG;IACnC;IACA,IAAID,MAAM,I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EC,QAAQ,CAACJ,OAAO,EAAE,EAAE,CAAC,GAAG,GAAG,GAAI,EAAE,CAAC;EAExE,OAAUD,KAAK,SAAIT,eAAe,CAACW,iBAAiB,CAAC;AACvD,CAAC;AAED,OAAO,MAAMX,eAAe,GAAG,SAAAA,CAACR,GAAoB,EAAEuB,IAAI,EAAS;EAAA,IAAbA,IAAI;IAAJA,IAAI,GAAG,CAAC;EAAA;EAC5D,IAAIC,CAAC,QAAMxB,GAAK;EAChB,OAAOwB,CAAC,CAAClB,MAAM,GAAGiB,IAAI,EAAEC,CAAC,GAAG,MAAMA,CAAC;EACnC,OAAOA,CAAC;AACV,CAAC;AAED,OAAO,MAAMZ,SAAS,GAAIZ,GAAW,IAAc;EACjD,OAAO,CAACO,MAAM,CAACkB,SAAS,CAACzB,GAAG,CAAC;AAC/B,CAAC"}
package/dist/index.js CHANGED
@@ -833,75 +833,6 @@
833
833
  var minutes_formatted = Math.round(parseInt(minutes, 10) / 100 * 60);
834
834
  return "".concat(hours, ":").concat(withLeadingZero(minutes_formatted));
835
835
  };
836
-
837
- /**
838
- * @function decimalToHours
839
- * @deprecated
840
- * @description
841
- * Converts a decimal number representing hours into a formatted string (HH:MM).
842
- * The input can be a number, string, or undefined. The function handles various formats
843
- * and can optionally add a leading zero to the hours component.
844
- *
845
- * @param {number | string | undefined} num - The input representing the hours, which can be in decimal format, a time string, or undefined.
846
- * @param {boolean} [withLeadingZeroHours=false] - Whether to add a leading zero to the hours part of the output.
847
- *
848
- * @returns {string} - A formatted time string in HH:MM format.
849
- *
850
- * @example
851
- * decimalToHours(1.5) // "1:30"
852
- * decimalToHours("3.5", true) // "03:30"
853
- */
854
- var decimalToHours = function decimalToHours(num) {
855
- var withLeadingZeroHours = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
856
- console.warn("Deprecated. Please use formatHours from @activecollab/components.");
857
- if (!num) {
858
- return "";
859
- }
860
- if (typeof num === "string" && !num) {
861
- return withLeadingZeroHours ? "00:00" : "0:00";
862
- }
863
- if (typeof num === "string" && num.indexOf(":") >= 0) {
864
- //eslint-disable-next-line
865
- var _num$split3 = num.split(":"),
866
- _num$split4 = _slicedToArray(_num$split3, 2),
867
- _hours = _num$split4[0],
868
- _minutes = _num$split4[1];
869
- if (_minutes && _minutes.length === 1 && Number(_minutes) < 10) {
870
- _minutes = "".concat(Number(_minutes), "0");
871
- }
872
- if (_hours && _minutes) {
873
- if (withLeadingZeroHours) {
874
- return "".concat(withLeadingZero(_hours), ":").concat(_minutes);
875
- }
876
- return "".concat(_hours, ":").concat(_minutes);
877
- } else if (!_hours && _minutes) {
878
- return withLeadingZeroHours ? "00:".concat(_minutes) : "0:".concat(_minutes);
879
- } else if (!_minutes && _hours) {
880
- return withLeadingZeroHours ? "".concat(withLeadingZero(_hours), ":00") : "".concat(_hours, ":00");
881
- } else {
882
- return withLeadingZeroHours ? "00:00" : "0:00";
883
- }
884
- }
885
- if (typeof num === "string" && num.indexOf(",") >= 0) {
886
- num = num.replace(",", ".");
887
- }
888
- var input = typeof num === "string" ? parseFloat(num) : num;
889
- if (!isDecimal(input)) {
890
- if (withLeadingZeroHours) {
891
- return "".concat(withLeadingZero(input), ":00");
892
- }
893
- return "".concat(input, ":00");
894
- }
895
- var decimal = input.toFixed(2);
896
- var time = decimal.toString().split(".");
897
- var hours = time[0];
898
- if (withLeadingZeroHours) {
899
- hours = withLeadingZero(hours);
900
- }
901
- var minutes = time[1];
902
- var minutes_formatted = Math.round(parseInt(minutes, 10) / 100 * 60);
903
- return "".concat(hours, ":").concat(withLeadingZero(minutes_formatted));
904
- };
905
836
  var withLeadingZero = function withLeadingZero(num) {
906
837
  var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
907
838
  var s = "".concat(num);
@@ -20066,7 +19997,6 @@
20066
19997
  exports._Dialog = _Dialog;
20067
19998
  exports._List = _List;
20068
19999
  exports.colors = colors$1;
20069
- exports.decimalToHours = decimalToHours;
20070
20000
  exports.formatCurrency = formatCurrency;
20071
20001
  exports.formatHours = formatHours;
20072
20002
  exports.formatNumber = formatNumber;