@instructure/ui-menu 8.13.1-snapshot.9 → 8.14.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 (47) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/es/Menu/MenuItem/index.js +28 -21
  3. package/es/Menu/MenuItem/props.js +0 -23
  4. package/es/Menu/MenuItemGroup/index.js +17 -13
  5. package/es/Menu/MenuItemGroup/props.js +1 -30
  6. package/es/Menu/MenuItemSeparator/index.js +6 -2
  7. package/es/Menu/index.js +59 -56
  8. package/es/Menu/props.js +1 -113
  9. package/es/MenuContext.js +3 -3
  10. package/lib/Menu/MenuItem/index.js +28 -21
  11. package/lib/Menu/MenuItem/props.js +0 -23
  12. package/lib/Menu/MenuItemGroup/index.js +17 -13
  13. package/lib/Menu/MenuItemGroup/props.js +1 -30
  14. package/lib/Menu/MenuItemSeparator/index.js +6 -2
  15. package/lib/Menu/index.js +61 -56
  16. package/lib/Menu/props.js +1 -113
  17. package/lib/MenuContext.js +2 -2
  18. package/package.json +21 -22
  19. package/src/Menu/MenuItem/index.tsx +24 -34
  20. package/src/Menu/MenuItem/props.ts +36 -27
  21. package/src/Menu/MenuItemGroup/index.tsx +28 -48
  22. package/src/Menu/MenuItemGroup/props.ts +37 -30
  23. package/src/Menu/MenuItemSeparator/index.tsx +2 -4
  24. package/src/Menu/index.tsx +81 -135
  25. package/src/Menu/props.ts +79 -84
  26. package/src/MenuContext.ts +3 -2
  27. package/tsconfig.build.json +25 -2
  28. package/tsconfig.build.tsbuildinfo +1 -0
  29. package/types/Menu/MenuItem/MenuItemLocator.d.ts +52 -52
  30. package/types/Menu/MenuItem/index.d.ts +24 -23
  31. package/types/Menu/MenuItem/index.d.ts.map +1 -1
  32. package/types/Menu/MenuItem/props.d.ts +30 -7
  33. package/types/Menu/MenuItem/props.d.ts.map +1 -1
  34. package/types/Menu/MenuItemGroup/MenuItemGroupLocator.d.ts +182 -182
  35. package/types/Menu/MenuItemGroup/index.d.ts +22 -22
  36. package/types/Menu/MenuItemGroup/index.d.ts.map +1 -1
  37. package/types/Menu/MenuItemGroup/props.d.ts +33 -8
  38. package/types/Menu/MenuItemGroup/props.d.ts.map +1 -1
  39. package/types/Menu/MenuItemSeparator/index.d.ts.map +1 -1
  40. package/types/Menu/MenuLocator.d.ts +576 -576
  41. package/types/Menu/index.d.ts +58 -68
  42. package/types/Menu/index.d.ts.map +1 -1
  43. package/types/Menu/props.d.ts +94 -16
  44. package/types/Menu/props.d.ts.map +1 -1
  45. package/types/MenuContext.d.ts +3 -2
  46. package/types/MenuContext.d.ts.map +1 -1
  47. package/LICENSE.md +0 -27
@@ -1,6 +1,8 @@
1
1
  /** @jsx jsx */
2
- import { Component, ReactElement } from 'react';
2
+ import React, { Component } from 'react';
3
+ import { Popover } from '@instructure/ui-popover';
3
4
  import { MenuItem } from './MenuItem';
5
+ import type { OnMenuItemSelect, MenuItemProps } from './MenuItem/props';
4
6
  import { MenuItemGroup } from './MenuItemGroup';
5
7
  import { MenuItemSeparator } from './MenuItemSeparator';
6
8
  import { jsx } from '@instructure/emotion';
@@ -9,30 +11,29 @@ import type { MenuProps } from './props';
9
11
  ---
10
12
  category: components
11
13
  ---
14
+ @tsProps
12
15
  **/
