react-magma-dom 3.7.0 → 3.9.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 (62) hide show
  1. package/dist/components/AlertBase/index.d.ts +2 -1
  2. package/dist/components/ButtonGroup/ButtonGroup.stories.d.ts +8 -8
  3. package/dist/components/CharacterCounter/CharacterCounter.stories.d.ts +16 -16
  4. package/dist/components/Checkbox/index.d.ts +5 -0
  5. package/dist/components/Combobox/ComboboxInput.d.ts +3 -3
  6. package/dist/components/Datagrid/Datagrid.stories.d.ts +8 -8
  7. package/dist/components/DatePicker/DatePicker.stories.d.ts +11 -0
  8. package/dist/components/DatePicker/utils.d.ts +1 -0
  9. package/dist/components/Dropdown/DropdownMenuItem.d.ts +2 -1
  10. package/dist/components/Grid/Grid.d.ts +2 -2
  11. package/dist/components/Hyperlink/Hyperlink.stories.d.ts +30 -2
  12. package/dist/components/Hyperlink/index.d.ts +19 -3
  13. package/dist/components/IconButton/IconButton.stories.d.ts +4 -4
  14. package/dist/components/IndeterminateCheckbox/index.d.ts +4 -0
  15. package/dist/components/Input/Input.stories.d.ts +46 -27
  16. package/dist/components/InputBase/index.d.ts +10 -2
  17. package/dist/components/Modal/Modal.d.ts +9 -0
  18. package/dist/components/Modal/Modal.stories.d.ts +1 -0
  19. package/dist/components/Pagination/Pagination.d.ts +1 -1
  20. package/dist/components/ProgressBar/ProgressBar.stories.d.ts +15 -0
  21. package/dist/components/ProgressBar/index.d.ts +1 -1
  22. package/dist/components/Select/shared.d.ts +10 -9
  23. package/dist/components/Stepper/Step.d.ts +53 -0
  24. package/dist/components/Stepper/Stepper.d.ts +53 -0
  25. package/dist/components/Stepper/Stepper.stories.d.ts +6 -0
  26. package/dist/components/Stepper/index.d.ts +2 -0
  27. package/dist/components/Table/Table.d.ts +3 -2
  28. package/dist/components/Table/Table.stories.d.ts +48 -48
  29. package/dist/components/Tabs/TabScrollSpyPanel.d.ts +10 -0
  30. package/dist/components/Tabs/Tabs.stories.d.ts +2 -0
  31. package/dist/components/Tabs/TabsScrollSpyContainer.d.ts +9 -0
  32. package/dist/components/Tabs/index.d.ts +2 -0
  33. package/dist/components/Tabs/utils.d.ts +3 -0
  34. package/dist/components/Tag/Tag.stories.d.ts +16 -16
  35. package/dist/components/Textarea/Textarea.stories.d.ts +8 -8
  36. package/dist/components/TimePicker/TimePicker.stories.d.ts +2 -0
  37. package/dist/components/TimePicker/useTimePicker.d.ts +2 -2
  38. package/dist/components/ToggleButton/ToggleButton.stories.d.ts +32 -32
  39. package/dist/components/ToggleButtonGroup/ToggleButtonGroup.stories.d.ts +16 -16
  40. package/dist/components/Tooltip/index.d.ts +4 -3
  41. package/dist/components/TreeView/TreeItem.d.ts +5 -0
  42. package/dist/components/TreeView/TreeItemContext.d.ts +15 -0
  43. package/dist/components/TreeView/TreeView.d.ts +5 -0
  44. package/dist/components/TreeView/TreeView.stories.d.ts +88 -0
  45. package/dist/components/TreeView/TreeViewContext.d.ts +28 -0
  46. package/dist/components/TreeView/index.d.ts +5 -0
  47. package/dist/components/TreeView/useTreeItem.d.ts +84 -0
  48. package/dist/components/TreeView/useTreeView.d.ts +75 -0
  49. package/dist/components/TreeView/utils.d.ts +44 -0
  50. package/dist/components/Typography/index.d.ts +1 -1
  51. package/dist/esm/index.js +3245 -737
  52. package/dist/esm/index.js.map +1 -1
  53. package/dist/i18n/interface.d.ts +5 -0
  54. package/dist/index.d.ts +7 -1
  55. package/dist/properties.json +1104 -128
  56. package/dist/react-magma-dom.cjs.development.js +2971 -540
  57. package/dist/react-magma-dom.cjs.development.js.map +1 -1
  58. package/dist/react-magma-dom.cjs.production.min.js +1 -1
  59. package/dist/react-magma-dom.cjs.production.min.js.map +1 -1
  60. package/dist/theme/styled.d.ts +1 -1
  61. package/dist/utils/index.d.ts +1 -0
  62. package/package.json +3 -3
