From 9c01a930b97218ea550cd7de3436941990b3b068 Mon Sep 17 00:00:00 2001 From: Pavithra Kodmad Date: Tue, 21 May 2024 19:38:29 +1000 Subject: [PATCH] =?UTF-8?q?ActionBar:=20Move=20to=20main=20directory=20(ex?= =?UTF-8?q?perimental=20=E2=86=92=20alpha)=20(#4574)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Move ActionBar to main directory * Export as named * Fix actionbar export in drafts * Fix lint errors * Fix imports Fix imports * Create wise-adults-lay.md * Update wise-adults-lay.md * update exports snapshot --------- Co-authored-by: Siddharth Kshetrapal --- .changeset/wise-adults-lay.md | 5 ++++ .../ActionBar/ActionBar.docs.json | 6 ++--- .../ActionBar/ActionBar.stories.tsx | 14 +++++----- .../{drafts => }/ActionBar/ActionBar.test.tsx | 2 +- .../src/{drafts => }/ActionBar/ActionBar.tsx | 26 +++++++++---------- .../react/src/{drafts => }/ActionBar/index.ts | 1 + .../__snapshots__/exports.test.ts.snap | 2 ++ packages/react/src/drafts/index.ts | 3 +-- packages/react/src/index.ts | 3 +++ 9 files changed, 36 insertions(+), 26 deletions(-) create mode 100644 .changeset/wise-adults-lay.md rename packages/react/src/{drafts => }/ActionBar/ActionBar.docs.json (94%) rename packages/react/src/{drafts => }/ActionBar/ActionBar.stories.tsx (96%) rename packages/react/src/{drafts => }/ActionBar/ActionBar.test.tsx (95%) rename packages/react/src/{drafts => }/ActionBar/ActionBar.tsx (94%) rename packages/react/src/{drafts => }/ActionBar/index.ts (93%) diff --git a/.changeset/wise-adults-lay.md b/.changeset/wise-adults-lay.md new file mode 100644 index 00000000000..7168db572af --- /dev/null +++ b/.changeset/wise-adults-lay.md @@ -0,0 +1,5 @@ +--- +"@primer/react": minor +--- + +ActionBar: Move to main directory. ActionBar can now be imported from `'@primer/react'` diff --git a/packages/react/src/drafts/ActionBar/ActionBar.docs.json b/packages/react/src/ActionBar/ActionBar.docs.json similarity index 94% rename from packages/react/src/drafts/ActionBar/ActionBar.docs.json rename to packages/react/src/ActionBar/ActionBar.docs.json index c73929c5802..7b8f2659f96 100644 --- a/packages/react/src/drafts/ActionBar/ActionBar.docs.json +++ b/packages/react/src/ActionBar/ActionBar.docs.json @@ -1,10 +1,10 @@ { "id": "actionbar", "name": "ActionBar", - "status": "draft", - "a11yReviewed": false, + "status": "alpha", + "a11yReviewed": true, "stories": [], - "importPath": "@primer/react/experimental", + "importPath": "@primer/react", "props": [ { "name": "size", diff --git a/packages/react/src/drafts/ActionBar/ActionBar.stories.tsx b/packages/react/src/ActionBar/ActionBar.stories.tsx similarity index 96% rename from packages/react/src/drafts/ActionBar/ActionBar.stories.tsx rename to packages/react/src/ActionBar/ActionBar.stories.tsx index f2dd0563a0a..95a4f72f720 100644 --- a/packages/react/src/drafts/ActionBar/ActionBar.stories.tsx +++ b/packages/react/src/ActionBar/ActionBar.stories.tsx @@ -1,7 +1,7 @@ import React from 'react' import type {Meta} from '@storybook/react' import ActionBar from '.' -import Text from '../../Text' +import Text from '../Text' import { PencilIcon, BoldIcon, @@ -18,12 +18,12 @@ import { ReplyIcon, ThreeBarsIcon, } from '@primer/octicons-react' -import {MarkdownInput} from '../MarkdownEditor/_MarkdownInput' -import {ViewSwitch} from '../MarkdownEditor/_ViewSwitch' -import type {MarkdownViewMode} from '../MarkdownEditor/_ViewSwitch' -import {Box, Dialog, Button, Avatar, ActionMenu, IconButton, ActionList} from '../..' -import {Divider} from '../../deprecated/ActionList/Divider' -import mockData from '../SelectPanel2/mock-story-data' +import {MarkdownInput} from '../drafts/MarkdownEditor/_MarkdownInput' +import {ViewSwitch} from '../drafts/MarkdownEditor/_ViewSwitch' +import type {MarkdownViewMode} from '../drafts/MarkdownEditor/_ViewSwitch' +import {Box, Dialog, Button, Avatar, ActionMenu, IconButton, ActionList} from '../' +import {Divider} from '../deprecated/ActionList/Divider' +import mockData from '../drafts/SelectPanel2/mock-story-data' export default { title: 'Drafts/Components/ActionBar', diff --git a/packages/react/src/drafts/ActionBar/ActionBar.test.tsx b/packages/react/src/ActionBar/ActionBar.test.tsx similarity index 95% rename from packages/react/src/drafts/ActionBar/ActionBar.test.tsx rename to packages/react/src/ActionBar/ActionBar.test.tsx index 97cc6ee4ff0..d9d9ab45827 100644 --- a/packages/react/src/drafts/ActionBar/ActionBar.test.tsx +++ b/packages/react/src/ActionBar/ActionBar.test.tsx @@ -1,5 +1,5 @@ import React from 'react' -import {behavesAsComponent} from '../../utils/testing' +import {behavesAsComponent} from '../utils/testing' import {render as HTMLRender} from '@testing-library/react' import axe from 'axe-core' diff --git a/packages/react/src/drafts/ActionBar/ActionBar.tsx b/packages/react/src/ActionBar/ActionBar.tsx similarity index 94% rename from packages/react/src/drafts/ActionBar/ActionBar.tsx rename to packages/react/src/ActionBar/ActionBar.tsx index e3f5b3b9879..aa2238aafc7 100644 --- a/packages/react/src/drafts/ActionBar/ActionBar.tsx +++ b/packages/react/src/ActionBar/ActionBar.tsx @@ -1,20 +1,20 @@ import type {RefObject, MutableRefObject} from 'react' import React, {useState, useCallback, useRef, forwardRef} from 'react' import {KebabHorizontalIcon} from '@primer/octicons-react' -import {ActionList} from '../../ActionList' -import useIsomorphicLayoutEffect from '../../utils/useIsomorphicLayoutEffect' +import {ActionList} from '../ActionList' +import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect' import styled from 'styled-components' -import sx from '../../sx' -import {useOnEscapePress} from '../../hooks/useOnEscapePress' -import type {ResizeObserverEntry} from '../../hooks/useResizeObserver' -import {useResizeObserver} from '../../hooks/useResizeObserver' - -import {useOnOutsideClick} from '../../hooks/useOnOutsideClick' -import type {IconButtonProps} from '../../Button' -import {IconButton} from '../../Button' -import Box from '../../Box' -import {ActionMenu} from '../../ActionMenu' -import {useFocusZone, FocusKeys} from '../../hooks/useFocusZone' +import sx from '../sx' +import {useOnEscapePress} from '../hooks/useOnEscapePress' +import type {ResizeObserverEntry} from '../hooks/useResizeObserver' +import {useResizeObserver} from '../hooks/useResizeObserver' + +import {useOnOutsideClick} from '../hooks/useOnOutsideClick' +import type {IconButtonProps} from '../Button' +import {IconButton} from '../Button' +import Box from '../Box' +import {ActionMenu} from '../ActionMenu' +import {useFocusZone, FocusKeys} from '../hooks/useFocusZone' type ChildSize = { text: string diff --git a/packages/react/src/drafts/ActionBar/index.ts b/packages/react/src/ActionBar/index.ts similarity index 93% rename from packages/react/src/drafts/ActionBar/index.ts rename to packages/react/src/ActionBar/index.ts index ae3069a0ae3..64bf265ed8f 100644 --- a/packages/react/src/drafts/ActionBar/index.ts +++ b/packages/react/src/ActionBar/index.ts @@ -7,3 +7,4 @@ const ActionBar = Object.assign(Bar, { }) export default ActionBar +export {ActionBar} diff --git a/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap b/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap index 4dbaf3f35d0..73706d20a0d 100644 --- a/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap +++ b/packages/react/src/__tests__/__snapshots__/exports.test.ts.snap @@ -2,6 +2,8 @@ exports[`@primer/react should not update exports without a semver change 1`] = ` [ + "ActionBar", + "type ActionBarProps", "ActionList", "type ActionListDescriptionProps", "type ActionListDividerProps", diff --git a/packages/react/src/drafts/index.ts b/packages/react/src/drafts/index.ts index b26c9a7abfa..4a869314e36 100644 --- a/packages/react/src/drafts/index.ts +++ b/packages/react/src/drafts/index.ts @@ -67,8 +67,7 @@ export * from './SelectPanel2' export {default as TabPanels} from './TabPanels' export type {TabPanelsProps, TabPanelsTabProps, TabPanelsPanelProps} from './TabPanels' export * from '../TooltipV2' -export {default as ActionBar} from './ActionBar' -export * from './ActionBar' +export * from '../ActionBar' export {Stack} from '../Stack' export type {StackProps, StackItemProps} from '../Stack' diff --git a/packages/react/src/index.ts b/packages/react/src/index.ts index e3148feb8f4..30f2d09c796 100644 --- a/packages/react/src/index.ts +++ b/packages/react/src/index.ts @@ -193,6 +193,9 @@ export type { export {UnderlineNav} from './UnderlineNav' export type {UnderlineNavProps, UnderlineNavItemProps} from './UnderlineNav' +export {ActionBar} from './ActionBar' +export type {ActionBarProps} from './ActionBar' + // eslint-disable-next-line no-restricted-imports export {SSRProvider, useSSRSafeId} from './utils/ssr' export {default as sx, merge} from './sx'