Skip to content

Commit 4ca3dfb

Browse files
committed
chore: release v0.9.0
Fix Carousel horizontal overflow in width-constrained containers (Issue #17) - Replace negative margin gap implementation with CSS gap property - Carousel now self-contained without requiring parent overflow-x: hidden - Add test story in Edge Cases section demonstrating fix - Simplify CSS by removing negative margin compensation logic Closes #17
1 parent 9e4a977 commit 4ca3dfb

File tree

4 files changed

+74
-11
lines changed

4 files changed

+74
-11
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.9.0] - 2025-11-10
11+
12+
### Fixed
13+
14+
- **Carousel**: Fixed horizontal page overflow in width-constrained containers (Issue #17)
15+
- Replaced negative margin gap implementation with CSS `gap` property
16+
- Carousel now properly contains itself without requiring parent containers to use `overflow-x: hidden`
17+
- Self-contained component handles its own overflow correctly
18+
1019
## [0.8.0] - 2025-11-09
1120

1221
### Fixed

packages/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ainativekit/ui",
3-
"version": "0.8.0",
3+
"version": "0.9.0",
44
"description": "AI Native Kit - Component library for AI-powered applications",
55
"type": "module",
66
"main": "./dist/index.cjs",

packages/ui/src/components/Carousel/Carousel.module.css

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,18 @@
5050
.emblaContainer {
5151
display: flex;
5252
align-items: stretch;
53-
margin-left: calc(var(--carousel-gap, 0) / -2);
54-
margin-right: calc(var(--carousel-gap, 0) / -2);
53+
gap: var(--carousel-gap, 0);
5554
padding-left: var(--carousel-start-inset, 0);
5655
}
5756

5857
.emblaContainerFlushStart {
59-
margin-left: 0;
6058
--carousel-start-inset: 0;
6159
}
6260

6361
/* Embla Slide */
6462
.emblaSlide {
6563
flex: 0 0 auto;
6664
min-width: 0;
67-
padding-left: calc(var(--carousel-gap, 0) / 2);
68-
padding-right: calc(var(--carousel-gap, 0) / 2);
69-
}
70-
71-
.emblaSlideFlushStart:first-child {
72-
padding-left: 0;
7365
}
7466

7567
/* Edge Gradients */

packages/ui/src/components/Carousel/Carousel.stories.tsx

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ Current: {currentSlide + 1} of {total}`}</code>
10311031
</div>
10321032

10331033
{/* Two Slides */}
1034-
<div>
1034+
<div style={{ marginBottom: '32px' }}>
10351035
<h3 style={{ fontSize: '16px', marginBottom: '12px' }}>Two Slides</h3>
10361036
<p
10371037
style={{
@@ -1050,6 +1050,68 @@ Current: {currentSlide + 1} of {total}`}</code>
10501050
))}
10511051
</Carousel>
10521052
</div>
1053+
1054+
{/* Constrained Container - Issue #17 Fix */}
1055+
<div>
1056+
<h3 style={{ fontSize: '16px', marginBottom: '12px' }}>
1057+
Carousel in Width-Constrained Container
1058+
</h3>
1059+
<p
1060+
style={{
1061+
fontSize: '14px',
1062+
color: 'var(--ai-color-text-secondary)',
1063+
marginBottom: '12px',
1064+
}}
1065+
>
1066+
Tests fix for Issue #17: Carousel should not cause horizontal page overflow when
1067+
placed in width-constrained containers (e.g., ChatGPT widgets with constrained iframe
1068+
widths)
1069+
</p>
1070+
<div
1071+
style={{
1072+
maxWidth: '768px',
1073+
margin: '0 auto',
1074+
border: '2px solid var(--ai-color-border-light)',
1075+
borderRadius: '8px',
1076+
padding: '16px',
1077+
backgroundColor: 'var(--ai-color-bg-secondary)',
1078+
}}
1079+
>
1080+
<div
1081+
style={{
1082+
marginBottom: '12px',
1083+
fontSize: '14px',
1084+
fontWeight: 600,
1085+
color: 'var(--ai-color-text-secondary)',
1086+
}}
1087+
>
1088+
Container: max-width: 768px
1089+
</div>
1090+
<Carousel gap="16px" align="start">
1091+
{sampleImages.slice(0, 5).map((image, index) => (
1092+
<div key={index} style={{ width: '240px', flexShrink: 0 }}>
1093+
<ImageCard
1094+
image={image}
1095+
title={`Image ${index + 1}`}
1096+
subtitle="No overflow!"
1097+
size="compact"
1098+
/>
1099+
</div>
1100+
))}
1101+
</Carousel>
1102+
</div>
1103+
<div
1104+
style={{
1105+
marginTop: '12px',
1106+
fontSize: '13px',
1107+
color: 'var(--ai-color-text-secondary)',
1108+
fontStyle: 'italic',
1109+
}}
1110+
>
1111+
✅ Expected: No horizontal scrollbar at page level. Carousel fully contained within
1112+
bordered container.
1113+
</div>
1114+
</div>
10531115
</div>
10541116
</section>
10551117

0 commit comments

Comments
 (0)