@sth87/shadcn-design-system 0.0.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.
- package/README.md +487 -0
- package/dist/cjs/_virtual/_commonjsHelpers.cjs +2 -0
- package/dist/cjs/_virtual/_commonjsHelpers.cjs.map +1 -0
- package/dist/cjs/_virtual/index.cjs +2 -0
- package/dist/cjs/_virtual/index.cjs.map +1 -0
- package/dist/cjs/_virtual/index2.cjs +2 -0
- package/dist/cjs/_virtual/index2.cjs.map +1 -0
- package/dist/cjs/components/Accordion/Accordion.cjs +2 -0
- package/dist/cjs/components/Accordion/Accordion.cjs.map +1 -0
- package/dist/cjs/components/Avatar/Avatar.cjs +2 -0
- package/dist/cjs/components/Avatar/Avatar.cjs.map +1 -0
- package/dist/cjs/components/Badge/Badge.cjs +2 -0
- package/dist/cjs/components/Badge/Badge.cjs.map +1 -0
- package/dist/cjs/components/Breadcrumb/Breadcrumb.cjs +2 -0
- package/dist/cjs/components/Breadcrumb/Breadcrumb.cjs.map +1 -0
- package/dist/cjs/components/Button/Button.cjs +2 -0
- package/dist/cjs/components/Button/Button.cjs.map +1 -0
- package/dist/cjs/components/Button/ButtonGroup.cjs +2 -0
- package/dist/cjs/components/Button/ButtonGroup.cjs.map +1 -0
- package/dist/cjs/components/Calendar/Calendar.cjs +2 -0
- package/dist/cjs/components/Calendar/Calendar.cjs.map +1 -0
- package/dist/cjs/components/Carousel/Carousel.cjs +2 -0
- package/dist/cjs/components/Carousel/Carousel.cjs.map +1 -0
- package/dist/cjs/components/Checkbox/Checkbox.cjs +2 -0
- package/dist/cjs/components/Checkbox/Checkbox.cjs.map +1 -0
- package/dist/cjs/components/Collapsible/Collapsible.cjs +2 -0
- package/dist/cjs/components/Collapsible/Collapsible.cjs.map +1 -0
- package/dist/cjs/components/Command/Command.cjs +2 -0
- package/dist/cjs/components/Command/Command.cjs.map +1 -0
- package/dist/cjs/components/Command/index.cjs +2 -0
- package/dist/cjs/components/Command/index.cjs.map +1 -0
- package/dist/cjs/components/ContextMenu/ContextMenu.cjs +2 -0
- package/dist/cjs/components/ContextMenu/ContextMenu.cjs.map +1 -0
- package/dist/cjs/components/ContextMenu/index.cjs +2 -0
- package/dist/cjs/components/ContextMenu/index.cjs.map +1 -0
- package/dist/cjs/components/Cropper/Cropper.cjs +2 -0
- package/dist/cjs/components/Cropper/Cropper.cjs.map +1 -0
- package/dist/cjs/components/Cropper/CropperTool.cjs +2 -0
- package/dist/cjs/components/Cropper/CropperTool.cjs.map +1 -0
- package/dist/cjs/components/Cropper/utils.cjs +2 -0
- package/dist/cjs/components/Cropper/utils.cjs.map +1 -0
- package/dist/cjs/components/DatePicker/DatePicker.cjs +2 -0
- package/dist/cjs/components/DatePicker/DatePicker.cjs.map +1 -0
- package/dist/cjs/components/DatePicker/RangePicker.cjs +2 -0
- package/dist/cjs/components/DatePicker/RangePicker.cjs.map +1 -0
- package/dist/cjs/components/DatePicker/TimePicker.cjs +2 -0
- package/dist/cjs/components/DatePicker/TimePicker.cjs.map +1 -0
- package/dist/cjs/components/Dialog/Dialog.cjs +2 -0
- package/dist/cjs/components/Dialog/Dialog.cjs.map +1 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs +2 -0
- package/dist/cjs/components/DropdownMenu/DropdownMenu.cjs.map +1 -0
- package/dist/cjs/components/DropdownMenu/index.cjs +2 -0
- package/dist/cjs/components/DropdownMenu/index.cjs.map +1 -0
- package/dist/cjs/components/FloatLabel.cjs +2 -0
- package/dist/cjs/components/FloatLabel.cjs.map +1 -0
- package/dist/cjs/components/Glass/Glass.cjs +2 -0
- package/dist/cjs/components/Glass/Glass.cjs.map +1 -0
- package/dist/cjs/components/ImageViewer/ImageViewer.cjs +2 -0
- package/dist/cjs/components/ImageViewer/ImageViewer.cjs.map +1 -0
- package/dist/cjs/components/ImageViewer/ImageViewer.css +1 -0
- package/dist/cjs/components/Input/Input.cjs +2 -0
- package/dist/cjs/components/Input/Input.cjs.map +1 -0
- package/dist/cjs/components/InputOTP/InputOTP.cjs +2 -0
- package/dist/cjs/components/InputOTP/InputOTP.cjs.map +1 -0
- package/dist/cjs/components/Interactive/CursorFollow.cjs +2 -0
- package/dist/cjs/components/Interactive/CursorFollow.cjs.map +1 -0
- package/dist/cjs/components/Marquee/Marquee.cjs +2 -0
- package/dist/cjs/components/Marquee/Marquee.cjs.map +1 -0
- package/dist/cjs/components/Marquee/MarqueeWrapper.cjs +2 -0
- package/dist/cjs/components/Marquee/MarqueeWrapper.cjs.map +1 -0
- package/dist/cjs/components/Marquee/index.cjs +2 -0
- package/dist/cjs/components/Marquee/index.cjs.map +1 -0
- package/dist/cjs/components/Masonry/Masonry.cjs +2 -0
- package/dist/cjs/components/Masonry/Masonry.cjs.map +1 -0
- package/dist/cjs/components/Masonry/MasonryWrapper.cjs +2 -0
- package/dist/cjs/components/Masonry/MasonryWrapper.cjs.map +1 -0
- package/dist/cjs/components/Pagination/Pagination.cjs +2 -0
- package/dist/cjs/components/Pagination/Pagination.cjs.map +1 -0
- package/dist/cjs/components/Pagination/index.cjs +2 -0
- package/dist/cjs/components/Pagination/index.cjs.map +1 -0
- package/dist/cjs/components/Popover/Popover.cjs +2 -0
- package/dist/cjs/components/Popover/Popover.cjs.map +1 -0
- package/dist/cjs/components/Popover/index.cjs +2 -0
- package/dist/cjs/components/Popover/index.cjs.map +1 -0
- package/dist/cjs/components/QrCode/QrCode.cjs +2 -0
- package/dist/cjs/components/QrCode/QrCode.cjs.map +1 -0
- package/dist/cjs/components/QrCode/index.cjs +2 -0
- package/dist/cjs/components/QrCode/index.cjs.map +1 -0
- package/dist/cjs/components/Radio/Radio.cjs +2 -0
- package/dist/cjs/components/Radio/Radio.cjs.map +1 -0
- package/dist/cjs/components/Rate/Rate.cjs +2 -0
- package/dist/cjs/components/Rate/Rate.cjs.map +1 -0
- package/dist/cjs/components/Resizable/Resizable.cjs +2 -0
- package/dist/cjs/components/Resizable/Resizable.cjs.map +1 -0
- package/dist/cjs/components/ScrollArea/ScrollArea.cjs +2 -0
- package/dist/cjs/components/ScrollArea/ScrollArea.cjs.map +1 -0
- package/dist/cjs/components/Select/Select.cjs +2 -0
- package/dist/cjs/components/Select/Select.cjs.map +1 -0
- package/dist/cjs/components/Separator/Separator.cjs +2 -0
- package/dist/cjs/components/Separator/Separator.cjs.map +1 -0
- package/dist/cjs/components/Sheet/Sheet.cjs +6 -0
- package/dist/cjs/components/Sheet/Sheet.cjs.map +1 -0
- package/dist/cjs/components/Sidebar/Sidebar.cjs +2 -0
- package/dist/cjs/components/Sidebar/Sidebar.cjs.map +1 -0
- package/dist/cjs/components/Skeleton/Skeleton.cjs +2 -0
- package/dist/cjs/components/Skeleton/Skeleton.cjs.map +1 -0
- package/dist/cjs/components/Slider/Slider.cjs +2 -0
- package/dist/cjs/components/Slider/Slider.cjs.map +1 -0
- package/dist/cjs/components/Stepper/Stepper.cjs +2 -0
- package/dist/cjs/components/Stepper/Stepper.cjs.map +1 -0
- package/dist/cjs/components/Stepper/StepperWrapper.cjs +2 -0
- package/dist/cjs/components/Stepper/StepperWrapper.cjs.map +1 -0
- package/dist/cjs/components/Stepper/index.cjs +2 -0
- package/dist/cjs/components/Stepper/index.cjs.map +1 -0
- package/dist/cjs/components/Switch/Switch.cjs +2 -0
- package/dist/cjs/components/Switch/Switch.cjs.map +1 -0
- package/dist/cjs/components/Table/TableFilter/data-table-date-filter.cjs +2 -0
- package/dist/cjs/components/Table/TableFilter/data-table-date-filter.cjs.map +1 -0
- package/dist/cjs/components/Table/TableFilter/data-table-filter-popover.cjs +2 -0
- package/dist/cjs/components/Table/TableFilter/data-table-filter-popover.cjs.map +1 -0
- package/dist/cjs/components/Table/TableFilter/data-table-slider-filter.cjs +2 -0
- package/dist/cjs/components/Table/TableFilter/data-table-slider-filter.cjs.map +1 -0
- package/dist/cjs/components/Table/data-table-column-header.cjs +2 -0
- package/dist/cjs/components/Table/data-table-column-header.cjs.map +1 -0
- package/dist/cjs/components/Table/data-table-pagination.cjs +2 -0
- package/dist/cjs/components/Table/data-table-pagination.cjs.map +1 -0
- package/dist/cjs/components/Table/data-table.cjs +2 -0
- package/dist/cjs/components/Table/data-table.cjs.map +1 -0
- package/dist/cjs/components/Tabs/Tabs.cjs +2 -0
- package/dist/cjs/components/Tabs/Tabs.cjs.map +1 -0
- package/dist/cjs/components/Tabs/classes.cjs +2 -0
- package/dist/cjs/components/Tabs/classes.cjs.map +1 -0
- package/dist/cjs/components/Textarea/Textarea.cjs +2 -0
- package/dist/cjs/components/Textarea/Textarea.cjs.map +1 -0
- package/dist/cjs/components/TimeGridView.cjs +2 -0
- package/dist/cjs/components/TimeGridView.cjs.map +1 -0
- package/dist/cjs/components/Toast/Toast.cjs +2 -0
- package/dist/cjs/components/Toast/Toast.cjs.map +1 -0
- package/dist/cjs/components/Toggle/Toggle.cjs +2 -0
- package/dist/cjs/components/Toggle/Toggle.cjs.map +1 -0
- package/dist/cjs/components/Tooltip/Tooltip.cjs +2 -0
- package/dist/cjs/components/Tooltip/Tooltip.cjs.map +1 -0
- package/dist/cjs/components/Tour/Tour.cjs +2 -0
- package/dist/cjs/components/Tour/Tour.cjs.map +1 -0
- package/dist/cjs/components/Tour/TourWrapper.cjs +2 -0
- package/dist/cjs/components/Tour/TourWrapper.cjs.map +1 -0
- package/dist/cjs/components/Tour/index.cjs +2 -0
- package/dist/cjs/components/Tour/index.cjs.map +1 -0
- package/dist/cjs/components/Upload/Upload.cjs +4 -0
- package/dist/cjs/components/Upload/Upload.cjs.map +1 -0
- package/dist/cjs/components/WheelColumn.cjs +2 -0
- package/dist/cjs/components/WheelColumn.cjs.map +1 -0
- package/dist/cjs/constants/common.cjs +2 -0
- package/dist/cjs/constants/common.cjs.map +1 -0
- package/dist/cjs/favicon.ico +0 -0
- package/dist/cjs/hooks/use-callback-ref.cjs +2 -0
- package/dist/cjs/hooks/use-callback-ref.cjs.map +1 -0
- package/dist/cjs/hooks/use-debounced-callback.cjs +2 -0
- package/dist/cjs/hooks/use-debounced-callback.cjs.map +1 -0
- package/dist/cjs/hooks/use-debounced-value.cjs +2 -0
- package/dist/cjs/hooks/use-debounced-value.cjs.map +1 -0
- package/dist/cjs/hooks/use-event-listener.cjs +2 -0
- package/dist/cjs/hooks/use-event-listener.cjs.map +1 -0
- package/dist/cjs/hooks/use-intersection-observer.cjs +2 -0
- package/dist/cjs/hooks/use-intersection-observer.cjs.map +1 -0
- package/dist/cjs/hooks/use-isomorphic-layout-effect.cjs +2 -0
- package/dist/cjs/hooks/use-isomorphic-layout-effect.cjs.map +1 -0
- package/dist/cjs/hooks/use-media-query.cjs +2 -0
- package/dist/cjs/hooks/use-media-query.cjs.map +1 -0
- package/dist/cjs/hooks/use-on-click-outside.cjs +2 -0
- package/dist/cjs/hooks/use-on-click-outside.cjs.map +1 -0
- package/dist/cjs/hooks/use-script.cjs +2 -0
- package/dist/cjs/hooks/use-script.cjs.map +1 -0
- package/dist/cjs/hooks/use-scroll-lock.cjs +2 -0
- package/dist/cjs/hooks/use-scroll-lock.cjs.map +1 -0
- package/dist/cjs/image.png +0 -0
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/index.cjs.map +1 -0
- package/dist/cjs/lib/TextAnimation/BlurText.cjs +2 -0
- package/dist/cjs/lib/TextAnimation/BlurText.cjs.map +1 -0
- package/dist/cjs/lib/TextAnimation/CircularText.cjs +2 -0
- package/dist/cjs/lib/TextAnimation/CircularText.cjs.map +1 -0
- package/dist/cjs/lib/TextAnimation/FlipWords.cjs +2 -0
- package/dist/cjs/lib/TextAnimation/FlipWords.cjs.map +1 -0
- package/dist/cjs/lib/TextAnimation/GradientText.cjs +2 -0
- package/dist/cjs/lib/TextAnimation/GradientText.cjs.map +1 -0
- package/dist/cjs/lib/TextAnimation/RollingText.cjs +2 -0
- package/dist/cjs/lib/TextAnimation/RollingText.cjs.map +1 -0
- package/dist/cjs/lib/TextAnimation/RotatingText.cjs +2 -0
- package/dist/cjs/lib/TextAnimation/RotatingText.cjs.map +1 -0
- package/dist/cjs/lib/TextAnimation/ShimmeringText.cjs +2 -0
- package/dist/cjs/lib/TextAnimation/ShimmeringText.cjs.map +1 -0
- package/dist/cjs/lib/TextAnimation/SplittingText.cjs +2 -0
- package/dist/cjs/lib/TextAnimation/SplittingText.cjs.map +1 -0
- package/dist/cjs/lib/TextAnimation/TextGenerateEffect.cjs +2 -0
- package/dist/cjs/lib/TextAnimation/TextGenerateEffect.cjs.map +1 -0
- package/dist/cjs/lib/TextAnimation/TextHoverEffect.cjs +2 -0
- package/dist/cjs/lib/TextAnimation/TextHoverEffect.cjs.map +1 -0
- package/dist/cjs/lib/TextAnimation/TextPressureEffect.cjs +22 -0
- package/dist/cjs/lib/TextAnimation/TextPressureEffect.cjs.map +1 -0
- package/dist/cjs/lib/TextAnimation/TypingText.cjs +2 -0
- package/dist/cjs/lib/TextAnimation/TypingText.cjs.map +1 -0
- package/dist/cjs/lib/TextAnimation/WritingText.cjs +2 -0
- package/dist/cjs/lib/TextAnimation/WritingText.cjs.map +1 -0
- package/dist/cjs/node_modules/.pnpm/react-viewer@3.2.2/node_modules/react-viewer/dist/index.cjs +253 -0
- package/dist/cjs/node_modules/.pnpm/react-viewer@3.2.2/node_modules/react-viewer/dist/index.cjs.map +1 -0
- package/dist/cjs/node_modules/.pnpm/viewerjs@1.11.7/node_modules/viewerjs/dist/viewer.css +1 -0
- package/dist/cjs/styles/animation.css +1 -0
- package/dist/cjs/styles/index.css +1 -0
- package/dist/cjs/styles/theme.css +1 -0
- package/dist/cjs/utils/animations.cjs +2 -0
- package/dist/cjs/utils/animations.cjs.map +1 -0
- package/dist/cjs/utils/css.cjs +2 -0
- package/dist/cjs/utils/css.cjs.map +1 -0
- package/dist/cjs/utils/data-table.cjs +2 -0
- package/dist/cjs/utils/data-table.cjs.map +1 -0
- package/dist/cjs/utils/datetime.cjs +2 -0
- package/dist/cjs/utils/datetime.cjs.map +1 -0
- package/dist/cjs/vite.svg +1 -0
- package/dist/cjs/wave.png +0 -0
- package/dist/esm/_virtual/_commonjsHelpers.js +7 -0
- package/dist/esm/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/esm/_virtual/index.js +8 -0
- package/dist/esm/_virtual/index.js.map +1 -0
- package/dist/esm/_virtual/index2.js +5 -0
- package/dist/esm/_virtual/index2.js.map +1 -0
- package/dist/esm/components/Accordion/Accordion.js +190 -0
- package/dist/esm/components/Accordion/Accordion.js.map +1 -0
- package/dist/esm/components/Avatar/Avatar.js +93 -0
- package/dist/esm/components/Avatar/Avatar.js.map +1 -0
- package/dist/esm/components/Badge/Badge.js +35 -0
- package/dist/esm/components/Badge/Badge.js.map +1 -0
- package/dist/esm/components/Breadcrumb/Breadcrumb.js +102 -0
- package/dist/esm/components/Breadcrumb/Breadcrumb.js.map +1 -0
- package/dist/esm/components/Button/Button.js +53 -0
- package/dist/esm/components/Button/Button.js.map +1 -0
- package/dist/esm/components/Button/ButtonGroup.js +53 -0
- package/dist/esm/components/Button/ButtonGroup.js.map +1 -0
- package/dist/esm/components/Calendar/Calendar.js +40 -0
- package/dist/esm/components/Calendar/Calendar.js.map +1 -0
- package/dist/esm/components/Carousel/Carousel.js +510 -0
- package/dist/esm/components/Carousel/Carousel.js.map +1 -0
- package/dist/esm/components/Checkbox/Checkbox.js +79 -0
- package/dist/esm/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/esm/components/Collapsible/Collapsible.js +107 -0
- package/dist/esm/components/Collapsible/Collapsible.js.map +1 -0
- package/dist/esm/components/Command/Command.js +113 -0
- package/dist/esm/components/Command/Command.js.map +1 -0
- package/dist/esm/components/Command/index.js +16 -0
- package/dist/esm/components/Command/index.js.map +1 -0
- package/dist/esm/components/ContextMenu/ContextMenu.js +131 -0
- package/dist/esm/components/ContextMenu/ContextMenu.js.map +1 -0
- package/dist/esm/components/ContextMenu/index.js +24 -0
- package/dist/esm/components/ContextMenu/index.js.map +1 -0
- package/dist/esm/components/Cropper/Cropper.js +1014 -0
- package/dist/esm/components/Cropper/Cropper.js.map +1 -0
- package/dist/esm/components/Cropper/CropperTool.js +157 -0
- package/dist/esm/components/Cropper/CropperTool.js.map +1 -0
- package/dist/esm/components/Cropper/utils.js +108 -0
- package/dist/esm/components/Cropper/utils.js.map +1 -0
- package/dist/esm/components/DatePicker/DatePicker.js +263 -0
- package/dist/esm/components/DatePicker/DatePicker.js.map +1 -0
- package/dist/esm/components/DatePicker/RangePicker.js +456 -0
- package/dist/esm/components/DatePicker/RangePicker.js.map +1 -0
- package/dist/esm/components/DatePicker/TimePicker.js +444 -0
- package/dist/esm/components/DatePicker/TimePicker.js.map +1 -0
- package/dist/esm/components/Dialog/Dialog.js +223 -0
- package/dist/esm/components/Dialog/Dialog.js.map +1 -0
- package/dist/esm/components/DropdownMenu/DropdownMenu.js +196 -0
- package/dist/esm/components/DropdownMenu/DropdownMenu.js.map +1 -0
- package/dist/esm/components/DropdownMenu/index.js +24 -0
- package/dist/esm/components/DropdownMenu/index.js.map +1 -0
- package/dist/esm/components/FloatLabel.js +59 -0
- package/dist/esm/components/FloatLabel.js.map +1 -0
- package/dist/esm/components/Glass/Glass.js +93 -0
- package/dist/esm/components/Glass/Glass.js.map +1 -0
- package/dist/esm/components/ImageViewer/ImageViewer.css +1 -0
- package/dist/esm/components/ImageViewer/ImageViewer.js +273 -0
- package/dist/esm/components/ImageViewer/ImageViewer.js.map +1 -0
- package/dist/esm/components/Input/Input.js +267 -0
- package/dist/esm/components/Input/Input.js.map +1 -0
- package/dist/esm/components/InputOTP/InputOTP.js +70 -0
- package/dist/esm/components/InputOTP/InputOTP.js.map +1 -0
- package/dist/esm/components/Interactive/CursorFollow.js +257 -0
- package/dist/esm/components/Interactive/CursorFollow.js.map +1 -0
- package/dist/esm/components/Marquee/Marquee.js +419 -0
- package/dist/esm/components/Marquee/Marquee.js.map +1 -0
- package/dist/esm/components/Marquee/MarqueeWrapper.js +25 -0
- package/dist/esm/components/Marquee/MarqueeWrapper.js.map +1 -0
- package/dist/esm/components/Marquee/index.js +15 -0
- package/dist/esm/components/Marquee/index.js.map +1 -0
- package/dist/esm/components/Masonry/Masonry.js +840 -0
- package/dist/esm/components/Masonry/Masonry.js.map +1 -0
- package/dist/esm/components/Masonry/MasonryWrapper.js +19 -0
- package/dist/esm/components/Masonry/MasonryWrapper.js.map +1 -0
- package/dist/esm/components/Pagination/Pagination.js +209 -0
- package/dist/esm/components/Pagination/Pagination.js.map +1 -0
- package/dist/esm/components/Pagination/index.js +14 -0
- package/dist/esm/components/Pagination/index.js.map +1 -0
- package/dist/esm/components/Popover/Popover.js +51 -0
- package/dist/esm/components/Popover/Popover.js.map +1 -0
- package/dist/esm/components/Popover/index.js +9 -0
- package/dist/esm/components/Popover/index.js.map +1 -0
- package/dist/esm/components/QrCode/QrCode.js +300 -0
- package/dist/esm/components/QrCode/QrCode.js.map +1 -0
- package/dist/esm/components/QrCode/index.js +16 -0
- package/dist/esm/components/QrCode/index.js.map +1 -0
- package/dist/esm/components/Radio/Radio.js +74 -0
- package/dist/esm/components/Radio/Radio.js.map +1 -0
- package/dist/esm/components/Rate/Rate.js +191 -0
- package/dist/esm/components/Rate/Rate.js.map +1 -0
- package/dist/esm/components/Resizable/Resizable.js +89 -0
- package/dist/esm/components/Resizable/Resizable.js.map +1 -0
- package/dist/esm/components/ScrollArea/ScrollArea.js +45 -0
- package/dist/esm/components/ScrollArea/ScrollArea.js.map +1 -0
- package/dist/esm/components/Select/Select.js +199 -0
- package/dist/esm/components/Select/Select.js.map +1 -0
- package/dist/esm/components/Separator/Separator.js +7 -0
- package/dist/esm/components/Separator/Separator.js.map +1 -0
- package/dist/esm/components/Sheet/Sheet.js +141 -0
- package/dist/esm/components/Sheet/Sheet.js.map +1 -0
- package/dist/esm/components/Sidebar/Sidebar.js +30 -0
- package/dist/esm/components/Sidebar/Sidebar.js.map +1 -0
- package/dist/esm/components/Skeleton/Skeleton.js +12 -0
- package/dist/esm/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/esm/components/Slider/Slider.js +420 -0
- package/dist/esm/components/Slider/Slider.js.map +1 -0
- package/dist/esm/components/Stepper/Stepper.js +886 -0
- package/dist/esm/components/Stepper/Stepper.js.map +1 -0
- package/dist/esm/components/Stepper/StepperWrapper.js +80 -0
- package/dist/esm/components/Stepper/StepperWrapper.js.map +1 -0
- package/dist/esm/components/Stepper/index.js +21 -0
- package/dist/esm/components/Stepper/index.js.map +1 -0
- package/dist/esm/components/Switch/Switch.js +126 -0
- package/dist/esm/components/Switch/Switch.js.map +1 -0
- package/dist/esm/components/Table/TableFilter/data-table-date-filter.js +126 -0
- package/dist/esm/components/Table/TableFilter/data-table-date-filter.js.map +1 -0
- package/dist/esm/components/Table/TableFilter/data-table-filter-popover.js +138 -0
- package/dist/esm/components/Table/TableFilter/data-table-filter-popover.js.map +1 -0
- package/dist/esm/components/Table/TableFilter/data-table-slider-filter.js +164 -0
- package/dist/esm/components/Table/TableFilter/data-table-slider-filter.js.map +1 -0
- package/dist/esm/components/Table/data-table-column-header.js +82 -0
- package/dist/esm/components/Table/data-table-column-header.js.map +1 -0
- package/dist/esm/components/Table/data-table-pagination.js +73 -0
- package/dist/esm/components/Table/data-table-pagination.js.map +1 -0
- package/dist/esm/components/Table/data-table.js +94 -0
- package/dist/esm/components/Table/data-table.js.map +1 -0
- package/dist/esm/components/Tabs/Tabs.js +540 -0
- package/dist/esm/components/Tabs/Tabs.js.map +1 -0
- package/dist/esm/components/Tabs/classes.js +345 -0
- package/dist/esm/components/Tabs/classes.js.map +1 -0
- package/dist/esm/components/Textarea/Textarea.js +132 -0
- package/dist/esm/components/Textarea/Textarea.js.map +1 -0
- package/dist/esm/components/TimeGridView.js +101 -0
- package/dist/esm/components/TimeGridView.js.map +1 -0
- package/dist/esm/components/Toast/Toast.js +80 -0
- package/dist/esm/components/Toast/Toast.js.map +1 -0
- package/dist/esm/components/Toggle/Toggle.js +23 -0
- package/dist/esm/components/Toggle/Toggle.js.map +1 -0
- package/dist/esm/components/Tooltip/Tooltip.js +120 -0
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/esm/components/Tour/Tour.js +948 -0
- package/dist/esm/components/Tour/Tour.js.map +1 -0
- package/dist/esm/components/Tour/TourWrapper.js +67 -0
- package/dist/esm/components/Tour/TourWrapper.js.map +1 -0
- package/dist/esm/components/Tour/index.js +38 -0
- package/dist/esm/components/Tour/index.js.map +1 -0
- package/dist/esm/components/Upload/Upload.js +948 -0
- package/dist/esm/components/Upload/Upload.js.map +1 -0
- package/dist/esm/components/WheelColumn.js +127 -0
- package/dist/esm/components/WheelColumn.js.map +1 -0
- package/dist/esm/constants/common.js +5 -0
- package/dist/esm/constants/common.js.map +1 -0
- package/dist/esm/favicon.ico +0 -0
- package/dist/esm/hooks/use-callback-ref.js +14 -0
- package/dist/esm/hooks/use-callback-ref.js.map +1 -0
- package/dist/esm/hooks/use-debounced-callback.js +21 -0
- package/dist/esm/hooks/use-debounced-callback.js.map +1 -0
- package/dist/esm/hooks/use-debounced-value.js +12 -0
- package/dist/esm/hooks/use-debounced-value.js.map +1 -0
- package/dist/esm/hooks/use-event-listener.js +21 -0
- package/dist/esm/hooks/use-event-listener.js.map +1 -0
- package/dist/esm/hooks/use-intersection-observer.js +56 -0
- package/dist/esm/hooks/use-intersection-observer.js.map +1 -0
- package/dist/esm/hooks/use-isomorphic-layout-effect.js +6 -0
- package/dist/esm/hooks/use-isomorphic-layout-effect.js.map +1 -0
- package/dist/esm/hooks/use-media-query.js +22 -0
- package/dist/esm/hooks/use-media-query.js.map +1 -0
- package/dist/esm/hooks/use-on-click-outside.js +18 -0
- package/dist/esm/hooks/use-on-click-outside.js.map +1 -0
- package/dist/esm/hooks/use-script.js +46 -0
- package/dist/esm/hooks/use-script.js.map +1 -0
- package/dist/esm/hooks/use-scroll-lock.js +27 -0
- package/dist/esm/hooks/use-scroll-lock.js.map +1 -0
- package/dist/esm/image.png +0 -0
- package/dist/esm/index.js +223 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/TextAnimation/BlurText.js +84 -0
- package/dist/esm/lib/TextAnimation/BlurText.js.map +1 -0
- package/dist/esm/lib/TextAnimation/CircularText.js +96 -0
- package/dist/esm/lib/TextAnimation/CircularText.js.map +1 -0
- package/dist/esm/lib/TextAnimation/FlipWords.js +103 -0
- package/dist/esm/lib/TextAnimation/FlipWords.js.map +1 -0
- package/dist/esm/lib/TextAnimation/GradientText.js +54 -0
- package/dist/esm/lib/TextAnimation/GradientText.js.map +1 -0
- package/dist/esm/lib/TextAnimation/RollingText.js +70 -0
- package/dist/esm/lib/TextAnimation/RollingText.js.map +1 -0
- package/dist/esm/lib/TextAnimation/RotatingText.js +38 -0
- package/dist/esm/lib/TextAnimation/RotatingText.js.map +1 -0
- package/dist/esm/lib/TextAnimation/ShimmeringText.js +64 -0
- package/dist/esm/lib/TextAnimation/ShimmeringText.js.map +1 -0
- package/dist/esm/lib/TextAnimation/SplittingText.js +86 -0
- package/dist/esm/lib/TextAnimation/SplittingText.js.map +1 -0
- package/dist/esm/lib/TextAnimation/TextGenerateEffect.js +59 -0
- package/dist/esm/lib/TextAnimation/TextGenerateEffect.js.map +1 -0
- package/dist/esm/lib/TextAnimation/TextHoverEffect.js +128 -0
- package/dist/esm/lib/TextAnimation/TextHoverEffect.js.map +1 -0
- package/dist/esm/lib/TextAnimation/TextPressureEffect.js +135 -0
- package/dist/esm/lib/TextAnimation/TextPressureEffect.js.map +1 -0
- package/dist/esm/lib/TextAnimation/TypingText.js +118 -0
- package/dist/esm/lib/TextAnimation/TypingText.js.map +1 -0
- package/dist/esm/lib/TextAnimation/WritingText.js +45 -0
- package/dist/esm/lib/TextAnimation/WritingText.js.map +1 -0
- package/dist/esm/node_modules/.pnpm/react-viewer@3.2.2/node_modules/react-viewer/dist/index.js +865 -0
- package/dist/esm/node_modules/.pnpm/react-viewer@3.2.2/node_modules/react-viewer/dist/index.js.map +1 -0
- package/dist/esm/node_modules/.pnpm/viewerjs@1.11.7/node_modules/viewerjs/dist/viewer.css +1 -0
- package/dist/esm/styles/animation.css +1 -0
- package/dist/esm/styles/index.css +1 -0
- package/dist/esm/styles/theme.css +1 -0
- package/dist/esm/utils/animations.js +189 -0
- package/dist/esm/utils/animations.js.map +1 -0
- package/dist/esm/utils/css.js +25 -0
- package/dist/esm/utils/css.js.map +1 -0
- package/dist/esm/utils/data-table.js +20 -0
- package/dist/esm/utils/data-table.js.map +1 -0
- package/dist/esm/utils/datetime.js +17 -0
- package/dist/esm/utils/datetime.js.map +1 -0
- package/dist/esm/vite.svg +1 -0
- package/dist/esm/wave.png +0 -0
- package/dist/types/components/Accordion/Accordion.d.ts +49 -0
- package/dist/types/components/Accordion/Accordion.d.ts.map +1 -0
- package/dist/types/components/Accordion/index.d.ts +3 -0
- package/dist/types/components/Accordion/index.d.ts.map +1 -0
- package/dist/types/components/Avatar/Avatar.d.ts +18 -0
- package/dist/types/components/Avatar/Avatar.d.ts.map +1 -0
- package/dist/types/components/Avatar/index.d.ts +3 -0
- package/dist/types/components/Avatar/index.d.ts.map +1 -0
- package/dist/types/components/Badge/Badge.d.ts +10 -0
- package/dist/types/components/Badge/Badge.d.ts.map +1 -0
- package/dist/types/components/Badge/index.d.ts +2 -0
- package/dist/types/components/Badge/index.d.ts.map +1 -0
- package/dist/types/components/Breadcrumb/Breadcrumb.d.ts +23 -0
- package/dist/types/components/Breadcrumb/Breadcrumb.d.ts.map +1 -0
- package/dist/types/components/Breadcrumb/index.d.ts +2 -0
- package/dist/types/components/Breadcrumb/index.d.ts.map +1 -0
- package/dist/types/components/Button/Button.d.ts +10 -0
- package/dist/types/components/Button/Button.d.ts.map +1 -0
- package/dist/types/components/Button/ButtonGroup.d.ts +16 -0
- package/dist/types/components/Button/ButtonGroup.d.ts.map +1 -0
- package/dist/types/components/Button/index.d.ts +5 -0
- package/dist/types/components/Button/index.d.ts.map +1 -0
- package/dist/types/components/Calendar/Calendar.d.ts +15 -0
- package/dist/types/components/Calendar/Calendar.d.ts.map +1 -0
- package/dist/types/components/Calendar/index.d.ts +3 -0
- package/dist/types/components/Calendar/index.d.ts.map +1 -0
- package/dist/types/components/Carousel/Carousel.d.ts +79 -0
- package/dist/types/components/Carousel/Carousel.d.ts.map +1 -0
- package/dist/types/components/Carousel/index.d.ts +4 -0
- package/dist/types/components/Carousel/index.d.ts.map +1 -0
- package/dist/types/components/Checkbox/Checkbox.d.ts +15 -0
- package/dist/types/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/dist/types/components/Checkbox/index.d.ts +2 -0
- package/dist/types/components/Checkbox/index.d.ts.map +1 -0
- package/dist/types/components/Collapsible/Collapsible.d.ts +17 -0
- package/dist/types/components/Collapsible/Collapsible.d.ts.map +1 -0
- package/dist/types/components/Collapsible/index.d.ts +2 -0
- package/dist/types/components/Collapsible/index.d.ts.map +1 -0
- package/dist/types/components/Command/Command.d.ts +39 -0
- package/dist/types/components/Command/Command.d.ts.map +1 -0
- package/dist/types/components/Command/index.d.ts +15 -0
- package/dist/types/components/Command/index.d.ts.map +1 -0
- package/dist/types/components/ContextMenu/ContextMenu.d.ts +64 -0
- package/dist/types/components/ContextMenu/ContextMenu.d.ts.map +1 -0
- package/dist/types/components/ContextMenu/index.d.ts +23 -0
- package/dist/types/components/ContextMenu/index.d.ts.map +1 -0
- package/dist/types/components/Cropper/Cropper.d.ts +86 -0
- package/dist/types/components/Cropper/Cropper.d.ts.map +1 -0
- package/dist/types/components/Cropper/CropperTool.d.ts +149 -0
- package/dist/types/components/Cropper/CropperTool.d.ts.map +1 -0
- package/dist/types/components/Cropper/index.d.ts +4 -0
- package/dist/types/components/Cropper/index.d.ts.map +1 -0
- package/dist/types/components/Cropper/utils.d.ts +130 -0
- package/dist/types/components/Cropper/utils.d.ts.map +1 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts +56 -0
- package/dist/types/components/DatePicker/DatePicker.d.ts.map +1 -0
- package/dist/types/components/DatePicker/RangePicker.d.ts +42 -0
- package/dist/types/components/DatePicker/RangePicker.d.ts.map +1 -0
- package/dist/types/components/DatePicker/TimePicker.d.ts +43 -0
- package/dist/types/components/DatePicker/TimePicker.d.ts.map +1 -0
- package/dist/types/components/DatePicker/index.d.ts +7 -0
- package/dist/types/components/DatePicker/index.d.ts.map +1 -0
- package/dist/types/components/Dialog/Dialog.d.ts +45 -0
- package/dist/types/components/Dialog/Dialog.d.ts.map +1 -0
- package/dist/types/components/Dialog/index.d.ts +2 -0
- package/dist/types/components/Dialog/index.d.ts.map +1 -0
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts +65 -0
- package/dist/types/components/DropdownMenu/DropdownMenu.d.ts.map +1 -0
- package/dist/types/components/DropdownMenu/index.d.ts +22 -0
- package/dist/types/components/DropdownMenu/index.d.ts.map +1 -0
- package/dist/types/components/FloatLabel.d.ts +8 -0
- package/dist/types/components/FloatLabel.d.ts.map +1 -0
- package/dist/types/components/Glass/Glass.d.ts +10 -0
- package/dist/types/components/Glass/Glass.d.ts.map +1 -0
- package/dist/types/components/Glass/index.d.ts +2 -0
- package/dist/types/components/Glass/index.d.ts.map +1 -0
- package/dist/types/components/ImageViewer/ImageViewer.d.ts +58 -0
- package/dist/types/components/ImageViewer/ImageViewer.d.ts.map +1 -0
- package/dist/types/components/ImageViewer/index.d.ts +4 -0
- package/dist/types/components/ImageViewer/index.d.ts.map +1 -0
- package/dist/types/components/Input/Input.d.ts +27 -0
- package/dist/types/components/Input/Input.d.ts.map +1 -0
- package/dist/types/components/Input/index.d.ts +2 -0
- package/dist/types/components/Input/index.d.ts.map +1 -0
- package/dist/types/components/InputOTP/InputOTP.d.ts +20 -0
- package/dist/types/components/InputOTP/InputOTP.d.ts.map +1 -0
- package/dist/types/components/InputOTP/index.d.ts +2 -0
- package/dist/types/components/InputOTP/index.d.ts.map +1 -0
- package/dist/types/components/Interactive/3DCard.d.ts +28 -0
- package/dist/types/components/Interactive/3DCard.d.ts.map +1 -0
- package/dist/types/components/Interactive/3DMarquee.d.ts +20 -0
- package/dist/types/components/Interactive/3DMarquee.d.ts.map +1 -0
- package/dist/types/components/Interactive/CursorFollow.d.ts +75 -0
- package/dist/types/components/Interactive/CursorFollow.d.ts.map +1 -0
- package/dist/types/components/Interactive/index.cursor.d.ts +7 -0
- package/dist/types/components/Interactive/index.cursor.d.ts.map +1 -0
- package/dist/types/components/Interactive/index.d.ts +2 -0
- package/dist/types/components/Interactive/index.d.ts.map +1 -0
- package/dist/types/components/Label/Label.d.ts +3 -0
- package/dist/types/components/Label/Label.d.ts.map +1 -0
- package/dist/types/components/Label/index.d.ts +2 -0
- package/dist/types/components/Label/index.d.ts.map +1 -0
- package/dist/types/components/Marquee/Marquee.d.ts +31 -0
- package/dist/types/components/Marquee/Marquee.d.ts.map +1 -0
- package/dist/types/components/Marquee/MarqueeWrapper.d.ts +10 -0
- package/dist/types/components/Marquee/MarqueeWrapper.d.ts.map +1 -0
- package/dist/types/components/Marquee/index.d.ts +13 -0
- package/dist/types/components/Marquee/index.d.ts.map +1 -0
- package/dist/types/components/Masonry/Masonry.d.ts +41 -0
- package/dist/types/components/Masonry/Masonry.d.ts.map +1 -0
- package/dist/types/components/Masonry/MasonryWrapper.d.ts +29 -0
- package/dist/types/components/Masonry/MasonryWrapper.d.ts.map +1 -0
- package/dist/types/components/Masonry/index.d.ts +5 -0
- package/dist/types/components/Masonry/index.d.ts.map +1 -0
- package/dist/types/components/Pagination/Pagination.d.ts +24 -0
- package/dist/types/components/Pagination/Pagination.d.ts.map +1 -0
- package/dist/types/components/Pagination/index.d.ts +11 -0
- package/dist/types/components/Pagination/index.d.ts.map +1 -0
- package/dist/types/components/Popover/Popover.d.ts +22 -0
- package/dist/types/components/Popover/Popover.d.ts.map +1 -0
- package/dist/types/components/Popover/index.d.ts +5 -0
- package/dist/types/components/Popover/index.d.ts.map +1 -0
- package/dist/types/components/QrCode/QrCode.d.ts +51 -0
- package/dist/types/components/QrCode/QrCode.d.ts.map +1 -0
- package/dist/types/components/QrCode/index.d.ts +13 -0
- package/dist/types/components/QrCode/index.d.ts.map +1 -0
- package/dist/types/components/Radio/Radio.d.ts +35 -0
- package/dist/types/components/Radio/Radio.d.ts.map +1 -0
- package/dist/types/components/Radio/index.d.ts +2 -0
- package/dist/types/components/Radio/index.d.ts.map +1 -0
- package/dist/types/components/Rate/Rate.d.ts +26 -0
- package/dist/types/components/Rate/Rate.d.ts.map +1 -0
- package/dist/types/components/Rate/index.d.ts +3 -0
- package/dist/types/components/Rate/index.d.ts.map +1 -0
- package/dist/types/components/Resizable/Resizable.d.ts +71 -0
- package/dist/types/components/Resizable/Resizable.d.ts.map +1 -0
- package/dist/types/components/Resizable/index.d.ts +4 -0
- package/dist/types/components/Resizable/index.d.ts.map +1 -0
- package/dist/types/components/ScrollArea/ScrollArea.d.ts +19 -0
- package/dist/types/components/ScrollArea/ScrollArea.d.ts.map +1 -0
- package/dist/types/components/ScrollArea/index.d.ts +2 -0
- package/dist/types/components/ScrollArea/index.d.ts.map +1 -0
- package/dist/types/components/Select/Select.d.ts +33 -0
- package/dist/types/components/Select/Select.d.ts.map +1 -0
- package/dist/types/components/Select/index.d.ts +2 -0
- package/dist/types/components/Select/index.d.ts.map +1 -0
- package/dist/types/components/Separator/Separator.d.ts +5 -0
- package/dist/types/components/Separator/Separator.d.ts.map +1 -0
- package/dist/types/components/Separator/index.d.ts +2 -0
- package/dist/types/components/Separator/index.d.ts.map +1 -0
- package/dist/types/components/Sheet/Sheet.d.ts +36 -0
- package/dist/types/components/Sheet/Sheet.d.ts.map +1 -0
- package/dist/types/components/Sheet/index.d.ts +2 -0
- package/dist/types/components/Sheet/index.d.ts.map +1 -0
- package/dist/types/components/Sidebar/Sidebar.d.ts +50 -0
- package/dist/types/components/Sidebar/Sidebar.d.ts.map +1 -0
- package/dist/types/components/Sidebar/index.d.ts +4 -0
- package/dist/types/components/Sidebar/index.d.ts.map +1 -0
- package/dist/types/components/Skeleton/Skeleton.d.ts +6 -0
- package/dist/types/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/dist/types/components/Skeleton/index.d.ts +2 -0
- package/dist/types/components/Skeleton/index.d.ts.map +1 -0
- package/dist/types/components/Slider/Slider.d.ts +25 -0
- package/dist/types/components/Slider/Slider.d.ts.map +1 -0
- package/dist/types/components/Slider/index.d.ts +2 -0
- package/dist/types/components/Slider/index.d.ts.map +1 -0
- package/dist/types/components/Stepper/Stepper.d.ts +86 -0
- package/dist/types/components/Stepper/Stepper.d.ts.map +1 -0
- package/dist/types/components/Stepper/StepperWrapper.d.ts +25 -0
- package/dist/types/components/Stepper/StepperWrapper.d.ts.map +1 -0
- package/dist/types/components/Stepper/index.d.ts +18 -0
- package/dist/types/components/Stepper/index.d.ts.map +1 -0
- package/dist/types/components/Switch/Switch.d.ts +14 -0
- package/dist/types/components/Switch/Switch.d.ts.map +1 -0
- package/dist/types/components/Switch/index.d.ts +2 -0
- package/dist/types/components/Switch/index.d.ts.map +1 -0
- package/dist/types/components/Table/TableFilter/data-table-date-filter.d.ts +9 -0
- package/dist/types/components/Table/TableFilter/data-table-date-filter.d.ts.map +1 -0
- package/dist/types/components/Table/TableFilter/data-table-filter-popover.d.ts +11 -0
- package/dist/types/components/Table/TableFilter/data-table-filter-popover.d.ts.map +1 -0
- package/dist/types/components/Table/TableFilter/data-table-slider-filter.d.ts +8 -0
- package/dist/types/components/Table/TableFilter/data-table-slider-filter.d.ts.map +1 -0
- package/dist/types/components/Table/TableWrapper.d.ts +2 -0
- package/dist/types/components/Table/TableWrapper.d.ts.map +1 -0
- package/dist/types/components/Table/data-table-column-header.d.ts +9 -0
- package/dist/types/components/Table/data-table-column-header.d.ts.map +1 -0
- package/dist/types/components/Table/data-table-pagination.d.ts +12 -0
- package/dist/types/components/Table/data-table-pagination.d.ts.map +1 -0
- package/dist/types/components/Table/data-table-toolbar.d.ts +10 -0
- package/dist/types/components/Table/data-table-toolbar.d.ts.map +1 -0
- package/dist/types/components/Table/data-table-view-options.d.ts +9 -0
- package/dist/types/components/Table/data-table-view-options.d.ts.map +1 -0
- package/dist/types/components/Table/data-table.d.ts +18 -0
- package/dist/types/components/Table/data-table.d.ts.map +1 -0
- package/dist/types/components/Table/index.d.ts +2 -0
- package/dist/types/components/Table/index.d.ts.map +1 -0
- package/dist/types/components/Table/select-column.d.ts +5 -0
- package/dist/types/components/Table/select-column.d.ts.map +1 -0
- package/dist/types/components/Tabs/Tabs.d.ts +22 -0
- package/dist/types/components/Tabs/Tabs.d.ts.map +1 -0
- package/dist/types/components/Tabs/classes.d.ts +29 -0
- package/dist/types/components/Tabs/classes.d.ts.map +1 -0
- package/dist/types/components/Tabs/index.d.ts +4 -0
- package/dist/types/components/Tabs/index.d.ts.map +1 -0
- package/dist/types/components/Tabs/types.d.ts +15 -0
- package/dist/types/components/Tabs/types.d.ts.map +1 -0
- package/dist/types/components/Textarea/Textarea.d.ts +17 -0
- package/dist/types/components/Textarea/Textarea.d.ts.map +1 -0
- package/dist/types/components/Textarea/index.d.ts +2 -0
- package/dist/types/components/Textarea/index.d.ts.map +1 -0
- package/dist/types/components/Theme/ThemeShowcase.d.ts +3 -0
- package/dist/types/components/Theme/ThemeShowcase.d.ts.map +1 -0
- package/dist/types/components/TimeGridView.d.ts +15 -0
- package/dist/types/components/TimeGridView.d.ts.map +1 -0
- package/dist/types/components/Toast/Toast.d.ts +12 -0
- package/dist/types/components/Toast/Toast.d.ts.map +1 -0
- package/dist/types/components/Toast/index.d.ts +3 -0
- package/dist/types/components/Toast/index.d.ts.map +1 -0
- package/dist/types/components/Toggle/Toggle.d.ts +10 -0
- package/dist/types/components/Toggle/Toggle.d.ts.map +1 -0
- package/dist/types/components/Toggle/index.d.ts +2 -0
- package/dist/types/components/Toggle/index.d.ts.map +1 -0
- package/dist/types/components/Tooltip/Tooltip.d.ts +19 -0
- package/dist/types/components/Tooltip/Tooltip.d.ts.map +1 -0
- package/dist/types/components/Tooltip/index.d.ts +3 -0
- package/dist/types/components/Tooltip/index.d.ts.map +1 -0
- package/dist/types/components/Tour/Tour.d.ts +105 -0
- package/dist/types/components/Tour/Tour.d.ts.map +1 -0
- package/dist/types/components/Tour/TourWrapper.d.ts +46 -0
- package/dist/types/components/Tour/TourWrapper.d.ts.map +1 -0
- package/dist/types/components/Tour/index.d.ts +36 -0
- package/dist/types/components/Tour/index.d.ts.map +1 -0
- package/dist/types/components/TreeSelect/TreeSelect.d.ts +2 -0
- package/dist/types/components/TreeSelect/TreeSelect.d.ts.map +1 -0
- package/dist/types/components/TreeSelect/index.d.ts +2 -0
- package/dist/types/components/TreeSelect/index.d.ts.map +1 -0
- package/dist/types/components/Upload/Upload.d.ts +69 -0
- package/dist/types/components/Upload/Upload.d.ts.map +1 -0
- package/dist/types/components/Upload/index.d.ts +2 -0
- package/dist/types/components/Upload/index.d.ts.map +1 -0
- package/dist/types/components/WheelColumn.d.ts +15 -0
- package/dist/types/components/WheelColumn.d.ts.map +1 -0
- package/dist/types/config/data-table.d.ts +125 -0
- package/dist/types/config/data-table.d.ts.map +1 -0
- package/dist/types/constants/common.d.ts +4 -0
- package/dist/types/constants/common.d.ts.map +1 -0
- package/dist/types/constants/theme.d.ts +13 -0
- package/dist/types/constants/theme.d.ts.map +1 -0
- package/dist/types/hooks/index.d.ts +10 -0
- package/dist/types/hooks/index.d.ts.map +1 -0
- package/dist/types/hooks/use-callback-ref.d.ts +10 -0
- package/dist/types/hooks/use-callback-ref.d.ts.map +1 -0
- package/dist/types/hooks/use-data-table.d.ts +26 -0
- package/dist/types/hooks/use-data-table.d.ts.map +1 -0
- package/dist/types/hooks/use-debounced-callback.d.ts +2 -0
- package/dist/types/hooks/use-debounced-callback.d.ts.map +1 -0
- package/dist/types/hooks/use-debounced-value.d.ts +9 -0
- package/dist/types/hooks/use-debounced-value.d.ts.map +1 -0
- package/dist/types/hooks/use-event-listener.d.ts +7 -0
- package/dist/types/hooks/use-event-listener.d.ts.map +1 -0
- package/dist/types/hooks/use-intersection-observer.d.ts +20 -0
- package/dist/types/hooks/use-intersection-observer.d.ts.map +1 -0
- package/dist/types/hooks/use-isomorphic-layout-effect.d.ts +3 -0
- package/dist/types/hooks/use-isomorphic-layout-effect.d.ts.map +1 -0
- package/dist/types/hooks/use-media-query.d.ts +7 -0
- package/dist/types/hooks/use-media-query.d.ts.map +1 -0
- package/dist/types/hooks/use-mouse-position.d.ts +14 -0
- package/dist/types/hooks/use-mouse-position.d.ts.map +1 -0
- package/dist/types/hooks/use-on-click-outside.d.ts +5 -0
- package/dist/types/hooks/use-on-click-outside.d.ts.map +1 -0
- package/dist/types/hooks/use-script.d.ts +9 -0
- package/dist/types/hooks/use-script.d.ts.map +1 -0
- package/dist/types/hooks/use-scroll-lock.d.ts +13 -0
- package/dist/types/hooks/use-scroll-lock.d.ts.map +1 -0
- package/dist/types/index.d.ts +72 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lib/TextAnimation/BlurText.d.ts +18 -0
- package/dist/types/lib/TextAnimation/BlurText.d.ts.map +1 -0
- package/dist/types/lib/TextAnimation/CircularText.d.ts +10 -0
- package/dist/types/lib/TextAnimation/CircularText.d.ts.map +1 -0
- package/dist/types/lib/TextAnimation/FlipWords.d.ts +10 -0
- package/dist/types/lib/TextAnimation/FlipWords.d.ts.map +1 -0
- package/dist/types/lib/TextAnimation/GradientText.d.ts +11 -0
- package/dist/types/lib/TextAnimation/GradientText.d.ts.map +1 -0
- package/dist/types/lib/TextAnimation/RollingText.d.ts +12 -0
- package/dist/types/lib/TextAnimation/RollingText.d.ts.map +1 -0
- package/dist/types/lib/TextAnimation/RotatingText.d.ts +11 -0
- package/dist/types/lib/TextAnimation/RotatingText.d.ts.map +1 -0
- package/dist/types/lib/TextAnimation/ShimmeringText.d.ts +12 -0
- package/dist/types/lib/TextAnimation/ShimmeringText.d.ts.map +1 -0
- package/dist/types/lib/TextAnimation/SplittingText.d.ts +26 -0
- package/dist/types/lib/TextAnimation/SplittingText.d.ts.map +1 -0
- package/dist/types/lib/TextAnimation/TextGenerateEffect.d.ts +10 -0
- package/dist/types/lib/TextAnimation/TextGenerateEffect.d.ts.map +1 -0
- package/dist/types/lib/TextAnimation/TextHoverEffect.d.ts +6 -0
- package/dist/types/lib/TextAnimation/TextHoverEffect.d.ts.map +1 -0
- package/dist/types/lib/TextAnimation/TextPressureEffect.d.ts +20 -0
- package/dist/types/lib/TextAnimation/TextPressureEffect.d.ts.map +1 -0
- package/dist/types/lib/TextAnimation/TypingText.d.ts +27 -0
- package/dist/types/lib/TextAnimation/TypingText.d.ts.map +1 -0
- package/dist/types/lib/TextAnimation/WritingText.d.ts +13 -0
- package/dist/types/lib/TextAnimation/WritingText.d.ts.map +1 -0
- package/dist/types/lib/TextAnimation/index.d.ts +16 -0
- package/dist/types/lib/TextAnimation/index.d.ts.map +1 -0
- package/dist/types/types/data-table.d.ts +44 -0
- package/dist/types/types/data-table.d.ts.map +1 -0
- package/dist/types/types/theme.d.ts +11 -0
- package/dist/types/types/theme.d.ts.map +1 -0
- package/dist/types/types/variables.d.ts +6 -0
- package/dist/types/types/variables.d.ts.map +1 -0
- package/dist/types/utils/animations.d.ts +47 -0
- package/dist/types/utils/animations.d.ts.map +1 -0
- package/dist/types/utils/css.d.ts +4 -0
- package/dist/types/utils/css.d.ts.map +1 -0
- package/dist/types/utils/data-table.d.ts +13 -0
- package/dist/types/utils/data-table.d.ts.map +1 -0
- package/dist/types/utils/datetime.d.ts +2 -0
- package/dist/types/utils/datetime.d.ts.map +1 -0
- package/dist/types/utils/parsers.d.ts +38 -0
- package/dist/types/utils/parsers.d.ts.map +1 -0
- package/package.json +968 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Marquee.cjs","sources":["../../../../src/components/Marquee/Marquee.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn, Slot, useComposedRefs } from \"@dsui/ui/index\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nconst ROOT_NAME = \"Marquee\";\nconst CONTENT_NAME = \"MarqueeContent\";\n\ntype Side = \"left\" | \"right\" | \"top\" | \"bottom\";\ntype Orientation = \"horizontal\" | \"vertical\";\ntype Direction = \"ltr\" | \"rtl\";\n\ntype RootElement = React.ComponentRef<typeof MarqueeRoot>;\ntype ContentElement = React.ComponentRef<typeof MarqueeContent>;\n\ninterface Dimensions {\n width: number;\n height: number;\n}\n\ninterface ElementDimensions {\n rootSize: number;\n contentSize: number;\n}\n\nfunction createResizeObserverStore() {\n const listeners = new Set<() => void>();\n let observer: ResizeObserver | null = null;\n const elements = new Map<Element, Dimensions>();\n const refCounts = new Map<Element, number>();\n const isSupported = typeof ResizeObserver !== \"undefined\";\n let notificationScheduled = false;\n\n const snapshotCache = new WeakMap<\n Element,\n WeakMap<\n Element,\n { horizontal: ElementDimensions; vertical: ElementDimensions }\n >\n >();\n\n function notify() {\n if (notificationScheduled) return;\n notificationScheduled = true;\n queueMicrotask(() => {\n notificationScheduled = false;\n for (const callback of listeners) {\n callback();\n }\n });\n }\n\n function cleanup() {\n if (observer) {\n observer.disconnect();\n observer = null;\n }\n elements.clear();\n refCounts.clear();\n }\n\n function subscribe(callback: () => void) {\n listeners.add(callback);\n return () => {\n listeners.delete(callback);\n if (listeners.size === 0) {\n cleanup();\n }\n };\n }\n\n function getSnapshot(\n rootElement: RootElement | null,\n contentElement: ContentElement | null,\n orientation: Orientation,\n ): ElementDimensions | null {\n if (!rootElement || !contentElement) return null;\n\n const rootDims = elements.get(rootElement);\n const contentDims = elements.get(contentElement);\n\n if (!rootDims || !contentDims) return null;\n\n const rootSize =\n orientation === \"vertical\" ? rootDims.height : rootDims.width;\n const contentSize =\n orientation === \"vertical\" ? contentDims.height : contentDims.width;\n\n let rootCache = snapshotCache.get(rootElement);\n if (!rootCache) {\n rootCache = new WeakMap();\n snapshotCache.set(rootElement, rootCache);\n }\n\n let contentCache = rootCache.get(contentElement);\n if (!contentCache) {\n contentCache = {\n horizontal: { rootSize: -1, contentSize: -1 },\n vertical: { rootSize: -1, contentSize: -1 },\n };\n rootCache.set(contentElement, contentCache);\n }\n\n const cached = contentCache[orientation];\n if (cached.rootSize === rootSize && cached.contentSize === contentSize) {\n return cached;\n }\n\n const snapshot = { rootSize, contentSize };\n contentCache[orientation] = snapshot;\n return snapshot;\n }\n\n function observe(\n rootElement: RootElement | null,\n contentElement: Element | null,\n ) {\n if (!isSupported || !rootElement || !contentElement) return;\n\n if (!observer) {\n observer = new ResizeObserver((entries) => {\n let hasChanged = false;\n\n for (const entry of entries) {\n const element = entry.target;\n const { width, height } = entry.contentRect;\n\n const currentData = elements.get(element);\n\n if (\n !currentData ||\n currentData.width !== width ||\n currentData.height !== height\n ) {\n elements.set(element, { width, height });\n hasChanged = true;\n }\n }\n\n if (hasChanged) {\n notify();\n }\n });\n }\n\n refCounts.set(rootElement, (refCounts.get(rootElement) ?? 0) + 1);\n refCounts.set(contentElement, (refCounts.get(contentElement) ?? 0) + 1);\n\n observer.observe(rootElement);\n observer.observe(contentElement);\n\n const rootRect = rootElement.getBoundingClientRect();\n const contentRect = contentElement.getBoundingClientRect();\n\n const rootData = { width: rootRect.width, height: rootRect.height };\n const contentData = {\n width: contentRect.width,\n height: contentRect.height,\n };\n\n elements.set(rootElement, rootData);\n elements.set(contentElement, contentData);\n\n if (\n rootData.width > 0 &&\n rootData.height > 0 &&\n contentData.width > 0 &&\n contentData.height > 0\n ) {\n notify();\n }\n }\n\n function unobserve(\n rootElement: RootElement | null,\n contentElement: Element | null,\n ) {\n if (!observer || !rootElement || !contentElement) return;\n\n const rootCount = (refCounts.get(rootElement) ?? 1) - 1;\n const contentCount = (refCounts.get(contentElement) ?? 1) - 1;\n\n if (rootCount <= 0) {\n observer.unobserve(rootElement);\n elements.delete(rootElement);\n refCounts.delete(rootElement);\n } else {\n refCounts.set(rootElement, rootCount);\n }\n\n if (contentCount <= 0) {\n observer.unobserve(contentElement);\n elements.delete(contentElement);\n refCounts.delete(contentElement);\n } else {\n refCounts.set(contentElement, contentCount);\n }\n }\n\n return {\n subscribe,\n getSnapshot,\n observe,\n unobserve,\n };\n}\n\nconst resizeObserverStore = createResizeObserverStore();\n\nfunction useResizeObserverStore(\n rootRef: React.RefObject<RootElement | null>,\n contentRef: React.RefObject<ContentElement | null>,\n orientation: Orientation,\n) {\n const onSubscribe = React.useCallback(\n (callback: () => void) => resizeObserverStore.subscribe(callback),\n [],\n );\n\n const getSnapshot = React.useCallback(\n () =>\n resizeObserverStore.getSnapshot(\n rootRef.current,\n contentRef.current,\n orientation,\n ),\n [rootRef, contentRef, orientation],\n );\n\n return React.useSyncExternalStore(onSubscribe, getSnapshot, getSnapshot);\n}\n\nconst DirectionContext = React.createContext<Direction | undefined>(undefined);\n\nfunction useDirection(dir?: Direction): Direction {\n const contextDir = React.useContext(DirectionContext);\n return dir ?? contextDir ?? \"ltr\";\n}\n\ninterface DivProps extends React.ComponentProps<\"div\"> {\n asChild?: boolean;\n}\n\ninterface MarqueeContextValue {\n side: Side;\n orientation: Orientation;\n dir: Direction;\n speed: number;\n loopCount: number;\n contentRef: React.RefObject<ContentElement | null>;\n rootRef: React.RefObject<RootElement | null>;\n autoFill: boolean;\n pauseOnHover: boolean;\n pauseOnKeyboard: boolean;\n reverse: boolean;\n paused: boolean;\n}\n\nconst MarqueeContext = React.createContext<MarqueeContextValue | null>(null);\n\nfunction useMarqueeContext(consumerName: string) {\n const context = React.useContext(MarqueeContext);\n if (!context) {\n throw new Error(`\\`${consumerName}\\` must be used within \\`${ROOT_NAME}\\``);\n }\n return context;\n}\n\ninterface MarqueeRootProps extends DivProps {\n side?: Side;\n dir?: Direction;\n speed?: number;\n delay?: number;\n loopCount?: number;\n gap?: string | number;\n autoFill?: boolean;\n pauseOnHover?: boolean;\n pauseOnKeyboard?: boolean;\n reverse?: boolean;\n}\n\nfunction MarqueeRoot(props: MarqueeRootProps) {\n const {\n side = \"left\",\n dir: dirProp,\n speed = 50,\n delay = 0,\n loopCount = 0,\n gap = \"1rem\",\n asChild,\n autoFill = false,\n pauseOnHover = false,\n pauseOnKeyboard = false,\n reverse = false,\n className,\n style: styleProp,\n ref,\n ...marqueeProps\n } = props;\n\n const orientation: Orientation =\n side === \"top\" || side === \"bottom\" ? \"vertical\" : \"horizontal\";\n\n const dir = useDirection(dirProp);\n\n const rootRef = React.useRef<RootElement>(null);\n const contentRef = React.useRef<ContentElement>(null);\n const composedRef = useComposedRefs(ref, rootRef);\n\n const [paused, setPaused] = React.useState(false);\n\n const onKeyDown = React.useCallback(\n (event: React.KeyboardEvent) => {\n if (pauseOnKeyboard && event.key === \" \") {\n event.preventDefault();\n setPaused((prev) => !prev);\n }\n },\n [pauseOnKeyboard],\n );\n\n const dimensions = useResizeObserverStore(rootRef, contentRef, orientation);\n\n const duration = React.useMemo(() => {\n const safeSpeed = Math.max(0.001, speed);\n\n if (!dimensions) {\n const defaultDistance = autoFill ? 1000 : 2000;\n return defaultDistance / safeSpeed;\n }\n\n const { rootSize, contentSize } = dimensions;\n\n if (autoFill) {\n const multiplier =\n contentSize < rootSize ? Math.ceil(rootSize / contentSize) : 1;\n return (contentSize * multiplier) / safeSpeed;\n } else {\n return contentSize < rootSize\n ? rootSize / safeSpeed\n : contentSize / safeSpeed;\n }\n }, [dimensions, speed, autoFill]);\n\n const style = React.useMemo<React.CSSProperties>(\n () => ({\n \"--marquee-duration\": `${duration}s`,\n \"--marquee-gap\": gap,\n \"--marquee-delay\": `${delay}s`,\n \"--marquee-loop-count\":\n loopCount === 0 || loopCount === Infinity\n ? \"infinite\"\n : loopCount.toString(),\n ...styleProp,\n }),\n [duration, gap, delay, loopCount, styleProp],\n );\n\n const contextValue = React.useMemo<MarqueeContextValue>(\n () => ({\n side,\n orientation,\n dir,\n speed,\n loopCount,\n contentRef,\n rootRef,\n autoFill,\n paused,\n pauseOnHover,\n pauseOnKeyboard,\n reverse,\n }),\n [\n side,\n orientation,\n dir,\n speed,\n loopCount,\n autoFill,\n paused,\n pauseOnHover,\n pauseOnKeyboard,\n reverse,\n ],\n );\n\n const MarqueePrimitive = asChild ? Slot : \"div\";\n\n return (\n <MarqueeContext.Provider value={contextValue}>\n <div data-slot=\"marquee-wrapper\" className=\"grid\">\n <MarqueePrimitive\n role=\"marquee\"\n aria-live=\"off\"\n data-orientation={orientation}\n data-slot=\"marquee\"\n dir={dir}\n tabIndex={pauseOnKeyboard ? 0 : undefined}\n {...marqueeProps}\n ref={composedRef}\n className={cn(\n \"relative flex overflow-hidden motion-reduce:animate-none\",\n orientation === \"vertical\" && \"h-full flex-col\",\n orientation === \"horizontal\" && \"w-full\",\n paused && \"[&_*]:[animation-play-state:paused]\",\n pauseOnHover && \"group\",\n pauseOnKeyboard &&\n \"rounded-md focus-visible:border-ring focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50\",\n className,\n )}\n style={style}\n onKeyDown={pauseOnKeyboard ? onKeyDown : undefined}\n />\n </div>\n </MarqueeContext.Provider>\n );\n}\n\nconst marqueeContentVariants = cva(\n \"flex min-w-full shrink-0 gap-(--marquee-gap)\",\n {\n variants: {\n side: {\n left: \"animate-marquee-left\",\n right: \"animate-marquee-right\",\n top: \"min-h-full min-w-auto animate-marquee-up flex-col\",\n bottom: \"min-h-full min-w-auto animate-marquee-down flex-col\",\n },\n dir: {\n ltr: \"\",\n rtl: \"\",\n },\n pauseOnHover: {\n true: \"group-hover:[animation-play-state:paused]\",\n false: \"\",\n },\n reverse: {\n true: \"[animation-direction:reverse]\",\n false: \"\",\n },\n },\n compoundVariants: [\n {\n side: \"left\",\n dir: \"rtl\",\n className: \"animate-marquee-left-rtl\",\n },\n {\n side: \"right\",\n dir: \"rtl\",\n className: \"animate-marquee-right-rtl\",\n },\n ],\n defaultVariants: {\n side: \"left\",\n dir: \"ltr\",\n pauseOnHover: false,\n reverse: false,\n },\n },\n);\n\nfunction MarqueeContent(props: DivProps) {\n const {\n className,\n asChild,\n ref,\n children,\n style: styleProp,\n ...contentProps\n } = props;\n\n const context = useMarqueeContext(CONTENT_NAME);\n const composedRef = useComposedRefs(ref, context.contentRef);\n\n const isVertical = context.orientation === \"vertical\";\n const isRtl = context.dir === \"rtl\";\n\n const dimensions = useResizeObserverStore(\n context.rootRef,\n context.contentRef,\n context.orientation,\n );\n\n React.useEffect(() => {\n if (context.rootRef.current && context.contentRef.current) {\n resizeObserverStore.observe(\n context.rootRef.current,\n context.contentRef.current,\n );\n\n return () => {\n resizeObserverStore.unobserve(\n context.rootRef.current,\n context.contentRef.current,\n );\n };\n }\n }, [context.rootRef, context.contentRef]);\n\n const multiplier = React.useMemo(() => {\n if (!context.autoFill || !dimensions) return 1;\n\n const { rootSize, contentSize } = dimensions;\n if (contentSize === 0) return 1;\n\n return contentSize < rootSize ? Math.ceil(rootSize / contentSize) : 1;\n }, [context.autoFill, dimensions]);\n\n const onMultipliedChildrenRender = React.useCallback(\n (count: number) => {\n return Array.from({ length: Math.max(0, count) }).map((_, i) => (\n <React.Fragment key={i}>{children}</React.Fragment>\n ));\n },\n [children],\n );\n\n const style = React.useMemo(\n () => ({\n ...styleProp,\n animationDuration: \"var(--marquee-duration)\",\n animationDelay: \"var(--marquee-delay)\",\n animationIterationCount: \"var(--marquee-loop-count)\",\n animationDirection: context.reverse ? \"reverse\" : \"normal\",\n }),\n [styleProp, context.reverse],\n );\n\n const ContentPrimitive = asChild ? Slot : \"div\";\n\n return (\n <>\n <ContentPrimitive\n data-orientation={context.orientation}\n data-slot=\"marquee-content\"\n {...contentProps}\n style={style}\n className={cn(\n marqueeContentVariants({\n side: context.side,\n dir: context.dir,\n pauseOnHover: context.pauseOnHover,\n reverse: context.reverse,\n className,\n }),\n isVertical && \"flex-col\",\n isVertical\n ? \"mb-(--marquee-gap)\"\n : isRtl\n ? \"ml-(--marquee-gap)\"\n : \"mr-(--marquee-gap)\",\n )}\n >\n <div\n ref={composedRef}\n className={cn(\n \"flex shrink-0 gap-(--marquee-gap)\",\n isVertical && \"flex-col\",\n )}\n >\n {children}\n </div>\n {onMultipliedChildrenRender(multiplier - 1)}\n </ContentPrimitive>\n <ContentPrimitive\n role=\"presentation\"\n aria-hidden=\"true\"\n {...contentProps}\n style={style}\n className={cn(\n marqueeContentVariants({\n side: context.side,\n dir: context.dir,\n pauseOnHover: context.pauseOnHover,\n reverse: context.reverse,\n className,\n }),\n isVertical && \"flex-col\",\n )}\n >\n {onMultipliedChildrenRender(multiplier)}\n </ContentPrimitive>\n </>\n );\n}\n\nfunction MarqueeItem(props: DivProps) {\n const { className, asChild, ...itemProps } = props;\n\n const ItemPrimitive = asChild ? Slot : \"div\";\n\n return (\n <ItemPrimitive\n data-slot=\"marquee-item\"\n {...itemProps}\n className={cn(\"shrink-0\", className)}\n />\n );\n}\n\nconst marqueeEdgeVariants = cva(\"pointer-events-none absolute z-10\", {\n variants: {\n side: {\n left: \"top-0 left-0 h-full bg-gradient-to-r from-background to-transparent\",\n right:\n \"top-0 right-0 h-full bg-gradient-to-l from-background to-transparent\",\n top: \"top-0 left-0 w-full bg-gradient-to-b from-background to-transparent\",\n bottom:\n \"bottom-0 left-0 w-full bg-gradient-to-t from-background to-transparent\",\n },\n size: {\n default: \"\",\n sm: \"\",\n lg: \"\",\n },\n },\n compoundVariants: [\n {\n side: [\"left\", \"right\"],\n size: \"default\",\n className: \"w-1/4\",\n },\n {\n side: [\"left\", \"right\"],\n size: \"sm\",\n className: \"w-1/6\",\n },\n {\n side: [\"left\", \"right\"],\n size: \"lg\",\n className: \"w-1/3\",\n },\n {\n side: [\"top\", \"bottom\"],\n size: \"default\",\n className: \"h-1/4\",\n },\n {\n side: [\"top\", \"bottom\"],\n size: \"sm\",\n className: \"h-1/6\",\n },\n {\n side: [\"top\", \"bottom\"],\n size: \"lg\",\n className: \"h-1/3\",\n },\n ],\n defaultVariants: {\n size: \"default\",\n },\n});\n\ninterface MarqueeEdgeProps\n extends VariantProps<typeof marqueeEdgeVariants>, DivProps {}\n\nfunction MarqueeEdge(props: MarqueeEdgeProps) {\n const { side, size, className, asChild, ...edgeProps } = props;\n\n const EdgePrimitive = asChild ? Slot : \"div\";\n\n return (\n <EdgePrimitive\n data-size={size}\n data-slot=\"marquee-edge\"\n {...edgeProps}\n className={cn(marqueeEdgeVariants({ side, size, className }))}\n />\n );\n}\n\nexport {\n MarqueeRoot as Root,\n MarqueeContent as Content,\n MarqueeItem as Item,\n MarqueeEdge as Edge,\n //\n MarqueeRoot as Marquee,\n MarqueeContent,\n MarqueeItem,\n MarqueeEdge,\n // types\n type MarqueeRootProps,\n type MarqueeEdgeProps,\n};\n"],"names":["ROOT_NAME","CONTENT_NAME","createResizeObserverStore","listeners","observer","elements","refCounts","isSupported","notificationScheduled","snapshotCache","notify","callback","cleanup","subscribe","getSnapshot","rootElement","contentElement","orientation","rootDims","contentDims","rootSize","contentSize","rootCache","contentCache","cached","snapshot","observe","entries","hasChanged","entry","element","width","height","currentData","rootRect","contentRect","rootData","contentData","unobserve","rootCount","contentCount","resizeObserverStore","useResizeObserverStore","rootRef","contentRef","onSubscribe","React","DirectionContext","useDirection","dir","contextDir","MarqueeContext","useMarqueeContext","consumerName","context","MarqueeRoot","props","side","dirProp","speed","delay","loopCount","gap","asChild","autoFill","pauseOnHover","pauseOnKeyboard","reverse","className","styleProp","ref","marqueeProps","composedRef","useComposedRefs","paused","setPaused","onKeyDown","event","prev","dimensions","duration","safeSpeed","multiplier","style","contextValue","MarqueePrimitive","Slot","jsx","cn","marqueeContentVariants","cva","MarqueeContent","children","contentProps","isVertical","isRtl","onMultipliedChildrenRender","count","_","i","ContentPrimitive","jsxs","Fragment","MarqueeItem","itemProps","ItemPrimitive","marqueeEdgeVariants","MarqueeEdge","size","edgeProps","EdgePrimitive"],"mappings":"oeAMMA,EAAY,UACZC,EAAe,iBAmBrB,SAASC,GAA4B,CACnC,MAAMC,MAAgB,IACtB,IAAIC,EAAkC,KACtC,MAAMC,MAAe,IACfC,MAAgB,IAChBC,EAAc,OAAO,eAAmB,IAC9C,IAAIC,EAAwB,GAE5B,MAAMC,MAAoB,QAQ1B,SAASC,GAAS,CACZF,IACJA,EAAwB,GACxB,eAAe,IAAM,CACnBA,EAAwB,GACxB,UAAWG,KAAYR,EACrBQ,EAAA,CAEJ,CAAC,EACH,CAEA,SAASC,GAAU,CACbR,IACFA,EAAS,WAAA,EACTA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QAAQ,EACtB,KAAM,KACN,UAAW,OAAA,EAEb,CACE,KAAM,CAAC,MAAO,QAAQ,EACtB,KAAM,KACN,UAAW,OAAA,CACb,EAEF,gBAAiB,CACf,KAAM,SAAA,CAEV,CAAC,EAKD,SAASiB,EAAYnD,EAAyB,CAC5C,KAAM,CAAE,KAAAC,EAAM,KAAAmD,EAAM,UAAAxC,EAAW,QAAAL,EAAS,GAAG8C,GAAcrD,EAEnDsD,EAAgB/C,EAAUuB,EAAAA,KAAO,MAEvC,OACEC,EAAAA,IAACuB,EAAA,CACC,YAAWF,EACX,YAAU,eACT,GAAGC,EACJ,UAAWrB,EAAAA,GAAGkB,EAAoB,CAAE,KAAAjD,EAAM,KAAAmD,EAAM,UAAAxC,EAAW,CAAC,CAAA,CAAA,CAGlE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),f=require("react"),c=require("./Marquee.cjs");function p(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const j=p(f);function b({items:e,fade:n,children:t,side:r="left",...i}){const s=e&&e.length>0,u=j.Children.count(t)>0;s&&u&&console.warn("Marquee: Both 'items' and 'children' are provided. 'items' will be used.");const a=r==="top"||r==="bottom"?["top","bottom"]:["left","right"];return s?o.jsxs(c.Root,{...i,side:r,children:[o.jsx(c.Content,{children:e.map((l,d)=>o.jsx(c.Item,{children:l},d))}),n&&o.jsx(c.Edge,{side:a[0]}),n&&o.jsx(c.Edge,{side:a[1]})]}):o.jsx(c.Root,{...i,side:r,children:t})}exports.MarqueeWrapper=b;
|
|
2
|
+
//# sourceMappingURL=MarqueeWrapper.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarqueeWrapper.cjs","sources":["../../../../src/components/Marquee/MarqueeWrapper.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Root, Content, Item, Edge } from \"./Marquee\";\nimport type { MarqueeRootProps } from \"./Marquee\";\n\ninterface MarqueeWrapperProps extends MarqueeRootProps {\n items?: React.ReactNode[];\n fade?: boolean;\n}\n\nfunction MarqueeWrapper({\n items,\n fade,\n children,\n side = \"left\",\n ...props\n}: MarqueeWrapperProps) {\n const hasItems = items && items.length > 0;\n const hasChildren = React.Children.count(children) > 0;\n\n if (hasItems && hasChildren) {\n console.warn(\n \"Marquee: Both 'items' and 'children' are provided. 'items' will be used.\",\n );\n }\n\n const isVertical = side === \"top\" || side === \"bottom\";\n const fadeSides = isVertical ? [\"top\", \"bottom\"] : [\"left\", \"right\"];\n\n if (hasItems) {\n return (\n <Root {...props} side={side}>\n <Content>\n {items.map((item, index) => (\n <Item key={index}>{item}</Item>\n ))}\n </Content>\n {fade && (\n <Edge side={fadeSides[0] as \"left\" | \"right\" | \"top\" | \"bottom\"} />\n )}\n {fade && (\n <Edge side={fadeSides[1] as \"left\" | \"right\" | \"top\" | \"bottom\"} />\n )}\n </Root>\n );\n }\n\n return (\n <Root {...props} side={side}>\n {children}\n </Root>\n );\n}\n\nexport { MarqueeWrapper };\nexport type { MarqueeWrapperProps };\n"],"names":["MarqueeWrapper","items","fade","children","side","props","hasItems","hasChildren","React","fadeSides","jsxs","Root","jsx","Content","item","index","Item","Edge"],"mappings":"6bAWA,SAASA,EAAe,CACtB,MAAAC,EACA,KAAAC,EACA,SAAAC,EACA,KAAAC,EAAO,OACP,GAAGC,CACL,EAAwB,CACtB,MAAMC,EAAWL,GAASA,EAAM,OAAS,EACnCM,EAAcC,EAAM,SAAS,MAAML,CAAQ,EAAI,EAEjDG,GAAYC,GACd,QAAQ,KACN,0EAAA,EAKJ,MAAME,EADaL,IAAS,OAASA,IAAS,SACf,CAAC,MAAO,QAAQ,EAAI,CAAC,OAAQ,OAAO,EAEnE,OAAIE,EAEAI,EAAAA,KAACC,EAAAA,KAAA,CAAM,GAAGN,EAAO,KAAAD,EACf,SAAA,CAAAQ,EAAAA,IAACC,EAAAA,QAAA,CACE,SAAAZ,EAAM,IAAI,CAACa,EAAMC,IAChBH,EAAAA,IAACI,EAAAA,KAAA,CAAkB,SAAAF,CAAA,EAARC,CAAa,CACzB,EACH,EACCb,GACCU,EAAAA,IAACK,OAAA,CAAK,KAAMR,EAAU,CAAC,EAA0C,EAElEP,GACCU,EAAAA,IAACK,EAAAA,KAAA,CAAK,KAAMR,EAAU,CAAC,CAAA,CAA0C,CAAA,EAErE,EAKFG,EAAAA,IAACD,EAAAA,KAAA,CAAM,GAAGN,EAAO,KAAAD,EACd,SAAAD,EACH,CAEJ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./Marquee.cjs"),t=require("./MarqueeWrapper.cjs"),r=Object.assign(t.MarqueeWrapper,{Content:e.Content,Item:e.Item,Edge:e.Edge,MarqueeContent:e.Content,MarqueeItem:e.Item,MarqueeEdge:e.Edge});exports.Marquee=r;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/Marquee/index.ts"],"sourcesContent":["import {\n Content,\n Item,\n Edge,\n //\n MarqueeContent,\n MarqueeItem,\n MarqueeEdge,\n // types\n type MarqueeRootProps,\n type MarqueeEdgeProps,\n} from \"./Marquee\";\nimport { MarqueeWrapper } from \"./MarqueeWrapper\";\n\nconst Marquee = Object.assign(MarqueeWrapper, {\n Content,\n Item,\n Edge,\n //\n MarqueeContent,\n MarqueeItem,\n MarqueeEdge,\n});\n\nexport { Marquee };\nexport type { MarqueeRootProps, MarqueeEdgeProps };\n"],"names":["Marquee","MarqueeWrapper","Content","Item","Edge","MarqueeContent","MarqueeItem","MarqueeEdge"],"mappings":"mJAcMA,EAAU,OAAO,OAAOC,iBAAgB,CAAA,QAC5CC,EAAAA,QAAA,KACAC,EAAAA,KAAA,KACAC,EAAAA,KAAA,eAEAC,EAAAA,QAAA,YACAC,EAAAA,KAAA,YACAC,EAAAA,IACF,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react/jsx-runtime"),ee=require("@dsui/ui/index"),pe=require("react");function de(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(o,e,t.get?t:{enumerable:!0,get:()=>r[e]})}}return o.default=r,Object.freeze(o)}const s=de(pe),f={RED:0,BLACK:1,SENTINEL:2},X={REMOVE:0,PRESERVE:1};function me(r,o,e){let t=r.list,l;for(;t;){if(t.index===e)return!1;if(o>t.high)break;l=t,t=t.next}return l||(r.list={index:e,high:o,next:t}),l&&(l.next={index:e,high:o,next:l.next}),!0}function ge(r,o){let e=r.list;if(e.index===o)return e.next===null?X.REMOVE:(r.list=e.next,X.PRESERVE);let t=e;for(e=e.next;e!==null;){if(e.index===o)return t.next=e.next,X.PRESERVE;t=e,e=e.next}}const y={low:0,max:0,high:0,color:f.SENTINEL,parent:void 0,right:void 0,left:void 0,list:void 0};y.parent=y;y.left=y;y.right=y;function W(r){const o=r.high;r.left===y&&r.right===y?r.max=o:r.left===y?r.max=Math.max(r.right.max,o):r.right===y?r.max=Math.max(r.left.max,o):r.max=Math.max(Math.max(r.left.max,r.right.max),o)}function Z(r){let o=r;for(;o.parent!==y;)W(o.parent),o=o.parent}function F(r,o){if(o.right===y)return;const e=o.right;o.right=e.left,e.left!==y&&(e.left.parent=o),e.parent=o.parent,o.parent===y?r.root=e:o===o.parent.left?o.parent.left=e:o.parent.right=e,e.left=o,o.parent=e,W(o),W(e)}function Y(r,o){if(o.left===y)return;const e=o.left;o.left=e.right,e.right!==y&&(e.right.parent=o),e.parent=o.parent,o.parent===y?r.root=e:o===o.parent.right?o.parent.right=e:o.parent.left=e,e.right=o,o.parent=e,W(o),W(e)}function J(r,o,e){o.parent===y?r.root=e:o===o.parent.left?o.parent.left=e:o.parent.right=e,e.parent=o.parent}function we(r,o){let e=o,t;for(;e!==y&&e.color===f.BLACK;)e===e.parent.left?(t=e.parent.right,t.color===f.RED&&(t.color=f.BLACK,e.parent.color=f.RED,F(r,e.parent),t=e.parent.right),t.left.color===f.BLACK&&t.right.color===f.BLACK?(t.color=f.RED,e=e.parent):(t.right.color===f.BLACK&&(t.left.color=f.BLACK,t.color=f.RED,Y(r,t),t=e.parent.right),t.color=e.parent.color,e.parent.color=f.BLACK,t.right.color=f.BLACK,F(r,e.parent),e=r.root)):(t=e.parent.left,t.color===f.RED&&(t.color=f.BLACK,e.parent.color=f.RED,Y(r,e.parent),t=e.parent.left),t.right.color===f.BLACK&&t.left.color===f.BLACK?(t.color=f.RED,e=e.parent):(t.left.color===f.BLACK&&(t.right.color=f.BLACK,t.color=f.RED,F(r,t),t=e.parent.left),t.color=e.parent.color,e.parent.color=f.BLACK,t.left.color=f.BLACK,Y(r,e.parent),e=r.root));e.color=f.BLACK}function ye(r){let o=r;for(;o.left!==y;)o=o.left;return o}function Ee(r,o){let e=o,t;for(;e.parent.color===f.RED;)e.parent===e.parent.parent.left?(t=e.parent.parent.right,t.color===f.RED?(e.parent.color=f.BLACK,t.color=f.BLACK,e.parent.parent.color=f.RED,e=e.parent.parent):(e===e.parent.right&&(e=e.parent,F(r,e)),e.parent.color=f.BLACK,e.parent.parent.color=f.RED,Y(r,e.parent.parent))):(t=e.parent.parent.left,t.color===f.RED?(e.parent.color=f.BLACK,t.color=f.BLACK,e.parent.parent.color=f.RED,e=e.parent.parent):(e===e.parent.left&&(e=e.parent,Y(r,e)),e.parent.color=f.BLACK,e.parent.parent.color=f.RED,F(r,e.parent.parent)));r.root.color=f.BLACK}function ve(){const r={root:y,size:0},o={};return{insert(e,t,l){let n=r.root,i=y;for(;n!==y&&(i=n,e!==i.low);)e<n.low?n=n.left:n=n.right;if(e===i.low&&i!==y){if(!me(i,t,l))return;i.high=Math.max(i.high,t),W(i),Z(i),o[l]=i,r.size++;return}const c={low:e,high:t,max:t,color:f.RED,parent:i,left:y,right:y,list:{index:l,high:t,next:null}};i===y?r.root=c:(c.low<i.low?i.left=c:i.right=c,Z(c)),Ee(r,c),o[l]=c,r.size++},remove(e){const t=o[e];if(t===void 0)return;delete o[e];const l=ge(t,e);if(l===void 0)return;if(l===X.PRESERVE){t.high=t.list.high,W(t),Z(t),r.size--;return}let n=t,i=n.color,c;t.left===y?(c=t.right,J(r,t,t.right)):t.right===y?(c=t.left,J(r,t,t.left)):(n=ye(t.right),i=n.color,c=n.right,n.parent===t?c.parent=n:(J(r,n,n.right),n.right=t.right,n.right.parent=n),J(r,t,n),n.left=t.left,n.left.parent=n,n.color=t.color),W(c),Z(c),i===f.BLACK&&we(r,c),r.size--},search(e,t,l){const n=[r.root];for(;n.length!==0;){const i=n.pop();if(i&&!(i===y||e>i.max)&&(i.left!==y&&n.push(i.left),i.right!==y&&n.push(i.right),i.low<=t&&i.high>=e)){let c=i.list;for(;c!==null;)c.high>=e&&l(c.index,i.low),c=c.next}}},get size(){return r.size}}}function Re(r,o){if(!r.length||!r[0])throw new Error("At least one constructor is required");function e(a){let p;if(typeof a=="function")try{p=new a}catch{p=new Map}else p=a;return{set(u,w){return p.set(u,w),w},get(u){return p.get(u)}}}const t=r.length,l=e(r[0]);let n,i,c,h;const g=t===1;function M(a){if(t<3){const p=a[0];return n=l.get(p),g?n:n?.get(a[1])}for(c=l,h=0;h<t;h++){const p=c.get(a[h]);if(!p)return;c=p}return c}function T(a,p){if(t<3){if(g)l.set(a[0],p);else if(n=l.get(a[0]),n)n.set(a[1],p);else{if(!r[1])throw new Error("Second constructor is required for non-single depth cache");i=e(r[1]),i.set(a[1],p),l.set(a[0],i)}return p}for(c=l,h=0;h<t-1;h++)if(i=c.get(a[h]),i)c=i;else{const u=r[h+1];if(!u)throw new Error(`Constructor at index ${h+1} is required`);i=e(u),c.set(a[h],i),c=i}return c.set(a[t-1],p),p}return(...a)=>{const p=M(a);return p===void 0?T(a,o(...a)):p}}const ie=200,se=0,be=300,Ce=2,ce=12,le=300;function Me({width:r,columnWidth:o=ie,columnGap:e=se,rowGap:t,columnCount:l,maxColumnCount:n,linear:i=!1},c=[]){const h=s.useCallback(()=>{function u(S,R){let d=0,A=S.length-1;for(;d<=A;){const E=d+A>>>1,b=S[E];if(b===R)return E;b===void 0||b<=R?d=E+1:A=E-1}return-1}const w=l||Math.min(Math.floor((r+e)/(o+e)),n||Number.POSITIVE_INFINITY)||1,B=Math.floor((r-e*(w-1))/w),z=ve(),I=new Array(w).fill(0),k=[],V=new Array(w).fill(0).map(()=>[]);for(let S=0;S<w;S++)I[S]=0,V[S]=[];return{columnCount:w,columnWidth:B,set:(S,R=0)=>{let d=0;if(i){const L=S%w;let D=I[0]??0,x=0;for(let O=0;O<I.length;O++){const m=I[O]??0;m<D&&(D=m,x=O)}const _=(I[L]??0)+R,P=D+R*2.5;d=_<=P?L:x}else for(let L=1;L<I.length;L++){const D=I[L],x=I[d];D!==void 0&&x!==void 0&&D<x&&(d=L)}const A=I[d];if(A===void 0)return;const E=A;I[d]=E+R+(t??e);const b=V[d];b&&(b.push(S),k[S]={left:d*(B+e),top:E,height:R,columnIndex:d},z.insert(E,E+R,S))},get:S=>k[S],update:S=>{const R=new Array(w);let d=0,A=0;for(;d<S.length-1;d++){const E=S[d];if(typeof E!="number")continue;const b=k[E];if(!b)continue;const L=S[++d];typeof L=="number"&&(b.height=L,z.remove(E),z.insert(b.top,b.top+b.height,E),R[b.columnIndex]=R[b.columnIndex]===void 0?E:Math.min(E,R[b.columnIndex]??E))}for(d=0;d<R.length;d++){const E=R[d];if(E===void 0)continue;const b=V[d];if(!b)continue;const L=u(b,E);if(L===-1)continue;const D=b[L];if(typeof D!="number")continue;const x=k[D];if(!(!x||typeof I[d]!="number"))for(I[d]=x.top+x.height+(t??e),A=L+1;A<b.length;A++){const P=b[A];if(typeof P!="number")continue;const O=k[P];if(!O)continue;const m=I[d];typeof m=="number"&&(O.top=m,I[d]=O.top+O.height+(t??e),z.remove(P),z.insert(O.top,O.top+O.height,P))}}},range:(S,R,d)=>z.search(S,R,(A,E)=>{const b=k[A];b&&d(A,b.left,E)}),estimateHeight:(S,R)=>{const d=Math.max(0,Math.max.apply(null,I));return S===z.size?d:d+Math.ceil((S-z.size)/w)*R},shortestColumn:()=>I.length>1?Math.min.apply(null,I):I[0]??0,size(){return z.size},all(){return k.filter(Boolean)}}},[r,o,e,t,l,n,i]),g=s.useRef(null);g.current===null&&(g.current=h());const M=s.useRef(c),T=[r,o,e,t,l,n,i],a=s.useRef(T),p=!T.every((u,w)=>a.current[w]===u);if(p||!c.every((u,w)=>M.current[w]===u)){const u=g.current,w=h();if(M.current=c,a.current=T,p){const B=u.size();for(let z=0;z<B;z++){const I=u.get(z);w.set(z,I!==void 0?I.height:0)}}g.current=w}return g.current}function Se(r){const{containerRef:o,defaultWidth:e=0,defaultHeight:t=0,delayMs:l=le}=r,n=s.useCallback(()=>typeof document>"u"?{width:e,height:t}:{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight},[e,t]),[i,c]=s.useState(n()),h=s.useRef(null),g=s.useCallback(M=>{h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{c(M)},l)},[l]);return s.useEffect(()=>{function M(){o.current?g({width:o.current.offsetWidth,height:document.documentElement.clientHeight}):g(n())}return window?.addEventListener("resize",M,{passive:!0}),window?.addEventListener("orientationchange",M),window.visualViewport?.addEventListener("resize",M),()=>{window?.removeEventListener("resize",M),window?.removeEventListener("orientationchange",M),window.visualViewport?.removeEventListener("resize",M),h.current&&clearTimeout(h.current)}},[g,o,n]),i}function oe(r){function o(...e){}return o.cancel=()=>{},o}function Ie(r){const[,o]=s.useState(0),t=s.useMemo(()=>typeof window>"u"?()=>({disconnect:()=>{},observe:()=>{},unobserve:()=>{}}):Re([WeakMap],(l,n)=>{const i=new WeakMap;oe();const c=new Map;function h(T){for(const a of T){if(!a)continue;const p=i.get(a.target);if(p===void 0)continue;let u=c.get(p);u||(u=oe(),c.set(p,u)),u(a.target)}}const g=new ResizeObserver(h),M=g.disconnect.bind(g);return g.disconnect=()=>{M();for(const[,T]of c)T.cancel()},g}),[])(r,()=>o(l=>l+1));return s.useEffect(()=>()=>t.disconnect(),[t]),t}function Le({offset:r=0,fps:o=ce}={}){const[e,t]=ze(typeof globalThis.window>"u"?0:globalThis.window.scrollY??document.documentElement.scrollTop??0,{fps:o,leading:!0}),l=s.useCallback(()=>{t(globalThis.window.scrollY??document.documentElement.scrollTop??0)},[t]);s.useEffect(()=>{if(!(typeof globalThis.window>"u"))return globalThis.window.addEventListener("scroll",l,{passive:!0}),()=>globalThis.window.removeEventListener("scroll",l)},[l]);const[n,i]=s.useState(!1),c=s.useRef(0);return s.useEffect(()=>{c.current===1&&i(!0);let h=!1;function g(T,a){const p=performance.now(),u={id:requestAnimationFrame(function w(B){B-p>=a?T():u.id=requestAnimationFrame(w)})};return u}const M=g(()=>{h||i(!1)},40+1e3/o);return c.current=1,()=>{h=!0,cancelAnimationFrame(M.id)}},[o]),{scrollTop:Math.max(0,e-r),isScrolling:n}}function ze(r,o={}){const{fps:e=30,leading:t=!1}=o,[l,n]=s.useState(r),i=s.useRef(n);i.current=n;const c=1e3/e,h=s.useRef(0),g=s.useRef(null),M=s.useCallback(()=>{g.current&&clearTimeout(g.current)},[]);s.useEffect(()=>()=>{h.current=0,M()},[M]);const T=s.useCallback(a=>{const p=typeof performance<"u"?performance:Date,w=p.now(),B=()=>{h.current=w,M(),i.current(a)},z=h.current;if(t&&z===0)return B();if(w-z>c){if(z>0)return B();h.current=w}M(),g.current=setTimeout(()=>{B(),h.current=0},c)},[t,c,M]);return[l,T]}const Q="MasonryRoot",G="MasonryViewport",re="MasonryItem",Ae={[Q]:`\`${Q}\` components must be within \`${Q}\``,[G]:`\`${G}\` components must be within \`${Q}\``,[re]:`\`${re}\` must be within \`${G}\``},ae=s.createContext(null);function Te(r){const o=s.useContext(ae);if(!o)throw new Error(Ae[r]);return o}const ue=typeof window<"u"?s.useLayoutEffect:s.useEffect;function fe(r){const{columnWidth:o=ie,columnCount:e,maxColumnCount:t,gap:l=se,itemHeight:n=be,defaultWidth:i,defaultHeight:c,overscan:h=Ce,scrollFps:g=ce,fallback:M,linear:T=!1,virtualize:a=!0,lazyLoad:p=!1,asChild:u,children:w,style:B,ref:z,...I}=r,k=typeof l=="object"?l:{column:l,row:l},V=k.column,S=k.row,R=s.useRef(null),d=ee.useComposedRefs(z,R),A=Se({containerRef:R,defaultWidth:i,defaultHeight:c,delayMs:le}),[E,b]=s.useState({offset:0,width:0});ue(()=>{if(!R.current)return;let N=0,K=R.current;do N+=K.offsetTop??0,K=K.offsetParent;while(K);(N!==E.offset||R.current.offsetWidth!==E.width)&&b({offset:N,width:R.current.offsetWidth})},[E,A]);const L=Me({width:E.width??A.width,columnWidth:o,columnGap:V,rowGap:S,columnCount:e,maxColumnCount:t,linear:T}),D=Ie(L),{scrollTop:x,isScrolling:_}=Le({offset:E.offset,fps:g}),P=s.useRef(new WeakMap).current,O=s.useRef(new Set),[m,C]=s.useState(()=>new Set),v=!a&&p,H=s.useCallback(N=>K=>{K&&(P.set(K,N),D&&D.observe(K),L.get(N)===void 0&&L.set(N,K.offsetHeight))},[P,L,D]),j=s.useCallback(N=>{let K=!1;N.forEach(ne=>{O.current.has(ne)||(O.current.add(ne),K=!0)}),K&&C(new Set(O.current))},[]),$=s.useMemo(()=>({positioner:L,resizeObserver:D,columnWidth:L.columnWidth,onItemRegister:H,scrollTop:x,windowHeight:A.height,itemHeight:n,overscan:h,fallback:M,isScrolling:_,virtualize:a,lazyLoad:v,loadedIndices:m,updateLoadedIndices:j}),[L,D,H,x,A.height,n,h,M,_,a,v,m,j]),U=u?ee.Slot:"div";return q.jsx(ae.Provider,{value:$,children:q.jsx(U,{...I,"data-slot":"masonry",ref:d,style:{position:"relative",width:"100%",height:"100%",...B},children:q.jsx(He,{children:w})})})}function He(r){const{children:o,style:e,ref:t,...l}=r,n=Te(G),[i,c]=s.useState(0),h=s.useRef(null),[g,M]=s.useState(!1);ue(()=>{M(!0)},[]);const T=s.Children.toArray(o).filter(m=>s.isValidElement(m)&&(m.type===te||m.type===he)),a=T.length,p=n.positioner.shortestColumn(),u=n.positioner.size(),w=n.windowHeight*n.overscan,B=Math.max(0,n.scrollTop-w/2),z=n.scrollTop+n.windowHeight+w/2,I=p<z&&u<a,k=[],V=s.useMemo(()=>({position:"absolute",writingMode:"horizontal-tb",visibility:"visible",width:n.columnWidth}),[n.columnWidth]),S=s.useMemo(()=>({position:"absolute",writingMode:"horizontal-tb",visibility:"visible",width:n.columnWidth,transform:n.isScrolling?"translateZ(0)":void 0,willChange:n.isScrolling?"transform":void 0}),[n.columnWidth,n.isScrolling]),R=n.virtualize?S:V,d=s.useMemo(()=>({position:"absolute",writingMode:"horizontal-tb",visibility:"hidden",width:n.columnWidth,zIndex:-1e3}),[n.columnWidth]),A=s.useRef([]);if(n.virtualize){if(n.positioner.range(B,z,(m,C,v)=>{const H=T[m];if(!H)return;const j={...R,top:v,left:C,...H.props.style};k.push(s.cloneElement(H,{key:H.key??m,ref:n.onItemRegister(m),style:j}))}),I&&g){const m=Math.min(a-u,Math.ceil((n.scrollTop+w-p)/n.itemHeight*n.positioner.columnCount));for(let C=u;C<u+m;C++){const v=T[C];if(!v)continue;const H={...d,...v.props.style};k.push(s.cloneElement(v,{key:v.key??C,ref:n.onItemRegister(C),style:H}))}}}else if(n.lazyLoad){if(u<a&&g){const C=Math.min(a-u,Math.ceil((n.scrollTop+w-p)/n.itemHeight*n.positioner.columnCount)+n.positioner.columnCount*2);for(let v=u;v<Math.max(u+C,u+1)&&!(v>=a);v++){const H=T[v];if(!H)continue;const j={...d,...H.props.style};k.push(s.cloneElement(H,{key:H.key??v,ref:n.onItemRegister(v),style:j}))}}const m=[];n.positioner.all().forEach((C,v)=>{const H=T[v];if(!H||!C)return;const $=C.top+(C.height??n.itemHeight)>=B&&C.top<=z,U=n.loadedIndices.has(v);if($&&!U&&m.push(v),$||U){const N={...R,top:C.top,left:C.left,...H.props.style};k.push(s.cloneElement(H,{key:H.key??v,ref:n.onItemRegister(v),style:N}))}}),A.current=m}else{if(u<a&&g)for(let m=u;m<a;m++){const C=T[m];if(!C)continue;const v={...d,...C.props.style};k.push(s.cloneElement(C,{key:C.key??m,ref:n.onItemRegister(m),style:v}))}n.positioner.all().forEach((m,C)=>{const v=T[C];if(!v||!m)return;const H={...R,top:m.top,left:m.left,...v.props.style};k.push(s.cloneElement(v,{key:v.key??C,ref:n.onItemRegister(C),style:H}))})}const E=n.virtualize?I&&g:u<a&&g;s.useEffect(()=>(E&&(h.current&&cancelAnimationFrame(h.current),h.current=requestAnimationFrame(()=>{c(m=>m+1)})),()=>{h.current&&cancelAnimationFrame(h.current)}),[E]);const{lazyLoad:b,updateLoadedIndices:L,scrollTop:D}=n;s.useEffect(()=>{b&&A.current.length>0&&(L(A.current),A.current=[])},[b,L,D]);const x=s.useMemo(()=>{const m=n.positioner.estimateHeight(u,n.itemHeight);if(u===a)return m;const C=a-u,v=Math.ceil(C/n.positioner.columnCount*n.itemHeight);return m+v},[n.positioner,n.itemHeight,u,a]),_=s.useMemo(()=>({position:"relative",width:"100%",maxWidth:"100%",height:Math.ceil(x),maxHeight:Math.ceil(x),...e}),[x,e]),P=s.useMemo(()=>({position:"relative",width:"100%",maxWidth:"100%",height:Math.ceil(x),maxHeight:Math.ceil(x),willChange:n.isScrolling?"contents":void 0,pointerEvents:n.isScrolling?"none":void 0,...e}),[n.isScrolling,x,e]),O=n.virtualize?P:_;return!g&&n.fallback?n.fallback:q.jsx("div",{...l,ref:t,style:O,"data-version":g?i:void 0,children:k})}function te(r){const{asChild:o,ref:e,...t}=r,l=o?ee.Slot:"div";return q.jsx(l,{"data-slot":"masonry-item",...t,ref:e})}const xe=fe,he=te;exports.Item=he;exports.MasonryItem=te;exports.MasonryRoot=fe;exports.Root=xe;
|
|
2
|
+
//# sourceMappingURL=Masonry.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Masonry.cjs","sources":["../../../../src/components/Masonry/Masonry.tsx"],"sourcesContent":["\"use client\";\n\nimport { Slot, useComposedRefs } from \"@dsui/ui/index\";\nimport * as React from \"react\";\n\nconst NODE_COLOR = {\n RED: 0,\n BLACK: 1,\n SENTINEL: 2,\n} as const;\n\nconst NODE_OPERATION = {\n REMOVE: 0,\n PRESERVE: 1,\n} as const;\n\ntype NodeColor = (typeof NODE_COLOR)[keyof typeof NODE_COLOR];\ntype NodeOperation = (typeof NODE_OPERATION)[keyof typeof NODE_OPERATION];\n\ninterface ListNode {\n index: number;\n high: number;\n next: ListNode | null;\n}\n\ninterface TreeNode {\n max: number;\n low: number;\n high: number;\n color: NodeColor;\n parent: TreeNode;\n right: TreeNode;\n left: TreeNode;\n list: ListNode;\n}\n\ninterface Tree {\n root: TreeNode;\n size: number;\n}\n\nfunction addInterval(treeNode: TreeNode, high: number, index: number): boolean {\n let node: ListNode | null = treeNode.list;\n let prevNode: ListNode | undefined;\n\n while (node) {\n if (node.index === index) return false;\n if (high > node.high) break;\n prevNode = node;\n node = node.next;\n }\n\n if (!prevNode) treeNode.list = { index, high, next: node };\n if (prevNode) prevNode.next = { index, high, next: prevNode.next };\n\n return true;\n}\n\nfunction removeInterval(\n treeNode: TreeNode,\n index: number,\n): NodeOperation | undefined {\n let node: ListNode | null = treeNode.list;\n if (node.index === index) {\n if (node.next === null) return NODE_OPERATION.REMOVE;\n treeNode.list = node.next;\n return NODE_OPERATION.PRESERVE;\n }\n\n let prevNode: ListNode | undefined = node;\n node = node.next;\n\n while (node !== null) {\n if (node.index === index) {\n prevNode.next = node.next;\n return NODE_OPERATION.PRESERVE;\n }\n prevNode = node;\n node = node.next;\n }\n}\n\nconst SENTINEL_NODE: TreeNode = {\n low: 0,\n max: 0,\n high: 0,\n color: NODE_COLOR.SENTINEL,\n parent: undefined as unknown as TreeNode,\n right: undefined as unknown as TreeNode,\n left: undefined as unknown as TreeNode,\n list: undefined as unknown as ListNode,\n};\n\nSENTINEL_NODE.parent = SENTINEL_NODE;\nSENTINEL_NODE.left = SENTINEL_NODE;\nSENTINEL_NODE.right = SENTINEL_NODE;\n\nfunction updateMax(node: TreeNode) {\n const max = node.high;\n if (node.left === SENTINEL_NODE && node.right === SENTINEL_NODE)\n node.max = max;\n else if (node.left === SENTINEL_NODE)\n node.max = Math.max(node.right.max, max);\n else if (node.right === SENTINEL_NODE)\n node.max = Math.max(node.left.max, max);\n else node.max = Math.max(Math.max(node.left.max, node.right.max), max);\n}\n\nfunction updateMaxUp(node: TreeNode) {\n let x = node;\n\n while (x.parent !== SENTINEL_NODE) {\n updateMax(x.parent);\n x = x.parent;\n }\n}\n\nfunction rotateLeft(tree: Tree, x: TreeNode) {\n if (x.right === SENTINEL_NODE) return;\n const y = x.right;\n x.right = y.left;\n if (y.left !== SENTINEL_NODE) y.left.parent = x;\n y.parent = x.parent;\n\n if (x.parent === SENTINEL_NODE) tree.root = y;\n else if (x === x.parent.left) x.parent.left = y;\n else x.parent.right = y;\n\n y.left = x;\n x.parent = y;\n\n updateMax(x);\n updateMax(y);\n}\n\nfunction rotateRight(tree: Tree, x: TreeNode) {\n if (x.left === SENTINEL_NODE) return;\n const y = x.left;\n x.left = y.right;\n if (y.right !== SENTINEL_NODE) y.right.parent = x;\n y.parent = x.parent;\n\n if (x.parent === SENTINEL_NODE) tree.root = y;\n else if (x === x.parent.right) x.parent.right = y;\n else x.parent.left = y;\n\n y.right = x;\n x.parent = y;\n\n updateMax(x);\n updateMax(y);\n}\n\nfunction replaceNode(tree: Tree, x: TreeNode, y: TreeNode) {\n if (x.parent === SENTINEL_NODE) tree.root = y;\n else if (x === x.parent.left) x.parent.left = y;\n else x.parent.right = y;\n y.parent = x.parent;\n}\n\nfunction fixRemove(tree: Tree, node: TreeNode) {\n let x = node;\n let w: TreeNode;\n\n while (x !== SENTINEL_NODE && x.color === NODE_COLOR.BLACK) {\n if (x === x.parent.left) {\n w = x.parent.right;\n\n if (w.color === NODE_COLOR.RED) {\n w.color = NODE_COLOR.BLACK;\n x.parent.color = NODE_COLOR.RED;\n rotateLeft(tree, x.parent);\n w = x.parent.right;\n }\n\n if (\n w.left.color === NODE_COLOR.BLACK &&\n w.right.color === NODE_COLOR.BLACK\n ) {\n w.color = NODE_COLOR.RED;\n x = x.parent;\n } else {\n if (w.right.color === NODE_COLOR.BLACK) {\n w.left.color = NODE_COLOR.BLACK;\n w.color = NODE_COLOR.RED;\n rotateRight(tree, w);\n w = x.parent.right;\n }\n\n w.color = x.parent.color;\n x.parent.color = NODE_COLOR.BLACK;\n w.right.color = NODE_COLOR.BLACK;\n rotateLeft(tree, x.parent);\n x = tree.root;\n }\n } else {\n w = x.parent.left;\n\n if (w.color === NODE_COLOR.RED) {\n w.color = NODE_COLOR.BLACK;\n x.parent.color = NODE_COLOR.RED;\n rotateRight(tree, x.parent);\n w = x.parent.left;\n }\n\n if (\n w.right.color === NODE_COLOR.BLACK &&\n w.left.color === NODE_COLOR.BLACK\n ) {\n w.color = NODE_COLOR.RED;\n x = x.parent;\n } else {\n if (w.left.color === NODE_COLOR.BLACK) {\n w.right.color = NODE_COLOR.BLACK;\n w.color = NODE_COLOR.RED;\n rotateLeft(tree, w);\n w = x.parent.left;\n }\n\n w.color = x.parent.color;\n x.parent.color = NODE_COLOR.BLACK;\n w.left.color = NODE_COLOR.BLACK;\n rotateRight(tree, x.parent);\n x = tree.root;\n }\n }\n }\n\n x.color = NODE_COLOR.BLACK;\n}\n\nfunction minimumTree(node: TreeNode) {\n let current = node;\n while (current.left !== SENTINEL_NODE) {\n current = current.left;\n }\n return current;\n}\n\nfunction fixInsert(tree: Tree, node: TreeNode) {\n let current = node;\n let y: TreeNode;\n\n while (current.parent.color === NODE_COLOR.RED) {\n if (current.parent === current.parent.parent.left) {\n y = current.parent.parent.right;\n\n if (y.color === NODE_COLOR.RED) {\n current.parent.color = NODE_COLOR.BLACK;\n y.color = NODE_COLOR.BLACK;\n current.parent.parent.color = NODE_COLOR.RED;\n current = current.parent.parent;\n } else {\n if (current === current.parent.right) {\n current = current.parent;\n rotateLeft(tree, current);\n }\n\n current.parent.color = NODE_COLOR.BLACK;\n current.parent.parent.color = NODE_COLOR.RED;\n rotateRight(tree, current.parent.parent);\n }\n } else {\n y = current.parent.parent.left;\n\n if (y.color === NODE_COLOR.RED) {\n current.parent.color = NODE_COLOR.BLACK;\n y.color = NODE_COLOR.BLACK;\n current.parent.parent.color = NODE_COLOR.RED;\n current = current.parent.parent;\n } else {\n if (current === current.parent.left) {\n current = current.parent;\n rotateRight(tree, current);\n }\n\n current.parent.color = NODE_COLOR.BLACK;\n current.parent.parent.color = NODE_COLOR.RED;\n rotateLeft(tree, current.parent.parent);\n }\n }\n }\n tree.root.color = NODE_COLOR.BLACK;\n}\n\ninterface IntervalTree {\n insert(low: number, high: number, index: number): void;\n remove(index: number): void;\n search(\n low: number,\n high: number,\n onCallback: (index: number, low: number) => void,\n ): void;\n size: number;\n}\n\nfunction createIntervalTree(): IntervalTree {\n const tree: Tree = {\n root: SENTINEL_NODE,\n size: 0,\n };\n\n const indexMap: Record<number, TreeNode> = {};\n\n return {\n insert(low, high, index) {\n let x: TreeNode = tree.root;\n let y: TreeNode = SENTINEL_NODE;\n\n while (x !== SENTINEL_NODE) {\n y = x;\n if (low === y.low) break;\n if (low < x.low) x = x.left;\n else x = x.right;\n }\n\n if (low === y.low && y !== SENTINEL_NODE) {\n if (!addInterval(y, high, index)) return;\n y.high = Math.max(y.high, high);\n updateMax(y);\n updateMaxUp(y);\n indexMap[index] = y;\n tree.size++;\n return;\n }\n\n const z: TreeNode = {\n low,\n high,\n max: high,\n color: NODE_COLOR.RED,\n parent: y,\n left: SENTINEL_NODE,\n right: SENTINEL_NODE,\n list: { index, high, next: null },\n };\n\n if (y === SENTINEL_NODE) {\n tree.root = z;\n } else {\n if (z.low < y.low) y.left = z;\n else y.right = z;\n updateMaxUp(z);\n }\n\n fixInsert(tree, z);\n indexMap[index] = z;\n tree.size++;\n },\n\n remove(index) {\n const z = indexMap[index];\n if (z === void 0) return;\n delete indexMap[index];\n\n const intervalResult = removeInterval(z, index);\n if (intervalResult === void 0) return;\n if (intervalResult === NODE_OPERATION.PRESERVE) {\n z.high = z.list.high;\n updateMax(z);\n updateMaxUp(z);\n tree.size--;\n return;\n }\n\n let y = z;\n let originalYColor = y.color;\n let x: TreeNode;\n\n if (z.left === SENTINEL_NODE) {\n x = z.right;\n replaceNode(tree, z, z.right);\n } else if (z.right === SENTINEL_NODE) {\n x = z.left;\n replaceNode(tree, z, z.left);\n } else {\n y = minimumTree(z.right);\n originalYColor = y.color;\n x = y.right;\n\n if (y.parent === z) {\n x.parent = y;\n } else {\n replaceNode(tree, y, y.right);\n y.right = z.right;\n y.right.parent = y;\n }\n\n replaceNode(tree, z, y);\n y.left = z.left;\n y.left.parent = y;\n y.color = z.color;\n }\n\n updateMax(x);\n updateMaxUp(x);\n\n if (originalYColor === NODE_COLOR.BLACK) fixRemove(tree, x);\n tree.size--;\n },\n\n search(low, high, onCallback) {\n const stack = [tree.root];\n while (stack.length !== 0) {\n const node = stack.pop();\n if (!node) continue;\n if (node === SENTINEL_NODE || low > node.max) continue;\n if (node.left !== SENTINEL_NODE) stack.push(node.left);\n if (node.right !== SENTINEL_NODE) stack.push(node.right);\n if (node.low <= high && node.high >= low) {\n let curr: ListNode | null = node.list;\n while (curr !== null) {\n if (curr.high >= low) onCallback(curr.index, node.low);\n curr = curr.next;\n }\n }\n }\n },\n\n get size() {\n return tree.size;\n },\n };\n}\n\ntype CacheKey = string | number | symbol;\ntype CacheConstructor = (new () => Cache) | Record<CacheKey, unknown>;\n\ninterface Cache<K = CacheKey, V = unknown> {\n set: (k: K, v: V) => V;\n get: (k: K) => V | undefined;\n}\n\nfunction onDeepMemo<T extends unknown[], U>(\n constructors: CacheConstructor[],\n fn: (...args: T) => U,\n): (...args: T) => U {\n if (!constructors.length || !constructors[0]) {\n throw new Error(\"At least one constructor is required\");\n }\n\n function createCache(obj: CacheConstructor): Cache {\n let cache: Cache;\n if (typeof obj === \"function\") {\n try {\n cache = new (obj as new () => Cache)();\n } catch (_err) {\n cache = new Map<CacheKey, unknown>();\n }\n } else {\n cache = obj as unknown as Cache;\n }\n return {\n set(k: CacheKey, v: unknown): unknown {\n cache.set(k, v);\n return v;\n },\n get(k: CacheKey): unknown | undefined {\n return cache.get(k);\n },\n };\n }\n\n const depth = constructors.length;\n const baseCache = createCache(constructors[0]);\n\n let base: Cache | undefined;\n let map: Cache | undefined;\n let node: Cache;\n let i: number;\n const one = depth === 1;\n\n function get(args: unknown[]): unknown {\n if (depth < 3) {\n const key = args[0] as CacheKey;\n base = baseCache.get(key) as Cache | undefined;\n return one ? base : base?.get(args[1] as CacheKey);\n }\n\n node = baseCache;\n for (i = 0; i < depth; i++) {\n const next = node.get(args[i] as CacheKey);\n if (!next) return undefined;\n node = next as Cache;\n }\n return node;\n }\n\n function set(args: unknown[], value: unknown): unknown {\n if (depth < 3) {\n if (one) {\n baseCache.set(args[0] as CacheKey, value);\n } else {\n base = baseCache.get(args[0] as CacheKey) as Cache | undefined;\n if (!base) {\n if (!constructors[1]) {\n throw new Error(\n \"Second constructor is required for non-single depth cache\",\n );\n }\n map = createCache(constructors[1]);\n map.set(args[1] as CacheKey, value);\n baseCache.set(args[0] as CacheKey, map);\n } else {\n base.set(args[1] as CacheKey, value);\n }\n }\n return value;\n }\n\n node = baseCache;\n for (i = 0; i < depth - 1; i++) {\n map = node.get(args[i] as CacheKey) as Cache | undefined;\n if (!map) {\n const nextConstructor = constructors[i + 1];\n if (!nextConstructor) {\n throw new Error(`Constructor at index ${i + 1} is required`);\n }\n map = createCache(nextConstructor);\n node.set(args[i] as CacheKey, map);\n node = map;\n } else {\n node = map;\n }\n }\n node.set(args[depth - 1] as CacheKey, value);\n return value;\n }\n\n return (...args: T): U => {\n const cached = get(args);\n if (cached === undefined) {\n return set(args, fn(...args)) as U;\n }\n return cached as U;\n };\n}\n\nconst COLUMN_WIDTH = 200;\nconst GAP = 0;\nconst ITEM_HEIGHT = 300;\nconst OVERSCAN = 2;\nconst SCROLL_FPS = 12;\nconst DEBOUNCE_DELAY = 300;\n\ninterface Positioner {\n columnCount: number;\n columnWidth: number;\n set: (index: number, height: number) => void;\n get: (index: number) => PositionerItem | undefined;\n update: (updates: number[]) => void;\n range: (\n low: number,\n high: number,\n onItemRender: (index: number, left: number, top: number) => void,\n ) => void;\n size: () => number;\n estimateHeight: (itemCount: number, defaultItemHeight: number) => number;\n shortestColumn: () => number;\n all: () => PositionerItem[];\n}\n\ninterface PositionerItem {\n top: number;\n left: number;\n height: number;\n columnIndex: number;\n}\n\ninterface UsePositionerOptions {\n width: number;\n columnWidth?: number;\n columnGap?: number;\n rowGap?: number;\n columnCount?: number;\n maxColumnCount?: number;\n linear?: boolean;\n}\n\nfunction usePositioner(\n {\n width,\n columnWidth = COLUMN_WIDTH,\n columnGap = GAP,\n rowGap,\n columnCount,\n maxColumnCount,\n linear = false,\n }: UsePositionerOptions,\n deps: React.DependencyList = [],\n): Positioner {\n const initPositioner = React.useCallback((): Positioner => {\n function binarySearch(a: number[], y: number): number {\n let l = 0;\n let h = a.length - 1;\n\n while (l <= h) {\n const m = (l + h) >>> 1;\n const x = a[m];\n if (x === y) return m;\n if (x === undefined || x <= y) l = m + 1;\n else h = m - 1;\n }\n\n return -1;\n }\n\n const computedColumnCount =\n columnCount ||\n Math.min(\n Math.floor((width + columnGap) / (columnWidth + columnGap)),\n maxColumnCount || Number.POSITIVE_INFINITY,\n ) ||\n 1;\n const computedColumnWidth = Math.floor(\n (width - columnGap * (computedColumnCount - 1)) / computedColumnCount,\n );\n\n const intervalTree = createIntervalTree();\n const columnHeights: number[] = new Array(computedColumnCount).fill(0);\n const items: (PositionerItem | undefined)[] = [];\n const columnItems: number[][] = new Array(computedColumnCount)\n .fill(0)\n .map(() => []);\n\n for (let i = 0; i < computedColumnCount; i++) {\n columnHeights[i] = 0;\n columnItems[i] = [];\n }\n\n return {\n columnCount: computedColumnCount,\n columnWidth: computedColumnWidth,\n set: (index: number, height = 0) => {\n let columnIndex = 0;\n\n if (linear) {\n const preferredColumn = index % computedColumnCount;\n\n let shortestHeight = columnHeights[0] ?? 0;\n let tallestHeight = shortestHeight;\n let shortestIndex = 0;\n\n for (let i = 0; i < columnHeights.length; i++) {\n const currentHeight = columnHeights[i] ?? 0;\n if (currentHeight < shortestHeight) {\n shortestHeight = currentHeight;\n shortestIndex = i;\n }\n if (currentHeight > tallestHeight) {\n tallestHeight = currentHeight;\n }\n }\n\n const preferredHeight =\n (columnHeights[preferredColumn] ?? 0) + height;\n\n const maxAllowedHeight = shortestHeight + height * 2.5;\n columnIndex =\n preferredHeight <= maxAllowedHeight\n ? preferredColumn\n : shortestIndex;\n } else {\n for (let i = 1; i < columnHeights.length; i++) {\n const currentHeight = columnHeights[i];\n const shortestHeight = columnHeights[columnIndex];\n if (\n currentHeight !== undefined &&\n shortestHeight !== undefined &&\n currentHeight < shortestHeight\n ) {\n columnIndex = i;\n }\n }\n }\n\n const columnHeight = columnHeights[columnIndex];\n if (columnHeight === undefined) return;\n\n const top = columnHeight;\n columnHeights[columnIndex] = top + height + (rowGap ?? columnGap);\n\n const columnItemsList = columnItems[columnIndex];\n if (!columnItemsList) return;\n columnItemsList.push(index);\n\n items[index] = {\n left: columnIndex * (computedColumnWidth + columnGap),\n top,\n height,\n columnIndex,\n };\n intervalTree.insert(top, top + height, index);\n },\n get: (index: number) => items[index],\n update: (updates: number[]) => {\n const columns: (number | undefined)[] = new Array(computedColumnCount);\n let i = 0;\n let j = 0;\n\n for (; i < updates.length - 1; i++) {\n const currentIndex = updates[i];\n if (typeof currentIndex !== \"number\") continue;\n\n const item = items[currentIndex];\n if (!item) continue;\n\n const nextHeight = updates[++i];\n if (typeof nextHeight !== \"number\") continue;\n\n item.height = nextHeight;\n intervalTree.remove(currentIndex);\n intervalTree.insert(item.top, item.top + item.height, currentIndex);\n columns[item.columnIndex] =\n columns[item.columnIndex] === void 0\n ? currentIndex\n : Math.min(\n currentIndex,\n columns[item.columnIndex] ?? currentIndex,\n );\n }\n\n for (i = 0; i < columns.length; i++) {\n const currentColumn = columns[i];\n if (currentColumn === void 0) continue;\n\n const itemsInColumn = columnItems[i];\n if (!itemsInColumn) continue;\n\n const startIndex = binarySearch(itemsInColumn, currentColumn);\n if (startIndex === -1) continue;\n\n const currentItemIndex = itemsInColumn[startIndex];\n if (typeof currentItemIndex !== \"number\") continue;\n\n const startItem = items[currentItemIndex];\n if (!startItem) continue;\n\n const currentHeight = columnHeights[i];\n if (typeof currentHeight !== \"number\") continue;\n\n columnHeights[i] =\n startItem.top + startItem.height + (rowGap ?? columnGap);\n\n for (j = startIndex + 1; j < itemsInColumn.length; j++) {\n const currentIndex = itemsInColumn[j];\n if (typeof currentIndex !== \"number\") continue;\n\n const item = items[currentIndex];\n if (!item) continue;\n\n const columnHeight = columnHeights[i];\n if (typeof columnHeight !== \"number\") continue;\n\n item.top = columnHeight;\n columnHeights[i] = item.top + item.height + (rowGap ?? columnGap);\n intervalTree.remove(currentIndex);\n intervalTree.insert(item.top, item.top + item.height, currentIndex);\n }\n }\n },\n range: (low, high, onItemRender) =>\n intervalTree.search(low, high, (index: number, top: number) => {\n const item = items[index];\n if (!item) return;\n onItemRender(index, item.left, top);\n }),\n estimateHeight: (itemCount, defaultItemHeight): number => {\n const tallestColumn = Math.max(0, Math.max.apply(null, columnHeights));\n\n return itemCount === intervalTree.size\n ? tallestColumn\n : tallestColumn +\n Math.ceil((itemCount - intervalTree.size) / computedColumnCount) *\n defaultItemHeight;\n },\n shortestColumn: () => {\n if (columnHeights.length > 1)\n return Math.min.apply(null, columnHeights);\n return columnHeights[0] ?? 0;\n },\n size(): number {\n return intervalTree.size;\n },\n all(): PositionerItem[] {\n return items.filter(Boolean) as PositionerItem[];\n },\n };\n }, [\n width,\n columnWidth,\n columnGap,\n rowGap,\n columnCount,\n maxColumnCount,\n linear,\n ]);\n\n const positionerRef = React.useRef<Positioner | null>(null);\n if (positionerRef.current === null) positionerRef.current = initPositioner();\n\n const prevDepsRef = React.useRef(deps);\n const opts = [\n width,\n columnWidth,\n columnGap,\n rowGap,\n columnCount,\n maxColumnCount,\n linear,\n ];\n const prevOptsRef = React.useRef(opts);\n const optsChanged = !opts.every((item, i) => prevOptsRef.current[i] === item);\n\n if (\n optsChanged ||\n !deps.every((item, i) => prevDepsRef.current[i] === item)\n ) {\n const prevPositioner = positionerRef.current;\n const positioner = initPositioner();\n prevDepsRef.current = deps;\n prevOptsRef.current = opts;\n\n if (optsChanged) {\n const cacheSize = prevPositioner.size();\n for (let index = 0; index < cacheSize; index++) {\n const pos = prevPositioner.get(index);\n positioner.set(index, pos !== void 0 ? pos.height : 0);\n }\n }\n\n positionerRef.current = positioner;\n }\n\n return positionerRef.current;\n}\n\ninterface DebouncedWindowSizeOptions {\n containerRef: React.RefObject<RootElement | null>;\n defaultWidth?: number;\n defaultHeight?: number;\n delayMs?: number;\n}\n\nfunction useDebouncedWindowSize(options: DebouncedWindowSizeOptions) {\n const {\n containerRef,\n defaultWidth = 0,\n defaultHeight = 0,\n delayMs = DEBOUNCE_DELAY,\n } = options;\n\n const getDocumentSize = React.useCallback(() => {\n if (typeof document === \"undefined\") {\n return { width: defaultWidth, height: defaultHeight };\n }\n return {\n width: document.documentElement.clientWidth,\n height: document.documentElement.clientHeight,\n };\n }, [defaultWidth, defaultHeight]);\n\n const [size, setSize] = React.useState(getDocumentSize());\n const timeoutRef = React.useRef<NodeJS.Timeout | null>(null);\n\n const setDebouncedSize = React.useCallback(\n (value: { width: number; height: number }) => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n\n timeoutRef.current = setTimeout(() => {\n setSize(value);\n }, delayMs);\n },\n [delayMs],\n );\n\n React.useEffect(() => {\n function onResize() {\n if (containerRef.current) {\n setDebouncedSize({\n width: containerRef.current.offsetWidth,\n height: document.documentElement.clientHeight,\n });\n } else {\n setDebouncedSize(getDocumentSize());\n }\n }\n\n window?.addEventListener(\"resize\", onResize, { passive: true });\n window?.addEventListener(\"orientationchange\", onResize);\n window.visualViewport?.addEventListener(\"resize\", onResize);\n\n return () => {\n window?.removeEventListener(\"resize\", onResize);\n window?.removeEventListener(\"orientationchange\", onResize);\n window.visualViewport?.removeEventListener(\"resize\", onResize);\n if (timeoutRef.current) clearTimeout(timeoutRef.current);\n };\n }, [setDebouncedSize, containerRef, getDocumentSize]);\n\n return size;\n}\n\ntype OnRafScheduleReturn<T extends unknown[]> = {\n (...args: T): void;\n cancel: () => void;\n};\n\nfunction onRafSchedule<T extends unknown[]>(\n callback: (...args: T) => void,\n): OnRafScheduleReturn<T> {\n let lastArgs: T = [] as unknown as T;\n let frameId: number | null = null;\n\n function onCallback(...args: T) {\n lastArgs = args;\n\n if (frameId)\n frameId = requestAnimationFrame(() => {\n frameId = null;\n callback(...lastArgs);\n });\n }\n\n onCallback.cancel = () => {\n if (!frameId) return;\n cancelAnimationFrame(frameId);\n frameId = null;\n };\n\n return onCallback;\n}\n\nfunction useResizeObserver(positioner: Positioner) {\n const [, setLayoutVersion] = React.useState(0);\n\n const createResizeObserver = React.useMemo(() => {\n if (typeof window === \"undefined\") {\n return () => ({\n disconnect: () => {},\n observe: () => {},\n unobserve: () => {},\n });\n }\n\n return onDeepMemo(\n [WeakMap],\n (positioner: Positioner, onUpdate: () => void) => {\n const updates: number[] = [];\n const itemMap = new WeakMap<Element, number>();\n\n const update = onRafSchedule(() => {\n if (updates.length > 0) {\n positioner.update(updates);\n onUpdate();\n }\n updates.length = 0;\n });\n\n function onItemResize(target: ItemElement) {\n const height = target.offsetHeight;\n if (height > 0) {\n const index = itemMap.get(target);\n if (index !== void 0) {\n const position = positioner.get(index);\n if (position !== void 0 && height !== position.height) {\n updates.push(index, height);\n }\n }\n }\n update();\n }\n\n const scheduledItemMap = new Map<\n number,\n OnRafScheduleReturn<[ItemElement]>\n >();\n function onResizeObserver(entries: ResizeObserverEntry[]) {\n for (const entry of entries) {\n if (!entry) continue;\n const index = itemMap.get(entry.target);\n\n if (index === void 0) continue;\n let handler = scheduledItemMap.get(index);\n if (!handler) {\n handler = onRafSchedule(onItemResize);\n scheduledItemMap.set(index, handler);\n }\n handler(entry.target as ItemElement);\n }\n }\n\n const observer = new ResizeObserver(onResizeObserver);\n const disconnect = observer.disconnect.bind(observer);\n observer.disconnect = () => {\n disconnect();\n for (const [, scheduleItem] of scheduledItemMap) {\n scheduleItem.cancel();\n }\n };\n\n return observer;\n },\n );\n }, []);\n\n const resizeObserver = createResizeObserver(positioner, () =>\n setLayoutVersion((prev) => prev + 1),\n );\n\n React.useEffect(() => () => resizeObserver.disconnect(), [resizeObserver]);\n\n return resizeObserver;\n}\n\nfunction useScroller({\n offset = 0,\n fps = SCROLL_FPS,\n}: {\n offset?: number;\n fps?: number;\n} = {}): { scrollTop: number; isScrolling: boolean } {\n const [scrollY, setScrollY] = useThrottle(\n typeof globalThis.window === \"undefined\"\n ? 0\n : (globalThis.window.scrollY ?? document.documentElement.scrollTop ?? 0),\n { fps, leading: true },\n );\n\n const onScroll = React.useCallback(() => {\n setScrollY(\n globalThis.window.scrollY ?? document.documentElement.scrollTop ?? 0,\n );\n }, [setScrollY]);\n\n React.useEffect(() => {\n if (typeof globalThis.window === \"undefined\") return;\n globalThis.window.addEventListener(\"scroll\", onScroll, { passive: true });\n\n return () => globalThis.window.removeEventListener(\"scroll\", onScroll);\n }, [onScroll]);\n\n const [isScrolling, setIsScrolling] = React.useState(false);\n const hasMountedRef = React.useRef(0);\n\n React.useEffect(() => {\n if (hasMountedRef.current === 1) setIsScrolling(true);\n let didUnsubscribe = false;\n\n function requestTimeout(fn: () => void, delay: number) {\n const start = performance.now();\n const handle = {\n id: requestAnimationFrame(function tick(timestamp) {\n if (timestamp - start >= delay) {\n fn();\n } else {\n handle.id = requestAnimationFrame(tick);\n }\n }),\n };\n return handle;\n }\n\n const timeout = requestTimeout(\n () => {\n if (didUnsubscribe) return;\n setIsScrolling(false);\n },\n 40 + 1000 / fps,\n );\n hasMountedRef.current = 1;\n return () => {\n didUnsubscribe = true;\n cancelAnimationFrame(timeout.id);\n };\n }, [fps]);\n\n return { scrollTop: Math.max(0, scrollY - offset), isScrolling };\n}\n\nfunction useThrottle<State>(\n initialState: State | (() => State),\n options: {\n fps?: number;\n leading?: boolean;\n } = {},\n): [State, React.Dispatch<React.SetStateAction<State>>] {\n const { fps = 30, leading = false } = options;\n const [state, setState] = React.useState(initialState);\n const latestSetState = React.useRef(setState);\n latestSetState.current = setState;\n\n const ms = 1000 / fps;\n const prevCountRef = React.useRef(0);\n const trailingTimeout = React.useRef<ReturnType<typeof setTimeout> | null>(\n null,\n );\n\n const clearTrailing = React.useCallback(() => {\n if (trailingTimeout.current) {\n clearTimeout(trailingTimeout.current);\n }\n }, []);\n\n React.useEffect(() => {\n return () => {\n prevCountRef.current = 0;\n clearTrailing();\n };\n }, [clearTrailing]);\n\n const throttledSetState = React.useCallback(\n (action: React.SetStateAction<State>) => {\n const perf = typeof performance !== \"undefined\" ? performance : Date;\n const now = () => perf.now();\n const rightNow = now();\n const call = () => {\n prevCountRef.current = rightNow;\n clearTrailing();\n latestSetState.current(action);\n };\n const current = prevCountRef.current;\n\n if (leading && current === 0) {\n return call();\n }\n\n if (rightNow - current > ms) {\n if (current > 0) {\n return call();\n }\n prevCountRef.current = rightNow;\n }\n\n clearTrailing();\n trailingTimeout.current = setTimeout(() => {\n call();\n prevCountRef.current = 0;\n }, ms);\n },\n [leading, ms, clearTrailing],\n );\n\n return [state, throttledSetState];\n}\n\nconst ROOT_NAME = \"MasonryRoot\";\nconst VIEWPORT_NAME = \"MasonryViewport\";\nconst ITEM_NAME = \"MasonryItem\";\n\nconst MASONRY_ERROR = {\n [ROOT_NAME]: `\\`${ROOT_NAME}\\` components must be within \\`${ROOT_NAME}\\``,\n [VIEWPORT_NAME]: `\\`${VIEWPORT_NAME}\\` components must be within \\`${ROOT_NAME}\\``,\n [ITEM_NAME]: `\\`${ITEM_NAME}\\` must be within \\`${VIEWPORT_NAME}\\``,\n} as const;\n\ninterface DivProps extends React.ComponentProps<\"div\"> {}\n\ntype RootElement = React.ComponentRef<typeof MasonryRoot>;\ntype ItemElement = React.ComponentRef<typeof MasonryItem>;\n\ninterface MasonryContextValue {\n positioner: Positioner;\n resizeObserver?: ResizeObserver;\n columnWidth: number;\n onItemRegister: (index: number) => (node: ItemElement | null) => void;\n scrollTop: number;\n windowHeight: number;\n itemHeight: number;\n overscan: number;\n isScrolling?: boolean;\n fallback?: React.ReactNode;\n virtualize: boolean;\n lazyLoad: boolean;\n loadedIndices: Set<number>;\n updateLoadedIndices: (indices: number[]) => void;\n}\n\nconst MasonryContext = React.createContext<MasonryContextValue | null>(null);\n\nfunction useMasonryContext(name: keyof typeof MASONRY_ERROR) {\n const context = React.useContext(MasonryContext);\n if (!context) {\n throw new Error(MASONRY_ERROR[name]);\n }\n return context;\n}\n\nconst useIsomorphicLayoutEffect =\n typeof window !== \"undefined\" ? React.useLayoutEffect : React.useEffect;\n\ninterface MasonryRootProps extends DivProps {\n columnWidth?: number;\n columnCount?: number;\n maxColumnCount?: number;\n gap?: number | { column: number; row: number };\n itemHeight?: number;\n defaultWidth?: number;\n defaultHeight?: number;\n overscan?: number;\n scrollFps?: number;\n fallback?: React.ReactNode;\n linear?: boolean;\n asChild?: boolean;\n /**\n * Enable/disable virtualization. When true (default), only items in viewport are rendered.\n * Set to false to render all items (useful for SEO, printing, or small lists).\n */\n virtualize?: boolean;\n /**\n * Enable lazy loading when virtualization is disabled.\n * When true, items are loaded progressively as user scrolls and remain in DOM.\n * Ignored when virtualize=true. Default: false\n */\n lazyLoad?: boolean;\n}\n\nfunction MasonryRoot(props: MasonryRootProps) {\n const {\n columnWidth = COLUMN_WIDTH,\n columnCount,\n maxColumnCount,\n gap = GAP,\n itemHeight = ITEM_HEIGHT,\n defaultWidth,\n defaultHeight,\n overscan = OVERSCAN,\n scrollFps = SCROLL_FPS,\n fallback,\n linear = false,\n virtualize = true,\n lazyLoad = false,\n asChild,\n children,\n style,\n ref,\n ...rootProps\n } = props;\n\n const gapValue = typeof gap === \"object\" ? gap : { column: gap, row: gap };\n const columnGap = gapValue.column;\n const rowGap = gapValue.row;\n\n const containerRef = React.useRef<RootElement | null>(null);\n const composedRef = useComposedRefs(ref, containerRef);\n\n const size = useDebouncedWindowSize({\n containerRef,\n defaultWidth,\n defaultHeight,\n delayMs: DEBOUNCE_DELAY,\n });\n\n const [containerPosition, setContainerPosition] = React.useState<{\n offset: number;\n width: number;\n }>({ offset: 0, width: 0 });\n\n useIsomorphicLayoutEffect(() => {\n if (!containerRef.current) return;\n\n let offset = 0;\n let container = containerRef.current;\n\n do {\n offset += container.offsetTop ?? 0;\n container = container.offsetParent as RootElement;\n } while (container);\n\n if (\n offset !== containerPosition.offset ||\n containerRef.current.offsetWidth !== containerPosition.width\n ) {\n setContainerPosition({\n offset,\n width: containerRef.current.offsetWidth,\n });\n }\n }, [containerPosition, size]);\n\n const positioner = usePositioner({\n width: containerPosition.width ?? size.width,\n columnWidth,\n columnGap,\n rowGap,\n columnCount,\n maxColumnCount,\n linear,\n });\n const resizeObserver = useResizeObserver(positioner);\n const { scrollTop, isScrolling } = useScroller({\n offset: containerPosition.offset,\n fps: scrollFps,\n });\n\n const itemMap = React.useRef(new WeakMap<ItemElement, number>()).current;\n\n // Track loaded indices for lazy loading mode\n const loadedIndicesRef = React.useRef<Set<number>>(new Set());\n const [loadedIndices, setLoadedIndices] = React.useState<Set<number>>(\n () => new Set(),\n );\n\n // Effective lazyLoad: only applies when virtualize is false\n const effectiveLazyLoad = !virtualize && lazyLoad;\n\n const onItemRegister = React.useCallback(\n (index: number) => (node: ItemElement | null) => {\n if (!node) return;\n\n itemMap.set(node, index);\n if (resizeObserver) {\n resizeObserver.observe(node);\n }\n if (positioner.get(index) === void 0) {\n positioner.set(index, node.offsetHeight);\n }\n },\n [itemMap, positioner, resizeObserver],\n );\n\n // Update loaded indices when in lazy load mode\n const updateLoadedIndices = React.useCallback((indices: number[]) => {\n let hasNew = false;\n indices.forEach((index) => {\n if (!loadedIndicesRef.current.has(index)) {\n loadedIndicesRef.current.add(index);\n hasNew = true;\n }\n });\n if (hasNew) {\n setLoadedIndices(new Set(loadedIndicesRef.current));\n }\n }, []);\n\n const contextValue = React.useMemo<MasonryContextValue>(\n () => ({\n positioner,\n resizeObserver,\n columnWidth: positioner.columnWidth,\n onItemRegister,\n scrollTop,\n windowHeight: size.height,\n itemHeight,\n overscan,\n fallback,\n isScrolling,\n virtualize,\n lazyLoad: effectiveLazyLoad,\n loadedIndices,\n updateLoadedIndices,\n }),\n [\n positioner,\n resizeObserver,\n onItemRegister,\n scrollTop,\n size.height,\n itemHeight,\n overscan,\n fallback,\n isScrolling,\n virtualize,\n effectiveLazyLoad,\n loadedIndices,\n updateLoadedIndices,\n ],\n );\n\n const RootPrimitive = asChild ? Slot : \"div\";\n\n return (\n <MasonryContext.Provider value={contextValue}>\n <RootPrimitive\n {...rootProps}\n data-slot=\"masonry\"\n ref={composedRef}\n style={{\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n ...style,\n }}\n >\n <MasonryViewport>{children}</MasonryViewport>\n </RootPrimitive>\n </MasonryContext.Provider>\n );\n}\n\ninterface MasonryItemPropsWithRef extends MasonryItemProps {\n ref: React.Ref<ItemElement | null>;\n}\n\nfunction MasonryViewport(props: DivProps) {\n const { children, style, ref, ...viewportProps } = props;\n const context = useMasonryContext(VIEWPORT_NAME);\n const [layoutVersion, setLayoutVersion] = React.useState(0);\n const rafId = React.useRef<number | null>(null);\n const [mounted, setMounted] = React.useState(false);\n\n useIsomorphicLayoutEffect(() => {\n setMounted(true);\n }, []);\n\n let startIndex = 0;\n let stopIndex: number | undefined;\n\n const validChildren = React.Children.toArray(children).filter(\n (child): child is React.ReactElement<MasonryItemPropsWithRef> =>\n React.isValidElement(child) &&\n (child.type === MasonryItem || child.type === Item),\n );\n const itemCount = validChildren.length;\n\n const shortestColumnSize = context.positioner.shortestColumn();\n const measuredCount = context.positioner.size();\n const overscanPixels = context.windowHeight * context.overscan;\n // rangeStart: scrollTop minus half overscan buffer (items above viewport)\n const rangeStart = Math.max(0, context.scrollTop - overscanPixels / 2);\n // rangeEnd: scrollTop + viewport height + half overscan buffer (items below viewport)\n const rangeEnd =\n context.scrollTop + context.windowHeight + overscanPixels / 2;\n const layoutOutdated =\n shortestColumnSize < rangeEnd && measuredCount < itemCount;\n\n const positionedChildren: React.ReactElement[] = [];\n\n // Stable style for non-virtualized mode (doesn't change on scroll)\n const stableItemStyle = React.useMemo(\n (): React.CSSProperties => ({\n position: \"absolute\",\n writingMode: \"horizontal-tb\",\n visibility: \"visible\",\n width: context.columnWidth,\n }),\n [context.columnWidth],\n );\n\n // Style with scroll optimizations for virtualized mode\n const virtualizedItemStyle = React.useMemo(\n (): React.CSSProperties => ({\n position: \"absolute\",\n writingMode: \"horizontal-tb\",\n visibility: \"visible\",\n width: context.columnWidth,\n transform: context.isScrolling ? \"translateZ(0)\" : undefined,\n willChange: context.isScrolling ? \"transform\" : undefined,\n }),\n [context.columnWidth, context.isScrolling],\n );\n\n // Use stable style when not virtualized to prevent re-renders\n const visibleItemStyle = context.virtualize\n ? virtualizedItemStyle\n : stableItemStyle;\n\n const hiddenItemStyle = React.useMemo(\n (): React.CSSProperties => ({\n position: \"absolute\",\n writingMode: \"horizontal-tb\",\n visibility: \"hidden\",\n width: context.columnWidth,\n zIndex: -1000,\n }),\n [context.columnWidth],\n );\n\n // Track indices to load for lazy load mode\n const indicesToLoadRef = React.useRef<number[]>([]);\n\n // Non-virtualized mode\n if (!context.virtualize) {\n if (context.lazyLoad) {\n // Lazy load mode: render items in viewport + previously loaded items\n // First, ensure items in viewport range are measured\n if (measuredCount < itemCount && mounted) {\n // Calculate how many items to measure based on viewport\n const batchSize = Math.min(\n itemCount - measuredCount,\n Math.ceil(\n ((context.scrollTop + overscanPixels - shortestColumnSize) /\n context.itemHeight) *\n context.positioner.columnCount,\n ) +\n context.positioner.columnCount * 2, // Extra buffer for initial load\n );\n\n for (\n let index = measuredCount;\n index < Math.max(measuredCount + batchSize, measuredCount + 1);\n index++\n ) {\n if (index >= itemCount) break;\n const child = validChildren[index];\n if (!child) continue;\n\n const itemStyle = {\n ...hiddenItemStyle,\n ...child.props.style,\n };\n\n positionedChildren.push(\n React.cloneElement(child, {\n key: child.key ?? index,\n ref: context.onItemRegister(index),\n style: itemStyle,\n }),\n );\n }\n }\n\n // Collect indices of items in current viewport range\n const newIndicesToLoad: number[] = [];\n\n // Render items that are in viewport OR have been previously loaded\n context.positioner.all().forEach((item, index) => {\n const child = validChildren[index];\n if (!child || !item) return;\n\n const itemBottom = item.top + (item.height ?? context.itemHeight);\n const isInViewport = itemBottom >= rangeStart && item.top <= rangeEnd;\n const wasLoaded = context.loadedIndices.has(index);\n\n if (isInViewport && !wasLoaded) {\n newIndicesToLoad.push(index);\n }\n\n // Render if in viewport or was previously loaded\n if (isInViewport || wasLoaded) {\n const itemStyle = {\n ...visibleItemStyle,\n top: item.top,\n left: item.left,\n ...child.props.style,\n };\n\n positionedChildren.push(\n React.cloneElement(child, {\n key: child.key ?? index,\n ref: context.onItemRegister(index),\n style: itemStyle,\n }),\n );\n }\n });\n\n // Store indices to load for effect\n indicesToLoadRef.current = newIndicesToLoad;\n } else {\n // Original non-virtualized mode: render all items\n // Ensure all items are measured first\n if (measuredCount < itemCount && mounted) {\n for (let index = measuredCount; index < itemCount; index++) {\n const child = validChildren[index];\n if (!child) continue;\n\n const itemStyle = {\n ...hiddenItemStyle,\n ...child.props.style,\n };\n\n positionedChildren.push(\n React.cloneElement(child, {\n key: child.key ?? index,\n ref: context.onItemRegister(index),\n style: itemStyle,\n }),\n );\n }\n }\n\n // Render all measured items\n context.positioner.all().forEach((item, index) => {\n const child = validChildren[index];\n if (!child || !item) return;\n\n const itemStyle = {\n ...visibleItemStyle,\n top: item.top,\n left: item.left,\n ...child.props.style,\n };\n\n positionedChildren.push(\n React.cloneElement(child, {\n key: child.key ?? index,\n ref: context.onItemRegister(index),\n style: itemStyle,\n }),\n );\n });\n }\n } else {\n // Virtualized mode: only render items in viewport\n context.positioner.range(rangeStart, rangeEnd, (index, left, top) => {\n const child = validChildren[index];\n if (!child) return;\n\n const itemStyle = {\n ...visibleItemStyle,\n top,\n left,\n ...child.props.style,\n };\n\n positionedChildren.push(\n React.cloneElement(child, {\n key: child.key ?? index,\n ref: context.onItemRegister(index),\n style: itemStyle,\n }),\n );\n\n if (stopIndex === undefined) {\n startIndex = index;\n stopIndex = index;\n } else {\n startIndex = Math.min(startIndex, index);\n stopIndex = Math.max(stopIndex, index);\n }\n });\n\n if (layoutOutdated && mounted) {\n const batchSize = Math.min(\n itemCount - measuredCount,\n Math.ceil(\n ((context.scrollTop + overscanPixels - shortestColumnSize) /\n context.itemHeight) *\n context.positioner.columnCount,\n ),\n );\n\n for (\n let index = measuredCount;\n index < measuredCount + batchSize;\n index++\n ) {\n const child = validChildren[index];\n if (!child) continue;\n\n const itemStyle = {\n ...hiddenItemStyle,\n ...child.props.style,\n };\n\n positionedChildren.push(\n React.cloneElement(child, {\n key: child.key ?? index,\n ref: context.onItemRegister(index),\n style: itemStyle,\n }),\n );\n }\n }\n }\n\n // Trigger re-layout when items need to be measured\n const needsLayout = context.virtualize\n ? layoutOutdated && mounted\n : measuredCount < itemCount && mounted;\n\n React.useEffect(() => {\n if (needsLayout) {\n if (rafId.current) {\n cancelAnimationFrame(rafId.current);\n }\n rafId.current = requestAnimationFrame(() => {\n setLayoutVersion((v) => v + 1);\n });\n }\n return () => {\n if (rafId.current) {\n cancelAnimationFrame(rafId.current);\n }\n };\n }, [needsLayout]);\n\n // Update loaded indices for lazy load mode\n const {\n lazyLoad,\n updateLoadedIndices,\n scrollTop: contextScrollTop,\n } = context;\n React.useEffect(() => {\n if (lazyLoad && indicesToLoadRef.current.length > 0) {\n updateLoadedIndices(indicesToLoadRef.current);\n indicesToLoadRef.current = [];\n }\n }, [lazyLoad, updateLoadedIndices, contextScrollTop]);\n\n const estimatedHeight = React.useMemo(() => {\n const measuredHeight = context.positioner.estimateHeight(\n measuredCount,\n context.itemHeight,\n );\n if (measuredCount === itemCount) {\n return measuredHeight;\n }\n const remainingItems = itemCount - measuredCount;\n const estimatedRemainingHeight = Math.ceil(\n (remainingItems / context.positioner.columnCount) * context.itemHeight,\n );\n return measuredHeight + estimatedRemainingHeight;\n }, [context.positioner, context.itemHeight, measuredCount, itemCount]);\n\n // Stable container style for non-virtualized mode\n const stableContainerStyle = React.useMemo(\n () => ({\n position: \"relative\" as const,\n width: \"100%\",\n maxWidth: \"100%\",\n height: Math.ceil(estimatedHeight),\n maxHeight: Math.ceil(estimatedHeight),\n ...style,\n }),\n [estimatedHeight, style],\n );\n\n // Container style with scroll optimizations for virtualized mode\n const virtualizedContainerStyle = React.useMemo(\n () => ({\n position: \"relative\" as const,\n width: \"100%\",\n maxWidth: \"100%\",\n height: Math.ceil(estimatedHeight),\n maxHeight: Math.ceil(estimatedHeight),\n willChange: context.isScrolling ? \"contents\" : undefined,\n pointerEvents: context.isScrolling ? (\"none\" as const) : undefined,\n ...style,\n }),\n [context.isScrolling, estimatedHeight, style],\n );\n\n const containerStyle = context.virtualize\n ? virtualizedContainerStyle\n : stableContainerStyle;\n\n if (!mounted && context.fallback) {\n return context.fallback;\n }\n\n return (\n <div\n {...viewportProps}\n ref={ref}\n style={containerStyle}\n data-version={mounted ? layoutVersion : undefined}\n >\n {positionedChildren}\n </div>\n );\n}\n\ninterface MasonryItemProps extends DivProps {\n asChild?: boolean;\n}\n\nfunction MasonryItem(props: MasonryItemProps) {\n const { asChild, ref, ...itemProps } = props;\n\n const ItemPrimitive = asChild ? Slot : \"div\";\n\n return <ItemPrimitive data-slot=\"masonry-item\" {...itemProps} ref={ref} />;\n}\n\nconst Root = MasonryRoot;\nconst Item = MasonryItem;\n\nexport {\n MasonryRoot,\n MasonryItem,\n //\n Root,\n Item,\n};\nexport type { MasonryRootProps, MasonryItemProps };\n"],"names":["NODE_COLOR","NODE_OPERATION","addInterval","treeNode","high","index","node","prevNode","removeInterval","SENTINEL_NODE","updateMax","max","updateMaxUp","x","rotateLeft","tree","y","rotateRight","replaceNode","fixRemove","w","minimumTree","current","fixInsert","createIntervalTree","indexMap","low","z","intervalResult","originalYColor","onCallback","stack","curr","onDeepMemo","constructors","fn","createCache","obj","cache","k","v","depth","baseCache","base","map","i","one","get","args","key","next","set","value","nextConstructor","cached","COLUMN_WIDTH","GAP","ITEM_HEIGHT","OVERSCAN","SCROLL_FPS","DEBOUNCE_DELAY","usePositioner","width","columnWidth","columnGap","rowGap","columnCount","maxColumnCount","linear","deps","initPositioner","React","binarySearch","a","l","h","m","computedColumnCount","computedColumnWidth","intervalTree","columnHeights","items","columnItems","height","columnIndex","preferredColumn","shortestHeight","shortestIndex","currentHeight","preferredHeight","maxAllowedHeight","columnHeight","top","columnItemsList","updates","columns","j","currentIndex","item","nextHeight","currentColumn","itemsInColumn","startIndex","currentItemIndex","startItem","onItemRender","itemCount","defaultItemHeight","tallestColumn","positionerRef","prevDepsRef","opts","prevOptsRef","optsChanged","prevPositioner","positioner","cacheSize","pos","useDebouncedWindowSize","options","containerRef","defaultWidth","defaultHeight","delayMs","getDocumentSize","size","setSize","timeoutRef","setDebouncedSize","onResize","onRafSchedule","callback","useResizeObserver","setLayoutVersion","resizeObserver","onUpdate","itemMap","scheduledItemMap","onResizeObserver","entries","entry","handler","observer","disconnect","scheduleItem","prev","useScroller","offset","fps","scrollY","setScrollY","useThrottle","onScroll","isScrolling","setIsScrolling","hasMountedRef","didUnsubscribe","requestTimeout","delay","start","handle","tick","timestamp","timeout","initialState","leading","state","setState","latestSetState","ms","prevCountRef","trailingTimeout","clearTrailing","throttledSetState","action","perf","rightNow","call","ROOT_NAME","VIEWPORT_NAME","ITEM_NAME","MASONRY_ERROR","MasonryContext","useMasonryContext","name","context","useIsomorphicLayoutEffect","MasonryRoot","props","gap","itemHeight","overscan","scrollFps","fallback","virtualize","lazyLoad","asChild","children","style","ref","rootProps","gapValue","composedRef","useComposedRefs","containerPosition","setContainerPosition","container","scrollTop","loadedIndicesRef","loadedIndices","setLoadedIndices","effectiveLazyLoad","onItemRegister","updateLoadedIndices","indices","hasNew","contextValue","RootPrimitive","Slot","jsx","MasonryViewport","viewportProps","layoutVersion","rafId","mounted","setMounted","validChildren","child","MasonryItem","Item","shortestColumnSize","measuredCount","overscanPixels","rangeStart","rangeEnd","layoutOutdated","positionedChildren","stableItemStyle","virtualizedItemStyle","visibleItemStyle","hiddenItemStyle","indicesToLoadRef","left","itemStyle","batchSize","newIndicesToLoad","isInViewport","wasLoaded","needsLayout","contextScrollTop","estimatedHeight","measuredHeight","remainingItems","estimatedRemainingHeight","stableContainerStyle","virtualizedContainerStyle","containerStyle","itemProps","ItemPrimitive","Root"],"mappings":"mcAKMA,EAAa,CACjB,IAAK,EACL,MAAO,EACP,SAAU,CACZ,EAEMC,EAAiB,CACrB,OAAQ,EACR,SAAU,CACZ,EA2BA,SAASC,GAAYC,EAAoBC,EAAcC,EAAwB,CAC7E,IAAIC,EAAwBH,EAAS,KACjCI,EAEJ,KAAOD,GAAM,CACX,GAAIA,EAAK,QAAUD,EAAO,MAAO,GACjC,GAAID,EAAOE,EAAK,KAAM,MACtBC,EAAWD,EACXA,EAAOA,EAAK,IACd,CAEA,OAAKC,IAAUJ,EAAS,KAAO,CAAE,MAAAE,EAAO,KAAAD,EAAM,KAAME,CAAA,GAChDC,MAAmB,KAAO,CAAE,MAAAF,EAAO,KAAAD,EAAM,KAAMG,EAAS,IAAA,GAErD,EACT,CAEA,SAASC,GACPL,EACAE,EAC2B,CAC3B,IAAIC,EAAwBH,EAAS,KACrC,GAAIG,EAAK,QAAUD,EACjB,OAAIC,EAAK,OAAS,KAAaL,EAAe,QAC9CE,EAAS,KAAOG,EAAK,KACdL,EAAe,UAGxB,I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AAGa,CAAA,GAEL,CAACb,EAAQ,YAAaiE,EAAiBpD,CAAK,CAAA,EAGxC0D,EAAiBvE,EAAQ,WAC3BsE,EACAD,EAEJ,MAAI,CAAC9B,GAAWvC,EAAQ,SACfA,EAAQ,SAIfkC,EAAAA,IAAC,MAAA,CACE,GAAGE,EACJ,IAAAtB,EACA,MAAOyD,EACP,eAAchC,EAAUF,EAAgB,OAEvC,SAAAc,CAAA,CAAA,CAGP,CAMA,SAASR,GAAYxC,EAAyB,CAC5C,KAAM,CAAE,QAAAQ,EAAS,IAAAG,EAAK,GAAG0D,GAAcrE,EAEjCsE,EAAgB9D,EAAUsB,GAAAA,KAAO,MAEvC,aAAQwC,EAAA,CAAc,YAAU,eAAgB,GAAGD,EAAW,IAAA1D,EAAU,CAC1E,CAEA,MAAM4D,GAAOxE,GACP0C,GAAOD"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");require("react");const n=require("./Masonry.cjs");function y(c){const{items:r,renderItem:t,children:i,...s}=c;return r&&r.length>0?e.jsx(n.MasonryRoot,{...s,children:r.map((o,a)=>{const u=typeof o=="object"&&o!==null&&"id"in o?String(o.id):a;return e.jsx(n.MasonryItem,{children:t?t(o,a):null},u)})}):e.jsx(n.MasonryRoot,{...s,children:i})}const l=Object.assign(y,{Item:n.MasonryItem,Root:n.MasonryRoot});exports.Masonry=l;exports.MasonryComponent=y;
|
|
2
|
+
//# sourceMappingURL=MasonryWrapper.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MasonryWrapper.cjs","sources":["../../../../src/components/Masonry/MasonryWrapper.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n MasonryRoot,\n MasonryItem,\n type MasonryRootProps,\n type MasonryItemProps,\n} from \"./Masonry\";\n\n/* -------------------------------------------------------------------------------------------------\n * Masonry - Unified wrapper component supporting both declarative and data-driven usage\n * -----------------------------------------------------------------------------------------------*/\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype MasonryItemData = any;\n\ninterface MasonryProps<T = MasonryItemData> extends Omit<\n MasonryRootProps,\n \"children\"\n> {\n /**\n * Array of items to render in the masonry grid (data-driven mode)\n * If provided, `renderItem` should also be provided\n */\n items?: T[];\n /**\n * Custom render function for each item (data-driven mode)\n * @param item - The item data\n * @param index - The index of the item\n */\n renderItem?: (_item: T, _index: number) => React.ReactNode;\n /**\n * Children elements (declarative mode)\n * Use `<Masonry.Item>` components as children\n */\n children?: React.ReactNode;\n}\n\nfunction MasonryComponent<T = MasonryItemData>(props: MasonryProps<T>) {\n const { items, renderItem, children, ...rootProps } = props;\n\n // Data-driven mode: render items using renderItem function\n if (items && items.length > 0) {\n return (\n <MasonryRoot {...rootProps}>\n {items.map((item, index) => {\n const key =\n typeof item === \"object\" && item !== null && \"id\" in item\n ? String((item as { id: unknown }).id)\n : index;\n return (\n <MasonryItem key={key}>\n {renderItem ? renderItem(item, index) : null}\n </MasonryItem>\n );\n })}\n </MasonryRoot>\n );\n }\n\n // Declarative mode: render children directly\n return <MasonryRoot {...rootProps}>{children}</MasonryRoot>;\n}\n\n/* -------------------------------------------------------------------------------------------------\n * Exports\n * -----------------------------------------------------------------------------------------------*/\n\n// Re-export MasonryItem as Item for Masonry.Item usage\nconst Masonry = Object.assign(MasonryComponent, {\n Item: MasonryItem,\n Root: MasonryRoot,\n});\n\nexport { Masonry, MasonryComponent };\nexport type { MasonryProps, MasonryItemProps };\n"],"names":["MasonryComponent","props","items","renderItem","children","rootProps","jsx","MasonryRoot","item","index","key","MasonryItem","Masonry"],"mappings":"uKAuCA,SAASA,EAAsCC,EAAwB,CACrE,KAAM,CAAE,MAAAC,EAAO,WAAAC,EAAY,SAAAC,EAAU,GAAGC,GAAcJ,EAGtD,OAAIC,GAASA,EAAM,OAAS,EAExBI,EAAAA,IAACC,eAAa,GAAGF,EACd,WAAM,IAAI,CAACG,EAAMC,IAAU,CAC1B,MAAMC,EACJ,OAAOF,GAAS,UAAYA,IAAS,MAAQ,OAAQA,EACjD,OAAQA,EAAyB,EAAE,EACnCC,EACN,OACEH,MAACK,EAAAA,aACE,SAAAR,EAAaA,EAAWK,EAAMC,CAAK,EAAI,MADxBC,CAElB,CAEJ,CAAC,CAAA,CACH,EAKGJ,EAAAA,IAACC,EAAAA,YAAA,CAAa,GAAGF,EAAY,SAAAD,CAAA,CAAS,CAC/C,CAOA,MAAMQ,EAAU,OAAO,OAAOZ,EAAkB,CAC9C,KAAMW,EAAAA,YACN,KAAMJ,EAAAA,WACR,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),A=require("react"),t=require("@dsui/ui/components/pagination"),T=require("@dsui/ui/lib/utils"),H=require("../../utils/animations.cjs"),b=require("lucide-react"),O=require("@dsui/ui/components/popover"),v=require("@dsui/ui/components/command");function $(i){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const r in i)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(i,r);Object.defineProperty(l,r,n.get?n:{enumerable:!0,get:()=>i[r]})}}return l.default=i,Object.freeze(l)}const C=$(A),W=(i,l,r)=>{if(i<=r)return Array.from({length:i},(a,f)=>f+1);const n=[],o=Math.floor(r/2);let c=Math.max(1,l-o);const s=Math.min(i,c+r-1);s-c+1<r&&(c=Math.max(1,s-r+1)),c>1&&(n.push(1),c>2&&n.push("..."));for(let a=c;a<=s;a++)n.push(a);return s<i&&(s<i-1&&n.push("..."),n.push(i)),n},B=({position:i,onJumpPrevious:l,onJumpNext:r,color:n,size:o,previousText:c,nextText:s,jumpType:a="jump",total:f,onPageChange:m})=>{const[h,g]=C.useState(!1);return a==="select"?e.jsxs(O.Popover,{open:h,onOpenChange:g,children:[e.jsx(O.PopoverTrigger,{asChild:!0,children:e.jsx(t.PaginationItem,{children:e.jsx(t.PaginationEllipsis,{size:o,color:n})})}),e.jsx(O.PopoverContent,{className:"w-40 p-0",children:e.jsxs(v.Command,{children:[e.jsx(v.CommandInput,{placeholder:"Search pages..."}),e.jsx(v.CommandList,{children:f&&Array.from({length:f},(u,j)=>j+1).map(u=>e.jsxs(v.CommandItem,{onSelect:()=>{m?.(u),g(!1)},children:["Page ",u]},u))})]})})]}):e.jsx(t.PaginationItem,{className:"group",children:i==="before"?e.jsxs(t.PaginationPrevious,{href:"#",onClick:u=>{u.preventDefault(),l?.()},color:n,size:o,hideIcon:!0,className:"peer",children:[e.jsx("span",{className:"hidden group-hover:block leading-none",children:c}),e.jsx(b.MoreHorizontalIcon,{className:"group-hover:hidden cursor-pointer"})]}):e.jsxs(t.PaginationNext,{href:"#",onClick:u=>{u.preventDefault(),r?.()},color:n,size:o,hideIcon:!0,children:[e.jsx("span",{className:"hidden group-hover:block leading-none",children:s}),e.jsx(b.MoreHorizontalIcon,{className:"group-hover:hidden cursor-pointer"})]})})},M=C.forwardRef(({className:i,animation:l,total:r,currentPage:n=1,onPageChange:o,showPreviousNext:c=!0,color:s="muted",size:a,maxPages:f=5,previousText:m,nextText:h,jumpOnEllipsis:g=!1,jumpType:u="jump",children:j,...P},q)=>{const y=C.useMemo(()=>l?H.animationEffect({animation:l,children:j,className:i,rootClassName:"",variantType:void 0,...P}):null,[l,P,i,j]),S=()=>m===!1?!1:m===!0?"Previous":m,D=()=>h===!1?!1:h===!0?"Next":h,E=()=>{const p=Math.max(1,n-f);o?.(p)},R=()=>{const p=Math.min(r,n+f);o?.(p)},J=()=>{if(!r)return j;const p=W(r,n,f);return e.jsxs(t.PaginationContent,{children:[c&&e.jsx(t.PaginationItem,{className:"flex justify-center",children:e.jsx(t.PaginationPrevious,{href:"#",onClick:d=>{d.preventDefault(),n>1&&o?.(n-1)},color:s,size:a,children:S()})}),p.map((d,N)=>{if(d==="..."){if(g){const I=N,_=p.findIndex(k=>typeof k=="number"&&k===n),w=I<_?"before":"after";return e.jsx(B,{position:w,onJumpPrevious:E,onJumpNext:R,color:s,size:a,previousText:e.jsx(b.ChevronsLeft,{}),nextText:e.jsx(b.ChevronsRight,{}),jumpType:u,total:r,onPageChange:o},`ellipsis-${N}`)}return e.jsx(t.PaginationItem,{children:e.jsx(t.PaginationEllipsis,{size:a,color:s})},`ellipsis-${N}`)}const x=d,L=x===n;return e.jsx(t.PaginationItem,{children:e.jsx(t.PaginationLink,{href:"#",isActive:L,onClick:I=>{I.preventDefault(),o?.(x)},color:s,size:a,children:x})},x)}),c&&e.jsx(t.PaginationItem,{className:"flex justify-center",children:e.jsx(t.PaginationNext,{href:"#",onClick:d=>{d.preventDefault(),n<r&&o?.(n+1)},color:s,size:a,children:D()})})]})};return e.jsx(t.Pagination,{ref:q,className:T.cn(i,y?.className),style:{...P.style||{},...y?.style||{}},...P,children:y?.children??J()})});M.displayName="Pagination";Object.defineProperty(exports,"PaginationContent",{enumerable:!0,get:()=>t.PaginationContent});Object.defineProperty(exports,"PaginationEllipsis",{enumerable:!0,get:()=>t.PaginationEllipsis});Object.defineProperty(exports,"PaginationItem",{enumerable:!0,get:()=>t.PaginationItem});Object.defineProperty(exports,"PaginationLink",{enumerable:!0,get:()=>t.PaginationLink});Object.defineProperty(exports,"PaginationNext",{enumerable:!0,get:()=>t.PaginationNext});Object.defineProperty(exports,"PaginationPrevious",{enumerable:!0,get:()=>t.PaginationPrevious});exports.Pagination=M;
|
|
2
|
+
//# sourceMappingURL=Pagination.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pagination.cjs","sources":["../../../../src/components/Pagination/Pagination.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {\n Pagination as SPagination,\n PaginationContent,\n PaginationItem,\n PaginationLink,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n} from \"@dsui/ui/components/pagination\";\nimport { cn } from \"@dsui/ui/lib/utils\";\nimport type { ButtonAnimation } from \"@/types/variables\";\nimport { animationEffect } from \"@/utils/animations\";\nimport { ChevronsLeft, ChevronsRight, MoreHorizontalIcon } from \"lucide-react\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"@dsui/ui/components/popover\";\nimport {\n Command,\n CommandInput,\n CommandList,\n CommandItem,\n} from \"@dsui/ui/components/command\";\nimport type Button from \"../Button\";\n\ntype PaginationItemType =\n | number\n | \"...\"\n | { page: number; isActive?: boolean; disabled?: boolean };\n\ntype PaginationWrapperProps = React.ComponentProps<typeof SPagination> & {\n animation?: ButtonAnimation;\n total?: number;\n currentPage?: number;\n onPageChange?: (page: number) => void;\n showPreviousNext?: boolean;\n maxPages?: number; // số pages hiển thị\n previousText?: string | boolean;\n nextText?: string | boolean;\n jumpOnEllipsis?: boolean; // khi hover vào ellipsis thì hiện thành nút next/previous\n jumpType?: \"jump\" | \"select\"; // jump type for ellipsis interaction\n} & Pick<React.ComponentProps<typeof Button>, \"size\" | \"color\">;\n\ntype AnimResult = {\n className?: string;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n};\n\nconst generatePages = (\n total: number,\n currentPage: number,\n maxPages: number,\n): PaginationItemType[] => {\n if (total <= maxPages) {\n return Array.from({ length: total }, (_, i) => i + 1);\n }\n\n const pages: PaginationItemType[] = [];\n const halfSize = Math.floor(maxPages / 2);\n let start = Math.max(1, currentPage - halfSize);\n const end = Math.min(total, start + maxPages - 1);\n\n if (end - start + 1 < maxPages) {\n start = Math.max(1, end - maxPages + 1);\n }\n\n // Add first page and ellipsis if needed\n if (start > 1) {\n pages.push(1);\n if (start > 2) {\n pages.push(\"...\");\n }\n }\n\n // Add middle pages\n for (let i = start; i <= end; i++) {\n pages.push(i);\n }\n\n // Add ellipsis and last page if needed\n if (end < total) {\n if (end < total - 1) {\n pages.push(\"...\");\n }\n pages.push(total);\n }\n\n return pages;\n};\n\nconst PaginationEllipsisWithJump = ({\n position,\n onJumpPrevious,\n onJumpNext,\n color,\n size,\n previousText,\n nextText,\n jumpType = \"jump\",\n total,\n onPageChange,\n}: {\n position: \"before\" | \"after\";\n onJumpPrevious?: () => void;\n onJumpNext?: () => void;\n color?: PaginationWrapperProps[\"color\"];\n size?: PaginationWrapperProps[\"size\"];\n previousText?: React.ReactNode;\n nextText?: React.ReactNode;\n jumpType?: \"jump\" | \"select\";\n total?: number;\n onPageChange?: (page: number) => void;\n}) => {\n const [popoverOpen, setPopoverOpen] = React.useState(false);\n\n if (jumpType === \"select\") {\n return (\n <Popover open={popoverOpen} onOpenChange={setPopoverOpen}>\n <PopoverTrigger asChild>\n <PaginationItem>\n <PaginationEllipsis size={size} color={color} />\n </PaginationItem>\n </PopoverTrigger>\n <PopoverContent className=\"w-40 p-0\">\n <Command>\n <CommandInput placeholder=\"Search pages...\" />\n <CommandList>\n {total &&\n Array.from({ length: total }, (_, i) => i + 1).map((page) => (\n <CommandItem\n key={page}\n onSelect={() => {\n onPageChange?.(page);\n setPopoverOpen(false);\n }}\n >\n Page {page}\n </CommandItem>\n ))}\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n );\n }\n\n return (\n <PaginationItem className=\"group\">\n {position === \"before\" ? (\n <PaginationPrevious\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n onJumpPrevious?.();\n }}\n color={color}\n size={size}\n hideIcon\n className=\"peer\"\n >\n <span className=\"hidden group-hover:block leading-none\">\n {previousText}\n </span>\n <MoreHorizontalIcon className=\"group-hover:hidden cursor-pointer\" />\n </PaginationPrevious>\n ) : (\n <PaginationNext\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n onJumpNext?.();\n }}\n color={color}\n size={size}\n hideIcon\n >\n <span className=\"hidden group-hover:block leading-none\">\n {nextText}\n </span>\n <MoreHorizontalIcon className=\"group-hover:hidden cursor-pointer\" />\n </PaginationNext>\n )}\n </PaginationItem>\n );\n};\n\nconst Pagination = React.forwardRef<HTMLElement, PaginationWrapperProps>(\n (\n {\n className,\n animation,\n total,\n currentPage = 1,\n onPageChange,\n showPreviousNext = true,\n color = \"muted\",\n size,\n maxPages = 5,\n previousText,\n nextText,\n jumpOnEllipsis = false,\n jumpType = \"jump\",\n children,\n ...props\n },\n ref,\n ) => {\n const paginationAnimation = React.useMemo<AnimResult | null>(() => {\n if (!animation) return null;\n return animationEffect<ButtonAnimation, string | undefined>({\n animation,\n children,\n className,\n rootClassName: \"\",\n variantType: undefined,\n ...props,\n });\n }, [animation, props, className, children]);\n\n const getPreviousText = () => {\n if (previousText === false) return false;\n if (previousText === true) return \"Previous\";\n return previousText;\n };\n\n const getNextText = () => {\n if (nextText === false) return false;\n if (nextText === true) return \"Next\";\n return nextText;\n };\n\n const handleJumpPrevious = () => {\n const newPage = Math.max(1, currentPage - maxPages);\n onPageChange?.(newPage);\n };\n\n const handleJumpNext = () => {\n const newPage = Math.min(total!, currentPage + maxPages);\n onPageChange?.(newPage);\n };\n\n const renderItems = () => {\n if (!total) return children;\n\n const pages = generatePages(total, currentPage, maxPages);\n\n return (\n <PaginationContent>\n {showPreviousNext && (\n <PaginationItem className=\"flex justify-center\">\n <PaginationPrevious\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n if (currentPage > 1) onPageChange?.(currentPage - 1);\n }}\n color={color}\n size={size}\n >\n {getPreviousText()}\n </PaginationPrevious>\n </PaginationItem>\n )}\n {pages.map((item, index) => {\n if (item === \"...\") {\n if (jumpOnEllipsis) {\n // Determine if this ellipsis is before or after the active page\n const ellipsisIndex = index;\n const activePageIndex = pages.findIndex(\n (page) => typeof page === \"number\" && page === currentPage,\n );\n const position =\n ellipsisIndex < activePageIndex ? \"before\" : \"after\";\n\n return (\n <PaginationEllipsisWithJump\n key={`ellipsis-${index}`}\n position={position}\n onJumpPrevious={handleJumpPrevious}\n onJumpNext={handleJumpNext}\n color={color}\n size={size}\n previousText={<ChevronsLeft />}\n nextText={<ChevronsRight />}\n jumpType={jumpType}\n total={total}\n onPageChange={onPageChange}\n />\n );\n }\n return (\n <PaginationItem key={`ellipsis-${index}`}>\n <PaginationEllipsis size={size} color={color} />\n </PaginationItem>\n );\n }\n\n const page = item as number;\n const isActive = page === currentPage;\n\n return (\n <PaginationItem key={page}>\n <PaginationLink\n href=\"#\"\n isActive={isActive}\n onClick={(e) => {\n e.preventDefault();\n onPageChange?.(page);\n }}\n color={color}\n size={size}\n >\n {page}\n </PaginationLink>\n </PaginationItem>\n );\n })}\n {showPreviousNext && (\n <PaginationItem className=\"flex justify-center\">\n <PaginationNext\n href=\"#\"\n onClick={(e) => {\n e.preventDefault();\n if (currentPage < total) onPageChange?.(currentPage + 1);\n }}\n color={color}\n size={size}\n >\n {getNextText()}\n </PaginationNext>\n </PaginationItem>\n )}\n </PaginationContent>\n );\n };\n\n return (\n <SPagination\n ref={ref}\n className={cn(className, paginationAnimation?.className)}\n style={{\n ...(props.style || {}),\n ...(paginationAnimation?.style || {}),\n }}\n {...props}\n >\n {paginationAnimation?.children ?? renderItems()}\n </SPagination>\n );\n },\n);\n\nPagination.displayName = \"Pagination\";\n\nexport {\n Pagination,\n PaginationContent,\n PaginationItem,\n PaginationLink,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n type PaginationWrapperProps,\n type PaginationItemType,\n};\n"],"names":["generatePages","total","currentPage","maxPages","_","i","pages","halfSize","start","end","PaginationEllipsisWithJump","position","onJumpPrevious","onJumpNext","color","size","previousText","nextText","jumpType","onPageChange","popoverOpen","setPopoverOpen","React","jsxs","Popover","jsx","PopoverTrigger","PaginationItem","PaginationEllipsis","PopoverContent","Command","CommandInput","CommandList","page","CommandItem","PaginationPrevious","e","MoreHorizontalIcon","PaginationNext","Pagination","className","animation","showPreviousNext","jumpOnEllipsis","children","props","ref","paginationAnimation","animationEffect","getPreviousText","getNextText","handleJumpPrevious","newPage","handleJumpNext","renderItems","PaginationContent","item","index","ellipsisIndex","activePageIndex","ChevronsLeft","ChevronsRight","isActive","PaginationLink","SPagination","cn"],"mappings":"koBAmDMA,EAAgB,CACpBC,EACAC,EACAC,IACyB,CACzB,GAAIF,GAASE,EACX,OAAO,MAA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EAAAA,aAAA,EAAa,EAC5B,eAAWC,EAAAA,cAAA,EAAc,EACzB,SAAA3C,EACA,MAAAjB,EACA,aAAAkB,CAAA,EAVK,YAAYsC,CAAK,EAAA,CAa5B,CACA,OACEhC,EAAAA,IAACE,EAAAA,gBACC,SAAAF,EAAAA,IAACG,EAAAA,mBAAA,CAAmB,KAAAb,EAAY,MAAAD,CAAA,CAAc,CAAA,EAD3B,YAAY2C,CAAK,EAEtC,CAEJ,CAEA,MAAMxB,EAAOuB,EACPM,EAAW7B,IAAS/B,EAE1B,aACGyB,EAAAA,eAAA,CACC,SAAAF,EAAAA,IAACsC,EAAAA,eAAA,CACC,KAAK,IACL,SAAAD,EACA,QAAU1B,GAAM,CACdA,EAAE,eAAA,EACFjB,IAAec,CAAI,CACrB,EACA,MAAAnB,EACA,KAAAC,EAEC,SAAAkB,CAAA,CAAA,GAXgBA,CAarB,CAEJ,CAAC,EACAS,GACCjB,EAAAA,IAACE,EAAAA,eAAA,CAAe,UAAU,sBACxB,SAAAF,EAAAA,IAACa,EAAAA,eAAA,CACC,KAAK,IACL,QAAUF,GAAM,CACdA,EAAE,eAAA,EACElC,EAAcD,GAAOkB,IAAejB,EAAc,CAAC,CACzD,EACA,MAAAY,EACA,KAAAC,EAEC,SAAAmC,EAAA,CAAY,CAAA,CACf,CACF,CAAA,EAEJ,CAEJ,EAEA,OACEzB,EAAAA,IAACuC,EAAAA,WAAA,CACC,IAAAlB,EACA,UAAWmB,EAAAA,GAAGzB,EAAWO,GAAqB,SAAS,EACvD,MAAO,CACL,GAAIF,EAAM,OAAS,CAAA,EACnB,GAAIE,GAAqB,OAAS,CAAA,CAAC,EAEpC,GAAGF,EAEH,SAAAE,GAAqB,UAAYO,EAAA,CAAY,CAAA,CAGpD,CACF,EAEAf,EAAW,YAAc"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./Pagination.cjs"),i=require("@dsui/ui/components/pagination"),t=Object.assign(n.Pagination,{Content:i.PaginationContent,Item:i.PaginationItem,Link:i.PaginationLink,Previous:i.PaginationPrevious,Next:i.PaginationNext,Ellipsis:i.PaginationEllipsis});exports.Pagination=t;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/Pagination/index.ts"],"sourcesContent":["import {\n Pagination as PaginationWrapper,\n PaginationContent,\n PaginationItem,\n PaginationLink,\n PaginationPrevious,\n PaginationNext,\n PaginationEllipsis,\n type PaginationWrapperProps,\n type PaginationItemType,\n} from \"./Pagination\";\n\nconst Pagination = Object.assign(PaginationWrapper, {\n Content: PaginationContent,\n Item: PaginationItem,\n Link: PaginationLink,\n Previous: PaginationPrevious,\n Next: PaginationNext,\n Ellipsis: PaginationEllipsis,\n});\n\nexport { Pagination, type PaginationWrapperProps, type PaginationItemType };\n"],"names":["Pagination","PaginationWrapper","PaginationContent","PaginationItem","PaginationLink","PaginationPrevious","PaginationNext","PaginationEllipsis"],"mappings":"gKAYMA,EAAa,OAAO,OAAOC,aAAmB,CAClD,QAASC,EAAAA,kBACT,KAAMC,EAAAA,eACN,KAAMC,EAAAA,eACN,SAAUC,EAAAA,mBACV,KAAMC,EAAAA,eACN,SAAUC,EAAAA,kBACZ,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),C=require("react"),r=require("@dsui/ui/components/popover"),s=require("@dsui/ui/lib/utils"),o=C.forwardRef((n,a)=>{const{open:i,defaultOpen:l,onOpenChange:c,modal:u=!1,children:d,trigger:g,content:p,side:m="bottom",align:f="center",sideOffset:v=4,alignOffset:h,className:N,contentClassName:P,triggerClassName:j}=n,t=g||d;return e.jsxs(r.Popover,{open:i,defaultOpen:l,onOpenChange:c,modal:u,children:[t&&e.jsx(r.PopoverTrigger,{asChild:!0,className:s.cn(j),children:t}),e.jsx(r.PopoverContent,{ref:a,side:m,align:f,sideOffset:v,alignOffset:h,className:s.cn(N,P),children:p})]})});o.displayName="Popover";exports.default=o;
|
|
2
|
+
//# sourceMappingURL=Popover.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Popover.cjs","sources":["../../../../src/components/Popover/Popover.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n Popover as SPopover,\n PopoverTrigger as SPopoverTrigger,\n PopoverContent as SPopoverContent,\n} from \"@dsui/ui/components/popover\";\nimport { cn } from \"@dsui/ui/lib/utils\";\n\nexport type PopoverSide = \"top\" | \"right\" | \"bottom\" | \"left\";\nexport type PopoverAlign = \"start\" | \"center\" | \"end\";\n\nexport interface PopoverProps {\n // Core props\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n modal?: boolean;\n\n // Content\n children?: React.ReactNode;\n trigger?: React.ReactNode;\n content?: React.ReactNode;\n\n // Layout\n side?: PopoverSide;\n align?: PopoverAlign;\n sideOffset?: number;\n alignOffset?: number;\n\n // Styling\n className?: string;\n contentClassName?: string;\n triggerClassName?: string;\n}\n\nconst Popover = React.forwardRef<HTMLDivElement, PopoverProps>((props, ref) => {\n const {\n open,\n defaultOpen,\n onOpenChange,\n modal = false,\n children,\n trigger,\n content,\n side = \"bottom\",\n align = \"center\",\n sideOffset = 4,\n alignOffset,\n className,\n contentClassName,\n triggerClassName,\n } = props;\n\n // If children are provided (compound pattern), render them directly\n // if (children) {\n // return (\n // <SPopover\n // open={open}\n // defaultOpen={defaultOpen}\n // onOpenChange={onOpenChange}\n // modal={modal}\n // >\n // {children}\n // </SPopover>\n // );\n // }\n\n // Fallback to props-based pattern\n const triggerElement = trigger || children;\n\n return (\n <SPopover\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n modal={modal}\n >\n {triggerElement && (\n <SPopoverTrigger asChild className={cn(triggerClassName)}>\n {triggerElement}\n </SPopoverTrigger>\n )}\n <SPopoverContent\n ref={ref}\n side={side}\n align={align}\n sideOffset={sideOffset}\n alignOffset={alignOffset}\n className={cn(className, contentClassName)}\n >\n {content}\n </SPopoverContent>\n </SPopover>\n );\n});\n\nPopover.displayName = \"Popover\";\n\nexport default Popover;\n"],"names":["Popover","React","props","ref","open","defaultOpen","onOpenChange","modal","children","trigger","content","side","align","sideOffset","alignOffset","className","contentClassName","triggerClassName","triggerElement","jsxs","SPopover","jsx","SPopoverTrigger","cn","SPopoverContent"],"mappings":"6OAmCMA,EAAUC,EAAM,WAAyC,CAACC,EAAOC,IAAQ,CAC7E,KAAM,CACJ,KAAAC,EACA,YAAAC,EACA,aAAAC,EACA,MAAAC,EAAQ,GACR,SAAAC,EACA,QAAAC,EACA,QAAAC,EACA,KAAAC,EAAO,SACP,MAAAC,EAAQ,SACR,WAAAC,EAAa,EACb,YAAAC,EACA,UAAAC,EACA,iBAAAC,EACA,iBAAAC,CAAA,EACEf,EAiBEgB,EAAiBT,GAAWD,EAElC,OACEW,EAAAA,KAACC,EAAAA,QAAA,CACC,KAAAhB,EACA,YAAAC,EACA,aAAAC,EACA,MAAAC,EAEC,SAAA,CAAAW,GACCG,EAAAA,IAACC,kBAAgB,QAAO,GAAC,UAAWC,EAAAA,GAAGN,CAAgB,EACpD,SAAAC,CAAA,CACH,EAEFG,EAAAA,IAACG,EAAAA,eAAA,CACC,IAAArB,EACA,KAAAQ,EACA,MAAAC,EACA,WAAAC,EACA,YAAAC,EACA,UAAWS,EAAAA,GAAGR,EAAWC,CAAgB,EAExC,SAAAN,CAAA,CAAA,CACH,CAAA,CAAA,CAGN,CAAC,EAEDV,EAAQ,YAAc"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/Popover/index.ts"],"sourcesContent":["import PopoverWrapper, { type PopoverProps } from \"./Popover\";\n// import { PopoverTrigger, PopoverContent } from \"@dsui/ui/components/popover\";\n\nconst Popover = Object.assign(PopoverWrapper, {\n // Trigger: PopoverTrigger,\n // Content: PopoverContent,\n});\n\nexport { Popover };\nexport type { PopoverProps };\n"],"names":["Popover","PopoverWrapper"],"mappings":"iHAGMA,EAAU,OAAO,OAAOC,UAAgB,CAG9C,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var F=Object.create;var O=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,J=Object.prototype.hasOwnProperty;var W=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of B(e))!J.call(t,r)&&r!==n&&O(t,r,{get:()=>e[r],enumerable:!(o=V(e,r))||o.enumerable});return t};var X=(t,e,n)=>(n=t!=null?F(H(t)):{},W(e||!t||!t.__esModule?O(n,"default",{value:t,enumerable:!0}):n,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react/jsx-runtime"),u=require("@dsui/ui/index"),Y=require("react");function Z(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const d=Z(Y),E="QRCode",ee="QRCodeCanvas",te="QRCodeSvg",ne="QRCodeImage",oe="QRCodeSkeleton";function P(t){const e=d.useRef(null);return e.current===null&&(e.current=t()),e}const L=d.createContext(null);function S(t){const e=d.useContext(L);if(!e)throw new Error(`\`useQRCode\` must be used within \`${E}\``);const n=d.useCallback(()=>t(e.getState()),[e,t]);return d.useSyncExternalStore(e.subscribe,n,n)}const M=d.createContext(null);function j(t){const e=d.useContext(M);if(!e)throw new Error(`\`${t}\` must be used within \`${E}\``);return e}function U(t){const{value:e,size:n=200,level:o="M",margin:r=1,quality:a=.92,backgroundColor:s="#ffffff",foregroundColor:c="#000000",onError:l,onGenerated:y,className:p,style:f,asChild:g,...w}=t,q=d.useRef(null),Q=P(()=>new Set),b=P(()=>({dataUrl:null,svgString:null,isGenerating:!1,error:null,generationKey:""})),h=d.useMemo(()=>({subscribe:i=>(Q.current.add(i),()=>Q.current.delete(i)),getState:()=>b.current,setState:(i,R)=>{Object.is(b.current[i],R)||(b.current[i]=R,h.notify())},setStates:i=>{let R=!1;for(const m of Object.keys(i)){const v=i[m];v!==void 0&&!Object.is(b.current[m],v)&&(Object.assign(b.current,{[m]:v}),R=!0)}R&&h.notify()},notify:()=>{for(const i of Q.current)i()}}),[Q,b]),x=d.useMemo(()=>({errorCorrectionLevel:o,type:"image/png",quality:a,margin:r,color:{dark:c,light:s},width:n}),[o,r,c,s,n,a]),N=d.useMemo(()=>e?JSON.stringify({value:e,size:n,level:o,margin:r,quality:a,foregroundColor:c,backgroundColor:s}):"",[e,o,r,c,s,n,a]),z=d.useCallback(async i=>{if(!e||!i)return;const R=h.getState();if(!(R.isGenerating||R.generationKey===i)){h.setStates({isGenerating:!0,error:null});try{const m=(await import("qrcode")).default;let v=null;try{v=await m.toDataURL(e,x)}catch{v=null}q.current&&await m.toCanvas(q.current,e,x);const T=await m.toString(e,{errorCorrectionLevel:x.errorCorrectionLevel,margin:x.margin,color:x.color,width:x.width,type:"svg"});h.setStates({dataUrl:v,svgString:T,isGenerating:!1,generationKey:i}),y?.()}catch(m){const v=m instanceof Error?m:new Error("Failed to generate QR code");h.setStates({error:v,isGenerating:!1}),l?.(v)}}},[e,x,h,l,y]),K=d.useMemo(()=>({value:e,size:n,level:o,margin:r,backgroundColor:s,foregroundColor:c,canvasRef:q}),[e,n,s,c,o,r]);d.useLayoutEffect(()=>{if(N){const i=requestAnimationFrame(()=>{z(N)});return()=>cancelAnimationFrame(i)}},[N,z]);const $=g?u.Slot:"div";return C.jsx(L.Provider,{value:h,children:C.jsx(M.Provider,{value:K,children:C.jsx($,{"data-slot":"qr-code",...w,className:u.cn(p,"relative flex flex-col items-center gap-2"),style:{"--qr-code-size":`${n}px`,...f},children:w?.children?w.children:C.jsx(k,{})})})})}function k(t){const{asChild:e,className:n,ref:o,...r}=t,a=j(ee),s=S(y=>y.generationKey),c=u.useComposedRefs(o,a.canvasRef),l=e?u.Slot:"canvas";return C.jsx(l,{"data-slot":"qr-code-canvas",...r,ref:c,width:a.size,height:a.size,className:u.cn("relative max-h-(--qr-code-size) max-w-(--qr-code-size)",!s&&"invisible",n)})}function A(t){const{asChild:e,className:n,style:o,...r}=t,a=j(te),s=S(l=>l.svgString);if(!s)return null;const c=e?u.Slot:"div";return C.jsx(c,{"data-slot":"qr-code-svg",...r,className:u.cn("relative max-h-(--qr-code-size) max-w-(--qr-code-size)",n),style:{width:a.size,height:a.size,...o},dangerouslySetInnerHTML:{__html:s}})}function _(t){const{alt:e="QR Code",asChild:n,className:o,...r}=t,a=j(ne),s=S(l=>l.dataUrl);if(!s)return null;const c=n?u.Slot:"img";return C.jsx(c,{"data-slot":"qr-code-image",...r,src:s,alt:e,width:a.size,height:a.size,className:u.cn("relative max-h-(--qr-code-size) max-w-(--qr-code-size)",o)})}function I(t){const{filename:e="qrcode",format:n="png",asChild:o,className:r,children:a,...s}=t,c=S(f=>f.dataUrl),l=S(f=>f.svgString),y=d.useCallback(f=>{if(s.onClick?.(f),f.defaultPrevented)return;const g=document.createElement("a");if(n==="png"&&c)g.href=c,g.download=`${e}.png`;else if(n==="svg"&&l){const w=new Blob([l],{type:"image/svg+xml"});g.href=URL.createObjectURL(w),g.download=`${e}.svg`}else return;document.body.appendChild(g),g.click(),document.body.removeChild(g),n==="svg"&&l&&URL.revokeObjectURL(g.href)},[c,l,e,n,s.onClick]),p=o?u.Slot:"button";return C.jsx(p,{type:"button","data-slot":"qr-code-download",...s,className:u.cn("max-w-(--qr-code-size)",r),onClick:y,children:a??`Download ${n.toUpperCase()}`})}function D(t){const{asChild:e,className:n,...o}=t,r=e?u.Slot:"div";return C.jsx(r,{"data-slot":"qr-code-overlay",...o,className:u.cn("-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 flex items-center justify-center rounded-sm bg-background",n)})}function G(t){const{asChild:e,className:n,style:o,...r}=t,a=j(oe),s=S(f=>f.dataUrl),c=S(f=>f.svgString),l=S(f=>f.generationKey);if(s||c||l)return null;const p=e?u.Slot:"div";return C.jsx(p,{"data-slot":"qr-code-skeleton",...r,className:u.cn("absolute max-h-(--qr-code-size) max-w-(--qr-code-size) animate-pulse bg-accent",n),style:{width:a.size,height:a.size,...o}})}exports.Canvas=k;exports.Download=I;exports.Image=_;exports.Overlay=D;exports.QRCode=U;exports.QRCodeCanvas=k;exports.QRCodeDownload=I;exports.QRCodeImage=_;exports.QRCodeOverlay=D;exports.QRCodeSkeleton=G;exports.QRCodeSvg=A;exports.Root=U;exports.Skeleton=G;exports.Svg=A;exports.useQRCode=S;
|
|
2
|
+
//# sourceMappingURL=QrCode.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QrCode.cjs","sources":["../../../../src/components/QrCode/QrCode.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn, Slot, useComposedRefs } from \"@dsui/ui/index\";\nimport * as React from \"react\";\n\nconst ROOT_NAME = \"QRCode\";\nconst CANVAS_NAME = \"QRCodeCanvas\";\nconst SVG_NAME = \"QRCodeSvg\";\nconst IMAGE_NAME = \"QRCodeImage\";\nconst SKELETON_NAME = \"QRCodeSkeleton\";\n\ntype QRCodeLevel = \"L\" | \"M\" | \"Q\" | \"H\";\n\ninterface QRCodeCanvasOpts {\n errorCorrectionLevel: QRCodeLevel;\n type?: \"image/png\" | \"image/jpeg\" | \"image/webp\";\n quality?: number;\n margin?: number;\n color?: {\n dark: string;\n light: string;\n };\n width?: number;\n rendererOpts?: {\n quality?: number;\n };\n}\n\nfunction useLazyRef<T>(fn: () => T) {\n const ref = React.useRef<T | null>(null);\n\n if (ref.current === null) {\n ref.current = fn();\n }\n\n return ref as React.RefObject<T>;\n}\n\ninterface StoreState {\n dataUrl: string | null;\n svgString: string | null;\n isGenerating: boolean;\n error: Error | null;\n generationKey: string;\n}\n\ninterface Store {\n subscribe: (callback: () => void) => () => void;\n getState: () => StoreState;\n setState: <K extends keyof StoreState>(key: K, value: StoreState[K]) => void;\n setStates: (updates: Partial<StoreState>) => void;\n notify: () => void;\n}\n\ninterface QRCodeContextValue {\n value: string;\n size: number;\n margin: number;\n level: QRCodeLevel;\n backgroundColor: string;\n foregroundColor: string;\n canvasRef: React.RefObject<HTMLCanvasElement | null>;\n}\n\nconst StoreContext = React.createContext<Store | null>(null);\n\nfunction useStore<T>(selector: (state: StoreState) => T): T {\n const store = React.useContext(StoreContext);\n if (!store) {\n throw new Error(`\\`useQRCode\\` must be used within \\`${ROOT_NAME}\\``);\n }\n\n const getSnapshot = React.useCallback(\n () => selector(store.getState()),\n [store, selector],\n );\n\n return React.useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);\n}\n\nconst QRCodeContext = React.createContext<QRCodeContextValue | null>(null);\n\nfunction useQRCodeContext(consumerName: string) {\n const context = React.useContext(QRCodeContext);\n if (!context) {\n throw new Error(`\\`${consumerName}\\` must be used within \\`${ROOT_NAME}\\``);\n }\n return context;\n}\n\ninterface QRCodeRootProps extends Omit<React.ComponentProps<\"div\">, \"onError\"> {\n value: string;\n size?: number;\n level?: QRCodeLevel;\n margin?: number;\n quality?: number;\n backgroundColor?: string;\n foregroundColor?: string;\n onError?: (error: Error) => void;\n onGenerated?: () => void;\n asChild?: boolean;\n}\n\nfunction QRCodeRoot(props: QRCodeRootProps) {\n const {\n value,\n size = 200,\n level = \"M\",\n margin = 1,\n quality = 0.92,\n backgroundColor = \"#ffffff\",\n foregroundColor = \"#000000\",\n onError,\n onGenerated,\n className,\n style,\n asChild,\n ...rootProps\n } = props;\n\n const canvasRef = React.useRef<HTMLCanvasElement>(null);\n\n const listenersRef = useLazyRef(() => new Set<() => void>());\n const stateRef = useLazyRef<StoreState>(() => ({\n dataUrl: null,\n svgString: null,\n isGenerating: false,\n error: null,\n generationKey: \"\",\n }));\n\n const store = React.useMemo<Store>(() => {\n return {\n subscribe: (cb) => {\n listenersRef.current.add(cb);\n return () => listenersRef.current.delete(cb);\n },\n getState: () => stateRef.current,\n setState: (key, value) => {\n if (Object.is(stateRef.current[key], value)) return;\n stateRef.current[key] = value;\n store.notify();\n },\n setStates: (updates) => {\n let hasChanged = false;\n\n for (const key of Object.keys(updates) as Array<keyof StoreState>) {\n const value = updates[key];\n if (value !== undefined && !Object.is(stateRef.current[key], value)) {\n Object.assign(stateRef.current, { [key]: value });\n hasChanged = true;\n }\n }\n\n if (hasChanged) {\n store.notify();\n }\n },\n notify: () => {\n for (const cb of listenersRef.current) {\n cb();\n }\n },\n };\n }, [listenersRef, stateRef]);\n\n const canvasOpts = React.useMemo<QRCodeCanvasOpts>(\n () => ({\n errorCorrectionLevel: level,\n type: \"image/png\",\n quality,\n margin,\n color: {\n dark: foregroundColor,\n light: backgroundColor,\n },\n width: size,\n }),\n [level, margin, foregroundColor, backgroundColor, size, quality],\n );\n\n const generationKey = React.useMemo(() => {\n if (!value) return \"\";\n\n return JSON.stringify({\n value,\n size,\n level,\n margin,\n quality,\n foregroundColor,\n backgroundColor,\n });\n }, [value, level, margin, foregroundColor, backgroundColor, size, quality]);\n\n const onQRCodeGenerate = React.useCallback(\n async (targetGenerationKey: string) => {\n if (!value || !targetGenerationKey) return;\n\n const currentState = store.getState();\n if (\n currentState.isGenerating ||\n currentState.generationKey === targetGenerationKey\n )\n return;\n\n store.setStates({\n isGenerating: true,\n error: null,\n });\n\n try {\n const QRCode = (await import(\"qrcode\")).default;\n\n let dataUrl: string | null = null;\n\n try {\n dataUrl = await QRCode.toDataURL(value, canvasOpts);\n } catch {\n dataUrl = null;\n }\n\n if (canvasRef.current) {\n await QRCode.toCanvas(canvasRef.current, value, canvasOpts);\n }\n\n const svgString = await QRCode.toString(value, {\n errorCorrectionLevel: canvasOpts.errorCorrectionLevel,\n margin: canvasOpts.margin,\n color: canvasOpts.color,\n width: canvasOpts.width,\n type: \"svg\",\n });\n\n store.setStates({\n dataUrl,\n svgString,\n isGenerating: false,\n generationKey: targetGenerationKey,\n });\n\n onGenerated?.();\n } catch (error) {\n const parsedError =\n error instanceof Error\n ? error\n : new Error(\"Failed to generate QR code\");\n store.setStates({\n error: parsedError,\n isGenerating: false,\n });\n onError?.(parsedError);\n }\n },\n [value, canvasOpts, store, onError, onGenerated],\n );\n\n const contextValue = React.useMemo<QRCodeContextValue>(\n () => ({\n value,\n size,\n level,\n margin,\n backgroundColor,\n foregroundColor,\n canvasRef,\n }),\n [value, size, backgroundColor, foregroundColor, level, margin],\n );\n\n React.useLayoutEffect(() => {\n if (generationKey) {\n const rafId = requestAnimationFrame(() => {\n onQRCodeGenerate(generationKey);\n });\n\n return () => cancelAnimationFrame(rafId);\n }\n }, [generationKey, onQRCodeGenerate]);\n\n const RootPrimitive = asChild ? Slot : \"div\";\n\n return (\n <StoreContext.Provider value={store}>\n <QRCodeContext.Provider value={contextValue}>\n <RootPrimitive\n data-slot=\"qr-code\"\n {...rootProps}\n className={cn(className, \"relative flex flex-col items-center gap-2\")}\n style={\n {\n \"--qr-code-size\": `${size}px`,\n ...style,\n } as React.CSSProperties\n }\n >\n {rootProps?.children ? rootProps.children : <QRCodeCanvas />}\n </RootPrimitive>\n </QRCodeContext.Provider>\n </StoreContext.Provider>\n );\n}\n\ninterface QRCodeCanvasProps extends React.ComponentProps<\"canvas\"> {\n asChild?: boolean;\n}\n\nfunction QRCodeCanvas(props: QRCodeCanvasProps) {\n const { asChild, className, ref, ...canvasProps } = props;\n\n const context = useQRCodeContext(CANVAS_NAME);\n const generationKey = useStore((state) => state.generationKey);\n\n const composedRef = useComposedRefs(ref, context.canvasRef);\n\n const CanvasPrimitive = asChild ? Slot : \"canvas\";\n\n return (\n <CanvasPrimitive\n data-slot=\"qr-code-canvas\"\n {...canvasProps}\n ref={composedRef}\n width={context.size}\n height={context.size}\n className={cn(\n \"relative max-h-(--qr-code-size) max-w-(--qr-code-size)\",\n !generationKey && \"invisible\",\n className,\n )}\n />\n );\n}\n\ninterface QRCodeSvgProps extends React.ComponentProps<\"div\"> {\n asChild?: boolean;\n}\n\nfunction QRCodeSvg(props: QRCodeSvgProps) {\n const { asChild, className, style, ...svgProps } = props;\n\n const context = useQRCodeContext(SVG_NAME);\n const svgString = useStore((state) => state.svgString);\n\n if (!svgString) return null;\n\n const SvgPrimitive = asChild ? Slot : \"div\";\n\n return (\n <SvgPrimitive\n data-slot=\"qr-code-svg\"\n {...svgProps}\n className={cn(\n \"relative max-h-(--qr-code-size) max-w-(--qr-code-size)\",\n className,\n )}\n style={{ width: context.size, height: context.size, ...style }}\n dangerouslySetInnerHTML={{ __html: svgString }}\n />\n );\n}\n\ninterface QRCodeImageProps extends React.ComponentProps<\"img\"> {\n asChild?: boolean;\n}\n\nfunction QRCodeImage(props: QRCodeImageProps) {\n const { alt = \"QR Code\", asChild, className, ...imageProps } = props;\n\n const context = useQRCodeContext(IMAGE_NAME);\n const dataUrl = useStore((state) => state.dataUrl);\n\n if (!dataUrl) return null;\n\n const ImagePrimitive = asChild ? Slot : \"img\";\n\n return (\n <ImagePrimitive\n data-slot=\"qr-code-image\"\n {...imageProps}\n src={dataUrl}\n alt={alt}\n width={context.size}\n height={context.size}\n className={cn(\n \"relative max-h-(--qr-code-size) max-w-(--qr-code-size)\",\n className,\n )}\n />\n );\n}\n\ninterface QRCodeDownloadProps extends React.ComponentProps<\"button\"> {\n filename?: string;\n format?: \"png\" | \"svg\";\n asChild?: boolean;\n}\n\nfunction QRCodeDownload(props: QRCodeDownloadProps) {\n const {\n filename = \"qrcode\",\n format = \"png\",\n asChild,\n className,\n children,\n ...buttonProps\n } = props;\n\n const dataUrl = useStore((state) => state.dataUrl);\n const svgString = useStore((state) => state.svgString);\n\n const onClick = React.useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n buttonProps.onClick?.(event);\n if (event.defaultPrevented) return;\n\n const link = document.createElement(\"a\");\n\n if (format === \"png\" && dataUrl) {\n link.href = dataUrl;\n link.download = `${filename}.png`;\n } else if (format === \"svg\" && svgString) {\n const blob = new Blob([svgString], { type: \"image/svg+xml\" });\n link.href = URL.createObjectURL(blob);\n link.download = `${filename}.svg`;\n } else {\n return;\n }\n\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n\n if (format === \"svg\" && svgString) {\n URL.revokeObjectURL(link.href);\n }\n },\n [dataUrl, svgString, filename, format, buttonProps.onClick],\n );\n\n const ButtonPrimitive = asChild ? Slot : \"button\";\n\n return (\n <ButtonPrimitive\n type=\"button\"\n data-slot=\"qr-code-download\"\n {...buttonProps}\n className={cn(\"max-w-(--qr-code-size)\", className)}\n onClick={onClick}\n >\n {children ?? `Download ${format.toUpperCase()}`}\n </ButtonPrimitive>\n );\n}\n\ninterface QRCodeOverlayProps extends React.ComponentProps<\"div\"> {\n asChild?: boolean;\n}\n\nfunction QRCodeOverlay(props: QRCodeOverlayProps) {\n const { asChild, className, ...overlayProps } = props;\n\n const OverlayPrimitive = asChild ? Slot : \"div\";\n\n return (\n <OverlayPrimitive\n data-slot=\"qr-code-overlay\"\n {...overlayProps}\n className={cn(\n \"-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 flex items-center justify-center rounded-sm bg-background\",\n className,\n )}\n />\n );\n}\n\ninterface QRCodeSkeletonProps extends React.ComponentProps<\"div\"> {\n asChild?: boolean;\n}\n\nfunction QRCodeSkeleton(props: QRCodeSkeletonProps) {\n const { asChild, className, style, ...skeletonProps } = props;\n\n const context = useQRCodeContext(SKELETON_NAME);\n const dataUrl = useStore((state) => state.dataUrl);\n const svgString = useStore((state) => state.svgString);\n const generationKey = useStore((state) => state.generationKey);\n\n const isLoaded = dataUrl || svgString || generationKey;\n\n if (isLoaded) return null;\n\n const SkeletonPrimitive = asChild ? Slot : \"div\";\n\n return (\n <SkeletonPrimitive\n data-slot=\"qr-code-skeleton\"\n {...skeletonProps}\n className={cn(\n \"absolute max-h-(--qr-code-size) max-w-(--qr-code-size) animate-pulse bg-accent\",\n className,\n )}\n style={{\n width: context.size,\n height: context.size,\n ...style,\n }}\n />\n );\n}\n\nexport {\n QRCodeRoot as Root,\n QRCodeCanvas as Canvas,\n QRCodeSvg as Svg,\n QRCodeImage as Image,\n QRCodeOverlay as Overlay,\n QRCodeSkeleton as Skeleton,\n QRCodeDownload as Download,\n //\n QRCodeRoot as QRCode,\n QRCodeCanvas,\n QRCodeSvg,\n QRCodeImage,\n QRCodeOverlay,\n QRCodeSkeleton,\n QRCodeDownload,\n //\n useStore as useQRCode,\n //\n type QRCodeRootProps as QRCodeProps,\n};\n"],"names":["ROOT_NAME","CANVAS_NAME","SVG_NAME","IMAGE_NAME","SKELETON_NAME","useLazyRef","fn","ref","React","StoreContext","useStore","selector","store","getSnapshot","QRCodeContext","useQRCodeContext","consumerName","context","QRCodeRoot","props","value","size","level","margin","quality","backgroundColor","foregroundColor","onError","onGenerated","className","style","asChild","rootProps","canvasRef","listenersRef","stateRef","cb","key","updates","hasChanged","canvasOpts","generationKey","onQRCodeGenerate","targetGenerationKey","currentState","QRCode","dataUrl","svgString","error","parsedError","contextValue","rafId","RootPrimitive","Slot","jsx","cn","QRCodeCanvas","canvasProps","state","composedRef","useComposedRefs","CanvasPrimitive","QRCodeSvg","svgProps","SvgPrimitive","QRCodeImage","alt","imageProps","ImagePrimitive","QRCodeDownload","filename","format","children","buttonProps","onClick","event","link","blob","ButtonPrimitive","QRCodeOverlay","overlayProps","OverlayPrimitive","QRCodeSkeleton","skeletonProps","SkeletonPrimitive"],"mappings":"y4BAKMA,EAAY,SACZC,GAAc,eACdC,GAAW,YACXC,GAAa,cACbC,GAAgB,iBAmBtB,SAASC,EAAcC,EAAa,CAClC,MAAMC,EAAMC,EAAM,OAAiB,IAAI,EAEvC,OAAID,EAAI,UAAY,OAClBA,EAAI,QAAUD,EAAA,GAGTC,CACT,CA4BA,MAAME,EAAeD,EAAM,cAA4B,IAAI,EAE3D,SAASE,EAAYC,EAAuC,CAC1D,MAAMC,EA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AAA6C,EAEC,SAAAF,GAAY,YAAYD,EAAO,YAAA,CAAa,EAAA,CAAA,CAGnD,CAMA,SAASQ,EAAc5D,EAA2B,CAChD,KAAM,CAAE,QAAAY,EAAS,UAAAF,EAAW,GAAGmD,GAAiB7D,EAE1C8D,EAAmBlD,EAAUsB,EAAAA,KAAO,MAE1C,OACEC,EAAAA,IAAC2B,EAAA,CACC,YAAU,kBACT,GAAGD,EACJ,UAAWzB,EAAAA,GACT,wHACA1B,CAAA,CACF,CAAA,CAGN,CAMA,SAASqD,EAAe/D,EAA4B,CAClD,KAAM,CAAE,QAAAY,EAAS,UAAAF,EAAW,MAAAC,EAAO,GAAGqD,GAAkBhE,EAElDF,EAAUF,EAAiBX,EAAa,EACxC0C,EAAUpC,EAAUgD,GAAUA,EAAM,OAAO,EAC3CX,EAAYrC,EAAUgD,GAAUA,EAAM,SAAS,EAC/CjB,EAAgB/B,EAAUgD,GAAUA,EAAM,aAAa,EAI7D,GAFiBZ,GAAWC,GAAaN,EAE3B,OAAO,KAErB,MAAM2C,EAAoBrD,EAAUsB,EAAAA,KAAO,MAE3C,OACEC,EAAAA,IAAC8B,EAAA,CACC,YAAU,mBACT,GAAGD,EACJ,UAAW5B,EAAAA,GACT,iFACA1B,CAAA,EAEF,MAAO,CACL,MAAOZ,EAAQ,KACf,OAAQA,EAAQ,KAChB,GAAGa,CAAA,CACL,CAAA,CAGN"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./QrCode.cjs"),o=Object.assign(e.Root,{Canvas:e.Canvas,Svg:e.Svg,Image:e.Image,Overlay:e.Overlay,Skeleton:e.Skeleton,Download:e.Download});exports.useQRCode=e.useQRCode;exports.QRCode=o;exports.QrCode=o;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/QrCode/index.ts"],"sourcesContent":["import {\n Root,\n Canvas,\n Svg,\n Image,\n Overlay,\n Skeleton,\n Download,\n useQRCode,\n type QRCodeProps,\n} from \"./QrCode\";\n\nconst QRCode = Object.assign(Root, {\n Canvas,\n Svg,\n Image,\n Overlay,\n Skeleton,\n Download,\n});\n\nexport { QRCode, QRCode as QrCode };\n\n// Export hook và type\nexport { useQRCode };\nexport type { QRCodeProps };\n"],"names":["QRCode","Root","Canvas","Svg","Image","Overlay","Skeleton","Download"],"mappings":"gHAYMA,EAAS,OAAO,OAAOC,OAAM,CAAA,OACjCC,EAAAA,OAAA,IACAC,EAAAA,IAAA,MACAC,EAAAA,MAAA,QACAC,EAAAA,QAAA,SACAC,EAAAA,SAAA,SACAC,EAAAA,QACF,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),c=require("react"),m=require("@dsui/ui/components/radio-group"),u=require("@dsui/ui/index"),x=c.forwardRef((i,n)=>{const{label:a,variant:s="option",rootClassName:l,...o}=i,r=c.useId();return e.jsxs("div",{className:u.cn("flex items-center space-x-2",l),children:[e.jsx(m.RadioGroupItem,{ref:n,id:r,...o}),s==="option"&&a&&e.jsx("label",{htmlFor:r,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:a}),s==="button-group"&&a&&e.jsx("span",{className:"sr-only",children:a})]})});x.displayName="RadioItem";const d=c.forwardRef((i,n)=>{const{options:a,label:s,helperText:l,variant:o="option",size:r="default",color:p,value:b,onValueChange:f,children:N,className:h,rootClassName:j,disabled:R}=i;return e.jsxs("div",{className:u.cn("flex flex-col gap-1.5",j),children:[s&&e.jsx("label",{className:"text-sm font-medium",children:s}),e.jsxs(m.RadioGroup,{ref:n,value:b,onValueChange:f,variant:o,className:u.cn(h),children:[a&&a.map(t=>e.jsx(x,{value:t.value,label:t.label,disabled:R||t.disabled,variant:o,size:r,color:p},t.value)),N]}),l&&e.jsx("p",{className:"text-xs text-muted-foreground",children:l})]})});d.displayName="Radio";d.Group=m.RadioGroup;d.Item=x;exports.default=d;
|
|
2
|
+
//# sourceMappingURL=Radio.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Radio.cjs","sources":["../../../../src/components/Radio/Radio.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n RadioGroupItem as SRadioGroupItem,\n RadioGroup as SRadioGroup,\n type RadioGroupProps,\n type RadioGroupItemProps,\n} from \"@dsui/ui/components/radio-group\";\nimport { cn } from \"@dsui/ui/index\";\n\ntype RadioItemProps = RadioGroupItemProps & {\n label?: React.ReactNode;\n variant?: \"option\" | \"button-group\";\n size?: \"default\" | \"sm\" | \"lg\";\n color?:\n | \"primary\"\n | \"secondary\"\n | \"accent\"\n | \"destructive\"\n | \"muted\"\n | \"success\"\n | \"error\"\n | \"warning\";\n rootClassName?: string;\n};\n\nconst RadioItem = React.forwardRef<HTMLButtonElement, RadioItemProps>(\n (props, ref) => {\n const { label, variant = \"option\", rootClassName, ...itemProps } = props;\n const id = React.useId();\n\n return (\n <div className={cn(\"flex items-center space-x-2\", rootClassName)}>\n <SRadioGroupItem ref={ref} id={id} {...itemProps} />\n {variant === \"option\" && label && (\n <label\n htmlFor={id}\n className=\"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n >\n {label}\n </label>\n )}\n {variant === \"button-group\" && label && (\n <span className=\"sr-only\">{label}</span>\n )}\n </div>\n );\n },\n);\n\nRadioItem.displayName = \"RadioItem\";\n\ntype RadioProps = {\n options?: Array<{\n label: React.ReactNode;\n value: string;\n disabled?: boolean;\n }>;\n label?: React.ReactNode;\n helperText?: React.ReactNode;\n variant?: \"option\" | \"button-group\";\n size?: \"default\" | \"sm\" | \"lg\";\n color?:\n | \"primary\"\n | \"secondary\"\n | \"accent\"\n | \"destructive\"\n | \"muted\"\n | \"success\"\n | \"error\"\n | \"warning\";\n value?: string;\n onValueChange?: (value: string) => void;\n children?: React.ReactNode;\n className?: string;\n rootClassName?: string;\n disabled?: boolean;\n} & RadioGroupProps;\n\nconst Radio = React.forwardRef<HTMLDivElement, RadioProps>((props, ref) => {\n const {\n options,\n label,\n helperText,\n variant = \"option\",\n size = \"default\",\n color,\n value,\n onValueChange,\n children,\n className,\n rootClassName,\n disabled,\n } = props;\n\n return (\n <div className={cn(\"flex flex-col gap-1.5\", rootClassName)}>\n {label && <label className=\"text-sm font-medium\">{label}</label>}\n\n <SRadioGroup\n ref={ref}\n value={value}\n onValueChange={onValueChange}\n variant={variant}\n className={cn(className)}\n >\n {options &&\n options.map((option) => (\n <RadioItem\n key={option.value}\n value={option.value}\n label={option.label}\n disabled={disabled || option.disabled}\n variant={variant}\n size={size}\n color={color}\n />\n ))}\n {children}\n </SRadioGroup>\n\n {helperText && (\n <p className=\"text-xs text-muted-foreground\">{helperText}</p>\n )}\n </div>\n );\n}) as React.ForwardRefExoticComponent<\n RadioProps & React.RefAttributes<HTMLDivElement>\n> & {\n Group: typeof SRadioGroup;\n Item: typeof RadioItem;\n};\n\nRadio.displayName = \"Radio\";\n\nRadio.Group = SRadioGroup;\nRadio.Item = RadioItem;\n\nexport default Radio;\nexport { type RadioProps, type RadioGroupProps, type RadioGroupItemProps };\n"],"names":["RadioItem","React","props","ref","label","variant","rootClassName","itemProps","id","cn","jsx","SRadioGroupItem","Radio","options","helperText","size","color","value","onValueChange","children","className","disabled","jsxs","SRadioGroup","option"],"mappings":"6OAyBMA,EAAYC,EAAM,WACtB,CAACC,EAAOC,IAAQ,CACd,KAAM,CAAE,MAAAC,EAAO,QAAAC,EAAU,SAAU,cAAAC,EAAe,GAAGC,GAAcL,EAC7DM,EAAKP,EAAM,MAAA,EAEjB,cACG,MAAA,CAAI,UAAWQ,EAAAA,GAAG,8BAA+BH,CAAa,EAC7D,SAAA,CAAAI,EAAAA,IAACC,EAAAA,eAAA,CAAgB,IAAAR,EAAU,GAAAK,EAAS,GAAGD,CAAA,CAAW,EACjDF,IAAY,UAAYD,GACvBM,EAAAA,IAAC,QAAA,CACC,QAASF,EACT,UAAU,6FAET,SAAAJ,CAAA,CAAA,EAGJC,IAAY,gBAAkBD,SAC5B,OAAA,CAAK,UAAU,UAAW,SAAAA,CAAA,CAAM,CAAA,EAErC,CAEJ,CACF,EAEAJ,EAAU,YAAc,YA6BxB,MAAMY,EAAQX,EAAM,WAAuC,CAACC,EAAOC,IAAQ,CACzE,KAAM,CACJ,QAAAU,EACA,MAAAT,EACA,WAAAU,EACA,QAAAT,EAAU,SACV,KAAAU,EAAO,UACP,MAAAC,EACA,MAAAC,EACA,cAAAC,EACA,SAAAC,EACA,UAAAC,EACA,cAAAd,EACA,SAAAe,CAAA,EACEnB,EAEJ,cACG,MAAA,CAAI,UAAWO,EAAAA,GAAG,wBAAyBH,CAAa,EACtD,SAAA,CAAAF,GAASM,EAAAA,IAAC,QAAA,CAAM,UAAU,sBAAuB,SAAAN,EAAM,EAExDkB,EAAAA,KAACC,EAAAA,WAAA,CACC,IAAApB,EACA,MAAAc,EACA,cAAAC,EACA,QAAAb,EACA,UAAWI,EAAAA,GAAGW,CAAS,EAEtB,SAAA,CAAAP,GACCA,EAAQ,IAAKW,GACXd,EAAAA,IAACV,EAAA,CAEC,MAAOwB,EAAO,MACd,MAAOA,EAAO,MACd,SAAUH,GAAYG,EAAO,SAC7B,QAAAnB,EACA,KAAAU,EACA,MAAAC,CAAA,EANKQ,EAAO,KAAA,CAQf,EACFL,CAAA,CAAA,CAAA,EAGFL,GACCJ,EAAAA,IAAC,IAAA,CAAE,UAAU,gCAAiC,SAAAI,CAAA,CAAW,CAAA,EAE7D,CAEJ,CAAC,EAODF,EAAM,YAAc,QAEpBA,EAAM,MAAQW,EAAAA,WACdX,EAAM,KAAOZ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),i=require("react"),k=require("lucide-react"),R=require("@dsui/ui/lib/utils"),b=i.forwardRef(({count:u=5,value:x,defaultValue:j=0,allowHalf:a=!1,allowClear:N=!0,size:f="middle",color:V="warning",character:v,className:D,style:A,disabled:l=!1,autoFocus:F=!1,keyboard:q=!0,tooltips:m,onChange:p,onHoverChange:M,onFocus:E,onBlur:L,onKeyDown:$},c)=>{const[B,d]=i.useState(j),[o,S]=i.useState(null),K=i.useRef(null),n=x!==void 0?x:B,_={small:20,middle:24,large:32},P={primary:"text-primary [&_svg]:fill-primary",secondary:"text-secondary [&_svg]:fill-secondary",accent:"text-accent [&_svg]:fill-accent",destructive:"text-destructive [&_svg]:fill-destructive",muted:"text-muted-foreground [&_svg]:fill-muted-foreground",success:"text-success [&_svg]:fill-success",error:"text-error [&_svg]:fill-error",warning:"text-yellow-400 [&_svg]:fill-yellow-400"},g=(e,t)=>{if(l)return;const r=t?e+.5:e+1;N&&r===n?(d(0),p?.(0)):(d(r),p?.(r))},h=(e,t)=>{if(l)return;const r=t?e+.5:e+1;S(r),M?.(r)},T=()=>{S(null),M?.(0)},C=e=>{if(!q||l)return;$?.(e);const t=a?.5:1;let r=n;switch(e.key){case"ArrowRight":case"ArrowUp":e.preventDefault(),r=Math.min(n+t,u);break;case"ArrowLeft":case"ArrowDown":e.preventDefault(),r=Math.max(n-t,0);break;case"Home":e.preventDefault(),r=a?.5:1;break;case"End":e.preventDefault(),r=u;break;default:return}d(r),p?.(r)},H=()=>{E?.()},O=()=>{L?.()},U=e=>{const t=o!==null?o:n;return t>=e+1?100:t>e&&t<e+1?(t-e)*100:0},z=e=>{if(!a)return!1;const r=(o!==null?o:n)-e;return r>0&&r<=.5},w=(e=!1)=>typeof v=="function"?v({count:u,value:n,defaultValue:j,allowHalf:a,allowClear:N,size:f,disabled:l}):e?s.jsx(k.StarHalf,{className:"w-full h-full"}):v||s.jsx(k.Star,{className:"w-full h-full"}),G=e=>{if(!(!m||!m[e]))return m[e]};return s.jsx("div",{ref:e=>{K.current=e,typeof c=="function"?c(e):c&&(c.current=e)},className:R.cn("inline-flex items-center gap-1",l&&"opacity-50 cursor-not-allowed",!l&&"cursor-pointer",D),style:A,onMouseLeave:T,onKeyDown:C,onFocus:H,onBlur:O,tabIndex:l?-1:0,role:"slider","aria-label":"Rate","aria-valuemin":0,"aria-valuemax":u,"aria-valuenow":n,"aria-disabled":l,autoFocus:F,children:Array.from({length:u},(e,t)=>{const r=U(t),y=G(t),J=z(t);return s.jsxs("div",{className:"relative group",title:y,children:[s.jsxs("div",{className:"relative inline-flex",style:{width:`${_[f]}px`,height:`${_[f]}px`},children:[s.jsx("div",{className:"text-muted-foreground/30 pointer-events-none",children:w(!1)}),r>0&&s.jsx("div",{className:R.cn("absolute inset-0 pointer-events-none",P[V]),children:J?w(!0):s.jsx("div",{className:"overflow-hidden",style:{width:`${r}%`},children:w(!1)})}),!l&&s.jsx(s.Fragment,{children:a?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"absolute inset-0 w-1/2 cursor-pointer",onClick:()=>g(t,!0),onMouseEnter:()=>h(t,!0)}),s.jsx("div",{className:"absolute inset-0 left-1/2 w-1/2 cursor-pointer",onClick:()=>g(t,!1),onMouseEnter:()=>h(t,!1)})]}):s.jsx("div",{className:"absolute inset-0 cursor-pointer",onClick:()=>g(t,!1),onMouseEnter:()=>h(t,!1)})})]}),y&&(o===t+1||a&&o===t+.5)&&s.jsx("div",{className:"absolute top-full left-1/2 -translate-x-1/2 mt-1 px-2 py-1 text-xs bg-foreground text-background rounded whitespace-nowrap z-10",children:y})]},t)})})});b.displayName="Rate";exports.default=b;
|
|
2
|
+
//# sourceMappingURL=Rate.cjs.map
|