@salutejs/plasma-new-hope 0.173.2-dev.0 → 0.173.4-canary.1502.11499843355.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. package/cjs/components/Tabs/createTabsController.js.map +1 -1
  2. package/cjs/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.js +3 -1
  3. package/cjs/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.js.map +1 -1
  4. package/cjs/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.css +1 -1
  5. package/cjs/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.js +8 -3
  6. package/cjs/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.js.map +1 -1
  7. package/cjs/components/Tabs/ui/horizontal/HorizontalTabs/variations/_view/base.js +1 -1
  8. package/cjs/components/Tabs/ui/horizontal/HorizontalTabs/variations/_view/base.js.map +1 -1
  9. package/cjs/components/Tabs/ui/horizontal/HorizontalTabs/variations/_view/{base_9miwn.css → base_4ob3q5.css} +1 -1
  10. package/cjs/index.css +1 -1
  11. package/emotion/cjs/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.js +3 -1
  12. package/emotion/cjs/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.js +8 -3
  13. package/emotion/cjs/components/Tabs/ui/horizontal/HorizontalTabs/variations/_view/base.js +1 -1
  14. package/emotion/cjs/examples/plasma_b2c/components/Tabs/Tabs.stories.tsx +72 -33
  15. package/emotion/cjs/examples/plasma_web/components/Tabs/Tabs.stories.tsx +72 -33
  16. package/emotion/es/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.js +3 -1
  17. package/emotion/es/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.js +8 -3
  18. package/emotion/es/components/Tabs/ui/horizontal/HorizontalTabs/variations/_view/base.js +1 -1
  19. package/emotion/es/examples/plasma_b2c/components/Tabs/Tabs.stories.tsx +72 -33
  20. package/emotion/es/examples/plasma_web/components/Tabs/Tabs.stories.tsx +72 -33
  21. package/es/components/Tabs/createTabsController.js.map +1 -1
  22. package/es/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.js +3 -1
  23. package/es/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.js.map +1 -1
  24. package/es/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.css +1 -1
  25. package/es/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.js +8 -3
  26. package/es/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.js.map +1 -1
  27. package/es/components/Tabs/ui/horizontal/HorizontalTabs/variations/_view/base.js +1 -1
  28. package/es/components/Tabs/ui/horizontal/HorizontalTabs/variations/_view/base.js.map +1 -1
  29. package/es/components/Tabs/ui/horizontal/HorizontalTabs/variations/_view/{base_9miwn.css → base_4ob3q5.css} +1 -1
  30. package/es/index.css +1 -1
  31. package/package.json +2 -2
  32. package/styled-components/cjs/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.js +3 -1
  33. package/styled-components/cjs/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.js +8 -3
  34. package/styled-components/cjs/components/Tabs/ui/horizontal/HorizontalTabs/variations/_view/base.js +1 -1
  35. package/styled-components/cjs/examples/plasma_b2c/components/Tabs/Tabs.stories.tsx +72 -33
  36. package/styled-components/cjs/examples/plasma_web/components/Tabs/Tabs.stories.tsx +72 -33
  37. package/styled-components/es/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.js +3 -1
  38. package/styled-components/es/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.js +8 -3
  39. package/styled-components/es/components/Tabs/ui/horizontal/HorizontalTabs/variations/_view/base.js +1 -1
  40. package/styled-components/es/examples/plasma_b2c/components/Tabs/Tabs.stories.tsx +72 -33
  41. package/styled-components/es/examples/plasma_web/components/Tabs/Tabs.stories.tsx +72 -33
  42. package/types/components/DatePicker/SingleDate/SingleDate.types.d.ts +4 -0
  43. package/types/components/DatePicker/SingleDate/SingleDate.types.d.ts.map +1 -1
  44. package/types/components/Tabs/TabItem.types.d.ts +50 -8
  45. package/types/components/Tabs/TabItem.types.d.ts.map +1 -1
  46. package/types/components/Tabs/Tabs.types.d.ts +44 -2
  47. package/types/components/Tabs/Tabs.types.d.ts.map +1 -1
  48. package/types/components/Tabs/createTabsController.d.ts +2 -2
  49. package/types/components/Tabs/createTabsController.d.ts.map +1 -1
  50. package/types/components/Tabs/index.d.ts +2 -2
  51. package/types/components/Tabs/index.d.ts.map +1 -1
  52. package/types/components/Tabs/ui/horizontal/HorizontalTabItem/HorizontalTabItem.d.ts.map +1 -1
  53. package/types/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.d.ts +2 -2
  54. package/types/components/Tabs/ui/horizontal/HorizontalTabs/HorizontalTabs.d.ts.map +1 -1
  55. package/types/components/Tabs/ui/horizontal/HorizontalTabs/variations/_view/base.d.ts.map +1 -1
  56. package/types/examples/plasma_b2c/components/Tabs/TabItem.d.ts +21 -6
  57. package/types/examples/plasma_b2c/components/Tabs/TabItem.d.ts.map +1 -1
  58. package/types/examples/plasma_b2c/components/Tabs/Tabs.d.ts +2 -2
  59. package/types/examples/plasma_b2c/components/Tabs/Tabs.d.ts.map +1 -1
  60. package/types/examples/plasma_web/components/Tabs/TabItem.d.ts +21 -6
  61. package/types/examples/plasma_web/components/Tabs/TabItem.d.ts.map +1 -1
  62. package/types/examples/plasma_web/components/Tabs/Tabs.d.ts +2 -2
  63. package/types/examples/plasma_web/components/Tabs/Tabs.d.ts.map +1 -1
