@invopop/popui 0.0.5 → 0.0.6

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.
@@ -29,6 +29,10 @@ $:
29
29
  groupedData = groupData(data);
30
30
  $:
31
31
  addExtraCell = getActions instanceof Function;
32
+ $:
33
+ indeterminate = selectedRows.length > 0 && selectedRows.length < data.length;
34
+ $:
35
+ allChecked = selectedRows.length === data.length;
32
36
  function groupData(rows) {
33
37
  if (rows.length === 0)
34
38
  return [];
@@ -69,6 +73,8 @@ function toggleAllSelected(selected) {
69
73
  <!-- if table is selectable we need to add an extra header with a checkbox -->
70
74
  <th scope="col" class="bg-white sticky top-0 z-10 rounded-tr-md pl-1.5">
71
75
  <InputCheckbox
76
+ checked={allChecked}
77
+ {indeterminate}
72
78
  on:change={(event) => {
73
79
  toggleAllSelected(event.detail)
74
80
  }}
@@ -1,6 +1,7 @@
1
1
  <script>import { createEventDispatcher } from "svelte";
2
2
  import { dispatchWcEvent } from "./wcdispatch.js";
3
3
  export let checked = false;
4
+ export let indeterminate = false;
4
5
  const dispatch = createEventDispatcher();
5
6
  function updateInput(event) {
6
7
  if (event instanceof CustomEvent)
@@ -15,6 +16,7 @@ function updateInput(event) {
15
16
  <input
16
17
  type="checkbox"
17
18
  {checked}
19
+ {indeterminate}
18
20
  class="form-checkbox w-5 h-5 text-workspace-accent focus:text-workspace-accent rounded border border-neutral-200 focus:ring-0 focus:ring-offset-0"
19
21
  on:change={updateInput}
20
22
  on:click|stopPropagation
@@ -2,6 +2,7 @@ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  checked?: boolean | undefined;
5
+ indeterminate?: boolean | undefined;
5
6
  };
6
7
  events: {
7
8
  click: MouseEvent;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@invopop/popui",
3
3
  "license": "MIT",
4
- "version": "0.0.5",
4
+ "version": "0.0.6",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
7
7
  "build": "vite build && npm run package",