13
16
  declare class Menu extends Component<MenuProps> {
14
17
  static readonly componentId = "Menu";
15
18
  static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
16
- children?: import("react").ReactNode;
19
+ children?: React.ReactNode;
17
20
  label?: string | undefined;
18
21
  disabled?: boolean | undefined;
19
- trigger?: import("react").ReactNode;
22
+ trigger?: React.ReactNode;
20
23
  placement?: import("@instructure/ui-position").PlacementPropValues | undefined;
21
24
  defaultShow?: boolean | undefined;
22
- show?: any;
23
- onToggle?: ((...args: any[]) => any) | undefined;
24
- onSelect?: ((...args: any[]) => any) | undefined;
25
- onDismiss?: ((...args: any[]) => any) | undefined;
26
- onBlur?: ((...args: any[]) => any) | undefined;
27
- onFocus?: ((...args: any[]) => any) | undefined;
28
- onMouseOver?: ((...args: any[]) => any) | undefined;
29
- onKeyDown?: ((...args: any[]) => any) | undefined;
30
- onKeyUp?: ((...args: any[]) => any) | undefined;
31
- menuRef?: ((...args: any[]) => any) | undefined;
32
- popoverRef?: ((...args: any[]) => any) | undefined;
25
+ show?: boolean | undefined;
26
+ onToggle?: ((show: boolean, menu: Menu) => void) | undefined;
27
+ onSelect?: OnMenuItemSelect | undefined;
28
+ onDismiss?: ((event: React.UIEvent<Element, UIEvent> | React.FocusEvent<Element, Element>, documentClick: boolean) => void) | undefined;
29
+ onFocus?: ((event: React.FocusEvent<Element, Element>) => void) | undefined;
30
+ onMouseOver?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
31
+ onKeyDown?: ((event: React.KeyboardEvent<HTMLUListElement>) => void) | undefined;
32
+ onKeyUp?: ((event: React.KeyboardEvent<HTMLUListElement>) => void) | undefined;
33
+ menuRef?: ((el: HTMLUListElement | null) => void) | undefined;
34
+ popoverRef?: ((el: Popover | null) => void) | undefined;
33
35
  mountNode?: import("@instructure/ui-position").PositionMountNode | undefined;
34
36
  constrain?: import("@instructure/ui-position").PositionConstraint | undefined;
35
- liveRegion?: ReactElement<any, string | import("react").JSXElementConstructor<any>> | ReactElement<any, string | import("react").JSXElementConstructor<any>>[] | ((...args: any[]) => any) | undefined;
36
37
  shouldHideOnSelect?: boolean | undefined;
37
38
  shouldFocusTriggerOnClose?: boolean | undefined;
38
39
  type?: "flyout" | undefined;
@@ -42,26 +43,24 @@ declare class Menu extends Component<MenuProps> {
42
43
  offsetY?: string | number | undefined;
43
44
  }>;
44
45
  static allowedProps: readonly (keyof {
45
- children?: import("react").ReactNode;
46
+ children?: React.ReactNode;
46
47
  label?: string | undefined;
47
48
  disabled?: boolean | undefined;
48
- trigger?: import("react").ReactNode;
49
+ trigger?: React.ReactNode;
49
50
  placement?: import("@instructure/ui-position").PlacementPropValues | undefined;
50
51
  defaultShow?: boolean | undefined;
51
- show?: any;
52
- onToggle?: ((...args: any[]) => any) | undefined;
53
- onSelect?: ((...args: any[]) => any) | undefined;
54
- onDismiss?: ((...args: any[]) => any) | undefined;
55
- onBlur?: ((...args: any[]) => any) | undefined;
56
- onFocus?: ((...args: any[]) => any) | undefined;
57
- onMouseOver?: ((...args: any[]) => any) | undefined;
58
- onKeyDown?: ((...args: any[]) => any) | undefined;
59
- onKeyUp?: ((...args: any[]) => any) | undefined;
60
- menuRef?: ((...args: any[]) => any) | undefined;
61
- popoverRef?: ((...args: any[]) => any) | undefined;
52
+ show?: boolean | undefined;
53
+ onToggle?: ((show: boolean, menu: Menu) => void) | undefined;
54
+ onSelect?: OnMenuItemSelect | undefined;
55
+ onDismiss?: ((event: React.UIEvent<Element, UIEvent> | React.FocusEvent<Element, Element>, documentClick: boolean) => void) | undefined;
56
+ onFocus?: ((event: React.FocusEvent<Element, Element>) => void) | undefined;
57
+ onMouseOver?: ((event: React.MouseEvent<Element, MouseEvent>) => void) | undefined;
58
+ onKeyDown?: ((event: React.KeyboardEvent<HTMLUListElement>) => void) | undefined;
59
+ onKeyUp?: ((event: React.KeyboardEvent<HTMLUListElement>) => void) | undefined;
60
+ menuRef?: ((el: HTMLUListElement | null) => void) | undefined;
61
+ popoverRef?: ((el: Popover | null) => void) | undefined;
62
62
  mountNode?: import("@instructure/ui-position").PositionMountNode | undefined;
63
63
  constrain?: import("@instructure/ui-position").PositionConstraint | undefined;
64
- liveRegion?: ReactElement<any, string | import("react").JSXElementConstructor<any>> | ReactElement<any, string | import("react").JSXElementConstructor<any>>[] | ((...args: any[]) => any) | undefined;
65
64
  shouldHideOnSelect?: boolean | undefined;
66
65
  shouldFocusTriggerOnClose?: boolean | undefined;
67
66
  type?: "flyout" | undefined;
@@ -71,25 +70,13 @@ declare class Menu extends Component<MenuProps> {
71
70
  offsetY?: string | number | undefined;
72
71
  })[];
73
72
  static defaultProps: {
74
- children: null;
75
73
  label: null;
76
74
  disabled: boolean;
77
75
  trigger: null;
78
76
  placement: string;
79
77
  defaultShow: boolean;
80
- onToggle: (shown: any, menu: any) => void;
81
- onSelect: (event: any, value: any, selected: any, item: any) => void;
82
- onDismiss: (event: any, documentClick: any) => void;
83
- onBlur: (event: any) => void;
84
- onFocus: (event: any) => void;
85
- onMouseOver: (event: any) => void;
86
- onKeyDown: (event: any) => void;
87
- onKeyUp: (event: any) => void;
88
- menuRef: (el: any) => void;
89
- popoverRef: (el: any) => void;
90
78
  mountNode: null;
91
79
  constrain: string;
92
- liveRegion: null;
93
80
  shouldHideOnSelect: boolean;
94
81
  shouldFocusTriggerOnClose: boolean;
95
82
  withArrow: boolean;
@@ -103,43 +90,46 @@ declare class Menu extends Component<MenuProps> {
103
90
  hasFocus: boolean;
104
91
  };
105
92
  _rootNode: null;
106
- _menuItems: never[];
107
- _popover: null;
108
- _trigger: null;
93
+ _menuItems: MenuItem[];
94
+ _popover: Popover | null;
95
+ _trigger: MenuItem | (React.ReactInstance & {
96
+ focus?: () => void;
97
+ }) | null;
109
98
  _menu: HTMLUListElement | null;
110
99
  _labelId: string;
111
- _activeSubMenu: null;
112
- ref: HTMLUListElement | null;
100
+ _activeSubMenu?: Menu | null;
101
+ _id: string;
102
+ ref: Element | null;
113
103
  handleRef: (el: HTMLUListElement | null) => void;
114
- constructor(props: any);
104
+ constructor(props: MenuProps);
115
105
  componentDidMount(): void;
116
- componentDidUpdate(prevProps: any): void;
117
- static contextType: import("react").Context<{
118
- registerMenuItem: () => void;
119
- removeMenuItem: () => void;
106
+ componentDidUpdate(): void;
107
+ static contextType: React.Context<{
108
+ registerMenuItem: (_value: MenuItem) => void;
109
+ removeMenuItem: (_value: MenuItem) => void;
120
110
  }>;
121
- registerMenuItem: (item: any) => void;
122
- removeMenuItem: (item: any) => void;
123
- get menuItems(): never[];
124
- getMenuItemIndex: (item: any) => number;
125
- handleTriggerKeyDown: (event: any) => void;
126
- handleTriggerMouseOver: () => void;
127
- handleToggle: (shown: any) => void;
128
- handleMenuKeyDown: (event: any) => void;
129
- handleMenuItemSelect: (event: any, value: any, selected: any, item: any) => void;
111
+ registerMenuItem: (item: MenuItem) => void;
112
+ removeMenuItem: (item: MenuItem) => void;
113
+ get menuItems(): MenuItem[];
114
+ getMenuItemIndex: (item: MenuItem) => number;
115
+ handleTriggerKeyDown: (event: React.KeyboardEvent) => void;
116
+ handleTriggerMouseOver: (event: React.MouseEvent) => void;
117
+ handleToggle: (shown: boolean) => void;
118
+ handleMenuKeyDown: (event: React.KeyboardEvent<HTMLUListElement>) => void;
119
+ handleMenuItemSelect: OnMenuItemSelect;
130
120
  handleMenuItemFocus: () => void;
131
121
  handleMenuItemBlur: () => void;
132
- handleMenuItemMouseOver: (event: any, menuItem: any) => void;
133
- hideActiveSubMenu: (event: any) => void;
134
- handleSubMenuToggle: (shown: any, subMenu: any) => void;
135
- handleSubMenuDismiss: (event: any, documentClick: any) => void;
136
- hide: (event: any) => void;
137
- show: (event: any) => void;
122
+ handleMenuItemMouseOver: MenuItemProps['onMouseOver'];
123
+ hideActiveSubMenu: (event: React.MouseEvent | React.KeyboardEvent) => void;
124
+ handleSubMenuToggle: MenuProps['onToggle'];
125
+ handleSubMenuDismiss: (event: React.MouseEvent | React.KeyboardEvent, documentClick: boolean) => void;
126
+ hide: (event: React.MouseEvent | React.KeyboardEvent) => void;
127
+ show: (event: React.MouseEvent | React.KeyboardEvent) => void;
138
128
  focus(): void;
139
129
  focused(): boolean;
140
130
  get focusedIndex(): number;
141
- moveFocus(step: any): void;
142
- get shown(): any;
131
+ moveFocus(step: number): void;
132
+ get shown(): boolean | undefined;
143
133
  renderChildren(): jsx.JSX.Element[] | null | undefined;
144
134
  renderMenu(): jsx.JSX.Element;
145
135
  render(): jsx.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Menu/index.tsx"],"names":[],"mappings":"AAuBA,eAAe;AACf,OAAO,EAAY,SAAS,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAczD,OAAO,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W,gBAAgB,GAAG,mBAAmB,UAIpD;IAED,IAAI,UAAW,gBAAgB,GAAG,mBAAmB,UAIpD;IAED,KAAK;IAUL,OAAO;IAQP,IAAI,YAAY,WAIf;IAED,SAAS,CAAC,IAAI,EAAE,MAAM;IAmBtB,IAAI,KAAK,wBAER;IAED,cAAc;IAuGd,UAAU;IA+BV,MAAM;CA+DP;AAED,eAAe,IAAI,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAA"}
@@ -1,40 +1,118 @@
1
- /// <reference types="react" />
2
- import type { PropValidators, MenuTheme } from '@instructure/shared-types';
1
+ import React from 'react';
2
+ import type { Menu } from './index';
3
+ import type { PropValidators, MenuTheme, OtherHTMLAttributes } from '@instructure/shared-types';
3
4
  import type { WithStyleProps, ComponentStyle } from '@instructure/emotion';
4
5
  import type { PlacementPropValues, PositionConstraint, PositionMountNode } from '@instructure/ui-position';
6
+ import type { OnMenuItemSelect } from './MenuItem/props';
7
+ import type { Popover } from '@instructure/ui-popover';
5
8
  declare type MenuOwnProps = {
9
+ /**
10
+ * Children of type `Menu.Item`, `Menu.Group`, `Menu.Separator`, or `Menu`
11
+ */
6
12
  children?: React.ReactNode;
13
+ /**
14
+ * Description of the `<Menu />`
15
+ */
7
16
  label?: string;
17
+ /**
18
+ * Is the `<Menu />` disabled
19
+ */
8
20
  disabled?: boolean;
21
+ /**
22
+ * The trigger element, if the `<Menu />` is to render as a popover
23
+ */
9
24
  trigger?: React.ReactNode;
25
+ /**
26
+ * If a trigger is supplied, where should the `<Menu />` be placed (relative to the trigger)
27
+ */
10
28
  placement?: PlacementPropValues;
29
+ /**
30
+ * Should the `<Menu />` be open for the initial render
31
+ */
11
32
  defaultShow?: boolean;
12
- show?: any;
13
- onToggle?: (...args: any[]) => any;
14
- onSelect?: (...args: any[]) => any;
15
- onDismiss?: (...args: any[]) => any;
16
- onBlur?: (...args: any[]) => any;
17
- onFocus?: (...args: any[]) => any;
18
- onMouseOver?: (...args: any[]) => any;
19
- onKeyDown?: (...args: any[]) => any;
20
- onKeyUp?: (...args: any[]) => any;
21
- menuRef?: (...args: any[]) => any;
22
- popoverRef?: (...args: any[]) => any;
33
+ /**
34
+ * Is the `<Menu />` open (should be accompanied by `onToggle`)
35
+ */
36
+ show?: boolean;
37
+ /**
38
+ * Callback fired when the `<Menu />` is toggled open/closed. When used with `show`,
39
+ * the component will not control its own state.
40
+ */
41
+ onToggle?: (show: boolean, menu: Menu) => void;
42
+ /**
43
+ * Callback fired when an item within the `<Menu />` is selected
44
+ */
45
+ onSelect?: OnMenuItemSelect;
46
+ /**
47
+ * If a trigger is supplied, callback fired when the `<Menu />` is closed
48
+ */
49
+ onDismiss?: (event: React.UIEvent | React.FocusEvent, documentClick: boolean) => void;
50
+ /**
51
+ * If a trigger is supplied, callback fired when the `<Menu />` trigger is focused
52
+ */
53
+ onFocus?: (event: React.FocusEvent) => void;
54
+ /**
55
+ * If a trigger is supplied, callback fired onMouseOver for the `<Menu />` trigger
56
+ */
57
+ onMouseOver?: (event: React.MouseEvent) => void;
58
+ /**
59
+ * Callback fired on the onKeyDown of the `<Menu />`
60
+ */
61
+ onKeyDown?: (event: React.KeyboardEvent<HTMLUListElement>) => void;
62
+ /**
63
+ * Callback fired on the onKeyUp of the `<Menu />`
64
+ */
65
+ onKeyUp?: (event: React.KeyboardEvent<HTMLUListElement>) => void;
66
+ /**
67
+ * A function that returns a reference to the `<Menu />`
68
+ */
69
+ menuRef?: (el: HTMLUListElement | null) => void;
70
+ /**
71
+ * A function that returns a reference to the `<Popover />`
72
+ */
73
+ popoverRef?: (el: Popover | null) => void;
74
+ /**
75
+ * If a trigger is supplied, an element or a function returning an element to use as the mount node
76
+ * for the `<Menu />` (defaults to `document.body`)
77
+ */
23
78
  mountNode?: PositionMountNode;
79
+ /**
80
+ * The parent in which to constrain the menu.
81
+ * One of: 'window', 'scroll-parent', 'parent', 'none', an element,
82
+ * or a function returning an element
83
+ */
24
84
  constrain?: PositionConstraint;
25
- liveRegion?: // TODO check whether this is used
26
- React.ReactElement[] | React.ReactElement | ((...args: any[]) => any);
85
+ /**
86
+ * If a trigger is supplied, should the `<Menu />` hide when an item is selected
87
+ */
27
88
  shouldHideOnSelect?: boolean;
89
+ /**
90
+ * If a trigger is supplied, should the `<Menu />` focus the trigger on after closing
91
+ */
28
92
  shouldFocusTriggerOnClose?: boolean;
93
+ /**
94
+ * The type of `<Menu />`
95
+ */
29
96
  type?: 'flyout';
30
97
  id?: string;
98
+ /**
99
+ * Whether or not an arrow pointing to the trigger should be rendered
100
+ */
31
101
  withArrow?: boolean;
102
+ /**
103
+ * The horizontal offset for the positioned content.
104
+ * Works only if `trigger` is provided.
105
+ */
32
106
  offsetX?: string | number;
107
+ /**
108
+ * The vertical offset for the positioned content.
109
+ * Works only if `trigger` is provided.
110
+ */
33
111
  offsetY?: string | number;
34
112
  };
35
113
  declare type PropKeys = keyof MenuOwnProps;
36
114
  declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
37
- declare type MenuProps = MenuOwnProps & WithStyleProps<MenuTheme, MenuStyle>;
115
+ declare type MenuProps = MenuOwnProps & WithStyleProps<MenuTheme, MenuStyle> & OtherHTMLAttributes<MenuOwnProps>;
38
116
  declare type MenuStyle = ComponentStyle<'menu'>;
39
117
  declare const propTypes: PropValidators<PropKeys>;
40
118
  declare const allowedProps: AllowedPropKeys;
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Menu/props.ts"],"names":[],"mappings":";AAgCA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1E,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,0BAA0B,CAAA;AAEjC,aAAK,YAAY,GAAG;IAClB,QAAQ,CAAC,EA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MenuContext
7
8
  **/
8
9
  declare const MenuContext: import("react").Context<{
9
- registerMenuItem: () => void;
10
- removeMenuItem: () => void;
10
+ registerMenuItem: (_value: MenuItem) => void;
11
+ removeMenuItem: (_value: MenuItem) => void;
11
12
  }>;
12
13
  export default MenuContext;
13
14
  export { MenuContext };
@@ -1 +1 @@
1
- {"version":3,"file":"MenuContext.d.ts","sourceRoot":"","sources":["../src/MenuContext.ts"],"names":[],"mappings":";AA0BA;;;;;GAKG;AACH,QAAA,MAAM,WAAW;;;EAGf,CAAA;AAEF,eAAe,WAAW,CAAA;AAC1B,OAAO,EAAE,WAAW,EAAE,CAAA"}
1
+ {"version":3,"file":"MenuContext.d.ts","sourceRoot":"","sources":["../src/MenuContext.ts"],"names":[],"mappings":";AAyBA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE1C;;;;;GAKG;AACH,QAAA,MAAM,WAAW;+BACY,QAAQ;6BACV,QAAQ;EACjC,CAAA;AAEF,eAAe,WAAW,CAAA;AAC1B,OAAO,EAAE,WAAW,EAAE,CAAA"}
package/LICENSE.md DELETED
@@ -1,27 +0,0 @@
1
- ---
2
- title: The MIT License (MIT)
3
- category: Getting Started
4
- order: 9
5
- ---
6
-
7
- # The MIT License (MIT)
8
-
9
- Copyright (c) 2015 Instructure, Inc.
10
-
11
- **Permission is hereby granted, free of charge, to any person obtaining a copy
12
- of this software and associated documentation files (the "Software"), to deal
13
- in the Software without restriction, including without limitation the rights
14
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- copies of the Software, and to permit persons to whom the Software is
16
- furnished to do so, subject to the following conditions.**
17
-
18
- The above copyright notice and this permission notice shall be included in all
19
- copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
- SOFTWARE.