Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
name: Cypress run
command: yarn --cwd /buie test:e2e

chromatic-deploy:
chromatic:
executor: default
steps:
- checkout
Expand Down Expand Up @@ -144,6 +144,6 @@ workflows:
- e2e-tests:
requires:
- setup
- chromatic-deploy:
- chromatic:
requires:
- setup
18 changes: 9 additions & 9 deletions .storybook/customTheme.ts

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the update caused the toolbar button colors to not work. so I just copied the theme used in blueprint

Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,27 @@ import * as vars from '../src/styles/variables';
export default create({
base: 'light',

// Typography
fontBase: 'Lato, "Helvetica Neue", Helvetica, Arial, sans-serif',
fontCode: 'monospace',

colorPrimary: vars.bdlBoxBlue,
colorSecondary: vars.bdlBoxBlue,

// UI
appBg: vars.bdlGray05,
appBg: vars.bdlBoxBlue05,
appContentBg: vars.white,
appBorderColor: vars.bdlGray10,
appBorderRadius: parseInt(vars.bdlBorderRadiusSize, 10),

// Typography
fontBase: 'Lato, "Helvetica Neue", Helvetica, Arial, sans-serif',
fontCode: 'monospace',

// Text colors
textColor: vars.bdlGray,
textInverseColor: vars.bdlGray02,
textInverseColor: vars.white,

// Toolbar default and active colors
barTextColor: vars.white,
barSelectedColor: vars.white,
barBg: vars.bdlBoxBlue,
barTextColor: vars.bdlGray65,
barSelectedColor: vars.bdlBoxBlue,
barBg: vars.white,

brandTitle: 'Box Elements',
brandUrl: 'https://opensource.box.com/box-ui-elements/',
Expand Down
7 changes: 5 additions & 2 deletions .storybook/main.ts

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

breaking change for storybook caused the imports to not work

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import type { Configuration } from 'webpack';

import NodePolyfillPlugin from 'node-polyfill-webpack-plugin';
import TranslationsPlugin from '@box/frontend/webpack/TranslationsPlugin';
import { DefinePlugin } from 'webpack';
import { translationDependencies } from '../scripts/i18n.config';
import _webpack from 'webpack';
import _i18n from '../scripts/i18n.config.js';

const { DefinePlugin } = _webpack;
const { translationDependencies } = _i18n;

const language = process.env.LANGUAGE;
const version = process.env.NODE_ENV === 'production' ? 'demo' : 'dev';
Expand Down
55 changes: 36 additions & 19 deletions .storybook/public/mockServiceWorker.js

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is auto generated

Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* - Please do NOT modify this file.
*/

const PACKAGE_VERSION = '2.10.2'
const INTEGRITY_CHECKSUM = 'f5825c521429caf22a4dd13b66e243af'
const PACKAGE_VERSION = '2.15.0'
const INTEGRITY_CHECKSUM = '03cb67ac84128e63d7cd722a6e5b7f1e'
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
const activeClientIds = new Set()

Expand Down Expand Up @@ -71,11 +71,6 @@ addEventListener('message', async function (event) {
break
}

case 'MOCK_DEACTIVATE': {
activeClientIds.delete(clientId)
break
}

case 'CLIENT_CLOSED': {
activeClientIds.delete(clientId)

Expand All @@ -94,6 +89,8 @@ addEventListener('message', async function (event) {
})

addEventListener('fetch', function (event) {
const requestInterceptedAt = Date.now()

// Bypass navigation requests.
if (event.request.mode === 'navigate') {
return
Expand All @@ -110,32 +107,48 @@ addEventListener('fetch', function (event) {

// Bypass all requests when there are no active clients.
// Prevents the self-unregistered worked from handling requests
// after it's been deleted (still remains active until the next reload).
// after it's been terminated (still remains active until the next reload).
if (activeClientIds.size === 0) {
return
}

const requestId = crypto.randomUUID()
event.respondWith(handleRequest(event, requestId))
event.respondWith(handleRequest(event, requestId, requestInterceptedAt))
})

/**
* @param {FetchEvent} event
* @param {string} requestId
* @param {number} requestInterceptedAt
*/
async function handleRequest(event, requestId) {
async function handleRequest(event, requestId, requestInterceptedAt) {
const client = await resolveMainClient(event)
const requestCloneForEvents = event.request.clone()
const response = await getResponse(event, client, requestId)
const response = await getResponse(
event,
client,
requestId,
requestInterceptedAt,
)

// Send back the response clone for the "response:*" life-cycle events.
// Ensure MSW is active and ready to handle the message, otherwise
// this message will pend indefinitely.
if (client && activeClientIds.has(client.id)) {
const serializedRequest = await serializeRequest(requestCloneForEvents)

// Omit the body of server-sent event stream responses.
// Cloning such responses would prevent client-side stream cancelations
// from reaching the original stream (a teed stream only cancels its
// source once both of its branches cancel) and would buffer the
// entire stream into the unconsumed clone indefinitely.
const isEventStreamResponse = response.headers
.get('content-type')
?.toLowerCase()
.startsWith('text/event-stream')

// Clone the response so both the client and the library could consume it.
const responseClone = response.clone()
const responseClone = isEventStreamResponse ? null : response.clone()

sendToClient(
client,
Expand All @@ -148,15 +161,17 @@ async function handleRequest(event, requestId) {
...serializedRequest,
},
response: {
type: responseClone.type,
status: responseClone.status,
statusText: responseClone.statusText,
headers: Object.fromEntries(responseClone.headers.entries()),
body: responseClone.body,
type: response.type,
status: response.status,
statusText: response.statusText,
headers: Object.fromEntries(response.headers.entries()),
body: responseClone ? responseClone.body : null,
},
},
},
responseClone.body ? [serializedRequest.body, responseClone.body] : [],
responseClone && responseClone.body
? [serializedRequest.body, responseClone.body]
: [],
)
}

Expand Down Expand Up @@ -202,9 +217,10 @@ async function resolveMainClient(event) {
* @param {FetchEvent} event
* @param {Client | undefined} client
* @param {string} requestId
* @param {number} requestInterceptedAt
* @returns {Promise<Response>}
*/
async function getResponse(event, client, requestId) {
async function getResponse(event, client, requestId, requestInterceptedAt) {
// Clone the request because it might've been already used
// (i.e. its body has been read and sent to the client).
const requestClone = event.request.clone()
Expand Down Expand Up @@ -255,6 +271,7 @@ async function getResponse(event, client, requestId) {
type: 'REQUEST',
payload: {
id: requestId,
interceptedAt: requestInterceptedAt,
...serializedRequest,
},
},
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,18 @@
"@box/uploads-manager": "^1.17.2",
"@box/user-selector": "^2.1.5",
"@cfaester/enzyme-adapter-react-18": "^0.8.0",
"@chromatic-com/storybook": "^4.0.1",
"@chromatic-com/storybook": "^5.2.1",
"@commitlint/cli": "^19.8.0",
"@commitlint/config-conventional": "^19.8.0",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.6.0",
"@formatjs/intl-pluralrules": "^1.5.2",
"@formatjs/intl-relativetimeformat": "^4.5.9",
"@hapi/address": "^2.1.4",
"@storybook/addon-docs": "^9.1.20",
"@storybook/addon-styling-webpack": "^2.0.0",
"@storybook/addon-webpack5-compiler-babel": "^3.0.6",
"@storybook/react-webpack5": "^9.1.20",
"@storybook/addon-docs": "^10.5.0",
"@storybook/addon-styling-webpack": "^3.0.2",
"@storybook/addon-webpack5-compiler-babel": "^4.0.1",
"@storybook/react-webpack5": "^10.5.0",
Comment on lines +154 to +165

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check installed versions and peer dependency requirements
cat node_modules/storybook/package.json 2>/dev/null | jq '{version, engines, peerDependencies}' || echo "storybook not installed"
cat node_modules/chromatic/package.json 2>/dev/null | jq '{version, engines, peerDependencies}' || echo "chromatic not installed"
cat node_modules/@chromatic-com/storybook/package.json 2>/dev/null | jq '{version, engines, peerDependencies}' || echo "`@chromatic-com/storybook` not installed"
cat node_modules/msw-storybook-addon/package.json 2>/dev/null | jq '{version, engines, peerDependencies}' || echo "msw-storybook-addon not installed"
cat node_modules/storybook-react-intl/package.json 2>/dev/null | jq '{version, engines, peerDependencies}' || echo "storybook-react-intl not installed"
cat node_modules/@storybook/addon-styling-webpack/package.json 2>/dev/null | jq '{version, peerDependencies}' || echo "addon-styling-webpack not installed"
cat node_modules/@storybook/addon-webpack5-compiler-babel/package.json 2>/dev/null | jq '{version, peerDependencies}' || echo "addon-webpack5-compiler-babel not installed"

Repository: box/box-ui-elements

Length of output: 1346


@storybook/addon-styling-webpack needs a Storybook 10.5-compatible release 3.0.2 only declares support through 10.4.0-0, but this bump pulls 10.5.0. Update the addon or keep Storybook on a supported 10.4.x release.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` around lines 154 - 165, Align the Storybook dependency versions
by either upgrading `@storybook/addon-styling-webpack` to a release that
explicitly supports Storybook 10.5.0, or change the Storybook packages such as
`@storybook/addon-docs` and `@storybook/react-webpack5` back to a supported 10.4.x
release.

Source: Learnings

"@tanstack/react-virtual": "^3.13.12",
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.9.1",
Expand Down Expand Up @@ -196,7 +196,7 @@
"babel-plugin-react-remove-properties": "^0.3.0",
"babel-plugin-rewire": "^1.0.0",
"babel-plugin-styled-components": "^1.10.7",
"chromatic": "^11.26.1",
"chromatic": "^18.0.1",
"circular-dependency-plugin": "^5.2.2",
"classnames": "^2.5.1",
"color": "^3.2.1",
Expand Down Expand Up @@ -240,8 +240,8 @@
"message-accumulator": "^2.1.1",
"mini-css-extract-plugin": "^2.10.1",
"mousetrap": "^1.6.5",
"msw": "^2.10.2",
"msw-storybook-addon": "^2.0.5",
"msw": "^2.15.0",
"msw-storybook-addon": "^2.0.7",
"node-polyfill-webpack-plugin": "^4.1.0",
"npm-run-all": "^4.1.5",
"pikaday": "^1.8.2",
Expand Down Expand Up @@ -276,8 +276,8 @@
"scroll-into-view-if-needed": "^2.2.31",
"semantic-release": "^24.2.9",
"sinon": "^2.3.7",
"storybook": "^9.1.20",
"storybook-react-intl": "^4.0.7",
"storybook": "^10.5.0",
"storybook-react-intl": "^10.2.1",
"string-replace-loader": "^3.1.0",
"styled-components": "5.0.0",
"stylelint": "^16.26.1",
Expand Down

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird type issue appearing

Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,9 @@ const meta: Meta<typeof ContentExplorer> = {
handlers: [
// Note that the Metadata API backend normally handles the sorting. The mocks below simulate the sorting for specific cases, but may not 100% accurately reflect the backend behavior.
http.post(`${DEFAULT_HOSTNAME_API}/2.0/metadata_queries/execute_read`, async ({ request }) => {
const body = await request.clone().json();
const orderByDirection = body.order_by[0].direction;
const orderByFieldKey = body.order_by[0].field_key;
const { order_by } = (await request.clone().json()) as { order_by };
const orderByDirection = order_by[0].direction;
const orderByFieldKey = order_by[0].field_key;

// Hardcoded case for sorting by industry
if (orderByFieldKey === `industry` && orderByDirection === 'ASC') {
Expand Down
Loading
Loading