Skip to content

Commit

Permalink
feat: upgrade park-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
tien committed Nov 20, 2024
1 parent ebd4eb6 commit 3baee90
Show file tree
Hide file tree
Showing 144 changed files with 2,074 additions and 1,761 deletions.
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"postinstall": "papi && panda codegen"
},
"dependencies": {
"@ark-ui/react": "^4.1.2",
"@ark-ui/react": "^4.4.4",
"@dnd-kit/core": "^6.1.0",
"@dnd-kit/modifiers": "^7.0.0",
"@dnd-kit/sortable": "^8.0.0",
Expand All @@ -36,24 +36,24 @@
"@reactive-dot/react": "^0.26.2",
"@reactive-dot/wallet-ledger": "^0.16.18",
"@reactive-dot/wallet-walletconnect": "^0.16.18",
"@tanstack/react-router": "^1.81.9",
"@tanstack/react-router": "^1.82.1",
"@w3f/polkadot-icons": "^1.0.0",
"date-fns": "^4.1.0",
"dot-connect": "^0.12.1",
"dot-identicon": "^0.1.0",
"jotai": "^2.10.2",
"polkadot-api": "^1.7.3",
"jotai": "^2.10.3",
"polkadot-api": "^1.7.6",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-error-boundary": "^4.1.2",
"react18-json-view": "^0.2.9-canary.8"
},
"devDependencies": {
"@eslint/compat": "^1.2.3",
"@eslint/js": "^9.14.0",
"@pandacss/dev": "^0.47.1",
"@park-ui/panda-preset": "^0.42.0",
"@tanstack/router-devtools": "^1.81.9",
"@eslint/js": "^9.15.0",
"@pandacss/dev": "^0.48.0",
"@park-ui/panda-preset": "^0.43.0",
"@tanstack/router-devtools": "^1.82.1",
"@tanstack/router-plugin": "^1.81.9",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@tsconfig/strictest": "^2.0.5",
Expand All @@ -62,13 +62,13 @@
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.3",
"eslint": "^9.14.0",
"eslint": "^9.15.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"prettier": "^3.3.3",
"typescript": "^5.6.3",
"typescript-eslint": "^8.14.0",
"typescript-eslint": "^8.15.0",
"vite": "^5.4.11",
"vite-tsconfig-paths": "^5.1.2"
"vite-tsconfig-paths": "^5.1.3"
}
}
9 changes: 5 additions & 4 deletions panda.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { defineConfig } from "@pandacss/dev";
import { createPreset } from "@park-ui/panda-preset";
import crimson from "@park-ui/panda-preset/colors/crimson";
import neutral from "@park-ui/panda-preset/colors/neutral";

