react-restyle-components 0.4.39 → 0.4.40

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 (232) 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 +1332 -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/index.js +30 -1
  136. package/lib/src/core-components/src/components/pdf/pdf-images.components.js +7 -1
  137. package/lib/src/core-components/src/components/pdf/pdf-table.components.js +48 -5
  138. package/lib/src/core-components/src/components/pdf/pdf-typography.components.js +70 -1
  139. package/lib/src/core-components/src/components/pdf/pdf-wrapped-view.components.js +50 -1
  140. package/lib/src/core-components/src/core-components/Avatar.js +33 -4
  141. package/lib/src/core-components/src/core-components/CoreButton/CoreButton.js +10 -1
  142. package/lib/src/core-components/src/core-components/CoreButton/elements.js +176 -67
  143. package/lib/src/core-components/src/core-components/CoreButton/index.js +3 -1
  144. package/lib/src/core-components/src/core-components/CoreButton/types.js +6 -1
  145. package/lib/src/core-components/src/core-components/CoreButton/utils.js +12 -1
  146. package/lib/src/core-components/src/core-components/Divider/Divider.js +19 -4
  147. package/lib/src/core-components/src/core-components/Divider/index.js +1 -1
  148. package/lib/src/core-components/src/core-components/SelectionCardStrip/index.js +1 -1
  149. package/lib/src/core-components/src/core-components/SelectionCardStrip/selectionCardStrip.js +33 -10
  150. package/lib/src/core-components/src/core-components/StateLayer.js +5 -3
  151. package/lib/src/core-components/src/core-components/ToggleCore/elements.js +50 -25
  152. package/lib/src/core-components/src/core-components/ToggleCore/index.js +2 -1
  153. package/lib/src/core-components/src/core-components/ToggleCore/toggleCore.js +14 -1
  154. package/lib/src/core-components/src/core-components/atoms/Input/Input.js +22 -1
  155. package/lib/src/core-components/src/core-components/atoms/Label/Label.js +21 -1
  156. package/lib/src/core-components/src/core-components/atoms/Textarea/Textarea.js +19 -1
  157. package/lib/src/core-components/src/core-components/index.js +3 -1
  158. package/lib/src/core-components/src/helpers/constants.js +11 -1
  159. package/lib/src/core-components/src/hooks/index.js +1 -1
  160. package/lib/src/core-components/src/hooks/outside.hook.js +28 -1
  161. package/lib/src/core-components/src/index.js +12 -1
  162. package/lib/src/core-components/src/tc.global.css +12 -1
  163. package/lib/src/core-components/src/tc.module.css +1 -1
  164. package/lib/src/core-components/src/utils/abstracts/breakpoints/index.js +28 -1
  165. package/lib/src/core-components/src/utils/abstracts/colors/index.js +49 -1
  166. package/lib/src/core-components/src/utils/abstracts/index.js +5 -1
  167. package/lib/src/core-components/src/utils/abstracts/space/index.js +26 -1
  168. package/lib/src/core-components/src/utils/abstracts/theme/ThemeBoundary.js +8 -1
  169. package/lib/src/core-components/src/utils/abstracts/theme/default-themes.js +30 -1
  170. package/lib/src/core-components/src/utils/abstracts/theme/index.js +3 -1
  171. package/lib/src/core-components/src/utils/abstracts/theme/theme.js +30 -1
  172. package/lib/src/core-components/src/utils/abstracts/theme/types.js +1 -1
  173. package/lib/src/core-components/src/utils/abstracts/theme/useTheme.js +17 -1
  174. package/lib/src/core-components/src/utils/abstracts/typography/index.js +25 -1
  175. package/lib/src/core-components/src/utils/context/DefaultsProvider.js +8 -1
  176. package/lib/src/core-components/src/utils/context/InternalProvider.js +24 -1
  177. package/lib/src/core-components/src/utils/context/index.js +2 -1
  178. package/lib/src/core-components/src/utils/designTokens.js +125 -1
  179. package/lib/src/core-components/src/utils/helpers/attachSubComponents.js +23 -1
  180. package/lib/src/core-components/src/utils/helpers/flattenChildren.js +11 -1
  181. package/lib/src/core-components/src/utils/helpers/getChildByType.js +3 -1
  182. package/lib/src/core-components/src/utils/helpers/index.js +5 -1
  183. package/lib/src/core-components/src/utils/helpers/isComponentType.js +16 -1
  184. package/lib/src/core-components/src/utils/helpers/separateChildrenByType.js +12 -1
  185. package/lib/src/core-components/src/utils/hooks/index.js +18 -1
  186. package/lib/src/core-components/src/utils/hooks/useClickOutside.js +18 -1
  187. package/lib/src/core-components/src/utils/hooks/useCombinedRefs.js +17 -1
  188. package/lib/src/core-components/src/utils/hooks/useDebouncedCallback.js +12 -1
  189. package/lib/src/core-components/src/utils/hooks/useDebouncedValue.js +20 -1
  190. package/lib/src/core-components/src/utils/hooks/useDeprecation.js +40 -1
  191. package/lib/src/core-components/src/utils/hooks/useDeviceDetect.js +10 -1
  192. package/lib/src/core-components/src/utils/hooks/useDeviceForm.js +24 -1
  193. package/lib/src/core-components/src/utils/hooks/useDisableBodyScroll.js +16 -1
  194. package/lib/src/core-components/src/utils/hooks/useHoverState.js +36 -1
  195. package/lib/src/core-components/src/utils/hooks/useId.js +7 -1
  196. package/lib/src/core-components/src/utils/hooks/useIsBrowser.js +11 -1
  197. package/lib/src/core-components/src/utils/hooks/useMediaQuery.js +16 -1
  198. package/lib/src/core-components/src/utils/hooks/useOverflow.js +22 -1
  199. package/lib/src/core-components/src/utils/hooks/useSafeLayoutEffect.js +5 -1
  200. package/lib/src/core-components/src/utils/hooks/useScrollingUp.js +18 -1
  201. package/lib/src/core-components/src/utils/hooks/useTrapFocus.js +30 -1
  202. package/lib/src/core-components/src/utils/hooks/useWindowDimensions.js +23 -1
  203. package/lib/src/core-components/src/utils/index.js +9 -1
  204. package/lib/src/core-components/src/utils/stories/Wrappers.js +23 -8
  205. package/lib/src/core-components/src/utils/stories/cleanProps.js +5 -1
  206. package/lib/src/core-components/src/utils/stories/index.js +4 -1
  207. package/lib/src/core-components/src/utils/stories/sleep.js +4 -1
  208. package/lib/src/core-components/src/utils/stories/view-ports.js +50 -1
  209. package/lib/src/core-components/src/utils/styling/calcWidthOfColumns.js +5 -1
  210. package/lib/src/core-components/src/utils/styling/createGridContainer.js +12 -6
  211. package/lib/src/core-components/src/utils/styling/createTransition.js +7 -2
  212. package/lib/src/core-components/src/utils/styling/forwardProps.js +10 -1
  213. package/lib/src/core-components/src/utils/styling/index.js +5 -1
  214. package/lib/src/core-components/src/utils/styling/pxToRem.js +6 -1
  215. package/lib/src/core-components/src/utils/testing/getComputedStyle.js +3 -1
  216. package/lib/src/core-components/src/utils/testing/index.js +1 -1
  217. package/lib/src/core-components/src/utils/utility.util.js +14 -1
  218. package/lib/src/core-components/tailwind.config.js +233 -1
  219. package/lib/src/core-hooks/index.js +3 -1
  220. package/lib/src/core-hooks/src/useClickOutside/useClickOutside.hook.js +46 -1
  221. package/lib/src/core-hooks/src/useDebounce/useDebounce.hook.js +30 -1
  222. package/lib/src/core-hooks/src/usePreventEKey/usePreventEKey.hook.js +8 -1
  223. package/lib/src/core-utils/index.js +7 -1
  224. package/lib/src/core-utils/src/calculation/calculation.util.js +89 -1
  225. package/lib/src/core-utils/src/colors/color.util.js +15 -1
  226. package/lib/src/core-utils/src/convert/numberToWords/numToWords.util.js +145 -1
  227. package/lib/src/core-utils/src/convert/typography/camelCaseToTitleCase.util.js +5 -1
  228. package/lib/src/core-utils/src/form-helper/form-helper.util.js +82 -1
  229. package/lib/src/core-utils/src/index.js +7 -1
  230. package/lib/src/core-utils/src/utility/utility.util.js +12 -1
  231. package/lib/src/core-utils/src/uuid/uuid.util.js +8 -1
  232. package/package.json +1 -1
