react-restyle-components 0.4.39 → 0.4.41

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 (243) hide show
  1. package/lib/index.js +3 -1
  2. package/lib/src/core-components/index.js +1 -1
  3. package/lib/src/core-components/src/components/Accordion/AccordionSection/Accordion.js +15 -1
  4. package/lib/src/core-components/src/components/Accordion/AccordionSection/AccordionContext.js +6 -1
  5. package/lib/src/core-components/src/components/Accordion/AccordionSection/AccordionSection.js +39 -1
  6. package/lib/src/core-components/src/components/Accordion/AccordionSection/Header.js +39 -1
  7. package/lib/src/core-components/src/components/Accordion/AccordionSection/elements.js +94 -57
  8. package/lib/src/core-components/src/components/Accordion/AccordionSection/hooks/useCurrentAccordionIndex.js +13 -1
  9. package/lib/src/core-components/src/components/Accordion/AccordionSection/index.js +3 -1
  10. package/lib/src/core-components/src/components/Accordion/AccordionSection/types.js +9 -1
  11. package/lib/src/core-components/src/components/Accordion/Collapsible/Collapsible2.component.js +249 -1
  12. package/lib/src/core-components/src/components/Action/types.js +8 -1
  13. package/lib/src/core-components/src/components/AlertBanner/AlertBanner.js +45 -1
  14. package/lib/src/core-components/src/components/AlertBanner/elements.js +120 -45
  15. package/lib/src/core-components/src/components/AlertBanner/index.js +2 -1
  16. package/lib/src/core-components/src/components/AlertBanner/types.js +10 -1
  17. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-group-by-multiple-select-multiple-fields-display/auto-complete-filter-group-by-multiple-select-multiple-fields-display.component.js +334 -1
  18. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-multi-select-multi-fields-display-drag-drop/auto-complete-filter-multi-select-multi-fields-display-drag-drop.component.js +229 -1
  19. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-multi-select-selected-top-display/auto-complete-filter-multi-select-selected-top-display.component.js +174 -1
  20. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.js +129 -2
  21. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-single-select/auto-complete-filter-single-select.component.js +55 -1
  22. package/lib/src/core-components/src/components/AutoComplete/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +308 -2
  23. package/lib/src/core-components/src/components/AutoComplete/auto-complete-group-by/auto-complete-group-by.component.js +115 -1
  24. package/lib/src/core-components/src/components/AutoComplete/autocomplete/autocomplete.js +442 -2
  25. package/lib/src/core-components/src/components/AutoComplete/index.js +8 -1
  26. package/lib/src/core-components/src/components/Avatar/Avatar.js +148 -14
  27. package/lib/src/core-components/src/components/Badge/Badge.js +25 -2
  28. package/lib/src/core-components/src/components/Badge/InnerBadge/Inline.js +25 -1
  29. package/lib/src/core-components/src/components/Badge/InnerBadge/InnerBadge.js +25 -1
  30. package/lib/src/core-components/src/components/Badge/InnerBadge/elements.js +78 -32
  31. package/lib/src/core-components/src/components/Badge/InnerBadge/index.js +1 -1
  32. package/lib/src/core-components/src/components/Badge/index.js +1 -1
  33. package/lib/src/core-components/src/components/Badge/types.js +5 -1
  34. package/lib/src/core-components/src/components/Breadcrumb/Breadcrumb.js +83 -1
  35. package/lib/src/core-components/src/components/Breadcrumb/elements.js +166 -94
  36. package/lib/src/core-components/src/components/Breadcrumb/index.js +3 -1
  37. package/lib/src/core-components/src/components/Breadcrumb/types.js +3 -1
  38. package/lib/src/core-components/src/components/Button/button.component.js +18 -1
  39. package/lib/src/core-components/src/components/Button/buttonGroup/buttonGroup.component.js +4 -1
  40. package/lib/src/core-components/src/components/Button/index.js +2 -1
  41. package/lib/src/core-components/src/components/Button/types.js +1 -1
  42. package/lib/src/core-components/src/components/Chip/Chip.js +64 -1
  43. package/lib/src/core-components/src/components/Chip/elements.js +148 -48
  44. package/lib/src/core-components/src/components/Chip/index.js +2 -1
  45. package/lib/src/core-components/src/components/Chip/types.js +4 -1
  46. package/lib/src/core-components/src/components/Divider/Divider.js +25 -1
  47. package/lib/src/core-components/src/components/Divider/elements.js +68 -31
  48. package/lib/src/core-components/src/components/Divider/index.js +2 -1
  49. package/lib/src/core-components/src/components/Divider/types.js +4 -1
  50. package/lib/src/core-components/src/components/DynamicGrid/DynamicGrid.js +147 -1
  51. package/lib/src/core-components/src/components/DynamicGrid/GridContainer.js +24 -17
  52. package/lib/src/core-components/src/components/DynamicGrid/elements.js +162 -100
  53. package/lib/src/core-components/src/components/DynamicGrid/index.js +3 -1
  54. package/lib/src/core-components/src/components/DynamicGrid/types.js +28 -1
  55. package/lib/src/core-components/src/components/DynamicGrid/utils.js +193 -1
  56. package/lib/src/core-components/src/components/FormField/FormField.js +103 -1
  57. package/lib/src/core-components/src/components/FormField/components/CheckboxGroupInput.js +37 -1
  58. package/lib/src/core-components/src/components/FormField/components/CheckboxInput.js +8 -1
  59. package/lib/src/core-components/src/components/FormField/components/CssMultilineInput.js +192 -1
  60. package/lib/src/core-components/src/components/FormField/components/DatePickerInput.js +99 -1
  61. package/lib/src/core-components/src/components/FormField/components/DropdownInput.js +70 -1
  62. package/lib/src/core-components/src/components/FormField/components/OtpInput.js +81 -1
  63. package/lib/src/core-components/src/components/FormField/components/PasswordInput.js +40 -1
  64. package/lib/src/core-components/src/components/FormField/components/PinInput.js +75 -1
  65. package/lib/src/core-components/src/components/FormField/components/RadioInput.js +54 -1
  66. package/lib/src/core-components/src/components/FormField/components/TextDropdownInput.js +94 -1
  67. package/lib/src/core-components/src/components/FormField/components/ToggleInput.js +36 -1
  68. package/lib/src/core-components/src/components/FormField/components/index.js +11 -1
  69. package/lib/src/core-components/src/components/FormField/css-properties.js +161 -1
  70. package/lib/src/core-components/src/components/FormField/index.js +2 -1
  71. package/lib/src/core-components/src/components/Icon/Icon.js +79 -1
  72. package/lib/src/core-components/src/components/Icon/index.js +2 -1
  73. package/lib/src/core-components/src/components/Icon/types.js +9 -1
  74. package/lib/src/core-components/src/components/Loader/loader.component.js +215 -2
  75. package/lib/src/core-components/src/components/Masonry/Masonry.js +73 -1
  76. package/lib/src/core-components/src/components/Masonry/elements.js +46 -29
  77. package/lib/src/core-components/src/components/Masonry/hooks.js +100 -1
  78. package/lib/src/core-components/src/components/Masonry/index.js +3 -1
  79. package/lib/src/core-components/src/components/Masonry/types.js +1 -1
  80. package/lib/src/core-components/src/components/Modal/BasicModal/modal.component.js +116 -1
  81. package/lib/src/core-components/src/components/Modal/index.js +2 -1
  82. package/lib/src/core-components/src/components/Modal/modal-confirm/modal-confirm.component.js +147 -1
  83. package/lib/src/core-components/src/components/Picker/color-picker/color-picker.component.js +12 -1
  84. package/lib/src/core-components/src/components/Picker/color-picker-modal/color-picker-modal.component.js +40 -1
  85. package/lib/src/core-components/src/components/Picker/index.js +2 -1
  86. package/lib/src/core-components/src/components/Selection/index.js +4 -1
  87. package/lib/src/core-components/src/components/Selection/multi-select/multi-select.component.js +49 -1
  88. package/lib/src/core-components/src/components/Selection/multi-select-with-field/multi-select-with-field.component.js +58 -1
  89. package/lib/src/core-components/src/components/Selection/multi-selection-dropdown/multi-selection-dropdown.component.js +43 -1
  90. package/lib/src/core-components/src/components/Selection/single-select/single-select.component.js +87 -1
  91. package/lib/src/core-components/src/components/Skeleton/Skeleton.js +51 -1
  92. package/lib/src/core-components/src/components/Skeleton/elements.js +143 -54
  93. package/lib/src/core-components/src/components/Skeleton/index.js +2 -1
  94. package/lib/src/core-components/src/components/Skeleton/types.js +4 -1
  95. package/lib/src/core-components/src/components/SpeedDial/SpeedDial.js +128 -1
  96. package/lib/src/core-components/src/components/SpeedDial/elements.js +132 -62
  97. package/lib/src/core-components/src/components/SpeedDial/index.js +2 -1
  98. package/lib/src/core-components/src/components/SpeedDial/types.js +3 -1
  99. package/lib/src/core-components/src/components/Stepper2/stepper.component.js +139 -1
  100. package/lib/src/core-components/src/components/Switch/Switch.js +26 -1
  101. package/lib/src/core-components/src/components/Switch/elements.js +103 -34
  102. package/lib/src/core-components/src/components/Switch/index.js +2 -1
  103. package/lib/src/core-components/src/components/Switch/types.js +3 -1
  104. package/lib/src/core-components/src/components/Table/Table.js +1357 -1
  105. package/lib/src/core-components/src/components/Table/columnReorder.d.ts +128 -0
  106. package/lib/src/core-components/src/components/Table/columnReorder.js +530 -0
  107. package/lib/src/core-components/src/components/Table/columnResize.d.ts +99 -0
  108. package/lib/src/core-components/src/components/Table/columnResize.js +399 -0
  109. package/lib/src/core-components/src/components/Table/elements.d.ts +9 -1
  110. package/lib/src/core-components/src/components/Table/elements.js +324 -155
  111. package/lib/src/core-components/src/components/Table/filters.js +555 -30
  112. package/lib/src/core-components/src/components/Table/hooks.js +536 -2
  113. package/lib/src/core-components/src/components/Table/index.d.ts +4 -0
  114. package/lib/src/core-components/src/components/Table/index.js +6 -1
  115. package/lib/src/core-components/src/components/Table/types.d.ts +58 -0
  116. package/lib/src/core-components/src/components/Table/types.js +1 -1
  117. package/lib/src/core-components/src/components/Tabs/tabs.component.js +22 -1
  118. package/lib/src/core-components/src/components/Tags1/Tags.component.js +118 -1
  119. package/lib/src/core-components/src/components/Tags1/types.js +20 -1
  120. package/lib/src/core-components/src/components/Timer1/timer.component.js +76 -1
  121. package/lib/src/core-components/src/components/Toast/Toast.js +50 -1
  122. package/lib/src/core-components/src/components/Toast/elements.js +122 -41
  123. package/lib/src/core-components/src/components/Toast/index.js +2 -1
  124. package/lib/src/core-components/src/components/Toast/types.js +9 -1
  125. package/lib/src/core-components/src/components/Tooltip/Tooltip.js +200 -1
  126. package/lib/src/core-components/src/components/Tooltip/elements.js +117 -55
  127. package/lib/src/core-components/src/components/Tooltip/index.js +2 -1
  128. package/lib/src/core-components/src/components/Tooltip/types.js +17 -1
  129. package/lib/src/core-components/src/components/Tooltip/utils.js +140 -1
  130. package/lib/src/core-components/src/components/TreeSelect/TreeSelect.js +303 -1
  131. package/lib/src/core-components/src/components/TreeSelect/elements.js +216 -117
  132. package/lib/src/core-components/src/components/TreeSelect/hooks.js +252 -1
  133. package/lib/src/core-components/src/components/TreeSelect/index.js +3 -1
  134. package/lib/src/core-components/src/components/TreeSelect/types.js +1 -1
  135. package/lib/src/core-components/src/components/ag-grid/AgGrid.d.ts +11 -0
  136. package/lib/src/core-components/src/components/ag-grid/AgGrid.js +733 -0
  137. package/lib/src/core-components/src/components/ag-grid/elements.d.ts +246 -0
  138. package/lib/src/core-components/src/components/ag-grid/elements.js +1156 -0
  139. package/lib/src/core-components/src/components/ag-grid/hooks.d.ts +196 -0
  140. package/lib/src/core-components/src/components/ag-grid/hooks.js +943 -0
  141. package/lib/src/core-components/src/components/ag-grid/index.d.ts +9 -0
  142. package/lib/src/core-components/src/components/ag-grid/index.js +13 -0
  143. package/lib/src/core-components/src/components/ag-grid/types.d.ts +1367 -0
  144. package/lib/src/core-components/src/components/ag-grid/types.js +6 -0
  145. package/lib/src/core-components/src/components/index.d.ts +1 -0
  146. package/lib/src/core-components/src/components/index.js +31 -1
  147. package/lib/src/core-components/src/components/pdf/pdf-images.components.js +7 -1
  148. package/lib/src/core-components/src/components/pdf/pdf-table.components.js +48 -5
  149. package/lib/src/core-components/src/components/pdf/pdf-typography.components.js +70 -1
  150. package/lib/src/core-components/src/components/pdf/pdf-wrapped-view.components.js +50 -1
  151. package/lib/src/core-components/src/core-components/Avatar.js +33 -4
  152. package/lib/src/core-components/src/core-components/CoreButton/CoreButton.js +10 -1
  153. package/lib/src/core-components/src/core-components/CoreButton/elements.js +176 -67
  154. package/lib/src/core-components/src/core-components/CoreButton/index.js +3 -1
  155. package/lib/src/core-components/src/core-components/CoreButton/types.js +6 -1
  156. package/lib/src/core-components/src/core-components/CoreButton/utils.js +12 -1
  157. package/lib/src/core-components/src/core-components/Divider/Divider.js +19 -4
  158. package/lib/src/core-components/src/core-components/Divider/index.js +1 -1
  159. package/lib/src/core-components/src/core-components/SelectionCardStrip/index.js +1 -1
  160. package/lib/src/core-components/src/core-components/SelectionCardStrip/selectionCardStrip.js +33 -10
  161. package/lib/src/core-components/src/core-components/StateLayer.js +5 -3
  162. package/lib/src/core-components/src/core-components/ToggleCore/elements.js +50 -25
  163. package/lib/src/core-components/src/core-components/ToggleCore/index.js +2 -1
  164. package/lib/src/core-components/src/core-components/ToggleCore/toggleCore.js +14 -1
  165. package/lib/src/core-components/src/core-components/atoms/Input/Input.js +22 -1
  166. package/lib/src/core-components/src/core-components/atoms/Label/Label.js +21 -1
  167. package/lib/src/core-components/src/core-components/atoms/Textarea/Textarea.js +19 -1
  168. package/lib/src/core-components/src/core-components/index.js +3 -1
  169. package/lib/src/core-components/src/helpers/constants.js +11 -1
  170. package/lib/src/core-components/src/hooks/index.js +1 -1
  171. package/lib/src/core-components/src/hooks/outside.hook.js +28 -1
  172. package/lib/src/core-components/src/index.js +12 -1
  173. package/lib/src/core-components/src/tc.global.css +16 -3
  174. package/lib/src/core-components/src/tc.module.css +2 -2
  175. package/lib/src/core-components/src/utils/abstracts/breakpoints/index.js +28 -1
  176. package/lib/src/core-components/src/utils/abstracts/colors/index.js +49 -1
  177. package/lib/src/core-components/src/utils/abstracts/index.js +5 -1
  178. package/lib/src/core-components/src/utils/abstracts/space/index.js +26 -1
  179. package/lib/src/core-components/src/utils/abstracts/theme/ThemeBoundary.js +8 -1
  180. package/lib/src/core-components/src/utils/abstracts/theme/default-themes.js +30 -1
  181. package/lib/src/core-components/src/utils/abstracts/theme/index.js +3 -1
  182. package/lib/src/core-components/src/utils/abstracts/theme/theme.js +30 -1
  183. package/lib/src/core-components/src/utils/abstracts/theme/types.js +1 -1
  184. package/lib/src/core-components/src/utils/abstracts/theme/useTheme.js +17 -1
  185. package/lib/src/core-components/src/utils/abstracts/typography/index.js +25 -1
  186. package/lib/src/core-components/src/utils/context/DefaultsProvider.js +8 -1
  187. package/lib/src/core-components/src/utils/context/InternalProvider.js +24 -1
  188. package/lib/src/core-components/src/utils/context/index.js +2 -1
  189. package/lib/src/core-components/src/utils/designTokens.js +125 -1
  190. package/lib/src/core-components/src/utils/helpers/attachSubComponents.js +23 -1
  191. package/lib/src/core-components/src/utils/helpers/flattenChildren.js +11 -1
  192. package/lib/src/core-components/src/utils/helpers/getChildByType.js +3 -1
  193. package/lib/src/core-components/src/utils/helpers/index.js +5 -1
  194. package/lib/src/core-components/src/utils/helpers/isComponentType.js +16 -1
  195. package/lib/src/core-components/src/utils/helpers/separateChildrenByType.js +12 -1
  196. package/lib/src/core-components/src/utils/hooks/index.js +18 -1
  197. package/lib/src/core-components/src/utils/hooks/useClickOutside.js +18 -1
  198. package/lib/src/core-components/src/utils/hooks/useCombinedRefs.js +17 -1
  199. package/lib/src/core-components/src/utils/hooks/useDebouncedCallback.js +12 -1
  200. package/lib/src/core-components/src/utils/hooks/useDebouncedValue.js +20 -1
  201. package/lib/src/core-components/src/utils/hooks/useDeprecation.js +40 -1
  202. package/lib/src/core-components/src/utils/hooks/useDeviceDetect.js +10 -1
  203. package/lib/src/core-components/src/utils/hooks/useDeviceForm.js +24 -1
  204. package/lib/src/core-components/src/utils/hooks/useDisableBodyScroll.js +16 -1
  205. package/lib/src/core-components/src/utils/hooks/useHoverState.js +36 -1
  206. package/lib/src/core-components/src/utils/hooks/useId.js +7 -1
  207. package/lib/src/core-components/src/utils/hooks/useIsBrowser.js +11 -1
  208. package/lib/src/core-components/src/utils/hooks/useMediaQuery.js +16 -1
  209. package/lib/src/core-components/src/utils/hooks/useOverflow.js +22 -1
  210. package/lib/src/core-components/src/utils/hooks/useSafeLayoutEffect.js +5 -1
  211. package/lib/src/core-components/src/utils/hooks/useScrollingUp.js +18 -1
  212. package/lib/src/core-components/src/utils/hooks/useTrapFocus.js +30 -1
  213. package/lib/src/core-components/src/utils/hooks/useWindowDimensions.js +23 -1
  214. package/lib/src/core-components/src/utils/index.js +9 -1
  215. package/lib/src/core-components/src/utils/stories/Wrappers.js +23 -8
  216. package/lib/src/core-components/src/utils/stories/cleanProps.js +5 -1
  217. package/lib/src/core-components/src/utils/stories/index.js +4 -1
  218. package/lib/src/core-components/src/utils/stories/sleep.js +4 -1
  219. package/lib/src/core-components/src/utils/stories/view-ports.js +50 -1
  220. package/lib/src/core-components/src/utils/styling/calcWidthOfColumns.js +5 -1
  221. package/lib/src/core-components/src/utils/styling/createGridContainer.js +12 -6
  222. package/lib/src/core-components/src/utils/styling/createTransition.js +7 -2
  223. package/lib/src/core-components/src/utils/styling/forwardProps.js +10 -1
  224. package/lib/src/core-components/src/utils/styling/index.js +5 -1
  225. package/lib/src/core-components/src/utils/styling/pxToRem.js +6 -1
  226. package/lib/src/core-components/src/utils/testing/getComputedStyle.js +3 -1
  227. package/lib/src/core-components/src/utils/testing/index.js +1 -1
  228. package/lib/src/core-components/src/utils/utility.util.js +14 -1
  229. package/lib/src/core-components/tailwind.config.js +233 -1
  230. package/lib/src/core-hooks/index.js +3 -1
  231. package/lib/src/core-hooks/src/useClickOutside/useClickOutside.hook.js +46 -1
  232. package/lib/src/core-hooks/src/useDebounce/useDebounce.hook.js +30 -1
  233. package/lib/src/core-hooks/src/usePreventEKey/usePreventEKey.hook.js +8 -1
  234. package/lib/src/core-utils/index.js +7 -1
  235. package/lib/src/core-utils/src/calculation/calculation.util.js +89 -1
  236. package/lib/src/core-utils/src/colors/color.util.js +15 -1
  237. package/lib/src/core-utils/src/convert/numberToWords/numToWords.util.js +145 -1
  238. package/lib/src/core-utils/src/convert/typography/camelCaseToTitleCase.util.js +5 -1
  239. package/lib/src/core-utils/src/form-helper/form-helper.util.js +82 -1
  240. package/lib/src/core-utils/src/index.js +7 -1
  241. package/lib/src/core-utils/src/utility/utility.util.js +12 -1
  242. package/lib/src/core-utils/src/uuid/uuid.util.js +8 -1
  243. package/package.json +1 -1
