Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
cbecafd
refactor: setup initial carousel testsw
thejackshelton Jul 18, 2024
13f2862
fix: carousel in CSR
thejackshelton Jul 18, 2024
7650e97
add expectation
thejackshelton Jul 18, 2024
8248ff8
test: added test cases
thejackshelton Jul 18, 2024
f1d02fb
test: some additional test cases
thejackshelton Jul 19, 2024
5a65216
not draggable
thejackshelton Jul 19, 2024
7308a7c
CSS scroll snapping on mobile
thejackshelton Jul 19, 2024
aa2785d
threshold tests
thejackshelton Jul 19, 2024
f03f0c8
try simpler code refactor
thejackshelton Jul 19, 2024
49dc6b8
small docs
thejackshelton Jul 19, 2024
ef6f282
Merge branch 'main' of https://github.com/qwikifiers/qwik-ui into imp…
thejackshelton Jul 19, 2024
44fafed
grab index from inline
thejackshelton Jul 19, 2024
066480a
improved examples
thejackshelton Jul 19, 2024
e2090ec
use scorllLeft instead
thejackshelton Jul 21, 2024
282d572
hacky impl
thejackshelton Jul 21, 2024
585ad61
fix: slide snapping
thejackshelton Jul 21, 2024
c81fbfe
better naming
thejackshelton Jul 21, 2024
70f115a
much simpler carousel
thejackshelton Jul 21, 2024
ae05887
fix: get proper array order
thejackshelton Jul 21, 2024
5d38c29
account for slide margin
thejackshelton Jul 21, 2024
edf7515
updated correct index
thejackshelton Jul 21, 2024
a65ce11
update with css scroll snapping
thejackshelton Jul 21, 2024
57a5f24
simplify container
thejackshelton Jul 21, 2024
6152865
get buttons working again
thejackshelton Jul 21, 2024
9b94d5d
setup for drag to do its own behavior
thejackshelton Jul 21, 2024
1ec631e
get mouse working again
thejackshelton Jul 21, 2024
469239c
correct indexes again
thejackshelton Jul 22, 2024
84deebe
it worksgit add .
thejackshelton Jul 22, 2024
3c21bcf
down to touch interacitons
thejackshelton Jul 22, 2024
07b534f
initial touch working
thejackshelton Jul 22, 2024
031696c
finally workinggit add .
thejackshelton Jul 22, 2024
769c466
add pagination
thejackshelton Jul 22, 2024
35ea86b
carousel pagination
thejackshelton Jul 22, 2024
3950b88
first attempt at multiple slides per view
thejackshelton Jul 22, 2024
7bbf206
update next button based on slidesPerView
thejackshelton Jul 22, 2024
2f6eb90
feat: keyboard navigation with pagination
thejackshelton Jul 22, 2024
613175b
focus management from previous and next when out of slides
thejackshelton Jul 22, 2024
d05ca06
bullets render based on slides in view
thejackshelton Jul 22, 2024
41eafc0
add non-draggable example
thejackshelton Jul 23, 2024
d06f411
touch ups
thejackshelton Jul 23, 2024
f6800a8
correct styles
thejackshelton Jul 23, 2024
14da2b3
mouse dragging works on variable slide widths
thejackshelton Jul 23, 2024
c6fe6d3
works on variable widths for index changes
thejackshelton Jul 23, 2024
6f41ebd
pagination works again
thejackshelton Jul 23, 2024
9e85678
correct scroll snapping again
thejackshelton Jul 23, 2024
2b21cd2
improve carousel a11y
thejackshelton Jul 23, 2024
847613b
without scrollbar
thejackshelton Jul 23, 2024
14aef9c
better styles and remove num slides in inline
thejackshelton Jul 23, 2024
050a878
transitions sort of working
thejackshelton Jul 24, 2024
3a317a8
center and end alignments
thejackshelton Jul 24, 2024
e7f56d5
more tests notes
thejackshelton Jul 24, 2024
da21e48
feat: looped support
thejackshelton Jul 24, 2024
64d793c
improved a11ty
thejackshelton Jul 25, 2024
8740f8e
home and enter keys for pagination
thejackshelton Jul 25, 2024
d6d4b02
add home & end test cases w/ pagination
thejackshelton Jul 25, 2024
079de94
add aria live polite
thejackshelton Jul 25, 2024
941131f
add announcements to the content inside of the carousel and collapsible
thejackshelton Jul 25, 2024
99104e9
add inert based on slidesPerView
thejackshelton Jul 25, 2024
315a8f0
tabpanel in pagination carousels
thejackshelton Jul 25, 2024
3e2d9f8
add accessible name
thejackshelton Jul 25, 2024
0eb04a1
cleaner code
thejackshelton Jul 25, 2024
d1dfa92
initial working autoplay
thejackshelton Jul 25, 2024
da3055d
bound signals
thejackshelton Jul 25, 2024
6918bd5
simplify bound signal
thejackshelton Jul 25, 2024
a5ac510
improved autoplay and tabs aria
thejackshelton Jul 25, 2024
3073ded
add in aria-selected
thejackshelton Jul 25, 2024
07f0fcf
accessible name for autoplay player button
thejackshelton Jul 26, 2024
355ab54
respecting reduced motion
thejackshelton Jul 26, 2024
357867c
autoplay looping working
thejackshelton Jul 26, 2024
4564114
Merge branch 'main' into carousel-mode
thejackshelton Jul 26, 2024
93ce9d7
improved experience when consuming and also support for updating flex…
thejackshelton Jul 26, 2024
e578938
setup for the initial index
thejackshelton Jul 27, 2024
279a86e
more test cases
thejackshelton Jul 27, 2024
d364dc5
multiple slides working on the server
thejackshelton Jul 27, 2024
c144692
proper gap
thejackshelton Jul 27, 2024
6d9a0a9
add correct initial index
thejackshelton Jul 28, 2024
d1ac93a
get initial indexes sort of working
thejackshelton Jul 28, 2024
fa5065c
correct snapping again on mobile with initial index
thejackshelton Jul 28, 2024
5458e33
almost
thejackshelton Jul 29, 2024
7438e31
next and prev buttons should work
thejackshelton Jul 29, 2024
50e7fd3
improved styling
thejackshelton Jul 29, 2024
437cc7b
upgrade to 1.7.2
thejackshelton Jul 29, 2024
a45316f
no caret
thejackshelton Jul 29, 2024
7859012
add in caret only in root
thejackshelton Jul 29, 2024
d43231e
latest from main
thejackshelton Jul 29, 2024
c7b5bb2
initial working
thejackshelton Jul 30, 2024
b66a4fb
initial working in all snap modes
thejackshelton Jul 30, 2024
a9aefee
carousel docs
thejackshelton Jul 30, 2024
43f7055
add in changeset
thejackshelton Jul 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/healthy-pumpkins-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@qwik-ui/headless': patch
---

