@instructure/ui-tabs 8.13.1-snapshot.46 → 8.13.1-snapshot.55

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.
@@ -2,7 +2,12 @@ import React from 'react';
2
2
  import type { Spacing, WithStyleProps, ComponentStyle } from '@instructure/emotion';
3
3
  import type { OtherHTMLAttributes, PropValidators, TabsPanelTheme } from '@instructure/shared-types';
4
4
  declare type TabsPanelOwnProps = {
5
- renderTitle: React.ReactNode | ((...args: any[]) => any);
5
+ /**
6
+ * The content that will be rendered in the corresponding <Tab /> and will label
7
+ * this `<Tabs.Panel />` for screen readers
8
+ */
9
+ renderTitle: React.ReactNode | (() => React.ReactNode);
10
+ children?: React.ReactNode;
6
11
  variant?: 'default' | 'secondary';
7
12
  isSelected?: boolean;
8
13
  isDisabled?: boolean;
@@ -12,8 +17,10 @@ declare type TabsPanelOwnProps = {
12
17
  labelledBy?: string;
13
18
  padding?: Spacing;
14
19
  textAlign?: 'start' | 'center' | 'end';
15
- elementRef?: (element: Element | null) => void;
16
- children?: React.ReactNode;
20
+ /**
21
+ * provides a reference to the underlying html root element
22
+ */
23
+ elementRef?: (element: HTMLDivElement | null) => void;
17
24
  };
18
25
  declare type PropKeys = keyof TabsPanelOwnProps;
19
26
  declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/Tabs/Panel/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACf,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,cAAc,EACf,MAAM,2BAA2B,CAAA;AAElC,aAAK,iBAAiB,GAAG;IACvB,WAAW,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,E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C,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
@@ -1,5 +1,6 @@
1
1
  /** @jsx jsx */
2
- import { Component } from 'react';
2
+ import React, { Component } from 'react';
3
+ import type { ViewOwnProps } from '@instructure/ui-view';
3
4
  import { jsx } from '@instructure/emotion';
4
5
  import type { TabsTabProps } from './props';
5
6
  /**
@@ -7,6 +8,7 @@ import type { TabsTabProps } from './props';
7
8
  parent: Tabs
8
9
  id: Tabs.Tab
9
10
  ---
11
+ @tsProps
10
12
  **/
11
13
  declare class Tab extends Component<TabsTabProps> {
12
14
  static readonly componentId = "Tabs.Tab";
@@ -17,9 +19,15 @@ declare class Tab extends Component<TabsTabProps> {
17
19
  controls: string;
18
20
  isDisabled?: boolean | undefined;
19
21
  isSelected?: boolean | undefined;
20
- onClick?: ((...args: any[]) => any) | undefined;
21
- onKeyDown?: ((...args: any[]) => any) | undefined;
22
- children?: import("react").ReactNode | ((...args: any[]) => import("react").ReactNode);
22
+ onClick?: ((event: React.MouseEvent<ViewOwnProps, MouseEvent>, tabData: {
23
+ index: number;
24
+ id: string;
25
+ }) => void) | undefined;
26
+ onKeyDown?: ((event: React.KeyboardEvent<ViewOwnProps>, tabData: {
27
+ index: number;
28
+ id: string;
29
+ }) => void) | undefined;
30
+ children?: React.ReactNode | (() => React.ReactNode);
23
31
  })[];
24
32
  static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
25
33
  variant?: "default" | "secondary" | undefined;
@@ -28,28 +36,25 @@ declare class Tab extends Component<TabsTabProps> {
28
36
  controls: string;
29
37
  isDisabled?: boolean | undefined;
30
38
  isSelected?: boolean | undefined;
31
- onClick?: ((...args: any[]) => any) | undefined;
32
- onKeyDown?: ((...args: any[]) => any) | undefined;
33
- children?: import("react").ReactNode | ((...args: any[]) => import("react").ReactNode);
39
+ onClick?: ((event: React.MouseEvent<ViewOwnProps, MouseEvent>, tabData: {
40
+ index: number;
41
+ id: string;
42
+ }) => void) | undefined;
43
+ onKeyDown?: ((event: React.KeyboardEvent<ViewOwnProps>, tabData: {
44
+ index: number;
45
+ id: string;
46
+ }) => void) | undefined;
47
+ children?: React.ReactNode | (() => React.ReactNode);
34
48
  }>;
35
49
  static defaultProps: {
36
- children: null;
37
50
  variant: string;
38
51
  isDisabled: boolean;
39
52
  isSelected: boolean;
40
- onClick: (event: any, { index, id }: {
41
- index: any;
42
- id: any;
43
- }) => void;
44
- onKeyDown: (event: any, { index, id }: {
45
- index: any;
46
- id: any;
47
- }) => void;
48
53
  };
49
54
  componentDidMount(): void;
50
- componentDidUpdate(prevProps: any, prevState: any, snapshot: any): void;
51
- handleClick: (event: any) => void;
52
- handleKeyDown: (event: any) => void;
55
+ componentDidUpdate(): void;
56
+ handleClick: (event: React.MouseEvent<ViewOwnProps>) => void;
57
+ handleKeyDown: (event: React.KeyboardEvent<ViewOwnProps>) => void;
53
58
  render(): jsx.JSX.Element;
54
59
  }
