@react-fabric/core 1.0.0-beta.3 → 1.0.0-beta.30
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/css/index.js +14 -14
- package/css/reset/_reset.css +1 -1
- package/dist/cjs/components/actionLabel/ActionLabel.js +1 -0
- package/dist/cjs/components/animations/Animations.js +14 -7
- package/dist/cjs/components/avatar/Avatar.js +8 -10
- package/dist/cjs/components/avatar/AvatarGroup.js +1 -0
- package/dist/cjs/components/badge/Badge.js +5 -4
- package/dist/cjs/components/breadcrumbs/Breadcrumbs.js +5 -2
- package/dist/cjs/components/button/Button.js +5 -4
- package/dist/cjs/components/button/Button.module.css +1 -1
- package/dist/cjs/components/button/ButtonGroup.js +3 -1
- package/dist/cjs/components/button/ConfirmButton.js +7 -2
- package/dist/cjs/components/button/ToggleButtonGroup.js +2 -1
- package/dist/cjs/components/callout/Callout.js +7 -2
- package/dist/cjs/components/card/Card.js +5 -3
- package/dist/cjs/components/card/CardCover.js +1 -1
- package/dist/cjs/components/chip/Chip.js +9 -4
- package/dist/cjs/components/chip/Chip.module.css +1 -1
- package/dist/cjs/components/collapsable/Collapsable.js +3 -2
- package/dist/cjs/components/divider/Divider.js +4 -3
- package/dist/cjs/components/divider/Divider.module.css +1 -0
- package/dist/cjs/components/dropdown/Dropdown.js +4 -2
- package/dist/cjs/components/dropdown/DropdownTool.js +4 -3
- package/dist/cjs/components/icon/Icon.js +14 -12
- package/dist/cjs/components/icon/Icon.module.css +1 -1
- package/dist/cjs/components/menu/ContextMenu.js +30 -10
- package/dist/cjs/components/menu/Menu.js +39 -20
- package/dist/cjs/components/menu/MenuItem.js +29 -14
- package/dist/cjs/components/navigator/Navigator.js +16 -9
- package/dist/cjs/components/panel/Panel.js +3 -1
- package/dist/cjs/components/progress/ProgressBar.js +2 -1
- package/dist/cjs/components/progress/ProgressCircle.js +2 -1
- package/dist/cjs/components/tabpanel/Tab.js +55 -36
- package/dist/cjs/components/tabpanel/TabPanel.js +19 -14
- package/dist/cjs/components/tabpanel/TabPanel.module.css +1 -1
- package/dist/cjs/core/aside/Aside.js +6 -2
- package/dist/cjs/core/content/Content.js +8 -5
- package/dist/cjs/core/headfoot/HeadFoot.js +3 -2
- package/dist/cjs/core/headfoot/HeadFoot.module.css +1 -1
- package/dist/cjs/core/page/Page.js +1 -0
- package/dist/cjs/core/responsive/Responsive.js +1 -1
- package/dist/cjs/core/section/Section.module.css +1 -1
- package/dist/cjs/hooks/useNavigator.js +6 -4
- package/dist/cjs/index.js +7 -2
- package/dist/cjs/overlays/alert/Alert.js +42 -17
- package/dist/cjs/overlays/alert/Alert.module.css +1 -1
- package/dist/cjs/overlays/flyout/Flyout.js +40 -42
- package/dist/cjs/overlays/message/Message.js +1 -1
- package/dist/cjs/overlays/modal/Modal.js +4 -5
- package/dist/cjs/overlays/toast/Toast.js +1 -1
- package/dist/cjs/overlays/tooltip/Tooltip.js +3 -3
- package/dist/cjs/overlays/tooltip/Tooltip.module.css +1 -1
- package/dist/cjs/types/icons.js +3 -0
- package/dist/cjs/typography/Abbr.js +1 -1
- package/dist/cjs/typography/{Link.js → Anchor.js} +4 -3
- package/dist/cjs/typography/Mark.js +1 -1
- package/dist/cjs/typography/Text.js +2 -2
- package/dist/cjs/typography/Title.js +3 -2
- package/dist/cjs/typography/Typography.module.css +1 -1
- package/dist/cjs/utils/cloneElement.js +44 -0
- package/dist/esm/components/actionLabel/ActionLabel.js +1 -0
- package/dist/esm/components/animations/Animations.js +14 -7
- package/dist/esm/components/avatar/Avatar.js +9 -11
- package/dist/esm/components/avatar/AvatarGroup.js +1 -0
- package/dist/esm/components/badge/Badge.js +5 -4
- package/dist/esm/components/breadcrumbs/Breadcrumbs.js +5 -2
- package/dist/esm/components/button/Button.js +5 -4
- package/dist/esm/components/button/Button.module.css +1 -1
- package/dist/esm/components/button/ButtonGroup.js +4 -2
- package/dist/esm/components/button/ConfirmButton.js +7 -2
- package/dist/esm/components/button/ToggleButtonGroup.js +3 -2
- package/dist/esm/components/callout/Callout.js +7 -2
- package/dist/esm/components/card/Card.js +5 -3
- package/dist/esm/components/card/CardCover.js +1 -1
- package/dist/esm/components/chip/Chip.js +9 -4
- package/dist/esm/components/chip/Chip.module.css +1 -1
- package/dist/esm/components/collapsable/Collapsable.js +3 -2
- package/dist/esm/components/divider/Divider.js +4 -3
- package/dist/esm/components/divider/Divider.module.css +1 -0
- package/dist/esm/components/dropdown/Dropdown.js +4 -2
- package/dist/esm/components/dropdown/DropdownTool.js +4 -3
- package/dist/esm/components/icon/Icon.js +14 -12
- package/dist/esm/components/icon/Icon.module.css +1 -1
- package/dist/esm/components/menu/ContextMenu.js +32 -12
- package/dist/esm/components/menu/Menu.js +41 -22
- package/dist/esm/components/menu/MenuItem.js +23 -8
- package/dist/esm/components/navigator/Navigator.js +16 -9
- package/dist/esm/components/panel/Panel.js +3 -1
- package/dist/esm/components/progress/ProgressBar.js +2 -1
- package/dist/esm/components/progress/ProgressCircle.js +2 -1
- package/dist/esm/components/tabpanel/Tab.js +56 -37
- package/dist/esm/components/tabpanel/TabPanel.js +19 -14
- package/dist/esm/components/tabpanel/TabPanel.module.css +1 -1
- package/dist/esm/core/aside/Aside.js +6 -2
- package/dist/esm/core/content/Content.js +8 -5
- package/dist/esm/core/headfoot/HeadFoot.js +3 -2
- package/dist/esm/core/headfoot/HeadFoot.module.css +1 -1
- package/dist/esm/core/page/Page.js +1 -0
- package/dist/esm/core/responsive/Responsive.js +1 -1
- package/dist/esm/core/section/Section.module.css +1 -1
- package/dist/esm/hooks/useNavigator.js +7 -5
- package/dist/esm/index.js +4 -1
- package/dist/esm/overlays/alert/Alert.js +31 -6
- package/dist/esm/overlays/alert/Alert.module.css +1 -1
- package/dist/esm/overlays/flyout/Flyout.js +41 -43
- package/dist/esm/overlays/message/Message.js +1 -1
- package/dist/esm/overlays/modal/Modal.js +5 -6
- package/dist/esm/overlays/toast/Toast.js +1 -1
- package/dist/esm/overlays/tooltip/Tooltip.js +3 -3
- package/dist/esm/overlays/tooltip/Tooltip.module.css +1 -1
- package/dist/esm/types/icons.js +3 -0
- package/dist/esm/typography/Abbr.js +1 -1
- package/dist/esm/typography/{Link.js → Anchor.js} +4 -3
- package/dist/esm/typography/Mark.js +1 -1
- package/dist/esm/typography/Text.js +2 -2
- package/dist/esm/typography/Title.js +3 -2
- package/dist/esm/typography/Typography.module.css +1 -1
- package/dist/esm/utils/cloneElement.js +44 -0
- package/dist/types/components/actionLabel/ActionLabel.d.ts +2 -2
- package/dist/types/components/animations/Animations.d.ts +1 -1
- package/dist/types/components/badge/Badge.d.ts +5 -1
- package/dist/types/components/breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/dist/types/components/button/Button.d.ts +5 -3
- package/dist/types/components/button/ConfirmButton.d.ts +6 -1
- package/dist/types/components/card/Card.d.ts +3 -3
- package/dist/types/components/chip/Chip.d.ts +1 -1
- package/dist/types/components/collapsable/Collapsable.d.ts +5 -1
- package/dist/types/components/dropdown/DropdownTool.d.ts +2 -1
- package/dist/types/components/media/Media.d.ts +2 -2
- package/dist/types/components/menu/ContextMenu.d.ts +2 -1
- package/dist/types/components/menu/MenuItem.d.ts +1 -1
- package/dist/types/components/navigator/Navigator.d.ts +3 -3
- package/dist/types/components/tabpanel/Tab.d.ts +4 -4
- package/dist/types/components/tabpanel/TabPanel.d.ts +10 -1
- package/dist/types/core/aside/Aside.d.ts +7 -3
- package/dist/types/core/content/Content.d.ts +3 -2
- package/dist/types/core/responsive/Responsive.d.ts +1 -1
- package/dist/types/core/theme/ThemeProvider.d.ts +1 -1
- package/dist/types/hooks/useOverlayService.d.ts +3 -3
- package/dist/types/index.d.ts +3 -0
- package/dist/types/overlays/alert/Alert.d.ts +9 -1
- package/dist/types/overlays/flyout/Flyout.d.ts +3 -2
- package/dist/types/overlays/modal/Modal.d.ts +4 -3
- package/dist/types/types/icons.d.ts +3 -0
- package/dist/types/types/index.d.ts +8 -1
- package/dist/types/typography/{Link.d.ts → Anchor.d.ts} +2 -2
- package/dist/types/typography/index.d.ts +1 -1
- package/dist/types/utils/cloneElement.d.ts +2 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +5 -5
- package/src/components/actionLabel/ActionLabel.tsx +13 -3
- package/src/components/animations/Animations.tsx +9 -3
- package/src/components/avatar/Avatar.tsx +69 -81
- package/src/components/avatar/AvatarGroup.tsx +1 -0
- package/src/components/badge/Badge.tsx +9 -4
- package/src/components/breadcrumbs/Breadcrumbs.tsx +9 -4
- package/src/components/button/Button.module.css +8 -1
- package/src/components/button/Button.tsx +12 -9
- package/src/components/button/ButtonGroup.tsx +3 -2
- package/src/components/button/ConfirmButton.tsx +15 -5
- package/src/components/button/ToggleButtonGroup.tsx +3 -2
- package/src/components/callout/Callout.tsx +12 -3
- package/src/components/card/Card.tsx +4 -0
- package/src/components/chip/Chip.module.css +4 -1
- package/src/components/chip/Chip.tsx +9 -4
- package/src/components/collapsable/Collapsable.tsx +6 -0
- package/src/components/divider/Divider.module.css +32 -0
- package/src/components/divider/Divider.tsx +3 -2
- package/src/components/dropdown/Dropdown.tsx +3 -2
- package/src/components/dropdown/DropdownTool.tsx +4 -2
- package/src/components/icon/Icon.module.css +0 -1
- package/src/components/icon/Icon.tsx +48 -58
- package/src/components/media/Media.tsx +2 -2
- package/src/components/menu/ContextMenu.tsx +36 -11
- package/src/components/menu/Menu.tsx +51 -30
- package/src/components/menu/MenuItem.tsx +14 -3
- package/src/components/navigator/Navigator.tsx +17 -4
- package/src/components/panel/Panel.tsx +3 -1
- package/src/components/tabpanel/Tab.tsx +74 -59
- package/src/components/tabpanel/TabPanel.module.css +19 -30
- package/src/components/tabpanel/TabPanel.tsx +33 -10
- package/src/core/aside/Aside.tsx +17 -3
- package/src/core/content/Content.tsx +16 -10
- package/src/core/headfoot/HeadFoot.module.css +2 -0
- package/src/core/headfoot/HeadFoot.tsx +1 -1
- package/src/core/page/Page.tsx +1 -0
- package/src/core/responsive/Responsive.tsx +3 -2
- package/src/core/section/Section.module.css +1 -1
- package/src/core/theme/ThemeProvider.tsx +1 -1
- package/src/hooks/useNavigator.tsx +10 -5
- package/src/hooks/useOverlayService.tsx +12 -4
- package/src/index.ts +4 -0
- package/src/overlays/alert/Alert.module.css +1 -1
- package/src/overlays/alert/Alert.tsx +30 -4
- package/src/overlays/flyout/Flyout.tsx +63 -62
- package/src/overlays/modal/Modal.tsx +13 -8
- package/src/overlays/tooltip/Tooltip.module.css +7 -7
- package/src/overlays/tooltip/Tooltip.tsx +4 -4
- package/src/types/icons.ts +6 -0
- package/src/types/index.ts +10 -9
- package/src/typography/{Link.tsx → Anchor.tsx} +3 -3
- package/src/typography/Text.tsx +1 -1
- package/src/typography/Title.tsx +0 -1
- package/src/typography/Typography.module.css +4 -2
- package/src/typography/index.ts +1 -1
- package/src/utils/cloneElement.ts +44 -0
- package/src/utils/index.ts +1 -0
|
@@ -21,8 +21,10 @@
|
|
|
21
21
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
+
import { isString } from "@react-fabric/utilities";
|
|
24
25
|
import classNames from "classnames";
|
|
25
|
-
import { type ReactElement, useMemo } from "react";
|
|
26
|
+
import { Fragment, type ReactElement, useMemo } from "react";
|
|
27
|
+
import { Tooltip } from "../../overlays";
|
|
26
28
|
import {
|
|
27
29
|
type AriaProps,
|
|
28
30
|
type BadgeType,
|
|
@@ -34,6 +36,7 @@ import {
|
|
|
34
36
|
type PolymorphicProps,
|
|
35
37
|
type RefProp,
|
|
36
38
|
type TestProps,
|
|
39
|
+
type TooltipProp,
|
|
37
40
|
} from "../../types";
|
|
38
41
|
import { Badge, getBadgeProps } from "../badge/Badge";
|
|
39
42
|
import { DropdownTool } from "../dropdown/DropdownTool";
|
|
@@ -46,7 +49,8 @@ export interface TabProps
|
|
|
46
49
|
RefProp,
|
|
47
50
|
AriaProps,
|
|
48
51
|
TestProps,
|
|
49
|
-
IconProps
|
|
52
|
+
IconProps,
|
|
53
|
+
TooltipProp {
|
|
50
54
|
/**
|
|
51
55
|
* tab id
|
|
52
56
|
*/
|
|
@@ -62,7 +66,7 @@ export interface TabProps
|
|
|
62
66
|
/**
|
|
63
67
|
* tab badge
|
|
64
68
|
*/
|
|
65
|
-
badge?: BadgeType;
|
|
69
|
+
badge?: string | number | BadgeType;
|
|
66
70
|
/**
|
|
67
71
|
* disabled
|
|
68
72
|
*/
|
|
@@ -110,6 +114,7 @@ export const Tab = <Tag extends React.ElementType = "button">({
|
|
|
110
114
|
tabFlex,
|
|
111
115
|
color,
|
|
112
116
|
actions,
|
|
117
|
+
tooltip,
|
|
113
118
|
activeClassName,
|
|
114
119
|
...aria
|
|
115
120
|
}: TabProps & PolymorphicProps<Tag>) => {
|
|
@@ -117,63 +122,73 @@ export const Tab = <Tag extends React.ElementType = "button">({
|
|
|
117
122
|
return getBadgeProps(badge);
|
|
118
123
|
}, [badge]);
|
|
119
124
|
|
|
125
|
+
const tooltipProps = useMemo(() => {
|
|
126
|
+
if (isString(tooltip)) return { content: tooltip };
|
|
127
|
+
|
|
128
|
+
return tooltip ?? {};
|
|
129
|
+
}, [tooltip]);
|
|
130
|
+
|
|
120
131
|
const E = as ?? "button";
|
|
132
|
+
const W = tooltip ? Tooltip : Fragment;
|
|
121
133
|
return (
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
className
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
"
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
e
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
134
|
+
<W {...tooltipProps}>
|
|
135
|
+
<E
|
|
136
|
+
data-id={id}
|
|
137
|
+
disabled={disabled}
|
|
138
|
+
data-color={color}
|
|
139
|
+
data-inner-clickable
|
|
140
|
+
className={classNames(
|
|
141
|
+
classes.tabButton,
|
|
142
|
+
className,
|
|
143
|
+
active && "active pointer-events-none",
|
|
144
|
+
active && activeClassName,
|
|
145
|
+
disabled && "text-tint-500 pointer-events-none",
|
|
146
|
+
tabFlex ? "flex-1" : "flex-initial max-w-36 min-w-24",
|
|
147
|
+
"flex items-center justify-center px-1 rounded overflow-hidden",
|
|
148
|
+
)}
|
|
149
|
+
onClick={() => !active && onClick?.(id)}
|
|
150
|
+
ref={ref as AnyObject}
|
|
151
|
+
{...aria}
|
|
152
|
+
>
|
|
153
|
+
{icon && (
|
|
154
|
+
<Icon
|
|
155
|
+
icon={icon}
|
|
156
|
+
bg={iconBg}
|
|
157
|
+
color={iconColor}
|
|
158
|
+
rtlFlip={rtlFlip}
|
|
159
|
+
className="flex-content"
|
|
160
|
+
/>
|
|
161
|
+
)}
|
|
162
|
+
{!minimal && (
|
|
163
|
+
<label className="flex-initial truncate text-center px-1 py-1">
|
|
164
|
+
{label}
|
|
165
|
+
</label>
|
|
166
|
+
)}
|
|
167
|
+
{badge && (
|
|
168
|
+
<Badge
|
|
169
|
+
{...badgeProps}
|
|
170
|
+
placement={minimal ? "end" : ""}
|
|
171
|
+
className={classNames("me-1", badgeProps.className)}
|
|
172
|
+
/>
|
|
173
|
+
)}
|
|
174
|
+
{actions && active && (
|
|
175
|
+
<DropdownTool className="bg-base/20 me-1 z-5">{actions}</DropdownTool>
|
|
176
|
+
)}
|
|
177
|
+
{onClose && (
|
|
178
|
+
<span
|
|
179
|
+
role="none"
|
|
180
|
+
className={classNames(
|
|
181
|
+
"cursor-pointer me-1 opacity-65 hover:opacity-90 pointer-events-auto",
|
|
182
|
+
)}
|
|
183
|
+
onClick={(e) => {
|
|
184
|
+
onClose?.();
|
|
185
|
+
e.stopPropagation();
|
|
186
|
+
}}
|
|
187
|
+
>
|
|
188
|
+
×
|
|
189
|
+
</span>
|
|
190
|
+
)}
|
|
191
|
+
</E>
|
|
192
|
+
</W>
|
|
178
193
|
);
|
|
179
194
|
};
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
.tabPanel {
|
|
26
26
|
--color: theme(colors.primary.500);
|
|
27
27
|
|
|
28
|
-
& > .
|
|
28
|
+
& > .tabHeader {
|
|
29
29
|
grid-area: tablist;
|
|
30
30
|
|
|
31
|
-
& > .tabButton {
|
|
31
|
+
& > .tabList > .tabButton {
|
|
32
32
|
&[data-color="accent"] {
|
|
33
33
|
--color: theme(colors.accent.500);
|
|
34
34
|
}
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
&[data-variant="outline"] {
|
|
67
|
-
&
|
|
67
|
+
& .tabList > .tabButton:global(.active) {
|
|
68
68
|
--active-color: theme(backgroundColor.base);
|
|
69
69
|
--active-border: 0 0 0 1px theme(borderColor.base) inset;
|
|
70
70
|
|
|
@@ -73,58 +73,47 @@
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
&[data-variant="solid"] {
|
|
76
|
-
&
|
|
76
|
+
& .tabList > .tabButton:global(.active) {
|
|
77
77
|
color: theme(colors.white);
|
|
78
78
|
background-color: var(--color);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
&[data-variant="soft"] {
|
|
83
|
-
&
|
|
83
|
+
& .tabList > .tabButton:global(.active) {
|
|
84
84
|
background-color: color-mix(in lab, var(--color) 20%, var(--fabric-bg));
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
&[data-orientation="top"] {
|
|
89
89
|
grid-template: "tablist" auto "content" 1fr / 1fr;
|
|
90
|
-
padding-inline: 2px;
|
|
91
90
|
|
|
92
|
-
|
|
93
|
-
&[data-variant="solid"] > .tabList,
|
|
94
|
-
&[data-variant="soft"] > .tabList {
|
|
91
|
+
.tabHeader {
|
|
95
92
|
box-shadow: 0 -1px 0 theme(borderColor.dimmed) inset;
|
|
96
93
|
}
|
|
97
94
|
}
|
|
98
95
|
|
|
99
96
|
&[data-orientation="bottom"] {
|
|
100
97
|
grid-template: "content" 1fr "tablist" auto / 1fr;
|
|
101
|
-
padding-inline: 2px;
|
|
102
98
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
&[data-variant="soft"] > .tabList {
|
|
99
|
+
.tabHeader {
|
|
100
|
+
margin-top: 1px;
|
|
106
101
|
box-shadow: 0 1px 0 theme(borderColor.dimmed) inset;
|
|
107
102
|
}
|
|
108
103
|
}
|
|
109
104
|
|
|
110
105
|
&[data-orientation="start"] {
|
|
111
106
|
grid-template: "tablist content" 1fr / auto 1fr;
|
|
112
|
-
padding-block: 2px;
|
|
113
107
|
|
|
114
|
-
|
|
115
|
-
&[data-variant="solid"] > .tabList,
|
|
116
|
-
&[data-variant="soft"] > .tabList {
|
|
108
|
+
.tabHeader {
|
|
117
109
|
box-shadow: -1px 0 0 theme(borderColor.dimmed) inset;
|
|
118
110
|
}
|
|
119
111
|
}
|
|
120
112
|
|
|
121
113
|
&[data-orientation="end"] {
|
|
122
114
|
grid-template: "content tablist" 1fr / 1fr auto;
|
|
123
|
-
padding-block: 2px;
|
|
124
115
|
|
|
125
|
-
|
|
126
|
-
&[data-variant="solid"] > .tabList,
|
|
127
|
-
&[data-variant="soft"] > .tabList {
|
|
116
|
+
.tabHeader {
|
|
128
117
|
box-shadow: 1px 0 0 theme(borderColor.dimmed) inset;
|
|
129
118
|
}
|
|
130
119
|
}
|
|
@@ -133,11 +122,11 @@
|
|
|
133
122
|
|
|
134
123
|
@layer util {
|
|
135
124
|
.tabPanel {
|
|
136
|
-
&
|
|
125
|
+
& .tabList > .tabButton:global(.active) {
|
|
137
126
|
pointer-events: none;
|
|
138
127
|
}
|
|
139
128
|
|
|
140
|
-
&[data-orientation="top"]
|
|
129
|
+
&[data-orientation="top"] .tabList {
|
|
141
130
|
& > .tabButton:global(.active) {
|
|
142
131
|
box-shadow:
|
|
143
132
|
0 -2px 0 var(--active-color) inset,
|
|
@@ -145,7 +134,7 @@
|
|
|
145
134
|
}
|
|
146
135
|
}
|
|
147
136
|
|
|
148
|
-
&[data-orientation="bottom"]
|
|
137
|
+
&[data-orientation="bottom"] .tabList {
|
|
149
138
|
& > .tabButton:global(.active) {
|
|
150
139
|
box-shadow:
|
|
151
140
|
0 2px 0 var(--active-color) inset,
|
|
@@ -153,7 +142,7 @@
|
|
|
153
142
|
}
|
|
154
143
|
}
|
|
155
144
|
|
|
156
|
-
&[data-orientation="start"]
|
|
145
|
+
&[data-orientation="start"] .tabList {
|
|
157
146
|
& > .tabButton:global(.active) {
|
|
158
147
|
box-shadow:
|
|
159
148
|
-2px 0 0 var(--active-color) inset,
|
|
@@ -161,7 +150,7 @@
|
|
|
161
150
|
}
|
|
162
151
|
}
|
|
163
152
|
|
|
164
|
-
&[data-orientation="end"]
|
|
153
|
+
&[data-orientation="end"] .tabList {
|
|
165
154
|
& > .tabButton:global(.active) {
|
|
166
155
|
box-shadow:
|
|
167
156
|
2px 0 0 var(--active-color) inset,
|
|
@@ -169,28 +158,28 @@
|
|
|
169
158
|
}
|
|
170
159
|
}
|
|
171
160
|
|
|
172
|
-
&[data-orientation="top"]
|
|
161
|
+
&[data-orientation="top"] .tabList > .tabButton {
|
|
173
162
|
margin-top: 2px;
|
|
174
163
|
margin-inline: 1px;
|
|
175
164
|
border-end-start-radius: 0;
|
|
176
165
|
border-end-end-radius: 0;
|
|
177
166
|
}
|
|
178
167
|
|
|
179
|
-
&[data-orientation="bottom"]
|
|
168
|
+
&[data-orientation="bottom"] .tabList > .tabButton {
|
|
180
169
|
margin-bottom: 2px;
|
|
181
170
|
margin-inline: 1px;
|
|
182
171
|
border-start-start-radius: 0;
|
|
183
172
|
border-start-end-radius: 0;
|
|
184
173
|
}
|
|
185
174
|
|
|
186
|
-
&[data-orientation="start"]
|
|
175
|
+
&[data-orientation="start"] .tabList > .tabButton {
|
|
187
176
|
margin-block: 1px;
|
|
188
177
|
margin-inline-start: 2px;
|
|
189
178
|
border-start-end-radius: 0;
|
|
190
179
|
border-end-end-radius: 0;
|
|
191
180
|
}
|
|
192
181
|
|
|
193
|
-
&[data-orientation="end"]
|
|
182
|
+
&[data-orientation="end"] .tabList > .tabButton {
|
|
194
183
|
margin-block: 1px;
|
|
195
184
|
margin-inline-end: 2px;
|
|
196
185
|
border-start-start-radius: 0;
|
|
@@ -25,6 +25,7 @@ import classNames from "classnames";
|
|
|
25
25
|
import {
|
|
26
26
|
Children,
|
|
27
27
|
cloneElement,
|
|
28
|
+
type ReactNode,
|
|
28
29
|
useCallback,
|
|
29
30
|
useEffect,
|
|
30
31
|
useMemo,
|
|
@@ -64,6 +65,14 @@ export interface TabPanelProps extends ChildrenProp<typeof Tab> {
|
|
|
64
65
|
* tab list className
|
|
65
66
|
*/
|
|
66
67
|
headerClassName?: string;
|
|
68
|
+
/**
|
|
69
|
+
* append element
|
|
70
|
+
*/
|
|
71
|
+
append?: ReactNode;
|
|
72
|
+
/**
|
|
73
|
+
* prepend element
|
|
74
|
+
*/
|
|
75
|
+
prepend?: ReactNode;
|
|
67
76
|
/**
|
|
68
77
|
* change handler
|
|
69
78
|
*/
|
|
@@ -84,6 +93,8 @@ export const TabPanel = ({
|
|
|
84
93
|
justify,
|
|
85
94
|
variant,
|
|
86
95
|
tabFlex,
|
|
96
|
+
append,
|
|
97
|
+
prepend,
|
|
87
98
|
gap,
|
|
88
99
|
onBeforeChange,
|
|
89
100
|
onChange,
|
|
@@ -132,21 +143,33 @@ export const TabPanel = ({
|
|
|
132
143
|
>
|
|
133
144
|
<div
|
|
134
145
|
className={classNames(
|
|
135
|
-
classes.
|
|
146
|
+
classes.tabHeader,
|
|
136
147
|
headerClassName,
|
|
137
148
|
justify && `justify-${justify}`,
|
|
138
149
|
["start", "end"].includes(orientation) && "flex-col",
|
|
139
|
-
"flex flex-nowrap overflow-
|
|
150
|
+
"flex flex-nowrap overflow-hidden items-center",
|
|
140
151
|
)}
|
|
141
|
-
style={{ gap }}
|
|
142
152
|
>
|
|
143
|
-
{
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
153
|
+
{prepend}
|
|
154
|
+
<div
|
|
155
|
+
className={classNames(
|
|
156
|
+
classes.tabList,
|
|
157
|
+
justify && `justify-${justify}`,
|
|
158
|
+
["start", "end"].includes(orientation) && "flex-col",
|
|
159
|
+
["bottom", "end"].includes(orientation) ? "self-start" : "self-end",
|
|
160
|
+
"flex flex-1 flex-nowrap overflow-auto scroll-thin",
|
|
161
|
+
)}
|
|
162
|
+
style={{ gap }}
|
|
163
|
+
>
|
|
164
|
+
{tabs.map((node: AnyObject) =>
|
|
165
|
+
cloneElement(node, {
|
|
166
|
+
tabFlex: node.props.tabFlex ?? tabFlex,
|
|
167
|
+
onClick: handleClick,
|
|
168
|
+
active: node.props.id === active,
|
|
169
|
+
}),
|
|
170
|
+
)}
|
|
171
|
+
</div>
|
|
172
|
+
{append}
|
|
150
173
|
</div>
|
|
151
174
|
{rest}
|
|
152
175
|
{activeTabPanel}
|
package/src/core/aside/Aside.tsx
CHANGED
|
@@ -23,12 +23,12 @@
|
|
|
23
23
|
|
|
24
24
|
import classNames from "classnames";
|
|
25
25
|
import {
|
|
26
|
-
type ReactNode,
|
|
27
26
|
useCallback,
|
|
28
27
|
useEffect,
|
|
29
28
|
useMemo,
|
|
30
29
|
useRef,
|
|
31
30
|
useState,
|
|
31
|
+
type ReactNode,
|
|
32
32
|
} from "react";
|
|
33
33
|
import { Loading } from "../../components/animations/Animations";
|
|
34
34
|
import { Icon } from "../../components/icon/Icon";
|
|
@@ -38,6 +38,7 @@ import { useResize } from "../../hooks/useResize";
|
|
|
38
38
|
import {
|
|
39
39
|
type ChildrenProp,
|
|
40
40
|
type CollapseProps,
|
|
41
|
+
type CssProp,
|
|
41
42
|
type Elements,
|
|
42
43
|
type IconProps,
|
|
43
44
|
type TestProps,
|
|
@@ -50,6 +51,7 @@ export interface AsideProps
|
|
|
50
51
|
extends IconProps,
|
|
51
52
|
ChildrenProp,
|
|
52
53
|
CollapseProps,
|
|
54
|
+
CssProp,
|
|
53
55
|
TestProps {
|
|
54
56
|
/**
|
|
55
57
|
* page title
|
|
@@ -67,6 +69,10 @@ export interface AsideProps
|
|
|
67
69
|
* header class
|
|
68
70
|
*/
|
|
69
71
|
headerClassName?: string;
|
|
72
|
+
/**
|
|
73
|
+
* header class
|
|
74
|
+
*/
|
|
75
|
+
bodyClassName?: string;
|
|
70
76
|
|
|
71
77
|
/**
|
|
72
78
|
* show loading indicator
|
|
@@ -109,6 +115,8 @@ export const Aside = ({
|
|
|
109
115
|
iconBg,
|
|
110
116
|
iconColor,
|
|
111
117
|
rtlFlip,
|
|
118
|
+
className,
|
|
119
|
+
bodyClassName,
|
|
112
120
|
headerClassName,
|
|
113
121
|
resizeable,
|
|
114
122
|
flyout,
|
|
@@ -189,9 +197,10 @@ export const Aside = ({
|
|
|
189
197
|
|
|
190
198
|
return (
|
|
191
199
|
<aside
|
|
192
|
-
className={classNames(classes.aside, "overflow-hidden grid")}
|
|
200
|
+
className={classNames(classes.aside, className, "overflow-hidden grid")}
|
|
193
201
|
data-align={align}
|
|
194
202
|
data-flyout={peek}
|
|
203
|
+
data-loading={loading}
|
|
195
204
|
data-collapsed={isCollapsed}
|
|
196
205
|
style={isCollapsed ? undefined : widthStyles}
|
|
197
206
|
data-testid={testId}
|
|
@@ -203,6 +212,7 @@ export const Aside = ({
|
|
|
203
212
|
headerClassName,
|
|
204
213
|
"grid area-head items-center",
|
|
205
214
|
)}
|
|
215
|
+
data-ref="asideHeader"
|
|
206
216
|
>
|
|
207
217
|
{title && (
|
|
208
218
|
<div
|
|
@@ -250,7 +260,11 @@ export const Aside = ({
|
|
|
250
260
|
<section
|
|
251
261
|
ref={elementRef}
|
|
252
262
|
data-ref="asideBody"
|
|
253
|
-
className={classNames(
|
|
263
|
+
className={classNames(
|
|
264
|
+
classes.asideBody,
|
|
265
|
+
bodyClassName,
|
|
266
|
+
"overflow-hidden grid",
|
|
267
|
+
)}
|
|
254
268
|
style={isCollapsed ? widthStyles : undefined}
|
|
255
269
|
>
|
|
256
270
|
<ErrorBoundary>{children}</ErrorBoundary>
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import classNames from "classnames";
|
|
25
|
-
import { useImperativeHandle } from "react";
|
|
25
|
+
import { type MouseEvent, useImperativeHandle } from "react";
|
|
26
26
|
import { useDebounce } from "../../hooks/useDebounce";
|
|
27
27
|
import { useResizeObserver } from "../../hooks/useResizeObserver";
|
|
28
28
|
import {
|
|
29
29
|
type ChildrenProp,
|
|
30
30
|
type CssProp,
|
|
31
|
-
type PositionObject,
|
|
32
31
|
type RefProp,
|
|
32
|
+
type ScrollObject,
|
|
33
33
|
type SizeObject,
|
|
34
34
|
type TestProps,
|
|
35
35
|
} from "../../types";
|
|
@@ -44,7 +44,7 @@ export interface ContentProps
|
|
|
44
44
|
/**
|
|
45
45
|
* scroll vevent handler
|
|
46
46
|
*/
|
|
47
|
-
onScroll?: (event:
|
|
47
|
+
onScroll?: (scroll: ScrollObject, event: MouseEvent<HTMLDivElement>) => void;
|
|
48
48
|
/**
|
|
49
49
|
* scroll vevent handler
|
|
50
50
|
*/
|
|
@@ -65,13 +65,19 @@ export const Content = ({
|
|
|
65
65
|
}: ContentProps) => {
|
|
66
66
|
const resizeHandle = useResizeObserver(onResize);
|
|
67
67
|
const scrollHandler = useDebounce(
|
|
68
|
-
(e:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
(e: MouseEvent<HTMLDivElement>) => {
|
|
69
|
+
const el = e.target as HTMLElement;
|
|
70
|
+
onScroll?.(
|
|
71
|
+
{
|
|
72
|
+
left: el.scrollLeft,
|
|
73
|
+
top: el.scrollTop,
|
|
74
|
+
scrollHeight: el.scrollHeight,
|
|
75
|
+
scrollWidth: el.scrollWidth,
|
|
76
|
+
width: el.offsetWidth,
|
|
77
|
+
height: el.offsetHeight,
|
|
78
|
+
},
|
|
79
|
+
e,
|
|
80
|
+
);
|
|
75
81
|
},
|
|
76
82
|
[onScroll],
|
|
77
83
|
);
|
|
@@ -93,7 +93,7 @@ const HeadFoot = ({
|
|
|
93
93
|
color && getColorClass(color),
|
|
94
94
|
area === "head" ? "area-head" : "area-foot",
|
|
95
95
|
`leading-none`,
|
|
96
|
-
flex && "flex flex-nowrap
|
|
96
|
+
flex && "flex flex-nowrap",
|
|
97
97
|
align && `items-${align}`,
|
|
98
98
|
justify && `justify-${justify}`,
|
|
99
99
|
)}
|
package/src/core/page/Page.tsx
CHANGED
|
@@ -81,7 +81,7 @@ export interface ColProps
|
|
|
81
81
|
/**
|
|
82
82
|
* column flex
|
|
83
83
|
*/
|
|
84
|
-
flex?: "auto" | "fill" | "full";
|
|
84
|
+
flex?: "auto" | "fill" | "full" | "content";
|
|
85
85
|
/**
|
|
86
86
|
* stretch inner content
|
|
87
87
|
*/
|
|
@@ -159,9 +159,10 @@ export const Col = ({
|
|
|
159
159
|
classes.col,
|
|
160
160
|
className,
|
|
161
161
|
stretchContent && classes.stretchContent,
|
|
162
|
-
flex === "auto" && "flex-content",
|
|
163
162
|
flex === "fill" && "flex-1",
|
|
164
163
|
flex === "full" && "flex-full",
|
|
164
|
+
flex === "auto" && "flex-initial",
|
|
165
|
+
flex === "content" && "flex-content",
|
|
165
166
|
align && `self-${align}`,
|
|
166
167
|
)}
|
|
167
168
|
{...aria}
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
@layer comp {
|
|
25
25
|
.section {
|
|
26
|
-
grid-template: "head head head" auto "side-s content side-e" 1fr "foot foot foot" auto / auto 1fr auto;
|
|
26
|
+
grid-template: ". loader ." auto "head head head" auto "side-s content side-e" 1fr "foot foot foot" auto / auto 1fr auto;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -21,24 +21,29 @@
|
|
|
21
21
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import { useCallback, useMemo, useState } from "react";
|
|
24
|
+
import { useCallback, useMemo, useRef, useState } from "react";
|
|
25
25
|
|
|
26
26
|
export const useNavigator = (totalCount = 0, defaultIndex = 0) => {
|
|
27
27
|
const [currentIndex, setCurrentIndex] = useState(defaultIndex);
|
|
28
|
+
const refCurrent = useRef(defaultIndex);
|
|
29
|
+
|
|
28
30
|
const onNavigate = useCallback(
|
|
29
31
|
(dir: 1 | -1) => {
|
|
30
32
|
if (dir === -1) {
|
|
31
|
-
|
|
33
|
+
refCurrent.current =
|
|
34
|
+
refCurrent.current > 0 ? refCurrent.current - 1 : totalCount - 1;
|
|
32
35
|
}
|
|
33
36
|
if (dir === 1) {
|
|
34
|
-
|
|
37
|
+
refCurrent.current =
|
|
38
|
+
refCurrent.current + 1 < totalCount ? refCurrent.current + 1 : 0;
|
|
35
39
|
}
|
|
40
|
+
setCurrentIndex(refCurrent.current);
|
|
36
41
|
},
|
|
37
|
-
[
|
|
42
|
+
[totalCount],
|
|
38
43
|
);
|
|
39
44
|
const headLabel = useMemo(
|
|
40
45
|
() => (
|
|
41
|
-
<span className="text-muted leading-none">
|
|
46
|
+
<span className="text-muted leading-none select-none">
|
|
42
47
|
{currentIndex + 1}/{totalCount}
|
|
43
48
|
</span>
|
|
44
49
|
),
|
|
@@ -21,10 +21,15 @@
|
|
|
21
21
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
useState,
|
|
26
|
+
type ComponentProps,
|
|
27
|
+
type ElementType,
|
|
28
|
+
type ReactNode,
|
|
29
|
+
} from "react";
|
|
25
30
|
|
|
26
|
-
type OverlayComponent =
|
|
27
|
-
onClose: (args
|
|
31
|
+
type OverlayComponent = ElementType<{
|
|
32
|
+
onClose: (...args: AnyObject) => void;
|
|
28
33
|
[key: string]: AnyObject;
|
|
29
34
|
}>;
|
|
30
35
|
|
|
@@ -36,7 +41,10 @@ export const useOverlayService = (
|
|
|
36
41
|
] => {
|
|
37
42
|
const [Overlay, setOverlay] = useState<ReactNode | null>(null);
|
|
38
43
|
|
|
39
|
-
const openOverlay = async ({
|
|
44
|
+
const openOverlay = async ({
|
|
45
|
+
onClose,
|
|
46
|
+
...props
|
|
47
|
+
}: ComponentProps<typeof ModalOrFlyout> = {}) => {
|
|
40
48
|
return await new Promise((resolve) => {
|
|
41
49
|
const handleClose = (args: AnyObject) => {
|
|
42
50
|
setOverlay(null);
|