@invopop/popui 0.0.76 → 0.0.77-beta

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.
Files changed (84) hide show
  1. package/dist/AlertDialog.svelte +38 -0
  2. package/dist/AlertDialog.svelte.d.ts +25 -0
  3. package/dist/BaseDropdown.svelte +1 -1
  4. package/dist/BaseTable.svelte +43 -56
  5. package/dist/BaseTableActions.svelte +12 -2
  6. package/dist/BaseTableCellContent.svelte +64 -0
  7. package/dist/BaseTableCellContent.svelte.d.ts +24 -0
  8. package/dist/BaseTableCheckbox.svelte +28 -0
  9. package/dist/BaseTableCheckbox.svelte.d.ts +21 -0
  10. package/dist/BaseTableHeaderContent.svelte +59 -0
  11. package/dist/BaseTableHeaderContent.svelte.d.ts +21 -0
  12. package/dist/BaseTableRow.svelte +44 -41
  13. package/dist/BaseTableRow.svelte.d.ts +1 -1
  14. package/dist/DrawerContext.svelte +1 -1
  15. package/dist/StepIconList.svelte +45 -0
  16. package/dist/StepIconList.svelte.d.ts +17 -0
  17. package/dist/alert-dialog/alert-dialog-action.svelte +19 -0
  18. package/dist/alert-dialog/alert-dialog-action.svelte.d.ts +28 -0
  19. package/dist/alert-dialog/alert-dialog-cancel.svelte +16 -0
  20. package/dist/alert-dialog/alert-dialog-cancel.svelte.d.ts +23 -0
  21. package/dist/alert-dialog/alert-dialog-content.svelte +23 -0
  22. package/dist/alert-dialog/alert-dialog-content.svelte.d.ts +17 -0
  23. package/dist/alert-dialog/alert-dialog-description.svelte +12 -0
  24. package/dist/alert-dialog/alert-dialog-description.svelte.d.ts +17 -0
  25. package/dist/alert-dialog/alert-dialog-footer.svelte +11 -0
  26. package/dist/alert-dialog/alert-dialog-footer.svelte.d.ts +17 -0
  27. package/dist/alert-dialog/alert-dialog-header.svelte +8 -0
  28. package/dist/alert-dialog/alert-dialog-header.svelte.d.ts +17 -0
  29. package/dist/alert-dialog/alert-dialog-overlay.svelte +17 -0
  30. package/dist/alert-dialog/alert-dialog-overlay.svelte.d.ts +15 -0
  31. package/dist/alert-dialog/alert-dialog-portal.svelte +6 -0
  32. package/dist/alert-dialog/alert-dialog-portal.svelte.d.ts +17 -0
  33. package/dist/alert-dialog/alert-dialog-title.svelte +10 -0
  34. package/dist/alert-dialog/alert-dialog-title.svelte.d.ts +17 -0
  35. package/dist/alert-dialog/index.d.ts +13 -0
  36. package/dist/alert-dialog/index.js +15 -0
  37. package/dist/button/button.svelte +20 -0
  38. package/dist/button/button.svelte.d.ts +16 -0
  39. package/dist/button/index.d.ts +60 -0
  40. package/dist/button/index.js +29 -0
  41. package/dist/index.d.ts +6 -2
  42. package/dist/index.js +6 -1
  43. package/dist/table/index.d.ts +9 -0
  44. package/dist/table/index.js +11 -0
  45. package/dist/table/table-body.svelte +8 -0
  46. package/dist/table/table-body.svelte.d.ts +17 -0
  47. package/dist/table/table-caption.svelte +8 -0
  48. package/dist/table/table-caption.svelte.d.ts +17 -0
  49. package/dist/table/table-cell.svelte +16 -0
  50. package/dist/table/table-cell.svelte.d.ts +20 -0
  51. package/dist/table/table-footer.svelte +8 -0
  52. package/dist/table/table-footer.svelte.d.ts +17 -0
  53. package/dist/table/table-head.svelte +14 -0
  54. package/dist/table/table-head.svelte.d.ts +17 -0
  55. package/dist/table/table-header.svelte +14 -0
  56. package/dist/table/table-header.svelte.d.ts +20 -0
  57. package/dist/table/table-row.svelte +17 -0
  58. package/dist/table/table-row.svelte.d.ts +23 -0
  59. package/dist/table/table.svelte +10 -0
  60. package/dist/table/table.svelte.d.ts +17 -0
  61. package/dist/tabs/index.d.ts +6 -0
  62. package/dist/tabs/index.js +8 -0
  63. package/dist/tabs/tabs-content.svelte +17 -0
  64. package/dist/tabs/tabs-content.svelte.d.ts +17 -0
  65. package/dist/tabs/tabs-list.svelte +15 -0
  66. package/dist/tabs/tabs-list.svelte.d.ts +17 -0
  67. package/dist/tabs/tabs-trigger.svelte +18 -0
  68. package/dist/tabs/tabs-trigger.svelte.d.ts +15 -0
  69. package/dist/tooltip/index.d.ts +5 -0
  70. package/dist/tooltip/index.js +7 -0
  71. package/dist/tooltip/tooltip-content.svelte +25 -0
  72. package/dist/tooltip/tooltip-content.svelte.d.ts +17 -0
  73. package/dist/tw.theme.d.ts +4 -0
  74. package/dist/tw.theme.js +7 -3
  75. package/dist/types.d.ts +4 -0
  76. package/dist/utils.d.ts +13 -0
  77. package/dist/utils.js +38 -0
  78. package/package.json +4 -1
  79. package/dist/BaseTableCell.svelte +0 -91
  80. package/dist/BaseTableCell.svelte.d.ts +0 -28
  81. package/dist/BaseTableHeader.svelte +0 -68
  82. package/dist/BaseTableHeader.svelte.d.ts +0 -24
  83. package/dist/Tabs.svelte +0 -41
  84. package/dist/Tabs.svelte.d.ts +0 -20
