@6thbridge/hexa 0.0.73 → 0.0.75

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
 
@@ -649,6 +650,104 @@ interface MultiSelectTriggerProps extends VariantProps<typeof inputContainerVari
649
650
  declare const MultiSelectTrigger: React$1.MemoExoticComponent<({ disabled, className, values, placeholder, status, onDelete, }: MultiSelectTriggerProps) => react_jsx_runtime.JSX.Element>;
650
651
  declare const MultiSelect: ({ options, children, onChange, optionComponent, values: dataValues, hideSearch, modal, placeholder, isLoading, showSelectedValues, error, label, showAsterisk, }: MultiSelectProps) => react_jsx_runtime.JSX.Element;
651
652
 
653
+ type Tab = {
654
+ key: string;
655
+ title: React.ReactNode;
656
+ count?: number | boolean;
657
+ content: JSX.Element | React.ReactNode;
658
+ };
659
+ type TabsProps = {
660
+ tabs: Tab[];
661
+ defaultValue?: string;
662
+ onChange?: (value?: string) => void;
663
+ };
664
+ declare function Tabs({ tabs, defaultValue, onChange }: TabsProps): react_jsx_runtime.JSX.Element;
665
+
666
+ type EditorControl = "bold" | "italic" | "underline" | "strike" | "heading1" | "bulletList" | "orderedList" | "blockquote" | "textStyle" | "link";
667
+
668
+ type RichTextEditorProps = {
669
+ label?: string;
670
+ helpText?: string;
671
+ error?: string;
672
+ value?: string;
673
+ onChange?: (html: string) => void;
674
+ optional?: boolean;
675
+ isRequired?: boolean;
676
+ extensions?: Extension[];
677
+ editorClassName?: string;
678
+ wrapperClassName?: string;
679
+ controls?: EditorControl[];
680
+ extraMenuNodes?: React.ReactNode;
681
+ placeholder?: string;
682
+ };
683
+ /**
684
+ * @component RichTextEditor
685
+ * @description
686
+ * The `RichTextEditor` component is a customizable rich text input built on top of Tiptap and styled with Tailwind CSS.
687
+ * It provides a toolbar for formatting text (bold, italic, underline, strikethrough, headings, lists, blockquote, links).
688
+ *
689
+ * ## Props
690
+ * - `label?: string` - Label for the editor.
691
+ * - `helpText?: string` - Optional help text displayed below the editor.
692
+ * - `error?: string` - Error message displayed below the editor.
693
+ * - `value?: string` - The HTML content of the editor.
694
+ * - `onChange?: (html: string) => void` - Callback fired when the content changes.
695
+ * - `optional?: boolean` - If true, displays "Optional" next to the label.
696
+ * - `isRequired?: boolean` - If true, displays a red asterisk next to the label.
697
+ * - `extensions?: Extension[]` - Additional Tiptap extensions to include.
698
+ * - `editorClassName?: string` - Custom class for the editor content area.
699
+ * - `wrapperClassName?: string` - Custom class for the editor wrapper.
700
+ * - `controls?: EditorControl[]` - Array of controls to show in the toolbar.
701
+ * - `extraMenuNodes?: React.ReactNode` - Extra nodes to render in the toolbar.
702
+ *
703
+ * ## Usage
704
+ *
705
+ * ```tsx
706
+ * import React, { useState } from "react";
707
+ * import { RichTextEditor } from "@6thbridge/hexa";
708
+ *
709
+ * export const RichTextEditorDemo = () => {
710
+ * const [value, setValue] = useState("<p>Hello <strong>world</strong>!</p>");
711
+ *
712
+ * return (
713
+ * <div className="max-w-xl mx-auto mt-8">
714
+ * <RichTextEditor
715
+ * label="Description"
716
+ * helpText="You can format your text using the toolbar above."
717
+ * value={value}
718
+ * onChange={setValue}
719
+ * optional
720
+ * isRequired
721
+ * // You can customize controls, add extensions, etc.
722
+ * // controls={["textStyle", "bold", "italic", "underline", "strike", "link", "bulletList", "orderedList", "blockquote"]}
723
+ * />
724
+ * <div className="mt-6">
725
+ * <h2 className="text-lg font-semibold mb-2">Editor Output (HTML):</h2>
726
+ * <pre className="bg-gray-100 p-4 rounded text-xs overflow-x-auto">{value}</pre>
727
+ * </div>
728
+ * </div>
729
+ * );
730
+ * };
731
+ * ```
732
+ *
733
+ * ## Output
734
+ *
735
+ * The editor renders a toolbar with formatting buttons (bold, italic, underline, strikethrough, headings, bullet list, ordered list, blockquote, link).
736
+ * 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.
737
+ *
738
+ * Example output:
739
+ *
740
+ * ```html
741
+ * <p>This is <strong>bold</strong>, <em>italic</em>, <u>underlined</u>, <s>strikethrough</s>, and a <blockquote>blockquote</blockquote>.</p>
742
+ * <ul>
743
+ * <li>Bullet item 1</li>
744
+ * <li>Bullet item 2</li>
745
+ * </ul>
746
+ * <a href="https://example.com">A link</a>
747
+ * ```
748
+ */
749
+ declare const RichTextEditor: ({ label, helpText, error, value, onChange, optional, isRequired, extensions, editorClassName, wrapperClassName, controls, extraMenuNodes, placeholder, }: RichTextEditorProps) => react_jsx_runtime.JSX.Element | null;
750
+
652
751
  declare const CurrencySymbolMap: Record<string, string>;
