@oneplatformdev/ui 0.1.99-beta.20 → 0.1.99-beta.201

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 (266) hide show
  1. package/.storybook/Wrappers.js.map +1 -1
  2. package/Accordion/Accordion.d.ts +1 -1
  3. package/Accordion/Accordion.d.ts.map +1 -1
  4. package/Accordion/Accordion.js +48 -26
  5. package/Accordion/Accordion.js.map +1 -1
  6. package/Alert/Alert.js.map +1 -1
  7. package/Alert/alertVariants.js.map +1 -1
  8. package/AlertDialog/AlertDialog.js.map +1 -1
  9. package/AlertDialog/AlertDialog.stories.js +2 -3
  10. package/AlertDialog/AlertDialog.stories.js.map +1 -1
  11. package/AlertDialog/AlertDialogRoot.d.ts.map +1 -1
  12. package/AlertDialog/AlertDialogRoot.js +23 -23
  13. package/AlertDialog/AlertDialogRoot.js.map +1 -1
  14. package/AreaChart/AreaChart.js.map +1 -1
  15. package/Aside/Aside.js.map +1 -1
  16. package/Aside/AsideSidebar.js.map +1 -1
  17. package/AspectRatio/AspectRatio.js.map +1 -1
  18. package/Avatar/Avatar.js.map +1 -1
  19. package/Badge/Badge.js.map +1 -1
  20. package/Badge/badgeVariants.js.map +1 -1
  21. package/Breadcrumb/Breadcrumb.js.map +1 -1
  22. package/Button/Button.d.ts.map +1 -1
  23. package/Button/Button.js +40 -41
  24. package/Button/Button.js.map +1 -1
  25. package/Button/Button.stories.js.map +1 -1
  26. package/Button/Button.utils.d.ts +3 -0
  27. package/Button/Button.utils.d.ts.map +1 -0
  28. package/Button/Button.utils.js +14 -0
  29. package/Button/Button.utils.js.map +1 -0
  30. package/Button/ButtonCounterBadge.js.map +1 -1
  31. package/Button/buttonVariants.d.ts.map +1 -1
  32. package/Button/buttonVariants.js +2 -1
  33. package/Button/buttonVariants.js.map +1 -1
  34. package/Button/index.d.ts +1 -0
  35. package/Button/index.d.ts.map +1 -1
  36. package/Button/index.js +8 -6
  37. package/Button/index.js.map +1 -1
  38. package/ButtonIcon/ButtonIcon.d.ts.map +1 -1
  39. package/ButtonIcon/ButtonIcon.js +49 -50
  40. package/ButtonIcon/ButtonIcon.js.map +1 -1
  41. package/ButtonIcon/ButtonIcon.stories.js +35 -33
  42. package/ButtonIcon/ButtonIcon.stories.js.map +1 -1
  43. package/ButtonIcon/buttonIconVariants.d.ts.map +1 -1
  44. package/ButtonIcon/buttonIconVariants.js +3 -2
  45. package/ButtonIcon/buttonIconVariants.js.map +1 -1
  46. package/CHANGELOG.md +2674 -1802
  47. package/Calendar/Calendar.js +0 -1
  48. package/Calendar/Calendar.js.map +1 -1
  49. package/Card/Card.js.map +1 -1
  50. package/Carousel/Carousel.js +6 -7
  51. package/Carousel/Carousel.js.map +1 -1
  52. package/Chart/Chart.js.map +1 -1
  53. package/Checkbox/Checkbox.d.ts.map +1 -1
  54. package/Checkbox/Checkbox.js +34 -33
  55. package/Checkbox/Checkbox.js.map +1 -1
  56. package/Checkbox/Checkbox.stories.js +108 -0
  57. package/Checkbox/Checkbox.stories.js.map +1 -0
  58. package/Collapsible/Collapsible.js.map +1 -1
  59. package/Combobox/Combobox.d.ts +1 -1
  60. package/Combobox/Combobox.d.ts.map +1 -1
  61. package/Combobox/Combobox.js +205 -192
  62. package/Combobox/Combobox.js.map +1 -1
  63. package/Combobox/Combobox.stories.js +212 -0
  64. package/Combobox/Combobox.stories.js.map +1 -0
  65. package/Combobox/Combobox.types.d.ts +34 -19
  66. package/Combobox/Combobox.types.d.ts.map +1 -1
  67. package/Combobox/ComboboxOptionItem.d.ts +4 -3
  68. package/Combobox/ComboboxOptionItem.d.ts.map +1 -1
  69. package/Combobox/ComboboxOptionItem.js +49 -22
  70. package/Combobox/ComboboxOptionItem.js.map +1 -1
  71. package/Combobox/ComboboxOptions.d.ts +2 -2
  72. package/Combobox/ComboboxOptions.d.ts.map +1 -1
  73. package/Combobox/ComboboxOptions.js +48 -49
  74. package/Combobox/ComboboxOptions.js.map +1 -1
  75. package/Command/Command.d.ts +6 -1
  76. package/Command/Command.d.ts.map +1 -1
  77. package/Command/Command.js +61 -47
  78. package/Command/Command.js.map +1 -1
  79. package/DataTable/DataTable.js +12 -13
  80. package/DataTable/DataTable.js.map +1 -1
  81. package/DataTable/DataTableColumnFilter.js +6 -7
  82. package/DataTable/DataTableColumnFilter.js.map +1 -1
  83. package/DataTable/useDataTable.js.map +1 -1
  84. package/DatePicker/DatePicker.js +12 -13
  85. package/DatePicker/DatePicker.js.map +1 -1
  86. package/Dialog/Dialog.d.ts +4 -1
  87. package/Dialog/Dialog.d.ts.map +1 -1
  88. package/Dialog/Dialog.js +70 -37
  89. package/Dialog/Dialog.js.map +1 -1
  90. package/Dialog/Dialog.stories.js +101 -0
  91. package/Dialog/Dialog.stories.js.map +1 -0
  92. package/Dialog/Dialog.types.d.ts +4 -0
  93. package/Dialog/Dialog.types.d.ts.map +1 -0
  94. package/Dialog/Dialog.types.js +2 -0
  95. package/Dialog/Dialog.types.js.map +1 -0
  96. package/Dialog/DialogOverlayScope.js.map +1 -1
  97. package/Dialog/index.d.ts +1 -0
  98. package/Dialog/index.d.ts.map +1 -1
  99. package/Drawer/Drawer.js.map +1 -1
  100. package/DropdownMenu/DropdownMenu.d.ts.map +1 -1
  101. package/DropdownMenu/DropdownMenu.js +33 -20
  102. package/DropdownMenu/DropdownMenu.js.map +1 -1
  103. package/Dropzone/Dropzone.d.ts.map +1 -1
  104. package/Dropzone/Dropzone.js +46 -28
  105. package/Dropzone/Dropzone.js.map +1 -1
  106. package/Dropzone/Dropzone.stories.js +100 -0
  107. package/Dropzone/Dropzone.stories.js.map +1 -0
  108. package/Dropzone/Dropzone.types.js.map +1 -1
  109. package/Dropzone/DropzoneFilePreview.js.map +1 -1
  110. package/Dropzone/DropzoneSinglePickPreview.js.map +1 -1
  111. package/Dropzone/DropzoneUtils.js.map +1 -1
  112. package/Form/Form.d.ts.map +1 -1
  113. package/Form/Form.js +14 -15
  114. package/Form/Form.js.map +1 -1
  115. package/Form/FormRenderControl.d.ts +1 -1
  116. package/Form/FormRenderControl.d.ts.map +1 -1
  117. package/Form/FormRenderControl.js +53 -14
  118. package/Form/FormRenderControl.js.map +1 -1
  119. package/Form/FormRenderControl.types.d.ts +4 -1
  120. package/Form/FormRenderControl.types.d.ts.map +1 -1
  121. package/Form/Form_old.js +4 -5
  122. package/Form/Form_old.js.map +1 -1
  123. package/FormCheckbox/FormCheckbox.js +4 -4
  124. package/FormCheckbox/FormCheckbox.js.map +1 -1
  125. package/FormCombobox/FormCombobox.d.ts.map +1 -1
  126. package/FormCombobox/FormCombobox.js +15 -13
  127. package/FormCombobox/FormCombobox.js.map +1 -1
  128. package/FormDatePicker/FormDatePicker.d.ts.map +1 -1
  129. package/FormDatePicker/FormDatePicker.js +18 -16
  130. package/FormDatePicker/FormDatePicker.js.map +1 -1
  131. package/FormDropzone/FormDropzone.d.ts.map +1 -1
  132. package/FormDropzone/FormDropzone.js +13 -11
  133. package/FormDropzone/FormDropzone.js.map +1 -1
  134. package/FormInput/FormInput.d.ts.map +1 -1
  135. package/FormInput/FormInput.js +47 -27
  136. package/FormInput/FormInput.js.map +1 -1
  137. package/FormInput/FormInput.stories.js +61 -0
  138. package/FormInput/FormInput.stories.js.map +1 -0
  139. package/FormInput/FormInput.types.d.ts +1 -0
  140. package/FormInput/FormInput.types.d.ts.map +1 -1
  141. package/FormRadio/FormRadio.js.map +1 -1
  142. package/FormSelect/FormSelect.d.ts.map +1 -1
  143. package/FormSelect/FormSelect.js +19 -18
  144. package/FormSelect/FormSelect.js.map +1 -1
  145. package/FormTextarea/FormTextarea.d.ts.map +1 -1
  146. package/FormTextarea/FormTextarea.js +13 -11
  147. package/FormTextarea/FormTextarea.js.map +1 -1
  148. package/Header/Header.js.map +1 -1
  149. package/HoverCard/HoverCard.js.map +1 -1
  150. package/InfoBlock/InfoBlock.d.ts +7 -0
  151. package/InfoBlock/InfoBlock.d.ts.map +1 -0
  152. package/InfoBlock/InfoBlock.js +28 -0
  153. package/InfoBlock/InfoBlock.js.map +1 -0
  154. package/InfoBlock/InfoBlock.stories.js +50 -0
  155. package/InfoBlock/InfoBlock.stories.js.map +1 -0
  156. package/InfoBlock/InfoBlock.types.d.ts +9 -0
  157. package/InfoBlock/InfoBlock.types.d.ts.map +1 -0
  158. package/InfoBlock/InfoBlock.types.js +2 -0
  159. package/InfoBlock/InfoBlock.types.js.map +1 -0
  160. package/InfoBlock/index.d.ts +3 -0
  161. package/InfoBlock/index.d.ts.map +1 -0
  162. package/InfoBlock/index.js +5 -0
  163. package/InfoBlock/index.js.map +1 -0
  164. package/InfoBlock/infoBlockVariants.d.ts +6 -0
  165. package/InfoBlock/infoBlockVariants.d.ts.map +1 -0
  166. package/InfoBlock/infoBlockVariants.js +27 -0
  167. package/InfoBlock/infoBlockVariants.js.map +1 -0
  168. package/Input/Input.d.ts.map +1 -1
  169. package/Input/Input.js +65 -51
  170. package/Input/Input.js.map +1 -1
  171. package/Input/Input.types.d.ts +1 -0
  172. package/Input/Input.types.d.ts.map +1 -1
  173. package/Input/inputVariants.d.ts.map +1 -1
  174. package/Input/inputVariants.js +5 -4
  175. package/Input/inputVariants.js.map +1 -1
  176. package/InputOTP/InputOTP.d.ts.map +1 -1
  177. package/InputOTP/InputOTP.js.map +1 -1
  178. package/LICENSE +21 -21
  179. package/Label/Label.js.map +1 -1
  180. package/Label/labelVariants.js.map +1 -1
  181. package/LazyLoader/LazyLoader.js +4 -5
  182. package/LazyLoader/LazyLoader.js.map +1 -1
  183. package/LoadedIcon/LoadedIcon.js.map +1 -1
  184. package/LoadingMask/LoadingMask.d.ts +1 -2
  185. package/LoadingMask/LoadingMask.d.ts.map +1 -1
  186. package/LoadingMask/LoadingMask.js +8 -8
  187. package/LoadingMask/LoadingMask.js.map +1 -1
  188. package/LoadingMask/LoadingMask.types.d.ts +1 -0
  189. package/LoadingMask/LoadingMask.types.d.ts.map +1 -1
  190. package/LoadingMask/RenderLoadingMask.js.map +1 -1
  191. package/LoadingProgress/LoadingProgress.js.map +1 -1
  192. package/LoadingProgress/loadingProgressVariants.js.map +1 -1
  193. package/Menubar/Menubar.js.map +1 -1
  194. package/NavigationMenu/NavigationMenu.js.map +1 -1
  195. package/NavigationMenu/navigationMenuVariants.js.map +1 -1
  196. package/Pagination/Pagination.js +0 -1
  197. package/Pagination/Pagination.js.map +1 -1
  198. package/Popover/Popover.js.map +1 -1
  199. package/Progress/Progress.js.map +1 -1
  200. package/README.md +7 -7
  201. package/Radio/Radio.js.map +1 -1
  202. package/RadioGroup/RadioGroup.js.map +1 -1
  203. package/Resizable/Resizable.js.map +1 -1
  204. package/Resizable/Resizable.stories.js.map +1 -1
  205. package/ScrollArea/ScrollArea.js.map +1 -1
  206. package/Search/Search.d.ts.map +1 -1
  207. package/Search/Search.js +40 -31
  208. package/Search/Search.js.map +1 -1
  209. package/Search/Search.stories.js +17 -0
  210. package/Search/Search.stories.js.map +1 -0
  211. package/Select/Select.d.ts.map +1 -1
  212. package/Select/Select.js +53 -49
  213. package/Select/Select.js.map +1 -1
  214. package/Select/Select.stories.js.map +1 -1
  215. package/Select/Select.types.d.ts +4 -0
  216. package/Select/Select.types.d.ts.map +1 -1
  217. package/Select/SelectRoot.js +1 -1
  218. package/Select/SelectRoot.js.map +1 -1
  219. package/Separator/Separator.js.map +1 -1
  220. package/Sheet/Sheet.js.map +1 -1
  221. package/Sidebar/Sidebar.js +20 -21
  222. package/Sidebar/Sidebar.js.map +1 -1
  223. package/Skeleton/Skeleton.js.map +1 -1
  224. package/Slider/Slider.js.map +1 -1
  225. package/Sonner/Sonner.js.map +1 -1
  226. package/Switch/Switch.js.map +1 -1
  227. package/Table/Table.js.map +1 -1
  228. package/TablePagination/TablePagination.js +17 -21
  229. package/TablePagination/TablePagination.js.map +1 -1
  230. package/Tabs/Tabs.js.map +1 -1
  231. package/Tabs/TabsRoot.js.map +1 -1
  232. package/Textarea/Textarea.d.ts.map +1 -1
  233. package/Textarea/Textarea.js +48 -43
  234. package/Textarea/Textarea.js.map +1 -1
  235. package/Textarea/Textarea.stories.js +1 -1
  236. package/Textarea/Textarea.stories.js.map +1 -1
  237. package/Textarea/Textarea.types.d.ts +3 -1
  238. package/Textarea/Textarea.types.d.ts.map +1 -1
  239. package/Textarea/useAutosizeTextArea.js.map +1 -1
  240. package/Theme/ThemeModeToggle.js +3 -4
  241. package/Theme/ThemeModeToggle.js.map +1 -1
  242. package/Theme/ThemeProvider.js.map +1 -1
  243. package/Toast/Toast.d.ts +1 -1
  244. package/Toast/Toast.js.map +1 -1
  245. package/Toast/toast.constants.js.map +1 -1
  246. package/Toast/toastVariants.d.ts +1 -1
  247. package/Toast/toastVariants.js.map +1 -1
  248. package/Toast/useToast.js.map +1 -1
  249. package/Toaster/Toaster.js.map +1 -1
  250. package/Toggle/Toggle.js.map +1 -1
  251. package/ToggleGroup/ToggleGroup.js.map +1 -1
  252. package/Tooltip/Tooltip.d.ts.map +1 -1
  253. package/Tooltip/Tooltip.js +41 -29
  254. package/Tooltip/Tooltip.js.map +1 -1
  255. package/Tooltip/Tooltip.types.d.ts +1 -0
  256. package/Tooltip/Tooltip.types.d.ts.map +1 -1
  257. package/Tooltip/TooltipRoot.js.map +1 -1
  258. package/Tooltip/tooltipVariants.d.ts +4 -0
  259. package/Tooltip/tooltipVariants.d.ts.map +1 -0
  260. package/Tooltip/tooltipVariants.js +23 -0
  261. package/Tooltip/tooltipVariants.js.map +1 -0
  262. package/index.d.ts +1 -0
  263. package/index.d.ts.map +1 -1
  264. package/index.js +332 -328
  265. package/index.js.map +1 -1
  266. package/package.json +6 -5
