Reduce bundle size by importing single icons at a time (#6644)
* Removed barrel import for icons to reduce bundle size. * Fixed replacement mistakes * Reverted unneccesary yarn.lock updates * Added some missed Icon. import conversions * Remove merge artifact import in @calcom/ui * Don't import Icon in pages/[user] * Update packages/ui/package.json Co-authored-by: Alex van Andel <[email protected]> Co-authored-by: Omar López <[email protected]>
This commit is contained in:
155 files changed
+881
-768
No files matched your search
@@ -3,7 +3,8 @@ import { Props } from "react-select";
|
||||
|
||||
import { classNames } from "@calcom/lib";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Avatar, Icon, Select } from "@calcom/ui";
|
||||
import { Avatar, Select } from "@calcom/ui";
|
||||
import { FiX } from "@calcom/ui/components/icon";
|
||||
|
||||
export type CheckedSelectOption = {
|
||||
avatar: string;
|
||||
@@ -48,7 +49,7 @@ export const CheckedTeamSelect = ({
|
||||
<li key={option.value} className={`flex py-2 px-3 ${index === value.length - 1 ? "" : "border-b"}`}>
|
||||
<Avatar size="sm" imageSrc={option.avatar} alt={option.label} />
|
||||
<p className="my-auto ml-3 text-sm text-gray-900">{option.label}</p>
|
||||
<Icon.FiX
|
||||
<FiX
|
||||
onClick={() => props.onChange(value.filter((item) => item.value !== option.value))}
|
||||
className="my-auto ml-auto"
|
||||
/>
|
||||
|
||||
@@ -27,12 +27,12 @@ import {
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
Form,
|
||||
Icon,
|
||||
RadioGroup as RadioArea,
|
||||
showToast,
|
||||
TextAreaField,
|
||||
TextField,
|
||||
} from "@calcom/ui";
|
||||
import { FiPlus, FiChevronDown } from "@calcom/ui/components/icon";
|
||||
|
||||
import { DuplicateDialog } from "./DuplicateDialog";
|
||||
|
||||
@@ -283,7 +283,7 @@ export default function CreateEventTypeButton(props: CreateEventTypeBtnProps) {
|
||||
<Button
|
||||
onClick={() => openModal(props.options[0])}
|
||||
data-testid="new-event-type"
|
||||
StartIcon={Icon.FiPlus}
|
||||
StartIcon={FiPlus}
|
||||
variant="fab"
|
||||
disabled={!props.canAddEvents}>
|
||||
{t("new")}
|
||||
@@ -291,7 +291,7 @@ export default function CreateEventTypeButton(props: CreateEventTypeBtnProps) {
|
||||
) : (
|
||||
<Dropdown>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="fab" StartIcon={Icon.FiPlus}>
|
||||
<Button variant="fab" StartIcon={FiPlus}>
|
||||
{t("new")}
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Badge, Button, ButtonGroup, Icon } from "@calcom/ui";
|
||||
import { Badge, Button, ButtonGroup } from "@calcom/ui";
|
||||
import { FiTrash } from "@calcom/ui/components/icon";
|
||||
|
||||
type Props = {
|
||||
required?: boolean;
|
||||
@@ -27,7 +28,7 @@ function CustomInputItem({ required, deleteOnClick, editOnClick, type, question
|
||||
{t("edit")}
|
||||
</Button>
|
||||
<Button
|
||||
StartIcon={Icon.FiTrash}
|
||||
StartIcon={FiTrash}
|
||||
variant="icon"
|
||||
color="destructive"
|
||||
onClick={deleteOnClick}
|
||||
|
||||
@@ -8,7 +8,8 @@ import getStripeAppData from "@calcom/lib/getStripeAppData";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { baseEventTypeSelect } from "@calcom/prisma";
|
||||
import { EventTypeModel } from "@calcom/prisma/zod";
|
||||
import { Badge, Icon } from "@calcom/ui";
|
||||
import { Badge } from "@calcom/ui";
|
||||
import { FiClock, FiUsers, FiRefreshCw, FiCreditCard, FiClipboard, FiPlus } from "@calcom/ui/components/icon";
|
||||
|
||||
export type EventTypeDescriptionProps = {
|
||||
eventType: Pick<
|
||||
@@ -43,21 +44,21 @@ export const EventTypeDescription = ({ eventType, className }: EventTypeDescript
|
||||
{eventType.metadata?.multipleDuration ? (
|
||||
eventType.metadata.multipleDuration.map((dur, idx) => (
|
||||
<li key={idx}>
|
||||
<Badge variant="gray" size="lg" StartIcon={Icon.FiClock}>
|
||||
<Badge variant="gray" size="lg" StartIcon={FiClock}>
|
||||
{dur}m
|
||||
</Badge>
|
||||
</li>
|
||||
))
|
||||
) : (
|
||||
<li>
|
||||
<Badge variant="gray" size="lg" StartIcon={Icon.FiClock}>
|
||||
<Badge variant="gray" size="lg" StartIcon={FiClock}>
|
||||
{eventType.length}m
|
||||
</Badge>
|
||||
</li>
|
||||
)}
|
||||
{eventType.schedulingType && (
|
||||
<li>
|
||||
<Badge variant="gray" size="lg" StartIcon={Icon.FiUsers}>
|
||||
<Badge variant="gray" size="lg" StartIcon={FiUsers}>
|
||||
{eventType.schedulingType === SchedulingType.ROUND_ROBIN && t("round_robin")}
|
||||
{eventType.schedulingType === SchedulingType.COLLECTIVE && t("collective")}
|
||||
</Badge>
|
||||
@@ -65,7 +66,7 @@ export const EventTypeDescription = ({ eventType, className }: EventTypeDescript
|
||||
)}
|
||||
{recurringEvent?.count && recurringEvent.count > 0 && (
|
||||
<li className="hidden xl:block">
|
||||
<Badge variant="gray" size="lg" StartIcon={Icon.FiRefreshCw}>
|
||||
<Badge variant="gray" size="lg" StartIcon={FiRefreshCw}>
|
||||
{t("repeats_up_to", {
|
||||
count: recurringEvent.count,
|
||||
})}
|
||||
@@ -74,7 +75,7 @@ export const EventTypeDescription = ({ eventType, className }: EventTypeDescript
|
||||
)}
|
||||
{stripeAppData.price > 0 && (
|
||||
<li>
|
||||
<Badge variant="gray" size="lg" StartIcon={Icon.FiCreditCard}>
|
||||
<Badge variant="gray" size="lg" StartIcon={FiCreditCard}>
|
||||
<IntlProvider locale="en">
|
||||
<FormattedNumber
|
||||
value={stripeAppData.price / 100.0}
|
||||
@@ -87,7 +88,7 @@ export const EventTypeDescription = ({ eventType, className }: EventTypeDescript
|
||||
)}
|
||||
{eventType.requiresConfirmation && (
|
||||
<li className="hidden xl:block">
|
||||
<Badge variant="gray" size="lg" StartIcon={Icon.FiClipboard}>
|
||||
<Badge variant="gray" size="lg" StartIcon={FiClipboard}>
|
||||
{eventType.metadata?.requiresConfirmationThreshold
|
||||
? t("may_require_confirmation")
|
||||
: t("requires_confirmation")}
|
||||
@@ -97,7 +98,7 @@ export const EventTypeDescription = ({ eventType, className }: EventTypeDescript
|
||||
{/* TODO: Maybe add a tool tip to this? */}
|
||||
{eventType.requiresConfirmation || (recurringEvent?.count && recurringEvent.count) ? (
|
||||
<li className="block xl:hidden">
|
||||
<Badge variant="gray" size="lg" StartIcon={Icon.FiPlus}>
|
||||
<Badge variant="gray" size="lg" StartIcon={FiPlus}>
|
||||
<p>{[eventType.requiresConfirmation, recurringEvent?.count].filter(Boolean).length}</p>
|
||||
</Badge>
|
||||
</li>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { components, GroupBase, Props, ValueContainerProps } from "react-select";
|
||||
|
||||
import { Icon, Select } from "../../..";
|
||||
import { FiPlus } from "@calcom/ui/components/icon";
|
||||
|
||||
const LimitedChipsContainer = <Option, IsMulti extends boolean, Group extends GroupBase<Option>>({
|
||||
children,
|
||||
@@ -22,7 +22,7 @@ const LimitedChipsContainer = <Option, IsMulti extends boolean, Group extends Gr
|
||||
{overflowCounter > 0 && (
|
||||
<span className="flex items-center justify-center rounded-md bg-gray-100 py-[5px] px-2 text-[14px] font-medium leading-4 text-gray-700">
|
||||
<>
|
||||
<Icon.FiPlus className="mr-1 inline h-3 w-3 stroke-[3px]" /> <span>{overflowCounter} more</span>
|
||||
<FiPlus className="mr-1 inline h-3 w-3 stroke-[3px]" /> <span>{overflowCounter} more</span>
|
||||
</>
|
||||
</span>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user