653
752
  interface FormatCurrencyOptions {
654
753
  convertToMajorCurrency?: boolean;
@@ -670,4 +769,4 @@ declare class DateAction {
670
769
 
671
770
  declare function cn(...inputs: ClassValue[]): string;
672
771
 
673
- 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, TextOverflow, type TextOverflowProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useFilterStore, useHasPermission, usePermissions };
772
+ 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
 
@@ -649,6 +650,104 @@ interface MultiSelectTriggerProps extends VariantProps<typeof inputContainerVari
649
650
  declare const MultiSelectTrigger: React$1.MemoExoticComponent<({ disabled, className, values, placeholder, status, onDelete, }: MultiSelectTriggerProps) => react_jsx_runtime.JSX.Element>;
650
651
  declare const MultiSelect: ({ options, children, onChange, optionComponent, values: dataValues, hideSearch, modal, placeholder, isLoading, showSelectedValues, error, label, showAsterisk, }: MultiSelectProps) => react_jsx_runtime.JSX.Element;
651
652
 
653
+ type Tab = {
654
+ key: string;
655
+ title: React.ReactNode;
656
+ count?: number | boolean;
657
+ content: JSX.Element | React.ReactNode;
658
+ };
659
+ type TabsProps = {
660
+ tabs: Tab[];
661
+ defaultValue?: string;
662
+ onChange?: (value?: string) => void;
663
+ };
664
+ declare function Tabs({ tabs, defaultValue, onChange }: TabsProps): react_jsx_runtime.JSX.Element;
665
+
666
+ type EditorControl = "bold" | "italic" | "underline" | "strike" | "heading1" | "bulletList" | "orderedList" | "blockquote" | "textStyle" | "link";
667
+
668
+ type RichTextEditorProps = {
669
+ label?: string;
670
+ helpText?: string;
671
+ error?: string;
672
+ value?: string;
673
+ onChange?: (html: string) => void;
674
+ optional?: boolean;
675
+ isRequired?: boolean;
676
+ extensions?: Extension[];
677
+ editorClassName?: string;
678
+ wrapperClassName?: string;
679
+ controls?: EditorControl[];
680
+ extraMenuNodes?: React.ReactNode;
681
+ placeholder?: string;
682
+ };
683
+ /**
684
+ * @component RichTextEditor
685
+ * @description
686
+ * The `RichTextEditor` component is a customizable rich text input built on top of Tiptap and styled with Tailwind CSS.
687
+ * It provides a toolbar for formatting text (bold, italic, underline, strikethrough, headings, lists, blockquote, links).
688
+ *
689
+ * ## Props
690
+ * - `label?: string` - Label for the editor.
691
+ * - `helpText?: string` - Optional help text displayed below the editor.
692
+ * - `error?: string` - Error message displayed below the editor.
693
+ * - `value?: string` - The HTML content of the editor.
694
+ * - `onChange?: (html: string) => void` - Callback fired when the content changes.
695
+ * - `optional?: boolean` - If true, displays "Optional" next to the label.
696
+ * - `isRequired?: boolean` - If true, displays a red asterisk next to the label.
697
+ * - `extensions?: Extension[]` - Additional Tiptap extensions to include.
698
+ * - `editorClassName?: string` - Custom class for the editor content area.
699
+ * - `wrapperClassName?: string` - Custom class for the editor wrapper.
700
+ * - `controls?: EditorControl[]` - Array of controls to show in the toolbar.
701
+ * - `extraMenuNodes?: React.ReactNode` - Extra nodes to render in the toolbar.
702
+ *
703
+ * ## Usage
704
+ *
705
+ * ```tsx
706
+ * import React, { useState } from "react";
707
+ * import { RichTextEditor } from "@6thbridge/hexa";
708
+ *
709
+ * export const RichTextEditorDemo = () => {
710
+ * const [value, setValue] = useState("<p>Hello <strong>world</strong>!</p>");
711
+ *
712
+ * return (
713
+ * <div className="max-w-xl mx-auto mt-8">
714
+ * <RichTextEditor
715
+ * label="Description"
716
+ * helpText="You can format your text using the toolbar above."
717
+ * value={value}
718
+ * onChange={setValue}
719
+ * optional
720
+ * isRequired
721
+ * // You can customize controls, add extensions, etc.
722
+ * // controls={["textStyle", "bold", "italic", "underline", "strike", "link", "bulletList", "orderedList", "blockquote"]}
723
+ * />
724
+ * <div className="mt-6">
725
+ * <h2 className="text-lg font-semibold mb-2">Editor Output (HTML):</h2>
726
+ * <pre className="bg-gray-100 p-4 rounded text-xs overflow-x-auto">{value}</pre>
727
+ * </div>
728
+ * </div>
729
+ * );
730
+ * };
731
+ * ```
732
+ *
733
+ * ## Output
734
+ *
735
+ * The editor renders a toolbar with formatting buttons (bold, italic, underline, strikethrough, headings, bullet list, ordered list, blockquote, link).
736
+ * 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.
737
+ *
738
+ * Example output:
739
+ *
740
+ * ```html
741
+ * <p>This is <strong>bold</strong>, <em>italic</em>, <u>underlined</u>, <s>strikethrough</s>, and a <blockquote>blockquote</blockquote>.</p>
742
+ * <ul>
743
+ * <li>Bullet item 1</li>
744
+ * <li>Bullet item 2</li>
745
+ * </ul>
746
+ * <a href="https://example.com">A link</a>
747
+ * ```
748
+ */
749
+ declare const RichTextEditor: ({ label, helpText, error, value, onChange, optional, isRequired, extensions, editorClassName, wrapperClassName, controls, extraMenuNodes, placeholder, }: RichTextEditorProps) => react_jsx_runtime.JSX.Element | null;
750
+
652
751
  declare const CurrencySymbolMap: Record<string, string>;
653
752
  interface FormatCurrencyOptions {
654
753
  convertToMajorCurrency?: boolean;
@@ -670,4 +769,4 @@ declare class DateAction {
670
769
 
671
770
  declare function cn(...inputs: ClassValue[]): string;
672
771
 
673
- 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, TextOverflow, type TextOverflowProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useFilterStore, useHasPermission, usePermissions };
772
+ 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 };