Skip to content

Commit

Permalink
refactor(misc): change imports from '@patternfly/react-core' to direc…
Browse files Browse the repository at this point in the history
…t imports (#11376)

- this change reduces size of CSS that is imported
  • Loading branch information
adamviktora authored Jan 14, 2025
1 parent ffab293 commit 80805a8
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,17 @@ import * as React from 'react';
import { css } from '@patternfly/react-styles';
import styles from '@patternfly/react-styles/css/components/CodeEditor/code-editor';
import fileUploadStyles from '@patternfly/react-styles/css/components/FileUpload/file-upload';
import { Button, ButtonVariant } from '@patternfly/react-core/dist/esm/components/Button';
import {
Button,
ButtonVariant,
EmptyState,
EmptyStateBody,
EmptyStateActions,
EmptyStateVariant,
EmptyStateBody,
EmptyStateFooter,
getResizeObserver,
Popover,
PopoverProps,
TooltipPosition
} from '@patternfly/react-core';
EmptyStateVariant
} from '@patternfly/react-core/dist/esm/components/EmptyState';
import { Popover, PopoverProps } from '@patternfly/react-core/dist/esm/components/Popover';
import { TooltipPosition } from '@patternfly/react-core/dist/esm/components/Tooltip';
import { getResizeObserver } from '@patternfly/react-core/dist/esm/helpers/resizeObserver';
import Editor, { EditorProps, Monaco } from '@monaco-editor/react';
import type { editor } from 'monaco-editor';
import CopyIcon from '@patternfly/react-icons/dist/esm/icons/copy-icon';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { Button, ButtonProps, Tooltip } from '@patternfly/react-core';
import { Button, ButtonProps } from '@patternfly/react-core/dist/esm/components/Button';
import { Tooltip } from '@patternfly/react-core/dist/esm/components/Tooltip';
import { CodeEditorContext } from './CodeEditorUtils';

