@pixpilot/shadcn-ui 0.4.0 → 0.4.1

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 (320) hide show
  1. package/dist/AbsoluteFill.cjs +24 -1
  2. package/dist/AbsoluteFill.d.ts +2 -2
  3. package/dist/AbsoluteFill.js +21 -1
  4. package/dist/Alert.cjs +81 -1
  5. package/dist/Alert.js +77 -1
  6. package/dist/Button.cjs +84 -1
  7. package/dist/Button.d.ts +1 -1
  8. package/dist/Button.js +79 -1
  9. package/dist/CloseButtonAbsolute.cjs +20 -1
  10. package/dist/CloseButtonAbsolute.js +16 -1
  11. package/dist/CloseButtonRounded.cjs +22 -1
  12. package/dist/CloseButtonRounded.js +17 -1
  13. package/dist/Combobox.cjs +53 -1
  14. package/dist/Combobox.js +48 -1
  15. package/dist/CommandOptionList.cjs +29 -1
  16. package/dist/CommandOptionList.js +25 -1
  17. package/dist/ContentCard.cjs +27 -1
  18. package/dist/ContentCard.js +23 -1
  19. package/dist/DatePicker.cjs +38 -1
  20. package/dist/DatePicker.d.ts +2 -2
  21. package/dist/DatePicker.js +33 -1
  22. package/dist/LoadingOverlay.cjs +65 -1
  23. package/dist/LoadingOverlay.js +60 -1
  24. package/dist/Select.cjs +27 -1
  25. package/dist/Select.js +23 -1
  26. package/dist/Slider.cjs +19 -1
  27. package/dist/Slider.js +15 -1
  28. package/dist/ThemeToggle.cjs +98 -1
  29. package/dist/ThemeToggle.js +94 -1
  30. package/dist/_virtual/rolldown_runtime.cjs +44 -1
  31. package/dist/_virtual/rolldown_runtime.js +43 -1
  32. package/dist/confirmation-dialog/ConfirmationDialog.cjs +47 -1
  33. package/dist/confirmation-dialog/ConfirmationDialog.d.cts +1 -0
  34. package/dist/confirmation-dialog/ConfirmationDialog.js +43 -1
  35. package/dist/confirmation-dialog/DialogProvider.cjs +16 -1
  36. package/dist/confirmation-dialog/DialogProvider.js +12 -1
  37. package/dist/confirmation-dialog/confirmation-dialogs.cjs +14 -1
  38. package/dist/confirmation-dialog/confirmation-dialogs.js +12 -1
  39. package/dist/confirmation-dialog/index.cjs +7 -1
  40. package/dist/confirmation-dialog/index.js +6 -1
  41. package/dist/file-upload/FileUpload.cjs +68 -1
  42. package/dist/file-upload/FileUpload.js +63 -1
  43. package/dist/file-upload/FileUploadItems.cjs +36 -1
  44. package/dist/file-upload/FileUploadItems.js +32 -1
  45. package/dist/file-upload/FileUploadListItem.cjs +89 -1
  46. package/dist/file-upload/FileUploadListItem.js +83 -1
  47. package/dist/file-upload/hooks/index.cjs +4 -1
  48. package/dist/file-upload/hooks/index.d.cts +2 -0
  49. package/dist/file-upload/hooks/index.js +3 -1
  50. package/dist/file-upload/hooks/use-file-error.cjs +15 -1
  51. package/dist/file-upload/hooks/use-file-error.js +14 -1
  52. package/dist/file-upload/hooks/use-file-upload-progress-callbacks.cjs +34 -1
  53. package/dist/file-upload/hooks/use-file-upload-progress-callbacks.d.cts +1 -0
  54. package/dist/file-upload/hooks/use-file-upload-progress-callbacks.js +32 -1
  55. package/dist/file-upload/hooks/use-file-upload-store.cjs +77 -1
  56. package/dist/file-upload/hooks/use-file-upload-store.d.cts +2 -0
  57. package/dist/file-upload/hooks/use-file-upload-store.js +75 -1
  58. package/dist/file-upload/index.cjs +6 -1
  59. package/dist/file-upload/index.d.cts +2 -1
  60. package/dist/file-upload/index.js +5 -1
  61. package/dist/file-upload/utils/create-placeholder-file.cjs +12 -1
  62. package/dist/file-upload/utils/create-placeholder-file.js +10 -1
  63. package/dist/file-upload/utils/get-file-key.cjs +9 -1
  64. package/dist/file-upload/utils/get-file-key.d.cts +1 -0
  65. package/dist/file-upload/utils/get-file-key.js +7 -1
  66. package/dist/file-upload/utils/get-file-meta.cjs +24 -1
  67. package/dist/file-upload/utils/get-file-meta.d.cts +1 -0
  68. package/dist/file-upload/utils/get-file-meta.js +21 -1
  69. package/dist/file-upload/utils/index.d.cts +4 -0
  70. package/dist/file-upload/utils/is-file-equal.cjs +10 -1
  71. package/dist/file-upload/utils/is-file-equal.d.cts +1 -0
  72. package/dist/file-upload/utils/is-file-equal.js +8 -1
  73. package/dist/file-upload/utils/merge-file-metadata.cjs +27 -1
  74. package/dist/file-upload/utils/merge-file-metadata.d.cts +1 -0
  75. package/dist/file-upload/utils/merge-file-metadata.js +26 -1
  76. package/dist/file-upload-inline/FileUploadInline.cjs +71 -1
  77. package/dist/file-upload-inline/FileUploadInline.js +66 -1
  78. package/dist/file-upload-inline/FileUploadInlineItem.cjs +96 -1
  79. package/dist/file-upload-inline/FileUploadInlineItem.js +90 -1
  80. package/dist/file-upload-inline/defaults.cjs +12 -1
  81. package/dist/file-upload-inline/defaults.js +10 -1
  82. package/dist/file-upload-inline/index.cjs +2 -1
  83. package/dist/file-upload-inline/index.js +1 -1
  84. package/dist/file-upload-inline/utils.cjs +37 -1
  85. package/dist/file-upload-inline/utils.js +34 -1
  86. package/dist/hooks/index.cjs +2 -1
  87. package/dist/hooks/index.js +1 -1
  88. package/dist/hooks/use-media-query.cjs +9 -1
  89. package/dist/hooks/use-media-query.js +7 -1
  90. package/dist/icon-selector/IconPicker.cjs +93 -1
  91. package/dist/icon-selector/IconPicker.js +88 -1
  92. package/dist/icon-selector/constants.cjs +7 -1
  93. package/dist/icon-selector/constants.js +5 -0
  94. package/dist/icon-selector/icon-picker-container.cjs +35 -1
  95. package/dist/icon-selector/icon-picker-container.js +32 -1
  96. package/dist/icon-selector/icon-picker-content.cjs +146 -1
  97. package/dist/icon-selector/icon-picker-content.js +141 -1
  98. package/dist/icon-selector/index.cjs +2 -1
  99. package/dist/icon-selector/index.js +1 -1
  100. package/dist/icon-selector/use-async-providers.cjs +69 -1
  101. package/dist/icon-selector/use-async-providers.js +67 -1
  102. package/dist/icon-selector/utils/is-valid-provider.cjs +12 -1
  103. package/dist/icon-selector/utils/is-valid-provider.js +10 -1
  104. package/dist/icon-selector/virtualized-icon-grid.cjs +137 -1
  105. package/dist/icon-selector/virtualized-icon-grid.js +132 -1
  106. package/dist/index.cjs +76 -1
  107. package/dist/index.js +37 -1
  108. package/dist/node_modules/.pnpm/@diceui_shared@0.12.0_@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@1_2c51ffe880f01dd537d5b6a13313daf4/node_modules/@diceui/shared/dist/index.cjs +558 -1
  109. package/dist/node_modules/.pnpm/@diceui_shared@0.12.0_@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@1_2c51ffe880f01dd537d5b6a13313daf4/node_modules/@diceui/shared/dist/index.js +555 -1
  110. package/dist/node_modules/.pnpm/@diceui_tags-input@0.7.2_@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__reac_e193dc2ff0d426ed009417f8d89778fd/node_modules/@diceui/tags-input/dist/index.cjs +566 -1
  111. package/dist/node_modules/.pnpm/@diceui_tags-input@0.7.2_@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__reac_e193dc2ff0d426ed009417f8d89778fd/node_modules/@diceui/tags-input/dist/index.js +565 -1
  112. package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.cjs +695 -1
  113. package/dist/node_modules/.pnpm/@floating-ui_core@1.7.3/node_modules/@floating-ui/core/dist/floating-ui.core.js +679 -1
  114. package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.cjs +521 -1
  115. package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.4/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +503 -1
  116. package/dist/node_modules/.pnpm/@floating-ui_react-dom@2.1.6_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.cjs +282 -1
  117. package/dist/node_modules/.pnpm/@floating-ui_react-dom@2.1.6_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +266 -1
  118. package/dist/node_modules/.pnpm/@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.esm.cjs +3767 -1
  119. package/dist/node_modules/.pnpm/@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.esm.js +3747 -1
  120. package/dist/node_modules/.pnpm/@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.utils.cjs +426 -1
  121. package/dist/node_modules/.pnpm/@floating-ui_react@0.27.16_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js +379 -1
  122. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.cjs +165 -1
  123. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.cjs +175 -1
  124. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +151 -1
  125. package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.10/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +138 -1
  126. package/dist/node_modules/.pnpm/@radix-ui_primitive@1.1.3/node_modules/@radix-ui/primitive/dist/index.cjs +13 -0
  127. package/dist/node_modules/.pnpm/@radix-ui_primitive@1.1.3/node_modules/@radix-ui/primitive/dist/index.js +11 -0
  128. package/dist/node_modules/.pnpm/@radix-ui_react-compose-refs@1.1.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +33 -0
  129. package/dist/node_modules/.pnpm/@radix-ui_react-compose-refs@1.1.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.js +30 -0
  130. package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-context/dist/index.cjs +92 -0
  131. package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-context/dist/index.js +88 -0
  132. package/dist/node_modules/.pnpm/@radix-ui_react-dialog@1.1.15_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react_4f1d9653b0e2175502748f45fd432185/node_modules/@radix-ui/react-dialog/dist/index.cjs +310 -0
  133. package/dist/node_modules/.pnpm/@radix-ui_react-dialog@1.1.15_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react_4f1d9653b0e2175502748f45fd432185/node_modules/@radix-ui/react-dialog/dist/index.js +299 -0
  134. package/dist/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@_9ee1db7daf927866cf505b31d40047ad/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs +190 -0
  135. package/dist/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@_9ee1db7daf927866cf505b31d40047ad/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +187 -0
  136. package/dist/node_modules/.pnpm/@radix-ui_react-focus-guards@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-focus-guards/dist/index.cjs +34 -0
  137. package/dist/node_modules/.pnpm/@radix-ui_react-focus-guards@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-focus-guards/dist/index.js +32 -0
  138. package/dist/node_modules/.pnpm/@radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_r_0a31b7f987af9482d13505312e1a1be9/node_modules/@radix-ui/react-focus-scope/dist/index.cjs +203 -0
  139. package/dist/node_modules/.pnpm/@radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_r_0a31b7f987af9482d13505312e1a1be9/node_modules/@radix-ui/react-focus-scope/dist/index.js +200 -0
  140. package/dist/node_modules/.pnpm/@radix-ui_react-id@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-id/dist/index.cjs +18 -0
  141. package/dist/node_modules/.pnpm/@radix-ui_react-id@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-id/dist/index.js +16 -0
  142. package/dist/node_modules/.pnpm/@radix-ui_react-portal@1.1.9_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_1bb4e0f97f86496802d28a2e74e2a8b9/node_modules/@radix-ui/react-portal/dist/index.cjs +29 -0
  143. package/dist/node_modules/.pnpm/@radix-ui_react-portal@1.1.9_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_1bb4e0f97f86496802d28a2e74e2a8b9/node_modules/@radix-ui/react-portal/dist/index.js +25 -0
  144. package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.1.5_@types_react-dom@19.2.3_@types_react@19.2.6__@types_reac_90f8e5c12233caef3399d5fd66452a13/node_modules/@radix-ui/react-presence/dist/index.cjs +110 -0
  145. package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.1.5_@types_react-dom@19.2.3_@types_react@19.2.6__@types_reac_90f8e5c12233caef3399d5fd66452a13/node_modules/@radix-ui/react-presence/dist/index.js +108 -0
  146. package/dist/node_modules/.pnpm/@radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_rea_a92a69cb1cb39305138539e4fa72f596/node_modules/@radix-ui/react-primitive/dist/index.cjs +52 -0
  147. package/dist/node_modules/.pnpm/@radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_rea_a92a69cb1cb39305138539e4fa72f596/node_modules/@radix-ui/react-primitive/dist/index.js +47 -0
  148. package/dist/node_modules/.pnpm/@radix-ui_react-slot@1.2.3_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-slot/dist/index.cjs +92 -0
  149. package/dist/node_modules/.pnpm/@radix-ui_react-slot@1.2.3_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-slot/dist/index.js +89 -0
  150. package/dist/node_modules/.pnpm/@radix-ui_react-slot@1.2.4_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-slot/dist/index.cjs +103 -0
  151. package/dist/node_modules/.pnpm/@radix-ui_react-slot@1.2.4_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-slot/dist/index.js +100 -0
  152. package/dist/node_modules/.pnpm/@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +15 -0
  153. package/dist/node_modules/.pnpm/@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +13 -0
  154. package/dist/node_modules/.pnpm/@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs +64 -0
  155. package/dist/node_modules/.pnpm/@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +62 -0
  156. package/dist/node_modules/.pnpm/@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-escape-keydown/dist/index.cjs +19 -0
  157. package/dist/node_modules/.pnpm/@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +17 -0
  158. package/dist/node_modules/.pnpm/@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs +9 -0
  159. package/dist/node_modules/.pnpm/@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
  160. package/dist/node_modules/.pnpm/aria-hidden@1.2.6/node_modules/aria-hidden/dist/es2015/index.js +108 -0
  161. package/dist/node_modules/.pnpm/aria-hidden@1.2.6/node_modules/aria-hidden/dist/es5/index.cjs +155 -0
  162. package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.cjs +19 -0
  163. package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.js +17 -0
  164. package/dist/node_modules/.pnpm/detect-node-es@1.1.0/node_modules/detect-node-es/es5/node.cjs +14 -0
  165. package/dist/node_modules/.pnpm/get-nonce@1.0.1/node_modules/get-nonce/dist/es2015/index.js +9 -0
  166. package/dist/node_modules/.pnpm/get-nonce@1.0.1/node_modules/get-nonce/dist/es5/index.cjs +22 -0
  167. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es2015/component.js +46 -0
  168. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +12 -0
  169. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es2015/index.js +3 -0
  170. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +37 -0
  171. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es5/component.cjs +61 -0
  172. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es5/constants.cjs +23 -0
  173. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es5/index.cjs +57 -0
  174. package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll-bar/dist/es5/utils.cjs +49 -0
  175. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/Combination.js +17 -0
  176. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +163 -0
  177. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/UI.js +64 -0
  178. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +16 -0
  179. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +85 -0
  180. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/medium.js +7 -0
  181. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/sidecar.js +9 -0
  182. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es5/Combination.cjs +29 -0
  183. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es5/SideEffect.cjs +179 -0
  184. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es5/UI.cjs +79 -0
  185. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es5/aggresiveCapture.cjs +27 -0
  186. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es5/handleScroll.cjs +98 -0
  187. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es5/index.cjs +19 -0
  188. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es5/medium.cjs +18 -0
  189. package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es5/sidecar.cjs +21 -0
  190. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es2015/component.js +21 -0
  191. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es2015/hook.js +27 -0
  192. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es2015/index.js +3 -0
  193. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es2015/singleton.js +43 -0
  194. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es5/component.cjs +33 -0
  195. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es5/hook.cjs +40 -0
  196. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es5/index.cjs +39 -0
  197. package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0/node_modules/react-style-singleton/dist/es5/singleton.cjs +55 -0
  198. package/dist/node_modules/.pnpm/tabbable@6.3.0/node_modules/tabbable/dist/index.cjs +347 -1
  199. package/dist/node_modules/.pnpm/tabbable@6.3.0/node_modules/tabbable/dist/index.esm.js +268 -1
  200. package/dist/node_modules/.pnpm/tailwind-merge@3.4.0/node_modules/tailwind-merge/dist/bundle-mjs.cjs +1895 -0
  201. package/dist/node_modules/.pnpm/tailwind-merge@3.4.0/node_modules/tailwind-merge/dist/bundle-mjs.js +1893 -0
  202. package/dist/node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.cjs +557 -0
  203. package/dist/node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.js +31 -0
  204. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es2015/assignRef.js +22 -0
  205. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +47 -0
  206. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es2015/useRef.js +42 -0
  207. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es5/assignRef.cjs +34 -0
  208. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es5/createRef.cjs +39 -0
  209. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es5/index.cjs +85 -0
  210. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es5/mergeRef.cjs +40 -0
  211. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es5/refToCallback.cjs +59 -0
  212. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es5/transformRef.cjs +34 -0
  213. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es5/useMergeRef.cjs +61 -0
  214. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es5/useRef.cjs +53 -0
  215. package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0/node_modules/use-callback-ref/dist/es5/useTransformRef.cjs +38 -0
  216. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es2015/exports.js +19 -0
  217. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es2015/medium.js +84 -0
  218. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es5/config.cjs +22 -0
  219. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es5/env.cjs +21 -0
  220. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es5/exports.cjs +31 -0
  221. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es5/hoc.cjs +31 -0
  222. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es5/hook.cjs +60 -0
  223. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es5/index.cjs +69 -0
  224. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es5/medium.cjs +101 -0
  225. package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0/node_modules/use-sidecar/dist/es5/renderProp.cjs +58 -0
  226. package/dist/packages/shadcn/src/components/index.cjs +6 -1
  227. package/dist/packages/shadcn/src/components/index.js +5 -1
  228. package/dist/packages/shadcn/src/components/ui/OrContinueWithSeparator.cjs +6 -1
  229. package/dist/packages/shadcn/src/components/ui/OrContinueWithSeparator.js +3 -1
  230. package/dist/packages/shadcn/src/components/ui/alert-dialog.cjs +10 -1
  231. package/dist/packages/shadcn/src/components/ui/alert-dialog.js +6 -1
  232. package/dist/packages/shadcn/src/components/ui/alert.cjs +44 -1
  233. package/dist/packages/shadcn/src/components/ui/alert.js +38 -1
  234. package/dist/packages/shadcn/src/components/ui/avatar.cjs +5 -1
  235. package/dist/packages/shadcn/src/components/ui/avatar.js +2 -1
  236. package/dist/packages/shadcn/src/components/ui/badge.cjs +20 -1
  237. package/dist/packages/shadcn/src/components/ui/badge.js +16 -1
  238. package/dist/packages/shadcn/src/components/ui/button.cjs +50 -1
  239. package/dist/packages/shadcn/src/components/ui/button.js +45 -1
  240. package/dist/packages/shadcn/src/components/ui/calendar.cjs +8 -1
  241. package/dist/packages/shadcn/src/components/ui/calendar.js +4 -1
  242. package/dist/packages/shadcn/src/components/ui/card.cjs +5 -1
  243. package/dist/packages/shadcn/src/components/ui/card.js +2 -1
  244. package/dist/packages/shadcn/src/components/ui/checkbox.cjs +10 -1
  245. package/dist/packages/shadcn/src/components/ui/checkbox.js +6 -1
  246. package/dist/packages/shadcn/src/components/ui/command.cjs +11 -1
  247. package/dist/packages/shadcn/src/components/ui/command.js +7 -1
  248. package/dist/packages/shadcn/src/components/ui/dialog.cjs +93 -1
  249. package/dist/packages/shadcn/src/components/ui/dialog.js +81 -1
  250. package/dist/packages/shadcn/src/components/ui/dropdown-menu.cjs +7 -1
  251. package/dist/packages/shadcn/src/components/ui/dropdown-menu.js +3 -1
  252. package/dist/packages/shadcn/src/components/ui/file-upload.cjs +49 -1
  253. package/dist/packages/shadcn/src/components/ui/file-upload.js +45 -1
  254. package/dist/packages/shadcn/src/components/ui/form.cjs +12 -1
  255. package/dist/packages/shadcn/src/components/ui/form.js +9 -1
  256. package/dist/packages/shadcn/src/components/ui/index.cjs +30 -1
  257. package/dist/packages/shadcn/src/components/ui/index.js +29 -1
  258. package/dist/packages/shadcn/src/components/ui/input.cjs +5 -1
  259. package/dist/packages/shadcn/src/components/ui/input.js +2 -1
  260. package/dist/packages/shadcn/src/components/ui/label.cjs +5 -1
  261. package/dist/packages/shadcn/src/components/ui/label.js +2 -1
  262. package/dist/packages/shadcn/src/components/ui/pagination.cjs +9 -1
  263. package/dist/packages/shadcn/src/components/ui/pagination.js +4 -1
  264. package/dist/packages/shadcn/src/components/ui/popover.cjs +5 -1
  265. package/dist/packages/shadcn/src/components/ui/popover.js +2 -1
  266. package/dist/packages/shadcn/src/components/ui/radio-group.cjs +7 -1
  267. package/dist/packages/shadcn/src/components/ui/radio-group.js +3 -1
  268. package/dist/packages/shadcn/src/components/ui/select.cjs +10 -1
  269. package/dist/packages/shadcn/src/components/ui/select.js +6 -1
  270. package/dist/packages/shadcn/src/components/ui/separator.cjs +5 -1
  271. package/dist/packages/shadcn/src/components/ui/separator.js +2 -1
  272. package/dist/packages/shadcn/src/components/ui/shadcn-io/tags/index.cjs +26 -1
  273. package/dist/packages/shadcn/src/components/ui/shadcn-io/tags/index.js +22 -1
  274. package/dist/packages/shadcn/src/components/ui/shadcn-io/tags-input-inline/index.cjs +6 -1
  275. package/dist/packages/shadcn/src/components/ui/shadcn-io/tags-input-inline/index.js +3 -1
  276. package/dist/packages/shadcn/src/components/ui/sheet.cjs +7 -1
  277. package/dist/packages/shadcn/src/components/ui/sheet.js +3 -1
  278. package/dist/packages/shadcn/src/components/ui/slider.cjs +5 -1
  279. package/dist/packages/shadcn/src/components/ui/slider.js +2 -1
  280. package/dist/packages/shadcn/src/components/ui/switch.cjs +8 -1
  281. package/dist/packages/shadcn/src/components/ui/switch.js +5 -1
  282. package/dist/packages/shadcn/src/components/ui/tabs.cjs +5 -1
  283. package/dist/packages/shadcn/src/components/ui/tabs.js +2 -1
  284. package/dist/packages/shadcn/src/components/ui/textarea.cjs +5 -1
  285. package/dist/packages/shadcn/src/components/ui/textarea.js +2 -1
  286. package/dist/packages/shadcn/src/components/ui/tooltip.cjs +5 -1
  287. package/dist/packages/shadcn/src/components/ui/tooltip.js +2 -1
  288. package/dist/packages/shadcn/src/lib/utils.cjs +11 -1
  289. package/dist/packages/shadcn/src/lib/utils.js +10 -1
  290. package/dist/pagination/Pagination.cjs +156 -1
  291. package/dist/pagination/Pagination.js +151 -1
  292. package/dist/pagination/index.cjs +2 -1
  293. package/dist/pagination/index.js +1 -1
  294. package/dist/rich-text-editor/RichTextEditor.cjs +132 -1
  295. package/dist/rich-text-editor/RichTextEditor.js +126 -1
  296. package/dist/rich-text-editor/index.cjs +2 -1
  297. package/dist/rich-text-editor/index.js +1 -1
  298. package/dist/rich-text-editor/predefined-toolbar-options.cjs +84 -1
  299. package/dist/rich-text-editor/predefined-toolbar-options.js +81 -1
  300. package/dist/spinner/index.cjs +2 -1
  301. package/dist/spinner/index.js +1 -1
  302. package/dist/spinner/spinner.cjs +73 -6
  303. package/dist/spinner/spinner.js +70 -6
  304. package/dist/spinner/styles.cjs +25 -12
  305. package/dist/spinner/styles.js +23 -12
  306. package/dist/tags-input.cjs +226 -1
  307. package/dist/tags-input.js +222 -1
  308. package/dist/theme-provider/ThemeProvider.cjs +27 -1
  309. package/dist/theme-provider/ThemeProvider.js +23 -1
  310. package/dist/theme-provider/index.cjs +4 -1
  311. package/dist/theme-provider/index.js +4 -1
  312. package/dist/toast/AlertToast.cjs +36 -1
  313. package/dist/toast/AlertToast.js +31 -1
  314. package/dist/toast/index.cjs +2 -1
  315. package/dist/toast/index.js +1 -1
  316. package/dist/toast/toast.cjs +75 -1
  317. package/dist/toast/toast.js +66 -1
  318. package/package.json +3 -3
  319. package/dist/packages/shadcn/src/lib/index.cjs +0 -1
  320. package/dist/packages/shadcn/src/lib/index.js +0 -1
