Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix/peer-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
Niznikr committed Jan 19, 2023
2 parents 2d81aec + 353b832 commit 89ff182
Show file tree
Hide file tree
Showing 501 changed files with 12,236 additions and 4,182 deletions.
6 changes: 6 additions & 0 deletions .changeset/breezy-bottles-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@twilio-paste/combobox': patch
'@twilio-paste/core': patch
---

[Combobox] Render the listbox in a portal to fix a bug where the contents of the listbox are cut off when it placed inside a scrolling container. Adds a new dependency on @radix-ui/react-use-rect.
6 changes: 6 additions & 0 deletions .changeset/khaki-sloths-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@twilio-paste/card': patch
'@twilio-paste/core': patch
---

[Card] Update styles to align with new Paste Twilio theme
6 changes: 6 additions & 0 deletions .changeset/lovely-rings-switch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@twilio-paste/side-modal': patch
'@twilio-paste/core': patch
---

[Side Modal] Update styles to align with new Paste Twilio theme
4 changes: 4 additions & 0 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@
"/packages/paste-core/components/data-grid",
"/packages/paste-libraries/data-visualization",
"/packages/paste-core/components/date-picker",
"/packages/paste-core/components/description-list",
"/packages/paste-design-tokens",
"/packages/paste-core/components/disclosure",
"/packages/paste-core/primitives/disclosure",
"/packages/paste-core/components/display-heading",
"/packages/paste-core/components/display-pill-group",
"/packages/paste-libraries/dropdown",
"/packages/paste-core/components/file-picker",
"/packages/paste-core/components/file-uploader",
"/packages/paste-core/layout/flex",
"/packages/paste-core/components/form",
"/packages/paste-core/components/form-pill-group",
"/packages/paste-core/layout/grid",
"/packages/paste-core/components/heading",
Expand All @@ -50,6 +53,7 @@
"/packages/paste-core/components/label",
"/packages/paste-libraries/lexical",
"/packages/paste-core/components/list",
"/packages/paste-core/primitives/listbox",
"/packages/paste-core/layout/media-object",
"/packages/paste-core/components/menu",
"/packages/paste-core/primitives/menu",
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/on_merge_to_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ jobs:
exitOnceUploaded: true
env:
STORYBOOK_GITHUB_SHA: ${{ github.sha }}
# https://github.com/storybookjs/builder-vite/issues/409#issuecomment-1199236279
NODE_OPTIONS: --max-old-space-size=6144

# run this job first to create a single timestamped id for all percy batches on parallel machines
percy-batch-id:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/on_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,8 @@ jobs:
exitOnceUploaded: true
env:
STORYBOOK_GITHUB_SHA: ${{ github.event.pull_request.head.sha }}
# https://github.com/storybookjs/builder-vite/issues/409#issuecomment-1199236279
NODE_OPTIONS: --max-old-space-size=6144

pr-categorizer:
name: Categorize the PR using labels
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/// <reference types="vite/client" />
import React from 'react';
import isChromatic from 'chromatic/isChromatic';
import {version} from '../packages/paste-core/core-bundle/package.json';

