@loadsmart/loadsmart-ui 5.4.0 → 5.6.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.
Files changed (44) hide show
  1. package/dist/components/Dropdown/Dropdown.types.d.ts +2 -2
  2. package/dist/components/Dropdown/useDropdown.d.ts +5 -1
  3. package/dist/components/Select/Select.types.d.ts +4 -4
  4. package/dist/components/Table/Table.d.ts +9 -1
  5. package/dist/components/Table/Table.stories.d.ts +6 -0
  6. package/dist/components/Table/Table.types.d.ts +8 -0
  7. package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +1 -0
  8. package/dist/components/VisuallyHidden/VisuallyHidden.stories.d.ts +14 -0
  9. package/dist/components/VisuallyHidden/VisuallyHidden.test.d.ts +1 -0
  10. package/dist/components/VisuallyHidden/index.d.ts +1 -0
  11. package/dist/hooks/useClickOutside/useClickOutside.d.ts +1 -1
  12. package/dist/index.d.ts +1 -0
  13. package/dist/index.js +82 -71
  14. package/dist/index.js.map +1 -1
  15. package/dist/loadsmart.theme-37a60d56.js +2 -0
  16. package/dist/{loadsmart.theme-63c13988.js.map → loadsmart.theme-37a60d56.js.map} +1 -1
  17. package/dist/{prop-0c635ee9.js → prop-06c02f6d.js} +2 -2
  18. package/dist/{prop-0c635ee9.js.map → prop-06c02f6d.js.map} +1 -1
  19. package/dist/testing/index.js +1 -1
  20. package/dist/testing/index.js.map +1 -1
  21. package/dist/theming/index.js +1 -1
  22. package/dist/tools/index.js +1 -1
  23. package/package.json +3 -2
  24. package/src/components/DragDropFile/components/DropZone.test.tsx +8 -0
  25. package/src/components/DragDropFile/components/DropZone.tsx +11 -9
  26. package/src/components/Dropdown/Dropdown.tsx +8 -11
  27. package/src/components/Dropdown/Dropdown.types.ts +2 -2
  28. package/src/components/Dropdown/useDropdown.ts +6 -1
  29. package/src/components/Select/Select.test.tsx +3 -25
  30. package/src/components/Select/Select.types.ts +4 -4
  31. package/src/components/Select/useSelect.ts +9 -11
  32. package/src/components/Table/Table.stories.tsx +61 -0
  33. package/src/components/Table/Table.test.tsx +128 -0
  34. package/src/components/Table/Table.tsx +89 -12
  35. package/src/components/Table/Table.types.ts +9 -0
  36. package/src/components/VisuallyHidden/VisuallyHidden.mdx +26 -0
  37. package/src/components/VisuallyHidden/VisuallyHidden.stories.tsx +32 -0
  38. package/src/components/VisuallyHidden/VisuallyHidden.test.tsx +18 -0
  39. package/src/components/VisuallyHidden/VisuallyHidden.tsx +6 -0
  40. package/src/components/VisuallyHidden/index.ts +1 -0
  41. package/src/hooks/useClickOutside/useClickOutside.ts +6 -6
  42. package/src/index.ts +2 -0
  43. package/src/testing/SelectEvent/SelectEvent.ts +7 -8
  44. package/dist/loadsmart.theme-63c13988.js +0 -2
@@ -1,5 +1,5 @@
1
- import type { ButtonProps } from "../Button";
2
1
  import type { ButtonHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
2
+ import type { ButtonProps } from "../Button";
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?: (event?: MouseEvent | TouchEvent | KeyboardEvent) => void;
15
+ onBlur?: () => void;
16
16
  }
17
17
  export interface GenericDropdownProps extends DropdownProps, useDropdownProps {
18
18
  }
@@ -1,4 +1,8 @@
1
- import type { DropdownProps } from './Dropdown.types';
1
+ import type { HTMLAttributes } from 'react';
2
+ export interface DropdownProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'onBlur'> {
3
+ disabled?: boolean;
4
+ onBlur?: () => void;
5
+ }
2
6
  export interface useDropdownProps {
3
7
  expanded: boolean;
4
8
  toggle: () => void;
@@ -1,9 +1,9 @@
1
1
  import EventLike from "../../utils/types/EventLike";
2
- import type { DropdownMenuItemProps, DropdownProps } from "../Dropdown";
2
+ import type { ChangeEvent, FocusEvent, ComponentType, HTMLAttributes } from 'react';
3
+ import type { DropdownProps, DropdownMenuItemProps } from "../Dropdown";
3
4
  import type { TextFieldProps } from "../TextField";
4
- import type { Selectable, SelectableAdapter, SelectableKeyType, SelectableState } from "../../hooks/useSelectable";
5
+ import type { SelectableAdapter, Selectable, SelectableKeyType, SelectableState } from "../../hooks/useSelectable";
5
6
  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: (event?: MouseEvent | TouchEvent | KeyboardEvent) => void;
101
+ onBlur: () => 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, TablePickerItemProps, TablePickerProps } from './Table.types';
4
+ import type { TableProps, TableSectionProps, TableRowProps, TableCellProps, TableCaptionProps, TableSelectionProps, SelectionCellProps, TablePickerItemProps, TablePickerProps, ExpandableTableRowProps } 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;
@@ -16,6 +16,11 @@ declare namespace Table {
16
16
  Cell: typeof SelectionCell;
17
17
  HeadCell: typeof SelectionHeadCell;
18
18
  };
