@wonderflow/react-components 3.0.0-next.1 → 3.0.0-next.2

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wonderflow/react-components",
3
3
  "description": "UI components from Wonderflow's Wanda design system",
4
- "version": "3.0.0-next.1",
4
+ "version": "3.0.0-next.2",
5
5
  "author": "Wonderflow",
6
6
  "license": "MIT",
7
7
  "main": "index.js",
package/tab/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { TabRoot as Tab } from './tab';
1
+ export { Tab } from './tab';
2
2
  export type { TabProps } from './tab';
package/tab/index.js CHANGED
@@ -1 +1 @@
1
- export { TabRoot as Tab } from './tab';
1
+ export { Tab } from './tab';
package/tab/tab-item.d.ts CHANGED
@@ -3,4 +3,6 @@ import { IconNames } from '../icons/types';
3
3
  export declare type TabItemProps = ButtonHTMLAttributes<HTMLButtonElement> & {
4
4
  icon?: IconNames;
5
5
  };
6
- export declare const TabItem: React.FC<TabItemProps>;
6
+ export declare const TabItem: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & {
7
+ icon?: IconNames | undefined;
8
+ } & React.RefAttributes<HTMLButtonElement>>;
package/tab/tab-item.js CHANGED
@@ -1,12 +1,12 @@
1
- import React, { useCallback, useRef } from 'react';
1
+ import React, { useCallback, useRef, forwardRef } from 'react';
2
2
  import { useRovingTabIndex, useFocusEffect } from 'react-roving-tabindex';
3
3
  import clsx from 'clsx';
4
4
  import { Stack, Icon } from '../';
5
5
  import { useTabState } from './primitive-tab';
6
6
  import { TabItem as TabItemClass } from './tab.module.css';
