Skip to content

Commit

Permalink
refactor: clean up internal architecture (#5404)
Browse files Browse the repository at this point in the history
* refactor: rename __future__ dir to __rc__

* refactor(Tooltip): move v1/v2 to src

* refactor(Tooltip): move v3 to rc

* refactor(Focusable): move into subcomponents of Tooltip

* refactor(Button): move v1/v2 to src

* refactor(Button): move v3 to rc

* refactor(Menu): move v1/v2 to src

* refactor(Menu): move v3 to rc
  • Loading branch information
HeartSquared authored and Christian Moore committed Dec 18, 2024
1 parent 305d335 commit 506c0c3
Show file tree
Hide file tree
Showing 338 changed files with 250 additions and 251 deletions.
5 changes: 5 additions & 0 deletions .changeset/twelve-panthers-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@kaizen/components': patch
---

Internal architecture restructure. Should not impact consumers.
2 changes: 1 addition & 1 deletion docs/components/DosAndDonts/DosAndDonts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { HTMLAttributes } from 'react'
import { Canvas, Unstyled } from '@storybook/blocks'
import classnames from 'classnames'
import { Text } from '~components/Text'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import styles from './DosAndDonts.module.css'

export const DosAndDonts = ({
Expand Down
2 changes: 1 addition & 1 deletion docs/components/ResourceLinks/ResourceLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { HTMLAttributes } from 'react'
import { Unstyled } from '@storybook/blocks'
import classNames from 'classnames'
import { Text } from '~components/Text'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'

type ResourceLinkProps = {
href: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as OLD_ICONS from '~components/Icon'
import { IconNames } from '~components/__future__/Icon/types'
import { IconNames } from '~components/__rc__/Icon/types'
import { StringSuggestions } from '~components/types/StringSuggestions'

// `undefined` means the icon has no usage, thus is not available in the new icon set
Expand Down
2 changes: 1 addition & 1 deletion packages/components/future/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ More details: [https://github.com/theKashey/multiple-entry-points-example](https

## Contribution

All "future" components are to be added to the `src/__future__` directory.
All "future" components are to be added to the `src/__rc__` directory.

### What is a "future" component?

Expand Down
2 changes: 1 addition & 1 deletion packages/components/future/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"main": "../dist/cjs/future.cjs",
"module": "../dist/esm/future.mjs",
"types": "../dist/types/__future__/index.d.ts"
"types": "../dist/types/__rc__/index.d.ts"
}
14 changes: 7 additions & 7 deletions packages/components/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { pluginsSharedUi, rollupConfig } from '@kaizen/package-bundler'
export default rollupConfig({
input: {
index: './src/index.ts',
future: './src/__future__/index.ts',
actionsV1: './src/__actions__/v1.ts',
actionsV2: './src/__actions__/v2.ts',
actionsV3: './src/__actions__/v3.ts',
overlaysV1: './src/__overlays__/v1.ts',
overlaysV2: './src/__overlays__/v2.ts',
overlaysV3: './src/__overlays__/v3.ts',
future: './src/__rc__/index.ts',
actionsV1: './src/v1-actions.ts',
actionsV2: './src/v2-actions.ts',
actionsV3: './src/v3-actions.ts',
overlaysV1: './src/v1-overlays.ts',
overlaysV2: './src/v2-overlays.ts',
overlaysV3: './src/v3-overlays.ts',
utilitiesV3: './src/__utilities__/v3.ts',
reactAriaV3: './src/__react-aria__/index.ts',
reactAriaComponentsV3: './src/__react-aria-components__/index.ts',
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState, useEffect, useRef, HTMLAttributes } from 'react'
import classnames from 'classnames'
import { Textfit } from 'react-textfit'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import { OverrideClassName } from '~components/types/OverrideClassName'
import styles from './Avatar.module.scss'

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/BrandMoment/BrandMoment.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { ReactNode, ReactElement, HTMLAttributes } from 'react'
import classnames from 'classnames'
import { Button, ButtonProps } from '~components/Button'
import { Heading } from '~components/Heading'
import { SceneProps } from '~components/Illustration'
import { Text } from '~components/Text'
import { Button, ButtonProps } from '~components/__actions__/v2'
import { OverrideClassName } from '~components/types/OverrideClassName'
import { assetUrl } from '~components/utils/hostedAssets'
import { useMediaQueries } from '~components/utils/useMediaQueries'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
AnimatedSceneProps,
} from '~components/Illustration'
import { Text } from '~components/Text'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import { BrandMoment } from '../index'
import { MinimalBasic, MinimalCustomerFocused, FakeNavBar } from './ExampleHeaders'

Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/BrandMoment/_docs/ExampleHeaders.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { Button } from '~components/__actions__/v2'
import { Icon } from '~components/__future__/Icon'
import { Button } from '~components/Button'
import { Icon } from '~components/__rc__/Icon'
import { assetUrl } from '~components/utils/hostedAssets'
import styles from './ExampleHeaders.module.scss'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@import '~@kaizen/design-tokens/sass/color';
@import '~@kaizen/design-tokens/sass/border';
@import '~@kaizen/design-tokens/sass/typography';
@import '../../../../../styles/utils/button-reset';
@import '../../../styles/utils/button-reset';
@import '../utils/mixins';
@import '../utils/variables';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { Meta } from '@storybook/react'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import { StickerSheet, StickerSheetStory } from '~storybook/components/StickerSheet'
import { Button, ButtonProps } from '../index'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState } from 'react'
import { StoryObj, Meta } from '@storybook/react'
import { LoadingInput } from '~components/Loading'
import { TextField } from '~components/TextField'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import { Button } from '../index'

const meta = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React, { useState } from 'react'
import { StoryObj, Meta } from '@storybook/react'
import { LoadingInput } from '~components/Loading'
import { TextField } from '~components/TextField'
import { Icon } from '~components/__future__/Icon'
import { Button } from '../index'
import { Icon } from '~components/__rc__/Icon'
import { Button } from '../../index'

const meta = {
title: 'Components/Button/Button (v2)',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@import '../utils/variables';
@import '../Button/Button.module';
@import '../IconButton/IconButton.module';
@import '../../../../Pagination/subcomponents/PaginationLink/PaginationLink.module';
@import '../../../../Pagination/subcomponents/DirectionalLink/DirectionalLink.module';
@import '../../Pagination/subcomponents/PaginationLink/PaginationLink.module';
@import '../../Pagination/subcomponents/DirectionalLink/DirectionalLink.module';

.container {
display: inline-block;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { Meta } from '@storybook/react'
import { ButtonProps } from '~components/__actions__/v2'
import { Icon } from '~components/__future__/Icon'
import type { ButtonProps } from '~components/Button'
import { Icon } from '~components/__rc__/Icon'
import { StickerSheet, StickerSheetStory } from '~storybook/components/StickerSheet'
import { IconButton, IconButtonProps } from '../index'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { Meta, StoryObj } from '@storybook/react'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import { IconButton } from '../index'

const meta = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { Meta, StoryObj } from '@storybook/react'
import { Icon } from '~components/__future__/Icon'
import { IconButton } from '../index'
import { Icon } from '~components/__rc__/Icon'
import { IconButton } from '../../index'

const meta = {
title: 'Components/IconButton/IconButton (v2)',
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import '~@kaizen/design-tokens/sass/spacing';
@import '~@kaizen/design-tokens/sass/border';
@import '../../../../../styles/utils/legacy/color';
@import '../../../../../styles/utils/legacy/layout';
@import '../../../styles/utils/legacy/color';
@import '../../../styles/utils/legacy/layout';

$button-height: $spacing-xl;
$button-small-height: calc(#{$spacing-md} * 5 / 3);
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/ButtonGroup/ButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
FilterButtonBase,
FilterButtonBaseProps,
} from '~components/Filter/FilterButton/subcomponents/FilterButtonBase'
import { Tooltip, TooltipProps } from '~components/__overlays__/Tooltip/v1'
import { Tooltip, TooltipProps } from '~components/Tooltip'
import { OverrideClassName } from '~components/types/OverrideClassName'
import styles from './ButtonGroup.module.scss'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { Meta } from '@storybook/react'
import { FilterButtonBase } from '~components/Filter/FilterButton/subcomponents/FilterButtonBase'
import { Tooltip } from '~components/__overlays__/Tooltip/v1'
import { Tooltip } from '~components/Tooltip'
import { StickerSheet, StickerSheetStory } from '~storybook/components/StickerSheet'
import { ButtonGroup } from '../index'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useRef } from 'react'
import { enAU } from 'date-fns/locale'
import { DayPicker, DayPickerRangeProps } from 'react-day-picker'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import { OverrideClassName } from '~components/types/OverrideClassName'
import { baseCalendarClassNames } from '../baseCalendarClassNames'
import { isInvalidDate } from '../utils'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect, useRef } from 'react'
import { enAU } from 'date-fns/locale'
import { DayPicker, DayPickerSingleProps } from 'react-day-picker'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import { OverrideClassName } from '~components/types/OverrideClassName'
import { baseCalendarClassNames } from '../baseCalendarClassNames'
import { isInvalidDate, isValidWeekStartsOn } from '../utils'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Matcher,
DayPickerRangeProps,
} from 'react-day-picker'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import { baseCalendarClassNames } from '../baseCalendarClassNames'
import { DayOfWeek } from '../enums'
import { isInvalidDate, isValidWeekStartsOn } from '../utils'
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/Checkbox/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { InputHTMLAttributes } from 'react'
import classnames from 'classnames'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import { OverrideClassName } from '~components/types/OverrideClassName'
import styles from './Checkbox.module.scss'

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/ClearButton/ClearButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { ButtonHTMLAttributes } from 'react'
import classnames from 'classnames'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import { OverrideClassName } from '~components/types/OverrideClassName'
import styles from './ClearButton.module.scss'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React, { HTMLAttributes, useId, useState } from 'react'
import classnames from 'classnames'
import AnimateHeight from 'react-animate-height'
import { IconButton } from '~components/Button'
import { Heading } from '~components/Heading'
import { IconButton } from '~components/__actions__/v2'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import { OverrideClassName } from '~components/types/OverrideClassName'
import { Sticky } from '../types'
import styles from './Collapsible.module.scss'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState } from 'react'
import { Meta, StoryObj } from '@storybook/react'
import { Heading } from '~components/Heading'
import { Text } from '~components/Text'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import { Collapsible } from '../index'

const meta = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import classnames from 'classnames'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import { isRefObject } from '~components/utils/isRefObject'
import { DateInput, DateInputProps } from '../DateInput'
import styles from './DateInputWithIconButton.module.scss'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { action } from '@storybook/addon-actions'
import { Meta, StoryObj } from '@storybook/react'
import { userEvent, within, expect } from '@storybook/test'
import Highlight from 'react-highlight'
import { Button } from '~components/Button'
import { defaultMonthControls } from '~components/Calendar/_docs/controls/defaultMonthControls'
import { weekStartsOnControls } from '~components/Calendar/_docs/controls/weekStartsOnControls'
import { FieldMessageStatus } from '~components/FieldMessage'
import { Text } from '~components/Text'
import { Button } from '~components/__actions__/v2'
import { DatePicker, ValidationResponse } from '../index'
import { datePickerLocaleControls } from './controls/datePickerLocaleControls'
import { disabledDayMatchersControls } from './controls/disabledDayMatchersControls'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '~components/Calendar/LegacyCalendarRange'
import { Label } from '~components/Label'
import { VisuallyHidden } from '~components/VisuallyHidden'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import styles from './DateRangePicker.module.scss'

export type DateRangePickerProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import { Meta } from '@storybook/react'
import isChromatic from 'chromatic'
import { Button } from '~components/__actions__/v2'
import { Icon } from '~components/__future__/Icon'
import { Button } from '~components/Button'
import { Icon } from '~components/__rc__/Icon'
import { StickerSheet, StickerSheetStory } from '~storybook/components/StickerSheet'
import { EmptyState, EmptyStateProps } from '../index'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { Meta, StoryObj } from '@storybook/react'
import { Button } from '~components/__actions__/v2'
import { Icon } from '~components/__future__/Icon'
import { Button } from '~components/Button'
import { Icon } from '~components/__rc__/Icon'
import { EmptyState } from '../index'

const meta = {
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/ErrorPage/ErrorPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import classNames from 'classnames'
import { BrandMoment } from '~components/BrandMoment'
import { BrandMomentError } from '~components/Illustration'
import { Text } from '~components/Text'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import { OverrideClassName } from '~components/types/OverrideClassName'
import { ErrorStatuses, useErrorMessages } from './hooks'
import styles from './ErrorPage.module.scss'
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/FieldMessage/FieldMessage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { HTMLAttributes } from 'react'
import classnames from 'classnames'
import { Text } from '~components/Text'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import { OverrideClassName } from '~components/types/OverrideClassName'
import styles from './FieldMessage.module.scss'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { useEffect, useRef } from 'react'
import { useIntl } from '@cultureamp/i18n-react-intl'
import { Menu, MenuList, MenuItem, Button } from '~components/__actions__/v2'
import { Icon } from '~components/__future__/Icon'
import { Button } from '~components/Button'
import { Menu, MenuList, MenuItem } from '~components/Menu'
import { Icon } from '~components/__rc__/Icon'
import { useFilterBarContext } from '../../context/FilterBarContext'

export const AddFiltersMenu = (): JSX.Element => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import { useIntl } from '@cultureamp/i18n-react-intl'
import classnames from 'classnames'
import { Button } from '~components/__actions__/v2'
import { Button } from '~components/Button'
import { useFilterBarContext } from '../../context/FilterBarContext'
import styles from './ClearAllButton.module.scss'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { forwardRef } from 'react'
import classnames from 'classnames'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import { isRefObject } from '~components/utils/isRefObject'
import { FilterTriggerRef } from '../../Filter/types'
import { FilterButtonBase, FilterButtonBaseProps } from '../subcomponents/FilterButtonBase'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { useIntl } from '@cultureamp/i18n-react-intl'
import classnames from 'classnames'
import { ButtonGroup, ButtonGroupProps } from '~components/ButtonGroup'
import { FilterTriggerRef } from '~components/Filter/Filter'
import { Icon } from '~components/__future__/Icon'
import { Tooltip } from '~components/__overlays__/Tooltip/v1'
import { Tooltip } from '~components/Tooltip'
import { Icon } from '~components/__rc__/Icon'
import { DataAttributes } from '~components/types/DataAttributes'
import { isRefObject } from '~components/utils/isRefObject'
import { FilterButton, FilterButtonProps } from '../FilterButton'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { Button, ButtonProps } from '~components/__actions__/v2'
import { Button, type ButtonProps } from '~components/Button'
import styles from './LoadMoreButton.module.scss'

export type LoadMoreButtonProps = ButtonProps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { mergeProps } from '@react-aria/utils'
import classnames from 'classnames'
import { Badge } from '~components/Badge'
import { VisuallyHidden } from '~components/VisuallyHidden'
import { Icon } from '~components/__future__/Icon'
import { Icon } from '~components/__rc__/Icon'
import { useSelectionContext } from '../../context'
import { MultiSelectItem } from '../../types'
import styles from './MultiSelectOption.module.scss'
Expand Down
Loading

0 comments on commit 506c0c3

Please sign in to comment.