@allxsmith/bestax-bulma 5.41.0 → 5.42.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/dist/bestax.css +1 -1
- package/dist/bestax.css.map +1 -1
- package/dist/esm/components/Carousel.js +282 -103
- package/dist/esm/components/Carousel.js.map +1 -1
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +280 -103
- package/dist/index.cjs.map +1 -1
- package/dist/types/components/Carousel.d.ts +96 -8
- package/dist/types-cjs/components/Carousel.d.ts +96 -8
- package/dist/versions/bestax-no-dark-mode.css +1 -1
- package/dist/versions/bestax-no-dark-mode.css.map +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
- package/dist/versions/bestax-no-helpers.css +1 -1
- package/dist/versions/bestax-no-helpers.css.map +1 -1
- package/dist/versions/bestax-prefixed.css +1 -1
- package/dist/versions/bestax-prefixed.css.map +1 -1
- package/package.json +6 -6
- package/src/scss/components/_carousel.scss +77 -24
|
@@ -4,7 +4,10 @@ import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
|
|
|
4
4
|
* Props for the CarouselItem component.
|
|
5
5
|
*/
|
|
6
6
|
export interface CarouselItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Whether this item is in view. `Carousel` sets it on every item in view,
|
|
9
|
+
* so with several in view several are active.
|
|
10
|
+
*/
|
|
8
11
|
active?: boolean;
|
|
9
12
|
}
|
|
10
13
|
/**
|
|
@@ -24,20 +27,93 @@ type IconLibrary = 'fa' | 'mdi' | 'ion' | 'material-icons' | 'material-symbols';
|
|
|
24
27
|
*/
|
|
25
28
|
export interface CarouselProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'color'>, BulmaClassesProps {
|
|
26
29
|
/**
|
|
27
|
-
*
|
|
30
|
+
* Index of the first item in view (controlled); with one item in view, the
|
|
31
|
+
* slide shown. A value between two of the positions a step lands on (see
|
|
32
|
+
* `itemsToScroll`) is shown as given, and the next step goes on from it.
|
|
33
|
+
* With `repeat`, a value past either end wraps around; without it, one
|
|
34
|
+
* that would leave empty space after the last item shows the last full
|
|
35
|
+
* view. Neither correction calls `onChange`. A value that takes the item
|
|
36
|
+
* holding focus out of view moves focus to the first item in view, as a
|
|
37
|
+
* swipe or a change of width does.
|
|
28
38
|
* @defaultValue 0
|
|
29
39
|
*/
|
|
30
40
|
value?: number;
|
|
31
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Enable auto-play: one step (`itemsToScroll` items) per `interval`.
|
|
43
|
+
* Without `repeat` it stops at the last position. It waits while the
|
|
44
|
+
* pointer is over the carousel (see `pauseOnHover`) and while focus is
|
|
45
|
+
* inside one of its items, so an item being read or used never moves out
|
|
46
|
+
* of view.
|
|
47
|
+
*/
|
|
32
48
|
autoplay?: boolean;
|
|
33
49
|
/** Auto-play interval in milliseconds. Default: 5000. */
|
|
34
50
|
interval?: number;
|
|
35
51
|
/** Pause auto-play on hover. Default: true. */
|
|
36
52
|
pauseOnHover?: boolean;
|
|
37
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Loop back to the first position after the last. Default: true. With
|
|
55
|
+
* several items in view, the view runs on past the last item into the
|
|
56
|
+
* first ones, so it can show the end and the start side by side. Only
|
|
57
|
+
* loops when some item is out of view.
|
|
58
|
+
*/
|
|
38
59
|
repeat?: boolean;
|
|
39
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Enable drag/swipe navigation. Default: true. A swipe moves one step,
|
|
62
|
+
* however far it travels.
|
|
63
|
+
*/
|
|
40
64
|
hasDrag?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* How many items are in view at once, at every width no
|
|
67
|
+
* `itemsToShow<Viewport>` prop covers. Those props read the way a
|
|
68
|
+
* `Column`'s `size<Viewport>` props do: `itemsToShowMobile` applies below
|
|
69
|
+
* Bulma's tablet breakpoint, each of the others from its own breakpoint
|
|
70
|
+
* up, and where several apply the widest one wins. A whole number, rounded
|
|
71
|
+
* down and at least 1. The widths come from the stylesheet, so they are
|
|
72
|
+
* right on the first paint; the arrows, indicators and steps use the
|
|
73
|
+
* count for the window's width once the page has hydrated, and this one
|
|
74
|
+
* until then. With this many children or fewer, every item keeps its
|
|
75
|
+
* share of the width, nothing moves, and no arrows or indicators render.
|
|
76
|
+
* @defaultValue 1
|
|
77
|
+
*/
|
|
78
|
+
itemsToShow?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Items in view at any width below Bulma's tablet breakpoint (769px),
|
|
81
|
+
* fractional ones included. Falls back to `itemsToShow`.
|
|
82
|
+
*/
|
|
83
|
+
itemsToShowMobile?: number;
|
|
84
|
+
/**
|
|
85
|
+
* Items in view from Bulma's tablet breakpoint (769px) up, until a wider
|
|
86
|
+
* viewport's prop takes over. Falls back to `itemsToShow`.
|
|
87
|
+
*/
|
|
88
|
+
itemsToShowTablet?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Items in view from Bulma's desktop breakpoint (1024px) up, until a wider
|
|
91
|
+
* viewport's prop takes over. Falls back to `itemsToShowTablet`, then
|
|
92
|
+
* `itemsToShow`.
|
|
93
|
+
*/
|
|
94
|
+
itemsToShowDesktop?: number;
|
|
95
|
+
/**
|
|
96
|
+
* Items in view from Bulma's widescreen breakpoint (1216px) up, until
|
|
97
|
+
* `itemsToShowFullhd` takes over. Falls back to `itemsToShowDesktop`, and
|
|
98
|
+
* on down to `itemsToShow`.
|
|
99
|
+
*/
|
|
100
|
+
itemsToShowWidescreen?: number;
|
|
101
|
+
/**
|
|
102
|
+
* Items in view from Bulma's fullhd breakpoint (1408px) up. Falls back to
|
|
103
|
+
* `itemsToShowWidescreen`, and on down to `itemsToShow`.
|
|
104
|
+
*/
|
|
105
|
+
itemsToShowFullhd?: number;
|
|
106
|
+
/**
|
|
107
|
+
* How many items one step moves, for an arrow, an arrow key, a swipe or an
|
|
108
|
+
* autoplay tick. A whole number, capped at the count in view so a step
|
|
109
|
+
* never skips an item. Without `repeat`, the last step stops at the last
|
|
110
|
+
* full view, so it can be shorter; with `repeat`, the step after the last
|
|
111
|
+
* position goes on to the first one. The indicators mark these positions,
|
|
112
|
+
* one per step rather than one per item. When the count in view changes
|
|
113
|
+
* with the window's width, the first item in view stays in view.
|
|
114
|
+
* @defaultValue 1
|
|
115
|
+
*/
|
|
116
|
+
itemsToScroll?: number;
|
|
41
117
|
/**
|
|
42
118
|
* Show navigation arrows. Default: true. They render `type="button"`, so a
|
|
43
119
|
* carousel inside a form is not submitted by moving between slides.
|
|
@@ -46,8 +122,9 @@ export interface CarouselProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
46
122
|
/** Only show arrows on hover. */
|
|
47
123
|
arrowHover?: boolean;
|
|
48
124
|
/**
|
|
49
|
-
* Show slide indicators. Default: true.
|
|
50
|
-
*
|
|
125
|
+
* Show slide indicators. Default: true. There is one for each position a
|
|
126
|
+
* step can land on (see `itemsToScroll`). They render `type="button"`, so
|
|
127
|
+
* a carousel inside a form is not submitted by picking a slide.
|
|
51
128
|
*/
|
|
52
129
|
indicator?: boolean;
|
|
53
130
|
/** Position indicators inside carousel. */
|
|
@@ -74,7 +151,10 @@ export interface CarouselProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
74
151
|
arrowColor?: 'light' | 'dark';
|
|
75
152
|
/** Accessible label for the carousel region. Default: 'Image carousel'. */
|
|
76
153
|
ariaLabel?: string;
|
|
77
|
-
/**
|
|
154
|
+
/**
|
|
155
|
+
* Called with the index of the first item in view when an arrow, an arrow
|
|
156
|
+
* key, an indicator, a swipe or autoplay moves the carousel.
|
|
157
|
+
*/
|
|
78
158
|
onChange?: (value: number) => void;
|
|
79
159
|
/** CarouselItem children. */
|
|
80
160
|
children?: React.ReactNode;
|
|
@@ -105,6 +185,14 @@ export interface CarouselProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
105
185
|
* <img src="image2.jpg" alt="Slide 2" />
|
|
106
186
|
* </CarouselItem>
|
|
107
187
|
* </Carousel>
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* // Three cards in view on desktop, two on tablet, one on mobile
|
|
191
|
+
* <Carousel itemsToShow={1} itemsToShowTablet={2} itemsToShowDesktop={3}>
|
|
192
|
+
* {cards.map(card => (
|
|
193
|
+
* <CarouselItem key={card.id}>{card.body}</CarouselItem>
|
|
194
|
+
* ))}
|
|
195
|
+
* </Carousel>
|
|
108
196
|
*/
|
|
109
197
|
export declare const Carousel: React.ForwardRefExoticComponent<CarouselProps & React.RefAttributes<HTMLDivElement>>;
|
|
110
198
|
export default Carousel;
|
|
@@ -4,7 +4,10 @@ import { BulmaClassesProps } from '../helpers/useBulmaClasses.js';
|
|
|
4
4
|
* Props for the CarouselItem component.
|
|
5
5
|
*/
|
|
6
6
|
export interface CarouselItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Whether this item is in view. `Carousel` sets it on every item in view,
|
|
9
|
+
* so with several in view several are active.
|
|
10
|
+
*/
|
|
8
11
|
active?: boolean;
|
|
9
12
|
}
|
|
10
13
|
/**
|
|
@@ -24,20 +27,93 @@ type IconLibrary = 'fa' | 'mdi' | 'ion' | 'material-icons' | 'material-symbols';
|
|
|
24
27
|
*/
|
|
25
28
|
export interface CarouselProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'color'>, BulmaClassesProps {
|
|
26
29
|
/**
|
|
27
|
-
*
|
|
30
|
+
* Index of the first item in view (controlled); with one item in view, the
|
|
31
|
+
* slide shown. A value between two of the positions a step lands on (see
|
|
32
|
+
* `itemsToScroll`) is shown as given, and the next step goes on from it.
|
|
33
|
+
* With `repeat`, a value past either end wraps around; without it, one
|
|
34
|
+
* that would leave empty space after the last item shows the last full
|
|
35
|
+
* view. Neither correction calls `onChange`. A value that takes the item
|
|
36
|
+
* holding focus out of view moves focus to the first item in view, as a
|
|
37
|
+
* swipe or a change of width does.
|
|
28
38
|
* @defaultValue 0
|
|
29
39
|
*/
|
|
30
40
|
value?: number;
|
|
31
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Enable auto-play: one step (`itemsToScroll` items) per `interval`.
|
|
43
|
+
* Without `repeat` it stops at the last position. It waits while the
|
|
44
|
+
* pointer is over the carousel (see `pauseOnHover`) and while focus is
|
|
45
|
+
* inside one of its items, so an item being read or used never moves out
|
|
46
|
+
* of view.
|
|
47
|
+
*/
|
|
32
48
|
autoplay?: boolean;
|
|
33
49
|
/** Auto-play interval in milliseconds. Default: 5000. */
|
|
34
50
|
interval?: number;
|
|
35
51
|
/** Pause auto-play on hover. Default: true. */
|
|
36
52
|
pauseOnHover?: boolean;
|
|
37
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* Loop back to the first position after the last. Default: true. With
|
|
55
|
+
* several items in view, the view runs on past the last item into the
|
|
56
|
+
* first ones, so it can show the end and the start side by side. Only
|
|
57
|
+
* loops when some item is out of view.
|
|
58
|
+
*/
|
|
38
59
|
repeat?: boolean;
|
|
39
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* Enable drag/swipe navigation. Default: true. A swipe moves one step,
|
|
62
|
+
* however far it travels.
|
|
63
|
+
*/
|
|
40
64
|
hasDrag?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* How many items are in view at once, at every width no
|
|
67
|
+
* `itemsToShow<Viewport>` prop covers. Those props read the way a
|
|
68
|
+
* `Column`'s `size<Viewport>` props do: `itemsToShowMobile` applies below
|
|
69
|
+
* Bulma's tablet breakpoint, each of the others from its own breakpoint
|
|
70
|
+
* up, and where several apply the widest one wins. A whole number, rounded
|
|
71
|
+
* down and at least 1. The widths come from the stylesheet, so they are
|
|
72
|
+
* right on the first paint; the arrows, indicators and steps use the
|
|
73
|
+
* count for the window's width once the page has hydrated, and this one
|
|
74
|
+
* until then. With this many children or fewer, every item keeps its
|
|
75
|
+
* share of the width, nothing moves, and no arrows or indicators render.
|
|
76
|
+
* @defaultValue 1
|
|
77
|
+
*/
|
|
78
|
+
itemsToShow?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Items in view at any width below Bulma's tablet breakpoint (769px),
|
|
81
|
+
* fractional ones included. Falls back to `itemsToShow`.
|
|
82
|
+
*/
|
|
83
|
+
itemsToShowMobile?: number;
|
|
84
|
+
/**
|
|
85
|
+
* Items in view from Bulma's tablet breakpoint (769px) up, until a wider
|
|
86
|
+
* viewport's prop takes over. Falls back to `itemsToShow`.
|
|
87
|
+
*/
|
|
88
|
+
itemsToShowTablet?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Items in view from Bulma's desktop breakpoint (1024px) up, until a wider
|
|
91
|
+
* viewport's prop takes over. Falls back to `itemsToShowTablet`, then
|
|
92
|
+
* `itemsToShow`.
|
|
93
|
+
*/
|
|
94
|
+
itemsToShowDesktop?: number;
|
|
95
|
+
/**
|
|
96
|
+
* Items in view from Bulma's widescreen breakpoint (1216px) up, until
|
|
97
|
+
* `itemsToShowFullhd` takes over. Falls back to `itemsToShowDesktop`, and
|
|
98
|
+
* on down to `itemsToShow`.
|
|
99
|
+
*/
|
|
100
|
+
itemsToShowWidescreen?: number;
|
|
101
|
+
/**
|
|
102
|
+
* Items in view from Bulma's fullhd breakpoint (1408px) up. Falls back to
|
|
103
|
+
* `itemsToShowWidescreen`, and on down to `itemsToShow`.
|
|
104
|
+
*/
|
|
105
|
+
itemsToShowFullhd?: number;
|
|
106
|
+
/**
|
|
107
|
+
* How many items one step moves, for an arrow, an arrow key, a swipe or an
|
|
108
|
+
* autoplay tick. A whole number, capped at the count in view so a step
|
|
109
|
+
* never skips an item. Without `repeat`, the last step stops at the last
|
|
110
|
+
* full view, so it can be shorter; with `repeat`, the step after the last
|
|
111
|
+
* position goes on to the first one. The indicators mark these positions,
|
|
112
|
+
* one per step rather than one per item. When the count in view changes
|
|
113
|
+
* with the window's width, the first item in view stays in view.
|
|
114
|
+
* @defaultValue 1
|
|
115
|
+
*/
|
|
116
|
+
itemsToScroll?: number;
|
|
41
117
|
/**
|
|
42
118
|
* Show navigation arrows. Default: true. They render `type="button"`, so a
|
|
43
119
|
* carousel inside a form is not submitted by moving between slides.
|
|
@@ -46,8 +122,9 @@ export interface CarouselProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
46
122
|
/** Only show arrows on hover. */
|
|
47
123
|
arrowHover?: boolean;
|
|
48
124
|
/**
|
|
49
|
-
* Show slide indicators. Default: true.
|
|
50
|
-
*
|
|
125
|
+
* Show slide indicators. Default: true. There is one for each position a
|
|
126
|
+
* step can land on (see `itemsToScroll`). They render `type="button"`, so
|
|
127
|
+
* a carousel inside a form is not submitted by picking a slide.
|
|
51
128
|
*/
|
|
52
129
|
indicator?: boolean;
|
|
53
130
|
/** Position indicators inside carousel. */
|
|
@@ -74,7 +151,10 @@ export interface CarouselProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
74
151
|
arrowColor?: 'light' | 'dark';
|
|
75
152
|
/** Accessible label for the carousel region. Default: 'Image carousel'. */
|
|
76
153
|
ariaLabel?: string;
|
|
77
|
-
/**
|
|
154
|
+
/**
|
|
155
|
+
* Called with the index of the first item in view when an arrow, an arrow
|
|
156
|
+
* key, an indicator, a swipe or autoplay moves the carousel.
|
|
157
|
+
*/
|
|
78
158
|
onChange?: (value: number) => void;
|
|
79
159
|
/** CarouselItem children. */
|
|
80
160
|
children?: React.ReactNode;
|
|
@@ -105,6 +185,14 @@ export interface CarouselProps extends Omit<React.HTMLAttributes<HTMLDivElement>
|
|
|
105
185
|
* <img src="image2.jpg" alt="Slide 2" />
|
|
106
186
|
* </CarouselItem>
|
|
107
187
|
* </Carousel>
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* // Three cards in view on desktop, two on tablet, one on mobile
|
|
191
|
+
* <Carousel itemsToShow={1} itemsToShowTablet={2} itemsToShowDesktop={3}>
|
|
192
|
+
* {cards.map(card => (
|
|
193
|
+
* <CarouselItem key={card.id}>{card.body}</CarouselItem>
|
|
194
|
+
* ))}
|
|
195
|
+
* </Carousel>
|
|
108
196
|
*/
|
|
109
197
|
export declare const Carousel: React.ForwardRefExoticComponent<CarouselProps & React.RefAttributes<HTMLDivElement>>;
|
|
110
198
|
export default Carousel;
|