@@ -0,0 +1,38 @@
1
+ <script>import {
2
+ AlertDialog,
3
+ AlertDialogTrigger,
4
+ AlertDialogContent,
5
+ AlertDialogHeader,
6
+ AlertDialogTitle,
7
+ AlertDialogDescription,
8
+ AlertDialogFooter,
9
+ AlertDialogCancel,
10
+ AlertDialogAction
11
+ } from "./alert-dialog";
12
+ export let open = false;
13
+ export let destructive = false;
14
+ export let title = "";
15
+ export let description = "";
16
+ export let cancelText = "Cancel";
17
+ export let actionText = "OK";
18
+ </script>
19
+
20
+ <AlertDialog openFocus="[data-alert-dialog-action]" bind:open>
21
+ <AlertDialogTrigger>
22
+ <slot />
23
+ </AlertDialogTrigger>
24
+ <AlertDialogContent>
25
+ <AlertDialogHeader>
26
+ <AlertDialogTitle>{title}</AlertDialogTitle>
27
+ <AlertDialogDescription>
28
+ {description}
29
+ </AlertDialogDescription>
30
+ </AlertDialogHeader>
31
+ <AlertDialogFooter>
32
+ <AlertDialogCancel>{cancelText}</AlertDialogCancel>
33
+ <AlertDialogAction {destructive} on:click>
34
+ {actionText}
35
+ </AlertDialogAction>
36
+ </AlertDialogFooter>
37
+ </AlertDialogContent>
38
+ </AlertDialog>
@@ -0,0 +1,25 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ open?: boolean | undefined;
5
+ destructive?: boolean | undefined;
6
+ title?: string | undefined;
7
+ description?: string | undefined;
8
+ cancelText?: string | undefined;
9
+ actionText?: string | undefined;
10
+ };
11
+ events: {
12
+ click: import("bits-ui").CustomEventHandler<MouseEvent, HTMLButtonElement>;
13
+ } & {
14
+ [evt: string]: CustomEvent<any>;
15
+ };
16
+ slots: {
17
+ default: {};
18
+ };
19
+ };
20
+ export type AlertDialogProps = typeof __propDef.props;
21
+ export type AlertDialogEvents = typeof __propDef.events;
22
+ export type AlertDialogSlots = typeof __propDef.slots;
23
+ export default class AlertDialog extends SvelteComponent<AlertDialogProps, AlertDialogEvents, AlertDialogSlots> {
24
+ }
25
+ export {};
@@ -29,7 +29,7 @@ export const toggle = () => {
29
29
  };
