Skip to content

Commit dfad812

Browse files
committed
docs: fix based on reviews
1 parent ba6ede5 commit dfad812

20 files changed

Lines changed: 266 additions & 212 deletions

File tree

docs/contributing/agentic-coding.md renamed to docs/contributing/building-and-running-instui.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Agentic coding
2+
title: Building and running InstUI
33
category: Contributing
44
order: 2
55
---

docs/contributing/contributing-getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ constructed from the existing ones. For these reasons adding a new component has
2323

2424
### Building InstUI from the source
2525

26-
Please follow the steps on the [how to build guide page](agentic-coding).
26+
Please follow the steps on the [how to build guide page](building-and-running-instui).
2727

2828
### Running the documentation app
2929

docs/contributing/multi-version-system.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,5 +312,3 @@ When you add a breaking change to a component, you manually add the new `./v11_8
312312
3. **Implement** breaking changes in the new version (keep `/latest` imports)
313313
4. **Create** a new lettered export file that exports all components at their latest versions
314314
5. **Update** `package.json` exports: add the new `./vX_Y` entry and point `./latest` to the new letter
315-
316-
For information on how documentation is versioned alongside components, see the [Docs Versioning](/docs-versioning) guide.

docs/contributing/versioning/docs-versioning.md

Lines changed: 0 additions & 61 deletions
This file was deleted.

docs/guides/guides-getting-started.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ The following steps will create a React app that uses Instructure UI. Recommende
1515
---
1616
type: code
1717
---
18-
1918
npm create vite@latest my-cool-app
2019
```
2120

@@ -63,7 +62,7 @@ export default App
6362

6463
What does this code do?
6564

