Skip to content

Commit

Permalink
fix(ui): fix styled imports (#1802)
Browse files Browse the repository at this point in the history
* fix(ui): fix `styled` imports

* chore: changeset
  • Loading branch information
VanishMax authored Sep 23, 2024
1 parent f3500b8 commit 43d8350
Show file tree
Hide file tree
Showing 51 changed files with 55 additions and 50 deletions.
5 changes: 5 additions & 0 deletions .changeset/slow-spies-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@penumbra-zone/ui': minor
---

Fix the issue of UI package not being build correctly for some server-side environments
2 changes: 1 addition & 1 deletion packages/ui/.storybook/preview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ConditionalWrap } from '../src/ConditionalWrap';
import { PenumbraUIProvider } from '../src/PenumbraUIProvider';
import { Density } from '../src/Density';
import { Tabs } from '../src/Tabs';
import styled from 'styled-components';
import { styled } from 'styled-components';
import '../styles/globals.css';

const Column = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/AccountSelector/AccountSelectorAddress.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Address } from '@penumbra-zone/protobuf/penumbra/core/keys/v1/keys_pb';
import { bech32mAddress } from '@penumbra-zone/bech32m/penumbra';
import styled, { DefaultTheme } from 'styled-components';
import { styled, DefaultTheme } from 'styled-components';
import { useDensity } from '../hooks/useDensity';
import { Density } from '../types/Density';
import { CopyToClipboardButton } from '../CopyToClipboardButton';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/AccountSelector/IbcDepositToggle.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled from 'styled-components';
import { styled } from 'styled-components';
import { Toggle } from '../Toggle';
import { Text } from '../Text';
import { Tooltip } from '../Tooltip';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/AccountSelector/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Meta, StoryObj } from '@storybook/react';
import { AccountSelector } from '.';
import { Address } from '@penumbra-zone/protobuf/penumbra/core/keys/v1/keys_pb';
import { Text } from '../Text';
import styled from 'styled-components';
import { styled } from 'styled-components';

const u8 = (length: number) => Uint8Array.from({ length }, () => Math.floor(Math.random() * 256));

Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/AccountSelector/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Address } from '@penumbra-zone/protobuf/penumbra/core/keys/v1/keys_pb';
import { TextInput } from '../TextInput';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { body } from '../utils/typography';
import { Density } from '../Density';
import { Button } from '../Button';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/AddressViewComponent/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Meta, StoryObj } from '@storybook/react';

import { AddressViewComponent } from '.';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { ADDRESS_VIEW_DECODED, ADDRESS_VIEW_OPAQUE } from '../utils/bufs';

const MaxWidthWrapper = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/AddressViewComponent/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AddressIcon } from './AddressIcon';
import { AddressView } from '@penumbra-zone/protobuf/penumbra/core/keys/v1/keys_pb';
import { bech32mAddress } from '@penumbra-zone/bech32m/penumbra';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { Text } from '../Text';
import { CopyToClipboardButton } from '../CopyToClipboardButton';
import { Shrink0 } from '../utils/Shrink0';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/AssetIcon/DelegationTokenIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assetPatterns } from '@penumbra-zone/types/assets';
import styled from 'styled-components';
import { styled } from 'styled-components';

const Svg = styled.svg.attrs({
id: 'delegation',
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/AssetIcon/UnbondingTokenIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assetPatterns } from '@penumbra-zone/types/assets';
import styled from 'styled-components';
import { styled } from 'styled-components';

const Svg = styled.svg.attrs({
id: 'unbonding',
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/AssetIcon/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactNode } from 'react';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { Metadata } from '@penumbra-zone/protobuf/penumbra/core/asset/v1/asset_pb';
import { getDisplay } from '@penumbra-zone/getters/metadata';
import { assetPatterns } from '@penumbra-zone/types/assets';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/AssetSelector/Custom.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactNode, useId, useState } from 'react';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { RadioGroup } from '@radix-ui/react-radio-group';
import { Dialog } from '../Dialog';
import { IsAnimatingProvider } from '../IsAnimatingProvider';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/AssetSelector/ListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RadioGroupItem } from '@radix-ui/react-radio-group';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { motion } from 'framer-motion';
import { AssetIcon } from '../AssetIcon';
import { Text } from '../Text';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/AssetSelector/Trigger.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { forwardRef, MouseEventHandler } from 'react';
import styled, { css } from 'styled-components';
import { styled, css } from 'styled-components';
import { ChevronsUpDownIcon } from 'lucide-react';
import { motion } from 'framer-motion';
import { getMetadataFromBalancesResponse } from '@penumbra-zone/getters/balances-response';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/AssetSelector/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useMemo, useState } from 'react';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { Metadata } from '@penumbra-zone/protobuf/penumbra/core/asset/v1/asset_pb';
import { BalancesResponse } from '@penumbra-zone/protobuf/penumbra/view/v1/view_pb';

Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Button/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC, forwardRef, MouseEventHandler } from 'react';
import styled, { css, DefaultTheme } from 'styled-components';
import { styled, css, DefaultTheme } from 'styled-components';
import { asTransientProps } from '../utils/asTransientProps';
import { Priority, focusOutline, overlays, buttonBase } from '../utils/button';
import { getBackgroundColor } from './helpers';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/ButtonGroup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { LucideIcon } from 'lucide-react';
import { MouseEventHandler } from 'react';
import { ActionType } from '../utils/ActionType';
import { Button } from '../Button';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { media } from '../utils/media';
import { Density } from '../types/Density';
import { useDensity } from '../hooks/useDensity';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Card/Title.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled from 'styled-components';
import { styled } from 'styled-components';
import { large } from '../utils/typography';
import { ReactNode } from 'react';
import { CharacterTransition } from '../CharacterTransition';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Card/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Meta, StoryObj } from '@storybook/react';
import { Card } from '.';