@@ -0,0 +1,84 @@
1
+ import * as React from 'react';
2
+ import { IconProps } from 'react-magma-icons';
3
+ import { IndeterminateCheckboxStatus } from '../IndeterminateCheckbox';
4
+ export interface UseTreeItemProps extends React.HTMLAttributes<HTMLLIElement> {
5
+ /**
6
+ * Index number
7
+ * private
8
+ */
9
+ index?: number;
10
+ /**
11
+ * Item name
12
+ */
13
+ label: React.ReactNode;
14
+ /**
15
+ * Item id
16
+ */
17
+ itemId: string;
18
+ /**
19
+ * @internal
20
+ */
21
+ testId?: string;
22
+ /**
23
+ * Action that fires when the item is clicked
24
+ */
25
+ onClick?: () => void;
26
+ /**
27
+ * Icon for the tree item
28
+ */
29
+ icon?: React.ReactElement<IconProps>;
30
+ /**
31
+ * Indeterminate Checkbox status
32
+ * @internal
33
+ */
34
+ parentCheckedStatus?: IndeterminateCheckboxStatus;
35
+ /**
36
+ * @internal
37
+ */
38
+ updateParentCheckStatus?: (index: number, status: IndeterminateCheckboxStatus, isInitialRender?: boolean) => void;
39
+ /**
40
+ * @internal
41
+ */
42
+ parentDepth?: number;
43
+ /**
44
+ * @internal
45
+ */
46
+ itemDepth?: number;
47
+ /**
48
+ * TODO: improve functionality (issue #1305)
49
+ * @internal
50
+ * If true, element is disabled
51
+ * @default false
52
+ */
53
+ isDisabled?: boolean;
54
+ /**
55
+ * Style properties for the tree item label
56
+ */
57
+ labelStyle?: React.CSSProperties;
58
+ /**
59
+ * @internal
60
+ */
61
+ topLevel?: boolean;
62
+ }
63
+ export declare const checkedStatusToBoolean: (status: IndeterminateCheckboxStatus) => boolean;
64
+ export declare function useTreeItem(props: UseTreeItemProps, forwardedRef: any): {
65
+ contextValue: {
66
+ checkboxChangeHandler: (event: React.ChangeEvent<HTMLInputElement>) => void;
67
+ checkedStatus: IndeterminateCheckboxStatus;
68
+ expanded: boolean;
69
+ hasOwnTreeItems: boolean;
70
+ itemDepth: number;
71
+ itemId: string;
72
+ numberOfTreeItemChildren: number;
73
+ parentCheckedStatus: IndeterminateCheckboxStatus;
74
+ parentDepth: number;
75
+ ref: (node: any) => void;
76
+ selectedItems: import("./TreeViewContext").TreeItemSelectedInterface[];
77
+ setExpanded: React.Dispatch<React.SetStateAction<boolean>>;
78
+ updateCheckedStatusFromChild: (index: number, status: IndeterminateCheckboxStatus, isInitialRender?: boolean) => void;
79
+ treeItemChildren: (string | number | {} | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, any>) | (new (props: any) => React.Component<any, any, any>)> | React.ReactNodeArray | React.ReactPortal)[];
80
+ };
81
+ handleClick: (event: any, itemId: any) => void;
82
+ handleKeyDown: (event: React.KeyboardEvent) => void;
83
+ };
84
+ export declare type UseTreeItemReturn = ReturnType<typeof useTreeItem>;
@@ -0,0 +1,75 @@
1
+ import * as React from 'react';
2
+ import { TreeItemSelectedInterface } from './TreeViewContext';
3
+ export declare enum TreeViewSelectable {
4
+ single = "single",
5
+ multi = "multi",
6
+ off = "off"
7
+ }
8
+ export interface UseTreeViewProps {
9
+ /**
10
+ * Text for aria-label attribute for the tree.
11
+ * If there is no visible name for the element you can reference, use aria-label to provide the user with a recognizable accessible name.
12
+ * It's required to use either `ariaLabel` OR `ariaLabelledBy`.
13
+ */
14
+ ariaLabel?: string;
15
+ /**
16
+ * Text for aria-labelledby attribute for the tree.
17
+ * If there is visible text that labels an element, use aria-labelledby.
18
+ * It's required to use either `ariaLabel` OR `ariaLabelledBy`.
19
+ */
20
+ ariaLabelledBy?: string;
21
+ /**
22
+ * Array list of itemIds of items that should be expanded by default.
23
+ * For all items expanded, provide an array with all the indexes
24
+ * @default [] (no items expanded)
25
+ */
26
+ initialExpandedItems?: Array<string>;
27
+ isInverse?: boolean;
28
+ /**
29
+ * Array list of itemIds of items that should be selected when the component renders
30
+ * * @default [] (no items selected)
31
+ */
32
+ preselectedItems?: Array<TreeItemSelectedInterface>;
33
+ /**
34
+ * How many items can be selected in the tree view: single, multi, off
35
+ * @default TreeViewSelectable.single
36
+ */
37
+ selectable?: TreeViewSelectable;
38
+ /**
39
+ * @internal
40
+ */
41
+ testId?: string;
42
+ /**
43
+ * Action that fires when an item is expanded or collapsed
44
+ */
45
+ onExpandedChange?: (event: React.SyntheticEvent) => void;
46
+ /**
47
+ * Action that fires when an item is selected
48
+ * Return an array of objects.
49
+ * Example: [ {itemId: 'item0', checkedStatus: IndeterminateCheckboxStatus.indeterminate}, {itemId: 'item0-child', checkedStatus: IndeterminateCheckboxStatus.checked} ]
50
+ */
51
+ onSelectedItemChange?: (selectedItems: Array<Object>) => void;
52
+ children?: React.ReactNode[];
53
+ }
54
+ export declare function useTreeView(props: UseTreeViewProps): {
55
+ contextValue: {
56
+ hasIcons: boolean;
57
+ itemToFocus: any;
58
+ onSelectedItemChange: (selectedItems: Object[]) => void;
59
+ onExpandedChange: (event: React.SyntheticEvent<Element, Event>) => void;
60
+ selectable: TreeViewSelectable;
61
+ setHasIcons: React.Dispatch<React.SetStateAction<boolean>>;
62
+ selectedItems: TreeItemSelectedInterface[];
63
+ setSelectedItems: React.Dispatch<React.SetStateAction<TreeItemSelectedInterface[]>>;
64
+ initialExpandedItems: string[];
65
+ treeItemRefArray: React.MutableRefObject<React.MutableRefObject<Element>[]>;
66
+ registerTreeItem: (refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>, ref: React.MutableRefObject<Element>) => void;
67
+ preselectedItemsNeedUpdate: boolean;
68
+ setPreselectedItemsNeedUpdate: React.Dispatch<React.SetStateAction<boolean>>;
69
+ initialExpandedItemsNeedUpdate: boolean;
70
+ setInitialExpandedItemsNeedUpdate: React.Dispatch<React.SetStateAction<boolean>>;
71
+ selectedItemsChanged: boolean;
72
+ setSelectedItemsChanged: React.Dispatch<React.SetStateAction<boolean>>;
73
+ };
74
+ };
75
+ export declare type UseTreeViewReturn = ReturnType<typeof useTreeView>;
@@ -0,0 +1,44 @@
1
+ import { ThemeInterface } from '../../theme/magma';
2
+ import { TreeViewSelectable } from './useTreeView';
3
+ export declare enum TreeNodeType {
4
+ branch = "branch",
5
+ leaf = "leaf"
6
+ }
7
+ /**
8
+ * Leaf node - 1st level has 40px of left padding.
9
+ * Each level after that adds 56px of left padding.
10
+ * 40, 64, 88, 112, 136, etc.
11
+ *
12
+ * Branch node - 1st level has 8px of left padding.
13
+ * Each level after that adds 24px of left padding.
14
+ * 8, 32, 56, 80, 104, etc.
15
+ *
16
+ * The label element (the div inside the li) gets additional spacing.
17
+ * In order to highlight the entire line, we need to negate the value for margin.
18
+ */
19
+ export declare function calculateOffset(type: TreeNodeType, depth?: number, labelElem?: boolean, negative?: boolean): string;
20
+ export declare function getTreeItemLabelColor(isInverse: boolean, disabled: boolean, theme: ThemeInterface): string;
21
+ export declare function getTreeItemWrapperCursor(disabled: boolean, selectable: TreeViewSelectable, nodeType: TreeNodeType): "not-allowed" | "pointer" | "default";
22
+ export declare function arrayIncludesId(itemsArray: any, itemId: any): any;
23
+ export declare function getChildrenItemIds(children: any, status?: string): any[];
24
+ export declare function getChildrenItemIdsFlat(children: any): any[];
25
+ export declare function getChildrenItemIdsInTree(children: any): any[];
26
+ export declare function getAllParentIds(childrenArr: any, itemId: any, parentItemIds?: any[]): any;
27
+ export declare function findChildByItemId(children: any, itemId: any): any;
28
+ export declare function getAllChildrenEnabled(children: any): boolean;
29
+ export declare function filterSelectedItems(selectedItems: any, childrenIds: any, itemId: any): any;
30
+ export declare function getMissingChildrenIds(selectedItems: any, childrenIds: any): any;
31
+ export declare function getChildrenCheckedStatus(childrenIds: any, status: any): any;
32
+ export declare function getEnabledTreeItemChildrenLength(treeItemChildren: any): any;
33
+ export declare function getUpdatedSelectedItems(selectedItems: any, itemId: any, checkedStatus: any): any;
34
+ export declare function getUniqueSelectedItemsArray(itemArr0: any, itemArr1: any, itemArr2: any): any[];
35
+ export declare function findCommonItems(initialItemsArr: any, childrenItemsArr: any): any[];
36
+ export declare function areArraysEqual(array1: any, array2: any): boolean;
37
+ export declare function getCheckedStatus(itemId: any, selectedItems: any): any;
38
+ export declare function findFirstBranchNode(children: any): any;
39
+ export declare function getFirstItemInTree(arr: any, children: any): any;
40
+ export declare function filterNullEntries(obj: any): {
41
+ current: any;
42
+ } | {
43
+ current?: undefined;
44
+ };
@@ -55,4 +55,4 @@ export declare const headingMediumStyles: (props: any) => import("@emotion/utils
55
55
  export declare const headingSmallStyles: (props: any) => import("@emotion/utils").SerializedStyles;
56
56
  export declare const headingXSmallStyles: (props: any) => import("@emotion/utils").SerializedStyles;
57
57
  export declare const heading2XSmallStyles: (props: any) => import("@emotion/utils").SerializedStyles;
58
- export declare const TypographyComponent: import("@emotion/styled-base").StyledComponent<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, TypographyProps<HTMLParagraphElement>, import("../..").ThemeInterface>;
58
+ export declare const TypographyComponent: import("@emotion/styled-base").StyledComponent<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, TypographyProps<HTMLParagraphElement>, object>;