You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-5Lines changed: 1 addition & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,11 +12,7 @@ Instructure UI is an open source UI framework and design system for React. Its c
12
12
13
13
## Contributing
14
14
15
-
Before contributing please read our [code of conduct](https://instructure.design/#CODE_OF_CONDUCT) and read the [contribution guidelines](https://instructure.design/#contributing).
16
-
17
-
## React Support
18
-
19
-
Instructure UI currently supports 16.14.0 and higher.
15
+
Before contributing, please read our [code of conduct](https://instructure.design/#CODE_OF_CONDUCT) and read the [contribution guidelines](https://instructure.design/#contributing).
Copy file name to clipboardExpand all lines: docs/contributor-docs/api-guidelines.md
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,43 +10,42 @@ order: 4
10
10
11
11
- All components should pass through additional props down to the root DOM element using the `passthroughProps` utility. (e.g. `<div {...passthroughProps(this.props)}>`). Note that in addition to allowing only valid DOM node attributes, `passthroughProps` will remove the `className` and `style` props to prevent unexpected style issues. These need to be set explicitly and used with caution. It also removes the `styles` and `makesStyles` properties added by the [withStyle](#withStyle) decorator.
12
12
- Avoid props that could be computed from other props. (e.g. prefer `<Select filter={handleFilter} />` over `<Select shouldFilter filter={handleFilter} />`. Prefer determining whether filtering should happen based on the presence of the `filter` function prop.)
13
-
- Avoid situations where certain prop combinations are not supported. Prefer splitting the component into separate components with fewer props or using `PropTypes.oneOf`.
13
+
- Avoid situations where certain prop combinations are not supported. Prefer splitting the component into separate components with fewer props.
14
14
- Set default prop values for non-required props when possible.
15
15
16
16
#### General Naming Conventions
17
17
18
18
- Component prop names should be camelCase.
19
19
- Avoid the 'default' prop prefix since all components should be controlled only.
20
20
- If the component should allow custom DOM elements, it should provide an `as` prop. (e.g. `<Tag as="span" />` will render an HTML `span` element.)
21
-
- Enum (`PropType.oneOf`) prop values should be kebab-case (dashes) (e.g. `size="x-small"`).
21
+
- Enum prop values should be kebab-case (dashes) (e.g. `size="x-small"`).
22
22
23
23
#### Boolean props
24
24
25
-
- Boolean props should be avoided when possible in favor of `PropTypes.oneOf` (a list of possible values) so that it's easier to extend later on.
26
-
- Avoid Boolean props that are mutually exclusive in favor of `PropTypes.oneOf` or separate components. For example, prefer `<Input interaction="disabled" />` over `<Input disabled />` where the `interaction` prop is `PropTypes.oneOf(['disabled', 'enabled', 'readonly'])`. Note that an input cannot be disabled and readonly, so these are mutually exclusive.
25
+
- Avoid Boolean props that are mutually exclusive in favor of separate components. For example, prefer `<Input interaction="disabled" />` over `<Input disabled />` where the `interaction` prop is `'disabled' | 'enabled' | 'readonly'`. Note that an input cannot be disabled and readonly, so these are mutually exclusive.
27
26
- Boolean props should begin with `should`/`is`/`does`/`has`/`with`.
28
27
- When possible, default boolean props to `false` so that they can be set to `true` without a value. (e.g. prefer `<Modal isOpen />` over `<Modal isClosed={false} />`)
29
28
30
29
#### Function props
31
30
32
-
- Function props that provide custom rendering should be prefixed with `render` (e.g. `renderLabel`, `renderHeader`). These props can be set to `PropTypes.oneOfType([PropTypes.node, PropTypes.func])` for the most flexibility. If your prop only accepts strings and provides text that is only read by screen readers, use the `screenReader` prefix (e.g., `screenReaderLabel`).
31
+
- Function props that provide custom rendering should be prefixed with `render` (e.g. `renderLabel`, `renderHeader`). If your prop only accepts strings and provides text that is only read by screen readers, use the `screenReader` prefix (e.g., `screenReaderLabel`).
33
32
- Function props that handle events should be prefixed with `on` (e.g. `onDismiss`, `onClose`, `onSelect`).
34
33
- Function props that handle DOM events should always pass in the [React SyntheticEvent](https://reactjs.org/docs/events.html) object as the first argument and any meta data about the event as a second argument.
35
34
- Function props that handle DOM events should be chained (e.g. `createChainedFunction(this.props.onFocus, this.handleFocus)`) so that consumers are able to attach their own handlers in addition to the built in handlers.
36
35
- Function [ref](https://reactjs.org/docs/refs-and-the-dom.html) props should have a `Ref` suffix and should describe the element to which it provides a ref (e.g. `inputRef`).
37
-
- All components should provide an `elementRef` prop that will return a ref to the root DOM element.
36
+
- All components should provide an `ref` prop that will return a ref to the root DOM element.
38
37
39
38
#### Children
40
39
41
40
- Prefer child components and composition with JSX vs. complex prop types. (e.g. prefer `<List><List.Item label="foo" /></List>` over `<List items={['foo']} />`)
42
41
- Avoid using internal child components that aren't meant to be exported as part of the public component API. Prefer composition using other publicly available components that can be rendered in isolation or provide public child components.
43
42
- If your component accepts a list of children, make sure it handles `null` children.
44
-
- Child components that can't be used on their own should be exported as static properties on the parent component (e.g. `Table.Row`, `Menu.Item`), so that only one import is required to render the component (e.g. `import Table from '@instructure/ui-tables'`).
43
+
- Child components that can't be used on their own should be exported as static properties on the parent component (e.g. `Table.Row`, `Menu.Item`), so that only one import is required to render the component (e.g. `import Table from '@instructure/ui-table'`).
45
44
- If the parent component can only be used with specific children that can also be used on their own, it should have the `Group` suffix (e.g. `<RadioGroup><Radio /><Radio /></RadioGroup>`, `<ButtonGroup><Button /><Button /></ButtonGroup>`).
46
45
47
-
### styles.js Class Names
46
+
### styles.ts Class Names
48
47
49
-
- In the `styles.js`, use the name of the component in camelCase (e.g. `appNav`) as the key of the root element's style object. Use camelCase for the keys of child elements as well (e.g. `list` and `listItem`).
48
+
- In the `styles.ts`, use the name of the component in camelCase (e.g. `appNav`) as the key of the root element's style object. Use camelCase for the keys of child elements as well (e.g. `list` and `listItem`).
50
49
- All style object names should be semantic (describe the content, not what it looks like).
51
50
- We make use of the `label` property of [Emotion.js](https://emotion.sh/) so that it gets displayed in the generated class name for easy readability and targetability. We use a naming convention based on [BEM naming convention](#http://getbem.com/naming/):
52
51
- For the root element, add a label with the name of the component in camelCase \
Copy file name to clipboardExpand all lines: docs/contributor-docs/codemods.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,8 +70,8 @@ We support testing these warnings using special fixtures and a console.warn spy.
70
70
---
71
71
<MyComponentdeprecatedProp="value"/>
72
72
```
73
-
3. Create new sample output file with the array of expected warning messages in the `__testfixtures__` folder, filename follows the following naming convention: `[fixtureName].warning.output.[js/ts/tsx]`:
74
-
```ts
73
+
3. Create new sample output file with the array of expected warning messages in the `__testfixtures__` folder, filename follows the following naming convention: `[fixtureName].warning.output.json`:
Copy file name to clipboardExpand all lines: docs/contributor-docs/contributing.md
+7-51Lines changed: 7 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ Please follow the steps on the [how to build guide page](#building-instui).
28
28
### Running the documentation app
29
29
30
30
1. Run `npm start`
31
-
1. Open [http://localhost:8001](http://localhost:8001) in your browser
31
+
1. Open [http://localhost:9090](http://localhost:9090) in your browser
32
32
33
33
### Development
34
34
@@ -41,73 +41,29 @@ Please follow the steps on the [how to build guide page](#building-instui).
41
41
42
42
### Testing
43
43
44
-
See the [testing documentation](#testing-components) for details.
44
+
See the [testing documentation](#testing-overview) for details.
45
45
46
46
### Linters and Code Formatting
47
47
48
-
Linters are run as part of the build. If you use the Sublime Text, Atom, or VSCode editors, you can set up the following plugins to catch lint and formatting errors earlier.
48
+
Linters are run as part of the build. If you use VSCode, you can set up the following plugins to catch lint and formatting errors earlier.
49
49
50
-
1. Install the _Linter_ plugin [Sublime](http://sublimelinter.readthedocs.org/en/latest/), [Atom](https://atom.io/packages/linter). Linting is included in VSCode.
51
-
1. Install the _EditorConfig_ plugin [Sublime](https://github.com/sindresorhus/editorconfig-sublime), [Atom](https://github.com/sindresorhus/atom-editorconfig), [VSCode](https://github.com/editorconfig/editorconfig-vscode)
52
-
1. Install the _Eslint_ plugin [Sublime](https://github.com/roadhump/SublimeLinter-eslint), [Atom](https://github.com/AtomLinter/linter-eslint), [VSCode](https://github.com/Microsoft/vscode-eslint)
53
-
1. Install the _Stylelint_ plugin [Sublime](https://github.com/kungfusheep/SublimeLinter-contrib-stylelint), [Atom](https://atom.io/packages/linter-stylelint), [VSCode](https://github.com/shinnn/vscode-stylelint)
50
+
1. Install the _Eslint_ plugin [VSCode](https://github.com/Microsoft/vscode-eslint)
51
+
1. Install the _Stylelint_ plugin [VSCode](https://github.com/stylelint/vscode-stylelint)
54
52
1. Run `npm install` to install the dependencies
55
53
1. Restart your editor
56
54
57
55
### Documentation
58
56
59
57
Please update the documentation and examples with any changes.
60
58
61
-
-`npm start` will build the production version of the documentation. You can view it at [http://localhost:8001](http://localhost:8001).
59
+
-`npm start` will build the production version of the documentation. You can view it at [http://localhost:9090](http://localhost:9090).
62
60
- All components and utilities should be well documented, including examples.
63
61
- Write documentation inline in code comment blocks. The code and docs should
64
62
always be in sync.
65
63
66
64
### Commit Guidelines
67
65
68
-
1. Run `git commit` to commit your changes and follow our commit message format.
69
-
1. Please do not include the output of `npm run build` in your commits.
70
-
71
-
### Adding a package
72
-
73
-
1. Run `npm run generate:package` and choose a name for your package (use "kebab" case (dashes), e.g. 'my-package').
74
-
2. Run `npm install` to update the lockfile.
75
-
3. Give a new package `description` in the `package.json` file.
76
-
4. Add package reference in the root `tsconfig.references.json`.
77
-
5. Register your package in the **docs app**:
78
-
1. Add an alias for your package in `packages/__docs__/resolve.js`.
79
-
2. Add the dependency in `packages/__docs__/package.json`.
80
-
3. Add the reference in `packages/__docs__/tsconfig.build.json`.
81
-
6. Stop the dev server (if you have it running), and run `npm run dev` to pick up the new package.
82
-
7. Visit [http://localhost:9090](http://localhost:9090) in a browser. You should see your package listed in the docs.
83
-
84
-
### Adding a component
85
-
86
-
1. Run `npm run generate:component` and choose a name for your component (use Pascal case: e.g., 'MyComponent').
87
-
2. Choose to create a new package for your component, add it to an existing package, or create the component with no package.
88
-
3. If you added the component to an **existing package**:
89
-
1. Don't forget to [add the new dependencies and devDependencies](/#contributing/#code-guidelines-adding-a-new-dependency) to the package.
90
-
2. List the new component in the package's `README.md` file under the `### Components` title (use other packages as reference when there is no "Components" block yet).
91
-
3. Export the component from the `packages/[package]/src/index.js` (`export { MyComponent } from './MyComponent'`)
92
-
4. Export the "Props type" from the `packages/[package]/src/index.js` (`export type { MyComponentProps } from './MyComponent/props'`)
93
-
4. If you created a **new package** for your component:
94
-
1. Follow the setup steps 2-5 of [Adding a package](/#contributing/#code-guidelines-adding-a-package). Do not start the dev server yet.
95
-
2. The exports for the component and its Props type will be added automatically to `packages/[package]/src/index.js`.
96
-
5. When adding a child component to another component, modify the child's `componentId` to be prefixed with the parent, e.g.: `MyComponent.Item`.
97
-
6.[Register the components Theme type](/#contributing/#code-guidelines-registering-the-components-theme-type). For the initial setup, define the mock variables used in the `theme.js`.
98
-
7. Run `npm install` to update the lockfile.
99
-
8. Run `npm run bootstrap` to generate the `es`, `lib` and `types` directories for your component.
100
-
9. Add your component to `packages/__docs__/components.js`.
101
-
10. Stop the dev server (if you have it running), and run `npm run dev` to pick up the new component.
102
-
11. Visit [http://localhost:9090](http://localhost:9090) in a browser. You should see your component listed in the docs.
103
-
12. Start making changes to your component, and watch it update in the browser automatically.
104
-
13. Resolve all `FIXME` comments in the generated code (except in the `MyComponentLocator.ts`).
105
-
14. Add a short description of the new component to the `packages/__docs__/buildScripts/ai-accessible-documentation/summaries-for-llms-file.json` file. This will optimize the component's documentation for consumption by AI agents.
106
-
107
-
### Adding a new dependency
108
-
109
-
1. Add the new dependency or devDependency in the package's `package.json`.
110
-
2. If the dependency is one of our own `@instructure/` packages, add it to the type references in the package's `tsconfig.build.json` too.
66
+
Run `git commit` to commit your changes and follow our commit message format.
Update the fields in the file `./packages/__docs__/versions.json` with the latest version and the maintenance branch map. Remove old unsupported versions if they are no longer needed and you don't want them to appear in the docs page version selector.
170
174
171
-
##### 3. Update version references in the docs app
175
+
##### 4. Update version references in the docs app
172
176
173
177
1. In `docs/getting-started/usage.md` update the version in the code snippet for `package.json`
174
-
2. In `packages/__docs__/src/Hero/index.tsx` update the url and title of the Upgrade Guide button
175
-
3. In `packages/__docs__/src/Hero/index.tsx` update the url and title of the Upgrade Guide link in the "What's new?" section
176
-
4. In `packages/__docs__/src/CodeSandboxButton/index.tsx` update the `@instructure/` dependencies to the latest version
178
+
2. In `packages/__docs__/src/Hero/index.tsx` update title of the Upgrade Guide button
179
+
3. In `packages/__docs__/src/CodeSandboxButton/index.tsx` update the `@instructure/` dependencies to the latest version
177
180
178
-
##### 4. Do a release like it was a minor update
181
+
##### 5. Do a release like it was a minor update
179
182
180
183
Follow the same process as it's described above. The `npm run bump` command should automatically recognise that there were a breaking commit and it should be a major version change.
0 commit comments