pika-ux 1.0.0-beta.7 → 1.0.0-beta.9
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.
- package/dist/cli/template-files/pnpm-workspace.yaml +1 -1
- package/package.json +13 -13
- package/src/.DS_Store +0 -0
- package/src/icons/lucide/index.d.ts +397 -40
- package/src/pika/scrollable-tabs/README.md +192 -0
- package/src/pika/scrollable-tabs/add-button.svelte +33 -0
- package/src/pika/scrollable-tabs/content.svelte +23 -0
- package/src/pika/scrollable-tabs/context.svelte.ts +23 -0
- package/src/pika/scrollable-tabs/example.svelte +81 -0
- package/src/pika/scrollable-tabs/index.ts +31 -0
- package/src/pika/scrollable-tabs/list.svelte +15 -0
- package/src/pika/scrollable-tabs/overflow-menu.svelte +119 -0
- package/src/pika/scrollable-tabs/pinned-section.svelte +138 -0
- package/src/pika/scrollable-tabs/pinned-trigger.svelte +81 -0
- package/src/pika/scrollable-tabs/root.svelte +34 -0
- package/src/pika/scrollable-tabs/scrollable-section.svelte +120 -0
- package/src/pika/scrollable-tabs/trigger.svelte +82 -0
- package/src/shadcn/carousel/carousel-content.svelte +36 -31
- package/src/shadcn/carousel/carousel-item.svelte +22 -18
- package/src/shadcn/carousel/carousel-next.svelte +29 -22
- package/src/shadcn/carousel/carousel-previous.svelte +29 -22
- package/src/shadcn/carousel/carousel.svelte +77 -73
- package/src/shadcn/carousel/context.ts +37 -32
- package/src/shadcn/toggle-group/toggle-group.svelte +23 -28
- package/src/pika/index.ts +0 -29
- package/src/shadcn/index.ts +0 -40
|
@@ -1,88 +1,92 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
type CarouselAPI,
|
|
4
|
+
type CarouselProps,
|
|
5
|
+
type EmblaContext,
|
|
6
|
+
setEmblaContext,
|
|
7
|
+
} from "./context.js";
|
|
8
|
+
import { cn } from "../utils.js";
|
|
4
9
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}: WithElementRef<CarouselProps> = $props();
|
|
10
|
+
let {
|
|
11
|
+
opts = {},
|
|
12
|
+
plugins = [],
|
|
13
|
+
setApi = () => {},
|
|
14
|
+
orientation = "horizontal",
|
|
15
|
+
class: className,
|
|
16
|
+
children,
|
|
17
|
+
...restProps
|
|
18
|
+
}: CarouselProps = $props();
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
let carouselState = $state<EmblaContext>({
|
|
21
|
+
api: undefined,
|
|
22
|
+
scrollPrev,
|
|
23
|
+
scrollNext,
|
|
24
|
+
orientation,
|
|
25
|
+
canScrollNext: false,
|
|
26
|
+
canScrollPrev: false,
|
|
27
|
+
handleKeyDown,
|
|
28
|
+
options: opts,
|
|
29
|
+
plugins,
|
|
30
|
+
onInit,
|
|
31
|
+
scrollSnaps: [],
|
|
32
|
+
selectedIndex: 0,
|
|
33
|
+
scrollTo,
|
|
34
|
+
});
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
setEmblaContext(carouselState);
|
|
33
37
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
function scrollPrev() {
|
|
39
|
+
carouselState.api?.scrollPrev();
|
|
40
|
+
}
|
|
41
|
+
function scrollNext() {
|
|
42
|
+
carouselState.api?.scrollNext();
|
|
43
|
+
}
|
|
44
|
+
function scrollTo(index: number, jump?: boolean) {
|
|
45
|
+
carouselState.api?.scrollTo(index, jump);
|
|
46
|
+
}
|
|
37
47
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
function onSelect(api: CarouselAPI) {
|
|
49
|
+
if (!api) return;
|
|
50
|
+
carouselState.canScrollPrev = api.canScrollPrev();
|
|
51
|
+
carouselState.canScrollNext = api.canScrollNext();
|
|
52
|
+
carouselState.selectedIndex = api.selectedScrollSnap();
|
|
53
|
+
}
|
|
41
54
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
55
|
+
$effect(() => {
|
|
56
|
+
if (carouselState.api) {
|
|
57
|
+
onSelect(carouselState.api);
|
|
58
|
+
carouselState.api.on("select", onSelect);
|
|
59
|
+
carouselState.api.on("reInit", onSelect);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
45
62
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
63
|
+
function handleKeyDown(e: KeyboardEvent) {
|
|
64
|
+
if (e.key === "ArrowLeft") {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
scrollPrev();
|
|
67
|
+
} else if (e.key === "ArrowRight") {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
scrollNext();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
52
72
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
scrollPrev();
|
|
57
|
-
} else if (e.key === 'ArrowRight') {
|
|
58
|
-
e.preventDefault();
|
|
59
|
-
scrollNext();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
73
|
+
$effect(() => {
|
|
74
|
+
setApi(carouselState.api);
|
|
75
|
+
});
|
|
62
76
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
setApi(carouselState.api);
|
|
77
|
+
function onInit(event: CustomEvent<CarouselAPI>) {
|
|
78
|
+
carouselState.api = event.detail;
|
|
66
79
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
onSelect();
|
|
70
|
-
}
|
|
80
|
+
carouselState.scrollSnaps = carouselState.api.scrollSnapList();
|
|
81
|
+
}
|
|
71
82
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
83
|
+
$effect(() => {
|
|
84
|
+
return () => {
|
|
85
|
+
carouselState.api?.off("select", onSelect);
|
|
86
|
+
};
|
|
87
|
+
});
|
|
77
88
|
</script>
|
|
78
89
|
|
|
79
|
-
<div
|
|
80
|
-
|
|
81
|
-
data-slot="carousel"
|
|
82
|
-
class={cn('relative', className)}
|
|
83
|
-
role="region"
|
|
84
|
-
aria-roledescription="carousel"
|
|
85
|
-
{...restProps}
|
|
86
|
-
>
|
|
87
|
-
{@render children?.()}
|
|
90
|
+
<div class={cn("relative", className)} role="region" aria-roledescription="carousel" {...restProps}>
|
|
91
|
+
{@render children?.()}
|
|
88
92
|
</div>
|
|
@@ -1,51 +1,56 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
3
|
-
import { getContext, hasContext, setContext } from
|
|
4
|
-
import type {
|
|
1
|
+
import type { EmblaCarouselSvelteType } from "embla-carousel-svelte";
|
|
2
|
+
import type emblaCarouselSvelte from "embla-carousel-svelte";
|
|
3
|
+
import { getContext, hasContext, setContext } from "svelte";
|
|
4
|
+
import type { WithElementRef } from "bits-ui";
|
|
5
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
5
6
|
|
|
6
7
|
export type CarouselAPI =
|
|
7
|
-
|
|
8
|
+
NonNullable<NonNullable<EmblaCarouselSvelteType["$$_attributes"]>["on:emblaInit"]> extends (
|
|
9
|
+
evt: CustomEvent<infer CarouselAPI>
|
|
10
|
+
) => void
|
|
11
|
+
? CarouselAPI
|
|
12
|
+
: never;
|
|
8
13
|
|
|
9
14
|
type EmblaCarouselConfig = NonNullable<Parameters<typeof emblaCarouselSvelte>[1]>;
|
|
10
15
|
|
|
11
|
-
export type CarouselOptions = EmblaCarouselConfig[
|
|
12
|
-
export type CarouselPlugins = EmblaCarouselConfig[
|
|
16
|
+
export type CarouselOptions = EmblaCarouselConfig["options"];
|
|
17
|
+
export type CarouselPlugins = EmblaCarouselConfig["plugins"];
|
|
13
18
|
|
|
14
19
|
////
|
|
15
20
|
|
|
16
21
|
export type CarouselProps = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
opts?: CarouselOptions;
|
|
23
|
+
plugins?: CarouselPlugins;
|
|
24
|
+
setApi?: (api: CarouselAPI | undefined) => void;
|
|
25
|
+
orientation?: "horizontal" | "vertical";
|
|
21
26
|
} & WithElementRef<HTMLAttributes<HTMLDivElement>>;
|
|
22
27
|
|
|
23
|
-
const EMBLA_CAROUSEL_CONTEXT = Symbol(
|
|
28
|
+
const EMBLA_CAROUSEL_CONTEXT = Symbol("EMBLA_CAROUSEL_CONTEXT");
|
|
24
29
|
|
|
25
30
|
export type EmblaContext = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
api: CarouselAPI | undefined;
|
|
32
|
+
orientation: "horizontal" | "vertical";
|
|
33
|
+
scrollNext: () => void;
|
|
34
|
+
scrollPrev: () => void;
|
|
35
|
+
canScrollNext: boolean;
|
|
36
|
+
canScrollPrev: boolean;
|
|
37
|
+
handleKeyDown: (e: KeyboardEvent) => void;
|
|
38
|
+
options: CarouselOptions;
|
|
39
|
+
plugins: CarouselPlugins;
|
|
40
|
+
onInit: (e: CustomEvent<CarouselAPI>) => void;
|
|
41
|
+
scrollTo: (index: number, jump?: boolean) => void;
|
|
42
|
+
scrollSnaps: number[];
|
|
43
|
+
selectedIndex: number;
|
|
39
44
|
};
|
|
40
45
|
|
|
41
46
|
export function setEmblaContext(config: EmblaContext): EmblaContext {
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
setContext(EMBLA_CAROUSEL_CONTEXT, config);
|
|
48
|
+
return config;
|
|
44
49
|
}
|
|
45
50
|
|
|
46
|
-
export function getEmblaContext(name =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
export function getEmblaContext(name = "This component") {
|
|
52
|
+
if (!hasContext(EMBLA_CAROUSEL_CONTEXT)) {
|
|
53
|
+
throw new Error(`${name} must be used within a <Carousel.Root> component`);
|
|
54
|
+
}
|
|
55
|
+
return getContext<ReturnType<typeof setEmblaContext>>(EMBLA_CAROUSEL_CONTEXT);
|
|
51
56
|
}
|
|
@@ -1,41 +1,36 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import { getContext, setContext } from 'svelte';
|
|
3
|
+
import type { ToggleVariants } from '../toggle/index';
|
|
4
|
+
export function setToggleGroupCtx(props: ToggleVariants) {
|
|
5
|
+
setContext('toggleGroup', props);
|
|
6
|
+
}
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
export function getToggleGroupCtx() {
|
|
9
|
+
return getContext<ToggleVariants>('toggleGroup');
|
|
10
|
+
}
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<script lang="ts">
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
import { ToggleGroup as ToggleGroupPrimitive } from 'bits-ui';
|
|
15
|
+
import { cn } from '../utils.js';
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
let {
|
|
18
|
+
ref = $bindable(null),
|
|
19
|
+
value = $bindable(),
|
|
20
|
+
class: className,
|
|
21
|
+
size = 'default',
|
|
22
|
+
variant = 'default',
|
|
23
|
+
...restProps
|
|
24
|
+
}: ToggleGroupPrimitive.RootProps & ToggleVariants = $props();
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
setToggleGroupCtx({
|
|
27
|
+
variant,
|
|
28
|
+
size
|
|
29
|
+
});
|
|
30
30
|
</script>
|
|
31
31
|
|
|
32
32
|
<!--
|
|
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
|
|
37
|
-
bind:value={value as never}
|
|
38
|
-
bind:ref
|
|
39
|
-
class={cn("flex items-center justify-center gap-1", className)}
|
|
40
|
-
{...restProps}
|
|
41
|
-
/>
|
|
36
|
+
<ToggleGroupPrimitive.Root bind:value={value as never} bind:ref class={cn('flex items-center justify-center gap-1', className)} {...restProps} />
|
package/src/pika/index.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// Pika UI Components - Non-conflicting exports
|
|
2
|
-
export * from './chip';
|
|
3
|
-
export * from './combobox';
|
|
4
|
-
export * from './confirm-dialog';
|
|
5
|
-
export * from './copy-button';
|
|
6
|
-
export * from './create-copy-link-button';
|
|
7
|
-
export * from './date-picker';
|
|
8
|
-
export * from './date-range-picker';
|
|
9
|
-
export * from './date-time-picker';
|
|
10
|
-
export * from './expandable-container';
|
|
11
|
-
export * from './markdown-editor';
|
|
12
|
-
export * from './permanent-toast';
|
|
13
|
-
export * from './pika-alert';
|
|
14
|
-
export * from './pika-badge';
|
|
15
|
-
export * from './pika-table';
|
|
16
|
-
export * from './popup-help';
|
|
17
|
-
export * from './simple-dropdown';
|
|
18
|
-
export * from './text-wave-shimmer';
|
|
19
|
-
export * from './tooltip-plus';
|
|
20
|
-
|
|
21
|
-
// Selective exports to avoid naming conflicts
|
|
22
|
-
// List component - renamed to avoid conflict with TabsList
|
|
23
|
-
export { List as PikaList, type ListMapping } from './list';
|
|
24
|
-
|
|
25
|
-
// Tabs component - only export aliased versions to avoid "Content" and "List" conflicts
|
|
26
|
-
export { Tabs, TabsContent, TabsList, TabsTrigger } from './pika-tabs';
|
|
27
|
-
|
|
28
|
-
// Slideout component - only export aliased versions to avoid "Content" conflict
|
|
29
|
-
export { Slideout, SlideoutContent, SlideoutPanel, SlideoutProvider, useSlideout } from './slideout';
|
package/src/shadcn/index.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// shadcn UI Components
|
|
2
|
-
export * from './alert';
|
|
3
|
-
export * from './avatar';
|
|
4
|
-
export * from './badge';
|
|
5
|
-
export * from './breadcrumb';
|
|
6
|
-
export * from './button';
|
|
7
|
-
export * from './calendar';
|
|
8
|
-
export * from './card';
|
|
9
|
-
export * from './carousel';
|
|
10
|
-
export * from './checkbox';
|
|
11
|
-
export * from './collapsible';
|
|
12
|
-
export * from './command';
|
|
13
|
-
export * from './data-table';
|
|
14
|
-
export * from './dialog';
|
|
15
|
-
export * from './dropdown-menu';
|
|
16
|
-
export * from './input';
|
|
17
|
-
export * from './label';
|
|
18
|
-
export * from './popover';
|
|
19
|
-
export * from './radio-group';
|
|
20
|
-
export * from './range-calendar';
|
|
21
|
-
export * from './resizable';
|
|
22
|
-
export * from './scroll-area';
|
|
23
|
-
export * from './select';
|
|
24
|
-
export * from './separator';
|
|
25
|
-
export * from './sheet';
|
|
26
|
-
export * from './sidebar';
|
|
27
|
-
export * from './skeleton';
|
|
28
|
-
export * from './slider';
|
|
29
|
-
export * from './sonner';
|
|
30
|
-
export * from './switch';
|
|
31
|
-
export * from './table';
|
|
32
|
-
export * from './tabs';
|
|
33
|
-
export * from './textarea';
|
|
34
|
-
export * from './toggle';
|
|
35
|
-
export * from './toggle-group';
|
|
36
|
-
export * from './tooltip';
|
|
37
|
-
|
|
38
|
-
// Utilities
|
|
39
|
-
export * from './utils';
|
|
40
|
-
export * from './is-mobile.svelte';
|