diff --git a/.changeset/small-humans-return.md b/.changeset/small-humans-return.md new file mode 100644 index 000000000..03e2b951b --- /dev/null +++ b/.changeset/small-humans-return.md @@ -0,0 +1,19 @@ +--- +"@igloo-ui/select": major +"@igloo-ui/tabs": major +"@igloo-ui/tag": major +"@igloo-ui/toaster": major +"@igloo-ui/toggle": major +"@igloo-ui/tooltip": major +"@igloo-ui/radio": minor +"@igloo-ui/stacked-bar": minor +"@igloo-ui/stepper": minor +"@igloo-ui/tag-picker": minor +"@igloo-ui/text-editor": minor +"@igloo-ui/textarea": minor +"@igloo-ui/vertical-bar-chart": minor +"@shared/components": minor +--- + +Clean up non-Workleap rebranded styles for components Q-Z. +All consumers should now be using the Workleap branded versions of the components. This will happen automatically, and consumers can stop setting `data-brand="workleap"` for these components. diff --git a/.storybook/withBrandDecorator.jsx b/.storybook/withBrandDecorator.jsx index 43f15c7d6..a3c4b1b34 100644 --- a/.storybook/withBrandDecorator.jsx +++ b/.storybook/withBrandDecorator.jsx @@ -1,27 +1,12 @@ -import isChromatic from "chromatic/isChromatic"; -import React from 'react'; +import { useEffect } from 'react'; export const withBrandDecorator = (StoryFn, context) => { - if(isChromatic()) { // The brand selector is not available in Chromatic - return StoryFn(); - } - - return ( - - {StoryFn()} - - ) -} - -export const BrandProvider = ({brand, children}) => { - const [internalBrand, setInternalBrand] = React.useState(); - - React.useEffect(() => { + useEffect(() => { + const brand = context.parameters.brand ?? context.globals.brand //document.documentElement refers to html tag inside iframe#storybook-preview-iframe document.documentElement.setAttribute('data-brand', brand); - setInternalBrand(brand) + }, [context.parameters.brand, context.globals.brand]); - }, [brand]); - return {children}; + return ; } diff --git a/packages/Disclosure/src/Disclosure.stories.tsx b/packages/Disclosure/src/Disclosure.stories.tsx index 2920a27af..33402a0cd 100644 --- a/packages/Disclosure/src/Disclosure.stories.tsx +++ b/packages/Disclosure/src/Disclosure.stories.tsx @@ -1,11 +1,11 @@ import React from 'react'; -import { Meta } from '@storybook/react'; +import { Meta, StoryObj } from '@storybook/react'; -import Substract from '@igloo-ui/icons/dist/Substract'; +import Button from '@igloo-ui/button'; import ArrowUp from '@igloo-ui/icons/dist/ArrowUp'; import Settings from '@igloo-ui/icons/dist/Settings'; -import Button from '@igloo-ui/button'; +import Substract from '@igloo-ui/icons/dist/Substract'; import Tag from '@igloo-ui/tag'; import readme from '../README.md'; @@ -24,7 +24,7 @@ export default { }, } as Meta; -export const Overview = { +export const Overview: StoryObj = { args: { children: (
@@ -47,6 +47,9 @@ export const Overview = {
), }, + parameters: { + brand: "workleap" + } }; export const Expanded = { diff --git a/packages/FormGroup/src/FormGroup.stories.tsx b/packages/FormGroup/src/FormGroup.stories.tsx index 7b0d0f6cf..b536bacd1 100644 --- a/packages/FormGroup/src/FormGroup.stories.tsx +++ b/packages/FormGroup/src/FormGroup.stories.tsx @@ -1,11 +1,11 @@ -import React from 'react'; import Input from '@igloo-ui/input'; -import Textarea from '@igloo-ui/textarea'; -import Select from '@igloo-ui/select'; import type { OptionType } from '@igloo-ui/list'; +import Select from '@igloo-ui/select'; +import Textarea from '@igloo-ui/textarea'; +import React from 'react'; -import { Meta, StoryFn } from '@storybook/react'; import Section from '@components/section'; +import { Meta, StoryFn, StoryObj } from '@storybook/react'; import readme from '../README.md'; import FormGroup from './FormGroup'; @@ -93,63 +93,69 @@ export const info = () => { ); }; -export const OtherFormElements = () => { - const smallOptionList = [ - { - label: 'Text option', - value: 'text', - }, - { - label: 'Disabled option', - value: 'disabled', - disabled: true, +export const OtherFormElements: StoryObj = { + parameters: { + brand: "workleap", + chromatic: { delay: 500 } }, - { - label: 'Text option 3', - value: 'icon', - }, - ]; - - const [hasSelectError, setHasSelectError] = React.useState(true); - const [hasTextareaError, setHasTextareaError] = React.useState(true); - - const handleSelectOnChange = (option: OptionType | undefined): void => { - setHasSelectError(!option?.value); - }; - - const handleTextareaOnChange = ( - event: React.ChangeEvent - ): void => { - setHasTextareaError(!event?.target?.value); - }; - - return ( -
- - - - - -