@react-fabric/core 1.0.0-beta.51 → 1.0.0-beta.52

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 (242) hide show
  1. package/css/components/_modal.css +2 -2
  2. package/dist/cjs/components/actionLabel/ActionLabel.js +23 -5
  3. package/dist/cjs/components/animations/Animations.js +92 -9
  4. package/dist/cjs/components/avatar/Avatar.js +33 -3
  5. package/dist/cjs/components/avatar/AvatarGroup.js +19 -1
  6. package/dist/cjs/components/badge/Badge.js +30 -1
  7. package/dist/cjs/components/breadcrumbs/Breadcrumbs.js +29 -0
  8. package/dist/cjs/components/button/Button.js +24 -1
  9. package/dist/cjs/components/button/ButtonGroup.js +26 -0
  10. package/dist/cjs/components/button/ConfirmButton.js +22 -1
  11. package/dist/cjs/components/button/ToggleButtonGroup.js +38 -12
  12. package/dist/cjs/components/callout/Callout.js +28 -0
  13. package/dist/cjs/components/card/Card.js +34 -0
  14. package/dist/cjs/components/card/CardCover.js +26 -0
  15. package/dist/cjs/components/card/FlipContent.js +21 -0
  16. package/dist/cjs/components/chip/Chip.js +22 -1
  17. package/dist/cjs/components/collapsable/Collapsable.js +26 -0
  18. package/dist/cjs/components/divider/Divider.js +19 -0
  19. package/dist/cjs/components/dropdown/Dropdown.js +42 -0
  20. package/dist/cjs/components/empty/EmptyContent.js +27 -0
  21. package/dist/cjs/components/icon/Icon.js +27 -1
  22. package/dist/cjs/components/media/Media.js +56 -0
  23. package/dist/cjs/components/menu/ContextMenu.js +19 -0
  24. package/dist/cjs/components/menu/Menu.js +30 -0
  25. package/dist/cjs/components/menu/MenuItem.js +21 -0
  26. package/dist/cjs/components/meter/Meter.js +24 -0
  27. package/dist/cjs/components/navigator/Navigator.js +22 -0
  28. package/dist/cjs/components/panel/Panel.js +37 -0
  29. package/dist/cjs/components/panel/PanelGroup.js +24 -0
  30. package/dist/cjs/components/panel/PanelStack.js +31 -0
  31. package/dist/cjs/components/progress/ProgressBar.js +21 -0
  32. package/dist/cjs/components/progress/ProgressCircle.js +20 -0
  33. package/dist/cjs/components/tabpanel/Tab.js +31 -0
  34. package/dist/cjs/components/tabpanel/TabPanel.js +33 -0
  35. package/dist/cjs/context/Global.js +25 -1
  36. package/dist/cjs/core/aside/Aside.js +39 -2
  37. package/dist/cjs/core/boundary/ErrorBoundary.js +17 -1
  38. package/dist/cjs/core/content/Content.js +6 -1
  39. package/dist/cjs/core/headfoot/HeadFoot.js +42 -0
  40. package/dist/cjs/core/page/Page.js +26 -1
  41. package/dist/cjs/core/responsive/Responsive.js +54 -1
  42. package/dist/cjs/core/theme/ThemeProvider.js +21 -1
  43. package/dist/cjs/core/viewport/Viewport.js +15 -1
  44. package/dist/cjs/hooks/useControlledValue.js +12 -0
  45. package/dist/cjs/hooks/useDebounce.js +13 -0
  46. package/dist/cjs/hooks/useEffectDebugger.js +52 -0
  47. package/dist/cjs/hooks/useIsDark.js +8 -0
  48. package/dist/cjs/hooks/useIsRtl.js +12 -0
  49. package/dist/cjs/hooks/useOverlayService.js +24 -0
  50. package/dist/cjs/hooks/usePropToggle.js +16 -5
  51. package/dist/cjs/hooks/useResize.js +18 -0
  52. package/dist/cjs/hooks/useResizeObserver.js +19 -0
  53. package/dist/cjs/hooks/useStorage.js +39 -0
  54. package/dist/cjs/types/icons.js +4 -0
  55. package/dist/cjs/typography/Abbr.js +28 -1
  56. package/dist/cjs/typography/Anchor.js +18 -1
  57. package/dist/cjs/typography/Mark.js +20 -1
  58. package/dist/cjs/typography/Text.js +27 -1
  59. package/dist/cjs/typography/Title.js +16 -1
  60. package/dist/esm/components/actionLabel/ActionLabel.js +23 -5
  61. package/dist/esm/components/animations/Animations.js +92 -9
  62. package/dist/esm/components/avatar/Avatar.js +33 -3
  63. package/dist/esm/components/avatar/AvatarGroup.js +19 -1
  64. package/dist/esm/components/badge/Badge.js +31 -2
  65. package/dist/esm/components/breadcrumbs/Breadcrumbs.js +29 -0
  66. package/dist/esm/components/button/Button.js +24 -1
  67. package/dist/esm/components/button/ButtonGroup.js +26 -0
  68. package/dist/esm/components/button/ConfirmButton.js +22 -1
  69. package/dist/esm/components/button/ToggleButtonGroup.js +39 -13
  70. package/dist/esm/components/callout/Callout.js +28 -0
  71. package/dist/esm/components/card/Card.js +34 -0
  72. package/dist/esm/components/card/CardCover.js +26 -0
  73. package/dist/esm/components/card/FlipContent.js +21 -0
  74. package/dist/esm/components/chip/Chip.js +22 -1
  75. package/dist/esm/components/collapsable/Collapsable.js +26 -0
  76. package/dist/esm/components/divider/Divider.js +19 -0
  77. package/dist/esm/components/dropdown/Dropdown.js +42 -0
  78. package/dist/esm/components/empty/EmptyContent.js +27 -0
  79. package/dist/esm/components/icon/Icon.js +27 -1
  80. package/dist/esm/components/media/Media.js +56 -0
  81. package/dist/esm/components/menu/ContextMenu.js +19 -0
  82. package/dist/esm/components/menu/Menu.js +30 -0
  83. package/dist/esm/components/menu/MenuItem.js +21 -0
  84. package/dist/esm/components/meter/Meter.js +24 -0
  85. package/dist/esm/components/navigator/Navigator.js +22 -0
  86. package/dist/esm/components/panel/Panel.js +37 -0
  87. package/dist/esm/components/panel/PanelGroup.js +24 -0
  88. package/dist/esm/components/panel/PanelStack.js +31 -0
  89. package/dist/esm/components/progress/ProgressBar.js +21 -0
  90. package/dist/esm/components/progress/ProgressCircle.js +20 -0
  91. package/dist/esm/components/tabpanel/Tab.js +31 -0
  92. package/dist/esm/components/tabpanel/TabPanel.js +33 -0
  93. package/dist/esm/context/Global.js +25 -1
  94. package/dist/esm/core/aside/Aside.js +39 -2
  95. package/dist/esm/core/boundary/ErrorBoundary.js +17 -1
  96. package/dist/esm/core/content/Content.js +6 -1
  97. package/dist/esm/core/headfoot/HeadFoot.js +42 -0
  98. package/dist/esm/core/page/Page.js +26 -1
  99. package/dist/esm/core/responsive/Responsive.js +54 -1
  100. package/dist/esm/core/theme/ThemeProvider.js +21 -1
  101. package/dist/esm/core/viewport/Viewport.js +15 -1
  102. package/dist/esm/hooks/useControlledValue.js +12 -0
  103. package/dist/esm/hooks/useDebounce.js +13 -0
  104. package/dist/esm/hooks/useEffectDebugger.js +52 -0
  105. package/dist/esm/hooks/useIsDark.js +8 -0
  106. package/dist/esm/hooks/useIsRtl.js +12 -0
  107. package/dist/esm/hooks/useOverlayService.js +24 -0
  108. package/dist/esm/hooks/usePropToggle.js +16 -5
  109. package/dist/esm/hooks/useResize.js +18 -0
  110. package/dist/esm/hooks/useResizeObserver.js +19 -0
  111. package/dist/esm/hooks/useStorage.js +39 -0
  112. package/dist/esm/types/icons.js +4 -0
  113. package/dist/esm/typography/Abbr.js +28 -1
  114. package/dist/esm/typography/Anchor.js +18 -1
  115. package/dist/esm/typography/Mark.js +20 -1
  116. package/dist/esm/typography/Text.js +27 -1
  117. package/dist/esm/typography/Title.js +16 -1
  118. package/dist/types/components/actionLabel/ActionLabel.d.ts +21 -2
  119. package/dist/types/components/animations/Animations.d.ts +80 -1
  120. package/dist/types/components/avatar/Avatar.d.ts +26 -2
  121. package/dist/types/components/avatar/AvatarGroup.d.ts +19 -1
  122. package/dist/types/components/badge/Badge.d.ts +25 -0
  123. package/dist/types/components/breadcrumbs/Breadcrumbs.d.ts +29 -0
  124. package/dist/types/components/button/Button.d.ts +23 -2
  125. package/dist/types/components/button/ButtonGroup.d.ts +26 -1
  126. package/dist/types/components/button/ConfirmButton.d.ts +23 -3
  127. package/dist/types/components/button/ToggleButtonGroup.d.ts +39 -11
  128. package/dist/types/components/callout/Callout.d.ts +26 -1
  129. package/dist/types/components/card/Card.d.ts +34 -0
  130. package/dist/types/components/card/CardCover.d.ts +25 -0
  131. package/dist/types/components/card/FlipContent.d.ts +21 -0
  132. package/dist/types/components/chip/Chip.d.ts +21 -1
  133. package/dist/types/components/collapsable/Collapsable.d.ts +26 -0
  134. package/dist/types/components/divider/Divider.d.ts +19 -0
  135. package/dist/types/components/dropdown/Dropdown.d.ts +40 -1
  136. package/dist/types/components/dropdown/DropdownTool.d.ts +25 -0
  137. package/dist/types/components/empty/EmptyContent.d.ts +26 -1
  138. package/dist/types/components/icon/Icon.d.ts +27 -2
  139. package/dist/types/components/media/Media.d.ts +54 -0
  140. package/dist/types/components/menu/ContextMenu.d.ts +19 -1
  141. package/dist/types/components/menu/Menu.d.ts +29 -0
  142. package/dist/types/components/menu/MenuItem.d.ts +22 -2
  143. package/dist/types/components/meter/Meter.d.ts +24 -0
  144. package/dist/types/components/navigator/Navigator.d.ts +22 -0
  145. package/dist/types/components/panel/Panel.d.ts +37 -0
  146. package/dist/types/components/panel/PanelGroup.d.ts +24 -0
  147. package/dist/types/components/panel/PanelStack.d.ts +31 -0
  148. package/dist/types/components/progress/ProgressBar.d.ts +20 -0
  149. package/dist/types/components/progress/ProgressCircle.d.ts +19 -0
  150. package/dist/types/components/tabpanel/Tab.d.ts +32 -1
  151. package/dist/types/components/tabpanel/TabPanel.d.ts +33 -0
  152. package/dist/types/context/Global.d.ts +24 -1
  153. package/dist/types/core/aside/Aside.d.ts +38 -1
  154. package/dist/types/core/boundary/ErrorBoundary.d.ts +17 -1
  155. package/dist/types/core/content/Content.d.ts +6 -1
  156. package/dist/types/core/headfoot/HeadFoot.d.ts +40 -0
  157. package/dist/types/core/page/Page.d.ts +26 -1
  158. package/dist/types/core/responsive/Responsive.d.ts +52 -1
  159. package/dist/types/core/section/Section.d.ts +16 -1
  160. package/dist/types/core/theme/ThemeProvider.d.ts +21 -1
  161. package/dist/types/core/viewport/Viewport.d.ts +15 -1
  162. package/dist/types/hooks/useControlledValue.d.ts +13 -2
  163. package/dist/types/hooks/useDebounce.d.ts +12 -0
  164. package/dist/types/hooks/useEffectDebugger.d.ts +49 -0
  165. package/dist/types/hooks/useIsDark.d.ts +8 -0
  166. package/dist/types/hooks/useIsRtl.d.ts +12 -0
  167. package/dist/types/hooks/useNavigator.d.ts +18 -1
  168. package/dist/types/hooks/useOverlayService.d.ts +25 -4
  169. package/dist/types/hooks/usePropToggle.d.ts +16 -5
  170. package/dist/types/hooks/useResize.d.ts +18 -0
  171. package/dist/types/hooks/useResizeObserver.d.ts +19 -0
  172. package/dist/types/hooks/useStorage.d.ts +38 -0
  173. package/dist/types/types/icons.d.ts +4 -0
  174. package/dist/types/typography/Abbr.d.ts +28 -1
  175. package/dist/types/typography/Anchor.d.ts +19 -2
  176. package/dist/types/typography/Copy.d.ts +15 -0
  177. package/dist/types/typography/Mark.d.ts +20 -1
  178. package/dist/types/typography/Text.d.ts +27 -1
  179. package/dist/types/typography/Title.d.ts +16 -1
  180. package/package.json +3 -3
  181. package/src/components/actionLabel/ActionLabel.tsx +23 -5
  182. package/src/components/animations/Animations.tsx +93 -14
  183. package/src/components/avatar/Avatar.tsx +32 -3
  184. package/src/components/avatar/AvatarGroup.tsx +19 -1
  185. package/src/components/badge/Badge.tsx +30 -2
  186. package/src/components/breadcrumbs/Breadcrumbs.tsx +29 -0
  187. package/src/components/button/Button.tsx +23 -1
  188. package/src/components/button/ButtonGroup.tsx +26 -0
  189. package/src/components/button/ConfirmButton.tsx +22 -1
  190. package/src/components/button/ToggleButtonGroup.tsx +70 -43
  191. package/src/components/callout/Callout.tsx +27 -0
  192. package/src/components/card/Card.tsx +34 -0
  193. package/src/components/card/CardCover.tsx +25 -0
  194. package/src/components/card/FlipContent.tsx +21 -0
  195. package/src/components/chip/Chip.tsx +21 -1
  196. package/src/components/collapsable/Collapsable.tsx +26 -0
  197. package/src/components/divider/Divider.tsx +19 -0
  198. package/src/components/dropdown/Dropdown.tsx +40 -0
  199. package/src/components/dropdown/DropdownTool.tsx +25 -0
  200. package/src/components/empty/EmptyContent.tsx +26 -0
  201. package/src/components/icon/Icon.tsx +27 -1
  202. package/src/components/media/Media.tsx +54 -0
  203. package/src/components/menu/ContextMenu.tsx +19 -0
  204. package/src/components/menu/Menu.tsx +29 -0
  205. package/src/components/menu/MenuItem.tsx +21 -0
  206. package/src/components/meter/Meter.tsx +24 -0
  207. package/src/components/navigator/Navigator.tsx +22 -0
  208. package/src/components/panel/Panel.tsx +37 -0
  209. package/src/components/panel/PanelGroup.tsx +24 -0
  210. package/src/components/panel/PanelStack.tsx +31 -0
  211. package/src/components/progress/ProgressBar.tsx +20 -0
  212. package/src/components/progress/ProgressCircle.tsx +19 -0
  213. package/src/components/tabpanel/Tab.tsx +31 -0
  214. package/src/components/tabpanel/TabPanel.tsx +33 -0
  215. package/src/context/Global.tsx +24 -1
  216. package/src/core/aside/Aside.tsx +39 -2
  217. package/src/core/boundary/ErrorBoundary.tsx +17 -1
  218. package/src/core/content/Content.tsx +6 -1
  219. package/src/core/headfoot/HeadFoot.tsx +40 -0
  220. package/src/core/page/Page.tsx +26 -1
  221. package/src/core/responsive/Responsive.tsx +52 -1
  222. package/src/core/section/Section.tsx +16 -1
  223. package/src/core/theme/ThemeProvider.tsx +21 -1
  224. package/src/core/viewport/Viewport.tsx +15 -1
  225. package/src/hooks/useControlledValue.tsx +12 -0
  226. package/src/hooks/useDebounce.ts +12 -0
  227. package/src/hooks/useEffectDebugger.ts +49 -0
  228. package/src/hooks/useIsDark.ts +8 -0
  229. package/src/hooks/useIsRtl.ts +12 -0
  230. package/src/hooks/useNavigator.tsx +18 -0
  231. package/src/hooks/useOverlayService.tsx +24 -0
  232. package/src/hooks/usePropToggle.ts +16 -5
  233. package/src/hooks/useResize.ts +18 -0
  234. package/src/hooks/useResizeObserver.ts +19 -0
  235. package/src/hooks/useStorage.ts +38 -0
  236. package/src/types/icons.ts +5 -1
  237. package/src/typography/Abbr.tsx +28 -1
  238. package/src/typography/Anchor.tsx +18 -1
  239. package/src/typography/Copy.tsx +15 -0
  240. package/src/typography/Mark.tsx +20 -1
  241. package/src/typography/Text.tsx +27 -1
  242. package/src/typography/Title.tsx +16 -1
