@semcore/accordion 3.5.4 → 3.5.5

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,6 +2,12 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
+ ## [3.5.5] - 2022-04-28
6
+
7
+ ### Changed
8
+
9
+ - Version patch update due to children dependencies update (`@semcore/icon` [2.20.0 ~> 2.21.0]).
10
+
5
11
  ## [3.5.4] - 2022-04-03
6
12
 
7
13
  ### Changed
@@ -0,0 +1,61 @@
1
+ import { Box, IFlexProps } from '@semcore/flex-box';
2
+ import { CProps, PropGetterFn, ReturnEl } from '@semcore/core';
3
+ import { ICollapseProps } from '@semcore/animation';
4
+
5
+ export type AccordionValue = null | number | string | Array<number | string | null>;
6
+
7
+ export interface IAccordionProps<T extends AccordionValue = AccordionValue> extends IFlexProps {
8
+ /** Value for the active tab. Can be set as stroke, number, null or as array.
9
+ * @type AccordionValue
10
+ * */
11
+ value?: T;
12
+ /**
13
+ * Value of the active tabs selected by default
14
+ * @type AccordionValue
15
+ * @default []
16
+ */
17
+ defaultValue?: T;
18
+ /** Called when the selection is changed
19
+ * @type (value: AccordionValue, event?: React.SyntheticEvent) => void
20
+ * */
21
+ onChange?: (value: T, event?: React.SyntheticEvent) => void;
22
+ /** Animation duration
23
+ * @default 350 */
24
+ duration?: number;
25
+ }
26
+
27
+ export interface IAccordionContext {
28
+ getItemProps: PropGetterFn;
29
+ }
30
+
31
+ export interface IAccordionHandlers {
32
+ value: (value: AccordionValue) => void;
33
+ }
34
+
35
+ export interface IAccordionItemProps {
36
+ /** Tab value */
37
+ value: string | number;
38
+ /** Disabling selection changes */
39
+ disabled?: boolean;
40
+ }
41
+
42
+ export interface IAccordionItemContext {
43
+ getToggleProps?: PropGetterFn;
44
+ getCollapseProps?: PropGetterFn;
45
+ getChevronProps?: PropGetterFn;
46
+ selected?: boolean;
47
+ }
48
+
49
+ declare const Accordion: (<T, V extends AccordionValue = AccordionValue>(
50
+ props: CProps<IAccordionProps<V> & T, IAccordionContext, IAccordionHandlers>,
51
+ ) => ReturnEl) & {
52
+ Item: (<T>(
53
+ props: CProps<IAccordionItemProps & T, IAccordionItemContext, IAccordionHandlers>,
54
+ ) => ReturnEl) & {
55
+ Toggle: typeof Box;
56
+ Chevron: typeof Box;
57
+ Collapse: <T>(props: ICollapseProps & T) => ReturnEl;
58
+ };
59
+ };
60
+
61
+ export default Accordion;
@@ -0,0 +1,61 @@
1
+ import { Box, IFlexProps } from '@semcore/flex-box';
2
+ import { CProps, PropGetterFn, ReturnEl } from '@semcore/core';
3
+ import { ICollapseProps } from '@semcore/animation';
4
+
5
+ export type AccordionValue = null | number | string | Array<number | string | null>;
6
+
7
+ export interface IAccordionProps<T extends AccordionValue = AccordionValue> extends IFlexProps {
8
+ /** Value for the active tab. Can be set as stroke, number, null or as array.
9
+ * @type AccordionValue
10
+ * */
11
+ value?: T;
12
+ /**
13
+ * Value of the active tabs selected by default
14
+ * @type AccordionValue
15
+ * @default []
16
+ */
17
+ defaultValue?: T;
18
+ /** Called when the selection is changed
19
+ * @type (value: AccordionValue, event?: React.SyntheticEvent) => void
20
+ * */
21
+ onChange?: (value: T, event?: React.SyntheticEvent) => void;
22
+ /** Animation duration
23
+ * @default 350 */
24
+ duration?: number;
25
+ }
26
+
27
+ export interface IAccordionContext {
28
+ getItemProps: PropGetterFn;
29
+ }
30
+
31
+ export interface IAccordionHandlers {
32
+ value: (value: AccordionValue) => void;
33
+ }
34
+
35
+ export interface IAccordionItemProps {
36
+ /** Tab value */
37
+ value: string | number;
38
+ /** Disabling selection changes */
39
+ disabled?: boolean;
40
+ }
41
+
42
+ export interface IAccordionItemContext {
43
+ getToggleProps?: PropGetterFn;
44
+ getCollapseProps?: PropGetterFn;
45
+ getChevronProps?: PropGetterFn;
46
+ selected?: boolean;
47
+ }
48
+
49
+ declare const Accordion: (<T, V extends AccordionValue = AccordionValue>(
50
+ props: CProps<IAccordionProps<V> & T, IAccordionContext, IAccordionHandlers>,
51
+ ) => ReturnEl) & {
52
+ Item: (<T>(
53
+ props: CProps<IAccordionItemProps & T, IAccordionItemContext, IAccordionHandlers>,
54
+ ) => ReturnEl) & {
55
+ Toggle: typeof Box;
56
+ Chevron: typeof Box;
57
+ Collapse: <T>(props: ICollapseProps & T) => ReturnEl;
58
+ };
59
+ };
60
+
61
+ export default Accordion;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/accordion",
3
3
  "description": "SEMRush Accordion Component",
4
- "version": "3.5.4",
4
+ "version": "3.5.5",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -29,5 +29,8 @@
29
29
  "type": "git",
30
30
  "url": "https://github.com/semrush/intergalactic.git",
31
31
  "directory": "semcore/accordion"
32
+ },
33
+ "devDependencies": {
34
+ "@semcore/jest-preset-ui": "1.0.0"
32
35
  }
33
36
  }