@skedulo/sked-ui 19.12.2 → 19.16.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/README.md CHANGED
@@ -54,6 +54,30 @@ and
54
54
 
55
55
  yarn build:declarations:watch
56
56
 
57
+ ### Merging to master & semantic-release
58
+
59
+ #### Concurrent merging
60
+
61
+ Do not in any circumstances merge branches to master while the build pipeline for the last commit is still running.
62
+
63
+ Doing so will cause the last commit to not be published while other assets relying on it will be.
64
+
65
+ #### Failed build pipelines on master
66
+
67
+ Semantic-release will create a new commit at some point in the build pipeline that updates the package version in the source.
68
+
69
+ If the build fails BEFORE this occurs, then feel free to rerun the build pipeline as it will cleanly re-attempt to release.
70
+
71
+ If the build fails AFTER a commit is created, then you will not be able to rerun the build pipeline. This is because the release
72
+
73
+ process relies on being at the tip of master to release to NPM and a previous pipeline has already added a commit changing the package version.
74
+
75
+ In this instance you will have to create another commit and merge it through a PR. If the build pipeline is still broken and needs to be debugged
76
+
77
+ then the only other option is asking an administrator to rebase master and drop the release commit allowing the release process to cleanly retry.
78
+
79
+ This is an unfortunate scenario that comes from using semantic-release as it does not do releases idempotently.
80
+
57
81
  ## Contributing
58
82
 
59
83
  PRs welcome. Please review the [CONTRIBUTING.md](./CONTRIBUTING.md) doc for what is required for any code contributions.
@@ -1,2 +1,2 @@
1
1
  import { ISelectItem, MultiSearchSelectBox } from './interfaces';
2
- export declare const MultiSearchSelect: <T extends ISelectItem<any>>({ initialSelectedItems, items, id, name, placeholder, autoFocus, className, onSelectedItemsChange, disabled, itemToString, ItemRenderer, MenuItemsRenderer, selectAll, onInputValueChange, onMenuToggle, ...rest }: MultiSearchSelectBox<T>) => JSX.Element;
2
+ export declare const MultiSearchSelect: <T extends ISelectItem<any>>({ initialSelectedItems, items, id, name, placeholder, autoFocus, className, onSelectedItemsChange, disabled, loading, itemToString, ItemRenderer, MenuItemsRenderer, selectAll, onInputValueChange, onMenuToggle, ...rest }: MultiSearchSelectBox<T>) => JSX.Element;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { ISelectItem } from './interfaces';
3
+ export interface IPlainAsyncMultiSearchSelectProps {
4
+ initialSelectedItems?: ISelectItem[];
5
+ fetchItems: (searchTerm: string) => Promise<ISelectItem[]>;
6
+ onSelectedItemsChange: (items: ISelectItem[]) => void;
7
+ }
8
+ export declare const PlainAsyncMultiSearchSelect: React.FC<IPlainAsyncMultiSearchSelectProps>;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { IMenuProps } from '../../menus/menu/Menu';
3
+ interface ISelectItem {
4
+ label: string;
5
+ value: string;
6
+ disabled?: boolean;
7
+ }
8
+ interface IPlainMultiSelectProps {
9
+ items: ISelectItem[];
10
+ initialSelectedItems?: ISelectItem[];
11
+ onSearchInputChange: (inputValue: string) => void;
12
+ onSelectedItemsChange: (items: ISelectItem[]) => void;
13
+ itemToString?: (item: ISelectItem) => string;
14
+ loading?: boolean;
15
+ }
16
+ export declare const PlainMultiSearchSelect: React.FC<IPlainMultiSelectProps>;
17
+ export interface IPlainMenuRendererProps extends IMenuProps {
18
+ items: ISelectItem[];
19
+ isItemSelected: (item: ISelectItem) => boolean;
20
+ handleItemSelection: (item: ISelectItem, isSelected: boolean) => void;
21
+ loading: boolean;
22
+ }
23
+ export declare const PlainMenuRenderer: React.ForwardRefExoticComponent<IPlainMenuRendererProps & React.RefAttributes<HTMLUListElement>>;
24
+ export {};
@@ -2,4 +2,4 @@ import { ISelectItem, SelectBox } from './interfaces';
2
2
  /**
3
3
  * A searchable select component. Just like it's native counterpart, only a valid listed option is allowed.
4
4
  */
