@mahatisystems/mahati-ui-components 5.2.1 → 5.2.2

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.
package/dist/index.mjs CHANGED
@@ -324,100 +324,81 @@ var require_decrease = __commonJS({
324
324
  module.exports = "./decrease-SMWSBU7A.png";
325
325
  }
326
326
  });
327
- // src/assets/icons/check-mark_1.png
328
- var require_check_mark_1 = __commonJS({
329
- "src/assets/icons/check-mark_1.png": function(exports, module) {
330
- module.exports = "./check-mark_1-6GNY6HFY.png";
331
- }
332
- });
333
- // src/assets/icons/danger_1.png
334
- var require_danger_1 = __commonJS({
335
- "src/assets/icons/danger_1.png": function(exports, module) {
336
- module.exports = "./danger_1-LUIFNS2J.png";
337
- }
338
- });
339
- // src/assets/icons/notification_1.png
340
- var require_notification_1 = __commonJS({
341
- "src/assets/icons/notification_1.png": function(exports, module) {
342
- module.exports = "./notification_1-K2I7DVDH.png";
343
- }
344
- });
345
- // src/assets/icons/close.png
346
- var require_close = __commonJS({
347
- "src/assets/icons/close.png": function(exports, module) {
348
- module.exports = "./close-EEDOIEDC.png";
349
- }
350
- });
351
- // src/assets/icons/check-mark_2.png
352
- var require_check_mark_2 = __commonJS({
353
- "src/assets/icons/check-mark_2.png": function(exports, module) {
354
- module.exports = "./check-mark_2-YWM2KQA2.png";
355
- }
356
- });
357
- // src/assets/icons/danger_2.png
358
- var require_danger_2 = __commonJS({
359
- "src/assets/icons/danger_2.png": function(exports, module) {
360
- module.exports = "./danger_2-YTNTGWQA.png";
361
- }
362
- });
363
- // src/assets/icons/danger_1_1.png
364
- var require_danger_1_1 = __commonJS({
365
- "src/assets/icons/danger_1_1.png": function(exports, module) {
366
- module.exports = "./danger_1_1-PHLDGYEA.png";
367
- }
368
- });
369
- // src/assets/icons/notification_2.png
370
- var require_notification_2 = __commonJS({
371
- "src/assets/icons/notification_2.png": function(exports, module) {
372
- module.exports = "./notification_2-KFI6MN7T.png";
373
- }
374
- });
375
- // src/assets/icons/close_copy_1.png
376
- var require_close_copy_1 = __commonJS({
377
- "src/assets/icons/close_copy_1.png": function(exports, module) {
378
- module.exports = "./close_copy_1-PFFNUORV.png";
379
- }
380
- });
381
327
  // src/components/accordion.tsx
382
328
  import { useState } from "react";
383
329
  import { ChevronDown, ChevronUp } from "lucide-react";
384
330
  import { jsx, jsxs } from "react/jsx-runtime";