@@ -82,6 +82,30 @@ const loadIndicator = (
82
82
  </div>
83
83
  );
84
84
 
85
+ /**
86
+ * Component for displaying images with optional reel decoration.
87
+ * A versatile media component that supports images and videos with various display options.
88
+ * It can display images with a reel decoration, handle loading states, and show error icons if the media fails to load.
89
+ * This component is useful for displaying images in a visually appealing way, with support for lazy loading and error handling.
90
+ * It automatically adjusts the display based on the provided fit property, allowing for different styles such as cover, contain, or fill.
91
+ *
92
+ * @param {ImageProps | VideoProps} props - The properties for the Media component.
93
+ * @returns {JSX.Element} The rendered Media component.
94
+ *
95
+ * @example
96
+ * ```jsx
97
+ * <Image
98
+ * src="image.jpg"
99
+ * alt="Example Image"
100
+ * reel={true}
101
+ * fit="cover"
102
+ * className="custom-class"
103
+ * />
104
+ * // Renders an image with reel decoration, cover fit, and a custom class name.
105
+ * ```
106
+ *
107
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-media--docs} for more details.
108
+ */
85
109
  export const Image = ({
86
110
  src,
87
111
  alt,
@@ -139,6 +163,36 @@ export const Image = ({
139
163
  );
140
164
  };
141
165
 
166
+ /**
167
+ * Component for displaying videos with optional controls and reel decoration.
168
+ * A versatile video component that supports autoplay, hover play, and various display options.
169
+ * It can display videos with a reel decoration, handle loading states, and show error icons if the video fails to load.
170
+ * This component is useful for displaying videos in a visually appealing way, with support for controls, autoplay, and error handling.
171
+ * It automatically adjusts the display based on the provided fit property, allowing for different styles such as cover, contain, or fill.
172
+ * It also includes controls for play/pause and volume, enhancing user interaction with the video content.
173
+ * This component is ideal for media-rich applications where video content needs to be displayed with user-friendly controls and visual effects.
174
+ * It supports features like autoplay, play on hover, and custom fit options for the video display.
175
+ * It also includes a reel decoration for a more engaging visual presentation.
176
+ *
177
+ * @param {VideoProps} props - The properties for the Video component.
178
+ * @returns {JSX.Element} The rendered Video component.
179
+ *
180
+ * @example
181
+ * ```jsx
182
+ * <Video
183
+ * src="video.mp4"
184
+ * poster="poster.jpg"
185
+ * reel={true}
186
+ * autoPlay={true}
187
+ * playOnHover={true}
188
+ * fit="cover"
189
+ * className="custom-class"
190
+ * />
191
+ * // Renders a video with reel decoration, autoplay, play on hover, cover fit, and a custom class name.
192
+ * ```
193
+ *
194
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-video--docs} for more details.
195
+ */
142
196
  export const Video = ({
143
197
  src,
144
198
  poster,
@@ -42,6 +42,25 @@ export interface ContextMenuProps extends ChildrenProp {
42
42
  disabled?: boolean;
43
43
  }
44
44
 
45
+ /**
46
+ * A component that provides a context menu that appears on right-click.
47
+ * It uses the Floating UI library to manage the positioning and interactions of the menu.
48
+ * This component is useful for creating custom context menus that can be triggered by right-clicking on elements.
49
+ *
50
+ * @param {ContextMenuProps} props - The properties for the ContextMenu component.
51
+ * @returns {JSX.Element} The rendered ContextMenu component.
52
+ *
53
+ * @example
54
+ * ```jsx
55
+ * <ContextMenu
56
+ * menu={<Menu items={[{ label: "Option 1" }, { label: "Option 2" }]} />}
57
+ * >
58
+ * <div className="context-menu-target">Right-click me!</div>
59
+ * </ContextMenu>
60
+ * ```
61
+ *
62
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-menu--docs}
63
+ */
45
64
  export const ContextMenu = ({ children, menu, disabled }: ContextMenuProps) => {
46
65
  const [isOpen, setIsOpen] = useState(false);
47
66
  const nodeId = useFloatingNodeId();
@@ -276,6 +276,35 @@ const MenuComponent = ({
276
276
  );
277
277
  };
278
278
 
279
+ /**
280
+ * A component that displays a menu with items, supports nested menus and various interactions.
281
+ * It can be triggered by hover or click events, and allows for custom styling and behavior.
282
+ * This component is designed to be used within a Floating UI context, allowing for dynamic positioning and interaction handling.
283
+ * It can be nested within other menus to create complex menu structures.
284
+ *
285
+ * @param {MenuProps} props - The properties for the Menu component.
286
+ * @returns {JSX.Element} The rendered Menu component.
287
+ *
288
+ * @example
289
+ * ```jsx
290
+ * <Menu
291
+ * className="my-menu"
292
+ * trigger="click"
293
+ * onClick={(id) => console.log(`Clicked item with id: ${id}`)}
294
+ * >
295
+ * <MenuItem id="item1" label="Item 1" />
296
+ * <MenuItem id="item2" label="Item 2" />
297
+ * <MenuItem id="item3" label="Item 3">
298
+ * <Menu>
299
+ * <MenuItem id="subitem1" label="Sub Item 1" />
300
+ * <MenuItem id="subitem2" label="Sub Item 2" />
301
+ * </Menu>
302
+ * </MenuItem>
303
+ * </Menu>
304
+ * ```
305
+ *
306
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-menu--docs} for more details.
307
+ */
279
308
  export const Menu = (props: MenuProps) => {
280
309
  const parentId = useFloatingParentNodeId();
281
310
  const tree = useFloatingTree();
@@ -33,6 +33,27 @@ import { Badge, getBadgeProps } from "../badge/Badge";
33
33
  import { Icon } from "../icon/Icon";
34
34
  import { type MenuItemProps } from "./types";
35
35
 
36
+ /**
37
+ * A menu item component that can be used in a dropdown or menu.
38
+ * It supports various features such as icons, badges, hotkeys, and more.
39
+ * It can be customized with different colors, icons, and behaviors.
40
+ *
41
+ * @param {MenuItemProps} props
42
+ * @returns A JSX element representing the menu item.
43
+ *
44
+ * @example
45
+ * ```jsx
46
+ * <MenuItem
47
+ * label="Settings"
48
+ * icon="settings"
49
+ * onClick={() => console.log("Settings clicked")}
50
+ * hotKey="Ctrl+S"
51
+ * badge={{ count: 3, color: "red" }}
52
+ * />
53
+ * ```
54
+ *
55
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-menu--docs} for documentation.
56
+ */
36
57
  export const MenuItem = <Tag extends React.ElementType = "button">({
37
58
  as,
38
59
  label,
@@ -37,6 +37,30 @@ export interface MeterProps extends CssProp, AriaProps, TestProps {
37
37
  hideLabel?: boolean;
38
38
  }
39
39
 
40
+ /**
41
+ * A component that displays a visual representation of a value as a series of dots.
42
+ * It is useful for showing progress or completion status in a compact form.
43
+ * The meter consists of 6 dots, each representing approximately 16.67% of the total value.
44
+ * The active dots are filled based on the value provided, and the remaining dots are empty.
45
+ * The component can also display a label showing the percentage value.
46
+ *
47
+ * @param {MeterProps} props - The properties for the Meter component.
48
+ * @returns {JSX.Element} The rendered Meter component.
49
+ *
50
+ * @example
51
+ * ```jsx
52
+ * <Meter value={75} />
53
+ * // Renders a meter with 4 active dots and a label showing "75%"
54
+ *
55
+ * <Meter value={50} hideLabel />
56
+ * // Renders a meter with 3 active dots and no label
57
+ *
58
+ * <Meter value={100} className="custom-meter" />
59
+ * // Renders a meter with all 6 active dots and a custom class name
60
+ * ```
61
+ *
62
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-meter--docs} for more details.
63
+ */
40
64
  export const Meter = ({ value, hideLabel, className, ...aria }: MeterProps) => {
41
65
  /** ***************** calculate active meter dots *******************/
42
66
  const activeCount = useMemoDebugger(
@@ -54,6 +54,28 @@ export interface NavigatorProps
54
54
  onNavigate: (dir: -1 | 1) => void;
55
55
  }
56
56
 
57
+ /**
58
+ * A component that provides navigation controls for traversing through items.
59
+ * It includes previous and next buttons, and supports keyboard navigation.
60
+ *
61
+ * @param {NavigatorProps} props - The properties for the Navigator component.
62
+ * @returns {JSX.Element} The rendered Navigator component.
63
+ *
64
+ * @example
65
+ * ```jsx
66
+ * <Navigator
67
+ * className="my-navigator"
68
+ * onNavigate={(dir) => console.log(`Navigate ${dir === -1 ? 'previous' : 'next'}`)}
69
+ * color="blue"
70
+ * length={10}
71
+ * current={0}
72
+ * >
73
+ * <span>Current Item: 1</span>
74
+ * </Navigator>
75
+ * ```
76
+ *
77
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-navigator--docs} for more details.
78
+ */
57
79
  export const Navigator = ({
58
80
  className,
59
81
  onNavigate,
@@ -101,6 +101,43 @@ export interface PanelProps
101
101
  onClose?: () => void;
102
102
  }
103
103
 
104
+ /**
105
+ * A component that represents a panel with a header, body, and optional actions.
106
+ * It supports expandable and collapsible functionality, loading state, and customizable styles.
107
+ * The panel can be resized and has a fixed position when expanded.
108
+ * It can be customized with different colors, icons, and behaviors.
109
+ * This component is useful for displaying content in a structured way, allowing users to interact with it through actions and toggles.
110
+ * It can be used in various applications where panels are needed, such as dashboards, settings pages, or content management systems.
111
+ *
112
+ * @param {PanelProps} props - The properties for the Panel component.
113
+ * @returns {JSX.Element} The rendered Panel component.
114
+ *
115
+ * @example
116
+ * ```jsx
117
+ * <Panel
118
+ * title="Panel Title"
119
+ * icon={CoreIcons.info}
120
+ * iconBg="bg-blue-500"
121
+ * iconColor="text-white"
122
+ * actions={<button>Action</button>}
123
+ * expandable
124
+ * collapsable
125
+ * onExpand={() => console.log("Expanded")}
126
+ * onCollapse={() => console.log("Collapsed")}
127
+ * onClose={() => console.log("Closed")}
128
+ * height="400px"
129
+ * width="300px"
130
+ * minHeight="200px"
131
+ * minWidth="200px"
132
+ * maxHeight="600px"
133
+ * maxWidth="600px"
134
+ * >
135
+ * <p>This is the content of the panel.</p>
136
+ * </Panel>
137
+ * ```
138
+ *
139
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-panel--docs} for more details.
140
+ */
104
141
  export const Panel = ({
105
142
  children,
106
143
  className,
@@ -40,6 +40,30 @@ export interface PanelGroupProps extends ChildrenProp {
40
40
  onActiveChange?: (panelId: string) => void;
41
41
  }
42
42
 
43
+ /**
44
+ * A component that groups multiple panels together, allowing for one panel to be expanded at a time.
45
+ * This component allows you to manage a group of panels where only one can be expanded at a time.
46
+ * It accepts an `activePanel` prop to control which panel is currently expanded,
47
+ * and an `onActiveChange` callback that is triggered when the active panel changes.
48
+ * It uses the `Panel` component to render each individual panel within the group.
49
+ *
50
+ * @param {PanelGroupProps} props - The properties for the PanelGroup component.
51
+ * @returns {JSX.Element} The rendered PanelGroup component.
52
+ *
53
+ * @example
54
+ * ```jsx
55
+ * <PanelGroup
56
+ * activePanel="panel1"
57
+ * onActiveChange={(panelId) => console.log(`Active panel changed to: ${panelId}`)}
58
+ * >
59
+ * <Panel panelId="panel1" title="Panel 1">Content for Panel 1</Panel>
60
+ * <Panel panelId="panel2" title="Panel 2">Content for Panel 2</Panel>
61
+ * <Panel panelId="panel3" title="Panel 3">Content for Panel 3</Panel>
62
+ * </PanelGroup>
63
+ * ```
64
+ *
65
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-panel--docs} for more details.
66
+ */
43
67
  export const PanelGroup = ({
44
68
  children,
45
69
  activePanel,
@@ -49,6 +49,37 @@ export interface PanelStackProps extends CssProp, ChildrenProp {
49
49
  onBack?: (panelId: string, nextPanelId: string) => boolean | undefined;
50
50
  }
51
51
 
52
+ /**
53
+ * A component that manages a stack of panels, allowing navigation between them.
54
+ * This component allows you to manage a stack of panels where you can navigate between them.
55
+ * It accepts an `active` prop to control which panel is currently active,
56
+ * an `onPanelChange` callback that is triggered when the active panel changes,
57
+ * and an `onBack` callback to handle navigation to the previous panel in the history.
58
+ * It uses the `Panel` component to render each individual panel within the stack.
59
+ * The component maintains a history of panels to allow back navigation,
60
+ * and it updates the active panel based on user interactions.
61
+ *
62
+ * @param {PanelStackProps} props - The properties for the PanelStack component.
63
+ * @returns {JSX.Element} The rendered PanelStack component.
64
+ *
65
+ * @example
66
+ * ```jsx
67
+ * <PanelStack
68
+ * active="panel1"
69
+ * onPanelChange={(panelId) => console.log(`Active panel changed to: ${panelId}`)}
70
+ * onBack={(currentPanel, nextPanel) => {
71
+ * console.log(`Navigating back from ${currentPanel} to ${nextPanel}`);
72
+ * return true; // return false to prevent navigation
73
+ * }}
74
+ * >
75
+ * <Panel panelId="panel1" title="Panel 1">Content for Panel 1</Panel>
76
+ * <Panel panelId="panel2" title="Panel 2">Content for Panel 2</Panel>
77
+ * <Panel panelId="panel3" title="Panel 3">Content for Panel 3</Panel>
78
+ * </PanelStack>
79
+ * ```
80
+ *
81
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-panelstack--docs} for more details.
82
+ */
52
83
  export const PanelStack = ({
53
84
  active,
54
85
  children,
@@ -60,6 +60,26 @@ const SizeMap: KeyValue = {
60
60
  xl: "2rem",
61
61
  };
62
62
 
63
+ /**
64
+ * A component that displays a progress bar indicating the completion percentage of a task or operation.
65
+ * The progress bar is styled with a background color and a track that fills based on the value provided.
66
+ * It can also display a label showing the percentage value.
67
+ * The label can be customized or hidden based on the props provided.
68
+ *
69
+ * @param {ProgressProps} props - The properties for the ProgressBar component.
70
+ * @returns {JSX.Element} The rendered ProgressBar component.
71
+ *
72
+ * @example
73
+ * ```jsx
74
+ * <ProgressBar value={0.75} size="md" color="primary-500" label="Loading" animate />
75
+ * // Renders a progress bar with 75% completion, medium size, primary color, and a label "Loading"
76
+ *
77
+ * <ProgressBar value={0.5} size="lg" color="success-500" />
78
+ * // Renders a progress bar with 50% completion, large size, and success color without a label
79
+ * ```
80
+ *
81
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-progress--docs} for more details.
82
+ */
63
83
  export const ProgressBar = ({
64
84
  value = 0,
65
85
  size,
@@ -50,6 +50,25 @@ const SizeMap: KeyValue = {
50
50
  xl: "2rem",
51
51
  };
52
52
 
53
+ /**
54
+ * A circular progress indicator that visually represents a percentage of completion.
55
+ * It displays a circular track with a stroke that fills based on the `value` prop.
56
+ * The component is customizable with size and color props.
57
+ *
58
+ * @param {ProgressProps} props - The properties for the ProgressCircle component.
59
+ * @returns {JSX.Element} - A circular progress indicator.
60
+ *
61
+ * @example
62
+ * ```jsx
63
+ * <ProgressCircle value={0.75} size="md" color="primary-500" />
64
+ * // Renders a circular progress indicator with 75% completion, medium size, and primary color.
65
+ *
66
+ * <ProgressCircle value={0.5} size="lg" color="secondary-500" />
67
+ * // Renders a circular progress indicator with 50% completion, large size, and secondary color.
68
+ * ```
69
+ *
70
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-progress--docs} for more details.
71
+ */
53
72
  export const ProgressCircle = ({
54
73
  value = 0,
55
74
  size = "sm",
@@ -92,6 +92,37 @@ export interface TabProps
92
92
  onClick?: (id: string) => CallbackReturn;
93
93
  }
94
94
 
95
+ /**
96
+ * A component that represents a tab in a tabbed interface. It can display an icon, label, badge, and actions.
97
+ * It supports polymorphic rendering, allowing it to be rendered as different HTML elements.
98
+ * It also supports tooltips, active states, and click handling.
99
+ *
100
+ * @param {TabProps} props - The properties for the Tab component.
101
+ * @returns {JSX.Element} The rendered Tab component.
102
+ *
103
+ * @example
104
+ * ```jsx
105
+ * <Tab
106
+ * id="tab1"
107
+ * label="Tab 1"
108
+ * icon="home"
109
+ * iconBg="bg-blue-500"
110
+ * iconColor="text-white"
111
+ * badge="New"
112
+ * onClick={(id) => console.log(`Tab clicked: ${id}`)}
113
+ * onClose={() => console.log("Tab closed")}
114
+ * active={true}
115
+ * actions={<button>Action</button>}
116
+ * color="primary"
117
+ * tooltip="This is a tab"
118
+ * activeClassName="bg-blue-100"
119
+ * />
120
+ * // Renders a tab with label "Tab 1", home icon, blue background, white text, badge "New",
121
+ * // and an action button. The tab is active and has a tooltip.
122
+ * ```
123
+ *
124
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-tabpanel--docs} for more details.
125
+ */
95
126
  export const Tab = <Tag extends React.ElementType = "button">({
96
127
  ref,
97
128
  as,
@@ -84,6 +84,39 @@ export interface TabPanelProps extends ChildrenProp<typeof Tab> {
84
84
 
85
85
  // TODO: implement append/prepend tab-bar items
86
86
 
87
+ /**
88
+ * A component that provides a tabbed interface for displaying content.
89
+ * It allows users to switch between different tabs, each containing its own content.
90
+ * It supports various orientations, justify options, and variants for the tab header.
91
+ * It also provides hooks for handling tab changes before and after they occur.
92
+ * This component is useful for organizing content into separate sections that can be easily navigated by the user.
93
+ * It can be customized with different styles and behaviors to fit the needs of the application.
94
+ *
95
+ * @param {TabPanelProps} props - The properties for the TabPanel component.
96
+ * @returns {JSX.Element} The rendered TabPanel component.
97
+ *
98
+ * @example
99
+ * ```jsx
100
+ * <TabPanel
101
+ * orientation="top"
102
+ * activeTab="tab1"
103
+ * justify="start"
104
+ * variant="solid"
105
+ * tabFlex={true}
106
+ * onBeforeChange={(nextTab, currentTab) => {
107
+ * console.log(`Switching from ${currentTab} to ${nextTab}`);
108
+ * return true; // or false to prevent change
109
+ * }}
110
+ * onChange={(id) => console.log(`Active tab changed to: ${id}`)}
111
+ * >
112
+ * <Tab id="tab1" label="Tab 1">Content for Tab 1</Tab>
113
+ * <Tab id="tab2" label="Tab 2">Content for Tab 2</Tab>
114
+ * <Tab id="tab3" label="Tab 3">Content for Tab 3</Tab>
115
+ * </TabPanel>
116
+ * ```
117
+ *
118
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-tabpanel--docs} for more details.
119
+ */
87
120
  export const TabPanel = ({
88
121
  children,
89
122
  headerClassName,
@@ -232,13 +232,36 @@ export const ApplicationProvider: FC<GlobalProps> = ({
232
232
  export const useGlobals = () => useContext(GlobalContext);
233
233
 
234
234
  /**
235
- * global application context
235
+ * Hook to access the global application context.
236
+ * This hook provides access to the global context values, including the current locale, calendar, and color scheme.
237
+ *
238
+ * @returns {GlobalContextType} The global context values excluding the error element.
239
+ *
240
+ * @example
241
+ * ```jsx
242
+ * const { changeLocale, currentLocale, toggleColorScheme } = useApplicationContext();
243
+ * ```
236
244
  */
237
245
  export const useApplicationContext = () => {
238
246
  const { errorElement, ...rest } = useContext(GlobalContext);
239
247
  return rest;
240
248
  };
241
249
 
250
+ /**
251
+ * Hook to access the notification manager from the global context.
252
+ * This hook provides methods to show alerts, errors, messages, and toasts.
253
+ * It returns a reference to the notification manager, which can be used to display notifications in the application.
254
+ *
255
+ * @returns {NotificationManagerRef} The notification manager reference.
256
+ *
257
+ * @example
258
+ * ```jsx
259
+ * const notificationService = useNotificationService();
260
+ * notificationService.showMessage("Hello World");
261
+ * ```
262
+ *
263
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/docs/core-components-notifications--notifications} for more details on available methods.
264
+ */
242
265
  export const useNotificationService = () => {
243
266
  const { notificationManager } = useContext(GlobalContext);
244
267
  return notificationManager ?? {};
@@ -105,7 +105,44 @@ export interface AsideProps
105
105
  }
106
106
 
107
107
  /**
108
- * Side panel
108
+ * A sidebar component that can be collapsed, resized, and has a flyout feature.
109
+ * It supports a title, icon, actions, and loading state.
110
+ * It can be aligned to the start or end of the page.
111
+ *
112
+ * @param {AsideProps} props - The properties for the Aside component.
113
+ * @returns {JSX.Element} The rendered Aside component.
114
+ *
115
+ * @example
116
+ * ```jsx
117
+ * <Aside
118
+ * title="Sidebar Title"
119
+ * icon={CoreIcons.menu}
120
+ * iconBg="bg-gray-200"
121
+ * iconColor="text-gray-800"
122
+ * rtlFlip={true}
123
+ * className="custom-aside"
124
+ * bodyClassName="custom-aside-body"
125
+ * headerClassName="custom-aside-header"
126
+ * resizeable={true}
127
+ * flyout={true}
128
+ * onFlyout={() => console.log("Flyout triggered")}
129
+ * collapsed={false}
130
+ * collapsable={true}
131
+ * onCollapse={() => console.log("Collapsed toggled")}
132
+ * actions={<button>Action</button>}
133
+ * loading={false}
134
+ * align="start"
135
+ * width="20rem"
136
+ * minWidth="2rem"
137
+ * maxWidth="30vw"
138
+ * data-testid="aside-test"
139
+ * data-test-value="aside-value"
140
+ * >
141
+ * <Content>This is the content of the aside.</Content>
142
+ * </Aside>
143
+ * ```
144
+ *
145
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/story/core-application--aside} for more details.
109
146
  */
110
147
  export const Aside = ({
111
148
  children,
@@ -273,7 +310,7 @@ export const Aside = ({
273
310
  {...resizeHandleProps}
274
311
  className={classNames(
275
312
  "fabric-asideResizer",
276
- "before:absolute before:inset-0 before:w-1 before:top-1/2 before:-translate-y-1/2 before:transition-all",
313
+ "before:absolute before:inset-0 before:w-1 before:top-1/2 before:-translate-y-1/2 before:transition-all before:delay-150",
277
314
  )}
278
315
  />
279
316
  )}
@@ -91,7 +91,23 @@ const ErrorStack = ({ error, stack }: KeyValue) => {
91
91
  };
92
92
 
93
93
  /**
94
- * An error boundary wrapper higher-order component designed to provide consistent error display across the application will trap runtime errors
94
+ * ErrorBoundary component to catch JavaScript errors anywhere in the child component tree,
95
+ * log those errors, and display a fallback UI.
96
+ * It can also display a custom error element if provided.
97
+ * This component is useful for preventing the entire application from crashing
98
+ * when an error occurs in a part of the component tree.
99
+ * It can be used to wrap any part of the application.
100
+ * It supports custom error display components and provides a default error message.
101
+ * It also conditionally displays the error stack trace in development mode.
102
+ *
103
+ * @example
104
+ * ```jsx
105
+ * <ErrorBoundary errorElement={CustomErrorComponent}>
106
+ * <YourComponent />
107
+ * </ErrorBoundary>
108
+ * ```
109
+ *
110
+ * @see {@link https://adarshpastakia.github.io/react-fabric/?path=/story/core-application--error-boundary}
95
111
  */
96
112
  export class ErrorBoundary extends Component<
97
113
  {
@@ -51,7 +51,12 @@ export interface ContentProps
51
51
  }
52
52
 
53
53
  /**
54
- * Scrollable content element
54
+ * Content component that wraps children in a section element.
55
+ * It uses a resize observer to handle resizing and a debounced scroll handler.
56
+ * It also includes an error boundary to catch any errors in the children.
57
+ *
58
+ * @param {ContentProps} props - The properties for the Content component.
59
+ * @returns A section element containing the children wrapped in an error boundary.
55
60
  */
56
61
  export const Content = ({
57
62
  ref,
@@ -72,10 +72,50 @@ const HeadFoot = ({
72
72
  );
73
73
  };
74
74
 
75
+ /**
76
+ * Header component that wraps children in a header element.
77
+ * It uses the HeadFoot component to handle layout and styling.
78
+ * It accepts properties for direction, alignment, and justification,
79
+ * allowing for flexible layout configurations.
80
+ * The `as` prop is set to "header" to render the element as a header.
81
+ * The `area` prop is set to "head" to indicate that this is a header area.
82
+ * It can be used to create a consistent header layout across an application.
83
+ *
84
+ * @param {HeadFootProps} props - The properties for the Header component.
85
+ * @returns A header element containing the children wrapped in the HeadFoot component.
86
+ *
87
+ * @example
88
+ * ```jsx
89
+ * <Header className="custom-header" dir="ltr">
90
+ * <h1>Header content goes here</h1>
91
+ * </Header>
92
+ * ```
93
+ */
75
94
  export const Header = (props: HeadFootProps) => (
76
95
  <HeadFoot as="header" area="head" {...props} />
77
96
  );
78
97
 
98
+ /**
99
+ * Footer component that wraps children in a footer element.
100
+ * It uses the HeadFoot component to handle layout and styling.
101
+ * It accepts properties for direction, alignment, and justification,
102
+ * allowing for flexible layout configurations.
103
+ * The `as` prop is set to "footer" to render the element as a footer.
104
+ * The `area` prop is set to "foot" to indicate that this is a footer area.
105
+ * It can be used to create a consistent footer layout across an application.
106
+ * * The Footer component is designed to be flexible and can be styled with custom classes.
107
+ * It supports both default and flex layouts, allowing for alignment and justification of its children.
108
+ *
109
+ * @param {HeadFootProps} props - The properties for the Footer component.
110
+ * @returns A footer element containing the children wrapped in the HeadFoot component.
111
+ *
112
+ * @example
113
+ * ```jsx
114
+ * <Footer className="custom-footer" dir="ltr">
115
+ * <p>Footer content goes here</p>
116
+ * </Footer>
117
+ * ```
118
+ */
79
119
  export const Footer = (props: HeadFootProps) => (
80
120
  <HeadFoot as="footer" area="foot" {...props} />
81
121
  );