5
- export declare const SearchSelect: <T extends ISelectItem<any>>({ id, name, items, placeholder, autoFocus, className, icon, onSelectedItemChange, disabled, itemToString, ItemRenderer, filterHandler, itemIsValid, getNewItemData, ...rest }: SelectBox<T>) => JSX.Element;
5
+ export declare const SearchSelect: <T extends ISelectItem<any>>({ id, name, items, placeholder, autoFocus, className, icon, onSelectedItemChange, disabled, onMenuToggle, loading, itemToString, ItemRenderer, filterHandler, itemIsValid, getNewItemData, ...rest }: SelectBox<T>) => JSX.Element;
@@ -80,7 +80,10 @@ interface ISelectBox<T extends ISelectItem> extends ISearchSelect<T> {
80
80
  */
81
81
  getNewItemData?: (inputValue: string) => T[];
82
82
  }
83
- export declare type SelectBox<T extends ISelectItem> = ISelectBox<T> & CommonComboBoxTypes<T> & Pick<UseComboboxProps<T>, 'initialSelectedItem' | 'selectedItem'>;
83
+ export declare type SelectBox<T extends ISelectItem> = ISelectBox<T> & CommonComboBoxTypes<T> & Pick<UseComboboxProps<T>, 'initialSelectedItem' | 'selectedItem'> & {
84
+ onMenuToggle?: (isOpen: boolean) => void;
85
+ loading?: boolean;
86
+ };
84
87
  export declare type AsyncSelectBox<T extends ISelectItem> = Omit<SelectBox<T>, 'items' | 'itemIsValid' | 'getNewItemData'> & IAsyncSearchSelect<T>;
85
88
  export interface IMultiSearchSelect<T extends ISelectItem> extends ISearchSelect<T> {
86
89
  selectAll?: 'enabled' | 'disabled';
@@ -93,6 +96,8 @@ export interface IMultiSearchSelect<T extends ISelectItem> extends ISearchSelect
93
96
  onInputValueChange?: UseComboboxProps<T>['onInputValueChange'];
94
97
  onSelectedItemsChange: (items: T[]) => void;
95
98
  }
96
- export declare type MultiSearchSelectBox<T extends ISelectItem> = IMultiSearchSelect<T> & CommonComboBoxTypes<T> & Pick<UseMultipleSelectionProps<T>, 'initialSelectedItems' | 'selectedItems'>;
99
+ export declare type MultiSearchSelectBox<T extends ISelectItem> = IMultiSearchSelect<T> & CommonComboBoxTypes<T> & Pick<UseMultipleSelectionProps<T>, 'initialSelectedItems' | 'selectedItems'> & {
100
+ loading?: boolean;
101
+ };
97
102
  export declare type AsyncMultiSearchSelectBox<T extends ISelectItem> = Omit<MultiSearchSelectBox<T>, 'items'> & IAsyncSearchSelect<T>;
98
103
  export {};
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { UseComboboxGetItemPropsOptions } from 'downshift';
3
- import { IconNames } from '../../..';
3
+ import { IconNames, IPillProps, IMenuProps } from '../../..';
4
4
  import { ISelectItem, ISearchSelect } from './interfaces';
