Alignment with Carbon version 10.29 (#529)

* chore: patch prettier-plugin-svelte

* docs(tag): add filterable small tag example

* feat(ui-shell): add SideNavDivider

* feat(combo-box): support warning state

* docs(combo-box): add invalid state example

* fix(progress-step): add title to warning icon

* docs(progress-indicator): add invalid step example

* docs(progress-indicator): add disabled steps example

* feat(truncate): add text truncation component and action

* docs(radio-tile): fix light variant example

* fix(side-effects): add pre-compiled CSS to library side effects

* refactor(css): use shorthand scss imports, add comments

* refactor(truncate): rename "direction" prop to "clamp"

* chore(deps-dev): bump carbon-components to v10.29.0

* feat(combo-box): add direction prop

* feat(dropdown): add direction prop

* feat(multi-select): add direction prop
This commit is contained in:
Eric Liu 2021-02-19 16:08:16 -08:00 committed by GitHub
commit 14e714fa61
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
48 changed files with 729 additions and 277 deletions

View file

@ -1,6 +1,6 @@
# Component Index # Component Index
> 156 components exported from carbon-components-svelte@0.28.0. > 158 components exported from carbon-components-svelte@0.28.0.
## Components ## Components
@ -107,6 +107,7 @@
- [`SelectSkeleton`](#selectskeleton) - [`SelectSkeleton`](#selectskeleton)
- [`SelectableTile`](#selectabletile) - [`SelectableTile`](#selectabletile)
- [`SideNav`](#sidenav) - [`SideNav`](#sidenav)
- [`SideNavDivider`](#sidenavdivider)
- [`SideNavItems`](#sidenavitems) - [`SideNavItems`](#sidenavitems)
- [`SideNavLink`](#sidenavlink) - [`SideNavLink`](#sidenavlink)
- [`SideNavMenu`](#sidenavmenu) - [`SideNavMenu`](#sidenavmenu)
@ -159,6 +160,7 @@
- [`Tooltip`](#tooltip) - [`Tooltip`](#tooltip)
- [`TooltipDefinition`](#tooltipdefinition) - [`TooltipDefinition`](#tooltipdefinition)
- [`TooltipIcon`](#tooltipicon) - [`TooltipIcon`](#tooltipicon)
- [`Truncate`](#truncate)
- [`UnorderedList`](#unorderedlist) - [`UnorderedList`](#unorderedlist)
--- ---
@ -609,6 +611,7 @@ export interface ComboBoxItem {
| selectedIndex | <code>let</code> | Yes | <code>number</code> | <code>-1</code> | Set the selected item by value index | | selectedIndex | <code>let</code> | Yes | <code>number</code> | <code>-1</code> | Set the selected item by value index |
| items | <code>let</code> | No | <code>ComboBoxItem[]</code> | <code>[]</code> | Set the combobox items | | items | <code>let</code> | No | <code>ComboBoxItem[]</code> | <code>[]</code> | Set the combobox items |
| itemToString | <code>let</code> | No | <code>(item: ComboBoxItem) => string</code> | <code>(item) => item.text &#124;&#124; item.id</code> | Override the display of a combobox item | | itemToString | <code>let</code> | No | <code>(item: ComboBoxItem) => string</code> | <code>(item) => item.text &#124;&#124; item.id</code> | Override the display of a combobox item |
| direction | <code>let</code> | No | <code>"bottom" &#124; "top"</code> | <code>"bottom"</code> | Specify the direction of the combobox dropdown menu |
| size | <code>let</code> | No | <code>"sm" &#124; "xl"</code> | -- | Set the size of the combobox | | size | <code>let</code> | No | <code>"sm" &#124; "xl"</code> | -- | Set the size of the combobox |
| disabled | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to disable the combobox | | disabled | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to disable the combobox |
| titleText | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the title text of the combobox | | titleText | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the title text of the combobox |
@ -616,6 +619,8 @@ export interface ComboBoxItem {
| helperText | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the helper text | | helperText | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the helper text |
| invalidText | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the invalid state text | | invalidText | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the invalid state text |
| invalid | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to indicate an invalid state | | invalid | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to indicate an invalid state |
| warn | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to indicate an warning state |
| warnText | <code>let</code> | No | <code>string</code> | <code>""</code> | Specify the warning state text |
| light | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to enable the light variant | | light | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to enable the light variant |
| shouldFilterItem | <code>let</code> | No | <code>(item: ComboBoxItem, value: string) => boolean</code> | <code>() => true</code> | Determine if an item should be filtered given the current combobox value | | shouldFilterItem | <code>let</code> | No | <code>(item: ComboBoxItem, value: string) => boolean</code> | <code>() => true</code> | Determine if an item should be filtered given the current combobox value |
| translateWithId | <code>let</code> | No | <code>(id: any) => string</code> | -- | Override the default translation ids | | translateWithId | <code>let</code> | No | <code>(id: any) => string</code> | -- | Override the default translation ids |
@ -980,6 +985,7 @@ export interface DropdownItem {
| items | <code>let</code> | No | <code>DropdownItem[]</code> | <code>[]</code> | Set the dropdown items | | items | <code>let</code> | No | <code>DropdownItem[]</code> | <code>[]</code> | Set the dropdown items |
| itemToString | <code>let</code> | No | <code>(item: DropdownItem) => string</code> | <code>(item) => item.text &#124;&#124; item.id</code> | Override the display of a dropdown item | | itemToString | <code>let</code> | No | <code>(item: DropdownItem) => string</code> | <code>(item) => item.text &#124;&#124; item.id</code> | Override the display of a dropdown item |
| type | <code>let</code> | No | <code>"default" &#124; "inline"</code> | <code>"default"</code> | Specify the type of dropdown | | type | <code>let</code> | No | <code>"default" &#124; "inline"</code> | <code>"default"</code> | Specify the type of dropdown |
| direction | <code>let</code> | No | <code>"bottom" &#124; "top"</code> | <code>"bottom"</code> | Specify the direction of the dropdown menu |
| size | <code>let</code> | No | <code>"sm" &#124; "lg" &#124; "xl"</code> | -- | Specify the size of the dropdown field | | size | <code>let</code> | No | <code>"sm" &#124; "lg" &#124; "xl"</code> | -- | Specify the size of the dropdown field |
| light | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to enable the light variant | | light | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to enable the light variant |
| disabled | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to disable the dropdown | | disabled | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to disable the dropdown |
@ -2150,6 +2156,7 @@ export interface MultiSelectItem {
| itemToString | <code>let</code> | No | <code>(item: MultiSelectItem) => string</code> | <code>(item) => item.text &#124;&#124; item.id</code> | Override the display of a multiselect item | | itemToString | <code>let</code> | No | <code>(item: MultiSelectItem) => string</code> | <code>(item) => item.text &#124;&#124; item.id</code> | Override the display of a multiselect item |
| size | <code>let</code> | No | <code>"sm" &#124; "lg" &#124; "xl"</code> | -- | Set the size of the combobox | | size | <code>let</code> | No | <code>"sm" &#124; "lg" &#124; "xl"</code> | -- | Set the size of the combobox |
| type | <code>let</code> | No | <code>"default" &#124; "inline"</code> | <code>"default"</code> | Specify the type of multiselect | | type | <code>let</code> | No | <code>"default" &#124; "inline"</code> | <code>"default"</code> | Specify the type of multiselect |
| direction | <code>let</code> | No | <code>"bottom" &#124; "top"</code> | <code>"bottom"</code> | Specify the direction of the multiselect dropdown menu |
| selectionFeedback | <code>let</code> | No | <code>"top" &#124; "fixed" &#124; "top-after-reopen"</code> | <code>"top-after-reopen"</code> | Specify the selection feedback after selecting items | | selectionFeedback | <code>let</code> | No | <code>"top" &#124; "fixed" &#124; "top-after-reopen"</code> | <code>"top-after-reopen"</code> | Specify the selection feedback after selecting items |
| disabled | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to disable the dropdown | | disabled | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to disable the dropdown |
| filterable | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to filter items | | filterable | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to filter items |
@ -2988,6 +2995,20 @@ None.
None. None.
## `SideNavDivider`
### Props
None.
### Slots
None.
### Events
None.
## `SideNavItems` ## `SideNavItems`
### Props ### Props
@ -4261,6 +4282,24 @@ None.
| mouseleave | forwarded | -- | | mouseleave | forwarded | -- |
| focus | forwarded | -- | | focus | forwarded | -- |
## `Truncate`
### Props
| Prop name | Kind | Reactive | Type | Default value | Description |
| :-------- | :--------------- | :------- | :-------------------------------- | ------------------ | ----------- |
| clamp | <code>let</code> | No | <code>"end" &#124; "front"</code> | <code>"end"</code> | -- |
### Slots
| Slot name | Default | Props | Fallback |
| :-------- | :------ | :---- | :------- |
| -- | Yes | -- | -- |
### Events
None.
## `UnorderedList` ## `UnorderedList`
### Props ### Props

View file

@ -164,7 +164,6 @@ Using JavaScript:
</script> </script>
<button on:click="{() => (theme = 'g90')}">Update theme</button> <button on:click="{() => (theme = 'g90')}">Update theme</button>
``` ```
## Preprocessors ## Preprocessors

1
actions/index.js Normal file
View file

@ -0,0 +1 @@
export { truncate } from "./truncate";

25
actions/truncate.js Normal file
View file

@ -0,0 +1,25 @@
/**
* Svelte action that applies single-line text truncation to an element
* @param {HTMLElement} node
* @param {{ clamp?: "end" | "front" }} params
* @example
* <script>
* import { truncate } from "carbon-components-svelte/actions";
* </script>
*
* <h1 use:truncate>...</h1>
* <h1 use:truncate={{ clamp: "front" }}>...</h1>
*/
export function truncate(node, params = {}) {
function toggleClass(front = false) {
node.className = `bx--text-truncate--${front ? "front" : "end"}`;
}
toggleClass(params.clamp === "front");
return {
update(params) {
toggleClass(params.clamp === "front");
},
};
}

View file

@ -1,4 +1,8 @@
// This is a recipe for dynamic, client-side theming
// All Carbon themes are included (White, Gray 10, Gray 90, Gray 100)
$feature-flags: ( $feature-flags: (
// Custom CSS properties must be enabled to dynamically switch themes
enable-css-custom-properties: true, enable-css-custom-properties: true,
ui-shell: true, ui-shell: true,
grid-columns-16: true grid-columns-16: true
@ -15,14 +19,30 @@ $css--plex: true;
// Use all Carbon themes // Use all Carbon themes
@import "carbon-components/scss/globals/scss/vendor/@carbon/themes/scss"; @import "carbon-components/scss/globals/scss/vendor/@carbon/themes/scss";
// The default theme is "white" (White)
:root { @include carbon--theme($carbon--theme--white, true); } :root { @include carbon--theme($carbon--theme--white, true); }
// Set the <html> theme attribute to "g10" to use the Gray 10 theme
// <html theme="g10">
:root[theme="g10"] { @include carbon--theme($carbon--theme--g10, true); } :root[theme="g10"] { @include carbon--theme($carbon--theme--g10, true); }
// Set the <html> theme attribute to "g90" to use the Gray 90 theme
// <html theme="g90">
:root[theme="g90"] { @include carbon--theme($carbon--theme--g90, true); } :root[theme="g90"] { @include carbon--theme($carbon--theme--g90, true); }
// Set the <html> theme attribute to "g100" to use the Gray 100 theme
// <html theme="g100">
:root[theme="g100"] { @include carbon--theme($carbon--theme--g100, true); } :root[theme="g100"] { @include carbon--theme($carbon--theme--g100, true); }
@import "carbon-components/scss/globals/scss/_css--reset.scss"; // Programmatically update the theme in JavaScript:
@import "carbon-components/scss/globals/scss/_css--font-face.scss"; // document.documentElement.setAttribute("theme", "g90");
@import "carbon-components/scss/globals/scss/_css--helpers.scss";
@import "carbon-components/scss/globals/scss/_css--body.scss"; @import "carbon-components/scss/globals/scss/_css--reset";
@import "carbon-components/scss/globals/grid/_grid.scss"; @import "carbon-components/scss/globals/scss/_css--font-face";
@import "carbon-components/scss/globals/scss/styles.scss"; @import "carbon-components/scss/globals/scss/_css--helpers";
@import "carbon-components/scss/globals/scss/_css--body";
@import "carbon-components/scss/globals/grid/grid";
// Import all component styles
@import "carbon-components/scss/globals/scss/styles";

View file

@ -17,9 +17,12 @@ $css--plex: true;
$carbon--theme: $carbon--theme--g10; $carbon--theme: $carbon--theme--g10;
@include carbon--theme(); @include carbon--theme();
@import "carbon-components/scss/globals/scss/_css--reset.scss"; @import "carbon-components/scss/globals/scss/_css--reset";
@import "carbon-components/scss/globals/scss/_css--font-face.scss"; @import "carbon-components/scss/globals/scss/_css--font-face";
@import "carbon-components/scss/globals/scss/_css--helpers.scss"; @import "carbon-components/scss/globals/scss/_css--helpers";
@import "carbon-components/scss/globals/scss/_css--body.scss"; @import "carbon-components/scss/globals/scss/_css--body";
@import "carbon-components/scss/globals/grid/_grid.scss"; @import "carbon-components/scss/globals/grid/grid";
@import "carbon-components/scss/globals/scss/styles.scss";
// Import all component styles
@import "carbon-components/scss/globals/scss/styles";

View file

@ -17,9 +17,11 @@ $css--plex: true;
$carbon--theme: $carbon--theme--g100; $carbon--theme: $carbon--theme--g100;
@include carbon--theme(); @include carbon--theme();
@import "carbon-components/scss/globals/scss/_css--reset.scss"; @import "carbon-components/scss/globals/scss/_css--reset";
@import "carbon-components/scss/globals/scss/_css--font-face.scss"; @import "carbon-components/scss/globals/scss/_css--font-face";
@import "carbon-components/scss/globals/scss/_css--helpers.scss"; @import "carbon-components/scss/globals/scss/_css--helpers";
@import "carbon-components/scss/globals/scss/_css--body.scss"; @import "carbon-components/scss/globals/scss/_css--body";
@import "carbon-components/scss/globals/grid/_grid.scss"; @import "carbon-components/scss/globals/grid/grid";
@import "carbon-components/scss/globals/scss/styles.scss";
// Import all component styles
@import "carbon-components/scss/globals/scss/styles";

View file

@ -17,9 +17,11 @@ $css--plex: true;
$carbon--theme: $carbon--theme--g90; $carbon--theme: $carbon--theme--g90;
@include carbon--theme(); @include carbon--theme();
@import "carbon-components/scss/globals/scss/_css--reset.scss"; @import "carbon-components/scss/globals/scss/_css--reset";
@import "carbon-components/scss/globals/scss/_css--font-face.scss"; @import "carbon-components/scss/globals/scss/_css--font-face";
@import "carbon-components/scss/globals/scss/_css--helpers.scss"; @import "carbon-components/scss/globals/scss/_css--helpers";
@import "carbon-components/scss/globals/scss/_css--body.scss"; @import "carbon-components/scss/globals/scss/_css--body";
@import "carbon-components/scss/globals/grid/_grid.scss"; @import "carbon-components/scss/globals/grid/grid";
@import "carbon-components/scss/globals/scss/styles.scss";
// Import all component styles
@import "carbon-components/scss/globals/scss/styles";

View file

@ -17,9 +17,11 @@ $css--plex: true;
$carbon--theme: $carbon--theme--white; $carbon--theme: $carbon--theme--white;
@include carbon--theme(); @include carbon--theme();
@import "carbon-components/scss/globals/scss/_css--reset.scss"; @import "carbon-components/scss/globals/scss/_css--reset";
@import "carbon-components/scss/globals/scss/_css--font-face.scss"; @import "carbon-components/scss/globals/scss/_css--font-face";
@import "carbon-components/scss/globals/scss/_css--helpers.scss"; @import "carbon-components/scss/globals/scss/_css--helpers";
@import "carbon-components/scss/globals/scss/_css--body.scss"; @import "carbon-components/scss/globals/scss/_css--body";
@import "carbon-components/scss/globals/grid/_grid.scss"; @import "carbon-components/scss/globals/grid/grid";
@import "carbon-components/scss/globals/scss/styles.scss";
// Import all component styles
@import "carbon-components/scss/globals/scss/styles";

View file

@ -11,7 +11,7 @@
"devDependencies": { "devDependencies": {
"@sveltech/routify": "^1.9.9", "@sveltech/routify": "^1.9.9",
"autoprefixer": "^10.2.3", "autoprefixer": "^10.2.3",
"carbon-components": "10.28.0", "carbon-components": "10.29.0",
"carbon-components-svelte": "../", "carbon-components-svelte": "../",
"clipboard-copy": "^3.1.0", "clipboard-copy": "^3.1.0",
"mdsvex": "^0.8.8", "mdsvex": "^0.8.8",

View file

@ -6,7 +6,11 @@
<Router routes="{routes}" /> <Router routes="{routes}" />
<style lang="scss" global> <style lang="scss" global>
// This is a recipe for dynamic, client-side theming
// All Carbon themes are included (White, Gray 10, Gray 90, Gray 100)
$feature-flags: ( $feature-flags: (
// Custom CSS properties must be enabled to dynamically switch themes
enable-css-custom-properties: true, enable-css-custom-properties: true,
ui-shell: true, ui-shell: true,
grid-columns-16: true grid-columns-16: true
@ -23,23 +27,38 @@
// Use all Carbon themes // Use all Carbon themes
@import "carbon-components/scss/globals/scss/vendor/@carbon/themes/scss"; @import "carbon-components/scss/globals/scss/vendor/@carbon/themes/scss";
// The default theme is "white" (White)
:root { :root {
@include carbon--theme($carbon--theme--white, true); @include carbon--theme($carbon--theme--white, true);
} }
// Set the <html> theme attribute to "g10" to use the Gray 10 theme
// <html theme="g10">
:root[theme="g10"] { :root[theme="g10"] {
@include carbon--theme($carbon--theme--g10, true); @include carbon--theme($carbon--theme--g10, true);
} }
// Set the <html> theme attribute to "g90" to use the Gray 90 theme
// <html theme="g90">
:root[theme="g90"] { :root[theme="g90"] {
@include carbon--theme($carbon--theme--g90, true); @include carbon--theme($carbon--theme--g90, true);
} }
// Set the <html> theme attribute to "g100" to use the Gray 100 theme
// <html theme="g100">
:root[theme="g100"] { :root[theme="g100"] {
@include carbon--theme($carbon--theme--g100, true); @include carbon--theme($carbon--theme--g100, true);
} }
@import "carbon-components/scss/globals/scss/_css--reset.scss"; // Programmatically update the theme in JavaScript:
@import "carbon-components/scss/globals/scss/_css--font-face.scss"; // document.documentElement.setAttribute("theme", "g90");
@import "carbon-components/scss/globals/scss/_css--helpers.scss";
@import "carbon-components/scss/globals/scss/_css--body.scss"; @import "carbon-components/scss/globals/scss/_css--reset";
@import "carbon-components/scss/globals/grid/_grid.scss"; @import "carbon-components/scss/globals/scss/_css--font-face";
@import "carbon-components/scss/globals/scss/styles.scss"; @import "carbon-components/scss/globals/scss/_css--helpers";
@import "carbon-components/scss/globals/scss/_css--body";
@import "carbon-components/scss/globals/grid/grid";
// Import all component styles
@import "carbon-components/scss/globals/scss/styles";
</style> </style>

View file

@ -1,5 +1,5 @@
{ {
"total": 156, "total": 158,
"components": [ "components": [
{ {
"moduleName": "Accordion", "moduleName": "Accordion",
@ -1189,6 +1189,16 @@
"constant": false, "constant": false,
"reactive": true "reactive": true
}, },
{
"name": "direction",
"kind": "let",
"description": "Specify the direction of the combobox dropdown menu",
"type": "\"bottom\" | \"top\"",
"value": "\"bottom\"",
"isFunction": false,
"constant": false,
"reactive": false
},
{ {
"name": "size", "name": "size",
"kind": "let", "kind": "let",
@ -1258,6 +1268,26 @@
"constant": false, "constant": false,
"reactive": false "reactive": false
}, },
{
"name": "warn",
"kind": "let",
"description": "Set to `true` to indicate an warning state",
"type": "boolean",
"value": "false",
"isFunction": false,
"constant": false,
"reactive": false
},
{
"name": "warnText",
"kind": "let",
"description": "Specify the warning state text",
"type": "string",
"value": "\"\"",
"isFunction": false,
"constant": false,
"reactive": false
},
{ {
"name": "light", "name": "light",
"kind": "let", "kind": "let",
@ -2290,6 +2320,16 @@
"constant": false, "constant": false,
"reactive": false "reactive": false
}, },
{
"name": "direction",
"kind": "let",
"description": "Specify the direction of the dropdown menu",
"type": "\"bottom\" | \"top\"",
"value": "\"bottom\"",
"isFunction": false,
"constant": false,
"reactive": false
},
{ {
"name": "size", "name": "size",
"kind": "let", "kind": "let",
@ -5142,6 +5182,16 @@
"constant": false, "constant": false,
"reactive": false "reactive": false
}, },
{
"name": "direction",
"kind": "let",
"description": "Specify the direction of the multiselect dropdown menu",
"type": "\"bottom\" | \"top\"",
"value": "\"bottom\"",
"isFunction": false,
"constant": false,
"reactive": false
},
{ {
"name": "selectionFeedback", "name": "selectionFeedback",
"kind": "let", "kind": "let",
@ -7733,6 +7783,15 @@
"typedefs": [], "typedefs": [],
"rest_props": { "type": "Element", "name": "nav" } "rest_props": { "type": "Element", "name": "nav" }
}, },
{
"moduleName": "SideNavDivider",
"filePath": "src/UIShell/SideNavDivider.svelte",
"props": [],
"slots": [],
"events": [],
"typedefs": [],
"rest_props": { "type": "Element", "name": "li" }
},
{ {
"moduleName": "SideNavItems", "moduleName": "SideNavItems",
"filePath": "src/UIShell/SideNav/SideNavItems.svelte", "filePath": "src/UIShell/SideNav/SideNavItems.svelte",
@ -10635,6 +10694,25 @@
"typedefs": [], "typedefs": [],
"rest_props": { "type": "Element", "name": "button" } "rest_props": { "type": "Element", "name": "button" }
}, },
{
"moduleName": "Truncate",
"filePath": "src/Truncate/Truncate.svelte",
"props": [
{
"name": "clamp",
"kind": "let",
"type": "\"end\" | \"front\"",
"value": "\"end\"",
"isFunction": false,
"constant": false,
"reactive": false
}
],
"slots": [{ "name": "__default__", "default": true, "slot_props": "{}" }],
"events": [],
"typedefs": [],
"rest_props": { "type": "Element", "name": "p" }
},
{ {
"moduleName": "UnorderedList", "moduleName": "UnorderedList",
"filePath": "src/UnorderedList/UnorderedList.svelte", "filePath": "src/UnorderedList/UnorderedList.svelte",

View file

@ -30,6 +30,17 @@ items={[
<FileSource src="/framed/ComboBox/FilterableComboBox" /> <FileSource src="/framed/ComboBox/FilterableComboBox" />
### Top direction
Set `direction` to `"top"` for the combobox dropdown menu to appear above the input.
<ComboBox direction="top" titleText="Contact" placeholder="Select contact method"
items={[
{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}
]} />
### Light variant ### Light variant
<ComboBox light titleText="Contact" placeholder="Select contact method" <ComboBox light titleText="Contact" placeholder="Select contact method"
@ -59,6 +70,24 @@ items={[
{id: "2", text: "Fax"} {id: "2", text: "Fax"}
]} /> ]} />
### Invalid state
<ComboBox invalid invalidText="Secondary contact method must be different from the primary contact" titleText="Contact" placeholder="Select contact method"
items={[
{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}
]} />
### Warning state
<ComboBox warn warnText="This contact method is not associated with your account" titleText="Contact" placeholder="Select contact method"
items={[
{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}
]} />
### Disabled ### Disabled
<ComboBox disabled titleText="Contact" placeholder="Select contact method" <ComboBox disabled titleText="Contact" placeholder="Select contact method"

View file

@ -33,6 +33,14 @@ Use the `itemToString` prop to format the display of individual items.
<FileSource src="/framed/Dropdown/MultipleDropdown" /> <FileSource src="/framed/Dropdown/MultipleDropdown" />
### Top direction
Set `direction` to `"top"` for the dropdown menu to appear above the input.
<Dropdown direction="top" titleText="Contact" selectedIndex={0} items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}" />
### Light variant ### Light variant
<Dropdown light titleText="Contact" selectedIndex={0} items="{[{id: "0", text: "Slack"}, <Dropdown light titleText="Contact" selectedIndex={0} items="{[{id: "0", text: "Slack"},

View file

@ -51,6 +51,16 @@ Use the `itemToString` prop to format the display of individual items.
sortItem="{() => {}}" sortItem="{() => {}}"
/> />
### Top direction
Set `direction` to `"top"` for the dropdown menu to appear above the input.
<MultiSelect direction="top" titleText="Contact" label="Select contact methods..."
items="{[{id: "0", text: "Slack"},
{id: "1", text: "Email"},
{id: "2", text: "Fax"}]}"
/>
### Light variant ### Light variant
<MultiSelect light titleText="Contact" label="Select contact methods..." <MultiSelect light titleText="Contact" label="Select contact methods..."

View file

@ -59,6 +59,40 @@ When programmatically updating the `currentIndex`, keep in mind that only comple
<FileSource src="/framed/ProgressIndicator/ProgrammaticProgressIndicator" /> <FileSource src="/framed/ProgressIndicator/ProgrammaticProgressIndicator" />
### Invalid step
<ProgressIndicator>
<ProgressStep complete
label="Step 1"
description="The progress indicator will listen for clicks on the steps"
/>
<ProgressStep invalid
label="Step 2"
description="The progress indicator will listen for clicks on the steps"
/>
<ProgressStep
label="Step 3"
description="The progress indicator will listen for clicks on the steps"
/>
</ProgressIndicator>
### Disabled steps
<ProgressIndicator>
<ProgressStep complete
label="Step 1"
description="The progress indicator will listen for clicks on the steps"
/>
<ProgressStep disabled
label="Step 2"
description="The progress indicator will listen for clicks on the steps"
/>
<ProgressStep disabled
label="Step 3"
description="The progress indicator will listen for clicks on the steps"
/>
</ProgressIndicator>
### Spaced-equally ### Spaced-equally
<ProgressIndicator spaceEqually> <ProgressIndicator spaceEqually>

View file

@ -24,13 +24,13 @@ components: ["TileGroup", "RadioTile"]
### Light variant ### Light variant
<TileGroup legend="Service pricing tiers"> <TileGroup legend="Service pricing tiers">
<RadioTile value="0" checked> <RadioTile light value="0" checked>
Lite plan Lite plan
</RadioTile> </RadioTile>
<RadioTile value="1"> <RadioTile light value="1">
Standard plan Standard plan
</RadioTile> </RadioTile>
<RadioTile value="2"> <RadioTile light value="2">
Plus plan Plus plan
</RadioTile> </RadioTile>
</TileGroup> </TileGroup>

View file

@ -29,7 +29,11 @@
### Filterable ### Filterable
<Tag filter on:close>Filterable</Tag> <Tag filter on:close>carbon-components</Tag>
### Filterable (small)
<Tag size="sm" filter on:close>carbon-components</Tag>
### Custom icon ### Custom icon

View file

@ -0,0 +1,37 @@
<script>
import { Truncate } from "carbon-components-svelte";
import { truncate } from "carbon-components-svelte/actions";
import Preview from "../../components/Preview.svelte";
</script>
This utility component wraps the `.bx--text-truncate--*` CSS selectors from [carbon-components](https://github.com/carbon-design-system/carbon/blob/master/packages/components/src/globals/scss/_helper-classes.scss#L11) for single-line text truncation.
### Default
By default, text will be clamped at the end of the line. Text is wrapped with a paragraph (`p`) element. Use the [truncate action](#usetruncate) to truncate text in other elements.
<Truncate>
Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM.
</Truncate>
### Clamp front
Set `clamp` to `"front"` to clamp the text from the front.
<Truncate clamp="front">
Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM.
</Truncate>
### use:truncate
The `truncate` action can be used on other HTML elements.
Import path: `import { truncate } from "carbon-components-svelte/actions";`
<h4 use:truncate>
Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM.
</h4>
<h4 use:truncate={{ clamp: "front" }}>
Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM.
</h4>

View file

@ -9,6 +9,7 @@
SideNavMenu, SideNavMenu,
SideNavMenuItem, SideNavMenuItem,
SideNavLink, SideNavLink,
SideNavDivider,
SkipToContent, SkipToContent,
Content, Content,
Grid, Grid,
@ -33,6 +34,7 @@
<HeaderNavItem href="/" text="Link 2" /> <HeaderNavItem href="/" text="Link 2" />
<HeaderNavItem href="/" text="Link 3" /> <HeaderNavItem href="/" text="Link 3" />
</HeaderNavMenu> </HeaderNavMenu>
<HeaderNavItem href="/" text="Link 4" />
</HeaderNav> </HeaderNav>
</Header> </Header>
@ -46,6 +48,8 @@
<SideNavMenuItem href="/" text="Link 2" /> <SideNavMenuItem href="/" text="Link 2" />
<SideNavMenuItem href="/" text="Link 3" /> <SideNavMenuItem href="/" text="Link 3" />
</SideNavMenu> </SideNavMenu>
<SideNavDivider />
<SideNavLink text="Link 4" />
</SideNavItems> </SideNavItems>
</SideNav> </SideNav>

View file

@ -38,6 +38,9 @@ function createImports(source) {
const ccs_imports = Array.from(inlineComponents.keys()); const ccs_imports = Array.from(inlineComponents.keys());
const icon_imports = Array.from(icons.keys()); const icon_imports = Array.from(icons.keys());
if (ccs_imports.length === 0) return "";
// TODO: determine if action is used, and generate import accordingly
return ` return `
<script> <script>
import {${ccs_imports.join(",")}} from "carbon-components-svelte"; import {${ccs_imports.join(",")}} from "carbon-components-svelte";

View file

@ -837,15 +837,15 @@ caniuse-lite@^1.0.30001173, caniuse-lite@^1.0.30001178:
integrity sha512-n8JVqXuZMVSPKiPiypjFtDTXc4jWIdjxull0f92WLo7e1MSi3uJ3NvveakSh/aCl1QKFAvIz3vIj0v+0K+FrXw== integrity sha512-n8JVqXuZMVSPKiPiypjFtDTXc4jWIdjxull0f92WLo7e1MSi3uJ3NvveakSh/aCl1QKFAvIz3vIj0v+0K+FrXw==
carbon-components-svelte@../: carbon-components-svelte@../:
version "0.27.0" version "0.28.0"
dependencies: dependencies:
carbon-icons-svelte "^10.21.0" carbon-icons-svelte "^10.21.0"
flatpickr "4.6.9" flatpickr "4.6.9"
carbon-components@10.28.0: carbon-components@10.29.0:
version "10.28.0" version "10.29.0"
resolved "https://registry.yarnpkg.com/carbon-components/-/carbon-components-10.28.0.tgz#c4d2b23df2559cf3b0226867c45e2e84e0af7c4e" resolved "https://registry.yarnpkg.com/carbon-components/-/carbon-components-10.29.0.tgz#9fd31f1a5cce4cb59a7196222e524d8442fd9026"
integrity sha512-bFsyngr625zc/t2gl4BPFYl0/ed4q38rrPihQxBXHhLAdeZNyy8xyOQlbh1PEQbTu47H/s/bxVo6QiFm/VmLZA== integrity sha512-y7BPEfwWxE1URTjrtHz4+rYQwB0u/e7WptlbTH2Lb/iqRYCe6T94u9EVZuq0ZZTpRUNRckbI1irt0AV3J/qlcA==
dependencies: dependencies:
"@carbon/telemetry" "0.0.0-alpha.6" "@carbon/telemetry" "0.0.0-alpha.6"
flatpickr "4.6.1" flatpickr "4.6.1"

View file

@ -8,7 +8,9 @@
"main": "./lib/index.js", "main": "./lib/index.js",
"module": "./lib/index.mjs", "module": "./lib/index.mjs",
"types": "./types/index.d.ts", "types": "./types/index.d.ts",
"sideEffects": false, "sideEffects": [
"css/*.css"
],
"scripts": { "scripts": {
"test": "run-p test:*", "test": "run-p test:*",
"test:types": "svelte-check --workspace tests", "test:types": "svelte-check --workspace tests",
@ -29,14 +31,14 @@
"@rollup/plugin-node-resolve": "^11.1.1", "@rollup/plugin-node-resolve": "^11.1.1",
"@tsconfig/svelte": "^1.0.10", "@tsconfig/svelte": "^1.0.10",
"autoprefixer": "^10.2.4", "autoprefixer": "^10.2.4",
"carbon-components": "10.28.0", "carbon-components": "10.29.0",
"gh-pages": "^3.1.0", "gh-pages": "^3.1.0",
"husky": "^4.3.8", "husky": "^4.3.8",
"lint-staged": "^10.5.3", "lint-staged": "^10.5.3",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"postcss": "^8.2.4", "postcss": "^8.2.4",
"prettier": "^2.2.1", "prettier": "^2.2.1",
"prettier-plugin-svelte": "^2.1.1", "prettier-plugin-svelte": "^2.1.5",
"rollup": "^2.38.4", "rollup": "^2.38.4",
"rollup-plugin-svelte": "^7.1.0", "rollup-plugin-svelte": "^7.1.0",
"rollup-plugin-terser": "^7.0.2", "rollup-plugin-terser": "^7.0.2",
@ -78,6 +80,7 @@
"src", "src",
"types", "types",
"css", "css",
"preprocess" "preprocess",
"actions"
] ]
} }

View file

@ -122,10 +122,9 @@
on:mouseenter on:mouseenter
on:mouseleave on:mouseleave
/> />
{:else} {:else if as}
{#if as}
<slot props="{buttonProps}" /> <slot props="{buttonProps}" />
{:else if href && !disabled} {:else if href && !disabled}
<!-- svelte-ignore a11y-missing-attribute --> <!-- svelte-ignore a11y-missing-attribute -->
<a <a
bind:this="{ref}" bind:this="{ref}"
@ -146,7 +145,7 @@
aria-label="{iconDescription}" aria-label="{iconDescription}"
/> />
</a> </a>
{:else} {:else}
<button <button
bind:this="{ref}" bind:this="{ref}"
{...buttonProps} {...buttonProps}
@ -166,5 +165,4 @@
aria-label="{iconDescription}" aria-label="{iconDescription}"
/> />
</button> </button>
{/if}
{/if} {/if}

View file

@ -103,8 +103,7 @@
on:mouseenter on:mouseenter
on:mouseleave on:mouseleave
/> />
{:else} {:else if type === "inline"}
{#if type === "inline"}
{#if hideCopyButton} {#if hideCopyButton}
<span <span
class:bx--snippet="{true}" class:bx--snippet="{true}"
@ -136,8 +135,7 @@
'bx--snippet--light'} 'bx--snippet--light'}
{hideCopyButton && {hideCopyButton &&
'bx--snippet--no-copy'} 'bx--snippet--no-copy'}
{wrapText && {wrapText && 'bx--snippet--wraptext'}"
'bx--snippet--wraptext'}"
{...$$restProps} {...$$restProps}
on:click on:click
on:mouseover on:mouseover
@ -149,7 +147,7 @@
</code> </code>
</Copy> </Copy>
{/if} {/if}
{:else} {:else}
<div <div
class:bx--snippet="{true}" class:bx--snippet="{true}"
class:bx--snippet--expand="{expanded}" class:bx--snippet--expand="{expanded}"
@ -205,5 +203,4 @@
</Button> </Button>
{/if} {/if}
</div> </div>
{/if}
{/if} {/if}

View file

@ -22,6 +22,12 @@
/** Specify the selected combobox value */ /** Specify the selected combobox value */
export let value = ""; export let value = "";
/**
* Specify the direction of the combobox dropdown menu
* @type {"bottom" | "top"}
*/
export let direction = "bottom";
/** /**
* Set the size of the combobox * Set the size of the combobox
* @type {"sm" | "xl"} * @type {"sm" | "xl"}
@ -46,6 +52,12 @@
/** Set to `true` to indicate an invalid state */ /** Set to `true` to indicate an invalid state */
export let invalid = false; export let invalid = false;
/** Set to `true` to indicate an warning state */
export let warn = false;
/** Specify the warning state text */
export let warnText = "";
/** Set to `true` to enable the light variant */ /** Set to `true` to enable the light variant */
export let light = false; export let light = false;
@ -84,6 +96,7 @@
import { createEventDispatcher, afterUpdate, tick } from "svelte"; import { createEventDispatcher, afterUpdate, tick } from "svelte";
import WarningFilled16 from "carbon-icons-svelte/lib/WarningFilled16/WarningFilled16.svelte"; import WarningFilled16 from "carbon-icons-svelte/lib/WarningFilled16/WarningFilled16.svelte";
import WarningAltFilled16 from "carbon-icons-svelte/lib/WarningAltFilled16/WarningAltFilled16.svelte";
import ListBox from "../ListBox/ListBox.svelte"; import ListBox from "../ListBox/ListBox.svelte";
import ListBoxField from "../ListBox/ListBoxField.svelte"; import ListBoxField from "../ListBox/ListBoxField.svelte";
import ListBoxMenu from "../ListBox/ListBoxMenu.svelte"; import ListBoxMenu from "../ListBox/ListBoxMenu.svelte";
@ -97,8 +110,8 @@
let inputValue = ""; let inputValue = "";
let highlightedIndex = -1; let highlightedIndex = -1;
function change(direction) { function change(dir) {
let index = highlightedIndex + direction; let index = highlightedIndex + dir;
if (index < 0) { if (index < 0) {
index = items.length - 1; index = items.length - 1;
@ -158,7 +171,8 @@
</label> </label>
{/if} {/if}
<ListBox <ListBox
class="bx--combo-box" class="bx--combo-box {direction === 'top' &&
'bx--list-box--up'} {!invalid && warn && 'bx--combo-box--warning'}"
id="{comboId}" id="{comboId}"
aria-label="{ariaLabel}" aria-label="{ariaLabel}"
disabled="{disabled}" disabled="{disabled}"
@ -167,6 +181,8 @@
open="{open}" open="{open}"
light="{light}" light="{light}"
size="{size}" size="{size}"
warn="{warn}"
warnText="{warnText}"
> >
<ListBoxField <ListBoxField
role="button" role="button"
@ -236,6 +252,11 @@
{#if invalid} {#if invalid}
<WarningFilled16 class="bx--list-box__invalid-icon" /> <WarningFilled16 class="bx--list-box__invalid-icon" />
{/if} {/if}
{#if !invalid && warn}
<WarningAltFilled16
class="bx--list-box__invalid-icon bx--list-box__invalid-icon--warning"
/>
{/if}
{#if inputValue} {#if inputValue}
<ListBoxSelection <ListBoxSelection
on:clear on:clear
@ -286,7 +307,7 @@
</ListBoxMenu> </ListBoxMenu>
{/if} {/if}
</ListBox> </ListBox>
{#if !invalid && helperText} {#if !invalid && helperText && !warn}
<div <div
class:bx--form__helper-text="{true}" class:bx--form__helper-text="{true}"
class:bx--form__helper-text--disabled="{disabled}" class:bx--form__helper-text--disabled="{disabled}"

View file

@ -27,6 +27,12 @@
*/ */
export let type = "default"; export let type = "default";
/**
* Specify the direction of the dropdown menu
* @type {"bottom" | "top"}
*/
export let direction = "bottom";
/** /**
* Specify the size of the dropdown field * Specify the size of the dropdown field
* @type {"sm" | "lg" | "xl"} * @type {"sm" | "lg" | "xl"}
@ -105,8 +111,8 @@
let selectedId = undefined; let selectedId = undefined;
let highlightedIndex = -1; let highlightedIndex = -1;
function change(direction) { function change(dir) {
let index = highlightedIndex + direction; let index = highlightedIndex + dir;
if (index < 0) { if (index < 0) {
index = items.length - 1; index = items.length - 1;
@ -159,7 +165,8 @@
id="{id}" id="{id}"
name="{name}" name="{name}"
aria-label="{$$props['aria-label']}" aria-label="{$$props['aria-label']}"
class="bx--dropdown {invalid && 'bx--dropdown--invalid'} {!invalid && class="bx--dropdown {direction === 'top' && 'bx--list-box--up'} {invalid &&
'bx--dropdown--invalid'} {!invalid &&
warn && warn &&
'bx--dropdown--warning'} {open && 'bx--dropdown--open'} 'bx--dropdown--warning'} {open && 'bx--dropdown--open'}
{size === {size ===

View file

@ -32,6 +32,12 @@
*/ */
export let type = "default"; export let type = "default";
/**
* Specify the direction of the multiselect dropdown menu
* @type {"bottom" | "top"}
*/
export let direction = "bottom";
/** /**
* Specify the selection feedback after selecting items * Specify the selection feedback after selecting items
* @type {"top" | "fixed" | "top-after-reopen"} * @type {"top" | "fixed" | "top-after-reopen"}
@ -252,7 +258,8 @@
size="{size}" size="{size}"
warn="{warn}" warn="{warn}"
warnText="{warnText}" warnText="{warnText}"
class="bx--multi-select {filterable && 'bx--combo-box'} class="bx--multi-select {direction === 'top' &&
'bx--list-box--up'} {filterable && 'bx--combo-box'}
{filterable && {filterable &&
'bx--multi-select--filterable'} 'bx--multi-select--filterable'}
{invalid && {invalid &&

View file

@ -80,7 +80,7 @@
}}" }}"
> >
{#if invalid} {#if invalid}
<Warning16 class="bx--progress__warning" /> <Warning16 class="bx--progress__warning" title="{description}" />
{:else if current} {:else if current}
<svg> <svg>
<path d="M 7, 7 m -7, 0 a 7,7 0 1,0 14,0 a 7,7 0 1,0 -14,0"></path> <path d="M 7, 7 m -7, 0 a 7,7 0 1,0 14,0 a 7,7 0 1,0 -14,0"></path>

View file

@ -48,8 +48,7 @@
on:mouseenter on:mouseenter
on:mouseleave on:mouseleave
/> />
{:else} {:else if filter}
{#if filter}
<div <div
aria-label="{title}" aria-label="{title}"
id="{id}" id="{id}"
@ -89,7 +88,7 @@
<Close16 /> <Close16 />
</button> </button>
</div> </div>
{:else} {:else}
<div <div
id="{id}" id="{id}"
class:bx--tag="{true}" class:bx--tag="{true}"
@ -121,5 +120,4 @@
<slot /> <slot />
</span> </span>
</div> </div>
{/if}
{/if} {/if}

View file

@ -80,9 +80,9 @@
<span aria-hidden="true" class:bx--toggle__text--off="{true}"> <span aria-hidden="true" class:bx--toggle__text--off="{true}">
{labelA} {labelA}
</span> </span>
<span aria-hidden="true" class:bx--toggle__text--on="{true}" <span aria-hidden="true" class:bx--toggle__text--on="{true}">
>{labelB}</span {labelB}
> </span>
</span> </span>
</label> </label>
</div> </div>

View file

@ -0,0 +1,12 @@
<script>
/** @type {"end" | "front"}*/
export let clamp = "end";
</script>
<p
class:bx--text-truncate--end="{clamp === 'end'}"
class:bx--text-truncate--front="{clamp === 'front'}"
{...$$restProps}
>
<slot />
</p>

1
src/Truncate/index.js Normal file
View file

@ -0,0 +1 @@
export { default as Truncate } from "./Truncate.svelte";

View file

@ -0,0 +1 @@
<li role="separator" class:bx--side-nav__divider="{true}" {...$$restProps}></li>

View file

@ -18,3 +18,4 @@ export { default as Content } from "./Content.svelte";
export { default as SkipToContent } from "./SkipToContent.svelte"; export { default as SkipToContent } from "./SkipToContent.svelte";
export { default as HeaderGlobalAction } from "./HeaderGlobalAction.svelte"; export { default as HeaderGlobalAction } from "./HeaderGlobalAction.svelte";
export { default as HeaderSearch } from "./HeaderSearch.svelte"; export { default as HeaderSearch } from "./HeaderSearch.svelte";
export { default as SideNavDivider } from "./SideNavDivider.svelte";

View file

@ -114,6 +114,7 @@ export { ToggleSmall, ToggleSmallSkeleton } from "./ToggleSmall";
export { Tooltip } from "./Tooltip"; export { Tooltip } from "./Tooltip";
export { TooltipDefinition } from "./TooltipDefinition"; export { TooltipDefinition } from "./TooltipDefinition";
export { TooltipIcon } from "./TooltipIcon"; export { TooltipIcon } from "./TooltipIcon";
export { Truncate } from "./Truncate";
export { export {
Header, Header,
HeaderAction, HeaderAction,
@ -131,6 +132,7 @@ export {
SideNavLink, SideNavLink,
SideNavMenu, SideNavMenu,
SideNavMenuItem, SideNavMenuItem,
SideNavDivider,
Content, Content,
SkipToContent, SkipToContent,
HeaderGlobalAction, HeaderGlobalAction,

View file

@ -10,6 +10,7 @@
</script> </script>
<ComboBox <ComboBox
direction="top"
titleText="Contact" titleText="Contact"
placeholder="Select contact method" placeholder="Select contact method"
items="{items}" items="{items}"

View file

@ -3,6 +3,7 @@
</script> </script>
<Dropdown <Dropdown
direction="top"
titleText="Contact" titleText="Contact"
selectedIndex="{0}" selectedIndex="{0}"
items="{[ items="{[

View file

@ -3,6 +3,7 @@
</script> </script>
<MultiSelect <MultiSelect
direction="top"
titleText="Contact" titleText="Contact"
label="Select contact methods..." label="Select contact methods..."
items="{[ items="{[

View file

@ -9,7 +9,7 @@
</TileGroup> </TileGroup>
<TileGroup legend="Service pricing tiers"> <TileGroup legend="Service pricing tiers">
<RadioTile value="0" checked>Lite plan</RadioTile> <RadioTile light value="0" checked>Lite plan</RadioTile>
<RadioTile value="1">Standard plan</RadioTile> <RadioTile light value="1">Standard plan</RadioTile>
<RadioTile value="2">Plus plan</RadioTile> <RadioTile light value="2">Plus plan</RadioTile>
</TileGroup> </TileGroup>

View file

@ -0,0 +1,23 @@
<script lang="ts">
import { Truncate } from "../types";
import { truncate } from "../actions";
</script>
<Truncate>
Carbon Components Svelte is a Svelte component library that implements the
Carbon Design System, an open source design system by IBM.
</Truncate>
<Truncate clamp="front">
Carbon Components Svelte is a Svelte component library that implements the
Carbon Design System, an open source design system by IBM.
</Truncate>
<h4 use:truncate>
Carbon Components Svelte is a Svelte component library that implements the
Carbon Design System, an open source design system by IBM.
</h4>
<h4 use:truncate="{{ clamp: 'front' }}">
Carbon Components Svelte is a Svelte component library that implements the
Carbon Design System, an open source design system by IBM.
</h4>

View file

@ -32,6 +32,12 @@ export interface ComboBoxProps
*/ */
value?: string; value?: string;
/**
* Specify the direction of the combobox dropdown menu
* @default "bottom"
*/
direction?: "bottom" | "top";
/** /**
* Set the size of the combobox * Set the size of the combobox
*/ */
@ -73,6 +79,18 @@ export interface ComboBoxProps
*/ */
invalid?: boolean; invalid?: boolean;
/**
* Set to `true` to indicate an warning state
* @default false
*/
warn?: boolean;
/**
* Specify the warning state text
* @default ""
*/
warnText?: string;
/** /**
* Set to `true` to enable the light variant * Set to `true` to enable the light variant
* @default false * @default false

View file

@ -36,6 +36,12 @@ export interface DropdownProps
*/ */
type?: "default" | "inline"; type?: "default" | "inline";
/**
* Specify the direction of the dropdown menu
* @default "bottom"
*/
direction?: "bottom" | "top";
/** /**
* Specify the size of the dropdown field * Specify the size of the dropdown field
*/ */

View file

@ -47,6 +47,12 @@ export interface MultiSelectProps
*/ */
type?: "default" | "inline"; type?: "default" | "inline";
/**
* Specify the direction of the multiselect dropdown menu
* @default "bottom"
*/
direction?: "bottom" | "top";
/** /**
* Specify the selection feedback after selecting items * Specify the selection feedback after selecting items
* @default "top-after-reopen" * @default "top-after-reopen"

16
types/Truncate/Truncate.d.ts vendored Normal file
View file

@ -0,0 +1,16 @@
/// <reference types="svelte" />
import { SvelteComponentTyped } from "svelte";
export interface TruncateProps
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["p"]> {
/**
* @default "end"
*/
clamp?: "end" | "front";
}
export default class Truncate extends SvelteComponentTyped<
TruncateProps,
{},
{ default: {} }
> {}

11
types/UIShell/SideNavDivider.d.ts vendored Normal file
View file

@ -0,0 +1,11 @@
/// <reference types="svelte" />
import { SvelteComponentTyped } from "svelte";
export interface SideNavDividerProps
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["li"]> {}
export default class SideNavDivider extends SvelteComponentTyped<
SideNavDividerProps,
{},
{}
> {}

2
types/index.d.ts vendored
View file

@ -133,6 +133,7 @@ export { default as ToggleSmallSkeleton } from "./ToggleSmall/ToggleSmallSkeleto
export { default as Tooltip } from "./Tooltip/Tooltip"; export { default as Tooltip } from "./Tooltip/Tooltip";
export { default as TooltipDefinition } from "./TooltipDefinition/TooltipDefinition"; export { default as TooltipDefinition } from "./TooltipDefinition/TooltipDefinition";
export { default as TooltipIcon } from "./TooltipIcon/TooltipIcon"; export { default as TooltipIcon } from "./TooltipIcon/TooltipIcon";
export { default as Truncate } from "./Truncate/Truncate";
export { default as Header } from "./UIShell/GlobalHeader/Header"; export { default as Header } from "./UIShell/GlobalHeader/Header";
export { default as HeaderAction } from "./UIShell/GlobalHeader/HeaderAction"; export { default as HeaderAction } from "./UIShell/GlobalHeader/HeaderAction";
export { default as HeaderActionLink } from "./UIShell/GlobalHeader/HeaderActionLink"; export { default as HeaderActionLink } from "./UIShell/GlobalHeader/HeaderActionLink";
@ -149,6 +150,7 @@ export { default as SideNavItems } from "./UIShell/SideNav/SideNavItems";
export { default as SideNavLink } from "./UIShell/SideNav/SideNavLink"; export { default as SideNavLink } from "./UIShell/SideNav/SideNavLink";
export { default as SideNavMenu } from "./UIShell/SideNav/SideNavMenu"; export { default as SideNavMenu } from "./UIShell/SideNav/SideNavMenu";
export { default as SideNavMenuItem } from "./UIShell/SideNav/SideNavMenuItem"; export { default as SideNavMenuItem } from "./UIShell/SideNav/SideNavMenuItem";
export { default as SideNavDivider } from "./UIShell/SideNavDivider";
export { default as Content } from "./UIShell/Content"; export { default as Content } from "./UIShell/Content";
export { default as SkipToContent } from "./UIShell/SkipToContent"; export { default as SkipToContent } from "./UIShell/SkipToContent";
export { default as HeaderGlobalAction } from "./UIShell/HeaderGlobalAction"; export { default as HeaderGlobalAction } from "./UIShell/HeaderGlobalAction";

View file

@ -453,10 +453,10 @@ caniuse-lite@^1.0.30001181:
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001183.tgz#7a57ba9d6584119bb5f2bc76d3cc47ba9356b3e2" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001183.tgz#7a57ba9d6584119bb5f2bc76d3cc47ba9356b3e2"
integrity sha512-7JkwTEE1hlRKETbCFd8HDZeLiQIUcl8rC6JgNjvHCNaxOeNmQ9V4LvQXRUsKIV2CC73qKxljwVhToaA3kLRqTw== integrity sha512-7JkwTEE1hlRKETbCFd8HDZeLiQIUcl8rC6JgNjvHCNaxOeNmQ9V4LvQXRUsKIV2CC73qKxljwVhToaA3kLRqTw==
carbon-components@10.28.0: carbon-components@10.29.0:
version "10.28.0" version "10.29.0"
resolved "https://registry.yarnpkg.com/carbon-components/-/carbon-components-10.28.0.tgz#c4d2b23df2559cf3b0226867c45e2e84e0af7c4e" resolved "https://registry.yarnpkg.com/carbon-components/-/carbon-components-10.29.0.tgz#9fd31f1a5cce4cb59a7196222e524d8442fd9026"
integrity sha512-bFsyngr625zc/t2gl4BPFYl0/ed4q38rrPihQxBXHhLAdeZNyy8xyOQlbh1PEQbTu47H/s/bxVo6QiFm/VmLZA== integrity sha512-y7BPEfwWxE1URTjrtHz4+rYQwB0u/e7WptlbTH2Lb/iqRYCe6T94u9EVZuq0ZZTpRUNRckbI1irt0AV3J/qlcA==
dependencies: dependencies:
"@carbon/telemetry" "0.0.0-alpha.6" "@carbon/telemetry" "0.0.0-alpha.6"
flatpickr "4.6.1" flatpickr "4.6.1"
@ -1899,10 +1899,10 @@ prepend-http@^1.0.0:
resolved "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc" resolved "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc"
integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw= integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=
prettier-plugin-svelte@^2.1.1: prettier-plugin-svelte@^2.1.5:
version "2.1.1" version "2.1.5"
resolved "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-2.1.1.tgz#e6613cac4292b5bbda5250680565c131b0da5ced" resolved "https://registry.yarnpkg.com/prettier-plugin-svelte/-/prettier-plugin-svelte-2.1.5.tgz#cb1df2bffafa0562f05e02c6e9373806ef51ebb1"
integrity sha512-U0gRsdJtveyusHd86OUPD+lEVd13bHPPF/CZD/csKjz0Y+Cv4WbUy9x8tA5vaHFtf0tsu8Yb1MrfuhN3GH2gig== integrity sha512-7ySuC/n0Rk8v6GrzoruojfLYde6ncjeFCAA65Dm+fXrK2Mgc3FlvzXMPpm//P3LgfEoc3zMEG/xog1YeoNhdSQ==
prettier@^2.2.1: prettier@^2.2.1:
version "2.2.1" version "2.2.1"