Skip to content

Commit

Permalink
use the new JSX transform (#2102)
Browse files Browse the repository at this point in the history
  • Loading branch information
mayank99 authored Jun 14, 2024
1 parent b0dc883 commit d09f35f
Show file tree
Hide file tree
Showing 178 changed files with 207 additions and 381 deletions.
5 changes: 5 additions & 0 deletions .changeset/fresh-hats-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@itwin/itwinui-react': minor
---

The build output now uses the [new JSX transform](https://react.dev/link/new-jsx-transform) instead of `React.createElement`.
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

0 comments on commit d09f35f

Please sign in to comment.