@wonderflow/react-components 2.38.0-next.8 → 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/button/button.module.css +16 -10
- package/card/card.d.ts +2 -0
- package/card/card.js +3 -3
- package/card/card.module.css +18 -1
- package/core/vibrancy.css +27 -0
- package/package.json +5 -5
- package/select/select.module.css +10 -10
- package/selection-controls/selection-controls.module.css +8 -5
- package/tab/index.d.ts +1 -1
- package/tab/tab-item.d.ts +8 -0
- package/tab/tab-item.js +20 -0
- package/tab/tab-list.d.ts +3 -0
- package/tab/tab-list.js +7 -0
- package/tab/tab-panel.d.ts +10 -0
- package/tab/tab-panel.js +10 -0
- package/tab/tab.d.ts +11 -14
- package/tab/tab.js +11 -38
- package/textfield/base-field/base-field.module.css +5 -3
- package/themes/dark.css +1 -1
- package/themes/light.css +1 -1
- package/themes.css +3 -3
package/button/button.module.css
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@import '../core/vibrancy.css';
|
|
2
|
+
|
|
1
3
|
.Button {
|
|
2
4
|
box-sizing: border-box;
|
|
3
5
|
user-select: none;
|
|
@@ -59,12 +61,14 @@
|
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
&[data-button-kind='secondary'] {
|
|
64
|
+
|
|
65
|
+
@mixin vibrancy;
|
|
66
|
+
|
|
62
67
|
color: var(--global-vibrancy-foreground);
|
|
63
|
-
backdrop-filter: blur(32px);
|
|
64
|
-
background-color: var(--global-vibrancy-background);
|
|
65
68
|
|
|
66
69
|
&:is(:active) {
|
|
67
|
-
|
|
70
|
+
|
|
71
|
+
@mixin vibrancy-hover;
|
|
68
72
|
}
|
|
69
73
|
|
|
70
74
|
&[aria-pressed='true'],
|
|
@@ -78,13 +82,15 @@
|
|
|
78
82
|
color: var(--global-foreground);
|
|
79
83
|
|
|
80
84
|
&:is(:active) {
|
|
81
|
-
|
|
82
|
-
|
|
85
|
+
|
|
86
|
+
@mixin vibrancy-hover;
|
|
83
87
|
}
|
|
84
88
|
|
|
85
89
|
&:is(:hover, :focus):not(:active) {
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
|
|
91
|
+
@mixin vibrancy;
|
|
92
|
+
|
|
93
|
+
color: var(--global-vibrancy-foreground);
|
|
88
94
|
}
|
|
89
95
|
|
|
90
96
|
&[aria-pressed='true'],
|
|
@@ -105,9 +111,9 @@
|
|
|
105
111
|
|
|
106
112
|
&[data-button-disabled='true'],
|
|
107
113
|
&[data-button-disabled='true']:is(:hover, :focus) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
114
|
+
|
|
115
|
+
@mixin vibrancy-disabled;
|
|
116
|
+
|
|
111
117
|
cursor: not-allowed;
|
|
112
118
|
}
|
|
113
119
|
|
package/card/card.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export declare type CardProps = PropsWithClass & Pick<StackProps, 'wrap' | 'colu
|
|
|
8
8
|
bordered?: boolean;
|
|
9
9
|
radius?: false | TokensTypes['radius'];
|
|
10
10
|
dimmed?: 1 | 2 | 3;
|
|
11
|
+
vibrant?: boolean;
|
|
12
|
+
highlightOnHover?: boolean;
|
|
11
13
|
};
|
|
12
14
|
declare type PolymorphicCard = Polymorphic.ForwardRefComponent<'div', CardProps>;
|
|
13
15
|
export declare const Card: PolymorphicCard;
|
package/card/card.js
CHANGED
|
@@ -3,14 +3,14 @@ import tkns from '@wonderflow/tokens/platforms/web/tokens.json';
|
|
|
3
3
|
import { Stack } from '../';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { Card as CardClass, Left, Content, Right } from './card.module.css';
|
|
6
|
-
export const Card = forwardRef(({ as: Wrapper = 'div', children, className, padding = 24, radius = 8, left, right, dimmed, bordered, columnGap = 24, rowGap = 24, verticalAlign = 'start', horizontalAlign = 'space-between', wrap, style, ...props }, forwardedRef) => {
|
|
6
|
+
export const Card = forwardRef(({ as: Wrapper = 'div', children, className, padding = 24, radius = 8, left, right, dimmed, bordered, columnGap = 24, rowGap = 24, verticalAlign = 'start', horizontalAlign = 'space-between', vibrant = false, highlightOnHover = false, wrap, style, ...props }, forwardedRef) => {
|
|
7
7
|
const dynamicStyle = {
|
|
8
8
|
'--padding': padding && tkns.space[padding],
|
|
9
9
|
'--radius': radius && tkns.radius[radius]
|
|
10
10
|
};
|
|
11
|
-
return (React.createElement(Wrapper, { ref: forwardedRef, className: clsx(CardClass, className), style: { ...dynamicStyle, ...style }, "data-card-dimmed": dimmed, "data-card-bordered": bordered, ...props },
|
|
11
|
+
return (React.createElement(Wrapper, { ref: forwardedRef, className: clsx(CardClass, className), style: { ...dynamicStyle, ...style }, "data-card-dimmed": dimmed, "data-card-bordered": bordered, "data-card-vibrant": vibrant, "data-card-highlight-hover": highlightOnHover, ...props },
|
|
12
12
|
React.createElement(Stack, { direction: "row", fill: false, verticalAlign: verticalAlign, horizontalAlign: horizontalAlign, columnGap: columnGap, rowGap: rowGap, wrap: wrap },
|
|
13
13
|
left && React.createElement("div", { className: Left }, left),
|
|
14
|
-
children && (React.createElement(
|
|
14
|
+
children && (React.createElement("div", { className: Content }, children)),
|
|
15
15
|
right && (React.createElement(Stack, { className: Right }, right)))));
|
|
16
16
|
});
|
package/card/card.module.css
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@import '../core/vibrancy.css';
|
|
2
|
+
|
|
1
3
|
:where(.Card) {
|
|
2
4
|
background: var(--global-background);
|
|
3
5
|
padding: var(--padding);
|
|
@@ -9,16 +11,31 @@
|
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
&[data-card-dimmed='2'] {
|
|
12
|
-
background: var(--dimmed-
|
|
14
|
+
background: var(--dimmed-1);
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
&[data-card-dimmed='3'] {
|
|
16
18
|
background: var(--dimmed-2);
|
|
17
19
|
}
|
|
18
20
|
|
|
21
|
+
&[data-card-vibrant='true'] {
|
|
22
|
+
|
|
23
|
+
@mixin vibrancy;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&[data-card-highlight-hover='true'][data-card-vibrant='true']:hover,
|
|
27
|
+
&[data-card-highlight-hover='true'][data-card-vibrant='true']:focus-visible {
|
|
28
|
+
|
|
29
|
+
@mixin vibrancy-hover;
|
|
30
|
+
}
|
|
31
|
+
|
|
19
32
|
&[data-card-bordered='true'] {
|
|
20
33
|
border: solid 1px var(--dimmed-1);
|
|
21
34
|
}
|
|
35
|
+
|
|
36
|
+
&[data-card-vibrant='true'][data-card-bordered='true'] {
|
|
37
|
+
border: solid 1px var(--dimmed-2);
|
|
38
|
+
}
|
|
22
39
|
}
|
|
23
40
|
|
|
24
41
|
.Left {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
@define-mixin vibrancy {
|
|
2
|
+
backdrop-filter: saturate(180%) blur(62px);
|
|
3
|
+
background:
|
|
4
|
+
linear-gradient(
|
|
5
|
+
to bottom,
|
|
6
|
+
var(--global-vibrancy-background),
|
|
7
|
+
var(--global-vibrancy-background)
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
@define-mixin vibrancy-hover {
|
|
11
|
+
background:
|
|
12
|
+
linear-gradient(
|
|
13
|
+
to bottom,
|
|
14
|
+
var(--global-vibrancy-background-hover),
|
|
15
|
+
var(--global-vibrancy-background-hover)
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
@define-mixin vibrancy-disabled {
|
|
19
|
+
color: var(--global-disabled-foreground);
|
|
20
|
+
backdrop-filter: saturate(180%) blur(62px);
|
|
21
|
+
background:
|
|
22
|
+
linear-gradient(
|
|
23
|
+
to bottom,
|
|
24
|
+
var(--global-disabled-background),
|
|
25
|
+
var(--global-disabled-background)
|
|
26
|
+
);
|
|
27
|
+
}
|
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": "
|
|
4
|
+
"version": "3.0.0-next.2",
|
|
5
5
|
"author": "Wonderflow",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "index.js",
|
|
@@ -56,14 +56,14 @@
|
|
|
56
56
|
"postbuild": "copyfiles package.json dist"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@react-aria/interactions": "3.
|
|
59
|
+
"@react-aria/interactions": "3.7.0",
|
|
60
60
|
"@wonderflow/eslint-config": "1.1.5",
|
|
61
61
|
"@wonderflow/stylelint-config": "1.0.3",
|
|
62
62
|
"@wonderflow/tokens": "1.3.6",
|
|
63
63
|
"clsx": "1.1.1",
|
|
64
64
|
"flat": "5.0.2",
|
|
65
65
|
"framer-motion": "4.1.17",
|
|
66
|
-
"postcss": "8.4.
|
|
66
|
+
"postcss": "8.4.1",
|
|
67
67
|
"react": ">=17.0.2",
|
|
68
68
|
"react-data-table-component": "7.4.5",
|
|
69
69
|
"react-dom": ">=17.0.2",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"@semantic-release/git": "10.0.1",
|
|
91
91
|
"@semantic-release/github": "8.0.2",
|
|
92
92
|
"@semantic-release/npm": "8.0.3",
|
|
93
|
-
"@semantic-release/release-notes-generator": "10.0.
|
|
93
|
+
"@semantic-release/release-notes-generator": "10.0.3",
|
|
94
94
|
"@storybook/addon-actions": "6.3.12",
|
|
95
95
|
"@storybook/addon-essentials": "6.3.12",
|
|
96
96
|
"@storybook/addon-links": "6.3.12",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"@types/react-dom": "17.0.11",
|
|
103
103
|
"@typescript-eslint/eslint-plugin": "5.4.0",
|
|
104
104
|
"@typescript-eslint/parser": "5.4.0",
|
|
105
|
-
"@wonderflow/config": "1.5.
|
|
105
|
+
"@wonderflow/config": "1.5.5",
|
|
106
106
|
"babel-loader": "8.2.3",
|
|
107
107
|
"commit-analyzer-fail-on-no-release": "1.0.0",
|
|
108
108
|
"commitizen": "4.2.4",
|
package/select/select.module.css
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@import '../core/vibrancy.css';
|
|
2
|
+
|
|
1
3
|
.Select {
|
|
2
4
|
appearance: none;
|
|
3
5
|
position: relative;
|
|
@@ -33,6 +35,9 @@
|
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
.Field {
|
|
38
|
+
|
|
39
|
+
@mixin vibrancy;
|
|
40
|
+
|
|
36
41
|
margin: 0;
|
|
37
42
|
border: 0;
|
|
38
43
|
text-overflow: ellipsis;
|
|
@@ -45,14 +50,7 @@
|
|
|
45
50
|
inline-size: 100%;
|
|
46
51
|
box-sizing: border-box;
|
|
47
52
|
overflow: hidden;
|
|
48
|
-
backdrop-filter: blur(32px);
|
|
49
53
|
color: inherit;
|
|
50
|
-
background:
|
|
51
|
-
linear-gradient(
|
|
52
|
-
to bottom,
|
|
53
|
-
var(--global-vibrancy-background),
|
|
54
|
-
var(--global-vibrancy-background)
|
|
55
|
-
);
|
|
56
54
|
block-size: var(--field-height);
|
|
57
55
|
padding:
|
|
58
56
|
0
|
|
@@ -61,9 +59,9 @@
|
|
|
61
59
|
var(--field-padding);
|
|
62
60
|
|
|
63
61
|
&:disabled {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
|
|
63
|
+
@mixin vibrancy-disabled;
|
|
64
|
+
|
|
67
65
|
cursor: not-allowed;
|
|
68
66
|
}
|
|
69
67
|
|
|
@@ -81,6 +79,7 @@
|
|
|
81
79
|
overflow: auto;
|
|
82
80
|
|
|
83
81
|
& option {
|
|
82
|
+
color: currentColor;
|
|
84
83
|
padding: calc(var(--field-padding) / 2) var(--field-padding);
|
|
85
84
|
}
|
|
86
85
|
|
|
@@ -91,6 +90,7 @@
|
|
|
91
90
|
}
|
|
92
91
|
|
|
93
92
|
& optgroup {
|
|
93
|
+
color: currentColor;
|
|
94
94
|
margin: 0 0 1rem;
|
|
95
95
|
font-family: inherit;
|
|
96
96
|
font-size: inherit;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
@import '../core/vibrancy.css';
|
|
2
|
+
|
|
1
3
|
.Checkbox {
|
|
2
4
|
--w: 24px;
|
|
3
5
|
--h: 24px;
|
|
4
6
|
|
|
7
|
+
@mixin vibrancy;
|
|
8
|
+
|
|
5
9
|
appearance: none;
|
|
6
10
|
inline-size: var(--w);
|
|
7
11
|
block-size: var(--h);
|
|
8
12
|
max-inline-size: var(--w);
|
|
9
13
|
max-block-size: var(--h);
|
|
10
|
-
backdrop-filter: blur(32px);
|
|
11
|
-
background-color: var(--global-vibrancy-background);
|
|
12
14
|
color: var(--global-background);
|
|
13
15
|
border-radius: env(--radius-4);
|
|
14
16
|
position: relative;
|
|
@@ -32,7 +34,7 @@
|
|
|
32
34
|
|
|
33
35
|
&:checked,
|
|
34
36
|
&[data-control-indeterminate='true'] {
|
|
35
|
-
background
|
|
37
|
+
background: var(--dimmed-7);
|
|
36
38
|
|
|
37
39
|
&::after {
|
|
38
40
|
display: block;
|
|
@@ -40,8 +42,9 @@
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
&:disabled {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
|
|
46
|
+
@mixin vibrancy-disabled;
|
|
47
|
+
|
|
45
48
|
cursor: not-allowed;
|
|
46
49
|
}
|
|
47
50
|
|
package/tab/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Tab } from './tab';
|
|
2
|
-
export type { TabProps
|
|
2
|
+
export type { TabProps } from './tab';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { IconNames } from '../icons/types';
|
|
3
|
+
export declare type TabItemProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
4
|
+
icon?: IconNames;
|
|
5
|
+
};
|
|
6
|
+
export declare const TabItem: React.ForwardRefExoticComponent<React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
7
|
+
icon?: IconNames | undefined;
|
|
8
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
package/tab/tab-item.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { useCallback, useRef, forwardRef } from 'react';
|
|
2
|
+
import { useRovingTabIndex, useFocusEffect } from 'react-roving-tabindex';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { Stack, Icon } from '../';
|
|
5
|
+
import { useTabState } from './primitive-tab';
|
|
6
|
+
import { TabItem as TabItemClass } from './tab.module.css';
|
|
7
|
+
export const TabItem = forwardRef(({ children, className, icon, ...props }, forwardedRef) => {
|
|
8
|
+
const { onClick, isActive } = useTabState(children);
|
|
9
|
+
const internalRef = useRef(forwardedRef);
|
|
10
|
+
const [, focused, handleKeyDown, handleClick] = useRovingTabIndex(internalRef, false);
|
|
11
|
+
useFocusEffect(focused, internalRef);
|
|
12
|
+
const fireClick = useCallback(() => {
|
|
13
|
+
onClick();
|
|
14
|
+
handleClick();
|
|
15
|
+
}, [handleClick, onClick]);
|
|
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
|
+
icon && React.createElement(Icon, { name: icon, dimension: 16 }),
|
|
18
|
+
children));
|
|
19
|
+
});
|
|
20
|
+
TabItem.displayName = 'Tab.Item';
|
package/tab/tab-list.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import { RovingTabIndexProvider } from 'react-roving-tabindex';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { TabList as TabListClass } from './tab.module.css';
|
|
5
|
+
export const TabList = forwardRef(({ children, className, ...props }, forwardedRef) => (React.createElement("div", { ref: forwardedRef, role: "tablist", tabIndex: -1, className: clsx(TabListClass, className), ...props },
|
|
6
|
+
React.createElement(RovingTabIndexProvider, null, children))));
|
|
7
|
+
TabList.displayName = 'Tab.List';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { IconNames } from '../icons/types';
|
|
3
|
+
export declare type TabPanelProps = PropsWithClass & {
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
icon?: IconNames;
|
|
6
|
+
};
|
|
7
|
+
export declare const TabPanel: React.ForwardRefExoticComponent<PropsWithClass & {
|
|
8
|
+
label: ReactNode;
|
|
9
|
+
icon?: IconNames | undefined;
|
|
10
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
package/tab/tab-panel.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { usePanelState } from './primitive-tab';
|
|
4
|
+
import { TabPanel as TabPanelClass } from './tab.module.css';
|
|
5
|
+
export const TabPanel = forwardRef(({ children, className, ...props }, forwardedRef) => {
|
|
6
|
+
const isActive = usePanelState(children);
|
|
7
|
+
return isActive
|
|
8
|
+
? (React.createElement("div", { ref: forwardedRef, tabIndex: 0, className: clsx(TabPanelClass, className), ...props }, children))
|
|
9
|
+
: null;
|
|
10
|
+
});
|
package/tab/tab.d.ts
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import React, { ReactNode
|
|
2
|
-
import {
|
|
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 '../';
|
|
3
6
|
export declare type TabProps = PropsWithClass & {
|
|
4
7
|
children: ReactNode;
|
|
5
8
|
state?: [number, React.Dispatch<React.SetStateAction<number>>];
|
|
6
9
|
onChange?(index: number): void;
|
|
7
10
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export declare type TabItemProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
13
|
-
icon?: IconNames;
|
|
14
|
-
};
|
|
15
|
-
export declare const Tab: {
|
|
16
|
-
Root: React.FC<TabProps>;
|
|
17
|
-
List: React.FC<PropsWithClass>;
|
|
18
|
-
Item: React.FC<TabItemProps>;
|
|
19
|
-
Panel: React.FC<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>>;
|
|
20
15
|
};
|
|
16
|
+
export declare const Tab: TabComponent;
|
|
17
|
+
export {};
|
package/tab/tab.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { useRovingTabIndex, useFocusEffect, RovingTabIndexProvider } from 'react-roving-tabindex';
|
|
1
|
+
import React, { useEffect, useState, forwardRef, Children, cloneElement } from 'react';
|
|
3
2
|
import clsx from 'clsx';
|
|
4
3
|
import { useUIDSeed } from 'react-uid';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
4
|
+
import { TabItem } from './tab-item';
|
|
5
|
+
import { TabList } from './tab-list';
|
|
6
|
+
import { TabPanel } from './tab-panel';
|
|
7
|
+
import { Tabs as TabsWrapper } from './primitive-tab';
|
|
8
|
+
import { Tab as TabClass } from './tab.module.css';
|
|
9
|
+
export const Tab = forwardRef(({ children, className, state, onChange, ...props }, forwardedRef) => {
|
|
9
10
|
const renderedChildren = Children.toArray(children).filter(Boolean);
|
|
10
11
|
const innerState = useState(0);
|
|
11
12
|
const tabState = state || innerState;
|
|
@@ -18,40 +19,12 @@ const TabRoot = forwardRef(({ children, className, state, onChange, ...props },
|
|
|
18
19
|
}, [currentTab, onChange]);
|
|
19
20
|
return (React.createElement("div", { ref: forwardedRef, className: clsx(TabClass, className), ...props },
|
|
20
21
|
React.createElement(TabsWrapper, { state: tabState },
|
|
21
|
-
React.createElement(TabList, null, Children.map(renderedChildren, (child, index) => (React.createElement(
|
|
22
|
+
React.createElement(TabList, null, Children.map(renderedChildren, (child, index) => (React.createElement(TabItem, { id: seedID(`tab-item-${index}`), "aria-controls": seedID(`tab-panel-${index}`), icon: child.props.icon }, child.props.label)))),
|
|
22
23
|
Children.map(renderedChildren, (child, index) => cloneElement(child, {
|
|
23
24
|
id: seedID(`tab-panel-${index}`),
|
|
24
25
|
'aria-labelledby': seedID(`tab-item-${index}`)
|
|
25
26
|
})))));
|
|
26
27
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const isActive = usePanelState(children);
|
|
31
|
-
return isActive
|
|
32
|
-
? (React.createElement("div", { ref: forwardedRef, tabIndex: 0, className: clsx(TabPanelClass, className), ...props }, children))
|
|
33
|
-
: null;
|
|
34
|
-
});
|
|
35
|
-
const TabItem = ({ children, className, icon, ...props }) => {
|
|
36
|
-
const { onClick, isActive } = useTabState(children);
|
|
37
|
-
const internalRef = useRef(null);
|
|
38
|
-
const [, focused, handleKeyDown, handleClick] = useRovingTabIndex(internalRef, false);
|
|
39
|
-
useFocusEffect(focused, internalRef);
|
|
40
|
-
const fireClick = useCallback(() => {
|
|
41
|
-
onClick();
|
|
42
|
-
handleClick();
|
|
43
|
-
}, [handleClick, onClick]);
|
|
44
|
-
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 },
|
|
45
|
-
icon && React.createElement(Icon, { name: icon, dimension: 16 }),
|
|
46
|
-
children));
|
|
47
|
-
};
|
|
48
|
-
export const Tab = {
|
|
49
|
-
Root: TabRoot,
|
|
50
|
-
List: TabList,
|
|
51
|
-
Item: TabItem,
|
|
52
|
-
Panel: TabPanel
|
|
53
|
-
};
|
|
54
|
-
Tab.Root.displayName = 'Tab.Root';
|
|
55
|
-
Tab.List.displayName = 'Tab.List';
|
|
56
|
-
Tab.Panel.displayName = 'Tab.Panel';
|
|
57
|
-
Tab.Item.displayName = 'Tab.Item';
|
|
28
|
+
Tab.Panel = TabPanel;
|
|
29
|
+
Tab.Item = TabItem;
|
|
30
|
+
Tab.List = TabList;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@import '../../core/vibrancy.css';
|
|
2
|
+
|
|
1
3
|
.BaseField {
|
|
2
4
|
margin: 0;
|
|
3
5
|
text-overflow: ellipsis;
|
|
@@ -37,9 +39,9 @@
|
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
&:disabled {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
|
|
43
|
+
@mixin vibrancy-disabled;
|
|
44
|
+
|
|
43
45
|
cursor: not-allowed;
|
|
44
46
|
border-color: transparent;
|
|
45
47
|
|
package/themes/dark.css
CHANGED
package/themes/light.css
CHANGED
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
|
|
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
|
|
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
|
|
102
|
+
* Generated on Mon, 29 Nov 2021 11:27:03 GMT
|
|
103
103
|
*/
|
|
104
104
|
|
|
105
105
|
|