Skip to content

Commit

Permalink
Merge pull request #524 from davidjerleke/feature/#507
Browse files Browse the repository at this point in the history
Make `containScroll: 'trimSnaps'` default
  • Loading branch information
davidjerleke authored Jul 8, 2023
2 parents 33a7e51 + e7fa164 commit 11e5d06
Show file tree
Hide file tree
Showing 11 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export const CarouselGeneratorAlignmentSettings = () => {
const align = formData[INPUT_ALIGN.FIELD_NAME]
const containScroll = formData[INPUT_CONTAIN_SCROLL.FIELD_NAME]
? 'trimSnaps'
: null
: false
const [options, setOptions] = useState<EmblaOptionsType>({
align,
containScroll,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const CONTEXT_DEFAULT_VALUE: CarouselGeneratorContextType = {
slideGapSize: '10',
edgeGap: '0',
align: 'center',
containScroll: false,
containScroll: true,
navigationPrevNextButtons: false,
navigationDots: false,
autoplay: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import { arrayFromNumber } from 'utils/arrayFromNumber'

export const ID = 'embla-carousel-align'
export const SLIDES = arrayFromNumber(5)
export const OPTIONS: EmblaOptionsType = { align: 'center' }
export const OPTIONS: EmblaOptionsType = {
align: 'center',
containScroll: false
}
export const STYLES = createCarouselDefaultStyles('80%')

export const Wrapper = styled.div`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const IosPickerItem = (props) => {
loop,
axis: 'y',
dragFree: true,
containScroll: false,
watchResize: false,
watchSlides: false
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export const IosPickerItem: React.FC<PropType> = (props) => {
loop,
axis: 'y',
dragFree: true,
containScroll: false,
watchResize: false,
watchSlides: false
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export const IosPickerItem: React.FC<PropType> = (props) => {
loop,
axis: 'y',
dragFree: true,
containScroll: false,
watchResize: false,
watchSlides: false
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const iosPickerNodes = Array.from(wheelNodes)
const iosPickers = iosPickerNodes.map((iosPickerNode) =>
setupIosPicker(iosPickerNode, {
dragFree: true,
containScroll: false,
loop: LOOP,
axis: 'y',
watchResize: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const iosPickerNodes = <HTMLElement[]>Array.from(wheelNodes)
const iosPickers = iosPickerNodes.map((iosPickerNode) =>
setupIosPicker(iosPickerNode, {
dragFree: true,
containScroll: false,
loop: LOOP,
axis: 'y',
watchResize: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const iosPickerNodes = <HTMLElement[]>Array.from(wheelNodes)
const iosPickers = iosPickerNodes.map((iosPickerNode) =>
setupIosPicker(iosPickerNode, {
dragFree: true,
containScroll: false,
loop: LOOP,
axis: 'y',
watchResize: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/embla-carousel/src/components/Options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const defaultOptions: OptionsType = {
axis: 'x',
container: null,
slides: null,
containScroll: null,
containScroll: 'trimSnaps',
direction: 'ltr',
slidesToScroll: 1,
breakpoints: {},
Expand Down
2 changes: 1 addition & 1 deletion packages/embla-carousel/src/components/ScrollContain.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Limit, LimitType } from './Limit'
import { arrayLast } from './utils'

export type ScrollContainOptionType = null | 'trimSnaps' | 'keepSnaps'
export type ScrollContainOptionType = false | 'trimSnaps' | 'keepSnaps'

export type ScrollContainType = {
snapsContained: number[]
Expand Down

0 comments on commit 11e5d06

Please sign in to comment.