@semcore/carousel 3.17.1-prerelease.1 → 3.18.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.
@@ -0,0 +1,122 @@
1
+ import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';
2
+ import { BoxProps } from '@semcore/flex-box';
3
+ import { IRootComponentProps } from '@semcore/core/src';
4
+
5
+ /** @deprecated */
6
+ export interface ICarouselProps extends CarouselProps, UnknownProperties {}
7
+ export type CarouselProps = BoxProps & {
8
+ /** Index active item */
9
+ index?: number;
10
+ /**
11
+ * Index of the active item selected by default
12
+ * @default 0
13
+ */
14
+ defaultIndex?: number;
15
+ /** Called when the selection is changed */
16
+ onIndexChange?: (index: number) => void;
17
+ /** Animation duration
18
+ * @default 300 */
19
+ duration?: number;
20
+ /** Disables infinite items change in the carousel
21
+ * @default false */
22
+ bounded?: boolean;
23
+ /** @ignore */
24
+ step?: number;
25
+ locale?: string;
26
+ /** Enable zoom feature for carousel items */
27
+ zoom?: boolean;
28
+ /** Width for items in zooming modal */
29
+ zoomWidth?: number;
30
+ /** Type of indicators */
31
+ indicators?: 'default' | 'hide' | 'preview';
32
+ };
33
+
34
+ /** @deprecated */
35
+ export interface ICarouselContext extends CarouselContext, UnknownProperties {}
36
+ export type CarouselContext = {
37
+ getContainerProps: PropGetterFn;
38
+ getItemProps: PropGetterFn;
39
+ getPrevProps: PropGetterFn;
40
+ getNextProps: PropGetterFn;
41
+ getIndicatorsProps: PropGetterFn;
42
+ };
43
+
44
+ export type CarouselItem = {
45
+ node: HTMLElement;
46
+ };
47
+
48
+ export type CarouselItemProps = BoxProps & {
49
+ /** Flag for css cursor
50
+ * @private
51
+ */
52
+ zoomIn?: boolean;
53
+ /** Flag for css cursor
54
+ * @private
55
+ */
56
+ zoomOut?: boolean;
57
+
58
+ /** Function to add item to list in Carousel
59
+ * @private
60
+ */
61
+ toggleItem?: (item: CarouselItem, toRemove?: boolean) => void;
62
+
63
+ /** Index of item in carousel */
64
+ index?: number;
65
+
66
+ uid?: string;
67
+
68
+ /** Flag - is current item shown now */
69
+ current?: boolean;
70
+
71
+ /** Handler for show item in modal window
72
+ * @private
73
+ */
74
+ onToggleZoomModal?: () => void;
75
+
76
+ /** Value for transform item
77
+ * @private
78
+ */
79
+ transform?: number;
80
+ };
81
+
82
+ /** @deprecated */
83
+ export interface ICarouselState extends CarouselState, UnknownProperties {}
84
+ export type CarouselState = {
85
+ isOpenZoom: boolean;
86
+ selectedIndex: number;
87
+ items: CarouselItem[];
88
+ };
89
+
90
+ export type CarouselButtonProps = IRootComponentProps &
91
+ BoxProps & {
92
+ label?: string;
93
+ inverted?: boolean;
94
+ };
95
+
96
+ export type CarouselIndicatorsProps = IRootComponentProps &
97
+ BoxProps & {
98
+ items?: CarouselItem[];
99
+ inverted?: boolean;
100
+ };
101
+
102
+ export type CarouselIndicatorProps = IRootComponentProps &
103
+ Omit<BoxProps, 'position'> & {
104
+ active?: boolean;
105
+ onClick?: () => void;
106
+ inverted?: boolean;
107
+ } & CarouselItem;
108
+
109
+ declare const CarouselType: Intergalactic.Component<
110
+ 'div',
111
+ CarouselProps,
112
+ CarouselContext & CarouselState
113
+ > & {
114
+ Container: Intergalactic.Component<'div', BoxProps>;
115
+ Indicators: Intergalactic.Component<'div', CarouselIndicatorsProps, CarouselState>;
116
+ Indicator: Intergalactic.Component<'div', CarouselIndicatorProps>;
117
+ Item: Intergalactic.Component<'div', CarouselItemProps>;
118
+ Prev: Intergalactic.Component<'div', CarouselButtonProps>;
119
+ Next: Intergalactic.Component<'div', CarouselButtonProps>;
120
+ };
121
+
122
+ export default CarouselType;
@@ -1,6 +1,7 @@
1
1
  SCarousel {
2
2
  overflow: hidden;
3
3
  outline: none;
4
+ user-select: none;
4
5
  }
