pika-ux 1.0.0-beta.9 → 1.0.1

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 (52) hide show
  1. package/dist/cli/template-files/pnpm-workspace.yaml +3 -3
  2. package/dist/cli/template-files/src/App.svelte +1 -1
  3. package/package.json +8 -1
  4. package/src/.DS_Store +0 -0
  5. package/src/App.svelte +2 -4
  6. package/src/icons/lucide/index.d.ts +28 -0
  7. package/src/pika/confirm-dialog/confirm-dialog.svelte +1 -1
  8. package/src/pika/pika-table/pika-table-pagination.svelte +32 -25
  9. package/src/pika/pika-table/pika-table-row-actions.svelte +1 -1
  10. package/src/pika/pika-table/pika-table.svelte +84 -58
  11. package/src/pika/pika-table/types.ts +13 -3
  12. package/src/pika/pika-toggle/index.ts +13 -0
  13. package/src/pika/pika-toggle/toggle.svelte +52 -0
  14. package/src/pika/pika-toggle-group/index.ts +10 -0
  15. package/src/pika/pika-toggle-group/toggle-group-item.svelte +88 -0
  16. package/src/pika/pika-toggle-group/toggle-group.svelte +72 -0
  17. package/src/pika/popup-help/popup-help.svelte +9 -3
  18. package/src/shadcn/chart/chart-container.svelte +69 -0
  19. package/src/shadcn/chart/chart-style.svelte +28 -0
  20. package/src/shadcn/chart/chart-tooltip.svelte +126 -0
  21. package/src/shadcn/chart/chart-utils.ts +37 -0
  22. package/src/shadcn/chart/index.ts +4 -0
  23. package/src/shadcn/dropdown-menu/dropdown-menu-group.svelte +2 -3
  24. package/src/shadcn/dropdown-menu/dropdown-menu-item.svelte +1 -1
  25. package/src/shadcn/dropdown-menu/dropdown-menu-label.svelte +1 -7
  26. package/src/shadcn/dropdown-menu/dropdown-menu-radio-group.svelte +3 -13
  27. package/src/shadcn/dropdown-menu/dropdown-menu-radio-item.svelte +0 -1
  28. package/src/shadcn/dropdown-menu/dropdown-menu-separator.svelte +1 -7
  29. package/src/shadcn/dropdown-menu/dropdown-menu-shortcut.svelte +2 -13
  30. package/src/shadcn/dropdown-menu/dropdown-menu-sub-content.svelte +0 -1
  31. package/src/shadcn/dropdown-menu/dropdown-menu-sub-trigger.svelte +1 -2
  32. package/src/shadcn/dropdown-menu/dropdown-menu-trigger.svelte +2 -3
  33. package/src/shadcn/dropdown-menu/index.ts +44 -45
  34. package/src/shadcn/dropdown-menu copy/dropdown-menu-checkbox-item.svelte +41 -0
  35. package/src/shadcn/dropdown-menu copy/dropdown-menu-content.svelte +27 -0
  36. package/src/shadcn/dropdown-menu copy/dropdown-menu-group-heading.svelte +22 -0
  37. package/src/shadcn/dropdown-menu copy/dropdown-menu-group.svelte +7 -0
  38. package/src/shadcn/dropdown-menu copy/dropdown-menu-item.svelte +27 -0
  39. package/src/shadcn/dropdown-menu copy/dropdown-menu-label.svelte +24 -0
  40. package/src/shadcn/dropdown-menu copy/dropdown-menu-radio-group.svelte +16 -0
  41. package/src/shadcn/dropdown-menu copy/dropdown-menu-radio-item.svelte +26 -0
  42. package/src/shadcn/dropdown-menu copy/dropdown-menu-separator.svelte +13 -0
  43. package/src/shadcn/dropdown-menu copy/dropdown-menu-shortcut.svelte +20 -0
  44. package/src/shadcn/dropdown-menu copy/dropdown-menu-sub-content.svelte +16 -0
  45. package/src/shadcn/dropdown-menu copy/dropdown-menu-sub-trigger.svelte +29 -0
  46. package/src/shadcn/dropdown-menu copy/dropdown-menu-trigger.svelte +7 -0
  47. package/src/shadcn/spinner/index.ts +1 -0
  48. package/src/shadcn/spinner/spinner.svelte +9 -0
  49. package/src/shadcn/toggle/toggle.svelte +36 -45
  50. package/src/shadcn/toggle-group/toggle-group-item.svelte +20 -23
  51. package/src/shadcn/toggle-group/toggle-group.svelte +9 -1
  52. /package/dist/cli/template-files/src/lib/{Counter.svelte → counter.svelte} +0 -0