385
331
  function Accordion(param) {
386
- var title = param.title, children = param.children, _param_defaultOpen = param.defaultOpen, defaultOpen = _param_defaultOpen === void 0 ? false : _param_defaultOpen, accordionTestId = param.accordionTestId, headerTestId = param.headerTestId, contentTestId = param.contentTestId;
387
- var _useState = _sliced_to_array(useState(defaultOpen), 2), open = _useState[0], setOpen = _useState[1];
388
- return /* @__PURE__ */ jsxs("div", {
332
+ var title = param.title, children = param.children, _param_items = param.items, items = _param_items === void 0 ? [] : _param_items, _param_defaultOpenIndex = param.defaultOpenIndex, defaultOpenIndex = _param_defaultOpenIndex === void 0 ? null : _param_defaultOpenIndex, defaultOpen = param.defaultOpen, _param_className = param.className, className = _param_className === void 0 ? "" : _param_className, _param_headerClassName = param.headerClassName, headerClassName = _param_headerClassName === void 0 ? "" : _param_headerClassName, _param_contentClassName = param.contentClassName, contentClassName = _param_contentClassName === void 0 ? "" : _param_contentClassName, icon = param.icon, _param_iconPosition = param.iconPosition, iconPosition = _param_iconPosition === void 0 ? "right" : _param_iconPosition, _param_multipleOpen = param.multipleOpen, multipleOpen = _param_multipleOpen === void 0 ? false : _param_multipleOpen, onToggle = param.onToggle, accordionTestId = param.accordionTestId, headerTestId = param.headerTestId, contentTestId = param.contentTestId;
333
+ var _useState = _sliced_to_array(useState(defaultOpen ? [
334
+ 0
335
+ ] : defaultOpenIndex !== null && defaultOpenIndex !== void 0 ? [
336
+ defaultOpenIndex
337
+ ] : []), 2), openIndexes = _useState[0], setOpenIndexes = _useState[1];
338
+ var normalizedItems = items && items.length > 0 ? items : title !== void 0 ? [
339
+ {
340
+ title: title,
341
+ content: children
342
+ }
343
+ ] : [];
344
+ var handleToggle = function handleToggle(index) {
345
+ var newIndexes;
346
+ if (multipleOpen) {
347
+ if (openIndexes.includes(index)) {
348
+ newIndexes = openIndexes.filter(function(i) {
349
+ return i !== index;
350
+ });
351
+ } else {
352
+ newIndexes = _to_consumable_array(openIndexes).concat([
353
+ index
354
+ ]);
355
+ }
356
+ } else {
357
+ newIndexes = openIndexes.includes(index) ? [] : [
358
+ index
359
+ ];
360
+ }
361
+ setOpenIndexes(newIndexes);
362
+ };
363
+ return /* @__PURE__ */ jsx("div", {
389
364
  "data-testid": accordionTestId,
390
- className: "\r\n w-full\r\n max-w-full\r\n border border-slate-200\r\n overflow-hidden\r\n bg-white\r\n rounded-xl\r\n sm:max-w-[684px]\r\n ",
391
- children: [
392
- /* @__PURE__ */ jsxs("button", {
393
- "data-testid": headerTestId,
394
- onClick: function onClick() {
395
- return setOpen(!open);
396
- },
397
- className: "\n w-full\n flex items-center justify-between\n font-medium\n border-none\n cursor-pointer\n min-h-[52px]\n px-4\n transition\n hover:opacity-95\n focus:outline-none\n sm:min-h-[60px]\n sm:px-6\n ".concat(open ? "text-white bg-gradient-to-r from-[#1761A3] to-[#4DAF83]" : "text-slate-800 bg-white", "\n "),
365
+ className: "w-full max-w-[684px] border border-slate-200 rounded-xl overflow-hidden bg-white ".concat(className),
366
+ children: normalizedItems.map(function(item, index) {
367
+ var isOpen = openIndexes.includes(index);
368
+ return /* @__PURE__ */ jsxs("div", {
398
369
  children: [
399
- /* @__PURE__ */ jsx("span", {
400
- children: title
370
+ /* @__PURE__ */ jsxs("button", {
371
+ "data-testid": headerTestId,
372
+ disabled: item.disabled,
373
+ onClick: function onClick() {
374
+ return handleToggle(index);
375
+ },
376
+ className: "\n w-full flex items-center justify-between\n px-6 min-h-[60px]\n font-medium transition\n ".concat(item.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer", "\n ").concat(isOpen ? "text-white bg-gradient-to-r from-[#1761A3] to-[#4DAF83]" : "text-slate-800 bg-white", "\n ").concat(headerClassName, "\n "),
377
+ children: [
378
+ iconPosition === "left" && /* @__PURE__ */ jsx("span", {
379
+ className: "mr-2",
380
+ children: icon || (isOpen ? /* @__PURE__ */ jsx(ChevronUp, {}) : /* @__PURE__ */ jsx(ChevronDown, {}))
381
+ }),
382
+ /* @__PURE__ */ jsx("span", {
383
+ className: "flex-1 text-left",
384
+ children: item.title
385
+ }),
386
+ iconPosition === "right" && /* @__PURE__ */ jsx("span", {
387
+ children: icon || (isOpen ? /* @__PURE__ */ jsx(ChevronUp, {}) : /* @__PURE__ */ jsx(ChevronDown, {}))
388
+ })
389
+ ]
401
390
  }),
402
- /* @__PURE__ */ jsx("span", {
403
- className: "inline-flex items-center justify-center",
404
- children: open ? /* @__PURE__ */ jsx(ChevronUp, {
405
- className: "w-5 h-5"
406
- }) : /* @__PURE__ */ jsx(ChevronDown, {
407
- className: "w-5 h-5"
408
- })
391
+ isOpen && !item.disabled && /* @__PURE__ */ jsx("div", {
392
+ "data-testid": contentTestId,
393
+ className: "px-6 py-4 text-slate-600 border-t border-slate-200 ".concat(contentClassName),
394
+ children: item.content
395
+ }),
396
+ index !== normalizedItems.length - 1 && /* @__PURE__ */ jsx("div", {
397
+ className: "border-t border-slate-200"
409
398
  })
410
399
  ]
411
- }),
412
- open && /* @__PURE__ */ jsx("div", {
413
- "data-testid": contentTestId,
414
- className: "\r\n w-full\r\n overflow-hidden\r\n px-6 py-4\r\n text-slate-600\r\n border-t border-slate-200\r\n ",
415
- children: /* @__PURE__ */ jsx("div", {
416
- className: "w-full box-border",
417
- children: children
418
- })
419
- })
420
- ]
400
+ }, index);
401
+ })
421
402
  });
422
403
  }
423
404
  Accordion.displayName = "Accordion";
@@ -1375,11 +1356,7 @@ var Calendar = function Calendar(param) {
1375
1356
  onChange === null || onChange === void 0 ? void 0 : onChange(null, "");
1376
1357
  }
1377
1358
  if (enableTimeSelection) {
1378
- onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange({
1379
- hour: 12,
1380
- minute: 0,
1381
- period: "AM"
1382
- });
1359
+ onTimeChange === null || onTimeChange === void 0 ? void 0 : onTimeChange(null);
1383
1360
  setSelectedHour(12);
1384
1361
  setSelectedMinute(0);
1385
1362
  setSelectedPeriod("AM");
@@ -1977,10 +1954,11 @@ var Calendar = function Calendar(param) {
1977
1954
  children: enableRangeSelection ? "Select Date Range" : "Select Date & Time"
1978
1955
  }),
1979
1956
  /* @__PURE__ */ jsx7("div", {
1980
- className: "flex",
1957
+ className: "flex items-center ".concat(!enableTimeSelection ? "justify-center" : "justify-center"),
1981
1958
  style: {
1982
- gap: scale * 12,
1983
- marginBottom: scale * 24
1959
+ gap: enableTimeSelection ? scale * 20 : 0,
1960
+ marginBottom: scale * 24,
1961
+ width: "100%"
1984
1962
  },
1985
1963
  children: enableRangeSelection ? /* @__PURE__ */ jsxs5(Fragment2, {
1986
1964
  children: [
@@ -2002,7 +1980,8 @@ var Calendar = function Calendar(param) {
2002
1980
  /* @__PURE__ */ jsx7("span", {
2003
1981
  className: "text-gray-500",
2004
1982
  style: {
2005
- fontSize: scale * 12
1983
+ fontSize: scale * 12,
1984
+ gap: scale * 24
2006
1985
  },
2007
1986
  children: "From Date"
2008
1987
  }),
@@ -2019,7 +1998,7 @@ var Calendar = function Calendar(param) {
2019
1998
  /* @__PURE__ */ jsxs5("button", {
2020
1999
  type: "button",
2021
2000
  onClick: handleEndFieldClick,
2022
- className: "flex items-center rounded-md shadow-sm",
2001
+ className: "flex items-center rounded-md shadow-sm",
2023
2002
  style: {
2024
2003
  height: scale * 40,
2025
2004
  padding: "0 ".concat(scale * 16, "px"),
@@ -2030,6 +2009,9 @@ var Calendar = function Calendar(param) {
2030
2009
  defaultIcon,
2031
2010
  /* @__PURE__ */ jsxs5("div", {
2032
2011
  className: "flex flex-col items-start",
2012
+ style: {
2013
+ gap: scale * 4
2014
+ },
2033
2015
  children: [
2034
2016
  /* @__PURE__ */ jsx7("span", {
2035
2017
  style: {
@@ -2053,10 +2035,11 @@ var Calendar = function Calendar(param) {
2053
2035
  /* @__PURE__ */ jsxs5("button", {
2054
2036
  type: "button",
2055
2037
  onClick: handleChooseDateClick,
2056
- className: "flex items-center rounded-md shadow-sm",
2038
+ className: "flex items-center justify-center rounded-md shadow-sm",
2057
2039
  style: {
2058
2040
  height: scale * 40,
2059
2041
  padding: "0 ".concat(scale * 16, "px"),
2042
+ minWidth: enableTimeSelection ? scale * 140 : scale * 220,
2060
2043
  background: !showTimeSelector && enableTimeSelection ? "linear-gradient(to bottom,#1761A3,#4DAF83)" : "white",
2061
2044
  color: !showTimeSelector && enableTimeSelection ? "white" : "#111827"
2062
2045
  },
@@ -2077,6 +2060,7 @@ var Calendar = function Calendar(param) {
2077
2060
  style: {
2078
2061
  height: scale * 40,
2079
2062
  padding: "0 ".concat(scale * 16, "px"),
2063
+ marginLeft: scale * 16,
2080
2064
  background: showTimeSelector ? "linear-gradient(to bottom,#1761A3,#4DAF83)" : "white",
2081
2065
  color: showTimeSelector ? "white" : "#111827"
2082
2066
  },
@@ -2103,7 +2087,7 @@ var Calendar = function Calendar(param) {
2103
2087
  marginBottom: scale * 22
2104
2088
  },
2105
2089
  children: /* @__PURE__ */ jsxs5("div", {
2106
- className: "flex items-center justify-between",
2090
+ className: "relative flex items-center justify-between",
2107
2091
  children: [
2108
2092
  /* @__PURE__ */ jsx7("button", {
2109
2093
  "aria-label": "Previous month",
@@ -2120,16 +2104,44 @@ var Calendar = function Calendar(param) {
2120
2104
  }
2121
2105
  })
2122
2106
  }),
2123
- /* @__PURE__ */ jsxs5("button", {
2124
- onClick: handleMonthYearClick,
2125
- className: "font-bold text-[#1761A3]",
2126
- style: {
2127
- fontSize: scale * 18
2128
- },
2107
+ /* @__PURE__ */ jsxs5("div", {
2108
+ className: "relative",
2129
2109
  children: [
2130
- monthName,
2131
- " ",
2132
- currentYear
2110
+ /* @__PURE__ */ jsxs5("button", {
2111
+ onClick: handleMonthYearClick,
2112
+ className: "font-bold text-[#1761A3]",
2113
+ style: {
2114
+ fontSize: scale * 18
2115
+ },
2116
+ children: [
2117
+ monthName,
2118
+ " ",
2119
+ currentYear
2120
+ ]
2121
+ }),
2122
+ showYearDropdown && /* @__PURE__ */ jsx7("div", {
2123
+ className: "absolute bg-white border rounded-md shadow-md z-[9999] max-h-40 overflow-y-auto",
2124
+ style: {
2125
+ marginTop: scale * 8,
2126
+ width: scale * 120
2127
+ },
2128
+ children: Array.from({
2129
+ length: 100
2130
+ }, function(_, i) {
2131
+ return currentYear - 50 + i;
2132
+ }).map(function(year) {
2133
+ return /* @__PURE__ */ jsx7("div", {
2134
+ onClick: function onClick() {
2135
+ return handleYearSelect(year);
2136
+ },
2137
+ className: "px-3 py-2 cursor-pointer hover:bg-gray-100",
2138
+ style: {
2139
+ fontSize: scale * 12
2140
+ },
2141
+ children: year
2142
+ }, year);
2143
+ })
2144
+ })
2133
2145
  ]
2134
2146
  }),
2135
2147
  /* @__PURE__ */ jsx7("button", {
@@ -2150,32 +2162,33 @@ var Calendar = function Calendar(param) {
2150
2162
  ]
2151
2163
  })
2152
2164
  }),
2153
- /* @__PURE__ */ jsx7("div", {
2154
- className: "grid grid-cols-7",
2155
- style: {
2156
- gap: scale * 8
2157
- },
2158
- children: renderDays()
2159
- }),
2160
- /* @__PURE__ */ jsxs5("div", {
2161
- className: "border-t border-gray-200",
2162
- style: {
2163
- padding: scale * 8
2164
- },
2165
+ !showTimeSelector ? /* @__PURE__ */ jsxs5(Fragment2, {
2165
2166
  children: [
2167
+ /* @__PURE__ */ jsx7("div", {
2168
+ className: "grid grid-cols-7",
2169
+ style: {
2170
+ gap: scale * 24
2171
+ },
2172
+ children: renderDays()
2173
+ }),
2166
2174
  /* @__PURE__ */ jsxs5("div", {
2167
- className: "flex",
2175
+ className: "flex justify-between",
2168
2176
  style: {
2169
- gap: scale * 12
2177
+ gap: scale * 12,
2178
+ marginTop: scale * 8
2170
2179
  },
2171
2180
  children: [
2172
2181
  showTodayButton && /* @__PURE__ */ jsxs5("button", {
2173
2182
  onClick: selectToday,
2174
- className: "flex items-center justify-center rounded-md font-semibold",
2183
+ className: "flex items-center justify-center font-semibold",
2175
2184
  style: {
2185
+ width: scale * 165,
2176
2186
  height: scale * 38,
2177
- background: "rgba(23,97,163,0.15)",
2178
- color: "#1761A3"
2187
+ borderRadius: scale * 6,
2188
+ background: "rgba(23, 97, 163, 0.15)",
2189
+ color: "#1761A3",
2190
+ fontSize: scale * 12,
2191
+ gap: scale * 8
2179
2192
  },
2180
2193
  children: [
2181
2194
  /* @__PURE__ */ jsx7(HiCalendarDays, {
@@ -2189,13 +2202,16 @@ var Calendar = function Calendar(param) {
2189
2202
  }),
2190
2203
  showClearButton && /* @__PURE__ */ jsx7("button", {
2191
2204
  onClick: clearDate,
2192
- className: "rounded-md font-semibold",
2205
+ className: "flex items-center justify-center font-semibold",
2193
2206
  style: {
2207
+ width: scale * 165,
2194
2208
  height: scale * 38,
2195
- background: "rgba(239,68,68,0.15)",
2196
- color: "#EF4444"
2209
+ borderRadius: scale * 6,
2210
+ background: "rgba(239, 68, 68, 0.15)",
2211
+ color: "#EF4444",
2212
+ fontSize: scale * 12
2197
2213
  },
2198
- children: "Clear"
2214
+ children: "\uD83D\uDDD1 Clear"
2199
2215
  })
2200
2216
  ]
2201
2217
  }),
@@ -2204,12 +2220,13 @@ var Calendar = function Calendar(param) {
2204
2220
  className: "w-full rounded-md font-semibold text-white",
2205
2221
  style: {
2206
2222
  height: scale * 38,
2223
+ marginTop: scale * 12,
2207
2224
  background: "linear-gradient(to right,#1761A3,#4DAF83)"
2208
2225
  },
2209
2226
  children: "Confirm Date"
2210
2227
  })
2211
2228
  ]
2212
- })
2229
+ }) : renderTimeSelector()
2213
2230
  ]
2214
2231
  })
2215
2232
  })
@@ -2750,7 +2767,7 @@ var TabbedInterface = function TabbedInterface(param) {
2750
2767
  var active = index === activeIndex;
2751
2768
  var isDragging = draggableTabs && draggingIndex === index;
2752
2769
  var showClose = showTabCloseIconInHeader && !!onCloseTab;
2753
- var closeIcon2 = showClose ? /* @__PURE__ */ jsx9("span", {
2770
+ var closeIcon = showClose ? /* @__PURE__ */ jsx9("span", {
2754
2771
  role: "button",
2755
2772
  "aria-label": "Close tab",
2756
2773
  onClick: function onClick(e) {
@@ -2782,7 +2799,7 @@ var TabbedInterface = function TabbedInterface(param) {
2782
2799
  /* @__PURE__ */ jsxs7("div", {
2783
2800
  className: "flex min-w-0 items-center gap-2",
2784
2801
  children: [
2785
- tabCloseIconPosition === "left" && closeIcon2,
2802
+ tabCloseIconPosition === "left" && closeIcon,
2786
2803
  tab.icon && /* @__PURE__ */ jsx9("span", {
2787
2804
  children: tab.icon
2788
2805
  }),
@@ -2792,7 +2809,7 @@ var TabbedInterface = function TabbedInterface(param) {
2792
2809
  })
2793
2810
  ]
2794
2811
  }),
2795
- tabCloseIconPosition === "right" && closeIcon2
2812
+ tabCloseIconPosition === "right" && closeIcon
2796
2813
  ]
2797
2814
  }),
2798
2815
  variant === "underline" && /* @__PURE__ */ jsx9("span", {
@@ -10217,50 +10234,6 @@ Tooltip2.displayName = "Tooltip";
10217
10234
  import React20, { useEffect as useEffect9 } from "react";
10218
10235
  import ReactDOM from "react-dom";
10219
10236
  import { jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
10220
- var assetSrc4 = function assetSrc4(m) {
10221
- if (typeof m === "string") return m;
10222
- var anyM = m;
10223
- if (typeof (anyM === null || anyM === void 0 ? void 0 : anyM.src) === "string") return anyM.src;
10224
- var d = anyM === null || anyM === void 0 ? void 0 : anyM.default;
10225
- if (typeof d === "string") return d;
10226
- if (typeof (d === null || d === void 0 ? void 0 : d.src) === "string") return d.src;
10227
- return "";
10228
- };
10229
- var checkMarkIcon = "";
10230
- var dangerIcon = "";
10231
- var notificationIcon = "";
10232
- var closeIcon = "";
10233
- var checkMarkIcon2 = "";
10234
- var dangerIcon2 = "";
10235
- var dangerIcon1_1 = "";
10236
- var notificationIcon2 = "";
10237
- var closeIconCopy = "";
10238
- try {
10239
- checkMarkIcon = require_check_mark_1();
10240
- dangerIcon = require_danger_1();
10241
- notificationIcon = require_notification_1();
10242
- closeIcon = require_close();
10243
- checkMarkIcon2 = require_check_mark_2();
10244
- dangerIcon2 = require_danger_2();
10245
- dangerIcon1_1 = require_danger_1_1();
10246
- notificationIcon2 = require_notification_2();
10247
- closeIconCopy = require_close_copy_1();
10248
- } catch (e) {}
10249
- var FALLBACK_ICONS2 = {
10250
- checkMarkIcon: "/toast-icons/check-mark_1.png",
10251
- dangerIcon: "/toast-icons/danger_1.png",
10252
- notificationIcon: "/toast-icons/notification_1.png",
10253
- closeIcon: "/toast-icons/close.png",
10254
- checkMarkIcon2: "/toast-icons/check-mark_2.png",
10255
- dangerIcon2: "/toast-icons/danger_2.png",
10256
- dangerIcon1_1: "/toast-icons/danger_1_1.png",
10257
- notificationIcon2: "/toast-icons/notification_2.png",
10258
- closeIconCopy: "/toast-icons/close_copy_1.png"
10259
- };
10260
- var getIconSrc2 = function getIconSrc2(imported, fallback) {
10261
- var src = assetSrc4(imported);
10262
- return src || fallback;
10263
- };
10264
10237
  var getStripGradient = function getStripGradient(type) {
10265
10238
  switch(type){
10266
10239
  case "success":
@@ -10274,6 +10247,19 @@ var getStripGradient = function getStripGradient(type) {
10274
10247
  return "linear-gradient(90deg, rgba(23, 97, 163, 1) 22.5%, rgba(77, 175, 131, 1) 130%)";
10275
10248
  }
10276
10249
  };
10250
+ var getGradient = function getGradient(type) {
10251
+ switch(type){
10252
+ case "success":
10253
+ return "linear-gradient(90deg, rgba(40, 167, 69, 1) 0%, rgba(58, 208, 125, 1) 100%)";
10254
+ case "error":
10255
+ return "linear-gradient(90deg, rgba(220, 53, 69, 1) 0%, rgba(183, 28, 28, 1) 100%)";
10256
+ case "warning":
10257
+ return "linear-gradient(90deg, rgba(245, 158, 11, 1) 0%, rgba(255, 191, 92, 1) 100%)";
10258
+ case "notification":
10259
+ default:
10260
+ return "linear-gradient(90deg, rgba(23, 97, 163, 1) 0%, rgba(77, 175, 131, 1) 100%)";
10261
+ }
10262
+ };
10277
10263
  var getTitleColor = function getTitleColor(type) {
10278
10264
  switch(type){
10279
10265
  case "success":
@@ -10293,31 +10279,31 @@ var getIcon = function getIcon(type, background) {
10293
10279
  height: "28px",
10294
10280
  objectFit: "contain"
10295
10281
  };
10282
+ var altText = type.charAt(0).toUpperCase() + type.slice(1);
10296
10283
  if (background === "transparent") {
10297
10284
  switch(type){
10298
10285
  case "success":
10299
10286
  return /* @__PURE__ */ jsx27("img", {
10300
- src: getIconSrc2(checkMarkIcon2, FALLBACK_ICONS2.checkMarkIcon2),
10301
- alt: "Success",
10287
+ src: "/icons/check-mark_2.png",
10288
+ alt: altText,
10302
10289
  style: style
10303
10290
  });
10304
10291
  case "error":
10305
10292
  return /* @__PURE__ */ jsx27("img", {
10306
- src: getIconSrc2(dangerIcon2, FALLBACK_ICONS2.dangerIcon2),
10307
- alt: "Error",
10293
+ src: "/icons/danger_2.png",
10294
+ alt: altText,
10308
10295
  style: style
10309
10296
  });
10310
10297
  case "warning":
10311
10298
  return /* @__PURE__ */ jsx27("img", {
10312
- src: getIconSrc2(dangerIcon1_1, FALLBACK_ICONS2.dangerIcon1_1),
10313
- alt: "Warning",
10299
+ src: "/icons/danger_1_1.png",
10300
+ alt: altText,
10314
10301
  style: style
10315
10302
  });
10316
- case "notification":
10317
10303
  default:
10318
10304
  return /* @__PURE__ */ jsx27("img", {
10319
- src: getIconSrc2(notificationIcon2, FALLBACK_ICONS2.notificationIcon2),
10320
- alt: "Notification",
10305
+ src: "/icons/notification_2.png",
10306
+ alt: altText,
10321
10307
  style: style
10322
10308
  });
10323
10309
  }
@@ -10325,27 +10311,26 @@ var getIcon = function getIcon(type, background) {
10325
10311
  switch(type){
10326
10312
  case "success":
10327
10313
  return /* @__PURE__ */ jsx27("img", {
10328
- src: getIconSrc2(checkMarkIcon, FALLBACK_ICONS2.checkMarkIcon),
10329
- alt: "Success",
10314
+ src: "/icons/check-mark_1.png",
10315
+ alt: altText,
10330
10316
  style: style
10331
10317
  });
10332
10318
  case "error":
10333
10319
  return /* @__PURE__ */ jsx27("img", {
10334
- src: getIconSrc2(dangerIcon, FALLBACK_ICONS2.dangerIcon),
10335
- alt: "Error",
10320
+ src: "/icons/danger_1.png",
10321
+ alt: altText,
10336
10322
  style: style
10337
10323
  });
10338
10324
  case "warning":
10339
10325
  return /* @__PURE__ */ jsx27("img", {
10340
- src: getIconSrc2(dangerIcon, FALLBACK_ICONS2.dangerIcon),
10341
- alt: "Warning",
10326
+ src: "/icons/danger_1.png",
10327
+ alt: altText,
10342
10328
  style: style
10343
10329
  });
10344
- case "notification":
10345
10330
  default:
10346
10331
  return /* @__PURE__ */ jsx27("img", {
10347
- src: getIconSrc2(notificationIcon, FALLBACK_ICONS2.notificationIcon),
10348
- alt: "Notification",
10332
+ src: "/icons/notification_1.png",
10333
+ alt: altText,
10349
10334
  style: style
10350
10335
  });
10351
10336
  }
@@ -10368,6 +10353,7 @@ var ToastMessage = React20.forwardRef(function(_0, _1) {
10368
10353
  "className",
10369
10354
  "testId"
10370
10355
  ]), _rest1 = _sliced_to_array(_rest, 1), ref = _rest1[0];
10356
+ var backgroundClass = background === "transparent" ? "bg-white" : "";
10371
10357
  var displayTitle = customTitle !== null && customTitle !== void 0 ? customTitle : type.charAt(0).toUpperCase() + type.slice(1);
10372
10358
  var hasActions = action && action.length > 0;
10373
10359
  useEffect9(function() {
@@ -10381,7 +10367,7 @@ var ToastMessage = React20.forwardRef(function(_0, _1) {
10381
10367
  duration,
10382
10368
  onClose
10383
10369
  ]);
10384
- var closeIconSrc = (custom === null || custom === void 0 ? void 0 : custom.closeIconSrc) || (background === "transparent" ? getIconSrc2(closeIconCopy, FALLBACK_ICONS2.closeIconCopy) : getIconSrc2(closeIcon, FALLBACK_ICONS2.closeIcon));
10370
+ var closeIconSrc = (custom === null || custom === void 0 ? void 0 : custom.closeIconSrc) || (background === "transparent" ? "icons/close_copy_1.png" : "/icons/close.png");
10385
10371
  var iconElement = (custom === null || custom === void 0 ? void 0 : custom.iconSrc) ? /* @__PURE__ */ jsx27("img", {
10386
10372
  src: custom.iconSrc,
10387
10373
  alt: type,
@@ -10394,7 +10380,10 @@ var ToastMessage = React20.forwardRef(function(_0, _1) {
10394
10380
  var content = /* @__PURE__ */ jsxs24("div", _object_spread_props(_object_spread({
10395
10381
  ref: ref,
10396
10382
  "data-testid": testId,
10397
- className: "fixed top-[20px] right-[20px] w-[325px] rounded-[12px] shadow-md z-[9999] overflow-hidden flex \n ".concat(hasActions ? "flex-col p-[10px]" : "flex-row items-center pl-[10px]", " \n ").concat(background === "transparent" ? "bg-white text-[#555]" : "text-white", "\n ").concat(className || ""),
10383
+ style: {
10384
+ background: background === "transparent" ? "#ffffff" : getGradient(type)
10385
+ },
10386
+ className: "fixed top-[20px] right-[20px] w-[325px] rounded-[12px] shadow-md z-[9999] overflow-hidden flex \n".concat(hasActions ? "flex-col p-[10px]" : "flex-row items-center pl-[10px]", " \n").concat(backgroundClass, "\n").concat(className || ""),
10398
10387
  role: "alert",
10399
10388
  "aria-live": "assertive"
10400
10389
  }, rest), {
@@ -10455,11 +10444,6 @@ var ToastMessage = React20.forwardRef(function(_0, _1) {
10455
10444
  return /* @__PURE__ */ jsx27("button", {
10456
10445
  onClick: btn.onClick,
10457
10446
  className: "text-[12px] font-semibold px-[16px] py-[6px] rounded-[6px] transition-all active:scale-95",
10458
- style: {
10459
- background: btn.backgroundColor || (btn.variant === "secondary" ? "transparent" : "rgba(255,255,255,0.9)"),
10460
- color: btn.textColor || (btn.variant === "secondary" ? "white" : "black"),
10461
- border: btn.borderColor ? "1px solid ".concat(btn.borderColor) : "none"
10462
- },
10463
10447
  children: btn.label
10464
10448
  }, index);
10465
10449
  })
@@ -11935,6 +11919,7 @@ var TexttoAudio = function TexttoAudio(param) {
11935
11919
  return text;
11936
11920
  };
11937
11921
  var speakFromTime = function speakFromTime1(time) {
11922
+ window.speechSynthesis.cancel();
11938
11923
  var source = text;
11939
11924
  if (!source.trim()) return;
11940
11925
  var words = source.split(/\s+/);
@@ -11983,6 +11968,7 @@ var TexttoAudio = function TexttoAudio(param) {
11983
11968
  };
11984
11969
  var togglePlay = function togglePlay() {
11985
11970
  if (!utteranceRef.current) {
11971
+ window.speechSynthesis.cancel();
11986
11972
  loopCountRef.current = 0;
11987
11973
  speakFromTime(currentTime);
11988
11974
  return;
@@ -12033,7 +12019,14 @@ var TexttoAudio = function TexttoAudio(param) {
12033
12019
  setPlaying(false);
12034
12020
  setCurrentTime(0);
12035
12021
  (_textAreaRef_current = textAreaRef.current) === null || _textAreaRef_current === void 0 ? void 0 : _textAreaRef_current.setSelectionRange(0, 0);
12022
+ utteranceRef.current = null;
12036
12023
  };
12024
+ useEffect13(function() {
12025
+ return function() {
12026
+ window.speechSynthesis.cancel();
12027
+ stopTimer();
12028
+ };
12029
+ }, []);
12037
12030
  useEffect13(function() {
12038
12031
  volumeRef.current = volume;
12039
12032
  }, [
@@ -12089,6 +12082,9 @@ var TexttoAudio = function TexttoAudio(param) {
12089
12082
  }, [
12090
12083
  text
12091
12084
  ]);
12085
+ var getVolumeIcon = function getVolumeIcon() {
12086
+ return volume === 0 ? "/icons/mute-icon.png" : "/icons/sound-icon.png";
12087
+ };
12092
12088
  return /* @__PURE__ */ jsxs27("div", {
12093
12089
  "data-testid": "text-to-audio-container",
12094
12090
  className: "grid grid-cols-[4fr_1fr] gap-[10px] max-[900px]:grid-cols-1",
@@ -12140,7 +12136,7 @@ var TexttoAudio = function TexttoAudio(param) {
12140
12136
  })
12141
12137
  }),
12142
12138
  /* @__PURE__ */ jsx32("button", {
12143
- className: "border border-[4daf83] bg-[#d4e4eb] rounded-[6px] p-[6px] cursor-pointer",
12139
+ className: "border border-[#4daf83] bg-[#d4e4eb] rounded-[6px] p-[6px] cursor-pointer",
12144
12140
  "data-testid": "play-pause-btn",
12145
12141
  onClick: togglePlay,
12146
12142
  children: /* @__PURE__ */ jsx32(ControlIcon, {
@@ -12148,7 +12144,7 @@ var TexttoAudio = function TexttoAudio(param) {
12148
12144
  })
12149
12145
  }),
12150
12146
  /* @__PURE__ */ jsx32("button", {
12151
- className: "border border-[4daf83] bg-[#d4e4eb] rounded-[6px] p-[6px] cursor-pointer",
12147
+ className: "border border-[#4daf83] bg-[#d4e4eb] rounded-[6px] p-[6px] cursor-pointer",
12152
12148
  "data-testid": "10-sec-forward-skip",
12153
12149
  onClick: function onClick() {
12154
12150
  return skip(10);
@@ -12158,7 +12154,7 @@ var TexttoAudio = function TexttoAudio(param) {
12158
12154
  })
12159
12155
  }),
12160
12156
  /* @__PURE__ */ jsx32("button", {
12161
- className: "border border-[4daf83] bg-[#d4e4eb] rounded-[6px] p-[6px] cursor-pointer",
12157
+ className: "border border-[#4daf83] bg-[#d4e4eb] rounded-[6px] p-[6px] cursor-pointer",
12162
12158
  "data-testid": "5-sec-forward-skip",
12163
12159
  onClick: function onClick() {
12164
12160
  return skip(5);
@@ -12176,7 +12172,7 @@ var TexttoAudio = function TexttoAudio(param) {
12176
12172
  })
12177
12173
  }),
12178
12174
  /* @__PURE__ */ jsx32("button", {
12179
- className: "border border-[4daf83] bg-[#d4e4eb] rounded-[6px] p-[6px] cursor-pointer",
12175
+ className: "border border-[#4daf83] bg-[#d4e4eb] rounded-[6px] p-[6px] cursor-pointer",
12180
12176
  "data-testid": "force-stop",
12181
12177
  onClick: stop,
12182
12178
  children: /* @__PURE__ */ jsx32(ControlIcon, {
@@ -12184,7 +12180,7 @@ var TexttoAudio = function TexttoAudio(param) {
12184
12180
  })
12185
12181
  }),
12186
12182
  /* @__PURE__ */ jsx32("button", {
12187
- className: "border border-[4daf83] bg-[#d4e4eb] rounded-[6px] p-[6px] cursor-pointer",
12183
+ className: "border border-[#4daf83] bg-[#d4e4eb] rounded-[6px] p-[6px] cursor-pointer",
12188
12184
  "data-testid": "on-loop-btn",
12189
12185
  onClick: function onClick() {
12190
12186
  setLoopMode(function(prev) {
@@ -12231,22 +12227,23 @@ var TexttoAudio = function TexttoAudio(param) {
12231
12227
  className: "flex items-center gap-[6px] w-[180px]",
12232
12228
  children: [
12233
12229
  /* @__PURE__ */ jsx32("input", {
12234
- className: "flex-1 appearance-none h-[6px] rounded-full cursor-pointer",
12230
+ className: "flex-1 appearance-none h-[6px] rounded-[5px] cursor-pointer",
12235
12231
  "data-testid": "seek-bar",
12236
12232
  type: "range",
12237
12233
  min: 0,
12238
12234
  max: duration,
12239
12235
  step: 0.01,
12240
12236
  value: currentTime,
12241
- style: {
12242
- "--progress": "".concat(currentTime / duration * 100, "%")
12243
- },
12244
12237
  onChange: function onChange(e) {
12245
12238
  var t = Number(e.target.value);
12246
12239
  setCurrentTime(t);
12247
12240
  window.speechSynthesis.cancel();
12248
12241
  stopTimer();
12249
12242
  speakFromTime(t);
12243
+ },
12244
+ style: {
12245
+ accentColor: "#4daf83",
12246
+ background: "linear-gradient(90deg,\n rgba(23,97,163,1) 0%,\n rgba(77,175,131,1) ".concat(currentTime / duration * 100, "%,\n #e5e7eb ").concat(currentTime / duration * 100, "%,\n #e5e7eb 100%)")
12250
12247
  }
12251
12248
  }),
12252
12249
  /* @__PURE__ */ jsxs27("span", {
@@ -12278,7 +12275,7 @@ var TexttoAudio = function TexttoAudio(param) {
12278
12275
  children: "Reads Entire page"
12279
12276
  }),
12280
12277
  /* @__PURE__ */ jsx32("button", {
12281
- className: "bg-gradient-to-r from-[#1761a3] to-[#4daf83] text white border-none px-[12px] py-[6px] ronded-[6px] cursor-pointer",
12278
+ className: "bg-gradient-to-r from-[#1761a3] to-[#4daf83] text-white border-none px-[12px] py-[6px] rounded-[6px] cursor-pointer",
12282
12279
  "data-testid": "reads-given-input",
12283
12280
  onClick: function onClick() {
12284
12281
  loopCountRef.current = 0;
@@ -12293,115 +12290,123 @@ var TexttoAudio = function TexttoAudio(param) {
12293
12290
  })
12294
12291
  ]
12295
12292
  }),
12296
- /* @__PURE__ */ jsx32("div", {
12297
- className: "flex flex-col gap-[16px]",
12298
- children: /* @__PURE__ */ jsxs27("div", {
12299
- className: "bg-[#f7fbfb] border border-[#cfe5da] rounded-[14px] p-[16px] mb-[16px]",
12300
- children: [
12301
- /* @__PURE__ */ jsxs27("div", {
12302
- className: "flex justify-between items-center text-[13px] font-semibold text-[#243a36] mb-[10px]",
12303
- children: [
12304
- /* @__PURE__ */ jsx32("span", {
12305
- children: "Volume"
12306
- }),
12307
- /* @__PURE__ */ jsxs27("span", {
12308
- children: [
12309
- Math.round(volume * 100),
12310
- "%"
12311
- ]
12312
- })
12313
- ]
12314
- }),
12315
- /* @__PURE__ */ jsx32("input", {
12316
- "data-testid": "text-to-audio-volume",
12317
- type: "range",
12318
- min: 0,
12319
- max: 1,
12320
- step: 0.01,
12321
- value: volume,
12322
- style: {
12323
- "--value": "".concat(volume * 100, "%")
12324
- },
12325
- onChange: function onChange(e) {
12326
- return setVolume(Number(e.target.value));
12327
- }
12328
- })
12329
- ]
12330
- })
12331
- }),
12332
12293
  /* @__PURE__ */ jsxs27("div", {
12333
- className: "bg-[#f7fbfb] border border-[#cfe5da] rounded-[14px] p-[16px]",
12294
+ className: "flex flex-col gap-[16px]",
12334
12295
  children: [
12335
12296
  /* @__PURE__ */ jsxs27("div", {
12336
- className: "text-[13px] font-semibold text-[#243a36] flex justify-between mb-[12px]",
12297
+ className: "bg-[#f7fbfb] border border-[#cfe5da] rounded-[14px] p-[16px]",
12337
12298
  children: [
12338
- /* @__PURE__ */ jsx32("span", {
12339
- children: "Playback Speed"
12299
+ /* @__PURE__ */ jsxs27("div", {
12300
+ className: "flex justify-between items-center text-[13px] font-semibold text-[#243a36] mb-[10px]",
12301
+ children: [
12302
+ /* @__PURE__ */ jsx32("span", {
12303
+ children: "Volume"
12304
+ }),
12305
+ /* @__PURE__ */ jsxs27("span", {
12306
+ children: [
12307
+ Math.round(volume * 100),
12308
+ "%"
12309
+ ]
12310
+ })
12311
+ ]
12340
12312
  }),
12341
- /* @__PURE__ */ jsxs27("span", {
12313
+ /* @__PURE__ */ jsxs27("div", {
12314
+ className: "flex items-center gap-[10px]",
12342
12315
  children: [
12343
- speed.toFixed(2),
12344
- "x"
12316
+ /* @__PURE__ */ jsx32("div", {
12317
+ onClick: function onClick() {
12318
+ return setVolume(volume === 0 ? 1 : 0);
12319
+ },
12320
+ style: {
12321
+ width: 18,
12322
+ height: 18,
12323
+ backgroundImage: "url(".concat(getVolumeIcon(), ")"),
12324
+ backgroundSize: "contain",
12325
+ backgroundRepeat: "no-repeat",
12326
+ cursor: "pointer"
12327
+ }
12328
+ }),
12329
+ /* @__PURE__ */ jsx32("input", {
12330
+ "data-testid": "text-to-audio-volume",
12331
+ type: "range",
12332
+ min: 0,
12333
+ max: 1,
12334
+ step: 0.01,
12335
+ value: volume,
12336
+ onChange: function onChange(e) {
12337
+ return setVolume(Number(e.target.value));
12338
+ },
12339
+ className: "w-full appearance-none h-[6px] rounded-[5px]",
12340
+ style: {
12341
+ accentColor: "#4daf83",
12342
+ background: "linear-gradient(90deg, \n rgba(23,97,163,1) 0%, \n rgba(77,175,131,1) ".concat(volume * 100, "%, \n #e5e7eb ").concat(volume * 100, "%, \n #e5e7eb 100%)")
12343
+ }
12344
+ })
12345
12345
  ]
12346
12346
  })
12347
12347
  ]
12348
12348
  }),
12349
- /* @__PURE__ */ jsx32("div", {
12350
- className: "bg-[#eef5f2] rounded-[12px] p-[12px]",
12351
- children: /* @__PURE__ */ jsx32("input", {
12352
- className: "w-full appearance-none h-[6px] rounded-full",
12353
- "data-testid": "test-to-audio-playbackspeed",
12354
- type: "range",
12355
- min: 0.5,
12356
- max: 2,
12357
- step: 0.25,
12358
- value: speed,
12359
- style: {
12360
- "--value": "".concat((speed - 0.5) / 1.5 * 100, "%")
12361
- },
12362
- onChange: function onChange(e) {
12363
- return setSpeed(Number(e.target.value));
12364
- }
12365
- })
12366
- }),
12367
12349
  /* @__PURE__ */ jsxs27("div", {
12368
- style: {
12369
- fontSize: 12,
12370
- color: "#7a8b86",
12371
- marginTop: 6,
12372
- display: "flex",
12373
- justifyContent: "space-between"
12374
- },
12350
+ className: "bg-[#f7fbfb] border border-[#cfe5da] rounded-[14px] p-[16px]",
12375
12351
  children: [
12376
- /* @__PURE__ */ jsx32("span", {
12377
- children: "Slower"
12352
+ /* @__PURE__ */ jsxs27("div", {
12353
+ className: "flex justify-between text-[13px] font-semibold mb-[10px]",
12354
+ children: [
12355
+ /* @__PURE__ */ jsx32("span", {
12356
+ children: "Playback Speed"
12357
+ }),
12358
+ /* @__PURE__ */ jsxs27("span", {
12359
+ children: [
12360
+ speed.toFixed(2),
12361
+ "x"
12362
+ ]
12363
+ })
12364
+ ]
12365
+ }),
12366
+ /* @__PURE__ */ jsx32("input", {
12367
+ "data-testid": "test-to-audio-playbackspeed",
12368
+ type: "range",
12369
+ min: 0.5,
12370
+ max: 2,
12371
+ step: 0.25,
12372
+ value: speed,
12373
+ className: "w-full appearance-none h-[6px] rounded-[5px]",
12374
+ onChange: function onChange(e) {
12375
+ return setSpeed(Number(e.target.value));
12376
+ },
12377
+ style: {
12378
+ accentColor: "#4daf83",
12379
+ background: "linear-gradient(90deg,\n rgba(23,97,163,1) 0%,\n rgba(77,175,131,1) ".concat((speed - 0.5) / 1.5 * 100, "%,\n #e5e7eb ").concat((speed - 0.5) / 1.5 * 100, "%,\n #e5e7eb 100%)")
12380
+ }
12378
12381
  }),
12379
- /* @__PURE__ */ jsx32("span", {
12380
- children: "Faster"
12382
+ /* @__PURE__ */ jsxs27("div", {
12383
+ className: "flex justify-between text-xs text-gray-500 mt-1",
12384
+ children: [
12385
+ /* @__PURE__ */ jsx32("span", {
12386
+ children: "Slower"
12387
+ }),
12388
+ /* @__PURE__ */ jsx32("span", {
12389
+ children: "Faster"
12390
+ })
12391
+ ]
12381
12392
  })
12382
12393
  ]
12383
- })
12384
- ]
12385
- }),
12386
- /* @__PURE__ */ jsxs27("div", {
12387
- className: "bg-[#f7fbfb] border border-[#cfe5da] rounded-[14px] p-[16px]",
12388
- children: [
12389
- /* @__PURE__ */ jsx32("div", {
12390
- className: "text-[13px] font-semibold text-[#243a36] flex justify-between mb-[12px]"
12391
12394
  }),
12392
- /* @__PURE__ */ jsx32("span", {
12393
- "data-testid": "quick-summary",
12394
- children: "Quick Summary"
12395
+ /* @__PURE__ */ jsxs27("div", {
12396
+ className: "bg-[#f7fbfb] border border-[#cfe5da] rounded-[14px] p-[16px]",
12397
+ children: [
12398
+ /* @__PURE__ */ jsx32("div", {
12399
+ "data-testid": "quick-summary",
12400
+ className: "font-semibold mb-[8px]",
12401
+ children: "Quick Summary"
12402
+ }),
12403
+ /* @__PURE__ */ jsx32("p", {
12404
+ className: "text-sm text-[#4a5c57] leading-[1.5]",
12405
+ children: mode === "textarea" ? categorizeText(text) : getQuickSummary()
12406
+ })
12407
+ ]
12395
12408
  })
12396
12409
  ]
12397
- }),
12398
- /* @__PURE__ */ jsx32("p", {
12399
- style: {
12400
- fontSize: 13,
12401
- color: "#4a5c57",
12402
- lineHeight: 1.5
12403
- },
12404
- children: mode === "textarea" ? categorizeText(text) : getQuickSummary()
12405
12410
  })
12406
12411
  ]
12407
12412
  });