@alfalab/core-components-tabs 8.8.6 → 8.9.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.
Files changed (128) hide show
  1. package/components/primary-tablist/Component.collapsible.d.ts +1 -1
  2. package/components/primary-tablist/Component.collapsible.js +4 -4
  3. package/components/primary-tablist/Component.d.ts +1 -1
  4. package/components/primary-tablist/Component.desktop.js +1 -1
  5. package/components/primary-tablist/Component.js +3 -3
  6. package/components/primary-tablist/Component.mobile.js +2 -2
  7. package/components/primary-tablist/index.css +137 -137
  8. package/components/primary-tablist/mobile.css +804 -804
  9. package/components/scroll-controls/Component.d.ts +1 -0
  10. package/components/scroll-controls/Component.js +4 -4
  11. package/components/scroll-controls/index.css +15 -15
  12. package/components/scrollable-container/Component.d.ts +5 -1
  13. package/components/scrollable-container/Component.js +3 -3
  14. package/components/scrollable-container/index.css +9 -9
  15. package/components/secondary-tablist/Component.d.ts +1 -1
  16. package/components/secondary-tablist/Component.desktop.js +1 -1
  17. package/components/secondary-tablist/Component.js +15 -3
  18. package/components/secondary-tablist/Component.mobile.js +2 -2
  19. package/components/secondary-tablist/index.css +27 -21
  20. package/components/secondary-tablist/mobile.css +609 -602
  21. package/components/tab/Component.js +1 -1
  22. package/components/tab/index.css +3 -3
  23. package/components/tabs/Component.d.ts +1 -1
  24. package/components/tabs/Component.js +2 -2
  25. package/components/title/Component.d.ts +3 -0
  26. package/components/title/Component.js +13 -8
  27. package/cssm/components/primary-tablist/Component.collapsible.d.ts +1 -1
  28. package/cssm/components/primary-tablist/Component.collapsible.js +3 -3
  29. package/cssm/components/primary-tablist/Component.d.ts +1 -1
  30. package/cssm/components/primary-tablist/Component.js +3 -3
  31. package/cssm/components/primary-tablist/index.module.css +6 -6
  32. package/cssm/components/primary-tablist/mobile.module.css +3 -3
  33. package/cssm/components/primary-tablist/text-styles.module.css +3 -3
  34. package/cssm/components/scroll-controls/Component.d.ts +1 -0
  35. package/cssm/components/scroll-controls/Component.js +3 -3
  36. package/cssm/components/scroll-controls/index.module.css +3 -3
  37. package/cssm/components/scrollable-container/Component.d.ts +5 -1
  38. package/cssm/components/scrollable-container/Component.js +2 -2
  39. package/cssm/components/scrollable-container/index.module.css +3 -3
  40. package/cssm/components/secondary-tablist/Component.d.ts +1 -1
  41. package/cssm/components/secondary-tablist/Component.js +15 -3
  42. package/cssm/components/secondary-tablist/index.module.css +22 -16
  43. package/cssm/components/secondary-tablist/mobile.module.css +5 -4
  44. package/cssm/components/tabs/Component.d.ts +1 -1
  45. package/cssm/components/tabs/Component.js +2 -2
  46. package/cssm/components/title/Component.d.ts +3 -0
  47. package/cssm/components/title/Component.js +13 -8
  48. package/cssm/typings.d.ts +10 -1
  49. package/cssm/vars.css +3 -3
  50. package/esm/components/primary-tablist/Component.collapsible.d.ts +1 -1
  51. package/esm/components/primary-tablist/Component.collapsible.js +4 -4
  52. package/esm/components/primary-tablist/Component.d.ts +1 -1
  53. package/esm/components/primary-tablist/Component.desktop.js +1 -1
  54. package/esm/components/primary-tablist/Component.js +3 -3
  55. package/esm/components/primary-tablist/Component.mobile.js +2 -2
  56. package/esm/components/primary-tablist/index.css +137 -137
  57. package/esm/components/primary-tablist/mobile.css +804 -804
  58. package/esm/components/scroll-controls/Component.d.ts +1 -0
  59. package/esm/components/scroll-controls/Component.js +4 -4
  60. package/esm/components/scroll-controls/index.css +15 -15
  61. package/esm/components/scrollable-container/Component.d.ts +5 -1
  62. package/esm/components/scrollable-container/Component.js +3 -3
  63. package/esm/components/scrollable-container/index.css +9 -9
  64. package/esm/components/secondary-tablist/Component.d.ts +1 -1
  65. package/esm/components/secondary-tablist/Component.desktop.js +1 -1
  66. package/esm/components/secondary-tablist/Component.js +15 -3
  67. package/esm/components/secondary-tablist/Component.mobile.js +2 -2
  68. package/esm/components/secondary-tablist/index.css +27 -21
  69. package/esm/components/secondary-tablist/mobile.css +609 -602
  70. package/esm/components/tab/Component.js +1 -1
  71. package/esm/components/tab/index.css +3 -3
  72. package/esm/components/tabs/Component.d.ts +1 -1
  73. package/esm/components/tabs/Component.js +2 -2
  74. package/esm/components/title/Component.d.ts +3 -0
  75. package/esm/components/title/Component.js +13 -8
  76. package/esm/index.module-2e31d255.js +4 -0
  77. package/esm/index.module-58855717.js +4 -0
  78. package/esm/typings.d.ts +10 -1
  79. package/index.module-1b957504.js +6 -0
  80. package/index.module-e547bb72.js +6 -0
  81. package/modern/components/primary-tablist/Component.collapsible.d.ts +1 -1
  82. package/modern/components/primary-tablist/Component.collapsible.js +4 -4
  83. package/modern/components/primary-tablist/Component.d.ts +1 -1
  84. package/modern/components/primary-tablist/Component.desktop.js +1 -1
  85. package/modern/components/primary-tablist/Component.js +3 -3
  86. package/modern/components/primary-tablist/Component.mobile.js +2 -2
  87. package/modern/components/primary-tablist/index.css +137 -137
  88. package/modern/components/primary-tablist/mobile.css +804 -804
  89. package/modern/components/scroll-controls/Component.d.ts +1 -0
  90. package/modern/components/scroll-controls/Component.js +4 -4
  91. package/modern/components/scroll-controls/index.css +15 -15
  92. package/modern/components/scrollable-container/Component.d.ts +5 -1
  93. package/modern/components/scrollable-container/Component.js +3 -3
  94. package/modern/components/scrollable-container/index.css +9 -9
  95. package/modern/components/secondary-tablist/Component.d.ts +1 -1
  96. package/modern/components/secondary-tablist/Component.desktop.js +1 -1
  97. package/modern/components/secondary-tablist/Component.js +18 -3
  98. package/modern/components/secondary-tablist/Component.mobile.js +2 -2
  99. package/modern/components/secondary-tablist/index.css +27 -21
  100. package/modern/components/secondary-tablist/mobile.css +609 -602
  101. package/modern/components/tab/Component.js +1 -1
  102. package/modern/components/tab/index.css +3 -3
  103. package/modern/components/tabs/Component.d.ts +1 -1
  104. package/modern/components/tabs/Component.js +2 -2
  105. package/modern/components/title/Component.d.ts +3 -0
  106. package/modern/components/title/Component.js +17 -10
  107. package/modern/index.module-c9fbdbe7.js +4 -0
  108. package/modern/index.module-efcd5c38.js +4 -0
  109. package/modern/typings.d.ts +10 -1
  110. package/package.json +4 -3
  111. package/src/components/primary-tablist/Component.collapsible.tsx +5 -0
  112. package/src/components/primary-tablist/Component.tsx +5 -0
  113. package/src/components/primary-tablist/index.module.css +1 -1
  114. package/src/components/scroll-controls/Component.tsx +4 -3
  115. package/src/components/scrollable-container/Component.tsx +7 -0
  116. package/src/components/secondary-tablist/Component.tsx +42 -1
  117. package/src/components/secondary-tablist/index.module.css +30 -12
  118. package/src/components/secondary-tablist/mobile.module.css +2 -1
  119. package/src/components/tabs/Component.tsx +4 -0
  120. package/src/components/title/Component.tsx +27 -5
  121. package/src/typings.ts +13 -0
  122. package/typings.d.ts +10 -1
  123. package/esm/index.module-02dfb393.js +0 -4
  124. package/esm/index.module-19d5207b.js +0 -4
  125. package/index.module-64e722f7.js +0 -6
  126. package/index.module-ef18a814.js +0 -6
  127. package/modern/index.module-4ff88bb9.js +0 -4
  128. package/modern/index.module-e3f72734.js +0 -4
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import cn from 'classnames';
3
3
 
