@invopop/popui 0.0.7 → 0.0.9

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.
@@ -151,27 +151,32 @@ function selectRange(to) {
151
151
  }}
152
152
  />
153
153
 
154
- <div class="w-full rounded-md md:border border-neutral-100 font-sans">
155
- <table class="hidden md:table w-full rounded-md">
154
+ <div class="w-full font-sans">
155
+ <table class="hidden md:table w-full">
156
156
  <thead>
157
157
  <tr class="border-b border-neutral-100 relative">
158
158
  {#if selectable}
159
159
  <!-- if table is selectable we need to add an extra header with a checkbox -->
160
- <th scope="col" class="bg-white sticky top-0 z-10 rounded-tr-md pl-1.5">
160
+ <th scope="col" class="bg-white sticky top-0 z-10 rounded-tr-md">
161
161
  {#if !hideSelectAll}
162
- <InputCheckbox
163
- checked={allChecked}
164
- {indeterminate}
165
- on:change={(event) => {
166
- toggleAllSelected(event.detail)
167
- }}
168
- />
162
+ <!-- svelte-ignore a11y-click-events-have-key-events -->
163
+ <!-- svelte-ignore a11y-label-has-associated-control -->
164
+ <!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
165
+ <label class="pl-5 pr-3 h-[40px] flex items-center" on:click|stopPropagation>
166
+ <InputCheckbox
167
+ checked={allChecked}
168
+ {indeterminate}
169
+ on:change={(event) => {
170
+ toggleAllSelected(event.detail)
171
+ }}
172
+ />
173
+ </label>
169
174
  {/if}
170
175
  </th>
171
176
  {/if}
172
177
  {#each fields as field, i (i)}
173
178
  <BaseTableHeader
174
- isFirst={i === 0}
179
+ isFirst={i === 0 && !selectable}
175
180
  isLast={!addExtraCell && i === fields.length - 1}
176
181
  {sortBy}
177
182
  {sortDirection}
@@ -191,8 +196,8 @@ function selectRange(to) {
191
196
  <tr>
192
197
  <th
193
198
  scope="colgroup"
194
- colspan={fields.length + 1}
195
- class="bg-neutral-50 px-3 py-1.5 text-left text-sm font-medium text-neutral-500 sticky top-11 tracking-normal border-t border-b border-neutral-100 h-8"
199
+ colspan={fields.length + (selectable ? 2 : 1)}
200
+ class="bg-neutral-50 px-5 text-left text-sm font-medium text-neutral-500 sticky top-11 tracking-normal border-t border-b border-neutral-100 h-8"
196
201
  >
197
202
  <span>{group.label}</span>
198
203
  {#if !hideCounter}
@@ -261,7 +266,6 @@ function selectRange(to) {
261
266
  {#each fields as field, i (i)}
262
267
  <BaseTableCell
263
268
  tag="div"
264
- currentIndex={i}
265
269
  {field}
266
270
  badge={field.helperBadge ? field.helperBadge(row) : null}
267
271
  status={field.helperStatus ? field.helperStatus(row) : null}
@@ -17,6 +17,7 @@ declare const __propDef: {
17
17
  hideSelectAll?: boolean | undefined;
18
18
  };
19
19
  events: {
20
+ click: MouseEvent;
20
21
  orderBy: CustomEvent<any>;
21
22
  action: CustomEvent<any>;
22
23
  copied: CustomEvent<any>;
@@ -7,23 +7,30 @@ import { getCountryName } from "./helpers.js";
7
7
  import UuidCopy from "./UuidCopy.svelte";
8
8
  import { Icon } from "@steeze-ui/svelte-icon";
9
9
  export let field;
10
- export let currentIndex;
10
+ export let isFirst = false;
11
+ export let isLast = false;
11
12
  export let badge = null;
12
13
  export let status = null;
13
14
  export let icons = null;
14
15
  export let data = "";
15
16
  export let freeWrap = false;
16
17
  export let tag = "td";
18
+ export let selectable = false;
19
+ export let hasActions = false;
17
20
  $:
18
21
  cellStyles = clsx(
19
22
  { "tabular-nums slashed-zero lining-nums": field.monospacedNums },
20
23
  { "font-mono": field.monospaced },
21
- { "text-neutral-800 font-medium": currentIndex === 0 && !field.grayed },
22
- { "text-neutral-800 md:text-neutral-500": currentIndex > 0 || field.grayed },
24
+ { "text-neutral-800 font-medium": isFirst && !field.grayed },
25
+ { "text-neutral-800 md:text-neutral-500": !isFirst || field.grayed },
23
26
  { "md:text-right": field.rightAlign },
24
27
  { "md:w-full md:max-w-0": field.fullWidth },
25
28
  { "py-2 md:py-[11.25px]": badge },
26
29
  { "py-2 md:py-[11.75px]": !badge },
30
+ { "pl-5": isFirst && !selectable },
31
+ { "pl-3": !isFirst || selectable },
32
+ { "pr-5": isLast && !hasActions },
33
+ { "pr-3": !isLast || hasActions },
27
34
  { "px-3": !field.noPadding },
28
35
  { "px-0": field.noPadding },
29
36
  { "whitespace-nowrap truncate": !freeWrap }
@@ -3,13 +3,16 @@ import type { Badge, FeedItemStatus, TableField, TableIcon } from './types.js';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  field: TableField;
6
- currentIndex: number;
6
+ isFirst?: boolean | undefined;
7
+ isLast?: boolean | undefined;
7
8
  badge?: Badge | null | undefined;
8
9
  status?: FeedItemStatus | null | undefined;
9
10
  icons?: TableIcon[] | null | undefined;
10
11
  data?: unknown;
11
12
  freeWrap?: boolean | undefined;
12
13
  tag?: string | undefined;
14
+ selectable?: boolean | undefined;
15
+ hasActions?: boolean | undefined;
13
16
  };
14
17
  events: {
15
18
  copied: CustomEvent<any>;
@@ -11,14 +11,16 @@ export let isFirst = false;
11
11
  export let isLast = false;
12
12
  $:
13
13
  outerStyles = clsx({
14
- "w-full": field.fullWidth,
15
- "rounded-tl-md": isFirst,
16
- "rounded-tr-md": isLast
14
+ "w-full": field.fullWidth
17
15
  });
18
16
  $:
19
17
  headerStyles = clsx({
20
18
  "justify-end": field.rightAlign,
21
- "hover:bg-neutral-50 focus:bg-neutral-100": field.sortable
19
+ "hover:bg-neutral-50 focus:bg-neutral-100": field.sortable,
20
+ "pl-5": isFirst,
21
+ "pl-3": !isFirst,
22
+ "pr-5": isLast,
23
+ "pr-3": !isLast
22
24
  });
23
25
  function handleSortBy(event) {
24
26
  sortDirection = event.detail;
@@ -38,7 +40,7 @@ function handleSortBy(event) {
38
40
  <BaseDropdown bind:this={sortDropdown} fullWidth>
39
41
  <span
40
42
  slot="trigger"
41
- class="{headerStyles} w-full p-3 flex items-center justify-start space-x-1 text-left text-base tracking-normal whitespace-nowrap font-normal"
43
+ class="{headerStyles} w-full py-3 flex items-center justify-start space-x-1 text-left text-base tracking-normal whitespace-nowrap font-normal"
42
44
  >
43
45
  <span>{field.headerLabel}</span>
44
46
  {#if sortBy === field.slug}
@@ -35,20 +35,28 @@ $:
35
35
  }}
36
36
  >
37
37
  {#if selectable}
38
- <td class="pl-1.5">
39
- <InputCheckbox
40
- {checked}
41
- on:change={(event) => {
42
- dispatch('checked', event.detail)
43
- }}
44
- />
38
+ <td>
39
+ <!-- svelte-ignore a11y-click-events-have-key-events -->
40
+ <!-- svelte-ignore a11y-label-has-associated-control -->
41
+ <!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
42
+ <label class="pl-5 pr-1.5 h-[40px] flex items-center" on:click|stopPropagation>
43
+ <InputCheckbox
44
+ {checked}
45
+ on:change={(event) => {
46
+ dispatch('checked', event.detail)
47
+ }}
48
+ />
49
+ </label>
45
50
  </td>
46
51
  {/if}
47
52
  {#each fields as field, i (i)}
48
53
  <BaseTableCell
49
- currentIndex={i}
54
+ isFirst={i === 0}
55
+ isLast={i === fields.length - 1}
50
56
  {field}
51
57
  {freeWrap}
58
+ {selectable}
59
+ hasActions={!!actions.length}
52
60
  badge={field.helperBadge ? field.helperBadge(row) : null}
53
61
  status={field.helperStatus ? field.helperStatus(row) : null}
54
62
  icons={field.helperIcons ? field.helperIcons(row) : null}
@@ -57,7 +65,7 @@ $:
57
65
  />
58
66
  {/each}
59
67
  {#if actions.length}
60
- <td class="pl-1 pr-3">
68
+ <td class="pl-1 pr-5">
61
69
  <BaseTableActions
62
70
  bind:this={actionsDropdown}
63
71
  {actions}
@@ -17,7 +17,7 @@ function updateInput(event) {
17
17
  type="checkbox"
18
18
  {checked}
19
19
  {indeterminate}
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"
20
+ class="form-checkbox w-5 h-5 text-workspace-accent focus:text-workspace-accent rounded border border-neutral-200 hover:border-neutral-300 focus:ring-0 focus:ring-offset-0"
21
21
  on:change={updateInput}
22
22
  on:click|stopPropagation
23
23
  />
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@invopop/popui",
3
3
  "license": "MIT",
4
- "version": "0.0.7",
4
+ "version": "0.0.9",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
7
7
  "build": "vite build && npm run package",