@@ -1,24 +1,20 @@
1
- import { jsxs as i, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as c, jsx as n } from "react/jsx-runtime";
2
2
  import { Button as o } from "../Button/Button.js";
3
- import "../Button/buttonVariants.js";
4
- import "@radix-ui/react-select";
5
- import "lucide-react";
6
- import "@oneplatformdev/utils";
7
3
  import { Select as P } from "../Select/Select.js";
8
- const L = ({
4
+ const j = ({
9
5
  offset: l,
10
6
  limit: a,
11
7
  totalRows: s,
12
- setLimit: p,
8
+ setLimit: d,
13
9
  setOffset: t,
14
- tRowsPerPage: m = "Rows per page",
15
- tPrevious: d = "Previous",
16
- tPage: u = "Page",
17
- tNext: x = "Next",
10
+ tRowsPerPage: p = "Rows per page",
11
+ tPrevious: u = "Previous",
12
+ tPage: x = "Page",
13
+ tNext: m = "Next",
18
14
  tOf: v = "Of"
19
15
  }) => {
20
- const r = Math.ceil(l / a) + 1, c = Math.ceil(s / a), h = r === c, b = (e) => {
21
- t(0), p(parseInt(e));
16
+ const i = Math.ceil(l / a) + 1, r = Math.ceil(s / a), h = i === r, b = (e) => {
17
+ t(0), d(parseInt(e));
22
18
  }, g = () => {
23
19
  let e = l - a;
24
20
  e < 0 && (e = 0), t(e);
@@ -26,9 +22,9 @@ const L = ({
26
22
  let e = l + a;
27
23
  e > s && (e = s - a), t(e);
28
24
  };
29
- return /* @__PURE__ */ i("div", { className: "flex items-center justify-end space-x-2 py-4", children: [
30
- /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
31
- /* @__PURE__ */ n("span", { className: "text-sm text-nowrap", children: m }),
25
+ return /* @__PURE__ */ c("div", { className: "flex items-center justify-end space-x-2 py-4", children: [
26
+ /* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
27
+ /* @__PURE__ */ n("span", { className: "text-sm text-nowrap", children: p }),
32
28
  /* @__PURE__ */ n(
33
29
  P,
34
30
  {
@@ -46,7 +42,7 @@ const L = ({
46
42
  }
47
43
  )
48
44
  ] }),
49
- /* @__PURE__ */ i("div", { className: "space-x-2", children: [
45
+ /* @__PURE__ */ c("div", { className: "space-x-2", children: [
50
46
  /* @__PURE__ */ n(
51
47
  o,
52
48
  {
@@ -54,10 +50,10 @@ const L = ({
54
50
  size: "sm",
55
51
  disabled: !l,
56
52
  onClick: g,
57
- children: d
53
+ children: u
58
54
  }
59
55
  ),
60
- /* @__PURE__ */ n("span", { className: "text-sm", children: `${u} ${r} ${v} ${c}` }),
56
+ /* @__PURE__ */ n("span", { className: "text-sm", children: `${x} ${i} ${v} ${r}` }),
61
57
  /* @__PURE__ */ n(
62
58
  o,
63
59
  {
@@ -65,13 +61,13 @@ const L = ({
65
61
  size: "sm",
66
62
  disabled: h,
67
63
  onClick: N,
68
- children: x
64
+ children: m
69
65
  }
70
66
  )
71
67
  ] })
72
68
  ] });
73
69
  };
74
70
  export {
75
- L as TablePagination
71
+ j as TablePagination
76
72
  };
77
73
  //# sourceMappingURL=TablePagination.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TablePagination.js","sources":["../../src/TablePagination/TablePagination.tsx"],"sourcesContent":["'use client';\n\nimport { Button } from '../Button';\nimport { Select } from '../Select';\nimport { FC } from 'react';\n\ninterface IProps {\n limit: number;\n offset: number;\n totalRows: number;\n setLimit: (limit: number) => void;\n setOffset: (offset: number) => void;\n tRowsPerPage?: string;\n tPrevious?: string;\n tPage?:string;\n tNext?:string;\n tOf?:string\n}\n\nexport const TablePagination: FC<IProps> = ({\n offset,\n limit,\n totalRows,\n setLimit,\n setOffset,\n tRowsPerPage= \"Rows per page\",\n tPrevious= \"Previous\",\n tPage= \"Page\",\n tNext= \"Next\",\n tOf= \"Of\",\n}) => {\n const currentPage = Math.ceil(offset / limit) + 1;\n const totalPages = Math.ceil(totalRows / limit);\n const isLastPage = currentPage === totalPages;\n\n const onChangeLimit = (value: string) => {\n setOffset(0);\n setLimit(parseInt(value));\n };\n\n const onPrevious = () => {\n let nextOffset = offset - limit;\n if (nextOffset < 0) {\n nextOffset = 0;\n }\n setOffset(nextOffset);\n };\n\n const onNext = () => {\n let nextOffset = offset + limit;\n if (nextOffset > totalRows) {\n nextOffset = totalRows - limit;\n }\n setOffset(nextOffset);\n };\n\n return (\n <div className=\"flex items-center justify-end space-x-2 py-4\">\n <div className=\"flex items-center space-x-2\">\n <span className=\"text-sm text-nowrap\">{tRowsPerPage}</span>\n <Select\n value={limit?.toString()}\n options={[\n { value: '5', label: '5' },\n { value: '10', label: '10' },\n { value: '20', label: '20' },\n { value: '30', label: '30' },\n { value: '50', label: '50' },\n ]}\n onChange={onChangeLimit}\n placeholder=\"6\"\n nullable={false}\n />\n </div>\n <div className=\"space-x-2\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={!offset}\n onClick={onPrevious}\n >\n {tPrevious}\n </Button>\n <span className=\"text-sm\">{`${tPage} ${currentPage} ${tOf} ${totalPages}`}</span>\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={isLastPage}\n onClick={onNext}\n >\n {tNext}\n </Button>\n </div>\n </div>\n );\n};\n"],"names":["TablePagination","offset","limit","totalRows","setLimit","setOffset","tRowsPerPage","tPrevious","tPage","tNext","tOf","currentPage","totalPages","isLastPage","onChangeLimit","value","onPrevious","nextOffset","onNext","jsxs","jsx","Select","Button"],"mappings":";;;;;;;AAmBO,MAAMA,IAA8B,CAAC;AAAA,EAC1C,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC,IAAc;AAAA,EACd,WAAAC,IAAW;AAAA,EACX,OAAAC,IAAO;AAAA,EACP,OAAAC,IAAO;AAAA,EACP,KAAAC,IAAK;AACP,MAAM;AACJ,QAAMC,IAAc,KAAK,KAAKV,IAASC,CAAK,IAAI,GAC1CU,IAAa,KAAK,KAAKT,IAAYD,CAAK,GACxCW,IAAaF,MAAgBC,GAE7BE,IAAgB,CAACC,MAAkB;AACvC,IAAAV,EAAU,CAAC,GACXD,EAAS,SAASW,CAAK,CAAC;AAAA,EAC1B,GAEMC,IAAa,MAAM;AACvB,QAAIC,IAAahB,IAASC;AAC1B,IAAIe,IAAa,MACfA,IAAa,IAEfZ,EAAUY,CAAU;AAAA,EACtB,GAEMC,IAAS,MAAM;AACnB,QAAID,IAAahB,IAASC;AAC1B,IAAIe,IAAad,MACfc,IAAad,IAAYD,IAE3BG,EAAUY,CAAU;AAAA,EACtB;AAEA,SACE,gBAAAE,EAAC,OAAA,EAAI,WAAU,gDACb,UAAA;AAAA,IAAA,gBAAAA,EAAC,OAAA,EAAI,WAAU,+BACb,UAAA;AAAA,MAAA,gBAAAC,EAAC,QAAA,EAAK,WAAU,uBAAuB,UAAAd,GAAa;AAAA,MACpD,gBAAAc;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,OAAOnB,GAAO,SAAA;AAAA,UACd,SAAS;AAAA,YACP,EAAE,OAAO,KAAK,OAAO,IAAA;AAAA,YACrB,EAAE,OAAO,MAAM,OAAO,KAAA;AAAA,YACtB,EAAE,OAAO,MAAM,OAAO,KAAA;AAAA,YACtB,EAAE,OAAO,MAAM,OAAO,KAAA;AAAA,YACtB,EAAE,OAAO,MAAM,OAAO,KAAA;AAAA,UAAK;AAAA,UAE7B,UAAUY;AAAA,UACV,aAAY;AAAA,UACZ,UAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IACZ,GACF;AAAA,IACA,gBAAAK,EAAC,OAAA,EAAI,WAAU,aACb,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,UAAU,CAACrB;AAAA,UACX,SAASe;AAAA,UAER,UAAAT;AAAA,QAAA;AAAA,MAAA;AAAA,MAEH,gBAAAa,EAAC,QAAA,EAAK,WAAU,WAAW,UAAA,GAAGZ,CAAK,IAAIG,CAAW,IAAID,CAAG,IAAIE,CAAU,IAAG;AAAA,MAC1E,gBAAAQ;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,UAAUT;AAAA,UACV,SAASK;AAAA,UAER,UAAAT;AAAA,QAAA;AAAA,MAAA;AAAA,IACH,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"TablePagination.js","sources":["../../src/TablePagination/TablePagination.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { Button } from '../Button';\r\nimport { Select } from '../Select';\r\nimport { FC } from 'react';\r\n\r\ninterface IProps {\r\n limit: number;\r\n offset: number;\r\n totalRows: number;\r\n setLimit: (limit: number) => void;\r\n setOffset: (offset: number) => void;\r\n tRowsPerPage?: string;\r\n tPrevious?: string;\r\n tPage?:string;\r\n tNext?:string;\r\n tOf?:string\r\n}\r\n\r\nexport const TablePagination: FC<IProps> = ({\r\n offset,\r\n limit,\r\n totalRows,\r\n setLimit,\r\n setOffset,\r\n tRowsPerPage= \"Rows per page\",\r\n tPrevious= \"Previous\",\r\n tPage= \"Page\",\r\n tNext= \"Next\",\r\n tOf= \"Of\",\r\n}) => {\r\n const currentPage = Math.ceil(offset / limit) + 1;\r\n const totalPages = Math.ceil(totalRows / limit);\r\n const isLastPage = currentPage === totalPages;\r\n\r\n const onChangeLimit = (value: string) => {\r\n setOffset(0);\r\n setLimit(parseInt(value));\r\n };\r\n\r\n const onPrevious = () => {\r\n let nextOffset = offset - limit;\r\n if (nextOffset < 0) {\r\n nextOffset = 0;\r\n }\r\n setOffset(nextOffset);\r\n };\r\n\r\n const onNext = () => {\r\n let nextOffset = offset + limit;\r\n if (nextOffset > totalRows) {\r\n nextOffset = totalRows - limit;\r\n }\r\n setOffset(nextOffset);\r\n };\r\n\r\n return (\r\n <div className=\"flex items-center justify-end space-x-2 py-4\">\r\n <div className=\"flex items-center space-x-2\">\r\n <span className=\"text-sm text-nowrap\">{tRowsPerPage}</span>\r\n <Select\r\n value={limit?.toString()}\r\n options={[\r\n { value: '5', label: '5' },\r\n { value: '10', label: '10' },\r\n { value: '20', label: '20' },\r\n { value: '30', label: '30' },\r\n { value: '50', label: '50' },\r\n ]}\r\n onChange={onChangeLimit}\r\n placeholder=\"6\"\r\n nullable={false}\r\n />\r\n </div>\r\n <div className=\"space-x-2\">\r\n <Button\r\n variant=\"outline\"\r\n size=\"sm\"\r\n disabled={!offset}\r\n onClick={onPrevious}\r\n >\r\n {tPrevious}\r\n </Button>\r\n <span className=\"text-sm\">{`${tPage} ${currentPage} ${tOf} ${totalPages}`}</span>\r\n <Button\r\n variant=\"outline\"\r\n size=\"sm\"\r\n disabled={isLastPage}\r\n onClick={onNext}\r\n >\r\n {tNext}\r\n </Button>\r\n </div>\r\n </div>\r\n );\r\n};\r\n"],"names":["TablePagination","offset","limit","totalRows","setLimit","setOffset","tRowsPerPage","tPrevious","tPage","tNext","tOf","currentPage","totalPages","isLastPage","onChangeLimit","value","onPrevious","nextOffset","onNext","jsxs","jsx","Select","Button"],"mappings":";;;AAmBO,MAAMA,IAA8B,CAAC;AAAA,EAC1C,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC,IAAc;AAAA,EACd,WAAAC,IAAW;AAAA,EACX,OAAAC,IAAO;AAAA,EACP,OAAAC,IAAO;AAAA,EACP,KAAAC,IAAK;AACP,MAAM;AACJ,QAAMC,IAAc,KAAK,KAAKV,IAASC,CAAK,IAAI,GAC1CU,IAAa,KAAK,KAAKT,IAAYD,CAAK,GACxCW,IAAaF,MAAgBC,GAE7BE,IAAgB,CAACC,MAAkB;AACvC,IAAAV,EAAU,CAAC,GACXD,EAAS,SAASW,CAAK,CAAC;AAAA,EAC1B,GAEMC,IAAa,MAAM;AACvB,QAAIC,IAAahB,IAASC;AAC1B,IAAIe,IAAa,MACfA,IAAa,IAEfZ,EAAUY,CAAU;AAAA,EACtB,GAEMC,IAAS,MAAM;AACnB,QAAID,IAAahB,IAASC;AAC1B,IAAIe,IAAad,MACfc,IAAad,IAAYD,IAE3BG,EAAUY,CAAU;AAAA,EACtB;AAEA,SACE,gBAAAE,EAAC,OAAA,EAAI,WAAU,gDACb,UAAA;AAAA,IAAA,gBAAAA,EAAC,OAAA,EAAI,WAAU,+BACb,UAAA;AAAA,MAAA,gBAAAC,EAAC,QAAA,EAAK,WAAU,uBAAuB,UAAAd,GAAa;AAAA,MACpD,gBAAAc;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,OAAOnB,GAAO,SAAA;AAAA,UACd,SAAS;AAAA,YACP,EAAE,OAAO,KAAK,OAAO,IAAA;AAAA,YACrB,EAAE,OAAO,MAAM,OAAO,KAAA;AAAA,YACtB,EAAE,OAAO,MAAM,OAAO,KAAA;AAAA,YACtB,EAAE,OAAO,MAAM,OAAO,KAAA;AAAA,YACtB,EAAE,OAAO,MAAM,OAAO,KAAA;AAAA,UAAK;AAAA,UAE7B,UAAUY;AAAA,UACV,aAAY;AAAA,UACZ,UAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IACZ,GACF;AAAA,IACA,gBAAAK,EAAC,OAAA,EAAI,WAAU,aACb,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,UAAU,CAACrB;AAAA,UACX,SAASe;AAAA,UAER,UAAAT;AAAA,QAAA;AAAA,MAAA;AAAA,MAEH,gBAAAa,EAAC,QAAA,EAAK,WAAU,WAAW,UAAA,GAAGZ,CAAK,IAAIG,CAAW,IAAID,CAAG,IAAIE,CAAU,IAAG;AAAA,MAC1E,gBAAAQ;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,UAAUT;AAAA,UACV,SAASK;AAAA,UAER,UAAAT;AAAA,QAAA;AAAA,MAAA;AAAA,IACH,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
package/Tabs/Tabs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.js","sources":["../../src/Tabs/Tabs.tsx"],"sourcesContent":["import { Children, FC, PropsWithChildren } from 'react';\n\nimport { TabsContent, TabsList, TabsRoot, TabsTrigger } from './TabsRoot';\nimport { TabsProps } from './Tabs.types';\n\nexport const TabRender: FC<TabsProps> = (props) => {\n const { tabs = [], contents } = props;\n return Children.map(contents, (child, index) => {\n if (!child || !tabs[index]) return null;\n const value = tabs[index]?.value;\n const props = child.props || {};\n return (\n <TabsContent key={value} value={value} {...props}>\n {child}\n </TabsContent>\n );\n });\n};\n\nexport const Tabs: FC<PropsWithChildren<TabsProps>> = (props) => {\n const { tab, tabs = [], onChange, children } = props;\n return (\n <TabsRoot value={tab} onValueChange={onChange}>\n <TabsList className=\"px-2 py-6 bg-[#E0E7FF] rounded-[6px]\">\n {tabs.map((tab) => (\n <TabsTrigger key={tab.value} value={tab.value} className=\"h-8\">\n {tab.label}\n </TabsTrigger>\n ))}\n </TabsList>\n {children}\n {!children && <TabRender {...props}/>}\n </TabsRoot>\n );\n};\n"],"names":["TabRender","props","tabs","contents","Children","child","index","value","TabsContent","Tabs","tab","onChange","children","jsxs","TabsRoot","jsx","TabsList","TabsTrigger"],"mappings":";;;AAKO,MAAMA,IAA2B,CAACC,MAAU;AACjD,QAAM,EAAE,MAAAC,IAAO,IAAI,UAAAC,MAAaF;AAChC,SAAOG,EAAS,IAAID,GAAU,CAACE,GAAOC,MAAU;AAC9C,QAAI,CAACD,KAAS,CAACH,EAAKI,CAAK,EAAG,QAAO;AACnC,UAAMC,IAAQL,EAAKI,CAAK,GAAG,OACrBL,IAAQI,EAAM,SAAS,CAAA;AAC7B,6BACGG,GAAA,EAAwB,OAAAD,GAAe,GAAGN,GACxC,eADeM,CAElB;AAAA,EAEJ,CAAC;AACH,GAEaE,IAAyC,CAACR,MAAU;AAC/D,QAAM,EAAE,KAAAS,GAAK,MAAAR,IAAO,CAAA,GAAI,UAAAS,GAAU,UAAAC,MAAaX;AAC/C,SACE,gBAAAY,EAACC,GAAA,EAAS,OAAOJ,GAAK,eAAeC,GACnC,UAAA;AAAA,IAAA,gBAAAI,EAACC,GAAA,EAAS,WAAU,wCACjB,UAAAd,EAAK,IAAI,CAACQ,wBACRO,GAAA,EAA4B,OAAOP,EAAI,OAAO,WAAU,OACtD,UAAAA,EAAI,SADWA,EAAI,KAEtB,CACD,EAAA,CACH;AAAA,IACCE;AAAA,IACA,CAACA,KAAY,gBAAAG,EAACf,GAAA,EAAW,GAAGC,EAAA,CAAM;AAAA,EAAA,GACrC;AAEJ;"}
1
+ {"version":3,"file":"Tabs.js","sources":["../../src/Tabs/Tabs.tsx"],"sourcesContent":["import { Children, FC, PropsWithChildren } from 'react';\r\n\r\nimport { TabsContent, TabsList, TabsRoot, TabsTrigger } from './TabsRoot';\r\nimport { TabsProps } from './Tabs.types';\r\n\r\nexport const TabRender: FC<TabsProps> = (props) => {\r\n const { tabs = [], contents } = props;\r\n return Children.map(contents, (child, index) => {\r\n if (!child || !tabs[index]) return null;\r\n const value = tabs[index]?.value;\r\n const props = child.props || {};\r\n return (\r\n <TabsContent key={value} value={value} {...props}>\r\n {child}\r\n </TabsContent>\r\n );\r\n });\r\n};\r\n\r\nexport const Tabs: FC<PropsWithChildren<TabsProps>> = (props) => {\r\n const { tab, tabs = [], onChange, children } = props;\r\n return (\r\n <TabsRoot value={tab} onValueChange={onChange}>\r\n <TabsList className=\"px-2 py-6 bg-[#E0E7FF] rounded-[6px]\">\r\n {tabs.map((tab) => (\r\n <TabsTrigger key={tab.value} value={tab.value} className=\"h-8\">\r\n {tab.label}\r\n </TabsTrigger>\r\n ))}\r\n </TabsList>\r\n {children}\r\n {!children && <TabRender {...props}/>}\r\n </TabsRoot>\r\n );\r\n};\r\n"],"names":["TabRender","props","tabs","contents","Children","child","index","value","TabsContent","Tabs","tab","onChange","children","jsxs","TabsRoot","jsx","TabsList","TabsTrigger"],"mappings":";;;AAKO,MAAMA,IAA2B,CAACC,MAAU;AACjD,QAAM,EAAE,MAAAC,IAAO,IAAI,UAAAC,MAAaF;AAChC,SAAOG,EAAS,IAAID,GAAU,CAACE,GAAOC,MAAU;AAC9C,QAAI,CAACD,KAAS,CAACH,EAAKI,CAAK,EAAG,QAAO;AACnC,UAAMC,IAAQL,EAAKI,CAAK,GAAG,OACrBL,IAAQI,EAAM,SAAS,CAAA;AAC7B,6BACGG,GAAA,EAAwB,OAAAD,GAAe,GAAGN,GACxC,eADeM,CAElB;AAAA,EAEJ,CAAC;AACH,GAEaE,IAAyC,CAACR,MAAU;AAC/D,QAAM,EAAE,KAAAS,GAAK,MAAAR,IAAO,CAAA,GAAI,UAAAS,GAAU,UAAAC,MAAaX;AAC/C,SACE,gBAAAY,EAACC,GAAA,EAAS,OAAOJ,GAAK,eAAeC,GACnC,UAAA;AAAA,IAAA,gBAAAI,EAACC,GAAA,EAAS,WAAU,wCACjB,UAAAd,EAAK,IAAI,CAACQ,wBACRO,GAAA,EAA4B,OAAOP,EAAI,OAAO,WAAU,OACtD,UAAAA,EAAI,SADWA,EAAI,KAEtB,CACD,EAAA,CACH;AAAA,IACCE;AAAA,IACA,CAACA,KAAY,gBAAAG,EAACf,GAAA,EAAW,GAAGC,EAAA,CAAM;AAAA,EAAA,GACrC;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TabsRoot.js","sources":["../../src/Tabs/TabsRoot.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\"\n\nimport { cn } from \"@oneplatformdev/utils\";\n\nconst TabsRoot = TabsPrimitive.Root\n\nconst TabsList = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.List\n ref={ref}\n className={cn(\n \"inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground\",\n className\n )}\n {...props}\n />\n))\nTabsList.displayName = TabsPrimitive.List.displayName\n\nconst TabsTrigger = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Trigger\n ref={ref}\n className={cn(\n \"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm\",\n className\n )}\n {...props}\n />\n))\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName\n\nconst TabsContent = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\n>(({ className, ...props }, ref) => (\n <TabsPrimitive.Content\n ref={ref}\n className={cn(\n \"mt-2 ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n className\n )}\n {...props}\n />\n))\nTabsContent.displayName = TabsPrimitive.Content.displayName\n\nexport { TabsRoot, TabsList, TabsTrigger, TabsContent }\n"],"names":["TabsRoot","TabsPrimitive","TabsList","React","className","props","ref","jsx","cn","TabsTrigger","TabsContent"],"mappings":";;;;AAOA,MAAMA,IAAWC,EAAc,MAEzBC,IAAWC,EAAM,WAGrB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAc;AAAA,EAAd;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDH,EAAS,cAAcD,EAAc,KAAK;AAE1C,MAAMQ,IAAcN,EAAM,WAGxB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAc;AAAA,EAAd;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDI,EAAY,cAAcR,EAAc,QAAQ;AAEhD,MAAMS,IAAcP,EAAM,WAGxB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAc;AAAA,EAAd;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDK,EAAY,cAAcT,EAAc,QAAQ;"}
1
+ {"version":3,"file":"TabsRoot.js","sources":["../../src/Tabs/TabsRoot.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\"\r\n\r\nimport { cn } from \"@oneplatformdev/utils\";\r\n\r\nconst TabsRoot = TabsPrimitive.Root\r\n\r\nconst TabsList = React.forwardRef<\r\n React.ElementRef<typeof TabsPrimitive.List>,\r\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>\r\n>(({ className, ...props }, ref) => (\r\n <TabsPrimitive.List\r\n ref={ref}\r\n className={cn(\r\n \"inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n))\r\nTabsList.displayName = TabsPrimitive.List.displayName\r\n\r\nconst TabsTrigger = React.forwardRef<\r\n React.ElementRef<typeof TabsPrimitive.Trigger>,\r\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\r\n>(({ className, ...props }, ref) => (\r\n <TabsPrimitive.Trigger\r\n ref={ref}\r\n className={cn(\r\n \"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n))\r\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName\r\n\r\nconst TabsContent = React.forwardRef<\r\n React.ElementRef<typeof TabsPrimitive.Content>,\r\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\r\n>(({ className, ...props }, ref) => (\r\n <TabsPrimitive.Content\r\n ref={ref}\r\n className={cn(\r\n \"mt-2 ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n))\r\nTabsContent.displayName = TabsPrimitive.Content.displayName\r\n\r\nexport { TabsRoot, TabsList, TabsTrigger, TabsContent }\r\n"],"names":["TabsRoot","TabsPrimitive","TabsList","React","className","props","ref","jsx","cn","TabsTrigger","TabsContent"],"mappings":";;;;AAOA,MAAMA,IAAWC,EAAc,MAEzBC,IAAWC,EAAM,WAGrB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAc;AAAA,EAAd;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDH,EAAS,cAAcD,EAAc,KAAK;AAE1C,MAAMQ,IAAcN,EAAM,WAGxB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAc;AAAA,EAAd;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDI,EAAY,cAAcR,EAAc,QAAQ;AAEhD,MAAMS,IAAcP,EAAM,WAGxB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAc;AAAA,EAAd;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDK,EAAY,cAAcT,EAAc,QAAQ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../src/Textarea/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,QAAA,MAAM,QAAQ,wGAmEb,CAAC;AAGF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../src/Textarea/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,QAAA,MAAM,QAAQ,wGA2Eb,CAAC;AAGF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -1,73 +1,78 @@
1
- import { jsxs as l, Fragment as p, jsx as b } from "react/jsx-runtime";
2
- import * as h from "react";
3
- import { useId as A, useRef as v, useState as w, useImperativeHandle as z, useEffect as F } from "react";
4
- import { cn as d } from "@oneplatformdev/utils";
5
- import { useAutosizeTextArea as N } from "./useAutosizeTextArea.js";
6
- const y = h.forwardRef(
7
- (u, m) => {
1
+ import { jsxs as d, Fragment as v, jsx as A } from "react/jsx-runtime";
2
+ import * as w from "react";
3
+ import { useId as y, useRef as z, useState as F, useImperativeHandle as N, useEffect as T } from "react";
4
+ import { cn as f } from "@oneplatformdev/utils";
5
+ import { useAutosizeTextArea as C } from "./useAutosizeTextArea.js";
6
+ const R = w.forwardRef(
7
+ (m, c) => {
8
8
  const {
9
- className: c,
10
- value: t = "",
11
- maxHeight: o = Number.MAX_SAFE_INTEGER,
9
+ className: g,
10
+ value: r = "",
11
+ maxHeight: a = Number.MAX_SAFE_INTEGER,
12
12
  minHeight: i = 40,
13
- resizeble: f = !0,
13
+ resizeble: x = !1,
14
14
  counter: s = !1,
15
15
  id: n = "",
16
- ...r
17
- } = u, a = A(), e = v(null), [x, g] = w("");
18
- return N({
19
- textAreaRef: e,
20
- triggerAutoSize: x,
21
- maxHeight: o,
16
+ onChange: p,
17
+ onTransform: l,
18
+ ...o
19
+ } = m, u = y(), t = z(null), [b, h] = F("");
20
+ return C({
21
+ textAreaRef: t,
22
+ triggerAutoSize: b,
23
+ maxHeight: a,
22
24
  minHeight: i
23
- }), z(m, () => ({
24
- ...e.current ?? {},
25
- textArea: e.current,
26
- focus: () => e?.current?.focus(),
27
- maxHeight: o,
25
+ }), N(c, () => ({
26
+ ...t.current ?? {},
27
+ textArea: t.current,
28
+ focus: () => t?.current?.focus(),
29
+ maxHeight: a,
28
30
  minHeight: i
29
- })), F(() => {
30
- g(t);
31
- }, [r?.defaultValue, t]), /* @__PURE__ */ l(p, { children: [
32
- /* @__PURE__ */ b(
31
+ })), T(() => {
32
+ h(r);
33
+ }, [o?.defaultValue, r]), /* @__PURE__ */ d(v, { children: [
34
+ /* @__PURE__ */ A(
33
35
  "textarea",
34
36
  {
35
- id: n || a,
36
- ...r,
37
- ref: e,
38
- value: t,
39
- className: d(
37
+ id: n || u,
38
+ ...o,
39
+ ref: t,
40
+ value: r,
41
+ onChange: (e) => {
42
+ typeof l?.(e.target.value, e) == "string" && (e.target.value = l(e.target.value, e)), p?.(e);
43
+ },
44
+ className: f(
40
45
  "flex min-h-10 w-full px-3 py-2 text-base relative md:text-sm",
41
46
  "rounded-lg border border-input bg-[#FCFCFC] shadow-none",
42
47
  "placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
43
48
  "focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring",
44
- f ? "resize" : "resize-none overflow-hidden!",
45
- s && "pb-2",
46
- c
49
+ x ? "resize" : "resize-none overflow-hidden!",
50
+ s && "pb-1",
51
+ g
47
52
  )
48
53
  }
49
54
  ),
50
- s && /* @__PURE__ */ l(
55
+ s && /* @__PURE__ */ d(
51
56
  "label",
52
57
  {
53
- htmlFor: n || a,
54
- className: d(
58
+ htmlFor: n || u,
59
+ className: f(
55
60
  "w-full text-right inline-flex items-center justify-end",
56
- "text-sm font-normal text-muted-foreground",
57
- "leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
61
+ "text-xs font-medium leading-[1.2] text-muted-foreground",
62
+ "peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
58
63
  ),
59
64
  children: [
60
- String(t || "").length,
65
+ String(r || "").length,
61
66
  " / ",
62
- r?.maxLength
67
+ o?.maxLength
63
68
  ]
64
69
  }
65
70
  )
66
71
  ] });
67
72
  }
68
73
  );
69
- y.displayName = "Textarea";
74
+ R.displayName = "Textarea";
70
75
  export {
71
- y as Textarea
76
+ R as Textarea
72
77
  };
73
78
  //# sourceMappingURL=Textarea.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.js","sources":["../../src/Textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useEffect, useId, useImperativeHandle, useRef, useState } from 'react';\nimport { cn } from '@oneplatformdev/utils';\n\nimport { TextareaProps } from './Textarea.types';\nimport { useAutosizeTextArea } from './useAutosizeTextArea';\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n (textareaProps, ref) => {\n const {\n className,\n value = '',\n maxHeight = Number.MAX_SAFE_INTEGER,\n minHeight = 40,\n resizeble = true,\n counter = false,\n id: customId = '',\n ...props\n } = textareaProps;\n const id = useId();\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\n const [triggerAutoSize, setTriggerAutoSize] = useState('');\n\n useAutosizeTextArea({\n textAreaRef,\n triggerAutoSize: triggerAutoSize,\n maxHeight,\n minHeight,\n });\n\n useImperativeHandle(ref, () => ({\n ...((textAreaRef.current ?? {}) as HTMLTextAreaElement),\n textArea: textAreaRef.current as HTMLTextAreaElement,\n focus: () => textAreaRef?.current?.focus(),\n maxHeight,\n minHeight,\n }));\n\n useEffect(() => {\n setTriggerAutoSize(value as string);\n }, [props?.defaultValue, value]);\n\n return (\n <>\n <textarea\n id={customId || id}\n {...props}\n ref={textAreaRef}\n value={value}\n className={cn(\n 'flex min-h-10 w-full px-3 py-2 text-base relative md:text-sm',\n 'rounded-lg border border-input bg-[#FCFCFC] shadow-none',\n 'placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',\n 'focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring',\n resizeble ? 'resize' : 'resize-none overflow-hidden!',\n counter && 'pb-2',\n className\n )}\n />\n {counter && (\n <label\n htmlFor={customId || id}\n className={cn(\n 'w-full text-right inline-flex items-center justify-end',\n 'text-sm font-normal text-muted-foreground',\n 'leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70'\n )}\n >\n {String(value || '').length} / {props?.maxLength}\n </label>\n )}\n </>\n );\n }\n);\nTextarea.displayName = 'Textarea';\n\nexport { Textarea };\n"],"names":["Textarea","React","textareaProps","ref","className","value","maxHeight","minHeight","resizeble","counter","customId","props","id","useId","textAreaRef","useRef","triggerAutoSize","setTriggerAutoSize","useState","useAutosizeTextArea","useImperativeHandle","useEffect","jsxs","Fragment","jsx","cn"],"mappings":";;;;;AAOA,MAAMA,IAAWC,EAAM;AAAA,EACrB,CAACC,GAAeC,MAAQ;AACtB,UAAM;AAAA,MACJ,WAAAC;AAAA,MACA,OAAAC,IAAQ;AAAA,MACR,WAAAC,IAAY,OAAO;AAAA,MACnB,WAAAC,IAAY;AAAA,MACZ,WAAAC,IAAY;AAAA,MACZ,SAAAC,IAAU;AAAA,MACV,IAAIC,IAAW;AAAA,MACf,GAAGC;AAAA,IAAA,IACDT,GACEU,IAAKC,EAAA,GACLC,IAAcC,EAAmC,IAAI,GACrD,CAACC,GAAiBC,CAAkB,IAAIC,EAAS,EAAE;AAEzD,WAAAC,EAAoB;AAAA,MAClB,aAAAL;AAAA,MACA,iBAAAE;AAAA,MACA,WAAAV;AAAA,MACA,WAAAC;AAAA,IAAA,CACD,GAEDa,EAAoBjB,GAAK,OAAO;AAAA,MAC9B,GAAKW,EAAY,WAAW,CAAA;AAAA,MAC5B,UAAUA,EAAY;AAAA,MACtB,OAAO,MAAMA,GAAa,SAAS,MAAA;AAAA,MACnC,WAAAR;AAAA,MACA,WAAAC;AAAA,IAAA,EACA,GAEFc,EAAU,MAAM;AACd,MAAAJ,EAAmBZ,CAAe;AAAA,IACpC,GAAG,CAACM,GAAO,cAAcN,CAAK,CAAC,GAG7B,gBAAAiB,EAAAC,GAAA,EACE,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,IAAId,KAAYE;AAAA,UACf,GAAGD;AAAA,UACJ,KAAKG;AAAA,UACL,OAAAT;AAAA,UACA,WAAWoB;AAAA,YACT;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACAjB,IAAY,WAAW;AAAA,YACvBC,KAAW;AAAA,YACXL;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,MAEDK,KACC,gBAAAa;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,SAASZ,KAAYE;AAAA,UACrB,WAAWa;AAAA,YACT;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,UAGD,UAAA;AAAA,YAAA,OAAOpB,KAAS,EAAE,EAAE;AAAA,YAAO;AAAA,YAAIM,GAAO;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACzC,GAEJ;AAAA,EAEJ;AACF;AACAX,EAAS,cAAc;"}
1
+ {"version":3,"file":"Textarea.js","sources":["../../src/Textarea/Textarea.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport { useEffect, useId, useImperativeHandle, useRef, useState } from 'react';\r\nimport { cn } from '@oneplatformdev/utils';\r\n\r\nimport { TextareaProps } from './Textarea.types';\r\nimport { useAutosizeTextArea } from './useAutosizeTextArea';\r\n\r\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\r\n (textareaProps, ref) => {\r\n const {\r\n className,\r\n value = '',\r\n maxHeight = Number.MAX_SAFE_INTEGER,\r\n minHeight = 40,\r\n resizeble = false,\r\n counter = false,\r\n id: customId = '',\r\n onChange,\r\n onTransform,\r\n ...props\r\n } = textareaProps;\r\n const id = useId();\r\n const textAreaRef = useRef<HTMLTextAreaElement | null>(null);\r\n const [triggerAutoSize, setTriggerAutoSize] = useState('');\r\n\r\n useAutosizeTextArea({\r\n textAreaRef,\r\n triggerAutoSize: triggerAutoSize,\r\n maxHeight,\r\n minHeight,\r\n });\r\n\r\n useImperativeHandle(ref, () => ({\r\n ...((textAreaRef.current ?? {}) as HTMLTextAreaElement),\r\n textArea: textAreaRef.current as HTMLTextAreaElement,\r\n focus: () => textAreaRef?.current?.focus(),\r\n maxHeight,\r\n minHeight,\r\n }));\r\n\r\n useEffect(() => {\r\n setTriggerAutoSize(value as string);\r\n }, [props?.defaultValue, value]);\r\n\r\n return (\r\n <>\r\n <textarea\r\n id={customId || id}\r\n {...props}\r\n ref={textAreaRef}\r\n value={value}\r\n onChange={(e) => {\r\n if (typeof onTransform?.(e.target.value, e) === 'string') {\r\n e.target.value = onTransform(e.target.value, e);\r\n }\r\n onChange?.(e);\r\n }}\r\n className={cn(\r\n 'flex min-h-10 w-full px-3 py-2 text-base relative md:text-sm',\r\n 'rounded-lg border border-input bg-[#FCFCFC] shadow-none',\r\n 'placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50',\r\n 'focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring',\r\n resizeble ? 'resize' : 'resize-none overflow-hidden!',\r\n counter && 'pb-1',\r\n className\r\n )}\r\n />\r\n {counter && (\r\n <label\r\n htmlFor={customId || id}\r\n className={cn(\r\n 'w-full text-right inline-flex items-center justify-end',\r\n 'text-xs font-medium leading-[1.2] text-muted-foreground',\r\n 'peer-disabled:cursor-not-allowed peer-disabled:opacity-70'\r\n )}\r\n >\r\n {String(value || '').length} / {props?.maxLength}\r\n </label>\r\n )}\r\n </>\r\n );\r\n }\r\n);\r\nTextarea.displayName = 'Textarea';\r\n\r\nexport { Textarea };\r\n"],"names":["Textarea","React","textareaProps","ref","className","value","maxHeight","minHeight","resizeble","counter","customId","onChange","onTransform","props","id","useId","textAreaRef","useRef","triggerAutoSize","setTriggerAutoSize","useState","useAutosizeTextArea","useImperativeHandle","useEffect","jsxs","Fragment","jsx","cn"],"mappings":";;;;;AAOA,MAAMA,IAAWC,EAAM;AAAA,EACrB,CAACC,GAAeC,MAAQ;AACtB,UAAM;AAAA,MACJ,WAAAC;AAAA,MACA,OAAAC,IAAQ;AAAA,MACR,WAAAC,IAAY,OAAO;AAAA,MACnB,WAAAC,IAAY;AAAA,MACZ,WAAAC,IAAY;AAAA,MACZ,SAAAC,IAAU;AAAA,MACV,IAAIC,IAAW;AAAA,MACf,UAAAC;AAAA,MACA,aAAAC;AAAA,MACA,GAAGC;AAAA,IAAA,IACDX,GACEY,IAAKC,EAAA,GACLC,IAAcC,EAAmC,IAAI,GACrD,CAACC,GAAiBC,CAAkB,IAAIC,EAAS,EAAE;AAEzD,WAAAC,EAAoB;AAAA,MAClB,aAAAL;AAAA,MACA,iBAAAE;AAAA,MACA,WAAAZ;AAAA,MACA,WAAAC;AAAA,IAAA,CACD,GAEDe,EAAoBnB,GAAK,OAAO;AAAA,MAC9B,GAAKa,EAAY,WAAW,CAAA;AAAA,MAC5B,UAAUA,EAAY;AAAA,MACtB,OAAO,MAAMA,GAAa,SAAS,MAAA;AAAA,MACnC,WAAAV;AAAA,MACA,WAAAC;AAAA,IAAA,EACA,GAEFgB,EAAU,MAAM;AACd,MAAAJ,EAAmBd,CAAe;AAAA,IACpC,GAAG,CAACQ,GAAO,cAAcR,CAAK,CAAC,GAG7B,gBAAAmB,EAAAC,GAAA,EACE,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,IAAIhB,KAAYI;AAAA,UACf,GAAGD;AAAA,UACJ,KAAKG;AAAA,UACL,OAAAX;AAAA,UACA,UAAU,CAAC,MAAM;AACf,YAAI,OAAOO,IAAc,EAAE,OAAO,OAAO,CAAC,KAAM,aAC9C,EAAE,OAAO,QAAQA,EAAY,EAAE,OAAO,OAAO,CAAC,IAEhDD,IAAW,CAAC;AAAA,UACd;AAAA,UACA,WAAWgB;AAAA,YACT;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACAnB,IAAY,WAAW;AAAA,YACvBC,KAAW;AAAA,YACXL;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,MAEDK,KACC,gBAAAe;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,SAASd,KAAYI;AAAA,UACrB,WAAWa;AAAA,YACT;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,UAGD,UAAA;AAAA,YAAA,OAAOtB,KAAS,EAAE,EAAE;AAAA,YAAO;AAAA,YAAIQ,GAAO;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACzC,GAEJ;AAAA,EAEJ;AACF;AACAb,EAAS,cAAc;"}
@@ -1,6 +1,6 @@
1
1
  import { Textarea as t } from "./Textarea.js";
2
2
  const a = {
3
- title: "Textarea",
3
+ title: "Input/Textarea",
4
4
  component: t
5
5
  }, o = {
6
6
  args: {}
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.stories.js","sources":["../../src/Textarea/Textarea.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from '@storybook/react-vite';\n\nimport { Textarea } from './Textarea';\n\nconst meta = {\n title: 'Textarea',\n component: Textarea,\n} satisfies Meta<typeof Textarea>;\n\nexport default meta;\n\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {\n args: {}\n};\n"],"names":["meta","Textarea","Default"],"mappings":";AAIA,MAAMA,IAAO;AAAA,EACX,OAAO;AAAA,EACP,WAAWC;AACb,GAMaC,IAAiB;AAAA,EAC5B,MAAM,CAAA;AACR;"}
1
+ {"version":3,"file":"Textarea.stories.js","sources":["../../src/Textarea/Textarea.stories.tsx"],"sourcesContent":["import type { Meta, StoryObj } from '@storybook/react-vite';\r\n\r\nimport { Textarea } from './Textarea';\r\n\r\nconst meta = {\r\n title: 'Input/Textarea',\r\n component: Textarea,\r\n} satisfies Meta<typeof Textarea>;\r\n\r\nexport default meta;\r\n\r\ntype Story = StoryObj<typeof meta>;\r\n\r\nexport const Default: Story = {\r\n args: {}\r\n};\r\n"],"names":["meta","Textarea","Default"],"mappings":";AAIA,MAAMA,IAAO;AAAA,EACX,OAAO;AAAA,EACP,WAAWC;AACb,GAMaC,IAAiB;AAAA,EAC5B,MAAM,CAAA;AACR;"}
@@ -1,4 +1,4 @@
1
- import { ComponentProps, RefObject } from 'react';
1
+ import { ChangeEvent, ComponentProps, RefObject } from 'react';
2
2
  export interface IUseAutosizeTextAreaProps {
3
3
  textAreaRef: RefObject<HTMLTextAreaElement | null>;
4
4
  triggerAutoSize: string;
@@ -14,5 +14,7 @@ export interface IUseAutosizeTextAreaProps {
14
14
  export interface TextareaProps extends ComponentProps<'textarea'>, Pick<IUseAutosizeTextAreaProps, 'minHeight' | 'maxHeight'> {
15
15
  resizeble?: boolean;
16
16
  counter?: boolean;
17
+ /** func transform event.target.value before onChange event call*/
18
+ onTransform?: (value: string, event: ChangeEvent<HTMLInputElement>) => string;
17
19
  }
18
20
  //# sourceMappingURL=Textarea.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.types.d.ts","sourceRoot":"","sources":["../../src/Textarea/Textarea.types.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElD,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACnD,eAAe,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aACf,SAAQ,cAAc,CAAC,UAAU,CAAC,EAChC,IAAI,CAAC,yBAAyB,EAAE,WAAW,GAAG,WAAW,CAAC;IAC5D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
1
+ {"version":3,"file":"Textarea.types.d.ts","sourceRoot":"","sources":["../../src/Textarea/Textarea.types.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE/D,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,SAAS,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACnD,eAAe,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aACf,SAAQ,cAAc,CAAC,UAAU,CAAC,EAChC,IAAI,CAAC,yBAAyB,EAAE,WAAW,GAAG,WAAW,CAAC;IAC5D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kEAAkE;IAClE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,MAAM,CAAC;CAC/E"}
@@ -1 +1 @@
1
- {"version":3,"file":"useAutosizeTextArea.js","sources":["../../src/Textarea/useAutosizeTextArea.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { IUseAutosizeTextAreaProps } from './Textarea.types';\n\nexport const useAutosizeTextArea = ({\n textAreaRef,\n triggerAutoSize,\n maxHeight = Number.MAX_SAFE_INTEGER,\n minHeight = 0,\n}: IUseAutosizeTextAreaProps) => {\n const [init, setInit] = React.useState(true);\n React.useEffect(() => {\n const offsetBorder = 0;\n const textAreaElement = textAreaRef.current;\n if (textAreaElement) {\n if (init) {\n textAreaElement.style.minHeight = `${minHeight + offsetBorder}px`;\n if (maxHeight > minHeight) {\n textAreaElement.style.maxHeight = `${maxHeight}px`;\n }\n setInit(false);\n }\n textAreaElement.style.height = `${minHeight + offsetBorder}px`;\n const scrollHeight = textAreaElement.scrollHeight;\n if (scrollHeight > maxHeight) {\n textAreaElement.style.height = `${maxHeight}px`;\n } else {\n textAreaElement.style.height = `${scrollHeight + offsetBorder}px`;\n }\n }\n }, [textAreaRef.current, triggerAutoSize]);\n};\n"],"names":["useAutosizeTextArea","textAreaRef","triggerAutoSize","maxHeight","minHeight","init","setInit","React","textAreaElement","scrollHeight"],"mappings":";AAKO,MAAMA,IAAsB,CAAC;AAAA,EAClC,aAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC,IAAY,OAAO;AAAA,EACnB,WAAAC,IAAY;AACd,MAAiC;AAC/B,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAM,SAAS,EAAI;AAC3C,EAAAA,EAAM,UAAU,MAAM;AAEpB,UAAMC,IAAkBP,EAAY;AACpC,QAAIO,GAAiB;AACnB,MAAIH,MACFG,EAAgB,MAAM,YAAY,GAAGJ,IAAY,CAAY,MACzDD,IAAYC,MACdI,EAAgB,MAAM,YAAY,GAAGL,CAAS,OAEhDG,EAAQ,EAAK,IAEfE,EAAgB,MAAM,SAAS,GAAGJ,IAAY,CAAY;AAC1D,YAAMK,IAAeD,EAAgB;AACrC,MAAIC,IAAeN,IACjBK,EAAgB,MAAM,SAAS,GAAGL,CAAS,OAE3CK,EAAgB,MAAM,SAAS,GAAGC,IAAe,CAAY;AAAA,IAEjE;AAAA,EACF,GAAG,CAACR,EAAY,SAASC,CAAe,CAAC;AAC3C;"}
1
+ {"version":3,"file":"useAutosizeTextArea.js","sources":["../../src/Textarea/useAutosizeTextArea.ts"],"sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\nimport { IUseAutosizeTextAreaProps } from './Textarea.types';\r\n\r\nexport const useAutosizeTextArea = ({\r\n textAreaRef,\r\n triggerAutoSize,\r\n maxHeight = Number.MAX_SAFE_INTEGER,\r\n minHeight = 0,\r\n}: IUseAutosizeTextAreaProps) => {\r\n const [init, setInit] = React.useState(true);\r\n React.useEffect(() => {\r\n const offsetBorder = 0;\r\n const textAreaElement = textAreaRef.current;\r\n if (textAreaElement) {\r\n if (init) {\r\n textAreaElement.style.minHeight = `${minHeight + offsetBorder}px`;\r\n if (maxHeight > minHeight) {\r\n textAreaElement.style.maxHeight = `${maxHeight}px`;\r\n }\r\n setInit(false);\r\n }\r\n textAreaElement.style.height = `${minHeight + offsetBorder}px`;\r\n const scrollHeight = textAreaElement.scrollHeight;\r\n if (scrollHeight > maxHeight) {\r\n textAreaElement.style.height = `${maxHeight}px`;\r\n } else {\r\n textAreaElement.style.height = `${scrollHeight + offsetBorder}px`;\r\n }\r\n }\r\n }, [textAreaRef.current, triggerAutoSize]);\r\n};\r\n"],"names":["useAutosizeTextArea","textAreaRef","triggerAutoSize","maxHeight","minHeight","init","setInit","React","textAreaElement","scrollHeight"],"mappings":";AAKO,MAAMA,IAAsB,CAAC;AAAA,EAClC,aAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC,IAAY,OAAO;AAAA,EACnB,WAAAC,IAAY;AACd,MAAiC;AAC/B,QAAM,CAACC,GAAMC,CAAO,IAAIC,EAAM,SAAS,EAAI;AAC3C,EAAAA,EAAM,UAAU,MAAM;AAEpB,UAAMC,IAAkBP,EAAY;AACpC,QAAIO,GAAiB;AACnB,MAAIH,MACFG,EAAgB,MAAM,YAAY,GAAGJ,IAAY,CAAY,MACzDD,IAAYC,MACdI,EAAgB,MAAM,YAAY,GAAGL,CAAS,OAEhDG,EAAQ,EAAK,IAEfE,EAAgB,MAAM,SAAS,GAAGJ,IAAY,CAAY;AAC1D,YAAMK,IAAeD,EAAgB;AACrC,MAAIC,IAAeN,IACjBK,EAAgB,MAAM,SAAS,GAAGL,CAAS,OAE3CK,EAAgB,MAAM,SAAS,GAAGC,IAAe,CAAY;AAAA,IAEjE;AAAA,EACF,GAAG,CAACR,EAAY,SAASC,CAAe,CAAC;AAC3C;"}
@@ -3,7 +3,6 @@ import * as d from "react";
3
3
  import { Moon as h, Sun as u, SunMoon as p } from "lucide-react";
4
4
  import { useTheme as l } from "next-themes";
5
5
  import { Button as g } from "../Button/Button.js";
6
- import "../Button/buttonVariants.js";
7
6
  import { DropdownMenu as T, DropdownMenuTrigger as f, DropdownMenuContent as M, DropdownMenuItem as k } from "../DropdownMenu/DropdownMenu.js";
8
7
  const y = {
9
8
  system: p,
@@ -20,7 +19,7 @@ const y = {
20
19
  ),
21
20
  /* @__PURE__ */ e("span", { className: "sr-only", children: "Toggle theme" })
22
21
  ] });
23
- }, I = (r) => {
22
+ }, v = (r) => {
24
23
  const {
25
24
  lightLabel: o = "Light",
26
25
  darkLabel: a = "Dark",
@@ -43,7 +42,7 @@ const y = {
43
42
  ] });
44
43
  };
45
44
  export {
46
- I as ThemeModeToggle,
47
- I as default
45
+ v as ThemeModeToggle,
46
+ v as default
48
47
  };
49
48
  //# sourceMappingURL=ThemeModeToggle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeModeToggle.js","sources":["../../src/Theme/ThemeModeToggle.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { Moon, Sun, SunMoon, LucideIcon } from \"lucide-react\"\nimport { useTheme } from \"next-themes\"\n\nimport { Button } from \"../Button\"\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"../DropdownMenu\";\n\nconst iconByTheme: Record<'system' | 'light' | 'dark', LucideIcon> = {\n 'system': SunMoon,\n 'light': Sun,\n 'dark': Moon,\n}\n\nconst RenderThemeIcon: React.FC = () => {\n const { theme = 'system' } = useTheme()\n const ThemeIcon = React.useMemo(() => iconByTheme[theme as 'system' | 'light' | 'dark'], [theme])\n return (\n <>\n <ThemeIcon\n className=\"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0 text-[currentColor] dar:fill-current\"\n />\n <span className=\"sr-only\">Toggle theme</span>\n </>\n )\n}\n\nexport interface ThemeModeToggleProps {\n lightLabel?: string;\n darkLabel?: string;\n systemLabel?: string;\n}\n\nexport const ThemeModeToggle: React.FC<ThemeModeToggleProps> = (props) => {\n const {\n lightLabel = 'Light',\n darkLabel = 'Dark',\n systemLabel = 'System',\n } = props;\n const { setTheme } = useTheme()\n\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button variant=\"outline\" size=\"icon\">\n <RenderThemeIcon/>\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {[\n {value: 'system', label: systemLabel},\n {value: 'light', label: lightLabel},\n {value: 'dark', label: darkLabel},\n ].map(({ value, label }) => (\n <DropdownMenuItem\n key={value}\n onClick={() => setTheme(value)}\n >\n {label}\n </DropdownMenuItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n\nexport default ThemeModeToggle\n"],"names":["iconByTheme","SunMoon","Sun","Moon","RenderThemeIcon","theme","useTheme","ThemeIcon","React","jsxs","Fragment","jsx","ThemeModeToggle","props","lightLabel","darkLabel","systemLabel","setTheme","DropdownMenu","DropdownMenuTrigger","Button","DropdownMenuContent","value","label","DropdownMenuItem"],"mappings":";;;;;;;AAYA,MAAMA,IAA+D;AAAA,EACnE,QAAUC;AAAA,EACV,OAASC;AAAA,EACT,MAAQC;AACV,GAEMC,IAA4B,MAAM;AACtC,QAAM,EAAE,OAAAC,IAAQ,SAAA,IAAaC,EAAA,GACvBC,IAAaC,EAAM,QAAQ,MAAMR,EAAYK,CAAoC,GAAG,CAACA,CAAK,CAAC;AACjG,SACE,gBAAAI,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACJ;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,IAEZ,gBAAAI,EAAC,QAAA,EAAK,WAAU,WAAU,UAAA,eAAA,CAAY;AAAA,EAAA,GACxC;AAEJ,GAQaC,IAAkD,CAACC,MAAU;AACxE,QAAM;AAAA,IACJ,YAAAC,IAAa;AAAA,IACb,WAAAC,IAAY;AAAA,IACZ,aAAAC,IAAc;AAAA,EAAA,IACZH,GACE,EAAE,UAAAI,EAAA,IAAaX,EAAA;AAErB,2BACGY,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAP,EAACQ,GAAA,EAAoB,SAAO,IAC1B,UAAA,gBAAAR,EAACS,GAAA,EAAO,SAAQ,WAAU,MAAK,QAC7B,UAAA,gBAAAT,EAACP,GAAA,CAAA,CAAe,EAAA,CAClB,GACF;AAAA,IACA,gBAAAO,EAACU,GAAA,EAAoB,OAAM,OACxB,UAAA;AAAA,MACC,EAAC,OAAO,UAAU,OAAOL,EAAA;AAAA,MACzB,EAAC,OAAO,SAAS,OAAOF,EAAA;AAAA,MACxB,EAAC,OAAO,QAAQ,OAAOC,EAAA;AAAA,IAAS,EAChC,IAAI,CAAC,EAAE,OAAAO,GAAO,OAAAC,QACd,gBAAAZ;AAAA,MAACa;AAAA,MAAA;AAAA,QAEC,SAAS,MAAMP,EAASK,CAAK;AAAA,QAE5B,UAAAC;AAAA,MAAA;AAAA,MAHID;AAAA,IAAA,CAKR,EAAA,CACH;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"ThemeModeToggle.js","sources":["../../src/Theme/ThemeModeToggle.tsx"],"sourcesContent":["import * as React from \"react\"\r\nimport { Moon, Sun, SunMoon, LucideIcon } from \"lucide-react\"\r\nimport { useTheme } from \"next-themes\"\r\n\r\nimport { Button } from \"../Button\"\r\nimport {\r\n DropdownMenu,\r\n DropdownMenuContent,\r\n DropdownMenuItem,\r\n DropdownMenuTrigger,\r\n} from \"../DropdownMenu\";\r\n\r\nconst iconByTheme: Record<'system' | 'light' | 'dark', LucideIcon> = {\r\n 'system': SunMoon,\r\n 'light': Sun,\r\n 'dark': Moon,\r\n}\r\n\r\nconst RenderThemeIcon: React.FC = () => {\r\n const { theme = 'system' } = useTheme()\r\n const ThemeIcon = React.useMemo(() => iconByTheme[theme as 'system' | 'light' | 'dark'], [theme])\r\n return (\r\n <>\r\n <ThemeIcon\r\n className=\"h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0 text-[currentColor] dar:fill-current\"\r\n />\r\n <span className=\"sr-only\">Toggle theme</span>\r\n </>\r\n )\r\n}\r\n\r\nexport interface ThemeModeToggleProps {\r\n lightLabel?: string;\r\n darkLabel?: string;\r\n systemLabel?: string;\r\n}\r\n\r\nexport const ThemeModeToggle: React.FC<ThemeModeToggleProps> = (props) => {\r\n const {\r\n lightLabel = 'Light',\r\n darkLabel = 'Dark',\r\n systemLabel = 'System',\r\n } = props;\r\n const { setTheme } = useTheme()\r\n\r\n return (\r\n <DropdownMenu>\r\n <DropdownMenuTrigger asChild>\r\n <Button variant=\"outline\" size=\"icon\">\r\n <RenderThemeIcon/>\r\n </Button>\r\n </DropdownMenuTrigger>\r\n <DropdownMenuContent align=\"end\">\r\n {[\r\n {value: 'system', label: systemLabel},\r\n {value: 'light', label: lightLabel},\r\n {value: 'dark', label: darkLabel},\r\n ].map(({ value, label }) => (\r\n <DropdownMenuItem\r\n key={value}\r\n onClick={() => setTheme(value)}\r\n >\r\n {label}\r\n </DropdownMenuItem>\r\n ))}\r\n </DropdownMenuContent>\r\n </DropdownMenu>\r\n )\r\n}\r\n\r\nexport default ThemeModeToggle\r\n"],"names":["iconByTheme","SunMoon","Sun","Moon","RenderThemeIcon","theme","useTheme","ThemeIcon","React","jsxs","Fragment","jsx","ThemeModeToggle","props","lightLabel","darkLabel","systemLabel","setTheme","DropdownMenu","DropdownMenuTrigger","Button","DropdownMenuContent","value","label","DropdownMenuItem"],"mappings":";;;;;;AAYA,MAAMA,IAA+D;AAAA,EACnE,QAAUC;AAAA,EACV,OAASC;AAAA,EACT,MAAQC;AACV,GAEMC,IAA4B,MAAM;AACtC,QAAM,EAAE,OAAAC,IAAQ,SAAA,IAAaC,EAAA,GACvBC,IAAaC,EAAM,QAAQ,MAAMR,EAAYK,CAAoC,GAAG,CAACA,CAAK,CAAC;AACjG,SACE,gBAAAI,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACJ;AAAA,MAAA;AAAA,QACC,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,IAEZ,gBAAAI,EAAC,QAAA,EAAK,WAAU,WAAU,UAAA,eAAA,CAAY;AAAA,EAAA,GACxC;AAEJ,GAQaC,IAAkD,CAACC,MAAU;AACxE,QAAM;AAAA,IACJ,YAAAC,IAAa;AAAA,IACb,WAAAC,IAAY;AAAA,IACZ,aAAAC,IAAc;AAAA,EAAA,IACZH,GACE,EAAE,UAAAI,EAAA,IAAaX,EAAA;AAErB,2BACGY,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAP,EAACQ,GAAA,EAAoB,SAAO,IAC1B,UAAA,gBAAAR,EAACS,GAAA,EAAO,SAAQ,WAAU,MAAK,QAC7B,UAAA,gBAAAT,EAACP,GAAA,CAAA,CAAe,EAAA,CAClB,GACF;AAAA,IACA,gBAAAO,EAACU,GAAA,EAAoB,OAAM,OACxB,UAAA;AAAA,MACC,EAAC,OAAO,UAAU,OAAOL,EAAA;AAAA,MACzB,EAAC,OAAO,SAAS,OAAOF,EAAA;AAAA,MACxB,EAAC,OAAO,QAAQ,OAAOC,EAAA;AAAA,IAAS,EAChC,IAAI,CAAC,EAAE,OAAAO,GAAO,OAAAC,QACd,gBAAAZ;AAAA,MAACa;AAAA,MAAA;AAAA,QAEC,SAAS,MAAMP,EAASK,CAAK;AAAA,QAE5B,UAAAC;AAAA,MAAA;AAAA,MAHID;AAAA,IAAA,CAKR,EAAA,CACH;AAAA,EAAA,GACF;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.js","sources":["../../src/Theme/ThemeProvider.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { ThemeProvider as NextThemesProvider } from \"next-themes\"\n\nexport function ThemeProvider(props: React.ComponentProps<typeof NextThemesProvider>) {\n const {\n children,\n attribute=\"class\",\n defaultTheme=\"system\",\n enableSystem = true,\n disableTransitionOnChange = true,\n ...rest\n } = props;\n\n return (\n <NextThemesProvider\n attribute={attribute}\n defaultTheme={defaultTheme}\n enableSystem={enableSystem}\n disableTransitionOnChange={disableTransitionOnChange}\n {...rest}\n >\n {children}\n </NextThemesProvider>\n );\n}\n\nexport default ThemeProvider;\n"],"names":["ThemeProvider","props","children","attribute","defaultTheme","enableSystem","disableTransitionOnChange","rest","jsx","NextThemesProvider"],"mappings":";;AAKO,SAASA,EAAcC,GAAwD;AACpF,QAAM;AAAA,IACJ,UAAAC;AAAA,IACA,WAAAC,IAAU;AAAA,IACV,cAAAC,IAAa;AAAA,IACb,cAAAC,IAAe;AAAA,IACf,2BAAAC,IAA4B;AAAA,IAC5B,GAAGC;AAAA,EAAA,IACDN;AAEJ,SACE,gBAAAO;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,WAAAN;AAAA,MACA,cAAAC;AAAA,MACA,cAAAC;AAAA,MACA,2BAAAC;AAAA,MACC,GAAGC;AAAA,MAEH,UAAAL;AAAA,IAAA;AAAA,EAAA;AAGP;"}
1
+ {"version":3,"file":"ThemeProvider.js","sources":["../../src/Theme/ThemeProvider.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport { ThemeProvider as NextThemesProvider } from \"next-themes\"\r\n\r\nexport function ThemeProvider(props: React.ComponentProps<typeof NextThemesProvider>) {\r\n const {\r\n children,\r\n attribute=\"class\",\r\n defaultTheme=\"system\",\r\n enableSystem = true,\r\n disableTransitionOnChange = true,\r\n ...rest\r\n } = props;\r\n\r\n return (\r\n <NextThemesProvider\r\n attribute={attribute}\r\n defaultTheme={defaultTheme}\r\n enableSystem={enableSystem}\r\n disableTransitionOnChange={disableTransitionOnChange}\r\n {...rest}\r\n >\r\n {children}\r\n </NextThemesProvider>\r\n );\r\n}\r\n\r\nexport default ThemeProvider;\r\n"],"names":["ThemeProvider","props","children","attribute","defaultTheme","enableSystem","disableTransitionOnChange","rest","jsx","NextThemesProvider"],"mappings":";;AAKO,SAASA,EAAcC,GAAwD;AACpF,QAAM;AAAA,IACJ,UAAAC;AAAA,IACA,WAAAC,IAAU;AAAA,IACV,cAAAC,IAAa;AAAA,IACb,cAAAC,IAAe;AAAA,IACf,2BAAAC,IAA4B;AAAA,IAC5B,GAAGC;AAAA,EAAA,IACDN;AAEJ,SACE,gBAAAO;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,WAAAN;AAAA,MACA,cAAAC;AAAA,MACA,cAAAC;AAAA,MACA,2BAAAC;AAAA,MACC,GAAGC;AAAA,MAEH,UAAAL;AAAA,IAAA;AAAA,EAAA;AAGP;"}
package/Toast/Toast.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as ToastPrimitives from "@radix-ui/react-toast";
4
4
  declare const ToastProvider: React.FC<ToastPrimitives.ToastProviderProps>;
5
5
  declare const ToastViewport: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastViewportProps & React.RefAttributes<HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
6
6
  declare const Toast: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastProps & React.RefAttributes<HTMLLIElement>, "ref"> & VariantProps<(props?: ({
7
- variant?: "default" | "destructive" | "success" | "info" | "update" | null | undefined;
7
+ variant?: "default" | "destructive" | "info" | "success" | "update" | null | undefined;
8
8
  } & import('class-variance-authority/types').ClassProp) | undefined) => string> & React.RefAttributes<HTMLLIElement>>;
9
9
  declare const ToastAction: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
10
10
  declare const ToastClose: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastCloseProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.js","sources":["../../src/Toast/Toast.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport * as ToastPrimitives from \"@radix-ui/react-toast\"\nimport { type VariantProps } from \"class-variance-authority\"\nimport { X } from \"lucide-react\"\n\nimport { cn } from \"@oneplatformdev/utils\"\nimport { toastVariants } from './toastVariants';\n\nconst ToastProvider = ToastPrimitives.Provider\n\nconst ToastViewport = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Viewport>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Viewport\n ref={ref}\n className={cn(\n \"fixed top-0 z-100 flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]\",\n className\n )}\n {...props}\n />\n))\nToastViewport.displayName = ToastPrimitives.Viewport.displayName\n\nconst Toast = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Root>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &\n VariantProps<typeof toastVariants>\n>(({ className, variant, ...props }, ref) => {\n return (\n <ToastPrimitives.Root\n ref={ref}\n className={cn(toastVariants({ variant }), className)}\n {...props}\n />\n )\n})\nToast.displayName = ToastPrimitives.Root.displayName\n\nconst ToastAction = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Action>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Action\n ref={ref}\n className={cn(\n \"inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-hidden focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 hover:group-[.destructive]:border-destructive/30 hover:group-[.destructive]:bg-destructive hover:group-[.destructive]:text-destructive-foreground focus:group-[.destructive]:ring-destructive\",\n className\n )}\n {...props}\n />\n))\nToastAction.displayName = ToastPrimitives.Action.displayName\n\nconst ToastClose = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Close>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Close\n ref={ref}\n className={cn(\n \"absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-hidden focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 hover:group-[.destructive]:text-red-50 focus:group-[.destructive]:ring-red-400 focus:group-[.destructive]:ring-offset-red-600\",\n className\n )}\n toast-close=\"\"\n {...props}\n >\n <X className=\"h-4 w-4\" />\n </ToastPrimitives.Close>\n))\nToastClose.displayName = ToastPrimitives.Close.displayName\n\nconst ToastTitle = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Title>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Title\n ref={ref}\n className={cn(\"text-sm font-semibold [&+div]:text-xs\", className)}\n {...props}\n />\n))\nToastTitle.displayName = ToastPrimitives.Title.displayName\n\nconst ToastDescription = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Description>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Description\n ref={ref}\n className={cn(\"text-sm opacity-90\", className)}\n {...props}\n />\n))\nToastDescription.displayName = ToastPrimitives.Description.displayName\n\n\nexport {\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction,\n}\n"],"names":["ToastProvider","ToastPrimitives","ToastViewport","React","className","props","ref","jsx","cn","Toast","variant","toastVariants","ToastAction","ToastClose","X","ToastTitle","ToastDescription"],"mappings":";;;;;;AAUA,MAAMA,IAAgBC,EAAgB,UAEhCC,IAAgBC,EAAM,WAG1B,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDH,EAAc,cAAcD,EAAgB,SAAS;AAErD,MAAMQ,IAAQN,EAAM,WAIlB,CAAC,EAAE,WAAAC,GAAW,SAAAM,GAAS,GAAGL,EAAA,GAASC,MAEjC,gBAAAC;AAAA,EAACN,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE,EAAGG,EAAc,EAAE,SAAAD,EAAA,CAAS,GAAGN,CAAS;AAAA,IAClD,GAAGC;AAAA,EAAA;AAAA,CAGT;AACDI,EAAM,cAAcR,EAAgB,KAAK;AAEzC,MAAMW,IAAcT,EAAM,WAGxB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDO,EAAY,cAAcX,EAAgB,OAAO;AAEjD,MAAMY,IAAaV,EAAM,WAGvB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAEF,eAAY;AAAA,IACX,GAAGC;AAAA,IAEJ,UAAA,gBAAAE,EAACO,GAAA,EAAE,WAAU,UAAA,CAAU;AAAA,EAAA;AACzB,CACD;AACDD,EAAW,cAAcZ,EAAgB,MAAM;AAE/C,MAAMc,IAAaZ,EAAM,WAGvB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE,EAAG,yCAAyCJ,CAAS;AAAA,IAC/D,GAAGC;AAAA,EAAA;AACN,CACD;AACDU,EAAW,cAAcd,EAAgB,MAAM;AAE/C,MAAMe,IAAmBb,EAAM,WAG7B,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE,EAAG,sBAAsBJ,CAAS;AAAA,IAC5C,GAAGC;AAAA,EAAA;AACN,CACD;AACDW,EAAiB,cAAcf,EAAgB,YAAY;"}
1
+ {"version":3,"file":"Toast.js","sources":["../../src/Toast/Toast.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport * as ToastPrimitives from \"@radix-ui/react-toast\"\r\nimport { type VariantProps } from \"class-variance-authority\"\r\nimport { X } from \"lucide-react\"\r\n\r\nimport { cn } from \"@oneplatformdev/utils\"\r\nimport { toastVariants } from './toastVariants';\r\n\r\nconst ToastProvider = ToastPrimitives.Provider\r\n\r\nconst ToastViewport = React.forwardRef<\r\n React.ElementRef<typeof ToastPrimitives.Viewport>,\r\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>\r\n>(({ className, ...props }, ref) => (\r\n <ToastPrimitives.Viewport\r\n ref={ref}\r\n className={cn(\r\n \"fixed top-0 z-100 flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n))\r\nToastViewport.displayName = ToastPrimitives.Viewport.displayName\r\n\r\nconst Toast = React.forwardRef<\r\n React.ElementRef<typeof ToastPrimitives.Root>,\r\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &\r\n VariantProps<typeof toastVariants>\r\n>(({ className, variant, ...props }, ref) => {\r\n return (\r\n <ToastPrimitives.Root\r\n ref={ref}\r\n className={cn(toastVariants({ variant }), className)}\r\n {...props}\r\n />\r\n )\r\n})\r\nToast.displayName = ToastPrimitives.Root.displayName\r\n\r\nconst ToastAction = React.forwardRef<\r\n React.ElementRef<typeof ToastPrimitives.Action>,\r\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>\r\n>(({ className, ...props }, ref) => (\r\n <ToastPrimitives.Action\r\n ref={ref}\r\n className={cn(\r\n \"inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-hidden focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 hover:group-[.destructive]:border-destructive/30 hover:group-[.destructive]:bg-destructive hover:group-[.destructive]:text-destructive-foreground focus:group-[.destructive]:ring-destructive\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n))\r\nToastAction.displayName = ToastPrimitives.Action.displayName\r\n\r\nconst ToastClose = React.forwardRef<\r\n React.ElementRef<typeof ToastPrimitives.Close>,\r\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>\r\n>(({ className, ...props }, ref) => (\r\n <ToastPrimitives.Close\r\n ref={ref}\r\n className={cn(\r\n \"absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-hidden focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 hover:group-[.destructive]:text-red-50 focus:group-[.destructive]:ring-red-400 focus:group-[.destructive]:ring-offset-red-600\",\r\n className\r\n )}\r\n toast-close=\"\"\r\n {...props}\r\n >\r\n <X className=\"h-4 w-4\" />\r\n </ToastPrimitives.Close>\r\n))\r\nToastClose.displayName = ToastPrimitives.Close.displayName\r\n\r\nconst ToastTitle = React.forwardRef<\r\n React.ElementRef<typeof ToastPrimitives.Title>,\r\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>\r\n>(({ className, ...props }, ref) => (\r\n <ToastPrimitives.Title\r\n ref={ref}\r\n className={cn(\"text-sm font-semibold [&+div]:text-xs\", className)}\r\n {...props}\r\n />\r\n))\r\nToastTitle.displayName = ToastPrimitives.Title.displayName\r\n\r\nconst ToastDescription = React.forwardRef<\r\n React.ElementRef<typeof ToastPrimitives.Description>,\r\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>\r\n>(({ className, ...props }, ref) => (\r\n <ToastPrimitives.Description\r\n ref={ref}\r\n className={cn(\"text-sm opacity-90\", className)}\r\n {...props}\r\n />\r\n))\r\nToastDescription.displayName = ToastPrimitives.Description.displayName\r\n\r\n\r\nexport {\r\n ToastProvider,\r\n ToastViewport,\r\n Toast,\r\n ToastTitle,\r\n ToastDescription,\r\n ToastClose,\r\n ToastAction,\r\n}\r\n"],"names":["ToastProvider","ToastPrimitives","ToastViewport","React","className","props","ref","jsx","cn","Toast","variant","toastVariants","ToastAction","ToastClose","X","ToastTitle","ToastDescription"],"mappings":";;;;;;AAUA,MAAMA,IAAgBC,EAAgB,UAEhCC,IAAgBC,EAAM,WAG1B,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDH,EAAc,cAAcD,EAAgB,SAAS;AAErD,MAAMQ,IAAQN,EAAM,WAIlB,CAAC,EAAE,WAAAC,GAAW,SAAAM,GAAS,GAAGL,EAAA,GAASC,MAEjC,gBAAAC;AAAA,EAACN,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE,EAAGG,EAAc,EAAE,SAAAD,EAAA,CAAS,GAAGN,CAAS;AAAA,IAClD,GAAGC;AAAA,EAAA;AAAA,CAGT;AACDI,EAAM,cAAcR,EAAgB,KAAK;AAEzC,MAAMW,IAAcT,EAAM,WAGxB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAED,GAAGC;AAAA,EAAA;AACN,CACD;AACDO,EAAY,cAAcX,EAAgB,OAAO;AAEjD,MAAMY,IAAaV,EAAM,WAGvB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAJ;AAAA,IAAA;AAAA,IAEF,eAAY;AAAA,IACX,GAAGC;AAAA,IAEJ,UAAA,gBAAAE,EAACO,GAAA,EAAE,WAAU,UAAA,CAAU;AAAA,EAAA;AACzB,CACD;AACDD,EAAW,cAAcZ,EAAgB,MAAM;AAE/C,MAAMc,IAAaZ,EAAM,WAGvB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE,EAAG,yCAAyCJ,CAAS;AAAA,IAC/D,GAAGC;AAAA,EAAA;AACN,CACD;AACDU,EAAW,cAAcd,EAAgB,MAAM;AAE/C,MAAMe,IAAmBb,EAAM,WAG7B,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAACN,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAK;AAAA,IACA,WAAWE,EAAG,sBAAsBJ,CAAS;AAAA,IAC5C,GAAGC;AAAA,EAAA;AACN,CACD;AACDW,EAAiB,cAAcf,EAAgB,YAAY;"}
@@ -1 +1 @@
1
- {"version":3,"file":"toast.constants.js","sources":["../../src/Toast/toast.constants.tsx"],"sourcesContent":["export const actionTypes = {\n ADD_TOAST: \"ADD_TOAST\",\n UPDATE_TOAST: \"UPDATE_TOAST\",\n DISMISS_TOAST: \"DISMISS_TOAST\",\n REMOVE_TOAST: \"REMOVE_TOAST\",\n} as const;\n"],"names":["actionTypes"],"mappings":"AAAO,MAAMA,IAAc;AAAA,EACzB,WAAW;AAAA,EACX,cAAc;AAAA,EACd,eAAe;AAAA,EACf,cAAc;AAChB;"}
1
+ {"version":3,"file":"toast.constants.js","sources":["../../src/Toast/toast.constants.tsx"],"sourcesContent":["export const actionTypes = {\r\n ADD_TOAST: \"ADD_TOAST\",\r\n UPDATE_TOAST: \"UPDATE_TOAST\",\r\n DISMISS_TOAST: \"DISMISS_TOAST\",\r\n REMOVE_TOAST: \"REMOVE_TOAST\",\r\n} as const;\r\n"],"names":["actionTypes"],"mappings":"AAAO,MAAMA,IAAc;AAAA,EACzB,WAAW;AAAA,EACX,cAAc;AAAA,EACd,eAAe;AAAA,EACf,cAAc;AAChB;"}
@@ -1,4 +1,4 @@
1
1
  export declare const toastVariants: (props?: ({
2
- variant?: "default" | "destructive" | "success" | "info" | "update" | null | undefined;
2
+ variant?: "default" | "destructive" | "info" | "success" | "update" | null | undefined;
3
3
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
4
4
  //# sourceMappingURL=toastVariants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toastVariants.js","sources":["../../src/Toast/toastVariants.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\n\nexport const toastVariants = cva(\n 'group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-(--radix-toast-swipe-end-x) data-[swipe=move]:translate-x-(--radix-toast-swipe-move-x) data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full sm:data-[state=open]:slide-in-from-bottom-full',\n {\n variants: {\n variant: {\n default: 'border bg-background text-foreground',\n destructive:\n 'destructive group border-destructive bg-destructive text-destructive-foreground',\n success: 'border bg-primary text-white',\n info: 'border bg-blue-400 text-white',\n update: 'border bg-orange-400 text-white',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n }\n);\n"],"names":["toastVariants","cva"],"mappings":";AAEO,MAAMA,IAAgBC;AAAA,EAC3B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,aACE;AAAA,QACF,SAAS;AAAA,QACT,MAAM;AAAA,QACN,QAAQ;AAAA,MAAA;AAAA,IACV;AAAA,IAEF,iBAAiB;AAAA,MACf,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ;"}
1
+ {"version":3,"file":"toastVariants.js","sources":["../../src/Toast/toastVariants.ts"],"sourcesContent":["import { cva } from 'class-variance-authority';\r\n\r\nexport const toastVariants = cva(\r\n 'group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-(--radix-toast-swipe-end-x) data-[swipe=move]:translate-x-(--radix-toast-swipe-move-x) data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full sm:data-[state=open]:slide-in-from-bottom-full',\r\n {\r\n variants: {\r\n variant: {\r\n default: 'border bg-background text-foreground',\r\n destructive:\r\n 'destructive group border-destructive bg-destructive text-destructive-foreground',\r\n success: 'border bg-primary text-white',\r\n info: 'border bg-blue-400 text-white',\r\n update: 'border bg-orange-400 text-white',\r\n },\r\n },\r\n defaultVariants: {\r\n variant: 'default',\r\n },\r\n }\r\n);\r\n"],"names":["toastVariants","cva"],"mappings":";AAEO,MAAMA,IAAgBC;AAAA,EAC3B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,aACE;AAAA,QACF,SAAS;AAAA,QACT,MAAM;AAAA,QACN,QAAQ;AAAA,MAAA;AAAA,IACV;AAAA,IAEF,iBAAiB;AAAA,MACf,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useToast.js","sources":["../../src/Toast/useToast.ts"],"sourcesContent":["// Inspired by react-hot-toast library\nimport * as React from \"react\";\n\nimport { ToasterToast, Action, State, TToast, ToasterToastVariant } from './Toast.types';\n\nconst TOAST_LIMIT = 1;\nconst TOAST_REMOVE_DELAY = 1000000;\n\nlet count = 0;\n\nfunction genId() {\n count = (count + 1) % Number.MAX_SAFE_INTEGER;\n return count.toString();\n};\n\n\nconst toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>();\n\nconst addToRemoveQueue = (toastId: string) => {\n if (toastTimeouts.has(toastId)) {\n return;\n };\n\n const timeout = setTimeout(() => {\n toastTimeouts.delete(toastId);\n dispatch({\n type: \"REMOVE_TOAST\",\n toastId: toastId,\n });\n }, TOAST_REMOVE_DELAY);\n\n toastTimeouts.set(toastId, timeout);\n};\n\nexport const reducer = (state: State, action: Action): State => {\n switch (action.type) {\n case \"ADD_TOAST\":\n return {\n ...state,\n toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),\n };\n\n case \"UPDATE_TOAST\":\n return {\n ...state,\n toasts: state.toasts.map((t) =>\n t.id === action.toast.id ? { ...t, ...action.toast } : t\n ),\n };\n\n case \"DISMISS_TOAST\": {\n const { toastId } = action;\n\n // ! Side effects ! - This could be extracted into a dismissToast() action,\n // but I'll keep it here for simplicity\n if (toastId) {\n addToRemoveQueue(toastId);\n } else {\n state.toasts.forEach((toast) => {\n addToRemoveQueue(toast.id);\n });\n }\n\n return {\n ...state,\n toasts: state.toasts.map((t) =>\n t.id === toastId || toastId === undefined\n ? {\n ...t,\n open: false,\n }\n : t\n ),\n };\n }\n case \"REMOVE_TOAST\":\n if (action.toastId === undefined) {\n return {\n ...state,\n toasts: [],\n };\n }\n return {\n ...state,\n toasts: state.toasts.filter((t) => t.id !== action.toastId),\n };\n }\n};\n\nconst listeners: Array<(state: State) => void> = [];\n\nlet memoryState: State = { toasts: [] };\n\nfunction dispatch(action: Action) {\n memoryState = reducer(memoryState, action);\n listeners.forEach((listener) => {\n listener(memoryState);\n });\n};\n\nexport function toast({ ...props }: TToast) {\n const id = genId();\n\n const update = (props: ToasterToast) =>\n dispatch({\n type: \"UPDATE_TOAST\",\n toast: { ...props, id },\n });\n const dismiss = () => dispatch({ type: \"DISMISS_TOAST\", toastId: id });\n\n dispatch({\n type: \"ADD_TOAST\",\n toast: {\n ...props,\n id,\n open: true,\n onOpenChange: (open: boolean) => {\n if (!open) dismiss();\n },\n },\n });\n\n return {\n id: id,\n dismiss,\n update,\n };\n};\n\nexport function useToast() {\n const [state, setState] = React.useState<State>(memoryState);\n\n React.useEffect(() => {\n listeners.push(setState);\n return () => {\n const index = listeners.indexOf(setState);\n if (index > -1) {\n listeners.splice(index, 1);\n }\n };\n }, [state]);\n\n return {\n ...state,\n toast,\n dismiss: (toastId?: string) => dispatch({ type: \"DISMISS_TOAST\", toastId }),\n };\n};\n\nexport const useNotify = () => {\n const notifyToast = (message: string, variant?: ToasterToastVariant, description?: string) => {\n toast({ title: message, variant, description: description });\n };\n\n return { notifyToast };\n};\n"],"names":["TOAST_LIMIT","TOAST_REMOVE_DELAY","count","genId","toastTimeouts","addToRemoveQueue","toastId","timeout","dispatch","reducer","state","action","t","toast","listeners","memoryState","listener","props","id","update","dismiss","open","useToast","setState","React","index","useNotify","message","variant","description"],"mappings":"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"}
1
+ {"version":3,"file":"useToast.js","sources":["../../src/Toast/useToast.ts"],"sourcesContent":["// Inspired by react-hot-toast library\r\nimport * as React from \"react\";\r\n\r\nimport { ToasterToast, Action, State, TToast, ToasterToastVariant } from './Toast.types';\r\n\r\nconst TOAST_LIMIT = 1;\r\nconst TOAST_REMOVE_DELAY = 1000000;\r\n\r\nlet count = 0;\r\n\r\nfunction genId() {\r\n count = (count + 1) % Number.MAX_SAFE_INTEGER;\r\n return count.toString();\r\n};\r\n\r\n\r\nconst toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>();\r\n\r\nconst addToRemoveQueue = (toastId: string) => {\r\n if (toastTimeouts.has(toastId)) {\r\n return;\r\n };\r\n\r\n const timeout = setTimeout(() => {\r\n toastTimeouts.delete(toastId);\r\n dispatch({\r\n type: \"REMOVE_TOAST\",\r\n toastId: toastId,\r\n });\r\n }, TOAST_REMOVE_DELAY);\r\n\r\n toastTimeouts.set(toastId, timeout);\r\n};\r\n\r\nexport const reducer = (state: State, action: Action): State => {\r\n switch (action.type) {\r\n case \"ADD_TOAST\":\r\n return {\r\n ...state,\r\n toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),\r\n };\r\n\r\n case \"UPDATE_TOAST\":\r\n return {\r\n ...state,\r\n toasts: state.toasts.map((t) =>\r\n t.id === action.toast.id ? { ...t, ...action.toast } : t\r\n ),\r\n };\r\n\r\n case \"DISMISS_TOAST\": {\r\n const { toastId } = action;\r\n\r\n // ! Side effects ! - This could be extracted into a dismissToast() action,\r\n // but I'll keep it here for simplicity\r\n if (toastId) {\r\n addToRemoveQueue(toastId);\r\n } else {\r\n state.toasts.forEach((toast) => {\r\n addToRemoveQueue(toast.id);\r\n });\r\n }\r\n\r\n return {\r\n ...state,\r\n toasts: state.toasts.map((t) =>\r\n t.id === toastId || toastId === undefined\r\n ? {\r\n ...t,\r\n open: false,\r\n }\r\n : t\r\n ),\r\n };\r\n }\r\n case \"REMOVE_TOAST\":\r\n if (action.toastId === undefined) {\r\n return {\r\n ...state,\r\n toasts: [],\r\n };\r\n }\r\n return {\r\n ...state,\r\n toasts: state.toasts.filter((t) => t.id !== action.toastId),\r\n };\r\n }\r\n};\r\n\r\nconst listeners: Array<(state: State) => void> = [];\r\n\r\nlet memoryState: State = { toasts: [] };\r\n\r\nfunction dispatch(action: Action) {\r\n memoryState = reducer(memoryState, action);\r\n listeners.forEach((listener) => {\r\n listener(memoryState);\r\n });\r\n};\r\n\r\nexport function toast({ ...props }: TToast) {\r\n const id = genId();\r\n\r\n const update = (props: ToasterToast) =>\r\n dispatch({\r\n type: \"UPDATE_TOAST\",\r\n toast: { ...props, id },\r\n });\r\n const dismiss = () => dispatch({ type: \"DISMISS_TOAST\", toastId: id });\r\n\r\n dispatch({\r\n type: \"ADD_TOAST\",\r\n toast: {\r\n ...props,\r\n id,\r\n open: true,\r\n onOpenChange: (open: boolean) => {\r\n if (!open) dismiss();\r\n },\r\n },\r\n });\r\n\r\n return {\r\n id: id,\r\n dismiss,\r\n update,\r\n };\r\n};\r\n\r\nexport function useToast() {\r\n const [state, setState] = React.useState<State>(memoryState);\r\n\r\n React.useEffect(() => {\r\n listeners.push(setState);\r\n return () => {\r\n const index = listeners.indexOf(setState);\r\n if (index > -1) {\r\n listeners.splice(index, 1);\r\n }\r\n };\r\n }, [state]);\r\n\r\n return {\r\n ...state,\r\n toast,\r\n dismiss: (toastId?: string) => dispatch({ type: \"DISMISS_TOAST\", toastId }),\r\n };\r\n};\r\n\r\nexport const useNotify = () => {\r\n const notifyToast = (message: string, variant?: ToasterToastVariant, description?: string) => {\r\n toast({ title: message, variant, description: description });\r\n };\r\n\r\n return { notifyToast };\r\n};\r\n"],"names":["TOAST_LIMIT","TOAST_REMOVE_DELAY","count","genId","toastTimeouts","addToRemoveQueue","toastId","timeout","dispatch","reducer","state","action","t","toast","listeners","memoryState","listener","props","id","update","dismiss","open","useToast","setState","React","index","useNotify","message","variant","description"],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"Toaster.js","sources":["../../src/Toaster/Toaster.tsx"],"sourcesContent":["\"use client\"\n\nimport { useToast } from \"../Toast/useToast\"\nimport {\n Toast,\n ToastClose,\n ToastDescription,\n ToastProvider,\n ToastTitle,\n ToastViewport,\n} from \"../Toast\"\n\nexport function Toaster() {\n const { toasts } = useToast()\n\n return (\n <ToastProvider>\n {toasts.map(function ({ id, title, description, action, ...props }) {\n return (\n <Toast key={id} {...props}>\n <div className=\"grid gap-1\">\n {title && <ToastTitle>{title}</ToastTitle>}\n {description && (\n <ToastDescription>{description}</ToastDescription>\n )}\n </div>\n {action}\n <ToastClose />\n </Toast>\n )\n })}\n <ToastViewport />\n </ToastProvider>\n )\n}\n"],"names":["Toaster","toasts","useToast","ToastProvider","id","title","description","action","props","jsxs","Toast","jsx","ToastTitle","ToastDescription","ToastClose","ToastViewport"],"mappings":";;;AAYO,SAASA,IAAU;AACxB,QAAM,EAAE,QAAAC,EAAA,IAAWC,EAAA;AAEnB,2BACGC,GAAA,EACE,UAAA;AAAA,IAAAF,EAAO,IAAI,SAAU,EAAE,IAAAG,GAAI,OAAAC,GAAO,aAAAC,GAAa,QAAAC,GAAQ,GAAGC,KAAS;AAClE,aACE,gBAAAC,EAACC,GAAA,EAAgB,GAAGF,GAClB,UAAA;AAAA,QAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,cACZ,UAAA;AAAA,UAAAJ,KAAS,gBAAAM,EAACC,KAAY,UAAAP,EAAA,CAAM;AAAA,UAC5BC,KACC,gBAAAK,EAACE,GAAA,EAAkB,UAAAP,EAAA,CAAY;AAAA,QAAA,GAEnC;AAAA,QACCC;AAAA,0BACAO,GAAA,CAAA,CAAW;AAAA,MAAA,EAAA,GARFV,CASZ;AAAA,IAEJ,CAAC;AAAA,sBACAW,GAAA,CAAA,CAAc;AAAA,EAAA,GACjB;AAEJ;"}
1
+ {"version":3,"file":"Toaster.js","sources":["../../src/Toaster/Toaster.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport { useToast } from \"../Toast/useToast\"\r\nimport {\r\n Toast,\r\n ToastClose,\r\n ToastDescription,\r\n ToastProvider,\r\n ToastTitle,\r\n ToastViewport,\r\n} from \"../Toast\"\r\n\r\nexport function Toaster() {\r\n const { toasts } = useToast()\r\n\r\n return (\r\n <ToastProvider>\r\n {toasts.map(function ({ id, title, description, action, ...props }) {\r\n return (\r\n <Toast key={id} {...props}>\r\n <div className=\"grid gap-1\">\r\n {title && <ToastTitle>{title}</ToastTitle>}\r\n {description && (\r\n <ToastDescription>{description}</ToastDescription>\r\n )}\r\n </div>\r\n {action}\r\n <ToastClose />\r\n </Toast>\r\n )\r\n })}\r\n <ToastViewport />\r\n </ToastProvider>\r\n )\r\n}\r\n"],"names":["Toaster","toasts","useToast","ToastProvider","id","title","description","action","props","jsxs","Toast","jsx","ToastTitle","ToastDescription","ToastClose","ToastViewport"],"mappings":";;;AAYO,SAASA,IAAU;AACxB,QAAM,EAAE,QAAAC,EAAA,IAAWC,EAAA;AAEnB,2BACGC,GAAA,EACE,UAAA;AAAA,IAAAF,EAAO,IAAI,SAAU,EAAE,IAAAG,GAAI,OAAAC,GAAO,aAAAC,GAAa,QAAAC,GAAQ,GAAGC,KAAS;AAClE,aACE,gBAAAC,EAACC,GAAA,EAAgB,GAAGF,GAClB,UAAA;AAAA,QAAA,gBAAAC,EAAC,OAAA,EAAI,WAAU,cACZ,UAAA;AAAA,UAAAJ,KAAS,gBAAAM,EAACC,KAAY,UAAAP,EAAA,CAAM;AAAA,UAC5BC,KACC,gBAAAK,EAACE,GAAA,EAAkB,UAAAP,EAAA,CAAY;AAAA,QAAA,GAEnC;AAAA,QACCC;AAAA,0BACAO,GAAA,CAAA,CAAW;AAAA,MAAA,EAAA,GARFV,CASZ;AAAA,IAEJ,CAAC;AAAA,sBACAW,GAAA,CAAA,CAAc;AAAA,EAAA,GACjB;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Toggle.js","sources":["../../src/Toggle/Toggle.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport * as TogglePrimitive from \"@radix-ui/react-toggle\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@oneplatformdev/utils\"\n\nconst toggleVariants = cva(\n \"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n {\n variants: {\n variant: {\n default: \"bg-transparent\",\n outline:\n \"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground\",\n },\n size: {\n default: \"h-9 px-2 min-w-9\",\n sm: \"h-8 px-1.5 min-w-8\",\n lg: \"h-10 px-2.5 min-w-10\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n)\n\nconst Toggle = React.forwardRef<\n React.ElementRef<typeof TogglePrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> &\n VariantProps<typeof toggleVariants>\n>(({ className, variant, size, ...props }, ref) => (\n <TogglePrimitive.Root\n ref={ref}\n className={cn(toggleVariants({ variant, size, className }))}\n {...props}\n />\n))\n\nToggle.displayName = TogglePrimitive.Root.displayName\n\nexport { Toggle, toggleVariants }\n"],"names":["toggleVariants","cva","Toggle","React","className","variant","size","props","ref","jsx","TogglePrimitive","cn"],"mappings":";;;;;AAQA,MAAMA,IAAiBC;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,SACE;AAAA,MAAA;AAAA,MAEJ,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA;AAAA,IACN;AAAA,IAEF,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,IAAA;AAAA,EACR;AAEJ,GAEMC,IAASC,EAAM,WAInB,CAAC,EAAE,WAAAC,GAAW,SAAAC,GAAS,MAAAC,GAAM,GAAGC,KAASC,MACzC,gBAAAC;AAAA,EAACC,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAF;AAAA,IACA,WAAWG,EAAGX,EAAe,EAAE,SAAAK,GAAS,MAAAC,GAAM,WAAAF,EAAA,CAAW,CAAC;AAAA,IACzD,GAAGG;AAAA,EAAA;AACN,CACD;AAEDL,EAAO,cAAcQ,EAAgB,KAAK;"}
1
+ {"version":3,"file":"Toggle.js","sources":["../../src/Toggle/Toggle.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport * as TogglePrimitive from \"@radix-ui/react-toggle\"\r\nimport { cva, type VariantProps } from \"class-variance-authority\"\r\n\r\nimport { cn } from \"@oneplatformdev/utils\"\r\n\r\nconst toggleVariants = cva(\r\n \"inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\r\n {\r\n variants: {\r\n variant: {\r\n default: \"bg-transparent\",\r\n outline:\r\n \"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground\",\r\n },\r\n size: {\r\n default: \"h-9 px-2 min-w-9\",\r\n sm: \"h-8 px-1.5 min-w-8\",\r\n lg: \"h-10 px-2.5 min-w-10\",\r\n },\r\n },\r\n defaultVariants: {\r\n variant: \"default\",\r\n size: \"default\",\r\n },\r\n }\r\n)\r\n\r\nconst Toggle = React.forwardRef<\r\n React.ElementRef<typeof TogglePrimitive.Root>,\r\n React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> &\r\n VariantProps<typeof toggleVariants>\r\n>(({ className, variant, size, ...props }, ref) => (\r\n <TogglePrimitive.Root\r\n ref={ref}\r\n className={cn(toggleVariants({ variant, size, className }))}\r\n {...props}\r\n />\r\n))\r\n\r\nToggle.displayName = TogglePrimitive.Root.displayName\r\n\r\nexport { Toggle, toggleVariants }\r\n"],"names":["toggleVariants","cva","Toggle","React","className","variant","size","props","ref","jsx","TogglePrimitive","cn"],"mappings":";;;;;AAQA,MAAMA,IAAiBC;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SAAS;AAAA,QACT,SACE;AAAA,MAAA;AAAA,MAEJ,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,MAAA;AAAA,IACN;AAAA,IAEF,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,IAAA;AAAA,EACR;AAEJ,GAEMC,IAASC,EAAM,WAInB,CAAC,EAAE,WAAAC,GAAW,SAAAC,GAAS,MAAAC,GAAM,GAAGC,KAASC,MACzC,gBAAAC;AAAA,EAACC,EAAgB;AAAA,EAAhB;AAAA,IACC,KAAAF;AAAA,IACA,WAAWG,EAAGX,EAAe,EAAE,SAAAK,GAAS,MAAAC,GAAM,WAAAF,EAAA,CAAW,CAAC;AAAA,IACzD,GAAGG;AAAA,EAAA;AACN,CACD;AAEDL,EAAO,cAAcQ,EAAgB,KAAK;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleGroup.js","sources":["../../src/ToggleGroup/ToggleGroup.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport * as ToggleGroupPrimitive from \"@radix-ui/react-toggle-group\"\nimport { type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@oneplatformdev/utils\";\nimport { toggleVariants } from \"../Toggle\";\n\nconst ToggleGroupContext = React.createContext<\n VariantProps<typeof toggleVariants>\n>({\n size: \"default\",\n variant: \"default\",\n})\n\nconst ToggleGroup = React.forwardRef<\n React.ElementRef<typeof ToggleGroupPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &\n VariantProps<typeof toggleVariants>\n>(({ className, variant, size, children, ...props }, ref) => (\n <ToggleGroupPrimitive.Root\n ref={ref}\n className={cn(\"flex items-center justify-center gap-1\", className)}\n {...props}\n >\n <ToggleGroupContext.Provider value={{ variant, size }}>\n {children}\n </ToggleGroupContext.Provider>\n </ToggleGroupPrimitive.Root>\n))\n\nToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName\n\nconst ToggleGroupItem = React.forwardRef<\n React.ElementRef<typeof ToggleGroupPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &\n VariantProps<typeof toggleVariants>\n>(({ className, children, variant, size, ...props }, ref) => {\n const context = React.useContext(ToggleGroupContext)\n\n return (\n <ToggleGroupPrimitive.Item\n ref={ref}\n className={cn(\n toggleVariants({\n variant: context.variant || variant,\n size: context.size || size,\n }),\n className\n )}\n {...props}\n >\n {children}\n </ToggleGroupPrimitive.Item>\n )\n})\n\nToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName\n\nexport { ToggleGroup, ToggleGroupItem }\n"],"names":["ToggleGroupContext","React","ToggleGroup","className","variant","size","children","props","ref","jsx","ToggleGroupPrimitive","cn","ToggleGroupItem","context","toggleVariants"],"mappings":";;;;;AASA,MAAMA,IAAqBC,EAAM,cAE/B;AAAA,EACA,MAAM;AAAA,EACN,SAAS;AACX,CAAC,GAEKC,IAAcD,EAAM,WAIxB,CAAC,EAAE,WAAAE,GAAW,SAAAC,GAAS,MAAAC,GAAM,UAAAC,GAAU,GAAGC,EAAA,GAASC,MACnD,gBAAAC;AAAA,EAACC,EAAqB;AAAA,EAArB;AAAA,IACC,KAAAF;AAAA,IACA,WAAWG,EAAG,0CAA0CR,CAAS;AAAA,IAChE,GAAGI;AAAA,IAEJ,UAAA,gBAAAE,EAACT,EAAmB,UAAnB,EAA4B,OAAO,EAAE,SAAAI,GAAS,MAAAC,EAAA,GAC5C,UAAAC,EAAA,CACH;AAAA,EAAA;AACF,CACD;AAEDJ,EAAY,cAAcQ,EAAqB,KAAK;AAEpD,MAAME,IAAkBX,EAAM,WAI5B,CAAC,EAAE,WAAAE,GAAW,UAAAG,GAAU,SAAAF,GAAS,MAAAC,GAAM,GAAGE,EAAA,GAASC,MAAQ;AAC3D,QAAMK,IAAUZ,EAAM,WAAWD,CAAkB;AAEnD,SACE,gBAAAS;AAAA,IAACC,EAAqB;AAAA,IAArB;AAAA,MACC,KAAAF;AAAA,MACA,WAAWG;AAAA,QACTG,EAAe;AAAA,UACb,SAASD,EAAQ,WAAWT;AAAA,UAC5B,MAAMS,EAAQ,QAAQR;AAAA,QAAA,CACvB;AAAA,QACDF;AAAA,MAAA;AAAA,MAED,GAAGI;AAAA,MAEH,UAAAD;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;AAEDM,EAAgB,cAAcF,EAAqB,KAAK;"}
1
+ {"version":3,"file":"ToggleGroup.js","sources":["../../src/ToggleGroup/ToggleGroup.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport * as ToggleGroupPrimitive from \"@radix-ui/react-toggle-group\"\r\nimport { type VariantProps } from \"class-variance-authority\"\r\n\r\nimport { cn } from \"@oneplatformdev/utils\";\r\nimport { toggleVariants } from \"../Toggle\";\r\n\r\nconst ToggleGroupContext = React.createContext<\r\n VariantProps<typeof toggleVariants>\r\n>({\r\n size: \"default\",\r\n variant: \"default\",\r\n})\r\n\r\nconst ToggleGroup = React.forwardRef<\r\n React.ElementRef<typeof ToggleGroupPrimitive.Root>,\r\n React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> &\r\n VariantProps<typeof toggleVariants>\r\n>(({ className, variant, size, children, ...props }, ref) => (\r\n <ToggleGroupPrimitive.Root\r\n ref={ref}\r\n className={cn(\"flex items-center justify-center gap-1\", className)}\r\n {...props}\r\n >\r\n <ToggleGroupContext.Provider value={{ variant, size }}>\r\n {children}\r\n </ToggleGroupContext.Provider>\r\n </ToggleGroupPrimitive.Root>\r\n))\r\n\r\nToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName\r\n\r\nconst ToggleGroupItem = React.forwardRef<\r\n React.ElementRef<typeof ToggleGroupPrimitive.Item>,\r\n React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> &\r\n VariantProps<typeof toggleVariants>\r\n>(({ className, children, variant, size, ...props }, ref) => {\r\n const context = React.useContext(ToggleGroupContext)\r\n\r\n return (\r\n <ToggleGroupPrimitive.Item\r\n ref={ref}\r\n className={cn(\r\n toggleVariants({\r\n variant: context.variant || variant,\r\n size: context.size || size,\r\n }),\r\n className\r\n )}\r\n {...props}\r\n >\r\n {children}\r\n </ToggleGroupPrimitive.Item>\r\n )\r\n})\r\n\r\nToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName\r\n\r\nexport { ToggleGroup, ToggleGroupItem }\r\n"],"names":["ToggleGroupContext","React","ToggleGroup","className","variant","size","children","props","ref","jsx","ToggleGroupPrimitive","cn","ToggleGroupItem","context","toggleVariants"],"mappings":";;;;;AASA,MAAMA,IAAqBC,EAAM,cAE/B;AAAA,EACA,MAAM;AAAA,EACN,SAAS;AACX,CAAC,GAEKC,IAAcD,EAAM,WAIxB,CAAC,EAAE,WAAAE,GAAW,SAAAC,GAAS,MAAAC,GAAM,UAAAC,GAAU,GAAGC,EAAA,GAASC,MACnD,gBAAAC;AAAA,EAACC,EAAqB;AAAA,EAArB;AAAA,IACC,KAAAF;AAAA,IACA,WAAWG,EAAG,0CAA0CR,CAAS;AAAA,IAChE,GAAGI;AAAA,IAEJ,UAAA,gBAAAE,EAACT,EAAmB,UAAnB,EAA4B,OAAO,EAAE,SAAAI,GAAS,MAAAC,EAAA,GAC5C,UAAAC,EAAA,CACH;AAAA,EAAA;AACF,CACD;AAEDJ,EAAY,cAAcQ,EAAqB,KAAK;AAEpD,MAAME,IAAkBX,EAAM,WAI5B,CAAC,EAAE,WAAAE,GAAW,UAAAG,GAAU,SAAAF,GAAS,MAAAC,GAAM,GAAGE,EAAA,GAASC,MAAQ;AAC3D,QAAMK,IAAUZ,EAAM,WAAWD,CAAkB;AAEnD,SACE,gBAAAS;AAAA,IAACC,EAAqB;AAAA,IAArB;AAAA,MACC,KAAAF;AAAA,MACA,WAAWG;AAAA,QACTG,EAAe;AAAA,UACb,SAASD,EAAQ,WAAWT;AAAA,UAC5B,MAAMS,EAAQ,QAAQR;AAAA,QAAA,CACvB;AAAA,QACDF;AAAA,MAAA;AAAA,MAED,GAAGI;AAAA,MAEH,UAAAD;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;AAEDM,EAAgB,cAAcF,EAAqB,KAAK;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,CAAC,YAAY,CAAC,4CAwClE,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,OAAO,iBAAiB,CAAC,YAAY,CAAC,4CAQ7D,CAAC"}
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAIpD,eAAO,MAAM,YAAY,GAAI,OAAO,iBAAiB,CAAC,YAAY,CAAC,4CAkDlE,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,OAAO,iBAAiB,CAAC,YAAY,CAAC,4CAQ7D,CAAC"}