55
60
  export default Tab;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Tabs/Tab/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAIrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAG3C;;;;;GAKG;AACH,cACM,GAAI,SAAQ,SAAS,CAAC,YAAY,CAAC;IACvC,MAAM,CAAC,QAAQ,CAAC,WAAW,cAAa;IAExC,MAAM,CAAC,YAAY;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY;;;;;;;;;;;;;MASlB;IAED,iBAAiB;IAKjB,kBAAkB,CAAC,SAAS,KAAA,EAAE,SAAS,KAAA,EAAE,QAAQ,KAAA;IAKjD,WAAW,uBASV;IAGD,aAAa,uBASZ;IAED,MAAM;CAiCP;AAED,eAAe,GAAG,CAAA;AAClB,OAAO,EAAE,GAAG,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Tabs/Tab/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAKrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAG3C;;;;;;GAMG;AACH,cACM,GAAI,SAAQ,SAAS,CAAC,YAAY,CAAC;IACvC,MAAM,CAAC,QAAQ,CAAC,WAAW,cAAa;IAExC,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY;;;;MAIlB;IAED,iBAAiB;IAIjB,kBAAkB;IAIlB,WAAW,UAAW,gBAAgB,CAAC,YAAY,CAAC,UAUnD;IAED,aAAa,UAAW,mBAAmB,CAAC,YAAY,CAAC,UAUxD;IAED,MAAM;CAgCP;AAED,eAAe,GAAG,CAAA;AAClB,OAAO,EAAE,GAAG,EAAE,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { OtherHTMLAttributes, PropValidators, TabsTabTheme } from '@instructure/shared-types';
3
3
  import type { WithStyleProps, ComponentStyle } from '@instructure/emotion';
