@6thbridge/hexa 0.0.91 → 0.0.93

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
@@ -1,3 +1,4 @@
1
+ import dayjs from 'dayjs';
1
2
  import * as React$1 from 'react';
2
3
  import React__default, { DetailedHTMLProps, ButtonHTMLAttributes, ReactNode } from 'react';
3
4
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
@@ -15,9 +16,36 @@ import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
15
16
  import * as zustand from 'zustand';
16
17
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
17
18
  import { Extension } from '@tiptap/react';
18
- import dayjs from 'dayjs';
19
19
  import { ClassValue } from 'clsx';
20
20
 
21
+ declare const CurrencySymbolMap: Record<string, string>;
22
+ interface FormatCurrencyOptions {
23
+ convertToMajorCurrency?: boolean;
24
+ locale?: string;
25
+ }
26
+ declare class AmountAction {
27
+ static getCurrencyLocaleMap(currency: string): string;
28
+ static koboToNaira(amount: number | string): number;
29
+ static nairaToKobo(amount: number | string): number;
30
+ static getCurrencySymbol(currency: string): string;
31
+ static formatAmountAndCurrency: (currency: string, value: number | string, options: FormatCurrencyOptions) => string;
32
+ }
33
+
34
+ declare class DateAction {
35
+ static getDateLibrary(): dayjs.Dayjs;
36
+ static formatTimestampToDate(timestamp: number, dateFormat?: string): string;
37
+ static formatDateToTimestamp(date: string): number;
38
+ }
39
+
40
+ declare class StringAction {
41
+ static capitalizeFirstWord(string: string): string;
42
+ static capitalizeEachWord(string: string): string;
43
+ static sanitizeString: ({ str, allowedChars, }: {
44
+ str: string;
45
+ allowedChars?: string[];
46
+ }) => string;
47
+ }
48
+
21
49
  declare const TooltipProvider: React$1.FC<TooltipPrimitive.TooltipProviderProps>;
22
50
  declare const TooltipRoot: React$1.FC<TooltipPrimitive.TooltipProps>;
23
51
  declare const TooltipTrigger: React$1.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
@@ -356,13 +384,26 @@ type BusinessType = {
356
384
  access?: string;
357
385
  };
358
386
 
387
+ type ResourcePermission = {
388
+ resource: string;
389
+ action: string;
390
+ };
391
+ type ResourcePermissions = ResourcePermission[];
392
+ type ResourcePermissionProps = {
393
+ permission?: {
394
+ resource?: string;
395
+ action?: string;
396
+ };
397
+ children: ReactNode;
398
+ };
399
+
359
400
  type SingleLinkType = {
360
401
  to: string;
361
402
  name: string;
362
403
  isHidden?: boolean;
363
404
  icon?: ReactNode;
364
405
  badge?: ReactNode;
365
- permission?: string;
406
+ permission?: ResourcePermissionProps["permission"];
366
407
  key?: string;
367
408
  id: string;
368
409
  };
@@ -538,19 +579,6 @@ type PageDataToolbarProps = {
538
579
  };
539
580
  declare const PageDataToolbar: ({ onRefetch, search, FilterMenu, ExtraNode, onExport, download, isRefetching, filterListOptions, setAppliedFilters, onFilterChange, id, }: PageDataToolbarProps) => React$1.JSX.Element;
540
581
 
541
- type ResourcePermission = {
542
- resource: string;
543
- action: string;
544
- };
545
- type ResourcePermissions = ResourcePermission[];
546
- type ResourcePermissionProps = {
547
- permission?: {
548
- resource?: string;
549
- action?: string;
550
- };
551
- children: ReactNode;
552
- };
553
-
554
582
  declare const PermissionsContext: React$1.Context<ResourcePermissions | undefined>;