const trackRenderPerformance = (data) => {
const commitSha = process.env.STORYBOOK_GITHUB_SHA ? process.env.STORYBOOK_GITHUB_SHA : 'localdev';
const commitSha = import.meta.env.STORYBOOK_GITHUB_SHA ? import.meta.env.STORYBOOK_GITHUB_SHA : 'localdev';

fetch('https://paste-data.netlify.app/.netlify/functions/create-component-perf-metric', {
method: 'POST',
Expand Down
5 changes: 5 additions & 0 deletions .storybook/gatsby.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as React from 'react';

const Link: React.FC = ({children, ...props}) => <a {...props}>{children}</a>;

export {Link};
90 changes: 0 additions & 90 deletions .storybook/main.js

This file was deleted.

51 changes: 51 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import type {StorybookConfig} from '@storybook/react-vite';
import {mergeConfig} from 'vite';
import path from 'path';

const config: StorybookConfig = {
stories: [
'../packages/**/*.stories.@(js|jsx|ts|tsx|mdx)',
'../performance-benchmarks/**/*.stories.@(js|jsx|ts|tsx|mdx)',
],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-a11y',
'@storybook/addon-interactions',
'./addons/google-analytics/register',
],
framework: {
name: '@storybook/react-vite',
},
features: {
interactionsDebugger: true,
},
staticDirs: ['./static'],
typescript: {
// enable type checking
check: true,
},
docs: {
autodocs: true,
defaultName: 'Docs',
},
async viteFinal(config, {configType}) {
const isDev = configType === 'DEVELOPMENT' && process.env.NODE_ENV !== 'test';
return mergeConfig(config, {
resolve: {
alias: {
gatsby: path.resolve(__dirname, './gatsby'),
'react-dom/client': path.resolve(__dirname, '../node_modules/react-dom/client'),
'react-dom': path.resolve(__dirname, '../node_modules/react-dom/profiling'),
'scheduler/tracing': path.resolve(__dirname, '../node_modules/scheduler/tracing-profiling'),
},
...(isDev && {mainFields: ['main:dev', 'browser', 'module', 'main']}),
},
optimizeDeps: {
include: ['@storybook/addon-viewport', 'chromatic/isChromatic', '@emotion/react/jsx-dev-runtime'],
},
});
},
};

export default config;
1 change: 0 additions & 1 deletion .storybook/package.json

This file was deleted.

6 changes: 6 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@
crossorigin="anonymous"
/>
<link rel="stylesheet" href="https://assets.twilio.com/public_assets/paste-fonts/1.4.1/fonts.css" />
<script>
window.global = window;
window.process = {
env: {},
};
</script>
14 changes: 14 additions & 0 deletions .storybook/preview.js → .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import {action} from '@storybook/addon-actions';
import {INITIAL_VIEWPORTS} from '@storybook/addon-viewport';
import isChromatic from 'chromatic/isChromatic';
import {StylingGlobals} from '@twilio-paste/styling-library';
Expand Down Expand Up @@ -169,3 +170,16 @@ export const parameters = {
viewports: INITIAL_VIEWPORTS,
},
};

// https://www.gatsbyjs.com/docs/how-to/testing/visual-testing-with-storybook/#manual-configuration

global.___loader = {
enqueue: () => {},
hovering: () => {},
};

global.__BASE_PATH__ = '/';

window.___navigate = (pathname) => {
action('NavigateTo:')(pathname);
};
2 changes: 1 addition & 1 deletion .vscode/component.code-snippets
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"prefix": "prindexp",
"body": [
"import * as React from 'react';",
"import * as PropTypes from 'prop-types';",
"import PropTypes from 'prop-types';",
"import {Box} from '@twilio-paste/box';",
"",
"${1:prfcp}",
Expand Down
2 changes: 0 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ const BASE_PLUGINS = [
'macros',
['@babel/proposal-class-properties', {loose: true}],
'@babel/proposal-object-rest-spread',
['@babel/proposal-private-methods', {loose: true}],
['@babel/proposal-private-property-in-object', {loose: true}],
'@babel/plugin-transform-runtime',
'@babel/plugin-proposal-optional-chaining',
];

Expand Down
2 changes: 1 addition & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default defineConfig({
USE_CYPRESS_VRT: process.env.USE_CYPRESS_VRT,
},
viewportWidth: 1440,
viewportHeight: 1020,
viewportHeight: 1440,
projectId: 'pe4h41',
retries: {
runMode: 2,
Expand Down
46 changes: 3 additions & 43 deletions cypress/integration/sidebar-navigation/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const sidebarNavigationDisclosures = [
'content',
'patterns',
'components',
'combobox',
'icon',
'primitives',
'tokens',
Expand Down Expand Up @@ -42,17 +43,8 @@ describe('Sidebar navigation', () => {
// creates an alias for the content
cy.get(`[data-cy="${contentSelector}"]`).as('currentContent');

cy.get('@currentContent')
// calls jquery attr() on the DOM element, returns the value of the data-level attribute
.invoke('attr', 'data-level')
.then((level) => {
return getTargetOffset(level);
})
.then((offset) => {
// scrollIntoView has offset arg, which takes top and left coordinates and scrolls that far after element is in view
cy.get('@currentContent').scrollIntoView({offset}).should('be.visible');
visited.add(buttonSelector);
});
cy.get('@currentContent').scrollIntoView().should('be.visible');
visited.add(buttonSelector);
});
});
});
Expand Down Expand Up @@ -114,35 +106,3 @@ function cleanupOpenDisclosures(visited: Set<string>) {
});
});
}

/**
* Helper that gets the coordinates of the disclosure content relative to the ul that wraps the disclosures
* @param level {'0' | '1'} - the level the disclosure content is nested
* @returns {top, left} - the content's coordinates
*/
function getTargetOffset(level) {
if (Number(level) > 0) {
// creates an alias for the ul that wraps the disclosures
cy.get('@currentContent').parent().parent().as('navigationList');

return (
cy
.get('@navigationList')
// calls jquery offset(), returns top, left coordinates of the ul
.invoke('offset')
.then((containingOffset) => {
cy.get('@currentContent')
// calls jquery offset(), returns top, left coordinates of disclosure content
.invoke('offset')
.then((currentOffset) => {
// add the top values, which is the correct value for cypress to scroll
const top = containingOffset.top + currentOffset.top;
const left = currentOffset.left;
return {top, left};
});
})
);
}

return cy.get('@currentContent').invoke('offset');
}
6 changes: 6 additions & 0 deletions cypress/integration/sitemap-vrt/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ export const SITEMAP = [
'/components/chat-log/',
'/components/checkbox/',
'/components/data-grid/',
'/components/description-list/',
'/components/display-heading/',
'/components/display-pill-group/',
'/components/disclosure/',
'/components/button/',
'/components/button-group/',
'/components/flex/',
'/components/file-picker/',
'/components/file-uploader/',
'/components/form/',
'/components/combobox/',
'/components/date-picker/',
'/components/grid/',
Expand Down Expand Up @@ -85,6 +89,7 @@ export const SITEMAP = [
'/foundations/content/word-list/',
'/foundations/illustrations/',
'/foundations/data-visualization/',
'/foundations/spacing-and-layout/',
'/inclusive-design/',
'/core/',
'/foundations/content/product-style-guide/',
Expand Down Expand Up @@ -117,6 +122,7 @@ export const SITEMAP = [
'/primitives/tabs-primitive/',
'/primitives/text/',
'/primitives/tooltip-primitive/',
'/primitives/listbox-primitive/',
'/roadmap/',
'/theme/',
'/theme/changing-theme/',
Expand Down
Loading

0 comments on commit 89ff182

Please sign in to comment.