import storiesBg from './storiesBg.jpg';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { Text } from '../Text';
import { FormField } from '../FormField';
import { TextInput } from '../TextInput';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Card/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactNode } from 'react';
import styled, { WebTarget } from 'styled-components';
import { styled, WebTarget } from 'styled-components';
import { hexOpacity } from '../utils/hexOpacity';
import { motion } from 'framer-motion';
import { Title } from './Title';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/CharacterTransition/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Meta, StoryObj } from '@storybook/react';
import { CharacterTransition } from '.';
import styled from 'styled-components';
import { styled } from 'styled-components';

const WhiteTextWrapper = styled.div`
color: ${props => props.theme.color.text.primary};
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/CharacterTransition/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { motion } from 'framer-motion';
import { Fragment, memo } from 'react';
import styled from 'styled-components';
import { styled } from 'styled-components';

/**
* Since we're splitting individual characters and wrapping them in `<span />`s,
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Colors.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Meta, StoryObj } from '@storybook/react';
import { Grid } from './Grid';
import { Text } from './Text';
import styled from 'styled-components';
import { styled } from 'styled-components';
import type { ColorVariant, Color as TColor, TextColorVariant } from './PenumbraUIProvider/theme';
import { Fragment } from 'react';
import { media } from './utils/media';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Dialog/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Dialog } from '.';
import { Button } from '../Button';
import { ComponentType } from 'react';
import { Text } from '../Text';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { Ban, Handshake, ThumbsUp } from 'lucide-react';

const WhiteTextWrapper = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Dialog/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createContext, ReactNode, useContext } from 'react';
import styled from 'styled-components';
import { styled } from 'styled-components';
import * as RadixDialog from '@radix-ui/react-dialog';
import { Text } from '../Text';
import { X } from 'lucide-react';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Display/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Meta, StoryObj } from '@storybook/react';

import { Display } from '.';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { Text } from '../Text';

const meta: Meta<typeof Display> = {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Display/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactNode } from 'react';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { media } from '../utils/media';

const Root = styled.section`
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/FormField/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled from 'styled-components';
import { styled } from 'styled-components';
import { small, strong } from '../utils/typography';
import { ReactNode } from 'react';
import { DisabledContext } from '../utils/DisabledContext';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Grid/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Meta, StoryObj } from '@storybook/react';
import { Grid } from '.';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { Text } from '../Text';

const meta: Meta<typeof Grid> = {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Grid/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PropsWithChildren } from 'react';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { AsTransientProps, asTransientProps } from '../utils/asTransientProps';
import { media } from '../utils/media';

Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Identicon/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useMemo } from 'react';
import { generateGradient, generateSolidColor } from './generate';
import styled from 'styled-components';
import { styled } from 'styled-components';