export default defineConfig({
preflight: true,
presets: [
"@pandacss/preset-base",
createPreset({
accentColor: "crimson",
grayColor: "neutral",
borderRadius: "2xl",
accentColor: crimson,
grayColor: neutral,
radius: "2xl",
}),
],
include: ["./src/**/*.{js,jsx,ts,tsx}"],
Expand Down
6 changes: 1 addition & 5 deletions park-ui.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"$schema": "https://park-ui.com/registry/latest/schema.json",
"importAlias": "~/*",
"jsFramework": "react",
"outputPaths": {
"componentsDir": "~/components/ui",
"libDir": "~/lib"
}
"outputPath": "./src/components/ui"
}
9 changes: 5 additions & 4 deletions src/components/account-list-item.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Heading, Text } from "./ui";
import { Heading } from "./ui/heading";
import { Icon } from "./ui/icon";
import { Text } from "./ui/text";
import { idle } from "@reactive-dot/core";
import { useLazyLoadQuery } from "@reactive-dot/react";
import IdentityIcon from "@w3f/polkadot-icons/solid/Identity";
Expand Down Expand Up @@ -146,13 +147,13 @@ function AccountListItemTemplate({
case "on-chain":
return (
<Icon size="sm">
<IdentityIcon fill="var(--colors-accent-emphasized)" />
<IdentityIcon fill="var(--colors-color-palette-emphasized)" />
</Icon>
);
case "sub-identity":
return (
<Icon size="sm">
<SubIdentityIcon fill="var(--colors-accent-emphasized)" />
<SubIdentityIcon fill="var(--colors-color-palette-emphasized)" />
</Icon>
);
default:
Expand All @@ -168,7 +169,7 @@ function AccountListItemTemplate({
style={
identityType === undefined
? undefined
: { color: "var(--colors-accent-emphasized)" }
: { color: "var(--colors-color-palette-emphasized)" }
}
>
{displayName ?? (
Expand Down
2 changes: 1 addition & 1 deletion src/components/codec-view.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { unbinary } from "../utils";
import { Code } from "./ui";
import { Code } from "./ui/code";
import JsonView from "react18-json-view";
import { css, cx } from "styled-system/css";

Expand Down
5 changes: 2 additions & 3 deletions src/components/constant-form.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import type { ConstantQuery, Pallet } from "../types";
import { PalletSelect } from "./pallet-select";
import { Select } from "./select";
import { Button, Code } from "./ui";
import { Button } from "./ui/button";
import { Code } from "./ui/code";
import { useChainId } from "@reactive-dot/react";
import Check from "@w3f/polkadot-icons/solid/Check";
import ChevronDown from "@w3f/polkadot-icons/solid/ChevronDown";
import { useState, type ReactNode } from "react";
import { css } from "styled-system/css";

Expand Down
3 changes: 2 additions & 1 deletion src/components/param/accountId.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { AccountSelect } from "../account-select";
import { Input, Switch } from "../ui";
import { Input } from "../ui/input";
import { Switch } from "../ui/switch";
import { INCOMPLETE, INVALID, type ParamProps } from "./common";
import { getSs58AddressInfo } from "@polkadot-api/substrate-bindings";
import type {
Expand Down
6 changes: 5 additions & 1 deletion src/components/param/binary.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { Button, FileUpload, IconButton, Input, Switch } from "../ui";
import { Button } from "../ui/button";
import { FileUpload } from "../ui/file-upload";
import { IconButton } from "../ui/icon-button";
import { Input } from "../ui/input";
import { Switch } from "../ui/switch";
import { INCOMPLETE, type ParamInput, type ParamProps } from "./common";
import { Binary } from "@polkadot-api/substrate-bindings";
import Delete from "@w3f/polkadot-icons/solid/DeleteCancel";
Expand Down
2 changes: 1 addition & 1 deletion src/components/param/compact.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Input } from "../ui";
import { Input } from "../ui/input";
import type { ParamProps } from "./common";
import { useEffect, useState } from "react";

Expand Down
2 changes: 1 addition & 1 deletion src/components/param/options.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Switch } from "../ui";
import { Switch } from "../ui/switch";
import { CodecParam } from "./codec";
import { INCOMPLETE, type ParamInput, type ParamProps } from "./common";
import type { OptionDecoded, OptionShape } from "@polkadot-api/view-builder";
Expand Down
3 changes: 2 additions & 1 deletion src/components/param/primitive.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Input, Switch } from "../ui";
import { Input } from "../ui/input";
import { Switch } from "../ui/switch";
import type { ParamProps } from "./common";
import type { PrimitiveDecoded } from "@polkadot-api/view-builder";
import { type ChangeEvent, useEffect, useState } from "react";
Expand Down
3 changes: 2 additions & 1 deletion src/components/param/sequence.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Button, IconButton } from "../ui";
import { Button } from "../ui/button";
import { IconButton } from "../ui/icon-button";
import { CodecParam } from "./codec";
import {
INCOMPLETE,
Expand Down
2 changes: 1 addition & 1 deletion src/components/param/struct.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FormLabel } from "../ui";
import { FormLabel } from "../ui/form-label";
import { CodecParam } from "./codec";
import { INCOMPLETE, INVALID, type ParamProps } from "./common";
import type { StructDecoded, StructShape } from "@polkadot-api/view-builder";
Expand Down
20 changes: 9 additions & 11 deletions src/components/query-result.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import type { Query } from "../types";
import { stringifyCodec } from "../utils";
import { CodecView } from "./codec-view";
import { Card, Code, FormLabel, IconButton, Progress } from "./ui";
import { Card } from "./ui/card";
import { Code } from "./ui/code";
import { FormLabel } from "./ui/form-label";
import { IconButton } from "./ui/icon-button";
import { Progress } from "./ui/progress";
import {
useLazyLoadQueryWithRefresh,
useQueryErrorResetter,
Expand Down Expand Up @@ -177,7 +181,7 @@ function QueryErrorBoundary({ onDelete, children }: QueryErrorBoundaryProps) {

return (
<ErrorBoundary
fallbackRender={({ error, resetErrorBoundary }) => (
fallbackRender={({ resetErrorBoundary }) => (
<Card.Root>
<Card.Header>
<Card.Title
Expand All @@ -189,22 +193,16 @@ function QueryErrorBoundary({ onDelete, children }: QueryErrorBoundaryProps) {
})}
>
<div>Error fetching query</div>
<IconButton
variant="ghost"
onClick={() => resetErrorBoundary(error)}
>
<IconButton variant="ghost" onClick={() => resetErrorBoundary()}>
<Close fill="currentcolor" />
</IconButton>
</Card.Title>
</Card.Header>
</Card.Root>
)}
onReset={(details) => {
onReset={() => {
onDelete();
if (details.reason === "imperative-api") {
const [error] = details.args;
resetQueryError(error);
}
resetQueryError();
}}
>
{children}
Expand Down
2 changes: 1 addition & 1 deletion src/components/runtime-api-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useMetadata } from "../hooks/metadata";
import type { RuntimeApi, RuntimeApiMethod, RuntimeApiQuery } from "../types";
import { CodecParam, INCOMPLETE, INVALID } from "./param";
import { Select } from "./select";
import { Button, Code } from "./ui";
import { Button } from "./ui/button";
import { useChainId } from "@reactive-dot/react";
import { useState } from "react";
import { css } from "styled-system/css";
Expand Down
2 changes: 1 addition & 1 deletion src/components/select.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Select as BaseSelect } from "./ui";
import { Select as BaseSelect } from "./ui/select";
import { createListCollection } from "@ark-ui/react";
import Check from "@w3f/polkadot-icons/solid/Check";
import ChevronDown from "@w3f/polkadot-icons/solid/ChevronDown";
Expand Down
5 changes: 4 additions & 1 deletion src/components/storage-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import {
type ParamInput,
} from "./param";
import { Select } from "./select";
import { Button, Code, FormLabel, Text } from "./ui";
import { Button } from "./ui/button";
import { Code } from "./ui/code";
import { FormLabel } from "./ui/form-label";
import { Text } from "./ui/text";
import { useChainId } from "@reactive-dot/react";
import { useMemo, useState, type ReactNode } from "react";
import { css } from "styled-system/css";
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/accordion.tsx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * as Accordion from "./primitives/accordion";
export * as Accordion from "./styled/accordion";
2 changes: 1 addition & 1 deletion src/components/ui/alert.tsx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * as Alert from "./primitives/alert";
export * as Alert from "./styled/alert";
14 changes: 7 additions & 7 deletions src/components/ui/avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as ArkAvatar from "./primitives/avatar";
import * as StyledAvatar from "./styled/avatar";
import { forwardRef } from "react";

export interface AvatarProps extends ArkAvatar.RootProps {
export interface AvatarProps extends StyledAvatar.RootProps {
name?: string;
src?: string;
}
Expand All @@ -10,12 +10,12 @@ export const Avatar = forwardRef<HTMLDivElement, AvatarProps>((props, ref) => {
const { name, src, ...rootProps } = props;

return (
<ArkAvatar.Root ref={ref} {...rootProps}>
<ArkAvatar.Fallback>
<StyledAvatar.Root ref={ref} {...rootProps}>
<StyledAvatar.Fallback>
{getInitials(name) || <UserIcon />}
</ArkAvatar.Fallback>
<ArkAvatar.Image src={src} alt={name} />
</ArkAvatar.Root>
</StyledAvatar.Fallback>
<StyledAvatar.Image src={src} alt={name} />
</StyledAvatar.Root>
);
});

Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/badge.tsx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { Badge, type BadgeProps } from "./primitives/badge";
export { Badge, type BadgeProps } from "./styled/badge";
12 changes: 9 additions & 3 deletions src/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Spinner } from "./spinner";
import {
Button as StyledButton,
type ButtonProps as StyledButtonProps,
} from "./primitives/button";
import { Spinner } from "./spinner";
} from "./styled/button";
import { forwardRef } from "react";
import { Center, styled } from "styled-system/jsx";

Expand Down Expand Up @@ -46,6 +46,12 @@ const ButtonSpinner = () => (
top="50%"
insetStart="50%"
>
<Spinner colorPalette="gray" />
<Spinner
width="1.1em"
height="1.1em"
borderWidth="1.5px"
borderTopColor="fg.disabled"
borderRightColor="fg.disabled"
/>
</Center>
);
2 changes: 1 addition & 1 deletion src/components/ui/card.tsx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * as Card from "./primitives/card";
export * as Card from "./styled/card";
2 changes: 1 addition & 1 deletion src/components/ui/carousel.tsx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * as Carousel from "./primitives/carousel";
export * as Carousel from "./styled/carousel";
24 changes: 12 additions & 12 deletions src/components/ui/checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import * as ArkCheckbox from "./primitives/checkbox";
import * as StyledCheckbox from "./styled/checkbox";
import { forwardRef } from "react";

export interface CheckboxProps extends ArkCheckbox.RootProps {}
export interface CheckboxProps extends StyledCheckbox.RootProps {}

export const Checkbox = forwardRef<HTMLLabelElement, CheckboxProps>(
(props, ref) => {
const { children, ...rootProps } = props;

return (
<ArkCheckbox.Root ref={ref} {...rootProps}>
<ArkCheckbox.Control>
<ArkCheckbox.Indicator>
<StyledCheckbox.Root ref={ref} {...rootProps}>
<StyledCheckbox.Control>
<StyledCheckbox.Indicator>
<CheckIcon />
</ArkCheckbox.Indicator>
<ArkCheckbox.Indicator indeterminate>
</StyledCheckbox.Indicator>
<StyledCheckbox.Indicator indeterminate>
<MinusIcon />
</ArkCheckbox.Indicator>
</ArkCheckbox.Control>
{children && <ArkCheckbox.Label>{children}</ArkCheckbox.Label>}
<ArkCheckbox.HiddenInput />
</ArkCheckbox.Root>
</StyledCheckbox.Indicator>
</StyledCheckbox.Control>
{children && <StyledCheckbox.Label>{children}</StyledCheckbox.Label>}
<StyledCheckbox.HiddenInput />
</StyledCheckbox.Root>
);
},
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/clipboard.tsx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * as Clipboard from "./primitives/clipboard";
export * as Clipboard from "./styled/clipboard";
2 changes: 1 addition & 1 deletion src/components/ui/code.tsx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { Code, type CodeProps } from "./primitives/code";
export { Code, type CodeProps } from "./styled/code";
2 changes: 1 addition & 1 deletion src/components/ui/collapsible.tsx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * as Collapsible from "./primitives/collapsible";
export * as Collapsible from "./styled/collapsible";
2 changes: 1 addition & 1 deletion src/components/ui/color-picker.tsx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * as ColorPicker from "./primitives/color-picker";
export * as ColorPicker from "./styled/color-picker";
3 changes: 2 additions & 1 deletion src/components/ui/combobox.tsx
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * as Combobox from "./primitives/combobox";
export { createListCollection } from "@ark-ui/react/combobox";
export * as Combobox from "./styled/combobox";
2 changes: 1 addition & 1 deletion src/components/ui/date-picker.tsx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * as DatePicker from "./primitives/date-picker";
export * as DatePicker from "./styled/date-picker";
2 changes: 1 addition & 1 deletion src/components/ui/dialog.tsx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * as Dialog from "./primitives/dialog";
export * as Dialog from "./styled/dialog";
2 changes: 1 addition & 1 deletion src/components/ui/drawer.tsx
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * as Drawer from "./primitives/drawer";
export * as Drawer from "./styled/drawer";
Loading

0 comments on commit 3baee90

Please sign in to comment.