7
- export const TabItem = ({ children, className, icon, ...props }) => {
7
+ export const TabItem = forwardRef(({ children, className, icon, ...props }, forwardedRef) => {
8
8
  const { onClick, isActive } = useTabState(children);
9
- const internalRef = useRef(null);
9
+ const internalRef = useRef(forwardedRef);
10
10
  const [, focused, handleKeyDown, handleClick] = useRovingTabIndex(internalRef, false);
11
11
  useFocusEffect(focused, internalRef);
12
12
  const fireClick = useCallback(() => {
@@ -16,5 +16,5 @@ export const TabItem = ({ children, className, icon, ...props }) => {
16
16
  return (React.createElement(Stack, { as: "button", direction: "row", verticalAlign: "center", horizontalAlign: "start", fill: false, columnGap: 8, role: "tab", ref: internalRef, className: clsx(TabItemClass, className), "aria-selected": isActive, onClick: fireClick, onKeyDown: handleKeyDown, onFocus: fireClick, type: "button", tabIndex: isActive ? 0 : -1, ...props },
17
17
  icon && React.createElement(Icon, { name: icon, dimension: 16 }),
18
18
  children));
19
- };
19
+ });
20
20
  TabItem.displayName = 'Tab.Item';
package/tab/tab-list.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- import React from 'react';
2
- export declare const TabList: React.FC<PropsWithClass>;
1
+ import React, { HTMLAttributes } from 'react';
2
+ export declare type TabListProps = HTMLAttributes<HTMLDivElement>;
3
+ export declare const TabList: React.ForwardRefExoticComponent<TabListProps & React.RefAttributes<HTMLDivElement>>;
package/tab/tab-list.js CHANGED
@@ -4,3 +4,4 @@ import clsx from 'clsx';
4
4
  import { TabList as TabListClass } from './tab.module.css';
5
5
  export const TabList = forwardRef(({ children, className, ...props }, forwardedRef) => (React.createElement("div", { ref: forwardedRef, role: "tablist", tabIndex: -1, className: clsx(TabListClass, className), ...props },
6
6
  React.createElement(RovingTabIndexProvider, null, children))));
7
+ TabList.displayName = 'Tab.List';
@@ -4,4 +4,7 @@ export declare type TabPanelProps = PropsWithClass & {
4
4
  label: ReactNode;
5
5
  icon?: IconNames;
6
6
  };
7
- export declare const TabPanel: React.FC<TabPanelProps>;
7
+ export declare const TabPanel: React.ForwardRefExoticComponent<PropsWithClass & {
8
+ label: ReactNode;
9
+ icon?: IconNames | undefined;
10
+ } & React.RefAttributes<HTMLDivElement>>;
package/tab/tab.d.ts CHANGED
@@ -1,15 +1,17 @@
1
1
  import React, { ReactNode } from 'react';
2
+ import { TabItem } from './tab-item';
3
+ import { TabListProps } from './tab-list';
4
+ import { TabPanelProps } from './tab-panel';
5
+ import { Polymorphic } from '../';
2
6
  export declare type TabProps = PropsWithClass & {
3
7
  children: ReactNode;
4
8
  state?: [number, React.Dispatch<React.SetStateAction<number>>];
5
9
  onChange?(index: number): void;
6
10
  };
7
- export declare const TabRoot: React.ForwardRefExoticComponent<PropsWithClass & {
8
- children: ReactNode;
9
- state?: [number, React.Dispatch<React.SetStateAction<number>>] | undefined;
10
- onChange?(index: number): void;
11
- } & React.RefAttributes<HTMLDivElement>> & {
12
- Item: React.FC<import("./tab-item").TabItemProps>;
13
- List: React.FC<PropsWithClass>;
14
- Panel: React.FC<import("./tab-panel").TabPanelProps>;
11
+ declare type TabComponent = React.ForwardRefExoticComponent<TabProps & React.RefAttributes<HTMLDivElement>> & {
12
+ Panel: React.ForwardRefExoticComponent<TabPanelProps & React.RefAttributes<HTMLDivElement>>;
13
+ Item: React.ForwardRefExoticComponent<Polymorphic.OwnProps<typeof TabItem> & React.RefAttributes<Polymorphic.IntrinsicElement<typeof TabItem>>>;
14
+ List: React.ForwardRefExoticComponent<TabListProps & React.RefAttributes<HTMLDivElement>>;
15
15
  };
16
+ export declare const Tab: TabComponent;
17
+ export {};
package/tab/tab.js CHANGED
@@ -6,7 +6,7 @@ import { TabList } from './tab-list';
6
6
  import { TabPanel } from './tab-panel';
7
7
  import { Tabs as TabsWrapper } from './primitive-tab';
8
8
  import { Tab as TabClass } from './tab.module.css';
9
- const Tab = forwardRef(({ children, className, state, onChange, ...props }, forwardedRef) => {
9
+ export const Tab = forwardRef(({ children, className, state, onChange, ...props }, forwardedRef) => {
10
10
  const renderedChildren = Children.toArray(children).filter(Boolean);
11
11
  const innerState = useState(0);
12
12
  const tabState = state || innerState;
@@ -25,8 +25,6 @@ const Tab = forwardRef(({ children, className, state, onChange, ...props }, forw
25
25
  'aria-labelledby': seedID(`tab-item-${index}`)
26
26
  })))));
27
27
  });
28
- export const TabRoot = Object.assign(Tab, {
29
- Item: TabItem,
30
- List: TabList,
31
- Panel: TabPanel
32
- });
28
+ Tab.Panel = TabPanel;
29
+ Tab.Item = TabItem;
30
+ Tab.List = TabList;
package/themes/dark.css CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 29 Nov 2021 10:40:48 GMT
3
+ * Generated on Mon, 29 Nov 2021 11:27:03 GMT
4
4
  */
5
5
 
6
6
  :root {
package/themes/light.css CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 29 Nov 2021 10:40:48 GMT
3
+ * Generated on Mon, 29 Nov 2021 11:27:03 GMT
4
4
  */
5
5
 
6
6
  :root {
package/themes.css CHANGED
@@ -4,7 +4,7 @@
4
4
  color: var(--global-foreground);
5
5
  /**
6
6
  * Do not edit directly
7
- * Generated on Mon, 29 Nov 2021 10:40:48 GMT
7
+ * Generated on Mon, 29 Nov 2021 11:27:03 GMT
8
8
  */
9
9
 
10
10
 
@@ -51,7 +51,7 @@
51
51
  color: var(--global-foreground);
52
52
  /**
53
53
  * Do not edit directly
54
- * Generated on Mon, 29 Nov 2021 10:40:48 GMT
54
+ * Generated on Mon, 29 Nov 2021 11:27:03 GMT
55
55
  */
56
56
 
57
57
 
@@ -99,7 +99,7 @@
99
99
  color: var(--global-foreground);
100
100
  /**
101
101
  * Do not edit directly
102
- * Generated on Mon, 29 Nov 2021 10:40:48 GMT
102
+ * Generated on Mon, 29 Nov 2021 11:27:03 GMT
103
103
  */
104
104
 
105
105