@hybr1d-tech/charizard 0.3.36

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 (96) hide show
  1. package/README.md +44 -0
  2. package/dist/button/Button.d.ts +52 -0
  3. package/dist/button/actions-dropdown.stories.d.ts +6 -0
  4. package/dist/button/button.stories.d.ts +10 -0
  5. package/dist/button/index.d.ts +1 -0
  6. package/dist/button/menu-button.stories.d.ts +6 -0
  7. package/dist/checkbox/Checkbox.d.ts +44 -0
  8. package/dist/checkbox/index.d.ts +1 -0
  9. package/dist/combo-box/ComboBox.d.ts +23 -0
  10. package/dist/combo-box/combo-box.stories.d.ts +10 -0
  11. package/dist/combo-box/index.d.ts +1 -0
  12. package/dist/drawer/Drawer.d.ts +71 -0
  13. package/dist/drawer/index.d.ts +1 -0
  14. package/dist/empty-state/EmptyState.d.ts +13 -0
  15. package/dist/empty-state/empty-state.stories.d.ts +6 -0
  16. package/dist/empty-state/index.d.ts +1 -0
  17. package/dist/hybr1d-ui.js +8024 -0
  18. package/dist/hybr1d-ui.umd.cjs +61 -0
  19. package/dist/index.d.ts +20 -0
  20. package/dist/input/Input.d.ts +63 -0
  21. package/dist/input/InputAddon.d.ts +44 -0
  22. package/dist/input/InputContainer.d.ts +28 -0
  23. package/dist/input/InputElement.d.ts +21 -0
  24. package/dist/input/InputGroup.d.ts +17 -0
  25. package/dist/input/InputLabel.d.ts +42 -0
  26. package/dist/input/index.d.ts +6 -0
  27. package/dist/input/types.d.ts +13 -0
  28. package/dist/layout-tabs/LayoutTabs.d.ts +22 -0
  29. package/dist/layout-tabs/index.d.ts +1 -0
  30. package/dist/loader/Loader.d.ts +17 -0
  31. package/dist/loader/index.d.ts +1 -0
  32. package/dist/loader/loader.stories.d.ts +13 -0
  33. package/dist/modal/Modal.d.ts +30 -0
  34. package/dist/modal/ModalBody.d.ts +17 -0
  35. package/dist/modal/ModalContent.d.ts +18 -0
  36. package/dist/modal/ModalFooter.d.ts +34 -0
  37. package/dist/modal/ModalHeader.d.ts +21 -0
  38. package/dist/modal/ModalOverlay.d.ts +9 -0
  39. package/dist/modal/index.d.ts +6 -0
  40. package/dist/modal/usage.d.ts +1 -0
  41. package/dist/popover/Popover.d.ts +26 -0
  42. package/dist/popover/PopoverCloseButton.d.ts +23 -0
  43. package/dist/popover/PopoverContent.d.ts +32 -0
  44. package/dist/popover/PopoverDescription.d.ts +23 -0
  45. package/dist/popover/PopoverTitle.d.ts +23 -0
  46. package/dist/popover/PopoverTrigger.d.ts +29 -0
  47. package/dist/popover/index.d.ts +6 -0
  48. package/dist/popover/usage.d.ts +1 -0
  49. package/dist/progress/Progress.d.ts +63 -0
  50. package/dist/progress/index.d.ts +1 -0
  51. package/dist/radio-group/RadioGroup.d.ts +43 -0
  52. package/dist/radio-group/index.d.ts +1 -0
  53. package/dist/search/Search.d.ts +9 -0
  54. package/dist/search/index.d.ts +1 -0
  55. package/dist/segmented-control/SegmentedControl.d.ts +22 -0
  56. package/dist/segmented-control/index.d.ts +1 -0
  57. package/dist/select/Common.d.ts +9 -0
  58. package/dist/select/CreatableSelect.d.ts +100 -0
  59. package/dist/select/Select.d.ts +91 -0
  60. package/dist/select/SelectAsync.d.ts +83 -0
  61. package/dist/select/config.d.ts +3 -0
  62. package/dist/select/index.d.ts +3 -0
  63. package/dist/select/types.d.ts +15 -0
  64. package/dist/selectors/Selectors.d.ts +7 -0
  65. package/dist/selectors/index.d.ts +1 -0
  66. package/dist/style.css +1 -0
  67. package/dist/svg/SVG.d.ts +11 -0
  68. package/dist/svg/index.d.ts +1 -0
  69. package/dist/switch/Switch.d.ts +12 -0
  70. package/dist/switch/index.d.ts +1 -0
  71. package/dist/table/Table.d.ts +87 -0
  72. package/dist/table/constants.d.ts +3 -0
  73. package/dist/table/index.d.ts +1 -0
  74. package/dist/table/store.d.ts +14 -0
  75. package/dist/table/table-actions/TableActions.d.ts +7 -0
  76. package/dist/table/table-actions/index.d.ts +1 -0
  77. package/dist/table/table-columns/TableCheckbox.d.ts +11 -0
  78. package/dist/table/table-columns/TableRadio.d.ts +7 -0
  79. package/dist/table/table-columns/index.d.ts +2 -0
  80. package/dist/table/table-empty/TableEmpty.d.ts +5 -0
  81. package/dist/table/table-empty/index.d.ts +1 -0
  82. package/dist/table/table-filters/FilterCheckbox.d.ts +12 -0
  83. package/dist/table/table-filters/FilterTooltip.d.ts +8 -0
  84. package/dist/table/table-filters/TableFilter.d.ts +13 -0
  85. package/dist/table/table-filters/TableFilters.d.ts +6 -0
  86. package/dist/table/table-filters/index.d.ts +1 -0
  87. package/dist/table/table-loader/TableLoader.d.ts +4 -0
  88. package/dist/table/table-loader/index.d.ts +1 -0
  89. package/dist/table/table-selected-actions/TableSelectedActions.d.ts +7 -0
  90. package/dist/table/table-selected-actions/index.d.ts +1 -0
  91. package/dist/table/types.d.ts +36 -0
  92. package/dist/tooltip/Tooltip.d.ts +28 -0
  93. package/dist/tooltip/TooltipContent.d.ts +24 -0
  94. package/dist/tooltip/TooltipTrigger.d.ts +16 -0
  95. package/dist/tooltip/index.d.ts +1 -0
  96. package/package.json +74 -0
