Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use the new JSX transform #2102

Merged
merged 25 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
92031b8
bump swc
mayank99 Jun 11, 2024
527bb82
Merge branch 'main' into mayank/bump-swc
mayank99 Jun 11, 2024
ef39341
Merge branch 'main' into mayank/bump-swc
mayank99 Jun 12, 2024
ae41079
add `--strip-leading-paths`
mayank99 Jun 12, 2024
e9d0f32
replace `tsc` with `swc` for compiling TSX files
mayank99 Jun 12, 2024
9457ad4
fix tsconfig
mayank99 Jun 12, 2024
3cc128e
fix prettier
mayank99 Jun 12, 2024
db07617
prettier changeset
mayank99 Jun 12, 2024
6beafb9
minimize diff
mayank99 Jun 12, 2024
b2b2e5d
use new JSX transform
mayank99 Jun 12, 2024
e7cd1a7
remove unnecessary react import
mayank99 Jun 12, 2024
78431fb
fix tsconfig and eslint config
mayank99 Jun 12, 2024
fbee216
use automatic runtime for dev server too
mayank99 Jun 12, 2024
cdbbf04
Merge branch 'origin/main' into mayank/swc-build
mayank99 Jun 12, 2024
95e92d8
Merge branch 'mayank/swc-build' into mayank/jsx-runtime
mayank99 Jun 12, 2024
b3686cb
use new url
mayank99 Jun 13, 2024
a281781
Merge branch 'main' into mayank/swc-build
mayank99 Jun 13, 2024
1e93a6e
Merge branch 'mayank/swc-build' into mayank/jsx-runtime
mayank99 Jun 13, 2024
172351a
fix inputflexcontainer import
mayank99 Jun 13, 2024
e3ec1a5
disable using eslint plugin
mayank99 Jun 13, 2024
ce12597
make the same change in stories
mayank99 Jun 13, 2024
f0531e4
manually fix imports for failed codemods
mayank99 Jun 13, 2024
34d6394
remove `noInterop`
mayank99 Jun 13, 2024
557f86c
Merge branch 'mayank/swc-build' into mayank/jsx-runtime
mayank99 Jun 13, 2024
ab819c3
Merge branch 'main' into mayank/jsx-runtime
mayank99 Jun 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion apps/react-workshop/src/Alert.stories.tsx
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 React from 'react';
import { Alert } from '@itwin/itwinui-react';
import { SvgPlaceholder, SvgSmileyHappy } from '@itwin/itwinui-icons-react';

Expand Down
1 change: 0 additions & 1 deletion apps/react-workshop/src/Anchor.stories.tsx
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 React from 'react';
import { Anchor } from '@itwin/itwinui-react';

