@patternfly/react-core 4.202.33 → 4.202.36
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/CHANGELOG.md +27 -0
- package/dist/esm/components/ApplicationLauncher/ApplicationLauncher.d.ts +9 -2
- package/dist/esm/components/ApplicationLauncher/ApplicationLauncher.d.ts.map +1 -1
- package/dist/esm/components/ApplicationLauncher/ApplicationLauncher.js.map +1 -1
- package/dist/esm/components/Brand/Brand.d.ts +23 -3
- package/dist/esm/components/Brand/Brand.d.ts.map +1 -1
- package/dist/esm/components/Brand/Brand.js +12 -2
- package/dist/esm/components/Brand/Brand.js.map +1 -1
- package/dist/esm/components/ContextSelector/ContextSelector.d.ts +10 -2
- package/dist/esm/components/ContextSelector/ContextSelector.d.ts.map +1 -1
- package/dist/esm/components/ContextSelector/ContextSelector.js +3 -2
- package/dist/esm/components/ContextSelector/ContextSelector.js.map +1 -1
- package/dist/esm/components/ContextSelector/ContextSelectorToggle.js +3 -3
- package/dist/esm/components/ContextSelector/ContextSelectorToggle.js.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.d.ts +9 -2
- package/dist/esm/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.js +2 -2
- package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/components/OptionsMenu/OptionsMenu.d.ts +9 -2
- package/dist/esm/components/OptionsMenu/OptionsMenu.d.ts.map +1 -1
- package/dist/esm/components/OptionsMenu/OptionsMenu.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts +9 -2
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.d.ts +2 -0
- package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/esm/components/Tabs/Tabs.js +3 -2
- package/dist/esm/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/helpers/Popper/Popper.d.ts +0 -10
- package/dist/esm/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/esm/helpers/Popper/Popper.js.map +1 -1
- package/dist/js/components/ApplicationLauncher/ApplicationLauncher.d.ts +9 -2
- package/dist/js/components/ApplicationLauncher/ApplicationLauncher.d.ts.map +1 -1
- package/dist/js/components/ApplicationLauncher/ApplicationLauncher.js.map +1 -1
- package/dist/js/components/Brand/Brand.d.ts +23 -3
- package/dist/js/components/Brand/Brand.d.ts.map +1 -1
- package/dist/js/components/Brand/Brand.js +12 -2
- package/dist/js/components/Brand/Brand.js.map +1 -1
- package/dist/js/components/ContextSelector/ContextSelector.d.ts +10 -2
- package/dist/js/components/ContextSelector/ContextSelector.d.ts.map +1 -1
- package/dist/js/components/ContextSelector/ContextSelector.js +3 -2
- package/dist/js/components/ContextSelector/ContextSelector.js.map +1 -1
- package/dist/js/components/ContextSelector/ContextSelectorToggle.js +3 -3
- package/dist/js/components/ContextSelector/ContextSelectorToggle.js.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.d.ts +9 -2
- package/dist/js/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.js +2 -2
- package/dist/js/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/js/components/OptionsMenu/OptionsMenu.d.ts +9 -2
- package/dist/js/components/OptionsMenu/OptionsMenu.d.ts.map +1 -1
- package/dist/js/components/OptionsMenu/OptionsMenu.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts +9 -2
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/components/Tabs/Tabs.d.ts +2 -0
- package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/js/components/Tabs/Tabs.js +3 -2
- package/dist/js/components/Tabs/Tabs.js.map +1 -1
- package/dist/js/helpers/Popper/Popper.d.ts +0 -10
- package/dist/js/helpers/Popper/Popper.d.ts.map +1 -1
- package/dist/js/helpers/Popper/Popper.js.map +1 -1
- package/dist/umd/react-core.css +64 -0
- package/dist/umd/react-core.js +152 -130
- package/dist/umd/react-core.min.css +64 -0
- package/dist/umd/react-core.min.js +4 -4
- package/package.json +5 -5
- package/src/components/ApplicationLauncher/ApplicationLauncher.tsx +9 -2
- package/src/components/Brand/Brand.tsx +61 -8
- package/src/components/Brand/__tests__/Brand.test.tsx +15 -4
- package/src/components/Brand/__tests__/__snapshots__/Brand.test.tsx.snap +1 -1
- package/src/components/Brand/examples/Brand.md +13 -0
- package/src/components/Brand/examples/BrandResponsive.tsx +18 -0
- package/src/components/Brand/examples/pf-c-brand--logo-base.jpg +0 -0
- package/src/components/Brand/examples/pf-c-brand--logo-on-lg.svg +32 -0
- package/src/components/Brand/examples/pf-c-brand--logo-on-md.svg +42 -0
- package/src/components/Brand/examples/pf-c-brand--logo-on-sm.svg +17 -0
- package/src/components/Brand/examples/pf-c-brand--logo-on-xl.svg +39 -0
- package/src/components/Brand/examples/pf-c-brand--logo.svg +10 -0
- package/src/components/ContextSelector/ContextSelector.tsx +12 -4
- package/src/components/ContextSelector/ContextSelectorToggle.tsx +3 -3
- package/src/components/Dropdown/Dropdown.tsx +11 -3
- package/src/components/OptionsMenu/OptionsMenu.tsx +9 -2
- package/src/components/Select/Select.tsx +10 -3
- package/src/components/Tabs/Tabs.tsx +5 -0
- package/src/components/Tabs/__tests__/Tabs.test.tsx +17 -0
- package/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +153 -0
- package/src/components/TextInputGroup/__tests__/TextInputGroup.test.tsx +47 -146
- package/src/components/TextInputGroup/__tests__/TextInputGroupMain.test.tsx +302 -0
- package/src/components/TextInputGroup/__tests__/TextInputGroupUtilities.test.tsx +34 -0
- package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroup.test.tsx.snap +2 -203
- package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroupMain.test.tsx.snap +21 -0
- package/src/components/TextInputGroup/__tests__/__snapshots__/TextInputGroupUtilities.test.tsx.snap +13 -0
- package/src/demos/Tabs.md +5 -0
- package/src/demos/examples/Tabs/TabsAndTablesAutoWidthTabs.tsx +442 -0
- package/src/helpers/Popper/Popper.tsx +0 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.202.
|
|
3
|
+
"version": "4.202.36",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.53.
|
|
38
|
-
"@patternfly/react-styles": "^4.52.
|
|
39
|
-
"@patternfly/react-tokens": "^4.54.
|
|
37
|
+
"@patternfly/react-icons": "^4.53.36",
|
|
38
|
+
"@patternfly/react-styles": "^4.52.36",
|
|
39
|
+
"@patternfly/react-tokens": "^4.54.36",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "f420c8cb16012a862440e821fb17102093bc57cd"
|
|
64
64
|
}
|
|
@@ -9,10 +9,9 @@ import { ApplicationLauncherGroup } from './ApplicationLauncherGroup';
|
|
|
9
9
|
import { ApplicationLauncherSeparator } from './ApplicationLauncherSeparator';
|
|
10
10
|
import { ApplicationLauncherItem } from './ApplicationLauncherItem';
|
|
11
11
|
import { ApplicationLauncherContext } from './ApplicationLauncherContext';
|
|
12
|
-
import { ToggleMenuBaseProps } from '../../helpers/Popper/Popper';
|
|
13
12
|
import { createRenderableFavorites, extendItemsWithFavorite } from '../../helpers/favorites';
|
|
14
13
|
|
|
15
|
-
export interface ApplicationLauncherProps extends
|
|
14
|
+
export interface ApplicationLauncherProps extends React.HTMLProps<HTMLDivElement> {
|
|
16
15
|
/** Additional element css classes */
|
|
17
16
|
className?: string;
|
|
18
17
|
/** Display menu above or below dropdown toggle */
|
|
@@ -35,6 +34,14 @@ export interface ApplicationLauncherProps extends ToggleMenuBaseProps, React.HTM
|
|
|
35
34
|
isGrouped?: boolean;
|
|
36
35
|
/** Toggle Icon, optional to override the icon used for the toggle */
|
|
37
36
|
toggleIcon?: React.ReactNode;
|
|
37
|
+
/** The container to append the menu to. Defaults to 'inline'.
|
|
38
|
+
* If your menu is being cut off you can append it to an element higher up the DOM tree.
|
|
39
|
+
* Some examples:
|
|
40
|
+
* menuAppendTo="parent"
|
|
41
|
+
* menuAppendTo={() => document.body}
|
|
42
|
+
* menuAppendTo={document.getElementById('target')}
|
|
43
|
+
*/
|
|
44
|
+
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
|
|
38
45
|
/** ID list of favorited ApplicationLauncherItems */
|
|
39
46
|
favorites?: string[];
|
|
40
47
|
/** Enables favorites. Callback called when an ApplicationLauncherItem's favorite button is clicked */
|
|
@@ -1,18 +1,71 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { css } from '@patternfly/react-styles';
|
|
3
|
-
|
|
3
|
+
import styles from '@patternfly/react-styles/css/components/Brand/brand';
|
|
4
|
+
import { setBreakpointCssVars } from '../../helpers';
|
|
4
5
|
export interface BrandProps
|
|
5
6
|
extends React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement> {
|
|
6
|
-
/**
|
|
7
|
+
/** Transforms the Brand into a <picture> element from an <img> element. Container for <source> child elements. */
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
/** Additional classes added to the either type of Brand. */
|
|
7
10
|
className?: string;
|
|
8
|
-
/** Attribute that specifies the URL of
|
|
11
|
+
/** Attribute that specifies the URL of a <img> Brand. For a <picture> Brand this specifies the fallback <img> URL. */
|
|
9
12
|
src?: string;
|
|
10
|
-
/** Attribute that specifies the alt text of
|
|
13
|
+
/** Attribute that specifies the alt text of a <img> Brand. For a <picture> Brand this specifies the fallback <img> alt text. */
|
|
11
14
|
alt: string;
|
|
15
|
+
/** Widths at various breakpoints for a <picture> Brand. */
|
|
16
|
+
widths?: {
|
|
17
|
+
default?: string;
|
|
18
|
+
sm?: string;
|
|
19
|
+
md?: string;
|
|
20
|
+
lg?: string;
|
|
21
|
+
xl?: string;
|
|
22
|
+
'2xl'?: string;
|
|
23
|
+
};
|
|
24
|
+
/** Heights at various breakpoints for a <picture> Brand. */
|
|
25
|
+
heights?: {
|
|
26
|
+
default?: string;
|
|
27
|
+
sm?: string;
|
|
28
|
+
md?: string;
|
|
29
|
+
lg?: string;
|
|
30
|
+
xl?: string;
|
|
31
|
+
'2xl'?: string;
|
|
32
|
+
};
|
|
12
33
|
}
|
|
13
34
|
|
|
14
|
-
export const Brand: React.FunctionComponent<BrandProps> = ({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
35
|
+
export const Brand: React.FunctionComponent<BrandProps> = ({
|
|
36
|
+
className = '',
|
|
37
|
+
src = '',
|
|
38
|
+
alt,
|
|
39
|
+
children,
|
|
40
|
+
widths,
|
|
41
|
+
heights,
|
|
42
|
+
style,
|
|
43
|
+
...props
|
|
44
|
+
}: BrandProps) => {
|
|
45
|
+
if (children !== undefined && widths !== undefined) {
|
|
46
|
+
style = {
|
|
47
|
+
...style,
|
|
48
|
+
...setBreakpointCssVars(widths, '--pf-c-brand--Width')
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (children !== undefined && heights !== undefined) {
|
|
53
|
+
style = {
|
|
54
|
+
...style,
|
|
55
|
+
...setBreakpointCssVars(heights, '--pf-c-brand--Height')
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
/** the brand component currently contains no styling the 'pf-c-brand' string will be used for the className */
|
|
61
|
+
children !== undefined ? (
|
|
62
|
+
<picture className={css(styles.brand, styles.modifiers.picture, className)} style={style} {...props}>
|
|
63
|
+
{children}
|
|
64
|
+
<img src={src} alt={alt} />
|
|
65
|
+
</picture>
|
|
66
|
+
) : (
|
|
67
|
+
<img {...props} className={css(styles.brand, className)} src={src} alt={alt} />
|
|
68
|
+
)
|
|
69
|
+
);
|
|
70
|
+
};
|
|
18
71
|
Brand.displayName = 'Brand';
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
3
|
import { Brand } from '../Brand';
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
describe('Brand', () => {
|
|
7
|
+
test('simple brand', () => {
|
|
8
|
+
const view = render(<Brand alt="brand" />);
|
|
9
|
+
expect(view.container).toMatchSnapshot();
|
|
10
|
+
});
|
|
11
|
+
test('passing children creates picture brand', () => {
|
|
12
|
+
const view = render(
|
|
13
|
+
<Brand>
|
|
14
|
+
<div>test</div>
|
|
15
|
+
</Brand>
|
|
16
|
+
);
|
|
17
|
+
expect(screen.getByText('test')).toBeInTheDocument();
|
|
18
|
+
});
|
|
8
19
|
});
|
|
@@ -6,6 +6,12 @@ propComponents: ['Brand']
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
import pfLogo from './pfLogo.svg';
|
|
9
|
+
import logoXl from './pf-c-brand--logo-on-xl.svg';
|
|
10
|
+
import logoLg from './pf-c-brand--logo-on-lg.svg';
|
|
11
|
+
import logoMd from './pf-c-brand--logo-on-md.svg';
|
|
12
|
+
import logoSm from './pf-c-brand--logo-on-sm.svg';
|
|
13
|
+
import logo from './pf-c-brand--logo.svg';
|
|
14
|
+
import logoBase from './pf-c-brand--logo-base.jpg';
|
|
9
15
|
|
|
10
16
|
## Examples
|
|
11
17
|
|
|
@@ -13,3 +19,10 @@ import pfLogo from './pfLogo.svg';
|
|
|
13
19
|
|
|
14
20
|
```ts file="./BrandBasic.tsx"
|
|
15
21
|
```
|
|
22
|
+
|
|
23
|
+
### Responsive
|
|
24
|
+
|
|
25
|
+
Passing `<source>` elements as children to `Brand` will change the component from an `<img>` to a `<picture>` element. In this form, breakpoint modifiers for width and height may be passed to `Brand`. The `src` and `alt` properties should still be passed to populate the fallback `img` of the brand.
|
|
26
|
+
|
|
27
|
+
```ts file="./BrandResponsive.tsx"
|
|
28
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Brand } from '@patternfly/react-core';
|
|
3
|
+
import logoXl from './pf-c-brand--logo-on-xl.svg';
|
|
4
|
+
import logoLg from './pf-c-brand--logo-on-lg.svg';
|
|
5
|
+
import logoMd from './pf-c-brand--logo-on-md.svg';
|
|
6
|
+
import logoSm from './pf-c-brand--logo-on-sm.svg';
|
|
7
|
+
import logo from './pf-c-brand--logo.svg';
|
|
8
|
+
import logoBase from './pf-c-brand--logo-base.jpg';
|
|
9
|
+
|
|
10
|
+
export const BrandBasic: React.FunctionComponent = () => (
|
|
11
|
+
<Brand src={logoBase} alt="Fallback patternfly default logo" widths={{ default: '40px', sm: '60px', md: '220px' }}>
|
|
12
|
+
<source media="(min-width: 1200px)" srcSet={logoXl} />
|
|
13
|
+
<source media="(min-width: 992px)" srcSet={logoLg} />
|
|
14
|
+
<source media="(min-width: 768px)" srcSet={logoMd} />
|
|
15
|
+
<source media="(min-width: 576px)" srcSet={logoSm} />
|
|
16
|
+
<source srcSet={logo} />
|
|
17
|
+
</Brand>
|
|
18
|
+
);
|
|
Binary file
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 24.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
+
viewBox="0 0 220 40" style="enable-background:new 0 0 220 40;" xml:space="preserve">
|
|
5
|
+
<g>
|
|
6
|
+
<path d="M56.4,25.7V14.4h4.8c0.7,0,1.3,0.1,1.8,0.3c0.5,0.2,0.9,0.5,1.2,0.8c0.3,0.3,0.5,0.7,0.7,1.1c0.1,0.4,0.2,0.9,0.2,1.3
|
|
7
|
+
c0,0.3,0,0.5-0.1,0.8c-0.1,0.3-0.2,0.6-0.3,0.8c-0.1,0.3-0.3,0.5-0.5,0.7c-0.2,0.2-0.5,0.4-0.7,0.6c-0.3,0.2-0.6,0.3-1,0.4
|
|
8
|
+
c-0.4,0.1-0.8,0.1-1.2,0.1h-2.7v4.1L56.4,25.7L56.4,25.7z M61.3,19.5c0.3,0,0.5,0,0.7-0.1c0.2-0.1,0.3-0.2,0.5-0.3
|
|
9
|
+
c0.1-0.1,0.2-0.3,0.3-0.5c0.1-0.2,0.1-0.4,0.1-0.5c0-0.2,0-0.3-0.1-0.5c0-0.2-0.1-0.3-0.2-0.5c-0.1-0.1-0.3-0.3-0.5-0.4
|
|
10
|
+
c-0.2-0.1-0.4-0.1-0.7-0.1h-2.8v3L61.3,19.5L61.3,19.5z"/>
|
|
11
|
+
<path d="M80.1,25.7l-0.9-2.3h-4.4L74,25.7h-2.3L76,14.4h2.1l4.3,11.3H80.1z M77.4,18.4c-0.1-0.1-0.1-0.3-0.2-0.5
|
|
12
|
+
c-0.1-0.2-0.1-0.4-0.2-0.5c0,0.2-0.1,0.3-0.2,0.5c-0.1,0.2-0.1,0.4-0.2,0.5l-1.1,2.9h2.9L77.4,18.4z"/>
|
|
13
|
+
<path d="M94.7,16.5v9.2h-2.2v-9.2h-3.2v-2.1h8.6v2.1H94.7z"/>
|
|
14
|
+
<path d="M111.6,16.5v9.2h-2.2v-9.2h-3.2v-2.1h8.6v2.1H111.6z"/>
|
|
15
|
+
<path d="M123.8,25.7V14.4h7.7v2.1h-5.5v2.4h3.2v2.1h-3.2v2.7h5.9v2.1L123.8,25.7L123.8,25.7z"/>
|
|
16
|
+
<path d="M141,25.7V14.4h5.2c0.7,0,1.3,0.1,1.8,0.3c0.5,0.2,0.9,0.5,1.2,0.8c0.3,0.3,0.5,0.7,0.6,1.1c0.1,0.4,0.2,0.9,0.2,1.3
|
|
17
|
+
c0,0.3,0,0.6-0.1,1c-0.1,0.3-0.2,0.6-0.4,0.9c-0.2,0.3-0.4,0.6-0.7,0.8c-0.3,0.2-0.6,0.4-1,0.6l2.2,4.5h-2.4l-2.1-4.2h-2.3v4.2H141
|
|
18
|
+
z M146.2,19.4c0.3,0,0.5,0,0.7-0.1c0.2-0.1,0.3-0.2,0.5-0.3c0.1-0.1,0.2-0.3,0.2-0.5c0.1-0.2,0.1-0.4,0.1-0.6c0-0.2,0-0.4-0.1-0.5
|
|
19
|
+
c0-0.2-0.1-0.3-0.2-0.5c-0.1-0.1-0.3-0.2-0.5-0.3s-0.4-0.1-0.7-0.1h-3.1v2.9L146.2,19.4L146.2,19.4L146.2,19.4z"/>
|
|
20
|
+
<path d="M166.3,25.7l-4.5-6.6c-0.1-0.1-0.2-0.2-0.2-0.4c-0.1-0.2-0.2-0.3-0.2-0.4c0,0.1,0,0.3,0,0.4c0,0.2,0,0.3,0,0.4v6.6h-2.2
|
|
21
|
+
V14.4h2l4.4,6.5c0.1,0.1,0.1,0.2,0.2,0.4c0.1,0.2,0.2,0.3,0.2,0.5c0-0.1,0-0.3,0-0.5c0-0.2,0-0.3,0-0.4v-6.5h2.2v11.3L166.3,25.7
|
|
22
|
+
L166.3,25.7z"/>
|
|
23
|
+
<path d="M178,25.7V14.4h7.6v2.1h-5.4v2.4h3.4v2.1h-3.4v4.8L178,25.7L178,25.7z"/>
|
|
24
|
+
<path d="M194.4,25.7V14.4h2.2v9.2h5.4v2.1H194.4z"/>
|
|
25
|
+
<path d="M212.4,25.7v-4.4l-4.2-6.9h2.5l2.8,4.6l2.8-4.6h2.5l-4.2,6.9v4.4H212.4z"/>
|
|
26
|
+
</g>
|
|
27
|
+
<path d="M41.9,20.7L21,0.2L0,20.7l8.4,11.8l6.4-1.5l6.3,8.8l6.3-8.8l6.3,1.4L41.9,20.7z M20.1,4l-2.7,25.1L12.2,22L20.1,4z
|
|
28
|
+
M11.6,21.2l-3.2-4.4L19.5,3.3L11.6,21.2z M16.5,29.3L16.5,29.3l0.3,0.4l-1.7,0.4l-4-5.6l0.7-1.6L16.5,29.3z M21,3.7l2.7,26.6L21,34
|
|
29
|
+
l-2.7-3.7L21,3.7z M25.4,29.3l4.8-6.5l0.7,1.7l-4,5.6l-1.8-0.4L25.4,29.3L25.4,29.3z M24.6,29.1L21.9,4l7.9,18L24.6,29.1z M22.5,3.3
|
|
30
|
+
l11,13.5l-3.2,4.3L22.5,3.3z M8.7,31.6L1.1,20.8L16,6.2L7.3,16.8l3.9,5.3l-1.1,2.5l4.1,5.7L8.7,31.6z M21,38.5l-5.4-7.6l1.7-0.4
|
|
31
|
+
l3.6,5l3.6-5l1.8,0.4L21,38.5z M27.8,30.4l4.1-5.7l-1.1-2.6l3.8-5.2L25.9,6.2l14.9,14.6l-7.6,10.8L27.8,30.4z"/>
|
|
32
|
+
</svg>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 24.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
+
viewBox="0 0 232.3 105.8" style="enable-background:new 0 0 232.3 105.8;" xml:space="preserve">
|
|
5
|
+
<style type="text/css">
|
|
6
|
+
.st0{fill:url(#SVGID_1_);}
|
|
7
|
+
.st1{fill:#030303;}
|
|
8
|
+
</style>
|
|
9
|
+
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="116.0373" y1="-7.7376" x2="116.0373" y2="65.5427" gradientTransform="matrix(1 0 0 1 0 10)">
|
|
10
|
+
<stop offset="0" style="stop-color:#60EFFF"/>
|
|
11
|
+
<stop offset="1" style="stop-color:#1F89C7"/>
|
|
12
|
+
</linearGradient>
|
|
13
|
+
<path class="st0" d="M158,40.8L116-0.1l-42,40.9l16.9,23.7l12.9-2.9L116,79.2l12.6-17.6l12.6,2.9L158,40.8z M114.2,7.4l-5.4,50.2
|
|
14
|
+
L98.5,43.3L114.2,7.4z M97.4,41.9l-6.5-8.6l22.2-26.9L97.4,41.9z M107.1,58L107.1,58l0.7,0.7l-3.6,0.7l-7.9-11.1l1.4-3.2L107.1,58z
|
|
15
|
+
M116,6.7l5.4,53.1l-5.4,7.5l-5.4-7.5L116,6.7z M125,58l9.7-12.9l1.4,3.2l-7.9,11.1l-3.6-0.7L125,58L125,58z M123.2,57.7l-5.4-50.2
|
|
16
|
+
l15.8,35.9L123.2,57.7z M119.3,6l21.9,27.3l-6.5,8.6L119.3,6z M91.6,62.7L76.6,41.2l29.8-29.1L89.1,33.3L97,44l-2.5,4.7l8.3,11.5
|
|
17
|
+
L91.6,62.7z M116,76.3l-10.8-15.1l3.6-0.7l7.2,10l7.2-10l3.6,0.7L116,76.3z M129.7,60.2l8.3-11.5l-2.2-5l7.5-10.4l-17.2-21.2
|
|
18
|
+
l29.8,29.1l-15.1,21.5L129.7,60.2z"/>
|
|
19
|
+
<g>
|
|
20
|
+
<path class="st1" d="M1.1,104.7v-16H8c1,0,1.9,0.1,2.5,0.5s1.3,0.7,1.7,1.2c0.5,0.5,0.7,1,0.9,1.6c0.2,0.6,0.3,1.2,0.3,1.8
|
|
21
|
+
c0,0.4,0,0.8-0.1,1.2c-0.1,0.4-0.2,0.8-0.4,1.2c-0.2,0.4-0.4,0.7-0.7,1c-0.3,0.3-0.6,0.6-1,0.9c-0.4,0.2-0.9,0.5-1.4,0.6
|
|
22
|
+
c-0.5,0.1-1.1,0.2-1.8,0.2H4.2v5.9L1.1,104.7L1.1,104.7z M8.1,95.9c0.4,0,0.7,0,1-0.2c0.3-0.1,0.5-0.3,0.6-0.5
|
|
23
|
+
c0.2-0.2,0.3-0.4,0.4-0.7c0.1-0.3,0.1-0.5,0.1-0.8c0-0.2,0-0.5-0.1-0.7c0-0.2-0.2-0.5-0.3-0.7c-0.2-0.2-0.4-0.4-0.6-0.5
|
|
24
|
+
c-0.3-0.1-0.6-0.2-1-0.2H4.3v4.3L8.1,95.9L8.1,95.9z"/>
|
|
25
|
+
<path class="st1" d="M34.8,104.7l-1.2-3.3h-6.1l-1.2,3.3h-3.3l6.1-16h3l6.1,16H34.8z M31,94.5c-0.1-0.2-0.2-0.4-0.3-0.7
|
|
26
|
+
c-0.1-0.3-0.2-0.5-0.2-0.8c0,0.2-0.1,0.5-0.2,0.8c-0.1,0.3-0.2,0.5-0.3,0.7l-1.6,4.2h4.2L31,94.5z"/>
|
|
27
|
+
<path class="st1" d="M55.4,91.7v13h-3.1v-13h-4.6v-3H60v3H55.4z"/>
|
|
28
|
+
<path class="st1" d="M79.3,91.7v13h-3.1v-13h-4.6v-3h12.2v3H79.3z"/>
|
|
29
|
+
<path class="st1" d="M96.7,104.7v-16h10.9v2.9h-7.8V95h4.6V98h-4.6v3.8h8.3v2.9L96.7,104.7L96.7,104.7z"/>
|
|
30
|
+
<path class="st1" d="M121,104.7v-16h7.4c1,0,1.9,0.1,2.5,0.4c0.7,0.3,1.2,0.6,1.6,1.1c0.4,0.5,0.7,1,0.9,1.6
|
|
31
|
+
c0.2,0.6,0.3,1.2,0.3,1.9c0,0.5,0,0.9-0.2,1.4c-0.1,0.5-0.3,0.9-0.6,1.3c-0.3,0.4-0.6,0.8-0.9,1.1c-0.4,0.3-0.8,0.6-1.4,0.8
|
|
32
|
+
l3.1,6.4h-3.5l-3-6h-3.2v6C124.1,104.7,121,104.7,121,104.7z M128.5,95.9c0.4,0,0.7,0,1-0.2c0.3-0.1,0.5-0.3,0.6-0.5
|
|
33
|
+
c0.2-0.2,0.3-0.4,0.4-0.7c0.1-0.3,0.1-0.5,0.1-0.8c0-0.3,0-0.5-0.1-0.8c0-0.3-0.2-0.5-0.3-0.7c-0.1-0.2-0.4-0.4-0.6-0.5
|
|
34
|
+
c-0.3-0.1-0.6-0.2-1-0.2h-4.4v4.2C124.1,95.9,128.5,95.9,128.5,95.9z"/>
|
|
35
|
+
<path class="st1" d="M157,104.7l-6.3-9.3c-0.1-0.1-0.2-0.4-0.4-0.6c-0.1-0.2-0.2-0.5-0.3-0.6c0,0.2,0,0.4,0,0.6c0,0.2,0,0.5,0,0.6
|
|
36
|
+
v9.3h-3.1V88.8h2.9L156,98c0.1,0.1,0.2,0.3,0.3,0.5c0.1,0.2,0.2,0.5,0.3,0.6c0-0.2,0-0.5,0-0.6c0-0.2,0-0.4,0-0.5v-9.2h3.1v16
|
|
37
|
+
L157,104.7L157,104.7z"/>
|
|
38
|
+
<path class="st1" d="M173.5,104.7v-16h10.7v2.9h-7.6V95h4.9V98h-4.8v6.8L173.5,104.7L173.5,104.7z"/>
|
|
39
|
+
<path class="st1" d="M196.7,104.7v-16h3.1v13h7.7v3L196.7,104.7L196.7,104.7z"/>
|
|
40
|
+
<path class="st1" d="M222.3,104.7v-6.2l-5.9-9.8h3.5l3.9,6.6l3.9-6.6h3.5l-5.9,9.8v6.2L222.3,104.7L222.3,104.7z"/>
|
|
41
|
+
</g>
|
|
42
|
+
</svg>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 24.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
+
viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
|
|
5
|
+
<style type="text/css">
|
|
6
|
+
.st0{fill:url(#SVGID_1_);}
|
|
7
|
+
</style>
|
|
8
|
+
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="12" y1="24.491" x2="12" y2="4.0278" gradientTransform="matrix(1 0 0 -1 0 26)">
|
|
9
|
+
<stop offset="0" style="stop-color:#60EFFF"/>
|
|
10
|
+
<stop offset="1" style="stop-color:#1F89C7"/>
|
|
11
|
+
</linearGradient>
|
|
12
|
+
<path class="st0" d="M23.7,12.3L12,0.8L0.3,12.3L5,18.9l3.6-0.8L12,23l3.5-4.9l3.5,0.8L23.7,12.3z M11.5,3L10,17L7.1,13L11.5,3z
|
|
13
|
+
M6.8,12.6L5,10.1l6.2-7.5L6.8,12.6z M9.5,17.1L9.5,17.1l0.2,0.2l-1,0.2l-2.2-3.1l0.4-0.9L9.5,17.1z M12,2.8l1.5,14.9L12,19.7
|
|
14
|
+
l-1.5-2.1L12,2.8z M14.5,17.1l2.7-3.6l0.4,0.9l-2.2,3.1l-1-0.2L14.5,17.1L14.5,17.1z M14,17l-1.5-14l4.4,10L14,17z M12.9,2.6
|
|
15
|
+
l6.2,7.5l-1.8,2.4L12.9,2.6z M5.2,18.4l-4.3-6l8.3-8.1l-4.8,5.9l2.2,3L6,14.5l2.3,3.2L5.2,18.4z M12,22.2L9,18l1-0.2l2,2.8l2-2.8
|
|
16
|
+
l1,0.2L12,22.2z M15.8,17.7l2.3-3.2L17.5,13l2.1-2.9l-4.8-5.9l8.3,8.1l-4.3,6L15.8,17.7z"/>
|
|
17
|
+
</svg>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 24.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
+
viewBox="0 0 220 40" style="enable-background:new 0 0 220 40;" xml:space="preserve">
|
|
5
|
+
<style type="text/css">
|
|
6
|
+
.st0{fill:url(#SVGID_1_);}
|
|
7
|
+
</style>
|
|
8
|
+
<g>
|
|
9
|
+
<path d="M56.4,25.7V14.4h4.8c0.7,0,1.3,0.1,1.8,0.3c0.5,0.2,0.9,0.5,1.2,0.8c0.3,0.3,0.5,0.7,0.7,1.1c0.1,0.4,0.2,0.9,0.2,1.3
|
|
10
|
+
c0,0.3,0,0.5-0.1,0.8c-0.1,0.3-0.2,0.6-0.3,0.8c-0.1,0.3-0.3,0.5-0.5,0.7c-0.2,0.2-0.5,0.4-0.7,0.6c-0.3,0.2-0.6,0.3-1,0.4
|
|
11
|
+
c-0.4,0.1-0.8,0.1-1.2,0.1h-2.7v4.1L56.4,25.7L56.4,25.7z M61.3,19.5c0.3,0,0.5,0,0.7-0.1c0.2-0.1,0.3-0.2,0.5-0.3
|
|
12
|
+
c0.1-0.1,0.2-0.3,0.3-0.5c0.1-0.2,0.1-0.4,0.1-0.5c0-0.2,0-0.3-0.1-0.5c0-0.2-0.1-0.3-0.2-0.5c-0.1-0.1-0.3-0.3-0.5-0.4
|
|
13
|
+
c-0.2-0.1-0.4-0.1-0.7-0.1h-2.8v3L61.3,19.5L61.3,19.5z"/>
|
|
14
|
+
<path d="M80.1,25.7l-0.9-2.3h-4.4L74,25.7h-2.3L76,14.4h2.1l4.3,11.3H80.1z M77.4,18.4c-0.1-0.1-0.1-0.3-0.2-0.5
|
|
15
|
+
c-0.1-0.2-0.1-0.4-0.2-0.5c0,0.2-0.1,0.3-0.2,0.5c-0.1,0.2-0.1,0.4-0.2,0.5l-1.1,2.9h2.9L77.4,18.4z"/>
|
|
16
|
+
<path d="M94.7,16.5v9.2h-2.2v-9.2h-3.2v-2.1h8.6v2.1H94.7z"/>
|
|
17
|
+
<path d="M111.6,16.5v9.2h-2.2v-9.2h-3.2v-2.1h8.6v2.1H111.6z"/>
|
|
18
|
+
<path d="M123.8,25.7V14.4h7.7v2.1h-5.5v2.4h3.2v2.1h-3.2v2.7h5.9v2.1L123.8,25.7L123.8,25.7z"/>
|
|
19
|
+
<path d="M141,25.7V14.4h5.2c0.7,0,1.3,0.1,1.8,0.3c0.5,0.2,0.9,0.5,1.2,0.8c0.3,0.3,0.5,0.7,0.6,1.1c0.1,0.4,0.2,0.9,0.2,1.3
|
|
20
|
+
c0,0.3,0,0.6-0.1,1c-0.1,0.3-0.2,0.6-0.4,0.9c-0.2,0.3-0.4,0.6-0.7,0.8c-0.3,0.2-0.6,0.4-1,0.6l2.2,4.5h-2.4l-2.1-4.2h-2.3v4.2H141
|
|
21
|
+
z M146.2,19.4c0.3,0,0.5,0,0.7-0.1c0.2-0.1,0.3-0.2,0.5-0.3c0.1-0.1,0.2-0.3,0.2-0.5c0.1-0.2,0.1-0.4,0.1-0.6c0-0.2,0-0.4-0.1-0.5
|
|
22
|
+
c0-0.2-0.1-0.3-0.2-0.5c-0.1-0.1-0.3-0.2-0.5-0.3s-0.4-0.1-0.7-0.1h-3.1v2.9L146.2,19.4L146.2,19.4L146.2,19.4z"/>
|
|
23
|
+
<path d="M166.3,25.7l-4.5-6.6c-0.1-0.1-0.2-0.2-0.2-0.4c-0.1-0.2-0.2-0.3-0.2-0.4c0,0.1,0,0.3,0,0.4c0,0.2,0,0.3,0,0.4v6.6h-2.2
|
|
24
|
+
V14.4h2l4.4,6.5c0.1,0.1,0.1,0.2,0.2,0.4c0.1,0.2,0.2,0.3,0.2,0.5c0-0.1,0-0.3,0-0.5c0-0.2,0-0.3,0-0.4v-6.5h2.2v11.3L166.3,25.7
|
|
25
|
+
L166.3,25.7z"/>
|
|
26
|
+
<path d="M178,25.7V14.4h7.6v2.1h-5.4v2.4h3.4v2.1h-3.4v4.8L178,25.7L178,25.7z"/>
|
|
27
|
+
<path d="M194.4,25.7V14.4h2.2v9.2h5.4v2.1H194.4z"/>
|
|
28
|
+
<path d="M212.4,25.7v-4.4l-4.2-6.9h2.5l2.8,4.6l2.8-4.6h2.5l-4.2,6.9v4.4H212.4z"/>
|
|
29
|
+
</g>
|
|
30
|
+
<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="20.9705" y1="40.6069" x2="20.9705" y2="3.9407" gradientTransform="matrix(1 0 0 -1 0 42)">
|
|
31
|
+
<stop offset="0" style="stop-color:#60EFFF"/>
|
|
32
|
+
<stop offset="1" style="stop-color:#1F89C7"/>
|
|
33
|
+
</linearGradient>
|
|
34
|
+
<path class="st0" d="M41.9,20.7L21,0.2L0,20.7l8.4,11.8l6.4-1.5l6.3,8.8l6.3-8.8l6.3,1.4L41.9,20.7z M20.1,4l-2.7,25.1L12.2,22
|
|
35
|
+
L20.1,4z M11.6,21.2l-3.2-4.4L19.5,3.3L11.6,21.2z M16.5,29.3L16.5,29.3l0.3,0.4l-1.7,0.4l-4-5.6l0.7-1.6L16.5,29.3z M21,3.7
|
|
36
|
+
l2.7,26.6L21,34l-2.7-3.7L21,3.7z M25.4,29.3l4.8-6.5l0.7,1.7l-4,5.6l-1.8-0.4L25.4,29.3L25.4,29.3z M24.6,29.1L21.9,4l7.9,18
|
|
37
|
+
L24.6,29.1z M22.5,3.3l11,13.5l-3.2,4.3L22.5,3.3z M8.7,31.6L1.1,20.8L16,6.2L7.3,16.8l3.9,5.3l-1.1,2.5l4.1,5.7L8.7,31.6z M21,38.5
|
|
38
|
+
l-5.4-7.6l1.7-0.4l3.6,5l3.6-5l1.8,0.4L21,38.5z M27.8,30.4l4.1-5.7l-1.1-2.6l3.8-5.2L25.9,6.2l14.9,14.6l-7.6,10.8L27.8,30.4z"/>
|
|
39
|
+
</svg>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 24.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
+
viewBox="0 0 48.4 46" style="enable-background:new 0 0 48.4 46;" xml:space="preserve">
|
|
5
|
+
<path d="M48.4,23.8L24.2,0.2L0,23.8l9.6,13.7l7.4-1.7L24.2,46l7.2-10.2l7.3,1.7L48.4,23.8z M23.2,4.6l-3.1,29l-6-8.2L23.2,4.6z
|
|
6
|
+
M13.4,24.5l-3.7-5.1L22.5,3.8L13.4,24.5z M19.1,33.8L19.1,33.8l0.3,0.5l-2,0.5l-4.6-6.5l0.8-1.9L19.1,33.8z M24.2,4.2l3.1,30.7
|
|
7
|
+
l-3.2,4.3L21,34.9L24.2,4.2z M29.3,33.8l5.5-7.5l0.9,2l-4.6,6.5L29,34.3L29.3,33.8L29.3,33.8z M28.3,33.5l-3.1-29l9.1,20.7
|
|
8
|
+
L28.3,33.5z M26,3.8l12.7,15.6l-3.7,5L26,3.8z M10.1,36.4L1.3,24L18.5,7.1l-10,12.2l4.5,6.1l-1.3,2.9l4.7,6.6L10.1,36.4z M24.2,44.3
|
|
9
|
+
L18,35.6l2-0.5l4.2,5.7l4.2-5.7l2.1,0.5L24.2,44.3z M32.1,35l4.7-6.6l-1.3-3l4.4-6l-10-12.2L47.1,24l-8.8,12.5L32.1,35z"/>
|
|
10
|
+
</svg>
|
|
@@ -10,7 +10,6 @@ import { TextInput } from '../TextInput';
|
|
|
10
10
|
import { InputGroup } from '../InputGroup';
|
|
11
11
|
import { KEY_CODES } from '../../helpers/constants';
|
|
12
12
|
import { FocusTrap } from '../../helpers';
|
|
13
|
-
import { ToggleMenuBaseProps } from '../../helpers/Popper/Popper';
|
|
14
13
|
import { Popper } from '../../helpers/Popper/Popper';
|
|
15
14
|
import { getOUIAProps, OUIAProps, getDefaultOUIAId } from '../../helpers';
|
|
16
15
|
|
|
@@ -18,7 +17,7 @@ import { getOUIAProps, OUIAProps, getDefaultOUIAId } from '../../helpers';
|
|
|
18
17
|
let currentId = 0;
|
|
19
18
|
const newId = currentId++;
|
|
20
19
|
|
|
21
|
-
export interface ContextSelectorProps extends
|
|
20
|
+
export interface ContextSelectorProps extends OUIAProps {
|
|
22
21
|
/** content rendered inside the Context Selector */
|
|
23
22
|
children?: React.ReactNode;
|
|
24
23
|
/** Classes applied to root element of Context Selector */
|
|
@@ -29,6 +28,14 @@ export interface ContextSelectorProps extends ToggleMenuBaseProps, OUIAProps {
|
|
|
29
28
|
onToggle?: (event: any, value: boolean) => void;
|
|
30
29
|
/** Function callback called when user selects item */
|
|
31
30
|
onSelect?: (event: any, value: React.ReactNode) => void;
|
|
31
|
+
/** The container to append the menu to. Defaults to 'inline'.
|
|
32
|
+
* If your menu is being cut off you can append it to an element higher up the DOM tree.
|
|
33
|
+
* Some examples:
|
|
34
|
+
* menuAppendTo="parent"
|
|
35
|
+
* menuAppendTo={() => document.body}
|
|
36
|
+
* menuAppendTo={document.getElementById('target')}
|
|
37
|
+
*/
|
|
38
|
+
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
|
|
32
39
|
/** Flag indicating that the context selector should expand to full height */
|
|
33
40
|
isFullHeight?: boolean;
|
|
34
41
|
/** Labels the Context Selector for Screen Readers */
|
|
@@ -85,6 +92,7 @@ export class ContextSelector extends React.Component<ContextSelectorProps, { oui
|
|
|
85
92
|
}
|
|
86
93
|
|
|
87
94
|
parentRef: React.RefObject<HTMLDivElement> = React.createRef();
|
|
95
|
+
popperRef: React.RefObject<HTMLDivElement> = React.createRef();
|
|
88
96
|
|
|
89
97
|
onEnterPressed = (event: any) => {
|
|
90
98
|
if (event.charCode === KEY_CODES.ENTER) {
|
|
@@ -154,7 +162,7 @@ export class ContextSelector extends React.Component<ContextSelectorProps, { oui
|
|
|
154
162
|
const popperContainer = (
|
|
155
163
|
<div
|
|
156
164
|
className={css(styles.contextSelector, isOpen && styles.modifiers.expanded, className)}
|
|
157
|
-
ref={this.
|
|
165
|
+
ref={this.popperRef}
|
|
158
166
|
{...props}
|
|
159
167
|
>
|
|
160
168
|
{isOpen && menuContainer}
|
|
@@ -182,7 +190,7 @@ export class ContextSelector extends React.Component<ContextSelectorProps, { oui
|
|
|
182
190
|
isOpen={isOpen}
|
|
183
191
|
toggleText={toggleText}
|
|
184
192
|
id={toggleId}
|
|
185
|
-
parentRef={this.parentRef.
|
|
193
|
+
parentRef={menuAppendTo === 'inline' ? this.parentRef : this.popperRef}
|
|
186
194
|
aria-labelledby={`${screenReaderLabelId} ${toggleId}`}
|
|
187
195
|
isPlain={isPlain}
|
|
188
196
|
isText={isText}
|
|
@@ -57,16 +57,16 @@ export class ContextSelectorToggle extends React.Component<ContextSelectorToggle
|
|
|
57
57
|
|
|
58
58
|
onDocClick = (event: any) => {
|
|
59
59
|
const { isOpen, parentRef, onToggle } = this.props;
|
|
60
|
-
if (isOpen && parentRef && !parentRef.contains(event.target)) {
|
|
60
|
+
if (isOpen && parentRef?.current && !parentRef.current.contains(event.target)) {
|
|
61
61
|
onToggle(null, false);
|
|
62
62
|
this.toggle.current.focus();
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
onEscPress = (event: any) => {
|
|
67
|
-
const { isOpen,
|
|
67
|
+
const { isOpen, onToggle } = this.props;
|
|
68
68
|
const keyCode = event.keyCode || event.which;
|
|
69
|
-
if (isOpen && keyCode === KEY_CODES.ESCAPE_KEY
|
|
69
|
+
if (isOpen && keyCode === KEY_CODES.ESCAPE_KEY) {
|
|
70
70
|
onToggle(null, false);
|
|
71
71
|
this.toggle.current.focus();
|
|
72
72
|
}
|
|
@@ -2,10 +2,9 @@ import * as React from 'react';
|
|
|
2
2
|
import styles from '@patternfly/react-styles/css/components/Dropdown/dropdown';
|
|
3
3
|
import { DropdownPosition, DropdownDirection, DropdownContext } from './dropdownConstants';
|
|
4
4
|
import { DropdownWithContext } from './DropdownWithContext';
|
|
5
|
-
import { ToggleMenuBaseProps } from '../../helpers/Popper/Popper';
|
|
6
5
|
import { OUIAProps, useOUIAId } from '../../helpers';
|
|
7
6
|
|
|
8
|
-
export interface DropdownProps extends
|
|
7
|
+
export interface DropdownProps extends React.HTMLProps<HTMLDivElement>, OUIAProps {
|
|
9
8
|
/** Anything which can be rendered in a dropdown */
|
|
10
9
|
children?: React.ReactNode;
|
|
11
10
|
/** Classes applied to root element of dropdown */
|
|
@@ -32,6 +31,14 @@ export interface DropdownProps extends ToggleMenuBaseProps, React.HTMLProps<HTML
|
|
|
32
31
|
};
|
|
33
32
|
/** Display menu above or below dropdown toggle */
|
|
34
33
|
direction?: DropdownDirection | 'up' | 'down';
|
|
34
|
+
/** The container to append the menu to. Defaults to 'inline'.
|
|
35
|
+
* If your menu is being cut off you can append it to an element higher up the DOM tree.
|
|
36
|
+
* Some examples:
|
|
37
|
+
* menuAppendTo="parent"
|
|
38
|
+
* menuAppendTo={() => document.body}
|
|
39
|
+
* menuAppendTo={document.getElementById('target')}
|
|
40
|
+
*/
|
|
41
|
+
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
|
|
35
42
|
/** Flag to indicate if dropdown has groups */
|
|
36
43
|
isGrouped?: boolean;
|
|
37
44
|
/** Toggle for the dropdown, examples: <DropdownToggle> or <DropdownToggleCheckbox> */
|
|
@@ -54,6 +61,7 @@ export const Dropdown: React.FunctionComponent<DropdownProps> = ({
|
|
|
54
61
|
ouiaSafe,
|
|
55
62
|
alignments,
|
|
56
63
|
contextProps,
|
|
64
|
+
menuAppendTo = 'inline',
|
|
57
65
|
...props
|
|
58
66
|
}: DropdownProps) => (
|
|
59
67
|
<DropdownContext.Provider
|
|
@@ -79,7 +87,7 @@ export const Dropdown: React.FunctionComponent<DropdownProps> = ({
|
|
|
79
87
|
...contextProps
|
|
80
88
|
}}
|
|
81
89
|
>
|
|
82
|
-
<DropdownWithContext {...props} />
|
|
90
|
+
<DropdownWithContext menuAppendTo={menuAppendTo} {...props} />
|
|
83
91
|
</DropdownContext.Provider>
|
|
84
92
|
);
|
|
85
93
|
Dropdown.displayName = 'Dropdown';
|
|
@@ -3,7 +3,6 @@ import styles from '@patternfly/react-styles/css/components/OptionsMenu/options-
|
|
|
3
3
|
import { DropdownContext } from '../Dropdown';
|
|
4
4
|
import { DropdownWithContext } from '../Dropdown/DropdownWithContext';
|
|
5
5
|
import { OUIAProps, useOUIAId } from '../../helpers';
|
|
6
|
-
import { ToggleMenuBaseProps } from '../../helpers/Popper/Popper';
|
|
7
6
|
|
|
8
7
|
export enum OptionsMenuPosition {
|
|
9
8
|
right = 'right',
|
|
@@ -15,7 +14,7 @@ export enum OptionsMenuDirection {
|
|
|
15
14
|
down = 'down'
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
export interface OptionsMenuProps extends
|
|
17
|
+
export interface OptionsMenuProps extends React.HTMLProps<HTMLDivElement>, OUIAProps {
|
|
19
18
|
/** Classes applied to root element of the options menu */
|
|
20
19
|
className?: string;
|
|
21
20
|
/** Id of the root element of the options menu */
|
|
@@ -36,6 +35,14 @@ export interface OptionsMenuProps extends ToggleMenuBaseProps, React.HTMLProps<H
|
|
|
36
35
|
position?: 'right' | 'left';
|
|
37
36
|
/** Menu will open up or open down from the options menu toggle */
|
|
38
37
|
direction?: 'up' | 'down';
|
|
38
|
+
/** The container to append the menu to. Defaults to 'inline'.
|
|
39
|
+
* If your menu is being cut off you can append it to an element higher up the DOM tree.
|
|
40
|
+
* Some examples:
|
|
41
|
+
* menuAppendTo="parent"
|
|
42
|
+
* menuAppendTo={() => document.body}
|
|
43
|
+
* menuAppendTo={document.getElementById('target')}
|
|
44
|
+
*/
|
|
45
|
+
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
|
|
39
46
|
}
|
|
40
47
|
|
|
41
48
|
export const OptionsMenu: React.FunctionComponent<OptionsMenuProps> = ({
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
} from '../../helpers';
|
|
34
34
|
import { KeyTypes } from '../../helpers/constants';
|
|
35
35
|
import { Divider } from '../Divider';
|
|
36
|
-
import {
|
|
36
|
+
import { Popper } from '../../helpers/Popper/Popper';
|
|
37
37
|
import { createRenderableFavorites, extendItemsWithFavorite } from '../../helpers/favorites';
|
|
38
38
|
import { ValidatedOptions } from '../../helpers/constants';
|
|
39
39
|
import { findTabbableElements } from '../../helpers/util';
|
|
@@ -48,8 +48,7 @@ export interface SelectViewMoreObject {
|
|
|
48
48
|
onClick: (event: React.MouseEvent | React.ChangeEvent) => void;
|
|
49
49
|
}
|
|
50
50
|
export interface SelectProps
|
|
51
|
-
extends
|
|
52
|
-
Omit<React.HTMLProps<HTMLDivElement>, 'onSelect' | 'ref' | 'checked' | 'selected'>,
|
|
51
|
+
extends Omit<React.HTMLProps<HTMLDivElement>, 'onSelect' | 'ref' | 'checked' | 'selected'>,
|
|
53
52
|
OUIAProps {
|
|
54
53
|
/** Content rendered inside the Select. Must be React.ReactElement<SelectGroupProps>[] */
|
|
55
54
|
children?: React.ReactElement[];
|
|
@@ -165,6 +164,14 @@ export interface SelectProps
|
|
|
165
164
|
shouldResetOnSelect?: boolean;
|
|
166
165
|
/** Content rendered in the footer of the select menu */
|
|
167
166
|
footer?: React.ReactNode;
|
|
167
|
+
/** The container to append the menu to. Defaults to 'inline'.
|
|
168
|
+
* If your menu is being cut off you can append it to an element higher up the DOM tree.
|
|
169
|
+
* Some examples:
|
|
170
|
+
* menuAppendTo="parent"
|
|
171
|
+
* menuAppendTo={() => document.body}
|
|
172
|
+
* menuAppendTo={document.getElementById('target')}
|
|
173
|
+
*/
|
|
174
|
+
menuAppendTo?: HTMLElement | (() => HTMLElement) | 'inline' | 'parent';
|
|
168
175
|
}
|
|
169
176
|
|
|
170
177
|
export interface SelectState {
|
|
@@ -41,6 +41,8 @@ export interface TabsProps extends Omit<React.HTMLProps<HTMLElement | HTMLDivEle
|
|
|
41
41
|
isBox?: boolean;
|
|
42
42
|
/** Enables vertical tab styling */
|
|
43
43
|
isVertical?: boolean;
|
|
44
|
+
/** Enables no border bottom tab styling */
|
|
45
|
+
hasBorderBottom?: boolean;
|
|
44
46
|
/** Aria-label for the left scroll button */
|
|
45
47
|
leftScrollAriaLabel?: string;
|
|
46
48
|
/** Aria-label for the right scroll button */
|
|
@@ -135,6 +137,7 @@ export class Tabs extends React.Component<TabsProps, TabsState> {
|
|
|
135
137
|
isSecondary: false,
|
|
136
138
|
isVertical: false,
|
|
137
139
|
isBox: false,
|
|
140
|
+
hasBorderBottom: true,
|
|
138
141
|
leftScrollAriaLabel: 'Scroll left',
|
|
139
142
|
rightScrollAriaLabel: 'Scroll right',
|
|
140
143
|
component: TabsComponent.div,
|
|
@@ -288,6 +291,7 @@ export class Tabs extends React.Component<TabsProps, TabsState> {
|
|
|
288
291
|
isSecondary,
|
|
289
292
|
isVertical,
|
|
290
293
|
isBox,
|
|
294
|
+
hasBorderBottom,
|
|
291
295
|
leftScrollAriaLabel,
|
|
292
296
|
rightScrollAriaLabel,
|
|
293
297
|
'aria-label': ariaLabel,
|
|
@@ -356,6 +360,7 @@ export class Tabs extends React.Component<TabsProps, TabsState> {
|
|
|
356
360
|
isBox && styles.modifiers.box,
|
|
357
361
|
showScrollButtons && !isVertical && styles.modifiers.scrollable,
|
|
358
362
|
usePageInsets && styles.modifiers.pageInsets,
|
|
363
|
+
!hasBorderBottom && styles.modifiers.noBorderBottom,
|
|
359
364
|
formatBreakpointMods(inset, styles),
|
|
360
365
|
variantStyle[variant],
|
|
361
366
|
className
|
|
@@ -276,3 +276,20 @@ test('should render box tabs of light variant', () => {
|
|
|
276
276
|
expect(view.container).toMatchSnapshot();
|
|
277
277
|
});
|
|
278
278
|
|
|
279
|
+
test('should render tabs with no bottom border', () => {
|
|
280
|
+
const view = render(
|
|
281
|
+
<Tabs id="noBottomBorderTabs" hasBorderBottom={false}>
|
|
282
|
+
<Tab id="tab1" eventKey={0} title={<TabTitleText>"Tab item 1"</TabTitleText>}>
|
|
283
|
+
Tab 1 section
|
|
284
|
+
</Tab>
|
|
285
|
+
<Tab id="tab2" eventKey={1} title={<TabTitleText>"Tab item 2"</TabTitleText>}>
|
|
286
|
+
Tab 2 section
|
|
287
|
+
</Tab>
|
|
288
|
+
<Tab id="tab3" eventKey={2} title={<TabTitleText>"Tab item 3"</TabTitleText>}>
|
|
289
|
+
Tab 3 section
|
|
290
|
+
</Tab>
|
|
291
|
+
</Tabs>
|
|
292
|
+
);
|
|
293
|
+
expect(view.container).toMatchSnapshot();
|
|
294
|
+
});
|
|
295
|
+
|