@react-fabric/core 1.0.0-beta.1 → 1.0.0-beta.4
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 +2 -2
- package/dist/cjs/components/animations/Animations.js +1 -1
- package/dist/cjs/components/badge/Badge.js +6 -4
- package/dist/cjs/components/button/Button.js +4 -3
- package/dist/cjs/components/button/Button.module.css +1 -1
- package/dist/cjs/components/callout/Callout.js +3 -2
- package/dist/cjs/components/collapsable/Collapsable.js +3 -2
- package/dist/cjs/components/menu/MenuItem.js +1 -1
- package/dist/cjs/core/aside/Aside.js +4 -2
- package/dist/cjs/core/section/Section.js +5 -2
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/overlays/alert/Alert.js +38 -16
- package/dist/cjs/types/icons.js +2 -0
- package/dist/cjs/typography/Abbr.js +2 -0
- package/dist/esm/components/animations/Animations.js +1 -1
- package/dist/esm/components/badge/Badge.js +7 -5
- package/dist/esm/components/button/Button.js +4 -3
- package/dist/esm/components/button/Button.module.css +1 -1
- package/dist/esm/components/callout/Callout.js +3 -2
- package/dist/esm/components/collapsable/Collapsable.js +3 -2
- package/dist/esm/components/menu/MenuItem.js +1 -1
- package/dist/esm/core/aside/Aside.js +4 -2
- package/dist/esm/core/section/Section.js +5 -2
- package/dist/esm/index.js +1 -0
- package/dist/esm/overlays/alert/Alert.js +27 -5
- package/dist/esm/types/icons.js +2 -0
- package/dist/esm/typography/Abbr.js +2 -0
- package/dist/types/components/button/Button.d.ts +2 -1
- package/dist/types/components/callout/Callout.d.ts +3 -3
- package/dist/types/components/collapsable/Collapsable.d.ts +5 -1
- package/dist/types/components/menu/types.d.ts +2 -2
- package/dist/types/components/tabpanel/Tab.d.ts +4 -0
- package/dist/types/core/aside/Aside.d.ts +9 -5
- package/dist/types/core/section/Section.d.ts +2 -2
- package/dist/types/overlays/alert/Alert.d.ts +9 -1
- package/dist/types/types/icons.d.ts +2 -0
- package/dist/types/types/index.d.ts +2 -2
- package/dist/types/typography/Abbr.d.ts +3 -3
- package/dist/types/typography/Link.d.ts +2 -1
- package/package.json +3 -3
- package/src/components/animations/Animations.tsx +1 -1
- package/src/components/badge/Badge.tsx +24 -20
- package/src/components/button/Button.module.css +1 -1
- package/src/components/button/Button.tsx +5 -2
- package/src/components/callout/Callout.tsx +8 -1
- package/src/components/collapsable/Collapsable.tsx +6 -1
- package/src/components/menu/Menu.tsx +1 -1
- package/src/components/menu/types.ts +2 -2
- package/src/components/tabpanel/Tab.tsx +4 -0
- package/src/core/aside/Aside.tsx +23 -4
- package/src/core/section/Section.tsx +8 -2
- package/src/overlays/alert/Alert.tsx +25 -2
- package/src/types/icons.ts +5 -0
- package/src/types/index.ts +5 -2
- package/src/typography/Abbr.tsx +4 -3
- package/src/typography/Link.tsx +3 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
4
5
|
import { useFloating, useDismiss, useRole, useInteractions, FloatingPortal, FloatingOverlay, FloatingFocusManager } from '@floating-ui/react';
|
|
5
6
|
import classNames from 'classnames';
|
|
6
|
-
import { useMemo, useCallback, useLayoutEffect } from 'react';
|
|
7
|
+
import { useState, useMemo, useCallback, useLayoutEffect } from 'react';
|
|
7
8
|
import { useTranslation } from 'react-i18next';
|
|
8
9
|
import { AnimationIndicator } from '../../components/animations/Animations.js';
|
|
9
10
|
import { Button } from '../../components/button/Button.js';
|
|
@@ -28,9 +29,15 @@ var Alert = function Alert(_ref) {
|
|
|
28
29
|
onClose = _ref.onClose,
|
|
29
30
|
type = _ref.type,
|
|
30
31
|
okLabel = _ref.okLabel,
|
|
31
|
-
cancelLabel = _ref.cancelLabel
|
|
32
|
+
cancelLabel = _ref.cancelLabel,
|
|
33
|
+
placeholder = _ref.placeholder,
|
|
34
|
+
defaultValue = _ref.defaultValue;
|
|
32
35
|
var _useTranslation = useTranslation("core"),
|
|
33
36
|
t = _useTranslation.t;
|
|
37
|
+
var _useState = useState(defaultValue),
|
|
38
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
+
value = _useState2[0],
|
|
40
|
+
setValue = _useState2[1];
|
|
34
41
|
var _useFloating = useFloating({
|
|
35
42
|
open: true,
|
|
36
43
|
onOpenChange: function onOpenChange() {
|
|
@@ -112,9 +119,24 @@ var Alert = function Alert(_ref) {
|
|
|
112
119
|
}), /*#__PURE__*/jsx("p", {
|
|
113
120
|
className: "area-[message] py-4",
|
|
114
121
|
children: message
|
|
115
|
-
}), /*#__PURE__*/jsx("
|
|
116
|
-
|
|
117
|
-
|
|
122
|
+
}), type === "prompt" && /*#__PURE__*/jsx("input", {
|
|
123
|
+
value: value,
|
|
124
|
+
placeholder: placeholder,
|
|
125
|
+
className: classNames("border rounded focus:border-primary-500"),
|
|
126
|
+
ref: function ref(e) {
|
|
127
|
+
return e != null && setTimeout(function () {
|
|
128
|
+
return e.focus();
|
|
129
|
+
}, 100);
|
|
130
|
+
},
|
|
131
|
+
onBlur: function onBlur(e) {
|
|
132
|
+
return e.target.focus();
|
|
133
|
+
},
|
|
134
|
+
onChange: function onChange(e) {
|
|
135
|
+
return setValue(e.target.value);
|
|
136
|
+
},
|
|
137
|
+
onKeyDown: function onKeyDown(e) {
|
|
138
|
+
return e.key === "Enter" && handleClose(value);
|
|
139
|
+
}
|
|
118
140
|
}), /*#__PURE__*/jsxs("div", {
|
|
119
141
|
className: "flex gap-1 justify-center flex-nowrap pt-2 area-[actions]",
|
|
120
142
|
children: [/*#__PURE__*/jsx("div", {
|
package/dist/esm/types/icons.js
CHANGED
|
@@ -52,6 +52,8 @@ var CoreIcons;
|
|
|
52
52
|
_CoreIcons.caretUp = "M7,15L12,10L17,15H7Z";
|
|
53
53
|
_CoreIcons.expand = "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 13h3v3c0 0.552 0.448 1 1 1s1-0.448 1-1v-3h3c0.552 0 1-0.448 1-1s-0.448-1-1-1h-3v-3c0-0.552-0.448-1-1-1s-1 0.448-1 1v3h-3c-0.552 0-1 0.448-1 1s0.448 1 1 1z";
|
|
54
54
|
_CoreIcons.collapse = "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";
|
|
55
|
+
_CoreIcons.expandActive = "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";
|
|
56
|
+
_CoreIcons.collapseActive = "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";
|
|
55
57
|
_CoreIcons.expandAll = "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";
|
|
56
58
|
_CoreIcons.colapseAll = "M18.707 21.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.414zM5.293 2.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.414z";
|
|
57
59
|
_CoreIcons.folderClosed = "M20,18H4V8H20M20,6H12L10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6Z";
|
|
@@ -42,6 +42,7 @@ var AbbrText = function AbbrText(_ref) {
|
|
|
42
42
|
var Abbr = function Abbr(_ref2) {
|
|
43
43
|
var children = _ref2.children,
|
|
44
44
|
abbr = _ref2.abbr,
|
|
45
|
+
className = _ref2.className,
|
|
45
46
|
renderer = _ref2.renderer,
|
|
46
47
|
_ref2$copyContent = _ref2.copyContent,
|
|
47
48
|
copyContent = _ref2$copyContent === void 0 ? "text" : _ref2$copyContent;
|
|
@@ -101,6 +102,7 @@ var Abbr = function Abbr(_ref2) {
|
|
|
101
102
|
|
|
102
103
|
/** ***************** component *******************/
|
|
103
104
|
return /*#__PURE__*/jsx("span", {
|
|
105
|
+
className: className,
|
|
104
106
|
children: inner
|
|
105
107
|
});
|
|
106
108
|
};
|
|
@@ -74,6 +74,7 @@ export interface BaseProps extends CssProp, AriaProps, IconProps, RefProp, TestP
|
|
|
74
74
|
* keyboard shortcut
|
|
75
75
|
*/
|
|
76
76
|
hotKey?: string;
|
|
77
|
+
stopPropagation?: boolean;
|
|
77
78
|
onMouseOut?: MouseEventHandler;
|
|
78
79
|
onMouseOver?: MouseEventHandler;
|
|
79
80
|
onMouseMove?: MouseEventHandler;
|
|
@@ -91,4 +92,4 @@ export type ButtonProps = {
|
|
|
91
92
|
/**
|
|
92
93
|
* Clickable action button
|
|
93
94
|
*/
|
|
94
|
-
export declare const Button: <Tag extends import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> = "button">({ as, ref, children, className, active, color, icon, iconBg, iconColor, iconAlign, altIcon, rtlFlip, rounded, size, disabled, loading, variant, badge, fullWidth, spinOnHover, onClick, actionMessage, type, hotKey, showActionDone, showActionDoneEvent, tabIndex, "data-ref": dataRef, ...aria }: BaseProps & ButtonProps & PolymorphicProps<Tag>) => import("react/jsx-runtime").JSX.Element;
|
|
95
|
+
export declare const Button: <Tag extends import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> = "button">({ as, ref, children, className, active, color, icon, iconBg, iconColor, iconAlign, altIcon, rtlFlip, rounded, size, disabled, loading, variant, badge, fullWidth, spinOnHover, onClick, actionMessage, stopPropagation, type, hotKey, showActionDone, showActionDoneEvent, tabIndex, "data-ref": dataRef, ...aria }: BaseProps & ButtonProps & PolymorphicProps<Tag>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type AriaProps, type ChildrenProp, type ColorType, type PaletteType, type TestProps } from "../../types";
|
|
2
|
-
export interface CalloutProps extends AriaProps, ChildrenProp, TestProps {
|
|
1
|
+
import { type AriaProps, type ChildrenProp, type ColorType, type CssProp, type PaletteType, type TestProps } from "../../types";
|
|
2
|
+
export interface CalloutProps extends AriaProps, ChildrenProp, CssProp, TestProps {
|
|
3
3
|
/**
|
|
4
4
|
* callout color
|
|
5
5
|
*/
|
|
@@ -25,4 +25,4 @@ export interface CalloutProps extends AriaProps, ChildrenProp, TestProps {
|
|
|
25
25
|
*/
|
|
26
26
|
onClose?: () => void;
|
|
27
27
|
}
|
|
28
|
-
export declare const Callout: ({ children, color, legend, title, icon, border, onClose, ...aria }: CalloutProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare const Callout: ({ children, color, legend, title, icon, border, onClose, className, ...aria }: CalloutProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -30,6 +30,10 @@ export interface CollapsableProps extends CssProp, AriaProps, TestProps, RefProp
|
|
|
30
30
|
* open state
|
|
31
31
|
*/
|
|
32
32
|
open?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* disable collapsable
|
|
35
|
+
*/
|
|
36
|
+
disabled?: boolean;
|
|
33
37
|
/**
|
|
34
38
|
* open handler
|
|
35
39
|
*/
|
|
@@ -39,5 +43,5 @@ export interface CollapsableProps extends CssProp, AriaProps, TestProps, RefProp
|
|
|
39
43
|
*/
|
|
40
44
|
onClose?: () => void;
|
|
41
45
|
}
|
|
42
|
-
export declare const Collapsable: ({ ref, className, bodyClassName, headerClassName, children, iconAlign, iconClosed, iconOpen, open, onClose, onOpen, ...aria }: CollapsableProps) => import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export declare const Collapsable: ({ ref, disabled, className, bodyClassName, headerClassName, children, iconAlign, iconClosed, iconOpen, open, onClose, onOpen, ...aria }: CollapsableProps) => import("react/jsx-runtime").JSX.Element;
|
|
43
47
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ElementType } from "react";
|
|
1
|
+
import { type ElementType, type MouseEvent } from "react";
|
|
2
2
|
import { type AriaProps, type BadgeType, type CallbackReturn, type ChildrenProp, type ColorType, type CssProp, type IconProps, type TestProps } from "../../types";
|
|
3
3
|
export interface MenuItemProps extends CssProp, AriaProps, TestProps, IconProps {
|
|
4
4
|
/**
|
|
@@ -40,7 +40,7 @@ export interface MenuItemProps extends CssProp, AriaProps, TestProps, IconProps
|
|
|
40
40
|
/**
|
|
41
41
|
* click handler
|
|
42
42
|
*/
|
|
43
|
-
onClick?: () => CallbackReturn;
|
|
43
|
+
onClick?: (e: MouseEvent) => CallbackReturn;
|
|
44
44
|
}
|
|
45
45
|
export interface MenuRootProps extends CssProp {
|
|
46
46
|
label?: never;
|
|
@@ -37,5 +37,9 @@ export interface TabProps extends Partial<ChildrenProp>, CssProp, RefProp, AriaP
|
|
|
37
37
|
* close handler
|
|
38
38
|
*/
|
|
39
39
|
onClose?: () => CallbackReturn;
|
|
40
|
+
/**
|
|
41
|
+
* click handler
|
|
42
|
+
*/
|
|
43
|
+
onClick?: (id: string) => CallbackReturn;
|
|
40
44
|
}
|
|
41
45
|
export declare const Tab: <Tag extends import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> = "button">({ ref, as, id, className, label, icon, iconBg, iconColor, rtlFlip, badge, disabled, onClose, active, minimal, onClick, tabFlex, color, actions, activeClassName, ...aria }: TabProps & PolymorphicProps<Tag>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import { type ChildrenProp, type CollapseProps, type Elements, type IconProps, type TestProps } from "../../types";
|
|
3
|
-
export interface AsideProps extends IconProps, ChildrenProp, CollapseProps, TestProps {
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ChildrenProp, type CollapseProps, type CssProp, type Elements, type IconProps, type TestProps } from "../../types";
|
|
3
|
+
export interface AsideProps extends IconProps, ChildrenProp, CollapseProps, CssProp, TestProps {
|
|
4
4
|
/**
|
|
5
5
|
* page title
|
|
6
6
|
*/
|
|
7
|
-
title?:
|
|
7
|
+
title?: ReactNode;
|
|
8
8
|
/**
|
|
9
9
|
* align inline-end
|
|
10
10
|
*/
|
|
@@ -17,6 +17,10 @@ export interface AsideProps extends IconProps, ChildrenProp, CollapseProps, Test
|
|
|
17
17
|
* header class
|
|
18
18
|
*/
|
|
19
19
|
headerClassName?: string;
|
|
20
|
+
/**
|
|
21
|
+
* header class
|
|
22
|
+
*/
|
|
23
|
+
bodyClassName?: string;
|
|
20
24
|
/**
|
|
21
25
|
* show loading indicator
|
|
22
26
|
*/
|
|
@@ -49,4 +53,4 @@ export interface AsideProps extends IconProps, ChildrenProp, CollapseProps, Test
|
|
|
49
53
|
/**
|
|
50
54
|
* Side panel
|
|
51
55
|
*/
|
|
52
|
-
export declare const Aside: ({ children, title, icon, iconBg, iconColor, rtlFlip, headerClassName, resizeable, flyout, onFlyout, collapsed, collapsable, onCollapse, actions, loading, align, width: wd, minWidth, maxWidth, "data-testid": testId, "data-test-value": testValue, }: AsideProps) => import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
export declare const Aside: ({ children, title, icon, iconBg, iconColor, rtlFlip, className, bodyClassName, headerClassName, resizeable, flyout, onFlyout, collapsed, collapsable, onCollapse, actions, loading, align, width: wd, minWidth, maxWidth, "data-testid": testId, "data-test-value": testValue, }: AsideProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { type ChildrenProp } from "../../types";
|
|
1
|
+
import { type ChildrenProp, type CssProp, type RefProp } from "../../types";
|
|
2
2
|
/**
|
|
3
3
|
* The section component provides a structured layout used within a page to organize and display content in a sectioned format, ensuring a consistent and intuitive user experience.
|
|
4
4
|
*/
|
|
5
|
-
export declare const Section: ({ children, dir, }: ChildrenProp & {
|
|
5
|
+
export declare const Section: ({ children, className, dir, ref, }: ChildrenProp & CssProp & RefProp<HTMLDivElement> & {
|
|
6
6
|
dir?: "ltr" | "rtl";
|
|
7
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -29,5 +29,13 @@ export interface AlertProps extends Omit<IconProps, "iconBg" | "iconColor"> {
|
|
|
29
29
|
* cancel label
|
|
30
30
|
*/
|
|
31
31
|
cancelLabel?: string;
|
|
32
|
+
/**
|
|
33
|
+
* placeholder for prompt
|
|
34
|
+
*/
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
/**
|
|
37
|
+
* default value for prompt
|
|
38
|
+
*/
|
|
39
|
+
defaultValue?: string;
|
|
32
40
|
}
|
|
33
|
-
export declare const Alert: ({ title, message, color, icon, rtlFlip, actions, onClose, type, okLabel, cancelLabel, }: AlertProps) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export declare const Alert: ({ title, message, color, icon, rtlFlip, actions, onClose, type, okLabel, cancelLabel, placeholder, defaultValue, }: AlertProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -34,6 +34,8 @@ export declare namespace CoreIcons {
|
|
|
34
34
|
const caretUp = "M7,15L12,10L17,15H7Z";
|
|
35
35
|
const expand = "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 13h3v3c0 0.552 0.448 1 1 1s1-0.448 1-1v-3h3c0.552 0 1-0.448 1-1s-0.448-1-1-1h-3v-3c0-0.552-0.448-1-1-1s-1 0.448-1 1v3h-3c-0.552 0-1 0.448-1 1s0.448 1 1 1z";
|
|
36
36
|
const collapse = "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";
|
|
37
|
+
const expandActive = "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";
|
|
38
|
+
const collapseActive = "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";
|
|
37
39
|
const expandAll = "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";
|
|
38
40
|
const colapseAll = "M18.707 21.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.414zM5.293 2.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.414z";
|
|
39
41
|
const folderClosed = "M20,18H4V8H20M20,6H12L10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6Z";
|
|
@@ -62,10 +62,10 @@ export type AriaProps = React.AriaAttributes;
|
|
|
62
62
|
export interface RefProp<T = HTMLElement> {
|
|
63
63
|
ref?: Ref<T>;
|
|
64
64
|
}
|
|
65
|
-
export type CallbackReturn<T = unknown> =
|
|
65
|
+
export type CallbackReturn<T = unknown> = undefined | T | Promise<T | undefined>;
|
|
66
66
|
export type ReactTag = keyof JSX.IntrinsicElements | JSXElementConstructor<any>;
|
|
67
67
|
export type PropsOf<AsTag extends ReactTag> = AsTag extends React.ElementType ? Omit<React.ComponentProps<AsTag>, "ref"> : never;
|
|
68
|
-
export type PolymorphicProps<AsTag extends ReactTag> = Omit<PropsOf<AsTag>, "children" | "as" | "className"> & {
|
|
68
|
+
export type PolymorphicProps<AsTag extends ReactTag> = Omit<PropsOf<AsTag>, "children" | "as" | "className" | "onClick"> & {
|
|
69
69
|
/**
|
|
70
70
|
* The component used for the root node.
|
|
71
71
|
* Either a string to use a HTML element or a component.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { type ChildProp, type ColorType } from "../types";
|
|
3
|
-
export interface AbbrProps extends ChildProp<string
|
|
2
|
+
import { type ChildProp, type ColorType, type CssProp } from "../types";
|
|
3
|
+
export interface AbbrProps extends ChildProp<string>, CssProp {
|
|
4
4
|
/**
|
|
5
5
|
* content to copy using the tooltip copy action
|
|
6
6
|
*/
|
|
@@ -19,4 +19,4 @@ export interface AbbrProps extends ChildProp<string> {
|
|
|
19
19
|
/**
|
|
20
20
|
* Typography abbr component to wrap text parts in `abbr` with tooltip
|
|
21
21
|
*/
|
|
22
|
-
export declare const Abbr: ({ children, abbr, renderer, copyContent, }: AbbrProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const Abbr: ({ children, abbr, className, renderer, copyContent, }: AbbrProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { type MouseEventHandler } from "react";
|
|
2
2
|
import { type AriaProps, type ChildrenProp, type ColorType, type CssProp, type PolymorphicProps, type RefProp, type SizeType } from "../types";
|
|
3
3
|
export interface LinkProps extends ChildrenProp, CssProp, RefProp, AriaProps {
|
|
4
4
|
/**
|
|
@@ -17,6 +17,7 @@ export interface LinkProps extends ChildrenProp, CssProp, RefProp, AriaProps {
|
|
|
17
17
|
* font family
|
|
18
18
|
*/
|
|
19
19
|
family?: "sans" | "serif" | "mono";
|
|
20
|
+
onClick?: MouseEventHandler;
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
23
|
* Typography link component
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-fabric/core",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"description": "RUF: Core package",
|
|
5
5
|
"author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@floating-ui/react": "^0.26.24",
|
|
39
|
-
"@react-fabric/utilities": "^1.0.0-beta.
|
|
39
|
+
"@react-fabric/utilities": "^1.0.0-beta.4",
|
|
40
40
|
"@tailwindcss/container-queries": "^0.1.1",
|
|
41
41
|
"@tailwindcss/forms": "^0.5.7",
|
|
42
42
|
"@tailwindcss/typography": "^0.5.13",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"node": ">=18.12.0",
|
|
57
57
|
"npm": ">=8.19.0"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "47b0aede19252a3a3ef8df75c08a21caabde8100"
|
|
60
60
|
}
|
|
@@ -21,7 +21,7 @@
|
|
|
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 { isNumber, isObject, mergeRefs } from "@react-fabric/utilities";
|
|
24
|
+
import { isNil, isNumber, isObject, mergeRefs } from "@react-fabric/utilities";
|
|
25
25
|
import classNames from "classnames";
|
|
26
26
|
import { cloneElement, useMemo } from "react";
|
|
27
27
|
import {
|
|
@@ -101,10 +101,12 @@ export const Badge = ({
|
|
|
101
101
|
...rest
|
|
102
102
|
}: BadgeProps) => {
|
|
103
103
|
const label = useMemo(() => {
|
|
104
|
-
if (
|
|
105
|
-
|
|
104
|
+
if (!isNil(value)) {
|
|
105
|
+
if (isNumber(value) && max && value > max) {
|
|
106
|
+
return `${max}+`;
|
|
107
|
+
}
|
|
108
|
+
return `${value}`;
|
|
106
109
|
}
|
|
107
|
-
return `${value}`;
|
|
108
110
|
}, [value, max]);
|
|
109
111
|
|
|
110
112
|
const innerRef = useMemo(
|
|
@@ -127,22 +129,24 @@ export const Badge = ({
|
|
|
127
129
|
...rest,
|
|
128
130
|
ref: innerRef,
|
|
129
131
|
})}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
132
|
+
{(!!ping || label) && (
|
|
133
|
+
<div
|
|
134
|
+
data-ref="badge"
|
|
135
|
+
data-ping={ping}
|
|
136
|
+
data-placement={placement}
|
|
137
|
+
className={classNames(
|
|
138
|
+
classes.badge,
|
|
139
|
+
className,
|
|
140
|
+
"inline-block p-px min-w-2 min-h-2 text-center select-none rounded-full leading-none z-5 pointer-events-none",
|
|
141
|
+
forButton && !placement ? "relative" : "absolute",
|
|
142
|
+
)}
|
|
143
|
+
>
|
|
144
|
+
{label && <span className="p-1">{label}</span>}
|
|
145
|
+
{icon && (
|
|
146
|
+
<Icon icon={icon} bg={iconBg} color={iconColor} rtlFlip={rtlFlip} />
|
|
147
|
+
)}
|
|
148
|
+
</div>
|
|
149
|
+
)}
|
|
146
150
|
</div>
|
|
147
151
|
);
|
|
148
152
|
};
|
|
@@ -136,6 +136,8 @@ export interface BaseProps
|
|
|
136
136
|
*/
|
|
137
137
|
hotKey?: string;
|
|
138
138
|
|
|
139
|
+
stopPropagation?: boolean;
|
|
140
|
+
|
|
139
141
|
onMouseOut?: MouseEventHandler;
|
|
140
142
|
onMouseOver?: MouseEventHandler;
|
|
141
143
|
onMouseMove?: MouseEventHandler;
|
|
@@ -175,6 +177,7 @@ export const Button = <Tag extends React.ElementType = "button">({
|
|
|
175
177
|
spinOnHover,
|
|
176
178
|
onClick,
|
|
177
179
|
actionMessage,
|
|
180
|
+
stopPropagation,
|
|
178
181
|
type = "button",
|
|
179
182
|
hotKey,
|
|
180
183
|
showActionDone,
|
|
@@ -191,7 +194,7 @@ export const Button = <Tag extends React.ElementType = "button">({
|
|
|
191
194
|
const clickHandler = useCallback(
|
|
192
195
|
(e: React.MouseEvent) => {
|
|
193
196
|
setBusy(true);
|
|
194
|
-
|
|
197
|
+
stopPropagation && e.stopPropagation();
|
|
195
198
|
const ret = onClick?.(e);
|
|
196
199
|
void Promise.resolve(ret).then((b) => {
|
|
197
200
|
setBusy(false);
|
|
@@ -200,7 +203,7 @@ export const Button = <Tag extends React.ElementType = "button">({
|
|
|
200
203
|
}
|
|
201
204
|
});
|
|
202
205
|
},
|
|
203
|
-
[onClick, disabled, actionMessage, showActionDoneEvent],
|
|
206
|
+
[onClick, disabled, actionMessage, showActionDoneEvent, stopPropagation],
|
|
204
207
|
);
|
|
205
208
|
|
|
206
209
|
/** ***************** reset done state on timeout *******************/
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
type AriaProps,
|
|
27
27
|
type ChildrenProp,
|
|
28
28
|
type ColorType,
|
|
29
|
+
type CssProp,
|
|
29
30
|
type PaletteType,
|
|
30
31
|
type TestProps,
|
|
31
32
|
} from "../../types";
|
|
@@ -33,7 +34,11 @@ import { CoreIcons } from "../../types/icons";
|
|
|
33
34
|
import { getBgClass, getBorderClass, getColorClass } from "../../utils";
|
|
34
35
|
import { Icon } from "../icon/Icon";
|
|
35
36
|
|
|
36
|
-
export interface CalloutProps
|
|
37
|
+
export interface CalloutProps
|
|
38
|
+
extends AriaProps,
|
|
39
|
+
ChildrenProp,
|
|
40
|
+
CssProp,
|
|
41
|
+
TestProps {
|
|
37
42
|
/**
|
|
38
43
|
* callout color
|
|
39
44
|
*/
|
|
@@ -69,11 +74,13 @@ export const Callout = ({
|
|
|
69
74
|
icon,
|
|
70
75
|
border,
|
|
71
76
|
onClose,
|
|
77
|
+
className,
|
|
72
78
|
...aria
|
|
73
79
|
}: CalloutProps) => {
|
|
74
80
|
return (
|
|
75
81
|
<fieldset
|
|
76
82
|
className={classNames(
|
|
83
|
+
className,
|
|
77
84
|
"block rounded-capped border max-w-full relative overflow-hidden mb-4",
|
|
78
85
|
getBgClass(color + "-50"),
|
|
79
86
|
getColorClass(color + "-700"),
|
|
@@ -78,6 +78,10 @@ export interface CollapsableProps
|
|
|
78
78
|
* open state
|
|
79
79
|
*/
|
|
80
80
|
open?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* disable collapsable
|
|
83
|
+
*/
|
|
84
|
+
disabled?: boolean;
|
|
81
85
|
/**
|
|
82
86
|
* open handler
|
|
83
87
|
*/
|
|
@@ -90,6 +94,7 @@ export interface CollapsableProps
|
|
|
90
94
|
|
|
91
95
|
export const Collapsable = ({
|
|
92
96
|
ref,
|
|
97
|
+
disabled,
|
|
93
98
|
className,
|
|
94
99
|
bodyClassName,
|
|
95
100
|
headerClassName,
|
|
@@ -135,7 +140,7 @@ export const Collapsable = ({
|
|
|
135
140
|
headerClassName,
|
|
136
141
|
iconAlign === "end" ? "flex-row-reverse" : "flex-row",
|
|
137
142
|
)}
|
|
138
|
-
onClick={() => setOpenState(!openState)}
|
|
143
|
+
onClick={() => !disabled && setOpenState(!openState)}
|
|
139
144
|
>
|
|
140
145
|
<Icon size="1.125em" icon={openState ? iconOpen : iconClosed} rtlFlip />
|
|
141
146
|
<div className="flex-1 px-2">{head}</div>
|
|
@@ -21,7 +21,7 @@
|
|
|
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 { type ElementType } from "react";
|
|
24
|
+
import { type ElementType, type MouseEvent } from "react";
|
|
25
25
|
import {
|
|
26
26
|
type AriaProps,
|
|
27
27
|
type BadgeType,
|
|
@@ -77,7 +77,7 @@ export interface MenuItemProps
|
|
|
77
77
|
/**
|
|
78
78
|
* click handler
|
|
79
79
|
*/
|
|
80
|
-
onClick?: () => CallbackReturn;
|
|
80
|
+
onClick?: (e: MouseEvent) => CallbackReturn;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
export interface MenuRootProps extends CssProp {
|
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,7 +197,7 @@ 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}
|
|
188
203
|
data-collapsed={isCollapsed}
|
|
@@ -243,7 +258,11 @@ export const Aside = ({
|
|
|
243
258
|
<section
|
|
244
259
|
ref={elementRef}
|
|
245
260
|
data-ref="asideBody"
|
|
246
|
-
className={classNames(
|
|
261
|
+
className={classNames(
|
|
262
|
+
classes.asideBody,
|
|
263
|
+
bodyClassName,
|
|
264
|
+
"overflow-hidden grid",
|
|
265
|
+
)}
|
|
247
266
|
style={isCollapsed ? widthStyles : undefined}
|
|
248
267
|
>
|
|
249
268
|
<ErrorBoundary>{children}</ErrorBoundary>
|
|
@@ -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
|
>
|