Skip to content

Commit

Permalink
refactor: use upstreamed FormikField (canonical#1744)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-cucu authored Mar 21, 2024
1 parent 61464f4 commit baed518
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 111 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"dependencies": {
"@canonical/jujulib": "6.0.0",
"@canonical/macaroon-bakery": "1.3.2",
"@canonical/react-components": "0.50.5",
"@canonical/react-components": "0.51.0",
"@reduxjs/toolkit": "2.0.1",
"@sentry/browser": "7.93.0",
"ansi-to-html": "0.7.2",
Expand Down
50 changes: 0 additions & 50 deletions src/components/FormikField/FormikField.test.tsx

This file was deleted.

43 changes: 0 additions & 43 deletions src/components/FormikField/FormikField.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/components/FormikField/index.ts

This file was deleted.

10 changes: 6 additions & 4 deletions src/components/secrets/RevisionField/RevisionField.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import type { PropsWithSpread, SelectProps } from "@canonical/react-components";
import { Select } from "@canonical/react-components";
import type {
FormikFieldProps,
PropsWithSpread,
SelectProps,
} from "@canonical/react-components";
import { FormikField, Select } from "@canonical/react-components";

import type { FormikFieldProps } from "components/FormikField";
import FormikField from "components/FormikField";
import { getSecretByURI } from "store/juju/selectors";
import { useAppSelector } from "store/store";

Expand Down
9 changes: 6 additions & 3 deletions src/components/secrets/SecretForm/Fields/Fields.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { Button, Icon, Textarea } from "@canonical/react-components";
import {
Button,
FormikField,
Icon,
Textarea,
} from "@canonical/react-components";
import { FieldArray, useFormikContext } from "formik";

import FormikField from "components/FormikField/FormikField";

import type { FormFields } from "../types";

export enum Label {
Expand Down
8 changes: 6 additions & 2 deletions src/panels/GrantSecretPanel/GrantSecretPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import type { ErrorResults } from "@canonical/jujulib/dist/api/facades/secrets/SecretsV2";
import { ActionButton, Button, Spinner } from "@canonical/react-components";
import {
ActionButton,
Button,
FormikField,
Spinner,
} from "@canonical/react-components";
import { Form, Formik } from "formik";
import { useId, useState, useRef } from "react";
import { useSelector } from "react-redux";
import { useParams } from "react-router-dom";

import FormikField from "components/FormikField";
import Panel from "components/Panel";
import type { EntityDetailsRoute } from "components/Routes/Routes";
import SecretLabel from "components/secrets/SecretLabel";
Expand Down
3 changes: 1 addition & 2 deletions src/panels/RemoveSecretPanel/Fields/Fields.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { ConfirmationModal } from "@canonical/react-components";
import { ConfirmationModal, FormikField } from "@canonical/react-components";
import { useFormikContext } from "formik";
import { useSelector } from "react-redux";
import { useParams } from "react-router-dom";
import usePortal from "react-useportal";

import FormikField from "components/FormikField/FormikField";
import type { EntityDetailsRoute } from "components/Routes/Routes";
import RevisionField from "components/secrets/RevisionField";
import { getSecretByURI, getModelUUIDFromList } from "store/juju/selectors";
Expand Down
11 changes: 6 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1818,9 +1818,9 @@ __metadata:
languageName: node
linkType: hard

"@canonical/react-components@npm:0.50.5":
version: 0.50.5
resolution: "@canonical/react-components@npm:0.50.5"
"@canonical/react-components@npm:0.51.0":
version: 0.51.0
resolution: "@canonical/react-components@npm:0.51.0"
dependencies:
"@types/jest": "npm:29.5.11"
"@types/node": "npm:20.8.5"
Expand All @@ -1836,10 +1836,11 @@ __metadata:
peerDependencies:
"@types/react": ^17.0.2 || ^18.0.0
"@types/react-dom": ^17.0.2 || ^18.0.0
formik: ^2.4.5
react: ^17.0.2 || ^18.0.0
react-dom: ^17.0.2 || ^18.0.0
vanilla-framework: ^3.15.1 || ^4.0.0
checksum: fba425fd06731a982666e889e0adf85d7fd28b8c408e1713e179d3cb267706e434dec7ef406977803dc95d5bac3d079c0e88e756a279669517fc689885531e6d
checksum: f1db7593e44d1e8fb517a7056ad3e5954ba1c2185094779f759169411346a83ea49cc11c86fdc38914f745b6d88a6ba5554650c0b6626fc79d9ee8884f5e198c
languageName: node
linkType: hard

Expand Down Expand Up @@ -11293,7 +11294,7 @@ __metadata:
"@babel/plugin-proposal-private-property-in-object": "npm:7.21.11"
"@canonical/jujulib": "npm:6.0.0"
"@canonical/macaroon-bakery": "npm:1.3.2"
"@canonical/react-components": "npm:0.50.5"
"@canonical/react-components": "npm:0.51.0"
"@reduxjs/toolkit": "npm:2.0.1"
"@sentry/browser": "npm:7.93.0"
"@testing-library/jest-dom": "npm:6.2.0"
Expand Down

0 comments on commit baed518

Please sign in to comment.