Skip to content

Commit d55db5e

Browse files
committed
docs(ui-themes): fix misleading docs
1 parent a672afc commit d55db5e

14 files changed

Lines changed: 176 additions & 168 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,14 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
77

88
### Bug Fixes
99

10-
- **docs:** fix SPA routing for PR preview and /latest/ deployments ([64badec](https://github.com/instructure/instructure-ui/commit/64badec7235c311a3cba32daad94aae69b5acaf1))
11-
- **docs:** fix SPA routing for PR preview deployments on GitHub Pages ([1f8a93e](https://github.com/instructure/instructure-ui/commit/1f8a93e7a4713eaa405370aaf78271be86664bf9))
12-
- **docs:** include components at different version stages in versioned docs ([df36851](https://github.com/instructure/instructure-ui/commit/df3685195a7981f256a5f9218acc724156bd1faa))
13-
- **docs:** skip /latest/ prefix in App getPathInfo URL parsing ([83f9117](https://github.com/instructure/instructure-ui/commit/83f91178cd871766622b17fa5965828798da9445))
14-
- **emotion:** fix old them override not working properly ([02bf2b7](https://github.com/instructure/instructure-ui/commit/02bf2b7f6b43a7d731908ec0f35757dc8c79737b))
1510
- **many:** a11y requirement fix, interactive links must be underlined on interaction and isWithinText prop was removed ([8531756](https://github.com/instructure/instructure-ui/commit/8531756c564a3220a8266d02a72fb26c3bbcc977))
1611
- **ui-checkbox:** prevent blur on checkbox label mousedown by manually restoring focus to hidden input ([843ca3e](https://github.com/instructure/instructure-ui/commit/843ca3e0d0db1197b343a17cd2740a4a8446d318))
17-
- **ui-many:** fix imports of the multiversion support ([ff5f2b3](https://github.com/instructure/instructure-ui/commit/ff5f2b38660ddae432edd32b98eedae586589977))
18-
- **ui-pagination:** fix Pagination.PageInput theme variables not visible in the docs app ([30ca564](https://github.com/instructure/instructure-ui/commit/30ca564c8a8df14c67f30bd106c2c8705f7ef3c0))
19-
- **ui-scripts,ui-list:** fix new theme build issues ([d0cd58d](https://github.com/instructure/instructure-ui/commit/d0cd58d8eb610748673570f611778157922c9fee))
20-
- **ui-scripts:** fix number token type issue ([060d59a](https://github.com/instructure/instructure-ui/commit/060d59a34a663c68d2e03748e743a03cd22c17ba))
21-
- **ui-scripts:** fix token conflict ([273ef99](https://github.com/instructure/instructure-ui/commit/273ef99abdf49f298a5e71b2b5c80fcfc0f6a139))
22-
- **ui-scripts:** fix token conflict ([72aba24](https://github.com/instructure/instructure-ui/commit/72aba2498276004585ba0a1a54d78cbd8f52c028))
23-
- **ui-scripts:** fix token conflicts ([4e2bf7a](https://github.com/instructure/instructure-ui/commit/4e2bf7ab658ee084c116e6924c3bb5f17fd76525))
24-
- **ui-svg-images:** fix inlinesvg parser ([9fc9675](https://github.com/instructure/instructure-ui/commit/9fc967538df47b26609ea3ab171b7253d736f89f))
2512
- **ui-text-input,emotion:** fix TextInput displaying double focus rings when a focusable element is rendered inside ([b33cea2](https://github.com/instructure/instructure-ui/commit/b33cea283ef84cdc674c43bf8a0b7ca55f04cfaa))
2613
- **ui-view:** clipping ContextView child content overflow ([94a76e8](https://github.com/instructure/instructure-ui/commit/94a76e884ee2ee09071d793daff9696049c06fe4))
2714

28-
### Code Refactoring
29-
30-
- **ui-text:** migrate to new theming system ([19c7c44](https://github.com/instructure/instructure-ui/commit/19c7c4413a5632b6b10380f888824384724b6be3))
31-
3215
### Features
3316

17+
- **ui-text:** migrate to new theming system ([19c7c44](https://github.com/instructure/instructure-ui/commit/19c7c4413a5632b6b10380f888824384724b6be3))
3418
- **many:** add new theming solution ([1cef88e](https://github.com/instructure/instructure-ui/commit/1cef88e97f40dd85e15b10bc4307d013ae8b09d0))
3519
- **many:** add solution for using both old and new token system in the same app ([688a713](https://github.com/instructure/instructure-ui/commit/688a713ff715433bb085323dbad61285387c5141))
3620
- **many:** refactor theme parser and implement tray and tabs ([ef28373](https://github.com/instructure/instructure-ui/commit/ef283736fd76fbdcc674854916b298c199f8df50))

docs/guides/upgrade-guide-v11.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
title: Upgrade Guide for Version 11
3+
category: Guides
4+
order: 1
5+
---
6+
7+
# Upgrade Guide for Version 11
8+
9+
## InstUI and React
10+
11+
> React 16 and 17 support was dropped with InstUI 11. Please upgrade to React 18 before upgrading to InstUI v11!
12+
13+
### React 19
14+
15+
InstUI v11 added support for React 19. But upgrading to React 19 might cause issues because InstUI needs to access the native DOM in some cases and React introduced a breaking change here by [removing `ReactDOM.findDOMNode()`](https://react.dev/blog/2024/04/25/react-19-upgrade-guide#removed-reactdom-finddomnode). If you are upgrading to React 19, you will need to add `ref`s to some of your custom components that use InstUI utilities, see [this guide](accessing-the-dom). We suggest to check your code thoroughly for errors, especially places where you use your own components as some kind of popovers or its triggers (e.g. Menu, Popover, Tooltip, Drilldown,..).
16+
17+
If you are using React 18 you might just see error messages like (`Error: ${elName} doesn't have "ref" property.`), but your code should work the same as with InstUI v10.
18+
19+
---
20+
21+
## PropTypes Support Dropped
22+
23+
With React 19, support for **PropTypes was dropped** from the core library. While it's still possible to use them with third-party libraries, InstUI has decided to no longer support them based on user feedback.
24+
25+
**Tip:** To see how the removal of `propTypes` might affect your application's business logic, you can use a Babel plugin like [babel-plugin-transform-react-remove-prop-types](https://github.com/oliviertassinari/babel-plugin-transform-react-remove-prop-types) to strip them out during your build process for testing.
26+
27+
---
28+
29+
## Changes to Testability
30+
31+
The **`@testable` decorator has been removed**. The `data-cid` props, which were previously added by this decorator in development builds, are now **always added to components**. This change was made in response to frequent requests for a consistent way to identify InstUI components for end-to-end (e2e) tests.
32+
33+
As a result of this change, the **`ALWAYS_APPEND_UI_TESTABLE_LOCATORS`** Node.js environment variable is no longer used.
34+
35+
---
36+
37+
## Removal of deprecated props/components/APIs
38+
39+
### InstUISettingsProvider
40+
41+
[InstUISettingsProvider](InstUISettingsProvider)'s `as` prop was removed, it will always render as a `<span>` (note: it will only render anything to the DOM if you provide a value to the `dir` prop.). The provided codemod will remove this prop automatically (see below).
42+
43+
### Theming engine changes
44+
45+
| Removed | What to use instead? |
46+
| :------------------------------------------------- | :---------------------------------------------------------------------------------------------------- |
47+
| `canvas.use()`, `canvasHighContrast.use()` | Wrap all your application roots in `<InstUISettingsProvider>` |
48+
| `canvasThemeLocal`, `canvasHighContrastThemeLocal` | Use `canvas` and `canvasHighContrast` respectively, they are the same objects. |
49+
| `variables` field on theme objects | Use `canvas.borders` instead of `canvas.variables.borders` (same for all other fields) |
50+
| `@instructure/theme-registry` package | This added the removed functions above. Wrap all your application roots in `<InstUISettingsProvider>` |
51+
52+
### CodeEditor
53+
54+
The **`<CodeEditor>` component** from the `ui-code-editor` package has been **removed** due to significant accessibility issues. Please use the [SourceCodeEditor](SourceCodeEditor) component as a replacement.
55+
56+
### Removal of the `deprecated`, `experimental`, `hack` decorators
57+
58+
We have removed these utilities from the `ui-react-utils` package because we are phasing out parts from the codebase that use decorators.
59+
60+
If you want to still use these we suggest to copy-paste their code from the latest v10 codebase (Note: they only work for class-based components!).
61+
62+
---
63+
64+
### Table
65+
66+
[Table](Table) is now using [TableContext](TableContext) to pass down data to its child components, the following props are no longer passed down to their children (This should only affect you if you have custom table rows or cells):
67+
68+
| Component | Prop removed | Substitute |
69+
| :-------- | :----------- | :------------------------------ |
70+
| `Row` | `isStacked` | is now stored in `TableContext` |
71+
| `Body` | `isStacked` | is now stored in `TableContext` |
72+
| `Body` | `hover` | is now stored in `TableContext` |
73+
| `Body` | `headers` | is now stored in `TableContext` |
74+
75+
[Table](Table)'s `caption` prop is now required.
76+
77+
---
78+
79+
## API Changes
80+
81+
`ui-dom-utils`/`getComputedStyle` can now return `undefined`: In previous versions it sometimes returned an empty object which could lead to runtime exceptions when one tried to call methods of `CSSStyleDeclaration` on it.
82+
83+
---
84+
85+
## Codemods
86+
87+
To ease the upgrade, we provide codemods that will automate most of the changes. Pay close attention to its output, it cannot refactor complex code! The codemod scripts can be run via the following commands:
88+
89+
```sh
90+
---
91+
type: code
92+
---
93+
npm install @instructure/ui-codemods@11
94+
npx jscodeshift@17.3.0 -t node_modules/@instructure/ui-codemods/lib/instUIv11Codemods.ts <path> --usePrettier=false
95+
```
96+
97+
This is a collection of the codemods that will do the following:
98+
99+
- Removes the `as` prop from `InstUISettingsProvider`.
100+
- Renames `canvasThemeLocal` to `canvas` and `canvasHighContrastThemeLocal` to `canvasHighContrastTheme`, warns about deleted `ThemeRegistry` imports and the removed `canvas.use()`/`canvasHighContrast.use()` functions.
101+
- Prints a warning if the `caption` prop is missing from a `<Table />`
102+
- Warns if `CodeEditor` is used
103+
104+
Options for the codemod:
105+
106+
- `filename`: if specified then emitted warnings are written to this file.
107+
- `usePrettier`: if `true` the transformed code will be run through Prettier. You can customize this through a [Prettier
108+
config file](https://prettier.io/docs/configuration.html)

docs/guides/upgrade-guide.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
title: Upgrade Guide for Version 12
2+
title: Upgrade Guide for multi version (beta)
33
category: Guides
4-
order: 1
4+
order: 9999999
55
---
66

7-
# Upgrade Guide for Version 12
7+
# Upgrade Guide for multi version support
88

99
## New theming system
1010

11-
TODO add details
11+
NOTE: this section is under development, will be updated soon
1212

1313
## New icons
1414

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
---
2-
title: Using Icons
3-
category: Patterns
2+
title: Using Icons (beta)
3+
category: Guides
44
id: UsingIcons
55
relevantForAI: true
66
---
77

8+
Note: These icons are only meant to be used with the new theming system (beta), please don't use them with the old (pre v11.7) components
9+
810
## Using Icons
911

1012
Icons from `@instructure/ui-icons` are available as `<Name>InstUIIcon` components — browse them

docs/guides/using-theme-overrides.md

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -348,68 +348,6 @@ const generateStyle = (componentTheme) => {
348348
}
349349
```
350350
351-
### Theme overrides for focus rings, border radii, shadows, spacing
352-
353-
Certain visuals as of now styled via a central object called `SharedTokens`. You can override this too, for example:
354-
355-
```js
356-
---
357-
type: example
358-
---
359-
<InstUISettingsProvider
360-
theme={{
361-
newTheme: { // TODO remove this when we remove the old theme
362-
sharedTokens: {
363-
focusOutline: {
364-
infoColor: 'green',
365-
width: '0.4rem',
366-
offset: '0rem'
367-
},
368-
boxShadow: {
369-
// View shadows:
370-
// resting: elevation1,
371-
// above: elevation2,
372-
// topmost: elevation4
373-
elevation1: {
374-
"0": {
375-
color: 'blue',
376-
blur: '1rem',
377-
spread: '0.2rem'
378-
}
379-
}
380-
},
381-
spacing: {
382-
general: {
383-
space2xs: '2rem' // component margin/padding/Flex gap spacing
384-
}
385-
},
386-
legacy: {
387-
radiusSmall: '2rem', // View border radius
388-
},
389-
strokeWidth: {
390-
sm: '1rem' // View border width
391-
}
392-
},
393-
}
394-
}}>
395-
<TextInput renderLabel="Fancy focus ring!" placeholder="TODO: Change example when the old theme is renamed!"/>
396-
<View
397-
as="span"
398-
display="inline-block"
399-
maxWidth="15rem"
400-
margin="general.space2xs"
401-
padding="small"
402-
background="primary"
403-
shadow="resting"
404-
borderRadius="small"
405-
borderWidth="small"
406-
>
407-
Here is a View with a blue shadow. and custom borders
408-
</View>
409-
<Avatar name="Spacing Override" margin="general.space2xs" />
410-
</InstUISettingsProvider>
411-
```
412-
413351
### Branding (user customizable theming)
414352
415353
The `canvas` theme has specific theme variables that are meant as a basis to provide end users a customizability of this theme, e.g. a university can use their own colors throughout the UI. This is used by [Canvas's theme editor](https://community.canvaslms.com/t5/Admin-Guide/How-do-I-create-a-theme-for-an-account-using-the-Theme-Editor/ta-p/242).

packages/__docs__/CHANGELOG.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,11 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
55

66
# [11.7.0](https://github.com/instructure/instructure-ui/compare/v11.6.0...v11.7.0) (2026-03-18)
77

8-
### Bug Fixes
9-
10-
- **docs:** fix SPA routing for PR preview and /latest/ deployments ([64badec](https://github.com/instructure/instructure-ui/commit/64badec7235c311a3cba32daad94aae69b5acaf1))
11-
- **docs:** fix SPA routing for PR preview deployments on GitHub Pages ([1f8a93e](https://github.com/instructure/instructure-ui/commit/1f8a93e7a4713eaa405370aaf78271be86664bf9))
12-
- **docs:** include components at different version stages in versioned docs ([df36851](https://github.com/instructure/instructure-ui/commit/df3685195a7981f256a5f9218acc724156bd1faa))
13-
- **docs:** skip /latest/ prefix in App getPathInfo URL parsing ([83f9117](https://github.com/instructure/instructure-ui/commit/83f91178cd871766622b17fa5965828798da9445))
14-
- **many:** a11y requirement fix, interactive links must be underlined on interaction and isWithinText prop was removed ([8531756](https://github.com/instructure/instructure-ui/commit/8531756c564a3220a8266d02a72fb26c3bbcc977))
15-
168
### Code Refactoring
179

18-
- **ui-text:** migrate to new theming system ([19c7c44](https://github.com/instructure/instructure-ui/commit/19c7c4413a5632b6b10380f888824384724b6be3))
19-
2010
### Features
2111

12+
- **ui-text:** migrate to new theming system ([19c7c44](https://github.com/instructure/instructure-ui/commit/19c7c4413a5632b6b10380f888824384724b6be3))
2213
- **many:** add new theming solution ([1cef88e](https://github.com/instructure/instructure-ui/commit/1cef88e97f40dd85e15b10bc4307d013ae8b09d0))
2314
- **many:** add solution for using both old and new token system in the same app ([688a713](https://github.com/instructure/instructure-ui/commit/688a713ff715433bb085323dbad61285387c5141))
2415
- **many:** rework TextArea and dependent FormField components ([0f8c438](https://github.com/instructure/instructure-ui/commit/0f8c43803e3458bbf7b2dd266a9e246cb89b0d3c))

packages/__docs__/src/App/index.tsx

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,7 @@ class App extends Component<AppProps, AppState> {
222222
docsData: null,
223223
currentDocData: undefined,
224224
changelogData: undefined,
225-
selectedMinorVersion: newVersion,
226-
showMinorVersionSelector: true
225+
selectedMinorVersion: newVersion
227226
})
228227

229228
// Update URL to reflect new version
@@ -319,9 +318,7 @@ class App extends Component<AppProps, AppState> {
319318
updateGlobalsForVersion(selectedMinorVersion)
320319
this.setState({
321320
minorVersionsData,
322-
selectedMinorVersion,
323-
// Only show version selector when URL has explicit version
324-
showMinorVersionSelector: !!urlMinorVersion
321+
selectedMinorVersion
325322
})
326323
return this.fetchMainDocsData(
327324
`${getAssetBasePath()}/docs/${selectedMinorVersion}/markdown-and-sources-data.json`,
@@ -449,14 +446,12 @@ class App extends Component<AppProps, AppState> {
449446

450447
updateKey = () => {
451448
const [page, _id] = this.getPathInfo()
452-
const { minorVersion } = parseCurrentUrl()
453449

454450
if (page) {
455451
this.setState(
456452
({ key, showMenu }) => ({
457453
key: page || 'index',
458-
showMenu: this.handleShowTrayOnURLChange(key, showMenu),
459-
showMinorVersionSelector: !!minorVersion
454+
showMenu: this.handleShowTrayOnURLChange(key, showMenu)
460455
}),
461456
this.scrollToElement
462457
)
@@ -570,9 +565,8 @@ class App extends Component<AppProps, AppState> {
570565

571566
renderThemeSelect() {
572567
const allThemeKeys = Object.keys(this.state.docsData!.themes)
573-
const showNewThemes =
574-
this.state.showMinorVersionSelector &&
575-
this.state.selectedMinorVersion !== 'v11_6'
568+
const showNewThemes = this.state.selectedMinorVersion !== 'v11_6'
569+
576570
const themeKeys = showNewThemes
577571
? allThemeKeys
578572
: ['canvas', 'canvas-high-contrast']
@@ -649,7 +643,7 @@ class App extends Component<AppProps, AppState> {
649643
}
650644
>
651645
<Heading level="h1" as="h2" margin="0 0 medium">
652-
Icons
646+
Icons (beta)
653647
</Heading>
654648
<IconsPage />
655649
</View>
@@ -973,11 +967,7 @@ class App extends Component<AppProps, AppState> {
973967
name={name === 'instructure-ui' ? 'v' : name}
974968
version={version}
975969
versionsData={versionsData}
976-
minorVersionsData={
977-
this.state.showMinorVersionSelector
978-
? this.state.minorVersionsData
979-
: undefined
980-
}
970+
minorVersionsData={this.state.minorVersionsData}
981971
selectedMinorVersion={this.state.selectedMinorVersion}
982972
onMinorVersionChange={this.handleMinorVersionChange}
983973
/>

packages/__docs__/src/Header/index.tsx

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,6 @@ class Header extends Component<HeaderProps> {
123123

124124
renderMinorVersionsBlock = () => {
125125
const { minorVersionsData, selectedMinorVersion } = this.props
126-
if (
127-
!minorVersionsData ||
128-
minorVersionsData.libraryVersions.length <= 1
129-
) {
130-
return null
131-
}
132126

133127
return (
134128
<View display="block" textAlign="center" margin="none none small">
@@ -151,18 +145,18 @@ class Header extends Component<HeaderProps> {
151145
selected={selectedMinorVersion ? [selectedMinorVersion] : []}
152146
onSelect={this.handleMinorVersionSelect}
153147
label={
154-
<ScreenReaderContent>
155-
Select minor version
156-
</ScreenReaderContent>
148+
<ScreenReaderContent>Select minor version</ScreenReaderContent>
157149
}
158150
>
159-
{[...minorVersionsData.libraryVersions].reverse().map((ver: string, index: number) => (
160-
<Menu.Item key={index} id={`minor-opt-${index}`} value={ver}>
161-
<View textAlign="center" as="div">
162-
{this.formatMinorVersion(ver)}
163-
</View>
164-
</Menu.Item>
165-
))}
151+
{[...minorVersionsData!.libraryVersions]
152+
.reverse()
153+
.map((ver: string, index: number) => (
154+
<Menu.Item key={index} id={`minor-opt-${index}`} value={ver}>
155+
<View textAlign="center" as="div">
156+
{this.formatMinorVersion(ver)}
157+
</View>
158+
</Menu.Item>
159+
))}
166160
</Menu.Group>
167161
</Menu>
168162
</View>

0 commit comments

Comments
 (0)