From 5d454ded3989275aefd42a62746d4f6eb85d86bd Mon Sep 17 00:00:00 2001 From: delangle Date: Wed, 22 May 2024 09:32:27 +0200 Subject: [PATCH 1/2] [website] List Tree View features on the Pricing page --- docs/src/components/pricing/PricingTable.tsx | 341 +++++++++++-------- 1 file changed, 192 insertions(+), 149 deletions(-) diff --git a/docs/src/components/pricing/PricingTable.tsx b/docs/src/components/pricing/PricingTable.tsx index c342fed6910a1e..d8789cad4ae75d 100644 --- a/docs/src/components/pricing/PricingTable.tsx +++ b/docs/src/components/pricing/PricingTable.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { alpha, styled } from '@mui/material/styles'; +import { alpha, styled, SxProps } from '@mui/material/styles'; import Box, { BoxProps } from '@mui/material/Box'; import Button from '@mui/material/Button'; import Container from '@mui/material/Container'; @@ -17,6 +17,8 @@ import IconImage from 'docs/src/components/icon/IconImage'; import LicensingModelSwitch from 'docs/src/components/pricing/LicensingModelSwitch'; import { useLicensingModel } from 'docs/src/components/pricing/LicensingModelContext'; +type ExpandableProduct = 'charts' | 'grid' | 'tree-view'; + const planInfo = { community: { iconName: 'pricing/x-plan-community', @@ -413,7 +415,7 @@ function RowHead({ children, startIcon, ...props }: BoxProps & { startIcon?: Rea ); } -const rowHeaders: Record = { +const rowHeaders = { // Core 'Base UI': ( = { 'data-grid/column-autosizing': ( ), - 'data-grid/column-reorder': ( - + 'data-grid/column-reordering': ( + ), 'data-grid/column-pinning': ( @@ -601,6 +603,33 @@ const rowHeaders: Record = { 'charts/filter-interaction': , 'charts/selection-interaction': , 'tree-view/tree-view': , + 'tree-view/item-selection': ( + + ), + 'tree-view/multi-item-selection': ( + + ), + 'tree-view/customizable-components': ( + + ), + 'tree-view/item-label-editing': , + 'tree-view/accessibility': ( + + ), + 'tree-view/keyboard-nav': ( + + ), + 'tree-view/item-virtualization': , + 'tree-view/item-reordering': , 'mui-x-production': , 'mui-x-development': , 'mui-x-development-perpetual': ( @@ -674,7 +703,9 @@ const rowHeaders: Record = { }} /> ), -}; +} as const; + +type PricingTableRowId = keyof typeof rowHeaders; const yes = ; const pending = ; @@ -697,7 +728,7 @@ const toBeDefined = ( ); -const communityData: Record = { +const communityData: Record = { // Core open-source libraries 'Base UI': yes, 'MUI System': yes, @@ -709,7 +740,7 @@ const communityData: Record = { 'data-grid/column-spanning': yes, 'data-grid/column-resizing': yes, 'data-grid/column-autosizing': yes, - 'data-grid/column-reorder': no, + 'data-grid/column-reordering': no, 'data-grid/column-pinning': no, // data grid - rows 'data-grid/row-height': yes, @@ -778,6 +809,14 @@ const communityData: Record = { 'charts/selection-interaction': no, // Tree View 'tree-view/tree-view': yes, + 'tree-view/item-selection': yes, + 'tree-view/multi-item-selection': yes, + 'tree-view/customizable-components': yes, + 'tree-view/accessibility': yes, + 'tree-view/keyboard-nav': yes, + 'tree-view/item-label-editing': pending, + 'tree-view/item-virtualization': no, + 'tree-view/item-reordering': no, // general 'mui-x-production': yes, 'mui-x-updates': yes, @@ -794,7 +833,7 @@ const communityData: Record = { 'security-questionnaire': no, }; -const proData: Record = { +const proData: Record = { // Core 'Base UI': yes, 'MUI System': yes, @@ -806,7 +845,7 @@ const proData: Record = { 'data-grid/column-spanning': yes, 'data-grid/column-resizing': yes, 'data-grid/column-autosizing': yes, - 'data-grid/column-reorder': yes, + 'data-grid/column-reordering': yes, 'data-grid/column-pinning': yes, // data grid - rows 'data-grid/row-height': yes, @@ -875,6 +914,14 @@ const proData: Record = { 'charts/selection-interaction': no, // Tree View 'tree-view/tree-view': yes, + 'tree-view/item-selection': yes, + 'tree-view/multi-item-selection': yes, + 'tree-view/customizable-components': yes, + 'tree-view/accessibility': yes, + 'tree-view/keyboard-nav': yes, + 'tree-view/item-label-editing': pending, + 'tree-view/item-virtualization': pending, + 'tree-view/item-reordering': pending, // general 'mui-x-production': yes, 'mui-x-development': , @@ -896,7 +943,7 @@ const proData: Record = { ), }; -const premiumData: Record = { +const premiumData: Record = { // Core 'Base UI': yes, 'MUI System': yes, @@ -908,7 +955,7 @@ const premiumData: Record = { 'data-grid/column-spanning': yes, 'data-grid/column-resizing': yes, 'data-grid/column-autosizing': yes, - 'data-grid/column-reorder': yes, + 'data-grid/column-reordering': yes, 'data-grid/column-pinning': yes, // data grid - rows 'data-grid/row-height': yes, @@ -977,6 +1024,14 @@ const premiumData: Record = { 'charts/selection-interaction': pending, // Tree View 'tree-view/tree-view': yes, + 'tree-view/item-selection': yes, + 'tree-view/multi-item-selection': yes, + 'tree-view/customizable-components': yes, + 'tree-view/accessibility': yes, + 'tree-view/keyboard-nav': yes, + 'tree-view/item-label-editing': pending, + 'tree-view/item-virtualization': pending, + 'tree-view/item-reordering': pending, // general 'mui-x-production': yes, 'mui-x-development': , @@ -1114,7 +1169,7 @@ function StickyHead({ const divider = ; -function renderMasterRow(key: string, gridSx: object, plans: Array) { +function renderMasterRow(key: PricingTableRowId, gridSx: object, plans: Array) { return ( void; +} + +function ExpandedProductHeader(props: ExpandedProductHeaderProps) { + const { productLabel, gridSx, expanded, toggleExpansion } = props; + + const expandIcon = ( + + ); + + return ( + + + {expandIcon} + + {expandIcon} + + {expandIcon} + + + ); +} + const StyledCollapse = styled(Collapse, { name: 'MuiSlider', slot: 'Track', @@ -1220,13 +1349,15 @@ export default function PricingTable({ plans?: Array<'community' | 'pro' | 'premium'>; }) { const router = useRouter(); - const [dataGridCollapsed, setDataGridCollapsed] = React.useState(false); - const [chartsCollapsed, setChartsCollapsed] = React.useState(false); + const [expandedProducts, setExpandedProducts] = React.useState< + Record + >({ charts: false, grid: false, 'tree-view': false }); React.useEffect(() => { if (router.query['expand-path'] === 'all') { - setDataGridCollapsed(true); - setChartsCollapsed(true); + setExpandedProducts( + (prev) => Object.fromEntries(Object.keys(prev).map((key) => [key, true])) as typeof prev, + ); } }, [router.query]); @@ -1247,22 +1378,11 @@ export default function PricingTable({ }, }; - const dataGridUnfoldMore = ( - - ); - - const chartsUnfoldMore = ( - - ); + const renderRow = (key: PricingTableRowId) => renderMasterRow(key, gridSx, plans); + const renderNestedRow = (key: PricingTableRowId) => renderMasterRow(key, nestedGridSx, plans); - const renderRow = (key: string) => renderMasterRow(key, gridSx, plans); - const renderNestedRow = (key: string) => renderMasterRow(key, nestedGridSx, plans); + const toggleProductExpansion = (productName: ExpandableProduct) => + setExpandedProducts((prev) => ({ ...prev, [productName]: !prev[productName] })); return ( @@ -1314,65 +1434,13 @@ export default function PricingTable({ }> MUI X (open-core) - - - {dataGridUnfoldMore} - - {dataGridUnfoldMore} - - - {dataGridUnfoldMore} - - - - + toggleProductExpansion('grid')} + gridSx={gridSx} + /> + Column features {renderNestedRow('data-grid/column-groups')} {divider} @@ -1382,7 +1450,7 @@ export default function PricingTable({ {divider} {renderNestedRow('data-grid/column-autosizing')} {divider} - {renderNestedRow('data-grid/column-reorder')} + {renderNestedRow('data-grid/column-reordering')} {divider} {renderNestedRow('data-grid/column-pinning')} {divider} @@ -1467,63 +1535,13 @@ export default function PricingTable({ {divider} {renderRow('date-picker/range')} {divider} - - - {chartsUnfoldMore} - - {chartsUnfoldMore} - - {chartsUnfoldMore} - - - + toggleProductExpansion('charts')} + gridSx={gridSx} + /> + Components {renderNestedRow('charts/line')} {divider} @@ -1572,7 +1590,32 @@ export default function PricingTable({ {renderNestedRow('charts/selection-interaction')} {divider} - {renderRow('tree-view/tree-view')} + toggleProductExpansion('tree-view')} + gridSx={gridSx} + /> + + Interactions + {renderNestedRow('tree-view/item-selection')} + {divider} + {renderNestedRow('tree-view/multi-item-selection')} + {divider} + {renderNestedRow('tree-view/item-label-editing')} + {divider} + {renderNestedRow('tree-view/item-reordering')} + {divider} + Rendering features + {renderNestedRow('tree-view/customizable-components')} + {divider} + {renderNestedRow('tree-view/item-virtualization')} + {divider} + Miscellaneous + {renderNestedRow('tree-view/accessibility')} + {divider} + {renderNestedRow('tree-view/keyboard-nav')} + {divider} {renderRow('mui-x-production')} {divider} From 05018330d0f4ee545399cc530fa7dc311ba21e4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rodolfo=20Freitas?= Date: Mon, 2 Sep 2024 14:00:01 +0200 Subject: [PATCH 2/2] Update docs/src/components/pricing/PricingTable.tsx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Olivier Tassinari Signed-off-by: José Rodolfo Freitas --- docs/src/components/pricing/PricingTable.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/components/pricing/PricingTable.tsx b/docs/src/components/pricing/PricingTable.tsx index d8789cad4ae75d..806e7cf4a70981 100644 --- a/docs/src/components/pricing/PricingTable.tsx +++ b/docs/src/components/pricing/PricingTable.tsx @@ -455,7 +455,7 @@ const rowHeaders = { ), 'data-grid/column-reordering': ( - + ), 'data-grid/column-pinning': (