@@ -1 +1,126 @@
1
- import{predefinedToolbarOptions as e}from"./predefined-toolbar-options.js";import{Button as t,Tooltip as n,TooltipContent as r,TooltipTrigger as i,cn as a}from"@pixpilot/shadcn";import o from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import{EditorContent as l,useEditor as u}from"@tiptap/react";import d from"@tiptap/starter-kit";const f=({onClick:e,isActive:a,disabled:o,children:l,tooltip:u})=>c(n,{children:[s(i,{asChild:!0,children:s(t,{type:`button`,variant:a?`default`:`ghost`,size:`sm`,onMouseDown:e=>{e.preventDefault()},onClick:e,disabled:o,className:`h-8 w-8 p-0`,children:l})}),s(r,{children:s(`p`,{children:u})})]}),p=[],m=[`bold`,`italic`,`underline`,`strike`,`code`,`|`,`heading1`,`heading2`,`heading3`,`|`,`bulletList`,`orderedList`,`|`,`blockquote`,`codeBlock`],h=({content:t,onChange:n,extensions:r=p,editable:i=!0,className:h,contentClassName:g,showToolbar:_=!0,toolbarOptions:v=m,editorProps:y})=>{let[,b]=o.useReducer(e=>e+1,0),x={attributes:{class:a(`min-h-[200px] p-4 text-sm leading-relaxed focus:outline-none`,`[&_h1]:text-3xl [&_h1]:font-bold [&_h1]:leading-tight [&_h1]:my-2`,`[&_h2]:text-2xl [&_h2]:font-bold [&_h2]:leading-tight [&_h2]:my-2`,`[&_h3]:text-xl [&_h3]:font-bold [&_h3]:leading-tight [&_h3]:my-2`,`[&_p]:my-2`,`[&_ul]:list-disc [&_ul]:pl-6 [&_ul]:my-2`,`[&_ol]:list-decimal [&_ol]:pl-6 [&_ol]:my-2`,`[&_blockquote]:border-l-4 [&_blockquote]:border-border [&_blockquote]:pl-4 [&_blockquote]:my-2 [&_blockquote]:italic`,`[&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-[0.875em] [&_code]:font-mono`,`[&_pre]:bg-muted [&_pre]:p-4 [&_pre]:rounded [&_pre]:overflow-x-auto [&_pre]:font-mono`,g)}},S={...x,...y,attributes:{...x.attributes,...y?.attributes,class:a(x.attributes.class,y?.attributes?.class)}},C=u({extensions:[d].concat(r),content:t,editable:i,onUpdate:({editor:e})=>{n?.(e.getHTML())},editorProps:S});if(o.useEffect(()=>{if(C==null)return()=>{};let e=()=>{b()};return C.on(`selectionUpdate`,e),C.on(`transaction`,e),C.on(`focus`,e),C.on(`blur`,e),()=>{C.off(`selectionUpdate`,e),C.off(`transaction`,e),C.off(`focus`,e),C.off(`blur`,e)}},[C]),C==null)return c(`div`,{className:a(`border rounded-md bg-background`,h),children:[_&&s(`div`,{className:`flex flex-wrap items-center gap-1 border-b p-2 h-10`}),s(`div`,{className:`min-h-[200px] p-4 text-sm leading-relaxed`,children:`Loading editor...`})]});let w=e=>{try{e()}catch{}};return c(`div`,{className:a(`border rounded-md bg-background`,h),children:[(()=>{if(!_)return null;let t=C.isFocused;return s(`div`,{className:`flex flex-wrap items-center gap-1 border-b p-2`,children:v.map((n,r)=>{if(n===`|`)return s(`div`,{className:`mx-1 h-6 w-px bg-border`},`separator-${r}`);if(typeof n==`string`){let r=e[n];return r?s(f,{onClick:()=>w(()=>r.onClick(C)),isActive:t&&(r.isActive?.(C)??!1),tooltip:r.tooltip,children:r.icon},n):null}let i=n;return s(f,{onClick:()=>w(()=>i.onClick(C)),isActive:t&&(i.isActive?.(C)??!1),tooltip:i.tooltip,children:i.icon},`custom-${r}-${i.tooltip}`)})})})(),s(l,{editor:C})]})};h.displayName=`RichTextEditor`;export{h as RichTextEditor};
1
+ import { predefinedToolbarOptions } from "./predefined-toolbar-options.js";
2
+ import { Button, Tooltip, TooltipContent, TooltipTrigger, cn } from "@pixpilot/shadcn";
3
+ import React from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { EditorContent, useEditor } from "@tiptap/react";
6
+ import StarterKit from "@tiptap/starter-kit";
7
+
8
+ //#region src/rich-text-editor/RichTextEditor.tsx
9
+ const ToolbarButton = ({ onClick, isActive, disabled, children, tooltip }) => /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
10
+ asChild: true,
11
+ children: /* @__PURE__ */ jsx(Button, {
12
+ type: "button",
13
+ variant: isActive ? "default" : "ghost",
14
+ size: "sm",
15
+ onMouseDown: (event) => {
16
+ event.preventDefault();
17
+ },
18
+ onClick,
19
+ disabled,
20
+ className: "h-8 w-8 p-0",
21
+ children
22
+ })
23
+ }), /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx("p", { children: tooltip }) })] });
24
+ const defaultExtensions = [];
25
+ const defaultToolbarOptions = [
26
+ "bold",
27
+ "italic",
28
+ "underline",
29
+ "strike",
30
+ "code",
31
+ "|",
32
+ "heading1",
33
+ "heading2",
34
+ "heading3",
35
+ "|",
36
+ "bulletList",
37
+ "orderedList",
38
+ "|",
39
+ "blockquote",
40
+ "codeBlock"
41
+ ];
42
+ const RichTextEditor = ({ content, onChange, extensions = defaultExtensions, editable = true, className, contentClassName, showToolbar = true, toolbarOptions = defaultToolbarOptions, editorProps: customEditorProps }) => {
43
+ const [, forceRender] = React.useReducer((x) => x + 1, 0);
44
+ const defaultEditorProps = { attributes: { class: cn("min-h-[200px] p-4 text-sm leading-relaxed focus:outline-none", "[&_h1]:text-3xl [&_h1]:font-bold [&_h1]:leading-tight [&_h1]:my-2", "[&_h2]:text-2xl [&_h2]:font-bold [&_h2]:leading-tight [&_h2]:my-2", "[&_h3]:text-xl [&_h3]:font-bold [&_h3]:leading-tight [&_h3]:my-2", "[&_p]:my-2", "[&_ul]:list-disc [&_ul]:pl-6 [&_ul]:my-2", "[&_ol]:list-decimal [&_ol]:pl-6 [&_ol]:my-2", "[&_blockquote]:border-l-4 [&_blockquote]:border-border [&_blockquote]:pl-4 [&_blockquote]:my-2 [&_blockquote]:italic", "[&_code]:bg-muted [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded [&_code]:text-[0.875em] [&_code]:font-mono", "[&_pre]:bg-muted [&_pre]:p-4 [&_pre]:rounded [&_pre]:overflow-x-auto [&_pre]:font-mono", contentClassName) } };
45
+ const mergedEditorProps = {
46
+ ...defaultEditorProps,
47
+ ...customEditorProps,
48
+ attributes: {
49
+ ...defaultEditorProps.attributes,
50
+ ...customEditorProps?.attributes,
51
+ class: cn(defaultEditorProps.attributes.class, (customEditorProps?.attributes)?.class)
52
+ }
53
+ };
54
+ const editorInstance = useEditor({
55
+ extensions: [StarterKit].concat(extensions),
56
+ content,
57
+ editable,
58
+ onUpdate: ({ editor: updatedEditor }) => {
59
+ onChange?.(updatedEditor.getHTML());
60
+ },
61
+ editorProps: mergedEditorProps
62
+ });
63
+ React.useEffect(() => {
64
+ if (editorInstance == null) return () => {};
65
+ const rerender = () => {
66
+ forceRender();
67
+ };
68
+ editorInstance.on("selectionUpdate", rerender);
69
+ editorInstance.on("transaction", rerender);
70
+ editorInstance.on("focus", rerender);
71
+ editorInstance.on("blur", rerender);
72
+ return () => {
73
+ editorInstance.off("selectionUpdate", rerender);
74
+ editorInstance.off("transaction", rerender);
75
+ editorInstance.off("focus", rerender);
76
+ editorInstance.off("blur", rerender);
77
+ };
78
+ }, [editorInstance]);
79
+ if (editorInstance == null) return /* @__PURE__ */ jsxs("div", {
80
+ className: cn("border rounded-md bg-background", className),
81
+ children: [showToolbar && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-1 border-b p-2 h-10" }), /* @__PURE__ */ jsx("div", {
82
+ className: "min-h-[200px] p-4 text-sm leading-relaxed",
83
+ children: "Loading editor..."
84
+ })]
85
+ });
86
+ const handleCommand = (commandFn) => {
87
+ try {
88
+ commandFn();
89
+ } catch {}
90
+ };
91
+ const renderToolbar = () => {
92
+ if (!showToolbar) return null;
93
+ const isEditorFocused = editorInstance.isFocused;
94
+ return /* @__PURE__ */ jsx("div", {
95
+ className: "flex flex-wrap items-center gap-1 border-b p-2",
96
+ children: toolbarOptions.map((option, index) => {
97
+ if (option === "|") return /* @__PURE__ */ jsx("div", { className: "mx-1 h-6 w-px bg-border" }, `separator-${index}`);
98
+ if (typeof option === "string") {
99
+ const predefinedOption = predefinedToolbarOptions[option];
100
+ if (!predefinedOption) return null;
101
+ return /* @__PURE__ */ jsx(ToolbarButton, {
102
+ onClick: () => handleCommand(() => predefinedOption.onClick(editorInstance)),
103
+ isActive: isEditorFocused && (predefinedOption.isActive?.(editorInstance) ?? false),
104
+ tooltip: predefinedOption.tooltip,
105
+ children: predefinedOption.icon
106
+ }, option);
107
+ }
108
+ const customOption = option;
109
+ return /* @__PURE__ */ jsx(ToolbarButton, {
110
+ onClick: () => handleCommand(() => customOption.onClick(editorInstance)),
111
+ isActive: isEditorFocused && (customOption.isActive?.(editorInstance) ?? false),
112
+ tooltip: customOption.tooltip,
113
+ children: customOption.icon
114
+ }, `custom-${index}-${customOption.tooltip}`);
115
+ })
116
+ });
117
+ };
118
+ return /* @__PURE__ */ jsxs("div", {
119
+ className: cn("border rounded-md bg-background", className),
120
+ children: [renderToolbar(), /* @__PURE__ */ jsx(EditorContent, { editor: editorInstance })]
121
+ });
122
+ };
123
+ RichTextEditor.displayName = "RichTextEditor";
124
+
125
+ //#endregion
126
+ export { RichTextEditor };
@@ -1 +1,2 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`./RichTextEditor.cjs`);
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_RichTextEditor = require('./RichTextEditor.cjs');
@@ -1 +1 @@
1
- import{RichTextEditor as e}from"./RichTextEditor.js";
1
+ import { RichTextEditor } from "./RichTextEditor.js";
@@ -1 +1,84 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`lucide-react`);t=e.__toESM(t);let n=require(`react/jsx-runtime`);n=e.__toESM(n);const r={bold:{icon:(0,n.jsx)(t.Bold,{className:`h-4 w-4`}),tooltip:`Bold`,onClick:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`bold`)},italic:{icon:(0,n.jsx)(t.Italic,{className:`h-4 w-4`}),tooltip:`Italic`,onClick:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`italic`)},underline:{icon:(0,n.jsx)(t.Underline,{className:`h-4 w-4`}),tooltip:`Underline`,onClick:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`)},strike:{icon:(0,n.jsx)(t.Strikethrough,{className:`h-4 w-4`}),tooltip:`Strikethrough`,onClick:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`)},code:{icon:(0,n.jsx)(t.Code,{className:`h-4 w-4`}),tooltip:`Inline Code`,onClick:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`)},heading1:{icon:(0,n.jsx)(t.Heading1,{className:`h-4 w-4`}),tooltip:`Heading 1`,onClick:e=>e.chain().focus().toggleHeading({level:1}).run(),isActive:e=>e.isActive(`heading`,{level:1})},heading2:{icon:(0,n.jsx)(t.Heading2,{className:`h-4 w-4`}),tooltip:`Heading 2`,onClick:e=>e.chain().focus().toggleHeading({level:2}).run(),isActive:e=>e.isActive(`heading`,{level:2})},heading3:{icon:(0,n.jsx)(t.Heading3,{className:`h-4 w-4`}),tooltip:`Heading 3`,onClick:e=>e.chain().focus().toggleHeading({level:3}).run(),isActive:e=>e.isActive(`heading`,{level:3})},bulletList:{icon:(0,n.jsx)(t.List,{className:`h-4 w-4`}),tooltip:`Bullet List`,onClick:e=>e.chain().focus().toggleBulletList().run(),isActive:e=>e.isActive(`bulletList`)},orderedList:{icon:(0,n.jsx)(t.ListOrdered,{className:`h-4 w-4`}),tooltip:`Ordered List`,onClick:e=>e.chain().focus().toggleOrderedList().run(),isActive:e=>e.isActive(`orderedList`)},blockquote:{icon:(0,n.jsx)(t.Quote,{className:`h-4 w-4`}),tooltip:`Blockquote`,onClick:e=>e.chain().focus().toggleBlockquote().run(),isActive:e=>e.isActive(`blockquote`)},codeBlock:{icon:(0,n.jsx)(t.Code2,{className:`h-4 w-4`}),tooltip:`Code Block`,onClick:e=>e.chain().focus().toggleCodeBlock().run(),isActive:e=>e.isActive(`codeBlock`)}};exports.predefinedToolbarOptions=r;
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let lucide_react = require("lucide-react");
3
+ lucide_react = require_rolldown_runtime.__toESM(lucide_react);
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
6
+
7
+ //#region src/rich-text-editor/predefined-toolbar-options.tsx
8
+ const predefinedToolbarOptions = {
9
+ bold: {
10
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Bold, { className: "h-4 w-4" }),
11
+ tooltip: "Bold",
12
+ onClick: (editor) => editor.chain().focus().toggleBold().run(),
13
+ isActive: (editor) => editor.isActive("bold")
14
+ },
15
+ italic: {
16
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Italic, { className: "h-4 w-4" }),
17
+ tooltip: "Italic",
18
+ onClick: (editor) => editor.chain().focus().toggleItalic().run(),
19
+ isActive: (editor) => editor.isActive("italic")
20
+ },
21
+ underline: {
22
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Underline, { className: "h-4 w-4" }),
23
+ tooltip: "Underline",
24
+ onClick: (editor) => editor.chain().focus().toggleUnderline().run(),
25
+ isActive: (editor) => editor.isActive("underline")
26
+ },
27
+ strike: {
28
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Strikethrough, { className: "h-4 w-4" }),
29
+ tooltip: "Strikethrough",
30
+ onClick: (editor) => editor.chain().focus().toggleStrike().run(),
31
+ isActive: (editor) => editor.isActive("strike")
32
+ },
33
+ code: {
34
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Code, { className: "h-4 w-4" }),
35
+ tooltip: "Inline Code",
36
+ onClick: (editor) => editor.chain().focus().toggleCode().run(),
37
+ isActive: (editor) => editor.isActive("code")
38
+ },
39
+ heading1: {
40
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Heading1, { className: "h-4 w-4" }),
41
+ tooltip: "Heading 1",
42
+ onClick: (editor) => editor.chain().focus().toggleHeading({ level: 1 }).run(),
43
+ isActive: (editor) => editor.isActive("heading", { level: 1 })
44
+ },
45
+ heading2: {
46
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Heading2, { className: "h-4 w-4" }),
47
+ tooltip: "Heading 2",
48
+ onClick: (editor) => editor.chain().focus().toggleHeading({ level: 2 }).run(),
49
+ isActive: (editor) => editor.isActive("heading", { level: 2 })
50
+ },
51
+ heading3: {
52
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Heading3, { className: "h-4 w-4" }),
53
+ tooltip: "Heading 3",
54
+ onClick: (editor) => editor.chain().focus().toggleHeading({ level: 3 }).run(),
55
+ isActive: (editor) => editor.isActive("heading", { level: 3 })
56
+ },
57
+ bulletList: {
58
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.List, { className: "h-4 w-4" }),
59
+ tooltip: "Bullet List",
60
+ onClick: (editor) => editor.chain().focus().toggleBulletList().run(),
61
+ isActive: (editor) => editor.isActive("bulletList")
62
+ },
63
+ orderedList: {
64
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ListOrdered, { className: "h-4 w-4" }),
65
+ tooltip: "Ordered List",
66
+ onClick: (editor) => editor.chain().focus().toggleOrderedList().run(),
67
+ isActive: (editor) => editor.isActive("orderedList")
68
+ },
69
+ blockquote: {
70
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Quote, { className: "h-4 w-4" }),
71
+ tooltip: "Blockquote",
72
+ onClick: (editor) => editor.chain().focus().toggleBlockquote().run(),
73
+ isActive: (editor) => editor.isActive("blockquote")
74
+ },
75
+ codeBlock: {
76
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Code2, { className: "h-4 w-4" }),
77
+ tooltip: "Code Block",
78
+ onClick: (editor) => editor.chain().focus().toggleCodeBlock().run(),
79
+ isActive: (editor) => editor.isActive("codeBlock")
80
+ }
81
+ };
82
+
83
+ //#endregion
84
+ exports.predefinedToolbarOptions = predefinedToolbarOptions;
@@ -1 +1,81 @@
1
- import{Bold as e,Code as t,Code2 as n,Heading1 as r,Heading2 as i,Heading3 as a,Italic as o,List as s,ListOrdered as c,Quote as l,Strikethrough as u,Underline as d}from"lucide-react";import{jsx as f}from"react/jsx-runtime";const p={bold:{icon:f(e,{className:`h-4 w-4`}),tooltip:`Bold`,onClick:e=>e.chain().focus().toggleBold().run(),isActive:e=>e.isActive(`bold`)},italic:{icon:f(o,{className:`h-4 w-4`}),tooltip:`Italic`,onClick:e=>e.chain().focus().toggleItalic().run(),isActive:e=>e.isActive(`italic`)},underline:{icon:f(d,{className:`h-4 w-4`}),tooltip:`Underline`,onClick:e=>e.chain().focus().toggleUnderline().run(),isActive:e=>e.isActive(`underline`)},strike:{icon:f(u,{className:`h-4 w-4`}),tooltip:`Strikethrough`,onClick:e=>e.chain().focus().toggleStrike().run(),isActive:e=>e.isActive(`strike`)},code:{icon:f(t,{className:`h-4 w-4`}),tooltip:`Inline Code`,onClick:e=>e.chain().focus().toggleCode().run(),isActive:e=>e.isActive(`code`)},heading1:{icon:f(r,{className:`h-4 w-4`}),tooltip:`Heading 1`,onClick:e=>e.chain().focus().toggleHeading({level:1}).run(),isActive:e=>e.isActive(`heading`,{level:1})},heading2:{icon:f(i,{className:`h-4 w-4`}),tooltip:`Heading 2`,onClick:e=>e.chain().focus().toggleHeading({level:2}).run(),isActive:e=>e.isActive(`heading`,{level:2})},heading3:{icon:f(a,{className:`h-4 w-4`}),tooltip:`Heading 3`,onClick:e=>e.chain().focus().toggleHeading({level:3}).run(),isActive:e=>e.isActive(`heading`,{level:3})},bulletList:{icon:f(s,{className:`h-4 w-4`}),tooltip:`Bullet List`,onClick:e=>e.chain().focus().toggleBulletList().run(),isActive:e=>e.isActive(`bulletList`)},orderedList:{icon:f(c,{className:`h-4 w-4`}),tooltip:`Ordered List`,onClick:e=>e.chain().focus().toggleOrderedList().run(),isActive:e=>e.isActive(`orderedList`)},blockquote:{icon:f(l,{className:`h-4 w-4`}),tooltip:`Blockquote`,onClick:e=>e.chain().focus().toggleBlockquote().run(),isActive:e=>e.isActive(`blockquote`)},codeBlock:{icon:f(n,{className:`h-4 w-4`}),tooltip:`Code Block`,onClick:e=>e.chain().focus().toggleCodeBlock().run(),isActive:e=>e.isActive(`codeBlock`)}};export{p as predefinedToolbarOptions};
1
+ import { Bold, Code, Code2, Heading1, Heading2, Heading3, Italic, List, ListOrdered, Quote, Strikethrough, Underline } from "lucide-react";
2
+ import { jsx } from "react/jsx-runtime";
3
+
4
+ //#region src/rich-text-editor/predefined-toolbar-options.tsx
5
+ const predefinedToolbarOptions = {
6
+ bold: {
7
+ icon: /* @__PURE__ */ jsx(Bold, { className: "h-4 w-4" }),
8
+ tooltip: "Bold",
9
+ onClick: (editor) => editor.chain().focus().toggleBold().run(),
10
+ isActive: (editor) => editor.isActive("bold")
11
+ },
12
+ italic: {
13
+ icon: /* @__PURE__ */ jsx(Italic, { className: "h-4 w-4" }),
14
+ tooltip: "Italic",
15
+ onClick: (editor) => editor.chain().focus().toggleItalic().run(),
16
+ isActive: (editor) => editor.isActive("italic")
17
+ },
18
+ underline: {
19
+ icon: /* @__PURE__ */ jsx(Underline, { className: "h-4 w-4" }),
20
+ tooltip: "Underline",
21
+ onClick: (editor) => editor.chain().focus().toggleUnderline().run(),
22
+ isActive: (editor) => editor.isActive("underline")
23
+ },
24
+ strike: {
25
+ icon: /* @__PURE__ */ jsx(Strikethrough, { className: "h-4 w-4" }),
26
+ tooltip: "Strikethrough",
27
+ onClick: (editor) => editor.chain().focus().toggleStrike().run(),
28
+ isActive: (editor) => editor.isActive("strike")
29
+ },
30
+ code: {
31
+ icon: /* @__PURE__ */ jsx(Code, { className: "h-4 w-4" }),
32
+ tooltip: "Inline Code",
33
+ onClick: (editor) => editor.chain().focus().toggleCode().run(),
34
+ isActive: (editor) => editor.isActive("code")
35
+ },
36
+ heading1: {
37
+ icon: /* @__PURE__ */ jsx(Heading1, { className: "h-4 w-4" }),
38
+ tooltip: "Heading 1",
39
+ onClick: (editor) => editor.chain().focus().toggleHeading({ level: 1 }).run(),
40
+ isActive: (editor) => editor.isActive("heading", { level: 1 })
41
+ },
42
+ heading2: {
43
+ icon: /* @__PURE__ */ jsx(Heading2, { className: "h-4 w-4" }),
44
+ tooltip: "Heading 2",
45
+ onClick: (editor) => editor.chain().focus().toggleHeading({ level: 2 }).run(),
46
+ isActive: (editor) => editor.isActive("heading", { level: 2 })
47
+ },
48
+ heading3: {
49
+ icon: /* @__PURE__ */ jsx(Heading3, { className: "h-4 w-4" }),
50
+ tooltip: "Heading 3",
51
+ onClick: (editor) => editor.chain().focus().toggleHeading({ level: 3 }).run(),
52
+ isActive: (editor) => editor.isActive("heading", { level: 3 })
53
+ },
54
+ bulletList: {
55
+ icon: /* @__PURE__ */ jsx(List, { className: "h-4 w-4" }),
56
+ tooltip: "Bullet List",
57
+ onClick: (editor) => editor.chain().focus().toggleBulletList().run(),
58
+ isActive: (editor) => editor.isActive("bulletList")
59
+ },
60
+ orderedList: {
61
+ icon: /* @__PURE__ */ jsx(ListOrdered, { className: "h-4 w-4" }),
62
+ tooltip: "Ordered List",
63
+ onClick: (editor) => editor.chain().focus().toggleOrderedList().run(),
64
+ isActive: (editor) => editor.isActive("orderedList")
65
+ },
66
+ blockquote: {
67
+ icon: /* @__PURE__ */ jsx(Quote, { className: "h-4 w-4" }),
68
+ tooltip: "Blockquote",
69
+ onClick: (editor) => editor.chain().focus().toggleBlockquote().run(),
70
+ isActive: (editor) => editor.isActive("blockquote")
71
+ },
72
+ codeBlock: {
73
+ icon: /* @__PURE__ */ jsx(Code2, { className: "h-4 w-4" }),
74
+ tooltip: "Code Block",
75
+ onClick: (editor) => editor.chain().focus().toggleCodeBlock().run(),
76
+ isActive: (editor) => editor.isActive("codeBlock")
77
+ }
78
+ };
79
+
80
+ //#endregion
81
+ export { predefinedToolbarOptions };
@@ -1 +1,2 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`./spinner.cjs`);
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_spinner = require('./spinner.cjs');
@@ -1 +1 @@
1
- import{Spinner as e}from"./spinner.js";
1
+ import { Spinner } from "./spinner.js";
@@ -1,7 +1,74 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`./styles.cjs`);let n=require(`react`);n=e.__toESM(n);let r=require(`react/jsx-runtime`);r=e.__toESM(r);const i={sm:24,md:40,lg:64,xl:96},a=40,o=2,s=.1,c=2,l=`currentColor`,u=40,d=100;let f=0;const p=({size:e=40,strokeWidth:a,speed:o=2,color:s=`currentColor`,colors:c,className:l=``})=>{let u=typeof e==`string`?i[e]:e,d=a??Math.max(2,Math.round(u*.1)),p=(0,n.useMemo)(()=>`spinner-${++f}-${Date.now()}`,[]),m=d/u*40,h=()=>!c||c.length===0?``:`${p}-color-change`;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(`style`,{children:[t.getGlobalStyles({uniqueId:p,speed:o,size:u,colors:c,color:s,strokeWidth:d}),c&&c.length>0&&(()=>{if(!c||c.length===0)return``;let e=c.map((e,t)=>`${t/c.length*100}% { stroke: ${e}; }`).join(`
2
- `);return`
3
- @keyframes ${h()} {
4
- ${e}
5
- 100% { stroke: ${c[0]}; }
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_styles = require('./styles.cjs');
3
+ let react = require("react");
4
+ react = require_rolldown_runtime.__toESM(react);
5
+ let react_jsx_runtime = require("react/jsx-runtime");
6
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
7
+
8
+ //#region src/spinner/spinner.tsx
9
+ const SpinnerSize = {
10
+ sm: 24,
11
+ md: 40,
12
+ lg: 64,
13
+ xl: 96
14
+ };
15
+ const DEFAULT_SIZE = 40;
16
+ const MIN_STROKE_WIDTH = 2;
17
+ const STROKE_WIDTH_RATIO = .1;
18
+ const DEFAULT_SPEED = 2;
19
+ const DEFAULT_COLOR = "currentColor";
20
+ const VIEWBOX_STROKE_REF = 40;
21
+ const PERCENT_MULTIPLIER = 100;
22
+ let spinnerIdCounter = 0;
23
+ const Spinner = ({ size: sizeProp = DEFAULT_SIZE, strokeWidth: strokeWidthProp, speed = DEFAULT_SPEED, color = DEFAULT_COLOR, colors, className = "" }) => {
24
+ const size = typeof sizeProp === "string" ? SpinnerSize[sizeProp] : sizeProp;
25
+ const strokeWidth = strokeWidthProp ?? Math.max(MIN_STROKE_WIDTH, Math.round(size * STROKE_WIDTH_RATIO));
26
+ const uniqueId = (0, react.useMemo)(() => `spinner-${++spinnerIdCounter}-${Date.now()}`, []);
27
+ const viewBoxStrokeWidth = strokeWidth / size * VIEWBOX_STROKE_REF;
28
+ const CIRCLE_RADIUS = 20;
29
+ const getColorAnimationId = () => {
30
+ if (!colors || colors.length === 0) return "";
31
+ return `${uniqueId}-color-change`;
32
+ };
33
+ const getColorAnimationKeyframes = () => {
34
+ if (!colors || colors.length === 0) return "";
35
+ const keyframes = colors.map((c, i) => {
36
+ return `${i / colors.length * PERCENT_MULTIPLIER}% { stroke: ${c}; }`;
37
+ }).join("\n");
38
+ return `
39
+ @keyframes ${getColorAnimationId()} {
40
+ ${keyframes}
41
+ 100% { stroke: ${colors[0]}; }
6
42
  }
7
- `})()]}),(0,r.jsx)(`div`,{className:`${p}-loader ${l}`,children:(0,r.jsx)(`svg`,{className:`${p}-circular`,viewBox:`25 25 50 50`,width:`100%`,height:`100%`,children:(0,r.jsx)(`circle`,{className:`${p}-path`,cx:50,cy:50,r:20,fill:`none`,strokeWidth:m,strokeMiterlimit:`10`})})})]})};p.displayName=`Spinner`,exports.Spinner=p;
43
+ `;
44
+ };
45
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("style", { children: [require_styles.getGlobalStyles({
46
+ uniqueId,
47
+ speed,
48
+ size,
49
+ colors,
50
+ color,
51
+ strokeWidth
52
+ }), colors && colors.length > 0 && getColorAnimationKeyframes()] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
53
+ className: `${uniqueId}-loader ${className}`,
54
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
55
+ className: `${uniqueId}-circular`,
56
+ viewBox: "25 25 50 50",
57
+ width: "100%",
58
+ height: "100%",
59
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
60
+ className: `${uniqueId}-path`,
61
+ cx: 50,
62
+ cy: 50,
63
+ r: CIRCLE_RADIUS,
64
+ fill: "none",
65
+ strokeWidth: viewBoxStrokeWidth,
66
+ strokeMiterlimit: "10"
67
+ })
68
+ })
69
+ })] });
70
+ };
71
+ Spinner.displayName = "Spinner";
72
+
73
+ //#endregion
74
+ exports.Spinner = Spinner;
@@ -1,7 +1,71 @@
1
- import{getGlobalStyles as e}from"./styles.js";import t,{useMemo as n}from"react";import{Fragment as r,jsx as i,jsxs as a}from"react/jsx-runtime";const o={sm:24,md:40,lg:64,xl:96};let s=0;const c=({size:t=40,strokeWidth:c,speed:l=2,color:u=`currentColor`,colors:d,className:f=``})=>{let p=typeof t==`string`?o[t]:t,m=c??Math.max(2,Math.round(p*.1)),h=n(()=>`spinner-${++s}-${Date.now()}`,[]),g=m/p*40,_=()=>!d||d.length===0?``:`${h}-color-change`;return a(r,{children:[a(`style`,{children:[e({uniqueId:h,speed:l,size:p,colors:d,color:u,strokeWidth:m}),d&&d.length>0&&(()=>{if(!d||d.length===0)return``;let e=d.map((e,t)=>`${t/d.length*100}% { stroke: ${e}; }`).join(`
2
- `);return`
3
- @keyframes ${_()} {
4
- ${e}
5
- 100% { stroke: ${d[0]}; }
1
+ import { getGlobalStyles } from "./styles.js";
2
+ import React, { useMemo } from "react";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+
5
+ //#region src/spinner/spinner.tsx
6
+ const SpinnerSize = {
7
+ sm: 24,
8
+ md: 40,
9
+ lg: 64,
10
+ xl: 96
11
+ };
12
+ const DEFAULT_SIZE = 40;
13
+ const MIN_STROKE_WIDTH = 2;
14
+ const STROKE_WIDTH_RATIO = .1;
15
+ const DEFAULT_SPEED = 2;
16
+ const DEFAULT_COLOR = "currentColor";
17
+ const VIEWBOX_STROKE_REF = 40;
18
+ const PERCENT_MULTIPLIER = 100;
19
+ let spinnerIdCounter = 0;
20
+ const Spinner = ({ size: sizeProp = DEFAULT_SIZE, strokeWidth: strokeWidthProp, speed = DEFAULT_SPEED, color = DEFAULT_COLOR, colors, className = "" }) => {
21
+ const size = typeof sizeProp === "string" ? SpinnerSize[sizeProp] : sizeProp;
22
+ const strokeWidth = strokeWidthProp ?? Math.max(MIN_STROKE_WIDTH, Math.round(size * STROKE_WIDTH_RATIO));
23
+ const uniqueId = useMemo(() => `spinner-${++spinnerIdCounter}-${Date.now()}`, []);
24
+ const viewBoxStrokeWidth = strokeWidth / size * VIEWBOX_STROKE_REF;
25
+ const CIRCLE_RADIUS = 20;
26
+ const getColorAnimationId = () => {
27
+ if (!colors || colors.length === 0) return "";
28
+ return `${uniqueId}-color-change`;
29
+ };
30
+ const getColorAnimationKeyframes = () => {
31
+ if (!colors || colors.length === 0) return "";
32
+ const keyframes = colors.map((c, i) => {
33
+ return `${i / colors.length * PERCENT_MULTIPLIER}% { stroke: ${c}; }`;
34
+ }).join("\n");
35
+ return `
36
+ @keyframes ${getColorAnimationId()} {
37
+ ${keyframes}
38
+ 100% { stroke: ${colors[0]}; }
6
39
  }
7
- `})()]}),i(`div`,{className:`${h}-loader ${f}`,children:i(`svg`,{className:`${h}-circular`,viewBox:`25 25 50 50`,width:`100%`,height:`100%`,children:i(`circle`,{className:`${h}-path`,cx:50,cy:50,r:20,fill:`none`,strokeWidth:g,strokeMiterlimit:`10`})})})]})};c.displayName=`Spinner`;export{c as Spinner};
40
+ `;
41
+ };
42
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("style", { children: [getGlobalStyles({
43
+ uniqueId,
44
+ speed,
45
+ size,
46
+ colors,
47
+ color,
48
+ strokeWidth
49
+ }), colors && colors.length > 0 && getColorAnimationKeyframes()] }), /* @__PURE__ */ jsx("div", {
50
+ className: `${uniqueId}-loader ${className}`,
51
+ children: /* @__PURE__ */ jsx("svg", {
52
+ className: `${uniqueId}-circular`,
53
+ viewBox: "25 25 50 50",
54
+ width: "100%",
55
+ height: "100%",
56
+ children: /* @__PURE__ */ jsx("circle", {
57
+ className: `${uniqueId}-path`,
58
+ cx: 50,
59
+ cy: 50,
60
+ r: CIRCLE_RADIUS,
61
+ fill: "none",
62
+ strokeWidth: viewBoxStrokeWidth,
63
+ strokeMiterlimit: "10"
64
+ })
65
+ })
66
+ })] });
67
+ };
68
+ Spinner.displayName = "Spinner";
69
+
70
+ //#endregion
71
+ export { Spinner };
@@ -1,11 +1,20 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`);function t(e){let{uniqueId:t,speed:n=2,size:r,colors:i,color:a}=e;return`
2
- @keyframes ${t}-rotate {
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+
3
+ //#region src/spinner/styles.ts
4
+ function getGlobalStyles(options) {
5
+ const { uniqueId, speed = 2, size, colors, color } = options;
6
+ const getColorAnimationId = () => {
7
+ if (!colors || colors.length === 0) return "";
8
+ return `${uniqueId}-color-change`;
9
+ };
10
+ return `
11
+ @keyframes ${uniqueId}-rotate {
3
12
  100% {
4
13
  transform: rotate(360deg);
5
14
  }
6
15
  }
7
16
 
8
- @keyframes ${t}-dash {
17
+ @keyframes ${uniqueId}-dash {
9
18
  0% {
10
19
  stroke-dasharray: 1, 200;
11
20
  stroke-dashoffset: 0;
@@ -20,27 +29,31 @@ const e=require(`../_virtual/rolldown_runtime.cjs`);function t(e){let{uniqueId:t
20
29
  }
21
30
  }
22
31
 
23
- .${t}-loader {
32
+ .${uniqueId}-loader {
24
33
  position: relative;
25
34
  display: inline-block;
26
- width: ${r}px;
27
- height: ${r}px;
35
+ width: ${size}px;
36
+ height: ${size}px;
28
37
  overflow: hidden;
29
38
  }
30
39
 
31
- .${t}-circular {
32
- animation: ${t}-rotate ${n}s linear infinite;
40
+ .${uniqueId}-circular {
41
+ animation: ${uniqueId}-rotate ${speed}s linear infinite;
33
42
  height: 100%;
34
43
  width: 100%;
35
44
  max-height: 100%;
36
45
  max-width: 100%;
37
46
  }
38
47
 
39
- .${t}-path {
40
- stroke: ${i&&i.length>0?i[0]:a};
48
+ .${uniqueId}-path {
49
+ stroke: ${colors && colors.length > 0 ? colors[0] : color};
41
50
  stroke-dasharray: 1, 200;
42
51
  stroke-dashoffset: 0;
43
- animation: ${i&&i.length>0?`${t}-dash 1.5s ease-in-out infinite, ${(()=>!i||i.length===0?``:`${t}-color-change`)()} ${n*i.length}s ease-in-out infinite`:`${t}-dash 1.5s ease-in-out infinite`};
52
+ animation: ${colors && colors.length > 0 ? `${uniqueId}-dash 1.5s ease-in-out infinite, ${getColorAnimationId()} ${speed * colors.length}s ease-in-out infinite` : `${uniqueId}-dash 1.5s ease-in-out infinite`};
44
53
  stroke-linecap: round;
45
54
  }
46
- `}exports.getGlobalStyles=t;
55
+ `;
56
+ }
57
+
58
+ //#endregion
59
+ exports.getGlobalStyles = getGlobalStyles;
@@ -1,11 +1,18 @@
1
- function e(e){let{uniqueId:t,speed:n=2,size:r,colors:i,color:a}=e;return`
2
- @keyframes ${t}-rotate {
1
+ //#region src/spinner/styles.ts
2
+ function getGlobalStyles(options) {
3
+ const { uniqueId, speed = 2, size, colors, color } = options;
4
+ const getColorAnimationId = () => {
5
+ if (!colors || colors.length === 0) return "";
6
+ return `${uniqueId}-color-change`;
7
+ };
8
+ return `
9
+ @keyframes ${uniqueId}-rotate {
3
10
  100% {
4
11
  transform: rotate(360deg);
5
12
  }
6
13
  }
7
14
 
8
- @keyframes ${t}-dash {
15
+ @keyframes ${uniqueId}-dash {
9
16
  0% {
10
17
  stroke-dasharray: 1, 200;
11
18
  stroke-dashoffset: 0;
@@ -20,27 +27,31 @@ function e(e){let{uniqueId:t,speed:n=2,size:r,colors:i,color:a}=e;return`
20
27
  }
21
28
  }
22
29
 
23
- .${t}-loader {
30
+ .${uniqueId}-loader {
24
31
  position: relative;
25
32
  display: inline-block;
26
- width: ${r}px;
27
- height: ${r}px;
33
+ width: ${size}px;
34
+ height: ${size}px;
28
35
  overflow: hidden;
29
36
  }
30
37
 
31
- .${t}-circular {
32
- animation: ${t}-rotate ${n}s linear infinite;
38
+ .${uniqueId}-circular {
39
+ animation: ${uniqueId}-rotate ${speed}s linear infinite;
33
40
  height: 100%;
34
41
  width: 100%;
35
42
  max-height: 100%;
36
43
  max-width: 100%;
37
44
  }
38
45
 
39
- .${t}-path {
40
- stroke: ${i&&i.length>0?i[0]:a};
46
+ .${uniqueId}-path {
47
+ stroke: ${colors && colors.length > 0 ? colors[0] : color};
41
48
  stroke-dasharray: 1, 200;
42
49
  stroke-dashoffset: 0;
43
- animation: ${i&&i.length>0?`${t}-dash 1.5s ease-in-out infinite, ${(()=>!i||i.length===0?``:`${t}-color-change`)()} ${n*i.length}s ease-in-out infinite`:`${t}-dash 1.5s ease-in-out infinite`};
50
+ animation: ${colors && colors.length > 0 ? `${uniqueId}-dash 1.5s ease-in-out infinite, ${getColorAnimationId()} ${speed * colors.length}s ease-in-out infinite` : `${uniqueId}-dash 1.5s ease-in-out infinite`};
44
51
  stroke-linecap: round;
45
52
  }
46
- `}export{e as getGlobalStyles};
53
+ `;
54
+ }
55
+
56
+ //#endregion
57
+ export { getGlobalStyles };