diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 204e3468c7..a7b983268b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -110,16 +110,3 @@ jobs: uses: actions/download-artifact@v2 with: name: build-artifacts - - - name: Generate Documentation - env: - STORYBOOK_URL: 'https://shoreline.storybook.vtex.com' - run: | - if git log -1 --pretty=%B | grep -q "\[skip-ci\]"; then - exit 0 - fi - git pull --rebase - pnpm run gen:docs - git add ./packages/docs - git commit -m "docs: generate documentation from $GITHUB_SHA [skip-ci]" --allow-empty - git push -u origin main --force diff --git a/package.json b/package.json index 198ab89b00..eebd92ff0d 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "version": "lerna run version", "lint:css": "stylelint \"**/*.css\"", "chromatic": "chromatic --exit-zero-on-changes --build-script-name=build:storybook", - "gen:docs": "npm --prefix packages/docs-generator run start", "gen:component": "plop component", "create:icon": "plop icon", "create:icon-variant": "plop icon-variant", diff --git a/packages/components/src/alert/alert.tsx b/packages/components/src/alert/alert.tsx index 29603c9e07..42c4ed2aab 100644 --- a/packages/components/src/alert/alert.tsx +++ b/packages/components/src/alert/alert.tsx @@ -47,7 +47,7 @@ export const Alert = forwardRef(function Alert( ) }) -function getIcon(variant: AlertVariant = 'informational') { +function getIcon(variant: AlertOptions['variant'] = 'informational') { switch (variant) { case 'informational': { return @@ -67,20 +67,16 @@ function getIcon(variant: AlertVariant = 'informational') { } } -export type AlertVariant = 'informational' | 'success' | 'critical' | 'warning' - -export interface AlertProps extends ComponentPropsWithoutRef<'div'> { +export interface AlertOptions { /** * Variants of the alert, one of: informational, success, critical, warning. * @default 'informational' */ - variant?: AlertVariant + variant?: 'informational' | 'success' | 'critical' | 'warning' /** * Callback fired when the alert is dismissed. */ onDismiss?: MouseEventHandler - /** - * The content of the alert. - */ - children?: React.ReactNode } + +export type AlertProps = AlertOptions & ComponentPropsWithoutRef<'div'> diff --git a/packages/components/src/alert/stories/alert.play.stories.tsx b/packages/components/src/alert/stories/alert.play.stories.tsx index a6571b7114..873b2ad07b 100644 --- a/packages/components/src/alert/stories/alert.play.stories.tsx +++ b/packages/components/src/alert/stories/alert.play.stories.tsx @@ -1,12 +1,11 @@ import React from 'react' -import type { AlertProps, AlertVariant } from '../index' +import type { AlertProps } from '../index' import { Alert } from '../index' import { Text } from '../../text' import { Button } from '../../button' -import type { StoryObj } from '@storybook/react' -const variants: AlertVariant[] = [ +const variants: Array = [ 'success', 'critical', 'warning', @@ -43,7 +42,7 @@ export default { parameters: { chromatic: { disableSnapshot: true }, }, -} as StoryObj +} interface StoryArgs extends AlertProps { withAction: boolean diff --git a/packages/components/src/bleed/bleed.tsx b/packages/components/src/bleed/bleed.tsx index 001bbf9f8e..babe667023 100644 --- a/packages/components/src/bleed/bleed.tsx +++ b/packages/components/src/bleed/bleed.tsx @@ -41,7 +41,7 @@ export const Bleed = forwardRef(function Bleed( ) }) -export interface BleedProps extends ComponentPropsWithoutRef<'div'> { +export interface BleedOptions { /** * Top bleed * @default '$space-0' @@ -63,3 +63,5 @@ export interface BleedProps extends ComponentPropsWithoutRef<'div'> { */ end?: string } + +export type BleedProps = BleedOptions & ComponentPropsWithoutRef<'div'> diff --git a/packages/components/src/button/button.tsx b/packages/components/src/button/button.tsx index 488abddd4a..83484782fb 100644 --- a/packages/components/src/button/button.tsx +++ b/packages/components/src/button/button.tsx @@ -66,7 +66,10 @@ function spanizeString(children: ReactNode) { }) } -export interface ButtonProps extends ComponentPropsWithoutRef<'button'> { +export interface ButtonOptions { + /** + * Button contents + */ children: ReactNode /** * Increase or decrease padding. @@ -94,3 +97,5 @@ export interface ButtonProps extends ComponentPropsWithoutRef<'button'> { */ asChild?: boolean } + +export type ButtonProps = ButtonOptions & ComponentPropsWithoutRef<'button'> diff --git a/packages/components/src/center/center.tsx b/packages/components/src/center/center.tsx index 2a1e429767..c8eae5b93d 100644 --- a/packages/components/src/center/center.tsx +++ b/packages/components/src/center/center.tsx @@ -22,10 +22,12 @@ export const Center = forwardRef(function Center( return }) -export interface CenterProps extends ComponentPropsWithoutRef<'div'> { +export interface CenterOptions { /** * Children composition * @default false */ asChild?: boolean } + +export type CenterProps = CenterOptions & ComponentPropsWithoutRef<'div'> diff --git a/packages/components/src/checkbox/checkbox-group.tsx b/packages/components/src/checkbox/checkbox-group.tsx index daba9eb1ae..8af498ff42 100644 --- a/packages/components/src/checkbox/checkbox-group.tsx +++ b/packages/components/src/checkbox/checkbox-group.tsx @@ -54,7 +54,7 @@ export const CheckboxGroup = forwardRef( } ) -export interface CheckboxGroupProps extends ComponentPropsWithoutRef<'div'> { +export interface CheckboxGroupOptions extends ComponentPropsWithoutRef<'div'> { /** * Whether the checkbox group is in an error state */ @@ -77,3 +77,6 @@ export interface CheckboxGroupProps extends ComponentPropsWithoutRef<'div'> { */ horizontal?: boolean } + +export type CheckboxGroupProps = CheckboxGroupOptions & + ComponentPropsWithoutRef<'div'> diff --git a/packages/components/src/checkbox/checkbox.tsx b/packages/components/src/checkbox/checkbox.tsx index 27e15430c6..769886f523 100644 --- a/packages/components/src/checkbox/checkbox.tsx +++ b/packages/components/src/checkbox/checkbox.tsx @@ -1,10 +1,13 @@ -import React, { forwardRef } from 'react' -import { useMergeRef } from '@vtex/shoreline-utils' +import React, { forwardRef, useMemo, useRef } from 'react' +import { useMergeRef, mergeProps, useId } from '@vtex/shoreline-utils' import { IconCheckSmall, IconMinusSmall } from '@vtex/shoreline-icons' - import { VisuallyHidden } from '@vtex/shoreline-primitives' -import { useAriaCheckbox } from './use-aria-checkbox' -import type { AriaCheckboxProps } from './use-aria-checkbox' +import type { ComponentPropsWithoutRef, Ref } from 'react' +import { useToggleState } from '@react-stately/toggle' +import { useCheckbox as useReactAriaCheckbox } from '@react-aria/checkbox' +import { useFocusRing } from '@react-aria/focus' +import type { AnyObject } from '@vtex/shoreline-utils' + import { Text } from '../text' /** @@ -21,7 +24,7 @@ export const Checkbox = forwardRef( isIndeterminate, isFocusVisible, isDisabled, - } = useAriaCheckbox(props) + } = useCheckbox(props) return (