### Node Component Migration Example Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Example of migrating a Node component from NodeTpl.Node to DiagramNode. ```typescript // Before My Node // After My Node ``` -------------------------------- ### Port Component Migration Example Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Example of migrating a Port component using createPort to DiagramPort. ```typescript // Before const MyPort = createPort({ // port configuration }); // After ``` -------------------------------- ### Status Component Theming Example Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Provides an example of how to customize the Status component's warning variant using theme variables, specifically for text color and icon color, after the removal of the deprecated 'light' property. ```tsx import { ThemeProvider, useTheme } from "styled-components"; import { createTheme } from "@com.mgmtp.a12.widgets/widgets-core/lib/theme/create-theme"; const customTheme = () => { const statusConfigs: DeepPartial = { text: { color: { warning: colors.text.color } }, icon: { color: { warning: colors.variant.warningColorDark } } }; return createTheme({ components: { status: statusConfigs } }); }; warning}> Warning ``` -------------------------------- ### TimeUtils Namespace Move Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Example demonstrating the updated import path for the TimeUtils namespace. ```tsx // BEFORE import { TimeUtils } from "@com.mgmtp.a12.widgets/widgets-core/lib/common/main/utils"; // AFTER import { TimeUtils } from "@com.mgmtp.a12.widgets/widgets-core/lib/common/main/date-time/time-utils"; ``` -------------------------------- ### Nested Imports vs Top-Level Imports Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Example demonstrating the change from nested imports to top-level imports. ```typescript // Before import { Button } from "@com.mgmtp.a12.widgets/widgets-core/lib/button/index.js"; // After import { Button } from "@com.mgmtp.a12.widgets/widgets-core"; ``` -------------------------------- ### Content Box: BASE_CONTENTBOX_DATA_ROLE Removal Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Example showing the replacement of `BASE_CONTENTBOX_DATA_ROLE` with `DataRoles.Contentbox`. ```tsx // BEFORE import { BASE_CONTENTBOX_CLASS_NAME } from "@com.mgmtp.a12.widgets/widgets-core/lib/contentbox/main/template/elements/config.js";
; // AFTER import { DataRoles } from "@com.mgmtp.a12.widgets/widgets-core/lib/common/main/data-roles.js";
; ``` -------------------------------- ### Relation Node Migration Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Example showing the migration from relation-node module components to model-graph-diagram module components. ```typescript // Before import { NodeTpl, createPort, PortProps } from "@com.mgmtp.a12.widgets/widgets-core"; // After import { DiagramNode, DiagramPort } from "@com.mgmtp.a12.widgets/widgets-core"; ``` -------------------------------- ### Interaction Hint Component Usage Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Example demonstrating the 'before' and 'after' of using the InteractionHint component to replace browser tooltips with a look-alike Widgets's Tooltip for better accessibility. ```tsx // BEFORE import * as React from "react"; function ButtonExample(): React.ReactElement { return ; } // AFTER import * as React from "react"; import { InteractionHint } from "@com.mgmtp.a12.widgets/widgets-core/lib/interaction-hint/main/interaction-hint.view"; function ButtonExample(): React.ReactElement { const inputRef = React.useRef(null); return ( <> ); } ``` -------------------------------- ### DatePicker Modifier Update Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Example showing the update to DatePicker modifiers, including new styles and class names. ```javascript // BEFORE // AFTER ``` -------------------------------- ### Changed isRangeModifier to isRangeMatcher Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Example showing the change from `DateTimeUtils.isRangeModifier` to `DateTimeUtils.isRangeMatcher`. ```ts import { DateTimeUtils } from "@com.mgmtp.a12.widgets/widgets-core/lib/common/main/utils"; // BEFORE DateTimeUtils.isRangeModifier(value); // AFTER DateTimeUtils.isRangeMatcher(value); ``` -------------------------------- ### Link Component Migration Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Example illustrating the change in the Link component's API, introducing `linkAttributes` for HTML attributes. ```tsx import { Link } from "@com.mgmtp.a12.widgets/widgets-core/lib/link/main/link/link.view"; // BEFORE // AFTER ``` -------------------------------- ### Master Detail Layout Migration Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Example showing the migration from the old Master Detail component API to the new one. ```tsx import { MasterDetail } from "@com.mgmtp.a12.widgets/widgets-core/lib/layout/master-detail"; // BEFORE { this.gotoView((view as any).view); }} viewSelectionPlaceholder="SELECT COMPONENT TO SHOW" onSizeChange={this.handleWindowSizeChanged} /> // AFTER ``` -------------------------------- ### Renamed initialMonth to defaultMonth Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Example showing the renaming of the `initialMonth` prop to `defaultMonth` for the DatePicker component. ```tsx import { DatePicker } from "@com.mgmtp.a12.widgets/widgets-core/lib/datepicker"; // BEFORE // AFTER ``` -------------------------------- ### Renamed onWeekClick to onWeekNumberClick Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Example showing the renaming of the `onWeekClick` prop to `onWeekNumberClick` for the DatePicker component. ```tsx import { DatePicker } from "@com.mgmtp.a12.widgets/widgets-core/lib/datepicker"; const handleClick = (weekNumber: number, dates: Date[], e: React.MouseEvent): void => { // Your logic here. } // BEFORE // AFTER ``` -------------------------------- ### React 18 Upgrade: Enabling React 18 Support Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Configuration example for enabling React 18 support via webpack's DefinePlugin. ```tsx plugins: [ webpack.DefinePlugin({ A12_ENABLE_REACT_18_SUPPORT: false }) ]; ``` -------------------------------- ### Renamed showWeekNumbers to showWeekNumber Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Example showing the renaming of the `showWeekNumbers` prop to `showWeekNumber` for the DatePicker component. ```tsx import { DatePicker } from "@com.mgmtp.a12.widgets/widgets-core/lib/datepicker"; // BEFORE // AFTER ``` -------------------------------- ### Popup Menu Accessibility Revert Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Example of how to revert the popup menu to its previous design using PopupMenuConfigContext. ```tsx ... ``` -------------------------------- ### Action Content Box: Heading Elements Property Change Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Example demonstrating the change in checking for the `headingElements` property from only null to both null and undefined. ```tsx // BEFORE: Checking only for null if (props.headingElements !== null) { // Render heading elements renderHeading(props.headingElements); } // AFTER: Checking for both null and undefined if (props.headingElements !== null && props.headingElements !== undefined) { // Render heading elements renderHeading(props.headingElements); } ``` -------------------------------- ### File Upload onUploadAreaClick Migration Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Example showing the type change for the `onUploadAreaClick` property in the File Upload component. ```tsx import { Checkbox } from "@com.mgmtp.a12.widgets/widgets-core/lib/input/checkbox"; import { DefaultFileUpload } from "@com.mgmtp.a12.widgets/widgets-core/lib/file-upload"; // BEFORE const onUploadAreaClick = (): boolean | undefined => { // Your logic here. }; ; // AFTER const onUploadAreaClick = (): boolean | void => { // Your logic here }; ; ``` -------------------------------- ### Collapsible Panel Icon Button Adjustment Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Example showing how the Collapsible Panel adapts to changes in icon button theming. ```tsx // BEFORE // NOW: // - `title` attribute is set to empty. // - `title` property's value is passed to `aria-label` attribute. ``` -------------------------------- ### React 18 Upgrade: `withSizeDetector` HOC vs. New Hooks Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Comparison of the old `withSizeDetector` HOC usage with the new, simpler `useWindowSize` hook for responsive behavior detection. ```tsx const AppFrameWithSizeDetect = withSizeDetector(ApplicationFrame); const AppView = () => { const [windowSize, setWindowSize] = React.useState("lg"); const handleWindowSizeChange = React.useCallback((breakPoint: SizeDetectorProps.BreakPoint) => { setWindowSize(breakPoint.size); }, []); return ( {windowSize} ); }; ``` ```tsx const AppView = () => { const { breakPoint } = useWindowSize(); return {breakPoint.size}; }; ``` -------------------------------- ### Button: Dark and Light button properties unified to invert Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md Demonstrates the change from 'dark' and 'light' properties to 'invert' for styling buttons on dark backgrounds, and the introduction of 'withBackground' for rounded backgrounds. ```tsx import { Button } from "@com.mgmtp.a12.widgets/widgets-core/lib/button"; // BEFORE // Dark button