@alfalab/core-components-tabs 9.1.0 → 9.2.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/components/primary-tablist/Component.collapsible.d.ts +1 -1
- package/components/primary-tablist/Component.collapsible.js.map +1 -1
- package/components/primary-tablist/Component.d.ts +1 -1
- package/components/primary-tablist/Component.desktop.d.ts +1 -1
- package/components/primary-tablist/Component.desktop.js.map +1 -1
- package/components/primary-tablist/Component.js.map +1 -1
- package/components/primary-tablist/Component.mobile.d.ts +1 -1
- package/components/primary-tablist/Component.mobile.js.map +1 -1
- package/components/primary-tablist/Component.responsive.d.ts +1 -1
- package/components/primary-tablist/Component.responsive.js.map +1 -1
- package/components/primary-tablist/index.css +138 -135
- package/components/primary-tablist/index.module.css.js +1 -1
- package/components/primary-tablist/index.module.css.js.map +1 -1
- package/components/primary-tablist/mobile.css +230 -226
- package/components/primary-tablist/mobile.module.css.js +1 -1
- package/components/scroll-controls/Component.d.ts +2 -2
- package/components/scroll-controls/Component.js.map +1 -1
- package/components/scroll-controls/index.css +11 -11
- package/components/scroll-controls/index.module.css.js +1 -1
- package/components/scroll-controls/utils.js.map +1 -1
- package/components/scrollable-container/Component.d.ts +2 -2
- package/components/scrollable-container/Component.js.map +1 -1
- package/components/scrollable-container/index.css +5 -5
- package/components/scrollable-container/index.module.css.js +1 -1
- package/components/secondary-tablist/Component.d.ts +1 -1
- package/components/secondary-tablist/Component.desktop.d.ts +1 -1
- package/components/secondary-tablist/Component.desktop.js.map +1 -1
- package/components/secondary-tablist/Component.js.map +1 -1
- package/components/secondary-tablist/Component.mobile.d.ts +1 -1
- package/components/secondary-tablist/Component.mobile.js.map +1 -1
- package/components/secondary-tablist/Component.responsive.d.ts +1 -1
- package/components/secondary-tablist/Component.responsive.js.map +1 -1
- package/components/secondary-tablist/index.css +18 -18
- package/components/secondary-tablist/index.module.css.js +1 -1
- package/components/secondary-tablist/mobile.css +22 -22
- package/components/secondary-tablist/mobile.module.css.js +1 -1
- package/components/tab/Component.d.ts +1 -1
- package/components/tab/Component.js.map +1 -1
- package/components/tab/index.css +2 -2
- package/components/tab/index.module.css.js +1 -1
- package/components/tabs/Component.collapsible.d.ts +1 -1
- package/components/tabs/Component.collapsible.js.map +1 -1
- package/components/tabs/Component.d.ts +2 -2
- package/components/tabs/Component.desktop.d.ts +1 -1
- package/components/tabs/Component.desktop.js.map +1 -1
- package/components/tabs/Component.js +2 -11
- package/components/tabs/Component.js.map +1 -1
- package/components/tabs/Component.mobile.d.ts +1 -1
- package/components/tabs/Component.mobile.js.map +1 -1
- package/components/tabs/Component.responsive.d.ts +1 -1
- package/components/tabs/Component.responsive.js.map +1 -1
- package/components/title/Component.d.ts +2 -2
- package/components/title/Component.js.map +1 -1
- package/cssm/components/primary-tablist/Component.collapsible.d.ts +1 -1
- package/cssm/components/primary-tablist/Component.collapsible.js.map +1 -1
- package/cssm/components/primary-tablist/Component.d.ts +1 -1
- package/cssm/components/primary-tablist/Component.desktop.d.ts +1 -1
- package/cssm/components/primary-tablist/Component.desktop.js.map +1 -1
- package/cssm/components/primary-tablist/Component.js.map +1 -1
- package/cssm/components/primary-tablist/Component.mobile.d.ts +1 -1
- package/cssm/components/primary-tablist/Component.mobile.js.map +1 -1
- package/cssm/components/primary-tablist/Component.responsive.d.ts +1 -1
- package/cssm/components/primary-tablist/Component.responsive.js.map +1 -1
- package/cssm/components/primary-tablist/index.module.css +7 -4
- package/cssm/components/primary-tablist/mobile.module.css +4 -3
- package/cssm/components/scroll-controls/Component.d.ts +2 -2
- package/cssm/components/scroll-controls/Component.js.map +1 -1
- package/cssm/components/scroll-controls/utils.js.map +1 -1
- package/cssm/components/scrollable-container/Component.d.ts +2 -2
- package/cssm/components/scrollable-container/Component.js.map +1 -1
- package/cssm/components/secondary-tablist/Component.d.ts +1 -1
- package/cssm/components/secondary-tablist/Component.desktop.d.ts +1 -1
- package/cssm/components/secondary-tablist/Component.desktop.js.map +1 -1
- package/cssm/components/secondary-tablist/Component.js.map +1 -1
- package/cssm/components/secondary-tablist/Component.mobile.d.ts +1 -1
- package/cssm/components/secondary-tablist/Component.mobile.js.map +1 -1
- package/cssm/components/secondary-tablist/Component.responsive.d.ts +1 -1
- package/cssm/components/secondary-tablist/Component.responsive.js.map +1 -1
- package/cssm/components/tab/Component.d.ts +1 -1
- package/cssm/components/tab/Component.js.map +1 -1
- package/cssm/components/tabs/Component.collapsible.d.ts +1 -1
- package/cssm/components/tabs/Component.collapsible.js.map +1 -1
- package/cssm/components/tabs/Component.d.ts +2 -2
- package/cssm/components/tabs/Component.desktop.d.ts +1 -1
- package/cssm/components/tabs/Component.desktop.js.map +1 -1
- package/cssm/components/tabs/Component.js +2 -11
- package/cssm/components/tabs/Component.js.map +1 -1
- package/cssm/components/tabs/Component.mobile.d.ts +1 -1
- package/cssm/components/tabs/Component.mobile.js.map +1 -1
- package/cssm/components/tabs/Component.responsive.d.ts +1 -1
- package/cssm/components/tabs/Component.responsive.js.map +1 -1
- package/cssm/components/title/Component.d.ts +2 -2
- package/cssm/components/title/Component.js.map +1 -1
- package/cssm/hooks/use-collapsible-elements.d.ts +1 -1
- package/cssm/hooks/use-collapsible-elements.js.map +1 -1
- package/cssm/hooks/use-tablist-titles.d.ts +50 -1
- package/cssm/hooks/use-tablist-titles.js.map +1 -1
- package/cssm/hooks/use-tabs.d.ts +2 -2
- package/cssm/hooks/use-tabs.js.map +1 -1
- package/cssm/synthetic-events.d.ts +1 -1
- package/cssm/synthetic-events.js.map +1 -1
- package/cssm/typings.d.ts +14 -4
- package/esm/components/primary-tablist/Component.collapsible.d.ts +1 -1
- package/esm/components/primary-tablist/Component.collapsible.js.map +1 -1
- package/esm/components/primary-tablist/Component.d.ts +1 -1
- package/esm/components/primary-tablist/Component.desktop.d.ts +1 -1
- package/esm/components/primary-tablist/Component.desktop.js.map +1 -1
- package/esm/components/primary-tablist/Component.js.map +1 -1
- package/esm/components/primary-tablist/Component.mobile.d.ts +1 -1
- package/esm/components/primary-tablist/Component.mobile.js.map +1 -1
- package/esm/components/primary-tablist/Component.responsive.d.ts +1 -1
- package/esm/components/primary-tablist/Component.responsive.js.map +1 -1
- package/esm/components/primary-tablist/index.css +138 -135
- package/esm/components/primary-tablist/index.module.css.js +1 -1
- package/esm/components/primary-tablist/index.module.css.js.map +1 -1
- package/esm/components/primary-tablist/mobile.css +230 -226
- package/esm/components/primary-tablist/mobile.module.css.js +1 -1
- package/esm/components/scroll-controls/Component.d.ts +2 -2
- package/esm/components/scroll-controls/Component.js.map +1 -1
- package/esm/components/scroll-controls/index.css +11 -11
- package/esm/components/scroll-controls/index.module.css.js +1 -1
- package/esm/components/scroll-controls/utils.js.map +1 -1
- package/esm/components/scrollable-container/Component.d.ts +2 -2
- package/esm/components/scrollable-container/Component.js.map +1 -1
- package/esm/components/scrollable-container/index.css +5 -5
- package/esm/components/scrollable-container/index.module.css.js +1 -1
- package/esm/components/secondary-tablist/Component.d.ts +1 -1
- package/esm/components/secondary-tablist/Component.desktop.d.ts +1 -1
- package/esm/components/secondary-tablist/Component.desktop.js.map +1 -1
- package/esm/components/secondary-tablist/Component.js.map +1 -1
- package/esm/components/secondary-tablist/Component.mobile.d.ts +1 -1
- package/esm/components/secondary-tablist/Component.mobile.js.map +1 -1
- package/esm/components/secondary-tablist/Component.responsive.d.ts +1 -1
- package/esm/components/secondary-tablist/Component.responsive.js.map +1 -1
- package/esm/components/secondary-tablist/index.css +18 -18
- package/esm/components/secondary-tablist/index.module.css.js +1 -1
- package/esm/components/secondary-tablist/mobile.css +22 -22
- package/esm/components/secondary-tablist/mobile.module.css.js +1 -1
- package/esm/components/tab/Component.d.ts +1 -1
- package/esm/components/tab/Component.js.map +1 -1
- package/esm/components/tab/index.css +2 -2
- package/esm/components/tab/index.module.css.js +1 -1
- package/esm/components/tabs/Component.collapsible.d.ts +1 -1
- package/esm/components/tabs/Component.collapsible.js.map +1 -1
- package/esm/components/tabs/Component.d.ts +2 -2
- package/esm/components/tabs/Component.desktop.d.ts +1 -1
- package/esm/components/tabs/Component.desktop.js.map +1 -1
- package/esm/components/tabs/Component.js +2 -11
- package/esm/components/tabs/Component.js.map +1 -1
- package/esm/components/tabs/Component.mobile.d.ts +1 -1
- package/esm/components/tabs/Component.mobile.js.map +1 -1
- package/esm/components/tabs/Component.responsive.d.ts +1 -1
- package/esm/components/tabs/Component.responsive.js.map +1 -1
- package/esm/components/title/Component.d.ts +2 -2
- package/esm/components/title/Component.js.map +1 -1
- package/esm/hooks/use-collapsible-elements.d.ts +1 -1
- package/esm/hooks/use-collapsible-elements.js.map +1 -1
- package/esm/hooks/use-tablist-titles.d.ts +50 -1
- package/esm/hooks/use-tablist-titles.js.map +1 -1
- package/esm/hooks/use-tabs.d.ts +2 -2
- package/esm/hooks/use-tabs.js.map +1 -1
- package/esm/synthetic-events.d.ts +1 -1
- package/esm/synthetic-events.js.map +1 -1
- package/esm/typings.d.ts +14 -4
- package/hooks/use-collapsible-elements.d.ts +1 -1
- package/hooks/use-collapsible-elements.js.map +1 -1
- package/hooks/use-tablist-titles.d.ts +50 -1
- package/hooks/use-tablist-titles.js.map +1 -1
- package/hooks/use-tabs.d.ts +2 -2
- package/hooks/use-tabs.js.map +1 -1
- package/modern/components/primary-tablist/Component.collapsible.d.ts +1 -1
- package/modern/components/primary-tablist/Component.collapsible.js.map +1 -1
- package/modern/components/primary-tablist/Component.d.ts +1 -1
- package/modern/components/primary-tablist/Component.desktop.d.ts +1 -1
- package/modern/components/primary-tablist/Component.desktop.js.map +1 -1
- package/modern/components/primary-tablist/Component.js.map +1 -1
- package/modern/components/primary-tablist/Component.mobile.d.ts +1 -1
- package/modern/components/primary-tablist/Component.mobile.js.map +1 -1
- package/modern/components/primary-tablist/Component.responsive.d.ts +1 -1
- package/modern/components/primary-tablist/Component.responsive.js.map +1 -1
- package/modern/components/primary-tablist/index.css +138 -135
- package/modern/components/primary-tablist/index.module.css.js +1 -1
- package/modern/components/primary-tablist/index.module.css.js.map +1 -1
- package/modern/components/primary-tablist/mobile.css +230 -226
- package/modern/components/primary-tablist/mobile.module.css.js +1 -1
- package/modern/components/scroll-controls/Component.d.ts +2 -2
- package/modern/components/scroll-controls/Component.js.map +1 -1
- package/modern/components/scroll-controls/index.css +11 -11
- package/modern/components/scroll-controls/index.module.css.js +1 -1
- package/modern/components/scroll-controls/utils.js.map +1 -1
- package/modern/components/scrollable-container/Component.d.ts +2 -2
- package/modern/components/scrollable-container/Component.js.map +1 -1
- package/modern/components/scrollable-container/index.css +5 -5
- package/modern/components/scrollable-container/index.module.css.js +1 -1
- package/modern/components/secondary-tablist/Component.d.ts +1 -1
- package/modern/components/secondary-tablist/Component.desktop.d.ts +1 -1
- package/modern/components/secondary-tablist/Component.desktop.js.map +1 -1
- package/modern/components/secondary-tablist/Component.js.map +1 -1
- package/modern/components/secondary-tablist/Component.mobile.d.ts +1 -1
- package/modern/components/secondary-tablist/Component.mobile.js.map +1 -1
- package/modern/components/secondary-tablist/Component.responsive.d.ts +1 -1
- package/modern/components/secondary-tablist/Component.responsive.js.map +1 -1
- package/modern/components/secondary-tablist/index.css +18 -18
- package/modern/components/secondary-tablist/index.module.css.js +1 -1
- package/modern/components/secondary-tablist/mobile.css +22 -22
- package/modern/components/secondary-tablist/mobile.module.css.js +1 -1
- package/modern/components/tab/Component.d.ts +1 -1
- package/modern/components/tab/Component.js.map +1 -1
- package/modern/components/tab/index.css +2 -2
- package/modern/components/tab/index.module.css.js +1 -1
- package/modern/components/tabs/Component.collapsible.d.ts +1 -1
- package/modern/components/tabs/Component.collapsible.js.map +1 -1
- package/modern/components/tabs/Component.d.ts +2 -2
- package/modern/components/tabs/Component.desktop.d.ts +1 -1
- package/modern/components/tabs/Component.desktop.js.map +1 -1
- package/modern/components/tabs/Component.js +2 -1
- package/modern/components/tabs/Component.js.map +1 -1
- package/modern/components/tabs/Component.mobile.d.ts +1 -1
- package/modern/components/tabs/Component.mobile.js.map +1 -1
- package/modern/components/tabs/Component.responsive.d.ts +1 -1
- package/modern/components/tabs/Component.responsive.js.map +1 -1
- package/modern/components/title/Component.d.ts +2 -2
- package/modern/components/title/Component.js.map +1 -1
- package/modern/hooks/use-collapsible-elements.d.ts +1 -1
- package/modern/hooks/use-collapsible-elements.js.map +1 -1
- package/modern/hooks/use-tablist-titles.d.ts +50 -1
- package/modern/hooks/use-tablist-titles.js.map +1 -1
- package/modern/hooks/use-tabs.d.ts +2 -2
- package/modern/hooks/use-tabs.js.map +1 -1
- package/modern/synthetic-events.d.ts +1 -1
- package/modern/synthetic-events.js.map +1 -1
- package/modern/typings.d.ts +14 -4
- package/moderncssm/components/primary-tablist/Component.collapsible.d.ts +1 -1
- package/moderncssm/components/primary-tablist/Component.collapsible.js.map +1 -1
- package/moderncssm/components/primary-tablist/Component.d.ts +1 -1
- package/moderncssm/components/primary-tablist/Component.desktop.d.ts +1 -1
- package/moderncssm/components/primary-tablist/Component.desktop.js.map +1 -1
- package/moderncssm/components/primary-tablist/Component.js.map +1 -1
- package/moderncssm/components/primary-tablist/Component.mobile.d.ts +1 -1
- package/moderncssm/components/primary-tablist/Component.mobile.js.map +1 -1
- package/moderncssm/components/primary-tablist/Component.responsive.d.ts +1 -1
- package/moderncssm/components/primary-tablist/Component.responsive.js.map +1 -1
- package/moderncssm/components/primary-tablist/index.module.css +3 -1
- package/moderncssm/components/scroll-controls/Component.d.ts +2 -2
- package/moderncssm/components/scroll-controls/Component.js.map +1 -1
- package/moderncssm/components/scroll-controls/utils.js.map +1 -1
- package/moderncssm/components/scrollable-container/Component.d.ts +2 -2
- package/moderncssm/components/scrollable-container/Component.js.map +1 -1
- package/moderncssm/components/secondary-tablist/Component.d.ts +1 -1
- package/moderncssm/components/secondary-tablist/Component.desktop.d.ts +1 -1
- package/moderncssm/components/secondary-tablist/Component.desktop.js.map +1 -1
- package/moderncssm/components/secondary-tablist/Component.js.map +1 -1
- package/moderncssm/components/secondary-tablist/Component.mobile.d.ts +1 -1
- package/moderncssm/components/secondary-tablist/Component.mobile.js.map +1 -1
- package/moderncssm/components/secondary-tablist/Component.responsive.d.ts +1 -1
- package/moderncssm/components/secondary-tablist/Component.responsive.js.map +1 -1
- package/moderncssm/components/tab/Component.d.ts +1 -1
- package/moderncssm/components/tab/Component.js.map +1 -1
- package/moderncssm/components/tabs/Component.collapsible.d.ts +1 -1
- package/moderncssm/components/tabs/Component.collapsible.js.map +1 -1
- package/moderncssm/components/tabs/Component.d.ts +2 -2
- package/moderncssm/components/tabs/Component.desktop.d.ts +1 -1
- package/moderncssm/components/tabs/Component.desktop.js.map +1 -1
- package/moderncssm/components/tabs/Component.js +2 -1
- package/moderncssm/components/tabs/Component.js.map +1 -1
- package/moderncssm/components/tabs/Component.mobile.d.ts +1 -1
- package/moderncssm/components/tabs/Component.mobile.js.map +1 -1
- package/moderncssm/components/tabs/Component.responsive.d.ts +1 -1
- package/moderncssm/components/tabs/Component.responsive.js.map +1 -1
- package/moderncssm/components/title/Component.d.ts +2 -2
- package/moderncssm/components/title/Component.js.map +1 -1
- package/moderncssm/hooks/use-collapsible-elements.d.ts +1 -1
- package/moderncssm/hooks/use-collapsible-elements.js.map +1 -1
- package/moderncssm/hooks/use-tablist-titles.d.ts +50 -1
- package/moderncssm/hooks/use-tablist-titles.js.map +1 -1
- package/moderncssm/hooks/use-tabs.d.ts +2 -2
- package/moderncssm/hooks/use-tabs.js.map +1 -1
- package/moderncssm/synthetic-events.d.ts +1 -1
- package/moderncssm/synthetic-events.js.map +1 -1
- package/moderncssm/typings.d.ts +14 -4
- package/package.json +3 -3
- package/src/components/primary-tablist/Component.collapsible.tsx +3 -3
- package/src/components/primary-tablist/Component.desktop.tsx +1 -1
- package/src/components/primary-tablist/Component.mobile.tsx +1 -1
- package/src/components/primary-tablist/Component.responsive.tsx +1 -1
- package/src/components/primary-tablist/Component.tsx +1 -1
- package/src/components/primary-tablist/index.module.css +3 -1
- package/src/components/scroll-controls/Component.tsx +2 -2
- package/src/components/scroll-controls/utils.ts +10 -7
- package/src/components/scrollable-container/Component.tsx +2 -2
- package/src/components/secondary-tablist/Component.desktop.tsx +1 -1
- package/src/components/secondary-tablist/Component.mobile.tsx +1 -1
- package/src/components/secondary-tablist/Component.responsive.tsx +1 -1
- package/src/components/secondary-tablist/Component.tsx +1 -1
- package/src/components/tab/Component.tsx +2 -3
- package/src/components/tabs/Component.collapsible.tsx +1 -1
- package/src/components/tabs/Component.desktop.tsx +1 -1
- package/src/components/tabs/Component.mobile.tsx +1 -1
- package/src/components/tabs/Component.responsive.tsx +1 -1
- package/src/components/tabs/Component.tsx +4 -1
- package/src/components/title/Component.tsx +3 -3
- package/src/hooks/use-collapsible-elements.ts +2 -2
- package/src/hooks/use-tablist-titles.ts +1 -1
- package/src/hooks/{use-tabs.tsx → use-tabs.ts} +5 -5
- package/src/synthetic-events.ts +1 -1
- package/src/typings.ts +78 -47
- package/synthetic-events.d.ts +1 -1
- package/synthetic-events.js.map +1 -1
- package/typings.d.ts +14 -4
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import React, { Ref, useEffect, useMemo, useRef } from 'react';
|
|
1
|
+
import React, { type Ref, useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
|
|
4
4
|
import { Badge } from '@alfalab/core-components-badge';
|
|
5
5
|
import { KeyboardFocusable } from '@alfalab/core-components-keyboard-focusable';
|
|
6
6
|
import {
|
|
7
7
|
PickerButtonDesktop,
|
|
8
|
-
PickerButtonDesktopProps,
|
|
8
|
+
type PickerButtonDesktopProps,
|
|
9
9
|
} from '@alfalab/core-components-picker-button/desktop';
|
|
10
10
|
|
|
11
11
|
import { useTablistTitles } from '../../hooks/use-tablist-titles';
|
|
12
12
|
import { createSyntheticMouseEvent } from '../../synthetic-events';
|
|
13
|
-
import { TabListProps } from '../../typings';
|
|
13
|
+
import { type TabListProps } from '../../typings';
|
|
14
14
|
import { Title } from '../title';
|
|
15
15
|
|
|
16
16
|
import styles from './index.module.css';
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { useIsDesktop } from '@alfalab/core-components-mq';
|
|
4
4
|
|
|
5
|
-
import { TabListProps } from '../../typings';
|
|
5
|
+
import { type TabListProps } from '../../typings';
|
|
6
6
|
|
|
7
7
|
import { PrimaryTabListDesktop } from './Component.desktop';
|
|
8
8
|
import { PrimaryTabListMobile } from './Component.mobile';
|
|
@@ -6,7 +6,7 @@ import { KeyboardFocusable } from '@alfalab/core-components-keyboard-focusable';
|
|
|
6
6
|
import { fnUtils } from '@alfalab/core-components-shared';
|
|
7
7
|
|
|
8
8
|
import { useTabs } from '../../hooks/use-tabs';
|
|
9
|
-
import { PlatformProps, Styles, TabListProps } from '../../typings';
|
|
9
|
+
import { type PlatformProps, type Styles, type TabListProps } from '../../typings';
|
|
10
10
|
import { ScrollableContainer } from '../scrollable-container';
|
|
11
11
|
import { Title } from '../title';
|
|
12
12
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { forwardRef, RefObject, useEffect, useState } from 'react';
|
|
1
|
+
import React, { forwardRef, type RefObject, useEffect, useState } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import _debounce from 'lodash/debounce';
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ import { IconButton } from '@alfalab/core-components-icon-button';
|
|
|
6
6
|
import { ChevronLeftCompactSIcon } from '@alfalab/icons-glyph/ChevronLeftCompactSIcon';
|
|
7
7
|
import { ChevronRightCompactSIcon } from '@alfalab/icons-glyph/ChevronRightCompactSIcon';
|
|
8
8
|
|
|
9
|
-
import { TabsProps } from '../../typings';
|
|
9
|
+
import { type TabsProps } from '../../typings';
|
|
10
10
|
|
|
11
11
|
import { getDisabledState, scrollIntoFirstTab, scrollIntoLastTab } from './utils';
|
|
12
12
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const ADDITIONAL_OFFSET = 15;
|
|
2
2
|
|
|
3
3
|
function getTabs(container: HTMLDivElement) {
|
|
4
|
-
return Array.from(container.querySelectorAll('button[role="tab"]'))
|
|
4
|
+
return Array.from(container.querySelectorAll<HTMLButtonElement>('button[role="tab"]'));
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
function findLastVisibleTab(container: HTMLDivElement) {
|
|
@@ -19,13 +19,16 @@ function findLastVisibleTab(container: HTMLDivElement) {
|
|
|
19
19
|
function findFirstVisibleTab(container: HTMLDivElement) {
|
|
20
20
|
const tabs = getTabs(container);
|
|
21
21
|
|
|
22
|
-
return tabs.reduceRight(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
return tabs.reduceRight(
|
|
23
|
+
(res, tab) => {
|
|
24
|
+
if (tab.offsetLeft + tab.clientWidth > container.scrollLeft + ADDITIONAL_OFFSET) {
|
|
25
|
+
return tab;
|
|
26
|
+
}
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
return res;
|
|
29
|
+
},
|
|
30
|
+
tabs[tabs.length - 1],
|
|
31
|
+
);
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
export function scrollIntoLastTab(container: HTMLDivElement | null) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React, { ReactNode, useEffect, useRef, useState } from 'react';
|
|
1
|
+
import React, { type ReactNode, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { compute } from 'compute-scroll-into-view';
|
|
4
4
|
|
|
5
|
-
import { PlatformProps, TabsProps } from '../../typings';
|
|
5
|
+
import { type PlatformProps, type TabsProps } from '../../typings';
|
|
6
6
|
import { ScrollControls } from '../scroll-controls';
|
|
7
7
|
|
|
8
8
|
import styles from './index.module.css';
|
|
@@ -3,7 +3,7 @@ import cn from 'classnames';
|
|
|
3
3
|
|
|
4
4
|
import { TagDesktop } from '@alfalab/core-components-tag/desktop';
|
|
5
5
|
|
|
6
|
-
import { SecondaryTabListProps } from '../../typings';
|
|
6
|
+
import { type SecondaryTabListProps } from '../../typings';
|
|
7
7
|
|
|
8
8
|
import { SecondaryTabList } from './Component';
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@ import cn from 'classnames';
|
|
|
3
3
|
|
|
4
4
|
import { TagMobile } from '@alfalab/core-components-tag/mobile';
|
|
5
5
|
|
|
6
|
-
import { SecondaryTabListProps } from '../../typings';
|
|
6
|
+
import { type SecondaryTabListProps } from '../../typings';
|
|
7
7
|
|
|
8
8
|
import { SecondaryTabList } from './Component';
|
|
9
9
|
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { useIsDesktop } from '@alfalab/core-components-mq';
|
|
4
4
|
|
|
5
|
-
import { SecondaryTabListProps } from '../../typings';
|
|
5
|
+
import { type SecondaryTabListProps } from '../../typings';
|
|
6
6
|
|
|
7
7
|
import { SecondaryTabListDesktop } from './Component.desktop';
|
|
8
8
|
import { SecondaryTabListMobile } from './Component.mobile';
|
|
@@ -4,7 +4,7 @@ import cn from 'classnames';
|
|
|
4
4
|
import { Skeleton } from '@alfalab/core-components-skeleton';
|
|
5
5
|
|
|
6
6
|
import { useTabs } from '../../hooks/use-tabs';
|
|
7
|
-
import { PlatformProps, SecondaryTabListProps, Styles } from '../../typings';
|
|
7
|
+
import { type PlatformProps, type SecondaryTabListProps, type Styles } from '../../typings';
|
|
8
8
|
import { ScrollableContainer } from '../scrollable-container';
|
|
9
9
|
|
|
10
10
|
function getBorderRadius(
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import React, { type AriaAttributes } from 'react';
|
|
3
2
|
import cn from 'classnames';
|
|
4
3
|
|
|
5
|
-
import { TabProps } from '../../typings';
|
|
4
|
+
import { type TabProps } from '../../typings';
|
|
6
5
|
|
|
7
6
|
import styles from './index.module.css';
|
|
8
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { TabsProps } from '../../typings';
|
|
3
|
+
import { type TabsProps } from '../../typings';
|
|
4
4
|
import { PrimaryTabListDesktop } from '../primary-tablist/Component.desktop';
|
|
5
5
|
import { SecondaryTabListDesktop } from '../secondary-tablist/Component.desktop';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { TabsProps } from '../../typings';
|
|
3
|
+
import { type TabsProps } from '../../typings';
|
|
4
4
|
import { PrimaryTabListMobile } from '../primary-tablist/Component.mobile';
|
|
5
5
|
import { SecondaryTabListMobile } from '../secondary-tablist/Component.mobile';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { TabsProps } from '../../typings';
|
|
3
|
+
import { type TabsProps } from '../../typings';
|
|
4
4
|
import { PrimaryTabListResponsive } from '../primary-tablist/Component.responsive';
|
|
5
5
|
import { SecondaryTabListResponsive } from '../secondary-tablist/Component.responsive';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { cloneElement } from 'react';
|
|
2
2
|
|
|
3
|
-
import { TabsProps } from '../../typings';
|
|
3
|
+
import { type TabsProps } from '../../typings';
|
|
4
4
|
|
|
5
5
|
export const Tabs = ({
|
|
6
6
|
TabList,
|
|
@@ -24,9 +24,11 @@ export const Tabs = ({
|
|
|
24
24
|
skeletonProps,
|
|
25
25
|
textStyle,
|
|
26
26
|
style,
|
|
27
|
+
titleProps,
|
|
27
28
|
...restProps
|
|
28
29
|
}: Omit<TabsProps, 'view'>) => {
|
|
29
30
|
const tabsArray = React.Children.toArray(children) as TabsProps['children'];
|
|
31
|
+
|
|
30
32
|
const titles = tabsArray.map(
|
|
31
33
|
({
|
|
32
34
|
props: {
|
|
@@ -48,6 +50,7 @@ export const Tabs = ({
|
|
|
48
50
|
toggleClassName,
|
|
49
51
|
dataTestId: toggleTestId,
|
|
50
52
|
toggleRef,
|
|
53
|
+
...titleProps,
|
|
51
54
|
}),
|
|
52
55
|
);
|
|
53
56
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { ButtonHTMLAttributes, forwardRef, useEffect, useRef } from 'react';
|
|
1
|
+
import React, { type ButtonHTMLAttributes, forwardRef, useEffect, useRef } from 'react';
|
|
2
2
|
import mergeRefs from 'react-merge-refs';
|
|
3
3
|
import cn from 'classnames';
|
|
4
4
|
|
|
5
|
-
import { Skeleton, SkeletonProps } from '@alfalab/core-components-skeleton';
|
|
5
|
+
import { Skeleton, type SkeletonProps } from '@alfalab/core-components-skeleton';
|
|
6
6
|
|
|
7
|
-
import { Styles, TabListTitle } from '../../typings';
|
|
7
|
+
import { type Styles, type TabListTitle } from '../../typings';
|
|
8
8
|
|
|
9
9
|
type Props = TabListTitle &
|
|
10
10
|
Styles &
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DependencyList, useRef, useState } from 'react';
|
|
1
|
+
import { type DependencyList, useRef, useState } from 'react';
|
|
2
2
|
import { ResizeObserver as ResizeObserverPolyfill } from '@juggle/resize-observer';
|
|
3
3
|
|
|
4
4
|
import { useLayoutEffect_SAFE_FOR_SSR } from '@alfalab/hooks';
|
|
@@ -24,7 +24,7 @@ export const useCollapsibleElements = <
|
|
|
24
24
|
const addon = addonRef.current;
|
|
25
25
|
const containerWidth =
|
|
26
26
|
(inlineSize || container.clientWidth) - (addon?.scrollWidth || 0) * 1.5; // при расчётах, даём кнопке "Ещё" чуть больше места, чтобы точно влезла
|
|
27
|
-
const elements = Array.from(container.querySelectorAll(selectors))
|
|
27
|
+
const elements = Array.from(container.querySelectorAll<HTMLElement>(selectors));
|
|
28
28
|
|
|
29
29
|
const collapsedIds = elements.reduce<string[]>((acc, element) => {
|
|
30
30
|
const { offsetLeft, scrollWidth, id } = element;
|
|
@@ -2,7 +2,7 @@ import { useMemo } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { useIsDesktop } from '@alfalab/core-components-mq';
|
|
4
4
|
|
|
5
|
-
import { TabListProps } from '../typings';
|
|
5
|
+
import { type TabListProps } from '../typings';
|
|
6
6
|
|
|
7
7
|
import { useCollapsibleElements } from './use-collapsible-elements';
|
|
8
8
|
import { useTabs } from './use-tabs';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
KeyboardEvent,
|
|
3
|
-
MouseEvent,
|
|
4
|
-
MutableRefObject,
|
|
5
|
-
Ref,
|
|
2
|
+
type KeyboardEvent,
|
|
3
|
+
type MouseEvent,
|
|
4
|
+
type MutableRefObject,
|
|
5
|
+
type Ref,
|
|
6
6
|
useCallback,
|
|
7
7
|
useRef,
|
|
8
8
|
useState,
|
|
@@ -11,7 +11,7 @@ import mergeRefs from 'react-merge-refs';
|
|
|
11
11
|
|
|
12
12
|
import { getDataTestId } from '@alfalab/core-components-shared';
|
|
13
13
|
|
|
14
|
-
import { TabListTitle, UseTabsProps } from '../typings';
|
|
14
|
+
import { type TabListTitle, type UseTabsProps } from '../typings';
|
|
15
15
|
|
|
16
16
|
export function useTabs({ titles = [], selectedId, onChange }: UseTabsProps) {
|
|
17
17
|
const [selectedTab, setSelectedTab] = useState<HTMLButtonElement | null>(null);
|
package/src/synthetic-events.ts
CHANGED
package/src/typings.ts
CHANGED
|
@@ -1,14 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
type AriaAttributes,
|
|
3
|
+
type FC,
|
|
4
|
+
type HTMLAttributes,
|
|
5
|
+
type MouseEvent,
|
|
6
|
+
type ReactElement,
|
|
7
|
+
type ReactNode,
|
|
8
|
+
type Ref,
|
|
9
|
+
} from 'react';
|
|
10
|
+
|
|
11
|
+
import { type SkeletonProps } from '@alfalab/core-components-skeleton';
|
|
12
|
+
import { type TagProps } from '@alfalab/core-components-tag';
|
|
5
13
|
|
|
6
14
|
export type SelectedId = string | number;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
15
|
+
export type TitleProps = Omit<
|
|
16
|
+
HTMLAttributes<HTMLButtonElement>,
|
|
17
|
+
| 'onClick'
|
|
18
|
+
| 'onKeyDown'
|
|
19
|
+
| 'className'
|
|
20
|
+
| 'disabled'
|
|
21
|
+
| 'id'
|
|
22
|
+
| 'role'
|
|
23
|
+
| 'tabIndex'
|
|
24
|
+
| 'aria-selected'
|
|
25
|
+
> &
|
|
26
|
+
AriaAttributes;
|
|
27
|
+
|
|
28
|
+
export interface TabsProps
|
|
29
|
+
extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'children' | 'className'>,
|
|
30
|
+
AriaAttributes {
|
|
12
31
|
/**
|
|
13
32
|
* Дополнительный класс
|
|
14
33
|
*/
|
|
@@ -38,25 +57,25 @@ export interface TabsProps extends Omit<
|
|
|
38
57
|
* Стиль текста. Имеет приоритет над size. Работает только в primary табах.
|
|
39
58
|
*/
|
|
40
59
|
textStyle?:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
| 'paragraph-primary-large'
|
|
61
|
+
| 'paragraph-primary-medium'
|
|
62
|
+
| 'paragraph-primary-small'
|
|
63
|
+
| 'action-primary-large'
|
|
64
|
+
| 'action-primary-medium'
|
|
65
|
+
| 'action-primary-small'
|
|
66
|
+
| 'accent-primary-large'
|
|
67
|
+
| 'accent-primary-medium'
|
|
68
|
+
| 'accent-primary-small'
|
|
69
|
+
| 'headline-system-xlarge'
|
|
70
|
+
| 'headline-system-large'
|
|
71
|
+
| 'headline-system-medium'
|
|
72
|
+
| 'headline-system-small'
|
|
73
|
+
| 'headline-system-xsmall'
|
|
74
|
+
| 'headline-xlarge'
|
|
75
|
+
| 'headline-large'
|
|
76
|
+
| 'headline-medium'
|
|
77
|
+
| 'headline-small'
|
|
78
|
+
| 'headline-xsmall';
|
|
60
79
|
|
|
61
80
|
/**
|
|
62
81
|
* Высота заголовков табов
|
|
@@ -144,6 +163,11 @@ export interface TabsProps extends Omit<
|
|
|
144
163
|
* Доп. пропсы для скелетона
|
|
145
164
|
*/
|
|
146
165
|
skeletonProps?: Omit<SkeletonProps, 'visible'>;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Доп. пропсы для заголовка таба
|
|
169
|
+
*/
|
|
170
|
+
titleProps?: TitleProps;
|
|
147
171
|
}
|
|
148
172
|
|
|
149
173
|
export interface TabProps extends AriaAttributes {
|
|
@@ -201,9 +225,14 @@ export interface TabProps extends AriaAttributes {
|
|
|
201
225
|
* Реф для кнопки переключения таба
|
|
202
226
|
*/
|
|
203
227
|
toggleRef?: Ref<HTMLDivElement>;
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Доп. пропсы для заголовка таба
|
|
231
|
+
*/
|
|
232
|
+
titleProps?: TitleProps;
|
|
204
233
|
}
|
|
205
234
|
|
|
206
|
-
export interface TabListTitle {
|
|
235
|
+
export interface TabListTitle extends AriaAttributes {
|
|
207
236
|
title: NonNullable<ReactNode>;
|
|
208
237
|
id: SelectedId;
|
|
209
238
|
disabled?: boolean;
|
|
@@ -214,26 +243,28 @@ export interface TabListTitle {
|
|
|
214
243
|
collapsed?: boolean;
|
|
215
244
|
dataTestId?: string;
|
|
216
245
|
toggleRef?: Ref<HTMLDivElement>;
|
|
246
|
+
titleProps?: TitleProps;
|
|
217
247
|
}
|
|
218
248
|
|
|
219
|
-
export interface TabListProps
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
249
|
+
export interface TabListProps
|
|
250
|
+
extends Pick<
|
|
251
|
+
TabsProps,
|
|
252
|
+
| 'className'
|
|
253
|
+
| 'containerClassName'
|
|
254
|
+
| 'size'
|
|
255
|
+
| 'defaultMatchMediaValue'
|
|
256
|
+
| 'selectedId'
|
|
257
|
+
| 'scrollable'
|
|
258
|
+
| 'collapsedTabsIds'
|
|
259
|
+
| 'onChange'
|
|
260
|
+
| 'dataTestId'
|
|
261
|
+
| 'fullWidthScroll'
|
|
262
|
+
| 'tagShape'
|
|
263
|
+
| 'tagView'
|
|
264
|
+
| 'textStyle'
|
|
265
|
+
| 'showSkeleton'
|
|
266
|
+
| 'skeletonProps'
|
|
267
|
+
> {
|
|
237
268
|
/**
|
|
238
269
|
* Заголовки табов
|
|
239
270
|
*/
|
package/synthetic-events.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
export declare const createSyntheticEvent: <T extends Element, E extends Event>(event: E) => React.SyntheticEvent<T, E>;
|
|
3
3
|
export declare const createUIEvent: <T extends Element, E extends Event>(event: E) => React.UIEvent<T, E>;
|
|
4
4
|
export declare const createSyntheticMouseEvent: <T extends Element>(event: MouseEvent) => React.MouseEvent<T, MouseEvent>;
|
package/synthetic-events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synthetic-events.js","sources":["src/synthetic-events.ts"],"sourcesContent":["import React from 'react';\n\nexport const createSyntheticEvent = <T extends Element, E extends Event>(\n event: E,\n): React.SyntheticEvent<T, E> => {\n let isDefaultPrevented = false;\n let isPropagationStopped = false;\n const preventDefault = () => {\n isDefaultPrevented = true;\n event.preventDefault();\n };\n const stopPropagation = () => {\n isPropagationStopped = true;\n event.stopPropagation();\n };\n\n return {\n nativeEvent: event,\n currentTarget: event.currentTarget as EventTarget & T,\n target: event.target as EventTarget & T,\n bubbles: event.bubbles,\n cancelable: event.cancelable,\n defaultPrevented: event.defaultPrevented,\n eventPhase: event.eventPhase,\n isTrusted: event.isTrusted,\n preventDefault,\n isDefaultPrevented: () => isDefaultPrevented,\n stopPropagation,\n isPropagationStopped: () => isPropagationStopped,\n persist: () => {},\n timeStamp: event.timeStamp,\n type: event.type,\n };\n};\n\nexport const createUIEvent = <T extends Element, E extends Event>(\n event: E,\n): React.UIEvent<T, E> => ({\n ...createSyntheticEvent(event),\n detail: 0,\n view: {\n styleMedia: {\n type: '',\n matchMedium: () => false,\n },\n document,\n },\n});\n\nexport const createSyntheticMouseEvent = <T extends Element>(\n event: MouseEvent,\n): React.MouseEvent<T, MouseEvent> => ({\n ...createUIEvent<T, MouseEvent>(event),\n altKey: event.altKey,\n button: event.button,\n buttons: event.buttons,\n clientX: event.clientX,\n clientY: event.clientY,\n ctrlKey: event.ctrlKey,\n getModifierState: event.getModifierState,\n metaKey: event.metaKey,\n movementX: event.movementX,\n movementY: event.movementY,\n pageX: event.pageX,\n pageY: event.pageY,\n relatedTarget: event.relatedTarget,\n screenX: event.screenX,\n screenY: event.screenY,\n shiftKey: event.shiftKey,\n});\n"],"names":["__assign"],"mappings":";;;;;;AAEO,IAAM,oBAAoB,GAAG,UAChC,KAAQ,EAAA;IAER,IAAI,kBAAkB,GAAG,KAAK;IAC9B,IAAI,oBAAoB,GAAG,KAAK;AAChC,IAAA,IAAM,cAAc,GAAG,YAAA;QACnB,kBAAkB,GAAG,IAAI;QACzB,KAAK,CAAC,cAAc,EAAE;AAC1B,KAAC;AACD,IAAA,IAAM,eAAe,GAAG,YAAA;QACpB,oBAAoB,GAAG,IAAI;QAC3B,KAAK,CAAC,eAAe,EAAE;AAC3B,KAAC;IAED,OAAO;AACH,QAAA,WAAW,EAAE,KAAK;QAClB,aAAa,EAAE,KAAK,CAAC,aAAgC;QACrD,MAAM,EAAE,KAAK,CAAC,MAAyB;QACvC,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;QACxC,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,SAAS,EAAE,KAAK,CAAC,SAAS;AAC1B,QAAA,cAAc,EAAA,cAAA;AACd,QAAA,kBAAkB,EAAE,YAAA,EAAM,OAAA,kBAAkB,GAAA;AAC5C,QAAA,eAAe,EAAA,eAAA;AACf,QAAA,oBAAoB,EAAE,YAAA,EAAM,OAAA,oBAAoB,GAAA;QAChD,OAAO,EAAE,eAAQ;QACjB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,IAAI,EAAE,KAAK,CAAC,IAAI;KACnB;AACL;AAEa,IAAA,aAAa,GAAG,UACzB,KAAQ,IACc,QAAAA,cAAA,CAAAA,cAAA,CAAA,EAAA,EACnB,oBAAoB,CAAC,KAAK,CAAC,CAC9B,EAAA,EAAA,MAAM,EAAE,CAAC,EACT,IAAI,EAAE;AACF,QAAA,UAAU,EAAE;AACR,YAAA,IAAI,EAAE,EAAE;AACR,YAAA,WAAW,EAAE,YAAA,EAAM,OAAA,KAAK,GAAA;AAC3B,SAAA;AACD,QAAA,QAAQ,EAAA,QAAA;KACX,EACH,CAAA,EAAA;AAEW,IAAA,yBAAyB,GAAG,UACrC,KAAiB,EACiB,EAAA,QAC/BA,cAAA,CAAAA,cAAA,CAAA,EAAA,EAAA,aAAa,CAAgB,KAAK,CAAC,CACtC,EAAA,EAAA,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,EACxC,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,aAAa,EAAE,KAAK,CAAC,aAAa,EAClC,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAA,CAAA,EAjBU;;;;;;"}
|
|
1
|
+
{"version":3,"file":"synthetic-events.js","sources":["src/synthetic-events.ts"],"sourcesContent":["import type React from 'react';\n\nexport const createSyntheticEvent = <T extends Element, E extends Event>(\n event: E,\n): React.SyntheticEvent<T, E> => {\n let isDefaultPrevented = false;\n let isPropagationStopped = false;\n const preventDefault = () => {\n isDefaultPrevented = true;\n event.preventDefault();\n };\n const stopPropagation = () => {\n isPropagationStopped = true;\n event.stopPropagation();\n };\n\n return {\n nativeEvent: event,\n currentTarget: event.currentTarget as EventTarget & T,\n target: event.target as EventTarget & T,\n bubbles: event.bubbles,\n cancelable: event.cancelable,\n defaultPrevented: event.defaultPrevented,\n eventPhase: event.eventPhase,\n isTrusted: event.isTrusted,\n preventDefault,\n isDefaultPrevented: () => isDefaultPrevented,\n stopPropagation,\n isPropagationStopped: () => isPropagationStopped,\n persist: () => {},\n timeStamp: event.timeStamp,\n type: event.type,\n };\n};\n\nexport const createUIEvent = <T extends Element, E extends Event>(\n event: E,\n): React.UIEvent<T, E> => ({\n ...createSyntheticEvent(event),\n detail: 0,\n view: {\n styleMedia: {\n type: '',\n matchMedium: () => false,\n },\n document,\n },\n});\n\nexport const createSyntheticMouseEvent = <T extends Element>(\n event: MouseEvent,\n): React.MouseEvent<T, MouseEvent> => ({\n ...createUIEvent<T, MouseEvent>(event),\n altKey: event.altKey,\n button: event.button,\n buttons: event.buttons,\n clientX: event.clientX,\n clientY: event.clientY,\n ctrlKey: event.ctrlKey,\n getModifierState: event.getModifierState,\n metaKey: event.metaKey,\n movementX: event.movementX,\n movementY: event.movementY,\n pageX: event.pageX,\n pageY: event.pageY,\n relatedTarget: event.relatedTarget,\n screenX: event.screenX,\n screenY: event.screenY,\n shiftKey: event.shiftKey,\n});\n"],"names":["__assign"],"mappings":";;;;;;AAEO,IAAM,oBAAoB,GAAG,UAChC,KAAQ,EAAA;IAER,IAAI,kBAAkB,GAAG,KAAK;IAC9B,IAAI,oBAAoB,GAAG,KAAK;AAChC,IAAA,IAAM,cAAc,GAAG,YAAA;QACnB,kBAAkB,GAAG,IAAI;QACzB,KAAK,CAAC,cAAc,EAAE;AAC1B,KAAC;AACD,IAAA,IAAM,eAAe,GAAG,YAAA;QACpB,oBAAoB,GAAG,IAAI;QAC3B,KAAK,CAAC,eAAe,EAAE;AAC3B,KAAC;IAED,OAAO;AACH,QAAA,WAAW,EAAE,KAAK;QAClB,aAAa,EAAE,KAAK,CAAC,aAAgC;QACrD,MAAM,EAAE,KAAK,CAAC,MAAyB;QACvC,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;QACxC,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,SAAS,EAAE,KAAK,CAAC,SAAS;AAC1B,QAAA,cAAc,EAAA,cAAA;AACd,QAAA,kBAAkB,EAAE,YAAA,EAAM,OAAA,kBAAkB,GAAA;AAC5C,QAAA,eAAe,EAAA,eAAA;AACf,QAAA,oBAAoB,EAAE,YAAA,EAAM,OAAA,oBAAoB,GAAA;QAChD,OAAO,EAAE,eAAQ;QACjB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,IAAI,EAAE,KAAK,CAAC,IAAI;KACnB;AACL;AAEa,IAAA,aAAa,GAAG,UACzB,KAAQ,IACc,QAAAA,cAAA,CAAAA,cAAA,CAAA,EAAA,EACnB,oBAAoB,CAAC,KAAK,CAAC,CAC9B,EAAA,EAAA,MAAM,EAAE,CAAC,EACT,IAAI,EAAE;AACF,QAAA,UAAU,EAAE;AACR,YAAA,IAAI,EAAE,EAAE;AACR,YAAA,WAAW,EAAE,YAAA,EAAM,OAAA,KAAK,GAAA;AAC3B,SAAA;AACD,QAAA,QAAQ,EAAA,QAAA;KACX,EACH,CAAA,EAAA;AAEW,IAAA,yBAAyB,GAAG,UACrC,KAAiB,EACiB,EAAA,QAC/BA,cAAA,CAAAA,cAAA,CAAA,EAAA,EAAA,aAAa,CAAgB,KAAK,CAAC,CACtC,EAAA,EAAA,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,EACxC,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,EAC1B,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,aAAa,EAAE,KAAK,CAAC,aAAa,EAClC,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAA,CAAA,EAjBU;;;;;;"}
|
package/typings.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { AriaAttributes, FC, HTMLAttributes, MouseEvent, ReactElement, ReactNode, Ref } from 'react';
|
|
2
|
-
import { SkeletonProps } from '@alfalab/core-components-skeleton';
|
|
3
|
-
import { TagProps } from '@alfalab/core-components-tag';
|
|
1
|
+
import { type AriaAttributes, type FC, type HTMLAttributes, type MouseEvent, type ReactElement, type ReactNode, type Ref } from 'react';
|
|
2
|
+
import { type SkeletonProps } from '@alfalab/core-components-skeleton';
|
|
3
|
+
import { type TagProps } from '@alfalab/core-components-tag';
|
|
4
4
|
export declare type SelectedId = string | number;
|
|
5
|
+
export declare type TitleProps = Omit<HTMLAttributes<HTMLButtonElement>, 'onClick' | 'onKeyDown' | 'className' | 'disabled' | 'id' | 'role' | 'tabIndex' | 'aria-selected'> & AriaAttributes;
|
|
5
6
|
export interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'children' | 'className'>, AriaAttributes {
|
|
6
7
|
/**
|
|
7
8
|
* Дополнительный класс
|
|
@@ -99,6 +100,10 @@ export interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChang
|
|
|
99
100
|
* Доп. пропсы для скелетона
|
|
100
101
|
*/
|
|
101
102
|
skeletonProps?: Omit<SkeletonProps, 'visible'>;
|
|
103
|
+
/**
|
|
104
|
+
* Доп. пропсы для заголовка таба
|
|
105
|
+
*/
|
|
106
|
+
titleProps?: TitleProps;
|
|
102
107
|
}
|
|
103
108
|
export interface TabProps extends AriaAttributes {
|
|
104
109
|
/**
|
|
@@ -145,8 +150,12 @@ export interface TabProps extends AriaAttributes {
|
|
|
145
150
|
* Реф для кнопки переключения таба
|
|
146
151
|
*/
|
|
147
152
|
toggleRef?: Ref<HTMLDivElement>;
|
|
153
|
+
/**
|
|
154
|
+
* Доп. пропсы для заголовка таба
|
|
155
|
+
*/
|
|
156
|
+
titleProps?: TitleProps;
|
|
148
157
|
}
|
|
149
|
-
export interface TabListTitle {
|
|
158
|
+
export interface TabListTitle extends AriaAttributes {
|
|
150
159
|
title: NonNullable<ReactNode>;
|
|
151
160
|
id: SelectedId;
|
|
152
161
|
disabled?: boolean;
|
|
@@ -157,6 +166,7 @@ export interface TabListTitle {
|
|
|
157
166
|
collapsed?: boolean;
|
|
158
167
|
dataTestId?: string;
|
|
159
168
|
toggleRef?: Ref<HTMLDivElement>;
|
|
169
|
+
titleProps?: TitleProps;
|
|
160
170
|
}
|
|
161
171
|
export interface TabListProps extends Pick<TabsProps, 'className' | 'containerClassName' | 'size' | 'defaultMatchMediaValue' | 'selectedId' | 'scrollable' | 'collapsedTabsIds' | 'onChange' | 'dataTestId' | 'fullWidthScroll' | 'tagShape' | 'tagView' | 'textStyle' | 'showSkeleton' | 'skeletonProps'> {
|
|
162
172
|
/**
|