@6thbridge/hexa 0.0.74 → 0.0.76

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/dist/index.d.mts CHANGED
@@ -15,6 +15,7 @@ import { RowData, Row, Table as Table$1 } from '@tanstack/react-table';
15
15
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
16
16
  import * as zustand from 'zustand';
17
17
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
18
+ import { Extension } from '@tiptap/react';
18
19
  import dayjs from 'dayjs';
19
20
  import { ClassValue } from 'clsx';
20
21
 
@@ -398,22 +399,20 @@ declare const Status: ({ status, variant, className, }: {
398
399
  className?: string;
399
400
  }) => react_jsx_runtime.JSX.Element;
400
401
 
401
- type PaginationProps = {
402
- currentPage?: number;
403
- totalPages?: number;
404
- onPageChange?: (page: number) => void;
405
- totalItems?: number;
406
- itemsPerPage?: number;
407
- id?: string;
402
+ type RowAction = {
403
+ icon: React__default.ReactNode;
404
+ label: React__default.ReactNode;
405
+ onClick: (rowIds: string[]) => void;
406
+ className?: string;
407
+ variant?: ButtonVariant;
408
+ disabled?: boolean;
409
+ showCount?: boolean;
410
+ };
411
+ type TableBulkRowActionsProps = {
412
+ tableBulkActions: RowAction[];
413
+ selectedRows: string[];
414
+ isMobile?: boolean;
408
415
  };
409
- /**
410
- * Pagination component for displaying pagination controls.
411
- * @param {number} currentPage - The current page number.
412
- * @param {number} totalPages - The total number of pages.
413
- * @param {function} onPageChange - Callback function to handle page change.
414
- * @param {number | undefined} itemsPerPage - The number of items per page.
415
- */
416
- declare const Pagination: ({ currentPage, totalPages, onPageChange, itemsPerPage, totalItems, id, }: PaginationProps) => react_jsx_runtime.JSX.Element;
417
416
 
418
417
  type SelectOption = {
419
418
  value: string;
@@ -446,20 +445,22 @@ type FilterContentProps = {
446
445
  };
447
446
  type FilterListOptions = FilterListItem[];
448
447
 
449
- type RowAction = {
450
- icon: React__default.ReactNode;
451
- label: React__default.ReactNode;
452
- onClick: (rowIds: string[]) => void;
453
- className?: string;
454
- variant?: ButtonVariant;
455
- disabled?: boolean;
456
- showCount?: boolean;
457
- };
458
- type TableBulkRowActionsProps = {
459
- tableBulkActions: RowAction[];
460
- selectedRows: string[];
461
- isMobile?: boolean;
448
+ type PaginationProps = {
449
+ currentPage?: number;
450
+ totalPages?: number;
451
+ onPageChange?: (page: number) => void;
452
+ totalItems?: number;
453
+ itemsPerPage?: number;
454
+ id?: string;
462
455
  };
456
+ /**
457
+ * Pagination component for displaying pagination controls.
458
+ * @param {number} currentPage - The current page number.
459
+ * @param {number} totalPages - The total number of pages.
460
+ * @param {function} onPageChange - Callback function to handle page change.
461
+ * @param {number | undefined} itemsPerPage - The number of items per page.
462
+ */
463
+ declare const Pagination: ({ currentPage, totalPages, onPageChange, itemsPerPage, totalItems, id, }: PaginationProps) => react_jsx_runtime.JSX.Element;
463
464
 
464
465
  type TableSearchProps = {
465
466
  enabled: boolean;
@@ -471,6 +472,7 @@ type TableDownloadProps = {
471
472
  buttonId?: string;
472
473
  onDownload?: () => void;
473
474
  buttonText?: string;
475
+ isDownloading?: boolean;
474
476
  };
475
477
  type TablePaginationProps = {
476
478
  enabled: boolean;
@@ -662,6 +664,91 @@ type TabsProps = {
662
664
  };
663
665
  declare function Tabs({ tabs, defaultValue, onChange }: TabsProps): react_jsx_runtime.JSX.Element;
664
666
 
667
+ type EditorControl = "bold" | "italic" | "underline" | "strike" | "heading1" | "bulletList" | "orderedList" | "blockquote" | "textStyle" | "link";
668
+
669
+ type RichTextEditorProps = {
670
+ label?: string;
671
+ helpText?: string;
672
+ error?: string;
673
+ value?: string;
674
+ onChange?: (html: string) => void;
675
+ optional?: boolean;
676
+ isRequired?: boolean;
677
+ extensions?: Extension[];
678
+ editorClassName?: string;
679
+ wrapperClassName?: string;
680
+ controls?: EditorControl[];
681
+ extraMenuNodes?: React.ReactNode;
682
+ placeholder?: string;
683
+ };
684
+ /**
685
+ * @component RichTextEditor
686
+ * @description
687
+ * The `RichTextEditor` component is a customizable rich text input built on top of Tiptap and styled with Tailwind CSS.
688
+ * It provides a toolbar for formatting text (bold, italic, underline, strikethrough, headings, lists, blockquote, links).
689
+ *
690
+ * ## Props
691
+ * - `label?: string` - Label for the editor.
692
+ * - `helpText?: string` - Optional help text displayed below the editor.
693
+ * - `error?: string` - Error message displayed below the editor.
694
+ * - `value?: string` - The HTML content of the editor.
695
+ * - `onChange?: (html: string) => void` - Callback fired when the content changes.
696
+ * - `optional?: boolean` - If true, displays "Optional" next to the label.
697
+ * - `isRequired?: boolean` - If true, displays a red asterisk next to the label.
698
+ * - `extensions?: Extension[]` - Additional Tiptap extensions to include.
699
+ * - `editorClassName?: string` - Custom class for the editor content area.
700
+ * - `wrapperClassName?: string` - Custom class for the editor wrapper.
701
+ * - `controls?: EditorControl[]` - Array of controls to show in the toolbar.
702
+ * - `extraMenuNodes?: React.ReactNode` - Extra nodes to render in the toolbar.
703
+ *
704
+ * ## Usage
705
+ *
706
+ * ```tsx
707
+ * import React, { useState } from "react";
708
+ * import { RichTextEditor } from "@6thbridge/hexa";
709
+ *
710
+ * export const RichTextEditorDemo = () => {
711
+ * const [value, setValue] = useState("<p>Hello <strong>world</strong>!</p>");
712
+ *
713
+ * return (
714
+ * <div className="max-w-xl mx-auto mt-8">
715
+ * <RichTextEditor
716
+ * label="Description"
717
+ * helpText="You can format your text using the toolbar above."
718
+ * value={value}
719
+ * onChange={setValue}
720
+ * optional
721
+ * isRequired
722
+ * // You can customize controls, add extensions, etc.
723
+ * // controls={["textStyle", "bold", "italic", "underline", "strike", "link", "bulletList", "orderedList", "blockquote"]}
724
+ * />
725
+ * <div className="mt-6">
726
+ * <h2 className="text-lg font-semibold mb-2">Editor Output (HTML):</h2>
727
+ * <pre className="bg-gray-100 p-4 rounded text-xs overflow-x-auto">{value}</pre>
728
+ * </div>
729
+ * </div>
730
+ * );
731
+ * };
732
+ * ```
733
+ *
734
+ * ## Output
735
+ *
736
+ * The editor renders a toolbar with formatting buttons (bold, italic, underline, strikethrough, headings, bullet list, ordered list, blockquote, link).
737
+ * The content area allows rich text editing. The output is HTML, which is returned via the `onChange` callback and can be displayed or stored as needed.
738
+ *
739
+ * Example output:
740
+ *
741
+ * ```html
742
+ * <p>This is <strong>bold</strong>, <em>italic</em>, <u>underlined</u>, <s>strikethrough</s>, and a <blockquote>blockquote</blockquote>.</p>
743
+ * <ul>
744
+ * <li>Bullet item 1</li>
745
+ * <li>Bullet item 2</li>
746
+ * </ul>
747
+ * <a href="https://example.com">A link</a>
748
+ * ```
749
+ */
750
+ declare const RichTextEditor: ({ label, helpText, error, value, onChange, optional, isRequired, extensions, editorClassName, wrapperClassName, controls, extraMenuNodes, placeholder, }: RichTextEditorProps) => react_jsx_runtime.JSX.Element | null;
751
+
665
752
  declare const CurrencySymbolMap: Record<string, string>;
666
753
  interface FormatCurrencyOptions {
667
754
  convertToMajorCurrency?: boolean;
@@ -683,4 +770,4 @@ declare class DateAction {
683
770
 
684
771
  declare function cn(...inputs: ClassValue[]): string;
685
772
 
686
- export { AmountAction, Banner, Button, CalendarInput, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, type FilterListItem, type FilterListOptions, FilterPopover, FlagComponent, FormLabel, type FormatCurrencyOptions, HasResourcePermission, Input, Loader, LocaleSelector, MultiSelect, type MultiSelectDataType, MultiSelectTrigger, OTPInput, PageDataToolbar, Pagination, PasswordInput, PermissionsContext, PermissionsProvider, PhoneInput, Popover, PopoverContent, PopoverRoot, PopoverTrigger, RadioGroup, RadioGroupItem, type ResourcePermission, type ResourcePermissionProps, type ResourcePermissions, ScrollArea, Select, Sidebar, Status, Table, type TableBulkRowActionsProps, type TablePaginationProps, Tabs, TextOverflow, type TextOverflowProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useFilterStore, useHasPermission, usePermissions };
773
+ export { AmountAction, Banner, Button, CalendarInput, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, type FilterListItem, type FilterListOptions, FilterPopover, FlagComponent, FormLabel, type FormatCurrencyOptions, HasResourcePermission, Input, Loader, LocaleSelector, MultiSelect, type MultiSelectDataType, MultiSelectTrigger, OTPInput, PageDataToolbar, Pagination, PasswordInput, PermissionsContext, PermissionsProvider, PhoneInput, Popover, PopoverContent, PopoverRoot, PopoverTrigger, RadioGroup, RadioGroupItem, type ResourcePermission, type ResourcePermissionProps, type ResourcePermissions, RichTextEditor, ScrollArea, Select, Sidebar, Status, Table, type TableBulkRowActionsProps, type TablePaginationProps, Tabs, TextOverflow, type TextOverflowProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useFilterStore, useHasPermission, usePermissions };
package/dist/index.d.ts CHANGED
@@ -15,6 +15,7 @@ import { RowData, Row, Table as Table$1 } from '@tanstack/react-table';
15
15
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
16
16
  import * as zustand from 'zustand';
17
17
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
18
+ import { Extension } from '@tiptap/react';
18
19
  import dayjs from 'dayjs';
19
20
  import { ClassValue } from 'clsx';
20
21
 
@@ -398,22 +399,20 @@ declare const Status: ({ status, variant, className, }: {
398
399
  className?: string;
399
400
  }) => react_jsx_runtime.JSX.Element;
400
401
 
401
- type PaginationProps = {
402
- currentPage?: number;
403
- totalPages?: number;
404
- onPageChange?: (page: number) => void;
405
- totalItems?: number;
406
- itemsPerPage?: number;
407
- id?: string;
402
+ type RowAction = {
403
+ icon: React__default.ReactNode;
404
+ label: React__default.ReactNode;
405
+ onClick: (rowIds: string[]) => void;
406
+ className?: string;
407
+ variant?: ButtonVariant;
408
+ disabled?: boolean;
409
+ showCount?: boolean;
410
+ };
411
+ type TableBulkRowActionsProps = {
412
+ tableBulkActions: RowAction[];
413
+ selectedRows: string[];
414
+ isMobile?: boolean;
408
415
  };
409
- /**
410
- * Pagination component for displaying pagination controls.
411
- * @param {number} currentPage - The current page number.
412
- * @param {number} totalPages - The total number of pages.
413
- * @param {function} onPageChange - Callback function to handle page change.
414
- * @param {number | undefined} itemsPerPage - The number of items per page.
415
- */
416
- declare const Pagination: ({ currentPage, totalPages, onPageChange, itemsPerPage, totalItems, id, }: PaginationProps) => react_jsx_runtime.JSX.Element;
417
416
 
418
417
  type SelectOption = {
419
418
  value: string;
@@ -446,20 +445,22 @@ type FilterContentProps = {
446
445
  };
447
446
  type FilterListOptions = FilterListItem[];
448
447
 
449
- type RowAction = {
450
- icon: React__default.ReactNode;
451
- label: React__default.ReactNode;
452
- onClick: (rowIds: string[]) => void;
453
- className?: string;
454
- variant?: ButtonVariant;
455
- disabled?: boolean;
456
- showCount?: boolean;
457
- };
458
- type TableBulkRowActionsProps = {
459
- tableBulkActions: RowAction[];
460
- selectedRows: string[];
461
- isMobile?: boolean;
448
+ type PaginationProps = {
449
+ currentPage?: number;
450
+ totalPages?: number;
451
+ onPageChange?: (page: number) => void;
452
+ totalItems?: number;
453
+ itemsPerPage?: number;
454
+ id?: string;
462
455
  };
456
+ /**
457
+ * Pagination component for displaying pagination controls.
458
+ * @param {number} currentPage - The current page number.
459
+ * @param {number} totalPages - The total number of pages.
460
+ * @param {function} onPageChange - Callback function to handle page change.
461
+ * @param {number | undefined} itemsPerPage - The number of items per page.
462
+ */
463
+ declare const Pagination: ({ currentPage, totalPages, onPageChange, itemsPerPage, totalItems, id, }: PaginationProps) => react_jsx_runtime.JSX.Element;
463
464
 
464
465
  type TableSearchProps = {
465
466
  enabled: boolean;
@@ -471,6 +472,7 @@ type TableDownloadProps = {
471
472
  buttonId?: string;
472
473
  onDownload?: () => void;
473
474
  buttonText?: string;
475
+ isDownloading?: boolean;
474
476
  };
475
477
  type TablePaginationProps = {
476
478
  enabled: boolean;
@@ -662,6 +664,91 @@ type TabsProps = {
662
664
  };
663
665
  declare function Tabs({ tabs, defaultValue, onChange }: TabsProps): react_jsx_runtime.JSX.Element;
664
666
 
667
+ type EditorControl = "bold" | "italic" | "underline" | "strike" | "heading1" | "bulletList" | "orderedList" | "blockquote" | "textStyle" | "link";
668
+
669
+ type RichTextEditorProps = {
670
+ label?: string;
671
+ helpText?: string;
672
+ error?: string;
673
+ value?: string;
674
+ onChange?: (html: string) => void;
675
+ optional?: boolean;
676
+ isRequired?: boolean;
677
+ extensions?: Extension[];
678
+ editorClassName?: string;
679
+ wrapperClassName?: string;
680
+ controls?: EditorControl[];
681
+ extraMenuNodes?: React.ReactNode;
682
+ placeholder?: string;
683
+ };
684
+ /**
685
+ * @component RichTextEditor
686
+ * @description
687
+ * The `RichTextEditor` component is a customizable rich text input built on top of Tiptap and styled with Tailwind CSS.
688
+ * It provides a toolbar for formatting text (bold, italic, underline, strikethrough, headings, lists, blockquote, links).
689
+ *
690
+ * ## Props
691
+ * - `label?: string` - Label for the editor.
692
+ * - `helpText?: string` - Optional help text displayed below the editor.
693
+ * - `error?: string` - Error message displayed below the editor.
694
+ * - `value?: string` - The HTML content of the editor.
695
+ * - `onChange?: (html: string) => void` - Callback fired when the content changes.
696
+ * - `optional?: boolean` - If true, displays "Optional" next to the label.
697
+ * - `isRequired?: boolean` - If true, displays a red asterisk next to the label.
698
+ * - `extensions?: Extension[]` - Additional Tiptap extensions to include.
699
+ * - `editorClassName?: string` - Custom class for the editor content area.
700
+ * - `wrapperClassName?: string` - Custom class for the editor wrapper.
701
+ * - `controls?: EditorControl[]` - Array of controls to show in the toolbar.
702
+ * - `extraMenuNodes?: React.ReactNode` - Extra nodes to render in the toolbar.
703
+ *
704
+ * ## Usage
705
+ *
706
+ * ```tsx
707
+ * import React, { useState } from "react";
708
+ * import { RichTextEditor } from "@6thbridge/hexa";
709
+ *
710
+ * export const RichTextEditorDemo = () => {
711
+ * const [value, setValue] = useState("<p>Hello <strong>world</strong>!</p>");
712
+ *
713
+ * return (
714
+ * <div className="max-w-xl mx-auto mt-8">
715
+ * <RichTextEditor
716
+ * label="Description"
717
+ * helpText="You can format your text using the toolbar above."
718
+ * value={value}
719
+ * onChange={setValue}
720
+ * optional
721
+ * isRequired
722
+ * // You can customize controls, add extensions, etc.
723
+ * // controls={["textStyle", "bold", "italic", "underline", "strike", "link", "bulletList", "orderedList", "blockquote"]}
724
+ * />
725
+ * <div className="mt-6">
726
+ * <h2 className="text-lg font-semibold mb-2">Editor Output (HTML):</h2>
727
+ * <pre className="bg-gray-100 p-4 rounded text-xs overflow-x-auto">{value}</pre>
728
+ * </div>
729
+ * </div>
730
+ * );
731
+ * };
732
+ * ```
733
+ *
734
+ * ## Output
735
+ *
736
+ * The editor renders a toolbar with formatting buttons (bold, italic, underline, strikethrough, headings, bullet list, ordered list, blockquote, link).
737
+ * The content area allows rich text editing. The output is HTML, which is returned via the `onChange` callback and can be displayed or stored as needed.
738
+ *
739
+ * Example output:
740
+ *
741
+ * ```html
742
+ * <p>This is <strong>bold</strong>, <em>italic</em>, <u>underlined</u>, <s>strikethrough</s>, and a <blockquote>blockquote</blockquote>.</p>
743
+ * <ul>
744
+ * <li>Bullet item 1</li>
745
+ * <li>Bullet item 2</li>
746
+ * </ul>
747
+ * <a href="https://example.com">A link</a>
748
+ * ```
749
+ */
750
+ declare const RichTextEditor: ({ label, helpText, error, value, onChange, optional, isRequired, extensions, editorClassName, wrapperClassName, controls, extraMenuNodes, placeholder, }: RichTextEditorProps) => react_jsx_runtime.JSX.Element | null;
751
+
665
752
  declare const CurrencySymbolMap: Record<string, string>;
666
753
  interface FormatCurrencyOptions {
667
754
  convertToMajorCurrency?: boolean;
@@ -683,4 +770,4 @@ declare class DateAction {
683
770
 
684
771
  declare function cn(...inputs: ClassValue[]): string;
685
772
 
686
- export { AmountAction, Banner, Button, CalendarInput, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, type FilterListItem, type FilterListOptions, FilterPopover, FlagComponent, FormLabel, type FormatCurrencyOptions, HasResourcePermission, Input, Loader, LocaleSelector, MultiSelect, type MultiSelectDataType, MultiSelectTrigger, OTPInput, PageDataToolbar, Pagination, PasswordInput, PermissionsContext, PermissionsProvider, PhoneInput, Popover, PopoverContent, PopoverRoot, PopoverTrigger, RadioGroup, RadioGroupItem, type ResourcePermission, type ResourcePermissionProps, type ResourcePermissions, ScrollArea, Select, Sidebar, Status, Table, type TableBulkRowActionsProps, type TablePaginationProps, Tabs, TextOverflow, type TextOverflowProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useFilterStore, useHasPermission, usePermissions };
773
+ export { AmountAction, Banner, Button, CalendarInput, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, type FilterListItem, type FilterListOptions, FilterPopover, FlagComponent, FormLabel, type FormatCurrencyOptions, HasResourcePermission, Input, Loader, LocaleSelector, MultiSelect, type MultiSelectDataType, MultiSelectTrigger, OTPInput, PageDataToolbar, Pagination, PasswordInput, PermissionsContext, PermissionsProvider, PhoneInput, Popover, PopoverContent, PopoverRoot, PopoverTrigger, RadioGroup, RadioGroupItem, type ResourcePermission, type ResourcePermissionProps, type ResourcePermissions, RichTextEditor, ScrollArea, Select, Sidebar, Status, Table, type TableBulkRowActionsProps, type TablePaginationProps, Tabs, TextOverflow, type TextOverflowProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useFilterStore, useHasPermission, usePermissions };