@@ -1 +1,128 @@
1
- "use strict";"use client";import{jsx as n,jsxs as d,Fragment as de}from"react/jsx-runtime";import{forwardRef as ue,useState as pe,useRef as me,useCallback as f,useEffect as w}from"react";import{Icon as k}from"../Icon/Icon";import{Tooltip as fe}from"../Tooltip/Tooltip";import{SpeedDialRoot as $e,SpeedDialBackdrop as be,SpeedDialFab as ge,SpeedDialActions as Ce,SpeedDialActionWrapper as ye,SpeedDialActionButton as he,SpeedDialActionLabel as N,IconWrapper as u,sizeConfig as I}from"./elements";const ke=()=>d("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),Se=()=>d("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]});export const SpeedDial=ue(function(B,p){const{actions:T,open:O,defaultOpen:j=!1,onOpenChange:$,onActionClick:x,uiConfig:R={},mainButtonConfig:W={},classNames:l={},styles:s={},disabled:b=!1,hidden:F=!1,closeOnActionClick:z=!0,closeOnClickOutside:D=!0,closeOnEscape:L=!0,className:M,style:_,ariaLabel:P}=B,{direction:r="up",size:i="medium",variant:q="filled",gap:G=12,showLabels:S=!1,showTooltips:H=!0,animationDuration:J=200,staggerDelay:g=30,showBackdrop:K=!1,backdropOpacity:Q=.3,zIndex:v=1e3}=R,{openIcon:U="MdAdd",closeIcon:V="MdClose",openIconElement:A,closeIconElement:E,backgroundColor:X,iconColor:Y,rotateOnToggle:C=!0,rotationDegrees:Z=45,ariaLabelClosed:ee="Open speed dial",ariaLabelOpen:ne="Close speed dial"}=W,y=me(null),[oe,ie]=pe(j),h=O!==void 0,o=h?O:oe,m=f(e=>{b||(h||ie(e),$?.(e))},[b,h,$]),te=f(()=>{m(!o)},[o,m]),a=f(()=>{m(!1)},[m]),re=f((e,t)=>{e.disabled||(e.onClick?.(t),x?.(e,t),z&&a())},[z,a,x]);w(()=>{if(!o||!D)return;const e=c=>{y.current&&!y.current.contains(c.target)&&a()},t=setTimeout(()=>{document.addEventListener("mousedown",e)},0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e)}},[o,D,a]),w(()=>{if(!o||!L)return;const e=t=>{t.key==="Escape"&&a()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[o,L,a]);const le=()=>{if(o){if(E)return E;if(!C)return n(u,{$size:i,children:n(k,{nameIcon:V,propsIcon:{size:I[i].iconSize,color:"currentColor"}})})}return A||(C?n(u,{$size:i,children:n(ke,{})}):n(u,{$size:i,children:n(k,{nameIcon:U,propsIcon:{size:I[i].iconSize,color:"currentColor"}})}))},se=e=>e.iconElement?n(u,{$size:i,$isAction:!0,children:e.iconElement}):n(u,{$size:i,$isAction:!0,children:n(k,{nameIcon:e.icon,propsIcon:{size:I[i].actionIconSize,color:e.iconColor||"currentColor"}})}),ae=(e,t)=>{const c=n(he,{$size:i,$isOpen:o,$index:t,$staggerDelay:g,$animationDuration:J,$customBg:e.backgroundColor,$customColor:e.iconColor,onClick:ce=>re(e,ce),disabled:e.disabled,"aria-label":e.ariaLabel||e.tooltip||e.label,className:l.action||e.className,style:{...s.action,...e.style},children:se(e)},e.id);return S&&e.label?d(ye,{$direction:r,$showLabels:S,children:[(r==="left"||r==="up")&&n(N,{$size:i,$direction:r,$isOpen:o,$index:t,$staggerDelay:g,className:l.actionLabel,style:s.actionLabel,children:e.label}),c,(r==="right"||r==="down")&&n(N,{$size:i,$direction:r,$isOpen:o,$index:t,$staggerDelay:g,className:l.actionLabel,style:s.actionLabel,children:e.label})]},e.id):H&&e.tooltip?n(fe,{content:e.tooltip,position:r==="up"||r==="down"?"left":"top",delay:100,children:c},e.id):c};return d(de,{children:[K&&n(be,{$isOpen:o,$opacity:Q,$zIndex:v,className:l.backdrop,style:s.backdrop,onClick:a}),d($e,{ref:e=>{y.current=e,typeof p=="function"?p(e):p&&(p.current=e)},$zIndex:v,$hidden:F,className:M||l.root,style:{...s.root,..._},role:"menu","aria-label":P||"Speed dial","aria-expanded":o,children:[n(ge,{$size:i,$variant:q,$isOpen:o,$rotateOnToggle:C,$rotationDegrees:Z,$customBg:X,$customColor:Y,onClick:te,disabled:b,"aria-label":o?ne:ee,className:l.fab,style:s.fab,children:le()}),n(Ce,{$direction:r,$gap:G,$isOpen:o,className:l.actions,style:s.actions,role:"menu",children:T.map((e,t)=>ae(e,t))})]})]})});SpeedDial.displayName="SpeedDial";
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { forwardRef, useState, useRef, useCallback, useEffect, } from 'react';
4
+ import { Icon } from '../Icon/Icon';
5
+ import { Tooltip } from '../Tooltip/Tooltip';
6
+ import { SpeedDialRoot, SpeedDialBackdrop, SpeedDialFab, SpeedDialActions, SpeedDialActionWrapper, SpeedDialActionButton, SpeedDialActionLabel, IconWrapper, sizeConfig, } from './elements';
7
+ // Default icons
8
+ const PlusIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: [_jsx("line", { x1: "12", y1: "5", x2: "12", y2: "19" }), _jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" })] }));
9
+ const CloseIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", children: [_jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), _jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })] }));
10
+ export const SpeedDial = forwardRef(function SpeedDialComponent(props, ref) {
11
+ const { actions, open: controlledOpen, defaultOpen = false, onOpenChange, onActionClick, uiConfig = {}, mainButtonConfig = {}, classNames = {}, styles = {}, disabled = false, hidden = false, closeOnActionClick = true, closeOnClickOutside = true, closeOnEscape = true, className, style, ariaLabel, } = props;
12
+ // Destructure configs with defaults
13
+ const { direction = 'up', size = 'medium', variant = 'filled', gap = 12, showLabels = false, showTooltips = true, animationDuration = 200, staggerDelay = 30, showBackdrop = false, backdropOpacity = 0.3, zIndex = 1000, } = uiConfig;
14
+ const { openIcon = 'MdAdd', closeIcon = 'MdClose', openIconElement, closeIconElement, backgroundColor, iconColor, rotateOnToggle = true, rotationDegrees = 45, ariaLabelClosed = 'Open speed dial', ariaLabelOpen = 'Close speed dial', } = mainButtonConfig;
15
+ // Refs
16
+ const rootRef = useRef(null);
17
+ // State
18
+ const [internalOpen, setInternalOpen] = useState(defaultOpen);
19
+ // Controlled vs uncontrolled
20
+ const isControlled = controlledOpen !== undefined;
21
+ const isOpen = isControlled ? controlledOpen : internalOpen;
22
+ // Handle open/close
23
+ const setOpen = useCallback((newOpen) => {
24
+ if (disabled)
25
+ return;
26
+ if (isControlled) {
27
+ onOpenChange?.(newOpen);
28
+ }
29
+ else {
30
+ setInternalOpen(newOpen);
31
+ onOpenChange?.(newOpen);
32
+ }
33
+ }, [disabled, isControlled, onOpenChange]);
34
+ const toggle = useCallback(() => {
35
+ setOpen(!isOpen);
36
+ }, [isOpen, setOpen]);
37
+ const close = useCallback(() => {
38
+ setOpen(false);
39
+ }, [setOpen]);
40
+ // Handle action click
41
+ const handleActionClick = useCallback((action, e) => {
42
+ if (action.disabled)
43
+ return;
44
+ action.onClick?.(e);
45
+ onActionClick?.(action, e);
46
+ if (closeOnActionClick) {
47
+ close();
48
+ }
49
+ }, [closeOnActionClick, close, onActionClick]);
50
+ // Click outside handler
51
+ useEffect(() => {
52
+ if (!isOpen || !closeOnClickOutside)
53
+ return;
54
+ const handleClickOutside = (e) => {
55
+ if (rootRef.current && !rootRef.current.contains(e.target)) {
56
+ close();
57
+ }
58
+ };
59
+ // Delay to prevent immediate close on open click
60
+ const timeout = setTimeout(() => {
61
+ document.addEventListener('mousedown', handleClickOutside);
62
+ }, 0);
63
+ return () => {
64
+ clearTimeout(timeout);
65
+ document.removeEventListener('mousedown', handleClickOutside);
66
+ };
67
+ }, [isOpen, closeOnClickOutside, close]);
68
+ // Escape key handler
69
+ useEffect(() => {
70
+ if (!isOpen || !closeOnEscape)
71
+ return;
72
+ const handleEscape = (e) => {
73
+ if (e.key === 'Escape') {
74
+ close();
75
+ }
76
+ };
77
+ document.addEventListener('keydown', handleEscape);
78
+ return () => document.removeEventListener('keydown', handleEscape);
79
+ }, [isOpen, closeOnEscape, close]);
80
+ // Render main button icon
81
+ const renderMainIcon = () => {
82
+ if (isOpen) {
83
+ if (closeIconElement)
84
+ return closeIconElement;
85
+ if (!rotateOnToggle) {
86
+ return (_jsx(IconWrapper, { "$size": size, children: _jsx(Icon, { nameIcon: closeIcon, propsIcon: { size: sizeConfig[size].iconSize, color: 'currentColor' } }) }));
87
+ }
88
+ }
89
+ if (openIconElement)
90
+ return openIconElement;
91
+ // Use default plus/close icons for rotation effect
92
+ if (rotateOnToggle) {
93
+ return (_jsx(IconWrapper, { "$size": size, children: _jsx(PlusIcon, {}) }));
94
+ }
95
+ return (_jsx(IconWrapper, { "$size": size, children: _jsx(Icon, { nameIcon: openIcon, propsIcon: { size: sizeConfig[size].iconSize, color: 'currentColor' } }) }));
96
+ };
97
+ // Render action icon
98
+ const renderActionIcon = (action) => {
99
+ if (action.iconElement) {
100
+ return (_jsx(IconWrapper, { "$size": size, "$isAction": true, children: action.iconElement }));
101
+ }
102
+ return (_jsx(IconWrapper, { "$size": size, "$isAction": true, children: _jsx(Icon, { nameIcon: action.icon, propsIcon: {
103
+ size: sizeConfig[size].actionIconSize,
104
+ color: action.iconColor || 'currentColor',
105
+ } }) }));
106
+ };
107
+ // Render action button
108
+ const renderAction = (action, index) => {
109
+ const button = (_jsx(SpeedDialActionButton, { "$size": size, "$isOpen": isOpen, "$index": index, "$staggerDelay": staggerDelay, "$animationDuration": animationDuration, "$customBg": action.backgroundColor, "$customColor": action.iconColor, onClick: (e) => handleActionClick(action, e), disabled: action.disabled, "aria-label": action.ariaLabel || action.tooltip || action.label, className: classNames.action || action.className, style: { ...styles.action, ...action.style }, children: renderActionIcon(action) }, action.id));
110
+ if (showLabels && action.label) {
111
+ return (_jsxs(SpeedDialActionWrapper, { "$direction": direction, "$showLabels": showLabels, children: [(direction === 'left' || direction === 'up') && (_jsx(SpeedDialActionLabel, { "$size": size, "$direction": direction, "$isOpen": isOpen, "$index": index, "$staggerDelay": staggerDelay, className: classNames.actionLabel, style: styles.actionLabel, children: action.label })), button, (direction === 'right' || direction === 'down') && (_jsx(SpeedDialActionLabel, { "$size": size, "$direction": direction, "$isOpen": isOpen, "$index": index, "$staggerDelay": staggerDelay, className: classNames.actionLabel, style: styles.actionLabel, children: action.label }))] }, action.id));
112
+ }
113
+ if (showTooltips && action.tooltip) {
114
+ return (_jsx(Tooltip, { content: action.tooltip, position: direction === 'up' || direction === 'down' ? 'left' : 'top', delay: 100, children: button }, action.id));
115
+ }
116
+ return button;
117
+ };
118
+ return (_jsxs(_Fragment, { children: [showBackdrop && (_jsx(SpeedDialBackdrop, { "$isOpen": isOpen, "$opacity": backdropOpacity, "$zIndex": zIndex, className: classNames.backdrop, style: styles.backdrop, onClick: close })), _jsxs(SpeedDialRoot, { ref: (node) => {
119
+ rootRef.current = node;
120
+ if (typeof ref === 'function') {
121
+ ref(node);
122
+ }
123
+ else if (ref) {
124
+ ref.current = node;
125
+ }
126
+ }, "$zIndex": zIndex, "$hidden": hidden, className: className || classNames.root, style: { ...styles.root, ...style }, role: "menu", "aria-label": ariaLabel || 'Speed dial', "aria-expanded": isOpen, children: [_jsx(SpeedDialFab, { "$size": size, "$variant": variant, "$isOpen": isOpen, "$rotateOnToggle": rotateOnToggle, "$rotationDegrees": rotationDegrees, "$customBg": backgroundColor, "$customColor": iconColor, onClick: toggle, disabled: disabled, "aria-label": isOpen ? ariaLabelOpen : ariaLabelClosed, className: classNames.fab, style: styles.fab, children: renderMainIcon() }), _jsx(SpeedDialActions, { "$direction": direction, "$gap": gap, "$isOpen": isOpen, className: classNames.actions, style: styles.actions, role: "menu", children: actions.map((action, index) => renderAction(action, index)) })] })] }));
127
+ });
128
+ SpeedDial.displayName = 'SpeedDial';
@@ -1,4 +1,7 @@
1
- "use strict";import{styled as i,css as e,keyframes as n}from"styled-components";import{tokens as a}from"../../utils/designTokens";const c=n`
1
+ import { styled, css, keyframes } from 'styled-components';
2
+ import { tokens } from '../../utils/designTokens';
3
+ // Animations
4
+ const fadeIn = keyframes `
2
5
  from {
3
6
  opacity: 0;
4
7
  transform: scale(0.3);
@@ -7,7 +10,8 @@
7
10
  opacity: 1;
8
11
  transform: scale(1);
9
12
  }
10
- `,p=n`
13
+ `;
14
+ const fadeOut = keyframes `
11
15
  from {
12
16
  opacity: 1;
13
17
  transform: scale(1);
@@ -16,11 +20,39 @@
16
20
  opacity: 0;
17
21
  transform: scale(0.3);
18
22
  }
19
- `,x=n`
23
+ `;
24
+ const backdropFadeIn = keyframes `
20
25
  from { opacity: 0; }
21
26
  to { opacity: 1; }
22
- `;export const sizeConfig={small:{fabSize:48,actionSize:40,iconSize:24,actionIconSize:20,labelFontSize:"12px"},medium:{fabSize:56,actionSize:48,iconSize:28,actionIconSize:24,labelFontSize:"13px"},large:{fabSize:64,actionSize:56,iconSize:32,actionIconSize:28,labelFontSize:"14px"}};const l={filled:e`
23
- background: ${a.primary||"#3b82f6"};
27
+ `;
28
+ // Size configurations
29
+ export const sizeConfig = {
30
+ small: {
31
+ fabSize: 48,
32
+ actionSize: 40,
33
+ iconSize: 24,
34
+ actionIconSize: 20,
35
+ labelFontSize: '12px',
36
+ },
37
+ medium: {
38
+ fabSize: 56,
39
+ actionSize: 48,
40
+ iconSize: 28,
41
+ actionIconSize: 24,
42
+ labelFontSize: '13px',
43
+ },
44
+ large: {
45
+ fabSize: 64,
46
+ actionSize: 56,
47
+ iconSize: 32,
48
+ actionIconSize: 28,
49
+ labelFontSize: '14px',
50
+ },
51
+ };
52
+ // Variant styles for FAB
53
+ const fabVariantStyles = {
54
+ filled: css `
55
+ background: ${tokens.primary || '#3b82f6'};
24
56
  color: white;
25
57
  border: none;
26
58
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
@@ -29,96 +61,117 @@
29
61
  background: #2563eb;
30
62
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
31
63
  }
32
- `,outlined:e`
64
+ `,
65
+ outlined: css `
33
66
  background: white;
34
- color: ${a.primary||"#3b82f6"};
35
- border: 2px solid ${a.primary||"#3b82f6"};
67
+ color: ${tokens.primary || '#3b82f6'};
68
+ border: 2px solid ${tokens.primary || '#3b82f6'};
36
69
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
37
70
 
38
71
  &:hover:not(:disabled) {
39
- background: ${a.primary||"#3b82f6"}10;
72
+ background: ${tokens.primary || '#3b82f6'}10;
40
73
  }
41
- `,soft:e`
42
- background: ${a.primary||"#3b82f6"}15;
43
- color: ${a.primary||"#3b82f6"};
74
+ `,
75
+ soft: css `
76
+ background: ${tokens.primary || '#3b82f6'}15;
77
+ color: ${tokens.primary || '#3b82f6'};
44
78
  border: none;
45
79
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
46
80
 
47
81
  &:hover:not(:disabled) {
48
- background: ${a.primary||"#3b82f6"}25;
82
+ background: ${tokens.primary || '#3b82f6'}25;
49
83
  }
50
- `},d=o=>{switch(o){case"up":return e`
84
+ `,
85
+ };
86
+ // Direction styles for actions container
87
+ const getDirectionStyles = (direction) => {
88
+ switch (direction) {
89
+ case 'up':
90
+ return css `
51
91
  flex-direction: column-reverse;
52
92
  bottom: 100%;
53
93
  left: 50%;
54
94
  transform: translateX(-50%);
55
95
  padding-bottom: 16px;
56
- `;case"down":return e`
96
+ `;
97
+ case 'down':
98
+ return css `
57
99
  flex-direction: column;
58
100
  top: 100%;
59
101
  left: 50%;
60
102
  transform: translateX(-50%);
61
103
  padding-top: 16px;
62
- `;case"left":return e`
104
+ `;
105
+ case 'left':
106
+ return css `
63
107
  flex-direction: row-reverse;
64
108
  right: 100%;
65
109
  top: 50%;
66
110
  transform: translateY(-50%);
67
111
  padding-right: 16px;
68
- `;case"right":return e`
112
+ `;
113
+ case 'right':
114
+ return css `
69
115
  flex-direction: row;
70
116
  left: 100%;
71
117
  top: 50%;
72
118
  transform: translateY(-50%);
73
119
  padding-left: 16px;
74
- `;default:return e`
120
+ `;
121
+ default:
122
+ return css `
75
123
  flex-direction: column-reverse;
76
124
  bottom: 100%;
77
125
  left: 50%;
78
126
  transform: translateX(-50%);
79
127
  padding-bottom: 16px;
80
- `}};export const SpeedDialRoot=i.div`
128
+ `;
129
+ }
130
+ };
131
+ export const SpeedDialRoot = styled.div `
81
132
  position: relative;
82
- display: ${({$hidden:o})=>o?"none":"inline-flex"};
83
- z-index: ${({$zIndex:o})=>o};
84
- `,SpeedDialBackdrop=i.div`
133
+ display: ${({ $hidden }) => ($hidden ? 'none' : 'inline-flex')};
134
+ z-index: ${({ $zIndex }) => $zIndex};
135
+ `;
136
+ export const SpeedDialBackdrop = styled.div `
85
137
  position: fixed;
86
138
  inset: 0;
87
- background: rgba(0, 0, 0, ${({$opacity:o})=>o});
88
- z-index: ${({$zIndex:o})=>o-1};
89
- pointer-events: ${({$isOpen:o})=>o?"auto":"none"};
90
- opacity: ${({$isOpen:o})=>o?1:0};
139
+ background: rgba(0, 0, 0, ${({ $opacity }) => $opacity});
140
+ z-index: ${({ $zIndex }) => $zIndex - 1};
141
+ pointer-events: ${({ $isOpen }) => ($isOpen ? 'auto' : 'none')};
142
+ opacity: ${({ $isOpen }) => ($isOpen ? 1 : 0)};
91
143
  transition: opacity 0.2s ease;
92
- `,SpeedDialFab=i.button`
144
+ `;
145
+ export const SpeedDialFab = styled.button `
93
146
  position: relative;
94
147
  display: flex;
95
148
  align-items: center;
96
149
  justify-content: center;
97
- width: ${({$size:o})=>sizeConfig[o].fabSize}px;
98
- height: ${({$size:o})=>sizeConfig[o].fabSize}px;
150
+ width: ${({ $size }) => sizeConfig[$size].fabSize}px;
151
+ height: ${({ $size }) => sizeConfig[$size].fabSize}px;
99
152
  border-radius: 50%;
100
153
  cursor: pointer;
101
154
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
102
155
  outline: none;
103
156
  z-index: 2;
104
157
 
105
- ${({$variant:o})=>l[o]}
158
+ ${({ $variant }) => fabVariantStyles[$variant]}
106
159
 
107
160
  /* Custom colors override */
108
- ${({$customBg:o})=>o&&e`background: ${o};`}
109
- ${({$customColor:o})=>o&&e`color: ${o};`}
161
+ ${({ $customBg }) => $customBg && css `background: ${$customBg};`}
162
+ ${({ $customColor }) => $customColor && css `color: ${$customColor};`}
110
163
 
111
164
  /* Icon rotation */
112
165
  & > * {
113
166
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
114
- ${({$isOpen:o,$rotateOnToggle:t,$rotationDegrees:r})=>o&&t&&e`
115
- transform: rotate(${r}deg);
167
+ ${({ $isOpen, $rotateOnToggle, $rotationDegrees }) => $isOpen && $rotateOnToggle && css `
168
+ transform: rotate(${$rotationDegrees}deg);
116
169
  `}
117
170
  }
118
171
 
119
172
  /* Focus ring */
120
173
  &:focus-visible {
121
- box-shadow: 0 0 0 3px ${a.primary||"#3b82f6"}40;
174
+ box-shadow: 0 0 0 3px ${tokens.primary || '#3b82f6'}40;
122
175
  }
123
176
 
124
177
  /* Disabled state */
@@ -135,30 +188,40 @@
135
188
  &:active:not(:disabled) {
136
189
  transform: scale(0.95);
137
190
  }
138
- `,SpeedDialActions=i.div`
191
+ `;
192
+ export const SpeedDialActions = styled.div `
139
193
  position: absolute;
140
194
  display: flex;
141
195
  align-items: center;
142
- gap: ${({$gap:o})=>o}px;
143
- pointer-events: ${({$isOpen:o})=>o?"auto":"none"};
196
+ gap: ${({ $gap }) => $gap}px;
197
+ pointer-events: ${({ $isOpen }) => ($isOpen ? 'auto' : 'none')};
144
198
 
145
- ${({$direction:o})=>d(o)}
146
- `,SpeedDialActionWrapper=i.div`
199
+ ${({ $direction }) => getDirectionStyles($direction)}
200
+ `;
201
+ export const SpeedDialActionWrapper = styled.div `
147
202
  display: flex;
148
203
  align-items: center;
149
204
  gap: 12px;
150
205
 
151
- ${({$direction:o,$showLabels:t})=>t?o==="up"||o==="down"?e`flex-direction: row;`:e`flex-direction: column;`:""}
152
- `,SpeedDialActionButton=i.button`
206
+ ${({ $direction, $showLabels }) => {
207
+ if (!$showLabels)
208
+ return '';
209
+ if ($direction === 'up' || $direction === 'down') {
210
+ return css `flex-direction: row;`;
211
+ }
212
+ return css `flex-direction: column;`;
213
+ }}
214
+ `;
215
+ export const SpeedDialActionButton = styled.button `
153
216
  display: flex;
154
217
  align-items: center;
155
218
  justify-content: center;
156
- width: ${({$size:o})=>sizeConfig[o].actionSize}px;
157
- height: ${({$size:o})=>sizeConfig[o].actionSize}px;
219
+ width: ${({ $size }) => sizeConfig[$size].actionSize}px;
220
+ height: ${({ $size }) => sizeConfig[$size].actionSize}px;
158
221
  border-radius: 50%;
159
222
  border: none;
160
- background: ${({$customBg:o})=>o||"white"};
161
- color: ${({$customColor:o})=>o||"#374151"};
223
+ background: ${({ $customBg }) => $customBg || 'white'};
224
+ color: ${({ $customColor }) => $customColor || '#374151'};
162
225
  cursor: pointer;
163
226
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
164
227
  transition: all 0.2s ease;
@@ -169,17 +232,19 @@
169
232
  opacity: 0;
170
233
  transform: scale(0.3);
171
234
 
172
- ${({$isOpen:o,$index:t,$staggerDelay:r,$animationDuration:s})=>o?e`
173
- animation: ${c} ${s}ms ease forwards;
174
- animation-delay: ${t*r}ms;
175
- `:e`
176
- animation: ${p} ${s*.5}ms ease forwards;
177
- animation-delay: ${t*(r*.3)}ms;
235
+ ${({ $isOpen, $index, $staggerDelay, $animationDuration }) => $isOpen
236
+ ? css `
237
+ animation: ${fadeIn} ${$animationDuration}ms ease forwards;
238
+ animation-delay: ${$index * $staggerDelay}ms;
239
+ `
240
+ : css `
241
+ animation: ${fadeOut} ${$animationDuration * 0.5}ms ease forwards;
242
+ animation-delay: ${$index * ($staggerDelay * 0.3)}ms;
178
243
  `}
179
244
 
180
245
  /* Focus ring */
181
246
  &:focus-visible {
182
- box-shadow: 0 0 0 3px ${a.primary||"#3b82f6"}40;
247
+ box-shadow: 0 0 0 3px ${tokens.primary || '#3b82f6'}40;
183
248
  }
184
249
 
185
250
  /* Disabled state */
@@ -197,8 +262,9 @@
197
262
  &:active:not(:disabled) {
198
263
  transform: scale(0.95);
199
264
  }
200
- `,SpeedDialActionLabel=i.span`
201
- font-size: ${({$size:o})=>sizeConfig[o].labelFontSize};
265
+ `;
266
+ export const SpeedDialActionLabel = styled.span `
267
+ font-size: ${({ $size }) => sizeConfig[$size].labelFontSize};
202
268
  font-weight: 500;
203
269
  color: #374151;
204
270
  white-space: nowrap;
@@ -209,18 +275,22 @@
209
275
 
210
276
  /* Animation */
211
277
  opacity: 0;
212
- transform: translateX(${({$direction:o})=>o==="left"?"10px":o==="right"?"-10px":"0"}) translateY(${({$direction:o})=>o==="up"?"10px":o==="down"?"-10px":"0"});
278
+ transform: translateX(${({ $direction }) => $direction === 'left' ? '10px' :
279
+ $direction === 'right' ? '-10px' : '0'}) translateY(${({ $direction }) => $direction === 'up' ? '10px' :
280
+ $direction === 'down' ? '-10px' : '0'});
213
281
 
214
- ${({$isOpen:o,$index:t,$staggerDelay:r})=>o&&e`
215
- animation: ${c} 150ms ease forwards;
216
- animation-delay: ${t*r+50}ms;
282
+ ${({ $isOpen, $index, $staggerDelay }) => $isOpen &&
283
+ css `
284
+ animation: ${fadeIn} 150ms ease forwards;
285
+ animation-delay: ${$index * $staggerDelay + 50}ms;
217
286
  `}
218
- `,IconWrapper=i.span`
287
+ `;
288
+ export const IconWrapper = styled.span `
219
289
  display: flex;
220
290
  align-items: center;
221
291
  justify-content: center;
222
- width: ${({$size:o,$isAction:t})=>t?sizeConfig[o].actionIconSize:sizeConfig[o].iconSize}px;
223
- height: ${({$size:o,$isAction:t})=>t?sizeConfig[o].actionIconSize:sizeConfig[o].iconSize}px;
292
+ width: ${({ $size, $isAction }) => $isAction ? sizeConfig[$size].actionIconSize : sizeConfig[$size].iconSize}px;
293
+ height: ${({ $size, $isAction }) => $isAction ? sizeConfig[$size].actionIconSize : sizeConfig[$size].iconSize}px;
224
294
 
225
295
  svg {
226
296
  width: 100%;
@@ -1 +1,2 @@
1
- "use strict";export{SpeedDial}from"./SpeedDial";export*from"./types";
1
+ export { SpeedDial } from './SpeedDial';
2
+ export * from './types';
@@ -1 +1,3 @@
1
- "use strict";export const SPEED_DIAL_DIRECTIONS=["up","down","left","right"],SPEED_DIAL_SIZES=["small","medium","large"],SPEED_DIAL_VARIANTS=["filled","outlined","soft"];
1
+ export const SPEED_DIAL_DIRECTIONS = ['up', 'down', 'left', 'right'];
2
+ export const SPEED_DIAL_SIZES = ['small', 'medium', 'large'];
3
+ export const SPEED_DIAL_VARIANTS = ['filled', 'outlined', 'soft'];
@@ -1 +1,139 @@
1
- "use strict";import{jsx as p,jsxs as v}from"react/jsx-runtime";import e from"../../tc.module.css";import{cn as n}from"../../utils";const _={completedColor:"#ffae1a",activeColor:"#ffae1a",pendingColor:"#d1d5db",lineColor:"#d1d5db",completedTextColor:"#374151",activeTextColor:"#ffffff",pendingTextColor:"#9ca3af"},D={sm:{stepSize:24,fontSize:"0.625rem",padding:2},md:{stepSize:32,fontSize:"0.75rem",padding:4},lg:{stepSize:40,fontSize:"0.875rem",padding:6}};export const Stepper=({className:$="",steps:f,currentStep:b=1,onStepClick:m,size:S="md",colors:I={},showNumbers:C=!0,lineThickness:x=2,stepSize:w,clickable:h=!0,style:y,orientation:H="horizontal",classNames:i={},styles:l={}})=>{const o={..._,...I},c=D[S],g=w||c.stepSize,z=c.padding+g/2,T=n($,e["w-full"],e["px-4"],e["sm:px-8"],i.container),k=(r,a)=>typeof r=="string"?{label:r,number:a+1,description:void 0,status:void 0}:{label:r.label,number:r.number??a+1,description:r.description,status:r.status},L=f?.map((r,a)=>{const s=k(r,a),u=s.number;let d;s.status?d=s.status:u<b?d="completed":u===b?d="current":d="pending";let N=n(e["inline-block"],e.transform,e["-translate-x-1/2"],e["rounded-full"],e["text-center"],e["font-medium"],e.border);const t={width:`${g}px`,height:`${g}px`,fontSize:c.fontSize,position:"relative",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center",borderWidth:"2px",borderStyle:"solid",transition:"all 0.3s ease",lineHeight:1};return d==="completed"?(t.borderColor=o.completedColor,t.backgroundColor="#ffffff",t.color=o.completedTextColor):d==="current"?(t.borderColor=o.activeColor,t.backgroundColor=o.activeColor,t.color=o.activeTextColor):(t.borderColor=o.pendingColor,t.backgroundColor="#ffffff",t.color=o.pendingTextColor),h&&m&&(t.cursor="pointer"),v("div",{style:{left:f.length>1?`${a/(f.length-1)*100}%`:"50%",...l.stepWrapper},className:n(e.absolute,i.stepWrapper),children:[p("span",{className:n(N,e["font-arimaRegular"],i.stepCircle),style:{...t,...l.stepCircle},onClick:()=>{h&&m&&m(u,r,a)},children:C?u:s.label}),!C&&s.description&&p("div",{className:i.stepDescription,style:{position:"absolute",top:`${g+8}px`,left:"50%",transform:"translateX(-50%)",fontSize:"0.75rem",color:d==="current"?o.activeColor:o.pendingTextColor,whiteSpace:"nowrap",...l.stepDescription},children:s.description})]},`step-${a}-${s.label}`)}),W=f.length>1?`${(b-1)/(f.length-1)*100}%`:"0%",j=c.padding*2+g;return p("div",{className:T,style:{...y,...l.container},children:v("div",{className:n(e["w-full"],e.relative,i.stepsWrapper),style:{minHeight:`${j}px`,paddingTop:`${c.padding}px`,...l.stepsWrapper},children:[p("div",{className:n(e.absolute,e["left-0"],e["w-full"],e["transition-width"],e["ease-in-out"],e["duration-500"],i.backgroundLine),style:{top:`${z}px`,height:`${x}px`,backgroundColor:o.lineColor,transform:"translateY(-50%)",zIndex:0,...l.backgroundLine}}),p("div",{className:n(e.absolute,e["left-0"],e["transition-width"],e["ease-in-out"],e["duration-500"],i.progressLine),style:{top:`${z}px`,width:W,height:`${x}px`,backgroundColor:o.completedColor,transform:"translateY(-50%)",zIndex:1,...l.progressLine}}),p("div",{className:n(e.relative,e["sm:block"]),style:{zIndex:2},children:L})]})})};
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import s from '../../tc.module.css';
3
+ import { cn } from '../../utils';
4
+ const DEFAULT_COLORS = {
5
+ completedColor: '#ffae1a',
6
+ activeColor: '#ffae1a',
7
+ pendingColor: '#d1d5db',
8
+ lineColor: '#d1d5db',
9
+ completedTextColor: '#374151',
10
+ activeTextColor: '#ffffff',
11
+ pendingTextColor: '#9ca3af', // gray-400
12
+ };
13
+ const SIZE_CONFIG = {
14
+ sm: { stepSize: 24, fontSize: '0.625rem', padding: 2 },
15
+ md: { stepSize: 32, fontSize: '0.75rem', padding: 4 },
16
+ lg: { stepSize: 40, fontSize: '0.875rem', padding: 6 },
17
+ };
18
+ export const Stepper = ({ className = '', steps, currentStep = 1, onStepClick, size = 'md', colors = {}, showNumbers = true, lineThickness = 2, stepSize, clickable = true, style, orientation = 'horizontal', classNames: customClassNames = {}, styles: customStyles = {}, }) => {
19
+ const mergedColors = { ...DEFAULT_COLORS, ...colors };
20
+ const sizeConfig = SIZE_CONFIG[size];
21
+ const finalStepSize = stepSize || sizeConfig.stepSize;
22
+ const linePosition = sizeConfig.padding + finalStepSize / 2;
23
+ const finalClass = cn(className, s['w-full'], s['px-4'], s['sm:px-8'], customClassNames.container);
24
+ // Helper to get step info
25
+ const getStepInfo = (step, index) => {
26
+ if (typeof step === 'string') {
27
+ return {
28
+ label: step,
29
+ number: index + 1,
30
+ description: undefined,
31
+ status: undefined,
32
+ };
33
+ }
34
+ return {
35
+ label: step.label,
36
+ number: step.number ?? index + 1,
37
+ description: step.description,
38
+ status: step.status,
39
+ };
40
+ };
41
+ const Steps = steps?.map((step, index) => {
42
+ const stepInfo = getStepInfo(step, index);
43
+ const stepNumber = stepInfo.number;
44
+ // Determine status
45
+ let status;
46
+ if (stepInfo.status) {
47
+ status = stepInfo.status;
48
+ }
49
+ else if (stepNumber < currentStep) {
50
+ status = 'completed';
51
+ }
52
+ else if (stepNumber === currentStep) {
53
+ status = 'current';
54
+ }
55
+ else {
56
+ status = 'pending';
57
+ }
58
+ // Base step classes
59
+ let stepClass = cn(s['inline-block'], s['transform'], s['-translate-x-1/2'], s['rounded-full'], s['text-center'], s['font-medium'], s['border']);
60
+ // Apply styles based on status
61
+ const stepStyles = {
62
+ width: `${finalStepSize}px`,
63
+ height: `${finalStepSize}px`,
64
+ fontSize: sizeConfig.fontSize,
65
+ position: 'relative',
66
+ zIndex: 10,
67
+ display: 'flex',
68
+ alignItems: 'center',
69
+ justifyContent: 'center',
70
+ borderWidth: '2px',
71
+ borderStyle: 'solid',
72
+ transition: 'all 0.3s ease',
73
+ lineHeight: 1,
74
+ };
75
+ if (status === 'completed') {
76
+ stepStyles.borderColor = mergedColors.completedColor;
77
+ stepStyles.backgroundColor = '#ffffff';
78
+ stepStyles.color = mergedColors.completedTextColor;
79
+ }
80
+ else if (status === 'current') {
81
+ stepStyles.borderColor = mergedColors.activeColor;
82
+ stepStyles.backgroundColor = mergedColors.activeColor;
83
+ stepStyles.color = mergedColors.activeTextColor;
84
+ }
85
+ else {
86
+ // pending
87
+ stepStyles.borderColor = mergedColors.pendingColor;
88
+ stepStyles.backgroundColor = '#ffffff';
89
+ stepStyles.color = mergedColors.pendingTextColor;
90
+ }
91
+ if (clickable && onStepClick) {
92
+ stepStyles.cursor = 'pointer';
93
+ }
94
+ return (_jsxs("div", { style: {
95
+ left: steps.length > 1 ? `${(index / (steps.length - 1)) * 100}%` : '50%',
96
+ ...customStyles.stepWrapper,
97
+ }, className: cn(s['absolute'], customClassNames.stepWrapper), children: [_jsx("span", { className: cn(stepClass, s['font-arimaRegular'], customClassNames.stepCircle), style: { ...stepStyles, ...customStyles.stepCircle }, onClick: () => {
98
+ if (clickable && onStepClick) {
99
+ onStepClick(stepNumber, step, index);
100
+ }
101
+ }, children: showNumbers ? stepNumber : stepInfo.label }), !showNumbers && stepInfo.description && (_jsx("div", { className: customClassNames.stepDescription, style: {
102
+ position: 'absolute',
103
+ top: `${finalStepSize + 8}px`,
104
+ left: '50%',
105
+ transform: 'translateX(-50%)',
106
+ fontSize: '0.75rem',
107
+ color: status === 'current'
108
+ ? mergedColors.activeColor
109
+ : mergedColors.pendingTextColor,
110
+ whiteSpace: 'nowrap',
111
+ ...customStyles.stepDescription,
112
+ }, children: stepInfo.description }))] }, `step-${index}-${stepInfo.label}`));
113
+ });
114
+ // Calculate progress width based on current step
115
+ const progressWidth = steps.length > 1
116
+ ? `${((currentStep - 1) / (steps.length - 1)) * 100}%`
117
+ : '0%';
118
+ const containerHeight = sizeConfig.padding * 2 + finalStepSize;
119
+ return (_jsx("div", { className: finalClass, style: { ...style, ...customStyles.container }, children: _jsxs("div", { className: cn(s['w-full'], s['relative'], customClassNames.stepsWrapper), style: {
120
+ minHeight: `${containerHeight}px`,
121
+ paddingTop: `${sizeConfig.padding}px`,
122
+ ...customStyles.stepsWrapper,
123
+ }, children: [_jsx("div", { className: cn(s['absolute'], s['left-0'], s['w-full'], s['transition-width'], s['ease-in-out'], s['duration-500'], customClassNames.backgroundLine), style: {
124
+ top: `${linePosition}px`,
125
+ height: `${lineThickness}px`,
126
+ backgroundColor: mergedColors.lineColor,
127
+ transform: 'translateY(-50%)',
128
+ zIndex: 0,
129
+ ...customStyles.backgroundLine,
130
+ } }), _jsx("div", { className: cn(s['absolute'], s['left-0'], s['transition-width'], s['ease-in-out'], s['duration-500'], customClassNames.progressLine), style: {
131
+ top: `${linePosition}px`,
132
+ width: progressWidth,
133
+ height: `${lineThickness}px`,
134
+ backgroundColor: mergedColors.completedColor,
135
+ transform: 'translateY(-50%)',
136
+ zIndex: 1,
137
+ ...customStyles.progressLine,
138
+ } }), _jsx("div", { className: cn(s['relative'], s['sm:block']), style: { zIndex: 2 }, children: Steps })] }) }));
139
+ };