Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rename Theme to GlobalTheme #1702

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
66 changes: 33 additions & 33 deletions COMPONENT_INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
- [`FormGroup`](#formgroup)
- [`FormItem`](#formitem)
- [`FormLabel`](#formlabel)
- [`GlobalTheme`](#globaltheme)
- [`Grid`](#grid)
- [`Header`](#header)
- [`HeaderAction`](#headeraction)
Expand Down Expand Up @@ -148,7 +149,6 @@
- [`TextAreaSkeleton`](#textareaskeleton)
- [`TextInput`](#textinput)
- [`TextInputSkeleton`](#textinputskeleton)
- [`Theme`](#theme)
- [`Tile`](#tile)
- [`TileGroup`](#tilegroup)
- [`TimePicker`](#timepicker)
Expand Down Expand Up @@ -1538,6 +1538,38 @@ None.
| mouseenter | forwarded | -- |
| mouseleave | forwarded | -- |

## `GlobalTheme`

### Types

```ts
export type CarbonTheme = "white" | "g10" | "g80" | "g90" | "g100";
```

### Props

| Prop name | Required | Kind | Reactive | Type | Default value | Description |
| :--------- | :------- | :--------------- | :------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| theme | No | <code>let</code> | Yes | <code>CarbonTheme</code> | <code>"white"</code> | Set the current Carbon theme |
| tokens | No | <code>let</code> | No | <code>{ [token: string]: any; }</code> | <code>{}</code> | Customize a theme with your own tokens<br />@see https://carbondesignsystem.com/guidelines/themes/overview#customizing-a-theme |
| persist | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to persist the theme using window.localStorage |
| persistKey | No | <code>let</code> | No | <code>string</code> | <code>"theme"</code> | Specify the local storage key |
| render | No | <code>let</code> | No | <code>"toggle" &#124; "select"</code> | <code>undefined</code> | Render a toggle or select dropdown to control the theme |
| toggle | No | <code>let</code> | No | <code>import("../Toggle/Toggle").ToggleProps & { themes?: [labelA: CarbonTheme, labelB: CarbonTheme]; }</code> | <code>{ themes: ["white", "g100"], labelA: "", labelB: "", labelText: "Dark mode", hideLabel: false, }</code> | Override the default toggle props |
| select | No | <code>let</code> | No | <code>import("../Select/Select").SelectProps & { themes?: CarbonTheme[]; }</code> | <code>{ themes: themeKeys, labelText: "Themes", hideLabel: false, }</code> | Override the default select props |

### Slots

| Slot name | Default | Props | Fallback |
| :-------- | :------ | :------------------------------------ | :------- |
| -- | Yes | <code>{ theme: CarbonTheme; } </code> | -- |

### Events

| Event name | Type | Detail |
| :--------- | :--------- | :----------------------------------- |
| update | dispatched | <code>{ theme: CarbonTheme; }</code> |

## `Grid`

### Props
Expand Down Expand Up @@ -4159,38 +4191,6 @@ None.
| mouseenter | forwarded | -- |
| mouseleave | forwarded | -- |

## `Theme`

### Types

```ts
export type CarbonTheme = "white" | "g10" | "g80" | "g90" | "g100";
```

### Props

| Prop name | Required | Kind | Reactive | Type | Default value | Description |
| :--------- | :------- | :--------------- | :------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| theme | No | <code>let</code> | Yes | <code>CarbonTheme</code> | <code>"white"</code> | Set the current Carbon theme |
| tokens | No | <code>let</code> | No | <code>{ [token: string]: any; }</code> | <code>{}</code> | Customize a theme with your own tokens<br />@see https://carbondesignsystem.com/guidelines/themes/overview#customizing-a-theme |
| persist | No | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to persist the theme using window.localStorage |
| persistKey | No | <code>let</code> | No | <code>string</code> | <code>"theme"</code> | Specify the local storage key |
| render | No | <code>let</code> | No | <code>"toggle" &#124; "select"</code> | <code>undefined</code> | Render a toggle or select dropdown to control the theme |
| toggle | No | <code>let</code> | No | <code>import("../Toggle/Toggle").ToggleProps & { themes?: [labelA: CarbonTheme, labelB: CarbonTheme]; }</code> | <code>{ themes: ["white", "g100"], labelA: "", labelB: "", labelText: "Dark mode", hideLabel: false, }</code> | Override the default toggle props |
| select | No | <code>let</code> | No | <code>import("../Select/Select").SelectProps & { themes?: CarbonTheme[]; }</code> | <code>{ themes: themeKeys, labelText: "Themes", hideLabel: false, }</code> | Override the default select props |

### Slots

| Slot name | Default | Props | Fallback |
| :-------- | :------ | :------------------------------------ | :------- |
| -- | Yes | <code>{ theme: CarbonTheme; } </code> | -- |

### Events

| Event name | Type | Detail |
| :--------- | :--------- | :----------------------------------- |
| update | dispatched | <code>{ theme: CarbonTheme; }</code> |

## `Tile`

### Props
Expand Down
222 changes: 111 additions & 111 deletions docs/src/COMPONENT_API.json
Original file line number Diff line number Diff line change
Expand Up @@ -4579,6 +4579,117 @@
"typedefs": [],
"rest_props": { "type": "Element", "name": "label" }
},
{
"moduleName": "GlobalTheme",
"filePath": "src/GlobalTheme/GlobalTheme.svelte",
"props": [
{
"name": "theme",
"kind": "let",
"description": "Set the current Carbon theme",
"type": "CarbonTheme",
"value": "\"white\"",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
"constant": false,
"reactive": true
},
{
"name": "tokens",
"kind": "let",
"description": "Customize a theme with your own tokens\n@see https://carbondesignsystem.com/guidelines/themes/overview#customizing-a-theme",
"type": "{ [token: string]: any; }",
"value": "{}",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
"constant": false,
"reactive": false
},
{
"name": "persist",
"kind": "let",
"description": "Set to `true` to persist the theme using window.localStorage",
"type": "boolean",
"value": "false",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
"constant": false,
"reactive": false
},
{
"name": "persistKey",
"kind": "let",
"description": "Specify the local storage key",
"type": "string",
"value": "\"theme\"",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
"constant": false,
"reactive": false
},
{
"name": "render",
"kind": "let",
"description": "Render a toggle or select dropdown to control the theme",
"type": "\"toggle\" | \"select\"",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
"constant": false,
"reactive": false
},
{
"name": "toggle",
"kind": "let",
"description": "Override the default toggle props",
"type": "import(\"../Toggle/Toggle\").ToggleProps & { themes?: [labelA: CarbonTheme, labelB: CarbonTheme]; }",
"value": "{ themes: [\"white\", \"g100\"], labelA: \"\", labelB: \"\", labelText: \"Dark mode\", hideLabel: false, }",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
"constant": false,
"reactive": false
},
{
"name": "select",
"kind": "let",
"description": "Override the default select props",
"type": "import(\"../Select/Select\").SelectProps & { themes?: CarbonTheme[]; }",
"value": "{ themes: themeKeys, labelText: \"Themes\", hideLabel: false, }",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
"constant": false,
"reactive": false
}
],
"moduleExports": [],
"slots": [
{
"name": "__default__",
"default": true,
"slot_props": "{ theme: CarbonTheme; }"
}
],
"events": [
{
"type": "dispatched",
"name": "update",
"detail": "{ theme: CarbonTheme; }"
}
],
"typedefs": [
{
"type": "\"white\" | \"g10\" | \"g80\" | \"g90\" | \"g100\"",
"name": "CarbonTheme",
"ts": "type CarbonTheme = \"white\" | \"g10\" | \"g80\" | \"g90\" | \"g100\""
}
]
},
{
"moduleName": "Grid",
"filePath": "src/Grid/Grid.svelte",
Expand Down Expand Up @@ -12837,117 +12948,6 @@
"typedefs": [],
"rest_props": { "type": "Element", "name": "div" }
},
{
"moduleName": "Theme",
"filePath": "src/Theme/Theme.svelte",
"props": [
{
"name": "theme",
"kind": "let",
"description": "Set the current Carbon theme",
"type": "CarbonTheme",
"value": "\"white\"",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
"constant": false,
"reactive": true
},
{
"name": "tokens",
"kind": "let",
"description": "Customize a theme with your own tokens\n@see https://carbondesignsystem.com/guidelines/themes/overview#customizing-a-theme",
"type": "{ [token: string]: any; }",
"value": "{}",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
"constant": false,
"reactive": false
},
{
"name": "persist",
"kind": "let",
"description": "Set to `true` to persist the theme using window.localStorage",
"type": "boolean",
"value": "false",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
"constant": false,
"reactive": false
},
{
"name": "persistKey",
"kind": "let",
"description": "Specify the local storage key",
"type": "string",
"value": "\"theme\"",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
"constant": false,
"reactive": false
},
{
"name": "render",
"kind": "let",
"description": "Render a toggle or select dropdown to control the theme",
"type": "\"toggle\" | \"select\"",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
"constant": false,
"reactive": false
},
{
"name": "toggle",
"kind": "let",
"description": "Override the default toggle props",
"type": "import(\"../Toggle/Toggle\").ToggleProps & { themes?: [labelA: CarbonTheme, labelB: CarbonTheme]; }",
"value": "{ themes: [\"white\", \"g100\"], labelA: \"\", labelB: \"\", labelText: \"Dark mode\", hideLabel: false, }",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
"constant": false,
"reactive": false
},
{
"name": "select",
"kind": "let",
"description": "Override the default select props",
"type": "import(\"../Select/Select\").SelectProps & { themes?: CarbonTheme[]; }",
"value": "{ themes: themeKeys, labelText: \"Themes\", hideLabel: false, }",
"isFunction": false,
"isFunctionDeclaration": false,
"isRequired": false,
"constant": false,
"reactive": false
}
],
"moduleExports": [],
"slots": [
{
"name": "__default__",
"default": true,
"slot_props": "{ theme: CarbonTheme; }"
}
],
"events": [
{
"type": "dispatched",
"name": "update",
"detail": "{ theme: CarbonTheme; }"
}
],
"typedefs": [
{
"type": "\"white\" | \"g10\" | \"g80\" | \"g90\" | \"g100\"",
"name": "CarbonTheme",
"ts": "type CarbonTheme = \"white\" | \"g10\" | \"g80\" | \"g90\" | \"g100\""
}
]
},
{
"moduleName": "Tile",
"filePath": "src/Tile/Tile.svelte",
Expand Down
6 changes: 3 additions & 3 deletions docs/src/pages/_layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
SideNav,
SideNavItems,
SideNavMenuItem,
Theme,
GlobalTheme,
Tag,
} from "carbon-components-svelte";
import LogoGithub from "carbon-icons-svelte/lib/LogoGithub.svelte";
Expand All @@ -39,7 +39,7 @@
<!-- routify:options bundle=true -->
<svelte:window bind:innerWidth />

<Theme persist bind:theme="{$theme}">
<GlobalTheme persist bind:theme="{$theme}">
<Header
aria-label="Navigation"
href="{$url('/')}"
Expand Down Expand Up @@ -129,7 +129,7 @@
</SideNavItems>
</SideNav>
<slot />
</Theme>
</GlobalTheme>

<style>
.platform-name {
Expand Down
Loading