@invopop/popui 0.0.32 → 0.0.34

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.
@@ -10,7 +10,7 @@ $:
10
10
  </script>
11
11
 
12
12
  <div
13
- class="{styles} inline-flex items-center justify-center rounded p-[3px] text-neutral-500 text-sm font-medium h-4 min-w-[16px] tracking-wide tabular-nums slashed-zero lining-nums"
13
+ class="{styles} inline-flex items-center justify-center rounded p-1 text-neutral-500 text-sm font-medium h-4 min-w-[16px] tracking-wide tabular-nums slashed-zero lining-nums box-border"
14
14
  >
15
15
  {content}
16
16
  </div>
@@ -198,59 +198,71 @@ function handleKeydown(event) {
198
198
  <div class="w-full font-sans">
199
199
  <table class="hidden md:table w-full">
200
200
  <thead>
201
- <tr class="border-b border-neutral-100 relative">
201
+ <tr class="relative">
202
202
  {#if selectable}
203
203
  <!-- if table is selectable we need to add an extra header with a checkbox -->
204
- <th scope="col" class="bg-white sticky top-0 z-10 rounded-tr-md">
205
- {#if !hideSelectAll}
206
- <button
207
- class="pl-5 pr-3 h-[40px] flex items-center outline-none group cursor-default"
208
- on:click|stopPropagation={() => {
209
- toggleAllSelected(!selectedRows.length)
210
- }}
211
- >
212
- <div class:invisible={!selectedRows.length} class="group-hover:visible">
213
- <InputCheckbox
214
- checked={allChecked}
215
- {indeterminate}
216
- on:change={(event) => {
217
- toggleAllSelected(event.detail)
218
- }}
219
- />
220
- </div>
221
- </button>
222
- {/if}
204
+ <th scope="col" class="bg-white sticky top-0 z-10 p-0">
205
+ <div class="border-b border-neutral-100">
206
+ {#if !hideSelectAll}
207
+ <button
208
+ class="px-5 h-[36px] flex items-center outline-none group cursor-default"
209
+ on:click|stopPropagation={() => {
210
+ toggleAllSelected(!selectedRows.length)
211
+ }}
212
+ >
213
+ <div class:invisible={!selectedRows.length} class="group-hover:visible">
214
+ <InputCheckbox
215
+ checked={allChecked}
216
+ {indeterminate}
217
+ on:change={(event) => {
218
+ toggleAllSelected(event.detail)
219
+ }}
220
+ />
221
+ </div>
222
+ </button>
223
+ {/if}
224
+ </div>
223
225
  </th>
224
226
  {/if}
225
227
  {#each fields as field, i (i)}
226
228
  <BaseTableHeader
227
- isFirst={i === 0 && !selectable}
229
+ isFirst={i === 0}
228
230
  isLast={!addExtraCell && i === fields.length - 1}
229
231
  {sortBy}
230
232
  {sortDirection}
231
233
  {field}
234
+ {selectable}
232
235
  on:orderBy
233
236
  />
234
237
  {/each}
235
238
  {#if addExtraCell}
236
239
  <!-- if table has actions cell we need to add an extra header -->
237
- <th scope="col" class="bg-white sticky top-0 z-10 rounded-tr-md" />
240
+ <th scope="col" class="bg-white sticky top-0 z-10 rounded-tr-md">
241
+ <div class="border-b border-neutral-100 h-9" />
242
+ </th>
238
243
  {/if}
239
244
  </tr>
240
245
  </thead>
241
246
  <tbody>
242
- {#each groupedData as group}
247
+ {#each groupedData as group, i (i)}
243
248
  {#if group.label}
244
249
  <tr>
245
250
  <th
246
251
  scope="colgroup"
247
252
  colspan={fields.length + (selectable ? 2 : 1)}
248
- 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"
253
+ class="bg-white text-left text-sm font-medium text-neutral-500 sticky top-9 tracking-normal h-8"
249
254
  >
250
- <span>{group.label}</span>
251
- {#if !hideCounter}
252
- <BaseCounter content={group.rows.length} />
253
- {/if}
255
+ <span
256
+ class:border-t={i > 0}
257
+ class:pl-14={selectable}
258
+ class:pl-5={!selectable}
259
+ class="flex items-center space-x-1 box-border border-b border-neutral-100 h-8"
260
+ >
261
+ <span>{group.label}</span>
262
+ {#if !hideCounter}
263
+ <BaseCounter content={group.rows.length} />
264
+ {/if}
265
+ </span>
254
266
  </th>
255
267
  </tr>
256
268
  {/if}
@@ -265,7 +277,9 @@ function handleKeydown(event) {
265
277
  {selectedRows}
266
278
  {selectedTrackedBy}
267
279
  {selectionMode}
268
- selected={lastSelected && row[selectedTrackedBy] === lastSelected[selectedTrackedBy]}
280
+ selected={selectable &&
281
+ lastSelected &&
282
+ row[selectedTrackedBy] === lastSelected[selectedTrackedBy]}
269
283
  on:click={() => {
270
284
  if (disableRowClick) return
271
285
 
@@ -17,6 +17,8 @@ export let freeWrap = false;
17
17
  export let tag = "td";
18
18
  export let selectable = false;
19
19
  export let hasActions = false;
20
+ $:
21
+ isSelectableFirst = isFirst && selectable;
20
22
  $:
21
23
  cellStyles = clsx(
22
24
  { "tabular-nums slashed-zero lining-nums": field.monospacedNums },
@@ -25,13 +27,11 @@ $:
25
27
  { "text-neutral-800 md:text-neutral-500": !isFirst || field.grayed },
26
28
  { "md:text-right": field.rightAlign },
27
29
  { "md:w-full md:max-w-0": field.fullWidth },
28
- { "py-2 md:py-[11.25px]": badge },
29
- { "py-2 md:py-[11.75px]": !badge },
30
30
  { "pl-5": isFirst && !selectable },
31
- { "pl-3": !isFirst || selectable },
31
+ { "pl-3": !isFirst && !isSelectableFirst },
32
32
  { "pr-5": isLast && !hasActions },
33
33
  { "pr-3": !isLast || hasActions },
34
- { "px-3": !field.noPadding },
34
+ { "px-3": (!isFirst || !selectable) && !field.noPadding },
35
35
  { "px-0": field.noPadding },
36
36
  { "whitespace-nowrap truncate": !freeWrap }
37
37
  );
@@ -41,7 +41,7 @@ $:
41
41
 
42
42
  <svelte:element
43
43
  this={tag}
44
- class="{cellStyles} text-base tracking-normal"
44
+ class="{cellStyles} text-base tracking-normal py-2"
45
45
  style:min-width={field.width}
46
46
  style:max-width={isMobile ? `${Viewport.Width}px` : field.width}
47
47
  >
@@ -9,15 +9,16 @@ export let sortBy = "";
9
9
  export let sortDirection;
10
10
  export let isFirst = false;
11
11
  export let isLast = false;
12
+ export let selectable = false;
12
13
  $:
13
14
  outerStyles = clsx({
14
15
  "w-full": field.fullWidth
15
16
  });
16
17
  $:
17
18
  headerStyles = clsx({
18
- "justify-end": field.rightAlign,
19
+ "self-end": field.rightAlign,
19
20
  "hover:bg-neutral-50 focus:bg-neutral-100": field.sortable,
20
- "pl-5": isFirst,
21
+ "pl-5": isFirst && !selectable,
21
22
  "pl-3": !isFirst,
22
23
  "pr-5": isLast,
23
24
  "pr-3": !isLast
@@ -31,18 +32,18 @@ function handleSortBy(event) {
31
32
 
32
33
  <th
33
34
  scope="col"
34
- class="{outerStyles} bg-white text-neutral-500 group sticky z-10 top-0"
35
+ class="{outerStyles} bg-white text-neutral-500 group sticky z-10 top-0 h-9 box-border p-0"
35
36
  style:min-width={field.width}
36
37
  style:max-width={field.width}
37
38
  >
38
- <span class="flex">
39
+ <span class="flex border-b border-neutral-100">
39
40
  {#if field.sortable}
40
41
  <BaseDropdown bind:this={sortDropdown} fullWidth>
41
42
  <span
42
43
  slot="trigger"
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"
44
+ class="{headerStyles} w-full py-2 flex items-center justify-start space-x-1 text-left text-base tracking-normal whitespace-nowrap font-normal"
44
45
  >
45
- <span>{field.headerLabel}</span>
46
+ <span class="min-h-5" />
46
47
  {#if sortBy === field.slug}
47
48
  <svg
48
49
  viewBox="0 0 12 12"
@@ -68,7 +69,7 @@ function handleSortBy(event) {
68
69
  </BaseDropdown>
69
70
  {:else}
70
71
  <div
71
- class="{headerStyles} p-3 text-left text-base font-normal tracking-normal whitespace-nowrap"
72
+ class="{headerStyles} py-2 text-left text-base font-normal tracking-normal whitespace-nowrap"
72
73
  >
73
74
  {field.headerLabel}
74
75
  </div>
@@ -7,6 +7,7 @@ declare const __propDef: {
7
7
  sortDirection: TableSortBy;
8
8
  isFirst?: boolean | undefined;
9
9
  isLast?: boolean | undefined;
10
+ selectable?: boolean | undefined;
10
11
  };
11
12
  events: {
12
13
  orderBy: CustomEvent<any>;
@@ -56,7 +56,7 @@ function scrollIntoView() {
56
56
  <td>
57
57
  <button
58
58
  bind:this={checkboxButton}
59
- class="pl-5 pr-1.5 h-[40px] flex items-center outline-none group cursor-default"
59
+ class="px-5 h-[40px] flex items-center outline-none group cursor-default"
60
60
  on:click|stopPropagation={() => {
61
61
  dispatch('checked', checked)
62
62
  }}
@@ -17,7 +17,7 @@ function updateInput(event) {
17
17
  type="checkbox"
18
18
  {checked}
19
19
  {indeterminate}
20
- class="form-checkbox w-4 h-4 text-workspace-accent focus:text-workspace-accent rounded border border-neutral-200 hover:border-neutral-300 focus:ring-0 focus:ring-offset-0"
20
+ class="form-checkbox w-4 h-4 text-workspace-accent focus:text-workspace-accent rounded border border-neutral-200 hover:border-neutral-300 group-hover:border-neutral-300 focus:ring-0 focus:ring-offset-0"
21
21
  on:change={updateInput}
22
22
  on:click|stopPropagation
23
23
  />
@@ -36,7 +36,7 @@ $:
36
36
  });
37
37
  </script>
38
38
 
39
- <span class="{tagStyles} rounded text-sm inline-flex items-center font-medium gap-1">
39
+ <span class="{tagStyles} rounded text-sm inline-flex items-center font-medium gap-1 box-border h-5">
40
40
  {#if dot}
41
41
  <span class="{dotStyles} w-2 h-2 rounded-sm" />
42
42
  {/if}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@invopop/popui",
3
3
  "license": "MIT",
4
- "version": "0.0.32",
4
+ "version": "0.0.34",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
7
7
  "build": "vite build && npm run package",