/** Allows customizing the code editor controls by passing this sub-component into the
Expand Down
5 changes: 4 additions & 1 deletion packages/react-docs/patternfly-docs/pages/icons.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React from 'react';
import { Tooltip, Grid, GridItem, PageSection, Content } from '@patternfly/react-core';
import { Content } from '@patternfly/react-core/dist/esm/components/Content';
import { Grid, GridItem } from '@patternfly/react-core/dist/esm/layouts/Grid';
import { PageSection } from '@patternfly/react-core/dist/esm/components/Page/PageSection';
import { Tooltip } from '@patternfly/react-core/dist/esm/components/Tooltip';
import spacerMd from '@patternfly/react-tokens/dist/esm/t_global_spacer_md';
import labelFontSize from '@patternfly/react-tokens/dist/esm/t_global_font_size_sm';
import * as IconsModule from '@patternfly/react-icons/dist/esm';
Expand Down
3 changes: 2 additions & 1 deletion packages/react-docs/patternfly-docs/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import { Title, PageSection } from '@patternfly/react-core';
import { PageSection } from '@patternfly/react-core/dist/esm/components/Page/PageSection';
import { Title } from '@patternfly/react-core/dist/esm/components/Title';

// https://philipwalton.github.io/solved-by-flexbox/demos/vertical-centering/
const centerStyle = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { css } from '@patternfly/react-styles';
import { Button } from '@patternfly/react-core';
import { Button } from '@patternfly/react-core/dist/esm/components/Button';
import dragButtonStyles from '@patternfly/react-styles/css/components/DataList/data-list';
import GripVerticalIcon from '@patternfly/react-icons/dist/esm/icons/grip-vertical-icon';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ import { Draggable } from './Draggable';
import { DraggableDataListItem } from './DraggableDataListItem';
import { DraggableDualListSelectorListItem } from './DraggableDualListSelectorListItem';
import styles from '@patternfly/react-styles/css/components/DragDrop/drag-drop';
import { DataList, canUseDOM } from '@patternfly/react-core';
import { DataList } from '@patternfly/react-core/dist/esm/components/DataList/DataList';
import { canUseDOM } from '@patternfly/react-core/dist/esm/helpers/util';

export type DragDropContainerDragStartEvent = DragStartEvent;
export type DragDropContainerDragOverEvent = DragOverEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { css } from '@patternfly/react-styles';
import styles from '@patternfly/react-styles/css/components/DataList/data-list';
import dragStyles from '@patternfly/react-styles/css/components/DragDrop/drag-drop';
import { DragButton } from './DragButton';
import { DataListItemRow, DataListControl } from '@patternfly/react-core';
import { DataListItemRow } from '@patternfly/react-core/dist/esm/components/DataList/DataListItemRow';
import { DataListControl } from '@patternfly/react-core/dist/esm/components/DataList/DataListControl';

export interface DraggableDataListItemObject {
id?: string;
Expand Down
24 changes: 11 additions & 13 deletions packages/react-integration/demo-app-ts/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
import React from 'react';
import { BrowserRouter as Router, Route, Link, Switch } from 'react-router-dom';
import { Avatar } from '@patternfly/react-core/dist/esm/components/Avatar';
import { Brand } from '@patternfly/react-core/dist/esm/components/Brand';
import {
Avatar,
Brand,
Masthead,
MastheadLogo,
MastheadBrand,
MastheadContent,
MastheadMain,
MastheadToggle,
Nav,
NavItem,
NavList,
MastheadToggle
} from '@patternfly/react-core/dist/esm/components/Masthead';
import { Nav, NavList, NavItem } from '@patternfly/react-core/dist/esm/components/Nav';
import {
Page,
PageSection,
PageSidebar,
PageSidebarBody,
PageToggleButton,
Radio,
SkipToContent,
Toolbar,
ToolbarGroup,
ToolbarItem
} from '@patternfly/react-core';
PageToggleButton
} from '@patternfly/react-core/dist/esm/components/Page';
import { Radio } from '@patternfly/react-core/dist/esm/components/Radio';
import { SkipToContent } from '@patternfly/react-core/dist/esm/components/SkipToContent';
import { Toolbar, ToolbarGroup, ToolbarItem } from '@patternfly/react-core/dist/esm/components/Toolbar';
import imgBrand from './assets/images/imgBrand.svg';
import imgAvatar from './assets/images/imgAvatar.svg';
import BarsIcon from '@patternfly/react-icons/dist/esm/icons/bars-icon';
Expand Down
3 changes: 2 additions & 1 deletion packages/react-table/src/components/Table/SortColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import StarIcon from '@patternfly/react-icons/dist/esm/icons/star-icon';
import { css } from '@patternfly/react-styles';
import styles from '@patternfly/react-styles/css/components/Table/table';
import { TableText } from './TableText';
import { ActionList, ActionListItem } from '@patternfly/react-core/dist/esm/components/ActionList';
import { Button } from '@patternfly/react-core/dist/esm/components/Button';
import { TooltipProps } from '@patternfly/react-core/dist/esm/components/Tooltip';
import { ActionList, ActionListItem, Button } from '@patternfly/react-core';
import { FavoriteButtonProps } from './base/types';

export enum SortByDirection {
Expand Down
4 changes: 3 additions & 1 deletion packages/react-table/src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import stylesTreeView from '@patternfly/react-styles/css/components/Table/table-
import { css } from '@patternfly/react-styles';
import { toCamel } from './utils';
import { IVisibility } from './utils/decorators/classNames';
import { useOUIAProps, OUIAProps, handleArrows, setTabIndex, KeyTypes } from '@patternfly/react-core';
import { handleArrows, setTabIndex } from '@patternfly/react-core/dist/esm/helpers/KeyboardHandler';
import { KeyTypes } from '@patternfly/react-core/dist/esm/helpers/constants';
import { useOUIAProps, OUIAProps } from '@patternfly/react-core/dist/esm/helpers/OUIA/ouia';
import { TableGridBreakpoint, TableVariant } from './TableTypes';

export interface BaseCellProps {
Expand Down
5 changes: 4 additions & 1 deletion packages/react-table/src/components/Table/base/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
*/

