@loadsmart/loadsmart-ui 5.0.1 → 5.2.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/components/Button/Button.d.ts +1 -0
- package/dist/components/Calendar/Pickers/PickerButton.d.ts +1 -1
- package/dist/components/Dropdown/Dropdown.stories.d.ts +6 -7
- package/dist/components/Dropdown/Dropdown.types.d.ts +2 -2
- package/dist/components/Dropdown/DropdownTrigger.d.ts +1 -1
- package/dist/components/Dropdown/useDropdown.d.ts +1 -5
- package/dist/components/Icon/Icon.d.ts +1 -0
- package/dist/components/Select/Select.types.d.ts +4 -4
- package/dist/components/Table/Table.d.ts +7 -1
- package/dist/components/Table/Table.fixtures.d.ts +1 -0
- package/dist/components/Table/Table.stories.d.ts +20 -4
- package/dist/components/Table/Table.types.d.ts +30 -1
- package/dist/components/Table/useSortBy.d.ts +2 -2
- package/dist/components/Table/useSortBy.types.d.ts +5 -6
- package/dist/hooks/useClickOutside/useClickOutside.d.ts +1 -1
- package/dist/index.js +448 -440
- package/dist/index.js.map +1 -1
- package/dist/loadsmart.theme-63c13988.js +2 -0
- package/dist/{loadsmart.theme-37a60d56.js.map → loadsmart.theme-63c13988.js.map} +1 -1
- package/dist/{prop-06c02f6d.js → prop-0c635ee9.js} +2 -2
- package/dist/{prop-06c02f6d.js.map → prop-0c635ee9.js.map} +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/theming/index.js +1 -1
- package/dist/tools/index.js +1 -1
- package/package.json +1 -1
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/Calendar/Pickers/DayPicker.tsx +9 -1
- package/src/components/Calendar/Pickers/PickerButton.tsx +14 -6
- package/src/components/Dropdown/Dropdown.stories.tsx +26 -75
- package/src/components/Dropdown/Dropdown.tsx +11 -8
- package/src/components/Dropdown/Dropdown.types.ts +2 -2
- package/src/components/Dropdown/DropdownTrigger.tsx +1 -1
- package/src/components/Dropdown/useDropdown.ts +1 -6
- package/src/components/Icon/Icon.tsx +2 -0
- package/src/components/Icon/assets/dots-horizontal.svg +1 -0
- package/src/components/Select/Select.test.tsx +23 -1
- package/src/components/Select/Select.types.ts +4 -4
- package/src/components/Select/useSelect.ts +11 -9
- package/src/components/Table/Table.fixtures.ts +26 -16
- package/src/components/Table/Table.stories.tsx +156 -25
- package/src/components/Table/Table.test.tsx +29 -0
- package/src/components/Table/Table.tsx +85 -1
- package/src/components/Table/Table.types.ts +39 -1
- package/src/components/Table/useSortBy.ts +5 -5
- package/src/components/Table/useSortBy.types.ts +5 -5
- package/src/hooks/useClickOutside/useClickOutside.ts +6 -6
- package/src/testing/SelectEvent/SelectEvent.ts +8 -7
- package/dist/loadsmart.theme-37a60d56.js +0 -2
|
@@ -10,6 +10,7 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
10
10
|
variant?: 'primary' | 'secondary' | 'warning' | 'icon' | 'tertiary';
|
|
11
11
|
scale?: 'small' | 'default' | 'large';
|
|
12
12
|
}
|
|
13
|
+
export declare const Children: import("styled-components").StyledComponent<"span", any, ButtonProps, never>;
|
|
13
14
|
export declare const BaseButton: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
14
15
|
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
15
16
|
export declare function Caret(props: Omit<IconProps, 'name'>): JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare const _default: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../Button").ButtonProps & import("react").RefAttributes<HTMLButtonElement>>, any, {
|
|
3
|
-
$status: "default" | "current-day" | "faded" | "selection-start" | "selection-end" | "selection";
|
|
3
|
+
$status: "default" | "current-day" | "faded" | "selection-start" | "selection-end" | "selection" | "next-month-day";
|
|
4
4
|
}, never>;
|
|
5
5
|
export default _default;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Story, Meta } from '@storybook/react/types-6-0';
|
|
2
|
-
import type { DropdownProps } from './Dropdown.types';
|
|
2
|
+
import type { DropdownProps, DropdownMenuProps, DropdownTriggerProps } from './Dropdown.types';
|
|
3
3
|
declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
|
|
4
4
|
export default _default;
|
|
5
|
-
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const WithSections: Story<
|
|
8
|
-
export declare const Extended: Story<
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const CustomTrigger: Story<DropdownProps>;
|
|
5
|
+
declare type DropdownStoryProps = DropdownProps & DropdownMenuProps & DropdownTriggerProps;
|
|
6
|
+
export declare const Playground: Story<DropdownStoryProps>;
|
|
7
|
+
export declare const WithSections: Story<DropdownStoryProps>;
|
|
8
|
+
export declare const Extended: Story<DropdownStoryProps>;
|
|
9
|
+
export declare const CustomTrigger: Story<DropdownStoryProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
|
|
2
1
|
import type { ButtonProps } from "../Button";
|
|
2
|
+
import type { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
export interface useDropdownProps {
|
|
4
4
|
expanded: boolean;
|
|
5
5
|
toggle: () => void;
|
|
@@ -12,7 +12,7 @@ export interface useDropdownReturn {
|
|
|
12
12
|
}
|
|
13
13
|
export interface DropdownProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'onBlur'> {
|
|
14
14
|
disabled?: boolean;
|
|
15
|
-
onBlur?: () => void;
|
|
15
|
+
onBlur?: (event?: MouseEvent | TouchEvent | KeyboardEvent) => void;
|
|
16
16
|
}
|
|
17
17
|
export interface GenericDropdownProps extends DropdownProps, useDropdownProps {
|
|
18
18
|
}
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import type { ButtonHTMLAttributes, HTMLAttributes } from 'react';
|
|
3
3
|
import type { DropdownTriggerProps, DropdownContextReturn } from './Dropdown.types';
|
|
4
4
|
import type ColorScheme from "../../utils/types/ColorScheme";
|
|
5
|
-
interface DropdownTriggerButtonProps extends DropdownTriggerProps {
|
|
5
|
+
export interface DropdownTriggerButtonProps extends DropdownTriggerProps {
|
|
6
6
|
children: DropdownTriggerProps['children'] | ((args: DropdownContextReturn) => React.ReactNode);
|
|
7
7
|
}
|
|
8
8
|
declare function DropdownTriggerButton(props: DropdownTriggerButtonProps): JSX.Element;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export interface DropdownProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'onBlur'> {
|
|
3
|
-
disabled?: boolean;
|
|
4
|
-
onBlur?: () => void;
|
|
5
|
-
}
|
|
1
|
+
import type { DropdownProps } from './Dropdown.types';
|
|
6
2
|
export interface useDropdownProps {
|
|
7
3
|
expanded: boolean;
|
|
8
4
|
toggle: () => void;
|
|
@@ -20,6 +20,7 @@ declare const icons: {
|
|
|
20
20
|
'sort-desc': JSX.Element;
|
|
21
21
|
upload: JSX.Element;
|
|
22
22
|
warning: JSX.Element;
|
|
23
|
+
'dots-horizontal': JSX.Element;
|
|
23
24
|
};
|
|
24
25
|
declare const Icon: (props: GenericIconProps<import("../IconFactory").IconMapping>) => JSX.Element;
|
|
25
26
|
export declare type IconProps = GenericIconProps<typeof icons>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import EventLike from "../../utils/types/EventLike";
|
|
2
|
-
import type {
|
|
3
|
-
import type { DropdownProps, DropdownMenuItemProps } from "../Dropdown";
|
|
2
|
+
import type { DropdownMenuItemProps, DropdownProps } from "../Dropdown";
|
|
4
3
|
import type { TextFieldProps } from "../TextField";
|
|
5
|
-
import type {
|
|
4
|
+
import type { Selectable, SelectableAdapter, SelectableKeyType, SelectableState } from "../../hooks/useSelectable";
|
|
6
5
|
import { useSelectableReturn } from "../../hooks/useSelectable/useSelectable.types";
|
|
6
|
+
import type { ChangeEvent, ComponentType, FocusEvent, HTMLAttributes } from 'react';
|
|
7
7
|
export declare type Option = Selectable;
|
|
8
8
|
export interface GenericOption {
|
|
9
9
|
label: string;
|
|
@@ -98,7 +98,7 @@ export declare type useSelectReturn = {
|
|
|
98
98
|
getDropdownProps: () => {
|
|
99
99
|
toggle: () => void;
|
|
100
100
|
expanded: boolean;
|
|
101
|
-
onBlur: () => void;
|
|
101
|
+
onBlur: (event?: MouseEvent | TouchEvent | KeyboardEvent) => void;
|
|
102
102
|
};
|
|
103
103
|
getCreatebleProps: () => CreatableProps;
|
|
104
104
|
isCreatable: () => boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { useSelection } from './Selection';
|
|
3
3
|
import TableSortHandle from './TableSortHandle';
|
|
4
|
-
import type { TableProps, TableSectionProps, TableRowProps, TableCellProps, TableCaptionProps, TableSelectionProps, SelectionCellProps } from './Table.types';
|
|
4
|
+
import type { TableProps, TableSectionProps, TableRowProps, TableCellProps, TableCaptionProps, TableSelectionProps, SelectionCellProps, TablePickerItemProps, TablePickerProps } from './Table.types';
|
|
5
5
|
declare function Table<T>({ children, selection, scale, ...others }: TableProps<T>): JSX.Element;
|
|
6
6
|
declare namespace Table {
|
|
7
7
|
var Head: typeof TableHead;
|
|
@@ -17,6 +17,7 @@ declare namespace Table {
|
|
|
17
17
|
HeadCell: typeof SelectionHeadCell;
|
|
18
18
|
};
|
|
19
19
|
var SortHandle: typeof TableSortHandle;
|
|
20
|
+
var Picker: typeof TablePicker;
|
|
20
21
|
}
|
|
21
22
|
declare function TableCaption({ children, position, height }: TableCaptionProps): JSX.Element;
|
|
22
23
|
declare function TableHead({ children, ...others }: TableSectionProps): JSX.Element;
|
|
@@ -27,5 +28,10 @@ declare function SelectionHeadCell<T>(props: SelectionCellProps<T>): JSX.Element
|
|
|
27
28
|
declare function TableRow({ children, ...others }: TableRowProps): JSX.Element;
|
|
28
29
|
declare function TableHeadCell({ alignment, children, onClick, ...others }: TableCellProps): JSX.Element;
|
|
29
30
|
declare function TableSelectionActions({ buttons, children, ...others }: TableSelectionProps): JSX.Element;
|
|
31
|
+
declare function TablePickerItem<T>({ option, checked, children, ...props }: TablePickerItemProps<T>): JSX.Element;
|
|
32
|
+
declare function TablePicker<T>({ value, onChange, options, align, children, trigger: propsTrigger, ...props }: TablePickerProps<T>): JSX.Element;
|
|
33
|
+
declare namespace TablePicker {
|
|
34
|
+
var Item: typeof TablePickerItem;
|
|
35
|
+
}
|
|
30
36
|
export { useSelection };
|
|
31
37
|
export default Table;
|
|
@@ -15,8 +15,24 @@ export declare namespace WithSorting {
|
|
|
15
15
|
scale: string;
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
export declare function
|
|
19
|
-
export declare namespace
|
|
18
|
+
export declare function WithColumnPicker(args: TableProps): JSX.Element;
|
|
19
|
+
export declare namespace WithColumnPicker {
|
|
20
|
+
var args: {
|
|
21
|
+
scale: string;
|
|
22
|
+
};
|
|
23
|
+
var parameters: {
|
|
24
|
+
docs: {
|
|
25
|
+
description: {
|
|
26
|
+
story: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
source: {
|
|
30
|
+
type: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export declare function WithRowSelection(args: TableProps): JSX.Element;
|
|
35
|
+
export declare namespace WithRowSelection {
|
|
20
36
|
var parameters: {
|
|
21
37
|
docs: {
|
|
22
38
|
description: {
|
|
@@ -28,8 +44,8 @@ export declare namespace Selection {
|
|
|
28
44
|
scale: string;
|
|
29
45
|
};
|
|
30
46
|
}
|
|
31
|
-
export declare function
|
|
32
|
-
export declare namespace
|
|
47
|
+
export declare function WithCustomRowSelection(): JSX.Element;
|
|
48
|
+
export declare namespace WithCustomRowSelection {
|
|
33
49
|
var parameters: {
|
|
34
50
|
docs: {
|
|
35
51
|
description: {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Selectable } from "../../hooks/useSelectable";
|
|
2
|
-
import type { ComponentType, HTMLAttributes } from 'react';
|
|
2
|
+
import type { ComponentType, HTMLAttributes, PropsWithChildren, ReactNode } from 'react';
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import type { DropdownMenuItemProps, DropdownMenuProps } from "../Dropdown";
|
|
5
|
+
import type { DropdownTriggerButtonProps } from "../Dropdown/DropdownTrigger";
|
|
4
6
|
import type { TableSelectableRow, TableSelectionConfig } from './Selection';
|
|
5
7
|
declare type Scale = 'default' | 'small' | 'large';
|
|
6
8
|
export interface TableProps<T extends Selectable = TableSelectableRow> extends HTMLAttributes<HTMLTableElement> {
|
|
@@ -34,4 +36,31 @@ export interface TableCellProps extends HTMLAttributes<HTMLTableCellElement> {
|
|
|
34
36
|
scale?: Scale;
|
|
35
37
|
selected?: boolean;
|
|
36
38
|
}
|
|
39
|
+
export declare type TableColumn<T = Record<string, unknown>> = {
|
|
40
|
+
/**
|
|
41
|
+
* The accessor of you entry interface
|
|
42
|
+
*/
|
|
43
|
+
key: keyof T;
|
|
44
|
+
/**
|
|
45
|
+
* The label that should go in the Header cell
|
|
46
|
+
*/
|
|
47
|
+
title: ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* The text of the Dropdown.Item
|
|
50
|
+
* If omitted, `title` is used
|
|
51
|
+
*/
|
|
52
|
+
option?: string;
|
|
53
|
+
};
|
|
54
|
+
export declare type TableColumns<T> = Array<TableColumn<T>>;
|
|
55
|
+
export interface TablePickerItemProps<T> extends DropdownMenuItemProps {
|
|
56
|
+
option?: TableColumn<T>;
|
|
57
|
+
checked?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface TablePickerProps<T> extends PropsWithChildren<Partial<Omit<DropdownTriggerButtonProps, 'onChange' | 'value' | 'children'>>> {
|
|
60
|
+
value?: TableColumn<T>;
|
|
61
|
+
onChange?: (value: TableColumn<T>) => void;
|
|
62
|
+
options?: TableColumns<T>;
|
|
63
|
+
trigger?: ReactNode | ((expanded: boolean) => ReactNode);
|
|
64
|
+
align?: DropdownMenuProps['align'];
|
|
65
|
+
}
|
|
37
66
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TableRowGroup,
|
|
1
|
+
import type { TableRowGroup, SortableColumn, ColumnGroup } from './useSortBy.types';
|
|
2
2
|
/**
|
|
3
3
|
* A hook that receives columns and table rows to sort them when sortByColumn function is called.
|
|
4
4
|
* Exposes columnData, tableData and sortByColumn to be consumed by the Table component.
|
|
@@ -11,6 +11,6 @@ import type { TableRowGroup, Column, ColumnGroup } from './useSortBy.types';
|
|
|
11
11
|
declare function useSortBy(columnGroup: ColumnGroup, tableRowGroup: TableRowGroup): {
|
|
12
12
|
tableData: TableRowGroup;
|
|
13
13
|
columnData: ColumnGroup;
|
|
14
|
-
sortByColumn: (column:
|
|
14
|
+
sortByColumn: (column: SortableColumn) => void;
|
|
15
15
|
};
|
|
16
16
|
export default useSortBy;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
+
import type { TableColumn } from './Table.types';
|
|
1
2
|
export declare type TableRowGroup = Array<Record<string, string | number>>;
|
|
2
|
-
export
|
|
3
|
-
key: string;
|
|
4
|
-
title: string;
|
|
3
|
+
export interface SortableColumn extends TableColumn {
|
|
5
4
|
isSortable?: boolean;
|
|
6
5
|
order?: SortDirection | null;
|
|
7
|
-
}
|
|
8
|
-
export declare type ColumnGroup = Array<
|
|
6
|
+
}
|
|
7
|
+
export declare type ColumnGroup = Array<SortableColumn>;
|
|
9
8
|
export interface SortState {
|
|
10
|
-
sortConfig:
|
|
9
|
+
sortConfig: SortableColumn;
|
|
11
10
|
columnGroup: ColumnGroup;
|
|
12
11
|
tableRowGroup: TableRowGroup;
|
|
13
12
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
|
-
declare function useClickOutside<T extends HTMLElement>(container: RefObject<T>, callback: () => void, disabled?: boolean): void;
|
|
2
|
+
declare function useClickOutside<T extends HTMLElement>(container: RefObject<T>, callback: (event?: MouseEvent | TouchEvent | KeyboardEvent) => void, disabled?: boolean): void;
|
|
3
3
|
export default useClickOutside;
|