4
- const styles = {"component":"tabs__component_1qfyb","hidden":"tabs__hidden_1qfyb"};
4
+ const styles = {"component":"tabs__component_8x2uw","hidden":"tabs__hidden_8x2uw"};
5
5
  require('./index.css')
6
6
 
7
7
  const Tab = ({ children, hidden, className, disabled, dataTestId }) => children ? (React.createElement("div", { className: cn(styles.component, {
@@ -1,8 +1,8 @@
1
- /* hash: wwjpq */
2
- .tabs__component_1qfyb {
1
+ /* hash: ibbij */
2
+ .tabs__component_8x2uw {
3
3
  outline: none;
4
4
  }
5
5
 
6
- .tabs__hidden_1qfyb {
6
+ .tabs__hidden_8x2uw {
7
7
  display: none;
8
8
  }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import React from 'react';
3
3
  import { TabsProps } from "../../typings";
4
- declare const Tabs: ({ TabList, className, containerClassName, size, defaultMatchMediaValue, children, selectedId, scrollable, collapsedTabsIds, fullWidthScroll, keepMounted, dataTestId, onChange, breakpoint, tagShape, tagView, textStyle, style, }: Omit<TabsProps, 'view'>) => React.JSX.Element;
4
+ declare const Tabs: ({ TabList, className, containerClassName, size, defaultMatchMediaValue, children, selectedId, scrollable, collapsedTabsIds, fullWidthScroll, keepMounted, dataTestId, onChange, breakpoint, tagShape, tagView, showSkeleton, skeletonProps, textStyle, style, }: Omit<TabsProps, 'view'>) => React.JSX.Element;
5
5
  export { Tabs };
@@ -1,6 +1,6 @@
1
1
  import React, { cloneElement } from 'react';
2
2
 
3
- const Tabs = ({ TabList, className, containerClassName, size, defaultMatchMediaValue, children, selectedId, scrollable, collapsedTabsIds, fullWidthScroll = false, keepMounted = false, dataTestId, onChange, breakpoint = 1024, tagShape, tagView, textStyle, style, }) => {
3
+ const Tabs = ({ TabList, className, containerClassName, size, defaultMatchMediaValue, children, selectedId, scrollable, collapsedTabsIds, fullWidthScroll = false, keepMounted = false, dataTestId, onChange, breakpoint = 1024, tagShape, tagView, showSkeleton = false, skeletonProps, textStyle, style, }) => {
4
4
  const tabsArray = React.Children.toArray(children);
5
5
  const titles = tabsArray.map(({ props: { title, id, rightAddons, disabled, hidden, toggleClassName, dataTestId: toggleTestId, toggleRef, }, }) => ({
6
6
  title,
@@ -14,7 +14,7 @@ const Tabs = ({ TabList, className, containerClassName, size, defaultMatchMediaV
14
14
  }));
15
15
  const tabs = tabsArray.filter((tab) => tab.props.id === selectedId || tab.props.keepMounted || keepMounted);
16
16
  return (React.createElement("div", { className: className },
17
- React.createElement(TabList, { containerClassName: containerClassName, size: size, titles: titles, selectedId: selectedId, scrollable: scrollable, collapsedTabsIds: collapsedTabsIds, onChange: onChange, dataTestId: dataTestId, defaultMatchMediaValue: defaultMatchMediaValue, fullWidthScroll: fullWidthScroll, breakpoint: breakpoint, tagShape: tagShape, tagView: tagView, textStyle: textStyle, inlineStyle: style }),
17
+ React.createElement(TabList, { containerClassName: containerClassName, size: size, titles: titles, selectedId: selectedId, scrollable: scrollable, collapsedTabsIds: collapsedTabsIds, onChange: onChange, dataTestId: dataTestId, defaultMatchMediaValue: defaultMatchMediaValue, fullWidthScroll: fullWidthScroll, breakpoint: breakpoint, tagShape: tagShape, tagView: tagView, textStyle: textStyle, inlineStyle: style, showSkeleton: showSkeleton, skeletonProps: skeletonProps }),
18
18
  tabs.map((tab) => cloneElement(tab, { hidden: tab.props.id !== selectedId }))));
19
19
  };
20
20
 
@@ -1,8 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import React from 'react';
3
+ import { SkeletonProps } from '@alfalab/core-components/skeleton';
3
4
  import { Styles, TabListTitle } from "../../typings";
4
5
  declare const Title: React.ForwardRefExoticComponent<TabListTitle & Styles & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "title" | "id"> & {
5
6
  focused?: boolean | undefined;
6
7
  isOption?: boolean | undefined;
8
+ showSkeleton?: boolean | undefined;
9
+ skeletonProps?: Omit<SkeletonProps, "visible"> | undefined;
7
10
  } & React.RefAttributes<HTMLButtonElement>>;
8
11
  export { Title };
@@ -1,15 +1,22 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import cn from 'classnames';
3
+ import { Skeleton } from '@alfalab/core-components/skeleton';
3
4
 
4
- const Title = forwardRef(({ id, toggleClassName, title, styles = {}, rightAddons = null, hidden = false, selected = false, disabled = false, collapsed = false, focused = false, isOption = false, ...restProps }, ref) => hidden ? null : (React.createElement("button", { ...restProps, ref: ref, disabled: disabled, type: 'button', id: String(id), className: cn(styles.title, {
5
- [styles.selected]: selected,
6
- [styles.disabled]: disabled,
7
- [styles.collapsed]: collapsed && !isOption,
8
- [styles.option]: isOption,
9
- }, toggleClassName) },
10
- React.createElement("span", { className: cn(styles.content, { [styles.focused]: focused }) }, title),
11
- rightAddons && (React.createElement("span", { className: cn(styles.rightAddons, {
12
- [styles.rightAddonsMarginZero]: !title,
13
- }) }, rightAddons)))));
5
+ const Title = forwardRef(({ id, toggleClassName, title, styles = {}, rightAddons = null, hidden = false, selected = false, disabled = false, collapsed = false, focused = false, isOption = false, showSkeleton = false, skeletonProps, ...restProps }, ref) => {
6
+ const titleClassName = {
7
+ [styles.content]: true,
8
+ [styles.focused]: focused,
9
+ };
10
+ return hidden ? null : (React.createElement("button", { ...restProps, ref: ref, disabled: disabled || showSkeleton, type: 'button', id: String(id), className: cn(styles.title, {
11
+ [styles.selected]: selected,
12
+ [styles.disabled]: disabled,
13
+ [styles.collapsed]: collapsed && !isOption,
14
+ [styles.option]: isOption,
15
+ }, toggleClassName) },
16
+ showSkeleton ? (React.createElement(Skeleton, { ...skeletonProps, className: cn(titleClassName, skeletonProps?.className), visible: true }, title)) : (React.createElement("span", { className: cn(titleClassName) }, title)),
17
+ rightAddons && (React.createElement("span", { className: cn(styles.rightAddons, {
18
+ [styles.rightAddonsMarginZero]: !title,
19
+ }) }, rightAddons))));
20
+ });
14
21
 
15
22
  export { Title };
@@ -0,0 +1,4 @@
1
+ const commonStyles = {"component":"tabs__component_1we1x","fullWidthScroll":"tabs__fullWidthScroll_1we1x","container":"tabs__container_1we1x","title":"tabs__title_1we1x","xxs":"tabs__xxs_1we1x","skeleton":"tabs__skeleton_1we1x","xs":"tabs__xs_1we1x","s":"tabs__s_1we1x","m":"tabs__m_1we1x","l":"tabs__l_1we1x","xl":"tabs__xl_1we1x"};
2
+ require('./components/secondary-tablist/index.css')
3
+
4
+ export { commonStyles as c };
@@ -0,0 +1,4 @@
1
+ const styles = {"component":"tabs__component_1wtkw","desktop":"tabs__desktop_1wtkw","paragraph-primary-large":"tabs__paragraph-primary-large_1wtkw","title":"tabs__title_1wtkw","paragraph-primary-medium":"tabs__paragraph-primary-medium_1wtkw","paragraph-primary-small":"tabs__paragraph-primary-small_1wtkw","action-primary-large":"tabs__action-primary-large_1wtkw","action-primary-medium":"tabs__action-primary-medium_1wtkw","action-primary-small":"tabs__action-primary-small_1wtkw","accent-primary-large":"tabs__accent-primary-large_1wtkw","accent-primary-medium":"tabs__accent-primary-medium_1wtkw","accent-primary-small":"tabs__accent-primary-small_1wtkw","pickerWrapper":"tabs__pickerWrapper_1wtkw","option":"tabs__option_1wtkw","scrollControls":"tabs__scrollControls_1wtkw","headline-system-xlarge":"tabs__headline-system-xlarge_1wtkw","headline-system-large":"tabs__headline-system-large_1wtkw","headline-system-medium":"tabs__headline-system-medium_1wtkw","headline-system-small":"tabs__headline-system-small_1wtkw","headline-system-xsmall":"tabs__headline-system-xsmall_1wtkw","headline-xlarge":"tabs__headline-xlarge_1wtkw","headline-large":"tabs__headline-large_1wtkw","headline-medium":"tabs__headline-medium_1wtkw","headline-small":"tabs__headline-small_1wtkw","headline-xsmall":"tabs__headline-xsmall_1wtkw","fullWidthScroll":"tabs__fullWidthScroll_1wtkw","container":"tabs__container_1wtkw","focused":"tabs__focused_1wtkw","collapsed":"tabs__collapsed_1wtkw","selected":"tabs__selected_1wtkw","disabled":"tabs__disabled_1wtkw","line":"tabs__line_1wtkw","s":"tabs__s_1wtkw","xs":"tabs__xs_1wtkw","xxs":"tabs__xxs_1wtkw","m":"tabs__m_1wtkw","l":"tabs__l_1wtkw","xl":"tabs__xl_1wtkw","rightAddons":"tabs__rightAddons_1wtkw","rightAddonsMarginZero":"tabs__rightAddonsMarginZero_1wtkw"};
2
+ require('./components/primary-tablist/index.css')
3
+
4
+ export { styles as s };
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { FC, MouseEvent, ReactElement, ReactNode, Ref } from 'react';
3
+ import { SkeletonProps } from '@alfalab/core-components/skeleton';
3
4
  import { TagProps } from "@alfalab/core-components-tag";
4
5
  type SelectedId = string | number;
5
6
  type TabsProps = {
@@ -86,6 +87,14 @@ type TabsProps = {
86
87
  * Дополнительные инлайн стили для враппера
87
88
  */
88
89
  style?: React.CSSProperties;
90
+ /**
91
+ * Показать скелетон
92
+ */
93
+ showSkeleton?: boolean;
94
+ /**
95
+ * Доп. пропсы для скелетона
96
+ */
97
+ skeletonProps?: Omit<SkeletonProps, 'visible'>;
89
98
  };
90
99
  type TabProps = {
91
100
  /**
@@ -145,7 +154,7 @@ type TabListTitle = {
145
154
  dataTestId?: string;
146
155
  toggleRef?: Ref<HTMLDivElement>;
147
156
  };
148
- type TabListProps = Pick<TabsProps, 'className' | 'containerClassName' | 'size' | 'defaultMatchMediaValue' | 'selectedId' | 'scrollable' | 'collapsedTabsIds' | 'onChange' | 'dataTestId' | 'fullWidthScroll' | 'tagShape' | 'tagView' | 'textStyle'> & {
157
+ type TabListProps = Pick<TabsProps, 'className' | 'containerClassName' | 'size' | 'defaultMatchMediaValue' | 'selectedId' | 'scrollable' | 'collapsedTabsIds' | 'onChange' | 'dataTestId' | 'fullWidthScroll' | 'tagShape' | 'tagView' | 'textStyle' | 'showSkeleton' | 'skeletonProps'> & {
149
158
  /**
150
159
  * Заголовки табов
151
160
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfalab/core-components-tabs",
3
- "version": "8.8.6",
3
+ "version": "8.9.0",
4
4
  "description": "Tabs components",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -16,12 +16,13 @@
16
16
  "dependencies": {
17
17
  "@alfalab/core-components-keyboard-focusable": "^4.1.0",
18
18
  "@alfalab/core-components-tag": "^8.2.1",
19
- "@alfalab/core-components-picker-button": "^11.7.6",
19
+ "@alfalab/core-components-picker-button": "^11.7.7",
20
20
  "@alfalab/core-components-badge": "^5.5.2",
21
21
  "@alfalab/core-components-mq": "^4.2.0",
22
22
  "@alfalab/hooks": "^1.13.0",
23
23
  "@alfalab/core-components-shared": "^0.10.0",
24
- "@alfalab/core-components-icon-button": "^6.6.1",
24
+ "@alfalab/core-components-icon-button": "^6.7.0",
25
+ "@alfalab/core-components-skeleton": "^5.0.0",
25
26
  "@alfalab/icons-glyph": "^2.139.0",
26
27
  "classnames": "^2.3.1",
27
28
  "compute-scroll-into-view": "^3.1.0",
@@ -28,6 +28,8 @@ export const CollapsiblePrimaryTabList = ({
28
28
  breakpoint = 1024,
29
29
  defaultMatchMediaValue,
30
30
  textStyle,
31
+ showSkeleton,
32
+ skeletonProps,
31
33
  }: TabListProps) => {
32
34
  const lineRef = useRef<HTMLDivElement>(null);
33
35
 
@@ -105,6 +107,8 @@ export const CollapsiblePrimaryTabList = ({
105
107
  {...restTitleProps}
106
108
  focused={focused}
107
109
  styles={styles}
110
+ showSkeleton={showSkeleton}
111
+ skeletonProps={skeletonProps}
108
112
  />
109
113
  )}
110
114
  </KeyboardFocusable>
@@ -126,6 +130,7 @@ export const CollapsiblePrimaryTabList = ({
126
130
  view='text'
127
131
  label='Ещё'
128
132
  popoverPosition='bottom-end'
133
+ disabled={showSkeleton}
129
134
  />
130
135
  </span>
131
136
  ) : null}
@@ -24,6 +24,8 @@ export const PrimaryTabList = ({
24
24
  platform,
25
25
  textStyle,
26
26
  inlineStyle,
27
+ showSkeleton,
28
+ skeletonProps,
27
29
  }: TabListProps & Styles & PlatformProps) => {
28
30
  const lineRef = useRef<HTMLDivElement>(null);
29
31
 
@@ -69,6 +71,8 @@ export const PrimaryTabList = ({
69
71
  {...restTitleProps}
70
72
  focused={focused}
71
73
  styles={styles}
74
+ showSkeleton={showSkeleton}
75
+ skeletonProps={skeletonProps}
72
76
  />
73
77
  )}
74
78
  </KeyboardFocusable>
@@ -91,6 +95,7 @@ export const PrimaryTabList = ({
91
95
  size={textStyle ? undefined : size}
92
96
  platform={platform}
93
97
  inlineStyle={inlineStyle}
98
+ showSkeleton={showSkeleton}
94
99
  >
95
100
  {renderContent()}
96
101
  </ScrollableContainer>
@@ -53,7 +53,7 @@
53
53
  user-select: none;
54
54
  outline: none;
55
55
 
56
- &:not(.disabled):hover {
56
+ &:not(:disabled):hover {
57
57
  color: var(--primary-tablist-hover-color);
58
58
  }
59
59
  }
@@ -17,10 +17,11 @@ type ScrollControlsProps = {
17
17
  view: Exclude<TabsProps['view'], undefined>;
18
18
  size: TabsProps['size'];
19
19
  containerRef: RefObject<HTMLDivElement>;
20
+ showSkeleton?: boolean;
20
21
  };
21
22
 
22
23
  export const ScrollControls = forwardRef<HTMLDivElement, ScrollControlsProps>(
23
- ({ containerRef, view, size: sizeProp, className }, ref) => {
24
+ ({ containerRef, view, size: sizeProp, className, showSkeleton }, ref) => {
24
25
  const container = containerRef.current;
25
26
  const [disabledState, updateDisabledState] = useState(() => getDisabledState(container));
26
27
 
@@ -70,13 +71,13 @@ export const ScrollControls = forwardRef<HTMLDivElement, ScrollControlsProps>(
70
71
  <IconButton
71
72
  {...commonButtonProps}
72
73
  icon={ChevronLeftCompactSIcon}
73
- disabled={disabledState.toLeft}
74
+ disabled={disabledState.toLeft || showSkeleton}
74
75
  onClick={handleScrollLeft}
75
76
  />
76
77
  <IconButton
77
78
  {...commonButtonProps}
78
79
  icon={ChevronRightCompactSIcon}
79
- disabled={disabledState.toRight}
80
+ disabled={disabledState.toRight || showSkeleton}
80
81
  onClick={handleScrollRight}
81
82
  />
82
83
  </div>
@@ -52,6 +52,11 @@ export type ScrollableContainerProps = {
52
52
  * Дополнительные инлайн стили для заголовка
53
53
  */
54
54
  inlineStyle?: React.CSSProperties;
55
+
56
+ /**
57
+ * Показать скелетон
58
+ */
59
+ showSkeleton?: boolean;
55
60
  };
56
61
 
57
62
  const isOverflown = (
@@ -74,6 +79,7 @@ export const ScrollableContainer = ({
74
79
  size,
75
80
  platform,
76
81
  inlineStyle,
82
+ showSkeleton,
77
83
  }: ScrollableContainerProps & Pick<TabsProps, 'fullWidthScroll'> & PlatformProps) => {
78
84
  const containerRef = useRef<HTMLDivElement>(null);
79
85
  const controlsRef = useRef<HTMLDivElement>(null);
@@ -143,6 +149,7 @@ export const ScrollableContainer = ({
143
149
  containerRef={containerRef}
144
150
  view={view}
145
151
  size={size}
152
+ showSkeleton={showSkeleton}
146
153
  />
147
154
  ) : null}
148
155
  </div>
@@ -1,10 +1,27 @@
1
1
  import React from 'react';
2
2
  import cn from 'classnames';
3
3
 
4
+ import { Skeleton } from '@alfalab/core-components/skeleton';
5
+
4
6
  import { useTabs } from '../../hooks/use-tabs';
5
7
  import { PlatformProps, SecondaryTabListProps, Styles } from '../../typings';
6
8
  import { ScrollableContainer } from '../scrollable-container';
7
9
 
10
+ function getBorderRadius(
11
+ shape?: SecondaryTabListProps['tagShape'],
12
+ size?: SecondaryTabListProps['size'],
13
+ isMobile?: boolean,
14
+ ) {
15
+ if (shape === 'rounded') {
16
+ return 99;
17
+ }
18
+
19
+ if (size === 'xxs') return isMobile ? 8 : 6;
20
+ if (size === 'xs' || size === 's') return isMobile ? 12 : 8;
21
+
22
+ return isMobile ? 16 : 4;
23
+ }
24
+
8
25
  export const SecondaryTabList = ({
9
26
  styles = {},
10
27
  className,
@@ -22,6 +39,8 @@ export const SecondaryTabList = ({
22
39
  tagShape,
23
40
  tagView,
24
41
  inlineStyle,
42
+ showSkeleton,
43
+ skeletonProps,
25
44
  }: SecondaryTabListProps & Styles & PlatformProps) => {
26
45
  const { focusedTab, selectedTab, getTabListItemProps } = useTabs({
27
46
  titles,
@@ -43,7 +62,7 @@ export const SecondaryTabList = ({
43
62
  {titles.map((item, index) => {
44
63
  if (item.hidden) return null;
45
64
 
46
- return (
65
+ const renderTab = () => (
47
66
  <TagComponent
48
67
  {...getTabListItemProps(index)}
49
68
  shape={tagShape}
@@ -57,6 +76,27 @@ export const SecondaryTabList = ({
57
76
  {item.title}
58
77
  </TagComponent>
59
78
  );
79
+
80
+ return showSkeleton ? (
81
+ <Skeleton
82
+ {...skeletonProps}
83
+ className={cn(styles.skeleton, skeletonProps?.className)}
84
+ key={item.id}
85
+ visible={true}
86
+ style={{
87
+ ...skeletonProps?.style,
88
+ borderRadius: getBorderRadius(
89
+ tagShape,
90
+ tagSize as SecondaryTabListProps['size'],
91
+ platform === 'mobile',
92
+ ),
93
+ }}
94
+ >
95
+ {renderTab()}
96
+ </Skeleton>
97
+ ) : (
98
+ renderTab()
99
+ );
60
100
  })}
61
101
  </div>
62
102
  );
@@ -71,6 +111,7 @@ export const SecondaryTabList = ({
71
111
  size={size}
72
112
  platform={platform}
73
113
  inlineStyle={inlineStyle}
114
+ showSkeleton={showSkeleton}
74
115
  >
75
116
  {renderContent()}
76
117
  </ScrollableContainer>
@@ -24,26 +24,44 @@
24
24
 
25
25
  /* sizes */
26
26
 
27
- .xxs .title + .title {
28
- margin-left: var(--secondary-tablist-xxs-gaps);
27
+ .xxs {
28
+ & .title + .title,
29
+ & .skeleton + .skeleton {
30
+ margin-left: var(--secondary-tablist-xxs-gaps);
31
+ }
29
32
  }
30
33
 
31
- .xs .title + .title {
32
- margin-left: var(--secondary-tablist-xs-gaps);
34
+ .xs {
35
+ & .title + .title,
36
+ & .skeleton + .skeleton {
37
+ margin-left: var(--secondary-tablist-xs-gaps);
38
+ }
33
39
  }
34
40
 
35
- .s .title + .title {
36
- margin-left: var(--secondary-tablist-s-gaps);
41
+ .s {
42
+ & .title + .title,
43
+ & .skeleton + .skeleton {
44
+ margin-left: var(--secondary-tablist-s-gaps);
45
+ }
37
46
  }
38
47
 
39
- .m .title + .title {
40
- margin-left: var(--secondary-tablist-m-gaps);
48
+ .m {
49
+ & .title + .title,
50
+ & .skeleton + .skeleton {
51
+ margin-left: var(--secondary-tablist-m-gaps);
52
+ }
41
53
  }
42
54
 
43
- .l .title + .title {
44
- margin-left: var(--secondary-tablist-l-gaps);
55
+ .l {
56
+ & .title + .title,
57
+ & .skeleton + .skeleton {
58
+ margin-left: var(--secondary-tablist-l-gaps);
59
+ }
45
60
  }
46
61
 
47
- .xl .title + .title {
48
- margin-left: var(--secondary-tablist-xl-gaps);
62
+ .xl {
63
+ & .title + .title,
64
+ & .skeleton + .skeleton {
65
+ margin-left: var(--secondary-tablist-xl-gaps);
66
+ }
49
67
  }
@@ -5,7 +5,8 @@
5
5
  }
6
6
 
7
7
  .mobile {
8
- & .title + .title {
8
+ & .title + .title,
9
+ & .skeleton + .skeleton {
9
10
  margin-left: var(--secondary-tablist-mobile-gaps);
10
11
  }
11
12
  }
@@ -19,6 +19,8 @@ export const Tabs = ({
19
19
  breakpoint = 1024,
20
20
  tagShape,
21
21
  tagView,
22
+ showSkeleton = false,
23
+ skeletonProps,
22
24
  textStyle,
23
25
  style,
24
26
  }: Omit<TabsProps, 'view'>) => {
@@ -69,6 +71,8 @@ export const Tabs = ({
69
71
  tagView={tagView}
70
72
  textStyle={textStyle}
71
73
  inlineStyle={style}
74
+ showSkeleton={showSkeleton}
75
+ skeletonProps={skeletonProps}
72
76
  />
73
77
 
74
78
  {tabs.map((tab) => cloneElement(tab, { hidden: tab.props.id !== selectedId }))}
@@ -1,6 +1,8 @@
1
1
  import React, { ButtonHTMLAttributes, forwardRef } from 'react';
2
2
  import cn from 'classnames';
3
3
 
4
+ import { Skeleton, SkeletonProps } from '@alfalab/core-components/skeleton';
5
+
4
6
  import { Styles, TabListTitle } from '../../typings';
5
7
 
6
8
  type Props = TabListTitle &
@@ -8,6 +10,8 @@ type Props = TabListTitle &
8
10
  Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'id' | 'title'> & {
9
11
  focused?: boolean;
10
12
  isOption?: boolean;
13
+ showSkeleton?: boolean;
14
+ skeletonProps?: Omit<SkeletonProps, 'visible'>;
11
15
  };
12
16
 
13
17
  export const Title = forwardRef<HTMLButtonElement, Props>(
@@ -24,15 +28,22 @@ export const Title = forwardRef<HTMLButtonElement, Props>(
24
28
  collapsed = false,
25
29
  focused = false,
26
30
  isOption = false,
31
+ showSkeleton = false,
32
+ skeletonProps,
27
33
  ...restProps
28
34
  },
29
35
  ref,
30
- ) =>
31
- hidden ? null : (
36
+ ) => {
37
+ const titleClassName = {
38
+ [styles.content]: true,
39
+ [styles.focused]: focused,
40
+ };
41
+
42
+ return hidden ? null : (
32
43
  <button
33
44
  {...restProps}
34
45
  ref={ref}
35
- disabled={disabled}
46
+ disabled={disabled || showSkeleton}
36
47
  type='button'
37
48
  id={String(id)}
38
49
  className={cn(
@@ -46,7 +57,17 @@ export const Title = forwardRef<HTMLButtonElement, Props>(
46
57
  toggleClassName,
47
58
  )}
48
59
  >
49
- <span className={cn(styles.content, { [styles.focused]: focused })}>{title}</span>
60
+ {showSkeleton ? (
61
+ <Skeleton
62
+ {...skeletonProps}
63
+ className={cn(titleClassName, skeletonProps?.className)}
64
+ visible={true}
65
+ >
66
+ {title}
67
+ </Skeleton>
68
+ ) : (
69
+ <span className={cn(titleClassName)}>{title}</span>
70
+ )}
50
71
 
51
72
  {rightAddons && (
52
73
  <span
@@ -58,5 +79,6 @@ export const Title = forwardRef<HTMLButtonElement, Props>(
58
79
  </span>
59
80
  )}
60
81
  </button>
61
- ),
82
+ );
83
+ },
62
84
  );
package/src/typings.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { FC, MouseEvent, ReactElement, ReactNode, Ref } from 'react';
2
2
 
3
+ import { SkeletonProps } from '@alfalab/core-components/skeleton';
3
4
  import { TagProps } from '@alfalab/core-components-tag';
4
5
 
5
6
  export type SelectedId = string | number;
@@ -124,6 +125,16 @@ export type TabsProps = {
124
125
  * Дополнительные инлайн стили для враппера
125
126
  */
126
127
  style?: React.CSSProperties;
128
+
129
+ /**
130
+ * Показать скелетон
131
+ */
132
+ showSkeleton?: boolean;
133
+
134
+ /**
135
+ * Доп. пропсы для скелетона
136
+ */
137
+ skeletonProps?: Omit<SkeletonProps, 'visible'>;
127
138
  };
128
139
 
129
140
  export type TabProps = {
@@ -211,6 +222,8 @@ export type TabListProps = Pick<
211
222
  | 'tagShape'
212
223
  | 'tagView'
213
224
  | 'textStyle'
225
+ | 'showSkeleton'
226
+ | 'skeletonProps'
214
227
  > & {
215
228
  /**
216
229
  * Заголовки табов
package/typings.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { FC, MouseEvent, ReactElement, ReactNode, Ref } from 'react';
3
+ import { SkeletonProps } from '@alfalab/core-components/skeleton';
3
4
  import { TagProps } from "@alfalab/core-components-tag";
4
5
  type SelectedId = string | number;
5
6
  type TabsProps = {
@@ -86,6 +87,14 @@ type TabsProps = {
86
87
  * Дополнительные инлайн стили для враппера
87
88
  */
88
89
  style?: React.CSSProperties;
90
+ /**
91
+ * Показать скелетон
92
+ */
93
+ showSkeleton?: boolean;
94
+ /**
95
+ * Доп. пропсы для скелетона
96
+ */
97
+ skeletonProps?: Omit<SkeletonProps, 'visible'>;
89
98
  };
90
99
  type TabProps = {
91
100
  /**
@@ -145,7 +154,7 @@ type TabListTitle = {
145
154
  dataTestId?: string;
146
155
  toggleRef?: Ref<HTMLDivElement>;
147
156
  };
148
- type TabListProps = Pick<TabsProps, 'className' | 'containerClassName' | 'size' | 'defaultMatchMediaValue' | 'selectedId' | 'scrollable' | 'collapsedTabsIds' | 'onChange' | 'dataTestId' | 'fullWidthScroll' | 'tagShape' | 'tagView' | 'textStyle'> & {
157
+ type TabListProps = Pick<TabsProps, 'className' | 'containerClassName' | 'size' | 'defaultMatchMediaValue' | 'selectedId' | 'scrollable' | 'collapsedTabsIds' | 'onChange' | 'dataTestId' | 'fullWidthScroll' | 'tagShape' | 'tagView' | 'textStyle' | 'showSkeleton' | 'skeletonProps'> & {
149
158
  /**
150
159
  * Заголовки табов
151
160
  */
@@ -1,4 +0,0 @@
1
- var commonStyles = {"component":"tabs__component_uw8qo","fullWidthScroll":"tabs__fullWidthScroll_uw8qo","container":"tabs__container_uw8qo","title":"tabs__title_uw8qo","xxs":"tabs__xxs_uw8qo","xs":"tabs__xs_uw8qo","s":"tabs__s_uw8qo","m":"tabs__m_uw8qo","l":"tabs__l_uw8qo","xl":"tabs__xl_uw8qo"};
2
- require('./components/secondary-tablist/index.css')
3
-
4
- export { commonStyles as c };
@@ -1,4 +0,0 @@
1
- var styles = {"component":"tabs__component_fapg6","desktop":"tabs__desktop_fapg6","paragraph-primary-large":"tabs__paragraph-primary-large_fapg6","title":"tabs__title_fapg6","paragraph-primary-medium":"tabs__paragraph-primary-medium_fapg6","paragraph-primary-small":"tabs__paragraph-primary-small_fapg6","action-primary-large":"tabs__action-primary-large_fapg6","action-primary-medium":"tabs__action-primary-medium_fapg6","action-primary-small":"tabs__action-primary-small_fapg6","accent-primary-large":"tabs__accent-primary-large_fapg6","accent-primary-medium":"tabs__accent-primary-medium_fapg6","accent-primary-small":"tabs__accent-primary-small_fapg6","pickerWrapper":"tabs__pickerWrapper_fapg6","option":"tabs__option_fapg6","scrollControls":"tabs__scrollControls_fapg6","headline-system-xlarge":"tabs__headline-system-xlarge_fapg6","headline-system-large":"tabs__headline-system-large_fapg6","headline-system-medium":"tabs__headline-system-medium_fapg6","headline-system-small":"tabs__headline-system-small_fapg6","headline-system-xsmall":"tabs__headline-system-xsmall_fapg6","headline-xlarge":"tabs__headline-xlarge_fapg6","headline-large":"tabs__headline-large_fapg6","headline-medium":"tabs__headline-medium_fapg6","headline-small":"tabs__headline-small_fapg6","headline-xsmall":"tabs__headline-xsmall_fapg6","fullWidthScroll":"tabs__fullWidthScroll_fapg6","container":"tabs__container_fapg6","disabled":"tabs__disabled_fapg6","focused":"tabs__focused_fapg6","collapsed":"tabs__collapsed_fapg6","selected":"tabs__selected_fapg6","line":"tabs__line_fapg6","s":"tabs__s_fapg6","xs":"tabs__xs_fapg6","xxs":"tabs__xxs_fapg6","m":"tabs__m_fapg6","l":"tabs__l_fapg6","xl":"tabs__xl_fapg6","rightAddons":"tabs__rightAddons_fapg6","rightAddonsMarginZero":"tabs__rightAddonsMarginZero_fapg6"};
2
- require('./components/primary-tablist/index.css')
3
-
4
- export { styles as s };
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var commonStyles = {"component":"tabs__component_uw8qo","fullWidthScroll":"tabs__fullWidthScroll_uw8qo","container":"tabs__container_uw8qo","title":"tabs__title_uw8qo","xxs":"tabs__xxs_uw8qo","xs":"tabs__xs_uw8qo","s":"tabs__s_uw8qo","m":"tabs__m_uw8qo","l":"tabs__l_uw8qo","xl":"tabs__xl_uw8qo"};
4
- require('./components/secondary-tablist/index.css')
5
-
6
- exports.commonStyles = commonStyles;
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var styles = {"component":"tabs__component_fapg6","desktop":"tabs__desktop_fapg6","paragraph-primary-large":"tabs__paragraph-primary-large_fapg6","title":"tabs__title_fapg6","paragraph-primary-medium":"tabs__paragraph-primary-medium_fapg6","paragraph-primary-small":"tabs__paragraph-primary-small_fapg6","action-primary-large":"tabs__action-primary-large_fapg6","action-primary-medium":"tabs__action-primary-medium_fapg6","action-primary-small":"tabs__action-primary-small_fapg6","accent-primary-large":"tabs__accent-primary-large_fapg6","accent-primary-medium":"tabs__accent-primary-medium_fapg6","accent-primary-small":"tabs__accent-primary-small_fapg6","pickerWrapper":"tabs__pickerWrapper_fapg6","option":"tabs__option_fapg6","scrollControls":"tabs__scrollControls_fapg6","headline-system-xlarge":"tabs__headline-system-xlarge_fapg6","headline-system-large":"tabs__headline-system-large_fapg6","headline-system-medium":"tabs__headline-system-medium_fapg6","headline-system-small":"tabs__headline-system-small_fapg6","headline-system-xsmall":"tabs__headline-system-xsmall_fapg6","headline-xlarge":"tabs__headline-xlarge_fapg6","headline-large":"tabs__headline-large_fapg6","headline-medium":"tabs__headline-medium_fapg6","headline-small":"tabs__headline-small_fapg6","headline-xsmall":"tabs__headline-xsmall_fapg6","fullWidthScroll":"tabs__fullWidthScroll_fapg6","container":"tabs__container_fapg6","disabled":"tabs__disabled_fapg6","focused":"tabs__focused_fapg6","collapsed":"tabs__collapsed_fapg6","selected":"tabs__selected_fapg6","line":"tabs__line_fapg6","s":"tabs__s_fapg6","xs":"tabs__xs_fapg6","xxs":"tabs__xxs_fapg6","m":"tabs__m_fapg6","l":"tabs__l_fapg6","xl":"tabs__xl_fapg6","rightAddons":"tabs__rightAddons_fapg6","rightAddonsMarginZero":"tabs__rightAddonsMarginZero_fapg6"};
4
- require('./components/primary-tablist/index.css')
5
-
6
- exports.styles = styles;
@@ -1,4 +0,0 @@
1
- const commonStyles = {"component":"tabs__component_uw8qo","fullWidthScroll":"tabs__fullWidthScroll_uw8qo","container":"tabs__container_uw8qo","title":"tabs__title_uw8qo","xxs":"tabs__xxs_uw8qo","xs":"tabs__xs_uw8qo","s":"tabs__s_uw8qo","m":"tabs__m_uw8qo","l":"tabs__l_uw8qo","xl":"tabs__xl_uw8qo"};
2
- require('./components/secondary-tablist/index.css')
3
-
4
- export { commonStyles as c };
@@ -1,4 +0,0 @@
1
- const styles = {"component":"tabs__component_fapg6","desktop":"tabs__desktop_fapg6","paragraph-primary-large":"tabs__paragraph-primary-large_fapg6","title":"tabs__title_fapg6","paragraph-primary-medium":"tabs__paragraph-primary-medium_fapg6","paragraph-primary-small":"tabs__paragraph-primary-small_fapg6","action-primary-large":"tabs__action-primary-large_fapg6","action-primary-medium":"tabs__action-primary-medium_fapg6","action-primary-small":"tabs__action-primary-small_fapg6","accent-primary-large":"tabs__accent-primary-large_fapg6","accent-primary-medium":"tabs__accent-primary-medium_fapg6","accent-primary-small":"tabs__accent-primary-small_fapg6","pickerWrapper":"tabs__pickerWrapper_fapg6","option":"tabs__option_fapg6","scrollControls":"tabs__scrollControls_fapg6","headline-system-xlarge":"tabs__headline-system-xlarge_fapg6","headline-system-large":"tabs__headline-system-large_fapg6","headline-system-medium":"tabs__headline-system-medium_fapg6","headline-system-small":"tabs__headline-system-small_fapg6","headline-system-xsmall":"tabs__headline-system-xsmall_fapg6","headline-xlarge":"tabs__headline-xlarge_fapg6","headline-large":"tabs__headline-large_fapg6","headline-medium":"tabs__headline-medium_fapg6","headline-small":"tabs__headline-small_fapg6","headline-xsmall":"tabs__headline-xsmall_fapg6","fullWidthScroll":"tabs__fullWidthScroll_fapg6","container":"tabs__container_fapg6","disabled":"tabs__disabled_fapg6","focused":"tabs__focused_fapg6","collapsed":"tabs__collapsed_fapg6","selected":"tabs__selected_fapg6","line":"tabs__line_fapg6","s":"tabs__s_fapg6","xs":"tabs__xs_fapg6","xxs":"tabs__xxs_fapg6","m":"tabs__m_fapg6","l":"tabs__l_fapg6","xl":"tabs__xl_fapg6","rightAddons":"tabs__rightAddons_fapg6","rightAddonsMarginZero":"tabs__rightAddonsMarginZero_fapg6"};
2
- require('./components/primary-tablist/index.css')
3
-
4
- export { styles as s };