diff --git a/apps/vr-tests-react-components/src/stories/SwatchPicker/SwatchPicker.stories.tsx b/apps/vr-tests-react-components/src/stories/SwatchPicker/SwatchPicker.stories.tsx index 5fb6f3bf26bbb..4bd6cc1d08ec9 100644 --- a/apps/vr-tests-react-components/src/stories/SwatchPicker/SwatchPicker.stories.tsx +++ b/apps/vr-tests-react-components/src/stories/SwatchPicker/SwatchPicker.stories.tsx @@ -29,17 +29,17 @@ export const DefaultRTL = getStoryVariant(Default, RTL); export const Size = () => ( <>

Colors

- +

Images

- +

Grid layout

- + diff --git a/change/@fluentui-react-swatch-picker-preview-6246310c-e802-4b75-a4dd-6aa211c022b9.json b/change/@fluentui-react-swatch-picker-preview-6246310c-e802-4b75-a4dd-6aa211c022b9.json new file mode 100644 index 0000000000000..0df655e161f2e --- /dev/null +++ b/change/@fluentui-react-swatch-picker-preview-6246310c-e802-4b75-a4dd-6aa211c022b9.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "fix: BREAKING CHANGE - api changes and fixes", + "packageName": "@fluentui/react-swatch-picker-preview", + "email": "vkozlova@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-components/react-swatch-picker-preview/etc/react-swatch-picker-preview.api.md b/packages/react-components/react-swatch-picker-preview/etc/react-swatch-picker-preview.api.md index b470ddd751446..eb11c8742a68e 100644 --- a/packages/react-components/react-swatch-picker-preview/etc/react-swatch-picker-preview.api.md +++ b/packages/react-components/react-swatch-picker-preview/etc/react-swatch-picker-preview.api.md @@ -108,11 +108,6 @@ export const SwatchPicker: ForwardRefComponent; // @public (undocumented) export const swatchPickerClassNames: SlotClassNames; -// @public (undocumented) -export const swatchPickerCSSVars: { - gridGap: string; -}; - // @public (undocumented) export type SwatchPickerGridProps = { items: SwatchProps[]; @@ -139,7 +134,7 @@ export type SwatchPickerProps = ComponentProps & { layout?: 'row' | 'grid'; onSelectionChange?: EventHandler; selectedValue?: string; - size?: 'extraSmall' | 'small' | 'medium' | 'large'; + size?: 'extra-small' | 'small' | 'medium' | 'large'; shape?: 'rounded' | 'square' | 'circular'; spacing?: 'small' | 'medium'; }; @@ -159,7 +154,7 @@ export type SwatchPickerRowSlots = { }; // @public -export type SwatchPickerRowState = ComponentState; +export type SwatchPickerRowState = ComponentState & Pick; // @public (undocumented) export type SwatchPickerSlots = { diff --git a/packages/react-components/react-swatch-picker-preview/src/components/ColorSwatch/useColorSwatchStyles.styles.ts b/packages/react-components/react-swatch-picker-preview/src/components/ColorSwatch/useColorSwatchStyles.styles.ts index 6865de83d5d48..13aadd65a01c0 100644 --- a/packages/react-components/react-swatch-picker-preview/src/components/ColorSwatch/useColorSwatchStyles.styles.ts +++ b/packages/react-components/react-swatch-picker-preview/src/components/ColorSwatch/useColorSwatchStyles.styles.ts @@ -89,7 +89,7 @@ const useStyles = makeStyles({ }); const useSizeStyles = makeStyles({ - extraSmall: { + 'extra-small': { width: '20px', height: '20px', }, @@ -136,7 +136,7 @@ const useIconStyles = makeStyles({ display: 'flex', alignSelf: 'center', }, - extraSmall: { + 'extra-small': { fontSize: '16px', }, small: { @@ -160,13 +160,13 @@ export const useColorSwatchStyles_unstable = (state: ColorSwatchState): ColorSwa const shapeStyles = useShapeStyles(); const iconStyles = useIconStyles(); - const size = state.size ?? 'medium'; + const { size = 'medium', shape = 'square' } = state; state.root.className = mergeClasses( colorSwatchClassNames.root, resetStyles, sizeStyles[size], - shapeStyles[state.shape ?? 'square'], + shapeStyles[shape], state.selected && styles.selected, state.disabled && styles.disabled, state.root.className, diff --git a/packages/react-components/react-swatch-picker-preview/src/components/EmptySwatch/EmptySwatch.test.tsx b/packages/react-components/react-swatch-picker-preview/src/components/EmptySwatch/EmptySwatch.test.tsx index 18eca475904ca..d60a3fc49bfd5 100644 --- a/packages/react-components/react-swatch-picker-preview/src/components/EmptySwatch/EmptySwatch.test.tsx +++ b/packages/react-components/react-swatch-picker-preview/src/components/EmptySwatch/EmptySwatch.test.tsx @@ -14,6 +14,7 @@ describe('EmptySwatch', () => { expect(result.container).toMatchInlineSnapshot(`
+ + ); }; diff --git a/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerBestPractices.md b/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerBestPractices.md deleted file mode 100644 index 08ff8ddeeb5f8..0000000000000 --- a/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerBestPractices.md +++ /dev/null @@ -1,5 +0,0 @@ -## Best practices - -### Do - -### Don't diff --git a/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerDefault.stories.tsx b/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerDefault.stories.tsx index e5c803b837d57..0e9821d5b357a 100644 --- a/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerDefault.stories.tsx +++ b/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerDefault.stories.tsx @@ -8,6 +8,9 @@ const useStyles = makeStyles({ height: '100px', ...shorthands.border('1px', 'solid', '#ccc'), ...shorthands.margin('20px', '0'), + '@media (forced-colors: active)': { + forcedColorAdjust: 'none', + }, }, }); diff --git a/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerLayout.stories.tsx b/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerLayout.stories.tsx index 2715475e35fca..4f7c3ee88b4ac 100644 --- a/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerLayout.stories.tsx +++ b/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerLayout.stories.tsx @@ -14,6 +14,9 @@ const useStyles = makeStyles({ height: '100px', ...shorthands.border('1px', 'solid', '#ccc'), ...shorthands.margin('20px', '0'), + '@media (forced-colors: active)': { + forcedColorAdjust: 'none', + }, }, }); diff --git a/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerPopup.stories.tsx b/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerPopup.stories.tsx index d4680243bceb9..124716c25dda0 100644 --- a/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerPopup.stories.tsx +++ b/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerPopup.stories.tsx @@ -8,6 +8,9 @@ const useStyles = makeStyles({ height: '100px', ...shorthands.border('1px', 'solid', '#ccc'), ...shorthands.margin('20px', '0'), + '@media (forced-colors: active)': { + forcedColorAdjust: 'none', + }, }, }); diff --git a/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerSize.stories.tsx b/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerSize.stories.tsx index b6e0d73d1b9b8..c72924c17352c 100644 --- a/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerSize.stories.tsx +++ b/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerSize.stories.tsx @@ -44,7 +44,7 @@ export const SwatchPickerSize = () => { })}