## Carousel

The carousel has been refactored from the ground up, including new features, components, and QOL updates. It is still in a draft state, and development is ongoing.

## Dropdown

More improvements have been made to the dropdown component, including new features, components, and QOL updates.
Original file line number Diff line number Diff line change
@@ -1,37 +1,24 @@
.carousel {
--slide-size: 100%;
--slide-height: 5rem;
height: 100%;
max-width: 500px;
overflow: hidden;
.carousel-root {
width: 100%;
}

.carousel-container {
backface-visibility: hidden;
display: flex;
touch-action: pan-y;
margin-left: calc(var(--slide-spacing) * -1);
transition-property: transform;
transition-timing-function: ease;
overflow-x: visible;
padding-block: 0.5rem;
.carousel-scroller {
margin-bottom: 0.5rem;
}

.carousel-slide {
flex: 0 0 var(--slide-size);
min-width: 0;
position: relative;
user-select: none;
transition-property: transform;
border: 2px dotted hsl(var(--primary));
pointer-events: none;
min-height: 10rem;
margin-top: 0.5rem;
user-select: none;
}

.carousel-pagination {
display: flex;
gap: 0.5rem;
padding: 1rem;
border: 2px dotted hsl(var(--foreground));
outline: none;
}

.carousel-buttons {
Expand All @@ -40,10 +27,6 @@
border: 2px dotted hsl(var(--accent));
}

.carousel-buttons button[aria-disabled='true'] {
opacity: 0.5;
}

.carousel-buttons button {
border: 2px dotted hsl(var(--foreground));
padding: 0.5rem;
Expand All @@ -53,20 +36,38 @@
background-color: hsla(var(--primary) / 0.08);
}

.carousel-img {
pointer-events: none;
.carousel-buttons button:disabled {
opacity: 0.5;
}

.carousel-pagination-bullet {
cursor: pointer;
padding-inline: 0.5rem;
}

.pagination-underline {
.carousel-pagination-bullet[data-active] {
outline: 2px dotted hsl(var(--primary));
background-color: hsla(var(--primary) / 0.08);
}

.carousel-pagination-bullet:hover {
background-color: hsla(var(--primary) / 0.08);
}

.carousel-conditional {
position: relative;
height: 200px;
}

.carousel-conditional .carousel-slide {
opacity: 0;
transition: opacity 0.5s;
/* NOT display block */
display: revert;
position: absolute;
inset: 0;
}

.carousel-conditional .carousel-slide[data-active] {
opacity: 1;
}
30 changes: 30 additions & 0 deletions apps/website/src/routes/docs/headless/carousel/examples/center.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { component$, useStyles$ } from '@builder.io/qwik';
import { Carousel } from '@qwik-ui/headless';

export default component$(() => {
useStyles$(styles);

const colors = ['red', 'green', 'blue', 'yellow', 'purple', 'orange', 'pink'];

return (
<Carousel.Root class="carousel-root" gap={30} align="center">
<div class="carousel-buttons">
<Carousel.Previous>Prev</Carousel.Previous>
<Carousel.Next>Next</Carousel.Next>
</div>
<Carousel.Scroller class="carousel-scroller">
{colors.map((color) => (
<Carousel.Slide
style={{ flexBasis: '300px' }}
key={color}
class="carousel-slide"
>
{color}
</Carousel.Slide>
))}
</Carousel.Scroller>
</Carousel.Root>
);
});
// internal
import styles from './carousel.css?inline';
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { component$, useStyles$ } from '@builder.io/qwik';
import { Carousel } from '@qwik-ui/headless';

export default component$(() => {
useStyles$(styles);

const colors = ['red', 'green', 'blue', 'yellow', 'purple', 'orange', 'pink'];

return (
<Carousel.Root class="carousel-root" gap={30}>
<div class="carousel-buttons">
<Carousel.Previous>Prev</Carousel.Previous>
<Carousel.Next>Next</Carousel.Next>
</div>
<div class="carousel-conditional">
{colors.map((color) => (
<Carousel.Slide key={color} class="carousel-slide">
{color}
</Carousel.Slide>
))}
</div>
</Carousel.Root>
);
});
// internal
import styles from './carousel.css?inline';
34 changes: 34 additions & 0 deletions apps/website/src/routes/docs/headless/carousel/examples/csr.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { component$, useSignal, useStyles$ } from '@builder.io/qwik';
import { Carousel } from '@qwik-ui/headless';

export default component$(() => {
useStyles$(styles);

const colors = ['red', 'green', 'blue', 'yellow', 'purple', 'orange', 'pink'];
const renderCarousel = useSignal(false);

return (
<>
<button onClick$={() => (renderCarousel.value = !renderCarousel.value)}>
Render Carousel
</button>
{renderCarousel.value && (
<Carousel.Root class="carousel-root">
<div class="carousel-buttons">
<Carousel.Previous>Prev</Carousel.Previous>
<Carousel.Next>Next</Carousel.Next>
</div>
<Carousel.Scroller class="carousel-scroller">
{colors.map((color) => (
<Carousel.Slide key={color} class="carousel-slide">
{color}
</Carousel.Slide>
))}
</Carousel.Scroller>
</Carousel.Root>
)}
</>
);
});
// internal
import styles from './carousel.css?inline';
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { component$, useStyles$ } from '@builder.io/qwik';
import { Carousel } from '@qwik-ui/headless';

export default component$(() => {
useStyles$(styles);

return (
<Carousel.Root class="carousel-root" gap={30}>
<div class="carousel-buttons">
<Carousel.Previous>Prev</Carousel.Previous>
<Carousel.Next>Next</Carousel.Next>
</div>
<Carousel.Scroller class="carousel-scroller">
<Carousel.Slide style={{ flexBasis: '200px' }} class="carousel-slide">
red
</Carousel.Slide>
<Carousel.Slide style={{ flexBasis: '400px' }} class="carousel-slide">
green
</Carousel.Slide>
<Carousel.Slide style={{ flexBasis: '300px' }} class="carousel-slide">
blue
</Carousel.Slide>
<Carousel.Slide style={{ flexBasis: '350px' }} class="carousel-slide">
yellow
</Carousel.Slide>
<Carousel.Slide style={{ flexBasis: '100px' }} class="carousel-slide">
purple
</Carousel.Slide>
</Carousel.Scroller>
</Carousel.Root>
);
});
// internal
import styles from './carousel.css?inline';
30 changes: 30 additions & 0 deletions apps/website/src/routes/docs/headless/carousel/examples/end.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { component$, useStyles$ } from '@builder.io/qwik';
import { Carousel } from '@qwik-ui/headless';

export default component$(() => {
useStyles$(styles);

const colors = ['red', 'green', 'blue', 'yellow', 'purple', 'orange', 'pink'];

return (
<Carousel.Root class="carousel-root" gap={30} align="end">
<div class="carousel-buttons">
<Carousel.Previous>Prev</Carousel.Previous>
<Carousel.Next>Next</Carousel.Next>
</div>
<Carousel.Scroller class="carousel-scroller">
{colors.map((color) => (
<Carousel.Slide
style={{ flexBasis: '300px' }}
key={color}
class="carousel-slide"
>
{color}
</Carousel.Slide>
))}
</Carousel.Scroller>
</Carousel.Root>
);
});
// internal
import styles from './carousel.css?inline';
Loading