@@ -0,0 +1,27 @@
1
+ <script lang="ts">
2
+ import { cn } from '../utils.js';
3
+ import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ sideOffset = 4,
8
+ portalProps,
9
+ class: className,
10
+ ...restProps
11
+ }: DropdownMenuPrimitive.ContentProps & {
12
+ portalProps?: DropdownMenuPrimitive.PortalProps;
13
+ } = $props();
14
+ </script>
15
+
16
+ <DropdownMenuPrimitive.Portal {...portalProps}>
17
+ <DropdownMenuPrimitive.Content
18
+ bind:ref
19
+ data-slot="dropdown-menu-content"
20
+ {sideOffset}
21
+ class={cn(
22
+ 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--bits-dropdown-menu-content-available-height) origin-(--bits-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md outline-none',
23
+ className
24
+ )}
25
+ {...restProps}
26
+ />
27
+ </DropdownMenuPrimitive.Portal>
@@ -0,0 +1,22 @@
1
+ <script lang="ts">
2
+ import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
3
+ import { cn } from '../utils.js';
4
+ import type { ComponentProps } from 'svelte';
5
+
6
+ let {
7
+ ref = $bindable(null),
8
+ class: className,
9
+ inset,
10
+ ...restProps
11
+ }: ComponentProps<typeof DropdownMenuPrimitive.GroupHeading> & {
12
+ inset?: boolean;
13
+ } = $props();
14
+ </script>
15
+
16
+ <DropdownMenuPrimitive.GroupHeading
17
+ bind:ref
18
+ data-slot="dropdown-menu-group-heading"
19
+ data-inset={inset}
20
+ class={cn('px-2 py-1.5 text-sm font-semibold data-[inset]:pl-8', className)}
21
+ {...restProps}
22
+ />
@@ -0,0 +1,7 @@
1
+ <script lang="ts">
2
+ import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
3
+
4
+ let { ref = $bindable(null), ...restProps }: DropdownMenuPrimitive.GroupProps = $props();
5
+ </script>
6
+
7
+ <DropdownMenuPrimitive.Group bind:ref data-slot="dropdown-menu-group" {...restProps} />
@@ -0,0 +1,27 @@
1
+ <script lang="ts">
2
+ import { cn } from '../utils.js';
3
+ import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ inset,
9
+ variant = 'default',
10
+ ...restProps
11
+ }: DropdownMenuPrimitive.ItemProps & {
12
+ inset?: boolean;
13
+ variant?: 'default' | 'destructive';
14
+ } = $props();
15
+ </script>
16
+
17
+ <DropdownMenuPrimitive.Item
18
+ bind:ref
19
+ data-slot="dropdown-menu-item"
20
+ data-inset={inset}
21
+ data-variant={variant}
22
+ class={cn(
23
+ "data-highlighted:bg-accent data-highlighted:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:data-highlighted:bg-destructive/10 dark:data-[variant=destructive]:data-highlighted:bg-destructive/20 data-[variant=destructive]:data-highlighted:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
24
+ className
25
+ )}
26
+ {...restProps}
27
+ />
@@ -0,0 +1,24 @@
1
+ <script lang="ts">
2
+ import { cn, type WithElementRef } from '../utils.js';
3
+ import type { HTMLAttributes } from 'svelte/elements';
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ inset,
9
+ children,
10
+ ...restProps
11
+ }: WithElementRef<HTMLAttributes<HTMLDivElement>> & {
12
+ inset?: boolean;
13
+ } = $props();
14
+ </script>
15
+
16
+ <div
17
+ bind:this={ref}
18
+ data-slot="dropdown-menu-label"
19
+ data-inset={inset}
20
+ class={cn('px-2 py-1.5 text-sm font-semibold data-[inset]:pl-8', className)}
21
+ {...restProps}
22
+ >
23
+ {@render children?.()}
24
+ </div>
@@ -0,0 +1,16 @@
1
+ <script lang="ts">
2
+ import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
3
+
4
+ let {
5
+ ref = $bindable(null),
6
+ value = $bindable(),
7
+ ...restProps
8
+ }: DropdownMenuPrimitive.RadioGroupProps = $props();
9
+ </script>
10
+
11
+ <DropdownMenuPrimitive.RadioGroup
12
+ bind:ref
13
+ bind:value
14
+ data-slot="dropdown-menu-radio-group"
15
+ {...restProps}
16
+ />
@@ -0,0 +1,26 @@
1
+ <script lang="ts">
2
+ import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
3
+ import CircleIcon from '$icons/lucide/circle';
4
+ import { cn, type WithoutChild } from '../utils.js';
5
+
6
+ let { ref = $bindable(null), class: className, children: childrenProp, ...restProps }: WithoutChild<DropdownMenuPrimitive.RadioItemProps> = $props();
7
+ </script>
8
+
9
+ <DropdownMenuPrimitive.RadioItem
10
+ bind:ref
11
+ data-slot="dropdown-menu-radio-item"
12
+ class={cn(
13
+ "focus:bg-accent focus:text-accent-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pl-8 pr-2 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
14
+ className
15
+ )}
16
+ {...restProps}
17
+ >
18
+ {#snippet children({ checked })}
19
+ <span class="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
20
+ {#if checked}
21
+ <CircleIcon class="size-2 fill-current" />
22
+ {/if}
23
+ </span>
24
+ {@render childrenProp?.({ checked })}
25
+ {/snippet}
26
+ </DropdownMenuPrimitive.RadioItem>
@@ -0,0 +1,13 @@
1
+ <script lang="ts">
2
+ import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
3
+ import { cn } from '../utils.js';
4
+
5
+ let { ref = $bindable(null), class: className, ...restProps }: DropdownMenuPrimitive.SeparatorProps = $props();
6
+ </script>
7
+
8
+ <DropdownMenuPrimitive.Separator
9
+ bind:ref
10
+ data-slot="dropdown-menu-separator"
11
+ class={cn('bg-border -mx-1 my-1 h-px', className)}
12
+ {...restProps}
13
+ />
@@ -0,0 +1,20 @@
1
+ <script lang="ts">
2
+ import type { HTMLAttributes } from 'svelte/elements';
3
+ import { cn, type WithElementRef } from '../utils.js';
4
+
5
+ let {
6
+ ref = $bindable(null),
7
+ class: className,
8
+ children,
9
+ ...restProps
10
+ }: WithElementRef<HTMLAttributes<HTMLSpanElement>> = $props();
11
+ </script>
12
+
13
+ <span
14
+ bind:this={ref}
15
+ data-slot="dropdown-menu-shortcut"
16
+ class={cn('text-muted-foreground ml-auto text-xs tracking-widest', className)}
17
+ {...restProps}
18
+ >
19
+ {@render children?.()}
20
+ </span>
@@ -0,0 +1,16 @@
1
+ <script lang="ts">
2
+ import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
3
+ import { cn } from '../utils.js';
4
+
5
+ let { ref = $bindable(null), class: className, ...restProps }: DropdownMenuPrimitive.SubContentProps = $props();
6
+ </script>
7
+
8
+ <DropdownMenuPrimitive.SubContent
9
+ bind:ref
10
+ data-slot="dropdown-menu-sub-content"
11
+ class={cn(
12
+ 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-(--bits-dropdown-menu-content-transform-origin) z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-lg',
13
+ className
14
+ )}
15
+ {...restProps}
16
+ />
@@ -0,0 +1,29 @@
1
+ <script lang="ts">
2
+ import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
3
+ import ChevronRightIcon from '$icons/lucide/chevron-right';
4
+ import { cn } from '../utils.js';
5
+
6
+ let {
7
+ ref = $bindable(null),
8
+ class: className,
9
+ inset,
10
+ children,
11
+ ...restProps
12
+ }: DropdownMenuPrimitive.SubTriggerProps & {
13
+ inset?: boolean;
14
+ } = $props();
15
+ </script>
16
+
17
+ <DropdownMenuPrimitive.SubTrigger
18
+ bind:ref
19
+ data-slot="dropdown-menu-sub-trigger"
20
+ data-inset={inset}
21
+ class={cn(
22
+ "data-highlighted:bg-accent data-highlighted:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground outline-hidden [&_svg:not([class*='text-'])]:text-muted-foreground flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
23
+ className
24
+ )}
25
+ {...restProps}
26
+ >
27
+ {@render children?.()}
28
+ <ChevronRightIcon class="ml-auto size-4" />
29
+ </DropdownMenuPrimitive.SubTrigger>
@@ -0,0 +1,7 @@
1
+ <script lang="ts">
2
+ import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
3
+
4
+ let { ref = $bindable(null), ...restProps }: DropdownMenuPrimitive.TriggerProps = $props();
5
+ </script>
6
+
7
+ <DropdownMenuPrimitive.Trigger bind:ref data-slot="dropdown-menu-trigger" {...restProps} />
@@ -0,0 +1 @@
1
+ export { default as Spinner } from './spinner.svelte';
@@ -0,0 +1,9 @@
1
+ <script lang="ts">
2
+ import { cn } from '../utils.js';
3
+ import Loader2Icon from '$icons/lucide/loader-circle';
4
+ import type { ComponentProps } from 'svelte';
5
+ type Props = ComponentProps<typeof Loader2Icon>;
6
+ let { class: className, ...restProps }: Props = $props();
7
+ </script>
8
+
9
+ <Loader2Icon role="status" aria-label="Loading" class={cn('size-4 animate-spin', className)} {...restProps} />
@@ -1,51 +1,42 @@
1
1
  <script lang="ts" module>
2
- import { type VariantProps, tv } from "tailwind-variants";
3
-
4
- export const toggleVariants = tv({
5
- base: "hover:bg-muted hover:text-muted-foreground focus-visible:ring-ring data-[state=on]:bg-accent data-[state=on]:text-accent-foreground inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
6
- variants: {
7
- variant: {
8
- default: "bg-transparent",
9
- outline:
10
- "border-input hover:bg-accent hover:text-accent-foreground border bg-transparent shadow-sm",
11
- },
12
- size: {
13
- default: "h-9 min-w-9 px-3",
14
- sm: "h-8 min-w-8 px-2",
15
- lg: "h-10 min-w-10 px-3",
16
- },
17
- },
18
- defaultVariants: {
19
- variant: "default",
20
- size: "default",
21
- },
22
- });
23
-
24
- export type ToggleVariant = VariantProps<typeof toggleVariants>["variant"];
25
- export type ToggleSize = VariantProps<typeof toggleVariants>["size"];
26
- export type ToggleVariants = VariantProps<typeof toggleVariants>;
2
+ import { type VariantProps, tv } from 'tailwind-variants';
3
+ export const toggleVariants = tv({
4
+ base: "hover:bg-muted hover:text-muted-foreground data-[state=on]:bg-accent data-[state=on]:text-accent-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium outline-none transition-[color,box-shadow] focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
5
+ variants: {
6
+ variant: {
7
+ default: 'bg-transparent',
8
+ outline: 'border-input shadow-xs hover:bg-accent hover:text-accent-foreground border bg-transparent'
9
+ },
10
+ size: {
11
+ default: 'h-9 min-w-9 px-2',
12
+ sm: 'h-8 min-w-8 px-1.5',
13
+ lg: 'h-10 min-w-10 px-2.5'
14
+ }
15
+ },
16
+ defaultVariants: {
17
+ variant: 'default',
18
+ size: 'default'
19
+ }
20
+ });
21
+ export type ToggleVariant = VariantProps<typeof toggleVariants>['variant'];
22
+ export type ToggleSize = VariantProps<typeof toggleVariants>['size'];
23
+ export type ToggleVariants = VariantProps<typeof toggleVariants>;
27
24
  </script>
28
25
 
29
26
  <script lang="ts">
30
- import { Toggle as TogglePrimitive } from "bits-ui";
31
- import { cn } from "../utils.js";
32
-
33
- let {
34
- ref = $bindable(null),
35
- pressed = $bindable(false),
36
- class: className,
37
- size = "default",
38
- variant = "default",
39
- ...restProps
40
- }: TogglePrimitive.RootProps & {
41
- variant?: ToggleVariant;
42
- size?: ToggleSize;
43
- } = $props();
27
+ import { Toggle as TogglePrimitive } from 'bits-ui';
28
+ import { cn } from '../utils.js';
29
+ let {
30
+ ref = $bindable(null),
31
+ pressed = $bindable(false),
32
+ class: className,
33
+ size = 'default',
34
+ variant = 'default',
35
+ ...restProps
36
+ }: TogglePrimitive.RootProps & {
37
+ variant?: ToggleVariant;
38
+ size?: ToggleSize;
39
+ } = $props();
44
40
  </script>
45
41
 
46
- <TogglePrimitive.Root
47
- bind:ref
48
- bind:pressed
49
- class={cn(toggleVariants({ variant, size }), className)}
50
- {...restProps}
51
- />
42
+ <TogglePrimitive.Root bind:ref bind:pressed data-slot="toggle" class={cn(toggleVariants({ variant, size }), className)} {...restProps} />
@@ -1,30 +1,27 @@
1
1
  <script lang="ts">
2
- import { ToggleGroup as ToggleGroupPrimitive } from "bits-ui";
3
- import { getToggleGroupCtx } from "./toggle-group.svelte";
4
- import { cn } from "../utils.js";
5
- import { type ToggleVariants, toggleVariants } from "../toggle/index.js";
2
+ import { ToggleGroup as ToggleGroupPrimitive } from 'bits-ui';
3
+ import { getToggleGroupCtx } from './toggle-group.svelte';
4
+ import { cn } from '../utils.js';
5
+ import { type ToggleVariants, toggleVariants } from '../toggle/index.js';
6
6
 
7
- let {
8
- ref = $bindable(null),
9
- value = $bindable(),
10
- class: className,
11
- size,
12
- variant,
13
- ...restProps
14
- }: ToggleGroupPrimitive.ItemProps & ToggleVariants = $props();
7
+ let { ref = $bindable(null), value = $bindable(), class: className, size, variant, ...restProps }: ToggleGroupPrimitive.ItemProps & ToggleVariants = $props();
15
8
 
16
- const ctx = getToggleGroupCtx();
9
+ const ctx = getToggleGroupCtx();
17
10
  </script>
18
11
 
19
12
  <ToggleGroupPrimitive.Item
20
- bind:ref
21
- class={cn(
22
- toggleVariants({
23
- variant: ctx.variant || variant,
24
- size: ctx.size || size,
25
- }),
26
- className
27
- )}
28
- {value}
29
- {...restProps}
13
+ bind:ref
14
+ data-slot="toggle-group-item"
15
+ data-variant={ctx.variant || variant}
16
+ data-size={ctx.size || size}
17
+ class={cn(
18
+ toggleVariants({
19
+ variant: ctx.variant || variant,
20
+ size: ctx.size || size
21
+ }),
22
+ 'min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l',
23
+ className
24
+ )}
25
+ {value}
26
+ {...restProps}
30
27
  />
@@ -33,4 +33,12 @@
33
33
  Discriminated Unions + Destructing (required for bindable) do not
34
34
  get along, so we shut typescript up by casting `value` to `never`.
35
35
  -->
36
- <ToggleGroupPrimitive.Root bind:value={value as never} bind:ref class={cn('flex items-center justify-center gap-1', className)} {...restProps} />
36
+ <ToggleGroupPrimitive.Root
37
+ bind:value={value as never}
38
+ bind:ref
39
+ data-slot="toggle-group"
40
+ data-variant={variant}
41
+ data-size={size}
42
+ class={cn('group/toggle-group data-[variant=outline]:shadow-xs flex w-fit items-center rounded-md', className)}
43
+ {...restProps}
44
+ />