@techsio/ui-kit 0.57.0 → 0.58.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/README.md +128 -133
- package/dist/atoms/action-icon.js +9 -8
- package/dist/atoms/button.js +78 -18
- package/dist/atoms/checkbox.js +77 -17
- package/dist/atoms/hotkeys.js +26 -7
- package/dist/atoms/icon.js +5 -5
- package/dist/atoms/image.js +107 -2
- package/dist/atoms/input.js +57 -9
- package/dist/atoms/label.js +13 -4
- package/dist/atoms/link-button.js +14 -12
- package/dist/atoms/link.js +18 -4
- package/dist/atoms/numeric-input.js +293 -76
- package/dist/atoms/rating.js +306 -73
- package/dist/atoms/skeleton.js +18 -14
- package/dist/atoms/status-text.js +31 -18
- package/dist/atoms/textarea.js +59 -12
- package/dist/atoms/tooltip.js +64 -43
- package/dist/hotkeys.js +1 -0
- package/dist/internal/choice-control.js +173 -0
- package/dist/internal/combobox-query-sync.js +11 -0
- package/dist/internal/date-picker-coordinator.js +56 -40
- package/dist/internal/date-picker-dom.js +44 -0
- package/dist/internal/date-picker-input.js +30 -0
- package/dist/internal/described-by.js +23 -18
- package/dist/internal/form-control-lifecycle.js +122 -0
- package/dist/internal/molecules/command.context.js +1 -0
- package/dist/internal/molecules/drawer.context.js +1 -0
- package/dist/internal/molecules/vertical-navigation.context.js +1 -0
- package/dist/internal/molecules/vertical-navigation.styles.js +9 -2
- package/dist/internal/numeric-input-editing.js +87 -0
- package/dist/internal/organisms/sidebar.context.js +1 -0
- package/dist/internal/organisms/sidebar.focus.js +1 -0
- package/dist/internal/overlay-portal.js +72 -0
- package/dist/internal/reduced-motion.js +1 -0
- package/dist/internal/use-effective-disabled.js +8 -0
- package/dist/molecules/accordion.js +44 -30
- package/dist/molecules/availability-status.js +1 -0
- package/dist/molecules/breadcrumb.js +11 -11
- package/dist/molecules/carousel.js +279 -97
- package/dist/molecules/cascade-select.js +327 -81
- package/dist/molecules/chart.js +276 -38
- package/dist/molecules/color-select.js +181 -62
- package/dist/molecules/combobox.js +535 -182
- package/dist/molecules/command.js +2 -1
- package/dist/molecules/date-picker.js +571 -119
- package/dist/molecules/dialog.js +81 -47
- package/dist/molecules/drawer.js +54 -5
- package/dist/molecules/file-upload.js +373 -37
- package/dist/molecules/form-checkbox.js +65 -22
- package/dist/molecules/form-error-summary.js +29 -5
- package/dist/molecules/form-input.js +26 -30
- package/dist/molecules/form-numeric-input.js +11 -9
- package/dist/molecules/form-textarea.js +26 -23
- package/dist/molecules/menu.js +170 -47
- package/dist/molecules/pagination.js +100 -28
- package/dist/molecules/phone-input.js +172 -37
- package/dist/molecules/popover.js +53 -26
- package/dist/molecules/price-block.js +1 -0
- package/dist/molecules/product-card.js +23 -18
- package/dist/molecules/quantity-field.js +4 -2
- package/dist/molecules/radio-card.js +102 -30
- package/dist/molecules/radio-group.js +108 -31
- package/dist/molecules/search-form.js +116 -13
- package/dist/molecules/select.js +226 -81
- package/dist/molecules/slider.js +141 -30
- package/dist/molecules/steps.js +181 -50
- package/dist/molecules/switch.js +85 -20
- package/dist/molecules/tabs.js +227 -31
- package/dist/molecules/toast.js +146 -51
- package/dist/molecules/totals-summary.js +2 -1
- package/dist/molecules/tour.js +9 -5
- package/dist/molecules/tree-view.js +255 -109
- package/dist/molecules/vertical-navigation.js +8 -4
- package/dist/organisms/data-table.fields.js +25 -5
- package/dist/organisms/data-table.helpers.js +6 -2
- package/dist/organisms/data-table.js +580 -151
- package/dist/organisms/footer.js +18 -11
- package/dist/organisms/gallery.js +61 -24
- package/dist/organisms/header.js +106 -32
- package/dist/organisms/line-item.js +1 -0
- package/dist/organisms/sidebar.js +1 -0
- package/dist/organisms/table.js +22 -7
- package/dist/src/atoms/action-icon.d.ts +10 -10
- package/dist/src/atoms/action-icon.d.ts.map +1 -1
- package/dist/src/atoms/badge.d.ts +3 -3
- package/dist/src/atoms/badge.d.ts.map +1 -1
- package/dist/src/atoms/button.d.ts +35 -24
- package/dist/src/atoms/button.d.ts.map +1 -1
- package/dist/src/atoms/checkbox.d.ts +6 -5
- package/dist/src/atoms/checkbox.d.ts.map +1 -1
- package/dist/src/atoms/hotkeys.d.ts +3 -2
- package/dist/src/atoms/hotkeys.d.ts.map +1 -1
- package/dist/src/atoms/icon.d.ts +18 -17
- package/dist/src/atoms/icon.d.ts.map +1 -1
- package/dist/src/atoms/image.d.ts +14 -6
- package/dist/src/atoms/image.d.ts.map +1 -1
- package/dist/src/atoms/input.d.ts +23 -14
- package/dist/src/atoms/input.d.ts.map +1 -1
- package/dist/src/atoms/label.d.ts +4 -4
- package/dist/src/atoms/label.d.ts.map +1 -1
- package/dist/src/atoms/link-button.d.ts +54 -31
- package/dist/src/atoms/link-button.d.ts.map +1 -1
- package/dist/src/atoms/link.d.ts +30 -9
- package/dist/src/atoms/link.d.ts.map +1 -1
- package/dist/src/atoms/numeric-input.d.ts +23 -19
- package/dist/src/atoms/numeric-input.d.ts.map +1 -1
- package/dist/src/atoms/rating.d.ts +54 -26
- package/dist/src/atoms/rating.d.ts.map +1 -1
- package/dist/src/atoms/skeleton.d.ts +9 -9
- package/dist/src/atoms/skeleton.d.ts.map +1 -1
- package/dist/src/atoms/status-text.d.ts +21 -13
- package/dist/src/atoms/status-text.d.ts.map +1 -1
- package/dist/src/atoms/textarea.d.ts +22 -20
- package/dist/src/atoms/textarea.d.ts.map +1 -1
- package/dist/src/atoms/tooltip.d.ts +5 -5
- package/dist/src/atoms/tooltip.d.ts.map +1 -1
- package/dist/src/hotkeys.d.ts +1 -1
- package/dist/src/hotkeys.d.ts.map +1 -1
- package/dist/src/internal/choice-control.d.ts +18 -0
- package/dist/src/internal/choice-control.d.ts.map +1 -0
- package/dist/src/internal/combobox-query-sync.d.ts +4 -0
- package/dist/src/internal/combobox-query-sync.d.ts.map +1 -0
- package/dist/src/internal/date-picker-coordinator.d.ts +7 -1
- package/dist/src/internal/date-picker-coordinator.d.ts.map +1 -1
- package/dist/src/internal/date-picker-dom.d.ts +10 -0
- package/dist/src/internal/date-picker-dom.d.ts.map +1 -0
- package/dist/src/internal/date-picker-input.d.ts +7 -0
- package/dist/src/internal/date-picker-input.d.ts.map +1 -0
- package/dist/src/internal/described-by.d.ts +7 -1
- package/dist/src/internal/described-by.d.ts.map +1 -1
- package/dist/src/internal/form-control-lifecycle.d.ts +22 -0
- package/dist/src/internal/form-control-lifecycle.d.ts.map +1 -0
- package/dist/src/internal/molecules/vertical-navigation.context.d.ts +1 -1
- package/dist/src/internal/molecules/vertical-navigation.context.d.ts.map +1 -1
- package/dist/src/internal/molecules/vertical-navigation.styles.d.ts +21 -0
- package/dist/src/internal/molecules/vertical-navigation.styles.d.ts.map +1 -1
- package/dist/src/internal/numeric-input-editing.d.ts +13 -0
- package/dist/src/internal/numeric-input-editing.d.ts.map +1 -0
- package/dist/src/internal/overlay-portal.d.ts +18 -0
- package/dist/src/internal/overlay-portal.d.ts.map +1 -0
- package/dist/src/internal/use-effective-disabled.d.ts +4 -0
- package/dist/src/internal/use-effective-disabled.d.ts.map +1 -0
- package/dist/src/molecules/accordion.d.ts +25 -19
- package/dist/src/molecules/accordion.d.ts.map +1 -1
- package/dist/src/molecules/availability-status.d.ts +4 -1
- package/dist/src/molecules/availability-status.d.ts.map +1 -1
- package/dist/src/molecules/breadcrumb.d.ts +2 -2
- package/dist/src/molecules/breadcrumb.d.ts.map +1 -1
- package/dist/src/molecules/carousel.d.ts +51 -52
- package/dist/src/molecules/carousel.d.ts.map +1 -1
- package/dist/src/molecules/cascade-select.d.ts +23 -8
- package/dist/src/molecules/cascade-select.d.ts.map +1 -1
- package/dist/src/molecules/chart.d.ts +7 -1
- package/dist/src/molecules/chart.d.ts.map +1 -1
- package/dist/src/molecules/color-select.d.ts +19 -3
- package/dist/src/molecules/color-select.d.ts.map +1 -1
- package/dist/src/molecules/combobox.d.ts +23 -5
- package/dist/src/molecules/combobox.d.ts.map +1 -1
- package/dist/src/molecules/command.d.ts +1 -1
- package/dist/src/molecules/date-picker.d.ts +7 -3
- package/dist/src/molecules/date-picker.d.ts.map +1 -1
- package/dist/src/molecules/dialog.d.ts +7 -3
- package/dist/src/molecules/dialog.d.ts.map +1 -1
- package/dist/src/molecules/drawer.d.ts +4 -4
- package/dist/src/molecules/drawer.d.ts.map +1 -1
- package/dist/src/molecules/file-upload.d.ts +11 -6
- package/dist/src/molecules/file-upload.d.ts.map +1 -1
- package/dist/src/molecules/form-checkbox.d.ts +7 -2
- package/dist/src/molecules/form-checkbox.d.ts.map +1 -1
- package/dist/src/molecules/form-error-summary.d.ts +4 -3
- package/dist/src/molecules/form-error-summary.d.ts.map +1 -1
- package/dist/src/molecules/form-input.d.ts +5 -6
- package/dist/src/molecules/form-input.d.ts.map +1 -1
- package/dist/src/molecules/form-numeric-input.d.ts +5 -5
- package/dist/src/molecules/form-numeric-input.d.ts.map +1 -1
- package/dist/src/molecules/form-textarea.d.ts +5 -6
- package/dist/src/molecules/form-textarea.d.ts.map +1 -1
- package/dist/src/molecules/menu.d.ts +17 -3
- package/dist/src/molecules/menu.d.ts.map +1 -1
- package/dist/src/molecules/pagination.d.ts +1 -1
- package/dist/src/molecules/pagination.d.ts.map +1 -1
- package/dist/src/molecules/phone-input.d.ts +4 -1
- package/dist/src/molecules/phone-input.d.ts.map +1 -1
- package/dist/src/molecules/popover.d.ts +7 -1
- package/dist/src/molecules/popover.d.ts.map +1 -1
- package/dist/src/molecules/price-block.d.ts +1 -1
- package/dist/src/molecules/price-block.d.ts.map +1 -1
- package/dist/src/molecules/product-card.d.ts +20 -25
- package/dist/src/molecules/product-card.d.ts.map +1 -1
- package/dist/src/molecules/quantity-field.d.ts +1 -1
- package/dist/src/molecules/quantity-field.d.ts.map +1 -1
- package/dist/src/molecules/radio-card.d.ts +10 -3
- package/dist/src/molecules/radio-card.d.ts.map +1 -1
- package/dist/src/molecules/radio-group.d.ts +15 -6
- package/dist/src/molecules/radio-group.d.ts.map +1 -1
- package/dist/src/molecules/search-form.d.ts +37 -12
- package/dist/src/molecules/search-form.d.ts.map +1 -1
- package/dist/src/molecules/select.d.ts +34 -29
- package/dist/src/molecules/select.d.ts.map +1 -1
- package/dist/src/molecules/slider.d.ts +23 -2
- package/dist/src/molecules/slider.d.ts.map +1 -1
- package/dist/src/molecules/steps.d.ts +30 -10
- package/dist/src/molecules/steps.d.ts.map +1 -1
- package/dist/src/molecules/switch.d.ts +54 -33
- package/dist/src/molecules/switch.d.ts.map +1 -1
- package/dist/src/molecules/tabs.d.ts +11 -11
- package/dist/src/molecules/tabs.d.ts.map +1 -1
- package/dist/src/molecules/toast.d.ts +25 -13
- package/dist/src/molecules/toast.d.ts.map +1 -1
- package/dist/src/molecules/totals-summary.d.ts +1 -1
- package/dist/src/molecules/totals-summary.d.ts.map +1 -1
- package/dist/src/molecules/tour.d.ts +1 -1
- package/dist/src/molecules/tour.d.ts.map +1 -1
- package/dist/src/molecules/tree-view.d.ts +16 -20
- package/dist/src/molecules/tree-view.d.ts.map +1 -1
- package/dist/src/molecules/vertical-navigation.d.ts +2 -2
- package/dist/src/molecules/vertical-navigation.d.ts.map +1 -1
- package/dist/src/organisms/data-table.d.ts +24 -3
- package/dist/src/organisms/data-table.d.ts.map +1 -1
- package/dist/src/organisms/data-table.fields.d.ts +4 -1
- package/dist/src/organisms/data-table.fields.d.ts.map +1 -1
- package/dist/src/organisms/data-table.helpers.d.ts +5 -12
- package/dist/src/organisms/data-table.helpers.d.ts.map +1 -1
- package/dist/src/organisms/footer.d.ts +5 -5
- package/dist/src/organisms/footer.d.ts.map +1 -1
- package/dist/src/organisms/gallery.d.ts +11 -9
- package/dist/src/organisms/gallery.d.ts.map +1 -1
- package/dist/src/organisms/header.d.ts +24 -22
- package/dist/src/organisms/header.d.ts.map +1 -1
- package/dist/src/organisms/table.d.ts +14 -14
- package/dist/src/organisms/table.d.ts.map +1 -1
- package/dist/src/templates/accordion.d.ts +8 -6
- package/dist/src/templates/accordion.d.ts.map +1 -1
- package/dist/src/templates/breadcrumb.d.ts +1 -1
- package/dist/src/templates/breadcrumb.d.ts.map +1 -1
- package/dist/src/templates/carousel.d.ts +3 -3
- package/dist/src/templates/carousel.d.ts.map +1 -1
- package/dist/src/templates/facet-filter-panel.d.ts +9 -3
- package/dist/src/templates/facet-filter-panel.d.ts.map +1 -1
- package/dist/src/templates/gallery.d.ts +2 -2
- package/dist/src/templates/gallery.d.ts.map +1 -1
- package/dist/src/templates/numeric-input.d.ts +1 -1
- package/dist/src/templates/numeric-input.d.ts.map +1 -1
- package/dist/src/templates/popover.d.ts +4 -2
- package/dist/src/templates/popover.d.ts.map +1 -1
- package/dist/src/templates/product-card.d.ts +12 -4
- package/dist/src/templates/product-card.d.ts.map +1 -1
- package/dist/src/templates/search-suggestions.d.ts +1 -1
- package/dist/src/templates/select.d.ts +7 -2
- package/dist/src/templates/select.d.ts.map +1 -1
- package/dist/src/templates/tabs.d.ts +8 -7
- package/dist/src/templates/tabs.d.ts.map +1 -1
- package/dist/src/theme/theme-config.d.ts +9 -16
- package/dist/src/theme/theme-config.d.ts.map +1 -1
- package/dist/src/theme/theme-provider.d.ts +16 -21
- package/dist/src/theme/theme-provider.d.ts.map +1 -1
- package/dist/src/theme/theme-toggle.d.ts.map +1 -1
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/templates/accordion.js +3 -1
- package/dist/templates/breadcrumb.js +11 -4
- package/dist/templates/carousel.js +3 -6
- package/dist/templates/facet-filter-panel.js +121 -52
- package/dist/templates/gallery.js +6 -2
- package/dist/templates/numeric-input.js +6 -1
- package/dist/templates/popover.js +6 -1
- package/dist/templates/product-card.js +52 -26
- package/dist/templates/select.js +6 -1
- package/dist/templates/tabs.js +4 -2
- package/dist/theme/theme-config.js +8 -16
- package/dist/theme/theme-provider.js +89 -63
- package/dist/theme/theme-toggle.js +17 -9
- package/dist/utils.js +11 -1
- package/package.json +9 -5
- package/src/tokens/_base.css +4 -3
- package/src/tokens/_business-atoms.css +103 -0
- package/src/tokens/_foundation-overrides.css +251 -0
- package/src/tokens/_reset.css +10 -10
- package/src/tokens/_scheme-scopes.css +4144 -0
- package/src/tokens/_semantic.css +1 -23
- package/src/tokens/_tokens-base.css +36 -32
- package/src/tokens/_typography.css +2 -1
- package/src/tokens/components/_form-control.css +149 -6
- package/src/tokens/components/_popup-surface.css +15 -29
- package/src/tokens/components/atoms/_action-icon.css +49 -0
- package/src/tokens/components/atoms/_button.css +67 -0
- package/src/tokens/components/atoms/_checkbox.css +47 -4
- package/src/tokens/components/atoms/_hotkeys.css +2 -0
- package/src/tokens/components/atoms/_icon.css +60 -7
- package/src/tokens/components/atoms/_image.css +18 -0
- package/src/tokens/components/atoms/_input.css +20 -0
- package/src/tokens/components/atoms/_label.css +3 -7
- package/src/tokens/components/atoms/_link.css +47 -5
- package/src/tokens/components/atoms/_numeric-input.css +111 -2
- package/src/tokens/components/atoms/_rating.css +55 -6
- package/src/tokens/components/atoms/_skeleton.css +12 -2
- package/src/tokens/components/atoms/_status-text.css +35 -5
- package/src/tokens/components/atoms/_textarea.css +32 -3
- package/src/tokens/components/atoms/_tooltip.css +25 -0
- package/src/tokens/components/molecules/_accordion.css +46 -5
- package/src/tokens/components/molecules/_breadcrumb.css +15 -4
- package/src/tokens/components/molecules/_carousel.css +67 -0
- package/src/tokens/components/molecules/_cascade-select.css +104 -0
- package/src/tokens/components/molecules/_chart.css +12 -14
- package/src/tokens/components/molecules/_color-select.css +21 -0
- package/src/tokens/components/molecules/_combobox.css +81 -0
- package/src/tokens/components/molecules/_command.css +1 -0
- package/src/tokens/components/molecules/_date-picker.css +66 -10
- package/src/tokens/components/molecules/_dialog.css +36 -4
- package/src/tokens/components/molecules/_drawer.css +39 -3
- package/src/tokens/components/molecules/_file-upload.css +16 -1
- package/src/tokens/components/molecules/_menu.css +17 -0
- package/src/tokens/components/molecules/_pagination.css +19 -0
- package/src/tokens/components/molecules/_phone-input.css +20 -5
- package/src/tokens/components/molecules/_popover.css +34 -0
- package/src/tokens/components/molecules/_product-card.css +49 -0
- package/src/tokens/components/molecules/_radio-card.css +35 -0
- package/src/tokens/components/molecules/_radio-group.css +8 -0
- package/src/tokens/components/molecules/_select.css +33 -0
- package/src/tokens/components/molecules/_slider.css +5 -0
- package/src/tokens/components/molecules/_steps.css +52 -0
- package/src/tokens/components/molecules/_switch.css +59 -10
- package/src/tokens/components/molecules/_tabs.css +61 -3
- package/src/tokens/components/molecules/_toast.css +60 -0
- package/src/tokens/components/molecules/_totals-summary.css +22 -22
- package/src/tokens/components/molecules/_tour.css +16 -1
- package/src/tokens/components/molecules/_tree-view.css +27 -3
- package/src/tokens/components/molecules/_vertical-navigation.css +21 -3
- package/src/tokens/components/organisms/_data-table.css +97 -0
- package/src/tokens/components/organisms/_footer.css +9 -0
- package/src/tokens/components/organisms/_gallery.css +11 -0
- package/src/tokens/components/organisms/_header.css +22 -0
- package/src/tokens/components/organisms/_sidebar.css +1 -1
- package/src/tokens/components/organisms/_table.css +31 -0
- package/src/tokens/components/templates/_facet-filter-panel.css +11 -1
- package/src/tokens/figma/akros/variables.css +6 -6
- package/src/tokens/figma/brand-overrides.css +162 -57
- package/src/tokens/figma/business/variables.css +6 -6
- package/src/tokens/figma/cyber/variables.css +115 -38
- package/src/tokens/figma/cyber-dark/variables.css +115 -38
- package/src/tokens/figma/dark/variables.css +4 -4
- package/src/tokens/figma/light/variables.css +43 -40
- package/src/tokens/figma/{neo → n1}/variables.css +114 -114
- package/src/tokens/figma/variables.css +639 -240
- package/src/tokens/theme.css +24 -4
- package/src/tokens/_colors.css +0 -5
- package/src/tokens/figma/neo-dark/variables.css +0 -457
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
2
3
|
import { createContext, useContext } from "react";
|
|
3
4
|
import { Icon } from "../atoms/icon.js";
|
|
@@ -6,39 +7,37 @@ import { tv } from "../utils.js";
|
|
|
6
7
|
const BreadcrumbVariants = tv({
|
|
7
8
|
slots: {
|
|
8
9
|
root: [
|
|
9
|
-
"inline-flex flex-wrap items-center",
|
|
10
|
+
"inline-flex min-w-0 max-w-full flex-wrap items-center",
|
|
10
11
|
"bg-breadcrumb-bg"
|
|
11
12
|
],
|
|
12
13
|
list: [
|
|
13
|
-
"flex flex-wrap items-center",
|
|
14
|
-
"
|
|
14
|
+
"flex min-w-0 max-w-full flex-wrap items-center",
|
|
15
|
+
"wrap-anywhere",
|
|
15
16
|
"list-none",
|
|
16
17
|
"text-breadcrumb-item"
|
|
17
18
|
],
|
|
18
19
|
item: [
|
|
19
|
-
"inline-flex min-w-0 items-center",
|
|
20
|
+
"wrap-anywhere inline-flex min-w-0 max-w-full items-center",
|
|
20
21
|
"text-breadcrumb-item"
|
|
21
22
|
],
|
|
22
23
|
link: [
|
|
23
|
-
"inline-flex min-w-0 items-center",
|
|
24
|
+
"wrap-anywhere inline-flex min-w-0 max-w-full items-center",
|
|
24
25
|
"rounded-breadcrumb-link",
|
|
25
26
|
"text-breadcrumb-item",
|
|
26
27
|
"no-underline",
|
|
27
28
|
"cursor-pointer",
|
|
28
29
|
"hover:text-breadcrumb-item-hover",
|
|
29
|
-
"focus-visible:
|
|
30
|
-
"focus-visible:outline-breadcrumb-ring",
|
|
31
|
-
"focus-visible:outline-offset-(length:--default-ring-offset)",
|
|
30
|
+
"focus-visible:breadcrumb-focus",
|
|
32
31
|
"transition-colors duration-200 motion-reduce:transition-none"
|
|
33
32
|
],
|
|
34
33
|
currentLink: [
|
|
35
|
-
"inline-flex min-w-0 items-center",
|
|
34
|
+
"wrap-anywhere inline-flex min-w-0 max-w-full items-center",
|
|
36
35
|
"rounded-breadcrumb-link",
|
|
37
36
|
"text-breadcrumb-item-current",
|
|
38
37
|
"cursor-default"
|
|
39
38
|
],
|
|
40
39
|
icon: [
|
|
41
|
-
"inline-flex items-center justify-center"
|
|
40
|
+
"inline-flex shrink-0 items-center justify-center"
|
|
42
41
|
],
|
|
43
42
|
iconSize: "",
|
|
44
43
|
separator: [
|
|
@@ -160,13 +159,14 @@ Breadcrumb.Item = function({ children, className, ref, ...props }) {
|
|
|
160
159
|
children: children
|
|
161
160
|
});
|
|
162
161
|
};
|
|
163
|
-
Breadcrumb.Link = function({ children, className, ...props }) {
|
|
162
|
+
Breadcrumb.Link = function({ size = "current", children, className, ...props }) {
|
|
164
163
|
const { styles } = useBreadcrumbContext();
|
|
165
164
|
return /*#__PURE__*/ jsx(Link, {
|
|
166
165
|
className: styles.link({
|
|
167
166
|
className
|
|
168
167
|
}),
|
|
169
168
|
...props,
|
|
169
|
+
size: size,
|
|
170
170
|
children: children
|
|
171
171
|
});
|
|
172
172
|
};
|
|
@@ -1,47 +1,191 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { connect, machine } from "@zag-js/carousel";
|
|
2
4
|
import { normalizeProps, useMachine } from "@zag-js/react";
|
|
3
5
|
import { createContext, useContext, useId } from "react";
|
|
4
|
-
import { tv } from "tailwind-variants";
|
|
5
6
|
import { ActionIcon } from "../atoms/action-icon.js";
|
|
6
|
-
import { Image } from "../atoms/image.js";
|
|
7
|
+
import { Image, ImageWithFallback } from "../atoms/image.js";
|
|
7
8
|
import { usePrefersReducedMotion } from "../internal/reduced-motion.js";
|
|
8
|
-
import
|
|
9
|
+
import { tv } from "../utils.js";
|
|
10
|
+
const carouselMachine = {
|
|
11
|
+
...machine,
|
|
12
|
+
implementations: {
|
|
13
|
+
...machine.implementations,
|
|
14
|
+
effects: {
|
|
15
|
+
...machine.implementations?.effects,
|
|
16
|
+
trackSlideIntersections ({ scope, context, prop, send }) {
|
|
17
|
+
const group = scope.getById(scope.ids?.itemGroup ?? `carousel:${scope.id}:item-group`);
|
|
18
|
+
if (!group) return;
|
|
19
|
+
const win = scope.getWin();
|
|
20
|
+
let items = new Set();
|
|
21
|
+
let frame = 0;
|
|
22
|
+
const currentItems = ()=>Array.from(group.querySelectorAll('[data-scope="carousel"][data-part="item"]')).filter((item)=>item.closest('[data-part="item-group"]') === group);
|
|
23
|
+
const updateVisibility = ()=>{
|
|
24
|
+
const viewport = group.getBoundingClientRect();
|
|
25
|
+
const configuredThreshold = prop("inViewThreshold") ?? 0.6;
|
|
26
|
+
const threshold = Array.isArray(configuredThreshold) ? Math.min(...configuredThreshold) : configuredThreshold;
|
|
27
|
+
const visible = [
|
|
28
|
+
...items
|
|
29
|
+
].filter((item)=>{
|
|
30
|
+
const rect = item.getBoundingClientRect();
|
|
31
|
+
const width = Math.max(0, Math.min(rect.right, viewport.right) - Math.max(rect.left, viewport.left));
|
|
32
|
+
const height = Math.max(0, Math.min(rect.bottom, viewport.bottom) - Math.max(rect.top, viewport.top));
|
|
33
|
+
return width > 0 && height > 0 && rect.width > 0 && rect.height > 0 && width * height / (rect.width * rect.height) >= threshold;
|
|
34
|
+
});
|
|
35
|
+
const active = group.ownerDocument.activeElement;
|
|
36
|
+
if ([
|
|
37
|
+
...items
|
|
38
|
+
].some((item)=>item.contains(active) && !visible.includes(item))) group.focus({
|
|
39
|
+
preventScroll: true
|
|
40
|
+
});
|
|
41
|
+
const indexes = visible.map((item)=>Number(item.dataset.index));
|
|
42
|
+
if (indexes.join(",") !== context.get("slidesInView").join(",")) context.set("slidesInView", indexes);
|
|
43
|
+
};
|
|
44
|
+
const schedule = ()=>{
|
|
45
|
+
win.cancelAnimationFrame(frame);
|
|
46
|
+
frame = win.requestAnimationFrame(updateVisibility);
|
|
47
|
+
};
|
|
48
|
+
const observer = new win.IntersectionObserver((entries)=>{
|
|
49
|
+
if (entries.some((entry)=>items.has(entry.target) && group.contains(entry.target))) updateVisibility();
|
|
50
|
+
}, {
|
|
51
|
+
root: group,
|
|
52
|
+
threshold: prop("inViewThreshold")
|
|
53
|
+
});
|
|
54
|
+
const resize = new win.ResizeObserver(schedule);
|
|
55
|
+
resize.observe(group);
|
|
56
|
+
const refresh = ()=>{
|
|
57
|
+
const next = new Set(currentItems());
|
|
58
|
+
for (const item of items)if (!next.has(item)) {
|
|
59
|
+
observer.unobserve(item);
|
|
60
|
+
resize.unobserve(item);
|
|
61
|
+
}
|
|
62
|
+
for (const item of next)if (!items.has(item)) {
|
|
63
|
+
observer.observe(item);
|
|
64
|
+
resize.observe(item);
|
|
65
|
+
}
|
|
66
|
+
items = next;
|
|
67
|
+
send({
|
|
68
|
+
type: "SNAP.REFRESH",
|
|
69
|
+
src: "slide.identity"
|
|
70
|
+
});
|
|
71
|
+
send({
|
|
72
|
+
type: "PAGE.SCROLL",
|
|
73
|
+
instant: true
|
|
74
|
+
});
|
|
75
|
+
schedule();
|
|
76
|
+
};
|
|
77
|
+
const mutations = new win.MutationObserver(refresh);
|
|
78
|
+
mutations.observe(group, {
|
|
79
|
+
childList: true,
|
|
80
|
+
subtree: true
|
|
81
|
+
});
|
|
82
|
+
group.addEventListener("scroll", schedule, {
|
|
83
|
+
passive: true
|
|
84
|
+
});
|
|
85
|
+
refresh();
|
|
86
|
+
return ()=>{
|
|
87
|
+
observer.disconnect();
|
|
88
|
+
resize.disconnect();
|
|
89
|
+
mutations.disconnect();
|
|
90
|
+
group.removeEventListener("scroll", schedule);
|
|
91
|
+
win.cancelAnimationFrame(frame);
|
|
92
|
+
items.clear();
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
trackKeyboardScroll ({ scope, send, context, prop }) {
|
|
96
|
+
const group = scope.getById(scope.ids?.itemGroup ?? `carousel:${scope.id}:item-group`);
|
|
97
|
+
if (!group) return;
|
|
98
|
+
const horizontal = "horizontal" === prop("orientation");
|
|
99
|
+
const forward = "rtl" === prop("dir") ? "ArrowLeft" : "ArrowRight";
|
|
100
|
+
const backward = "rtl" === prop("dir") ? "ArrowRight" : "ArrowLeft";
|
|
101
|
+
const next = horizontal ? forward : "ArrowDown";
|
|
102
|
+
const previous = horizontal ? backward : "ArrowUp";
|
|
103
|
+
const onKeyDown = (event)=>{
|
|
104
|
+
const target = event.target;
|
|
105
|
+
if (!(target instanceof scope.getWin().HTMLElement && group.contains(target))) return;
|
|
106
|
+
if (target.closest('[data-part="item-group"]') !== group) return;
|
|
107
|
+
if ([
|
|
108
|
+
event.defaultPrevented,
|
|
109
|
+
event.altKey,
|
|
110
|
+
event.ctrlKey,
|
|
111
|
+
event.metaKey,
|
|
112
|
+
event.shiftKey
|
|
113
|
+
].some(Boolean)) return;
|
|
114
|
+
if (target.isContentEditable || target.closest('input, textarea, select, [role="textbox"], [role="combobox"], [role="slider"], [role="spinbutton"], [role="listbox"], [role="tree"], [role="grid"], [role="radiogroup"], [role="tablist"], [role="menu"], [role="menubar"]')) return;
|
|
115
|
+
if (event.key === next) {
|
|
116
|
+
event.preventDefault();
|
|
117
|
+
send({
|
|
118
|
+
type: "PAGE.NEXT"
|
|
119
|
+
});
|
|
120
|
+
} else if (event.key === previous) {
|
|
121
|
+
event.preventDefault();
|
|
122
|
+
send({
|
|
123
|
+
type: "PAGE.PREV"
|
|
124
|
+
});
|
|
125
|
+
} else if ("Home" === event.key || "End" === event.key) {
|
|
126
|
+
event.preventDefault();
|
|
127
|
+
send({
|
|
128
|
+
type: "PAGE.SET",
|
|
129
|
+
index: "Home" === event.key ? 0 : context.get("pageSnapPoints").length - 1
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const win = scope.getWin();
|
|
134
|
+
win.addEventListener("keydown", onKeyDown, {
|
|
135
|
+
capture: true
|
|
136
|
+
});
|
|
137
|
+
return ()=>win.removeEventListener("keydown", onKeyDown, {
|
|
138
|
+
capture: true
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
9
144
|
const carouselVariants = tv({
|
|
10
145
|
slots: {
|
|
11
146
|
wrapper: [
|
|
12
|
-
"relative w-
|
|
147
|
+
"relative w-full"
|
|
13
148
|
],
|
|
149
|
+
media: "",
|
|
14
150
|
root: [
|
|
15
|
-
"relative
|
|
151
|
+
"carousel-side-layout relative w-full",
|
|
16
152
|
"rounded-carousel"
|
|
17
153
|
],
|
|
18
154
|
control: [
|
|
19
|
-
"flex gap-carousel-control p-carousel-control",
|
|
155
|
+
"flex items-center gap-carousel-control p-carousel-control",
|
|
156
|
+
"data-[orientation=vertical]:flex-col",
|
|
157
|
+
"border border-carousel-control-border shadow-carousel-control",
|
|
20
158
|
"bg-carousel-control-bg",
|
|
21
159
|
"rounded-carousel"
|
|
22
160
|
],
|
|
23
161
|
slideGroup: [
|
|
24
|
-
"overflow-hidden",
|
|
162
|
+
"focus-visible:carousel-focus-ring overflow-hidden rounded-carousel",
|
|
25
163
|
"scrollbar-none",
|
|
26
164
|
"data-dragging:cursor-grabbing",
|
|
27
|
-
"
|
|
165
|
+
"min-h-0 min-w-0"
|
|
28
166
|
],
|
|
29
167
|
slide: [
|
|
30
168
|
"relative shrink-0",
|
|
31
169
|
"flex items-center justify-center",
|
|
32
170
|
"overflow-hidden",
|
|
171
|
+
"min-h-0 min-w-0",
|
|
33
172
|
"data-[orientation=vertical]:size-full"
|
|
34
173
|
],
|
|
35
174
|
prevTrigger: [
|
|
36
|
-
"
|
|
37
|
-
"
|
|
175
|
+
"border border-carousel-trigger-border bg-carousel-navigation-bg text-carousel-trigger-fg-base shadow-carousel-navigation",
|
|
176
|
+
"data-disabled:cursor-not-allowed data-disabled:text-carousel-trigger-fg-disabled",
|
|
177
|
+
"data-disabled:hover:bg-carousel-navigation-bg data-disabled:hover:text-carousel-trigger-fg-disabled",
|
|
178
|
+
"hover:bg-carousel-navigation-bg-hover hover:text-carousel-trigger-fg-hover"
|
|
38
179
|
],
|
|
39
180
|
nextTrigger: [
|
|
40
|
-
"
|
|
41
|
-
"
|
|
181
|
+
"border border-carousel-trigger-border bg-carousel-navigation-bg text-carousel-trigger-fg-base shadow-carousel-navigation",
|
|
182
|
+
"data-disabled:cursor-not-allowed data-disabled:text-carousel-trigger-fg-disabled",
|
|
183
|
+
"data-disabled:hover:bg-carousel-navigation-bg data-disabled:hover:text-carousel-trigger-fg-disabled",
|
|
184
|
+
"hover:bg-carousel-navigation-bg-hover hover:text-carousel-trigger-fg-hover"
|
|
42
185
|
],
|
|
43
186
|
indicatorGroup: [
|
|
44
|
-
"flex
|
|
187
|
+
"flex items-center justify-center gap-carousel-indicator",
|
|
188
|
+
"data-[orientation=vertical]:flex-col"
|
|
45
189
|
],
|
|
46
190
|
indicator: [
|
|
47
191
|
"group inline-flex shrink-0 cursor-pointer items-center justify-center",
|
|
@@ -49,34 +193,33 @@ const carouselVariants = tv({
|
|
|
49
193
|
"rounded-carousel-indicator border border-carousel-indicator-border-base",
|
|
50
194
|
"data-current:border-carousel-indicator-border-active",
|
|
51
195
|
"text-carousel-trigger-fg-base",
|
|
52
|
-
"focus-visible:
|
|
53
|
-
"focus-visible:outline-carousel-ring",
|
|
54
|
-
"focus-visible:outline-offset-(length:--default-ring-offset)"
|
|
196
|
+
"focus-visible:carousel-focus-ring"
|
|
55
197
|
],
|
|
56
198
|
indicatorDot: [
|
|
57
199
|
"size-carousel-indicator-dot rounded-carousel-indicator",
|
|
58
200
|
"bg-carousel-indicator-bg-base",
|
|
59
|
-
"group-data-current:bg-carousel-indicator-bg-active",
|
|
201
|
+
"group-data-current:scale-125 group-data-current:bg-carousel-indicator-bg-active",
|
|
60
202
|
"transition-colors duration-200 motion-reduce:transition-none"
|
|
61
203
|
],
|
|
62
204
|
autoplayTrigger: [
|
|
63
|
-
"absolute top-carousel-trigger-top right-carousel-trigger-right
|
|
64
|
-
"bg-carousel-
|
|
65
|
-
|
|
66
|
-
spacer: [
|
|
67
|
-
"flex-1"
|
|
205
|
+
"absolute top-carousel-trigger-top right-carousel-trigger-right",
|
|
206
|
+
"border border-carousel-trigger-border bg-carousel-navigation-bg text-carousel-trigger-fg-base shadow-carousel-navigation",
|
|
207
|
+
"hover:bg-carousel-navigation-bg-hover hover:text-carousel-trigger-fg-hover"
|
|
68
208
|
]
|
|
69
209
|
},
|
|
70
210
|
variants: {
|
|
71
211
|
objectFit: {
|
|
72
212
|
cover: {
|
|
73
|
-
slide: "*:size-full *:object-cover"
|
|
213
|
+
slide: "*:size-full *:object-cover",
|
|
214
|
+
media: "object-cover"
|
|
74
215
|
},
|
|
75
216
|
contain: {
|
|
76
|
-
slide: "*:size-full *:object-contain"
|
|
217
|
+
slide: "*:size-full *:object-contain",
|
|
218
|
+
media: "object-contain"
|
|
77
219
|
},
|
|
78
220
|
fill: {
|
|
79
|
-
slide: "*:size-full *:object-fill"
|
|
221
|
+
slide: "*:size-full *:object-fill",
|
|
222
|
+
media: "object-fill"
|
|
80
223
|
},
|
|
81
224
|
none: {
|
|
82
225
|
slide: ""
|
|
@@ -84,82 +227,61 @@ const carouselVariants = tv({
|
|
|
84
227
|
},
|
|
85
228
|
controlPosition: {
|
|
86
229
|
side: {
|
|
87
|
-
control: "
|
|
230
|
+
control: "absolute top-1/2 right-carousel-control-inset -translate-y-1/2 flex-col"
|
|
88
231
|
},
|
|
89
232
|
top: {
|
|
90
|
-
control: "absolute top-
|
|
233
|
+
control: "absolute top-carousel-control-inset left-1/2 -translate-x-1/2"
|
|
91
234
|
},
|
|
92
235
|
bottom: {
|
|
93
|
-
control: "absolute bottom-
|
|
236
|
+
control: "absolute bottom-carousel-control-inset left-1/2 -translate-x-1/2"
|
|
94
237
|
},
|
|
95
238
|
unset: {}
|
|
96
239
|
},
|
|
240
|
+
controls: {
|
|
241
|
+
standard: {},
|
|
242
|
+
minimal: {
|
|
243
|
+
control: [
|
|
244
|
+
"pointer-events-none absolute inset-0 justify-between rounded-none border-0 bg-transparent shadow-none",
|
|
245
|
+
"*:pointer-events-auto"
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
},
|
|
97
249
|
aspectRatio: {
|
|
98
250
|
square: {
|
|
99
|
-
slideGroup: "
|
|
100
|
-
slide: "data-[orientation=horizontal]:aspect-square"
|
|
251
|
+
slideGroup: "aspect-square"
|
|
101
252
|
},
|
|
102
253
|
landscape: {
|
|
103
|
-
slideGroup: "
|
|
104
|
-
slide: "data-[orientation=horizontal]:aspect-video"
|
|
254
|
+
slideGroup: "aspect-video"
|
|
105
255
|
},
|
|
106
256
|
portrait: {
|
|
107
|
-
slideGroup: "
|
|
108
|
-
slide: "data-[orientation=horizontal]:aspect-portrait"
|
|
257
|
+
slideGroup: "aspect-portrait"
|
|
109
258
|
},
|
|
110
259
|
wide: {
|
|
111
|
-
slideGroup: "
|
|
112
|
-
slide: "data-[orientation=horizontal]:aspect-wide"
|
|
260
|
+
slideGroup: "aspect-wide"
|
|
113
261
|
},
|
|
114
262
|
none: {
|
|
115
|
-
slideGroup: ""
|
|
116
|
-
slide: ""
|
|
263
|
+
slideGroup: "data-[orientation=vertical]:h-full"
|
|
117
264
|
}
|
|
118
265
|
},
|
|
119
266
|
size: {
|
|
120
267
|
sm: {
|
|
121
|
-
|
|
122
|
-
"data-[orientation=horizontal]:max-w-carousel-root-sm",
|
|
123
|
-
"data-[orientation=vertical]:max-h-carousel-root-sm"
|
|
124
|
-
],
|
|
125
|
-
slide: [
|
|
126
|
-
"data-[orientation=horizontal]:max-w-carousel-root-sm",
|
|
127
|
-
"data-[orientation=vertical]:max-h-carousel-root-sm"
|
|
128
|
-
]
|
|
268
|
+
wrapper: "max-w-carousel-root-sm"
|
|
129
269
|
},
|
|
130
270
|
md: {
|
|
131
|
-
|
|
132
|
-
"data-[orientation=horizontal]:max-w-carousel-root-md",
|
|
133
|
-
"data-[orientation=vertical]:max-h-carousel-root-md"
|
|
134
|
-
],
|
|
135
|
-
slide: [
|
|
136
|
-
"data-[orientation=horizontal]:max-w-carousel-root-md",
|
|
137
|
-
"data-[orientation=vertical]:max-h-carousel-root-md"
|
|
138
|
-
]
|
|
271
|
+
wrapper: "max-w-carousel-root-md"
|
|
139
272
|
},
|
|
140
273
|
lg: {
|
|
141
|
-
|
|
142
|
-
"data-[orientation=horizontal]:max-w-carousel-root-lg",
|
|
143
|
-
"data-[orientation=vertical]:max-h-carousel-root-lg"
|
|
144
|
-
],
|
|
145
|
-
slide: [
|
|
146
|
-
"data-[orientation=horizontal]:max-w-carousel-root-lg",
|
|
147
|
-
"data-[orientation=vertical]:max-h-carousel-root-lg"
|
|
148
|
-
]
|
|
274
|
+
wrapper: "max-w-carousel-root-lg"
|
|
149
275
|
},
|
|
150
|
-
full: {
|
|
151
|
-
root: [
|
|
152
|
-
"data-[orientation=horizontal]:w-full",
|
|
153
|
-
"data-[orientation=vertical]:h-full"
|
|
154
|
-
]
|
|
155
|
-
}
|
|
276
|
+
full: {}
|
|
156
277
|
}
|
|
157
278
|
},
|
|
158
279
|
defaultVariants: {
|
|
159
280
|
aspectRatio: "square",
|
|
160
281
|
objectFit: "cover",
|
|
161
282
|
size: "md",
|
|
162
|
-
controlPosition: "bottom"
|
|
283
|
+
controlPosition: "bottom",
|
|
284
|
+
controls: "standard"
|
|
163
285
|
}
|
|
164
286
|
});
|
|
165
287
|
const CarouselContext = /*#__PURE__*/ createContext(null);
|
|
@@ -173,13 +295,34 @@ const useCarouselContext = ()=>{
|
|
|
173
295
|
if (!context) throw new Error("Carousel components must be used within Carousel.Root");
|
|
174
296
|
return context;
|
|
175
297
|
};
|
|
176
|
-
function Carousel({ id, size, objectFit, aspectRatio, orientation = "horizontal", slideCount = 1, loop = true, autoplay = false, allowMouseDrag = true, slidesPerPage = 1, slidesPerMove = 1, spacing = "0px", padding = "0px", dir = "ltr", snapType = "mandatory", className, children, width, height, onPageChange, "aria-label": ariaLabel, ...props }) {
|
|
298
|
+
function Carousel({ id, size, objectFit, aspectRatio, orientation = "horizontal", slideCount = 1, loop = true, autoplay = false, allowMouseDrag = true, slidesPerPage = 1, slidesPerMove = 1, spacing = "0px", padding = "0px", dir = "ltr", snapType = "mandatory", className, children, width, height, imageAs, onPageChange, "aria-label": ariaLabel, ...props }) {
|
|
177
299
|
const fallbackId = useId();
|
|
178
300
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
179
|
-
const
|
|
301
|
+
const motionAwareMachine = {
|
|
302
|
+
...carouselMachine,
|
|
303
|
+
initialState: (params)=>prefersReducedMotion ? "idle" : carouselMachine.initialState(params),
|
|
304
|
+
watch (params) {
|
|
305
|
+
carouselMachine.watch?.({
|
|
306
|
+
...params,
|
|
307
|
+
send (event) {
|
|
308
|
+
if (prefersReducedMotion && "AUTOPLAY.START" === event.type) return;
|
|
309
|
+
params.send(event);
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
params.track([
|
|
313
|
+
()=>prefersReducedMotion
|
|
314
|
+
], ()=>{
|
|
315
|
+
params.send({
|
|
316
|
+
type: !prefersReducedMotion && params.prop("autoplay") ? "AUTOPLAY.START" : "AUTOPLAY.PAUSE",
|
|
317
|
+
src: "motion.preference.change"
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
const service = useMachine(motionAwareMachine, {
|
|
180
323
|
id: id ?? fallbackId,
|
|
181
324
|
slideCount,
|
|
182
|
-
autoplay
|
|
325
|
+
autoplay,
|
|
183
326
|
orientation,
|
|
184
327
|
allowMouseDrag,
|
|
185
328
|
loop,
|
|
@@ -192,7 +335,7 @@ function Carousel({ id, size, objectFit, aspectRatio, orientation = "horizontal"
|
|
|
192
335
|
onPageChange,
|
|
193
336
|
...props
|
|
194
337
|
});
|
|
195
|
-
const api =
|
|
338
|
+
const api = connect(service, normalizeProps);
|
|
196
339
|
const { wrapper, root } = carouselVariants({
|
|
197
340
|
size,
|
|
198
341
|
objectFit,
|
|
@@ -221,17 +364,25 @@ function Carousel({ id, size, objectFit, aspectRatio, orientation = "horizontal"
|
|
|
221
364
|
api,
|
|
222
365
|
size,
|
|
223
366
|
objectFit,
|
|
224
|
-
aspectRatio
|
|
367
|
+
aspectRatio,
|
|
368
|
+
orientation,
|
|
369
|
+
dir,
|
|
370
|
+
imageAs
|
|
225
371
|
},
|
|
226
372
|
children: /*#__PURE__*/ jsx("div", {
|
|
227
373
|
className: wrapper(),
|
|
228
374
|
style: resolvedWrapperStyle,
|
|
229
|
-
children: /*#__PURE__*/ jsx("
|
|
375
|
+
children: /*#__PURE__*/ jsx("section", {
|
|
230
376
|
...rootProps,
|
|
231
377
|
"aria-label": ariaLabel,
|
|
232
378
|
className: root({
|
|
233
379
|
className
|
|
234
380
|
}),
|
|
381
|
+
onFocusCapture: (event)=>{
|
|
382
|
+
if (event.target.closest('[data-part="autoplay-trigger"]')) return;
|
|
383
|
+
api.pause();
|
|
384
|
+
},
|
|
385
|
+
onMouseEnter: ()=>api.pause(),
|
|
235
386
|
style: resolvedRootStyle,
|
|
236
387
|
children: children
|
|
237
388
|
})
|
|
@@ -239,31 +390,37 @@ function Carousel({ id, size, objectFit, aspectRatio, orientation = "horizontal"
|
|
|
239
390
|
});
|
|
240
391
|
}
|
|
241
392
|
Carousel.Slides = function({ slides, size: overrideSize, imageAs, className }) {
|
|
242
|
-
const { api, size: contextSize, objectFit, aspectRatio } = useCarouselContext();
|
|
393
|
+
const { api, size: contextSize, objectFit, aspectRatio, imageAs: contextImageAs } = useCarouselContext();
|
|
243
394
|
const size = overrideSize ?? contextSize;
|
|
244
|
-
const { slideGroup } = carouselVariants({
|
|
395
|
+
const { slideGroup, media } = carouselVariants({
|
|
245
396
|
size,
|
|
246
397
|
objectFit,
|
|
247
398
|
aspectRatio
|
|
248
399
|
});
|
|
249
|
-
const
|
|
250
|
-
const
|
|
400
|
+
const resolvedImageAs = imageAs ?? contextImageAs;
|
|
401
|
+
const Media = ImageWithFallback;
|
|
402
|
+
const groupProps = api.getItemGroupProps();
|
|
251
403
|
return /*#__PURE__*/ jsx("div", {
|
|
404
|
+
...groupProps,
|
|
252
405
|
className: slideGroup({
|
|
253
406
|
className
|
|
254
407
|
}),
|
|
255
|
-
|
|
408
|
+
onMouseDown: (event)=>{
|
|
409
|
+
const target = event.target;
|
|
410
|
+
if (target.isContentEditable || target.closest('input, textarea, select, button, a[href], [role="textbox"], [role="combobox"], [role="slider"], [role="spinbutton"], [role="listbox"], [role="tree"], [role="grid"], [role="radiogroup"], [role="tablist"], [role="menu"], [role="menubar"]')) return;
|
|
411
|
+
groupProps.onMouseDown?.(event);
|
|
412
|
+
},
|
|
256
413
|
children: slides.map((slide, index)=>/*#__PURE__*/ jsx(Carousel.Slide, {
|
|
257
414
|
index: index,
|
|
258
|
-
children: slide.content
|
|
415
|
+
children: slide.content ?? /*#__PURE__*/ jsx(Media, {
|
|
259
416
|
alt: slide.alt || "",
|
|
260
417
|
src: slide.src || "",
|
|
261
|
-
...slide.imageProps
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
})
|
|
418
|
+
...slide.imageProps,
|
|
419
|
+
as: resolvedImageAs && resolvedImageAs !== Image ? resolvedImageAs : "img",
|
|
420
|
+
className: media({
|
|
421
|
+
className: slide.imageProps?.className
|
|
422
|
+
})
|
|
423
|
+
})
|
|
267
424
|
}, slide.id))
|
|
268
425
|
});
|
|
269
426
|
};
|
|
@@ -288,32 +445,52 @@ Carousel.Slide = function({ index, children, size: overrideSize, className }) {
|
|
|
288
445
|
children: children
|
|
289
446
|
});
|
|
290
447
|
};
|
|
291
|
-
Carousel.Previous = function({ className, icon
|
|
292
|
-
const { api, size } = useCarouselContext();
|
|
448
|
+
Carousel.Previous = function({ className, icon }) {
|
|
449
|
+
const { api, size, orientation, dir } = useCarouselContext();
|
|
293
450
|
const { prevTrigger } = carouselVariants();
|
|
294
451
|
const triggerProps = api.getPrevTriggerProps();
|
|
452
|
+
const disabled = !api.canScrollPrev || api.pageSnapPoints.length <= 1;
|
|
453
|
+
let resolvedIcon = icon;
|
|
454
|
+
if (!resolvedIcon || "token-icon-carousel-prev" === resolvedIcon) {
|
|
455
|
+
resolvedIcon = "rtl" === dir ? "token-icon-carousel-next" : "token-icon-carousel-prev";
|
|
456
|
+
if ("vertical" === orientation) resolvedIcon = "token-icon-carousel-prev-vertical";
|
|
457
|
+
}
|
|
295
458
|
return /*#__PURE__*/ jsx(ActionIcon, {
|
|
296
459
|
className: prevTrigger({
|
|
297
460
|
className
|
|
298
461
|
}),
|
|
299
462
|
size: toTriggerSize(size),
|
|
300
463
|
...triggerProps,
|
|
464
|
+
"aria-disabled": disabled,
|
|
301
465
|
"aria-label": triggerProps["aria-label"] ?? "Previous slide",
|
|
302
|
-
|
|
466
|
+
"data-disabled": disabled ? "" : void 0,
|
|
467
|
+
disabled: disabled,
|
|
468
|
+
icon: resolvedIcon,
|
|
469
|
+
onClick: disabled ? void 0 : triggerProps.onClick
|
|
303
470
|
});
|
|
304
471
|
};
|
|
305
|
-
Carousel.Next = function({ className, icon
|
|
306
|
-
const { api, size } = useCarouselContext();
|
|
472
|
+
Carousel.Next = function({ className, icon }) {
|
|
473
|
+
const { api, size, orientation, dir } = useCarouselContext();
|
|
307
474
|
const { nextTrigger } = carouselVariants();
|
|
308
475
|
const triggerProps = api.getNextTriggerProps();
|
|
476
|
+
const disabled = !api.canScrollNext || api.pageSnapPoints.length <= 1;
|
|
477
|
+
let resolvedIcon = icon;
|
|
478
|
+
if (!resolvedIcon || "token-icon-carousel-next" === resolvedIcon) {
|
|
479
|
+
resolvedIcon = "rtl" === dir ? "token-icon-carousel-prev" : "token-icon-carousel-next";
|
|
480
|
+
if ("vertical" === orientation) resolvedIcon = "token-icon-carousel-next-vertical";
|
|
481
|
+
}
|
|
309
482
|
return /*#__PURE__*/ jsx(ActionIcon, {
|
|
310
483
|
className: nextTrigger({
|
|
311
484
|
className
|
|
312
485
|
}),
|
|
313
486
|
size: toTriggerSize(size),
|
|
314
487
|
...triggerProps,
|
|
488
|
+
"aria-disabled": disabled,
|
|
315
489
|
"aria-label": triggerProps["aria-label"] ?? "Next slide",
|
|
316
|
-
|
|
490
|
+
"data-disabled": disabled ? "" : void 0,
|
|
491
|
+
disabled: disabled,
|
|
492
|
+
icon: resolvedIcon,
|
|
493
|
+
onClick: disabled ? void 0 : triggerProps.onClick
|
|
317
494
|
});
|
|
318
495
|
};
|
|
319
496
|
Carousel.Indicators = function({ className, children }) {
|
|
@@ -333,7 +510,7 @@ Carousel.Indicators = function({ className, children }) {
|
|
|
333
510
|
...api.getIndicatorGroupProps(),
|
|
334
511
|
children: api.pageSnapPoints.map((_, index)=>/*#__PURE__*/ jsx(Carousel.Indicator, {
|
|
335
512
|
index: index
|
|
336
|
-
},
|
|
513
|
+
}, index))
|
|
337
514
|
});
|
|
338
515
|
};
|
|
339
516
|
Carousel.Indicator = function({ index, className, children }) {
|
|
@@ -347,6 +524,7 @@ Carousel.Indicator = function({ index, className, children }) {
|
|
|
347
524
|
...api.getIndicatorProps({
|
|
348
525
|
index
|
|
349
526
|
}),
|
|
527
|
+
"aria-current": index === api.page ? "true" : void 0,
|
|
350
528
|
children: children ?? /*#__PURE__*/ jsx("span", {
|
|
351
529
|
"aria-hidden": "true",
|
|
352
530
|
className: indicatorDot()
|
|
@@ -367,16 +545,20 @@ Carousel.Autoplay = function({ className }) {
|
|
|
367
545
|
"aria-label": triggerProps["aria-label"] ?? (api.isPlaying ? "Stop slide rotation" : "Start slide rotation")
|
|
368
546
|
});
|
|
369
547
|
};
|
|
370
|
-
Carousel.Control = function({ children, className, controlPosition }) {
|
|
371
|
-
const { api } = useCarouselContext();
|
|
548
|
+
Carousel.Control = function({ children, className, controlPosition, controls }) {
|
|
549
|
+
const { api, orientation } = useCarouselContext();
|
|
550
|
+
const sideLayout = "vertical" === orientation && "minimal" !== controls && "unset" !== controlPosition;
|
|
372
551
|
const { control } = carouselVariants({
|
|
373
|
-
controlPosition
|
|
552
|
+
controlPosition: "minimal" === controls || sideLayout ? "unset" : controlPosition,
|
|
553
|
+
controls
|
|
374
554
|
});
|
|
375
555
|
return /*#__PURE__*/ jsx("div", {
|
|
376
556
|
className: control({
|
|
377
557
|
className
|
|
378
558
|
}),
|
|
379
559
|
...api.getControlProps(),
|
|
560
|
+
"data-carousel-layout": sideLayout ? "side" : void 0,
|
|
561
|
+
"data-carousel-leading": sideLayout && "top" === controlPosition ? "" : void 0,
|
|
380
562
|
children: children
|
|
381
563
|
});
|
|
382
564
|
};
|