30
30
  </script>
31
31
 
32
- <div class="inline-flex" class:w-full={fullWidth}>
32
+ <div class="inline-flex" class:w-full={fullWidth} role="menu">
33
33
  <button
34
34
  class="text-left"
35
35
  use:floatingRef
@@ -1,11 +1,13 @@
1
1
  <script>import { intersect } from "svelte-intersection-observer-action";
2
- import BaseTableHeader from "./BaseTableHeader.svelte";
3
2
  import { createEventDispatcher } from "svelte";
4
3
  import BaseCounter from "./BaseCounter.svelte";
5
4
  import BaseTableRow from "./BaseTableRow.svelte";
6
- import BaseTableCell from "./BaseTableCell.svelte";
7
- import InputCheckbox from "./InputCheckbox.svelte";
8
5
  import { isInputFocused } from "./helpers.js";
6
+ import BaseTableCellContent from "./BaseTableCellContent.svelte";
7
+ import { Table, TableHead, TableHeader, TableRow } from "./table/index.js";
8
+ import BaseTableCheckbox from "./BaseTableCheckbox.svelte";
9
+ import BaseTableHeaderContent from "./BaseTableHeaderContent.svelte";
10
+ import TableBody from "./table/table-body.svelte";
9
11
  const dispatch = createEventDispatcher();
