Skip to content

Commit

Permalink
Merge branch 'mc-ff-example' of https://github.com/mannycarrera4/canv…
Browse files Browse the repository at this point in the history
…as-kit into mc-ff-example
  • Loading branch information
manuel.carrera committed Sep 19, 2024
2 parents f3ba40d + 67d90e5 commit af922d1
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 12 deletions.
11 changes: 10 additions & 1 deletion .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {DocsPage, DocsContainer} from '@storybook/addon-docs';
import React from 'react';
import {DocsPage, DocsContainer, Unstyled} from '@storybook/addon-docs';
import 'cypress-storybook/react';
import routes from './routes';

Expand All @@ -12,6 +13,14 @@ import '@workday/canvas-tokens-web/css/system/_variables.css';
// set routes on window for testing the validity of the routes
window.__routes = routes;

const UnstyledDocsContainer = ({children, ...props}) => {
return (
<DocsContainer {...props}>
<Unstyled>{children}</Unstyled>
</DocsContainer>
);
};

export const decorators = [CanvasProviderDecorator];

export const parameters = {
Expand Down
2 changes: 1 addition & 1 deletion modules/docs/lib/ExampleCodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const ExampleCodeBlock = ({code}: any) => {

return (
<div {...cardStencil({opened: isCodeDisplayed})}>
<Card data-part="example-block">
<Card data-part="example-block" className="sb-unstyled">
<Card.Body>
{React.createElement(code)}
{code && (
Expand Down
12 changes: 10 additions & 2 deletions modules/docs/mdx/12.0-UPGRADE-GUIDE.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ A note to the reader:

- [Canvas Tokens](#canvas-tokens)
- [Codemod](#codemod)
- [Styling Updates](#styling-updates)
- [Compatability Mode](#compatability-mode)
- [Deprecations](#deprecations)
- [Form Field Container](#form-field-container)
- [Removals](#removals)
Expand Down Expand Up @@ -71,6 +73,12 @@ In v12, we have done some infrastructure updates with moving to Webpack 5 and St
these updates has come some formatting issues after running our codemods. We recommend running a
formatter to address the format issues that have been introduced in v12.

## Styling Updates

### Compatability Mode

In v12, we have addressed a style merge issue with removing forced compatibility mode. For more information on this change, please read our [discussion](https://github.com/Workday/canvas-kit/discussions/2893).

## Deprecations

We add the [@deprecated](https://jsdoc.app/tags-deprecated.html) JSDoc tag to code we plan to remove
Expand Down Expand Up @@ -224,8 +232,8 @@ the input regardless of the `orientation`prop's value on`FormField` or `FormFiel
component should replace `FormField.Container` and always be used to ensure proper alignment of the
label and hint text. Our examples have been updated to reflect this.

Although there is no codemod for this change and it's non breaking, we suggest moving towards adding
this sub component when using `FormField`. This component also exists on `FormFieldGroup`.
Although there is no codemod for this change and it's non-breaking, we suggest moving towards adding
this sub-component when using `FormField`. This component also exists on `FormFieldGroup`.

```tsx
<FormField orientation="horizontal">
Expand Down
3 changes: 1 addition & 2 deletions modules/react/layout/spec/mergeStyles.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ describe('mergeStyles', () => {

expect(screen.getByTestId('base')).toHaveStyle({padding: padding.styleAttribute});
});
// Skipping this for now while we enable compat mode to run all the time
it.skip('should allow the cs prop to override base styles', () => {
it('should allow the cs prop to override base styles', () => {
const overrideStyles = createStyles({
padding: padding.createStyles,
});
Expand Down
3 changes: 1 addition & 2 deletions modules/styling-transform/lib/utils/createStyleObjectNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {generateUniqueId} from '@workday/canvas-kit-styling';

import {prettyStringify} from './stylisFns';
import {NestedStyleObject, TransformerContext} from './types';
import {getHash} from './getHash';

/**
* Creates an AST node representation of the passed in `styleObj`, but in the format of `{name:
Expand Down Expand Up @@ -65,7 +64,7 @@ export function serializeStyles(
) {
const {getFileName, styles, cache, names, extractedNames} = context;
const fileName = getFileName(node.getSourceFile().fileName);
const hash = getHash(node, context);
const hash = generateUniqueId(); //getHash(node, context);
const serialized = {...serializedStylesEmotion([input]), name: hash} as ReturnType<
typeof serializedStylesEmotion
>;
Expand Down
2 changes: 1 addition & 1 deletion modules/styling/lib/cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ export function handleCsProp<
// In order to allow everyone to use createStyles and createStencil without worrying about style merge issues, we're going
// to enable compat mode all the time. We'll look into possible out-of-order execution issues in the future and plan to re-enable
// full static mode (for better performance) once we know why this is happening and have a proper workaround.
let shouldRuntimeMergeStyles = true;
let shouldRuntimeMergeStyles = false;

// The order is intentional. The `className` should go first, then the `cs` prop. If we don't do
// runtime merging, this order doesn't actually matter because the browser doesn't care the order
Expand Down
4 changes: 1 addition & 3 deletions modules/styling/spec/cs.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1222,9 +1222,7 @@ describe('handleCsProp', () => {
expect(screen.getByTestId('base')).toHaveStyle({padding: padding.styleAttribute});
});

// While we have compat mode enabled, we'll skip these tests. The class generated comes from emotion and
//we have no way of validating the correct class.
it.skip('should allow the cs prop to override base styles', () => {
it('should allow the cs prop to override base styles', () => {
const overrideStyles = createStyles({
padding: padding.createStyles,
});
Expand Down

0 comments on commit af922d1

Please sign in to comment.