4
+ import type { ViewOwnProps } from '@instructure/ui-view';
4
5
  declare type TabsTabOwnProps = {
5
6
  variant?: 'default' | 'secondary';
6
7
  id: string;
@@ -8,9 +9,15 @@ declare type TabsTabOwnProps = {
8
9
  controls: string;
9
10
  isDisabled?: boolean;
10
11
  isSelected?: boolean;
11
- onClick?: (...args: any[]) => any;
12
- onKeyDown?: (...args: any[]) => any;
13
- children?: React.ReactNode | ((...args: any[]) => React.ReactNode);
12
+ onClick?: (event: React.MouseEvent<ViewOwnProps>, tabData: {
13
+ index: number;
14
+ id: string;
15
+ }) => void;
16
+ onKeyDown?: (event: React.KeyboardEvent<ViewOwnProps>, tabData: {
17
+ index: number;
18
+ id: string;
19
+ }) => void;
20
+ children?: React.ReactNode | (() => React.ReactNode);
14
21
  };
15
22
  declare type PropKeys = keyof TabsTabOwnProps;
16
23
  declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/Tabs/Tab/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,YAAY,EACb,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1E,aAAK,eAAe,GAAG;IACrB,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,CAAA;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACjC,SAAS,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACnC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,KAAK,CAAC,SAAS,CAAC,CAAA;CACnE,CAAA;AAED,aAAK,QAAQ,GAAG,MAAM,eAAe,CAAA;AAErC,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,YAAY,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AAM,CAAA;KAAE,KACnC,IAAI,CAAA;IACT,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,MAAM,KAAK,CAAC,SAAS,CAAC,CAAA;CACrD,CAAA;AAED,aAAK,QAAQ,GAAG,MAAM,eAAe,CAAA;AAErC,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,YAAY,GAAG,eAAe,GACjC,cAAc,CAAC,YAAY,EAAE,YAAY,CAAC,GAC1C,mBAAmB,CAAC,eAAe,CAAC,CAAA;AAEtC,aAAK,YAAY,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;AAEzC,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAUvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAUnB,CAAA;AAED,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
@@ -1,24 +1,31 @@
1
1
  /** @jsx jsx */
2
- import React, { Component, ComponentElement, ReactElement } from 'react';
2
+ import React, { Component, ComponentElement } from 'react';
3
+ import type { ViewOwnProps } from '@instructure/ui-view';
4
+ import { Focusable } from '@instructure/ui-focusable';
3
5
  import { jsx } from '@instructure/emotion';
4
6
  import { Tab } from './Tab';
5
7
  import { Panel } from './Panel';
6
- import type { TabsProps } from './props';
8
+ import type { TabsProps, TabsState } from './props';
7
9
  import type { TabsTabProps } from './Tab/props';
8
10
  import type { TabsPanelProps } from './Panel/props';
9
- declare type TabChild = ReactElement & ComponentElement<TabsTabProps, any>;
10
- declare type PanelChild = ReactElement & ComponentElement<TabsPanelProps, any>;
11
+ declare type TabChild = ComponentElement<TabsTabProps, any>;
12
+ declare type PanelChild = ComponentElement<TabsPanelProps, any>;
11
13
  /**
12
14
  ---
13
15
  category: components
14
16
  ---
17
+ @tsProps
15
18
  **/
16
- declare class Tabs extends Component<TabsProps> {
19
+ declare class Tabs extends Component<TabsProps, TabsState> {
17
20
  static readonly componentId = "Tabs";
18
21
  static allowedProps: readonly (keyof {
22
+ children?: React.ReactNode;
19
23
  variant?: "default" | "secondary" | undefined;
20
24
  screenReaderLabel?: string | undefined;
21
- onRequestTabChange?: ((...args: any[]) => any) | undefined;
25
+ onRequestTabChange?: ((event: React.KeyboardEvent<ViewOwnProps> | React.MouseEvent<ViewOwnProps, MouseEvent>, tabData: {
26
+ index: number;
27
+ id?: string | undefined;
28
+ }) => void) | undefined;
22
29
  maxWidth?: string | number | undefined;
23
30
  maxHeight?: string | number | undefined;
24
31
  minHeight?: string | number | undefined;
@@ -29,12 +36,15 @@ declare class Tabs extends Component<TabsProps> {
29
36
  elementRef?: ((element: Element | null) => void) | undefined;
30
37
  tabOverflow?: "scroll" | "stack" | undefined;
31
38
  shouldFocusOnRender?: boolean | undefined;
32
- children?: React.ReactNode;
33
39
  })[];
34
40
  static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
41
+ children?: React.ReactNode;
35
42
  variant?: "default" | "secondary" | undefined;
36
43
  screenReaderLabel?: string | undefined;
37
- onRequestTabChange?: ((...args: any[]) => any) | undefined;
44
+ onRequestTabChange?: ((event: React.KeyboardEvent<ViewOwnProps> | React.MouseEvent<ViewOwnProps, MouseEvent>, tabData: {
45
+ index: number;
46
+ id?: string | undefined;
47
+ }) => void) | undefined;
38
48
  maxWidth?: string | number | undefined;
39
49
  maxHeight?: string | number | undefined;
40
50
  minHeight?: string | number | undefined;
@@ -45,51 +55,44 @@ declare class Tabs extends Component<TabsProps> {
45
55
  elementRef?: ((element: Element | null) => void) | undefined;
46
56
  tabOverflow?: "scroll" | "stack" | undefined;
47
57
  shouldFocusOnRender?: boolean | undefined;
48
- children?: React.ReactNode;
49
58
  }>;
50
59
  static defaultProps: {
51
60
  variant: string;
52
- onRequestTabChange: (event: any, { index, id }: {
53
- index: any;
54
- id: any;
55
- }) => void;
56
- children: null;
57
- elementRef: () => void;
58
61
  shouldFocusOnRender: boolean;
59
62
  tabOverflow: string;
60
63
  };
61
64
  static Panel: typeof Panel;
62
65
  static Tab: typeof Tab;
66
+ private _tabList;
67
+ private _focusable;
68
+ private _tabListPosition?;
69
+ private _debounced?;
70
+ private _resizeListener?;
63
71
  ref: Element | null;
64
72
  handleRef: (el: Element | null) => void;
65
- constructor(props: any);
73
+ constructor(props: TabsProps);
66
74
  componentDidMount(): void;
67
- componentDidUpdate(prevProps: any, prevState: any, snapshot: any): void;
75
+ componentDidUpdate(prevProps: TabsProps, prevState: TabsState): void;
68
76
  componentWillUnmount(): void;
69
77
  startScrollOverflow(): void;
70
78
  cancelScrollOverflow(): void;
71
- getOverlayWidth(): number | undefined;
72
- showActiveTabIfOverlayed(activeTabEl: any): void;
73
- handleTabClick: (event: any, { index, id }: {
74
- index: any;
75
- id: any;
76
- }) => void;
77
- handleTabKeyDown: (event: any, { index }: {
78
- index: any;
79
- }) => void;
79
+ getOverlayWidth(): number;
80
+ showActiveTabIfOverlayed(activeTabEl: Element | null): void;
81
+ handleTabClick: TabsTabProps['onClick'];
82
+ handleTabKeyDown: TabsTabProps['onKeyDown'];
80
83
  handleResize: () => void;
81
- getNextTab(startIndex: any, step: any): {
82
- index: any;
83
- id: any;
84
+ getNextTab(startIndex: number, step: -1 | 0 | 1): {
85
+ index: number;
86
+ id?: string;
84
87
  };
85
- fireOnChange(event: any, { index, id }: {
86
- index: any;
87
- id: any;
88
+ fireOnChange(event: React.MouseEvent<ViewOwnProps> | React.KeyboardEvent<ViewOwnProps>, { index, id }: {
89
+ index: number;
90
+ id?: string;
88
91
  }): void;
89
92
  createTab(index: number, generatedId: string, selected: boolean, panel: PanelChild): TabChild;
90
- clonePanel(_index: number, generatedId: string, selected: boolean, panel: PanelChild): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
91
- handleFocusableRef: (el: any) => void;
92
- handleTabListRef: (el: any) => void;
93
+ clonePanel(_index: number, generatedId: string, selected: boolean, panel: PanelChild): PanelChild;
94
+ handleFocusableRef: (el: Focusable | null) => void;
95
+ handleTabListRef: (el: Element | null) => void;
93
96
  focus(): void;
94
97
  render(): jsx.JSX.Element;
95
98
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Tabs/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,KAAK,EAAE,EACZ,SAAS,EAET,gBAAgB,EAEhB,YAAY,EACb,MAAM,OAAO,CAAA;AAmBd,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAKrD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAG/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEnD,aAAK,QAAQ,GAAG,YAAY,GAAG,gBAAgB,CAAC,YAAY,EAAE,GAAG,CAAC,CAAA;AAClE,aAAK,UAAU,GAAG,YAAY,GAAG,gBAAgB,CAAC,cAAc,EAAE,GAAG,CAAC,CAAA;AAEtE;;;;GAIG;AACH,cAGM,IAAK,SAAQ,SAAS,CAAC,SAAS,CAAC;IACrC,MAAM,CAAC,QAAQ,CAAC,WAAW,UAAS;IAEpC,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY;;;;;;;;;;MAQlB;IAED,MAAM,CAAC,KAAK,eAAQ;IACpB,MAAM,CAAC,GAAG,aAAM;IAEhB,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,OAAQ,OAAO,GAAG,IAAI,UAQ9B;gBAGW,KAAK,KAAA;IAajB,iBAAiB;IAcjB,kBAAkB,CAAC,SAA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;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE;IA2BjC,YAAY,CACV,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,YAAY,CAAC,EACzE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE;IAU/C,SAAS,CACP,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,OAAO,EACjB,KAAK,EAAE,UAAU,GAChB,QAAQ;IAiBX,UAAU,CACR,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,OAAO,EACjB,KAAK,EAAE,UAAU;IAoBnB,kBAAkB,OAAQ,SAAS,GAAG,IAAI,UAEzC;IAED,gBAAgB,OAAQ,OAAO,GAAG,IAAI,UAErC;IAED,KAAK;IAML,MAAM;CA4FP;AAED,eAAe,IAAI,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA"}
@@ -2,28 +2,64 @@ import React from 'react';
2
2
  import type { Spacing, WithStyleProps, ComponentStyle } from '@instructure/emotion';
3
3
  import type { OtherHTMLAttributes, PropValidators, TabsTheme } from '@instructure/shared-types';
4
4
  import type { BidirectionalProps } from '@instructure/ui-i18n';
5
+ import type { ViewOwnProps } from '@instructure/ui-view';
5
6
  declare type TabsOwnProps = {
7
+ /**
8
+ * children of type `Tabs.Panel`
9
+ */
10
+ children?: React.ReactNode;
6
11
  variant?: 'default' | 'secondary';
12
+ /**
13
+ * A screen ready only label for the list of tabs
14
+ */
7
15
  screenReaderLabel?: string;
8
- onRequestTabChange?: (...args: any[]) => any;
16
+ /**
17
+ * Called when the selected tab should change
18
+ */
19
+ onRequestTabChange?: (event: React.MouseEvent<ViewOwnProps> | React.KeyboardEvent<ViewOwnProps>, tabData: {
20
+ index: number;
21
+ id?: string;
22
+ }) => void;
9
23
  maxWidth?: string | number;
10
24
  maxHeight?: string | number;
11
25
  minHeight?: string | number;
12
26
  fixHeight?: string | number;
27
+ /**
28
+ * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
29
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
30
+ * familiar CSS-like shorthand. For example: `margin="small auto large"`.
31
+ */
13
32
  margin?: Spacing;
33
+ /**
34
+ * Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
35
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
36
+ * familiar CSS-like shorthand. For example: `padding="small x-large large"`.
37
+ */
14
38
  padding?: Spacing;
15
39
  textAlign?: 'start' | 'center' | 'end';
40
+ /**
41
+ * provides a reference to the underlying html root element
42
+ */
16
43
  elementRef?: (element: Element | null) => void;
44
+ /**
45
+ * Choose whether Tabs should stack or scroll when they exceed the width of their
46
+ * container.
47
+ */
17
48
  tabOverflow?: 'stack' | 'scroll';
18
49
  shouldFocusOnRender?: boolean;
19
- children?: React.ReactNode;
20
50
  };
21
51
  declare type PropKeys = keyof TabsOwnProps;
22
52
  declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
23
53
  declare type TabsProps = TabsOwnProps & BidirectionalProps & WithStyleProps<TabsTheme, TabsStyle> & OtherHTMLAttributes<TabsOwnProps>;
24
- declare type TabsStyle = ComponentStyle<'tabs' | 'container' | 'tabList' | 'panelsContainer' | 'scrollOverlay' | 'scrollSpacer' | 'scrollOverlayWidthDefault' | 'scrollOverlayWidthSecondary'>;
54
+ declare type TabsStyle = ComponentStyle<'tabs' | 'container' | 'tabList' | 'panelsContainer' | 'scrollOverlay' | 'scrollSpacer'> & {
55
+ scrollOverlayWidthDefault: string;
56
+ scrollOverlayWidthSecondary: string;
57
+ };
58
+ declare type TabsState = {
59
+ withTabListOverflow: boolean;
60
+ };
25
61
  declare const propTypes: PropValidators<PropKeys>;
26
62
  declare const allowedProps: AllowedPropKeys;
27
- export type { TabsProps, TabsStyle };
63
+ export type { TabsProps, TabsState, TabsStyle };
28
64
  export { propTypes, allowedProps };
29
65
  //# sourceMappingURL=props.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Tabs/props.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACf,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,SAAS,EACV,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAE9D,aAAK,YAAY,GAAG;IAClB,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,CAAA;IACjC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,kBAAkB,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IAC5C,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;IACtC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAA;IAC9C,WAAW,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAChC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC3B,C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