Skip to content

Commit

Permalink
updated itwinui-react version & breaking changes (#87)
Browse files Browse the repository at this point in the history
Co-authored-by: Rohan Kadkol <[email protected]>
Co-authored-by: Mayank <[email protected]>
  • Loading branch information
3 people authored Dec 7, 2023
1 parent 3bc8503 commit 6b6b764
Show file tree
Hide file tree
Showing 52 changed files with 209 additions and 196 deletions.
6 changes: 6 additions & 0 deletions .changeset/forty-gifts-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@itwin/itwinui-layouts-css': minor
'@itwin/itwinui-layouts-react': minor
---

Added support for `@itwin/itwinui-react` v3 and removed dependency on `@itwin/itwinui-variables`.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@itwin/itwinui-icons-react": "^1.7.0",
"@itwin/itwinui-layouts-css": "workspace:*",
"@itwin/itwinui-layouts-react": "workspace:*",
"@itwin/itwinui-react": "^2.0.0",
"@itwin/itwinui-react": "^3.0.0",
"prism-react-renderer": "^1.3.3",
"react-router-dom": "6",
"vite-plugin-svgr": "^1.0.1"
Expand Down
1 change: 0 additions & 1 deletion demo/src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
@import '@itwin/itwinui-variables';

.app {
padding: var(--iui-size-l) unquote('max(var(--iui-size-l), var(--iui-size-l) + env(safe-area-inset-right))') var(--iui-size-l) unquote('max(var(--iui-size-l), var(--iui-size-l) + env(safe-area-inset-left))');
Expand Down
1 change: 0 additions & 1 deletion demo/src/common/CodeSample.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
@import '@itwin/itwinui-variables';

.code-sample {
text-align: left;
Expand Down
36 changes: 17 additions & 19 deletions demo/src/common/DemoHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import {
MenuDivider,
MenuExtraContent,
MenuItem,
UserIcon,
IconButton,
DropdownMenu,
Select,
Text,
Avatar,
} from '@itwin/itwinui-react';
import {
SvgCheckmark,
Expand Down Expand Up @@ -66,29 +66,29 @@ export const DemoHeader = ({ isSlim = false }: DemoHeaderProps) => {
<MenuItem
key='projectA'
sublabel='0x0123456789'
icon={
startIcon={
<img
src='https://itwinplatformcdn.azureedge.net/iTwinUI/stadium.png'
alt='Project thumbnail'
draggable='false'
/>
}
badge={<SvgCheckmark />}
endIcon={<SvgCheckmark />}
isSelected
>
Project Alpha
</MenuItem>,
<MenuItem
key='projectB'
sublabel='0x0987654321'
icon={<SvgProject />}
startIcon={<SvgProject />}
>
Project Beta
</MenuItem>,
<MenuItem
key='projectC'
sublabel='0x0001337420'
icon={<SvgProject />}
startIcon={<SvgProject />}
>
Project Charlie
</MenuItem>,
Expand All @@ -107,23 +107,23 @@ export const DemoHeader = ({ isSlim = false }: DemoHeaderProps) => {
<MenuItem
key='iModelA'
sublabel='0x0123456789'
icon={<SvgModel />}
startIcon={<SvgModel />}
>
iModel Alpha
</MenuItem>,
<MenuItem
key='iModelB'
sublabel='0x0987654321'
icon={<SvgModel />}
startIcon={<SvgModel />}
isSelected
badge={<SvgCheckmark />}
endIcon={<SvgCheckmark />}
>
iModel Beta
</MenuItem>,
<MenuItem
key='iModelC'
sublabel='0x0001337420'
icon={<SvgModel />}
startIcon={<SvgModel />}
>
iModel Charlie
</MenuItem>,
Expand All @@ -150,8 +150,6 @@ export const DemoHeader = ({ isSlim = false }: DemoHeaderProps) => {
<SvgHelpCircular />
</IconButton>
</DropdownMenu>,
]}
userIcon={
<DropdownMenu
key='profile'
role='menu'
Expand All @@ -174,13 +172,13 @@ export const DemoHeader = ({ isSlim = false }: DemoHeaderProps) => {
</MenuExtraContent>,
<MenuDivider key={1} />,
<MenuItem key='view-profile'>View profile</MenuItem>,
<MenuItem key='sign-out' badge={<SvgExit />}>
<MenuItem key='sign-out' endIcon={<SvgExit />}>
Sign out
</MenuItem>,
]}
>
<IconButton styleType='borderless'>
<UserIcon
<Avatar
size='medium'
image={
<img
Expand All @@ -190,19 +188,19 @@ export const DemoHeader = ({ isSlim = false }: DemoHeaderProps) => {
}
/>
</IconButton>
</DropdownMenu>
}
</DropdownMenu>,
]}
menuItems={() => [
<MenuItem key='settings' icon={<SvgSettings />}>
<MenuItem key='settings' startIcon={<SvgSettings />}>
Settings
</MenuItem>,
<MenuItem key='feedback' icon={<SvgSmileyHappy />}>
<MenuItem key='feedback' startIcon={<SvgSmileyHappy />}>
Feedback
</MenuItem>,
<MenuItem key='whats-new' icon={<SvgNews />}>
<MenuItem key='whats-new' startIcon={<SvgNews />}>
{`What's new`}
</MenuItem>,
<MenuItem key='about' icon={<SvgInfoCircular />}>
<MenuItem key='about' startIcon={<SvgInfoCircular />}>
About
</MenuItem>,
]}
Expand Down
1 change: 0 additions & 1 deletion demo/src/common/DemoHomePageInfoCard.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) Bentley Systems, Incorporated. All rights reserved.
// See LICENSE.md in the project root for license terms and full copyright notice.
@import '@itwin/itwinui-variables';

.demo-home-page-info-card {
display: flex;
Expand Down
4 changes: 3 additions & 1 deletion demo/src/common/DemoSideNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { SidenavButton, SideNavigation } from '@itwin/itwinui-react';
export const DemoSideNav = ({ activeItemKey = 'Home' }) => {
return (
<SideNavigation
className='app-sidenav'
expanderPlacement='bottom'
items={[
<SidenavButton
Expand Down Expand Up @@ -44,6 +43,9 @@ export const DemoSideNav = ({ activeItemKey = 'Home' }) => {
Configuration
</SidenavButton>,
]}
wrapperProps={{
className: 'app-sidenav',
}}
/>
);
};
Expand Down
1 change: 0 additions & 1 deletion demo/src/common/DemoSurfaceCard.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) Bentley Systems, Incorporated. All rights reserved.
// See LICENSE.md in the project root for license terms and full copyright notice.
@import '@itwin/itwinui-variables';

.demo-surface-card {
height: 100%;
Expand Down
1 change: 0 additions & 1 deletion demo/src/common/DemoTemplate.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) Bentley Systems, Incorporated. All rights reserved.
// See LICENSE.md in the project root for license terms and full copyright notice.
@import '@itwin/itwinui-variables';

.demo-template-container {
display: flex;
Expand Down
111 changes: 51 additions & 60 deletions demo/src/common/DemoTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
ButtonGroup,
Button,
Text,
ThemeType,
InformationPanel,
InformationPanelHeader,
InformationPanelWrapper,
Expand All @@ -18,7 +17,6 @@ import {
import { SvgDeveloper } from '@itwin/itwinui-icons-react';
import { ThemeButton } from '../common/ThemeButton';
import { Link } from 'react-router-dom';
import { ThemeContext } from './ThemeContext';
import CodeSample from './CodeSample';

export type DemoTemplateProps = {
Expand All @@ -36,11 +34,6 @@ export const DemoTemplate = (props: DemoTemplateProps) => {

const [showCodeDemo, setShowCodeDemo] = React.useState(false);
const [copyTooltipVisible, setCopyTooltipVisible] = React.useState(false);
const [theme, setTheme] = React.useState<ThemeType>(() =>
window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark'
: 'light',
);

const showCopiedTooltip = () => {
setCopyTooltipVisible(true);
Expand All @@ -49,62 +42,60 @@ export const DemoTemplate = (props: DemoTemplateProps) => {
}, 500);
};
return (
<ThemeContext.Provider value={{ theme, setTheme }}>
<InformationPanelWrapper>
<div className='demo-template-container'>
<div className='demo-template-content'>
{children}
{!isTestRun() && (
<ButtonGroup className='demo-template-button-overlay'>
<ThemeButton />
<IconButton onClick={() => setShowCodeDemo((f) => !f)}>
<SvgDeveloper />
</IconButton>
</ButtonGroup>
)}
</div>
<InformationPanelWrapper>
<div className='demo-template-container'>
<div className='demo-template-content'>
{children}
{!isTestRun() && (
<ButtonGroup className='demo-template-button-overlay'>
<ThemeButton />
<IconButton onClick={() => setShowCodeDemo((f) => !f)}>
<SvgDeveloper />
</IconButton>
</ButtonGroup>
)}
</div>

<InformationPanel style={{ width: '40%' }} isOpen={showCodeDemo}>
<InformationPanelHeader
actions={
<div className='demo-template-code-header-actions'>
<Tooltip
content='Copied to clipboard'
visible={copyTooltipVisible}
<InformationPanel style={{ width: '40%' }} isOpen={showCodeDemo}>
<InformationPanelHeader
actions={
<div className='demo-template-code-header-actions'>
<Tooltip
content='Copied to clipboard'
visible={copyTooltipVisible}
>
<Button
onClick={() => {
navigator.clipboard.writeText(codeExample);
showCopiedTooltip();
}}
styleType='high-visibility'
>
<Button
onClick={() => {
navigator.clipboard.writeText(codeExample);
showCopiedTooltip();
}}
styleType='high-visibility'
>
Copy
</Button>
</Tooltip>
</div>
}
Copy
</Button>
</Tooltip>
</div>
}
>
<Link to='../' className='iui-anchor'>
..
</Link>
<Text
as='h1'
variant='title'
className='demo-template-code-header-title'
>
<Link to='../' className='iui-anchor'>
..
</Link>
<Text
as='h1'
variant='title'
className='demo-template-code-header-title'
>
{title}
</Text>
</InformationPanelHeader>
<CodeSample
showLineNumbers
style={{ height: '100%', border: 'none', margin: '0' }}
code={codeExample}
/>
</InformationPanel>
</div>
</InformationPanelWrapper>
</ThemeContext.Provider>
{title}
</Text>
</InformationPanelHeader>
<CodeSample
showLineNumbers
style={{ height: '100%', border: 'none', margin: '0' }}
code={codeExample}
/>
</InformationPanel>
</div>
</InformationPanelWrapper>
);
};

Expand Down
13 changes: 6 additions & 7 deletions demo/src/common/ThemeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,22 @@
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import React from 'react';
import { useTheme, IconButton } from '@itwin/itwinui-react';
import { IconButton } from '@itwin/itwinui-react';
import { SvgSun, SvgMoon } from '@itwin/itwinui-icons-react';
import { useThemeContext } from './ThemeContext';

export const ThemeButton = () => {
const { theme, setTheme } = useThemeContext();

useTheme(theme);

const changeTheme = () => {
setTheme(theme === 'light' ? 'dark' : 'light');
};

return (
<IconButton styleType='default' onClick={changeTheme}>
{theme === 'light' ? <SvgMoon /> : <SvgSun />}
</IconButton>
<>
<IconButton styleType='default' onClick={changeTheme}>
{theme === 'light' ? <SvgMoon /> : <SvgSun />}
</IconButton>
</>
);
};

Expand Down
1 change: 0 additions & 1 deletion demo/src/demos/Grid/FluidGridDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ export const GridLayoutDemo = () => {
right={
<LabeledInput
key='search'
iconDisplayStyle='inline'
placeholder='Search…'
svgIcon={<SvgSearch />}
/>
Expand Down
6 changes: 2 additions & 4 deletions demo/src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
*,
*::before,
*::after {
box-sizing: border-box;
.custom-theme {
height: 100dvh;
}

html,
Expand Down
Loading

0 comments on commit 6b6b764

Please sign in to comment.