66-
- [InstUISettingsProvider](InstUISettingsProvider) allows to specify the text direction (default is the direction that the user's browser supplies) and the theme to your application. InstUI components require a theme to work, all components are themeable, and themes control their look and feel. There are 2 built-in themes: [`canvas`](canvas) and [`canvasHighContrast`](canvas-high-contrast). The component examples seen throughout the documentation use the [canvas theme](canvas) by default.
65+
- [InstUISettingsProvider](InstUISettingsProvider) allows to specify the text direction (default is the direction that the user's browser supplies) and the theme to your application. InstUI components require a theme to work, all components are themeable, and themes control their look and feel. Starting from v11.7 there are 4 built-in themes: [`canvas`](canvas), [`canvas-high-contrast`](canvas-high-contrast), [`light`](light) and [`dark`](dark). For v11.6 components the legacy themes [`legacy-canvas`](legacy-canvas) and [`legacy-canvas-high-contrast`](legacy-canvas-high-contrast) are available. The component examples seen throughout the documentation use the [canvas theme](canvas) by default.
6766
- [Button](Button) is an Instructure UI button component
6867

6968
Finally, run `pnpm run dev` to start up a basic development server.

docs/guides/using-icons.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ 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
8+
```js
9+
---
10+
type: embed
11+
---
12+
<Alert variant="info" margin="0 0 medium">
13+
These icons are only meant to be used with the new theming system, please do not use them with the old (pre v11.7)
14+
</Alert>
15+
```
916

1017
## Using Icons
1118

docs/theming/new-theme-overrides.md

Lines changed: 6 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -527,9 +527,9 @@ type: example
527527
</InstUISettingsProvider>
528528
```
529529

530-
### 13. Targeted override for a parent component
530+
### 13. Provider-level overrides cannot target a child component selectively
531531

532-
You can use the parent component's name (e.g. `Button`) in `themeOverride.components` to override its internal child component's tokens. When both `BaseButton` and `Button` overrides are present, the `Button` override should take precedence for `Button` instances, while `BaseButton` stays unaffected.
532+
Because `Button` uses `BaseButton`'s theme internally, a `components.Button` entry in the provider's `themeOverride` does **not** override `BaseButton`'s tokens for `Button` instances only. Both `BaseButton` and `Button` share the same `BaseButton` theme variables, so a `components.BaseButton` override affects both, regardless of whether a separate `components.Button` entry is also present.
533533

534534
```js
535535
---
@@ -551,15 +551,17 @@ type: example
551551
}}
552552
>
553553
<BaseButton color="primary" margin="small">
554-
BaseButton - still purple (BaseButton override)
554+
BaseButton - purple (BaseButton override)
555555
</BaseButton>
556556
<Button color="primary" margin="small">
557-
Button - deeppink (Button override wins)
557+
Button - also purple (Button uses BaseButton's theme; deeppink has no effect)
558558
</Button>
559559
</InstUISettingsProvider>
560560
</InstUISettingsProvider>
561561
```
562562
563+
To override a specific `Button` instance without affecting others, use the per-component `themeOverride` prop instead (see section 14).
564+
563565
### 14. Per-component `themeOverride` prop overriding provider-level child overrides
564566
565567
When a provider sets `components.BaseButton` overrides, a specific `Button` instance can override those via its own `themeOverride` prop. The per-component prop has the highest priority.
@@ -599,54 +601,6 @@ type: example
599601
</InstUISettingsProvider>
600602
```
601603
602-
### 15. Overrides on functional (`useStyleNew`) components
603-
604-
All override patterns work identically on functional components that use the `useStyleNew` hook. Here, Avatar tokens are overridden the same way as class-based components using `withStyleNew`.
605-
606-
```js
607-
---
608-
type: example
609-
---
610-
<InstUISettingsProvider theme={light}>
611-
<Avatar name="Default" color="accent1" margin="0 small 0 0" />
612-
613-
<InstUISettingsProvider
614-
themeOverride={{
615-
components: {
616-
Avatar: {
617-
backgroundColor: 'navy',
618-
blueTextColor: 'lime'
619-
}
620-
}
621-
}}
622-
>
623-
<Avatar name="Overridden" color="accent1" margin="0 small 0 0" />
624-
<Avatar name="Unaffected" color="accent2" />
625-
</InstUISettingsProvider>
626-
</InstUISettingsProvider>
627-
```
628-
629-
### 16. Function form `themeOverride` on functional components
630-
631-
The function form also works on `useStyleNew` components. The function receives the component's calculated theme as the first argument, letting you derive overrides from existing token values.
632-
633-
```js
634-
---
635-
type: example
636-
---
637-
<InstUISettingsProvider theme={light}>
638-
<Avatar name="Default Blue" color="accent1" margin="0 small 0 0" />
639-
<Avatar
640-
name="Swapped to Green"
641-
color="accent1"
642-
themeOverride={(componentTheme) => ({
643-
backgroundColor: componentTheme.greenBackgroundColor,
644-
blueTextColor: componentTheme.greenTextColor
645-
})}
646-
/>
647-
</InstUISettingsProvider>
648-
```
649-
650604
### Override priority (highest to lowest)
651605
652606
1. **Per-component `themeOverride` prop** - affects a single instance

docs/upgrading/upgrade-guide-v11.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
title: Upgrade Guide for Version 11
2+
title: Upgrade guide for v10 -> v11
33
category: Upgrading
44
order: 1
55
---
66

7-
# Upgrade Guide for Version 11
7+
# Upgrade guide for v10 -> v11
88

99
## InstUI and React
1010

docs/upgrading/upgrade-guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: Upgrade Guide for multi version
2+
title: Upgrade guide for v11.7
33
category: Upgrading
4-
order: 9999999
4+
order: 2
55
---
66

77
# Upgrade Guide for multi version support
@@ -52,7 +52,7 @@ type: example
5252
>
5353
<TextInput
5454
renderLabel="Name"
55-
placeholder="Note: Change example when the old theme is renamed!"
55+
placeholder="Focus me!"
5656
/>
5757
</InstUISettingsProvider>
5858
```

packages/__docs__/buildScripts/DataTypes.mts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424

2525
// This is the format of the saved JSON files
2626
import type { Documentation } from 'react-docgen'
27+
import type { BaseTheme } from '@instructure/shared-types'
28+
import type {
29+
NewBaseTheme,
30+
LightTheme,
31+
DarkTheme,
32+
SharedTokens
33+
} from '@instructure/ui-themes'
2734

2835
type ProcessedFile =
2936
Documentation &
@@ -137,8 +144,21 @@ type Glyph = {
137144

138145
type LegacyIconsData = Glyph[]
139146

147+
type ResolvedColors = {
148+
primitives: Record<string, string>
149+
semantic: Record<string, string>
150+
}
151+
152+
type ThemeResource =
153+
| (BaseTheme & { resolvedComponents: Record<string, any> }) // legacy-canvas, legacy-canvas-high-contrast
154+
| (NewBaseTheme & { resolvedColors: ResolvedColors }) // canvas, canvas-high-contrast
155+
| (LightTheme & { resolvedColors: ResolvedColors })
156+
| (DarkTheme & { resolvedColors: ResolvedColors })
157+
| SharedTokens
158+
140159
type MainDocsData = {
141-
// resource is `any` to support both old BaseTheme and new token objects
160+
// `any` instead of ThemeResource: the union breaks property access (.key, .description)
161+
// and typed function calls in consumers — would need type guards throughout to fix properly
142162
themes: Record<string, { resource: any }>
143163
library: LibraryOptions
144164
} & ParsedDoc
@@ -172,6 +192,8 @@ export type {
172192
JsDocResult,
173193
MinorVersionData,
174194
Section,
195+
ThemeResource,
196+
ResolvedColors,
175197
VersionMapEntry,
176198
VersionMap
177199
}

0 commit comments

Comments
 (0)