### 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
// AFTER
```
--------------------------------
### Table/Tree Table Drag and Drop Preview Layer
Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md
Example demonstrating the change in rendering for the dragging row during drag and drop events in Table and Tree Table components.
```tsx
// BEFORE
// ... Few levels below
...
```
```tsx
// AFTER
...
```
--------------------------------
### Renamed disabledDays to disabled
Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md
Example showing the renaming of the `disabledDays` prop to `disabled` for the DatePicker component.
```tsx
import { DatePicker } from "@com.mgmtp.a12.widgets/widgets-core/lib/datepicker";
// BEFORE
// AFTER
```
--------------------------------
### Renamed firstDayOfWeek to weekStartsOn
Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md
Example showing the renaming of the `firstDayOfWeek` prop to `weekStartsOn` for the DatePicker component.
```tsx
import { DatePicker } from "@com.mgmtp.a12.widgets/widgets-core/lib/datepicker";
// BEFORE
// AFTER
```
--------------------------------
### Time Picker Validation Migration
Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md
Example demonstrating the change in the Time Picker's validation callback from `onValidationError` to `onValidate`.
```tsx
import { useCallback } from "react";
import { TimePicker } from "@com.mgmtp.a12.widgets/widgets-core/lib/time-picker";
// BEFORE
const onValidationError = useCallback((value: string): void => {
// Your logic here.
}, []);
;
// AFTER
const onValidate: TimePickerProps["onValidate"] = useCallback(({ value, valid }) => {
// Your logic here.
}, []);
;
```
--------------------------------
### Migration of disabledDays to disabled for DateInput
Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md
Example showing the migration of `disabledDays` to `disabled` within the `datePickerProps` of the `DateInput` widget.
```tsx
import { DateInput as DateInputWidget } from "@com.mgmtp.a12.widgets/widgets-core/lib/datepicker";
// BEFORE
// AFTER
```
--------------------------------
### React 18 Upgrade: Portal DOM Snapshot Test Markup
Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md
Example of the additional markup that may appear in the DOM where a portal is rendered due to React 18 compatibility changes.
```html
```
--------------------------------
### DateTimeUtils Migration to date-fns locale
Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md
Example illustrating the change in how locales are handled with DateTimeUtils, now using date-fns locale objects.
```tsx
// BEFORE
import { DateTimeUtils } from "@com.mgmtp.a12.widgets/widgets-core/lib/common/main/utils";
const date = new Date();
const locale = "de";
const format = "DD/MM/YYYY";
DateTimeUtils.formatDateTime(date, locale, format);
// AFTER
import { DateTimeUtils } from "@com.mgmtp.a12.widgets/widgets-core/lib/common/main/date-time/date-utils";
import { de } from "date-fns/locale/de";
const date = new Date();
const format = "DD/MM/YYYY";
DateTimeUtils.formatDateTime(date, de, format);
```
--------------------------------
### Date Input Locale Configuration (Before and Now)
Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md
Demonstrates the change in locale configuration for DateInput components, moving from direct prop passing to using DateTimeContext.Provider with date-fns.
```tsx
// BEFORE
;
// NOW
import { de } from "date-fns/locale/de";
;
```
--------------------------------
### Enable Interaction Hint
Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md
To enable the interaction hint, use the InteractionHintConfigProvider with enableInteractionHint set to true.
```tsx
import { InteractionHintConfigProvider } from "@com.mgmtp.a12.widgets/widgets-core/lib/interaction-hint/main/interaction-hint-context";
...;
```
--------------------------------
### Menu: mainMenu removed, useAs property introduced
Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md
Illustrates the replacement of the 'mainMenu' property with the 'useAs' property for customizing Menu styles.
```tsx
import { FlyoutMenu } from "@com.mgmtp.a12.widgets/widgets-core/lib/menu";
// BEFORE
return ;
// AFTER
// Display the main menu
return ;
// In case you want the menu to be displayed as Tab Navigation
return ;
```
--------------------------------
### Theming Customization: Interactive Tile Border Configuration
Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md
Demonstrates the change in how border styles are configured for the Interactive Tile component, moving from a general 'border' key to specific 'primary.border' and 'secondary.border'.
```tsx
// BEFORE
import { ThemeProvider, useTheme } from "styled-components";
import { createTheme } from "@com.mgmtp.a12.widgets/widgets-core/lib/theme/create-theme";
const customTheme = () => {
const interactiveTileConfigs: DeepPartial = {
border: "1px solid red",
secondary: {
border: "1px solid blue",
}
};
return createTheme({ components: { interactiveTile: interactiveTileConfig } });
}
```
```tsx
// AFTER
import { ThemeProvider, useTheme } from "styled-components";
import { createTheme } from "@com.mgmtp.a12.widgets/widgets-core/lib/theme/create-theme";
const customTheme = () => {
const interactiveTileConfigs: DeepPartial = {
primary: {
border: "1px solid red",
},
secondary: {
border: "1px solid blue",
}
};
return createTheme({ components: { interactiveTile: interactiveTileConfig } });
}
```
--------------------------------
### Styled Components v5 vs v6 StyleSheetManager
Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md
Illustrates the difference in using the StyleSheetManager component between styled-components v5 and v6, specifically regarding vendor prefix management.
```tsx
// In Styled Components v5, the component supported the `disableVendorPrefixes` property:
```
```
```tsx
// In Styled Components v6:
// `disableVendorPrefixes` has been removed.
// Vendor prefixes are now disabled by default.
// To enable vendor prefixes, set `enableVendorPrefixes` to true in the `StyleSheetManager`.
```
```
--------------------------------
### Codemod for Nested Imports
Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md
Command to run the codemod for updating nested imports to top-level imports.
```bash
npx @com.mgmtp.a12.widgets/widgets-codemod prefer-top-level-imports
```
--------------------------------
### Button Widget Interaction Hint DOM Difference
Source: https://github.com/mgm-tp/a12-widgets/blob/main/new-showcase/src/docs/migration/migration-notes.md
Demonstrates the DOM difference for a Button Widget before and after the Interaction Hint enhancement, showing how the title property is now passed to aria-label.
```tsx
// BEFORE: `title` property's value was passed to `title` attribute.
// 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