import * as React from 'react';
import { ButtonProps, PopoverProps, SelectProps, TooltipProps } from '@patternfly/react-core';
import { ButtonProps } from '@patternfly/react-core/dist/esm/components/Button';
import { PopoverProps } from '@patternfly/react-core/dist/esm/components/Popover';
import { SelectProps } from '@patternfly/react-core/dist/esm/components/Select';
import { TooltipProps } from '@patternfly/react-core/dist/esm/components/Tooltip';
import { Table } from '../Table';
import { Thead } from '../Thead';
import { Tbody } from '../Tbody';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { OUIAProps, getDefaultOUIAId } from '@patternfly/react-core';
import { OUIAProps, getDefaultOUIAId } from '@patternfly/react-core/dist/esm/helpers/OUIA/ouia';
import inlineStyles from '@patternfly/react-styles/css/components/InlineEdit/inline-edit';
import { css } from '@patternfly/react-styles';
import { Provider } from '../../../components/Table/base/provider';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import React from 'react';
import { Badge } from '@patternfly/react-core/dist/esm/components/Badge';
import { MenuToggle, MenuToggleElement, MenuToggleProps } from '@patternfly/react-core/dist/esm/components/MenuToggle';
import {
Badge,
MenuToggle,
MenuToggleElement,
MenuToggleProps,
Select,
SelectList,
SelectOption,
SelectOptionProps,
SelectProps
} from '@patternfly/react-core';
} from '@patternfly/react-core/dist/esm/components/Select';

export interface CheckboxSelectOption extends Omit<SelectOptionProps, 'content'> {
/** Content of the select option. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import React from 'react';
import { Button } from '@patternfly/react-core/dist/esm/components/Button';
import { Label, LabelGroup } from '@patternfly/react-core/dist/esm/components/Label';
import { MenuToggle, MenuToggleElement, MenuToggleProps } from '@patternfly/react-core/dist/esm/components/MenuToggle';
import {
Select,
SelectOption,
SelectList,
SelectOption,
SelectOptionProps,
MenuToggle,
MenuToggleElement,
SelectProps
} from '@patternfly/react-core/dist/esm/components/Select';
import {
TextInputGroup,
TextInputGroupMain,
TextInputGroupUtilities,
Button,
MenuToggleProps,
SelectProps,
Label,
LabelGroup
} from '@patternfly/react-core';
TextInputGroupUtilities
} from '@patternfly/react-core/dist/esm/components/TextInputGroup';
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';

export interface MultiTypeaheadSelectOption extends Omit<SelectOptionProps, 'content'> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React from 'react';
import { Button } from '@patternfly/react-core/dist/esm/components/Button';
import { MenuToggle, MenuToggleElement, MenuToggleProps } from '@patternfly/react-core/dist/esm/components/MenuToggle';
import {
Select,
SelectOption,
SelectList,
SelectOption,
SelectOptionProps,
MenuToggle,
MenuToggleElement,
SelectProps
} from '@patternfly/react-core/dist/esm/components/Select';
import {
TextInputGroup,
TextInputGroupMain,
TextInputGroupUtilities,
Button,
MenuToggleProps,
SelectProps
} from '@patternfly/react-core';
TextInputGroupUtilities
} from '@patternfly/react-core/dist/esm/components/TextInputGroup';
import TimesIcon from '@patternfly/react-icons/dist/esm/icons/times-icon';

export interface TypeaheadSelectOption extends Omit<SelectOptionProps, 'content'> {
Expand Down

0 comments on commit 80805a8

Please sign in to comment.