carbon-components-svelte 0.93.1 → 0.93.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-components-svelte",
3
- "version": "0.93.1",
3
+ "version": "0.93.2",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Svelte implementation of the Carbon Design System",
6
6
  "type": "module",
@@ -15,6 +15,11 @@
15
15
  */
16
16
  const overflowVisible = writable(false);
17
17
 
18
+ /**
19
+ * @type {import("svelte/store").Writable<boolean>}
20
+ */
21
+ const batchActionsActive = writable(false);
22
+
18
23
  /**
19
24
  * @type {(visible: boolean) => void}
20
25
  */
@@ -26,6 +31,7 @@
26
31
  setContext("Toolbar", {
27
32
  overflowVisible,
28
33
  setOverflowVisible,
34
+ batchActionsActive,
29
35
  });
30
36
  </script>
31
37
 
@@ -82,6 +82,10 @@
82
82
  });
83
83
  }
84
84
 
85
+ $: if (ctxToolbar?.batchActionsActive) {
86
+ ctxToolbar.batchActionsActive.set(showActions);
87
+ }
88
+
85
89
  onMount(() => {
86
90
  return () => {
87
91
  unsubscribe?.();
@@ -1,18 +1,17 @@
1
1
  <script>
2
2
  import { getContext } from "svelte";
3
3
 
4
- const ctx = getContext("DataTable") ?? {};
4
+ const ctx = getContext("Toolbar") ?? {};
5
5
 
6
- let batchSelectedIds = [];
6
+ let batchActionsActive = false;
7
7
 
8
- if (ctx?.batchSelectedIds) {
9
- ctx.batchSelectedIds.subscribe((value) => {
10
- batchSelectedIds = value;
8
+ if (ctx?.batchActionsActive) {
9
+ ctx.batchActionsActive.subscribe((value) => {
10
+ batchActionsActive = value;
11
11
  });
12
12
  }
13
13
 
14
- $: hasBatchSelection = batchSelectedIds.length > 0;
15
- $: inertProps = hasBatchSelection ? { inert: true } : {};
14
+ $: inertProps = batchActionsActive ? { inert: true } : {};
16
15
  </script>
17
16
 
18
17
  <div class:bx--toolbar-content={true} {...inertProps}>
@@ -4,6 +4,7 @@ import type { SvelteHTMLElements } from "svelte/elements";
4
4
  export type ToolbarContext = {
5
5
  overflowVisible: import("svelte/store").Writable<boolean>;
6
6
  setOverflowVisible: (visible: boolean) => void;
7
+ batchActionsActive: import("svelte/store").Writable<boolean>;
7
8
  };
8
9
 
9
10
  type $RestProps = SvelteHTMLElements["section"];