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,38 +1,126 @@
1
- "use strict";import{styled as a,css as i}from"styled-components";import{tokens as t}from"../../utils/designTokens";const f={small:{height:"24px",padding:"0 8px",fontSize:"0.75rem",iconSize:"14px",gap:"4px",borderRadius:"12px"},medium:{height:"32px",padding:"0 12px",fontSize:"0.8125rem",iconSize:"16px",gap:"6px",borderRadius:"16px"},large:{height:"40px",padding:"0 16px",fontSize:"0.875rem",iconSize:"18px",gap:"8px",borderRadius:"20px"}},s={default:{filled:{bg:t.onSurface||"#1a1a2e",text:"#fff",hover:"#2d2d42"},outlined:{border:t.outline||"#d1d5db",text:t.onSurface||"#1a1a2e",hover:"#f3f4f6"},soft:{bg:t.surface||"#f3f4f6",text:t.onSurface||"#1a1a2e",hover:"#e5e7eb"}},primary:{filled:{bg:t.primary||"#454cbf",text:"#fff",hover:"#3d44a5"},outlined:{border:t.primary||"#454cbf",text:t.primary||"#454cbf",hover:"#e7e8f8"},soft:{bg:"#e7e8f8",text:t.primary||"#454cbf",hover:"#d4d6f4"}},success:{filled:{bg:"#10b981",text:"#fff",hover:"#059669"},outlined:{border:"#10b981",text:"#10b981",hover:"#ecfdf5"},soft:{bg:"#ecfdf5",text:"#065f46",hover:"#d1fae5"}},warning:{filled:{bg:"#f59e0b",text:"#fff",hover:"#d97706"},outlined:{border:"#f59e0b",text:"#f59e0b",hover:"#fffbeb"},soft:{bg:"#fffbeb",text:"#92400e",hover:"#fef3c7"}},error:{filled:{bg:"#ef4444",text:"#fff",hover:"#dc2626"},outlined:{border:"#ef4444",text:"#ef4444",hover:"#fef2f2"},soft:{bg:"#fef2f2",text:"#991b1b",hover:"#fee2e2"}},info:{filled:{bg:"#3b82f6",text:"#fff",hover:"#2563eb"},outlined:{border:"#3b82f6",text:"#3b82f6",hover:"#e7f3ff"},soft:{bg:"#e7f3ff",text:"#1e40af",hover:"#dbeafe"}}},p=(e,r,n)=>{const d=s[r];if(e==="filled"){const o=d.filled;return i`
2
- background: ${n?o.hover:o.bg};
3
- color: ${o.text};
1
+ import { styled, css } from 'styled-components';
2
+ import { tokens } from '../../utils/designTokens';
3
+ // Size configurations
4
+ const sizeConfig = {
5
+ small: {
6
+ height: '24px',
7
+ padding: '0 8px',
8
+ fontSize: '0.75rem',
9
+ iconSize: '14px',
10
+ gap: '4px',
11
+ borderRadius: '12px',
12
+ },
13
+ medium: {
14
+ height: '32px',
15
+ padding: '0 12px',
16
+ fontSize: '0.8125rem',
17
+ iconSize: '16px',
18
+ gap: '6px',
19
+ borderRadius: '16px',
20
+ },
21
+ large: {
22
+ height: '40px',
23
+ padding: '0 16px',
24
+ fontSize: '0.875rem',
25
+ iconSize: '18px',
26
+ gap: '8px',
27
+ borderRadius: '20px',
28
+ },
29
+ };
30
+ // Color configurations
31
+ const colorConfig = {
32
+ default: {
33
+ filled: { bg: tokens.onSurface || '#1a1a2e', text: '#fff', hover: '#2d2d42' },
34
+ outlined: {
35
+ border: tokens.outline || '#d1d5db',
36
+ text: tokens.onSurface || '#1a1a2e',
37
+ hover: '#f3f4f6',
38
+ },
39
+ soft: {
40
+ bg: tokens.surface || '#f3f4f6',
41
+ text: tokens.onSurface || '#1a1a2e',
42
+ hover: '#e5e7eb',
43
+ },
44
+ },
45
+ primary: {
46
+ filled: { bg: tokens.primary || '#454cbf', text: '#fff', hover: '#3d44a5' },
47
+ outlined: {
48
+ border: tokens.primary || '#454cbf',
49
+ text: tokens.primary || '#454cbf',
50
+ hover: '#e7e8f8',
51
+ },
52
+ soft: { bg: '#e7e8f8', text: tokens.primary || '#454cbf', hover: '#d4d6f4' },
53
+ },
54
+ success: {
55
+ filled: { bg: '#10b981', text: '#fff', hover: '#059669' },
56
+ outlined: { border: '#10b981', text: '#10b981', hover: '#ecfdf5' },
57
+ soft: { bg: '#ecfdf5', text: '#065f46', hover: '#d1fae5' },
58
+ },
59
+ warning: {
60
+ filled: { bg: '#f59e0b', text: '#fff', hover: '#d97706' },
61
+ outlined: { border: '#f59e0b', text: '#f59e0b', hover: '#fffbeb' },
62
+ soft: { bg: '#fffbeb', text: '#92400e', hover: '#fef3c7' },
63
+ },
64
+ error: {
65
+ filled: { bg: '#ef4444', text: '#fff', hover: '#dc2626' },
66
+ outlined: { border: '#ef4444', text: '#ef4444', hover: '#fef2f2' },
67
+ soft: { bg: '#fef2f2', text: '#991b1b', hover: '#fee2e2' },
68
+ },
69
+ info: {
70
+ filled: { bg: '#3b82f6', text: '#fff', hover: '#2563eb' },
71
+ outlined: { border: '#3b82f6', text: '#3b82f6', hover: '#e7f3ff' },
72
+ soft: { bg: '#e7f3ff', text: '#1e40af', hover: '#dbeafe' },
73
+ },
74
+ };
75
+ const getVariantStyles = (variant, color, selected) => {
76
+ const colorSet = colorConfig[color];
77
+ if (variant === 'filled') {
78
+ const config = colorSet.filled;
79
+ return css `
80
+ background: ${selected ? config.hover : config.bg};
81
+ color: ${config.text};
4
82
  border: 2px solid transparent;
5
83
 
6
84
  &:hover:not(:disabled) {
7
- background: ${o.hover};
85
+ background: ${config.hover};
8
86
  }
9
- `}if(e==="outlined"){const o=d.outlined;return i`
10
- background: ${n?o.hover:"transparent"};
11
- color: ${o.text};
12
- border: 2px solid ${o.border};
87
+ `;
88
+ }
89
+ if (variant === 'outlined') {
90
+ const config = colorSet.outlined;
91
+ return css `
92
+ background: ${selected ? config.hover : 'transparent'};
93
+ color: ${config.text};
94
+ border: 2px solid ${config.border};
13
95
 
14
96
  &:hover:not(:disabled) {
15
- background: ${o.hover};
97
+ background: ${config.hover};
16
98
  }
17
- `}const l=d.soft;return i`
18
- background: ${n?l.hover:l.bg};
19
- color: ${l.text};
99
+ `;
100
+ }
101
+ // soft
102
+ const config = colorSet.soft;
103
+ return css `
104
+ background: ${selected ? config.hover : config.bg};
105
+ color: ${config.text};
20
106
  border: 2px solid transparent;
21
107
 
22
108
  &:hover:not(:disabled) {
23
- background: ${l.hover};
109
+ background: ${config.hover};
24
110
  }
25
- `};export const ChipElement=a.button`
111
+ `;
112
+ };
113
+ export const ChipElement = styled.button `
26
114
  display: inline-flex;
27
115
  align-items: center;
28
116
  justify-content: center;
29
- gap: ${({$size:e})=>f[e].gap};
30
- height: ${({$size:e})=>f[e].height};
31
- padding: ${({$size:e})=>f[e].padding};
32
- font-size: ${({$size:e})=>f[e].fontSize};
117
+ gap: ${({ $size }) => sizeConfig[$size].gap};
118
+ height: ${({ $size }) => sizeConfig[$size].height};
119
+ padding: ${({ $size }) => sizeConfig[$size].padding};
120
+ font-size: ${({ $size }) => sizeConfig[$size].fontSize};
33
121
  font-weight: 500;
34
122
  font-family: inherit;
35
- border-radius: ${({$size:e})=>f[e].borderRadius};
123
+ border-radius: ${({ $size }) => sizeConfig[$size].borderRadius};
36
124
  cursor: pointer;
37
125
  transition: all 0.2s ease;
38
126
  white-space: nowrap;
@@ -41,16 +129,19 @@
41
129
  position: relative;
42
130
  overflow: hidden;
43
131
 
44
- ${({$variant:e,$color:r,$selected:n})=>p(e,r,n)}
132
+ ${({ $variant, $color, $selected }) => getVariantStyles($variant, $color, $selected)}
45
133
 
46
134
  /* Selected state visual indicator */
47
- ${({$selected:e,$color:r,$variant:n})=>e&&n==="outlined"&&i`
48
- border-color: ${s[r].outlined.text};
49
- box-shadow: 0 0 0 1px ${s[r].outlined.text};
135
+ ${({ $selected, $color, $variant }) => $selected &&
136
+ $variant === 'outlined' &&
137
+ css `
138
+ border-color: ${colorConfig[$color].outlined.text};
139
+ box-shadow: 0 0 0 1px ${colorConfig[$color].outlined.text};
50
140
  `}
51
141
 
52
142
  /* Disabled state */
53
- ${({$disabled:e})=>e&&i`
143
+ ${({ $disabled }) => $disabled &&
144
+ css `
54
145
  opacity: 0.5;
55
146
  cursor: not-allowed;
56
147
  `}
@@ -58,25 +149,28 @@
58
149
  /* Focus visible */
59
150
  &:focus-visible {
60
151
  box-shadow:
61
- 0 0 0 2px ${t.surface||"#fff"},
62
- 0 0 0 4px ${t.primary||"#454cbf"};
152
+ 0 0 0 2px ${tokens.surface || '#fff'},
153
+ 0 0 0 4px ${tokens.primary || '#454cbf'};
63
154
  }
64
155
 
65
156
  /* Active state */
66
157
  &:active:not(:disabled) {
67
158
  transform: scale(0.97);
68
159
  }
69
- `,IconWrapper=a.span`
160
+ `;
161
+ export const IconWrapper = styled.span `
70
162
  display: flex;
71
163
  align-items: center;
72
164
  justify-content: center;
73
165
  flex-shrink: 0;
74
- width: ${({$size:e})=>f[e].iconSize};
75
- height: ${({$size:e})=>f[e].iconSize};
166
+ width: ${({ $size }) => sizeConfig[$size].iconSize};
167
+ height: ${({ $size }) => sizeConfig[$size].iconSize};
76
168
 
77
- ${({$side:e})=>e==="left"?i`
169
+ ${({ $side }) => $side === 'left'
170
+ ? css `
78
171
  margin-left: -2px;
79
- `:i`
172
+ `
173
+ : css `
80
174
  margin-right: -2px;
81
175
  `}
82
176
 
@@ -84,29 +178,31 @@
84
178
  width: 100%;
85
179
  height: 100%;
86
180
  }
87
- `,AvatarWrapper=a.span`
181
+ `;
182
+ export const AvatarWrapper = styled.span `
88
183
  display: flex;
89
184
  align-items: center;
90
185
  justify-content: center;
91
186
  flex-shrink: 0;
92
- width: ${({$size:e})=>e==="small"?"18px":e==="large"?"28px":"24px"};
93
- height: ${({$size:e})=>e==="small"?"18px":e==="large"?"28px":"24px"};
187
+ width: ${({ $size }) => $size === 'small' ? '18px' : $size === 'large' ? '28px' : '24px'};
188
+ height: ${({ $size }) => $size === 'small' ? '18px' : $size === 'large' ? '28px' : '24px'};
94
189
  border-radius: 50%;
95
190
  overflow: hidden;
96
- margin-left: ${({$size:e})=>e==="small"?"-4px":e==="large"?"-10px":"-6px"};
191
+ margin-left: ${({ $size }) => $size === 'small' ? '-4px' : $size === 'large' ? '-10px' : '-6px'};
97
192
 
98
193
  img {
99
194
  width: 100%;
100
195
  height: 100%;
101
196
  object-fit: cover;
102
197
  }
103
- `,DeleteButton=a.span`
198
+ `;
199
+ export const DeleteButton = styled.span `
104
200
  display: flex;
105
201
  align-items: center;
106
202
  justify-content: center;
107
203
  flex-shrink: 0;
108
- width: ${({$size:e})=>e==="small"?"14px":e==="large"?"18px":"16px"};
109
- height: ${({$size:e})=>e==="small"?"14px":e==="large"?"18px":"16px"};
204
+ width: ${({ $size }) => $size === 'small' ? '14px' : $size === 'large' ? '18px' : '16px'};
205
+ height: ${({ $size }) => $size === 'small' ? '14px' : $size === 'large' ? '18px' : '16px'};
110
206
  border-radius: 50%;
111
207
  margin-right: -4px;
112
208
  transition: all 0.2s ease;
@@ -119,21 +215,25 @@
119
215
  width: 100%;
120
216
  height: 100%;
121
217
  }
122
- `,ChipLabel=a.span`
218
+ `;
219
+ export const ChipLabel = styled.span `
123
220
  line-height: 1;
124
- `,ChipGroupElement=a.div`
221
+ `;
222
+ export const ChipGroupElement = styled.div `
125
223
  display: flex;
126
- flex-direction: ${({$direction:e})=>e};
127
- gap: ${({$gap:e})=>e};
224
+ flex-direction: ${({ $direction }) => $direction};
225
+ gap: ${({ $gap }) => $gap};
128
226
 
129
- ${({$wrap:e})=>e&&i`
227
+ ${({ $wrap }) => $wrap &&
228
+ css `
130
229
  flex-wrap: wrap;
131
230
  `}
132
231
 
133
- ${({$scrollable:e,$direction:r})=>e&&i`
134
- overflow-x: ${r==="row"?"auto":"visible"};
135
- overflow-y: ${r==="column"?"auto":"visible"};
136
- padding-bottom: ${r==="row"?"4px":"0"};
232
+ ${({ $scrollable, $direction }) => $scrollable &&
233
+ css `
234
+ overflow-x: ${$direction === 'row' ? 'auto' : 'visible'};
235
+ overflow-y: ${$direction === 'column' ? 'auto' : 'visible'};
236
+ padding-bottom: ${$direction === 'row' ? '4px' : '0'};
137
237
 
138
238
  /* Custom scrollbar */
139
239
  &::-webkit-scrollbar {
@@ -146,7 +246,7 @@
146
246
  }
147
247
 
148
248
  &::-webkit-scrollbar-thumb {
149
- background: ${t.outline||"#d1d5db"};
249
+ background: ${tokens.outline || '#d1d5db'};
150
250
  border-radius: 2px;
151
251
  }
152
252
  `}
@@ -1 +1,2 @@
1
- "use strict";export{Chip,ChipGroup}from"./Chip";export*from"./types";
1
+ export { Chip, ChipGroup } from './Chip';
2
+ export * from './types';
@@ -1 +1,4 @@
1
- "use strict";export const CHIP_VARIANTS=["filled","outlined","soft"],CHIP_SIZES=["small","medium","large"],CHIP_COLORS=["default","primary","success","warning","error","info"],CHIP_TYPES=["button","selection","filter","input"];
1
+ export const CHIP_VARIANTS = ['filled', 'outlined', 'soft'];
2
+ export const CHIP_SIZES = ['small', 'medium', 'large'];
3
+ export const CHIP_COLORS = ['default', 'primary', 'success', 'warning', 'error', 'info'];
4
+ export const CHIP_TYPES = ['button', 'selection', 'filter', 'input'];
@@ -1 +1,25 @@
1
- "use strict";"use client";import{jsx as s,jsxs as x}from"react/jsx-runtime";import{forwardRef as h}from"react";import{DividerContainer as p,DividerLine as l,DividerLabel as D}from"./elements";export const Divider=h(function(c,d){const{orientation:e="horizontal",variant:a="solid",size:i="thin",color:t="default",inset:$="0",centerInset:f=!1,label:o,labelPosition:u="center",className:v,...m}=c,n=!!o,r=(()=>{if(!n)return{start:1,end:0};switch(u){case"start":return{start:0,end:1};case"end":return{start:1,end:0};default:return{start:1,end:1}}})();return x(p,{ref:d,$orientation:e,$variant:a,$size:i,$color:t,$inset:$,$centerInset:f,$hasLabel:n,role:"separator","aria-orientation":e,"data-aui":"divider",className:v,...m,children:[r.start>0&&s(l,{$orientation:e,$variant:a,$size:i,$color:t,$flex:r.start}),n&&s(D,{$color:t,children:o}),r.end>0&&s(l,{$orientation:e,$variant:a,$size:i,$color:t,$flex:r.end})]})});Divider.displayName="Divider";
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { forwardRef } from 'react';
4
+ import { DividerContainer, DividerLine, DividerLabel } from './elements';
5
+ export const Divider = forwardRef(function DividerComponent(props, ref) {
6
+ const { orientation = 'horizontal', variant = 'solid', size = 'thin', color = 'default', inset = '0', centerInset = false, label, labelPosition = 'center', className, ...rest } = props;
7
+ const hasLabel = Boolean(label);
8
+ // Calculate flex values for label positioning
9
+ const getFlexValues = () => {
10
+ if (!hasLabel)
11
+ return { start: 1, end: 0 };
12
+ switch (labelPosition) {
13
+ case 'start':
14
+ return { start: 0, end: 1 };
15
+ case 'end':
16
+ return { start: 1, end: 0 };
17
+ case 'center':
18
+ default:
19
+ return { start: 1, end: 1 };
20
+ }
21
+ };
22
+ const flexValues = getFlexValues();
23
+ return (_jsxs(DividerContainer, { ref: ref, "$orientation": orientation, "$variant": variant, "$size": size, "$color": color, "$inset": inset, "$centerInset": centerInset, "$hasLabel": hasLabel, role: "separator", "aria-orientation": orientation, "data-aui": "divider", className: className, ...rest, children: [flexValues.start > 0 && (_jsx(DividerLine, { "$orientation": orientation, "$variant": variant, "$size": size, "$color": color, "$flex": flexValues.start })), hasLabel && (_jsx(DividerLabel, { "$color": color, children: label })), flexValues.end > 0 && (_jsx(DividerLine, { "$orientation": orientation, "$variant": variant, "$size": size, "$color": color, "$flex": flexValues.end }))] }));
24
+ });
25
+ Divider.displayName = 'Divider';
@@ -1,66 +1,103 @@
1
- "use strict";import{styled as i,css as t}from"styled-components";import{tokens as n}from"../../utils/designTokens";const o={thin:"1px",medium:"2px",thick:"4px"},c={default:n.outline||"#e9ecef",primary:n.primary||"#454cbf",subtle:n.outlineSoft||"#f1f3f5",dark:"#374151"};export const DividerContainer=i.div`
1
+ import { styled, css } from 'styled-components';
2
+ import { tokens } from '../../utils/designTokens';
3
+ // Size values
4
+ const sizeValues = {
5
+ thin: '1px',
6
+ medium: '2px',
7
+ thick: '4px',
8
+ };
9
+ // Color values
10
+ const colorValues = {
11
+ default: tokens.outline || '#e9ecef',
12
+ primary: tokens.primary || '#454cbf',
13
+ subtle: tokens.outlineSoft || '#f1f3f5',
14
+ dark: '#374151',
15
+ };
16
+ export const DividerContainer = styled.div `
2
17
  display: flex;
3
18
  align-items: center;
4
19
 
5
- ${({$orientation:a,$inset:e,$centerInset:r})=>a==="horizontal"?t`
6
- width: ${r?`calc(100% - (${e} * 2))`:`calc(100% - ${e})`};
7
- margin-left: ${e};
8
- ${r&&`margin-right: ${e};`}
20
+ ${({ $orientation, $inset, $centerInset }) => $orientation === 'horizontal'
21
+ ? css `
22
+ width: ${$centerInset
23
+ ? `calc(100% - (${$inset} * 2))`
24
+ : `calc(100% - ${$inset})`};
25
+ margin-left: ${$inset};
26
+ ${$centerInset && `margin-right: ${$inset};`}
9
27
  flex-direction: row;
10
- `:t`
28
+ `
29
+ : css `
11
30
  height: 100%;
12
- margin-top: ${e};
13
- ${r&&`margin-bottom: ${e};`}
31
+ margin-top: ${$inset};
32
+ ${$centerInset && `margin-bottom: ${$inset};`}
14
33
  flex-direction: column;
15
34
  `}
16
- `,DividerLine=i.div`
17
- flex: ${({$flex:a})=>a??1};
35
+ `;
36
+ export const DividerLine = styled.div `
37
+ flex: ${({ $flex }) => $flex ?? 1};
18
38
 
19
- ${({$orientation:a,$size:e,$variant:r,$color:d})=>a==="horizontal"?t`
20
- height: ${o[e]};
39
+ ${({ $orientation, $size, $variant, $color }) => $orientation === 'horizontal'
40
+ ? css `
41
+ height: ${sizeValues[$size]};
21
42
  width: 100%;
22
- `:t`
23
- width: ${o[e]};
43
+ `
44
+ : css `
45
+ width: ${sizeValues[$size]};
24
46
  height: 100%;
25
47
  `}
26
48
 
27
49
  /* Variant styles */
28
- ${({$variant:a,$color:e})=>{const r=c[e];switch(a){case"solid":return t`
29
- background-color: ${r};
30
- `;case"dashed":return t`
50
+ ${({ $variant, $color }) => {
51
+ const colorValue = colorValues[$color];
52
+ switch ($variant) {
53
+ case 'solid':
54
+ return css `
55
+ background-color: ${colorValue};
56
+ `;
57
+ case 'dashed':
58
+ return css `
31
59
  background-image: repeating-linear-gradient(
32
60
  90deg,
33
- ${r},
34
- ${r} 8px,
61
+ ${colorValue},
62
+ ${colorValue} 8px,
35
63
  transparent 8px,
36
64
  transparent 16px
37
65
  );
38
- `;case"dotted":return t`
66
+ `;
67
+ case 'dotted':
68
+ return css `
39
69
  background-image: repeating-linear-gradient(
40
70
  90deg,
41
- ${r},
42
- ${r} 4px,
71
+ ${colorValue},
72
+ ${colorValue} 4px,
43
73
  transparent 4px,
44
74
  transparent 12px
45
75
  );
46
- `;case"gradient":return t`
76
+ `;
77
+ case 'gradient':
78
+ return css `
47
79
  background: linear-gradient(
48
80
  90deg,
49
81
  transparent 0%,
50
- ${r} 20%,
51
- ${r} 80%,
82
+ ${colorValue} 20%,
83
+ ${colorValue} 80%,
52
84
  transparent 100%
53
85
  );
54
- `;default:return t`
55
- background-color: ${r};
56
- `}}}
57
- `,DividerLabel=i.span`
58
- padding: 0 ${n.spacing150||"0.75rem"};
86
+ `;
87
+ default:
88
+ return css `
89
+ background-color: ${colorValue};
90
+ `;
91
+ }
92
+ }}
93
+ `;
94
+ export const DividerLabel = styled.span `
95
+ padding: 0 ${tokens.spacing150 || '0.75rem'};
59
96
  font-size: 0.75rem;
60
97
  font-weight: 500;
61
98
  text-transform: uppercase;
62
99
  letter-spacing: 0.05em;
63
- color: ${({$color:a})=>a==="dark"?"#9ca3af":n.onSurface?`${n.onSurface}80`:"#6c757d"};
100
+ color: ${({ $color }) => $color === 'dark' ? '#9ca3af' : tokens.onSurface ? `${tokens.onSurface}80` : '#6c757d'};
64
101
  white-space: nowrap;
65
102
  flex-shrink: 0;
66
103
  `;
@@ -1 +1,2 @@
1
- "use strict";export{Divider}from"./Divider";export*from"./types";
1
+ export { Divider } from './Divider';
2
+ export * from './types';
@@ -1 +1,4 @@
1
- "use strict";export const DIVIDER_ORIENTATIONS=["horizontal","vertical"],DIVIDER_VARIANTS=["solid","dashed","dotted","gradient"],DIVIDER_SIZES=["thin","medium","thick"],DIVIDER_COLORS=["default","primary","subtle","dark"];
1
+ export const DIVIDER_ORIENTATIONS = ['horizontal', 'vertical'];
2
+ export const DIVIDER_VARIANTS = ['solid', 'dashed', 'dotted', 'gradient'];
3
+ export const DIVIDER_SIZES = ['thin', 'medium', 'thick'];
4
+ export const DIVIDER_COLORS = ['default', 'primary', 'subtle', 'dark'];
@@ -1 +1,147 @@
1
- "use strict";"use client";import{jsx as e,jsxs as R,Fragment as ye}from"react/jsx-runtime";import Ce,{Children as $e,forwardRef as T,useMemo as s,useRef as K,useState as Re,useCallback as Se,createContext as we,useContext as xe}from"react";import{cn as q}from"../../utils";import J from"../../tc.module.css";import{GridWrapper as be,GridContainer as ke,GridItem as j,SkeletonItem as ve,EmptyState as Ge,ScrollArrow as O,ScrollDots as Ie,ScrollDot as De}from"./elements";import{gapSizeValues as Q}from"./types";import{calcColumns as Le,getGapValue as U,getResponsiveColumns as We,useWindowWidth as je,useElementResize as Ne,useScrollToKeyboardFocus as Ae,useScrollNavigation as Ee,getItemCount as Ve}from"./utils";const X=we(null);export const useGridContext=()=>xe(X);const Fe=()=>e("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e("polyline",{points:"15 18 9 12 15 6"})}),He=()=>e("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e("polyline",{points:"9 18 15 12 9 6"})}),_e=()=>R("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e("line",{x1:"9",y1:"9",x2:"15",y2:"15"}),e("line",{x1:"15",y1:"9",x2:"9",y2:"15"})]}),ze=()=>R(Ge,{children:[e(_e,{}),e("p",{className:q(J["text-gray-500"],J["text-sm"]),children:"No items to display"})]}),Be=({aspectRatio:S})=>e(ve,{$aspectRatio:S});export const DynamicGrid=T(function(w,N){const{children:c,minWidth:d=10,maxWidth:x,columns:m,responsiveColumns:u,maxColumns:p=1/0,maxRows:b,autoFit:h=!1,modulo:A=1,gap:k="md",rowGap:E,columnGap:V,variant:f="default",alignItems:Y,justifyItems:Z,alignContent:ee,justifyContent:te,scroll:r,scrollEnabled:F,animation:v,itemConfig:o,role:oe="none",elementRole:ne,ariaLabel:re,isLoading:g=!1,skeletonCount:H=6,renderSkeleton:G,emptyState:ie,onLayoutChange:I,onScrollChange:Pe,className:le,style:ae,containerClassName:se,itemClassName:_,...ce}=w,z=K(null),D=K(null),[B,de]=Re(0),P=je(),l=s(()=>r?.enabled||F?{enabled:!0,scrollHint:r?.scrollHint??.5,hideScrollbar:r?.hideScrollbar??!1,scrollSnapAlign:r?.scrollSnapAlign??"start",smoothScroll:r?.smoothScroll??!0,showArrows:r?.showArrows??!0,showDots:r?.showDots??!1,...r}:void 0,[r,F]),me=Se(n=>{de(n)},[]);Ne(z,me);const a=s(()=>{if(m)return m;if(u)return We(u,P);const n=U(k);return Le({minWidth:d,elementWidth:B,gap:n,modulo:A,maxColumns:p,scrollHint:l?.scrollHint})},[m,u,P,d,B,k,A,p,l?.scrollHint]);Ae(D,l);const y=Ve(c),i=Ee(D,y,a);Ce.useEffect(()=>{if(I){const n=Math.ceil(y/a);I(a,n)}},[a,y,I]);const L=U(k),ue=E?Q[E]:void 0,pe=V?Q[V]:void 0,W=s(()=>$e.toArray(c).map((t,M)=>e(j,{$animation:v,$animationIndex:M,$borderRadius:o?.borderRadius,$padding:o?.padding,$aspectRatio:o?.aspectRatio,className:_,children:t},M)),[c,v,o,_]),C=oe||ne||"none",he=s(()=>C==="list"?W.map((n,t)=>e("li",{style:{display:"contents"},children:n},t)):W,[W,C]),fe=s(()=>g?Array.from({length:H},(n,t)=>e(j,{$animation:{enabled:!0,type:"fade",duration:200},$animationIndex:t,$borderRadius:o?.borderRadius,$aspectRatio:o?.aspectRatio,children:G?G():e(Be,{aspectRatio:o?.aspectRatio})},`skeleton-${t}`)):null,[g,H,G,o]),$=!g&&y===0,ge=s(()=>({columns:a,gap:L,variant:f,itemConfig:o}),[a,L,f,o]);return e(X.Provider,{value:ge,children:R(be,{ref:z,$variant:f,className:q(se,le),style:ae,"data-aui":"dynamic-grid",...ce,children:[e(ke,{ref:D,as:C==="list"?"ul":"div",role:C==="grid"?"grid":void 0,"aria-label":re,$columns:a,$minWidth:d,$maxWidth:x,$gap:L,$rowGap:ue,$columnGap:pe,$autoFit:h,$maxRows:b,$alignItems:Y,$justifyItems:Z,$alignContent:ee,$justifyContent:te,$scroll:l,$animation:v,$variant:f,children:g?fe:$?null:he}),$&&(ie||e(ze,{})),l?.enabled&&l.showArrows&&!$&&R(ye,{children:[e(O,{$direction:"left",$visible:i.canScrollLeft,onClick:i.scrollLeft,"aria-label":"Scroll left",disabled:!i.canScrollLeft,children:e(Fe,{})}),e(O,{$direction:"right",$visible:i.canScrollRight,onClick:i.scrollRight,"aria-label":"Scroll right",disabled:!i.canScrollRight,children:e(He,{})})]}),l?.enabled&&l.showDots&&!$&&e(Ie,{children:Array.from({length:i.totalPages},(n,t)=>e(De,{$active:t===i.currentPage,onClick:()=>i.scrollTo(t),"aria-label":`Go to page ${t+1}`},t))})]})})}),DynamicGridItem=T(function({children:w,colSpan:N,rowSpan:c,order:d,alignSelf:x,justifySelf:m,className:u,...p},b){const h=useGridContext();return e(j,{ref:b,$colSpan:N,$rowSpan:c,$order:d,$alignSelf:x,$justifySelf:m,$borderRadius:h?.itemConfig?.borderRadius,$padding:h?.itemConfig?.padding,className:u,...p,children:w})});DynamicGrid.displayName="DynamicGrid",DynamicGridItem.displayName="DynamicGridItem";
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import React, { Children, forwardRef, useMemo, useRef, useState, useCallback, createContext, useContext, } from 'react';
4
+ import { cn } from '../../utils';
5
+ import s from '../../tc.module.css';
6
+ import { GridWrapper, GridContainer, GridItem, SkeletonItem, EmptyState, ScrollArrow, ScrollDots, ScrollDot, } from './elements';
7
+ import { gapSizeValues, } from './types';
8
+ import { calcColumns, getGapValue, getResponsiveColumns, useWindowWidth, useElementResize, useScrollToKeyboardFocus, useScrollNavigation, getItemCount, } from './utils';
9
+ // Grid context for nested components
10
+ const GridContext = createContext(null);
11
+ export const useGridContext = () => useContext(GridContext);
12
+ // Arrow icons
13
+ const ChevronLeftIcon = () => (_jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("polyline", { points: "15 18 9 12 15 6" }) }));
14
+ const ChevronRightIcon = () => (_jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: _jsx("polyline", { points: "9 18 15 12 9 6" }) }));
15
+ // Empty icon
16
+ const EmptyIcon = () => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [_jsx("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }), _jsx("line", { x1: "9", y1: "9", x2: "15", y2: "15" }), _jsx("line", { x1: "15", y1: "9", x2: "9", y2: "15" })] }));
17
+ // Default empty state
18
+ const DefaultEmptyState = () => (_jsxs(EmptyState, { children: [_jsx(EmptyIcon, {}), _jsx("p", { className: cn(s['text-gray-500'], s['text-sm']), children: "No items to display" })] }));
19
+ // Default skeleton renderer
20
+ const DefaultSkeleton = ({ aspectRatio }) => (_jsx(SkeletonItem, { "$aspectRatio": aspectRatio }));
21
+ export const DynamicGrid = forwardRef(function DynamicGridComponent(props, fRef) {
22
+ const { children,
23
+ // Layout
24
+ minWidth = 10, maxWidth, columns: fixedColumns, responsiveColumns, maxColumns = Infinity, maxRows, autoFit = false, modulo = 1,
25
+ // Spacing
26
+ gap = 'md', rowGap, columnGap,
27
+ // Styling
28
+ variant = 'default', alignItems, justifyItems, alignContent, justifyContent,
29
+ // Scroll
30
+ scroll, scrollEnabled,
31
+ // Animation
32
+ animation,
33
+ // Item config
34
+ itemConfig,
35
+ // Accessibility
36
+ role = 'none', elementRole, ariaLabel,
37
+ // State
38
+ isLoading = false, skeletonCount = 6, renderSkeleton, emptyState,
39
+ // Events
40
+ onLayoutChange, onScrollChange,
41
+ // Styling
42
+ className, style, containerClassName, itemClassName, ...rest } = props;
43
+ const innerRef = useRef(null);
44
+ const gridRef = useRef(null);
45
+ const [elementWidth, setElementWidth] = useState(0);
46
+ const windowWidth = useWindowWidth();
47
+ // Merge scroll config
48
+ const scrollConfig = useMemo(() => scroll?.enabled || scrollEnabled
49
+ ? {
50
+ enabled: true,
51
+ scrollHint: scroll?.scrollHint ?? 0.5,
52
+ hideScrollbar: scroll?.hideScrollbar ?? false,
53
+ scrollSnapAlign: scroll?.scrollSnapAlign ?? 'start',
54
+ smoothScroll: scroll?.smoothScroll ?? true,
55
+ showArrows: scroll?.showArrows ?? true,
56
+ showDots: scroll?.showDots ?? false,
57
+ ...scroll,
58
+ }
59
+ : undefined, [scroll, scrollEnabled]);
60
+ // Handle element resize
61
+ const handleResize = useCallback((width) => {
62
+ setElementWidth(width);
63
+ }, []);
64
+ useElementResize(innerRef, handleResize);
65
+ // Calculate columns
66
+ const calculatedColumns = useMemo(() => {
67
+ // Use fixed columns if provided
68
+ if (fixedColumns)
69
+ return fixedColumns;
70
+ // Use responsive columns if provided
71
+ if (responsiveColumns) {
72
+ return getResponsiveColumns(responsiveColumns, windowWidth);
73
+ }
74
+ // Calculate based on container width
75
+ const gapValue = getGapValue(gap);
76
+ return calcColumns({
77
+ minWidth,
78
+ elementWidth,
79
+ gap: gapValue,
80
+ modulo,
81
+ maxColumns,
82
+ scrollHint: scrollConfig?.scrollHint,
83
+ });
84
+ }, [
85
+ fixedColumns,
86
+ responsiveColumns,
87
+ windowWidth,
88
+ minWidth,
89
+ elementWidth,
90
+ gap,
91
+ modulo,
92
+ maxColumns,
93
+ scrollConfig?.scrollHint,
94
+ ]);
95
+ // Handle keyboard focus scroll
96
+ useScrollToKeyboardFocus(gridRef, scrollConfig);
97
+ // Scroll navigation
98
+ const itemCount = getItemCount(children);
99
+ const scrollNav = useScrollNavigation(gridRef, itemCount, calculatedColumns);
100
+ // Notify layout changes
101
+ React.useEffect(() => {
102
+ if (onLayoutChange) {
103
+ const rows = Math.ceil(itemCount / calculatedColumns);
104
+ onLayoutChange(calculatedColumns, rows);
105
+ }
106
+ }, [calculatedColumns, itemCount, onLayoutChange]);
107
+ // Get gap values
108
+ const gapValue = getGapValue(gap);
109
+ const rowGapValue = rowGap ? gapSizeValues[rowGap] : undefined;
110
+ const columnGapValue = columnGap ? gapSizeValues[columnGap] : undefined;
111
+ // Process children
112
+ const processedChildren = useMemo(() => {
113
+ const childArray = Children.toArray(children);
114
+ return childArray.map((child, index) => (_jsx(GridItem, { "$animation": animation, "$animationIndex": index, "$borderRadius": itemConfig?.borderRadius, "$padding": itemConfig?.padding, "$aspectRatio": itemConfig?.aspectRatio, className: itemClassName, children: child }, index)));
115
+ }, [children, animation, itemConfig, itemClassName]);
116
+ // Render as list items if role is list
117
+ const gridRole = role || elementRole || 'none';
118
+ const renderChildren = useMemo(() => {
119
+ if (gridRole === 'list') {
120
+ return processedChildren.map((child, index) => (_jsx("li", { style: { display: 'contents' }, children: child }, index)));
121
+ }
122
+ return processedChildren;
123
+ }, [processedChildren, gridRole]);
124
+ // Render skeletons
125
+ const skeletons = useMemo(() => {
126
+ if (!isLoading)
127
+ return null;
128
+ return Array.from({ length: skeletonCount }, (_, index) => (_jsx(GridItem, { "$animation": { enabled: true, type: 'fade', duration: 200 }, "$animationIndex": index, "$borderRadius": itemConfig?.borderRadius, "$aspectRatio": itemConfig?.aspectRatio, children: renderSkeleton ? (renderSkeleton()) : (_jsx(DefaultSkeleton, { aspectRatio: itemConfig?.aspectRatio })) }, `skeleton-${index}`)));
129
+ }, [isLoading, skeletonCount, renderSkeleton, itemConfig]);
130
+ // Check if empty
131
+ const isEmpty = !isLoading && itemCount === 0;
132
+ // Grid context value
133
+ const contextValue = useMemo(() => ({
134
+ columns: calculatedColumns,
135
+ gap: gapValue,
136
+ variant,
137
+ itemConfig,
138
+ }), [calculatedColumns, gapValue, variant, itemConfig]);
139
+ return (_jsx(GridContext.Provider, { value: contextValue, children: _jsxs(GridWrapper, { ref: innerRef, "$variant": variant, className: cn(containerClassName, className), style: style, "data-aui": "dynamic-grid", ...rest, children: [_jsx(GridContainer, { ref: gridRef, as: gridRole === 'list' ? 'ul' : 'div', role: gridRole === 'grid' ? 'grid' : undefined, "aria-label": ariaLabel, "$columns": calculatedColumns, "$minWidth": minWidth, "$maxWidth": maxWidth, "$gap": gapValue, "$rowGap": rowGapValue, "$columnGap": columnGapValue, "$autoFit": autoFit, "$maxRows": maxRows, "$alignItems": alignItems, "$justifyItems": justifyItems, "$alignContent": alignContent, "$justifyContent": justifyContent, "$scroll": scrollConfig, "$animation": animation, "$variant": variant, children: isLoading ? skeletons : isEmpty ? null : renderChildren }), isEmpty && (emptyState || _jsx(DefaultEmptyState, {})), scrollConfig?.enabled && scrollConfig.showArrows && !isEmpty && (_jsxs(_Fragment, { children: [_jsx(ScrollArrow, { "$direction": "left", "$visible": scrollNav.canScrollLeft, onClick: scrollNav.scrollLeft, "aria-label": "Scroll left", disabled: !scrollNav.canScrollLeft, children: _jsx(ChevronLeftIcon, {}) }), _jsx(ScrollArrow, { "$direction": "right", "$visible": scrollNav.canScrollRight, onClick: scrollNav.scrollRight, "aria-label": "Scroll right", disabled: !scrollNav.canScrollRight, children: _jsx(ChevronRightIcon, {}) })] })), scrollConfig?.enabled && scrollConfig.showDots && !isEmpty && (_jsx(ScrollDots, { children: Array.from({ length: scrollNav.totalPages }, (_, index) => (_jsx(ScrollDot, { "$active": index === scrollNav.currentPage, onClick: () => scrollNav.scrollTo(index), "aria-label": `Go to page ${index + 1}` }, index))) }))] }) }));
140
+ });
141
+ // Grid Item component for advanced usage
142
+ export const DynamicGridItem = forwardRef(function DynamicGridItemComponent({ children, colSpan, rowSpan, order, alignSelf, justifySelf, className, ...rest }, ref) {
143
+ const gridContext = useGridContext();
144
+ return (_jsx(GridItem, { ref: ref, "$colSpan": colSpan, "$rowSpan": rowSpan, "$order": order, "$alignSelf": alignSelf, "$justifySelf": justifySelf, "$borderRadius": gridContext?.itemConfig?.borderRadius, "$padding": gridContext?.itemConfig?.padding, className: className, ...rest, children: children }));
145
+ });
146
+ DynamicGrid.displayName = 'DynamicGrid';
147
+ DynamicGridItem.displayName = 'DynamicGridItem';