box-ui-elements 23.4.0-beta.5 → 23.4.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DEVELOPING.md +13 -29
- package/cypress.config.ts +1 -1
- package/dist/explorer.css +1 -1
- package/dist/explorer.js +1 -1
- package/dist/preview.css +1 -1
- package/dist/preview.js +1 -1
- package/dist/sidebar.js +1 -1
- package/es/components/context-menu/ContextMenu.stories.js +3 -3
- package/es/components/context-menu/ContextMenu.stories.js.map +1 -1
- package/es/components/context-menu/ContextMenuExample.scss +4 -0
- package/es/components/context-menu/ContextMenuWithSubmenuExample.js +43 -0
- package/es/components/context-menu/ContextMenuWithSubmenuExample.js.map +1 -0
- package/es/components/selector-dropdown/SelectorDropdown.stories.js +2 -2
- package/es/components/selector-dropdown/SelectorDropdown.stories.js.flow +2 -2
- package/es/components/selector-dropdown/SelectorDropdown.stories.js.map +1 -1
- package/es/components/selector-dropdown/SelectorDropdownExample.js +126 -0
- package/es/components/selector-dropdown/SelectorDropdownExample.js.map +1 -0
- package/es/elements/content-preview/preview-header/FileInfo.scss +4 -0
- package/es/elements/content-sidebar/BoxAISidebarContent.js +6 -1
- package/es/elements/content-sidebar/BoxAISidebarContent.js.map +1 -1
- package/es/src/components/context-menu/ContextMenu.stories.d.ts +1 -1
- package/es/src/components/context-menu/ContextMenuWithSubmenuExample.d.ts +9 -0
- package/es/src/components/selector-dropdown/SelectorDropdownExample.d.ts +3 -0
- package/es/src/elements/content-sidebar/BoxAISidebarContent.d.ts +2 -0
- package/es/types.d.ts +0 -1
- package/eslint.config.js +0 -1
- package/i18n/pl-PL.js +2 -2
- package/i18n/pl-PL.properties +2 -2
- package/package.json +9 -16
- package/src/components/context-menu/ContextMenu.stories.tsx +3 -3
- package/src/components/context-menu/ContextMenuExample.scss +4 -0
- package/src/components/context-menu/ContextMenuWithSubmenuExample.tsx +61 -0
- package/src/components/progress-bar/README.md +1 -11
- package/src/components/selector-dropdown/SelectorDropdown.stories.js +2 -2
- package/src/components/selector-dropdown/SelectorDropdownExample.tsx +140 -0
- package/src/elements/content-preview/preview-header/FileInfo.scss +4 -0
- package/src/elements/content-sidebar/BoxAISidebarContent.tsx +13 -2
- package/src/elements/content-sidebar/__tests__/BoxAISidebar.test.tsx +21 -0
- package/types.ts +0 -1
package/DEVELOPING.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Development Setup
|
|
2
2
|
|
|
3
|
-
Our development setup assumes a LINUX/BSD
|
|
3
|
+
Our development setup assumes a LINUX/BSD environment.
|
|
4
4
|
|
|
5
5
|
## Project Setup
|
|
6
6
|
|
|
@@ -12,23 +12,20 @@ Our development setup assumes a LINUX/BSD environemnt.
|
|
|
12
12
|
6. Add the upstream repo to your remotes `git remote add upstream git@github.com:box/box-ui-elements.git`.
|
|
13
13
|
7. Verify your remotes are properly set up `git remote -v`. You should pull updates from the `upstream` box repo and push changes to your fork `origin`.
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## Storybook
|
|
16
16
|
|
|
17
|
-
A published version of
|
|
17
|
+
We use Storybook (https://storybook.js.org/). A published version of our Storybook is available at https://opensource.box.com/box-ui-elements/.
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
2. Navigate to `http://localhost:6060/` to see the UI Elements in action. If testing on a different machine or VM, you can instead use the IP address shown on your terminal window.
|
|
21
|
-
|
|
22
|
-
**_NOTE:_** _This note applies to testing top level UI Elements only and not the lower level components. If you want to use your own live data for the style guide, then start the style guide server using [your own developer auth token](https://developer.box.com/docs/authenticate-with-developer-token) and a file or folder ID via_
|
|
19
|
+
## Local Development
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
1. Start your local Storybook instance via `yarn start`.
|
|
22
|
+
2. Navigate to `http://localhost:6060/` to see the UI Elements in action. If testing on a different machine or VM, you can instead use the IP address shown on your terminal window.
|
|
26
23
|
|
|
27
24
|
## Testing UI Elements in a Parent Project
|
|
28
25
|
|
|
29
26
|
### Webpack Setup
|
|
30
27
|
|
|
31
|
-
`box-ui-elements` must use the same `react` and `react-dom` instances as the parent application for React hooks to work properly. Application repositories must add the following webpack `resolve` alias configuration to
|
|
28
|
+
`box-ui-elements` must use the same `react` and `react-dom` instances as the parent application for React hooks to work properly. Application repositories must add the following webpack `resolve` alias configuration to satisfy this requirement:
|
|
32
29
|
|
|
33
30
|
```js
|
|
34
31
|
// webpack.config.js
|
|
@@ -44,7 +41,7 @@ A published version of the style guide can be seen at https://opensource.box.com
|
|
|
44
41
|
}
|
|
45
42
|
```
|
|
46
43
|
|
|
47
|
-
This will ensure that `box-ui-elements` does not use
|
|
44
|
+
This will ensure that `box-ui-elements` does not use its own `react` and `react-dom` modules when linked. Improper setup is the primary reason for "**Invalid Hook**" errors due to React version mismatch.
|
|
48
45
|
|
|
49
46
|
We also recommend using `yarn resolutions` to fix the version of `react` and `react-dom` in your application:
|
|
50
47
|
|
|
@@ -71,9 +68,8 @@ To test the Box UI Elements with your own project use local Yarn linking.
|
|
|
71
68
|
|
|
72
69
|
## Common Script Commands
|
|
73
70
|
|
|
74
|
-
- `yarn start` to launch a local
|
|
71
|
+
- `yarn start` to launch a local Storybook server. Uses demo live data for Elements.
|
|
75
72
|
- `yarn start:npm` to symlink Elements via `yarn link` to a parent project.
|
|
76
|
-
- `yarn start:dev` to launch a local webpack dev server. Uses your own data for Elements.
|
|
77
73
|
- `yarn lint` to lint js and css.
|
|
78
74
|
- `yarn lint:js --fix` to lint js and fix issues.
|
|
79
75
|
- `yarn lint:css --fix` to lint styles and fix issues.
|
|
@@ -102,27 +98,15 @@ For more information, please see https://flow.org/en/docs/react/components/#toc-
|
|
|
102
98
|
Install the following plugins in your preferred editor
|
|
103
99
|
|
|
104
100
|
- Editor Config (standardizes basic editor configuration)
|
|
105
|
-
- ESLint (
|
|
101
|
+
- ESLint (JavaScript linting)
|
|
106
102
|
- Stylelint (CSS linting)
|
|
107
|
-
- Prettier (
|
|
103
|
+
- Prettier (JavaScript formatting)
|
|
108
104
|
- Sass (Stylesheets)
|
|
109
105
|
- Babel (Transpiler)
|
|
110
106
|
|
|
111
|
-
## Testing Embedded UI Elements With Your Data
|
|
112
|
-
|
|
113
|
-
Under most circumstances you should be using the style guide as mentioned earlier. This section is primarily for testing the Box UI Elements embedded in a custom HTML page with your own box data and auth token. For this, launch a local webpack dev server via `yarn start:dev` and navigate to `http://localhost:8080/`. HTML test files for local development are located inside the [test folder](http://localhost:8080/test).
|
|
114
|
-
|
|
115
|
-
1. Open a test file, such as http://localhost:8080/test/sidebar.html
|
|
116
|
-
2. When prompted, enter a file id and developer token.
|
|
117
|
-
1. Developer tokens can be created at https://app.box.com/developers/console.
|
|
118
|
-
2. Select `Custom App` and choose `Oauth 2.0 with JWT (Server Authentication)`.
|
|
119
|
-
3. Select `View Your App` > `Configuration` > `CORS Domains` and add `http://localhost:8080` to the domain whitelist. Save the configuration.
|
|
120
|
-
4. The developer token will be regenerated once the configuration is saved. Copy the token and paste into the prompt in the localhost test page. The token will be valid for an hour; return to the app configuration page to generate a new token.
|
|
121
|
-
5. For additional information about developing on the Box Platform, see the [Platform docs](https://developer.box.com/docs/box-ui-elements#section-using-the-box-ui-elements).
|
|
122
|
-
|
|
123
107
|
## Unit Testing
|
|
124
108
|
|
|
125
|
-
### `
|
|
109
|
+
### `Jest` and `Enzyme`
|
|
126
110
|
|
|
127
111
|
The project uses the `jest` testing framework and `enzyme` for component testing.
|
|
128
112
|
|
|
@@ -131,7 +115,7 @@ Please refer to the relevant documentation pages for tutorials and troubleshooti
|
|
|
131
115
|
- Jest: https://jestjs.io
|
|
132
116
|
- Enzyme: https://airbnb.io/enzyme/
|
|
133
117
|
|
|
134
|
-
### Testing Hooks with `
|
|
118
|
+
### Testing Hooks with `Enzyme`
|
|
135
119
|
|
|
136
120
|
Most hooks can be tested with `shallow` rendering except for lifecycle hooks such as `useEffect` and `useLayoutEffect`.
|
|
137
121
|
|
package/cypress.config.ts
CHANGED
|
@@ -10,7 +10,7 @@ export default defineConfig({
|
|
|
10
10
|
viewportHeight: 1260,
|
|
11
11
|
viewportWidth: 1600,
|
|
12
12
|
e2e: {
|
|
13
|
-
baseUrl: 'http://localhost:
|
|
13
|
+
baseUrl: 'http://localhost:6060',
|
|
14
14
|
specPattern: 'test/integration/**/*.cy.{js,jsx,ts,tsx}',
|
|
15
15
|
supportFile: 'test/support/index.js',
|
|
16
16
|
},
|