555
583
  declare const PermissionsProvider: ({ permissions, children, }: {
556
584
  permissions: ResourcePermissions;
@@ -683,7 +711,7 @@ type TabsProps = {
683
711
  declare function Tabs({ tabs, defaultValue, onChange }: TabsProps): React$1.JSX.Element;
684
712
 
685
713
  declare const featureBannerVariants: (props?: ({
686
- variant?: "success" | "pending" | "default" | "danger" | null | undefined;
714
+ variant?: "default" | "success" | "pending" | "danger" | null | undefined;
687
715
  } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
688
716
 
689
717
  type FeatureBannerActionVariant = "primary" | "outlined";
@@ -798,25 +826,34 @@ type RichTextEditorProps = {
798
826
  */
799
827
  declare const RichTextEditor: ({ label, helpText, error, value, onChange, optional, isRequired, extensions, editorClassName, wrapperClassName, controls, extraMenuNodes, placeholder, }: RichTextEditorProps) => React$1.JSX.Element | null;
800
828
 
801
- declare const CurrencySymbolMap: Record<string, string>;
802
- interface FormatCurrencyOptions {
803
- convertToMajorCurrency?: boolean;
804
- locale?: string;
805
- }
806
- declare class AmountAction {
807
- static getCurrencyLocaleMap(currency: string): string;
808
- static koboToNaira(amount: number | string): number;
809
- static nairaToKobo(amount: number | string): number;
810
- static getCurrencySymbol(currency: string): string;
811
- static formatAmountAndCurrency: (currency: string, value: number | string, options: FormatCurrencyOptions) => string;
812
- }
813
-
814
- declare class DateAction {
815
- static getDateLibrary(): dayjs.Dayjs;
816
- static formatTimestampToDate(timestamp: number, dateFormat?: string): string;
817
- static formatDateToTimestamp(date: string): number;
829
+ type TagInputVariant = "success" | "failed" | "pending" | "default";
830
+ type TagOption = {
831
+ value: string;
832
+ label: string;
833
+ variant?: TagInputVariant;
834
+ disabled?: boolean;
835
+ [key: string]: unknown;
836
+ };
837
+ interface TagsInputProps {
838
+ value: TagOption[];
839
+ onChange: (value: TagOption[]) => void;
840
+ options?: TagOption[];
841
+ label?: string;
842
+ error?: string;
843
+ placeholder?: string;
844
+ description?: React$1.ReactNode;
845
+ showAsterisk?: boolean;
846
+ disabled?: boolean;
847
+ isLoading?: boolean;
848
+ allowCreate?: boolean;
849
+ renderTag?: (tag: TagOption) => React$1.ReactNode;
850
+ renderOption?: (option: TagOption, selected: boolean) => React$1.ReactNode;
851
+ validateTag?: (input: string) => boolean;
852
+ onCreate?: (input: string) => TagOption;
853
+ maxTags?: number;
818
854
  }
855
+ declare const TagsInput: ({ value, onChange, options, label, error, placeholder, description, showAsterisk, disabled, isLoading, allowCreate, renderTag, renderOption, validateTag, onCreate, maxTags, }: TagsInputProps) => React$1.JSX.Element;
819
856
 
820
857
  declare function cn(...inputs: ClassValue[]): string;
821
858
 
822
- export { AmountAction, Banner, Button, CalendarInput, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, FeatureBanner, 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 };
859
+ export { AmountAction, Banner, Button, CalendarInput, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, FeatureBanner, 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, StringAction, Table, type TableBulkRowActionsProps, type TablePaginationProps, Tabs, type TagOption, TagsInput, type TagsInputProps, TextOverflow, type TextOverflowProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useFilterStore, useHasPermission, usePermissions };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import dayjs from 'dayjs';
1
2
  import * as React$1 from 'react';
2
3
  import React__default, { DetailedHTMLProps, ButtonHTMLAttributes, ReactNode } from 'react';
3
4
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
@@ -15,9 +16,36 @@ import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
15
16
  import * as zustand from 'zustand';
16
17
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
17
18
  import { Extension } from '@tiptap/react';
18
- import dayjs from 'dayjs';
19
19
  import { ClassValue } from 'clsx';
20
20
 
21
+ declare const CurrencySymbolMap: Record<string, string>;
22
+ interface FormatCurrencyOptions {
23
+ convertToMajorCurrency?: boolean;
24
+ locale?: string;
25
+ }
26
+ declare class AmountAction {
27
+ static getCurrencyLocaleMap(currency: string): string;
28
+ static koboToNaira(amount: number | string): number;
29
+ static nairaToKobo(amount: number | string): number;
30
+ static getCurrencySymbol(currency: string): string;
31
+ static formatAmountAndCurrency: (currency: string, value: number | string, options: FormatCurrencyOptions) => string;
32
+ }
33
+
34
+ declare class DateAction {
35
+ static getDateLibrary(): dayjs.Dayjs;
36
+ static formatTimestampToDate(timestamp: number, dateFormat?: string): string;
37
+ static formatDateToTimestamp(date: string): number;
38
+ }
39
+
40
+ declare class StringAction {
41
+ static capitalizeFirstWord(string: string): string;
42
+ static capitalizeEachWord(string: string): string;
43
+ static sanitizeString: ({ str, allowedChars, }: {
44
+ str: string;
45
+ allowedChars?: string[];
46
+ }) => string;
47
+ }
48
+
21
49
  declare const TooltipProvider: React$1.FC<TooltipPrimitive.TooltipProviderProps>;
22
50
  declare const TooltipRoot: React$1.FC<TooltipPrimitive.TooltipProps>;
23
51
  declare const TooltipTrigger: React$1.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
@@ -356,13 +384,26 @@ type BusinessType = {
356
384
  access?: string;
357
385
  };
358
386
 
387
+ type ResourcePermission = {
388
+ resource: string;
389
+ action: string;
390
+ };
391
+ type ResourcePermissions = ResourcePermission[];
392
+ type ResourcePermissionProps = {
393
+ permission?: {
394
+ resource?: string;
395
+ action?: string;
396
+ };
397
+ children: ReactNode;
398
+ };
399
+
359
400
  type SingleLinkType = {
360
401
  to: string;
361
402
  name: string;
362
403
  isHidden?: boolean;
363
404
  icon?: ReactNode;
364
405
  badge?: ReactNode;
365
- permission?: string;
406
+ permission?: ResourcePermissionProps["permission"];
366
407
  key?: string;
367
408
  id: string;
368
409
  };
@@ -538,19 +579,6 @@ type PageDataToolbarProps = {
538
579
  };
539
580
  declare const PageDataToolbar: ({ onRefetch, search, FilterMenu, ExtraNode, onExport, download, isRefetching, filterListOptions, setAppliedFilters, onFilterChange, id, }: PageDataToolbarProps) => React$1.JSX.Element;
540
581
 
541
- type ResourcePermission = {
542
- resource: string;
543
- action: string;
544
- };
545
- type ResourcePermissions = ResourcePermission[];
546
- type ResourcePermissionProps = {
547
- permission?: {
548
- resource?: string;
549
- action?: string;
550
- };
551
- children: ReactNode;
552
- };
553
-
554
582
  declare const PermissionsContext: React$1.Context<ResourcePermissions | undefined>;
555
583
  declare const PermissionsProvider: ({ permissions, children, }: {
556
584
  permissions: ResourcePermissions;
@@ -683,7 +711,7 @@ type TabsProps = {
683
711
  declare function Tabs({ tabs, defaultValue, onChange }: TabsProps): React$1.JSX.Element;
684
712
 
685
713
  declare const featureBannerVariants: (props?: ({
686
- variant?: "success" | "pending" | "default" | "danger" | null | undefined;
714
+ variant?: "default" | "success" | "pending" | "danger" | null | undefined;
687
715
  } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
688
716
 
689
717
  type FeatureBannerActionVariant = "primary" | "outlined";
@@ -798,25 +826,34 @@ type RichTextEditorProps = {
798
826
  */
799
827
  declare const RichTextEditor: ({ label, helpText, error, value, onChange, optional, isRequired, extensions, editorClassName, wrapperClassName, controls, extraMenuNodes, placeholder, }: RichTextEditorProps) => React$1.JSX.Element | null;
800
828
 
801
- declare const CurrencySymbolMap: Record<string, string>;
802
- interface FormatCurrencyOptions {
803
- convertToMajorCurrency?: boolean;
804
- locale?: string;
805
- }
806
- declare class AmountAction {
807
- static getCurrencyLocaleMap(currency: string): string;
808
- static koboToNaira(amount: number | string): number;
809
- static nairaToKobo(amount: number | string): number;
810
- static getCurrencySymbol(currency: string): string;
811
- static formatAmountAndCurrency: (currency: string, value: number | string, options: FormatCurrencyOptions) => string;
812
- }
813
-
814
- declare class DateAction {
815
- static getDateLibrary(): dayjs.Dayjs;
816
- static formatTimestampToDate(timestamp: number, dateFormat?: string): string;
817
- static formatDateToTimestamp(date: string): number;
829
+ type TagInputVariant = "success" | "failed" | "pending" | "default";
830
+ type TagOption = {
831
+ value: string;
832
+ label: string;
833
+ variant?: TagInputVariant;
834
+ disabled?: boolean;
835
+ [key: string]: unknown;
836
+ };
837
+ interface TagsInputProps {
838
+ value: TagOption[];
839
+ onChange: (value: TagOption[]) => void;
840
+ options?: TagOption[];
841
+ label?: string;
842
+ error?: string;
843
+ placeholder?: string;
844
+ description?: React$1.ReactNode;
845
+ showAsterisk?: boolean;
846
+ disabled?: boolean;
847
+ isLoading?: boolean;
848
+ allowCreate?: boolean;
849
+ renderTag?: (tag: TagOption) => React$1.ReactNode;
850
+ renderOption?: (option: TagOption, selected: boolean) => React$1.ReactNode;
851
+ validateTag?: (input: string) => boolean;
852
+ onCreate?: (input: string) => TagOption;
853
+ maxTags?: number;
818
854
  }
855
+ declare const TagsInput: ({ value, onChange, options, label, error, placeholder, description, showAsterisk, disabled, isLoading, allowCreate, renderTag, renderOption, validateTag, onCreate, maxTags, }: TagsInputProps) => React$1.JSX.Element;
819
856
 
820
857
  declare function cn(...inputs: ClassValue[]): string;
821
858
 
822
- export { AmountAction, Banner, Button, CalendarInput, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, FeatureBanner, 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 };
859
+ export { AmountAction, Banner, Button, CalendarInput, CopyableLabel, Country, CurrencySymbolMap, DateAction, DebouncedInput, DevBanner, Dialog, Drawer, DrawerClose, type DrawerPropsType, DrawerRoot, FeatureBanner, 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, StringAction, Table, type TableBulkRowActionsProps, type TablePaginationProps, Tabs, type TagOption, TagsInput, type TagsInputProps, TextOverflow, type TextOverflowProps, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipRoot, TooltipTrigger, buttonVariants, cn, useFilterStore, useHasPermission, usePermissions };