export default {
Expand Down
1 change: 0 additions & 1 deletion apps/react-workshop/src/Avatar.stories.tsx
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 React from 'react';
import { getUserColor, Avatar } from '@itwin/itwinui-react';
import { SvgUser } from '@itwin/itwinui-icons-react';

Expand Down
4 changes: 2 additions & 2 deletions apps/react-workshop/src/AvatarGroup.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import React from 'react';
import { useState } from 'react';
import {
getUserColor,
Tooltip,
Expand Down Expand Up @@ -153,7 +153,7 @@ export const WithTooltip = () => {
/**
* Store the last avatar for tooltip positioning.
*/
const [countIcon, setCountIcon] = React.useState<HTMLElement | null>(null);
const [countIcon, setCountIcon] = useState<HTMLElement | null>(null);

const usersSubArray = userNames.slice(5);
const tooltipContent = usersSubArray.join(`\n`) as string;
Expand Down
1 change: 0 additions & 1 deletion apps/react-workshop/src/Badge.stories.tsx
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 React from 'react';
import { Badge } from '@itwin/itwinui-react';

export default {
Expand Down
1 change: 0 additions & 1 deletion apps/react-workshop/src/Blockquote.stories.tsx
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 React from 'react';
import { Blockquote } from '@itwin/itwinui-react';

export default {
Expand Down
10 changes: 5 additions & 5 deletions apps/react-workshop/src/Breadcrumbs.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import React from 'react';
import { useMemo, useState } from 'react';
import {
IconButton,
Breadcrumbs,
Expand Down Expand Up @@ -193,15 +193,15 @@ export const CustomOverflowDropdown = () => {
};

export const FolderNavigation = () => {
const items = React.useMemo(
const items = useMemo(
() => ['Root', 'Level 1', 'Level 2', 'Level 3', 'Level 4'],
[],
);

const [lastIndex, setLastIndex] = React.useState(items.length - 1);
const [isEditing, setIsEditing] = React.useState(false);
const [lastIndex, setLastIndex] = useState(items.length - 1);
const [isEditing, setIsEditing] = useState(false);

const breadcrumbItems = React.useMemo(
const breadcrumbItems = useMemo(
() =>
items.slice(0, lastIndex + 1).map((item, index) => (
<Breadcrumbs.Item
Expand Down
2 changes: 1 addition & 1 deletion apps/react-workshop/src/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import React from 'react';
import * as React from 'react';
import { Button, NotificationMarker } from '@itwin/itwinui-react';
import { SvgAdd, SvgEmail, SvgPlaceholder } from '@itwin/itwinui-icons-react';

Expand Down
1 change: 0 additions & 1 deletion apps/react-workshop/src/ButtonGroup.stories.tsx
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 React from 'react';
import {
Button,
ButtonGroup,
Expand Down
1 change: 0 additions & 1 deletion apps/react-workshop/src/Checkbox.stories.tsx
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 React from 'react';
import { Checkbox } from '@itwin/itwinui-react';

export default {
Expand Down
1 change: 0 additions & 1 deletion apps/react-workshop/src/Code.stories.tsx
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 React from 'react';
import { Code } from '@itwin/itwinui-react';

export default {
Expand Down
28 changes: 14 additions & 14 deletions apps/react-workshop/src/ColorPicker.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import React from 'react';
import { useState } from 'react';
import {
ColorPicker,
IconButton,
Expand Down Expand Up @@ -55,9 +55,9 @@ const ColorsList = [
];

export const Basic = () => {
const [isOpen, setIsOpen] = React.useState(false);
const [activeColor, setActiveColor] = React.useState(ColorsList[5]);
const [colorName, setColorName] = React.useState(ColorsList[5].name);
const [isOpen, setIsOpen] = useState(false);
const [activeColor, setActiveColor] = useState(ColorsList[5]);
const [colorName, setColorName] = useState(ColorsList[5].name);

const onColorChanged = (color: ColorValue) => {
const hexString = color.toHexString();
Expand Down Expand Up @@ -97,15 +97,15 @@ export const Basic = () => {
};

export const Advanced = () => {
const [isOpen, setIsOpen] = React.useState(false);
const [selectedColor, setSelectedColor] = React.useState<ColorValue>(
const [isOpen, setIsOpen] = useState(false);
const [selectedColor, setSelectedColor] = useState<ColorValue>(
ColorValue.create({ h: 0, s: 100, l: 50 }),
);

const formats = ['hsl', 'rgb', 'hex'] as const;
const [currentFormat, setCurrentFormat] = React.useState<
(typeof formats)[number]
>(formats[0]);
const [currentFormat, setCurrentFormat] = useState<(typeof formats)[number]>(
formats[0],
);

const onColorChanged = (color: ColorValue) => {
setSelectedColor(color);
Expand Down Expand Up @@ -176,15 +176,15 @@ export const Advanced = () => {
};

export const WithAlpha = () => {
const [isOpen, setIsOpen] = React.useState(false);
const [selectedColor, setSelectedColor] = React.useState<ColorValue>(
const [isOpen, setIsOpen] = useState(false);
const [selectedColor, setSelectedColor] = useState<ColorValue>(
ColorValue.create({ r: 90, g: 105, b: 115, a: 0.4 }),
);

const formats = ['hsl', 'rgb', 'hex'] as const;
const [currentFormat, setCurrentFormat] = React.useState<
(typeof formats)[number]
>(formats[0]);
const [currentFormat, setCurrentFormat] = useState<(typeof formats)[number]>(
formats[0],
);

const onColorChanged = (color: ColorValue) => {
setSelectedColor(color);
Expand Down
20 changes: 10 additions & 10 deletions apps/react-workshop/src/DatePicker.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import React from 'react';
import { useState } from 'react';
import {
DatePicker,
IconButton,
Expand All @@ -16,7 +16,7 @@ export default {
};

export const Basic = () => {
const [currentDate, setCurrentDate] = React.useState(
const [currentDate, setCurrentDate] = useState(
new Date(2021, 4, 11, 14, 55, 22),
);
const onChange = (date: Date) => {
Expand Down Expand Up @@ -46,7 +46,7 @@ export const Basic = () => {
};

export const WithTime = () => {
const [currentDate, setCurrentDate] = React.useState(
const [currentDate, setCurrentDate] = useState(
new Date(2021, 4, 11, 14, 55, 22),
);
const onChange = (date: Date) => {
Expand Down Expand Up @@ -77,7 +77,7 @@ export const WithTime = () => {
};

export const WithCombinedTime = () => {
const [currentDate, setCurrentDate] = React.useState(
const [currentDate, setCurrentDate] = useState(
new Date(2021, 4, 11, 14, 30, 0),
);
const onChange = (date: Date) => {
Expand Down Expand Up @@ -111,7 +111,7 @@ export const WithCombinedTime = () => {
};

export const Localized = () => {
const [currentDate, setCurrentDate] = React.useState(
const [currentDate, setCurrentDate] = useState(
new Date(2021, 4, 11, 14, 55, 22),
);
const onChange = (date: Date) => {
Expand Down Expand Up @@ -141,7 +141,7 @@ export const Localized = () => {
);
};
export const WithYear = () => {
const [currentDate, setCurrentDate] = React.useState(
const [currentDate, setCurrentDate] = useState(
new Date(2021, 4, 11, 14, 55, 22),
);
const onChange = (date: Date) => {
Expand Down Expand Up @@ -170,10 +170,10 @@ export const WithYear = () => {
};

export const Range = () => {
const [currentStartDate, setCurrentStartDate] = React.useState(
const [currentStartDate, setCurrentStartDate] = useState(
new Date(2022, 6, 13, 14, 55, 22),
);
const [currentEndDate, setCurrentEndDate] = React.useState(
const [currentEndDate, setCurrentEndDate] = useState(
new Date(2022, 6, 27, 14, 55, 22),
);
const onChange = (startDate: Date, endDate?: Date) => {
Expand Down Expand Up @@ -216,10 +216,10 @@ export const Range = () => {
};

export const SomeDatesDisabled = () => {
const [currentStartDate, setCurrentStartDate] = React.useState(
const [currentStartDate, setCurrentStartDate] = useState(
new Date(2022, 6, 13, 14, 55, 22),
);
const [currentEndDate, setCurrentEndDate] = React.useState(
const [currentEndDate, setCurrentEndDate] = useState(
new Date(2022, 6, 17, 14, 55, 22),
);

Expand Down
12 changes: 6 additions & 6 deletions apps/react-workshop/src/Dialog.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import React from 'react';
import { useState } from 'react';
import { Button, Code, Dialog } from '@itwin/itwinui-react';

export default {
title: 'Dialog',
};

export const Basic = () => {
const [isOpen, setIsOpen] = React.useState(false);
const [isOpen, setIsOpen] = useState(false);

const closeDialog = () => {
setIsOpen(false);
Expand Down Expand Up @@ -61,7 +61,7 @@ export const Basic = () => {
};

export const Modal = () => {
const [isOpen, setIsOpen] = React.useState(false);
const [isOpen, setIsOpen] = useState(false);

const closeDialog = () => {
setIsOpen(false);
Expand Down Expand Up @@ -122,7 +122,7 @@ export const Modal = () => {
};

export const DraggableAndResizable = () => {
const [isOpen, setIsOpen] = React.useState(false);
const [isOpen, setIsOpen] = useState(false);

const closeDialog = () => {
setIsOpen(false);
Expand Down Expand Up @@ -180,7 +180,7 @@ export const DraggableAndResizable = () => {
};

export const DraggableRelativeToContainer = () => {
const [isDialogOpen, setIsDialogOpen] = React.useState(false);
const [isDialogOpen, setIsDialogOpen] = useState(false);

const closeDialog = () => {
setIsDialogOpen(false);
Expand Down Expand Up @@ -252,7 +252,7 @@ export const DraggableRelativeToContainer = () => {
};

export const Placement = () => {
const [isOpen, setIsOpen] = React.useState(false);
const [isOpen, setIsOpen] = useState(false);

const closeDialog = () => {
setIsOpen(false);
Expand Down
1 change: 0 additions & 1 deletion apps/react-workshop/src/DropdownButton.stories.tsx
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 React from 'react';
import { MenuItem, DropdownButton } from '@itwin/itwinui-react';

export default {
Expand Down
1 change: 0 additions & 1 deletion apps/react-workshop/src/ExpandableBlock.stories.tsx
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 React from 'react';
import { ExpandableBlock } from '@itwin/itwinui-react';

export default {
Expand Down
6 changes: 3 additions & 3 deletions apps/react-workshop/src/Fieldset.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import React from 'react';
import { useState } from 'react';
import {
Fieldset,
InputGroup,
Expand All @@ -16,7 +16,7 @@ export default {
};

export const Basic = () => {
const [value, setValue] = React.useState<number | undefined>(undefined);
const [value, setValue] = useState<number | undefined>(undefined);

return (
<Fieldset
Expand Down Expand Up @@ -52,7 +52,7 @@ export const Basic = () => {
};

export const Disabled = () => {
const [value, setValue] = React.useState<number | undefined>(undefined);
const [value, setValue] = useState<number | undefined>(undefined);

return (
<Fieldset
Expand Down
2 changes: 1 addition & 1 deletion apps/react-workshop/src/FileUpload.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import { useState } from 'react';
import React from 'react';
import * as React from 'react';
import {
FileUpload,
FileUploadCard,
Expand Down
1 change: 0 additions & 1 deletion apps/react-workshop/src/Flex.stories.tsx
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 React from 'react';
import { Flex } from '@itwin/itwinui-react';
import type { StoryDefault } from '@ladle/react';

Expand Down
Loading
Loading