5
6
 
6
7
  SContainer {
@@ -8,6 +9,11 @@ SContainer {
8
9
  transition: transform var(--duration) ease-in-out;
9
10
  }
10
11
 
12
+ SModalContainer {
13
+ display: flex;
14
+ transition: transform var(--duration) ease-in-out;
15
+ }
16
+
11
17
  SItem {
12
18
  flex: 0 0 100%;
13
19
  max-width: 100%;
@@ -17,6 +23,13 @@ SItem {
17
23
  overflow: hidden;
18
24
  }
19
25
 
26
+ SItem[zoomIn] {
27
+ cursor: zoom-in;
28
+ }
29
+ SItem[zoomOut] {
30
+ cursor: zoom-out;
31
+ }
32
+
20
33
  SIndicators {
21
34
  display: flex;
22
35
  justify-content: center;
@@ -44,6 +57,10 @@ SIndicator[active] {
44
57
  opacity: 1;
45
58
  }
46
59
 
60
+ SIndicator[inverted] {
61
+ background-color: var(--intergalactic-icon-primary-invert, #ffffff);
62
+ }
63
+
47
64
  SPrev,
48
65
  SNext {
49
66
  display: inline-flex;
@@ -54,10 +71,10 @@ SNext {
54
71
  }
55
72
 
56
73
  SPrev {
57
- margin-right: var(--intergalactic-spacing-3x, 12px);
74
+ margin-right: var(--intergalactic-spacing-2x, 8px);
58
75
  }
59
76
  SNext {
60
- margin-left: var(--intergalactic-spacing-3x, 12px);
77
+ margin-left: var(--intergalactic-spacing-2x, 8px);
61
78
  }
62
79
 
63
80
  SPrev[disabled],
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=index.d.js.map
@@ -1 +0,0 @@
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 locale?: string;\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,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.d.js.map
@@ -1 +0,0 @@
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 locale?: string;\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,76 +0,0 @@
1
- import React from 'react';
2
- import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';
3
- import { BoxProps } from '@semcore/flex-box';
4
-
5
- type ChildRenderFn<Props> = Props & {
6
- children?: ({
7
- items,
8
- }: {
9
- items: { active: boolean; onClick: () => void }[];
10
- }) => React.ReactElement | React.ReactElement[];
11
- };
12
-
13
- /** @deprecated */
14
- export interface ICarouselProps extends CarouselProps, UnknownProperties {}
15
- export type CarouselProps = BoxProps & {
16
- /** Index active item */
17
- index?: number;
18
- /**
19
- * Index of the active item selected by default
20
- * @default 0
21
- */
22
- defaultIndex?: number;
23
- /** Called when the selection is changed */
24
- onIndexChange?: (index: number) => void;
25
- /** Animation duration
26
- * @default 300 */
27
- duration?: number;
28
- /** Disables infinite items change in the carousel
29
- * @default false */
30
- bounded?: boolean;
31
- /** @ignore */
32
- step?: number;
33
- locale?: string;
34
- };
35
-
36
- /** @deprecated */
37
- export interface ICarouselContext extends CarouselContext, UnknownProperties {}
38
- export type CarouselContext = {
39
- getContainerProps: PropGetterFn;
40
- getItemProps: PropGetterFn;
41
- getPrevProps: PropGetterFn;
42
- getNextProps: PropGetterFn;
43
- getIndicatorsProps: PropGetterFn;
44
- };
45
-
46
- /** @deprecated */
47
- export interface ICarouselState extends CarouselState, UnknownProperties {}
48
- export type CarouselState = {
49
- // eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
50
- items: { transform: number; position: number; node: HTMLDivElement }[];
51
- };
52
-
53
- declare const Carousel: Intergalactic.Component<
54
- 'div',
55
- CarouselProps,
56
- CarouselContext & CarouselState
57
- > & {
58
- Container: Intergalactic.Component<'div', BoxProps>;
59
- Indicators: Intergalactic.Component<'div', BoxProps, CarouselState>;
60
- Indicator: Intergalactic.Component<
61
- 'div',
62
- Omit<BoxProps, 'position'> & {
63
- active?: boolean;
64
- onClick?: () => void;
65
- transform?: number;
66
- position?: number;
67
- // eslint-disable-next-line ssr-friendly/no-dom-globals-in-module-scope
68
- node?: HTMLDivElement;
69
- }
70
- >;
71
- Item: Intergalactic.Component<'div', BoxProps>;
72
- Prev: Intergalactic.Component<'div', BoxProps>;
73
- Next: Intergalactic.Component<'div', BoxProps>;
74
- };
75
-
76
- export default Carousel;