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:
authored and GitHub committed 2023-01-23 23:08:01 +00:00
1 parent a888be6e04
commit cfa8fd8b67
155 files changed
+881 -768

No files matched your search

@@ -1,6 +1,6 @@
import { FieldValues, useFormContext } from "react-hook-form";
import { Icon } from "../../../components/icon";
import { FiCheck, FiCircle, FiInfo, FiX } from "@calcom/ui/components/icon";
export function HintsOrErrors<T extends FieldValues = FieldValues>(props: {
hintErrors?: string[];
@@ -48,12 +48,12 @@ export function HintsOrErrors<T extends FieldValues = FieldValues>(props: {
className={error !== undefined ? (submitted ? "text-red-700" : "") : "text-green-600"}>
{error !== undefined ? (
submitted ? (
<Icon.FiX size="12" strokeWidth="3" className="-ml-1 inline-block ltr:mr-2 rtl:ml-2" />
<FiX size="12" strokeWidth="3" className="-ml-1 inline-block ltr:mr-2 rtl:ml-2" />
) : (
<Icon.FiCircle fill="currentColor" size="5" className="inline-block ltr:mr-2 rtl:ml-2" />
<FiCircle fill="currentColor" size="5" className="inline-block ltr:mr-2 rtl:ml-2" />
)
) : (
<Icon.FiCheck size="12" strokeWidth="3" className="-ml-1 inline-block ltr:mr-2 rtl:ml-2" />
<FiCheck size="12" strokeWidth="3" className="-ml-1 inline-block ltr:mr-2 rtl:ml-2" />
)}
{t(`${fieldName}_hint_${key}`)}
</li>
@@ -68,7 +68,7 @@ export function HintsOrErrors<T extends FieldValues = FieldValues>(props: {
if (fieldErrors) {
return (
<div className="text-gray mt-2 flex items-center text-sm text-red-700">
<Icon.FiInfo className="mr-1 h-3 w-3" />
<FiInfo className="mr-1 h-3 w-3" />
<>{fieldErrors.message}</>
</div>
);
@@ -86,9 +86,9 @@ export function HintsOrErrors<T extends FieldValues = FieldValues>(props: {
return (
<li key={key} className={!!dirty ? "text-green-600" : ""}>
{!!dirty ? (
<Icon.FiCheck size="12" strokeWidth="3" className="-ml-1 inline-block ltr:mr-2 rtl:ml-2" />
<FiCheck size="12" strokeWidth="3" className="-ml-1 inline-block ltr:mr-2 rtl:ml-2" />
) : (
<Icon.FiCircle fill="currentColor" size="5" className="inline-block ltr:mr-2 rtl:ml-2" />
<FiCircle fill="currentColor" size="5" className="inline-block ltr:mr-2 rtl:ml-2" />
)}
{t(`${fieldName}_hint_${key}`)}
</li>
+5 -4
View File
@@ -4,8 +4,9 @@ import { FieldValues, FormProvider, SubmitHandler, useFormContext, UseFormReturn
import classNames from "@calcom/lib/classNames";
import { getErrorFromUnknown } from "@calcom/lib/errors";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { FiEye, FiEyeOff, FiX } from "@calcom/ui/components/icon";
import { Alert, Icon, showToast, Skeleton, Tooltip, UnstyledSelect } from "../../..";
import { Alert, showToast, Skeleton, Tooltip, UnstyledSelect } from "../../..";
import { HintsOrErrors } from "./HintOrErrors";
import { Label } from "./Label";
@@ -162,7 +163,7 @@ export const InputField = forwardRef<HTMLInputElement, InputFieldProps>(function
</Addon>
)}
{type === "search" && inputValue?.toString().length > 0 && (
<Icon.FiX
<FiX
className="absolute top-2.5 h-4 w-4 cursor-pointer text-gray-500 ltr:right-2 rtl:left-2"
onClick={(e) => {
setInputValue("");
@@ -220,9 +221,9 @@ export const PasswordField = forwardRef<HTMLInputElement, InputFieldProps>(funct
type="button"
onClick={() => toggleIsPasswordVisible()}>
{isPasswordVisible ? (
<Icon.FiEyeOff className="h-4 stroke-[2.5px]" />
<FiEyeOff className="h-4 stroke-[2.5px]" />
) : (
<Icon.FiEye className="h-4 stroke-[2.5px]" />
<FiEye className="h-4 stroke-[2.5px]" />
)}
<span className="sr-only">{textLabel}</span>
</button>