@react-fabric/core 1.0.0-beta.1 → 1.0.0-beta.12

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.
Files changed (155) hide show
  1. package/css/index.js +13 -13
  2. package/dist/cjs/components/actionLabel/ActionLabel.js +1 -0
  3. package/dist/cjs/components/animations/Animations.js +13 -6
  4. package/dist/cjs/components/avatar/Avatar.js +6 -7
  5. package/dist/cjs/components/badge/Badge.js +6 -4
  6. package/dist/cjs/components/breadcrumbs/Breadcrumbs.js +2 -2
  7. package/dist/cjs/components/button/Button.js +9 -7
  8. package/dist/cjs/components/button/Button.module.css +1 -1
  9. package/dist/cjs/components/button/ConfirmButton.js +4 -2
  10. package/dist/cjs/components/callout/Callout.js +3 -2
  11. package/dist/cjs/components/card/Card.js +4 -2
  12. package/dist/cjs/components/chip/Chip.js +2 -2
  13. package/dist/cjs/components/chip/Chip.module.css +1 -1
  14. package/dist/cjs/components/collapsable/Collapsable.js +5 -3
  15. package/dist/cjs/components/divider/Divider.js +3 -2
  16. package/dist/cjs/components/divider/Divider.module.css +1 -0
  17. package/dist/cjs/components/dropdown/Dropdown.js +4 -2
  18. package/dist/cjs/components/dropdown/DropdownTool.js +3 -2
  19. package/dist/cjs/components/icon/Icon.js +8 -7
  20. package/dist/cjs/components/menu/ContextMenu.js +30 -10
  21. package/dist/cjs/components/menu/Menu.js +1 -1
  22. package/dist/cjs/components/menu/MenuItem.js +1 -1
  23. package/dist/cjs/components/navigator/Navigator.js +15 -9
  24. package/dist/cjs/components/panel/Panel.js +2 -0
  25. package/dist/cjs/components/tabpanel/Tab.js +55 -36
  26. package/dist/cjs/components/tabpanel/TabPanel.js +18 -13
  27. package/dist/cjs/components/tabpanel/TabPanel.module.css +1 -1
  28. package/dist/cjs/core/aside/Aside.js +7 -2
  29. package/dist/cjs/core/content/Content.js +8 -5
  30. package/dist/cjs/core/headfoot/HeadFoot.js +1 -1
  31. package/dist/cjs/core/headfoot/HeadFoot.module.css +1 -1
  32. package/dist/cjs/core/page/Page.js +1 -0
  33. package/dist/cjs/core/section/Section.js +5 -2
  34. package/dist/cjs/hooks/useNavigator.js +6 -4
  35. package/dist/cjs/index.js +3 -2
  36. package/dist/cjs/overlays/alert/Alert.js +38 -16
  37. package/dist/cjs/overlays/modal/Modal.js +1 -1
  38. package/dist/cjs/overlays/tooltip/Tooltip.js +3 -3
  39. package/dist/cjs/overlays/tooltip/Tooltip.module.css +1 -1
  40. package/dist/cjs/types/icons.js +3 -0
  41. package/dist/cjs/typography/Abbr.js +2 -0
  42. package/dist/cjs/typography/{Link.js → Anchor.js} +2 -2
  43. package/dist/cjs/typography/Typography.module.css +1 -1
  44. package/dist/esm/components/actionLabel/ActionLabel.js +1 -0
  45. package/dist/esm/components/animations/Animations.js +13 -6
  46. package/dist/esm/components/avatar/Avatar.js +7 -8
  47. package/dist/esm/components/badge/Badge.js +7 -5
  48. package/dist/esm/components/breadcrumbs/Breadcrumbs.js +2 -2
  49. package/dist/esm/components/button/Button.js +9 -7
  50. package/dist/esm/components/button/Button.module.css +1 -1
  51. package/dist/esm/components/button/ConfirmButton.js +4 -2
  52. package/dist/esm/components/callout/Callout.js +3 -2
  53. package/dist/esm/components/card/Card.js +4 -2
  54. package/dist/esm/components/chip/Chip.js +2 -2
  55. package/dist/esm/components/chip/Chip.module.css +1 -1
  56. package/dist/esm/components/collapsable/Collapsable.js +5 -3
  57. package/dist/esm/components/divider/Divider.js +3 -2
  58. package/dist/esm/components/divider/Divider.module.css +1 -0
  59. package/dist/esm/components/dropdown/Dropdown.js +4 -2
  60. package/dist/esm/components/dropdown/DropdownTool.js +3 -2
  61. package/dist/esm/components/icon/Icon.js +8 -7
  62. package/dist/esm/components/menu/ContextMenu.js +32 -12
  63. package/dist/esm/components/menu/Menu.js +1 -1
  64. package/dist/esm/components/menu/MenuItem.js +1 -1
  65. package/dist/esm/components/navigator/Navigator.js +15 -9
  66. package/dist/esm/components/panel/Panel.js +2 -0
  67. package/dist/esm/components/tabpanel/Tab.js +56 -37
  68. package/dist/esm/components/tabpanel/TabPanel.js +18 -13
  69. package/dist/esm/components/tabpanel/TabPanel.module.css +1 -1
  70. package/dist/esm/core/aside/Aside.js +7 -2
  71. package/dist/esm/core/content/Content.js +8 -5
  72. package/dist/esm/core/headfoot/HeadFoot.js +1 -1
  73. package/dist/esm/core/headfoot/HeadFoot.module.css +1 -1
  74. package/dist/esm/core/page/Page.js +1 -0
  75. package/dist/esm/core/section/Section.js +5 -2
  76. package/dist/esm/hooks/useNavigator.js +7 -5
  77. package/dist/esm/index.js +2 -1
  78. package/dist/esm/overlays/alert/Alert.js +27 -5
  79. package/dist/esm/overlays/modal/Modal.js +1 -1
  80. package/dist/esm/overlays/tooltip/Tooltip.js +3 -3
  81. package/dist/esm/overlays/tooltip/Tooltip.module.css +1 -1
  82. package/dist/esm/types/icons.js +3 -0
  83. package/dist/esm/typography/Abbr.js +2 -0
  84. package/dist/esm/typography/{Link.js → Anchor.js} +2 -2
  85. package/dist/esm/typography/Typography.module.css +1 -1
  86. package/dist/types/components/actionLabel/ActionLabel.d.ts +2 -2
  87. package/dist/types/components/animations/Animations.d.ts +1 -1
  88. package/dist/types/components/breadcrumbs/Breadcrumbs.d.ts +2 -2
  89. package/dist/types/components/button/Button.d.ts +5 -2
  90. package/dist/types/components/button/ConfirmButton.d.ts +6 -1
  91. package/dist/types/components/callout/Callout.d.ts +3 -3
  92. package/dist/types/components/card/Card.d.ts +3 -3
  93. package/dist/types/components/collapsable/Collapsable.d.ts +9 -1
  94. package/dist/types/components/dropdown/DropdownTool.d.ts +2 -1
  95. package/dist/types/components/media/Media.d.ts +2 -2
  96. package/dist/types/components/menu/ContextMenu.d.ts +2 -1
  97. package/dist/types/components/menu/types.d.ts +2 -2
  98. package/dist/types/components/navigator/Navigator.d.ts +3 -3
  99. package/dist/types/components/tabpanel/Tab.d.ts +8 -4
  100. package/dist/types/components/tabpanel/TabPanel.d.ts +10 -1
  101. package/dist/types/core/aside/Aside.d.ts +9 -5
  102. package/dist/types/core/content/Content.d.ts +3 -2
  103. package/dist/types/core/section/Section.d.ts +2 -2
  104. package/dist/types/overlays/alert/Alert.d.ts +9 -1
  105. package/dist/types/overlays/modal/Modal.d.ts +1 -1
  106. package/dist/types/types/icons.d.ts +3 -0
  107. package/dist/types/types/index.d.ts +6 -2
  108. package/dist/types/typography/Abbr.d.ts +3 -3
  109. package/dist/types/typography/{Link.d.ts → Anchor.d.ts} +4 -3
  110. package/dist/types/typography/index.d.ts +1 -1
  111. package/package.json +3 -3
  112. package/src/components/actionLabel/ActionLabel.tsx +13 -3
  113. package/src/components/animations/Animations.tsx +9 -3
  114. package/src/components/avatar/Avatar.tsx +68 -81
  115. package/src/components/badge/Badge.tsx +24 -20
  116. package/src/components/breadcrumbs/Breadcrumbs.tsx +3 -3
  117. package/src/components/button/Button.module.css +1 -1
  118. package/src/components/button/Button.tsx +16 -10
  119. package/src/components/button/ConfirmButton.tsx +10 -4
  120. package/src/components/callout/Callout.tsx +8 -1
  121. package/src/components/card/Card.tsx +4 -0
  122. package/src/components/chip/Chip.module.css +1 -1
  123. package/src/components/chip/Chip.tsx +2 -4
  124. package/src/components/collapsable/Collapsable.tsx +12 -1
  125. package/src/components/divider/Divider.module.css +32 -0
  126. package/src/components/divider/Divider.tsx +3 -2
  127. package/src/components/dropdown/Dropdown.tsx +3 -2
  128. package/src/components/dropdown/DropdownTool.tsx +3 -1
  129. package/src/components/icon/Icon.tsx +46 -57
  130. package/src/components/media/Media.tsx +2 -2
  131. package/src/components/menu/ContextMenu.tsx +36 -11
  132. package/src/components/menu/Menu.tsx +2 -2
  133. package/src/components/menu/types.ts +2 -2
  134. package/src/components/navigator/Navigator.tsx +16 -4
  135. package/src/components/panel/Panel.tsx +2 -0
  136. package/src/components/tabpanel/Tab.tsx +78 -59
  137. package/src/components/tabpanel/TabPanel.module.css +19 -26
  138. package/src/components/tabpanel/TabPanel.tsx +32 -10
  139. package/src/core/aside/Aside.tsx +26 -4
  140. package/src/core/content/Content.tsx +16 -10
  141. package/src/core/headfoot/HeadFoot.module.css +2 -0
  142. package/src/core/headfoot/HeadFoot.tsx +1 -1
  143. package/src/core/page/Page.tsx +1 -0
  144. package/src/core/section/Section.tsx +8 -2
  145. package/src/hooks/useNavigator.tsx +10 -5
  146. package/src/overlays/alert/Alert.tsx +25 -2
  147. package/src/overlays/modal/Modal.tsx +2 -2
  148. package/src/overlays/tooltip/Tooltip.module.css +1 -1
  149. package/src/overlays/tooltip/Tooltip.tsx +4 -4
  150. package/src/types/icons.ts +6 -0
  151. package/src/types/index.ts +10 -2
  152. package/src/typography/Abbr.tsx +4 -3
  153. package/src/typography/{Link.tsx → Anchor.tsx} +6 -3
  154. package/src/typography/Typography.module.css +2 -2
  155. package/src/typography/index.ts +1 -1
