@deskpro/deskpro-ui 2.9.1 → 3.1.0
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/cjs/components/Drilldown/Drilldown.js +91 -38
- package/dist/cjs/components/Drilldown/Drilldown.js.map +1 -1
- package/dist/cjs/components/Drilldown/DrilldownResetButton.js +1 -1
- package/dist/cjs/components/Drilldown/DrilldownResetButton.js.map +1 -1
- package/dist/cjs/components/Drilldown/index.js +3 -3
- package/dist/cjs/components/Drilldown/index.js.map +1 -1
- package/dist/cjs/components/Drilldown/storyDataFlat.js +1108 -0
- package/dist/cjs/components/Drilldown/storyDataFlat.js.map +1 -0
- package/dist/cjs/components/Drilldown/{storyData.js → storyDataTree.js} +3 -3
- package/dist/cjs/components/Drilldown/storyDataTree.js.map +1 -0
- package/dist/cjs/components/Drilldown/styles.js +3 -2
- package/dist/cjs/components/Drilldown/styles.js.map +1 -1
- package/dist/cjs/components/Drilldown/types.js +33 -3
- package/dist/cjs/components/Drilldown/types.js.map +1 -1
- package/dist/cjs/components/Drilldown/useUpdateItems.js +42 -13
- package/dist/cjs/components/Drilldown/useUpdateItems.js.map +1 -1
- package/dist/cjs/components/Drilldown/utility.js +46 -15
- package/dist/cjs/components/Drilldown/utility.js.map +1 -1
- package/dist/cjs/components/Dropdown/Dropdown.js +71 -48
- package/dist/cjs/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/cjs/components/Dropdown/DropdownResetButton.js +1 -1
- package/dist/cjs/components/Dropdown/DropdownResetButton.js.map +1 -1
- package/dist/cjs/components/Popover/Popover.js +6 -0
- package/dist/cjs/components/Popover/Popover.js.map +1 -1
- package/dist/cjs/components/index.js +1 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/deskpro-ui.d.ts +468 -3
- package/dist/esm/components/Drilldown/Drilldown.js +93 -40
- package/dist/esm/components/Drilldown/Drilldown.js.map +1 -1
- package/dist/esm/components/Drilldown/DrilldownResetButton.js +1 -1
- package/dist/esm/components/Drilldown/DrilldownResetButton.js.map +1 -1
- package/dist/esm/components/Drilldown/index.js +2 -2
- package/dist/esm/components/Drilldown/index.js.map +1 -1
- package/dist/esm/components/Drilldown/storyDataFlat.js +1105 -0
- package/dist/esm/components/Drilldown/storyDataFlat.js.map +1 -0
- package/dist/esm/components/Drilldown/{storyData.js → storyDataTree.js} +3 -3
- package/dist/esm/components/Drilldown/storyDataTree.js.map +1 -0
- package/dist/esm/components/Drilldown/styles.js +3 -2
- package/dist/esm/components/Drilldown/styles.js.map +1 -1
- package/dist/esm/components/Drilldown/types.js +23 -1
- package/dist/esm/components/Drilldown/types.js.map +1 -1
- package/dist/esm/components/Drilldown/useUpdateItems.js +42 -14
- package/dist/esm/components/Drilldown/useUpdateItems.js.map +1 -1
- package/dist/esm/components/Drilldown/utility.js +40 -11
- package/dist/esm/components/Drilldown/utility.js.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.js +71 -48
- package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/components/Dropdown/DropdownResetButton.js +1 -1
- package/dist/esm/components/Dropdown/DropdownResetButton.js.map +1 -1
- package/dist/esm/components/Popover/Popover.js +6 -0
- package/dist/esm/components/Popover/Popover.js.map +1 -1
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/components/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/Drilldown/storyData.js.map +0 -1
- package/dist/esm/components/Drilldown/storyData.js.map +0 -1
package/dist/deskpro-ui.d.ts
CHANGED
|
@@ -1542,7 +1542,7 @@ export declare interface CommonButtonProps {
|
|
|
1542
1542
|
/**
|
|
1543
1543
|
* @public
|
|
1544
1544
|
*/
|
|
1545
|
-
export declare const CreateNewOption: ({ text, icon, onClick, resetButton, iconColor, }: CreateNewOptionProps) => JSX.Element;
|
|
1545
|
+
export declare const CreateNewOption: ({ text, icon, onClick, resetButton, iconColor, active, }: CreateNewOptionProps) => JSX.Element;
|
|
1546
1546
|
|
|
1547
1547
|
/**
|
|
1548
1548
|
* @public
|
|
@@ -1553,6 +1553,7 @@ export declare interface CreateNewOptionProps {
|
|
|
1553
1553
|
onClick: () => void;
|
|
1554
1554
|
resetButton?: boolean;
|
|
1555
1555
|
iconColor?: ThemeColorKey;
|
|
1556
|
+
active: boolean;
|
|
1556
1557
|
}
|
|
1557
1558
|
|
|
1558
1559
|
/**
|
|
@@ -1696,6 +1697,449 @@ export declare interface DividerProps {
|
|
|
1696
1697
|
|
|
1697
1698
|
declare type DpCustomIconsId = "active-call" | "admin" | "advanced-filter" | "agent" | "api" | "apps-zapier" | "arrow" | "column-width" | "community" | "crown" | "deskpro" | "dot" | "drag" | "dual-view" | "email-primary" | "enter" | "export-alt" | "export" | "follow-up" | "glossary" | "google-analytics" | "grip" | "hang-up" | "helping-hand" | "im-outline" | "im-send" | "im" | "inbound-call" | "kanban-view" | "level-down" | "linked-ticket" | "location-arrow" | "merge" | "merge2" | "missed-call" | "mobile-rotate" | "organization-circle" | "outbound-call" | "read" | "record" | "sent" | "sip-address" | "sort" | "transfer-queue" | "triangle" | "warm-add" | "warm-transfer" | "webhook";
|
|
1698
1699
|
|
|
1700
|
+
/**
|
|
1701
|
+
* Wraps around any child to upgrade it to a drilldown component. If used in the
|
|
1702
|
+
* render props style you get access to some of the internal state of the drilldown
|
|
1703
|
+
* including the input props used for search
|
|
1704
|
+
* @public
|
|
1705
|
+
* @example
|
|
1706
|
+
* ```
|
|
1707
|
+
* const options = [
|
|
1708
|
+
* {type: "header", label: "Header"},
|
|
1709
|
+
* {type: "value", key: "1", label: "Value"}
|
|
1710
|
+
* ];
|
|
1711
|
+
*
|
|
1712
|
+
* function handleOnSelect(value: DrilldownValueType) {}
|
|
1713
|
+
*
|
|
1714
|
+
* // as children
|
|
1715
|
+
* <Drilldown options={options} onSelectOption={handleOnSelect}>
|
|
1716
|
+
* <button>click here</button>
|
|
1717
|
+
* </Drilldown>
|
|
1718
|
+
*
|
|
1719
|
+
* // as render props with controlled input
|
|
1720
|
+
* <Drilldown options={options} onSelectOption={handleOnSelect}>
|
|
1721
|
+
* {({searchInputProps}) =>
|
|
1722
|
+
* <input {...searchInputProps}/>
|
|
1723
|
+
* }
|
|
1724
|
+
* </Drilldown>
|
|
1725
|
+
* ```
|
|
1726
|
+
*/
|
|
1727
|
+
export declare function Drilldown<T, TargetRef extends HTMLElement = any>({ type, children, options, inputValue, searchPlaceholder, placement, showInternalSearch, isLoading, usePortal, closeOnSelect, isOpen: isOpenProp, renderCreateNewOption, hideIcons, iconColumnWidth, containerWidth, containerHeight, onSelectOption, onInputChange, filterItemsCb, onFetchMore, onClear, onClose, onOpen, onInputReturn, tabProps, disabled, fetchMoreText, autoscrollText, externalLinkIcon, selectedIcon, layer, animationDuration, onDrilldown, onDrilldownAnimationEnd, onDrillupAnimationEnd, backText, }: DrilldownProps<T, TargetRef>): JSX.Element;
|
|
1728
|
+
|
|
1729
|
+
declare interface DrilldownBaseProps<T, TargetRef extends HTMLElement> {
|
|
1730
|
+
/** Event handler for when an option is selected */
|
|
1731
|
+
onSelectOption?: (item: DrilldownValueType<T>, keyPathToSelectedItem: string[]) => void;
|
|
1732
|
+
/** Event handler that it called when triggering a drilldown, before animation is run */
|
|
1733
|
+
onDrilldown?: (item: DrilldownValueType<T>, pathToSelectedItem: PathToSelectedItem) => Promise<void>;
|
|
1734
|
+
/** Control over whether the drilldown is open - default uncontrolled */
|
|
1735
|
+
isOpen?: boolean;
|
|
1736
|
+
/** PopperJS placement option. Defaults to "bottom-start" */
|
|
1737
|
+
placement?: Placement;
|
|
1738
|
+
/** Wether to render the drilldown in a portal. Default true */
|
|
1739
|
+
usePortal?: boolean;
|
|
1740
|
+
/** The input value to render in the search box */
|
|
1741
|
+
inputValue?: string;
|
|
1742
|
+
/** Show a loading indicator */
|
|
1743
|
+
isLoading?: boolean;
|
|
1744
|
+
/** Show an internal search input for filtering options. The Drilldown does not
|
|
1745
|
+
* do any filtering itself
|
|
1746
|
+
*/
|
|
1747
|
+
showInternalSearch?: boolean;
|
|
1748
|
+
/** Whether to disable the drilldown */
|
|
1749
|
+
disabled?: boolean;
|
|
1750
|
+
/** Whether subitems are rendered in an expanding or non-expanding style */
|
|
1751
|
+
expandingDrillDown?: boolean;
|
|
1752
|
+
/** Placeholder for search input box */
|
|
1753
|
+
searchPlaceholder?: string;
|
|
1754
|
+
/** Whether the drilldown should close on selections. default true */
|
|
1755
|
+
closeOnSelect?: boolean;
|
|
1756
|
+
/** Whether to hide item's icon for the whole list */
|
|
1757
|
+
hideIcons?: boolean;
|
|
1758
|
+
/** The width of the column in which icons are rendered */
|
|
1759
|
+
iconColumnWidth?: number;
|
|
1760
|
+
/** Add in custom width to the drilldown options container */
|
|
1761
|
+
containerWidth?: number;
|
|
1762
|
+
/** Add in custom height to the drilldown options container */
|
|
1763
|
+
containerHeight?: number;
|
|
1764
|
+
/** Event handler for when the user requests more options.
|
|
1765
|
+
* For use with paginated options */
|
|
1766
|
+
onFetchMore?: () => void;
|
|
1767
|
+
/** Event handler for when the drilldown closes */
|
|
1768
|
+
onClose?: () => void;
|
|
1769
|
+
/** Event handler for when the drilldown opens */
|
|
1770
|
+
onOpen?: () => void;
|
|
1771
|
+
/** The target for the drilldown. Either a normal ReactNode or a render
|
|
1772
|
+
* prop with additional state from the drilldown */
|
|
1773
|
+
children: ((props: DrilldownTargetProps<TargetRef>) => JSX.Element) | JSX.Element;
|
|
1774
|
+
/** Render the create new option - no default implementation and renders as a
|
|
1775
|
+
* sticky footer above the normal sticky footer
|
|
1776
|
+
*/
|
|
1777
|
+
onCreateNewOption?: () => void;
|
|
1778
|
+
renderCreateNewOption?: (active: boolean, onSelect: () => void) => ReactNode;
|
|
1779
|
+
/** Props for rendering tabs within the drilldown */
|
|
1780
|
+
tabProps?: DrilldownTabProps;
|
|
1781
|
+
/** The text to show for the fetch more button */
|
|
1782
|
+
fetchMoreText: ReactNode;
|
|
1783
|
+
/** The text to show for the autoscroll button */
|
|
1784
|
+
autoscrollText: ReactNode;
|
|
1785
|
+
externalLinkIcon: AnyIcon;
|
|
1786
|
+
selectedIcon: AnyIcon;
|
|
1787
|
+
/** Event handler that returns input value after enter has been pressed */
|
|
1788
|
+
onInputReturn?: (inputValue: string) => void;
|
|
1789
|
+
/** The zIndex Layer that the drilldown will be rendered at. Defaults to: popover */
|
|
1790
|
+
layer?: keyof Layers;
|
|
1791
|
+
/** the time it takes to animate sliding between lists. Defaults to 0.3s */
|
|
1792
|
+
animationDuration?: number;
|
|
1793
|
+
/** Event handler that it called when triggering a drillup, after animation was run */
|
|
1794
|
+
onDrillupAnimationEnd?: (pathToSelectedItem: PathToSelectedItem) => Promise<void>;
|
|
1795
|
+
/** The text to show for the back button */
|
|
1796
|
+
backText: ReactNode;
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1799
|
+
/**
|
|
1800
|
+
* @public
|
|
1801
|
+
*/
|
|
1802
|
+
export declare const DrilldownContainer: StyledComponent<ForwardRefComponent<HTMLDivElement, HTMLMotionProps<"div">>, DefaultTheme, {
|
|
1803
|
+
"data-dp-name": string;
|
|
1804
|
+
"data-dp-ident"?: string | undefined;
|
|
1805
|
+
} & {
|
|
1806
|
+
containerWidth?: number | undefined;
|
|
1807
|
+
containerHeight?: number | undefined;
|
|
1808
|
+
layer: keyof Layers;
|
|
1809
|
+
}, keyof {
|
|
1810
|
+
"data-dp-name": string;
|
|
1811
|
+
"data-dp-ident"?: string | undefined;
|
|
1812
|
+
}>;
|
|
1813
|
+
|
|
1814
|
+
/**
|
|
1815
|
+
* @public
|
|
1816
|
+
*/
|
|
1817
|
+
export declare const DrilldownCreateNewOption: ({ text, icon, onClick, resetButton, iconColor, active, }: DrilldownCreateNewOptionProps) => JSX.Element;
|
|
1818
|
+
|
|
1819
|
+
/**
|
|
1820
|
+
* @public
|
|
1821
|
+
*/
|
|
1822
|
+
export declare interface DrilldownCreateNewOptionProps {
|
|
1823
|
+
text?: ReactNode;
|
|
1824
|
+
icon: AnyIcon;
|
|
1825
|
+
onClick: () => void;
|
|
1826
|
+
resetButton?: boolean;
|
|
1827
|
+
iconColor?: ThemeColorKey;
|
|
1828
|
+
active: boolean;
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
/**
|
|
1832
|
+
* @public
|
|
1833
|
+
*/
|
|
1834
|
+
export declare interface DrilldownDivider {
|
|
1835
|
+
type: "divider";
|
|
1836
|
+
}
|
|
1837
|
+
|
|
1838
|
+
/**
|
|
1839
|
+
* @public
|
|
1840
|
+
*/
|
|
1841
|
+
declare interface DrilldownDividerFlat extends DrilldownDivider {
|
|
1842
|
+
/** Unique identifier for the parent option */
|
|
1843
|
+
parentKey: string | undefined;
|
|
1844
|
+
}
|
|
1845
|
+
|
|
1846
|
+
/**
|
|
1847
|
+
* @public
|
|
1848
|
+
*/
|
|
1849
|
+
export declare const DrilldownDividerItem: StyledComponent<"div", DefaultTheme, {}, never>;
|
|
1850
|
+
|
|
1851
|
+
/**
|
|
1852
|
+
* @public
|
|
1853
|
+
* Pass in a component to render if the list is empty.
|
|
1854
|
+
* This will usually be a NonIdeal state, see storybook examples
|
|
1855
|
+
*/
|
|
1856
|
+
declare interface DrilldownEmptyList {
|
|
1857
|
+
type: "emptyList";
|
|
1858
|
+
component: ReactNode;
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
/**
|
|
1862
|
+
* @public
|
|
1863
|
+
*/
|
|
1864
|
+
declare interface DrilldownEmptyListFlat extends DrilldownEmptyList {
|
|
1865
|
+
/** Unique identifier for the parent option */
|
|
1866
|
+
parentKey: string | undefined;
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
/**
|
|
1870
|
+
* @public
|
|
1871
|
+
*/
|
|
1872
|
+
declare interface DrilldownFlatProps<T, TargetRef extends HTMLElement> extends DrilldownBaseProps<T, TargetRef> {
|
|
1873
|
+
/** Expects options to be a flat array of type DrilldownItemFlatType<T>[]. This is easier to work with if your response data is also returned as a flat array */
|
|
1874
|
+
type: "flat";
|
|
1875
|
+
/** List of options to render */
|
|
1876
|
+
options: DrilldownItemFlatType<T>[];
|
|
1877
|
+
/** Event handler for when the "active" item changes via keyboard events */
|
|
1878
|
+
onActiveOptionChange?: (item: DrilldownValueFlatType<T> | null) => void;
|
|
1879
|
+
/** Event handler for when the "clear" event is triggered for the search input */
|
|
1880
|
+
onClear?: () => void;
|
|
1881
|
+
/** Event handler for when an option is selected */
|
|
1882
|
+
/** Event handler for when the search input value changes */
|
|
1883
|
+
onInputChange?: (input: string, pathToSelectedItem: PathToSelectedItem) => void;
|
|
1884
|
+
/** Callback for filtering items. This is used on drillup to re-filter the parent list based on the input string */
|
|
1885
|
+
filterItemsCb?: (items: DrilldownItemFlatType<T>[], input: string, prevItemsKey: string | undefined) => DrilldownItemFlatType<T>[];
|
|
1886
|
+
/** Event handler that it called when triggering a drilldown, after animation was run */
|
|
1887
|
+
onDrilldownAnimationEnd?: (item: DrilldownValueFlatType<T> | undefined, pathToSelectedItem: PathToSelectedItem) => Promise<void>;
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
/**
|
|
1891
|
+
* @public
|
|
1892
|
+
*/
|
|
1893
|
+
declare interface DrilldownHeaderFlatType extends DrilldownHeaderType {
|
|
1894
|
+
/** Unique identifier for the parent option */
|
|
1895
|
+
parentKey: string | undefined;
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
/**
|
|
1899
|
+
* @public
|
|
1900
|
+
*/
|
|
1901
|
+
export declare const DrilldownHeaderItem: StyledComponent<"div", DefaultTheme, {}, never>;
|
|
1902
|
+
|
|
1903
|
+
/**
|
|
1904
|
+
* @public
|
|
1905
|
+
*/
|
|
1906
|
+
export declare interface DrilldownHeaderType {
|
|
1907
|
+
type: "header";
|
|
1908
|
+
label: ReactNode;
|
|
1909
|
+
childLabels?: string[];
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
/**
|
|
1913
|
+
* @public
|
|
1914
|
+
*/
|
|
1915
|
+
export declare const DrilldownInternalSearchInputContainer: StyledComponent<"div", DefaultTheme, {}, never>;
|
|
1916
|
+
|
|
1917
|
+
/**
|
|
1918
|
+
* @public
|
|
1919
|
+
*/
|
|
1920
|
+
export declare function DrilldownItem<T = unknown>({ value, active, onSelect, onSelectIcon, onClickSubItem, hideIcons, iconColumnWidth, selectedIcon, externalLinkIcon, handleDrilldown, dataKey, subItems, }: DrilldownItemProps<T>): JSX.Element;
|
|
1921
|
+
|
|
1922
|
+
/**
|
|
1923
|
+
* @public
|
|
1924
|
+
*/
|
|
1925
|
+
declare type DrilldownItemFlatType<T = unknown> = DrilldownValueFlatType<T> | DrilldownHeaderFlatType | DrilldownDividerFlat | DrilldownStickyHeaderFlat<T> | DrilldownStickyFooterFlat<T> | DrilldownEmptyListFlat | DrilldownLoadingFlat;
|
|
1926
|
+
|
|
1927
|
+
/**
|
|
1928
|
+
* @public
|
|
1929
|
+
*/
|
|
1930
|
+
export declare interface DrilldownItemMeta {
|
|
1931
|
+
/** Whether to render as an "active" element */
|
|
1932
|
+
active: boolean;
|
|
1933
|
+
/** The current search input */
|
|
1934
|
+
input: string;
|
|
1935
|
+
}
|
|
1936
|
+
|
|
1937
|
+
/**
|
|
1938
|
+
* @public
|
|
1939
|
+
*/
|
|
1940
|
+
export declare interface DrilldownItemProps<T = unknown> {
|
|
1941
|
+
onSelect?: (value: DrilldownValueType<T>) => void;
|
|
1942
|
+
onSelectIcon?: (value: T) => void;
|
|
1943
|
+
onClickSubItem?: (value: DrilldownValueType<T>) => void;
|
|
1944
|
+
value: DrilldownValueType<T>;
|
|
1945
|
+
meta: DrilldownItemMeta;
|
|
1946
|
+
customLabelRender?: ReactNode;
|
|
1947
|
+
active?: boolean;
|
|
1948
|
+
hideIcons?: boolean;
|
|
1949
|
+
iconColumnWidth?: number;
|
|
1950
|
+
externalLinkIcon: AnyIcon;
|
|
1951
|
+
selectedIcon: AnyIcon;
|
|
1952
|
+
handleDrilldown: (item: DrilldownValueType<T>) => Promise<void>;
|
|
1953
|
+
dataKey: string;
|
|
1954
|
+
subItems: DrilldownItemType<T>[] | undefined;
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
/**
|
|
1958
|
+
* @public
|
|
1959
|
+
*/
|
|
1960
|
+
declare type DrilldownItemTreeType<T = unknown> = DrilldownValueTreeType<T> | DrilldownHeaderType | DrilldownDivider | DrilldownStickyHeader<T> | DrilldownStickyFooter<T> | DrilldownEmptyList | DrilldownLoading;
|
|
1961
|
+
|
|
1962
|
+
/**
|
|
1963
|
+
* @public
|
|
1964
|
+
*/
|
|
1965
|
+
export declare type DrilldownItemType<T = unknown> = DrilldownItemTreeType<T> | DrilldownItemFlatType<T>;
|
|
1966
|
+
|
|
1967
|
+
/**
|
|
1968
|
+
* @public
|
|
1969
|
+
* Pass in a component to render if the list is loading.
|
|
1970
|
+
* This will usually be a <Spinner />, see storybook examples
|
|
1971
|
+
*/
|
|
1972
|
+
declare interface DrilldownLoading {
|
|
1973
|
+
type: "loading";
|
|
1974
|
+
component?: ReactNode;
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
/**
|
|
1978
|
+
* @public
|
|
1979
|
+
*/
|
|
1980
|
+
declare interface DrilldownLoadingFlat extends DrilldownLoading {
|
|
1981
|
+
/** Unique identifier for the parent option */
|
|
1982
|
+
parentKey: string | undefined;
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
export declare type DrilldownProps<T, TargetRef extends HTMLElement> = DrilldownTreeProps<T, TargetRef> | DrilldownFlatProps<T, TargetRef>;
|
|
1986
|
+
|
|
1987
|
+
/**
|
|
1988
|
+
* @public
|
|
1989
|
+
*/
|
|
1990
|
+
export declare function drilldownRenderOptions<T = string>(options: DrilldownItemType<T>[], handleSelectOption: (value: DrilldownValueType<T>) => void, handleDrilldown: (item: DrilldownValueType<T>) => Promise<void>, handleBack: () => Promise<void>, activeItem: DrilldownValueType<T> | null, fetchMoreText: ReactNode, autoscrollText: ReactNode, selectedIcon: AnyIcon, externalLinkIcon: AnyIcon, hideIcons?: boolean, iconColumnWidth?: number): (value: DrilldownItemType<T>, index: number, array: DrilldownItemType<T>[]) => ReactNode;
|
|
1991
|
+
|
|
1992
|
+
/**
|
|
1993
|
+
* @public
|
|
1994
|
+
*/
|
|
1995
|
+
export declare const DrilldownResetButton: ({ onClick, buttonText, undoIcon, }: DrilldownResetButtonProps) => JSX.Element;
|
|
1996
|
+
|
|
1997
|
+
declare interface DrilldownResetButtonProps {
|
|
1998
|
+
onClick: () => void;
|
|
1999
|
+
buttonText: string;
|
|
2000
|
+
undoIcon: AnyIcon;
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
/**
|
|
2004
|
+
* @public
|
|
2005
|
+
* List of options to render as sticky options at the foot of any of the normal options
|
|
2006
|
+
*/
|
|
2007
|
+
declare interface DrilldownStickyFooter<T> {
|
|
2008
|
+
type: "stickyFooter";
|
|
2009
|
+
options: DrilldownItemType<T>[];
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
/**
|
|
2013
|
+
* @public
|
|
2014
|
+
* List of options to render as sticky options at the foot of any of the normal options
|
|
2015
|
+
*/
|
|
2016
|
+
declare interface DrilldownStickyFooterFlat<T> {
|
|
2017
|
+
type: "stickyFooter";
|
|
2018
|
+
options: DrilldownItemFlatType<T>[];
|
|
2019
|
+
/** Unique identifier for the parent option */
|
|
2020
|
+
parentKey: string | undefined;
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
/**
|
|
2024
|
+
* @public
|
|
2025
|
+
* List of options to render as sticky options at the head of any of the normal options
|
|
2026
|
+
*/
|
|
2027
|
+
declare interface DrilldownStickyHeader<T> {
|
|
2028
|
+
type: "stickyHeader";
|
|
2029
|
+
options: DrilldownItemType<T>[];
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
/**
|
|
2033
|
+
* @public
|
|
2034
|
+
* List of options to render as sticky options at the head of any of the normal options
|
|
2035
|
+
*/
|
|
2036
|
+
declare interface DrilldownStickyHeaderFlat<T> {
|
|
2037
|
+
type: "stickyHeader";
|
|
2038
|
+
options: DrilldownItemFlatType<T>[];
|
|
2039
|
+
/** Unique identifier for the parent option */
|
|
2040
|
+
parentKey: string | undefined;
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
/**
|
|
2044
|
+
* @public
|
|
2045
|
+
*/
|
|
2046
|
+
export declare interface DrilldownTabProps {
|
|
2047
|
+
tabs: TabBarItemType[];
|
|
2048
|
+
activeTabIndex: number;
|
|
2049
|
+
onTabChange: (index: number) => void;
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
/**
|
|
2053
|
+
* @public
|
|
2054
|
+
*/
|
|
2055
|
+
export declare interface DrilldownTargetProps<TargetRef extends HTMLElement> {
|
|
2056
|
+
targetProps: HTMLAttributes<HTMLElement>;
|
|
2057
|
+
targetRef: Ref<TargetRef>;
|
|
2058
|
+
inputProps: InputHTMLAttributes<HTMLInputElement>;
|
|
2059
|
+
inputRef: Ref<HTMLInputElement>;
|
|
2060
|
+
handleOnClear?: () => void;
|
|
2061
|
+
active: boolean;
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
/**
|
|
2065
|
+
* @public
|
|
2066
|
+
*/
|
|
2067
|
+
declare interface DrilldownTreeProps<T, TargetRef extends HTMLElement> extends DrilldownBaseProps<T, TargetRef> {
|
|
2068
|
+
/** Expects options to be a flat array of type DrilldownItemTreeType<T>[] */
|
|
2069
|
+
type: "tree";
|
|
2070
|
+
/** List of options to render */
|
|
2071
|
+
options: DrilldownItemTreeType<T>[];
|
|
2072
|
+
/** Event handler for when the "active" item changes via keyboard events */
|
|
2073
|
+
onActiveOptionChange?: (item: DrilldownValueTreeType<T> | null) => void;
|
|
2074
|
+
/** Event handler for when the "clear" event is triggered for the search input */
|
|
2075
|
+
onClear?: () => void;
|
|
2076
|
+
/** Event handler for when an option is selected */
|
|
2077
|
+
/** Event handler for when the search input value changes */
|
|
2078
|
+
onInputChange?: (input: string, pathToSelectedItem: PathToSelectedItem) => void;
|
|
2079
|
+
/** Callback for filtering items. This is used on drillup to re-filter the parent list based on the input string */
|
|
2080
|
+
filterItemsCb?: (items: DrilldownItemTreeType<T>[], input: string) => DrilldownItemTreeType<T>[];
|
|
2081
|
+
/** Event handler that it called when triggering a drilldown, after animation was run */
|
|
2082
|
+
onDrilldownAnimationEnd?: (item: DrilldownValueTreeType<T> | undefined, pathToSelectedItem: PathToSelectedItem) => Promise<void>;
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
/**
|
|
2086
|
+
* @public
|
|
2087
|
+
*/
|
|
2088
|
+
export declare const DrilldownTrigger: StyledComponent<"div", DefaultTheme, {}, never>;
|
|
2089
|
+
|
|
2090
|
+
declare interface DrilldownValueBaseType<OriginalValue> {
|
|
2091
|
+
/** Unique identifier for the option */
|
|
2092
|
+
key: string;
|
|
2093
|
+
/** Text label for the option*/
|
|
2094
|
+
label: React_2.ReactNode;
|
|
2095
|
+
/** Discriminated union literal */
|
|
2096
|
+
type: "value";
|
|
2097
|
+
/** Show option as disabled*/
|
|
2098
|
+
disabled?: boolean;
|
|
2099
|
+
/** Description to render */
|
|
2100
|
+
description?: string;
|
|
2101
|
+
/** Icon to render */
|
|
2102
|
+
icon?: AnyIcon | IconProps | JSX.Element | null;
|
|
2103
|
+
/** Show option as selected */
|
|
2104
|
+
selected?: boolean;
|
|
2105
|
+
/** Link to render - changes behavior to open link in new browser tab */
|
|
2106
|
+
href?: string;
|
|
2107
|
+
onClickIcon?: (value: unknown) => void;
|
|
2108
|
+
/** Callback fired on clicking the sub menu arrow icon **/
|
|
2109
|
+
onClickSubItem?: (value: unknown) => void;
|
|
2110
|
+
/** The underlying data related to the option, for the convenience of the user */
|
|
2111
|
+
value: OriginalValue;
|
|
2112
|
+
/** The default behaviour will only open submenu on clicking th right arrow icon, this will make the whole item
|
|
2113
|
+
* clickable, overriding the onSelect behaviour
|
|
2114
|
+
*/
|
|
2115
|
+
openSubmenuOnSelect?: boolean;
|
|
2116
|
+
/** Callback fired to handle fetch more scrolling for sub items */
|
|
2117
|
+
onFetchMoreSubItems?: () => void;
|
|
2118
|
+
/** Whether to show icon when a href is provided default is true */
|
|
2119
|
+
showHrefIcon?: boolean;
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
/**
|
|
2123
|
+
* @public
|
|
2124
|
+
*/
|
|
2125
|
+
declare interface DrilldownValueFlatType<OriginalValue> extends DrilldownValueBaseType<OriginalValue> {
|
|
2126
|
+
/** Unique identifier for the parent option */
|
|
2127
|
+
parentKey: string | undefined;
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
/**
|
|
2131
|
+
* @public
|
|
2132
|
+
*/
|
|
2133
|
+
declare interface DrilldownValueTreeType<OriginalValue> extends DrilldownValueBaseType<OriginalValue> {
|
|
2134
|
+
/** Sub options to render */
|
|
2135
|
+
subItems?: DrilldownItemTreeType<OriginalValue>[];
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
/**
|
|
2139
|
+
* @public
|
|
2140
|
+
*/
|
|
2141
|
+
export declare type DrilldownValueType<OriginalValue> = DrilldownValueTreeType<OriginalValue> | DrilldownValueFlatType<OriginalValue>;
|
|
2142
|
+
|
|
1699
2143
|
/**
|
|
1700
2144
|
* Wraps around any child to upgrade it to a dropdown component. If used in the
|
|
1701
2145
|
* render props style you get access to some of the internal state of the dropdown
|
|
@@ -1723,7 +2167,7 @@ declare type DpCustomIconsId = "active-call" | "admin" | "advanced-filter" | "ag
|
|
|
1723
2167
|
* </Dropdown>
|
|
1724
2168
|
* ```
|
|
1725
2169
|
*/
|
|
1726
|
-
export declare function Dropdown<T, TargetRef extends HTMLElement = any>({ children, options, stickyHeaderOptions, stickyFooterOptions, inputValue, searchPlaceholder, placement, showInternalSearch, isLoading, usePortal, closeOnSelect, isOpen: isOpenProp, renderCreateNewOption, hideIcons, iconColumnWidth, containerWidth, containerHeight, onSelectOption, onInputChange, onFetchMore, onClear, onClose, onOpen, optionsRenderer, onInputReturn, tabProps, disabled, fetchMoreText, autoscrollText, externalLinkIcon, selectedIcon, layer, containerMaxHeight, }: DropdownProps<T, TargetRef>): JSX.Element;
|
|
2170
|
+
export declare function Dropdown<T, TargetRef extends HTMLElement = any>({ children, options, stickyHeaderOptions, stickyFooterOptions, inputValue, searchPlaceholder, placement, showInternalSearch, isLoading, usePortal, closeOnSelect, isOpen: isOpenProp, renderCreateNewOption, onCreateNewOption, hideIcons, iconColumnWidth, containerWidth, containerHeight, onSelectOption, onInputChange, onFetchMore, onClear, onClose, onOpen, optionsRenderer, onInputReturn, tabProps, disabled, fetchMoreText, autoscrollText, externalLinkIcon, selectedIcon, layer, containerMaxHeight, }: DropdownProps<T, TargetRef>): JSX.Element;
|
|
1727
2171
|
|
|
1728
2172
|
/**
|
|
1729
2173
|
* @public
|
|
@@ -1896,7 +2340,8 @@ export declare interface DropdownProps<T, TargetRef extends HTMLElement> {
|
|
|
1896
2340
|
/** Render the create new option - no default implementation and renders as a
|
|
1897
2341
|
* sticky footer above the normal sticky footer
|
|
1898
2342
|
*/
|
|
1899
|
-
|
|
2343
|
+
onCreateNewOption?: () => void;
|
|
2344
|
+
renderCreateNewOption?: (active: boolean, onSelect: () => void) => ReactNode;
|
|
1900
2345
|
/** Override the rendering of the contents of the dropdown container */
|
|
1901
2346
|
optionsRenderer?: (options: DropdownItemType<T>[], handleSelectOption: (value: DropdownValueType<T>) => void, activeItem: DropdownValueType<T> | null, activeSubItem: string | null, setActiveSubItem: React_2.Dispatch<React_2.SetStateAction<string | null>>, hideIcons: boolean | undefined) => ReactNode;
|
|
1902
2347
|
/** Props for rendering tabs within the dropdown */
|
|
@@ -2013,6 +2458,21 @@ export declare interface FaIconAvatarProps {
|
|
|
2013
2458
|
iconStyles?: CSSProperties;
|
|
2014
2459
|
}
|
|
2015
2460
|
|
|
2461
|
+
/**
|
|
2462
|
+
* A helper function to make it easier to filter the items at the current depth
|
|
2463
|
+
* e.g. on search input change (@see WithSearch story)
|
|
2464
|
+
*
|
|
2465
|
+
* Returns the full items array with only the deepest sub items of the path updated */
|
|
2466
|
+
export declare function filterCurrentTreeItems<T>(items: DrilldownItemTreeType<T>[], pathToSelectedItem: {
|
|
2467
|
+
key: string;
|
|
2468
|
+
searchTerm?: string;
|
|
2469
|
+
}[], input: string, filterItemsCb: FilterItemsTreeCb<T>, depth?: number): DrilldownItemTreeType<T>[];
|
|
2470
|
+
|
|
2471
|
+
/**
|
|
2472
|
+
* @public
|
|
2473
|
+
*/
|
|
2474
|
+
export declare type FilterItemsTreeCb<T> = (items: DrilldownItemTreeType<T>[], input: string) => DrilldownItemTreeType<T>[];
|
|
2475
|
+
|
|
2016
2476
|
/**
|
|
2017
2477
|
* Wrapper around Formik's useField hook and ErrorMessage component
|
|
2018
2478
|
* @public
|
|
@@ -3668,6 +4128,11 @@ export declare const paragraphStyled: {
|
|
|
3668
4128
|
p16: FlattenInterpolation<ThemeProps<DefaultTheme>>;
|
|
3669
4129
|
};
|
|
3670
4130
|
|
|
4131
|
+
declare type PathToSelectedItem = {
|
|
4132
|
+
key: string;
|
|
4133
|
+
searchTerm?: string;
|
|
4134
|
+
}[];
|
|
4135
|
+
|
|
3671
4136
|
/**
|
|
3672
4137
|
* @public
|
|
3673
4138
|
*/
|