@@ -0,0 +1,87 @@
1
+ import * as React from 'react';
2
+ import type { FilterConfig } from './types';
3
+ export interface TableProps {
4
+ data: any;
5
+ columns: any;
6
+ actionsConfig?: {
7
+ isDropdownActions?: boolean;
8
+ menuItems?: {
9
+ label: string;
10
+ iconSrc?: string;
11
+ onClick: any;
12
+ filterFn?: any;
13
+ }[];
14
+ key?: string;
15
+ customComp?: React.ReactNode;
16
+ };
17
+ loaderConfig: {
18
+ text?: string;
19
+ isFetching: boolean;
20
+ isError: boolean;
21
+ errMsg?: string;
22
+ };
23
+ searchConfig?: {
24
+ placeholder?: string;
25
+ search: string;
26
+ setSearch: any;
27
+ };
28
+ /**
29
+ * table sorting
30
+ * @param sortBy used for
31
+ */
32
+ sortConfig?: {
33
+ sortBy: string;
34
+ setSortBy: any;
35
+ sortOrd: 'asc' | 'desc' | '';
36
+ setSortOrd: any;
37
+ sortMap: Record<string, string>;
38
+ };
39
+ /**
40
+ * table filtering, data comes from an api
41
+ *
42
+ */
43
+ filterConfig?: FilterConfig;
44
+ totalText?: string;
45
+ rowSelectionConfig?: {
46
+ isCheckbox?: boolean;
47
+ isRadio?: boolean;
48
+ actions?: {
49
+ icon: string;
50
+ text: string;
51
+ onClick: any;
52
+ }[];
53
+ setSelectedRows?: React.Dispatch<React.SetStateAction<any>>;
54
+ iconSrc?: string;
55
+ shouldClear?: boolean;
56
+ };
57
+ selectorConfig?: {
58
+ selectors: {
59
+ name: string;
60
+ onClick: any;
61
+ }[];
62
+ };
63
+ paginationConfig?: {
64
+ metaData: {
65
+ total_items: number;
66
+ items_on_page: number;
67
+ };
68
+ loader: React.ReactNode;
69
+ fetchNextPage: () => void;
70
+ height?: string;
71
+ };
72
+ emptyStateConfig?: {
73
+ icon: string;
74
+ isCustom?: {
75
+ value: boolean;
76
+ component: React.ReactNode;
77
+ };
78
+ title: string;
79
+ desc: string;
80
+ btnText: string;
81
+ onClick: any;
82
+ columns: number;
83
+ emptySearchTitle?: string;
84
+ };
85
+ headerText?: string;
86
+ }
87
+ export declare function Table({ data, loaderConfig, columns, filterConfig, sortConfig, rowSelectionConfig, actionsConfig, searchConfig, totalText, selectorConfig, paginationConfig, emptyStateConfig, headerText, }: TableProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare const CHECKBOX_COL_ID = "select";
2
+ export declare const DROPDOWN_COL_ID = "dropdown-actions";
3
+ export declare const RADIO_COL_ID = "select-radio";
@@ -0,0 +1 @@
1
+ export * from './Table';
@@ -0,0 +1,14 @@
1
+ import { InternalTableFilters } from './types';
2
+ export interface TableStore {
3
+ filters: InternalTableFilters[];
4
+ setDefaultFilters: (filters: InternalTableFilters[]) => void;
5
+ addFilters: (filterKey: string, value: string, filterDispatch: any) => void;
6
+ removeFilters: (filterKey: string, value: string, filterDispatch: any) => void;
7
+ resetFilters: (filterKey: string, filterDispatch: any) => void;
8
+ resetAllFilters: (filterReset?: any) => void;
9
+ }
10
+ export declare const useTableStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<TableStore>, "setState"> & {
11
+ setState<A extends string | {
12
+ type: unknown;
13
+ }>(partial: TableStore | Partial<TableStore> | ((state: TableStore) => TableStore | Partial<TableStore>), replace?: boolean | undefined, action?: A | undefined): void;
14
+ }>;
@@ -0,0 +1,7 @@
1
+ import { TableProps } from '../Table';
2
+ type TableActionsProps = {
3
+ actionsConfig: TableProps['actionsConfig'];
4
+ data: any;
5
+ };
6
+ export default function TableActions({ actionsConfig, data }: TableActionsProps): import("react/jsx-runtime").JSX.Element | null;
7
+ export {};
@@ -0,0 +1 @@
1
+ export { default } from './TableActions';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @author Soham Sarkar <soham@hybr1d.io>
3
+ */
4
+ import * as React from 'react';
5
+ import type { Row } from '@tanstack/react-table';
6
+ export declare function TableCheckbox({ indeterminate, row, isHeader, ...rest }: {
7
+ indeterminate: boolean;
8
+ row: Row<unknown>;
9
+ setSelectedRows?: any;
10
+ isHeader?: boolean;
11
+ } & React.HTMLProps<HTMLInputElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import type { Row } from '@tanstack/react-table';
3
+ export declare function TableRadio({ indeterminate, row, ...rest }: {
4
+ indeterminate: boolean;
5
+ row: Row<unknown>;
6
+ setSelectedRows?: any;
7
+ } & React.HTMLProps<HTMLInputElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export * from './TableCheckbox';
2
+ export * from './TableRadio';
@@ -0,0 +1,5 @@
1
+ import { TableProps } from '../Table';
2
+ export default function TableEmpty({ emptyStateConfig, search, }: {
3
+ emptyStateConfig: TableProps['emptyStateConfig'];
4
+ search?: string;
5
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1 @@
1
+ export { default } from './TableEmpty';
@@ -0,0 +1,12 @@
1
+ import { TableStore } from '../store';
2
+ export default function FilterCheckbox({ label, value, addFilters, removeFilters, checked, filterKey, filterDispatch, countryCode, customName, }: {
3
+ label: string;
4
+ value: string;
5
+ checked: boolean;
6
+ filterKey: string;
7
+ addFilters: TableStore['addFilters'];
8
+ removeFilters: TableStore['removeFilters'];
9
+ filterDispatch: (value: any) => void;
10
+ countryCode?: string;
11
+ customName?: string;
12
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { FilterOptions, InternalTableFilters } from '../types';
2
+ type FilterTooltipProps = {
3
+ filter: FilterOptions;
4
+ tableFilter: InternalTableFilters;
5
+ selectedFilters: number;
6
+ };
7
+ export default function FilterTooltip({ filter, tableFilter, selectedFilters }: FilterTooltipProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,13 @@
1
+ import { TableStore } from '../store';
2
+ import type { FilterOptions, InternalTableFilters } from '../types';
3
+ interface TableFilterProps {
4
+ filter: FilterOptions;
5
+ tableFilters: TableStore['filters'];
6
+ tableFilter: InternalTableFilters;
7
+ addFilters: TableStore['addFilters'];
8
+ removeFilters: TableStore['removeFilters'];
9
+ resetFilters: (filterKey: string, filterDispatch: any) => void;
10
+ filterDispatch: (value: any) => void;
11
+ }
12
+ export default function TableFilter({ filter, tableFilters, tableFilter, addFilters, removeFilters, resetFilters, filterDispatch, }: TableFilterProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { FilterConfig } from '../types';
2
+ type TableFiltersProps = {
3
+ filterConfig: FilterConfig;
4
+ };
5
+ export default function TableFilters({ filterConfig }: TableFiltersProps): import("react/jsx-runtime").JSX.Element | null;
6
+ export {};
@@ -0,0 +1 @@
1
+ export { default } from './TableFilters';
@@ -0,0 +1,4 @@
1
+ export default function TableLoader({ text, isError, }: {
2
+ text?: string;
3
+ isError: boolean;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export { default } from './TableLoader';
@@ -0,0 +1,7 @@
1
+ import { TableProps } from '../Table';
2
+ interface TableSelectedActionsProps {
3
+ rowSelectionConfig: TableProps['rowSelectionConfig'];
4
+ rowSelection: {};
5
+ }
6
+ export default function TableSelectedActions({ rowSelectionConfig, rowSelection, }: TableSelectedActionsProps): import("react/jsx-runtime").JSX.Element | null;
7
+ export {};
@@ -0,0 +1 @@
1
+ export { default } from './TableSelectedActions';
@@ -0,0 +1,36 @@
1
+ export type FilterOptions = {
2
+ id: string;
3
+ name: string;
4
+ key: string;
5
+ options: {
6
+ name: string;
7
+ value: string;
8
+ country_code?: string;
9
+ customName?: string;
10
+ }[];
11
+ config?: {
12
+ hideSearch?: boolean;
13
+ placeholder?: string;
14
+ };
15
+ };
16
+ /**
17
+ * @param filters comes from an api, must follow the type definition strictly
18
+ * @param isLoading is fetching from api
19
+ * @param isError api threw error
20
+ * @param filterDispatch must be of @type (value) => dispatch({type,payload})
21
+ * this is used to sync the internal table filter state with the external zustand store of the consumer
22
+ * @param filterReset same type as above but is used to reset all the filters
23
+ *
24
+ *
25
+ */
26
+ export type FilterConfig = {
27
+ filters: FilterOptions[];
28
+ isLoading: boolean;
29
+ isError: boolean;
30
+ filterDispatch: (value: any) => void;
31
+ filterReset: (value: any) => void;
32
+ };
33
+ export type InternalTableFilters = {
34
+ key: string;
35
+ values: string[];
36
+ };
@@ -0,0 +1,28 @@
1
+ import * as React from 'react';
2
+ import { TooltipTrigger } from './TooltipTrigger';
3
+ import { TooltipContent } from './TooltipContent';
4
+ import type { Placement } from '@zag-js/popper';
5
+ interface TooltipProps {
6
+ /**
7
+ * tooltip children
8
+ */
9
+ children: React.ReactNode;
10
+ /**
11
+ * open tooltip after delay
12
+ */
13
+ openDelay?: number;
14
+ /**
15
+ * close tooltip after delay
16
+ */
17
+ closeDelay?: number;
18
+ /**
19
+ * placement of the tooltip
20
+ */
21
+ placement?: Placement;
22
+ }
23
+ export declare function Tooltip({ children, openDelay, closeDelay, placement, }: TooltipProps): import("react/jsx-runtime").JSX.Element;
24
+ export declare namespace Tooltip {
25
+ var Trigger: typeof TooltipTrigger;
26
+ var Content: typeof TooltipContent;
27
+ }
28
+ export {};
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @author Pratik Awaik <pratik@hybr1d.io>
3
+ */
4
+ interface TooltipContentProps {
5
+ /**
6
+ * tooltip content children
7
+ */
8
+ children: React.ReactNode;
9
+ /**
10
+ * tooltip API object
11
+ */
12
+ api?: any;
13
+ /**
14
+ * content background
15
+ */
16
+ bg?: 'black' | 'gray' | string;
17
+ /**
18
+ * positioner styles
19
+ */
20
+ positionerStyles?: React.CSSProperties;
21
+ containerStyles?: React.CSSProperties;
22
+ }
23
+ export declare function TooltipContent({ children, api, bg, positionerStyles, containerStyles, }: TooltipContentProps): import("react/jsx-runtime").JSX.Element;
24
+ export {};
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @author Pratik Awaik <pratik@hybr1d.io>
3
+ */
4
+ interface TooltipTriggerProps {
5
+ /**
6
+ * tooltip trigger
7
+ */
8
+ children: React.ReactNode;
9
+ /**
10
+ * The tooltip API object.
11
+ */
12
+ api?: any;
13
+ customStyles?: React.CSSProperties;
14
+ }
15
+ export declare function TooltipTrigger({ children, api, customStyles }: TooltipTriggerProps): import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1 @@
1
+ export { Tooltip } from './Tooltip';
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@hybr1d-tech/charizard",
3
+ "version": "0.3.36",
4
+ "type": "module",
5
+ "files": [
6
+ "dist"
7
+ ],
8
+ "main": "./dist/hybr1d-ui.umd.js",
9
+ "module": "./dist/hybr1d-ui.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/hybr1d-ui.js",
14
+ "require": "./dist/hybr1d-ui.umd.js"
15
+ }
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/Usehybrid/charizard"
20
+ },
21
+ "peerDependencies": {
22
+ "@tanstack/react-table": "^8.10.7",
23
+ "@zag-js/checkbox": "^0.31.1",
24
+ "@zag-js/combobox": "^0.31.1",
25
+ "@zag-js/dialog": "^0.31.1",
26
+ "@zag-js/menu": "^0.31.1",
27
+ "@zag-js/popover": "^0.31.1",
28
+ "@zag-js/popper": "^0.31.1",
29
+ "@zag-js/radio-group": "^0.31.1",
30
+ "@zag-js/react": "^0.31.1",
31
+ "@zag-js/tabs": "^0.31.1",
32
+ "@zag-js/tooltip": "^0.31.1",
33
+ "clsx": "^2.0.0",
34
+ "react": "^18.2.0",
35
+ "react-country-flag": "^3.1.0",
36
+ "react-dom": "^18.2.0",
37
+ "react-infinite-scroll-component": "^6.1.0",
38
+ "react-inlinesvg": "^4.1.0",
39
+ "react-select": "^5.8.0",
40
+ "use-deep-compare-effect": "^1.8.1",
41
+ "zustand": "^4.4.6"
42
+ },
43
+ "devDependencies": {
44
+ "@storybook/addon-essentials": "^7.5.3",
45
+ "@storybook/addon-interactions": "^7.5.3",
46
+ "@storybook/addon-links": "^7.5.3",
47
+ "@storybook/blocks": "^7.5.3",
48
+ "@storybook/react": "^7.5.3",
49
+ "@storybook/react-vite": "^7.5.3",
50
+ "@storybook/testing-library": "^0.2.2",
51
+ "@types/node": "^20.9.0",
52
+ "@types/react": "^18.2.37",
53
+ "@types/react-dom": "^18.2.15",
54
+ "@vitejs/plugin-react": "^4.1.1",
55
+ "prop-types": "^15.8.1",
56
+ "storybook": "^7.5.3",
57
+ "storybook-css-modules-preset": "^1.1.1",
58
+ "typescript": "^5.2.2",
59
+ "vite": "^4.5.0",
60
+ "vite-plugin-checker": "^0.6.2",
61
+ "vite-plugin-dts": "^3.6.3",
62
+ "vite-plugin-libcss": "^1.1.1"
63
+ },
64
+ "publishConfig": {
65
+ "access": "public"
66
+ },
67
+ "scripts": {
68
+ "dev": "vite",
69
+ "build": "tsc && vite build",
70
+ "preview": "vite preview",
71
+ "storybook": "storybook dev -p 6006",
72
+ "build-storybook": "storybook build"
73
+ }
74
+ }