From 14e714fa61134ddf220ba3ba1af7cad644b9d5d6 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Fri, 19 Feb 2021 16:08:16 -0800 Subject: [PATCH] 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 --- COMPONENT_INDEX.md | 41 ++++- README.md | 1 - actions/index.js | 1 + actions/truncate.js | 25 +++ css/all.scss | 32 +++- css/g10.scss | 15 +- css/g100.scss | 14 +- css/g90.scss | 14 +- css/white.scss | 14 +- docs/package.json | 2 +- docs/src/App.svelte | 31 +++- docs/src/COMPONENT_API.json | 80 +++++++- docs/src/pages/components/ComboBox.svx | 29 +++ docs/src/pages/components/Dropdown.svx | 8 + docs/src/pages/components/MultiSelect.svx | 10 + .../pages/components/ProgressIndicator.svx | 34 ++++ docs/src/pages/components/RadioTile.svx | 6 +- docs/src/pages/components/Tag.svx | 6 +- docs/src/pages/components/Truncate.svx | 37 ++++ .../src/pages/framed/UIShell/HeaderNav.svelte | 4 + docs/svelte.config.js | 3 + docs/yarn.lock | 10 +- package.json | 11 +- src/Button/Button.svelte | 86 +++++---- src/CodeSnippet/CodeSnippet.svelte | 171 +++++++++--------- src/ComboBox/ComboBox.svelte | 29 ++- src/Dropdown/Dropdown.svelte | 13 +- src/MultiSelect/MultiSelect.svelte | 9 +- src/ProgressIndicator/ProgressStep.svelte | 2 +- src/Tag/Tag.svelte | 138 +++++++------- src/Toggle/Toggle.svelte | 6 +- src/Truncate/Truncate.svelte | 12 ++ src/Truncate/index.js | 1 + src/UIShell/SideNavDivider.svelte | 1 + src/UIShell/index.js | 1 + src/index.js | 2 + tests/ComboBox.test.svelte | 1 + tests/Dropdown.test.svelte | 1 + tests/MultiSelect.test.svelte | 1 + tests/RadioTile.test.svelte | 6 +- tests/Truncate.test.svelte | 23 +++ types/ComboBox/ComboBox.d.ts | 18 ++ types/Dropdown/Dropdown.d.ts | 6 + types/MultiSelect/MultiSelect.d.ts | 6 + types/Truncate/Truncate.d.ts | 16 ++ types/UIShell/SideNavDivider.d.ts | 11 ++ types/index.d.ts | 2 + yarn.lock | 16 +- 48 files changed, 729 insertions(+), 277 deletions(-) create mode 100644 actions/index.js create mode 100644 actions/truncate.js create mode 100644 docs/src/pages/components/Truncate.svx create mode 100644 src/Truncate/Truncate.svelte create mode 100644 src/Truncate/index.js create mode 100644 src/UIShell/SideNavDivider.svelte create mode 100644 tests/Truncate.test.svelte create mode 100644 types/Truncate/Truncate.d.ts create mode 100644 types/UIShell/SideNavDivider.d.ts diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 21aae8b5..8b970752 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -1,6 +1,6 @@ # Component Index -> 156 components exported from carbon-components-svelte@0.28.0. +> 158 components exported from carbon-components-svelte@0.28.0. ## Components @@ -107,6 +107,7 @@ - [`SelectSkeleton`](#selectskeleton) - [`SelectableTile`](#selectabletile) - [`SideNav`](#sidenav) +- [`SideNavDivider`](#sidenavdivider) - [`SideNavItems`](#sidenavitems) - [`SideNavLink`](#sidenavlink) - [`SideNavMenu`](#sidenavmenu) @@ -159,6 +160,7 @@ - [`Tooltip`](#tooltip) - [`TooltipDefinition`](#tooltipdefinition) - [`TooltipIcon`](#tooltipicon) +- [`Truncate`](#truncate) - [`UnorderedList`](#unorderedlist) --- @@ -609,6 +611,7 @@ export interface ComboBoxItem { | selectedIndex | let | Yes | number | -1 | Set the selected item by value index | | items | let | No | ComboBoxItem[] | [] | Set the combobox items | | itemToString | let | No | (item: ComboBoxItem) => string | (item) => item.text || item.id | Override the display of a combobox item | +| direction | let | No | "bottom" | "top" | "bottom" | Specify the direction of the combobox dropdown menu | | size | let | No | "sm" | "xl" | -- | Set the size of the combobox | | disabled | let | No | boolean | false | Set to `true` to disable the combobox | | titleText | let | No | string | "" | Specify the title text of the combobox | @@ -616,6 +619,8 @@ export interface ComboBoxItem { | helperText | let | No | string | "" | Specify the helper text | | invalidText | let | No | string | "" | Specify the invalid state text | | invalid | let | No | boolean | false | Set to `true` to indicate an invalid state | +| warn | let | No | boolean | false | Set to `true` to indicate an warning state | +| warnText | let | No | string | "" | Specify the warning state text | | light | let | No | boolean | false | Set to `true` to enable the light variant | | shouldFilterItem | let | No | (item: ComboBoxItem, value: string) => boolean | () => true | Determine if an item should be filtered given the current combobox value | | translateWithId | let | No | (id: any) => string | -- | Override the default translation ids | @@ -980,6 +985,7 @@ export interface DropdownItem { | items | let | No | DropdownItem[] | [] | Set the dropdown items | | itemToString | let | No | (item: DropdownItem) => string | (item) => item.text || item.id | Override the display of a dropdown item | | type | let | No | "default" | "inline" | "default" | Specify the type of dropdown | +| direction | let | No | "bottom" | "top" | "bottom" | Specify the direction of the dropdown menu | | size | let | No | "sm" | "lg" | "xl" | -- | Specify the size of the dropdown field | | light | let | No | boolean | false | Set to `true` to enable the light variant | | disabled | let | No | boolean | false | Set to `true` to disable the dropdown | @@ -2150,6 +2156,7 @@ export interface MultiSelectItem { | itemToString | let | No | (item: MultiSelectItem) => string | (item) => item.text || item.id | Override the display of a multiselect item | | size | let | No | "sm" | "lg" | "xl" | -- | Set the size of the combobox | | type | let | No | "default" | "inline" | "default" | Specify the type of multiselect | +| direction | let | No | "bottom" | "top" | "bottom" | Specify the direction of the multiselect dropdown menu | | selectionFeedback | let | No | "top" | "fixed" | "top-after-reopen" | "top-after-reopen" | Specify the selection feedback after selecting items | | disabled | let | No | boolean | false | Set to `true` to disable the dropdown | | filterable | let | No | boolean | false | Set to `true` to filter items | @@ -2988,6 +2995,20 @@ None. None. +## `SideNavDivider` + +### Props + +None. + +### Slots + +None. + +### Events + +None. + ## `SideNavItems` ### Props @@ -4261,6 +4282,24 @@ None. | mouseleave | forwarded | -- | | focus | forwarded | -- | +## `Truncate` + +### Props + +| Prop name | Kind | Reactive | Type | Default value | Description | +| :-------- | :--------------- | :------- | :-------------------------------- | ------------------ | ----------- | +| clamp | let | No | "end" | "front" | "end" | -- | + +### Slots + +| Slot name | Default | Props | Fallback | +| :-------- | :------ | :---- | :------- | +| -- | Yes | -- | -- | + +### Events + +None. + ## `UnorderedList` ### Props diff --git a/README.md b/README.md index 25e8f78e..a576e34f 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,6 @@ Using JavaScript: - ``` ## Preprocessors diff --git a/actions/index.js b/actions/index.js new file mode 100644 index 00000000..6a270efa --- /dev/null +++ b/actions/index.js @@ -0,0 +1 @@ +export { truncate } from "./truncate"; diff --git a/actions/truncate.js b/actions/truncate.js new file mode 100644 index 00000000..b886728b --- /dev/null +++ b/actions/truncate.js @@ -0,0 +1,25 @@ +/** + * Svelte action that applies single-line text truncation to an element + * @param {HTMLElement} node + * @param {{ clamp?: "end" | "front" }} params + * @example + * + * + *

