@invopop/popui 0.1.11 → 0.1.13

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.
@@ -27,6 +27,7 @@
27
27
  children
28
28
  }: AlertDialogProps = $props()
29
29
 
30
+ let previousOpen = $state(open)
30
31
  let recentAction = $state(false)
31
32
 
32
33
  function cancel() {
@@ -46,17 +47,13 @@
46
47
  }
47
48
 
48
49
  $effect(() => {
49
- if (!open) {
50
- cancelByEsc()
50
+ // Only fire oncancel when transitioning from true to false (ESC or backdrop click)
51
+ if (previousOpen && !open && !recentAction) {
52
+ oncancel?.()
51
53
  }
54
+ previousOpen = open
52
55
  })
53
56
 
54
- function cancelByEsc() {
55
- if (recentAction) return
56
-
57
- oncancel?.()
58
- }
59
-
60
57
  function handleOpen(value: boolean) {
61
58
  if (value) {
62
59
  const focusEl = document.querySelector(
@@ -16,7 +16,7 @@
16
16
  </script>
17
17
 
18
18
  <button
19
- class="rounded-lg bg-white hover:bg-neutral-100 focus:bg-neutral-200 disabled:bg-neutral-50 disabled:pointer-events-none border border-neutral-100 p-3 flex flex-col min-w-[298px] min-h-[126px] text-left"
19
+ class="cursor-pointer rounded-lg bg-white hover:bg-neutral-100 focus:bg-neutral-200 disabled:bg-neutral-50 disabled:pointer-events-none border border-neutral-100 p-3 flex flex-col min-w-[298px] min-h-[126px] text-left"
20
20
  disabled={type === 'soon'}
21
21
  {...rest}
22
22
  {onclick}
@@ -24,7 +24,7 @@
24
24
  <div class="flex flex-col items-start justify-center space-y-2 w-full">
25
25
  <div class="flex items-center justify-between w-full">
26
26
  <div class="rounded-md bg-white border border-neutral-100 p-1.5">
27
- <img class="h-5 w-5 flex-shrink-0" src={imageUrl} alt={imageAlt} />
27
+ <img class="h-5 w-5 shrink-0" src={imageUrl} alt={imageAlt} />
28
28
  </div>
29
29
  <div class="flex items-center space-x-2">
30
30
  {#if enabled}
@@ -51,7 +51,7 @@
51
51
 
52
52
  <div class="inline-flex" class:w-full={fullWidth} role="menu">
53
53
  <button
54
- class="text-left"
54
+ class="cursor-pointer text-left"
55
55
  class:w-full={fullWidth}
56
56
  use:floatingRef
57
57
  {...rest}
@@ -61,7 +61,7 @@
61
61
  </button>
62
62
  {#if isOpen}
63
63
  <div
64
- class="max-h-40 absolute z-[1001]"
64
+ class="max-h-40 absolute z-1001"
65
65
  use:portal
66
66
  use:floatingContent
67
67
  use:clickOutside
@@ -22,7 +22,7 @@
22
22
  </a>
23
23
  {:else if breadcrumb.copiable}
24
24
  <button
25
- class={i < breadcrumbs.length - 1 ? 'text-neutral-400' : 'font-medium'}
25
+ class="cursor-pointer {i < breadcrumbs.length - 1 ? 'text-neutral-400' : 'font-medium'}"
26
26
  onclick={(e) => handleClick(e, breadcrumb.label)}
27
27
  >
28
28
  {breadcrumb.label}
@@ -8,7 +8,10 @@
8
8
  </script>
9
9
 
10
10
  <div class="border border-neutral-100 rounded-lg">
11
- <button class="pl-3 py-2 pr-2 flex items-center justify-between space-x-3 w-full" {onclick}>
11
+ <button
12
+ class="cursor-pointer pl-3 py-2 pr-2 flex items-center justify-between space-x-3 w-full"
13
+ {onclick}
14
+ >
12
15
  <div class="flex items-center space-x-1.5">
13
16
  {#if icon}
14
17
  <Icon src={icon} class="h-4 w-4 text-neutral-500" />
@@ -64,7 +64,7 @@
64
64
 
65
65
  <button
66
66
  bind:this={el}
67
- class="w-full px-1 py-0.5 disabled:opacity-30 group"
67
+ class="cursor-pointer w-full px-1 py-0.5 disabled:opacity-30 group"
68
68
  disabled={item.disabled}
69
69
  onclick={handleClick}
70
70
  >
@@ -29,7 +29,7 @@
29
29
  <div class="w-[300px] border border-neutral-200 rounded-md shadow-lg bg-white">
30
30
  <div class="max-h-[550px] overflow-hidden rounded-t-md">
31
31
  <button
32
- class="flex items-center justify-between bg-neutral-50 border-b border-neutral-200 rounded-t-sm h-9 py-2 pl-2.5 pr-3 text-base font-medium text-neutral-800 w-full"
32
+ class="cursor-pointer flex items-center justify-between bg-neutral-50 border-b border-neutral-200 rounded-t-sm h-9 py-2 pl-2.5 pr-3 text-base font-medium text-neutral-800 w-full"
33
33
  onclick={() => {
34
34
  if (liveOpen) return
35
35
  liveOpen = true
@@ -66,7 +66,7 @@
66
66
  </div>
67
67
  {/if}
68
68
  <button
69
- class="flex items-center justify-between bg-neutral-50 border-b border-neutral-200 h-9 py-2 pl-2.5 pr-3 text-base font-medium text-neutral-800 w-full"
69
+ class="cursor-pointer flex items-center justify-between bg-neutral-50 border-b border-neutral-200 h-9 py-2 pl-2.5 pr-3 text-base font-medium text-neutral-800 w-full"
70
70
  class:border-t={liveOpen}
71
71
  onclick={() => {
72
72
  if (sandboxOpen) return
@@ -108,7 +108,7 @@
108
108
  <ul class="px-1 space-y-1 bg-neutral-50 rounded-b border-t border-neutral-100 py-1">
109
109
  <li class="pl-1.5 py-1.5 pr-2 hover:bg-neutral-100 rounded-sm">
110
110
  <button
111
- class="flex items-center justify-between w-full"
111
+ class="cursor-pointer flex items-center justify-between w-full"
112
112
  onclick={() => {
113
113
  onclick?.('add')
114
114
  }}
@@ -37,6 +37,7 @@
37
37
  <div class="px-3 py-2 text-sm text-neutral-500 flex items-center justify-between">
38
38
  <span>Logs</span>
39
39
  <button
40
+ class="cursor-pointer"
40
41
  aria-label="Toggle details"
41
42
  onclick={() => {
42
43
  open = !open
@@ -39,7 +39,7 @@
39
39
  </script>
40
40
 
41
41
  <button
42
- class="{styles} flex items-center border pl-1.5 py-1.5 pr-2 border-white-10 bg-neutral-800/10 rounded-md"
42
+ class="cursor-pointer {styles} flex items-center border pl-1.5 py-1.5 pr-2 border-white-10 bg-neutral-800/10 rounded-md"
43
43
  onclick={() => onOpen?.()}
44
44
  >
45
45
  <Icon src={Search} class="w-4 h-4 text-white-70" />
@@ -106,7 +106,7 @@
106
106
  onmouseleave={handleBlur}
107
107
  onclick={handleClick}
108
108
  title={label}
109
- class="{itemStyles} text-base border border-transparent flex items-center justify-between hover:text-white focus:text-white rounded-md"
109
+ class="cursor-pointer {itemStyles} text-base border border-transparent flex items-center justify-between hover:text-white focus:text-white rounded-md"
110
110
  >
111
111
  <span class="flex items-center space-x-2">
112
112
  {#if resolvedIcon}
@@ -118,6 +118,7 @@
118
118
  </span>
119
119
  {#if collapsable && !collapsedSidebar}
120
120
  <button
121
+ class="cursor-pointer"
121
122
  onclick={(e) => {
122
123
  e.stopPropagation()
123
124
  open = !open
@@ -25,7 +25,7 @@
25
25
  </script>
26
26
 
27
27
  <button
28
- class="{styles} text-white border border-transparent text-base flex items-center justify-between space-x-1 rounded text-left"
28
+ class="cursor-pointer {styles} text-white border border-transparent text-base flex items-center justify-between space-x-1 rounded text-left"
29
29
  {onclick}
30
30
  >
31
31
  <span class="flex items-center justify-between w-full space-x-2">
@@ -28,7 +28,7 @@
28
28
  <span class="py-1 pr-2 text-workspace-accent tracking-normal">{label}</span>
29
29
  <button
30
30
  aria-label="Clear"
31
- class="py-1 border-l border-workspace-accent-100 pl-1 text-neutral-500"
31
+ class="cursor-pointer py-1 border-l border-workspace-accent-100 pl-1 text-neutral-500"
32
32
  onclick={handleClear}
33
33
  >
34
34
  <svg
@@ -3,7 +3,7 @@
3
3
  import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements'
4
4
  import { type VariantProps, tv } from 'tailwind-variants'
5
5
  export const buttonVariants = tv({
6
- base: 'ring-workspace-accent-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 flex items-center justify-center font-medium font-sans relative group tracking-tight rounded-md text-base text-neutral-800 box-border',
6
+ base: 'cursor-pointer ring-workspace-accent-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 flex items-center justify-center font-medium font-sans relative group tracking-tight rounded-md text-base text-neutral-800 box-border',
7
7
  variants: {
8
8
  variant: {
9
9
  default: 'bg-white text-neutral-800 hover:bg-primary/90',
@@ -18,7 +18,7 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
18
18
  icon: string;
19
19
  'icon-sm': string;
20
20
  };
21
- }, undefined, "ring-workspace-accent-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 flex items-center justify-center font-medium font-sans relative group tracking-tight rounded-md text-base text-neutral-800 box-border", {
21
+ }, undefined, "cursor-pointer ring-workspace-accent-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 flex items-center justify-center font-medium font-sans relative group tracking-tight rounded-md text-base text-neutral-800 box-border", {
22
22
  variant: {
23
23
  default: string;
24
24
  destructive: string;
@@ -52,7 +52,7 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
52
52
  icon: string;
53
53
  'icon-sm': string;
54
54
  };
55
- }, undefined, "ring-workspace-accent-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 flex items-center justify-center font-medium font-sans relative group tracking-tight rounded-md text-base text-neutral-800 box-border", unknown, unknown, undefined>>;
55
+ }, undefined, "cursor-pointer ring-workspace-accent-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 flex items-center justify-center font-medium font-sans relative group tracking-tight rounded-md text-base text-neutral-800 box-border", unknown, unknown, undefined>>;
56
56
  export type ButtonVariant = VariantProps<typeof buttonVariants>['variant'];
57
57
  export type ButtonSize = VariantProps<typeof buttonVariants>['size'];
58
58
  export type ButtonProps = WithElementRef<HTMLButtonAttributes> & WithElementRef<HTMLAnchorAttributes> & {
@@ -15,7 +15,7 @@
15
15
  bind:this={ref}
16
16
  data-slot="table-cell"
17
17
  class={cn(
18
- 'py-3 pl-3 pr-3 align-middle text-neutral-500 font-normal text-base [&:has([role=checkbox])]:pr-2 [&:has([role=menu])]:pl-1 relative',
18
+ 'py-3 pl-3 pr-3 align-middle text-neutral-500 font-normal text-base [&:has([role=checkbox])]:pr-2 [&:has([role=menu])]:pl-1 relative z-1',
19
19
  className
20
20
  )}
21
21
  onclick={bubble('click')}
@@ -14,7 +14,7 @@
14
14
  {value}
15
15
  data-slot="tabs-trigger"
16
16
  class={cn(
17
- 'data-[state=active]:bg-white inline-flex items-center justify-center whitespace-nowrap rounded px-3 py-0.5 text-base font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm w-full',
17
+ 'data-[state=active]:bg-white inline-flex items-center justify-center whitespace-nowrap rounded px-3 py-0.5 text-base font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm w-full cursor-pointer',
18
18
  className
19
19
  )}
20
20
  >
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@invopop/popui",
3
3
  "license": "MIT",
4
- "version": "0.1.11",
4
+ "version": "0.1.13",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
7
7
  "dev:clean": "npm run clean && vite dev",
8
8
  "clean": "rm -rf .svelte-kit node_modules/.vite node_modules/.cache",
9
+ "clean:ts": "rm -rf .svelte-kit/tsconfig.json .svelte-kit/types && svelte-kit sync",
9
10
  "build": "vite build && npm run package",
10
11
  "preview": "vite preview",
11
12
  "package": "svelte-kit sync && svelte-package && publint",