@react-fabric/core 1.0.0-beta.0 → 1.0.0-beta.11
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 +13 -13
- package/dist/cjs/components/actionLabel/ActionLabel.js +1 -0
- package/dist/cjs/components/animations/Animations.js +13 -6
- package/dist/cjs/components/avatar/Avatar.js +6 -7
- package/dist/cjs/components/badge/Badge.js +6 -4
- package/dist/cjs/components/breadcrumbs/Breadcrumbs.js +2 -2
- package/dist/cjs/components/button/Button.js +9 -7
- package/dist/cjs/components/button/Button.module.css +1 -1
- package/dist/cjs/components/button/ConfirmButton.js +4 -2
- package/dist/cjs/components/callout/Callout.js +3 -2
- package/dist/cjs/components/card/Card.js +4 -2
- package/dist/cjs/components/chip/Chip.js +2 -2
- package/dist/cjs/components/chip/Chip.module.css +1 -1
- package/dist/cjs/components/collapsable/Collapsable.js +5 -3
- package/dist/cjs/components/divider/Divider.js +3 -2
- package/dist/cjs/components/divider/Divider.module.css +1 -0
- package/dist/cjs/components/dropdown/Dropdown.js +3 -1
- package/dist/cjs/components/dropdown/DropdownTool.js +4 -2
- package/dist/cjs/components/icon/Icon.js +8 -7
- package/dist/cjs/components/menu/ContextMenu.js +30 -10
- package/dist/cjs/components/menu/Menu.js +1 -1
- package/dist/cjs/components/menu/MenuItem.js +1 -1
- package/dist/cjs/components/navigator/Navigator.js +15 -9
- package/dist/cjs/components/panel/Panel.js +2 -0
- package/dist/cjs/components/tabpanel/Tab.js +55 -36
- package/dist/cjs/components/tabpanel/TabPanel.js +18 -13
- package/dist/cjs/components/tabpanel/TabPanel.module.css +1 -1
- package/dist/cjs/core/aside/Aside.js +7 -2
- package/dist/cjs/core/content/Content.js +8 -5
- package/dist/cjs/core/headfoot/HeadFoot.js +1 -1
- package/dist/cjs/core/headfoot/HeadFoot.module.css +1 -1
- package/dist/cjs/core/page/Page.js +1 -0
- package/dist/cjs/core/section/Section.js +5 -2
- package/dist/cjs/hooks/useNavigator.js +6 -4
- package/dist/cjs/index.js +4 -2
- package/dist/cjs/overlays/alert/Alert.js +38 -16
- package/dist/cjs/overlays/modal/Modal.js +1 -1
- package/dist/cjs/overlays/tooltip/Tooltip.js +2 -2
- package/dist/cjs/overlays/tooltip/Tooltip.module.css +1 -1
- package/dist/cjs/types/icons.js +3 -0
- package/dist/cjs/typography/Abbr.js +2 -0
- package/dist/cjs/typography/{Link.js → Anchor.js} +2 -2
- package/dist/cjs/typography/Typography.module.css +1 -1
- package/dist/esm/components/actionLabel/ActionLabel.js +1 -0
- package/dist/esm/components/animations/Animations.js +13 -6
- package/dist/esm/components/avatar/Avatar.js +7 -8
- package/dist/esm/components/badge/Badge.js +7 -5
- package/dist/esm/components/breadcrumbs/Breadcrumbs.js +2 -2
- package/dist/esm/components/button/Button.js +9 -7
- package/dist/esm/components/button/Button.module.css +1 -1
- package/dist/esm/components/button/ConfirmButton.js +4 -2
- package/dist/esm/components/callout/Callout.js +3 -2
- package/dist/esm/components/card/Card.js +4 -2
- package/dist/esm/components/chip/Chip.js +2 -2
- package/dist/esm/components/chip/Chip.module.css +1 -1
- package/dist/esm/components/collapsable/Collapsable.js +5 -3
- package/dist/esm/components/divider/Divider.js +3 -2
- package/dist/esm/components/divider/Divider.module.css +1 -0
- package/dist/esm/components/dropdown/Dropdown.js +3 -1
- package/dist/esm/components/dropdown/DropdownTool.js +4 -2
- package/dist/esm/components/icon/Icon.js +8 -7
- package/dist/esm/components/menu/ContextMenu.js +32 -12
- package/dist/esm/components/menu/Menu.js +1 -1
- package/dist/esm/components/menu/MenuItem.js +1 -1
- package/dist/esm/components/navigator/Navigator.js +15 -9
- package/dist/esm/components/panel/Panel.js +2 -0
- package/dist/esm/components/tabpanel/Tab.js +56 -37
- package/dist/esm/components/tabpanel/TabPanel.js +18 -13
- package/dist/esm/components/tabpanel/TabPanel.module.css +1 -1
- package/dist/esm/core/aside/Aside.js +7 -2
- package/dist/esm/core/content/Content.js +8 -5
- package/dist/esm/core/headfoot/HeadFoot.js +1 -1
- package/dist/esm/core/headfoot/HeadFoot.module.css +1 -1
- package/dist/esm/core/page/Page.js +1 -0
- package/dist/esm/core/section/Section.js +5 -2
- package/dist/esm/hooks/useNavigator.js +7 -5
- package/dist/esm/index.js +3 -2
- package/dist/esm/overlays/alert/Alert.js +27 -5
- package/dist/esm/overlays/modal/Modal.js +1 -1
- package/dist/esm/overlays/tooltip/Tooltip.js +2 -2
- package/dist/esm/overlays/tooltip/Tooltip.module.css +1 -1
- package/dist/esm/types/icons.js +3 -0
- package/dist/esm/typography/Abbr.js +2 -0
- package/dist/esm/typography/{Link.js → Anchor.js} +2 -2
- package/dist/esm/typography/Typography.module.css +1 -1
- package/dist/types/components/actionLabel/ActionLabel.d.ts +2 -2
- package/dist/types/components/animations/Animations.d.ts +1 -1
- package/dist/types/components/breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/dist/types/components/button/Button.d.ts +5 -2
- package/dist/types/components/button/ConfirmButton.d.ts +6 -1
- package/dist/types/components/callout/Callout.d.ts +3 -3
- package/dist/types/components/card/Card.d.ts +3 -3
- package/dist/types/components/collapsable/Collapsable.d.ts +9 -1
- package/dist/types/components/dropdown/DropdownTool.d.ts +2 -1
- package/dist/types/components/index.d.ts +1 -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/types.d.ts +2 -2
- package/dist/types/components/navigator/Navigator.d.ts +3 -3
- package/dist/types/components/tabpanel/Tab.d.ts +8 -4
- package/dist/types/components/tabpanel/TabPanel.d.ts +10 -1
- package/dist/types/core/aside/Aside.d.ts +9 -5
- package/dist/types/core/content/Content.d.ts +3 -2
- package/dist/types/core/section/Section.d.ts +2 -2
- package/dist/types/overlays/alert/Alert.d.ts +9 -1
- package/dist/types/overlays/modal/Modal.d.ts +1 -1
- package/dist/types/types/icons.d.ts +3 -0
- package/dist/types/types/index.d.ts +6 -2
- package/dist/types/typography/Abbr.d.ts +3 -3
- package/dist/types/typography/{Link.d.ts → Anchor.d.ts} +4 -3
- package/dist/types/typography/index.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/actionLabel/ActionLabel.tsx +13 -3
- package/src/components/animations/Animations.tsx +9 -3
- package/src/components/avatar/Avatar.tsx +68 -81
- package/src/components/badge/Badge.tsx +24 -20
- package/src/components/breadcrumbs/Breadcrumbs.tsx +3 -3
- package/src/components/button/Button.module.css +1 -1
- package/src/components/button/Button.tsx +16 -10
- package/src/components/button/ConfirmButton.tsx +10 -4
- package/src/components/callout/Callout.tsx +8 -1
- package/src/components/card/Card.tsx +4 -0
- package/src/components/chip/Chip.module.css +1 -1
- package/src/components/chip/Chip.tsx +2 -4
- package/src/components/collapsable/Collapsable.tsx +12 -1
- package/src/components/divider/Divider.module.css +32 -0
- package/src/components/divider/Divider.tsx +3 -2
- package/src/components/dropdown/Dropdown.tsx +2 -0
- package/src/components/dropdown/DropdownTool.tsx +4 -1
- package/src/components/icon/Icon.tsx +46 -57
- package/src/components/index.ts +1 -0
- package/src/components/media/Media.tsx +2 -2
- package/src/components/menu/ContextMenu.tsx +36 -11
- package/src/components/menu/Menu.tsx +2 -2
- package/src/components/menu/types.ts +2 -2
- package/src/components/navigator/Navigator.tsx +16 -4
- package/src/components/panel/Panel.tsx +2 -0
- package/src/components/tabpanel/Tab.tsx +78 -59
- package/src/components/tabpanel/TabPanel.module.css +19 -26
- package/src/components/tabpanel/TabPanel.tsx +32 -10
- package/src/core/aside/Aside.tsx +26 -4
- 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/section/Section.tsx +8 -2
- package/src/hooks/useNavigator.tsx +10 -5
- package/src/overlays/alert/Alert.tsx +25 -2
- package/src/overlays/modal/Modal.tsx +2 -2
- package/src/overlays/tooltip/Tooltip.module.css +1 -1
- package/src/overlays/tooltip/Tooltip.tsx +3 -3
- package/src/types/icons.ts +6 -0
- package/src/types/index.ts +10 -2
- package/src/typography/Abbr.tsx +4 -3
- package/src/typography/{Link.tsx → Anchor.tsx} +6 -3
- package/src/typography/Typography.module.css +2 -2
- package/src/typography/index.ts +1 -1
|
@@ -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,14 +73,14 @@
|
|
|
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
|
}
|
|
@@ -89,9 +89,7 @@
|
|
|
89
89
|
grid-template: "tablist" auto "content" 1fr / 1fr;
|
|
90
90
|
padding-inline: 2px;
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
&[data-variant="solid"] > .tabList,
|
|
94
|
-
&[data-variant="soft"] > .tabList {
|
|
92
|
+
.tabHeader {
|
|
95
93
|
box-shadow: 0 -1px 0 theme(borderColor.dimmed) inset;
|
|
96
94
|
}
|
|
97
95
|
}
|
|
@@ -100,9 +98,8 @@
|
|
|
100
98
|
grid-template: "content" 1fr "tablist" auto / 1fr;
|
|
101
99
|
padding-inline: 2px;
|
|
102
100
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
&[data-variant="soft"] > .tabList {
|
|
101
|
+
.tabHeader {
|
|
102
|
+
margin-top: 1px;
|
|
106
103
|
box-shadow: 0 1px 0 theme(borderColor.dimmed) inset;
|
|
107
104
|
}
|
|
108
105
|
}
|
|
@@ -111,9 +108,7 @@
|
|
|
111
108
|
grid-template: "tablist content" 1fr / auto 1fr;
|
|
112
109
|
padding-block: 2px;
|
|
113
110
|
|
|
114
|
-
|
|
115
|
-
&[data-variant="solid"] > .tabList,
|
|
116
|
-
&[data-variant="soft"] > .tabList {
|
|
111
|
+
.tabHeader {
|
|
117
112
|
box-shadow: -1px 0 0 theme(borderColor.dimmed) inset;
|
|
118
113
|
}
|
|
119
114
|
}
|
|
@@ -122,9 +117,7 @@
|
|
|
122
117
|
grid-template: "content tablist" 1fr / 1fr auto;
|
|
123
118
|
padding-block: 2px;
|
|
124
119
|
|
|
125
|
-
|
|
126
|
-
&[data-variant="solid"] > .tabList,
|
|
127
|
-
&[data-variant="soft"] > .tabList {
|
|
120
|
+
.tabHeader {
|
|
128
121
|
box-shadow: 1px 0 0 theme(borderColor.dimmed) inset;
|
|
129
122
|
}
|
|
130
123
|
}
|
|
@@ -133,11 +126,11 @@
|
|
|
133
126
|
|
|
134
127
|
@layer util {
|
|
135
128
|
.tabPanel {
|
|
136
|
-
&
|
|
129
|
+
& .tabList > .tabButton:global(.active) {
|
|
137
130
|
pointer-events: none;
|
|
138
131
|
}
|
|
139
132
|
|
|
140
|
-
&[data-orientation="top"]
|
|
133
|
+
&[data-orientation="top"] .tabList {
|
|
141
134
|
& > .tabButton:global(.active) {
|
|
142
135
|
box-shadow:
|
|
143
136
|
0 -2px 0 var(--active-color) inset,
|
|
@@ -145,7 +138,7 @@
|
|
|
145
138
|
}
|
|
146
139
|
}
|
|
147
140
|
|
|
148
|
-
&[data-orientation="bottom"]
|
|
141
|
+
&[data-orientation="bottom"] .tabList {
|
|
149
142
|
& > .tabButton:global(.active) {
|
|
150
143
|
box-shadow:
|
|
151
144
|
0 2px 0 var(--active-color) inset,
|
|
@@ -153,7 +146,7 @@
|
|
|
153
146
|
}
|
|
154
147
|
}
|
|
155
148
|
|
|
156
|
-
&[data-orientation="start"]
|
|
149
|
+
&[data-orientation="start"] .tabList {
|
|
157
150
|
& > .tabButton:global(.active) {
|
|
158
151
|
box-shadow:
|
|
159
152
|
-2px 0 0 var(--active-color) inset,
|
|
@@ -161,7 +154,7 @@
|
|
|
161
154
|
}
|
|
162
155
|
}
|
|
163
156
|
|
|
164
|
-
&[data-orientation="end"]
|
|
157
|
+
&[data-orientation="end"] .tabList {
|
|
165
158
|
& > .tabButton:global(.active) {
|
|
166
159
|
box-shadow:
|
|
167
160
|
2px 0 0 var(--active-color) inset,
|
|
@@ -169,28 +162,28 @@
|
|
|
169
162
|
}
|
|
170
163
|
}
|
|
171
164
|
|
|
172
|
-
&[data-orientation="top"]
|
|
165
|
+
&[data-orientation="top"] .tabList > .tabButton {
|
|
173
166
|
margin-top: 2px;
|
|
174
167
|
margin-inline: 1px;
|
|
175
168
|
border-end-start-radius: 0;
|
|
176
169
|
border-end-end-radius: 0;
|
|
177
170
|
}
|
|
178
171
|
|
|
179
|
-
&[data-orientation="bottom"]
|
|
172
|
+
&[data-orientation="bottom"] .tabList > .tabButton {
|
|
180
173
|
margin-bottom: 2px;
|
|
181
174
|
margin-inline: 1px;
|
|
182
175
|
border-start-start-radius: 0;
|
|
183
176
|
border-start-end-radius: 0;
|
|
184
177
|
}
|
|
185
178
|
|
|
186
|
-
&[data-orientation="start"]
|
|
179
|
+
&[data-orientation="start"] .tabList > .tabButton {
|
|
187
180
|
margin-block: 1px;
|
|
188
181
|
margin-inline-start: 2px;
|
|
189
182
|
border-start-end-radius: 0;
|
|
190
183
|
border-end-end-radius: 0;
|
|
191
184
|
}
|
|
192
185
|
|
|
193
|
-
&[data-orientation="end"]
|
|
186
|
+
&[data-orientation="end"] .tabList > .tabButton {
|
|
194
187
|
margin-block: 1px;
|
|
195
188
|
margin-inline-end: 2px;
|
|
196
189
|
border-start-start-radius: 0;
|
|
@@ -25,6 +25,7 @@ import classNames from "classnames";
|
|
|
25
25
|
import {
|
|
26
26
|
Children,
|
|
27
27
|
cloneElement,
|
|
28
|
+
type ReactElement,
|
|
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?: ReactElement;
|
|
72
|
+
/**
|
|
73
|
+
* prepend element
|
|
74
|
+
*/
|
|
75
|
+
prepend?: ReactElement;
|
|
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,32 @@ 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
|
+
"flex flex-1 flex-nowrap overflow-auto scroll-thin",
|
|
160
|
+
)}
|
|
161
|
+
style={{ gap }}
|
|
162
|
+
>
|
|
163
|
+
{tabs.map((node: AnyObject) =>
|
|
164
|
+
cloneElement(node, {
|
|
165
|
+
tabFlex: node.props.tabFlex ?? tabFlex,
|
|
166
|
+
onClick: handleClick,
|
|
167
|
+
active: node.props.id === active,
|
|
168
|
+
}),
|
|
169
|
+
)}
|
|
170
|
+
</div>
|
|
171
|
+
{append}
|
|
150
172
|
</div>
|
|
151
173
|
{rest}
|
|
152
174
|
{activeTabPanel}
|
package/src/core/aside/Aside.tsx
CHANGED
|
@@ -22,7 +22,14 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import classNames from "classnames";
|
|
25
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
useCallback,
|
|
27
|
+
useEffect,
|
|
28
|
+
useMemo,
|
|
29
|
+
useRef,
|
|
30
|
+
useState,
|
|
31
|
+
type ReactNode,
|
|
32
|
+
} from "react";
|
|
26
33
|
import { Loading } from "../../components/animations/Animations";
|
|
27
34
|
import { Icon } from "../../components/icon/Icon";
|
|
28
35
|
import { useLayoutEffectDebugger } from "../../hooks/useEffectDebugger";
|
|
@@ -31,6 +38,7 @@ import { useResize } from "../../hooks/useResize";
|
|
|
31
38
|
import {
|
|
32
39
|
type ChildrenProp,
|
|
33
40
|
type CollapseProps,
|
|
41
|
+
type CssProp,
|
|
34
42
|
type Elements,
|
|
35
43
|
type IconProps,
|
|
36
44
|
type TestProps,
|
|
@@ -43,11 +51,12 @@ export interface AsideProps
|
|
|
43
51
|
extends IconProps,
|
|
44
52
|
ChildrenProp,
|
|
45
53
|
CollapseProps,
|
|
54
|
+
CssProp,
|
|
46
55
|
TestProps {
|
|
47
56
|
/**
|
|
48
57
|
* page title
|
|
49
58
|
*/
|
|
50
|
-
title?:
|
|
59
|
+
title?: ReactNode;
|
|
51
60
|
/**
|
|
52
61
|
* align inline-end
|
|
53
62
|
*/
|
|
@@ -60,6 +69,10 @@ export interface AsideProps
|
|
|
60
69
|
* header class
|
|
61
70
|
*/
|
|
62
71
|
headerClassName?: string;
|
|
72
|
+
/**
|
|
73
|
+
* header class
|
|
74
|
+
*/
|
|
75
|
+
bodyClassName?: string;
|
|
63
76
|
|
|
64
77
|
/**
|
|
65
78
|
* show loading indicator
|
|
@@ -102,6 +115,8 @@ export const Aside = ({
|
|
|
102
115
|
iconBg,
|
|
103
116
|
iconColor,
|
|
104
117
|
rtlFlip,
|
|
118
|
+
className,
|
|
119
|
+
bodyClassName,
|
|
105
120
|
headerClassName,
|
|
106
121
|
resizeable,
|
|
107
122
|
flyout,
|
|
@@ -182,9 +197,10 @@ export const Aside = ({
|
|
|
182
197
|
|
|
183
198
|
return (
|
|
184
199
|
<aside
|
|
185
|
-
className={classNames(classes.aside, "overflow-hidden grid")}
|
|
200
|
+
className={classNames(classes.aside, className, "overflow-hidden grid")}
|
|
186
201
|
data-align={align}
|
|
187
202
|
data-flyout={peek}
|
|
203
|
+
data-loading={loading}
|
|
188
204
|
data-collapsed={isCollapsed}
|
|
189
205
|
style={isCollapsed ? undefined : widthStyles}
|
|
190
206
|
data-testid={testId}
|
|
@@ -196,6 +212,7 @@ export const Aside = ({
|
|
|
196
212
|
headerClassName,
|
|
197
213
|
"grid area-head items-center",
|
|
198
214
|
)}
|
|
215
|
+
data-testid="aside-header"
|
|
199
216
|
>
|
|
200
217
|
{title && (
|
|
201
218
|
<div
|
|
@@ -243,8 +260,13 @@ export const Aside = ({
|
|
|
243
260
|
<section
|
|
244
261
|
ref={elementRef}
|
|
245
262
|
data-ref="asideBody"
|
|
246
|
-
className={classNames(
|
|
263
|
+
className={classNames(
|
|
264
|
+
classes.asideBody,
|
|
265
|
+
bodyClassName,
|
|
266
|
+
"overflow-hidden grid",
|
|
267
|
+
)}
|
|
247
268
|
style={isCollapsed ? widthStyles : undefined}
|
|
269
|
+
data-testid="aside-body"
|
|
248
270
|
>
|
|
249
271
|
<ErrorBoundary>{children}</ErrorBoundary>
|
|
250
272
|
</section>
|
|
@@ -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
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import classNames from "classnames";
|
|
25
|
-
import { type ChildrenProp } from "../../types";
|
|
25
|
+
import { type ChildrenProp, type CssProp, type RefProp } from "../../types";
|
|
26
26
|
import { ErrorBoundary } from "../boundary/ErrorBoundary";
|
|
27
27
|
import classes from "./Section.module.css";
|
|
28
28
|
|
|
@@ -31,14 +31,20 @@ import classes from "./Section.module.css";
|
|
|
31
31
|
*/
|
|
32
32
|
export const Section = ({
|
|
33
33
|
children,
|
|
34
|
+
className,
|
|
34
35
|
dir,
|
|
35
|
-
|
|
36
|
+
ref,
|
|
37
|
+
}: ChildrenProp &
|
|
38
|
+
CssProp &
|
|
39
|
+
RefProp<HTMLDivElement> & { dir?: "ltr" | "rtl" }) => {
|
|
36
40
|
return (
|
|
37
41
|
<div
|
|
38
42
|
data-ref="section"
|
|
39
43
|
dir={dir}
|
|
44
|
+
ref={ref}
|
|
40
45
|
className={classNames(
|
|
41
46
|
classes.section,
|
|
47
|
+
className,
|
|
42
48
|
"grid area-content overflow-hidden",
|
|
43
49
|
)}
|
|
44
50
|
>
|
|
@@ -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-
|
|
46
|
+
<span className="text-muted leading-5">
|
|
42
47
|
{currentIndex + 1}/{totalCount}
|
|
43
48
|
</span>
|
|
44
49
|
),
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
useRole,
|
|
32
32
|
} from "@floating-ui/react";
|
|
33
33
|
import classNames from "classnames";
|
|
34
|
-
import { useCallback, useLayoutEffect, useMemo } from "react";
|
|
34
|
+
import { useCallback, useLayoutEffect, useMemo, useState } from "react";
|
|
35
35
|
import { useTranslation } from "react-i18next";
|
|
36
36
|
import { AnimationIndicator } from "../../components/animations/Animations";
|
|
37
37
|
import { Button } from "../../components/button/Button";
|
|
@@ -71,6 +71,14 @@ export interface AlertProps extends Omit<IconProps, "iconBg" | "iconColor"> {
|
|
|
71
71
|
* cancel label
|
|
72
72
|
*/
|
|
73
73
|
cancelLabel?: string;
|
|
74
|
+
/**
|
|
75
|
+
* placeholder for prompt
|
|
76
|
+
*/
|
|
77
|
+
placeholder?: string;
|
|
78
|
+
/**
|
|
79
|
+
* default value for prompt
|
|
80
|
+
*/
|
|
81
|
+
defaultValue?: string;
|
|
74
82
|
}
|
|
75
83
|
|
|
76
84
|
export const Alert = ({
|
|
@@ -85,8 +93,11 @@ export const Alert = ({
|
|
|
85
93
|
type,
|
|
86
94
|
okLabel,
|
|
87
95
|
cancelLabel,
|
|
96
|
+
placeholder,
|
|
97
|
+
defaultValue,
|
|
88
98
|
}: AlertProps) => {
|
|
89
99
|
const { t } = useTranslation("core");
|
|
100
|
+
const [value, setValue] = useState(defaultValue);
|
|
90
101
|
const { refs, context } = useFloating({
|
|
91
102
|
open: true,
|
|
92
103
|
onOpenChange: () => {
|
|
@@ -181,7 +192,19 @@ export const Alert = ({
|
|
|
181
192
|
|
|
182
193
|
<Title className="font-medium area-[title]">{title}</Title>
|
|
183
194
|
<p className="area-[message] py-4">{message}</p>
|
|
184
|
-
|
|
195
|
+
{type === "prompt" && (
|
|
196
|
+
<input
|
|
197
|
+
value={value}
|
|
198
|
+
placeholder={placeholder}
|
|
199
|
+
className={classNames(
|
|
200
|
+
"border rounded focus:border-primary-500",
|
|
201
|
+
)}
|
|
202
|
+
ref={(e) => e != null && setTimeout(() => e.focus(), 100)}
|
|
203
|
+
onBlur={(e) => e.target.focus()}
|
|
204
|
+
onChange={(e) => setValue(e.target.value)}
|
|
205
|
+
onKeyDown={(e) => e.key === "Enter" && handleClose(value)}
|
|
206
|
+
/>
|
|
207
|
+
)}
|
|
185
208
|
<div className="flex gap-1 justify-center flex-nowrap pt-2 area-[actions]">
|
|
186
209
|
<div
|
|
187
210
|
className="contents"
|
|
@@ -95,7 +95,7 @@ export interface ModalProps
|
|
|
95
95
|
/**
|
|
96
96
|
* close handler
|
|
97
97
|
*/
|
|
98
|
-
onClose
|
|
98
|
+
onClose?: (...args: AnyObject) => void;
|
|
99
99
|
/**
|
|
100
100
|
* before close handler, return false to prevent close
|
|
101
101
|
*/
|
|
@@ -174,7 +174,7 @@ export const Modal = ({
|
|
|
174
174
|
<FloatingOverlay
|
|
175
175
|
lockScroll
|
|
176
176
|
style={{ zIndex: "var(--z-overlay-mask)" }}
|
|
177
|
-
className="bg-base/
|
|
177
|
+
className="bg-base/20 backdrop-blur-sm grid place-items-center"
|
|
178
178
|
>
|
|
179
179
|
<FloatingFocusManager context={context}>
|
|
180
180
|
<dialog
|
|
@@ -176,7 +176,7 @@ export const Tooltip = ({
|
|
|
176
176
|
data-color={color}
|
|
177
177
|
className={classNames(
|
|
178
178
|
classes.tooltip,
|
|
179
|
-
"select-none text-sm not-italic flex py-1 px-2 rounded shadow-md bg-current",
|
|
179
|
+
"select-none text-sm not-italic flex py-1 px-2 !max-w-64 rounded shadow-md bg-current",
|
|
180
180
|
)}
|
|
181
181
|
ref={refs.setFloating}
|
|
182
182
|
style={floatingStyles}
|
|
@@ -184,8 +184,8 @@ export const Tooltip = ({
|
|
|
184
184
|
>
|
|
185
185
|
<span
|
|
186
186
|
className={classNames(
|
|
187
|
-
"font-medium text-
|
|
188
|
-
isString(content) && "whitespace-pre-wrap",
|
|
187
|
+
"font-medium text-dimmed flex-1",
|
|
188
|
+
isString(content) && "whitespace-pre-wrap mixed-lang",
|
|
189
189
|
)}
|
|
190
190
|
>
|
|
191
191
|
{content}
|
package/src/types/icons.ts
CHANGED
|
@@ -90,6 +90,11 @@ export module CoreIcons {
|
|
|
90
90
|
export const collapse =
|
|
91
91
|
"M5 2c-0.828 0-1.58 0.337-2.121 0.879s-0.879 1.293-0.879 2.121v14c0 0.828 0.337 1.58 0.879 2.121s1.293 0.879 2.121 0.879h14c0.828 0 1.58-0.337 2.121-0.879s0.879-1.293 0.879-2.121v-14c0-0.828-0.337-1.58-0.879-2.121s-1.293-0.879-2.121-0.879zM5 4h14c0.276 0 0.525 0.111 0.707 0.293s0.293 0.431 0.293 0.707v14c0 0.276-0.111 0.525-0.293 0.707s-0.431 0.293-0.707 0.293h-14c-0.276 0-0.525-0.111-0.707-0.293s-0.293-0.431-0.293-0.707v-14c0-0.276 0.111-0.525 0.293-0.707s0.431-0.293 0.707-0.293zM8 13h8c0.552 0 1-0.448 1-1s-0.448-1-1-1h-8c-0.552 0-1 0.448-1 1s0.448 1 1 1z";
|
|
92
92
|
|
|
93
|
+
export const expandActive =
|
|
94
|
+
"M17,13H13V17H11V13H7V11H11V7H13V11H17M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z";
|
|
95
|
+
export const collapseActive =
|
|
96
|
+
"M17,13H7V11H17M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3Z";
|
|
97
|
+
|
|
93
98
|
export const expandAll =
|
|
94
99
|
"M5.293 16.707l6 6c0.391 0.391 1.024 0.391 1.414 0l6-6c0.391-0.391 0.391-1.024 0-1.414s-1.024-0.391-1.414 0l-5.293 5.293-5.293-5.293c-0.391-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414zM18.707 7.293l-6-6c-0.391-0.391-1.024-0.391-1.414 0l-6 6c-0.391 0.391-0.391 1.024 0 1.414s1.024 0.391 1.414 0l5.293-5.293 5.293 5.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414z";
|
|
95
100
|
export const colapseAll =
|
|
@@ -244,6 +249,7 @@ export module CoreIcons {
|
|
|
244
249
|
"M5.541 2.159c-0.153-0.1-0.34-0.159-0.541-0.159-0.552 0-1 0.448-1 1v18c-0.001 0.182 0.050 0.372 0.159 0.541 0.299 0.465 0.917 0.599 1.382 0.3l14-9c0.114-0.072 0.219-0.174 0.3-0.3 0.299-0.465 0.164-1.083-0.3-1.382zM6 4.832l11.151 7.168-11.151 7.168z";
|
|
245
250
|
export const pause =
|
|
246
251
|
"M6 3c-0.552 0-1 0.448-1 1v16c0 0.552 0.448 1 1 1h4c0.552 0 1-0.448 1-1v-16c0-0.552-0.448-1-1-1zM7 5h2v14h-2zM14 3c-0.552 0-1 0.448-1 1v16c0 0.552 0.448 1 1 1h4c0.552 0 1-0.448 1-1v-16c0-0.552-0.448-1-1-1zM15 5h2v14h-2z";
|
|
252
|
+
export const stop = "M18,18H6V6H18V18Z";
|
|
247
253
|
export const volumeOn =
|
|
248
254
|
"M10 7.081v9.839l-3.375-2.7c-0.17-0.137-0.388-0.22-0.625-0.22h-3v-4h3c0.218 0.001 0.439-0.071 0.625-0.219zM10.375 4.219l-4.726 3.781h-3.649c-0.552 0-1 0.448-1 1v6c0 0.552 0.448 1 1 1h3.649l4.726 3.781c0.431 0.345 1.061 0.275 1.406-0.156 0.148-0.185 0.22-0.407 0.219-0.625v-14c0-0.552-0.448-1-1-1-0.237 0-0.455 0.083-0.625 0.219zM18.363 5.637c1.757 1.758 2.635 4.059 2.635 6.364 0 2.304-0.878 4.605-2.635 6.362-0.39 0.391-0.39 1.024 0 1.414s1.024 0.39 1.414 0c2.147-2.147 3.22-4.963 3.221-7.776s-1.074-5.63-3.221-7.778c-0.39-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414zM14.833 9.167c0.781 0.781 1.171 1.803 1.171 2.828s-0.39 2.047-1.171 2.828c-0.39 0.391-0.39 1.024 0 1.414s1.024 0.39 1.414 0c1.171-1.171 1.757-2.708 1.757-4.242s-0.586-3.071-1.757-4.242c-0.39-0.391-1.024-0.391-1.414 0s-0.391 1.024 0 1.414z";
|
|
249
255
|
export const volumeOff =
|
package/src/types/index.ts
CHANGED
|
@@ -145,7 +145,10 @@ export interface RefProp<T = HTMLElement> {
|
|
|
145
145
|
/* *********** */
|
|
146
146
|
|
|
147
147
|
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
148
|
-
export type CallbackReturn<T = unknown> =
|
|
148
|
+
export type CallbackReturn<T = unknown> =
|
|
149
|
+
| undefined
|
|
150
|
+
| T
|
|
151
|
+
| Promise<T | undefined>;
|
|
149
152
|
|
|
150
153
|
export type ReactTag = keyof JSX.IntrinsicElements | JSXElementConstructor<any>;
|
|
151
154
|
|
|
@@ -155,7 +158,7 @@ export type PropsOf<AsTag extends ReactTag> = AsTag extends React.ElementType
|
|
|
155
158
|
|
|
156
159
|
export type PolymorphicProps<AsTag extends ReactTag> = Omit<
|
|
157
160
|
PropsOf<AsTag>,
|
|
158
|
-
"children" | "as" | "className"
|
|
161
|
+
"children" | "as" | "className" | "onClick"
|
|
159
162
|
> & {
|
|
160
163
|
/**
|
|
161
164
|
* The component used for the root node.
|
|
@@ -236,3 +239,8 @@ export interface SizeObject {
|
|
|
236
239
|
width: number;
|
|
237
240
|
height: number;
|
|
238
241
|
}
|
|
242
|
+
|
|
243
|
+
export interface ScrollObject extends PositionObject, SizeObject {
|
|
244
|
+
scrollWidth?: number;
|
|
245
|
+
scrollHeight: number;
|
|
246
|
+
}
|
package/src/typography/Abbr.tsx
CHANGED
|
@@ -26,7 +26,7 @@ import classNames from "classnames";
|
|
|
26
26
|
import { Fragment, useCallback, useMemo } from "react";
|
|
27
27
|
import { useMemoDebugger } from "../hooks/useEffectDebugger";
|
|
28
28
|
import { Tooltip, getTooltipProps } from "../overlays/tooltip/Tooltip";
|
|
29
|
-
import { type ChildProp, type ColorType } from "../types";
|
|
29
|
+
import { type ChildProp, type ColorType, type CssProp } from "../types";
|
|
30
30
|
import { getColor, getColorClass } from "../utils";
|
|
31
31
|
import classes from "./Typography.module.css";
|
|
32
32
|
|
|
@@ -64,7 +64,7 @@ const AbbrText = ({ color, children, tooltip, content }: AbbrTextProps) => {
|
|
|
64
64
|
);
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
-
export interface AbbrProps extends ChildProp<string
|
|
67
|
+
export interface AbbrProps extends ChildProp<string>, CssProp {
|
|
68
68
|
/**
|
|
69
69
|
* content to copy using the tooltip copy action
|
|
70
70
|
*/
|
|
@@ -87,6 +87,7 @@ export interface AbbrProps extends ChildProp<string> {
|
|
|
87
87
|
export const Abbr = ({
|
|
88
88
|
children,
|
|
89
89
|
abbr,
|
|
90
|
+
className,
|
|
90
91
|
renderer,
|
|
91
92
|
copyContent = "text",
|
|
92
93
|
}: AbbrProps) => {
|
|
@@ -148,5 +149,5 @@ export const Abbr = ({
|
|
|
148
149
|
);
|
|
149
150
|
|
|
150
151
|
/** ***************** component *******************/
|
|
151
|
-
return <span>{inner}</span>;
|
|
152
|
+
return <span className={className}>{inner}</span>;
|
|
152
153
|
};
|