@@ -12,6 +12,7 @@ import { Tabs } from './Tabs';
12
12
  import { TabItem } from './TabItem';
13
13
 
14
14
  const clips = ['none', 'scroll', 'showAll'];
15
+ const headerClips = ['none', 'scroll'];
15
16
  const sizes = ['xs', 's', 'm', 'l'] as const;
16
17
  const headerSizes = ['h5', 'h4', 'h3', 'h2', 'h1'] as const;
17
18
 
@@ -20,7 +21,6 @@ type HeaderSize = typeof headerSizes[number];
20
21
 
21
22
  type CustomStoryTabsProps = {
22
23
  itemQuantity: number;
23
- hasDivider: boolean;
24
24
  contentLeft: string;
25
25
  contentRight: string;
26
26
  stretch: boolean;
@@ -30,12 +30,12 @@ type CustomStoryTabsProps = {
30
30
  const contentLeftOptions = ['none', 'icon'];
31
31
  const contentRightOptions = ['none', 'counter', 'icon'];
32
32
 
33
- const getContentLeft = (contentLeftOption: string, size: Size) => {
33
+ const getContentLeft = (contentLeftOption: string, size: string) => {
34
34
  const iconSize = size === 'xs' ? 'xs' : 's';
35
35
  return contentLeftOption === 'icon' ? <IconMic size={iconSize} color="inherit" /> : undefined;
36
36
  };
37
37
 
38
- const getContentRight = (contentRightOption: string, size: Size) => {
38
+ const getContentRight = (contentRightOption: string, size: string) => {
39
39
  const iconSize = size === 'xs' ? 'xs' : 's';
40
40
  const counterSize = size === 'xs' ? 'xxs' : 'xs';
41
41
 
@@ -96,7 +96,7 @@ const StoryHorizontalDefault = (props: HorizontalStoryTabsProps) => {
96
96
  const [index, setIndex] = useState(0);
97
97
 
98
98
  return (
99
- <Tabs view={hasDivider ? 'divider' : 'clear'} stretch={stretch} disabled={disabled} size={size}>
99
+ <Tabs view="divider" hasDivider={hasDivider} stretch={stretch} disabled={disabled} size={size}>
100
100
  {items.map((_, i) => {
101
101
  if (helperText !== '') {
102
102
  return (
@@ -152,7 +152,7 @@ const StoryHorizontalScroll = (props: HorizontalStoryTabsProps) => {
152
152
  const [index, setIndex] = useState(0);
153
153
 
154
154
  return (
155
- <Tabs clip={clip} view={hasDivider ? 'divider' : 'clear'} disabled={disabled} size={size} style={{ width }}>
155
+ <Tabs clip={clip} view="divider" hasDivider={hasDivider} disabled={disabled} size={size} style={{ width }}>
156
156
  {items.map((_, i) => {
157
157
  if (helperText !== '') {
158
158
  return (
@@ -220,7 +220,7 @@ const StoryHorizontalShowAll = (props: HorizontalStoryTabsProps) => {
220
220
  });
221
221
 
222
222
  return (
223
- <Tabs clip={clip} view={hasDivider ? 'divider' : 'clear'} disabled={disabled} size={size}>
223
+ <Tabs clip={clip} view="divider" hasDivider={hasDivider} disabled={disabled} size={size}>
224
224
  {visibleItems.map((_, i) => {
225
225
  if (helperText !== '') {
226
226
  return (
@@ -603,31 +603,47 @@ export const VerticalTabs: StoryObj<VerticalStoryTabsProps> = {
603
603
  },
604
604
  };
605
605
 
606
- const StoryHeaderTabs = (props: StoryTabsProps) => {
607
- const {
608
- disabled,
609
- itemQuantity,
610
- size,
611
- contentLeft: contentLeftOption,
612
- contentRight: contentRightOption,
613
- hasDivider,
614
- stretch,
615
- } = props;
606
+ const StoryHeaderDefault = (props: HorizontalStoryTabsProps) => {
607
+ const { disabled, itemQuantity, size, helperText } = props;
608
+ const items = Array(itemQuantity).fill(0);
609
+ const [index, setIndex] = useState(0);
610
+
611
+ return (
612
+ <Tabs view="clear" disabled={disabled} size={size as HeaderSize}>
613
+ {items.map((_, i) => (
614
+ <TabItem
615
+ key={`item:${i}`}
616
+ view="clear"
617
+ selected={i === index}
618
+ onClick={() => !disabled && setIndex(i)}
619
+ tabIndex={!disabled ? 0 : -1}
620
+ disabled={disabled}
621
+ value={helperText}
622
+ size={size as HeaderSize}
623
+ >
624
+ {`Label${i + 1}`}
625
+ </TabItem>
626
+ ))}
627
+ </Tabs>
628
+ );
629
+ };
630
+
631
+ const StoryHeaderScroll = (props: HorizontalStoryTabsProps) => {
632
+ const { disabled, itemQuantity, size, helperText, width } = props;
616
633
  const items = Array(itemQuantity).fill(0);
617
634
  const [index, setIndex] = useState(0);
618
635
 
619
636
  return (
620
- <Tabs view={hasDivider ? 'divider' : 'clear'} disabled={disabled} size={size} stretch={stretch}>
637
+ <Tabs view="clear" disabled={disabled} size={size as HeaderSize} style={{ width }}>
621
638
  {items.map((_, i) => (
622
639
  <TabItem
623
640
  key={`item:${i}`}
624
- view="divider"
641
+ view="clear"
625
642
  selected={i === index}
626
643
  onClick={() => !disabled && setIndex(i)}
627
644
  tabIndex={!disabled ? 0 : -1}
628
645
  disabled={disabled}
629
- contentLeft={getContentLeft(contentLeftOption, size as Size)}
630
- contentRight={getContentRight(contentRightOption, size as Size)}
646
+ value={helperText}
631
647
  size={size as HeaderSize}
632
648
  >
633
649
  {`Label${i + 1}`}
@@ -637,37 +653,60 @@ const StoryHeaderTabs = (props: StoryTabsProps) => {
637
653
  );
638
654
  };
639
655
 
640
- export const HeaderTabs: StoryObj<StoryTabsProps> = {
656
+ export const HeaderTabs: StoryObj<HorizontalStoryTabsProps> = {
641
657
  args: {
642
658
  size: 'h5',
643
659
  disabled: false,
644
- hasDivider: true,
645
- itemQuantity: 4,
660
+ helperText: '',
661
+ itemQuantity: 6,
662
+ width: '12rem',
646
663
  },
647
664
  argTypes: {
648
- size: {
649
- options: headerSizes,
665
+ clip: {
666
+ options: headerClips,
650
667
  control: {
651
668
  type: 'select',
652
669
  },
653
670
  },
654
- contentLeft: {
655
- options: contentLeftOptions,
671
+ width: {
656
672
  control: {
657
- type: 'select',
673
+ type: 'text',
674
+ },
675
+ if: { arg: 'clip', eq: 'scroll' },
676
+ },
677
+ stretch: {
678
+ table: {
679
+ disable: true,
680
+ },
681
+ },
682
+ contentLeft: {
683
+ table: {
684
+ disable: true,
658
685
  },
659
686
  },
660
687
  contentRight: {
661
- options: contentRightOptions,
662
- control: {
663
- type: 'select',
688
+ table: {
689
+ disable: true,
664
690
  },
665
691
  },
666
- clip: {
692
+ hasDivider: {
667
693
  table: {
668
694
  disable: true,
669
695
  },
670
696
  },
697
+ size: {
698
+ options: headerSizes,
699
+ control: {
700
+ type: 'select',
701
+ },
702
+ },
703
+ },
704
+ render: (args) => {
705
+ switch (args.clip) {
706
+ case 'scroll':
707
+ return <StoryHeaderScroll {...args} />;
708
+ default:
709
+ return <StoryHeaderDefault {...args} />;
710
+ }
671
711
  },
672
- render: (args) => <StoryHeaderTabs {...args} />,
673
712
  };
@@ -92,7 +92,9 @@ export var horizontalTabItemRoot = function horizontalTabItemRoot(Root) {
92
92
  disabled: disabled,
93
93
  pilled: pilled,
94
94
  role: role,
95
- view: view,
95
+ view: view
96
+ // TODO: убрать каст any, когда будут удалены deprecated props
97
+ ,
96
98
  size: size,
97
99
  onFocus: onItemFocus,
98
100
  tabIndex: hasKeyNavigation ? navigationTabIndex : tabIndex,
@@ -1,4 +1,4 @@
1
- var _excluded = ["id", "stretch", "disabled", "clip", "size", "view", "children", "pilled", "index", "className"];
1
+ var _excluded = ["id", "stretch", "disabled", "clip", "size", "view", "children", "pilled", "index", "className", "hasDivider"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
4
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -43,6 +43,8 @@ export var horizontalTabsRoot = function horizontalTabsRoot(Root) {
43
43
  pilled = _props$pilled === void 0 ? false : _props$pilled,
44
44
  index = props.index,
45
45
  className = props.className,
46
+ _props$hasDivider = props.hasDivider,
47
+ hasDivider = _props$hasDivider === void 0 ? true : _props$hasDivider,
46
48
  rest = _objectWithoutProperties(props, _excluded);
47
49
  var _useState = useState(true),
48
50
  _useState2 = _slicedToArray(_useState, 2),
@@ -60,6 +62,7 @@ export var horizontalTabsRoot = function horizontalTabsRoot(Root) {
60
62
  var isFilled = view === 'filled'; // outer padding is only for filled view
61
63
  var pilledAttr = view !== 'clear' && pilled;
62
64
  var pilledClass = pilledAttr ? classes.tabsPilled : undefined;
65
+ var noDividerClass = !hasDivider ? classes.tabsNoDivider : undefined;
63
66
  var stretchClass = firstItemVisible && lastItemVisible && stretch ? classes.tabsStretch : undefined;
64
67
  var hasLeftArrowClass = !firstItemVisible ? classes.tabsHasLeftArrow : undefined;
65
68
  var hasRightArrowClass = !lastItemVisible ? classes.tabsHasRightArrow : undefined;
@@ -189,13 +192,15 @@ export var horizontalTabsRoot = function horizontalTabsRoot(Root) {
189
192
  value: refs
190
193
  }, /*#__PURE__*/React.createElement(Root, _extends({
191
194
  view: view,
192
- role: "tablist",
195
+ role: "tablist"
196
+ // TODO: убрать каст any, когда будут удалены deprecated props
197
+ ,
193
198
  size: size,
194
199
  pilled: pilled,
195
200
  id: tabsId,
196
201
  ref: outerRef,
197
202
  disabled: disabled,
198
- className: cx(pilledClass, stretchClass, hasLeftArrowClass, hasRightArrowClass, className),
203
+ className: cx(pilledClass, stretchClass, hasLeftArrowClass, hasRightArrowClass, noDividerClass, className),
199
204
  onKeyDown: onKeyDown
200
205
  }, rest), !firstItemVisible && PreviousButton, /*#__PURE__*/React.createElement(StyledContentWrapper, {
201
206
  className: cx(clipScrollClass, clipShowAllClass),
@@ -1,3 +1,3 @@
1
1
  import { css } from 'styled-components';
2
2
  import { classes, tokens } from '../../../../../tokens';
3
- export var base = /*#__PURE__*/css(["background-color:var(", ");&::after{content:'';position:absolute;bottom:0.125rem;left:0.125rem;right:0.125rem;background:var(", ");height:var(", ");border-radius:var(", ");}&.", "{&::after{left:1.5rem;}}&.", "{&::after{right:1.5rem;}}"], tokens.tabsBackgroundColor, tokens.tabsDividerColor, tokens.tabsDividerHeight, tokens.tabsDividerBorderRadius, classes.tabsHasLeftArrow, classes.tabsHasRightArrow);
3
+ export var base = /*#__PURE__*/css(["background-color:var(", ");&::after{content:'';position:absolute;bottom:0.125rem;left:0.125rem;right:0.125rem;background:var(", ");height:var(", ");border-radius:var(", ");}&.", "{&::after{left:1.5rem;}}&.", "{&::after{right:1.5rem;}}&.", "{&::after{height:0;}}"], tokens.tabsBackgroundColor, tokens.tabsDividerColor, tokens.tabsDividerHeight, tokens.tabsDividerBorderRadius, classes.tabsHasLeftArrow, classes.tabsHasRightArrow, classes.tabsNoDivider);
@@ -12,6 +12,7 @@ import { Tabs } from './Tabs';
12
12
  import { TabItem } from './TabItem';
13
13
 
14
14
  const clips = ['none', 'scroll', 'showAll'];
15
+ const headerClips = ['none', 'scroll'];
15
16
  const sizes = ['xs', 's', 'm', 'l'] as const;
16
17
  const headerSizes = ['h5', 'h4', 'h3', 'h2', 'h1'] as const;
17
18
 
@@ -20,7 +21,6 @@ type HeaderSize = typeof headerSizes[number];
20
21
 
21
22
  type CustomStoryTabsProps = {
22
23
  itemQuantity: number;
23
- hasDivider: boolean;
24
24
  contentLeft: string;
25
25
  contentRight: string;
26
26
  stretch: boolean;
@@ -30,12 +30,12 @@ type CustomStoryTabsProps = {
30
30
  const contentLeftOptions = ['none', 'icon'];
31
31
  const contentRightOptions = ['none', 'counter', 'icon'];
32
32
 
33
- const getContentLeft = (contentLeftOption: string, size: Size) => {
33
+ const getContentLeft = (contentLeftOption: string, size: string) => {
34
34
  const iconSize = size === 'xs' ? 'xs' : 's';
35
35
  return contentLeftOption === 'icon' ? <IconMic size={iconSize} color="inherit" /> : undefined;
36
36
  };
37
37
 
38
- const getContentRight = (contentRightOption: string, size: Size) => {
38
+ const getContentRight = (contentRightOption: string, size: string) => {
39
39
  const iconSize = size === 'xs' ? 'xs' : 's';
40
40
  const counterSize = size === 'xs' ? 'xxs' : 'xs';
41
41
 
@@ -96,7 +96,7 @@ const StoryHorizontalDefault = (props: HorizontalStoryTabsProps) => {
96
96
  const [index, setIndex] = useState(0);
97
97
 
98
98
  return (
99
- <Tabs view={hasDivider ? 'divider' : 'clear'} stretch={stretch} disabled={disabled} size={size}>
99
+ <Tabs view="divider" hasDivider={hasDivider} stretch={stretch} disabled={disabled} size={size}>
100
100
  {items.map((_, i) => {
101
101
  if (helperText !== '') {
102
102
  return (
@@ -152,7 +152,7 @@ const StoryHorizontalScroll = (props: HorizontalStoryTabsProps) => {
152
152
  const [index, setIndex] = useState(0);
153
153
 
154
154
  return (
155
- <Tabs clip={clip} view={hasDivider ? 'divider' : 'clear'} disabled={disabled} size={size} style={{ width }}>
155
+ <Tabs clip={clip} view="divider" hasDivider={hasDivider} disabled={disabled} size={size} style={{ width }}>
156
156
  {items.map((_, i) => {
157
157
  if (helperText !== '') {
158
158
  return (
@@ -220,7 +220,7 @@ const StoryHorizontalShowAll = (props: HorizontalStoryTabsProps) => {
220
220
  });
221
221
 
222
222
  return (
223
- <Tabs clip={clip} view={hasDivider ? 'divider' : 'clear'} disabled={disabled} size={size}>
223
+ <Tabs clip={clip} view="divider" hasDivider={hasDivider} disabled={disabled} size={size}>
224
224
  {visibleItems.map((_, i) => {
225
225
  if (helperText !== '') {
226
226
  return (
@@ -603,31 +603,47 @@ export const VerticalTabs: StoryObj<VerticalStoryTabsProps> = {
603
603
  },
604
604
  };
605
605
 
606
- const StoryHeaderTabs = (props: StoryTabsProps) => {
607
- const {
608
- disabled,
609
- itemQuantity,
610
- size,
611
- contentLeft: contentLeftOption,
612
- contentRight: contentRightOption,
613
- hasDivider,
614
- stretch,
615
- } = props;
606
+ const StoryHeaderDefault = (props: HorizontalStoryTabsProps) => {
607
+ const { disabled, itemQuantity, size, helperText } = props;
608
+ const items = Array(itemQuantity).fill(0);
609
+ const [index, setIndex] = useState(0);
610
+
611
+ return (
612
+ <Tabs view="clear" disabled={disabled} size={size as HeaderSize}>
613
+ {items.map((_, i) => (
614
+ <TabItem
615
+ key={`item:${i}`}
616
+ view="clear"
617
+ selected={i === index}
618
+ onClick={() => !disabled && setIndex(i)}
619
+ tabIndex={!disabled ? 0 : -1}
620
+ disabled={disabled}
621
+ value={helperText}
622
+ size={size as HeaderSize}
623
+ >
624
+ {`Label${i + 1}`}
625
+ </TabItem>
626
+ ))}
627
+ </Tabs>
628
+ );
629
+ };
630
+
631
+ const StoryHeaderScroll = (props: HorizontalStoryTabsProps) => {
632
+ const { disabled, itemQuantity, size, helperText, width } = props;
616
633
  const items = Array(itemQuantity).fill(0);
617
634
  const [index, setIndex] = useState(0);
618
635
 
619
636
  return (
620
- <Tabs view={hasDivider ? 'divider' : 'clear'} disabled={disabled} size={size} stretch={stretch}>
637
+ <Tabs view="clear" disabled={disabled} size={size as HeaderSize} style={{ width }}>
621
638
  {items.map((_, i) => (
622
639
  <TabItem
623
640
  key={`item:${i}`}
624
- view="divider"
641
+ view="clear"
625
642
  selected={i === index}
626
643
  onClick={() => !disabled && setIndex(i)}
627
644
  tabIndex={!disabled ? 0 : -1}
628
645
  disabled={disabled}
629
- contentLeft={getContentLeft(contentLeftOption, size as Size)}
630
- contentRight={getContentRight(contentRightOption, size as Size)}
646
+ value={helperText}
631
647
  size={size as HeaderSize}
632
648
  >
633
649
  {`Label${i + 1}`}
@@ -637,37 +653,60 @@ const StoryHeaderTabs = (props: StoryTabsProps) => {
637
653
  );
638
654
  };
639
655
 
640
- export const HeaderTabs: StoryObj<StoryTabsProps> = {
656
+ export const HeaderTabs: StoryObj<HorizontalStoryTabsProps> = {
641
657
  args: {
642
658
  size: 'h5',
643
659
  disabled: false,
644
- hasDivider: true,
645
- itemQuantity: 4,
660
+ helperText: '',
661
+ itemQuantity: 6,
662
+ width: '12rem',
646
663
  },
647
664
  argTypes: {
648
- size: {
649
- options: headerSizes,
665
+ clip: {
666
+ options: headerClips,
650
667
  control: {
651
668
  type: 'select',
652
669
  },
653
670
  },
654
- contentLeft: {
655
- options: contentLeftOptions,
671
+ width: {
656
672
  control: {
657
- type: 'select',
673
+ type: 'text',
674
+ },
675
+ if: { arg: 'clip', eq: 'scroll' },
676
+ },
677
+ stretch: {
678
+ table: {
679
+ disable: true,
680
+ },
681
+ },
682
+ contentLeft: {
683
+ table: {
684
+ disable: true,
658
685
  },
659
686
  },
660
687
  contentRight: {
661
- options: contentRightOptions,
662
- control: {
663
- type: 'select',
688
+ table: {
689
+ disable: true,
664
690
  },
665
691
  },
666
- clip: {
692
+ hasDivider: {
667
693
  table: {
668
694
  disable: true,
669
695
  },
670
696
  },
697
+ size: {
698
+ options: headerSizes,
699
+ control: {
700
+ type: 'select',
701
+ },
702
+ },
703
+ },
704
+ render: (args) => {
705
+ switch (args.clip) {
706
+ case 'scroll':
707
+ return <StoryHeaderScroll {...args} />;
708
+ default:
709
+ return <StoryHeaderDefault {...args} />;
710
+ }
671
711
  },
672
- render: (args) => <StoryHeaderTabs {...args} />,
673
712
  };
@@ -12,6 +12,7 @@ import { Tabs } from './Tabs';
12
12
  import { TabItem } from './TabItem';
13
13
 
14
14
  const clips = ['none', 'scroll', 'showAll'];
15
+ const headerClips = ['none', 'scroll'];
15
16
  const sizes = ['xs', 's', 'm', 'l'] as const;
16
17
  const headerSizes = ['h5', 'h4', 'h3', 'h2', 'h1'] as const;
17
18
 
@@ -20,7 +21,6 @@ type HeaderSize = typeof headerSizes[number];
20
21
 
21
22
  type CustomStoryTabsProps = {
22
23
  itemQuantity: number;
23
- hasDivider: boolean;
24
24
  contentLeft: string;
25
25
  contentRight: string;
26
26
  stretch: boolean;
@@ -30,12 +30,12 @@ type CustomStoryTabsProps = {
30
30
  const contentLeftOptions = ['none', 'icon'];
31
31
  const contentRightOptions = ['none', 'counter', 'icon'];
32
32
 
33
- const getContentLeft = (contentLeftOption: string, size: Size) => {
33
+ const getContentLeft = (contentLeftOption: string, size: string) => {
34
34
  const iconSize = size === 'xs' ? 'xs' : 's';
35
35
  return contentLeftOption === 'icon' ? <IconMic size={iconSize} color="inherit" /> : undefined;
36
36
  };
37
37
 
38
- const getContentRight = (contentRightOption: string, size: Size) => {
38
+ const getContentRight = (contentRightOption: string, size: string) => {
39
39
  const iconSize = size === 'xs' ? 'xs' : 's';
40
40
  const counterSize = size === 'xs' ? 'xxs' : 'xs';
41
41
 
@@ -96,7 +96,7 @@ const StoryHorizontalDefault = (props: HorizontalStoryTabsProps) => {
96
96
  const [index, setIndex] = useState(0);
97
97
 
98
98
  return (
99
- <Tabs view={hasDivider ? 'divider' : 'clear'} stretch={stretch} disabled={disabled} size={size}>
99
+ <Tabs view="divider" hasDivider={hasDivider} stretch={stretch} disabled={disabled} size={size}>
100
100
  {items.map((_, i) => {
101
101
  if (helperText !== '') {
102
102
  return (
@@ -152,7 +152,7 @@ const StoryHorizontalScroll = (props: HorizontalStoryTabsProps) => {
152
152
  const [index, setIndex] = useState(0);
153
153
 
154
154
  return (
155
- <Tabs clip={clip} view={hasDivider ? 'divider' : 'clear'} disabled={disabled} size={size} style={{ width }}>
155
+ <Tabs clip={clip} view="divider" hasDivider={hasDivider} disabled={disabled} size={size} style={{ width }}>
156
156
  {items.map((_, i) => {
157
157
  if (helperText !== '') {
158
158
  return (
@@ -220,7 +220,7 @@ const StoryHorizontalShowAll = (props: HorizontalStoryTabsProps) => {
220
220
  });
221
221
 
222
222
  return (
223
- <Tabs clip={clip} view={hasDivider ? 'divider' : 'clear'} disabled={disabled} size={size}>
223
+ <Tabs clip={clip} view="divider" hasDivider={hasDivider} disabled={disabled} size={size}>
224
224
  {visibleItems.map((_, i) => {
225
225
  if (helperText !== '') {
226
226
  return (
@@ -603,31 +603,47 @@ export const VerticalTabs: StoryObj<VerticalStoryTabsProps> = {
603
603
  },
604
604
  };
605
605
 
606
- const StoryHeaderTabs = (props: StoryTabsProps) => {
607
- const {
608
- disabled,
609
- itemQuantity,
610
- size,
611
- contentLeft: contentLeftOption,
612
- contentRight: contentRightOption,
613
- hasDivider,
614
- stretch,
615
- } = props;
606
+ const StoryHeaderDefault = (props: HorizontalStoryTabsProps) => {
607
+ const { disabled, itemQuantity, size, helperText } = props;
608
+ const items = Array(itemQuantity).fill(0);
609
+ const [index, setIndex] = useState(0);
610
+
611
+ return (
612
+ <Tabs view="clear" disabled={disabled} size={size as HeaderSize}>
613
+ {items.map((_, i) => (
614
+ <TabItem
615
+ key={`item:${i}`}
616
+ view="clear"
617
+ selected={i === index}
618
+ onClick={() => !disabled && setIndex(i)}
619
+ tabIndex={!disabled ? 0 : -1}
620
+ disabled={disabled}
621
+ value={helperText}
622
+ size={size as HeaderSize}
623
+ >
624
+ {`Label${i + 1}`}
625
+ </TabItem>
626
+ ))}
627
+ </Tabs>
628
+ );
629
+ };
630
+
631
+ const StoryHeaderScroll = (props: HorizontalStoryTabsProps) => {
632
+ const { disabled, itemQuantity, size, helperText, width } = props;
616
633
  const items = Array(itemQuantity).fill(0);
617
634
  const [index, setIndex] = useState(0);
618
635
 
619
636
  return (
620
- <Tabs view={hasDivider ? 'divider' : 'clear'} disabled={disabled} size={size} stretch={stretch}>
637
+ <Tabs view="clear" disabled={disabled} size={size as HeaderSize} style={{ width }}>
621
638
  {items.map((_, i) => (
622
639
  <TabItem
623
640
  key={`item:${i}`}
624
- view="divider"
641
+ view="clear"
625
642
  selected={i === index}
626
643
  onClick={() => !disabled && setIndex(i)}
627
644
  tabIndex={!disabled ? 0 : -1}
628
645
  disabled={disabled}
629
- contentLeft={getContentLeft(contentLeftOption, size as Size)}
630
- contentRight={getContentRight(contentRightOption, size as Size)}
646
+ value={helperText}
631
647
  size={size as HeaderSize}
632
648
  >
633
649
  {`Label${i + 1}`}
@@ -637,37 +653,60 @@ const StoryHeaderTabs = (props: StoryTabsProps) => {
637
653
  );
638
654
  };
639
655
 
640
- export const HeaderTabs: StoryObj<StoryTabsProps> = {
656
+ export const HeaderTabs: StoryObj<HorizontalStoryTabsProps> = {
641
657
  args: {
642
658
  size: 'h5',
643
659
  disabled: false,
644
- hasDivider: true,
645
- itemQuantity: 4,
660
+ helperText: '',
661
+ itemQuantity: 6,
662
+ width: '12rem',
646
663
  },
647
664
  argTypes: {
648
- size: {
649
- options: headerSizes,
665
+ clip: {
666
+ options: headerClips,
650
667
  control: {
651
668
  type: 'select',
652
669
  },
653
670
  },
654
- contentLeft: {
655
- options: contentLeftOptions,
671
+ width: {
656
672
  control: {
657
- type: 'select',
673
+ type: 'text',
674
+ },
675
+ if: { arg: 'clip', eq: 'scroll' },
676
+ },
677
+ stretch: {
678
+ table: {
679
+ disable: true,
680
+ },
681
+ },
682
+ contentLeft: {
683
+ table: {
684
+ disable: true,
658
685
  },
659
686
  },
660
687
  contentRight: {
661
- options: contentRightOptions,
662
- control: {
663
- type: 'select',
688
+ table: {
689
+ disable: true,
664
690
  },
665
691
  },
666
- clip: {
692
+ hasDivider: {
667
693
  table: {
668
694
  disable: true,
669
695
  },
670
696
  },
697
+ size: {
698
+ options: headerSizes,
699
+ control: {
700
+ type: 'select',
701
+ },
702
+ },
703
+ },
704
+ render: (args) => {
705
+ switch (args.clip) {
706
+ case 'scroll':
707
+ return <StoryHeaderScroll {...args} />;
708
+ default:
709
+ return <StoryHeaderDefault {...args} />;
710
+ }
671
711
  },
672
- render: (args) => <StoryHeaderTabs {...args} />,
673
712
  };
@@ -8,6 +8,10 @@ export declare type DatePickerTextFieldProps = {
8
8
  * Выбранное значение.
9
9
  */
10
10
  defaultDate?: Date;
11
+ /**
12
+ * Placeholder для поля ввода
13
+ */
14
+ placeholder?: string;
11
15
  /**
12
16
  * Свойство для названия поля при работе с формой
13
17
  */
@@ -1 +1 @@
1
- {"version":3,"file":"SingleDate.types.d.ts","sourceRoot":"","sources":["../../../../src/components/DatePicker/SingleDate/SingleDate.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAE9D,oBAAY,wBAAwB,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAC3E,oBAAY,mBAAmB,GAAG,wBAAwB,GAAG,MAAM,CAAC;AAEpE,oBAAY,wBAAwB,GAAG;IACnC;;OAEG;IACH,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB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SAAS,CAAC,WAAW,CAAC,CAAC;IACrD;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,GAAG,KAAK,KAAK,IAAI,CAAC;CACvE,CAAC;AAEF,oBAAY,eAAe,GAAG,wBAAwB,GAClD,wBAAwB,GACxB,uBAAuB,GACvB,sBAAsB,GACtB,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"SingleDate.types.d.ts","sourceRoot":"","sources":["../../../../src/components/DatePicker/SingleDate/SingleDate.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACjG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAE9D,oBAAY,wBAAwB,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAC3E,oBAAY,mBAAmB,GAAG,wBAAwB,GAAG,MAAM,CAAC;AAEpE,oBAAY,wBAAwB,GAAG;IACnC;;OAEG;IACH,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH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