@@ -25,10 +25,10 @@
25
25
  .tabPanel {
26
26
  --color: theme(colors.primary.500);
27
27
 
28
- & > .tabList {
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
- & > .tabList > .tabButton:global(.active) {
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
- & > .tabList > .tabButton:global(.active) {
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
- & > .tabList > .tabButton:global(.active) {
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
- &[data-variant="outline"] > .tabList,
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
- &[data-variant="outline"] > .tabList,
104
- &[data-variant="solid"] > .tabList,
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
- &[data-variant="outline"] > .tabList,
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
- &[data-variant="outline"] > .tabList,
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
- & > .tabList > .tabButton:global(.active) {
129
+ & .tabList > .tabButton:global(.active) {
137
130
  pointer-events: none;
138
131
  }
139
132
 
140
- &[data-orientation="top"] > .tabList {
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"] > .tabList {
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"] > .tabList {
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"] > .tabList {
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"] > .tabList > .tabButton {
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"] > .tabList > .tabButton {
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"] > .tabList > .tabButton {
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"] > .tabList > .tabButton {
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.tabList,
146
+ classes.tabHeader,
136
147
  headerClassName,
137
148
  justify && `justify-${justify}`,
138
149
  ["start", "end"].includes(orientation) && "flex-col",
139
- "flex flex-nowrap overflow-auto scroll-thin",
150
+ "flex flex-nowrap overflow-hidden items-center",
140
151
  )}
141
- style={{ gap }}
142
152
  >
143
- {tabs.map((node: AnyObject) =>
144
- cloneElement(node, {
145
- tabFlex: node.props.tabFlex ?? tabFlex,
146
- onClick: handleClick,
147
- active: node.props.id === active,
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}
@@ -22,7 +22,14 @@
22
22
  */
23
23
 
24
24
  import classNames from "classnames";
25
- import { useCallback, useEffect, useMemo, useRef, useState } from "react";
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?: string;
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(classes.asideBody, "overflow-hidden grid")}
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: PositionObject) => void;
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: React.UIEvent<HTMLDivElement>) => {
69
- onScroll?.({
70
- // @ts-expect-error ignore
71
- left: e.target.scrollLeft,
72
- // @ts-expect-error ignore
73
- top: e.target.scrollTop,
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
  );
@@ -23,6 +23,8 @@
23
23
 
24
24
  @layer comp {
25
25
  .headfoot {
26
+ gap: 2px;
27
+
26
28
  .buttonWrapper + .buttonWrapper {
27
29
  margin-inline-start: 0.25rem;
28
30
  }
@@ -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 gap-px",
96
+ flex && "flex flex-nowrap",
97
97
  align && `items-${align}`,
98
98
  justify && `justify-${justify}`,
99
99
  )}
@@ -66,6 +66,7 @@ export const Page = ({
66
66
  <div
67
67
  data-testid={testId}
68
68
  data-test-value={testValue}
69
+ data-loading={loading}
69
70
  className={classNames(
70
71
  classes.page,
71
72
  "overflow-hidden grid area-content",
@@ -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
- }: ChildrenProp & { dir?: "ltr" | "rtl" }) => {
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
- setCurrentIndex(currentIndex > 0 ? currentIndex - 1 : totalCount - 1);
33
+ refCurrent.current =
34
+ refCurrent.current > 0 ? refCurrent.current - 1 : totalCount - 1;
32
35
  }
33
36
  if (dir === 1) {
34
- setCurrentIndex(currentIndex + 1 < totalCount ? currentIndex + 1 : 0);
37
+ refCurrent.current =
38
+ refCurrent.current + 1 < totalCount ? refCurrent.current + 1 : 0;
35
39
  }
40
+ setCurrentIndex(refCurrent.current);
36
41
  },
37
- [currentIndex, totalCount],
42
+ [totalCount],
38
43
  );
39
44
  const headLabel = useMemo(
40
45
  () => (
41
- <span className="text-muted leading-none">
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
- <div className="area-[message]">{message}</div>
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: (...args: AnyObject) => void;
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/50 backdrop-blur-sm grid place-items-center"
177
+ className="bg-base/20 backdrop-blur-sm grid place-items-center"
178
178
  >
179
179
  <FloatingFocusManager context={context}>
180
180
  <dialog
@@ -24,7 +24,7 @@
24
24
  @layer comp {
25
25
  .tooltip {
26
26
  z-index: var(--z-tooltip);
27
- color: theme(backgroundColor.invert);
27
+ color: theme(backgroundColor.dimmed);
28
28
 
29
29
  &[data-color="primary"] {
30
30
  color: theme(colors.primary.600);
@@ -153,7 +153,7 @@ export const Tooltip = ({
153
153
  return (
154
154
  <span
155
155
  role="none"
156
- className="ms-2 cursor-pointer text-invert flex-content opacity-75 hover:opacity-90 active:opacity-60"
156
+ className="ms-2 cursor-pointer flex-content opacity-75 hover:opacity-90 active:opacity-60"
157
157
  onClick={handler}
158
158
  >
159
159
  <Icon icon={CoreIcons.copy} />
@@ -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-invert flex-1",
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}
@@ -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 =
@@ -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> = void | T | Promise<T | void>;
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
+ }
@@ -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
  };