...

+ *

...

+ */ +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"); + }, + }; +} diff --git a/css/all.scss b/css/all.scss index faa17656..07f58fd6 100644 --- a/css/all.scss +++ b/css/all.scss @@ -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: ( + // Custom CSS properties must be enabled to dynamically switch themes enable-css-custom-properties: true, ui-shell: true, grid-columns-16: true @@ -15,14 +19,30 @@ $css--plex: true; // Use all Carbon themes @import "carbon-components/scss/globals/scss/vendor/@carbon/themes/scss"; +// The default theme is "white" (White) :root { @include carbon--theme($carbon--theme--white, true); } + +// Set the theme attribute to "g10" to use the Gray 10 theme +// :root[theme="g10"] { @include carbon--theme($carbon--theme--g10, true); } + +// Set the theme attribute to "g90" to use the Gray 90 theme +// :root[theme="g90"] { @include carbon--theme($carbon--theme--g90, true); } + +// Set the theme attribute to "g100" to use the Gray 100 theme +// :root[theme="g100"] { @include carbon--theme($carbon--theme--g100, true); } -@import "carbon-components/scss/globals/scss/_css--reset.scss"; -@import "carbon-components/scss/globals/scss/_css--font-face.scss"; -@import "carbon-components/scss/globals/scss/_css--helpers.scss"; -@import "carbon-components/scss/globals/scss/_css--body.scss"; -@import "carbon-components/scss/globals/grid/_grid.scss"; -@import "carbon-components/scss/globals/scss/styles.scss"; \ No newline at end of file +// Programmatically update the theme in JavaScript: +// document.documentElement.setAttribute("theme", "g90"); + +@import "carbon-components/scss/globals/scss/_css--reset"; +@import "carbon-components/scss/globals/scss/_css--font-face"; +@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"; + diff --git a/css/g10.scss b/css/g10.scss index 452ad7a2..ebc3970d 100644 --- a/css/g10.scss +++ b/css/g10.scss @@ -17,9 +17,12 @@ $css--plex: true; $carbon--theme: $carbon--theme--g10; @include carbon--theme(); -@import "carbon-components/scss/globals/scss/_css--reset.scss"; -@import "carbon-components/scss/globals/scss/_css--font-face.scss"; -@import "carbon-components/scss/globals/scss/_css--helpers.scss"; -@import "carbon-components/scss/globals/scss/_css--body.scss"; -@import "carbon-components/scss/globals/grid/_grid.scss"; -@import "carbon-components/scss/globals/scss/styles.scss"; \ No newline at end of file +@import "carbon-components/scss/globals/scss/_css--reset"; +@import "carbon-components/scss/globals/scss/_css--font-face"; +@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"; + diff --git a/css/g100.scss b/css/g100.scss index 9eb38fea..0c148822 100644 --- a/css/g100.scss +++ b/css/g100.scss @@ -17,9 +17,11 @@ $css--plex: true; $carbon--theme: $carbon--theme--g100; @include carbon--theme(); -@import "carbon-components/scss/globals/scss/_css--reset.scss"; -@import "carbon-components/scss/globals/scss/_css--font-face.scss"; -@import "carbon-components/scss/globals/scss/_css--helpers.scss"; -@import "carbon-components/scss/globals/scss/_css--body.scss"; -@import "carbon-components/scss/globals/grid/_grid.scss"; -@import "carbon-components/scss/globals/scss/styles.scss"; \ No newline at end of file +@import "carbon-components/scss/globals/scss/_css--reset"; +@import "carbon-components/scss/globals/scss/_css--font-face"; +@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"; \ No newline at end of file diff --git a/css/g90.scss b/css/g90.scss index 5a28dbcc..7efb4c28 100644 --- a/css/g90.scss +++ b/css/g90.scss @@ -17,9 +17,11 @@ $css--plex: true; $carbon--theme: $carbon--theme--g90; @include carbon--theme(); -@import "carbon-components/scss/globals/scss/_css--reset.scss"; -@import "carbon-components/scss/globals/scss/_css--font-face.scss"; -@import "carbon-components/scss/globals/scss/_css--helpers.scss"; -@import "carbon-components/scss/globals/scss/_css--body.scss"; -@import "carbon-components/scss/globals/grid/_grid.scss"; -@import "carbon-components/scss/globals/scss/styles.scss"; \ No newline at end of file +@import "carbon-components/scss/globals/scss/_css--reset"; +@import "carbon-components/scss/globals/scss/_css--font-face"; +@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"; \ No newline at end of file diff --git a/css/white.scss b/css/white.scss index 2b1a12a5..a4e01a14 100644 --- a/css/white.scss +++ b/css/white.scss @@ -17,9 +17,11 @@ $css--plex: true; $carbon--theme: $carbon--theme--white; @include carbon--theme(); -@import "carbon-components/scss/globals/scss/_css--reset.scss"; -@import "carbon-components/scss/globals/scss/_css--font-face.scss"; -@import "carbon-components/scss/globals/scss/_css--helpers.scss"; -@import "carbon-components/scss/globals/scss/_css--body.scss"; -@import "carbon-components/scss/globals/grid/_grid.scss"; -@import "carbon-components/scss/globals/scss/styles.scss"; \ No newline at end of file +@import "carbon-components/scss/globals/scss/_css--reset"; +@import "carbon-components/scss/globals/scss/_css--font-face"; +@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"; \ No newline at end of file diff --git a/docs/package.json b/docs/package.json index 6d5fbdf4..fd6c270e 100644 --- a/docs/package.json +++ b/docs/package.json @@ -11,7 +11,7 @@ "devDependencies": { "@sveltech/routify": "^1.9.9", "autoprefixer": "^10.2.3", - "carbon-components": "10.28.0", + "carbon-components": "10.29.0", "carbon-components-svelte": "../", "clipboard-copy": "^3.1.0", "mdsvex": "^0.8.8", diff --git a/docs/src/App.svelte b/docs/src/App.svelte index 235e35fc..f465829f 100644 --- a/docs/src/App.svelte +++ b/docs/src/App.svelte @@ -6,7 +6,11 @@ diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index ac2406cc..34654213 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -1,5 +1,5 @@ { - "total": 156, + "total": 158, "components": [ { "moduleName": "Accordion", @@ -1189,6 +1189,16 @@ "constant": false, "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", "kind": "let", @@ -1258,6 +1268,26 @@ "constant": 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", "kind": "let", @@ -2290,6 +2320,16 @@ "constant": 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", "kind": "let", @@ -5142,6 +5182,16 @@ "constant": 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", "kind": "let", @@ -7733,6 +7783,15 @@ "typedefs": [], "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", "filePath": "src/UIShell/SideNav/SideNavItems.svelte", @@ -10635,6 +10694,25 @@ "typedefs": [], "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", "filePath": "src/UnorderedList/UnorderedList.svelte", diff --git a/docs/src/pages/components/ComboBox.svx b/docs/src/pages/components/ComboBox.svx index 42936b24..014769f0 100644 --- a/docs/src/pages/components/ComboBox.svx +++ b/docs/src/pages/components/ComboBox.svx @@ -30,6 +30,17 @@ items={[ +### Top direction + +Set `direction` to `"top"` for the combobox dropdown menu to appear above the input. + + + ### Light variant +### Invalid state + + + +### Warning state + + + ### Disabled +### Top direction + +Set `direction` to `"top"` for the dropdown menu to appear above the input. + + + ### Light variant +### Top direction + +Set `direction` to `"top"` for the dropdown menu to appear above the input. + + + ### Light variant +### Invalid step + + + + + + + +### Disabled steps + + + + + + + ### Spaced-equally diff --git a/docs/src/pages/components/RadioTile.svx b/docs/src/pages/components/RadioTile.svx index 34109335..263a8e23 100644 --- a/docs/src/pages/components/RadioTile.svx +++ b/docs/src/pages/components/RadioTile.svx @@ -24,13 +24,13 @@ components: ["TileGroup", "RadioTile"] ### Light variant - + Lite plan - + Standard plan - + Plus plan \ No newline at end of file diff --git a/docs/src/pages/components/Tag.svx b/docs/src/pages/components/Tag.svx index 04423048..193720e6 100644 --- a/docs/src/pages/components/Tag.svx +++ b/docs/src/pages/components/Tag.svx @@ -29,7 +29,11 @@ ### Filterable -Filterable +carbon-components + +### Filterable (small) + +carbon-components ### Custom icon diff --git a/docs/src/pages/components/Truncate.svx b/docs/src/pages/components/Truncate.svx new file mode 100644 index 00000000..41c0ce4a --- /dev/null +++ b/docs/src/pages/components/Truncate.svx @@ -0,0 +1,37 @@ + + + +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. + + + Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM. + + +### Clamp front + +Set `clamp` to `"front"` to clamp the text from the front. + + + Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM. + + +### use:truncate + +The `truncate` action can be used on other HTML elements. + +Import path: `import { truncate } from "carbon-components-svelte/actions";` + +

+ Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM. +

+

+ Carbon Components Svelte is a Svelte component library that implements the Carbon Design System, an open source design system by IBM. +

\ No newline at end of file diff --git a/docs/src/pages/framed/UIShell/HeaderNav.svelte b/docs/src/pages/framed/UIShell/HeaderNav.svelte index 1e229526..8035eb68 100644 --- a/docs/src/pages/framed/UIShell/HeaderNav.svelte +++ b/docs/src/pages/framed/UIShell/HeaderNav.svelte @@ -9,6 +9,7 @@ SideNavMenu, SideNavMenuItem, SideNavLink, + SideNavDivider, SkipToContent, Content, Grid, @@ -33,6 +34,7 @@ + @@ -46,6 +48,8 @@ + + diff --git a/docs/svelte.config.js b/docs/svelte.config.js index cad6f06f..fbf33fcb 100644 --- a/docs/svelte.config.js +++ b/docs/svelte.config.js @@ -38,6 +38,9 @@ function createImports(source) { const ccs_imports = Array.from(inlineComponents.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 ` + +

+ +

diff --git a/src/Truncate/index.js b/src/Truncate/index.js new file mode 100644 index 00000000..ae315be0 --- /dev/null +++ b/src/Truncate/index.js @@ -0,0 +1 @@ +export { default as Truncate } from "./Truncate.svelte"; diff --git a/src/UIShell/SideNavDivider.svelte b/src/UIShell/SideNavDivider.svelte new file mode 100644 index 00000000..26284398 --- /dev/null +++ b/src/UIShell/SideNavDivider.svelte @@ -0,0 +1 @@ +
  • diff --git a/src/UIShell/index.js b/src/UIShell/index.js index aba209bd..b91bd2d3 100644 --- a/src/UIShell/index.js +++ b/src/UIShell/index.js @@ -18,3 +18,4 @@ export { default as Content } from "./Content.svelte"; export { default as SkipToContent } from "./SkipToContent.svelte"; export { default as HeaderGlobalAction } from "./HeaderGlobalAction.svelte"; export { default as HeaderSearch } from "./HeaderSearch.svelte"; +export { default as SideNavDivider } from "./SideNavDivider.svelte"; diff --git a/src/index.js b/src/index.js index 07fa85c4..2217ff9f 100644 --- a/src/index.js +++ b/src/index.js @@ -114,6 +114,7 @@ export { ToggleSmall, ToggleSmallSkeleton } from "./ToggleSmall"; export { Tooltip } from "./Tooltip"; export { TooltipDefinition } from "./TooltipDefinition"; export { TooltipIcon } from "./TooltipIcon"; +export { Truncate } from "./Truncate"; export { Header, HeaderAction, @@ -131,6 +132,7 @@ export { SideNavLink, SideNavMenu, SideNavMenuItem, + SideNavDivider, Content, SkipToContent, HeaderGlobalAction, diff --git a/tests/ComboBox.test.svelte b/tests/ComboBox.test.svelte index 43d26446..d38b0344 100644 --- a/tests/ComboBox.test.svelte +++ b/tests/ComboBox.test.svelte @@ -10,6 +10,7 @@ - Lite plan - Standard plan - Plus plan + Lite plan + Standard plan + Plus plan diff --git a/tests/Truncate.test.svelte b/tests/Truncate.test.svelte new file mode 100644 index 00000000..35e90c8b --- /dev/null +++ b/tests/Truncate.test.svelte @@ -0,0 +1,23 @@ + + + + Carbon Components Svelte is a Svelte component library that implements the + Carbon Design System, an open source design system by IBM. + + + + Carbon Components Svelte is a Svelte component library that implements the + Carbon Design System, an open source design system by IBM. + + +

    + Carbon Components Svelte is a Svelte component library that implements the + Carbon Design System, an open source design system by IBM. +

    +

    + Carbon Components Svelte is a Svelte component library that implements the + Carbon Design System, an open source design system by IBM. +

    diff --git a/types/ComboBox/ComboBox.d.ts b/types/ComboBox/ComboBox.d.ts index cf86750d..af7529b7 100644 --- a/types/ComboBox/ComboBox.d.ts +++ b/types/ComboBox/ComboBox.d.ts @@ -32,6 +32,12 @@ export interface ComboBoxProps */ value?: string; + /** + * Specify the direction of the combobox dropdown menu + * @default "bottom" + */ + direction?: "bottom" | "top"; + /** * Set the size of the combobox */ @@ -73,6 +79,18 @@ export interface ComboBoxProps */ 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 * @default false diff --git a/types/Dropdown/Dropdown.d.ts b/types/Dropdown/Dropdown.d.ts index 74f632e1..91afec2e 100644 --- a/types/Dropdown/Dropdown.d.ts +++ b/types/Dropdown/Dropdown.d.ts @@ -36,6 +36,12 @@ export interface DropdownProps */ type?: "default" | "inline"; + /** + * Specify the direction of the dropdown menu + * @default "bottom" + */ + direction?: "bottom" | "top"; + /** * Specify the size of the dropdown field */ diff --git a/types/MultiSelect/MultiSelect.d.ts b/types/MultiSelect/MultiSelect.d.ts index 60b31afc..e2f52fb2 100644 --- a/types/MultiSelect/MultiSelect.d.ts +++ b/types/MultiSelect/MultiSelect.d.ts @@ -47,6 +47,12 @@ export interface MultiSelectProps */ type?: "default" | "inline"; + /** + * Specify the direction of the multiselect dropdown menu + * @default "bottom" + */ + direction?: "bottom" | "top"; + /** * Specify the selection feedback after selecting items * @default "top-after-reopen" diff --git a/types/Truncate/Truncate.d.ts b/types/Truncate/Truncate.d.ts new file mode 100644 index 00000000..9977769b --- /dev/null +++ b/types/Truncate/Truncate.d.ts @@ -0,0 +1,16 @@ +/// +import { SvelteComponentTyped } from "svelte"; + +export interface TruncateProps + extends svelte.JSX.HTMLAttributes { + /** + * @default "end" + */ + clamp?: "end" | "front"; +} + +export default class Truncate extends SvelteComponentTyped< + TruncateProps, + {}, + { default: {} } +> {} diff --git a/types/UIShell/SideNavDivider.d.ts b/types/UIShell/SideNavDivider.d.ts new file mode 100644 index 00000000..b880e27c --- /dev/null +++ b/types/UIShell/SideNavDivider.d.ts @@ -0,0 +1,11 @@ +/// +import { SvelteComponentTyped } from "svelte"; + +export interface SideNavDividerProps + extends svelte.JSX.HTMLAttributes {} + +export default class SideNavDivider extends SvelteComponentTyped< + SideNavDividerProps, + {}, + {} +> {} diff --git a/types/index.d.ts b/types/index.d.ts index e83f6b2e..9addddc7 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -133,6 +133,7 @@ export { default as ToggleSmallSkeleton } from "./ToggleSmall/ToggleSmallSkeleto export { default as Tooltip } from "./Tooltip/Tooltip"; export { default as TooltipDefinition } from "./TooltipDefinition/TooltipDefinition"; 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 HeaderAction } from "./UIShell/GlobalHeader/HeaderAction"; 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 SideNavMenu } from "./UIShell/SideNav/SideNavMenu"; 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 SkipToContent } from "./UIShell/SkipToContent"; export { default as HeaderGlobalAction } from "./UIShell/HeaderGlobalAction"; diff --git a/yarn.lock b/yarn.lock index c745867e..70cddc75 100644 --- a/yarn.lock +++ b/yarn.lock @@ -453,10 +453,10 @@ caniuse-lite@^1.0.30001181: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001183.tgz#7a57ba9d6584119bb5f2bc76d3cc47ba9356b3e2" integrity sha512-7JkwTEE1hlRKETbCFd8HDZeLiQIUcl8rC6JgNjvHCNaxOeNmQ9V4LvQXRUsKIV2CC73qKxljwVhToaA3kLRqTw== -carbon-components@10.28.0: - version "10.28.0" - resolved "https://registry.yarnpkg.com/carbon-components/-/carbon-components-10.28.0.tgz#c4d2b23df2559cf3b0226867c45e2e84e0af7c4e" - integrity sha512-bFsyngr625zc/t2gl4BPFYl0/ed4q38rrPihQxBXHhLAdeZNyy8xyOQlbh1PEQbTu47H/s/bxVo6QiFm/VmLZA== +carbon-components@10.29.0: + version "10.29.0" + resolved "https://registry.yarnpkg.com/carbon-components/-/carbon-components-10.29.0.tgz#9fd31f1a5cce4cb59a7196222e524d8442fd9026" + integrity sha512-y7BPEfwWxE1URTjrtHz4+rYQwB0u/e7WptlbTH2Lb/iqRYCe6T94u9EVZuq0ZZTpRUNRckbI1irt0AV3J/qlcA== dependencies: "@carbon/telemetry" "0.0.0-alpha.6" 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" integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw= -prettier-plugin-svelte@^2.1.1: - version "2.1.1" - resolved "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-2.1.1.tgz#e6613cac4292b5bbda5250680565c131b0da5ced" - integrity sha512-U0gRsdJtveyusHd86OUPD+lEVd13bHPPF/CZD/csKjz0Y+Cv4WbUy9x8tA5vaHFtf0tsu8Yb1MrfuhN3GH2gig== +prettier-plugin-svelte@^2.1.5: + version "2.1.5" + resolved "https://registry.yarnpkg.com/prettier-plugin-svelte/-/prettier-plugin-svelte-2.1.5.tgz#cb1df2bffafa0562f05e02c6e9373806ef51ebb1" + integrity sha512-7ySuC/n0Rk8v6GrzoruojfLYde6ncjeFCAA65Dm+fXrK2Mgc3FlvzXMPpm//P3LgfEoc3zMEG/xog1YeoNhdSQ== prettier@^2.2.1: version "2.2.1"