forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add rollup to react-table * fix circular deps in react-core * fix circular deps in react-table * fix circular deps in react-charts * add check to react-datetime * move to types and enums * revert most table changes * fix table build * revert fixing charts circular dependencies
- Loading branch information
Showing
22 changed files
with
203 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,7 @@ | ||
import resolve from '@rollup/plugin-node-resolve'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import scss from 'rollup-plugin-scss'; | ||
import replace from '@rollup/plugin-replace'; | ||
import { terser } from 'rollup-plugin-terser'; | ||
const { name } = require('./package.json'); | ||
const baseConfig = require('../rollup.base'); | ||
|
||
const isProduction = process.env.IS_PRODUCTION; | ||
|
||
module.exports = { | ||
input: 'dist/esm/index.js', | ||
output: { | ||
file: `dist/umd/react-core${isProduction ? '.min' : ''}.js`, | ||
format: 'umd', | ||
name: 'PatternFlyReact', | ||
globals: { | ||
react: 'React', | ||
'react-dom': 'ReactDOM' | ||
} | ||
}, | ||
external: ['react', 'react-dom'], | ||
plugins: [ | ||
replace({ | ||
'process.env.NODE_ENV': `'${isProduction ? 'production' : 'development'}'` | ||
}), | ||
resolve(), | ||
commonjs(), | ||
scss(), | ||
isProduction && terser() | ||
] | ||
}; | ||
module.exports = baseConfig({ | ||
packageName: name.replace('@patternfly/', ''), | ||
name: 'PatternFlyReact' | ||
}); |
2 changes: 1 addition & 1 deletion
2
packages/react-core/src/components/ApplicationLauncher/ApplicationLauncherSeparator.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import * as React from 'react'; | ||
import { ApplicationLauncherSeparator } from '../ApplicationLauncher/ApplicationLauncherSeparator'; | ||
import { Divider } from '../Divider/Divider'; | ||
|
||
/** | ||
* This function is a helper for creating an array of renderable favorite items for the Application launcher or Select | ||
* | ||
* @param {object} items The items rendered in Select or Application aLauncher | ||
* @param {boolean} isGrouped Flag indicating if items are grouped | ||
* @param {any[]} favorites Array of ids of favorited items | ||
* @param {boolean} isEnterTriggersArrowDown Flag indicating if we should add isEnterTriggersArrowDown to favorited item | ||
*/ | ||
export const createRenderableFavorites = ( | ||
items: object, | ||
isGrouped: boolean, | ||
favorites: any[], | ||
isEnterTriggersArrowDown?: boolean | ||
) => { | ||
if (isGrouped) { | ||
const favoriteItems: React.ReactNode[] = []; | ||
(items as React.ReactElement[]).forEach(group => { | ||
if (favorites.length > 0) { | ||
return ( | ||
group.props.children && | ||
(group.props.children as React.ReactElement[]) | ||
.filter(item => favorites.includes(item.props.id)) | ||
.map(item => { | ||
if (isEnterTriggersArrowDown) { | ||
return favoriteItems.push( | ||
React.cloneElement(item, { | ||
isFavorite: true, | ||
enterTriggersArrowDown: isEnterTriggersArrowDown, | ||
id: `favorite-${item.props.id}` | ||
}) | ||
); | ||
} else { | ||
return favoriteItems.push( | ||
React.cloneElement(item, { isFavorite: true, id: `favorite-${item.props.id}` }) | ||
); | ||
} | ||
}) | ||
); | ||
} | ||
}); | ||
return favoriteItems; | ||
} | ||
return (items as React.ReactElement[]) | ||
.filter(item => favorites.includes(item.props.id)) | ||
.map(item => React.cloneElement(item, { isFavorite: true, enterTriggersArrowDown: isEnterTriggersArrowDown })); | ||
}; | ||
|
||
/** | ||
* This function is a helper for extending the array of renderable favorite with the select/application launcher items to render in the Application launcher or Select | ||
* | ||
* @param {object} items The items rendered in Select or Application aLauncher | ||
* @param {boolean} isGrouped Flag indicating if items are grouped | ||
* @param {any[]} favorites Array of ids of favorited items | ||
*/ | ||
export const extendItemsWithFavorite = (items: object, isGrouped: boolean, favorites: any[]) => { | ||
if (isGrouped) { | ||
return (items as React.ReactElement[]).map(group => | ||
React.cloneElement(group, { | ||
children: React.Children.map(group.props.children as React.ReactElement[], item => { | ||
if (item.type === ApplicationLauncherSeparator || item.type === Divider) { | ||
return item; | ||
} | ||
return React.cloneElement(item, { | ||
isFavorite: favorites.some( | ||
favoriteId => favoriteId === item.props.id || `favorite-${favoriteId}` === item.props.id | ||
) | ||
}); | ||
}) | ||
}) | ||
); | ||
} | ||
return (items as React.ReactElement[]).map(item => | ||
React.cloneElement(item, { | ||
isFavorite: favorites.some(favoriteId => favoriteId === item.props.id) | ||
}) | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as React from 'react'; | ||
|
||
export interface TabsContextProps { | ||
variant: 'default' | 'light300'; | ||
} | ||
|
||
const TabsContext = React.createContext<TabsContextProps>({ | ||
variant: 'default' | ||
}); | ||
|
||
export const TabsContextProvider = TabsContext.Provider; | ||
export const TabsContextConsumer = TabsContext.Consumer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export * from './Tab'; | ||
export * from './Tabs'; | ||
export * from './TabContent'; | ||
export * from './TabsContext'; | ||
export * from './TabTitleText'; | ||
export * from './TabTitleIcon'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const { name } = require('./package.json'); | ||
const baseConfig = require('../rollup.base'); | ||
|
||
module.exports = baseConfig({ | ||
packageName: name.replace('@patternfly/', ''), | ||
name: 'PatternFlyDateTime' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const { name } = require('./package.json'); | ||
const baseConfig = require('../rollup.base'); | ||
|
||
module.exports = baseConfig({ | ||
packageName: name.replace('@patternfly/', ''), | ||
name: 'PatternFlyTable' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.