Extra small

- + {colors.map(color => { return ; })} diff --git a/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerWithTooltip.stories.tsx b/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerWithTooltip.stories.tsx index 19bb7bded6add..bdad182639811 100644 --- a/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerWithTooltip.stories.tsx +++ b/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/SwatchPickerWithTooltip.stories.tsx @@ -13,6 +13,9 @@ const useStyles = makeStyles({ height: '100px', ...shorthands.border('1px', 'solid', '#ccc'), ...shorthands.margin('20px', '0'), + '@media (forced-colors: active)': { + forcedColorAdjust: 'none', + }, }, }); diff --git a/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/index.stories.tsx b/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/index.stories.tsx index e5b34e7d23f10..19297aaf1ce43 100644 --- a/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/index.stories.tsx +++ b/packages/react-components/react-swatch-picker-preview/stories/SwatchPicker/index.stories.tsx @@ -8,7 +8,6 @@ import { } from '@fluentui/react-swatch-picker-preview'; import descriptionMd from './SwatchPickerDescription.md'; -import bestPracticesMd from './SwatchPickerBestPractices.md'; export { Default } from './SwatchPickerDefault.stories'; export { SwatchPickerImage } from './SwatchPickerImage.stories'; @@ -33,7 +32,7 @@ const metadata: ComponentMeta = { parameters: { docs: { description: { - component: [descriptionMd, bestPracticesMd].join('\n'), + component: [descriptionMd].join('\n'), }, }, },