@@ -1 +1,118 @@
1
- "use strict";import{jsxs as u,jsx as g}from"react/jsx-runtime";import{useState as h,useRef as q}from"react";import e from"../../tc.module.css";import{cn as n}from"../../utils";export const Tags=({defaultTags:L=[],placeholder:N="Type and press Enter to add tags...",maxTags:a,disabled:c=!1,className:R="",label:w,hasError:d=!1,errorMessage:x,removable:v=!0,tagVariant:D="default",size:m="md",classNames:l={},styles:o={},onChange:B,onBlur:F,onTagAdd:I,onTagRemove:V})=>{const[r,k]=h(L),[p,f]=h(""),[_,C]=h(!1),b=q(null),$={default:e["bg-gray-100"]+" "+e["text-gray-800"]+" "+e["border-gray-200"],primary:e["bg-blue-100"]+" "+e["text-blue-800"]+" "+e["border-blue-200"],secondary:e["bg-gray-100"]+" "+e["text-gray-700"]+" "+e["border-gray-300"],success:e["bg-green-100"]+" "+e["text-green-800"]+" "+e["border-green-200"],warning:e["bg-yellow-100"]+" "+e["text-yellow-800"]+" "+e["border-yellow-200"],danger:e["bg-red-100"]+" "+e["text-red-800"]+" "+e["border-red-200"]},y={sm:{tag:e["text-xs"]+" "+e["px-2"]+" "+e["py-1"],input:e["text-sm"]+" "+e["p-2"],removeBtn:e["w-3"]+" "+e["h-3"]},md:{tag:e["text-sm"]+" "+e["px-3"]+" "+e["py-1"],input:e["text-base"]+" "+e["p-3"],removeBtn:e["w-4"]+" "+e["h-4"]},lg:{tag:e["text-base"]+" "+e["px-4"]+" "+e["py-2"],input:e["text-lg"]+" "+e["p-4"],removeBtn:e["w-5"]+" "+e["h-5"]}},j=t=>{const i=t.trim();if(!i)return;if(r.includes(i)){f("");return}if(a&&r.length>=a){f("");return}const s=[...r,i];k(s),f(""),B?.(s),I?.(i)},T=t=>{if(!v)return;const i=r[t],s=r.filter((z,A)=>A!==t);k(s),B?.(s),V?.(i,t)},K=t=>{t.key==="Enter"?(t.preventDefault(),j(p)):t.key==="Backspace"&&!p&&r.length>0?T(r.length-1):t.key==="Escape"&&(f(""),b.current?.blur())},P=()=>{C(!1),p.trim()&&j(p),F?.(r)},S=()=>{c||b.current?.focus()};return u("div",{className:n(e.flex,e["flex-col"],e["w-full"],R,l.container),style:o.container,children:[w&&u("label",{className:n(e["text-sm"],e["font-medium"],e["mb-2"],d?e["text-red-600"]:e["text-gray-700"],l.label),style:o.label,children:[w,a&&u("span",{className:n(e["text-xs"],e["text-gray-500"],e["ml-2"]),children:["(",r.length,"/",a,")"]})]}),u("div",{onClick:S,className:n(e["min-h-10"],e["w-full"],e.border,e["rounded-md"],e["bg-white"],e.flex,e["flex-wrap"],e["gap-2"],e["p-2"],e["cursor-text"],e["transition-colors"],_&&!d&&e["border-blue-500"]+" "+e["ring-1"]+" "+e["ring-blue-500"],d?e["border-red"]:e["border-gray-300"],c&&e["bg-gray-50"]+" "+e["cursor-not-allowed"],!c&&e["hover:border-gray-400"],l.tagsContainer),style:o.tagsContainer,children:[r.map((t,i)=>u("span",{className:n(e.flex,e["inline-flex"],e["items-center"],e.border,e["rounded-full"],e["font-medium"],e["transition-colors"],e["items-center"],y[m].tag,$[D],c&&e["opacity-60"],l.tag),style:o.tag,children:[g("span",{className:n(e.truncate,e["max-w-32"],l.tagText),style:o.tagText,children:t}),v&&!c&&g("button",{type:"button",onClick:s=>{s.stopPropagation(),T(i)},className:n(e["ml-2"],e["flex-shrink-0"],e["rounded-full"],e["hover:bg-black"],e["hover:bg-opacity-10"],e["transition-colors"],e["focus:outline-none"],e["focus:ring-2"],e["focus:ring-offset-1"],e["focus:ring-gray-500"],l.removeButton),style:o.removeButton,"aria-label":`Remove ${t} tag`,children:g("svg",{className:n(y[m].removeBtn),fill:"currentColor",viewBox:"0 0 20 20",children:g("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]},`${t}-${i}`)),(!a||r.length<a)&&g("input",{ref:b,type:"text",value:p,onChange:t=>f(t.target.value),onKeyDown:K,onFocus:()=>C(!0),onBlur:P,placeholder:r.length===0?N:"",disabled:c,className:n(e["flex-1"],e["min-w-32"],e["border-0"],e["outline-none"],e["bg-transparent"],y[m].input.replace(e["p-3"],e["p-1"]),c&&e["cursor-not-allowed"],l.input),style:o.input,"aria-label":"Add new tag"})]}),(x||a)&&u("div",{className:n(e["mt-1"],e.flex,e["justify-between"],e["text-xs"],l.helperText),style:o.helperText,children:[x&&d&&g("span",{className:n(e["text-red-600"],l.errorMessage),style:o.errorMessage,children:x}),a&&!d&&u("span",{className:n(e["text-gray-500"],e["ml-auto"]),children:[r.length,"/",a," tags"]})]}),!d&&!x&&g("p",{className:n(e["mt-1"],e["text-xs"],e["text-gray-500"],l.helperText),style:o.helperText,children:"Press Enter to add tags, Backspace to remove last tag"})]})};
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState, useRef } from 'react';
3
+ import s from '../../tc.module.css';
4
+ import { cn } from '../../utils';
5
+ export const Tags = ({ defaultTags = [], placeholder = 'Type and press Enter to add tags...', maxTags, disabled = false, className = '', label, hasError = false, errorMessage, removable = true, tagVariant = 'default', size = 'md', classNames = {}, styles = {}, onChange, onBlur, onTagAdd, onTagRemove, }) => {
6
+ const [tags, setTags] = useState(defaultTags);
7
+ const [inputValue, setInputValue] = useState('');
8
+ const [isFocused, setIsFocused] = useState(false);
9
+ const inputRef = useRef(null);
10
+ // Tag variant styles
11
+ const tagVariants = {
12
+ default: s['bg-gray-100'] + ' ' + s['text-gray-800'] + ' ' + s['border-gray-200'],
13
+ primary: s['bg-blue-100'] + ' ' + s['text-blue-800'] + ' ' + s['border-blue-200'],
14
+ secondary: s['bg-gray-100'] + ' ' + s['text-gray-700'] + ' ' + s['border-gray-300'],
15
+ success: s['bg-green-100'] +
16
+ ' ' +
17
+ s['text-green-800'] +
18
+ ' ' +
19
+ s['border-green-200'],
20
+ warning: s['bg-yellow-100'] +
21
+ ' ' +
22
+ s['text-yellow-800'] +
23
+ ' ' +
24
+ s['border-yellow-200'],
25
+ danger: s['bg-red-100'] + ' ' + s['text-red-800'] + ' ' + s['border-red-200'],
26
+ };
27
+ // Size styles
28
+ const sizeStyles = {
29
+ sm: {
30
+ tag: s['text-xs'] + ' ' + s['px-2'] + ' ' + s['py-1'],
31
+ input: s['text-sm'] + ' ' + s['p-2'],
32
+ removeBtn: s['w-3'] + ' ' + s['h-3'],
33
+ },
34
+ md: {
35
+ tag: s['text-sm'] + ' ' + s['px-3'] + ' ' + s['py-1'],
36
+ input: s['text-base'] + ' ' + s['p-3'],
37
+ removeBtn: s['w-4'] + ' ' + s['h-4'],
38
+ },
39
+ lg: {
40
+ tag: s['text-base'] + ' ' + s['px-4'] + ' ' + s['py-2'],
41
+ input: s['text-lg'] + ' ' + s['p-4'],
42
+ removeBtn: s['w-5'] + ' ' + s['h-5'],
43
+ },
44
+ };
45
+ const addTag = (tag) => {
46
+ const trimmedTag = tag.trim();
47
+ if (!trimmedTag)
48
+ return;
49
+ // Check if tag already exists
50
+ if (tags.includes(trimmedTag)) {
51
+ setInputValue('');
52
+ return;
53
+ }
54
+ // Check max tags limit
55
+ if (maxTags && tags.length >= maxTags) {
56
+ setInputValue('');
57
+ return;
58
+ }
59
+ const newTags = [...tags, trimmedTag];
60
+ setTags(newTags);
61
+ setInputValue('');
62
+ // Callbacks
63
+ onChange?.(newTags);
64
+ onTagAdd?.(trimmedTag);
65
+ };
66
+ const removeTag = (indexToRemove) => {
67
+ if (!removable)
68
+ return;
69
+ const tagToRemove = tags[indexToRemove];
70
+ const newTags = tags.filter((_, index) => index !== indexToRemove);
71
+ setTags(newTags);
72
+ // Callbacks
73
+ onChange?.(newTags);
74
+ onTagRemove?.(tagToRemove, indexToRemove);
75
+ };
76
+ const handleKeyDown = (e) => {
77
+ if (e.key === 'Enter') {
78
+ e.preventDefault();
79
+ addTag(inputValue);
80
+ }
81
+ else if (e.key === 'Backspace' && !inputValue && tags.length > 0) {
82
+ // Remove last tag when backspace is pressed on empty input
83
+ removeTag(tags.length - 1);
84
+ }
85
+ else if (e.key === 'Escape') {
86
+ setInputValue('');
87
+ inputRef.current?.blur();
88
+ }
89
+ };
90
+ const handleInputBlur = () => {
91
+ setIsFocused(false);
92
+ // Add current input as tag if not empty
93
+ if (inputValue.trim()) {
94
+ addTag(inputValue);
95
+ }
96
+ onBlur?.(tags);
97
+ };
98
+ const handleContainerClick = () => {
99
+ if (!disabled) {
100
+ inputRef.current?.focus();
101
+ }
102
+ };
103
+ return (_jsxs("div", { className: cn(s.flex, s['flex-col'], s['w-full'], className, classNames.container), style: styles.container, children: [label && (_jsxs("label", { className: cn(s['text-sm'], s['font-medium'], s['mb-2'], hasError ? s['text-red-600'] : s['text-gray-700'], classNames.label), style: styles.label, children: [label, maxTags && (_jsxs("span", { className: cn(s['text-xs'], s['text-gray-500'], s['ml-2']), children: ["(", tags.length, "/", maxTags, ")"] }))] })), _jsxs("div", { onClick: handleContainerClick, className: cn(s['min-h-10'], s['w-full'], s['border'], s['rounded-md'], s['bg-white'], s['flex'], s['flex-wrap'], s['gap-2'], s['p-2'], s['cursor-text'], s['transition-colors'],
104
+ // Focus styles
105
+ isFocused &&
106
+ !hasError &&
107
+ s['border-blue-500'] + ' ' + s['ring-1'] + ' ' + s['ring-blue-500'],
108
+ // Error styles
109
+ hasError ? s['border-red'] : s['border-gray-300'],
110
+ // Disabled styles
111
+ disabled && s['bg-gray-50'] + ' ' + s['cursor-not-allowed'],
112
+ // Hover styles
113
+ !disabled && s['hover:border-gray-400'], classNames.tagsContainer), style: styles.tagsContainer, children: [tags.map((tag, index) => (_jsxs("span", { className: cn(s['flex'], s['inline-flex'], s['items-center'], s['border'], s['rounded-full'], s['font-medium'], s['transition-colors'], s['items-center'], sizeStyles[size].tag, tagVariants[tagVariant], disabled && s['opacity-60'], classNames.tag), style: styles.tag, children: [_jsx("span", { className: cn(s['truncate'], s['max-w-32'], classNames.tagText), style: styles.tagText, children: tag }), removable && !disabled && (_jsx("button", { type: "button", onClick: (e) => {
114
+ e.stopPropagation();
115
+ removeTag(index);
116
+ }, className: cn(s['ml-2'], s['flex-shrink-0'], s['rounded-full'], s['hover:bg-black'], s['hover:bg-opacity-10'], s['transition-colors'], s['focus:outline-none'], s['focus:ring-2'], s['focus:ring-offset-1'], s['focus:ring-gray-500'], classNames.removeButton), style: styles.removeButton, "aria-label": `Remove ${tag} tag`, children: _jsx("svg", { className: cn(sizeStyles[size].removeBtn), fill: "currentColor", viewBox: "0 0 20 20", children: _jsx("path", { fillRule: "evenodd", d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z", clipRule: "evenodd" }) }) }))] }, `${tag}-${index}`))), (!maxTags || tags.length < maxTags) && (_jsx("input", { ref: inputRef, type: "text", value: inputValue, onChange: (e) => setInputValue(e.target.value), onKeyDown: handleKeyDown, onFocus: () => setIsFocused(true), onBlur: handleInputBlur, placeholder: tags.length === 0 ? placeholder : '', disabled: disabled, className: cn(s['flex-1'], s['min-w-32'], s['border-0'], s['outline-none'], s['bg-transparent'], sizeStyles[size].input.replace(s['p-3'], s['p-1']), // Adjust padding for input inside container
117
+ disabled && s['cursor-not-allowed'], classNames.input), style: styles.input, "aria-label": "Add new tag" }))] }), (errorMessage || maxTags) && (_jsxs("div", { className: cn(s['mt-1'], s['flex'], s['justify-between'], s['text-xs'], classNames.helperText), style: styles.helperText, children: [errorMessage && hasError && (_jsx("span", { className: cn(s['text-red-600'], classNames.errorMessage), style: styles.errorMessage, children: errorMessage })), maxTags && !hasError && (_jsxs("span", { className: cn(s['text-gray-500'], s['ml-auto']), children: [tags.length, "/", maxTags, " tags"] }))] })), !hasError && !errorMessage && (_jsx("p", { className: cn(s['mt-1'], s['text-xs'], s['text-gray-500'], classNames.helperText), style: styles.helperText, children: "Press Enter to add tags, Backspace to remove last tag" }))] }));
118
+ };
@@ -1 +1,20 @@
1
- "use strict";export const TAG_TYPES=["light","gray","dark","success","warn","error","update","attention","disabled","red","orange","yellow","green","teal","purple","themeable"],TAG_SIZES=["large","regular","small"],TAG_FAMILIES=["bold","soft"];
1
+ export const TAG_TYPES = [
2
+ 'light',
3
+ 'gray',
4
+ 'dark',
5
+ 'success',
6
+ 'warn',
7
+ 'error',
8
+ 'update',
9
+ 'attention',
10
+ 'disabled',
11
+ 'red',
12
+ 'orange',
13
+ 'yellow',
14
+ 'green',
15
+ 'teal',
16
+ 'purple',
17
+ 'themeable',
18
+ ];
19
+ export const TAG_SIZES = ['large', 'regular', 'small'];
20
+ export const TAG_FAMILIES = ['bold', 'soft'];
@@ -1 +1,76 @@
1
- "use strict";import{jsx as p,jsxs as f}from"react/jsx-runtime";import v,{useEffect as x,useState as d,useImperativeHandle as h}from"react";import{Icon as S}from"../Icon/Icon";import s from"../../tc.module.css";import{cn as I}from"../../utils";export const Timer=v.forwardRef(({onClear:i},u)=>{const[a,r]=d("00"),[m,e]=d("10");return x(()=>{const n=parseInt(m),c=parseInt(a),o=setInterval(()=>{if(c===0&&n===0)r("00"),e("00"),clearInterval(o),i&&i();else{let t=(n-1).toString();if(t.length===1&&(t="0".concat(t)),e(t),n===0){e("59");const l=(c-1).toString();r("0"+l)}}},1e3);return()=>{clearInterval(o)}}),h(u,()=>({updateState(){r("02"),e("00")},resetTimer(){const n=parseInt(m),c=parseInt(a==="00"?"02":a),o=setInterval(()=>{if(c===0&&n===0)r("00"),e("00"),clearInterval(o),i&&i();else{let t=(n-1).toString();if(t.length===1&&(t="0".concat(t)),e(t),n===0){e("59");const l=(c-1).toString();r("0"+l)}}},1e3);return()=>{clearInterval(o)}}})),f("div",{className:I(s.flex,s["flex-row"],s["items-center"]),children:[p(S,{nameIcon:"MdAvTimer"}),f("div",{className:I(s["ml-2"],s.flex,s["flex-row"]),children:[f("span",{children:[a,":"]}),p("span",{children:m})]})]})});
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /* eslint-disable react/prop-types */
3
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
4
+ import React, { useEffect, useState, useImperativeHandle } from 'react';
5
+ import { Icon } from '../Icon/Icon';
6
+ import s from '../../tc.module.css';
7
+ import { cn } from '../../utils';
8
+ // eslint-disable-next-line react/display-name
9
+ export const Timer = React.forwardRef(({ onClear }, ref) => {
10
+ const width = 15;
11
+ const [minute, setMinute] = useState('00');
12
+ const [second, setSecond] = useState('10');
13
+ useEffect(() => {
14
+ const sec = parseInt(second);
15
+ const min = parseInt(minute);
16
+ const countDown = setInterval(() => {
17
+ if (min === 0 && sec === 0) {
18
+ setMinute('00');
19
+ setSecond('00');
20
+ clearInterval(countDown);
21
+ onClear && onClear();
22
+ }
23
+ else {
24
+ let secondstTmp = (sec - 1).toString();
25
+ if (secondstTmp.length === 1) {
26
+ secondstTmp = '0'.concat(secondstTmp);
27
+ }
28
+ setSecond(secondstTmp);
29
+ if (sec === 0) {
30
+ setSecond('59');
31
+ const m = (min - 1).toString();
32
+ setMinute('0' + m);
33
+ }
34
+ }
35
+ }, 1000);
36
+ return () => {
37
+ clearInterval(countDown);
38
+ };
39
+ });
40
+ useImperativeHandle(ref, () => ({
41
+ updateState() {
42
+ setMinute('02');
43
+ setSecond('00');
44
+ },
45
+ resetTimer() {
46
+ // eslint-disable-next-line no-console
47
+ const sec = parseInt(second);
48
+ const min = parseInt(minute === '00' ? '02' : minute);
49
+ const countDown = setInterval(() => {
50
+ // eslint-disable-next-line no-console
51
+ if (min === 0 && sec === 0) {
52
+ setMinute('00');
53
+ setSecond('00');
54
+ clearInterval(countDown);
55
+ onClear && onClear();
56
+ }
57
+ else {
58
+ let secondstTmp = (sec - 1).toString();
59
+ if (secondstTmp.length === 1) {
60
+ secondstTmp = '0'.concat(secondstTmp);
61
+ }
62
+ setSecond(secondstTmp);
63
+ if (sec === 0) {
64
+ setSecond('59');
65
+ const m = (min - 1).toString();
66
+ setMinute('0' + m);
67
+ }
68
+ }
69
+ }, 1000);
70
+ return () => {
71
+ clearInterval(countDown);
72
+ };
73
+ },
74
+ }));
75
+ return (_jsxs("div", { className: cn(s['flex'], s['flex-row'], s['items-center']), children: [_jsx(Icon, { nameIcon: "MdAvTimer" }), _jsxs("div", { className: cn(s['ml-2'], s['flex'], s['flex-row']), children: [_jsxs("span", { children: [minute, ":"] }), _jsx("span", { children: second })] })] }));
76
+ });
@@ -1 +1,50 @@
1
- "use strict";"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{forwardRef as p,useEffect as w,useCallback as x}from"react";import{ToastElement as I,ToastContainerElement as T,IconWrapper as $,ContentWrapper as W,Message as B,ActionsWrapper as b,ActionButton as j,DismissButton as E,ProgressBar as N}from"./elements";const A=()=>n("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"}),e("polyline",{points:"22 4 12 14.01 9 11.01"})]}),D=()=>n("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),e("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),L=()=>n("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),e("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),M=()=>n("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("circle",{cx:"12",cy:"12",r:"10"}),e("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),e("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]}),O=()=>n("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),P=a=>{switch(a){case"success":return e(A,{});case"error":return e(D,{});case"warning":return e(L,{});case"info":return e(M,{});default:return null}};export const Toast=p(function(c,l){const{message:u,type:t="default",isOpen:s=!0,onClose:o,action:r,icon:h,showIcon:y=!0,duration:i,showProgress:f=!1,className:m,...C}=c;w(()=>{if(i&&s&&o){const v=setTimeout(()=>{o()},i);return()=>clearTimeout(v)}},[i,s,o]);const g=x(()=>{o?.()},[o]),k=x(()=>{r?.onClick?.()},[r]),d=h??(y?P(t):null);return n(I,{ref:l,$type:t,$isOpen:s,$position:"bottom-right",role:"alert","aria-live":"assertive","data-aui":"toast",className:m,...C,children:[d&&e($,{$type:t,"aria-hidden":"true",children:d}),e(W,{children:e(B,{children:u})}),n(b,{children:[r&&e(j,{$type:t,onClick:k,"aria-label":r.ariaLabel||r.text,children:r.text}),o&&e(E,{$type:t,onClick:g,"aria-label":"Dismiss",children:e(O,{})})]}),f&&i&&e(N,{$type:t,$duration:i})]})});Toast.displayName="Toast";export const ToastContainer=p(function(c,l){const{position:u="bottom-right",children:t,gap:s="8px",...o}=c;return e(T,{ref:l,$position:u,$gap:s,"data-aui":"toast-container",...o,children:t})});ToastContainer.displayName="ToastContainer";
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { forwardRef, useEffect, useCallback } from 'react';
4
+ import { ToastElement, ToastContainerElement, IconWrapper, ContentWrapper, Message, ActionsWrapper, ActionButton, DismissButton, ProgressBar, } from './elements';
5
+ // Default icons
6
+ const SuccessIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }), _jsx("polyline", { points: "22 4 12 14.01 9 11.01" })] }));
7
+ const ErrorIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("circle", { cx: "12", cy: "12", r: "10" }), _jsx("line", { x1: "15", y1: "9", x2: "9", y2: "15" }), _jsx("line", { x1: "9", y1: "9", x2: "15", y2: "15" })] }));
8
+ const WarningIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("path", { d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" }), _jsx("line", { x1: "12", y1: "9", x2: "12", y2: "13" }), _jsx("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })] }));
9
+ const InfoIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("circle", { cx: "12", cy: "12", r: "10" }), _jsx("line", { x1: "12", y1: "16", x2: "12", y2: "12" }), _jsx("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })] }));
10
+ const CloseIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [_jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), _jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })] }));
11
+ const getDefaultIcon = (type) => {
12
+ switch (type) {
13
+ case 'success':
14
+ return _jsx(SuccessIcon, {});
15
+ case 'error':
16
+ return _jsx(ErrorIcon, {});
17
+ case 'warning':
18
+ return _jsx(WarningIcon, {});
19
+ case 'info':
20
+ return _jsx(InfoIcon, {});
21
+ default:
22
+ return null;
23
+ }
24
+ };
25
+ export const Toast = forwardRef(function ToastComponent(props, ref) {
26
+ const { message, type = 'default', isOpen = true, onClose, action, icon, showIcon = true, duration, showProgress = false, className, ...rest } = props;
27
+ // Auto dismiss
28
+ useEffect(() => {
29
+ if (duration && isOpen && onClose) {
30
+ const timer = setTimeout(() => {
31
+ onClose();
32
+ }, duration);
33
+ return () => clearTimeout(timer);
34
+ }
35
+ }, [duration, isOpen, onClose]);
36
+ const handleClose = useCallback(() => {
37
+ onClose?.();
38
+ }, [onClose]);
39
+ const handleAction = useCallback(() => {
40
+ action?.onClick?.();
41
+ }, [action]);
42
+ const displayIcon = icon ?? (showIcon ? getDefaultIcon(type) : null);
43
+ return (_jsxs(ToastElement, { ref: ref, "$type": type, "$isOpen": isOpen, "$position": "bottom-right", role: "alert", "aria-live": "assertive", "data-aui": "toast", className: className, ...rest, children: [displayIcon && (_jsx(IconWrapper, { "$type": type, "aria-hidden": "true", children: displayIcon })), _jsx(ContentWrapper, { children: _jsx(Message, { children: message }) }), _jsxs(ActionsWrapper, { children: [action && (_jsx(ActionButton, { "$type": type, onClick: handleAction, "aria-label": action.ariaLabel || action.text, children: action.text })), onClose && (_jsx(DismissButton, { "$type": type, onClick: handleClose, "aria-label": "Dismiss", children: _jsx(CloseIcon, {}) }))] }), showProgress && duration && (_jsx(ProgressBar, { "$type": type, "$duration": duration }))] }));
44
+ });
45
+ Toast.displayName = 'Toast';
46
+ export const ToastContainer = forwardRef(function ToastContainerComponent(props, ref) {
47
+ const { position = 'bottom-right', children, gap = '8px', ...rest } = props;
48
+ return (_jsx(ToastContainerElement, { ref: ref, "$position": position, "$gap": gap, "data-aui": "toast-container", ...rest, children: children }));
49
+ });
50
+ ToastContainer.displayName = 'ToastContainer';
@@ -1,4 +1,8 @@
1
- "use strict";import{styled as e,css as n,keyframes as i}from"styled-components";import{tokens as r}from"../../utils/designTokens";import{breakpoints as s}from"../../utils/abstracts";const a=i`
1
+ import { styled, css, keyframes } from 'styled-components';
2
+ import { tokens } from '../../utils/designTokens';
3
+ import { breakpoints } from '../../utils/abstracts';
4
+ // Animations
5
+ const slideInRight = keyframes `
2
6
  from {
3
7
  transform: translateX(100%);
4
8
  opacity: 0;
@@ -7,7 +11,8 @@
7
11
  transform: translateX(0);
8
12
  opacity: 1;
9
13
  }
10
- `,c=i`
14
+ `;
15
+ const slideInLeft = keyframes `
11
16
  from {
12
17
  transform: translateX(-100%);
13
18
  opacity: 0;
@@ -16,7 +21,8 @@
16
21
  transform: translateX(0);
17
22
  opacity: 1;
18
23
  }
19
- `,f=i`
24
+ `;
25
+ const slideInUp = keyframes `
20
26
  from {
21
27
  transform: translateY(100%);
22
28
  opacity: 0;
@@ -25,7 +31,8 @@
25
31
  transform: translateY(0);
26
32
  opacity: 1;
27
33
  }
28
- `,l=i`
34
+ `;
35
+ const slideInDown = keyframes `
29
36
  from {
30
37
  transform: translateY(-100%);
31
38
  opacity: 0;
@@ -34,109 +41,181 @@
34
41
  transform: translateY(0);
35
42
  opacity: 1;
36
43
  }
37
- `,p=i`
44
+ `;
45
+ const progressShrink = keyframes `
38
46
  from {
39
47
  width: 100%;
40
48
  }
41
49
  to {
42
50
  width: 0%;
43
51
  }
44
- `,o={default:{bg:"#1f2937",border:"#374151",text:"#f9fafb",icon:"#9ca3af",accent:r.primary||"#454cbf"},success:{bg:"#065f46",border:"#10b981",text:"#ecfdf5",icon:"#10b981",accent:"#10b981"},error:{bg:"#991b1b",border:"#ef4444",text:"#fef2f2",icon:"#ef4444",accent:"#ef4444"},warning:{bg:"#92400e",border:"#f59e0b",text:"#fffbeb",icon:"#f59e0b",accent:"#f59e0b"},info:{bg:"#1e40af",border:"#3b82f6",text:"#e7f3ff",icon:"#3b82f6",accent:"#3b82f6"}},d=t=>{switch(t){case"top-left":return n`
52
+ `;
53
+ // Type styles
54
+ const typeStyles = {
55
+ default: {
56
+ bg: '#1f2937',
57
+ border: '#374151',
58
+ text: '#f9fafb',
59
+ icon: '#9ca3af',
60
+ accent: tokens.primary || '#454cbf',
61
+ },
62
+ success: {
63
+ bg: '#065f46',
64
+ border: '#10b981',
65
+ text: '#ecfdf5',
66
+ icon: '#10b981',
67
+ accent: '#10b981',
68
+ },
69
+ error: {
70
+ bg: '#991b1b',
71
+ border: '#ef4444',
72
+ text: '#fef2f2',
73
+ icon: '#ef4444',
74
+ accent: '#ef4444',
75
+ },
76
+ warning: {
77
+ bg: '#92400e',
78
+ border: '#f59e0b',
79
+ text: '#fffbeb',
80
+ icon: '#f59e0b',
81
+ accent: '#f59e0b',
82
+ },
83
+ info: {
84
+ bg: '#1e40af',
85
+ border: '#3b82f6',
86
+ text: '#e7f3ff',
87
+ icon: '#3b82f6',
88
+ accent: '#3b82f6',
89
+ },
90
+ };
91
+ const getPositionStyles = (position) => {
92
+ switch (position) {
93
+ case 'top-left':
94
+ return css `
45
95
  top: 1rem;
46
96
  left: 1rem;
47
97
  align-items: flex-start;
48
- `;case"top-center":return n`
98
+ `;
99
+ case 'top-center':
100
+ return css `
49
101
  top: 1rem;
50
102
  left: 50%;
51
103
  transform: translateX(-50%);
52
104
  align-items: center;
53
- `;case"top-right":return n`
105
+ `;
106
+ case 'top-right':
107
+ return css `
54
108
  top: 1rem;
55
109
  right: 1rem;
56
110
  align-items: flex-end;
57
- `;case"bottom-left":return n`
111
+ `;
112
+ case 'bottom-left':
113
+ return css `
58
114
  bottom: 1rem;
59
115
  left: 1rem;
60
116
  align-items: flex-start;
61
- `;case"bottom-center":return n`
117
+ `;
118
+ case 'bottom-center':
119
+ return css `
62
120
  bottom: 1rem;
63
121
  left: 50%;
64
122
  transform: translateX(-50%);
65
123
  align-items: center;
66
- `;default:return n`
124
+ `;
125
+ case 'bottom-right':
126
+ default:
127
+ return css `
67
128
  bottom: 1rem;
68
129
  right: 1rem;
69
130
  align-items: flex-end;
70
- `}},m=t=>t.includes("left")?c:t.includes("right")?a:t.includes("top")?l:f;export const ToastContainerElement=e.div`
131
+ `;
132
+ }
133
+ };
134
+ const getAnimation = (position) => {
135
+ if (position.includes('left'))
136
+ return slideInLeft;
137
+ if (position.includes('right'))
138
+ return slideInRight;
139
+ if (position.includes('top'))
140
+ return slideInDown;
141
+ return slideInUp;
142
+ };
143
+ export const ToastContainerElement = styled.div `
71
144
  position: fixed;
72
145
  z-index: 9999;
73
146
  display: flex;
74
147
  flex-direction: column;
75
- gap: ${({$gap:t})=>t};
148
+ gap: ${({ $gap }) => $gap};
76
149
  pointer-events: none;
77
150
 
78
- ${({$position:t})=>d(t)}
151
+ ${({ $position }) => getPositionStyles($position)}
79
152
 
80
- ${s.xs} {
153
+ ${breakpoints.xs} {
81
154
  left: 1rem;
82
155
  right: 1rem;
83
156
  transform: none;
84
157
  align-items: stretch;
85
158
  }
86
- `,ToastElement=e.div`
87
- display: ${({$isOpen:t})=>t?"flex":"none"};
159
+ `;
160
+ export const ToastElement = styled.div `
161
+ display: ${({ $isOpen }) => ($isOpen ? 'flex' : 'none')};
88
162
  align-items: flex-start;
89
- gap: ${r.spacing150||"0.75rem"};
163
+ gap: ${tokens.spacing150 || '0.75rem'};
90
164
  min-width: 280px;
91
165
  max-width: 420px;
92
- padding: ${r.spacing150||"0.75rem"} ${r.spacing200||"1rem"};
93
- background: ${({$type:t})=>o[t].bg};
94
- border: 1px solid ${({$type:t})=>o[t].border};
95
- border-radius: ${r.borderRadius100||"8px"};
96
- color: ${({$type:t})=>o[t].text};
166
+ padding: ${tokens.spacing150 || '0.75rem'} ${tokens.spacing200 || '1rem'};
167
+ background: ${({ $type }) => typeStyles[$type].bg};
168
+ border: 1px solid ${({ $type }) => typeStyles[$type].border};
169
+ border-radius: ${tokens.borderRadius100 || '8px'};
170
+ color: ${({ $type }) => typeStyles[$type].text};
97
171
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.1);
98
172
  pointer-events: auto;
99
173
  overflow: hidden;
100
174
  position: relative;
101
175
 
102
- animation: ${({$position:t})=>m(t)} 0.3s ease-out;
176
+ animation: ${({ $position }) => getAnimation($position)} 0.3s ease-out;
103
177
 
104
- ${s.xs} {
178
+ ${breakpoints.xs} {
105
179
  min-width: unset;
106
180
  max-width: unset;
107
181
  width: 100%;
108
182
  }
109
- `,IconWrapper=e.span`
183
+ `;
184
+ export const IconWrapper = styled.span `
110
185
  display: flex;
111
186
  align-items: center;
112
187
  justify-content: center;
113
188
  flex-shrink: 0;
114
189
  width: 20px;
115
190
  height: 20px;
116
- color: ${({$type:t})=>o[t].icon};
191
+ color: ${({ $type }) => typeStyles[$type].icon};
117
192
 
118
193
  svg {
119
194
  width: 100%;
120
195
  height: 100%;
121
196
  }
122
- `,ContentWrapper=e.div`
197
+ `;
198
+ export const ContentWrapper = styled.div `
123
199
  flex: 1;
124
200
  min-width: 0;
125
- `,Message=e.div`
201
+ `;
202
+ export const Message = styled.div `
126
203
  font-size: 0.875rem;
127
204
  line-height: 1.5;
128
205
  word-break: break-word;
129
- `,ActionsWrapper=e.div`
206
+ `;
207
+ export const ActionsWrapper = styled.div `
130
208
  display: flex;
131
209
  align-items: center;
132
- gap: ${r.spacing100||"0.5rem"};
210
+ gap: ${tokens.spacing100 || '0.5rem'};
133
211
  flex-shrink: 0;
134
- `,ActionButton=e.button`
212
+ `;
213
+ export const ActionButton = styled.button `
135
214
  background: transparent;
136
- border: 1px solid ${({$type:t})=>o[t].border};
215
+ border: 1px solid ${({ $type }) => typeStyles[$type].border};
137
216
  color: inherit;
138
217
  padding: 0.25rem 0.625rem;
139
- border-radius: ${r.borderRadius050||"4px"};
218
+ border-radius: ${tokens.borderRadius050 || '4px'};
140
219
  font-size: 0.8125rem;
141
220
  font-weight: 500;
142
221
  cursor: pointer;
@@ -148,10 +227,11 @@
148
227
  }
149
228
 
150
229
  &:focus-visible {
151
- outline: 2px solid ${({$type:t})=>o[t].accent};
230
+ outline: 2px solid ${({ $type }) => typeStyles[$type].accent};
152
231
  outline-offset: 2px;
153
232
  }
154
- `,DismissButton=e.button`
233
+ `;
234
+ export const DismissButton = styled.button `
155
235
  display: flex;
156
236
  align-items: center;
157
237
  justify-content: center;
@@ -159,7 +239,7 @@
159
239
  border: none;
160
240
  color: inherit;
161
241
  padding: 0.25rem;
162
- border-radius: ${r.borderRadius050||"4px"};
242
+ border-radius: ${tokens.borderRadius050 || '4px'};
163
243
  cursor: pointer;
164
244
  transition: all 0.2s ease;
165
245
  opacity: 0.7;
@@ -173,7 +253,7 @@
173
253
  }
174
254
 
175
255
  &:focus-visible {
176
- outline: 2px solid ${({$type:t})=>o[t].accent};
256
+ outline: 2px solid ${({ $type }) => typeStyles[$type].accent};
177
257
  outline-offset: 2px;
178
258
  }
179
259
 
@@ -181,11 +261,12 @@
181
261
  width: 100%;
182
262
  height: 100%;
183
263
  }
184
- `,ProgressBar=e.div`
264
+ `;
265
+ export const ProgressBar = styled.div `
185
266
  position: absolute;
186
267
  bottom: 0;
187
268
  left: 0;
188
269
  height: 3px;
189
- background: ${({$type:t})=>o[t].accent};
190
- animation: ${p} ${({$duration:t})=>t}ms linear forwards;
270
+ background: ${({ $type }) => typeStyles[$type].accent};
271
+ animation: ${progressShrink} ${({ $duration }) => $duration}ms linear forwards;
191
272
  `;
@@ -1 +1,2 @@
1
- "use strict";export{Toast,ToastContainer}from"./Toast";export*from"./types";
1
+ export { Toast, ToastContainer } from './Toast';
2
+ export * from './types';
@@ -1 +1,9 @@
1
- "use strict";export const TOAST_TYPES=["default","success","error","warning","info"],TOAST_POSITIONS=["top-left","top-center","top-right","bottom-left","bottom-center","bottom-right"];
1
+ export const TOAST_TYPES = ['default', 'success', 'error', 'warning', 'info'];
2
+ export const TOAST_POSITIONS = [
3
+ 'top-left',
4
+ 'top-center',
5
+ 'top-right',
6
+ 'bottom-left',
7
+ 'bottom-center',
8
+ 'bottom-right',
9
+ ];