/**
* The view box size is separate from the passed-in `size` prop.
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/MenuItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { LucideIcon } from 'lucide-react';
import type { FC, MouseEventHandler } from 'react';
import { MenuItem as SharedMenuItem, DropdownMenuItemBase } from '../utils/menuItem';
import { Text } from '../Text';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { asTransientProps } from '../utils/asTransientProps.ts';

const IconAdornment = styled.i`
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Pill/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled, { DefaultTheme } from 'styled-components';
import { styled, DefaultTheme } from 'styled-components';
import { asTransientProps } from '../utils/asTransientProps';
import { ReactNode } from 'react';
import { body, technical, detail, detailTechnical } from '../utils/typography';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Popover/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Popover } from '.';
import { Button } from '../Button';
import { ComponentType, useState } from 'react';
import { Text } from '../Text';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { Shield } from 'lucide-react';
import { Density } from '../Density';

Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Progress/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as ProgressPrimitive from '@radix-ui/react-progress';
import styled, { type DefaultTheme, keyframes } from 'styled-components';
import { styled, type DefaultTheme, keyframes } from 'styled-components';

export const infiniteLoading = keyframes`
from {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/SegmentedControl/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled, { DefaultTheme } from 'styled-components';
import { styled, DefaultTheme } from 'styled-components';
import { button } from '../utils/typography';
import { focusOutline, overlays, buttonBase } from '../utils/button';
import { Density } from '../types/Density';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Slider/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
import styled, { css } from 'styled-components';
import { styled, css } from 'styled-components';
import * as RadixSlider from '@radix-ui/react-slider';
import { detail, detailTechnical } from '../utils/typography';
import { theme } from '../PenumbraUIProvider/theme';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/SwapInput/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled from 'styled-components';
import { styled } from 'styled-components';
import { ArrowLeftRight } from 'lucide-react';
import { Metadata } from '@penumbra-zone/protobuf/penumbra/core/asset/v1/asset_pb';
import { BalancesResponse } from '@penumbra-zone/protobuf/penumbra/view/v1/view_pb';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Table/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PropsWithChildren, ReactNode } from 'react';
import styled, { css } from 'styled-components';
import { styled, css } from 'styled-components';
import { tableHeading, tableItem } from '../utils/typography';
import { Density } from '../types/Density';
import { useDensity } from '../hooks/useDensity';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Tabs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled, { css, DefaultTheme } from 'styled-components';
import { styled, css, DefaultTheme } from 'styled-components';
import { tab, tabSmall } from '../utils/typography';
import { motion } from 'framer-motion';
import { useId } from 'react';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Text/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Meta, StoryObj } from '@storybook/react';

import { Text } from '.';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { useArgs } from '@storybook/preview-api';

const meta: Meta<typeof Text> = {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Text/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled, { css, DefaultTheme, WebTarget } from 'styled-components';
import { styled, css, DefaultTheme, WebTarget } from 'styled-components';
import {
body,
detail,
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/TextInput/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled from 'styled-components';
import { styled } from 'styled-components';
import { small } from '../utils/typography';
import { ActionType, getOutlineColorByActionType } from '../utils/ActionType';
import { useDisabled } from '../hooks/useDisabled';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Toggle/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as RadixToggle from '@radix-ui/react-toggle';
import { useDisabled } from '../hooks/useDisabled';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { buttonBase } from '../utils/button';
import { useDensity } from '../hooks/useDensity';
import { Density } from '../types/Density';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/Tooltip/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as RadixTooltip from '@radix-ui/react-tooltip';
import { ReactNode } from 'react';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { Text } from '../Text';
import { buttonBase } from '../utils/button';
import { small } from '../utils/typography';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/ValueInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { BalancesResponse } from '@penumbra-zone/protobuf/penumbra/view/v1/view_
import { getBalanceView } from '@penumbra-zone/getters/balances-response';
import { fromValueView } from '@penumbra-zone/types/amount';
import { Density } from '../Density';
import styled from 'styled-components';
import { styled } from 'styled-components';

const SelectorWrapper = styled.div`
padding-top: ${props => props.theme.spacing(2)};
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/ValueViewComponent/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactNode } from 'react';
import styled from 'styled-components';
import { styled } from 'styled-components';
import { ValueView } from '@penumbra-zone/protobuf/penumbra/core/asset/v1/asset_pb';
import { getMetadata } from '@penumbra-zone/getters/value-view';
import { getFormattedAmtFromValueView } from '@penumbra-zone/types/value-view';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/WalletBalance/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MouseEventHandler } from 'react';
import styled, { type DefaultTheme } from 'styled-components';
import { styled, type DefaultTheme } from 'styled-components';
import { Wallet } from 'lucide-react';
import type { BalancesResponse } from '@penumbra-zone/protobuf/penumbra/view/v1/view_pb';
import { getFormattedAmtFromValueView } from '@penumbra-zone/types/value-view';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/utils/Shrink0.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled from 'styled-components';
import { styled } from 'styled-components';

/**
* Utility component for wrapping other markup in a `flex-shrink: 0` container.
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/utils/menuItem.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled from 'styled-components';
import { styled } from 'styled-components';
import { ActionType, getColorByActionType, getOutlineColorByActionType } from './ActionType.ts';

export interface DropdownMenuItemBase {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/utils/popover.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import styled, { keyframes } from 'styled-components';
import { styled, keyframes } from 'styled-components';

export const scaleIn = keyframes`
from {
Expand Down

0 comments on commit 43d8350

Please sign in to comment.