react-magma-dom 4.7.0-next.1 → 4.7.0-next.10

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.
@@ -7,6 +7,7 @@ export declare enum ButtonColor {
7
7
  primary = "primary",
8
8
  secondary = "secondary",
9
9
  danger = "danger",
10
+ success = "success",
10
11
  marketing = "marketing",
11
12
  subtle = "subtle"
12
13
  }
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { SelectComponents } from '../Select/components';
3
- import { UseComboboxGetToggleButtonPropsOptions, UseComboboxGetComboboxPropsOptions, UseComboboxGetInputPropsOptions } from 'downshift';
3
+ import { UseComboboxGetComboboxPropsOptions, UseComboboxGetInputPropsOptions, UseComboboxGetToggleButtonPropsOptions } from 'downshift';
4
+ import { ReferenceType } from '@floating-ui/react-dom';
4
5
  interface ComboboxInputProps<T> {
5
6
  ariaDescribedBy?: string;
6
7
  children?: React.ReactNode | React.ReactNode[];
@@ -22,6 +23,7 @@ interface ComboboxInputProps<T> {
22
23
  onInputKeyUp?: (event: any) => void;
23
24
  placeholder?: string;
24
25
  selectedItems?: React.ReactNode;
26
+ setReference?: (node: ReferenceType) => void;
25
27
  toggleButtonRef?: React.Ref<HTMLButtonElement>;
26
28
  }
27
29
  export declare function ComboboxInput<T>(props: ComboboxInputProps<T>): JSX.Element;
@@ -1,13 +1,18 @@
1
1
  import React from 'react';
2
2
  import { UseComboboxProps, UseComboboxState, UseMultipleSelectionProps } from 'downshift';
3
- import { SelectOptions, InternalSelectProps, InternalMultiProps } from '../Select';
4
- import { XOR, Omit } from '../../utils';
3
+ import { InternalMultiProps, InternalSelectProps, SelectOptions } from '../Select';
4
+ import { Omit, XOR } from '../../utils';
5
5
  import { LabelPosition } from '../Label';
6
+ import { ReferenceType } from '@floating-ui/react-dom';
6
7
  export interface ComboboxProps<T extends SelectOptions> extends Omit<UseComboboxProps<T>, 'items'>, InternalSelectProps<T> {
7
8
  /**
8
9
  * Id of the element that describes the combobox input
9
10
  */
10
11
  ariaDescribedBy?: string;
12
+ /**
13
+ * Style properties for the component container element
14
+ */
15
+ containerStyle?: React.CSSProperties;
11
16
  /**
12
17
  * Default selectable options. Allows for uncontrolled component and internal creation of items. Can be an array of strings or objects
13
18
  */
@@ -17,6 +22,10 @@ export interface ComboboxProps<T extends SelectOptions> extends Omit<UseCombobox
17
22
  * @default false
18
23
  */
19
24
  disableCreateItem?: boolean;
25
+ /**
26
+ * @internal
27
+ */
28
+ floatingElementStyles?: React.CSSProperties;
20
29
  /**
21
30
  * @internal
22
31
  */
@@ -43,6 +52,13 @@ export interface ComboboxProps<T extends SelectOptions> extends Omit<UseCombobox
43
52
  * Default selectable options. Can be an array of strings or objects
44
53
  */
45
54
  items?: T[];
55
+ /**
56
+ * When false, the selected item gets validated to ensure it's in the original `items` list.
57
+ * When using Combobox for typeahead with a large `items` list, set this boolean to true to allow the selected item to not be part of the original `items` list.
58
+ * In addition, when this is true and `isLoading` is used, the loading indicator will appear on the list instead of the input
59
+ * @default false
60
+ */
61
+ isTypeahead?: boolean;
46
62
  /**
47
63
  * Function passed in that transforms a newly created item to whatever format your items are in
48
64
  */
@@ -83,24 +99,21 @@ export interface ComboboxProps<T extends SelectOptions> extends Omit<UseCombobox
83
99
  */
84
100
  onItemCreated?: (newItem: T) => void;
85
101
  /**
86
- * Reference to the toggle button element wrapping the input in the combobox
102
+ * @internal
87
103
  */
88
- toggleButtonRef?: React.Ref<HTMLButtonElement>;
104
+ setFloating?: (node: ReferenceType) => void;
89
105
  /**
90
106
  * @internal
91
107
  */
92
- testId?: string;
108
+ setReference?: (node: ReferenceType) => void;
93
109
  /**
94
- * Style properties for the component container element
110
+ * Reference to the toggle button element wrapping the input in the combobox
95
111
  */
96
- containerStyle?: React.CSSProperties;
112
+ toggleButtonRef?: React.Ref<HTMLButtonElement>;
97
113
  /**
98
- * When false, the selected item gets validated to ensure it's in the original `items` list.
99
- * When using Combobox for typeahead with a large `items` list, set this boolean to true to allow the selected item to not be part of the original `items` list.
100
- * In addition, when this is true and `isLoading` is used, the loading indicator will appear on the list instead of the input
101
- * @default false
114
+ * @internal
102
115
  */
103
- isTypeahead?: boolean;
116
+ testId?: string;
104
117
  }
105
118
  export interface MultiComboboxProps<T extends SelectOptions> extends UseMultipleSelectionProps<T>, Omit<ComboboxProps<T>, 'onStateChange' | 'stateReducer' | 'isMulti'>, InternalMultiProps<T> {
106
119
  /**
@@ -26,6 +26,10 @@ export interface DatePickerProps extends Omit<React.InputHTMLAttributes<HTMLInpu
26
26
  * @default false
27
27
  */
28
28
  isClearable?: boolean;
29
+ /**
30
+ * If true, the component will have inverse styling to better appear on a dark background
31
+ * @default false
32
+ */
29
33
  isInverse?: boolean;
30
34
  /**
31
35
  * Style properties for the label element
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { ReferenceType } from '@floating-ui/react-dom/dist/floating-ui.react-dom';
2
3
  export declare enum DropdownDropDirection {
3
4
  down = "down",
4
5
  left = "left",
@@ -25,6 +26,10 @@ export interface DropdownProps extends React.HTMLAttributes<HTMLDivElement> {
25
26
  * @default DropdownDropDirection.down
26
27
  */
27
28
  dropDirection?: DropdownDropDirection;
29
+ /**
30
+ * If true, the component will have inverse styling to better appear on a dark background
31
+ * @default false
32
+ */
28
33
  isInverse?: boolean;
29
34
  /**
30
35
  * Max-height of dropdown content
@@ -55,6 +60,7 @@ interface DropdownContextInterface {
55
60
  closeDropdown?: (event: React.SyntheticEvent | React.KeyboardEvent) => void;
56
61
  dropdownButtonId?: React.MutableRefObject<string>;
57
62
  dropDirection?: DropdownDropDirection;
63
+ floatingStyles?: React.CSSProperties;
58
64
  handleDropdownBlur?: (event: React.FocusEvent) => void;
59
65
  itemRefArray?: React.MutableRefObject<React.MutableRefObject<Element>[]>;
60
66
  isFixedWidth?: boolean;
@@ -66,6 +72,8 @@ interface DropdownContextInterface {
66
72
  registerDropdownMenuItem: (itemRefArray: React.MutableRefObject<React.MutableRefObject<Element>[]>, itemRef: React.MutableRefObject<Element>) => void;
67
73
  setActiveItemIndex?: React.Dispatch<React.SetStateAction<number>>;
68
74
  setIsOpen: React.Dispatch<React.SetStateAction<boolean>>;
75
+ setFloating?: (node: ReferenceType) => void;
76
+ setReference?: (node: ReferenceType) => void;
69
77
  toggleRef?: any;
70
78
  width?: string;
71
79
  }
@@ -15,3 +15,4 @@ export declare const NoItems: (args: any) => JSX.Element;
15
15
  export declare const ExpandableItems: (args: any) => JSX.Element;
16
16
  export declare const ExpandableItemsWithIcons: (args: any) => JSX.Element;
17
17
  export declare const ExpandableItemsWithIconsAndConsoleWarning: (args: any) => JSX.Element;
18
+ export declare const FlippedItems: (args: any) => JSX.Element;
@@ -38,13 +38,14 @@ export declare const IconPositions: {
38
38
  inputWrapperStyle?: React.CSSProperties;
39
39
  isClearable?: boolean;
40
40
  onClear?: () => void;
41
+ isPasswordInput?: boolean;
41
42
  isPredictive?: boolean;
42
43
  onIconClick?: () => void;
43
44
  onIconKeyDown?: (event: any) => void;
44
45
  onDateChange?: (event: any) => void;
46
+ setReference?: (node: import("@floating-ui/react-dom").ReferenceType) => void;
45
47
  theme?: any;
46
48
  type?: InputType;
47
- isPasswordInput?: boolean;
48
49
  width?: string;
49
50
  accept?: string;
50
51
  alt?: string;
@@ -368,13 +369,14 @@ export declare const WithChildren: {
368
369
  inputWrapperStyle?: React.CSSProperties;
369
370
  isClearable?: boolean;
370
371
  onClear?: () => void;
372
+ isPasswordInput?: boolean;
371
373
  isPredictive?: boolean;
372
374
  onIconClick?: () => void;
373
375
  onIconKeyDown?: (event: any) => void;
374
376
  onDateChange?: (event: any) => void;
377
+ setReference?: (node: import("@floating-ui/react-dom").ReferenceType) => void;
375
378
  theme?: any;
376
379
  type?: InputType;
377
- isPasswordInput?: boolean;
378
380
  width?: string;
379
381
  accept?: string;
380
382
  alt?: string;
@@ -696,13 +698,14 @@ export declare const WithTwoIcons: {
696
698
  inputWrapperStyle?: React.CSSProperties;
697
699
  isClearable?: boolean;
698
700
  onClear?: () => void;
701
+ isPasswordInput?: boolean;
699
702
  isPredictive?: boolean;
700
703
  onIconClick?: () => void;
701
704
  onIconKeyDown?: (event: any) => void;
702
705
  onDateChange?: (event: any) => void;
706
+ setReference?: (node: import("@floating-ui/react-dom").ReferenceType) => void;
703
707
  theme?: any;
704
708
  type?: InputType;
705
- isPasswordInput?: boolean;
706
709
  width?: string;
707
710
  accept?: string;
708
711
  alt?: string;
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { IconProps } from 'react-magma-icons';
3
3
  import { ThemeInterface } from '../../theme/magma';
4
+ import { ReferenceType } from '@floating-ui/react-dom/dist/floating-ui.react-dom';
4
5
  export declare enum InputSize {
5
6
  large = "large",
6
7
  medium = "medium"
@@ -81,7 +82,15 @@ export interface InputBaseProps extends React.InputHTMLAttributes<HTMLInputEleme
81
82
  * Function to be called when the contents of input are cleared by clicking a clear button
82
83
  */
83
84
  onClear?: () => void;
85
+ /**
86
+ * If true, the component will have inverse styling to better appear on a dark background
87
+ * @default false
88
+ */
84
89
  isInverse?: boolean;
90
+ /**
91
+ * Boolean for whether this is a Password Input or not
92
+ */
93
+ isPasswordInput?: boolean;
85
94
  /**
86
95
  * For use in predictive search which moves the icon to the left
87
96
  */
@@ -107,6 +116,10 @@ export interface InputBaseProps extends React.InputHTMLAttributes<HTMLInputEleme
107
116
  * Action that will synchronize chosenDate with input value
108
117
  */
109
118
  onDateChange?: (event: any) => void;
119
+ /**
120
+ * @internal
121
+ */
122
+ setReference?: (node: ReferenceType) => void;
110
123
  /**
111
124
  * @internal
112
125
  */
@@ -120,10 +133,6 @@ export interface InputBaseProps extends React.InputHTMLAttributes<HTMLInputEleme
120
133
  * @default InputType.text
121
134
  */
122
135
  type?: InputType;
123
- /**
124
- * Boolean for whether this is a Password Input or not
125
- */
126
- isPasswordInput?: boolean;
127
136
  /**
128
137
  * String to determine width of input, must be suffixed with "px", "rem", or "%""
129
138
  * @default "auto"
@@ -1,18 +1,21 @@
1
1
  import React from 'react';
2
- import { UseSelectGetMenuPropsOptions, UseSelectGetItemPropsOptions } from 'downshift';
2
+ import { UseSelectGetItemPropsOptions, UseSelectGetMenuPropsOptions } from 'downshift';
3
3
  import { SelectComponents } from './components';
4
+ import { ReferenceType } from '@floating-ui/react-dom';
4
5
  interface ItemsListProps<T> {
5
6
  customComponents?: SelectComponents<T>;
7
+ floatingElementStyles?: React.CSSProperties;
6
8
  getItemProps: (options?: UseSelectGetItemPropsOptions<T>) => any;
7
9
  getMenuProps: (options?: UseSelectGetMenuPropsOptions) => any;
8
10
  highlightedIndex?: number;
9
- isOpen?: boolean;
10
11
  isInverse?: boolean;
12
+ isLoading?: boolean;
13
+ isOpen?: boolean;
11
14
  items: T[];
12
15
  itemToString: (item: T) => string;
13
16
  maxHeight?: number | string;
14
17
  menuStyle?: React.CSSProperties;
15
- isLoading?: boolean;
18
+ setFloating?: (node: ReferenceType) => void;
16
19
  }
17
20
  export declare function ItemsList<T>(props: ItemsListProps<T>): JSX.Element;
18
21
  export {};
@@ -13,8 +13,8 @@ interface SelectContainerInterface<T> {
13
13
  additionalContent?: React.ReactNode;
14
14
  children: React.ReactNode[];
15
15
  containerStyle?: React.CSSProperties;
16
- errorMessage?: React.ReactNode;
17
16
  descriptionId?: string;
17
+ errorMessage?: React.ReactNode;
18
18
  getLabelProps: (options?: UseSelectGetLabelPropsOptions) => any;
19
19
  hasError?: boolean;
20
20
  helperMessage?: React.ReactNode;
@@ -1,12 +1,14 @@
1
1
  import React from 'react';
2
2
  import { SelectComponents } from '../Select/components';
3
+ import { ReferenceType } from '@floating-ui/react-dom';
3
4
  interface SelectTriggerButtonInterface<T> {
4
5
  ariaDescribedBy?: string;
5
6
  children: React.ReactNode | React.ReactNode[];
6
7
  customComponents?: SelectComponents<T>;
7
- hasError?: boolean;
8
8
  disabled?: boolean;
9
+ hasError?: boolean;
9
10
  isInverse?: boolean;
11
+ setReference?: (node: ReferenceType) => void;
10
12
  style?: React.CSSProperties;
11
13
  toggleButtonProps: any;
12
14
  tabindex?: number;
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
- import { UseSelectProps, UseMultipleSelectionProps } from 'downshift';
2
+ import { UseMultipleSelectionProps, UseSelectProps } from 'downshift';
3
+ import { ReferenceType } from '@floating-ui/react-dom/dist/floating-ui.react-dom';
3
4
  import { SelectComponents } from './components';
4
- import { XOR, Omit } from '../../utils';
5
+ import { Omit, XOR } from '../../utils';
5
6
  import { LabelPosition } from '../Label';
6
7
  export declare type SelectOptions = string | {
7
8
  value: string;
@@ -43,6 +44,10 @@ export interface InternalSelectProps<T> {
43
44
  * @default false
44
45
  */
45
46
  disabled?: boolean;
47
+ /**
48
+ * If true, the component will have inverse styling to better appear on a dark background
49
+ * @default false
50
+ */
46
51
  isInverse?: boolean;
47
52
  /**
48
53
  * If true, label text will be hidden visually, but will still be read by assistive technology
@@ -102,6 +107,10 @@ export interface SelectProps<T extends SelectOptions> extends UseSelectProps<T>,
102
107
  * Id of the element that describes the select trigger button
103
108
  */
104
109
  ariaDescribedBy?: string;
110
+ /**
111
+ * @internal
112
+ */
113
+ floatingElementStyles?: React.CSSProperties;
105
114
  /**
106
115
  * @internal
107
116
  */
@@ -134,12 +143,23 @@ export interface SelectProps<T extends SelectOptions> extends UseSelectProps<T>,
134
143
  * Event that will fire when a keypress is released while focused on the trigger button
135
144
  */
136
145
  onKeyUp?: (event: React.KeyboardEvent) => void;
146
+ /**
147
+ * @internal
148
+ */
149
+ setFloating?: (node: ReferenceType) => void;
150
+ /**
151
+ * @internal
152
+ */
153
+ setReference?: (node: ReferenceType) => void;
137
154
  }
138
155
  export interface MultiSelectProps<T extends SelectOptions> extends UseMultipleSelectionProps<T>, Omit<SelectProps<T>, 'onStateChange' | 'stateReducer' | 'isMulti'>, InternalMultiProps<T> {
139
156
  /**
140
157
  * @internal
141
158
  */
142
159
  hasError?: boolean;
160
+ /**
161
+ * @internal
162
+ */
143
163
  isInverse?: boolean;
144
164
  /**
145
165
  * @internal
@@ -10,6 +10,8 @@ export declare const StyledButton: import("@emotion/styled").StyledComponent<{
10
10
  export declare const SelectText: import("@emotion/styled").StyledComponent<{
11
11
  theme?: import("@emotion/react").Theme;
12
12
  as?: import("react").ElementType<any>;
13
+ } & {
14
+ isClearable?: boolean;
13
15
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
14
16
  export declare const StyledCard: import("@emotion/styled").StyledComponent<import("../Card").CardProps & import("react").RefAttributes<HTMLDivElement> & {
15
17
  theme?: import("@emotion/react").Theme;
@@ -81,7 +81,7 @@ export declare function useTreeView(props: UseTreeViewProps): {
81
81
  onExpandedChange: (event: React.SyntheticEvent<Element, Event>) => void;
82
82
  selectable: TreeViewSelectable;
83
83
  selectedItems: any;
84
- initialExpandedItems: string[];
84
+ initialExpandedItems: any[];
85
85
  treeItemRefArray: React.MutableRefObject<React.MutableRefObject<Element>[]>;
86
86
  registerTreeItem: (refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>, ref: React.MutableRefObject<Element>) => void;
87
87
  initialExpandedItemsNeedUpdate: boolean;
@@ -48,3 +48,6 @@ export declare const selectMulti: ({ items, itemId, checkedStatus, checkChildren
48
48
  itemId: TreeViewItemInterface['itemId'];
49
49
  checkedStatus: TreeViewItemInterface['checkedStatus'];
50
50
  } & Pick<UseTreeViewProps, "checkParents" | "checkChildren">) => any;
51
+ export declare const getInitialExpandedIds: ({ items, initialExpandedItems }: {
52
+ items: TreeViewItemInterface[];
53
+ } & Pick<UseTreeViewProps, "initialExpandedItems">) => any[];