From 924b6d352eebf5c82da63f0ead450dc59e80ca30 Mon Sep 17 00:00:00 2001 From: tlkh40 <72644753+tlkh40@users.noreply.github.com> Date: Wed, 29 Jun 2022 21:08:51 +0700 Subject: [PATCH 001/732] fix(notification): `on:close` should be cancellable (#1379) Fixes #927 --- src/Notification/InlineNotification.svelte | 10 ++++++++-- src/Notification/ToastNotification.svelte | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Notification/InlineNotification.svelte b/src/Notification/InlineNotification.svelte index 19cb0588..4cd57717 100644 --- a/src/Notification/InlineNotification.svelte +++ b/src/Notification/InlineNotification.svelte @@ -40,8 +40,14 @@ let timeoutId = undefined; function close(closeFromTimeout) { - open = false; - dispatch("close", { timeout: closeFromTimeout === true }); + const shouldContinue = dispatch( + "close", + { timeout: closeFromTimeout === true }, + { cancelable: true } + ); + if (shouldContinue) { + open = false; + } } onMount(() => { diff --git a/src/Notification/ToastNotification.svelte b/src/Notification/ToastNotification.svelte index ff60b6c7..1d00ba4e 100644 --- a/src/Notification/ToastNotification.svelte +++ b/src/Notification/ToastNotification.svelte @@ -43,8 +43,14 @@ let timeoutId = undefined; function close(closeFromTimeout) { - open = false; - dispatch("close", { timeout: closeFromTimeout === true }); + const shouldContinue = dispatch( + "close", + { timeout: closeFromTimeout === true }, + { cancelable: true } + ); + if (shouldContinue) { + open = false; + } } onMount(() => { From 04f18ae5e99527fb6cb247af41d3d05e051acd08 Mon Sep 17 00:00:00 2001 From: metonym Date: Wed, 29 Jun 2022 10:14:22 -0700 Subject: [PATCH 002/732] docs(notification): add examples "Prevent default close behavior" (#1380) Follow-up to #1379 --- .../src/pages/components/InlineNotification.svx | 15 +++++++++++++++ docs/src/pages/components/ToastNotification.svx | 17 ++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/docs/src/pages/components/InlineNotification.svx b/docs/src/pages/components/InlineNotification.svx index 98b461d4..d976ee49 100644 --- a/docs/src/pages/components/InlineNotification.svx +++ b/docs/src/pages/components/InlineNotification.svx @@ -11,6 +11,21 @@ source: Notification/InlineNotification.svelte +### Prevent default close behavior + +`InlineNotification` is a controlled component. Prevent the default close behavior using the `e.preventDefault()` method in the dispatched `on:close` event. + + +
+ Svelte version 3.48.0 or greater is required. +
+
+ + { + e.preventDefault(); + // custom close logic (e.g., transitions) +}} /> + ### Slottable title, subtitle diff --git a/docs/src/pages/components/ToastNotification.svx b/docs/src/pages/components/ToastNotification.svx index 80ddaed4..a430fb8e 100644 --- a/docs/src/pages/components/ToastNotification.svx +++ b/docs/src/pages/components/ToastNotification.svx @@ -3,7 +3,7 @@ source: Notification/ToastNotification.svelte --- @@ -11,6 +11,21 @@ source: Notification/ToastNotification.svelte +### Prevent default close behavior + +`ToastNotification` is a controlled component. Prevent the default close behavior using the `e.preventDefault()` method in the dispatched `on:close` event. + + +
+ Svelte version 3.48.0 or greater is required. +
+
+ + { + e.preventDefault(); + // custom close logic (e.g., transitions) +}} /> + ### Slottable title, subtitle, caption From 5fa07ab44bd8eed1a88ee66a8c1f46b1aa33c31d Mon Sep 17 00:00:00 2001 From: metonym Date: Wed, 29 Jun 2022 10:18:24 -0700 Subject: [PATCH 003/732] v0.66.2 --- CHANGELOG.md | 11 +++++++++++ COMPONENT_INDEX.md | 2 +- package.json | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3edf04fd..26f11728 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 +## [0.66.2](https://github.com/carbon-design-system/carbon-components-svelte/releases/tag/v0.66.2) - 2022-06-29 + +**Fixes** + +- allow close event in `ToastNotification`, `InlineNotification` to be cancellable + +**Documentation** + +- add `ToastNotification` example "Prevent default close behavior" +- add `InlineNotification` example "Prevent default close behavior" + ## [0.66.1](https://github.com/carbon-design-system/carbon-components-svelte/releases/tag/v0.66.1) - 2022-06-27 **Fixes** diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 134d599c..29f08e56 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -1,6 +1,6 @@ # Component Index -> 165 components exported from carbon-components-svelte@0.66.1. +> 165 components exported from carbon-components-svelte@0.66.2. ## Components diff --git a/package.json b/package.json index 9e764287..e6793100 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "carbon-components-svelte", - "version": "0.66.1", + "version": "0.66.2", "license": "Apache-2.0", "description": "Svelte implementation of the Carbon Design System", "svelte": "./src/index.js", From 052acfc2cebb1c011046f253d97748a720af4e45 Mon Sep 17 00:00:00 2001 From: metonym Date: Wed, 29 Jun 2022 10:57:37 -0700 Subject: [PATCH 004/732] Revert "fix(notification): `on:close` should be cancellable (#1379)" (#1381) This reverts commit 924b6d352eebf5c82da63f0ead450dc59e80ca30. --- src/Notification/InlineNotification.svelte | 10 ++-------- src/Notification/ToastNotification.svelte | 10 ++-------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/Notification/InlineNotification.svelte b/src/Notification/InlineNotification.svelte index 4cd57717..19cb0588 100644 --- a/src/Notification/InlineNotification.svelte +++ b/src/Notification/InlineNotification.svelte @@ -40,14 +40,8 @@ let timeoutId = undefined; function close(closeFromTimeout) { - const shouldContinue = dispatch( - "close", - { timeout: closeFromTimeout === true }, - { cancelable: true } - ); - if (shouldContinue) { - open = false; - } + open = false; + dispatch("close", { timeout: closeFromTimeout === true }); } onMount(() => { diff --git a/src/Notification/ToastNotification.svelte b/src/Notification/ToastNotification.svelte index 1d00ba4e..ff60b6c7 100644 --- a/src/Notification/ToastNotification.svelte +++ b/src/Notification/ToastNotification.svelte @@ -43,14 +43,8 @@ let timeoutId = undefined; function close(closeFromTimeout) { - const shouldContinue = dispatch( - "close", - { timeout: closeFromTimeout === true }, - { cancelable: true } - ); - if (shouldContinue) { - open = false; - } + open = false; + dispatch("close", { timeout: closeFromTimeout === true }); } onMount(() => { From f08175b6b30df87b870a535b31648250a1d9f98e Mon Sep 17 00:00:00 2001 From: metonym Date: Wed, 29 Jun 2022 10:59:45 -0700 Subject: [PATCH 005/732] v0.66.3 --- CHANGELOG.md | 6 ++++++ COMPONENT_INDEX.md | 2 +- package.json | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26f11728..9547a0de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 +## [0.66.3](https://github.com/carbon-design-system/carbon-components-svelte/releases/tag/v0.66.3) - 2022-06-29 + +**Fixes** + +- revert [924b6d35](924b6d352eebf5c82da63f0ead450dc59e80ca30) and re-publish since v0.66.2 contains breaking changes + ## [0.66.2](https://github.com/carbon-design-system/carbon-components-svelte/releases/tag/v0.66.2) - 2022-06-29 **Fixes** diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 29f08e56..87bed391 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -1,6 +1,6 @@ # Component Index -> 165 components exported from carbon-components-svelte@0.66.2. +> 165 components exported from carbon-components-svelte@0.66.3. ## Components diff --git a/package.json b/package.json index e6793100..e03775c2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "carbon-components-svelte", - "version": "0.66.2", + "version": "0.66.3", "license": "Apache-2.0", "description": "Svelte implementation of the Carbon Design System", "svelte": "./src/index.js", From aee7f3ba765793b0615a0bc1f172e5f60110146a Mon Sep 17 00:00:00 2001 From: metonym Date: Wed, 29 Jun 2022 11:11:33 -0700 Subject: [PATCH 006/732] Revert "Revert "fix(notification): `on:close` should be cancellable (#1379)" (#1381)" (#1382) This reverts commit 052acfc2cebb1c011046f253d97748a720af4e45. --- src/Notification/InlineNotification.svelte | 10 ++++++++-- src/Notification/ToastNotification.svelte | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Notification/InlineNotification.svelte b/src/Notification/InlineNotification.svelte index 19cb0588..4cd57717 100644 --- a/src/Notification/InlineNotification.svelte +++ b/src/Notification/InlineNotification.svelte @@ -40,8 +40,14 @@ let timeoutId = undefined; function close(closeFromTimeout) { - open = false; - dispatch("close", { timeout: closeFromTimeout === true }); + const shouldContinue = dispatch( + "close", + { timeout: closeFromTimeout === true }, + { cancelable: true } + ); + if (shouldContinue) { + open = false; + } } onMount(() => { diff --git a/src/Notification/ToastNotification.svelte b/src/Notification/ToastNotification.svelte index ff60b6c7..1d00ba4e 100644 --- a/src/Notification/ToastNotification.svelte +++ b/src/Notification/ToastNotification.svelte @@ -43,8 +43,14 @@ let timeoutId = undefined; function close(closeFromTimeout) { - open = false; - dispatch("close", { timeout: closeFromTimeout === true }); + const shouldContinue = dispatch( + "close", + { timeout: closeFromTimeout === true }, + { cancelable: true } + ); + if (shouldContinue) { + open = false; + } } onMount(() => { From f59daa20a2cb29252504ab891f28ee05d2dc0c22 Mon Sep 17 00:00:00 2001 From: metonym Date: Wed, 29 Jun 2022 11:49:23 -0700 Subject: [PATCH 007/732] docs: specify minimum Svelte version requirement --- README.md | 2 ++ docs/src/pages/index.svelte | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 003757a5..f6579eee 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,8 @@ Other forms of documentation are auto-generated: Install `carbon-components-svelte` as a development dependency. +A minimum Svelte version of 3.48.0 is required to use this library. + ```sh # Yarn yarn add -D carbon-components-svelte diff --git a/docs/src/pages/index.svelte b/docs/src/pages/index.svelte index 5dc4726b..d439f9f1 100644 --- a/docs/src/pages/index.svelte +++ b/docs/src/pages/index.svelte @@ -12,6 +12,7 @@ OutboundLink, RadioButtonGroup, RadioButton, + InlineNotification, } from "carbon-components-svelte"; import TileCard from "../components/TileCard.svelte"; import { theme } from "../store"; @@ -89,8 +90,15 @@ - -

Installation

+ +

Installation

+
From 2fedd6343f4fa0da66fb9e0feba1911e9303cb0f Mon Sep 17 00:00:00 2001 From: metonym Date: Wed, 29 Jun 2022 11:50:25 -0700 Subject: [PATCH 008/732] v0.67.0 --- CHANGELOG.md | 8 ++++++++ COMPONENT_INDEX.md | 2 +- package.json | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9547a0de..e89ff162 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 +## [0.67.0](https://github.com/carbon-design-system/carbon-components-svelte/releases/tag/v0.67.0) - 2022-06-29 + +**Breaking Changes** + +Svelte version >=3.48.0 is required. + +- re-revert [924b6d35](924b6d352eebf5c82da63f0ead450dc59e80ca30) to allow close event in `ToastNotification`, `InlineNotification` to be cancellable + ## [0.66.3](https://github.com/carbon-design-system/carbon-components-svelte/releases/tag/v0.66.3) - 2022-06-29 **Fixes** diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index 87bed391..2e88611c 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -1,6 +1,6 @@ # Component Index -> 165 components exported from carbon-components-svelte@0.66.3. +> 165 components exported from carbon-components-svelte@0.67.0. ## Components diff --git a/package.json b/package.json index e03775c2..7aca2f38 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "carbon-components-svelte", - "version": "0.66.3", + "version": "0.67.0", "license": "Apache-2.0", "description": "Svelte implementation of the Carbon Design System", "svelte": "./src/index.js", From 638a43714fdeb55b696a64f96b291f43af7374fe Mon Sep 17 00:00:00 2001 From: metonym Date: Tue, 12 Jul 2022 19:43:45 -0700 Subject: [PATCH 009/732] fix(side-nav): set high `z-index` on open overlay (#1388) Fixes #786 The UI Shell `SideNav` overlay can sometimes be superseded by other elements. This applies a `z-index` value of `6000` to the overlay when open. --- src/UIShell/SideNav.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/src/UIShell/SideNav.svelte b/src/UIShell/SideNav.svelte index 30aad9b3..6dbadb32 100644 --- a/src/UIShell/SideNav.svelte +++ b/src/UIShell/SideNav.svelte @@ -56,6 +56,7 @@ }}" class:bx--side-nav__overlay="{true}" class:bx--side-nav__overlay-active="{isOpen}" + style="{isOpen && 'z-index: 6000'}" > {/if}