diff --git a/package.json b/package.json index 997f340..ce4b027 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@invopop/popui", "license": "MIT", - "version": "0.0.32", + "version": "0.0.33", "scripts": { "dev": "vite dev", "build": "vite build && npm run package", diff --git a/svelte/lib/BaseCounter.svelte b/svelte/lib/BaseCounter.svelte index f13ef4f..fc79fa6 100644 --- a/svelte/lib/BaseCounter.svelte +++ b/svelte/lib/BaseCounter.svelte @@ -12,7 +12,7 @@
{content}
diff --git a/svelte/lib/BaseTable.svelte b/svelte/lib/BaseTable.svelte index e43b128..59a4530 100644 --- a/svelte/lib/BaseTable.svelte +++ b/svelte/lib/BaseTable.svelte @@ -235,37 +235,40 @@
- + {#if selectable} - {/if} {#each fields as field, i (i)} {/each} @@ -276,18 +279,25 @@ - {#each groupedData as group} + {#each groupedData as group, i (i)} {#if group.label} {/if} @@ -302,7 +312,9 @@ {selectedRows} {selectedTrackedBy} {selectionMode} - selected={lastSelected && row[selectedTrackedBy] === lastSelected[selectedTrackedBy]} + selected={selectable && + lastSelected && + row[selectedTrackedBy] === lastSelected[selectedTrackedBy]} on:click={() => { if (disableRowClick) return diff --git a/svelte/lib/BaseTableCell.svelte b/svelte/lib/BaseTableCell.svelte index a962001..d5aac01 100644 --- a/svelte/lib/BaseTableCell.svelte +++ b/svelte/lib/BaseTableCell.svelte @@ -21,6 +21,8 @@ export let selectable = false export let hasActions = false + $: isSelectableFirst = isFirst && selectable + $: cellStyles = clsx( { 'tabular-nums slashed-zero lining-nums': field.monospacedNums }, { 'font-mono': field.monospaced }, @@ -28,13 +30,11 @@ { 'text-neutral-800 md:text-neutral-500': !isFirst || field.grayed }, { 'md:text-right': field.rightAlign }, { 'md:w-full md:max-w-0': field.fullWidth }, - { 'py-2 md:py-[11.25px]': badge }, - { 'py-2 md:py-[11.75px]': !badge }, { 'pl-5': isFirst && !selectable }, - { 'pl-3': !isFirst || selectable }, + { 'pl-3': !isFirst && !isSelectableFirst }, { 'pr-5': isLast && !hasActions }, { 'pr-3': !isLast || hasActions }, - { 'px-3': !field.noPadding }, + { 'px-3': (!isFirst || !selectable) && !field.noPadding }, { 'px-0': field.noPadding }, { 'whitespace-nowrap truncate': !freeWrap } ) @@ -43,7 +43,7 @@ diff --git a/svelte/lib/BaseTableHeader.svelte b/svelte/lib/BaseTableHeader.svelte index 007bb88..fda5134 100644 --- a/svelte/lib/BaseTableHeader.svelte +++ b/svelte/lib/BaseTableHeader.svelte @@ -14,6 +14,7 @@ export let sortDirection: TableSortBy export let isFirst = false export let isLast = false + export let selectable = false $: outerStyles = clsx({ 'w-full': field.fullWidth @@ -22,7 +23,7 @@ $: headerStyles = clsx({ 'justify-end': field.rightAlign, 'hover:bg-neutral-50 focus:bg-neutral-100': field.sortable, - 'pl-5': isFirst, + 'pl-5': isFirst && !selectable, 'pl-3': !isFirst, 'pr-5': isLast, 'pr-3': !isLast @@ -37,16 +38,16 @@