@databrainhq/plugin 0.9.3 → 0.9.5

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/README.md CHANGED
@@ -1,26 +1,26 @@
1
- # @databrainhq/plugin
2
-
3
- > Databrain app ui plugin.
4
-
5
- [![NPM](https://img.shields.io/npm/v/@databrainhq/plugin.svg)](https://www.npmjs.com/package/@databrainhq/plugin) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
6
-
7
- ## Install
8
-
9
- ```bash
10
- npm install @databrainhq/plugin
11
- ```
12
-
13
- ## Usage
14
-
15
- ```tsx
16
- import { Dashboard } from '@databrainhq/plugin';
17
- import '@databrainhq/plugin/dist/style.css';
18
-
19
- const Example = () => {
20
- return <Dashboard token={/* Your Guest Token */} />;
21
- };
22
- ```
23
-
24
- ## License
25
-
26
- MIT © [databrainhq](https://github.com/databrainhq)
1
+ # @databrainhq/plugin
2
+
3
+ > Databrain app ui plugin.
4
+
5
+ [![NPM](https://img.shields.io/npm/v/@databrainhq/plugin.svg)](https://www.npmjs.com/package/@databrainhq/plugin) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @databrainhq/plugin
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```tsx
16
+ import { Dashboard } from '@databrainhq/plugin';
17
+ import '@databrainhq/plugin/dist/style.css';
18
+
19
+ const Example = () => {
20
+ return <Dashboard token={/* Your Guest Token */} />;
21
+ };
22
+ ```
23
+
24
+ ## License
25
+
26
+ MIT © [databrainhq](https://github.com/databrainhq)
@@ -14,9 +14,8 @@ export declare type FloatingDropDownProps = {
14
14
  closeControl?: {
15
15
  close: boolean;
16
16
  };
17
- labelDesign?: string;
18
17
  };
19
- export declare const FloatingDropDown: ({ label, labelVariant, selectedOption, onChange, className, options, isDisabled, children, icon, isSearchEnabled, closeControl, labelDesign, }: FloatingDropDownProps) => JSX.Element;
18
+ export declare const FloatingDropDown: ({ label, labelVariant, selectedOption, onChange, className, options, isDisabled, children, icon, isSearchEnabled, closeControl, }: FloatingDropDownProps) => JSX.Element;
20
19
  export declare type MultiFloatingDropDownProps = Omit<FloatingDropDownProps, 'selectedOption' | 'onChange'> & {
21
20
  selectedOptions: FloatingDropDownOption[];
22
21
  onChange: (options: FloatingDropDownOption[]) => void;
@@ -11,5 +11,5 @@ interface Props extends React.HTMLProps<HTMLInputElement> {
11
11
  inputClass?: string;
12
12
  onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
13
13
  }
14
- export declare const InputField: ({ type, register, error, icon, label, isDisabled, labelClass, inputClass, className, labelVariant, id, defaultValue, ...rest }: Props) => JSX.Element;
14
+ export declare const InputField: ({ type, register, error, icon, label, isDisabled, labelClass, inputClass, className, labelVariant, id, ...rest }: Props) => JSX.Element;
15
15
  export {};
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { ExternalMetrics } from '@/utils/generated/graphql';
3
+ declare type Props = {
4
+ onCloseModal: (value: boolean) => void;
5
+ isShowRawCsvModal: boolean;
6
+ metricItem?: ExternalMetrics;
7
+ client: string;
8
+ companyTenancyType: string;
9
+ };
10
+ export declare const DownloadRawCsvModal: ({ onCloseModal, isShowRawCsvModal, metricItem, client, companyTenancyType, }: Props) => JSX.Element;
11
+ export default DownloadRawCsvModal;
@@ -17,5 +17,7 @@ export declare type MetricCardProps = {
17
17
  renderHeaderName?: (name: string) => JSX.Element;
18
18
  onArchive?: (metricId: string) => void;
19
19
  onEdit?: (metric: ExternalMetrics, metricData?: Record<string, any>[]) => void;
20
+ onTableView?: (metric: ExternalMetrics, metricData?: Record<string, any>[]) => void;
21
+ onDownloadRawCsv?: (metric: ExternalMetrics) => void;
20
22
  };
21
23
  export declare const MetricCard: React.FC<MetricCardProps>;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ declare type Props = {
3
+ metricData?: Record<string, any>[];
4
+ isOpen: boolean;
5
+ onClose: () => void;
6
+ title: string;
7
+ };
8
+ export declare const TableViewModal: ({ metricData, isOpen, onClose, title, }: Props) => JSX.Element;
9
+ export default TableViewModal;
@@ -3,3 +3,5 @@ export * from './components/MetricCard';
3
3
  export * from './components/SingleValueCard';
4
4
  export * from './components/ArchiveMetricModal';
5
5
  export * from './components/LayoutAlert';
6
+ export * from './components/TableViewModal';
7
+ export * from './components/DownloadRawCsvModal';
@@ -17,13 +17,13 @@ declare type SelectInput = {
17
17
  containerClass?: string;
18
18
  isSearchEnabled?: boolean;
19
19
  textSize?: string;
20
- labelDesign?: string;
20
+ labelVariant?: 'floating' | 'static';
21
21
  };
22
22
  declare type HookSelectInput = Omit<SelectInput, 'value'> & {
23
23
  control: Control;
24
24
  name: string;
25
25
  };
26
- export declare const Select: ({ label, options, onChange, value, defaultValue, children, placeHolder, className, containerClass, isSearchEnabled, textSize, labelDesign, }: SelectInput) => JSX.Element;
26
+ export declare const Select: ({ label, options, onChange, value, defaultValue, children, placeHolder, className, containerClass, isSearchEnabled, textSize, labelVariant, }: SelectInput) => JSX.Element;
27
27
  export declare const HookSelect: ({ control, name, ...rest }: HookSelectInput) => JSX.Element;
28
28
  export declare const SelectWithSubValue: ({ label, options, onChange, value, defaultValue, }: any) => JSX.Element;
29
29
  export declare const DropDown: ({ control, name, options, label, defaultValue, }: HookSelectInput) => JSX.Element;
@@ -39,6 +39,7 @@ declare type MultiSelectProps = {
39
39
  children?: React.ReactNode;
40
40
  placeHolder?: string;
41
41
  onClick?: any;
42
+ labelVariant?: 'floating' | 'static';
42
43
  isSearchEnabled?: boolean;
43
44
  };
44
45
  export declare const MultiSelect: React.FC<MultiSelectProps>;
@@ -60,3 +60,4 @@ export declare const FREQUENCY: {
60
60
  value: string;
61
61
  label: string;
62
62
  }[];
63
+ export declare const RAW_CSV_OPTIONS: string[];
@@ -0,0 +1,2 @@
1
+ declare const timeAgo: (unixTimestamp: number) => string;
2
+ export default timeAgo;
@@ -1,8 +1,6 @@
1
- /// <reference types="react" />
2
1
  import { FieldValues } from 'react-hook-form';
3
- declare const useDownloadRawCsv: () => {
4
- isShowRawCsvModal: boolean;
5
- setRawCsvModal: import("react").Dispatch<import("react").SetStateAction<boolean>>;
2
+ import { ExternalMetrics } from '@/utils/generated/graphql';
3
+ declare const useDownloadRawCsv: (onCloseModal: (value: boolean) => void, metricItem?: ExternalMetrics) => {
6
4
  isLoading: boolean;
7
5
  downloadCsvError: string;
8
6
  onSubmitDownloadCsv: ({ companyId, sqlQuery, values, clientName, tenancyType, metricName, workspaceId, }: {
@@ -16,5 +14,25 @@ declare const useDownloadRawCsv: () => {
16
14
  }) => void;
17
15
  handleSubmit: import("react-hook-form").UseFormHandleSubmit<FieldValues>;
18
16
  register: import("react-hook-form").UseFormRegister<FieldValues>;
17
+ csvDownloadUrls: {
18
+ urls: string[];
19
+ lastUpdatedAt: string;
20
+ isExpired: boolean;
21
+ error: string | null | undefined;
22
+ expireUrlIn: number;
23
+ } | {
24
+ urls: never[];
25
+ lastUpdatedAt: number;
26
+ isExpired: boolean;
27
+ error: null;
28
+ expireUrlIn: number;
29
+ };
30
+ handleDownload: (url: string) => void;
31
+ csvDownloadUrlError: string;
32
+ saveRawCsvDetails: ({ values, clientName, tenancyType, }: {
33
+ values: FieldValues;
34
+ clientName?: string | undefined;
35
+ tenancyType?: string | undefined;
36
+ }) => void;
19
37
  };
20
38
  export default useDownloadRawCsv;