19
+ var Expandable: {
20
+ HeadCell: typeof ExpandableHeadCell;
21
+ Cell: typeof ExpandableCell;
22
+ Row: typeof ExpandableTableRow;
23
+ };
19
24
  var SortHandle: typeof TableSortHandle;
20
25
  var Picker: typeof TablePicker;
21
26
  }
@@ -25,7 +30,10 @@ declare function TableBody({ children, ...others }: TableSectionProps): JSX.Elem
25
30
  declare function TableCell({ children, alignment, format, ...others }: TableCellProps): JSX.Element;
26
31
  declare function SelectionCell<T>({ value, ...props }: SelectionCellProps<T>): JSX.Element;
27
32
  declare function SelectionHeadCell<T>(props: SelectionCellProps<T>): JSX.Element;
33
+ declare function ExpandableHeadCell(props: TableCellProps): JSX.Element;
34
+ declare function ExpandableCell(props: TableCellProps): JSX.Element;
28
35
  declare function TableRow({ children, ...others }: TableRowProps): JSX.Element;
36
+ declare function ExpandableTableRow({ index, expandableContent, expanded, leading: propsLeading, children, onExpandedChange, initialExpanded, ...others }: ExpandableTableRowProps): JSX.Element;
29
37
  declare function TableHeadCell({ alignment, children, onClick, ...others }: TableCellProps): JSX.Element;
30
38
  declare function TableSelectionActions({ buttons, children, ...others }: TableSelectionProps): JSX.Element;
31
39
  declare function TablePickerItem<T>({ option, checked, children, ...props }: TablePickerItemProps<T>): JSX.Element;
@@ -54,3 +54,9 @@ export declare namespace WithCustomRowSelection {
54
54
  };
55
55
  };
56
56
  }
57
+ export declare function WithExpandableRow(args: TableProps): JSX.Element;
58
+ export declare namespace WithExpandableRow {
59
+ var args: {
60
+ scale: string;
61
+ };
62
+ }
@@ -29,6 +29,14 @@ export interface TableSectionProps extends HTMLAttributes<HTMLTableSectionElemen
29
29
  scale?: Scale;
30
30
  }
31
31
  export declare type TableRowProps = HTMLAttributes<HTMLTableRowElement>;
32
+ export declare type ExpandableTableRowProps = TableRowProps & {
33
+ index: number;
34
+ expandableContent?: ReactNode;
35
+ leading?: ReactNode | ((expanded: boolean) => ReactNode);
36
+ initialExpanded?: boolean;
37
+ expanded?: boolean;
38
+ onExpandedChange?: (expanded: boolean) => void;
39
+ };
32
40
  export interface TableCellProps extends HTMLAttributes<HTMLTableCellElement> {
33
41
  alignment?: 'left' | 'right';
34
42
  format?: 'default' | 'number' | 'currency';
@@ -0,0 +1 @@
1
+ export declare const VisuallyHidden: import("styled-components").StyledComponent<"span", any, {}, never>;
@@ -0,0 +1,14 @@
1
+ /// <reference types="mdx" />
2
+ /// <reference types="react" />
3
+ import Docs from './VisuallyHidden.mdx';
4
+ declare const _default: {
5
+ title: string;
6
+ component: import("styled-components").StyledComponent<"span", any, {}, never>;
7
+ parameters: {
8
+ docs: {
9
+ page: typeof Docs;
10
+ };
11
+ };
12
+ };
13
+ export default _default;
14
+ export declare function Playground(): JSX.Element;
@@ -0,0 +1 @@
1
+ export { VisuallyHidden } from './VisuallyHidden';
@@ -1,3 +1,3 @@
1
1
  import type { RefObject } from 'react';
2
- declare function useClickOutside<T extends HTMLElement>(container: RefObject<T>, callback: (event?: MouseEvent | TouchEvent | KeyboardEvent) => void, disabled?: boolean): void;
2
+ declare function useClickOutside<T extends HTMLElement>(container: RefObject<T>, callback: () => void, disabled?: boolean): void;
3
3
  export default useClickOutside;
package/dist/index.d.ts CHANGED
@@ -94,3 +94,4 @@ export { default as DragDropFile } from './components/DragDropFile/DragDropFile'
94
94
  export type { FileStatus, FileWithStatus, DropZoneProps, DragDropFileProviderProps, DragDropFileContextValue, } from './components/DragDropFile/types';
95
95
  export { TablePagination } from './components/TablePagination';
96
96
  export type { TablePaginationProps } from './components/TablePagination';
97
+ export { VisuallyHidden } from './components/VisuallyHidden';