Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

47_26_9_beta #1578

Draft
wants to merge 33 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
c52b234
feat: add single type image to gallery component
ViralLka Nov 27, 2024
67b76ab
feat: add single type image to gallery component
ViralLka Nov 28, 2024
932193c
feat: change version
fulcanellee Nov 28, 2024
70aa7f2
fix(input): fix set selection range
Dec 10, 2024
b589294
feat(input): refactor use effect
Dec 11, 2024
8f4adb3
feat: update version
fulcanellee Dec 18, 2024
a3fc1c4
feat(*): added support safe area for side-panel (#1555)
fulcanellee Jan 27, 2025
399f871
feat: update tests
fulcanellee Jan 27, 2025
aeb67fb
feat: update version
fulcanellee Jan 27, 2025
b373174
fix(calendar): fix initialMonthIndex
fulcanellee Jan 27, 2025
826bcf5
fix(intl-phone-input): ability to overwrite country-data (#1562)
mikhail-yurin Feb 4, 2025
ae8c803
Fix/ampay 7072 2 (#1566)
mikhail-yurin Feb 5, 2025
9654dcb
feat: update version
fulcanellee Feb 7, 2025
d8c9c81
fix/modal_safe_area (#1563)
fulcanellee Feb 7, 2025
6d1f413
feat: update version
fulcanellee Feb 7, 2025
ed8a5af
feat: safe area improvement
fulcanellee Feb 10, 2025
fc40ba0
feat: update version
fulcanellee Feb 11, 2025
6ff59fc
fix: added getSafeArea utility, updated bottom-sheet to take into acc…
makdv Feb 11, 2025
a3026fc
fix: remove obsolete changeset
fulcanellee Feb 11, 2025
b1f8a3a
fix: test fix
makdv Feb 11, 2025
b99d60b
fix: test fix
makdv Feb 11, 2025
a6a8efd
feat: добавлен changesets
makdv Feb 11, 2025
93ab237
fix: fix after merge conflict
fulcanellee Feb 11, 2025
6fcb694
fix: fix after merge conflict
fulcanellee Feb 11, 2025
0dea08a
fix: added adjustContainerHeight property for BottomSheet and removed…
makdv Feb 12, 2025
d6c989e
fix: updated changesets README
makdv Feb 12, 2025
8902ed6
fix: fixed modal and sidepanel header paddings according to initial gap
makdv Feb 13, 2025
2dadaa9
fix: updated type comment and split changesets
makdv Feb 14, 2025
e8f3b79
fix: updated variables for sidepanel and modal header padding
makdv Feb 14, 2025
46e3a0c
fix: added default value for adjustContainerHeight according to code …
makdv Feb 17, 2025
0a656ad
fix: moved fallback value from anonymous function to const
makdv Feb 17, 2025
cc6f8d0
fix: added 'email' input type to avoid setSelectionRange issue
makdv Feb 19, 2025
215c183
Revert "fix: added 'email' input type to avoid setSelectionRange issue"
makdv Feb 19, 2025
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
5 changes: 5 additions & 0 deletions .changeset/angry-points-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@alfalab/core-components-international-phone-input': minor
---

Экспорт массива countriesData и его типа (для модификации по месту использования)
5 changes: 5 additions & 0 deletions .changeset/dull-olives-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@alfalab/core-components-vars': minor
---

Добавлена единица длины для нулевого значения
5 changes: 5 additions & 0 deletions .changeset/five-eels-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@alfalab/core-components-side-panel': patch
---

Добавлена поддержка безопасных отступов safe-area
6 changes: 6 additions & 0 deletions .changeset/flat-crews-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@alfalab/core-components-modal': patch
'@alfalab/core-components-side-panel': patch
---

Добавлена обработка safe-area
7 changes: 7 additions & 0 deletions .changeset/gold-maps-bell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@alfalab/core-components-modal': patch
'@alfalab/core-components-side-panel': patch
---

- Фикс паддинга заголовка компонента SidePanel в PWA c safe-area
- Фикс паддинга заголовка компонента Modal в PWA c safe-area
5 changes: 5 additions & 0 deletions .changeset/gold-maps-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@alfalab/core-components-bottom-sheet': minor
---

- Добавлено свойство *adjustContainerHeight* для возможности подстраивать высоту контейнера bottomSheet извне, например с учётом верхней и/или нижней safe-area
5 changes: 5 additions & 0 deletions .changeset/silly-seas-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@alfalab/core-components-calendar': patch
---

Критическое исправление `month-only` календаря связанное с работой minDate/maxDate пропсов
5 changes: 5 additions & 0 deletions .changeset/small-pigs-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@alfalab/core-components-gallery': patch
---

Добавлен отдельный компонент для single изображения, что сделать его независимым от swiper
5 changes: 5 additions & 0 deletions .changeset/violet-dancers-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@alfalab/core-components-international-phone-input': minor
---

добавлен опциональный проп customCountriesList, который можно использовать, чтобы переопределить дефолтный массив country-data
5 changes: 5 additions & 0 deletions .changeset/weak-poems-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@alfalab/core-components-input': patch
---

Фикс вызова input.setSelectionRange
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alfalab/core-components",
"version": "47.26.1",
"version": "47.26.8",
"private": true,
"workspaces": [
"packages/*"
Expand Down
4 changes: 4 additions & 0 deletions packages/base-modal/src/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,10 @@ export const BaseModal = forwardRef<HTMLDivElement, BaseModalProps>(
styles.content,
contentClassName,
contentProps?.className,
{
[styles.hasFooter]: hasFooter,
[styles.hasHeader]: hasHeader,
},
)}
>
{children}
Expand Down
12 changes: 12 additions & 0 deletions packages/base-modal/src/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ body:global(.is-locked) {
display: flex;
flex-direction: column;
flex: 1;

&.hasFooter {
@media (display-mode: standalone) {
padding-bottom: unset;
}
}

&.hasHeader {
@media (display-mode: standalone) {
padding-top: unset;
}
}
}

.hidden {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ exports[`Bottom sheet Snapshots tests should match snapshot 1`] = `
class="component modal appear appearActive"
>
<div
class="content"
class="content hasHeader"
>
<div
class="wrapper"
Expand Down Expand Up @@ -123,7 +123,7 @@ exports[`Bottom sheet Snapshots tests should match snapshot with action button 1
class="component modal appear appearActive"
>
<div
class="content"
class="content hasFooter hasHeader"
>
<div
class="wrapper"
Expand Down
22 changes: 16 additions & 6 deletions packages/bottom-sheet/src/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import styles from './index.module.css';

const { isNil } = fnUtils;

const adjustContainerHeightDefault = (value: number) => value;

export const BottomSheet = forwardRef<HTMLDivElement, BottomSheetProps>(
(
{
Expand Down Expand Up @@ -89,6 +91,7 @@ export const BottomSheet = forwardRef<HTMLDivElement, BottomSheetProps>(
bottomSheetInstanceRef,
sheetContainerRef = () => null,
headerOffset = 24,
adjustContainerHeight = adjustContainerHeightDefault,
onClose,
onBack,
onMagnetize,
Expand All @@ -110,11 +113,12 @@ export const BottomSheet = forwardRef<HTMLDivElement, BottomSheetProps>(
) => {
const windowHeight = use100vh() ?? 0;
const visibleViewportSize = useVisibleViewportSize(virtualKeyboard);
const fullHeight = virtualKeyboard ? visibleViewportSize?.height ?? 0 : windowHeight;

let fullHeight = virtualKeyboard ? visibleViewportSize?.height ?? 0 : windowHeight;
// Хук use100vh рассчитывает высоту вьюпорта в useEffect, поэтому на первый рендер всегда возвращает null.
const isFirstRender = fullHeight === 0;

fullHeight = adjustContainerHeight(fullHeight);

const initialIndexRef = useRef<number | undefined>(initialActiveAreaIndex);

const magneticAreas = useMemo(() => {
Expand All @@ -123,15 +127,21 @@ export const BottomSheet = forwardRef<HTMLDivElement, BottomSheetProps>(
convertPercentToNumber(area, fullHeight, headerOffset),
);
}
let iOSViewHeight = 0;

const iOSViewHeight = isClient()
? document?.documentElement?.clientHeight || window?.innerHeight
: 0;
if (isClient()) {
if (document?.documentElement?.clientHeight) {
iOSViewHeight = adjustContainerHeight(document.documentElement.clientHeight);
} else {
iOSViewHeight = window?.innerHeight;
}
}

const viewHeight = os.isIOS() && !virtualKeyboard ? iOSViewHeight : fullHeight;

return [0, viewHeight - headerOffset];
}, [fullHeight, headerOffset, magneticAreasProp, virtualKeyboard]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [fullHeight, headerOffset, magneticAreasProp, virtualKeyboard, adjustContainerHeight]);

const lastMagneticArea = magneticAreas[magneticAreas.length - 1];

Expand Down
3 changes: 2 additions & 1 deletion packages/bottom-sheet/src/index.module.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import '../../vars/src/index.css';
@import '../../vars/src/safe-area.css';
@import './vars.css';

.modal {
Expand Down Expand Up @@ -141,7 +142,7 @@
}

.safeAreaBottom {
padding-bottom: env(safe-area-inset-bottom);
padding-bottom: var(--sab);
}

@mixin bg-class-list;
4 changes: 4 additions & 0 deletions packages/bottom-sheet/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import type { BackgroundColorType } from '../../types';
export type BottomSheetTitleAlign = 'center' | 'left';

export type BottomSheetProps = {
/**
* Метод, позволяющий донастраивать высоту контейнера для BottomSheet, например с учётом safe-area
*/
adjustContainerHeight?: (height: number) => number
/**
* Контент
*/
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 0 additions & 13 deletions packages/calendar/src/__snapshots__/Component.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2474,19 +2474,6 @@ exports[`Calendar Display tests should match defaultView="years" snapshot 1`] =
1925
</span>
</button>
<button
aria-selected="false"
class="component text size-40 hug size-40 component text component text button default button"
data-date="-1451692800000"
tabindex="-1"
type="button"
>
<span
class="label stretchText"
>
1924
</span>
</button>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ export const CalendarMonthOnlyView = ({
const initialMonthIndex = useMemo(() => {
const date = range.value || range.selectedFrom || activeMonth.getTime() || Date.now();

return activeMonths.findIndex((m) => isSameMonth(date, m.date));
const index = activeMonths.findIndex((m) => isSameMonth(date, m.date));

return Math.max(index, 0);
}, [range.value, range.selectedFrom, activeMonth, activeMonths]);

// заголовок должен становиться активным если выбран весь доступный период в месяце
Expand Down
9 changes: 7 additions & 2 deletions packages/gallery/src/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import SwiperCore from 'swiper';
import { BaseModal } from '@alfalab/core-components-base-modal';
import { useMedia } from '@alfalab/hooks';

import { Single } from './components/image-viewer/single';
import { Header, HeaderMobile, ImageViewer, InfoBar, NavigationBar } from './components';
import { GalleryContext } from './context';
import { GalleryImage, ImageMeta } from './types';
Expand Down Expand Up @@ -240,9 +241,13 @@ export const Gallery: FC<GalleryProps> = ({
Backdrop={Backdrop}
onUnmount={onUnmount}
>
<div className={styles.container}>
<div
className={cn(styles.container, {
[styles.mobile]: view !== 'desktop',
})}
>
{view === 'desktop' ? <Header /> : <HeaderMobile />}
<ImageViewer />
{images.length === 1 ? <Single /> : <ImageViewer />}
<nav
className={cn({
[styles.navigationVideo]: isCurrentVideo && isMobile,
Expand Down
Loading