@semcore/carousel 2.2.49 → 3.0.0-beta.1

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/CHANGELOG.md CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
- ## [2.2.49] - 2023-06-30
5
+ ## [3.0.0] - 2023-07-15
6
6
 
7
- ### Changed
7
+ ### Break
8
8
 
9
- - Version patch update due to children dependencies update (`@semcore/utils` [3.54.0 ~> 3.54.1]).
9
+ - Strict, backward incompatible typings.
10
10
 
11
11
  ## [2.2.48] - 2023-06-28
12
12
 
@@ -22,18 +22,18 @@ var _l = _interopRequireDefault(require("@semcore/icon/ChevronRight/l"));
22
22
  var _l2 = _interopRequireDefault(require("@semcore/icon/ChevronLeft/l"));
23
23
  var _uniqueID = _interopRequireDefault(require("@semcore/utils/lib/uniqueID"));
24
24
  /*__reshadow-styles__:"./style/carousel.shadow.css"*/
25
- var style = ( /*__reshadow_css_start__*/_core.sstyled.insert( /*__inner_css_start__*/".___SCarousel_1s7t6_gg_{overflow:hidden;outline:0}.___SContainer_1s7t6_gg_{display:flex;transition:transform var(--duration_1s7t6) ease-in-out}.___SItem_1s7t6_gg_{flex:0 0 100%;max-width:100%;box-sizing:border-box;transform:var(--transform_1s7t6);border-radius:var(--intergalactic-surface-rounded, 6px);overflow:hidden}.___SIndicators_1s7t6_gg_{display:flex;justify-content:center;margin-top:var(--intergalactic-spacing-4x, 16px)}.___SIndicator_1s7t6_gg_{margin:0 calc(.5*var(--intergalactic-spacing-3x, 12px));cursor:pointer;display:block;width:12px;height:12px;border-radius:var(--intergalactic-control-rounded, 6px);background-color:var(--intergalactic-icon-secondary-neutral, #a9abb6);opacity:var(--intergalactic-disabled-opacity, 0.3);-o-object-fit:cover;object-fit:cover;transition:ease-in-out opacity .1s}@media (hover:hover){.___SIndicator_1s7t6_gg_:hover{opacity:calc(2*var(--intergalactic-disabled-opacity, 0.3))}}.___SIndicator_1s7t6_gg_.__active_1s7t6_gg_{opacity:1}.___SNext_1s7t6_gg_,.___SPrev_1s7t6_gg_{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SPrev_1s7t6_gg_{margin-right:var(--intergalactic-spacing-3x, 12px)}.___SNext_1s7t6_gg_{margin-left:var(--intergalactic-spacing-3x, 12px)}.___SNext_1s7t6_gg_.__disabled_1s7t6_gg_,.___SPrev_1s7t6_gg_.__disabled_1s7t6_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}@media (prefers-reduced-motion){.___SContainer_1s7t6_gg_{transition:none}}" /*__inner_css_end__*/, "1s7t6_gg_") /*__reshadow_css_end__*/, {
26
- "__SCarousel": "___SCarousel_1s7t6_gg_",
27
- "__SContainer": "___SContainer_1s7t6_gg_",
28
- "--duration": "--duration_1s7t6",
29
- "__SItem": "___SItem_1s7t6_gg_",
30
- "--transform": "--transform_1s7t6",
31
- "__SIndicators": "___SIndicators_1s7t6_gg_",
32
- "__SIndicator": "___SIndicator_1s7t6_gg_",
33
- "_active": "__active_1s7t6_gg_",
34
- "__SPrev": "___SPrev_1s7t6_gg_",
35
- "__SNext": "___SNext_1s7t6_gg_",
36
- "_disabled": "__disabled_1s7t6_gg_"
25
+ var style = ( /*__reshadow_css_start__*/_core.sstyled.insert( /*__inner_css_start__*/".___SCarousel_1sujb_gg_{overflow:hidden;outline:0}.___SContainer_1sujb_gg_{display:flex;transition:transform var(--duration_1sujb) ease-in-out}.___SItem_1sujb_gg_{flex:0 0 100%;max-width:100%;box-sizing:border-box;transform:var(--transform_1sujb);border-radius:var(--intergalactic-surface-rounded, 6px);overflow:hidden}.___SIndicators_1sujb_gg_{display:flex;justify-content:center;margin-top:var(--intergalactic-spacing-4x, 16px)}.___SIndicator_1sujb_gg_{margin:0 calc(.5*var(--intergalactic-spacing-3x, 12px));cursor:pointer;display:block;width:12px;height:12px;border-radius:var(--intergalactic-control-rounded, 6px);background-color:var(--intergalactic-icon-secondary-neutral, #a9abb6);opacity:var(--intergalactic-disabled-opacity, 0.3);-o-object-fit:cover;object-fit:cover;transition:ease-in-out opacity .1s}@media (hover:hover){.___SIndicator_1sujb_gg_:hover{opacity:calc(2*var(--intergalactic-disabled-opacity, 0.3))}}.___SIndicator_1sujb_gg_.__active_1sujb_gg_{opacity:1}.___SNext_1sujb_gg_,.___SPrev_1sujb_gg_{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SPrev_1sujb_gg_{margin-right:var(--intergalactic-spacing-3x, 12px)}.___SNext_1sujb_gg_{margin-left:var(--intergalactic-spacing-3x, 12px)}.___SNext_1sujb_gg_.__disabled_1sujb_gg_,.___SPrev_1sujb_gg_.__disabled_1sujb_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}@media (prefers-reduced-motion){.___SContainer_1sujb_gg_{transition:none}}" /*__inner_css_end__*/, "1sujb_gg_") /*__reshadow_css_end__*/, {
26
+ "__SCarousel": "___SCarousel_1sujb_gg_",
27
+ "__SContainer": "___SContainer_1sujb_gg_",
28
+ "--duration": "--duration_1sujb",
29
+ "__SItem": "___SItem_1sujb_gg_",
30
+ "--transform": "--transform_1sujb",
31
+ "__SIndicators": "___SIndicators_1sujb_gg_",
32
+ "__SIndicator": "___SIndicator_1sujb_gg_",
33
+ "_active": "__active_1sujb_gg_",
34
+ "__SPrev": "___SPrev_1sujb_gg_",
35
+ "__SNext": "___SNext_1sujb_gg_",
36
+ "_disabled": "__disabled_1sujb_gg_"
37
37
  });
38
38
  var position = {
39
39
  getItemMin: function getItemMin(items) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React from 'react';\nimport { PropGetterFn, CProps, ReturnEl } from '@semcore/core';\nimport { IBoxProps } from '@semcore/flex-box';\n\ntype ChildRenderFn<Props> = Props & {\n children?: ({\n items,\n }: {\n items: { active: boolean; onClick: () => void }[];\n }) => React.ReactElement | React.ReactElement[];\n};\n\nexport interface ICarouselProps {\n /** Index active item */\n index?: number;\n /**\n * Index of the active item selected by default\n * @default 0\n */\n defaultIndex?: number;\n /** Called when the selection is changed */\n onIndexChange?: (index: number) => void;\n /** Animation duration\n * @default 300 */\n duration?: number;\n /** Disables infinite items change in the carousel\n * @default false */\n bounded?: boolean;\n /** @ignore */\n step?: number;\n}\n\nexport interface ICarouselContext {\n getContainerProps: PropGetterFn;\n getItemProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getIndicatorsProps: PropGetterFn;\n}\n\nexport interface ICarouselState {\n items: { transform: number; position: number; node: HTMLDivElement }[];\n}\n\ndeclare const Carousel: (<T>(\n props: CProps<ICarouselProps & T, ICarouselContext, ICarouselState>,\n) => ReturnEl) & {\n Container: <T>(props: IBoxProps & T) => ReturnEl;\n Indicators: <T>(props: ChildRenderFn<IBoxProps & T>) => ReturnEl;\n Indicator: <T>(\n props: ChildRenderFn<IBoxProps & { active: boolean; onClick: () => void } & T>,\n ) => ReturnEl;\n Item: <T>(props: IBoxProps & T) => ReturnEl;\n Prev: <T>(props: IBoxProps & T) => ReturnEl;\n Next: <T>(props: IBoxProps & T) => ReturnEl;\n};\n\nexport default Carousel;\n"],"mappings":""}
1
+ {"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React from 'react';\nimport { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { BoxProps } from '@semcore/flex-box';\n\ntype ChildRenderFn<Props> = Props & {\n children?: ({\n items,\n }: {\n items: { active: boolean; onClick: () => void }[];\n }) => React.ReactElement | React.ReactElement[];\n};\n\n/** @deprecated */\nexport interface ICarouselProps extends CarouselProps, UnknownProperties {}\nexport type CarouselProps = BoxProps & {\n /** Index active item */\n index?: number;\n /**\n * Index of the active item selected by default\n * @default 0\n */\n defaultIndex?: number;\n /** Called when the selection is changed */\n onIndexChange?: (index: number) => void;\n /** Animation duration\n * @default 300 */\n duration?: number;\n /** Disables infinite items change in the carousel\n * @default false */\n bounded?: boolean;\n /** @ignore */\n step?: number;\n};\n\n/** @deprecated */\nexport interface ICarouselContext extends CarouselContext, UnknownProperties {}\nexport type CarouselContext = {\n getContainerProps: PropGetterFn;\n getItemProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getIndicatorsProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface ICarouselState extends CarouselState, UnknownProperties {}\nexport type CarouselState = {\n // eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope\n items: { transform: number; position: number; node: HTMLDivElement }[];\n};\n\ndeclare const Carousel: Intergalactic.Component<\n 'div',\n CarouselProps,\n CarouselContext & CarouselState\n> & {\n Container: Intergalactic.Component<'div', BoxProps>;\n Indicators: Intergalactic.Component<'div', BoxProps, CarouselState>;\n Indicator: Intergalactic.Component<\n 'div',\n Omit<BoxProps, 'position'> & {\n active?: boolean;\n onClick?: () => void;\n transform?: number;\n position?: number;\n // eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope\n node?: HTMLDivElement;\n }\n >;\n Item: Intergalactic.Component<'div', BoxProps>;\n Prev: Intergalactic.Component<'div', BoxProps>;\n Next: Intergalactic.Component<'div', BoxProps>;\n};\n\nexport default Carousel;\n"],"mappings":""}
@@ -23,18 +23,18 @@ import ChevronRight from '@semcore/icon/ChevronRight/l';
23
23
  import ChevronLeft from '@semcore/icon/ChevronLeft/l';
24
24
  import uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';
25
25
  /*__reshadow-styles__:"./style/carousel.shadow.css"*/
26
- var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SCarousel_1s7t6_gg_{overflow:hidden;outline:0}.___SContainer_1s7t6_gg_{display:flex;transition:transform var(--duration_1s7t6) ease-in-out}.___SItem_1s7t6_gg_{flex:0 0 100%;max-width:100%;box-sizing:border-box;transform:var(--transform_1s7t6);border-radius:var(--intergalactic-surface-rounded, 6px);overflow:hidden}.___SIndicators_1s7t6_gg_{display:flex;justify-content:center;margin-top:var(--intergalactic-spacing-4x, 16px)}.___SIndicator_1s7t6_gg_{margin:0 calc(.5*var(--intergalactic-spacing-3x, 12px));cursor:pointer;display:block;width:12px;height:12px;border-radius:var(--intergalactic-control-rounded, 6px);background-color:var(--intergalactic-icon-secondary-neutral, #a9abb6);opacity:var(--intergalactic-disabled-opacity, 0.3);-o-object-fit:cover;object-fit:cover;transition:ease-in-out opacity .1s}@media (hover:hover){.___SIndicator_1s7t6_gg_:hover{opacity:calc(2*var(--intergalactic-disabled-opacity, 0.3))}}.___SIndicator_1s7t6_gg_.__active_1s7t6_gg_{opacity:1}.___SNext_1s7t6_gg_,.___SPrev_1s7t6_gg_{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SPrev_1s7t6_gg_{margin-right:var(--intergalactic-spacing-3x, 12px)}.___SNext_1s7t6_gg_{margin-left:var(--intergalactic-spacing-3x, 12px)}.___SNext_1s7t6_gg_.__disabled_1s7t6_gg_,.___SPrev_1s7t6_gg_.__disabled_1s7t6_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}@media (prefers-reduced-motion){.___SContainer_1s7t6_gg_{transition:none}}" /*__inner_css_end__*/, "1s7t6_gg_") /*__reshadow_css_end__*/, {
27
- "__SCarousel": "___SCarousel_1s7t6_gg_",
28
- "__SContainer": "___SContainer_1s7t6_gg_",
29
- "--duration": "--duration_1s7t6",
30
- "__SItem": "___SItem_1s7t6_gg_",
31
- "--transform": "--transform_1s7t6",
32
- "__SIndicators": "___SIndicators_1s7t6_gg_",
33
- "__SIndicator": "___SIndicator_1s7t6_gg_",
34
- "_active": "__active_1s7t6_gg_",
35
- "__SPrev": "___SPrev_1s7t6_gg_",
36
- "__SNext": "___SNext_1s7t6_gg_",
37
- "_disabled": "__disabled_1s7t6_gg_"
26
+ var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SCarousel_1sujb_gg_{overflow:hidden;outline:0}.___SContainer_1sujb_gg_{display:flex;transition:transform var(--duration_1sujb) ease-in-out}.___SItem_1sujb_gg_{flex:0 0 100%;max-width:100%;box-sizing:border-box;transform:var(--transform_1sujb);border-radius:var(--intergalactic-surface-rounded, 6px);overflow:hidden}.___SIndicators_1sujb_gg_{display:flex;justify-content:center;margin-top:var(--intergalactic-spacing-4x, 16px)}.___SIndicator_1sujb_gg_{margin:0 calc(.5*var(--intergalactic-spacing-3x, 12px));cursor:pointer;display:block;width:12px;height:12px;border-radius:var(--intergalactic-control-rounded, 6px);background-color:var(--intergalactic-icon-secondary-neutral, #a9abb6);opacity:var(--intergalactic-disabled-opacity, 0.3);-o-object-fit:cover;object-fit:cover;transition:ease-in-out opacity .1s}@media (hover:hover){.___SIndicator_1sujb_gg_:hover{opacity:calc(2*var(--intergalactic-disabled-opacity, 0.3))}}.___SIndicator_1sujb_gg_.__active_1sujb_gg_{opacity:1}.___SNext_1sujb_gg_,.___SPrev_1sujb_gg_{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:var(--intergalactic-icon-primary-neutral, #6c6e79)}.___SPrev_1sujb_gg_{margin-right:var(--intergalactic-spacing-3x, 12px)}.___SNext_1sujb_gg_{margin-left:var(--intergalactic-spacing-3x, 12px)}.___SNext_1sujb_gg_.__disabled_1sujb_gg_,.___SPrev_1sujb_gg_.__disabled_1sujb_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}@media (prefers-reduced-motion){.___SContainer_1sujb_gg_{transition:none}}" /*__inner_css_end__*/, "1sujb_gg_") /*__reshadow_css_end__*/, {
27
+ "__SCarousel": "___SCarousel_1sujb_gg_",
28
+ "__SContainer": "___SContainer_1sujb_gg_",
29
+ "--duration": "--duration_1sujb",
30
+ "__SItem": "___SItem_1sujb_gg_",
31
+ "--transform": "--transform_1sujb",
32
+ "__SIndicators": "___SIndicators_1sujb_gg_",
33
+ "__SIndicator": "___SIndicator_1sujb_gg_",
34
+ "_active": "__active_1sujb_gg_",
35
+ "__SPrev": "___SPrev_1sujb_gg_",
36
+ "__SNext": "___SNext_1sujb_gg_",
37
+ "_disabled": "__disabled_1sujb_gg_"
38
38
  });
39
39
  var position = {
40
40
  getItemMin: function getItemMin(items) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React from 'react';\nimport { PropGetterFn, CProps, ReturnEl } from '@semcore/core';\nimport { IBoxProps } from '@semcore/flex-box';\n\ntype ChildRenderFn<Props> = Props & {\n children?: ({\n items,\n }: {\n items: { active: boolean; onClick: () => void }[];\n }) => React.ReactElement | React.ReactElement[];\n};\n\nexport interface ICarouselProps {\n /** Index active item */\n index?: number;\n /**\n * Index of the active item selected by default\n * @default 0\n */\n defaultIndex?: number;\n /** Called when the selection is changed */\n onIndexChange?: (index: number) => void;\n /** Animation duration\n * @default 300 */\n duration?: number;\n /** Disables infinite items change in the carousel\n * @default false */\n bounded?: boolean;\n /** @ignore */\n step?: number;\n}\n\nexport interface ICarouselContext {\n getContainerProps: PropGetterFn;\n getItemProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getIndicatorsProps: PropGetterFn;\n}\n\nexport interface ICarouselState {\n items: { transform: number; position: number; node: HTMLDivElement }[];\n}\n\ndeclare const Carousel: (<T>(\n props: CProps<ICarouselProps & T, ICarouselContext, ICarouselState>,\n) => ReturnEl) & {\n Container: <T>(props: IBoxProps & T) => ReturnEl;\n Indicators: <T>(props: ChildRenderFn<IBoxProps & T>) => ReturnEl;\n Indicator: <T>(\n props: ChildRenderFn<IBoxProps & { active: boolean; onClick: () => void } & T>,\n ) => ReturnEl;\n Item: <T>(props: IBoxProps & T) => ReturnEl;\n Prev: <T>(props: IBoxProps & T) => ReturnEl;\n Next: <T>(props: IBoxProps & T) => ReturnEl;\n};\n\nexport default Carousel;\n"],"mappings":""}
1
+ {"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React from 'react';\nimport { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { BoxProps } from '@semcore/flex-box';\n\ntype ChildRenderFn<Props> = Props & {\n children?: ({\n items,\n }: {\n items: { active: boolean; onClick: () => void }[];\n }) => React.ReactElement | React.ReactElement[];\n};\n\n/** @deprecated */\nexport interface ICarouselProps extends CarouselProps, UnknownProperties {}\nexport type CarouselProps = BoxProps & {\n /** Index active item */\n index?: number;\n /**\n * Index of the active item selected by default\n * @default 0\n */\n defaultIndex?: number;\n /** Called when the selection is changed */\n onIndexChange?: (index: number) => void;\n /** Animation duration\n * @default 300 */\n duration?: number;\n /** Disables infinite items change in the carousel\n * @default false */\n bounded?: boolean;\n /** @ignore */\n step?: number;\n};\n\n/** @deprecated */\nexport interface ICarouselContext extends CarouselContext, UnknownProperties {}\nexport type CarouselContext = {\n getContainerProps: PropGetterFn;\n getItemProps: PropGetterFn;\n getPrevProps: PropGetterFn;\n getNextProps: PropGetterFn;\n getIndicatorsProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface ICarouselState extends CarouselState, UnknownProperties {}\nexport type CarouselState = {\n // eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope\n items: { transform: number; position: number; node: HTMLDivElement }[];\n};\n\ndeclare const Carousel: Intergalactic.Component<\n 'div',\n CarouselProps,\n CarouselContext & CarouselState\n> & {\n Container: Intergalactic.Component<'div', BoxProps>;\n Indicators: Intergalactic.Component<'div', BoxProps, CarouselState>;\n Indicator: Intergalactic.Component<\n 'div',\n Omit<BoxProps, 'position'> & {\n active?: boolean;\n onClick?: () => void;\n transform?: number;\n position?: number;\n // eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope\n node?: HTMLDivElement;\n }\n >;\n Item: Intergalactic.Component<'div', BoxProps>;\n Prev: Intergalactic.Component<'div', BoxProps>;\n Next: Intergalactic.Component<'div', BoxProps>;\n};\n\nexport default Carousel;\n"],"mappings":""}
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { PropGetterFn, CProps, ReturnEl } from '@semcore/core';
3
- import { IBoxProps } from '@semcore/flex-box';
2
+ import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';
3
+ import { BoxProps } from '@semcore/flex-box';
4
4
 
5
5
  type ChildRenderFn<Props> = Props & {
6
6
  children?: ({
@@ -10,7 +10,9 @@ type ChildRenderFn<Props> = Props & {
10
10
  }) => React.ReactElement | React.ReactElement[];
11
11
  };
12
12
 
13
- export interface ICarouselProps {
13
+ /** @deprecated */
14
+ export interface ICarouselProps extends CarouselProps, UnknownProperties {}
15
+ export type CarouselProps = BoxProps & {
14
16
  /** Index active item */
15
17
  index?: number;
16
18
  /**
@@ -28,31 +30,46 @@ export interface ICarouselProps {
28
30
  bounded?: boolean;
29
31
  /** @ignore */
30
32
  step?: number;
31
- }
33
+ };
32
34
 
33
- export interface ICarouselContext {
35
+ /** @deprecated */
36
+ export interface ICarouselContext extends CarouselContext, UnknownProperties {}
37
+ export type CarouselContext = {
34
38
  getContainerProps: PropGetterFn;
35
39
  getItemProps: PropGetterFn;
36
40
  getPrevProps: PropGetterFn;
37
41
  getNextProps: PropGetterFn;
38
42
  getIndicatorsProps: PropGetterFn;
39
- }
43
+ };
40
44
 
41
- export interface ICarouselState {
45
+ /** @deprecated */
46
+ export interface ICarouselState extends CarouselState, UnknownProperties {}
47
+ export type CarouselState = {
48
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
42
49
  items: { transform: number; position: number; node: HTMLDivElement }[];
43
- }
50
+ };
44
51
 
45
- declare const Carousel: (<T>(
46
- props: CProps<ICarouselProps & T, ICarouselContext, ICarouselState>,
47
- ) => ReturnEl) & {
48
- Container: <T>(props: IBoxProps & T) => ReturnEl;
49
- Indicators: <T>(props: ChildRenderFn<IBoxProps & T>) => ReturnEl;
50
- Indicator: <T>(
51
- props: ChildRenderFn<IBoxProps & { active: boolean; onClick: () => void } & T>,
52
- ) => ReturnEl;
53
- Item: <T>(props: IBoxProps & T) => ReturnEl;
54
- Prev: <T>(props: IBoxProps & T) => ReturnEl;
55
- Next: <T>(props: IBoxProps & T) => ReturnEl;
52
+ declare const Carousel: Intergalactic.Component<
53
+ 'div',
54
+ CarouselProps,
55
+ CarouselContext & CarouselState
56
+ > & {
57
+ Container: Intergalactic.Component<'div', BoxProps>;
58
+ Indicators: Intergalactic.Component<'div', BoxProps, CarouselState>;
59
+ Indicator: Intergalactic.Component<
60
+ 'div',
61
+ Omit<BoxProps, 'position'> & {
62
+ active?: boolean;
63
+ onClick?: () => void;
64
+ transform?: number;
65
+ position?: number;
66
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
67
+ node?: HTMLDivElement;
68
+ }
69
+ >;
70
+ Item: Intergalactic.Component<'div', BoxProps>;
71
+ Prev: Intergalactic.Component<'div', BoxProps>;
72
+ Next: Intergalactic.Component<'div', BoxProps>;
56
73
  };
57
74
 
58
75
  export default Carousel;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/carousel",
3
3
  "description": "Semrush Carousel Component",
4
- "version": "2.2.49",
4
+ "version": "3.0.0-beta.1",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -9,12 +9,12 @@
9
9
  "author": "UI-kit team <ui-kit-team@semrush.com>",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "@semcore/flex-box": "^4",
13
- "@semcore/icon": "2.16 - 3",
14
- "@semcore/utils": "^3.15"
12
+ "@semcore/flex-box": "5.0.0-beta.1",
13
+ "@semcore/icon": "4.0.0-beta.1",
14
+ "@semcore/utils": "4.0.0-beta.1"
15
15
  },
16
16
  "peerDependencies": {
17
- "@semcore/core": "^1.11",
17
+ "@semcore/core": "2.0.0-beta.1",
18
18
  "react": "16.8 - 18",
19
19
  "react-dom": "16.8 - 18"
20
20
  },
package/src/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { PropGetterFn, CProps, ReturnEl } from '@semcore/core';
3
- import { IBoxProps } from '@semcore/flex-box';
2
+ import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';
3
+ import { BoxProps } from '@semcore/flex-box';
4
4
 
5
5
  type ChildRenderFn<Props> = Props & {
6
6
  children?: ({
@@ -10,7 +10,9 @@ type ChildRenderFn<Props> = Props & {
10
10
  }) => React.ReactElement | React.ReactElement[];
11
11
  };
12
12
 
13
- export interface ICarouselProps {
13
+ /** @deprecated */
14
+ export interface ICarouselProps extends CarouselProps, UnknownProperties {}
15
+ export type CarouselProps = BoxProps & {
14
16
  /** Index active item */
15
17
  index?: number;
16
18
  /**
@@ -28,31 +30,46 @@ export interface ICarouselProps {
28
30
  bounded?: boolean;
29
31
  /** @ignore */
30
32
  step?: number;
31
- }
33
+ };
32
34
 
33
- export interface ICarouselContext {
35
+ /** @deprecated */
36
+ export interface ICarouselContext extends CarouselContext, UnknownProperties {}
37
+ export type CarouselContext = {
34
38
  getContainerProps: PropGetterFn;
35
39
  getItemProps: PropGetterFn;
36
40
  getPrevProps: PropGetterFn;
37
41
  getNextProps: PropGetterFn;
38
42
  getIndicatorsProps: PropGetterFn;
39
- }
43
+ };
40
44
 
41
- export interface ICarouselState {
45
+ /** @deprecated */
46
+ export interface ICarouselState extends CarouselState, UnknownProperties {}
47
+ export type CarouselState = {
48
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
42
49
  items: { transform: number; position: number; node: HTMLDivElement }[];
43
- }
50
+ };
44
51
 
45
- declare const Carousel: (<T>(
46
- props: CProps<ICarouselProps & T, ICarouselContext, ICarouselState>,
47
- ) => ReturnEl) & {
48
- Container: <T>(props: IBoxProps & T) => ReturnEl;
49
- Indicators: <T>(props: ChildRenderFn<IBoxProps & T>) => ReturnEl;
50
- Indicator: <T>(
51
- props: ChildRenderFn<IBoxProps & { active: boolean; onClick: () => void } & T>,
52
- ) => ReturnEl;
53
- Item: <T>(props: IBoxProps & T) => ReturnEl;
54
- Prev: <T>(props: IBoxProps & T) => ReturnEl;
55
- Next: <T>(props: IBoxProps & T) => ReturnEl;
52
+ declare const Carousel: Intergalactic.Component<
53
+ 'div',
54
+ CarouselProps,
55
+ CarouselContext & CarouselState
56
+ > & {
57
+ Container: Intergalactic.Component<'div', BoxProps>;
58
+ Indicators: Intergalactic.Component<'div', BoxProps, CarouselState>;
59
+ Indicator: Intergalactic.Component<
60
+ 'div',
61
+ Omit<BoxProps, 'position'> & {
62
+ active?: boolean;
63
+ onClick?: () => void;
64
+ transform?: number;
65
+ position?: number;
66
+ // eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
67
+ node?: HTMLDivElement;
68
+ }
69
+ >;
70
+ Item: Intergalactic.Component<'div', BoxProps>;
71
+ Prev: Intergalactic.Component<'div', BoxProps>;
72
+ Next: Intergalactic.Component<'div', BoxProps>;
56
73
  };
57
74
 
58
75
  export default Carousel;