5
5
  export interface ISelectMenuItem<T extends ISelectItem> {
6
6
  item: T;
@@ -17,22 +17,22 @@ interface ISearchSelectTrigger {
17
17
  icon?: IconNames;
18
18
  }
19
19
  export declare const SearchSelectTrigger: React.FC<ISearchSelectTrigger & React.InputHTMLAttributes<HTMLInputElement>>;
20
- export declare const SelectMenu: React.ForwardRefExoticComponent<React.RefAttributes<HTMLUListElement>>;
20
+ export declare const SelectMenu: React.ForwardRefExoticComponent<IMenuProps & React.RefAttributes<HTMLUListElement>>;
21
21
  export declare const SelectMenuItem: <T extends ISelectItem<any>>({ item, ItemRenderer, index, highlightedIndex, getItemProps }: ISelectMenuItem<T>) => JSX.Element;
22
+ export interface IPlainMultiSelectMenuItemProps extends React.HTMLAttributes<HTMLLIElement> {
23
+ item: ISelectItem;
24
+ isSelected: boolean;
25
+ }
26
+ export declare const PlainMultiSelectMenuItem: React.FC<IPlainMultiSelectMenuItemProps>;
22
27
  export declare const MultiSelectMenuItem: <T extends ISelectItem<any>>({ item, ItemRenderer, isSelected, index, highlightedIndex, getItemProps }: ISelectMenuItem<T> & {
23
28
  isSelected: boolean;
24
29
  }) => JSX.Element;
25
30
  export declare const SelectEmptyState: React.FC;
26
- interface IMultiSearchSelectTrigger {
27
- wrapperRef: React.RefObject<HTMLDivElement>;
31
+ interface IMultiSearchSelectTriggerProps extends React.HTMLAttributes<HTMLDivElement> {
28
32
  hasItems: boolean;
29
33
  disabled: boolean;
30
34
  className: string;
31
35
  }
32
- export declare const MultiSearchSelectTrigger: React.FC<IMultiSearchSelectTrigger>;
33
- interface IMultiSelectPill {
34
- text: string;
35
- onClose: () => void;
36
- }
37
- export declare const MultiSelectPill: React.ForwardRefExoticComponent<IMultiSelectPill & React.RefAttributes<HTMLDivElement>>;
36
+ export declare const MultiSearchSelectTrigger: React.ForwardRefExoticComponent<IMultiSearchSelectTriggerProps & React.RefAttributes<HTMLDivElement>>;
37
+ export declare const MultiSelectPill: React.ForwardRefExoticComponent<IPillProps & React.RefAttributes<HTMLDivElement>>;
38
38
  export {};
@@ -25,4 +25,14 @@ export declare const useAutoExpandingInput: ({ defaultInputWidth, inputProps, cl
25
25
  setInputValueWidth: React.Dispatch<React.SetStateAction<number>>;
26
26
  AutoExpandingInput: JSX.Element;
27
27
  };
28
+ export declare function useOnClickOutside(refs: React.RefObject<HTMLElement>[], handler: (event: MouseEvent) => void): void;
29
+ export interface UseRunPromiseState<D> {
30
+ data: D | undefined;
31
+ error: Error | undefined;
32
+ pending: boolean;
33
+ }
34
+ export interface UseRunPromiseRes<D, A extends any[]> extends UseRunPromiseState<D> {
35
+ run: (...args: A) => void;
36
+ }
37
+ export declare function useRunPromise<D, A extends any[]>(func: (...args: A) => Promise<D>): UseRunPromiseRes<D, A>;
28
38
  export {};
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- export interface IMenuProps extends React.HTMLAttributes<HTMLElement> {
2
+ export interface IMenuProps extends React.HTMLAttributes<HTMLUListElement> {
3
3
  className?: string;
4
4
  }
5
5
  export interface IMenuItemProps extends React.HTMLAttributes<HTMLLIElement> {
@@ -14,7 +14,7 @@ export interface IPillProps {
14
14
  iconName?: IconNames;
15
15
  disabled?: boolean;
16
16
  className?: string;
17
- onClose?: () => void;
17
+ onClose?: (e: React.MouseEvent) => void;
18
18
  }
19
19
  /**
20
20
  * Creates a Pill. Text will be truncated at 190px and a Tooltip will be enabled
package/dist/index.d.ts CHANGED
@@ -24,11 +24,14 @@ export * from './components/filter-bar/filter-list/RemoteSearch';
24
24
  export * from './components/forms/elements/FormElements';
25
25
  export * from './components/forms/elements/NumberInput';
26
26
  export { formatReadonlySelect } from './components/forms/elements/select-utils';
27
+ export { useRunPromise, useOnClickOutside } from './components/forms/elements/select-hooks';
27
28
  export * from './components/forms/elements/interfaces';
28
29
  export * from './components/forms/elements/SearchSelect';
29
30
  export * from './components/forms/elements/AsyncSearchSelect';
30
31
  export * from './components/forms/elements/MultiSearchSelect';
31
32
  export * from './components/forms/elements/AsyncMultiSearchSelect';
33
+ export * from './components/forms/elements/PlainMultiSearchSelect';
34
+ export * from './components/forms/elements/PlainAsyncMultiSearchSelect';
32
35
  export * from './components/forms/ReadOnly';
33
36
  export * from './components/forms/SkedFormValidation';
34
37
  export * from './components/forms/elements/TextArea';