@brightlocal/ui-components 3.1.0 → 3.3.0
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/AI_USAGE.md +10 -0
- package/README.md +8 -1
- package/component-meta.json +1591 -123
- package/deprecations.json +45 -1
- package/dist/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.js +73 -102
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +36 -5
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +83 -128
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +4 -4
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +116 -177
- package/dist/aspect-ratio.cjs +1 -1
- package/dist/aspect-ratio.js +13 -16
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.js +30 -45
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts +32 -1
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +90 -71
- package/dist/banner.cjs +1 -0
- package/dist/banner.d.ts +81 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/banner.js +130 -0
- package/dist/blocks/empty-state.cjs +1 -1
- package/dist/blocks/empty-state.d.ts +24 -6
- package/dist/blocks/empty-state.d.ts.map +1 -1
- package/dist/blocks/empty-state.js +74 -140
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts +2 -2
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +136 -176
- package/dist/blocks/progress-state.cjs +1 -1
- package/dist/blocks/progress-state.d.ts +2 -2
- package/dist/blocks/progress-state.js +223 -347
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +28 -6
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +763 -1086
- package/dist/brand-illustration-motif.cjs +1 -1
- package/dist/brand-illustration-motif.d.ts +1 -1
- package/dist/brand-illustration-motif.js +40 -61
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.js +62 -102
- package/dist/button-group.cjs +1 -1
- package/dist/button-group.js +23 -31
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts +4 -2
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +149 -189
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.ts +87 -3
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +116 -173
- package/dist/callout.cjs +1 -1
- package/dist/callout.js +73 -96
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +92 -6
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +240 -234
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.d.ts +3 -3
- package/dist/carousel.d.ts.map +1 -1
- package/dist/carousel.js +174 -268
- package/dist/centred-layout.cjs +1 -1
- package/dist/centred-layout.js +27 -48
- package/dist/chart-empty.cjs +1 -1
- package/dist/chart-empty.js +18 -27
- package/dist/chart.cjs +7 -7
- package/dist/chart.d.ts +253 -25
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +465 -511
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/checkbox.js +37 -69
- package/dist/chip.cjs +1 -1
- package/dist/chip.js +116 -173
- package/dist/collapsible.cjs +1 -1
- package/dist/collapsible.d.ts.map +1 -1
- package/dist/collapsible.js +35 -41
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts +14 -4
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +440 -639
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +273 -420
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.d.ts +5 -5
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +121 -191
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +442 -144
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +708 -835
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +15 -4
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +156 -231
- package/dist/delta.cjs +1 -0
- package/dist/delta.d.ts +79 -0
- package/dist/delta.d.ts.map +1 -0
- package/dist/delta.js +62 -0
- package/dist/description.cjs +1 -1
- package/dist/description.js +11 -20
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts +1 -1
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +76 -116
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts +11 -11
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +76 -134
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts +6 -6
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +179 -300
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +9 -9
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +166 -286
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.js +203 -342
- package/dist/grid.cjs +1 -1
- package/dist/grid.d.ts +24 -1
- package/dist/grid.d.ts.map +1 -1
- package/dist/grid.js +16 -29
- package/dist/header.cjs +1 -1
- package/dist/header.js +21 -38
- package/dist/height-transition.cjs +1 -1
- package/dist/height-transition.js +38 -55
- package/dist/hooks/use-breakpoint.cjs +1 -1
- package/dist/hooks/use-breakpoint.d.ts +1 -1
- package/dist/hooks/use-breakpoint.d.ts.map +1 -1
- package/dist/hooks/use-breakpoint.js +10 -9
- package/dist/hooks/use-debounce.cjs +1 -1
- package/dist/hooks/use-debounce.js +12 -11
- package/dist/hooks/use-delayed-pending.cjs +1 -1
- package/dist/hooks/use-delayed-pending.js +8 -9
- package/dist/hooks/use-filter-search-params.cjs +1 -0
- package/dist/hooks/use-filter-search-params.d.ts +93 -0
- package/dist/hooks/use-filter-search-params.d.ts.map +1 -0
- package/dist/hooks/use-filter-search-params.js +122 -0
- package/dist/hooks/use-mobile.cjs +1 -1
- package/dist/hooks/use-mobile.js +6 -6
- package/dist/hooks/use-overlay-pointer-lock.cjs +1 -1
- package/dist/hooks/use-overlay-pointer-lock.js +8 -9
- package/dist/hooks/use-prefers-reduced-motion.cjs +1 -1
- package/dist/hooks/use-prefers-reduced-motion.js +5 -8
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.d.ts +1 -1
- package/dist/hover-card.d.ts.map +1 -1
- package/dist/hover-card.js +30 -62
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +636 -582
- package/dist/info-tooltip.cjs +1 -0
- package/dist/info-tooltip.d.ts +39 -0
- package/dist/info-tooltip.d.ts.map +1 -0
- package/dist/info-tooltip.js +27 -0
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.d.ts +32 -3
- package/dist/input-chip.d.ts.map +1 -1
- package/dist/input-chip.js +182 -231
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.d.ts +33 -2
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-group.js +188 -122
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.d.ts +3 -3
- package/dist/input-otp.d.ts.map +1 -1
- package/dist/input-otp.js +102 -146
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts +26 -8
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +139 -171
- package/dist/input.cjs +1 -1
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +51 -73
- package/dist/label.cjs +1 -1
- package/dist/label.js +20 -38
- package/dist/lib/block-illustration.cjs +1 -1
- package/dist/lib/block-illustration.d.ts +5 -2
- package/dist/lib/block-illustration.d.ts.map +1 -1
- package/dist/lib/block-illustration.js +16 -17
- package/dist/lib/compose-event-handlers.cjs +1 -0
- package/dist/lib/compose-event-handlers.d.ts +9 -0
- package/dist/lib/compose-event-handlers.d.ts.map +1 -0
- package/dist/lib/compose-event-handlers.js +8 -0
- package/dist/lib/download-file.cjs +1 -0
- package/dist/lib/download-file.d.ts +14 -0
- package/dist/lib/download-file.d.ts.map +1 -0
- package/dist/lib/download-file.js +40 -0
- package/dist/lib/empty-canvas.cjs +1 -1
- package/dist/lib/empty-canvas.js +28 -56
- package/dist/lib/empty-chip.cjs +1 -1
- package/dist/lib/empty-chip.d.ts +14 -3
- package/dist/lib/empty-chip.d.ts.map +1 -1
- package/dist/lib/empty-chip.js +15 -11
- package/dist/lib/field-aria.cjs +1 -0
- package/dist/lib/field-aria.d.ts +34 -0
- package/dist/lib/field-aria.d.ts.map +1 -0
- package/dist/lib/field-aria.js +52 -0
- package/dist/lib/image-file-info.cjs +1 -0
- package/dist/lib/image-file-info.d.ts +25 -0
- package/dist/lib/image-file-info.d.ts.map +1 -0
- package/dist/lib/image-file-info.js +67 -0
- package/dist/lib/media-viewer-content.cjs +1 -0
- package/dist/lib/media-viewer-content.d.ts +102 -0
- package/dist/lib/media-viewer-content.d.ts.map +1 -0
- package/dist/lib/media-viewer-content.js +650 -0
- package/dist/lib/media-viewer-internal.cjs +1 -0
- package/dist/lib/media-viewer-internal.d.ts +98 -0
- package/dist/lib/media-viewer-internal.d.ts.map +1 -0
- package/dist/lib/media-viewer-internal.js +61 -0
- package/dist/lib/media-viewer-motion.cjs +1 -0
- package/dist/lib/media-viewer-motion.d.ts +40 -0
- package/dist/lib/media-viewer-motion.d.ts.map +1 -0
- package/dist/lib/media-viewer-motion.js +37 -0
- package/dist/lib/motion.cjs +1 -1
- package/dist/lib/motion.d.ts +8 -0
- package/dist/lib/motion.d.ts.map +1 -1
- package/dist/lib/motion.js +11 -10
- package/dist/lib/optical-center.cjs +1 -1
- package/dist/lib/optical-center.d.ts +1 -1
- package/dist/lib/optical-center.d.ts.map +1 -1
- package/dist/lib/optical-center.js +12 -5
- package/dist/lib/spring-settle.cjs +1 -1
- package/dist/lib/spring-settle.js +1 -1
- package/dist/lib/table-internal.cjs +1 -0
- package/dist/lib/table-internal.d.ts +62 -0
- package/dist/lib/table-internal.d.ts.map +1 -0
- package/dist/lib/table-internal.js +18 -0
- package/dist/lib/use-controllable.cjs +1 -0
- package/dist/lib/use-controllable.d.ts +12 -0
- package/dist/lib/use-controllable.d.ts.map +1 -0
- package/dist/lib/use-controllable.js +15 -0
- package/dist/lib/use-dev-warning.cjs +1 -1
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +29 -35
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts +1 -1
- package/dist/link.js +78 -124
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts +8 -0
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +94 -156
- package/dist/loading.cjs +1 -1
- package/dist/loading.js +124 -151
- package/dist/logo-mark.cjs +1 -0
- package/dist/logo-mark.d.ts +79 -0
- package/dist/logo-mark.d.ts.map +1 -0
- package/dist/logo-mark.js +219 -0
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts +1 -1
- package/dist/logo.d.ts.map +1 -1
- package/dist/logo.js +51 -87
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +390 -586
- package/dist/media-empty.cjs +1 -1
- package/dist/media-empty.js +27 -42
- package/dist/media-viewer.cjs +1 -0
- package/dist/media-viewer.d.ts +224 -0
- package/dist/media-viewer.d.ts.map +1 -0
- package/dist/media-viewer.js +295 -0
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.d.ts +14 -14
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +130 -267
- package/dist/multi-select-filter.cjs +1 -0
- package/dist/multi-select-filter.d.ts +186 -0
- package/dist/multi-select-filter.d.ts.map +1 -0
- package/dist/multi-select-filter.js +374 -0
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.js +108 -172
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +36 -12
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +208 -281
- package/dist/popover.cjs +1 -1
- package/dist/popover.d.ts +1 -1
- package/dist/popover.d.ts.map +1 -1
- package/dist/popover.js +34 -45
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +139 -17
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +116 -148
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.js +90 -146
- package/dist/rating.cjs +1 -1
- package/dist/rating.d.ts +80 -13
- package/dist/rating.d.ts.map +1 -1
- package/dist/rating.js +70 -65
- package/dist/relative-date.cjs +1 -0
- package/dist/relative-date.d.ts +65 -0
- package/dist/relative-date.d.ts.map +1 -0
- package/dist/relative-date.js +112 -0
- package/dist/resizable.cjs +1 -1
- package/dist/resizable.d.ts +39 -23
- package/dist/resizable.d.ts.map +1 -1
- package/dist/resizable.js +42 -44
- package/dist/result-count.cjs +1 -0
- package/dist/result-count.d.ts +110 -0
- package/dist/result-count.d.ts.map +1 -0
- package/dist/result-count.js +49 -0
- package/dist/route-progress.cjs +1 -1
- package/dist/route-progress.js +58 -102
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.d.ts +9 -1
- package/dist/scroll-area.d.ts.map +1 -1
- package/dist/scroll-area.js +44 -79
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +20 -10
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +132 -236
- package/dist/separator.cjs +1 -1
- package/dist/separator.js +90 -78
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +86 -7
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +275 -235
- package/dist/single-select-filter.cjs +1 -0
- package/dist/single-select-filter.d.ts +113 -0
- package/dist/single-select-filter.d.ts.map +1 -0
- package/dist/single-select-filter.js +224 -0
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.js +24 -38
- package/dist/slider.cjs +1 -1
- package/dist/slider.js +51 -81
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +113 -137
- package/dist/spinner.cjs +1 -1
- package/dist/spinner.js +22 -31
- package/dist/split-layout.cjs +1 -1
- package/dist/split-layout.d.ts +1 -1
- package/dist/split-layout.js +53 -102
- package/dist/status.cjs +1 -0
- package/dist/status.d.ts +51 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +60 -0
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.js +184 -316
- package/dist/switch.cjs +1 -1
- package/dist/switch.js +17 -32
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +127 -13
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +170 -192
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +12 -1
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +123 -146
- package/dist/text-reveal-motion.cjs +1 -1
- package/dist/text-reveal-motion.js +307 -363
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.d.ts.map +1 -1
- package/dist/textarea.js +23 -36
- package/dist/toggle-group.cjs +1 -1
- package/dist/toggle-group.js +43 -62
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +34 -46
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.d.ts +38 -36
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +175 -78
- package/dist/typography-heading.cjs +1 -1
- package/dist/typography-heading.js +25 -61
- package/dist/typography-text.cjs +1 -1
- package/dist/typography-text.d.ts +1 -2
- package/dist/typography-text.d.ts.map +1 -1
- package/dist/typography-text.js +27 -57
- package/dist/typography.cjs +1 -1
- package/dist/typography.d.ts +1 -1
- package/dist/typography.js +132 -340
- package/package.json +45 -46
- package/src/blocks/empty-state.tsx +42 -21
- package/src/blocks/progress-state.tsx +2 -2
- package/src/blocks/sidebar.tsx +111 -32
- package/src/components/accordion.tsx +1 -1
- package/src/components/alert-dialog.tsx +52 -5
- package/src/components/alert.tsx +16 -8
- package/src/components/badge.tsx +152 -3
- package/src/components/banner.tsx +288 -0
- package/src/components/brand-illustration-motif.tsx +1 -1
- package/src/components/breadcrumb.tsx +1 -1
- package/src/components/button.tsx +8 -6
- package/src/components/calendar.tsx +155 -9
- package/src/components/card.tsx +266 -26
- package/src/components/carousel.tsx +4 -1
- package/src/components/chart.tsx +664 -42
- package/src/components/checkbox.tsx +2 -2
- package/src/components/collapsible.tsx +4 -1
- package/src/components/combobox.tsx +42 -9
- package/src/components/command.tsx +10 -11
- package/src/components/context-menu.tsx +4 -4
- package/src/components/data-table.tsx +1363 -398
- package/src/components/date-picker.tsx +31 -4
- package/src/components/delta.tsx +217 -0
- package/src/components/drawer.tsx +5 -5
- package/src/components/dropdown-menu.tsx +4 -4
- package/src/components/field.tsx +36 -15
- package/src/components/global-layout.tsx +1 -1
- package/src/components/grid.tsx +32 -1
- package/src/components/info-tooltip.tsx +94 -0
- package/src/components/input-chip.tsx +52 -8
- package/src/components/input-group.tsx +247 -12
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +29 -11
- package/src/components/input.tsx +11 -2
- package/src/components/list.tsx +15 -3
- package/src/components/logo-mark.tsx +345 -0
- package/src/components/map.tsx +18 -20
- package/src/components/media-viewer.tsx +908 -0
- package/src/components/multi-select-filter.tsx +1046 -0
- package/src/components/navigation-menu.tsx +2 -2
- package/src/components/pagination.tsx +86 -26
- package/src/components/progress.tsx +281 -54
- package/src/components/rating.tsx +200 -74
- package/src/components/relative-date.tsx +238 -0
- package/src/components/resizable.tsx +86 -33
- package/src/components/result-count.tsx +253 -0
- package/src/components/scroll-area.tsx +31 -5
- package/src/components/select.tsx +37 -7
- package/src/components/sheet.tsx +252 -6
- package/src/components/single-select-filter.tsx +538 -0
- package/src/components/slider.tsx +2 -2
- package/src/components/sonner.tsx +16 -5
- package/src/components/split-layout.tsx +2 -2
- package/src/components/status.tsx +162 -0
- package/src/components/switch.tsx +1 -1
- package/src/components/table.tsx +305 -73
- package/src/components/tabs.tsx +94 -46
- package/src/components/textarea.tsx +21 -3
- package/src/components/toggle.tsx +2 -2
- package/src/components/tooltip.tsx +431 -68
- package/src/components/typography-text.tsx +1 -2
- package/src/components/typography.tsx +1 -1
- package/src/hooks/use-breakpoint.ts +2 -1
- package/src/hooks/use-filter-search-params.ts +302 -0
- package/src/index.ts +11 -0
- package/src/lib/block-illustration.tsx +5 -1
- package/src/lib/compose-event-handlers.ts +14 -0
- package/src/lib/download-file.ts +61 -0
- package/src/lib/empty-chip.tsx +52 -0
- package/src/lib/field-aria.tsx +97 -0
- package/src/lib/image-file-info.ts +102 -0
- package/src/lib/media-viewer-content.tsx +1587 -0
- package/src/lib/media-viewer-internal.tsx +191 -0
- package/src/lib/media-viewer-motion.ts +120 -0
- package/src/lib/motion.ts +9 -0
- package/src/lib/table-internal.ts +74 -0
- package/src/lib/use-controllable.ts +43 -0
- package/src/lib/utils.ts +1 -0
- package/src/lib/empty-chip.ts +0 -24
package/dist/carousel.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use
|
|
1
|
+
"use client";const D=require("./_virtual/_rolldown/runtime.cjs");let t=require("react");t=D.__toESM(t,1);let R=require("@brightlocal/icons"),p=require("@brightlocal/ui-components/lib/utils"),c=require("react/jsx-runtime"),M=require("@brightlocal/ui-components/button"),z=require("embla-carousel-react");z=D.__toESM(z,1);var V=t.createContext(null);function k(){const l=t.useContext(V);if(!l)throw new Error("useCarousel must be used within a <Carousel />");return l}var K=t.forwardRef(({orientation:l="horizontal",opts:s,setApi:a,plugins:f,className:x,children:u,dataHook:d,trackingEl:r,trackingLabel:i,lazyLoad:o=!1,overscan:m=1,...b},w)=>{const[h,e]=(0,z.default)({...s,axis:l==="horizontal"?"x":"y"},f),[G,T]=t.useState(!1),[U,$]=t.useState(!1),N=Math.max(0,Math.floor(m)),[F,H]=t.useState(()=>{if(!o)return new Set;const n=s?.startIndex??0,v=new Set;for(let S=Math.max(0,n-N);S<=n+N;S++)v.add(S);return v}),g=t.useCallback(n=>{n&&(T(n.canScrollPrev()),$(n.canScrollNext()))},[]),y=t.useCallback(()=>{e?.scrollPrev()},[e]),_=t.useCallback(()=>{e?.scrollNext()},[e]),J=t.useCallback(n=>{const v=l==="horizontal"?"ArrowLeft":"ArrowUp",S=l==="horizontal"?"ArrowRight":"ArrowDown";n.key===v?(n.preventDefault(),y()):n.key===S&&(n.preventDefault(),_())},[l,y,_]);t.useEffect(()=>{!e||!a||a(e)},[e,a]),t.useEffect(()=>{if(e)return g(e),e.on("reInit",g),e.on("select",g),()=>{e?.off("reInit",g),e?.off("select",g)}},[e,g]);const C=t.useCallback(n=>{if(!n||!o)return;const v=n.slidesInView(),S=n.slideNodes().length;H(I=>{const j=new Set(I);for(const q of v){const Q=Math.max(0,q-N),W=Math.min(S-1,q+N);for(let P=Q;P<=W;P++)j.add(P)}return j.size===I.size?I:j})},[o,N]);return t.useEffect(()=>{if(!(!e||!o))return C(e),e.on("slidesInView",C),e.on("select",C),e.on("reInit",C),()=>{e.off("slidesInView",C),e.off("select",C),e.off("reInit",C)}},[e,o,C]),(0,c.jsx)(V.Provider,{value:{carouselRef:h,api:e,opts:s,orientation:l||(s?.axis==="y"?"vertical":"horizontal"),scrollPrev:y,scrollNext:_,canScrollPrev:G,canScrollNext:U,lazyLoad:o,loadedSlides:F},children:(0,c.jsx)("div",{ref:w,"aria-roledescription":"carousel",className:(0,p.cn)("relative",x),"data-hook":d,"data-slot":"carousel","data-tracking-el":r,"data-tracking-label":i,role:"region",onKeyDownCapture:J,...b,children:u})})});K.displayName="Carousel";var L=t.forwardRef(({className:l,children:s,...a},f)=>{const{carouselRef:x,orientation:u,lazyLoad:d}=k(),r=u==="vertical";let i=0;const o=d?t.Children.map(s,m=>{if(t.isValidElement(m)&&m.type===E){const b=i++;return t.cloneElement(m,{_lazyIndex:b})}return m}):s;return(0,c.jsx)("div",{ref:x,className:(0,p.cn)("overflow-hidden",r&&"w-full",l),"data-slot":"carousel-content",children:(0,c.jsx)("div",{ref:f,className:(0,p.cn)("flex",r?"-mt-4 h-full w-full flex-col":"-ml-4"),...a,children:o})})});L.displayName="CarouselContent";var E=t.forwardRef(({className:l,children:s,_lazyIndex:a,...f},x)=>{const{orientation:u,lazyLoad:d,loadedSlides:r}=k(),i=!d||a===void 0||r.has(a);return(0,c.jsx)("div",{ref:x,"aria-roledescription":"slide",className:(0,p.cn)("min-w-0 shrink-0 grow-0 basis-full",u==="horizontal"?"pl-4":"w-full pt-4",l),"data-lazy-loaded":d?String(i):void 0,"data-slot":"carousel-item",role:"group",...f,children:i?s:null})});E.displayName="CarouselItem";function O({className:l,variant:s="outline",size:a="default",dataHook:f="carousel-previous",hideWhenDisabled:x=!1,ariaLabel:u="Previous slide",...d}){const{orientation:r,scrollPrev:i,canScrollPrev:o}=k();return x&&!o?null:(0,c.jsxs)(M.Button,{iconOnly:!0,className:(0,p.cn)("absolute",r==="horizontal"?"top-1/2 left-1 -translate-y-1/2 sm:-left-12":"-top-12 left-1/2 -translate-x-1/2 rotate-90",l),"data-slot":"carousel-previous",dataHook:f,disabled:!o,size:a,variant:s,onClick:i,...d,children:[(0,c.jsx)(R.ArrowLeft,{}),(0,c.jsx)("span",{className:"sr-only",children:u})]})}O.displayName="CarouselPrevious";function B({className:l,variant:s="outline",size:a="default",dataHook:f="carousel-next",hideWhenDisabled:x=!1,ariaLabel:u="Next slide",...d}){const{orientation:r,scrollNext:i,canScrollNext:o}=k();return x&&!o?null:(0,c.jsxs)(M.Button,{iconOnly:!0,className:(0,p.cn)("absolute",r==="horizontal"?"top-1/2 right-1 -translate-y-1/2 sm:-right-12":"-bottom-12 left-1/2 -translate-x-1/2 rotate-90",l),"data-slot":"carousel-next",dataHook:f,disabled:!o,size:a,variant:s,onClick:i,...d,children:[(0,c.jsx)(R.ArrowRight,{}),(0,c.jsx)("span",{className:"sr-only",children:u})]})}B.displayName="CarouselNext";function A({className:l,dataHook:s="carousel-dots",trackingEl:a,trackingLabel:f,ariaLabel:x="Slide navigation",slideAriaLabel:u,...d}){const{api:r}=k(),[i,o]=t.useState(0),[m,b]=t.useState([]);return t.useEffect(()=>{if(!r)return;b(r.scrollSnapList()),o(r.selectedScrollSnap());const w=()=>{o(r.selectedScrollSnap())},h=()=>{b(r.scrollSnapList()),o(r.selectedScrollSnap())};return r.on("select",w),r.on("reInit",h),()=>{r.off("select",w),r.off("reInit",h)}},[r]),m.length===0?null:(0,c.jsx)("div",{"aria-label":x,className:(0,p.cn)("border-border dark:border-input dark:bg-input/30 inline-flex items-center justify-center gap-2 rounded-full border bg-white px-2.5 py-2",l),"data-hook":s,"data-slot":"carousel-dots","data-tracking-el":a,"data-tracking-label":f,role:"group",...d,children:m.map((w,h)=>(0,c.jsx)("button",{"aria-current":h===i?"step":void 0,"aria-label":u?u.replace("{slide}",String(h+1)):`Go to slide ${h+1}`,className:(0,p.cn)("focus-visible:shadow-default duration-base size-3 cursor-pointer rounded-full transition-[width,background-color] ease-in-out outline-none",h===i?"bg-muted-foreground/50 dark:bg-muted-foreground/70 w-9":"bg-input hover:bg-muted-foreground/30 dark:bg-input/80 dark:hover:bg-muted-foreground/50"),"data-slot":"carousel-dot",type:"button",onClick:()=>r?.scrollTo(h)},h))})}A.displayName="CarouselDots";exports.Carousel=K;exports.CarouselContent=L;exports.CarouselDots=A;exports.CarouselItem=E;exports.CarouselNext=B;exports.CarouselPrevious=O;
|
package/dist/carousel.d.ts
CHANGED
|
@@ -97,7 +97,7 @@ interface CarouselPreviousProps extends Omit<ButtonProps, "variant" | "size" | "
|
|
|
97
97
|
/**
|
|
98
98
|
* Button to navigate to the previous slide.
|
|
99
99
|
*/
|
|
100
|
-
declare function CarouselPrevious({ className, variant, size, dataHook, hideWhenDisabled, ariaLabel, ...props }: CarouselPreviousProps):
|
|
100
|
+
declare function CarouselPrevious({ className, variant, size, dataHook, hideWhenDisabled, ariaLabel, ...props }: CarouselPreviousProps): React.JSX.Element | null;
|
|
101
101
|
declare namespace CarouselPrevious {
|
|
102
102
|
var displayName: string;
|
|
103
103
|
}
|
|
@@ -134,7 +134,7 @@ interface CarouselNextProps extends Omit<ButtonProps, "variant" | "size" | "data
|
|
|
134
134
|
/**
|
|
135
135
|
* Button to navigate to the next slide.
|
|
136
136
|
*/
|
|
137
|
-
declare function CarouselNext({ className, variant, size, dataHook, hideWhenDisabled, ariaLabel, ...props }: CarouselNextProps):
|
|
137
|
+
declare function CarouselNext({ className, variant, size, dataHook, hideWhenDisabled, ariaLabel, ...props }: CarouselNextProps): React.JSX.Element | null;
|
|
138
138
|
declare namespace CarouselNext {
|
|
139
139
|
var displayName: string;
|
|
140
140
|
}
|
|
@@ -171,7 +171,7 @@ interface CarouselDotsProps extends React.ComponentProps<"div"> {
|
|
|
171
171
|
* Dot/pill pagination indicator for the carousel.
|
|
172
172
|
* Active slide is shown as an elongated pill, inactive slides as circles.
|
|
173
173
|
*/
|
|
174
|
-
declare function CarouselDots({ className, dataHook, trackingEl, trackingLabel, ariaLabel, slideAriaLabel, ...props }: CarouselDotsProps):
|
|
174
|
+
declare function CarouselDots({ className, dataHook, trackingEl, trackingLabel, ariaLabel, slideAriaLabel, ...props }: CarouselDotsProps): React.JSX.Element | null;
|
|
175
175
|
declare namespace CarouselDots {
|
|
176
176
|
var displayName: string;
|
|
177
177
|
}
|
package/dist/carousel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.d.ts","sourceRoot":"","sources":["../../src/components/carousel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,gBAAgB,EAAE,EACvB,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAE7E,KAAK,WAAW,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAC3C,KAAK,qBAAqB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACjE,KAAK,eAAe,GAAG,qBAAqB,CAAC,CAAC,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AQ,EACR,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,YAAY,GACb,CAAC;AAEF,YAAY,EACV,aAAa,EACb,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,GAClB,CAAC"}
|
package/dist/carousel.js
CHANGED
|
@@ -1,297 +1,203 @@
|
|
|
1
|
-
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import { ArrowRight as q, ArrowLeft as F } from "@brightlocal/icons";
|
|
1
|
+
"use client";
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import { ArrowLeft as $, ArrowRight as q } from "@brightlocal/icons";
|
|
5
4
|
import { cn as C } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
+
import { jsx as p, jsxs as D } from "react/jsx-runtime";
|
|
6
6
|
import { Button as V } from "@brightlocal/ui-components/button";
|
|
7
|
-
|
|
7
|
+
import F from "embla-carousel-react";
|
|
8
|
+
var M = r.createContext(null);
|
|
8
9
|
function k() {
|
|
9
|
-
const
|
|
10
|
-
if (!
|
|
11
|
-
|
|
12
|
-
return r;
|
|
10
|
+
const o = r.useContext(M);
|
|
11
|
+
if (!o) throw new Error("useCarousel must be used within a <Carousel />");
|
|
12
|
+
return o;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
);
|
|
54
|
-
o.useEffect(() => {
|
|
55
|
-
!e || !n || n(e);
|
|
56
|
-
}, [e, n]), o.useEffect(() => {
|
|
57
|
-
if (e)
|
|
58
|
-
return b(e), e.on("reInit", b), e.on("select", b), () => {
|
|
59
|
-
e?.off("reInit", b), e?.off("select", b);
|
|
60
|
-
};
|
|
61
|
-
}, [e, b]);
|
|
62
|
-
const S = o.useCallback(
|
|
63
|
-
(a) => {
|
|
64
|
-
if (!a || !l) return;
|
|
65
|
-
const g = a.slidesInView(), x = a.slideNodes().length;
|
|
66
|
-
G((P) => {
|
|
67
|
-
const z = new Set(P);
|
|
68
|
-
for (const E of g) {
|
|
69
|
-
const U = Math.max(0, E - N), _ = Math.min(x - 1, E + N);
|
|
70
|
-
for (let R = U; R <= _; R++)
|
|
71
|
-
z.add(R);
|
|
72
|
-
}
|
|
73
|
-
return z.size === P.size ? P : z;
|
|
74
|
-
});
|
|
75
|
-
},
|
|
76
|
-
[l, N]
|
|
77
|
-
);
|
|
78
|
-
return o.useEffect(() => {
|
|
79
|
-
if (!(!e || !l))
|
|
80
|
-
return S(e), e.on("slidesInView", S), e.on("select", S), e.on("reInit", S), () => {
|
|
81
|
-
e.off("slidesInView", S), e.off("select", S), e.off("reInit", S);
|
|
82
|
-
};
|
|
83
|
-
}, [e, l, S]), /* @__PURE__ */ p(
|
|
84
|
-
M.Provider,
|
|
85
|
-
{
|
|
86
|
-
value: {
|
|
87
|
-
carouselRef: m,
|
|
88
|
-
api: e,
|
|
89
|
-
opts: s,
|
|
90
|
-
orientation: r || (s?.axis === "y" ? "vertical" : "horizontal"),
|
|
91
|
-
scrollPrev: y,
|
|
92
|
-
scrollNext: I,
|
|
93
|
-
canScrollPrev: j,
|
|
94
|
-
canScrollNext: O,
|
|
95
|
-
lazyLoad: l,
|
|
96
|
-
loadedSlides: B
|
|
97
|
-
},
|
|
98
|
-
children: /* @__PURE__ */ p(
|
|
99
|
-
"div",
|
|
100
|
-
{
|
|
101
|
-
ref: v,
|
|
102
|
-
"aria-roledescription": "carousel",
|
|
103
|
-
className: C("relative", f),
|
|
104
|
-
"data-hook": u,
|
|
105
|
-
"data-slot": "carousel",
|
|
106
|
-
"data-tracking-el": t,
|
|
107
|
-
"data-tracking-label": i,
|
|
108
|
-
role: "region",
|
|
109
|
-
onKeyDownCapture: T,
|
|
110
|
-
...w,
|
|
111
|
-
children: c
|
|
112
|
-
}
|
|
113
|
-
)
|
|
14
|
+
var H = r.forwardRef(({ orientation: o = "horizontal", opts: a, setApi: n, plugins: d, className: f, children: c, dataHook: u, trackingEl: t, trackingLabel: i, lazyLoad: l = !1, overscan: h = 1, ...v }, g) => {
|
|
15
|
+
const [m, e] = F({
|
|
16
|
+
...a,
|
|
17
|
+
axis: o === "horizontal" ? "x" : "y"
|
|
18
|
+
}, d), [j, L] = r.useState(!1), [O, A] = r.useState(!1), N = Math.max(0, Math.floor(h)), [B, G] = r.useState(() => {
|
|
19
|
+
if (!l) return /* @__PURE__ */ new Set();
|
|
20
|
+
const s = a?.startIndex ?? 0, b = /* @__PURE__ */ new Set();
|
|
21
|
+
for (let x = Math.max(0, s - N); x <= s + N; x++) b.add(x);
|
|
22
|
+
return b;
|
|
23
|
+
}), w = r.useCallback((s) => {
|
|
24
|
+
s && (L(s.canScrollPrev()), A(s.canScrollNext()));
|
|
25
|
+
}, []), y = r.useCallback(() => {
|
|
26
|
+
e?.scrollPrev();
|
|
27
|
+
}, [e]), I = r.useCallback(() => {
|
|
28
|
+
e?.scrollNext();
|
|
29
|
+
}, [e]), T = r.useCallback((s) => {
|
|
30
|
+
const b = o === "horizontal" ? "ArrowLeft" : "ArrowUp", x = o === "horizontal" ? "ArrowRight" : "ArrowDown";
|
|
31
|
+
s.key === b ? (s.preventDefault(), y()) : s.key === x && (s.preventDefault(), I());
|
|
32
|
+
}, [
|
|
33
|
+
o,
|
|
34
|
+
y,
|
|
35
|
+
I
|
|
36
|
+
]);
|
|
37
|
+
r.useEffect(() => {
|
|
38
|
+
!e || !n || n(e);
|
|
39
|
+
}, [e, n]), r.useEffect(() => {
|
|
40
|
+
if (e)
|
|
41
|
+
return w(e), e.on("reInit", w), e.on("select", w), () => {
|
|
42
|
+
e?.off("reInit", w), e?.off("select", w);
|
|
43
|
+
};
|
|
44
|
+
}, [e, w]);
|
|
45
|
+
const S = r.useCallback((s) => {
|
|
46
|
+
if (!s || !l) return;
|
|
47
|
+
const b = s.slidesInView(), x = s.slideNodes().length;
|
|
48
|
+
G((P) => {
|
|
49
|
+
const z = new Set(P);
|
|
50
|
+
for (const E of b) {
|
|
51
|
+
const U = Math.max(0, E - N), _ = Math.min(x - 1, E + N);
|
|
52
|
+
for (let R = U; R <= _; R++) z.add(R);
|
|
114
53
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
);
|
|
54
|
+
return z.size === P.size ? P : z;
|
|
55
|
+
});
|
|
56
|
+
}, [l, N]);
|
|
57
|
+
return r.useEffect(() => {
|
|
58
|
+
if (!(!e || !l))
|
|
59
|
+
return S(e), e.on("slidesInView", S), e.on("select", S), e.on("reInit", S), () => {
|
|
60
|
+
e.off("slidesInView", S), e.off("select", S), e.off("reInit", S);
|
|
61
|
+
};
|
|
62
|
+
}, [
|
|
63
|
+
e,
|
|
64
|
+
l,
|
|
65
|
+
S
|
|
66
|
+
]), /* @__PURE__ */ p(M.Provider, {
|
|
67
|
+
value: {
|
|
68
|
+
carouselRef: m,
|
|
69
|
+
api: e,
|
|
70
|
+
opts: a,
|
|
71
|
+
orientation: o || (a?.axis === "y" ? "vertical" : "horizontal"),
|
|
72
|
+
scrollPrev: y,
|
|
73
|
+
scrollNext: I,
|
|
74
|
+
canScrollPrev: j,
|
|
75
|
+
canScrollNext: O,
|
|
76
|
+
lazyLoad: l,
|
|
77
|
+
loadedSlides: B
|
|
78
|
+
},
|
|
79
|
+
children: /* @__PURE__ */ p("div", {
|
|
80
|
+
ref: g,
|
|
81
|
+
"aria-roledescription": "carousel",
|
|
82
|
+
className: C("relative", f),
|
|
83
|
+
"data-hook": u,
|
|
84
|
+
"data-slot": "carousel",
|
|
85
|
+
"data-tracking-el": t,
|
|
86
|
+
"data-tracking-label": i,
|
|
87
|
+
role: "region",
|
|
88
|
+
onKeyDownCapture: T,
|
|
89
|
+
...v,
|
|
90
|
+
children: c
|
|
91
|
+
})
|
|
92
|
+
});
|
|
93
|
+
});
|
|
118
94
|
H.displayName = "Carousel";
|
|
119
|
-
|
|
95
|
+
var J = r.forwardRef(({ className: o, children: a, ...n }, d) => {
|
|
120
96
|
const { carouselRef: f, orientation: c, lazyLoad: u } = k(), t = c === "vertical";
|
|
121
97
|
let i = 0;
|
|
122
|
-
const l = u ?
|
|
123
|
-
if (
|
|
124
|
-
const
|
|
125
|
-
return
|
|
126
|
-
h,
|
|
127
|
-
{ _lazyIndex: w }
|
|
128
|
-
);
|
|
98
|
+
const l = u ? r.Children.map(a, (h) => {
|
|
99
|
+
if (r.isValidElement(h) && h.type === K) {
|
|
100
|
+
const v = i++;
|
|
101
|
+
return r.cloneElement(h, { _lazyIndex: v });
|
|
129
102
|
}
|
|
130
103
|
return h;
|
|
131
|
-
}) :
|
|
132
|
-
return /* @__PURE__ */ p(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
"flex",
|
|
144
|
-
t ? "-mt-4 h-full w-full flex-col" : "-ml-4"
|
|
145
|
-
),
|
|
146
|
-
...n,
|
|
147
|
-
children: l
|
|
148
|
-
}
|
|
149
|
-
)
|
|
150
|
-
}
|
|
151
|
-
);
|
|
104
|
+
}) : a;
|
|
105
|
+
return /* @__PURE__ */ p("div", {
|
|
106
|
+
ref: f,
|
|
107
|
+
className: C("overflow-hidden", t && "w-full", o),
|
|
108
|
+
"data-slot": "carousel-content",
|
|
109
|
+
children: /* @__PURE__ */ p("div", {
|
|
110
|
+
ref: d,
|
|
111
|
+
className: C("flex", t ? "-mt-4 h-full w-full flex-col" : "-ml-4"),
|
|
112
|
+
...n,
|
|
113
|
+
children: l
|
|
114
|
+
})
|
|
115
|
+
});
|
|
152
116
|
});
|
|
153
117
|
J.displayName = "CarouselContent";
|
|
154
|
-
|
|
118
|
+
var K = r.forwardRef(({ className: o, children: a, _lazyIndex: n, ...d }, f) => {
|
|
155
119
|
const { orientation: c, lazyLoad: u, loadedSlides: t } = k(), i = !u || n === void 0 || t.has(n);
|
|
156
|
-
return /* @__PURE__ */ p(
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
"data-lazy-loaded": u ? String(i) : void 0,
|
|
167
|
-
"data-slot": "carousel-item",
|
|
168
|
-
role: "group",
|
|
169
|
-
...d,
|
|
170
|
-
children: i ? s : null
|
|
171
|
-
}
|
|
172
|
-
);
|
|
120
|
+
return /* @__PURE__ */ p("div", {
|
|
121
|
+
ref: f,
|
|
122
|
+
"aria-roledescription": "slide",
|
|
123
|
+
className: C("min-w-0 shrink-0 grow-0 basis-full", c === "horizontal" ? "pl-4" : "w-full pt-4", o),
|
|
124
|
+
"data-lazy-loaded": u ? String(i) : void 0,
|
|
125
|
+
"data-slot": "carousel-item",
|
|
126
|
+
role: "group",
|
|
127
|
+
...d,
|
|
128
|
+
children: i ? a : null
|
|
129
|
+
});
|
|
173
130
|
});
|
|
174
131
|
K.displayName = "CarouselItem";
|
|
175
|
-
function Q({
|
|
176
|
-
className: r,
|
|
177
|
-
variant: s = "outline",
|
|
178
|
-
size: n = "default",
|
|
179
|
-
dataHook: d = "carousel-previous",
|
|
180
|
-
hideWhenDisabled: f = !1,
|
|
181
|
-
ariaLabel: c = "Previous slide",
|
|
182
|
-
...u
|
|
183
|
-
}) {
|
|
132
|
+
function Q({ className: o, variant: a = "outline", size: n = "default", dataHook: d = "carousel-previous", hideWhenDisabled: f = !1, ariaLabel: c = "Previous slide", ...u }) {
|
|
184
133
|
const { orientation: t, scrollPrev: i, canScrollPrev: l } = k();
|
|
185
|
-
return f && !l ? null : /* @__PURE__ */ D(
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
...u,
|
|
201
|
-
children: [
|
|
202
|
-
/* @__PURE__ */ p(F, {}),
|
|
203
|
-
/* @__PURE__ */ p("span", { className: "sr-only", children: c })
|
|
204
|
-
]
|
|
205
|
-
}
|
|
206
|
-
);
|
|
134
|
+
return f && !l ? null : /* @__PURE__ */ D(V, {
|
|
135
|
+
iconOnly: !0,
|
|
136
|
+
className: C("absolute", t === "horizontal" ? "top-1/2 left-1 -translate-y-1/2 sm:-left-12" : "-top-12 left-1/2 -translate-x-1/2 rotate-90", o),
|
|
137
|
+
"data-slot": "carousel-previous",
|
|
138
|
+
dataHook: d,
|
|
139
|
+
disabled: !l,
|
|
140
|
+
size: n,
|
|
141
|
+
variant: a,
|
|
142
|
+
onClick: i,
|
|
143
|
+
...u,
|
|
144
|
+
children: [/* @__PURE__ */ p($, {}), /* @__PURE__ */ p("span", {
|
|
145
|
+
className: "sr-only",
|
|
146
|
+
children: c
|
|
147
|
+
})]
|
|
148
|
+
});
|
|
207
149
|
}
|
|
208
150
|
Q.displayName = "CarouselPrevious";
|
|
209
|
-
function W({
|
|
210
|
-
className: r,
|
|
211
|
-
variant: s = "outline",
|
|
212
|
-
size: n = "default",
|
|
213
|
-
dataHook: d = "carousel-next",
|
|
214
|
-
hideWhenDisabled: f = !1,
|
|
215
|
-
ariaLabel: c = "Next slide",
|
|
216
|
-
...u
|
|
217
|
-
}) {
|
|
151
|
+
function W({ className: o, variant: a = "outline", size: n = "default", dataHook: d = "carousel-next", hideWhenDisabled: f = !1, ariaLabel: c = "Next slide", ...u }) {
|
|
218
152
|
const { orientation: t, scrollNext: i, canScrollNext: l } = k();
|
|
219
|
-
return f && !l ? null : /* @__PURE__ */ D(
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
...u,
|
|
235
|
-
children: [
|
|
236
|
-
/* @__PURE__ */ p(q, {}),
|
|
237
|
-
/* @__PURE__ */ p("span", { className: "sr-only", children: c })
|
|
238
|
-
]
|
|
239
|
-
}
|
|
240
|
-
);
|
|
153
|
+
return f && !l ? null : /* @__PURE__ */ D(V, {
|
|
154
|
+
iconOnly: !0,
|
|
155
|
+
className: C("absolute", t === "horizontal" ? "top-1/2 right-1 -translate-y-1/2 sm:-right-12" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90", o),
|
|
156
|
+
"data-slot": "carousel-next",
|
|
157
|
+
dataHook: d,
|
|
158
|
+
disabled: !l,
|
|
159
|
+
size: n,
|
|
160
|
+
variant: a,
|
|
161
|
+
onClick: i,
|
|
162
|
+
...u,
|
|
163
|
+
children: [/* @__PURE__ */ p(q, {}), /* @__PURE__ */ p("span", {
|
|
164
|
+
className: "sr-only",
|
|
165
|
+
children: c
|
|
166
|
+
})]
|
|
167
|
+
});
|
|
241
168
|
}
|
|
242
169
|
W.displayName = "CarouselNext";
|
|
243
|
-
function X({
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
trackingEl: n,
|
|
247
|
-
trackingLabel: d,
|
|
248
|
-
ariaLabel: f = "Slide navigation",
|
|
249
|
-
slideAriaLabel: c,
|
|
250
|
-
...u
|
|
251
|
-
}) {
|
|
252
|
-
const { api: t } = k(), [i, l] = o.useState(0), [h, w] = o.useState([]);
|
|
253
|
-
return o.useEffect(() => {
|
|
170
|
+
function X({ className: o, dataHook: a = "carousel-dots", trackingEl: n, trackingLabel: d, ariaLabel: f = "Slide navigation", slideAriaLabel: c, ...u }) {
|
|
171
|
+
const { api: t } = k(), [i, l] = r.useState(0), [h, v] = r.useState([]);
|
|
172
|
+
return r.useEffect(() => {
|
|
254
173
|
if (!t) return;
|
|
255
|
-
|
|
256
|
-
const
|
|
174
|
+
v(t.scrollSnapList()), l(t.selectedScrollSnap());
|
|
175
|
+
const g = () => {
|
|
257
176
|
l(t.selectedScrollSnap());
|
|
258
177
|
}, m = () => {
|
|
259
|
-
|
|
178
|
+
v(t.scrollSnapList()), l(t.selectedScrollSnap());
|
|
260
179
|
};
|
|
261
|
-
return t.on("select",
|
|
262
|
-
t.off("select",
|
|
180
|
+
return t.on("select", g), t.on("reInit", m), () => {
|
|
181
|
+
t.off("select", g), t.off("reInit", m);
|
|
263
182
|
};
|
|
264
|
-
}, [t]), h.length === 0 ? null : /* @__PURE__ */ p(
|
|
265
|
-
"
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
"
|
|
275
|
-
"
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
"aria-label": c ? c.replace("{slide}", String(m + 1)) : `Go to slide ${m + 1}`,
|
|
283
|
-
className: C(
|
|
284
|
-
"focus-visible:shadow-default duration-base size-3 rounded-full transition-[width,background-color] ease-in-out outline-none",
|
|
285
|
-
m === i ? "bg-muted-foreground/50 dark:bg-muted-foreground/70 w-9" : "bg-input hover:bg-muted-foreground/30 dark:bg-input/80 dark:hover:bg-muted-foreground/50"
|
|
286
|
-
),
|
|
287
|
-
"data-slot": "carousel-dot",
|
|
288
|
-
type: "button",
|
|
289
|
-
onClick: () => t?.scrollTo(m)
|
|
290
|
-
},
|
|
291
|
-
m
|
|
292
|
-
))
|
|
293
|
-
}
|
|
294
|
-
);
|
|
183
|
+
}, [t]), h.length === 0 ? null : /* @__PURE__ */ p("div", {
|
|
184
|
+
"aria-label": f,
|
|
185
|
+
className: C("border-border dark:border-input dark:bg-input/30 inline-flex items-center justify-center gap-2 rounded-full border bg-white px-2.5 py-2", o),
|
|
186
|
+
"data-hook": a,
|
|
187
|
+
"data-slot": "carousel-dots",
|
|
188
|
+
"data-tracking-el": n,
|
|
189
|
+
"data-tracking-label": d,
|
|
190
|
+
role: "group",
|
|
191
|
+
...u,
|
|
192
|
+
children: h.map((g, m) => /* @__PURE__ */ p("button", {
|
|
193
|
+
"aria-current": m === i ? "step" : void 0,
|
|
194
|
+
"aria-label": c ? c.replace("{slide}", String(m + 1)) : `Go to slide ${m + 1}`,
|
|
195
|
+
className: C("focus-visible:shadow-default duration-base size-3 cursor-pointer rounded-full transition-[width,background-color] ease-in-out outline-none", m === i ? "bg-muted-foreground/50 dark:bg-muted-foreground/70 w-9" : "bg-input hover:bg-muted-foreground/30 dark:bg-input/80 dark:hover:bg-muted-foreground/50"),
|
|
196
|
+
"data-slot": "carousel-dot",
|
|
197
|
+
type: "button",
|
|
198
|
+
onClick: () => t?.scrollTo(m)
|
|
199
|
+
}, m))
|
|
200
|
+
});
|
|
295
201
|
}
|
|
296
202
|
X.displayName = "CarouselDots";
|
|
297
203
|
export {
|
package/dist/centred-layout.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const y=require("./_virtual/_rolldown/runtime.cjs");let n=require("react");n=y.__toESM(n,1);let l=require("@brightlocal/ui-components/lib/utils"),o=require("react/jsx-runtime");var d=n.forwardRef(({className:e,children:t,dataHook:r,trackingEl:a,trackingLabel:c,...i},f)=>(0,o.jsx)("div",{ref:f,className:(0,l.cn)("bg-background p-section-sm flex min-h-screen w-full flex-col items-center justify-center gap-4",e),"data-hook":r,"data-slot":"centred-layout","data-tracking-el":a,"data-tracking-label":c,...i,children:t}));d.displayName="CentredLayout";var u=n.forwardRef(({className:e,children:t,...r},a)=>(0,o.jsx)("div",{ref:a,className:(0,l.cn)("flex w-full items-center justify-center lg:justify-start",e),"data-slot":"centred-layout-header",...r,children:t}));u.displayName="CentredLayoutHeader";var s=n.forwardRef(({className:e,children:t,...r},a)=>(0,o.jsx)("div",{ref:a,className:(0,l.cn)("flex w-full flex-1 flex-col items-center justify-center",e),"data-slot":"centred-layout-content",...r,children:t}));s.displayName="CentredLayoutContent";exports.CentredLayout=d;exports.CentredLayoutContent=s;exports.CentredLayoutHeader=u;
|