10
12
  const callback = (entry) => {
11
13
  if (entry.intersectionRatio && entry.isIntersecting) {
@@ -198,56 +200,40 @@ function handleKeydown(event) {
198
200
  }}
199
201
  />
200
202
 
201
- <div class="w-full font-sans">
202
- <table class="hidden md:table w-full">
203
+ <div class="w-full font-sans border rounded-md border-neutral-100">
204
+ <Table class="hidden md:table">
203
205
  <colgroup>
204
206
  {#if selectable}
205
- <col style="width: 56px" />
207
+ <col style="width: 38px" />
206
208
  {/if}
207
209
  {#each fields as field, i (i)}
208
210
  <col style={field.style} />
209
211
  {/each}
210
212
  {#if addExtraCell}
211
- <col style="width: 40px" />
213
+ <col style="width: 38px" />
212
214
  {/if}
213
215
  </colgroup>
214
- <thead>
215
- <tr class="relative">
216
+ <TableHeader>
217
+ <TableRow>
216
218
  {#if selectable}
217
219
  <!-- if table is selectable we need to add an extra header with a checkbox -->
218
- <th scope="col" class="bg-white sticky top-0 z-10 p-0">
219
- <div class="border-b border-neutral-100">
220
- {#if !hideSelectAll}
221
- <button
222
- class="px-5 h-[36px] flex items-center outline-none group cursor-default"
223
- on:click|stopPropagation={() => {
224
- toggleAllSelected(!selectedRows.length)
225
- }}
226
- >
227
- <div class:invisible={!selectedRows.length} class="group-hover:visible">
228
- <InputCheckbox
229
- checked={allChecked}
230
- {indeterminate}
231
- on:change={(event) => {
232
- toggleAllSelected(event.detail)
233
- }}
234
- />
235
- </div>
236
- </button>
237
- {/if}
238
- </div>
239
- </th>
220
+ <TableHead class="bg-white sticky top-0 z-10 p-0 h-9">
221
+ {#if !hideSelectAll}
222
+ <BaseTableCheckbox
223
+ hidden={!selectedRows.length}
224
+ {indeterminate}
225
+ checked={allChecked}
226
+ on:checked={() => {
227
+ toggleAllSelected(!selectedRows.length)
228
+ }}
229
+ />
230
+ {/if}
231
+ </TableHead>
240
232
  {/if}
241
233
  {#each fields as field, i (i)}
242
- <BaseTableHeader
243
- isFirst={i === 0}
244
- isLast={!addExtraCell && i === fields.length - 1}
245
- {sortBy}
246
- {sortDirection}
247
- {field}
248
- {selectable}
249
- on:orderBy
250
- />
234
+ <TableHead class="bg-white group sticky z-10 top-0 p-0">
235
+ <BaseTableHeaderContent {sortBy} {sortDirection} {field} on:orderBy />
236
+ </TableHead>
251
237
  {/each}
252
238
  {#if addExtraCell}
253
239
  <!-- if table has actions cell we need to add an extra header -->
@@ -255,21 +241,21 @@ function handleKeydown(event) {
255
241
  <div class="border-b border-neutral-100 h-9" />
256
242
  </th>
257
243
  {/if}
258
- </tr>
259
- </thead>
260
- <tbody>
244
+ </TableRow>
245
+ </TableHeader>
246
+ <TableBody>
261
247
  {#each groupedData as group, i (i)}
262
248
  {#if group.label}
263
249
  <tr>
264
250
  <th
265
251
  scope="colgroup"
266
252
  colspan={fields.length + (selectable ? 2 : 1)}
267
- class="bg-white text-left text-sm font-medium text-neutral-500 sticky top-9 tracking-normal h-8"
253
+ class="bg-white text-left text-sm font-medium text-neutral-500 sticky top-9 tracking-normal h-8 z-10"
268
254
  >
269
255
  <span
270
256
  class:border-t={i > 0}
271
- class:pl-14={selectable}
272
- class:pl-5={!selectable}
257
+ class:pl-12={selectable}
258
+ class:pl-3={!selectable}
273
259
  class="flex items-center space-x-1 box-border border-b border-neutral-100 h-8"
274
260
  >
275
261
  <span>{group.label}</span>
@@ -326,8 +312,8 @@ function handleKeydown(event) {
326
312
  />
327
313
  {/each}
328
314
  {/each}
329
- </tbody>
330
- </table>
315
+ </TableBody>
316
+ </Table>
331
317
  <div class="md:hidden space-y-3">
332
318
  {#each groupedData as group}
333
319
  {#each group.rows as row}
@@ -345,14 +331,15 @@ function handleKeydown(event) {
345
331
  }}
346
332
  >
347
333
  {#each fields as field, i (i)}
348
- <BaseTableCell
349
- tag="div"
350
- {field}
351
- badge={field.helperBadge ? field.helperBadge(row) : null}
352
- status={field.helperStatus ? field.helperStatus(row) : null}
353
- data={field.formatter ? field.formatter(row) : row[field.slug] || ''}
354
- on:copied
355
- />
334
+ <div class="text-base tracking-normal py-2">
335
+ <BaseTableCellContent
336
+ {field}
337
+ badge={field.helperBadge ? field.helperBadge(row) : null}
338
+ status={field.helperStatus ? field.helperStatus(row) : null}
339
+ data={field.formatter ? field.formatter(row) : row[field.slug] || ''}
340
+ on:copied
341
+ />
342
+ </div>
356
343
  {/each}
357
344
  </button>
358
345
  {/each}
@@ -3,9 +3,11 @@ import BaseDropdown from "./BaseDropdown.svelte";
3
3
  import { createEventDispatcher } from "svelte";
4
4
  import DrawerContext from "./DrawerContext.svelte";
5
5
  import { Options } from "@invopop/ui-icons";
6
+ import clsx from "clsx";
6
7
  const dispatch = createEventDispatcher();
7
8
  export let actions;
8
9
  let actionDropdown;
10
+ let isOpen = false;
9
11
  $:
10
12
  items = actions.map((a) => ({
11
13
  label: a.label,
@@ -14,13 +16,21 @@ $:
14
16
  footer: a.footer,
15
17
  destructive: a.destructive
16
18
  }));
19
+ $:
20
+ overlayClasses = clsx({
21
+ "group-hover:bg-neutral-800/[.05]": !isOpen,
22
+ "bg-neutral-800/[.1]": isOpen
23
+ });
17
24
  export const toggle = () => {
18
25
  actionDropdown.toggle();
19
26
  };
20
27
  </script>
21
28
 
22
- <BaseDropdown bind:this={actionDropdown}>
23
- <Icon slot="trigger" src={Options} class="w-4 mt-1 text-neutral-500" />
29
+ <BaseDropdown bind:isOpen bind:this={actionDropdown}>
30
+ <div class="relative group flex justify-center items-center rounded p-1" slot="trigger">
31
+ <span class="{overlayClasses} absolute inset-0 rounded" />
32
+ <Icon slot="trigger" src={Options} class="w-4 text-neutral-500" />
33
+ </div>
24
34
  <DrawerContext
25
35
  {items}
26
36
  on:click={(e) => {
@@ -0,0 +1,64 @@
1
+ <script>import TagStatus from "./TagStatus.svelte";
2
+ import FeedIconStatus from "./FeedIconStatus.svelte";
3
+ import BaseFlag from "./BaseFlag.svelte";
4
+ import { getCountryName } from "./helpers.js";
5
+ import UuidCopy from "./UuidCopy.svelte";
6
+ import { Icon } from "@steeze-ui/svelte-icon";
7
+ export let field;
8
+ export let data = "";
9
+ export let isMobile = false;
10
+ export let badge = null;
11
+ export let status = null;
12
+ export let icons = null;
13
+ </script>
14
+
15
+ <div class="flex flex-col">
16
+ <span class="md:hidden text-sm text-neutral-600 font-normal">
17
+ {field.headerLabel}
18
+ </span>
19
+ <span class="flex items-center" class:justify-end={field.rightAlign}>
20
+ {#if field.isCountry && data}
21
+ <span class="flex items-center space-x-1">
22
+ <BaseFlag country={String(data)} width={16} />
23
+ <span>{getCountryName(String(data))}</span>
24
+ </span>
25
+ {:else if field.copy && data}
26
+ <UuidCopy
27
+ rightAlign={isMobile ? false : field.rightAlign}
28
+ uuid={String(data)}
29
+ prefixLength={4}
30
+ suffixLength={4}
31
+ full
32
+ compact
33
+ dark={isMobile}
34
+ on:copied
35
+ />
36
+ {:else}
37
+ <span class="hidden md:inline">{data}</span>
38
+ <span class="md:hidden">{data ? data : badge || status ? '' : '-'}</span>
39
+ {/if}
40
+ {#if badge}
41
+ <span class:ml-2={!!data}>
42
+ <TagStatus label={badge.label} status={badge.status} dot={Boolean(badge.dot)} />
43
+ </span>
44
+ {/if}
45
+ {#if status}
46
+ <span class:ml-2={!!data}>
47
+ <FeedIconStatus {status} />
48
+ </span>
49
+ {/if}
50
+ {#if icons}
51
+ <span class:ml-2={!!data} class="flex items-center gap-1 flex-shrink-0">
52
+ {#each icons as icon}
53
+ <div class="border border-neutral-200 rounded-md p-px">
54
+ {#if typeof icon === 'string'}
55
+ <img alt="icon" src={icon} class="h-4 w-4" />
56
+ {:else}
57
+ <Icon src={icon} class="h-4 w-4" />
58
+ {/if}
59
+ </div>
60
+ {/each}
61
+ </span>
62
+ {/if}
63
+ </span>
64
+ </div>
@@ -0,0 +1,24 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { Badge, FeedItemStatus, TableField, TableIcon } from './types';
3
+ declare const __propDef: {
4
+ props: {
5
+ field: TableField;
6
+ data?: unknown;
7
+ isMobile?: boolean | undefined;
8
+ badge?: Badge | null | undefined;
9
+ status?: FeedItemStatus | null | undefined;
10
+ icons?: TableIcon[] | null | undefined;
11
+ };
12
+ events: {
13
+ copied: CustomEvent<any>;
14
+ } & {
15
+ [evt: string]: CustomEvent<any>;
16
+ };
17
+ slots: {};
18
+ };
19
+ export type BaseTableCellContentProps = typeof __propDef.props;
20
+ export type BaseTableCellContentEvents = typeof __propDef.events;
21
+ export type BaseTableCellContentSlots = typeof __propDef.slots;
22
+ export default class BaseTableCellContent extends SvelteComponent<BaseTableCellContentProps, BaseTableCellContentEvents, BaseTableCellContentSlots> {
23
+ }
24
+ export {};
@@ -0,0 +1,28 @@
1
+ <script>import { createEventDispatcher } from "svelte";
2
+ import InputCheckbox from "./InputCheckbox.svelte";
3
+ const dispatch = createEventDispatcher();
4
+ export let checkboxButton = void 0;
5
+ export let checked = false;
6
+ export let hidden = false;
7
+ export let indeterminate = false;
8
+ </script>
9
+
10
+ <button
11
+ role="checkbox"
12
+ aria-checked={checked}
13
+ bind:this={checkboxButton}
14
+ class="absolute inset-0 h-full w-full flex items-center justify-center outline-none group cursor-default"
15
+ on:click|stopPropagation={() => {
16
+ dispatch('checked', !checked)
17
+ }}
18
+ >
19
+ <div class:invisible={hidden} class="group-hover:visible">
20
+ <InputCheckbox
21
+ {checked}
22
+ {indeterminate}
23
+ on:change={(event) => {
24
+ dispatch('checked', event.detail)
25
+ }}
26
+ />
27
+ </div>
28
+ </button>
@@ -0,0 +1,21 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ checkboxButton?: HTMLButtonElement | undefined;
5
+ checked?: boolean | undefined;
6
+ hidden?: boolean | undefined;
7
+ indeterminate?: boolean | undefined;
8
+ };
9
+ events: {
10
+ checked: CustomEvent<any>;
11
+ } & {
12
+ [evt: string]: CustomEvent<any>;
13
+ };
14
+ slots: {};
15
+ };
16
+ export type BaseTableCheckboxProps = typeof __propDef.props;
17
+ export type BaseTableCheckboxEvents = typeof __propDef.events;
18
+ export type BaseTableCheckboxSlots = typeof __propDef.slots;
19
+ export default class BaseTableCheckbox extends SvelteComponent<BaseTableCheckboxProps, BaseTableCheckboxEvents, BaseTableCheckboxSlots> {
20
+ }
21
+ export {};
@@ -0,0 +1,59 @@
1
+ <script>import clsx from "clsx";
2
+ import { createEventDispatcher } from "svelte";
3
+ import BaseDropdown from "./BaseDropdown.svelte";
4
+ import BaseTableHeaderSortBy from "./BaseTableHeaderSortBy.svelte";
5
+ const dispatch = createEventDispatcher();
6
+ let sortDropdown;
7
+ export let field;
8
+ export let sortBy = "";
9
+ export let sortDirection;
10
+ $:
11
+ headerStyles = clsx({
12
+ "hover:bg-neutral-50 focus:bg-neutral-100": field.sortable
13
+ });
14
+ function handleSortBy(event) {
15
+ sortDirection = event.detail;
16
+ dispatch("orderBy", { field: field.slug, direction: sortDirection });
17
+ sortDropdown.toggle();
18
+ }
19
+ </script>
20
+
21
+ <span class="flex" class:justify-end={field.rightAlign}>
22
+ {#if field.sortable}
23
+ <BaseDropdown bind:this={sortDropdown} fullWidth>
24
+ <span
25
+ slot="trigger"
26
+ class="{headerStyles} w-full p-3 flex items-center justify-start space-x-1 text-left text-base tracking-normal whitespace-nowrap font-normal"
27
+ >
28
+ <span class="w-full" class:text-right={field.rightAlign}>{field.headerLabel}</span>
29
+ {#if sortBy === field.slug}
30
+ <svg
31
+ viewBox="0 0 12 12"
32
+ fill="none"
33
+ xmlns="http://www.w3.org/2000/svg"
34
+ class:rotate-180={sortDirection === 'asc'}
35
+ class="mt-px text-neutral-400 h-3 w-3"
36
+ >
37
+ <path
38
+ fill-rule="evenodd"
39
+ clip-rule="evenodd"
40
+ d="M6.56519 8.8272L7.9966 7.39579L8.7037 8.1029L6.41082 10.3958L6.05726 10.7493L5.70371 10.3958L3.41082 8.1029L4.11793 7.39579L5.56507 8.84293L5.61453 1.24609L6.61451 1.2526L6.56519 8.8272Z"
41
+ fill="currentColor"
42
+ />
43
+ </svg>
44
+ {/if}
45
+ </span>
46
+ <BaseTableHeaderSortBy
47
+ {sortDirection}
48
+ isActive={sortBy === field.slug}
49
+ on:sortBy={handleSortBy}
50
+ />
51
+ </BaseDropdown>
52
+ {:else}
53
+ <div
54
+ class="{headerStyles} p-3 text-left text-base font-normal tracking-normal whitespace-nowrap"
55
+ >
56
+ <div class="h-5">{field.headerLabel}</div>
57
+ </div>
58
+ {/if}
59
+ </span>
@@ -0,0 +1,21 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { TableField, TableSortBy } from './types.js';
3
+ declare const __propDef: {
4
+ props: {
5
+ field: TableField;
6
+ sortBy?: string | undefined;
7
+ sortDirection: TableSortBy;
8
+ };
9
+ events: {
10
+ orderBy: CustomEvent<any>;
11
+ } & {
12
+ [evt: string]: CustomEvent<any>;
13
+ };
14
+ slots: {};
15
+ };
16
+ export type BaseTableHeaderContentProps = typeof __propDef.props;
17
+ export type BaseTableHeaderContentEvents = typeof __propDef.events;
18
+ export type BaseTableHeaderContentSlots = typeof __propDef.slots;
19
+ export default class BaseTableHeaderContent extends SvelteComponent<BaseTableHeaderContentProps, BaseTableHeaderContentEvents, BaseTableHeaderContentSlots> {
20
+ }
21
+ export {};
@@ -1,11 +1,14 @@
1
1
  <script>import { createEventDispatcher } from "svelte";
2
2
  import BaseTableActions from "./BaseTableActions.svelte";
3
- import BaseTableCell from "./BaseTableCell.svelte";
4
- import InputCheckbox from "./InputCheckbox.svelte";
5
3
  import { scrollIntoTableView } from "./helpers.js";
4
+ import { TableCell, TableRow } from "./table";
5
+ import clsx from "clsx";
6
+ import BaseTableCellContent from "./BaseTableCellContent.svelte";
7
+ import BaseTableCheckbox from "./BaseTableCheckbox.svelte";
6
8
  const dispatch = createEventDispatcher();
7
9
  let actionsDropdown;
8
10
  let checkboxButton;
11
+ let dataState = void 0;
9
12
  export let row;
10
13
  export let getActions = void 0;
11
14
  export let fields = [];
@@ -31,15 +34,27 @@ $:
31
34
  function scrollIntoView() {
32
35
  scrollIntoTableView(checkboxButton);
33
36
  }
37
+ $:
38
+ rowClass = clsx({
39
+ "cursor-pointer": !disableRowClick,
40
+ "!hover:bg-transparent": disableRowClick
41
+ });
42
+ $: {
43
+ if (selected) {
44
+ dataState = "selected";
45
+ } else if (checked) {
46
+ dataState = "checked";
47
+ } else {
48
+ dataState = void 0;
49
+ }
50
+ }
34
51
  </script>
35
52
 
36
- <tr
37
- class:cursor-pointer={!disableRowClick}
38
- class:bg-neutral-50={selected}
39
- class:hover:bg-neutral-50={!disableRowClick}
40
- class:bg-workspace-accent-50={checked && !selected}
53
+ <TableRow
54
+ data-state={dataState}
55
+ class={rowClass}
41
56
  on:click
42
- on:contextmenu|preventDefault={() => {
57
+ on:contextmenu={() => {
43
58
  if (!actionsDropdown) return
44
59
 
45
60
  actionsDropdown.toggle()
@@ -53,41 +68,29 @@ function scrollIntoView() {
53
68
  }}
54
69
  >
55
70
  {#if selectable}
56
- <td class="relative">
57
- <button
58
- bind:this={checkboxButton}
59
- class="absolute inset-0 h-full px-5 flex items-center outline-none group cursor-default"
60
- on:click|stopPropagation={() => {
61
- dispatch('checked', !checked)
62
- }}
63
- >
64
- <div class:invisible={selectedRows.length === 0} class="group-hover:visible">
65
- <InputCheckbox
66
- {checked}
67
- on:change={(event) => {
68
- dispatch('checked', event.detail)
69
- }}
70
- />
71
- </div>
72
- </button>
73
- </td>
71
+ <TableCell>
72
+ <BaseTableCheckbox
73
+ bind:checkboxButton
74
+ {checked}
75
+ hidden={selectedRows.length === 0}
76
+ on:checked
77
+ />
78
+ </TableCell>
74
79
  {/if}
75
80
  {#each fields as field, i (i)}
76
- <BaseTableCell
77
- isFirst={i === 0}
78
- isLast={i === fields.length - 1}
79
- {field}
80
- {selectable}
81
- hasActions={!!actions.length}
82
- badge={field.helperBadge ? field.helperBadge(row) : null}
83
- status={field.helperStatus ? field.helperStatus(row) : null}
84
- icons={field.helperIcons ? field.helperIcons(row) : null}
85
- data={field.formatter ? field.formatter(row) : row[field.slug] || ''}
86
- on:copied
87
- />
81
+ <TableCell>
82
+ <BaseTableCellContent
83
+ {field}
84
+ badge={field.helperBadge ? field.helperBadge(row) : null}
85
+ status={field.helperStatus ? field.helperStatus(row) : null}
86
+ icons={field.helperIcons ? field.helperIcons(row) : null}
87
+ data={field.formatter ? field.formatter(row) : row[field.slug] || ''}
88
+ on:copied
89
+ />
90
+ </TableCell>
88
91
  {/each}
89
92
  {#if actions.length}
90
- <td class="pl-1 pr-5">
93
+ <TableCell>
91
94
  <BaseTableActions
92
95
  bind:this={actionsDropdown}
93
96
  {actions}
@@ -95,6 +98,6 @@ function scrollIntoView() {
95
98
  dispatch('action', { row, action: event.detail })
96
99
  }}
97
100
  />
98
- </td>
101
+ </TableCell>
99
102
  {/if}
100
- </tr>
103
+ </TableRow>
@@ -14,10 +14,10 @@ declare const __propDef: {
14
14
  };
15
15
  events: {
16
16
  click: MouseEvent;
17
+ checked: CustomEvent<any>;
17
18
  copied: CustomEvent<any>;
18
19
  hover: CustomEvent<any>;
19
20
  focus: CustomEvent<any>;
20
- checked: CustomEvent<any>;
21
21
  action: CustomEvent<any>;
22
22
  } & {
23
23
  [evt: string]: CustomEvent<any>;
@@ -25,7 +25,7 @@ function updateItem(event) {
25
25
  </script>
26
26
 
27
27
  <div
28
- class="{widthClass} border border-neutral-200 py-1 rounded shadow-lg space-y-0.5 bg-white max-h-80 overflow-y-auto"
28
+ class="{widthClass} border border-neutral-200 py-1 rounded-md shadow-lg space-y-0.5 bg-white max-h-80 overflow-y-auto"
29
29
  >
30
30
  {#if searchable}
31
31
  <div class="px-2 mt-2 mb-1">