@react-fabric/core 1.0.0-beta.51 → 1.0.0-beta.53
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/components/_breadcrumbs.css +3 -3
- package/css/components/_menu.css +2 -0
- package/css/components/_modal.css +2 -2
- package/css/core/_aside.css +2 -2
- package/css/theme/_utilities.css +2 -2
- package/dist/cjs/components/actionLabel/ActionLabel.js +23 -5
- package/dist/cjs/components/animations/Animations.js +92 -9
- package/dist/cjs/components/avatar/Avatar.js +33 -3
- package/dist/cjs/components/avatar/AvatarGroup.js +19 -1
- package/dist/cjs/components/badge/Badge.js +31 -2
- package/dist/cjs/components/breadcrumbs/Breadcrumbs.js +30 -1
- package/dist/cjs/components/button/Button.js +25 -2
- package/dist/cjs/components/button/ButtonGroup.js +26 -0
- package/dist/cjs/components/button/ConfirmButton.js +22 -1
- package/dist/cjs/components/button/ToggleButtonGroup.js +38 -12
- package/dist/cjs/components/callout/Callout.js +28 -0
- package/dist/cjs/components/card/Card.js +34 -0
- package/dist/cjs/components/card/CardCover.js +26 -0
- package/dist/cjs/components/card/FlipContent.js +21 -0
- package/dist/cjs/components/chip/Chip.js +22 -1
- package/dist/cjs/components/collapsable/Collapsable.js +26 -0
- package/dist/cjs/components/divider/Divider.js +19 -0
- package/dist/cjs/components/dropdown/Dropdown.js +42 -0
- package/dist/cjs/components/empty/EmptyContent.js +27 -0
- package/dist/cjs/components/icon/Icon.js +27 -1
- package/dist/cjs/components/media/Media.js +56 -0
- package/dist/cjs/components/menu/ContextMenu.js +19 -0
- package/dist/cjs/components/menu/Menu.js +30 -0
- package/dist/cjs/components/menu/MenuItem.js +22 -1
- package/dist/cjs/components/meter/Meter.js +24 -0
- package/dist/cjs/components/navigator/Navigator.js +22 -0
- package/dist/cjs/components/panel/Panel.js +37 -0
- package/dist/cjs/components/panel/PanelGroup.js +24 -0
- package/dist/cjs/components/panel/PanelStack.js +31 -0
- package/dist/cjs/components/progress/ProgressBar.js +21 -0
- package/dist/cjs/components/progress/ProgressCircle.js +20 -0
- package/dist/cjs/components/tabpanel/Tab.js +31 -0
- package/dist/cjs/components/tabpanel/TabPanel.js +33 -0
- package/dist/cjs/context/Global.js +25 -1
- package/dist/cjs/core/aside/Aside.js +39 -2
- package/dist/cjs/core/boundary/ErrorBoundary.js +17 -1
- package/dist/cjs/core/content/Content.js +6 -1
- package/dist/cjs/core/headfoot/HeadFoot.js +42 -0
- package/dist/cjs/core/page/Page.js +26 -1
- package/dist/cjs/core/responsive/Responsive.js +55 -2
- package/dist/cjs/core/section/Section.js +11 -27
- package/dist/cjs/core/theme/ThemeProvider.js +21 -1
- package/dist/cjs/core/viewport/Viewport.js +15 -1
- package/dist/cjs/hooks/useControlledValue.js +12 -0
- package/dist/cjs/hooks/useDebounce.js +13 -0
- package/dist/cjs/hooks/useEffectDebugger.js +52 -0
- package/dist/cjs/hooks/useIsDark.js +8 -0
- package/dist/cjs/hooks/useIsRtl.js +12 -0
- package/dist/cjs/hooks/useOverlayService.js +24 -0
- package/dist/cjs/hooks/usePropToggle.js +16 -5
- package/dist/cjs/hooks/useResize.js +18 -0
- package/dist/cjs/hooks/useResizeObserver.js +19 -0
- package/dist/cjs/hooks/useStorage.js +39 -0
- package/dist/cjs/types/icons.js +4 -0
- package/dist/cjs/typography/Abbr.js +28 -1
- package/dist/cjs/typography/Anchor.js +18 -1
- package/dist/cjs/typography/Mark.js +20 -1
- package/dist/cjs/typography/Text.js +27 -1
- package/dist/cjs/typography/Title.js +16 -1
- package/dist/esm/components/actionLabel/ActionLabel.js +23 -5
- package/dist/esm/components/animations/Animations.js +92 -9
- package/dist/esm/components/avatar/Avatar.js +33 -3
- package/dist/esm/components/avatar/AvatarGroup.js +19 -1
- package/dist/esm/components/badge/Badge.js +32 -3
- package/dist/esm/components/breadcrumbs/Breadcrumbs.js +30 -1
- package/dist/esm/components/button/Button.js +25 -2
- package/dist/esm/components/button/ButtonGroup.js +26 -0
- package/dist/esm/components/button/ConfirmButton.js +22 -1
- package/dist/esm/components/button/ToggleButtonGroup.js +39 -13
- package/dist/esm/components/callout/Callout.js +28 -0
- package/dist/esm/components/card/Card.js +34 -0
- package/dist/esm/components/card/CardCover.js +26 -0
- package/dist/esm/components/card/FlipContent.js +21 -0
- package/dist/esm/components/chip/Chip.js +22 -1
- package/dist/esm/components/collapsable/Collapsable.js +26 -0
- package/dist/esm/components/divider/Divider.js +19 -0
- package/dist/esm/components/dropdown/Dropdown.js +42 -0
- package/dist/esm/components/empty/EmptyContent.js +27 -0
- package/dist/esm/components/icon/Icon.js +27 -1
- package/dist/esm/components/media/Media.js +56 -0
- package/dist/esm/components/menu/ContextMenu.js +19 -0
- package/dist/esm/components/menu/Menu.js +30 -0
- package/dist/esm/components/menu/MenuItem.js +22 -1
- package/dist/esm/components/meter/Meter.js +24 -0
- package/dist/esm/components/navigator/Navigator.js +22 -0
- package/dist/esm/components/panel/Panel.js +37 -0
- package/dist/esm/components/panel/PanelGroup.js +24 -0
- package/dist/esm/components/panel/PanelStack.js +31 -0
- package/dist/esm/components/progress/ProgressBar.js +21 -0
- package/dist/esm/components/progress/ProgressCircle.js +20 -0
- package/dist/esm/components/tabpanel/Tab.js +31 -0
- package/dist/esm/components/tabpanel/TabPanel.js +33 -0
- package/dist/esm/context/Global.js +25 -1
- package/dist/esm/core/aside/Aside.js +39 -2
- package/dist/esm/core/boundary/ErrorBoundary.js +17 -1
- package/dist/esm/core/content/Content.js +6 -1
- package/dist/esm/core/headfoot/HeadFoot.js +42 -0
- package/dist/esm/core/page/Page.js +26 -1
- package/dist/esm/core/responsive/Responsive.js +55 -2
- package/dist/esm/core/section/Section.js +11 -27
- package/dist/esm/core/theme/ThemeProvider.js +21 -1
- package/dist/esm/core/viewport/Viewport.js +15 -1
- package/dist/esm/hooks/useControlledValue.js +12 -0
- package/dist/esm/hooks/useDebounce.js +13 -0
- package/dist/esm/hooks/useEffectDebugger.js +52 -0
- package/dist/esm/hooks/useIsDark.js +8 -0
- package/dist/esm/hooks/useIsRtl.js +12 -0
- package/dist/esm/hooks/useOverlayService.js +24 -0
- package/dist/esm/hooks/usePropToggle.js +16 -5
- package/dist/esm/hooks/useResize.js +18 -0
- package/dist/esm/hooks/useResizeObserver.js +19 -0
- package/dist/esm/hooks/useStorage.js +39 -0
- package/dist/esm/types/icons.js +4 -0
- package/dist/esm/typography/Abbr.js +28 -1
- package/dist/esm/typography/Anchor.js +18 -1
- package/dist/esm/typography/Mark.js +20 -1
- package/dist/esm/typography/Text.js +27 -1
- package/dist/esm/typography/Title.js +16 -1
- package/dist/types/components/actionLabel/ActionLabel.d.ts +21 -2
- package/dist/types/components/animations/Animations.d.ts +80 -1
- package/dist/types/components/avatar/Avatar.d.ts +26 -2
- package/dist/types/components/avatar/AvatarGroup.d.ts +19 -1
- package/dist/types/components/badge/Badge.d.ts +25 -0
- package/dist/types/components/breadcrumbs/Breadcrumbs.d.ts +29 -0
- package/dist/types/components/button/Button.d.ts +23 -2
- package/dist/types/components/button/ButtonGroup.d.ts +26 -1
- package/dist/types/components/button/ConfirmButton.d.ts +23 -3
- package/dist/types/components/button/ToggleButtonGroup.d.ts +39 -11
- package/dist/types/components/callout/Callout.d.ts +26 -1
- package/dist/types/components/card/Card.d.ts +34 -0
- package/dist/types/components/card/CardCover.d.ts +25 -0
- package/dist/types/components/card/FlipContent.d.ts +21 -0
- package/dist/types/components/chip/Chip.d.ts +21 -1
- package/dist/types/components/collapsable/Collapsable.d.ts +26 -0
- package/dist/types/components/divider/Divider.d.ts +19 -0
- package/dist/types/components/dropdown/Dropdown.d.ts +40 -1
- package/dist/types/components/dropdown/DropdownTool.d.ts +25 -0
- package/dist/types/components/empty/EmptyContent.d.ts +26 -1
- package/dist/types/components/icon/Icon.d.ts +27 -2
- package/dist/types/components/media/Media.d.ts +54 -0
- package/dist/types/components/menu/ContextMenu.d.ts +19 -1
- package/dist/types/components/menu/Menu.d.ts +29 -0
- package/dist/types/components/menu/MenuItem.d.ts +22 -2
- package/dist/types/components/meter/Meter.d.ts +24 -0
- package/dist/types/components/navigator/Navigator.d.ts +22 -0
- package/dist/types/components/panel/Panel.d.ts +37 -0
- package/dist/types/components/panel/PanelGroup.d.ts +24 -0
- package/dist/types/components/panel/PanelStack.d.ts +31 -0
- package/dist/types/components/progress/ProgressBar.d.ts +20 -0
- package/dist/types/components/progress/ProgressCircle.d.ts +19 -0
- package/dist/types/components/tabpanel/Tab.d.ts +32 -1
- package/dist/types/components/tabpanel/TabPanel.d.ts +33 -0
- package/dist/types/context/Global.d.ts +24 -1
- package/dist/types/core/aside/Aside.d.ts +38 -1
- package/dist/types/core/boundary/ErrorBoundary.d.ts +17 -1
- package/dist/types/core/content/Content.d.ts +6 -1
- package/dist/types/core/headfoot/HeadFoot.d.ts +40 -0
- package/dist/types/core/page/Page.d.ts +26 -1
- package/dist/types/core/responsive/Responsive.d.ts +52 -1
- package/dist/types/core/section/Section.d.ts +18 -3
- package/dist/types/core/theme/ThemeProvider.d.ts +21 -1
- package/dist/types/core/viewport/Viewport.d.ts +15 -1
- package/dist/types/hooks/useControlledValue.d.ts +13 -2
- package/dist/types/hooks/useDebounce.d.ts +12 -0
- package/dist/types/hooks/useEffectDebugger.d.ts +49 -0
- package/dist/types/hooks/useIsDark.d.ts +8 -0
- package/dist/types/hooks/useIsRtl.d.ts +12 -0
- package/dist/types/hooks/useNavigator.d.ts +18 -1
- package/dist/types/hooks/useOverlayService.d.ts +25 -4
- package/dist/types/hooks/usePropToggle.d.ts +16 -5
- package/dist/types/hooks/useResize.d.ts +18 -0
- package/dist/types/hooks/useResizeObserver.d.ts +19 -0
- package/dist/types/hooks/useStorage.d.ts +38 -0
- package/dist/types/types/icons.d.ts +4 -0
- package/dist/types/typography/Abbr.d.ts +28 -1
- package/dist/types/typography/Anchor.d.ts +19 -2
- package/dist/types/typography/Copy.d.ts +15 -0
- package/dist/types/typography/Mark.d.ts +20 -1
- package/dist/types/typography/Text.d.ts +27 -1
- package/dist/types/typography/Title.d.ts +16 -1
- package/package.json +3 -3
- package/src/components/actionLabel/ActionLabel.tsx +23 -5
- package/src/components/animations/Animations.tsx +93 -14
- package/src/components/avatar/Avatar.tsx +32 -3
- package/src/components/avatar/AvatarGroup.tsx +19 -1
- package/src/components/badge/Badge.tsx +33 -3
- package/src/components/breadcrumbs/Breadcrumbs.tsx +30 -1
- package/src/components/button/Button.tsx +24 -2
- package/src/components/button/ButtonGroup.tsx +26 -0
- package/src/components/button/ConfirmButton.tsx +22 -1
- package/src/components/button/ToggleButtonGroup.tsx +70 -43
- package/src/components/callout/Callout.tsx +27 -0
- package/src/components/card/Card.tsx +34 -0
- package/src/components/card/CardCover.tsx +25 -0
- package/src/components/card/FlipContent.tsx +21 -0
- package/src/components/chip/Chip.tsx +21 -1
- package/src/components/collapsable/Collapsable.tsx +26 -0
- package/src/components/divider/Divider.tsx +19 -0
- package/src/components/dropdown/Dropdown.tsx +40 -0
- package/src/components/dropdown/DropdownTool.tsx +25 -0
- package/src/components/empty/EmptyContent.tsx +26 -0
- package/src/components/icon/Icon.tsx +27 -1
- package/src/components/media/Media.tsx +54 -0
- package/src/components/menu/ContextMenu.tsx +19 -0
- package/src/components/menu/Menu.tsx +29 -0
- package/src/components/menu/MenuItem.tsx +22 -1
- package/src/components/meter/Meter.tsx +24 -0
- package/src/components/navigator/Navigator.tsx +22 -0
- package/src/components/panel/Panel.tsx +37 -0
- package/src/components/panel/PanelGroup.tsx +24 -0
- package/src/components/panel/PanelStack.tsx +31 -0
- package/src/components/progress/ProgressBar.tsx +20 -0
- package/src/components/progress/ProgressCircle.tsx +19 -0
- package/src/components/tabpanel/Tab.tsx +31 -0
- package/src/components/tabpanel/TabPanel.tsx +33 -0
- package/src/context/Global.tsx +24 -1
- package/src/core/aside/Aside.tsx +39 -2
- package/src/core/boundary/ErrorBoundary.tsx +17 -1
- package/src/core/content/Content.tsx +6 -1
- package/src/core/headfoot/HeadFoot.tsx +40 -0
- package/src/core/page/Page.tsx +26 -1
- package/src/core/responsive/Responsive.tsx +53 -2
- package/src/core/section/Section.tsx +25 -2
- package/src/core/theme/ThemeProvider.tsx +21 -1
- package/src/core/viewport/Viewport.tsx +15 -1
- package/src/hooks/useControlledValue.tsx +12 -0
- package/src/hooks/useDebounce.ts +12 -0
- package/src/hooks/useEffectDebugger.ts +49 -0
- package/src/hooks/useIsDark.ts +8 -0
- package/src/hooks/useIsRtl.ts +12 -0
- package/src/hooks/useNavigator.tsx +18 -0
- package/src/hooks/useOverlayService.tsx +24 -0
- package/src/hooks/usePropToggle.ts +16 -5
- package/src/hooks/useResize.ts +18 -0
- package/src/hooks/useResizeObserver.ts +19 -0
- package/src/hooks/useStorage.ts +38 -0
- package/src/types/icons.ts +5 -1
- package/src/typography/Abbr.tsx +28 -1
- package/src/typography/Anchor.tsx +18 -1
- package/src/typography/Copy.tsx +15 -0
- package/src/typography/Mark.tsx +20 -1
- package/src/typography/Text.tsx +27 -1
- package/src/typography/Title.tsx +16 -1
|
@@ -22,7 +22,32 @@ var SizeMap = {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* A component that displays an avatar image or a fallback icon with customizable styles and properties.
|
|
26
|
+
* It supports various avatar types, including text-based avatars, and allows for customization of background color, icon color, size, and rounded corners.
|
|
27
|
+
* This component is useful for displaying user avatars in applications, providing a visual representation of users or entities.
|
|
28
|
+
* It can also handle cases where the avatar image fails to load by displaying a fallback icon or text.
|
|
29
|
+
* It uses the Boring Avatars library for generating fallback avatars based on the user's name.
|
|
30
|
+
*
|
|
31
|
+
* @param {AvatarProps} props - The properties for the Avatar component.
|
|
32
|
+
* @returns {JSX.Element} The rendered Avatar component.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```jsx
|
|
36
|
+
* <Avatar
|
|
37
|
+
* name="John Doe"
|
|
38
|
+
* avatar="https://example.com/avatar.jpg"
|
|
39
|
+
* fallbackIcon="fas fa-user"
|
|
40
|
+
* bg="bg-blue-500"
|
|
41
|
+
* color="text-white"
|
|
42
|
+
* size="md"
|
|
43
|
+
* rounded
|
|
44
|
+
* variant="beam"
|
|
45
|
+
* onClick={() => console.log("Avatar clicked")}
|
|
46
|
+
* />
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/story/core-components-avatar--docs} for more details.
|
|
50
|
+
* @see {@link https://boringavatars.com/} for more information on Boring Avatars.
|
|
26
51
|
*/
|
|
27
52
|
var Avatar = function Avatar(_ref) {
|
|
28
53
|
var ref = _ref.ref,
|
|
@@ -46,7 +71,8 @@ var Avatar = function Avatar(_ref) {
|
|
|
46
71
|
fallback = _useState2[0],
|
|
47
72
|
setFallback = _useState2[1];
|
|
48
73
|
|
|
49
|
-
|
|
74
|
+
// Memoize styles to avoid unnecessary recalculations
|
|
75
|
+
// and to ensure styles are only recalculated when dependencies change
|
|
50
76
|
var styles = useMemo(function () {
|
|
51
77
|
var s = {};
|
|
52
78
|
if (bg) {
|
|
@@ -64,7 +90,8 @@ var Avatar = function Avatar(_ref) {
|
|
|
64
90
|
return s;
|
|
65
91
|
}, [bg, color, size]);
|
|
66
92
|
|
|
67
|
-
|
|
93
|
+
// avatar image
|
|
94
|
+
// if avatar is not provided, fallback to icon or text
|
|
68
95
|
var avatarImage = useMemo(function () {
|
|
69
96
|
setFallback(!avatar);
|
|
70
97
|
return avatar && /*#__PURE__*/jsxs("div", {
|
|
@@ -85,6 +112,8 @@ var Avatar = function Avatar(_ref) {
|
|
|
85
112
|
})]
|
|
86
113
|
});
|
|
87
114
|
}, [avatar]);
|
|
115
|
+
|
|
116
|
+
// render fallback icon or text
|
|
88
117
|
var fallbackAvatar = useMemo(function () {
|
|
89
118
|
if (fallbackIcon) {
|
|
90
119
|
return isSvgPath(fallbackIcon) ? /*#__PURE__*/jsx("svg", {
|
|
@@ -119,6 +148,7 @@ var Avatar = function Avatar(_ref) {
|
|
|
119
148
|
})
|
|
120
149
|
});
|
|
121
150
|
}
|
|
151
|
+
// Fallback to BoringAvatar
|
|
122
152
|
return /*#__PURE__*/jsx(BoringAvatar, {
|
|
123
153
|
square: true,
|
|
124
154
|
size: 64,
|
|
@@ -19,7 +19,25 @@ var SizeMap = {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* A component that groups multiple avatars together, displaying a count of additional avatars if the total exceeds the visible ones.
|
|
23
|
+
* It allows customization of size, rounding, and additional aria attributes.
|
|
24
|
+
* This component is useful for displaying a collection of user avatars in a compact format, such as in a chat application or user list.
|
|
25
|
+
* It automatically calculates the number of additional avatars based on the `totalCount` prop and the number of children provided.
|
|
26
|
+
*
|
|
27
|
+
* @param {AvatarGroupProps} props - The properties for the AvatarGroup component.
|
|
28
|
+
* @returns {JSX.Element} The rendered AvatarGroup component.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```jsx
|
|
32
|
+
* <AvatarGroup totalCount={5} size="md" className="my-avatar-group">
|
|
33
|
+
* <Avatar name="John Doe" avatar="https://example.com/avatar1.jpg" />
|
|
34
|
+
* <Avatar name="Jane Smith" avatar="https://example.com/avatar2.jpg" />
|
|
35
|
+
* <Avatar name="Alice Johnson" avatar="https://example.com/avatar3.jpg" />
|
|
36
|
+
* <Avatar name="Bob Brown" avatar="https://example.com/avatar4.jpg" />
|
|
37
|
+
* </AvatarGroup>
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-avatar--docs} for more details.
|
|
23
41
|
*/
|
|
24
42
|
var AvatarGroup = function AvatarGroup(_ref) {
|
|
25
43
|
var ref = _ref.ref,
|
|
@@ -4,15 +4,22 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
4
4
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
5
|
import { isObject, isNil, isNumber, mergeRefs } from '@react-fabric/utilities';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
-
import { useMemo, cloneElement } from 'react';
|
|
7
|
+
import { isValidElement, useMemo, cloneElement } from 'react';
|
|
8
8
|
import { Icon } from '../icon/Icon.js';
|
|
9
9
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
10
|
|
|
11
11
|
var _excluded = ["ref", "className", "value", "max", "ping", "block", "inline", "placement", "children", "forButton", "icon", "iconBg", "iconColor", "rtlFlip"];
|
|
12
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
13
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
/**
|
|
15
|
+
* Utility function to get badge properties from a badge value or object.
|
|
16
|
+
* It checks if the badge is an object and returns its properties,
|
|
17
|
+
*
|
|
18
|
+
* @param {string | number | BadgeType} badge - The badge value or object.
|
|
19
|
+
* @returns {AnyObject} An object containing badge properties.
|
|
20
|
+
*/
|
|
14
21
|
var getBadgeProps = function getBadgeProps(badge) {
|
|
15
|
-
if (isObject(badge)) {
|
|
22
|
+
if (isObject(badge) && ! /*#__PURE__*/isValidElement(badge)) {
|
|
16
23
|
return Object.assign({
|
|
17
24
|
forButton: true,
|
|
18
25
|
placement: ""
|
|
@@ -25,6 +32,25 @@ var getBadgeProps = function getBadgeProps(badge) {
|
|
|
25
32
|
};
|
|
26
33
|
}
|
|
27
34
|
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A component that displays a badge with a value, icon, and optional ping animation.
|
|
38
|
+
* It can be used to indicate notifications, messages, or other important information.
|
|
39
|
+
* It supports various placements, inline or block display, and custom styling.
|
|
40
|
+
* It can also wrap children elements, allowing for flexible usage in buttons or other components.
|
|
41
|
+
*
|
|
42
|
+
* @param {BadgeProps} props - The properties for the Badge component.
|
|
43
|
+
* @returns {JSX.Element} The rendered Badge component.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```jsx
|
|
47
|
+
* <Badge value={5} max={10} ping>
|
|
48
|
+
* <button>Notifications</button>
|
|
49
|
+
* </Badge>
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-badge--docs} for more details.
|
|
53
|
+
*/
|
|
28
54
|
var Badge = function Badge(_ref) {
|
|
29
55
|
var ref = _ref.ref,
|
|
30
56
|
className = _ref.className,
|
|
@@ -44,6 +70,9 @@ var Badge = function Badge(_ref) {
|
|
|
44
70
|
rtlFlip = _ref.rtlFlip,
|
|
45
71
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
46
72
|
var label = useMemo(function () {
|
|
73
|
+
if ( /*#__PURE__*/isValidElement(value)) {
|
|
74
|
+
return value;
|
|
75
|
+
}
|
|
47
76
|
if (!isNil(value)) {
|
|
48
77
|
if (isNumber(value) && max && value > max) {
|
|
49
78
|
return "".concat(max, "+");
|
|
@@ -66,7 +95,7 @@ var Badge = function Badge(_ref) {
|
|
|
66
95
|
"data-ref": "badge",
|
|
67
96
|
"data-ping": ping,
|
|
68
97
|
"data-placement": placement,
|
|
69
|
-
className: classNames("fabric-badge", className, "inline-block p-px min-w-2 min-h-2 text-center select-none rounded-full leading-none z-2 pointer-events-none", forButton && !placement || inline ? "relative" : "absolute"),
|
|
98
|
+
className: classNames("fabric-badge", className, "inline-block p-px min-w-2 min-h-2 text-center select-none rounded-full leading-none z-2 pointer-events-none", forButton && !placement || inline ? "relative flex-content" : "absolute"),
|
|
70
99
|
children: [label && /*#__PURE__*/jsx("span", {
|
|
71
100
|
className: "p-1",
|
|
72
101
|
children: label
|
|
@@ -12,6 +12,35 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
12
12
|
var _excluded = ["variant", "className", "separator", "children", "color"];
|
|
13
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
14
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
15
|
+
/**
|
|
16
|
+
* A navigation component that displays the current page's location within a hierarchy and allows users to navigate back to previous pages.
|
|
17
|
+
* It supports different styles, separators, and colors, and can handle a variable number of breadcrumb links.
|
|
18
|
+
* This component is useful for enhancing user navigation experience in applications with multiple levels of content hierarchy.
|
|
19
|
+
* It automatically manages the display of overflow items when there are too many links to fit in the available space, providing a dropdown for additional links.
|
|
20
|
+
*
|
|
21
|
+
* @param {BreadcrumbProps} props - The properties for the Breadcrumbs component.
|
|
22
|
+
* @returns {JSX.Element} The rendered Breadcrumbs component.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```jsx
|
|
26
|
+
* <Breadcrumbs
|
|
27
|
+
* variant="classic"
|
|
28
|
+
* separator=">"
|
|
29
|
+
* color="primary"
|
|
30
|
+
* className="my-custom-class"
|
|
31
|
+
* aria-label="Breadcrumbs"
|
|
32
|
+
* >
|
|
33
|
+
* <Anchor href="/">Home</Anchor>
|
|
34
|
+
* <Anchor href="/products">Products</Anchor>
|
|
35
|
+
* <Anchor href="/products/shoes">Shoes</Anchor>
|
|
36
|
+
* <Anchor href="/products/shoes/sneakers">Sneakers</Anchor>
|
|
37
|
+
* <Anchor href="/products/shoes/sneakers/nike">Nike</Anchor>
|
|
38
|
+
* <Anchor href="/products/shoes/sneakers/nike/airmax">Air Max</Anchor>
|
|
39
|
+
* </Breadcrumbs>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-breadcrumbs--docs} for more details.
|
|
43
|
+
*/
|
|
15
44
|
var Breadcrumbs = function Breadcrumbs(_ref) {
|
|
16
45
|
var _ref$variant = _ref.variant,
|
|
17
46
|
variant = _ref$variant === void 0 ? "classic" : _ref$variant,
|
|
@@ -22,7 +51,7 @@ var Breadcrumbs = function Breadcrumbs(_ref) {
|
|
|
22
51
|
color = _ref.color,
|
|
23
52
|
aria = _objectWithoutProperties(_ref, _excluded);
|
|
24
53
|
var _useMemo = useMemo(function () {
|
|
25
|
-
var nodeList = Children.toArray(children);
|
|
54
|
+
var nodeList = Children.toArray(children).filter(Boolean);
|
|
26
55
|
if (nodeList.length > 7) {
|
|
27
56
|
return [nodeList.slice(0, 3), nodeList.slice(3, -3), nodeList.slice(-3)];
|
|
28
57
|
}
|
|
@@ -20,7 +20,28 @@ var _excluded = ["as", "ref", "children", "className", "active", "color", "icon"
|
|
|
20
20
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
21
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* A versatile button component that supports various styles, icons, and actions.
|
|
24
|
+
* It can be used as a primary action button, with options for loading states, action messages, and more.
|
|
25
|
+
* It supports polymorphic rendering, allowing it to be used as different HTML elements (e.g., button, a, div).
|
|
26
|
+
* It also includes features like after action tooltips, badges, and keyboard shortcuts.
|
|
27
|
+
*
|
|
28
|
+
* @param {ButtonProps} props - The properties for the Button component.
|
|
29
|
+
* @returns {JSX.Element} The rendered Button component.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```jsx
|
|
33
|
+
* <Button
|
|
34
|
+
* color="primary"
|
|
35
|
+
* size="md"
|
|
36
|
+
* variant="solid"
|
|
37
|
+
* icon="check"
|
|
38
|
+
* onClick={() => console.log("Button clicked!")}
|
|
39
|
+
* >
|
|
40
|
+
* Click Me
|
|
41
|
+
* </Button>
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-button--docs} for more details.
|
|
24
45
|
*/
|
|
25
46
|
var Button = function Button(_ref) {
|
|
26
47
|
var as = _ref.as,
|
|
@@ -67,6 +88,8 @@ var Button = function Button(_ref) {
|
|
|
67
88
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
68
89
|
actionDone = _useState4[0],
|
|
69
90
|
setActionDone = _useState4[1];
|
|
91
|
+
|
|
92
|
+
// Handle click events
|
|
70
93
|
var clickHandler = useCallback(function (e) {
|
|
71
94
|
setBusy(true);
|
|
72
95
|
stopPropagation && e.stopPropagation();
|
|
@@ -151,7 +174,7 @@ var Button = function Button(_ref) {
|
|
|
151
174
|
className: classNames("fabric-buttonLabel", "truncate"),
|
|
152
175
|
"data-colored-icon": !!iconBg,
|
|
153
176
|
children: children
|
|
154
|
-
}), !isNil(badge) && /*#__PURE__*/jsx(Badge, _objectSpread({}, badgeProps)), hotKey && /*#__PURE__*/jsx(HotKeyLabel, {
|
|
177
|
+
}), !isNil(badge) && /*#__PURE__*/jsx(Badge, _objectSpread({}, badgeProps)), hotKey && children && /*#__PURE__*/jsx(HotKeyLabel, {
|
|
155
178
|
keyCombo: hotKey
|
|
156
179
|
}), altIcon && /*#__PURE__*/jsx(Icon, {
|
|
157
180
|
className: "fabric-altIcon",
|
|
@@ -11,6 +11,32 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
11
11
|
var _excluded = ["vertical", "className", "children", "variant", "rounded", "disabled", "fullWidth", "color", "size"];
|
|
12
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
13
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
/**
|
|
15
|
+
* A component that groups buttons together, allowing for consistent styling and behavior across multiple buttons.
|
|
16
|
+
* It supports vertical orientation, various button styles, and can handle properties like size, color, and disabled state.
|
|
17
|
+
* This component is useful for creating button groups that maintain a uniform appearance and functionality,
|
|
18
|
+
* such as toolbars, action groups, or navigation buttons.
|
|
19
|
+
*
|
|
20
|
+
* @param {ButtonGroupProps} props - The properties for the ButtonGroup component.
|
|
21
|
+
* @returns {JSX.Element} The rendered ButtonGroup component.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```jsx
|
|
25
|
+
* <ButtonGroup
|
|
26
|
+
* variant="solid"
|
|
27
|
+
* color="primary"
|
|
28
|
+
* className="my-custom-class"
|
|
29
|
+
* aria-label="Button Group"
|
|
30
|
+
* vertical
|
|
31
|
+
* >
|
|
32
|
+
* <Button>Button 1</Button>
|
|
33
|
+
* <Button>Button 2</Button>
|
|
34
|
+
* <Button>Button 3</Button>
|
|
35
|
+
* </ButtonGroup>
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-buttongroup--docs} for more details.
|
|
39
|
+
*/
|
|
14
40
|
var ButtonGroup = function ButtonGroup(_ref) {
|
|
15
41
|
var vertical = _ref.vertical,
|
|
16
42
|
className = _ref.className,
|
|
@@ -16,7 +16,28 @@ var _excluded = ["ref", "message", "color", "okLabel", "cancelLabel", "onClick",
|
|
|
16
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* A button that shows a confirmation dialog when clicked, allowing the user to confirm or cancel an action.
|
|
20
|
+
* It supports custom messages, labels, and loading states.
|
|
21
|
+
* This component is useful for actions that require user confirmation, such as deleting items or submitting forms.
|
|
22
|
+
* It uses the Floating UI library to manage the positioning of the confirmation dialog, ensuring it appears correctly relative to the button.
|
|
23
|
+
* It also supports custom placement of the dialog, and can display an action message when the action is completed.
|
|
24
|
+
*
|
|
25
|
+
* @param {ConfirmButtonProps} props - The properties for the ConfirmButton component.
|
|
26
|
+
* @returns {JSX.Element} The rendered ConfirmButton component.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```jsx
|
|
30
|
+
* <ConfirmButton
|
|
31
|
+
* message="Are you sure you want to delete this item?"
|
|
32
|
+
* onClick={(confirmed) => {
|
|
33
|
+
* if (confirmed) {
|
|
34
|
+
* // Perform action
|
|
35
|
+
* }
|
|
36
|
+
* }}
|
|
37
|
+
* />
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-confirmbutton--docs} for more details.
|
|
20
41
|
*/
|
|
21
42
|
var ConfirmButton = function ConfirmButton(_ref) {
|
|
22
43
|
var ref = _ref.ref,
|
|
@@ -5,7 +5,7 @@ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
|
5
5
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
6
6
|
import { isArray, EMPTY_ARRAY } from '@react-fabric/utilities';
|
|
7
7
|
import classNames from 'classnames';
|
|
8
|
-
import {
|
|
8
|
+
import { useCallback, cloneElement } from 'react';
|
|
9
9
|
import { useControlledValue } from '../../hooks/useControlledValue.js';
|
|
10
10
|
import { cloneChildren } from '../../utils/cloneElement.js';
|
|
11
11
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -13,6 +13,34 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
13
13
|
var _excluded = ["vertical", "className", "children", "variant", "rounded", "disabled", "fullWidth", "color", "size", "value", "onChange"];
|
|
14
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
|
+
/**
|
|
17
|
+
* A component that groups toggle buttons together, allowing for consistent styling and behavior across multiple toggle buttons.
|
|
18
|
+
* It supports vertical orientation, various button styles, and can handle properties like size, color, and disabled state.
|
|
19
|
+
* This component is useful for creating toggle button groups that maintain a uniform appearance and functionality,
|
|
20
|
+
* such as toggle switches, selection groups, or multi-select options.
|
|
21
|
+
*
|
|
22
|
+
* @param {ToggleButtonGroupProps} props - The properties for the ToggleButtonGroup component.
|
|
23
|
+
* @returns {JSX.Element} The rendered ToggleButtonGroup component.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```jsx
|
|
27
|
+
* <ToggleButtonGroup
|
|
28
|
+
* value={selectedValues}
|
|
29
|
+
* onChange={(newValues) => setSelectedValues(newValues)}
|
|
30
|
+
* variant="outline"
|
|
31
|
+
* color="primary"
|
|
32
|
+
* size="md"
|
|
33
|
+
* rounded
|
|
34
|
+
* fullWidth
|
|
35
|
+
* >
|
|
36
|
+
* <Button value="option1">Option 1</Button>
|
|
37
|
+
* <Button value="option2">Option 2</Button>
|
|
38
|
+
* <Button value="option3">Option 3</Button>
|
|
39
|
+
* </ToggleButtonGroup>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-togglebuttongroup--docs} for more details.
|
|
43
|
+
*/
|
|
16
44
|
var ToggleButtonGroup = function ToggleButtonGroup(_ref) {
|
|
17
45
|
var vertical = _ref.vertical,
|
|
18
46
|
className = _ref.className,
|
|
@@ -26,19 +54,18 @@ var ToggleButtonGroup = function ToggleButtonGroup(_ref) {
|
|
|
26
54
|
value = _ref.value,
|
|
27
55
|
onChange = _ref.onChange,
|
|
28
56
|
aria = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
-
var
|
|
30
|
-
return isArray(value);
|
|
31
|
-
}, [value]);
|
|
32
|
-
var _useControlledValue = useControlledValue(value, isArray(value) ? EMPTY_ARRAY : ""),
|
|
57
|
+
var _useControlledValue = useControlledValue(value, isArray(value) ? EMPTY_ARRAY : null),
|
|
33
58
|
currentValue = _useControlledValue.currentValue,
|
|
34
59
|
updateValue = _useControlledValue.updateValue;
|
|
35
|
-
var clickHandler = useCallback(function (cb) {
|
|
60
|
+
var clickHandler = useCallback(function (cb, childValue) {
|
|
36
61
|
return function (e) {
|
|
37
|
-
var newValue
|
|
62
|
+
var newValue;
|
|
38
63
|
if (isArray(currentValue)) {
|
|
39
|
-
if (currentValue.includes(
|
|
40
|
-
return v !==
|
|
41
|
-
});else newValue = [].concat(_toConsumableArray(currentValue), [
|
|
64
|
+
if (currentValue.includes(childValue)) newValue = currentValue.filter(function (v) {
|
|
65
|
+
return v !== childValue;
|
|
66
|
+
});else newValue = [].concat(_toConsumableArray(currentValue), [childValue]);
|
|
67
|
+
} else {
|
|
68
|
+
newValue = childValue;
|
|
42
69
|
}
|
|
43
70
|
updateValue(newValue);
|
|
44
71
|
onChange === null || onChange === void 0 || onChange(newValue);
|
|
@@ -57,9 +84,8 @@ var ToggleButtonGroup = function ToggleButtonGroup(_ref) {
|
|
|
57
84
|
rounded: rounded,
|
|
58
85
|
fullWidth: fullWidth
|
|
59
86
|
}, child.props), {}, {
|
|
60
|
-
onClick: clickHandler(child.props.onClick),
|
|
61
|
-
"data-
|
|
62
|
-
"data-checked": isMultiple ? currentValue.includes(child.props.value) : currentValue === child.props.value
|
|
87
|
+
onClick: clickHandler(child.props.onClick, child.props.value),
|
|
88
|
+
"data-checked": isArray(currentValue) ? currentValue === null || currentValue === void 0 ? void 0 : currentValue.includes(child.props.value) : currentValue === child.props.value
|
|
63
89
|
}));
|
|
64
90
|
})
|
|
65
91
|
}));
|
|
@@ -10,6 +10,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
10
10
|
var _excluded = ["children", "color", "legend", "title", "icon", "border", "onClose", "className"];
|
|
11
11
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
12
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
+
// colors for different callout types
|
|
13
14
|
var colors = {
|
|
14
15
|
none: "bg-base text-tint-900 border-tint-100",
|
|
15
16
|
tint: "bg-tint-50/50 text-tint-800 border-tint-300",
|
|
@@ -20,6 +21,33 @@ var colors = {
|
|
|
20
21
|
success: "bg-success-50/50 text-success-800 border-success-300",
|
|
21
22
|
warning: "bg-warning-50/50 text-warning-800 border-warning-300"
|
|
22
23
|
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A component that displays a callout box with an optional title, icon, and legend.
|
|
27
|
+
* It can be used to highlight important information, warnings, or notices.
|
|
28
|
+
* The callout can be styled with different colors and border styles, and it supports a close action.
|
|
29
|
+
* This component is useful for drawing attention to specific content within a page or application,
|
|
30
|
+
* such as alerts, notifications, or important messages.
|
|
31
|
+
*
|
|
32
|
+
* @param {CalloutProps} props - The properties for the Callout component.
|
|
33
|
+
* @returns {JSX.Element} The rendered Callout component.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```jsx
|
|
37
|
+
* <Callout
|
|
38
|
+
* color="primary"
|
|
39
|
+
* legend="Important Notice"
|
|
40
|
+
* title="Attention Required"
|
|
41
|
+
* icon="info"
|
|
42
|
+
* onClose={() => console.log("Callout closed")}
|
|
43
|
+
* >
|
|
44
|
+
* This is an important message that requires your attention.
|
|
45
|
+
* </Callout>
|
|
46
|
+
* // Renders a callout box with a primary color, an icon, a title, and a close button.
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/story/core-components-callout--docs} for more details.
|
|
50
|
+
*/
|
|
23
51
|
var Callout = function Callout(_ref) {
|
|
24
52
|
var children = _ref.children,
|
|
25
53
|
_ref$color = _ref.color,
|
|
@@ -14,6 +14,40 @@ import { nodeCheck } from '../../utils/nodeCheck.js';
|
|
|
14
14
|
var _excluded = ["children", "className", "bodyClassName", "selected", "selectedRibbon", "onClick", "onDragStart", "flex", "draggable", "dragKey", "dragData", "ref"];
|
|
15
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
|
+
/**
|
|
18
|
+
* A component that displays a card with a header, body, and footer. It can be used to display content in a structured format.
|
|
19
|
+
* It supports various features such as click handling, drag-and-drop functionality, and customizable styles.
|
|
20
|
+
* The Card component is designed to be flexible and can be used in various contexts, such as displaying user profiles, product information, or any other content that benefits from a card layout.
|
|
21
|
+
* The component accepts children that can include a Header, body content, and a Footer.
|
|
22
|
+
* It also supports additional properties for styling, accessibility, and interaction.
|
|
23
|
+
* It can be styled with custom CSS classes and supports features like selection indication and drag-and-drop functionality.
|
|
24
|
+
*
|
|
25
|
+
* @param {CardProps} props - The properties for the Card component.
|
|
26
|
+
* @returns {JSX.Element} The rendered Card component.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```jsx
|
|
30
|
+
* <Card
|
|
31
|
+
* className="my-custom-class"
|
|
32
|
+
* bodyClassName="my-body-class"
|
|
33
|
+
* selected={true}
|
|
34
|
+
* selectedRibbon={true}
|
|
35
|
+
* onClick={() => console.log("Card clicked")}
|
|
36
|
+
* onDragStart={(event, key, data) => console.log("Drag started", key, data)}
|
|
37
|
+
* flex={true}
|
|
38
|
+
* draggable={true}
|
|
39
|
+
* dragKey="my-drag-key"
|
|
40
|
+
* dragData={{ id: 1, name: "Card Data" }}
|
|
41
|
+
* aria-label="My Card"
|
|
42
|
+
* >
|
|
43
|
+
* <Header>Card Header</Header>
|
|
44
|
+
* <div>Card Body Content</div>
|
|
45
|
+
* <Footer>Card Footer</Footer>
|
|
46
|
+
* </Card>
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-card--docs} for more details.
|
|
50
|
+
*/
|
|
17
51
|
var Card = function Card(_ref) {
|
|
18
52
|
var children = _ref.children,
|
|
19
53
|
className = _ref.className,
|
|
@@ -18,6 +18,32 @@ var scheme = {
|
|
|
18
18
|
light: "light",
|
|
19
19
|
dark: "dark"
|
|
20
20
|
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A cover component for cards that can contain media and content.
|
|
24
|
+
* It allows for flexible layout options and supports different color schemes.
|
|
25
|
+
* It can be used to create visually appealing card layouts with media content.
|
|
26
|
+
*
|
|
27
|
+
* @param {CardCoverProps} props - The properties for the CardCover component.
|
|
28
|
+
* @returns {JSX.Element} The rendered CardCover component.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```jsx
|
|
32
|
+
* <CardCover
|
|
33
|
+
* height={200}
|
|
34
|
+
* colorScheme="light"
|
|
35
|
+
* justify="center"
|
|
36
|
+
* className="my-custom-class"
|
|
37
|
+
* aria-label="Card Cover"
|
|
38
|
+
* >
|
|
39
|
+
* <Image src="image.jpg" alt="Card Image" />
|
|
40
|
+
* <div>Card Content</div>
|
|
41
|
+
* </CardCover>
|
|
42
|
+
* // Renders a card cover with a height of 200px, light color scheme, centered content, and a custom class name.
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/story/core-components-card--docs} for more details.
|
|
46
|
+
*/
|
|
21
47
|
var CardCover = function CardCover(_ref) {
|
|
22
48
|
var className = _ref.className,
|
|
23
49
|
children = _ref.children,
|
|
@@ -5,6 +5,27 @@ import classNames from 'classnames';
|
|
|
5
5
|
import { useState, useImperativeHandle, Children, isValidElement, cloneElement } from 'react';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A component that allows flipping between front and back content.
|
|
10
|
+
* It uses a ref to control the flipping action, which toggles the visibility of the front and back content.
|
|
11
|
+
* The component accepts children elements, which should be valid React elements representing the front and back content.
|
|
12
|
+
* The front content is expected to be the first child, and the back content is expected to be the second child.
|
|
13
|
+
* The component applies specific classes to the children based on their position (front or back) and manages the flipping state internally.
|
|
14
|
+
* The `flipCard` method can be called to toggle the visibility of the back content.
|
|
15
|
+
*
|
|
16
|
+
* @param {Props} props - The properties for the FlipContent component.
|
|
17
|
+
* @returns {JSX.Element} The rendered FlipContent component.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```jsx
|
|
21
|
+
* <FlipContent ref={flipRef}>
|
|
22
|
+
* <div className="front">Front Content</div>
|
|
23
|
+
* <div className="back">Back Content</div>
|
|
24
|
+
* </FlipContent>
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-flipcontent--docs}
|
|
28
|
+
*/
|
|
8
29
|
var FlipContent = function FlipContent(_ref) {
|
|
9
30
|
var ref = _ref.ref,
|
|
10
31
|
children = _ref.children;
|
|
@@ -20,6 +20,27 @@ var SizeMap = {
|
|
|
20
20
|
lg: "1.5rem",
|
|
21
21
|
xl: "2rem"
|
|
22
22
|
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A component that represents a small block of information, often used for tags, categories, or actions.
|
|
26
|
+
* It allows customization of size, color, variant, and includes optional icon and remove functionality.
|
|
27
|
+
* It supports various properties for styling and interaction, including click handlers and disabled state.
|
|
28
|
+
* It can be used in various contexts, such as filtering options, displaying tags, or representing user actions.
|
|
29
|
+
* It can be styled with custom CSS classes and supports features like rounded edges and click handling.
|
|
30
|
+
* It can also include an icon and a remove button, making it versatile for different use cases.
|
|
31
|
+
*
|
|
32
|
+
* @param {ChipProps} props - The properties for the Chip component.
|
|
33
|
+
* @returns {JSX.Element} The rendered Chip component.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```jsx
|
|
37
|
+
* <Chip color="primary" size="md" className="my-chip">
|
|
38
|
+
* Example Chip
|
|
39
|
+
* </Chip>
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-chip--docs} for more details.
|
|
43
|
+
*/
|
|
23
44
|
var Chip = function Chip(_ref) {
|
|
24
45
|
var ref = _ref.ref,
|
|
25
46
|
children = _ref.children,
|
|
@@ -74,7 +95,7 @@ var Chip = function Chip(_ref) {
|
|
|
74
95
|
}, aria), {}, {
|
|
75
96
|
children: [icon && /*#__PURE__*/jsx(Icon, {
|
|
76
97
|
"data-ref": "chipIcon",
|
|
77
|
-
className: classNames("fabric-chipIcon", "m-1"),
|
|
98
|
+
className: classNames("fabric-chipIcon", "m-1 flex-auto"),
|
|
78
99
|
icon: icon,
|
|
79
100
|
bg: iconBg,
|
|
80
101
|
onClick: onIconClick,
|
|
@@ -13,6 +13,32 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
13
13
|
var _excluded = ["ref", "disabled", "className", "bodyClassName", "headerClassName", "children", "iconAlign", "stickyHeader", "iconClosed", "iconOpen", "open", "onClose", "onOpen"];
|
|
14
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
|
+
/**
|
|
17
|
+
* A component that can be expanded or collapsed to show or hide content.
|
|
18
|
+
* It is useful for organizing content in a way that allows users to focus on the information they are interested in.
|
|
19
|
+
* It supports custom icons for open and closed states, alignment options, and can be made sticky.
|
|
20
|
+
* This component is ideal for creating accordions, expandable panels, or sections that can be toggled by the user.
|
|
21
|
+
*
|
|
22
|
+
* @param {CollapsableProps} props - The properties for the Collapsable component.
|
|
23
|
+
* @returns {JSX.Element} The rendered Collapsable component.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```jsx
|
|
27
|
+
* <Collapsable
|
|
28
|
+
* iconAlign="start"
|
|
29
|
+
* iconOpen={CoreIcons.chevronDown}
|
|
30
|
+
* iconClosed={CoreIcons.chevronRight}
|
|
31
|
+
* open={true}
|
|
32
|
+
* onOpen={() => console.log("Opened")}
|
|
33
|
+
* onClose={() => console.log("Closed")}
|
|
34
|
+
* >
|
|
35
|
+
* <div>Header Content</div>
|
|
36
|
+
* <div>Body Content</div>
|
|
37
|
+
* </Collapsable>
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-collapsable--docs} for more details.
|
|
41
|
+
*/
|
|
16
42
|
var Collapsable = function Collapsable(_ref) {
|
|
17
43
|
var ref = _ref.ref,
|
|
18
44
|
disabled = _ref.disabled,
|