@makolabs/ripple 1.0.1 → 1.0.2

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/index.d.ts CHANGED
@@ -317,6 +317,8 @@ export { tv, cn } from './helper/cls.js';
317
317
  export { isRouteActive } from './helper/nav.svelte.js';
318
318
  export { default as Button } from './button/Button.svelte';
319
319
  export { default as Modal } from './modal/Modal.svelte';
320
+ export { default as Pipeline } from './pipeline/Pipeline.svelte';
321
+ export type { PipelineStage } from './pipeline/Pipeline.svelte';
320
322
  export { default as Drawer } from './drawer/Drawer.svelte';
321
323
  export { default as PageHeader } from './header/PageHeader.svelte';
322
324
  export { default as Breadcrumbs } from './header/Breadcrumbs.svelte';
package/dist/index.js CHANGED
@@ -16,6 +16,8 @@ export { isRouteActive } from './helper/nav.svelte.js';
16
16
  export { default as Button } from './button/Button.svelte';
17
17
  // Modal
18
18
  export { default as Modal } from './modal/Modal.svelte';
19
+ // Pipeline
20
+ export { default as Pipeline } from './pipeline/Pipeline.svelte';
19
21
  // Drawer
20
22
  export { default as Drawer } from './drawer/Drawer.svelte';
21
23
  // Header
@@ -0,0 +1,186 @@
1
+ <script lang="ts">
2
+ import { tv } from 'tailwind-variants';
3
+ import type { Snippet } from 'svelte';
4
+
5
+ export type PipelineStage = {
6
+ label: string;
7
+ count?: number | string;
8
+ color?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info';
9
+ active?: boolean;
10
+ };
11
+
12
+ interface Props {
13
+ stages: PipelineStage[];
14
+ class?: string;
15
+ size?: 'sm' | 'base' | 'lg';
16
+ equalWidth?: boolean;
17
+ children?: Snippet<[PipelineStage, number]>;
18
+ }
19
+
20
+ let {
21
+ stages = [],
22
+ class: className = '',
23
+ size = 'base',
24
+ equalWidth = true,
25
+ children
26
+ }: Props = $props();
27
+
28
+ const pipeline = tv({
29
+ slots: {
30
+ container: 'flex items-center gap-0 w-full',
31
+ stage: 'relative flex items-center justify-center transition-all duration-200',
32
+ content: 'relative z-10 flex flex-col items-center justify-center px-4 text-center',
33
+ label: 'font-medium text-gray-700 leading-tight',
34
+ count: 'font-bold text-gray-900',
35
+ chevron: 'absolute inset-0',
36
+ chevronPath: 'fill-current'
37
+ },
38
+ variants: {
39
+ size: {
40
+ sm: {
41
+ stage: 'h-16 min-w-[120px]',
42
+ label: 'text-xs',
43
+ count: 'text-lg mt-1',
44
+ content: 'px-3'
45
+ },
46
+ base: {
47
+ stage: 'h-20 min-w-[150px]',
48
+ label: 'text-sm',
49
+ count: 'text-2xl mt-1',
50
+ content: 'px-4'
51
+ },
52
+ lg: {
53
+ stage: 'h-24 min-w-[180px]',
54
+ label: 'text-base',
55
+ count: 'text-3xl mt-2',
56
+ content: 'px-5'
57
+ }
58
+ },
59
+ color: {
60
+ default: {
61
+ chevronPath: 'text-gray-100'
62
+ },
63
+ primary: {
64
+ chevronPath: 'text-blue-100',
65
+ label: 'text-blue-900',
66
+ count: 'text-blue-900'
67
+ },
68
+ success: {
69
+ chevronPath: 'text-green-100',
70
+ label: 'text-green-900',
71
+ count: 'text-green-900'
72
+ },
73
+ warning: {
74
+ chevronPath: 'text-orange-100',
75
+ label: 'text-orange-900',
76
+ count: 'text-orange-900'
77
+ },
78
+ danger: {
79
+ chevronPath: 'text-red-100',
80
+ label: 'text-red-900',
81
+ count: 'text-red-900'
82
+ },
83
+ info: {
84
+ chevronPath: 'text-purple-100',
85
+ label: 'text-purple-900',
86
+ count: 'text-purple-900'
87
+ }
88
+ },
89
+ active: {
90
+ true: {
91
+ stage: 'ring-2 ring-offset-2',
92
+ chevronPath: 'brightness-110'
93
+ }
94
+ },
95
+ equalWidth: {
96
+ true: {
97
+ stage: 'flex-1'
98
+ },
99
+ false: {
100
+ stage: ''
101
+ }
102
+ }
103
+ }
104
+ });
105
+
106
+ const styles = $derived(pipeline({ size, equalWidth }));
107
+
108
+ function getStageStyles(stage: PipelineStage) {
109
+ return pipeline({
110
+ size,
111
+ color: stage.color || 'default',
112
+ active: stage.active,
113
+ equalWidth
114
+ });
115
+ }
116
+ </script>
117
+
118
+ <div class="{styles.container()} {className}">
119
+ {#each stages as stage, index}
120
+ <div
121
+ class={getStageStyles(stage).stage()}
122
+ >
123
+ <!-- Chevron SVG Background -->
124
+ <svg
125
+ class={getStageStyles(stage).chevron()}
126
+ viewBox="0 0 200 80"
127
+ preserveAspectRatio="none"
128
+ xmlns="http://www.w3.org/2000/svg"
129
+ >
130
+ {#if index === 0}
131
+ <!-- First item - no tail -->
132
+ <path
133
+ d="M 0 0 L 160 0 L 200 40 L 160 80 L 0 80 Z"
134
+ class={getStageStyles(stage).chevronPath()}
135
+ />
136
+ <path
137
+ d="M 0 0 L 160 0 L 200 40 L 160 80 L 0 80 Z"
138
+ fill="none"
139
+ stroke={stage.active ? 'rgb(59 130 246)' : 'rgb(209 213 219)'}
140
+ stroke-width="2"
141
+ />
142
+ {:else if index === stages.length - 1}
143
+ <!-- Last item - no arrow -->
144
+ <path
145
+ d="M 0 0 L 200 0 L 200 80 L 0 80 L 40 40 Z"
146
+ class={getStageStyles(stage).chevronPath()}
147
+ />
148
+ <path
149
+ d="M 0 0 L 200 0 L 200 80 L 0 80 L 40 40 Z"
150
+ fill="none"
151
+ stroke={stage.active ? 'rgb(59 130 246)' : 'rgb(209 213 219)'}
152
+ stroke-width="2"
153
+ />
154
+ {:else}
155
+ <!-- Middle items - full chevron -->
156
+ <path
157
+ d="M 0 0 L 160 0 L 200 40 L 160 80 L 0 80 L 40 40 Z"
158
+ class={getStageStyles(stage).chevronPath()}
159
+ />
160
+ <path
161
+ d="M 0 0 L 160 0 L 200 40 L 160 80 L 0 80 L 40 40 Z"
162
+ fill="none"
163
+ stroke={stage.active ? 'rgb(59 130 246)' : 'rgb(209 213 219)'}
164
+ stroke-width="2"
165
+ />
166
+ {/if}
167
+ </svg>
168
+
169
+ <!-- Content -->
170
+ <div class={getStageStyles(stage).content()}>
171
+ {#if children}
172
+ {@render children(stage, index)}
173
+ {:else}
174
+ <span class={getStageStyles(stage).label()}>
175
+ {stage.label}
176
+ </span>
177
+ {#if stage.count !== undefined}
178
+ <span class={getStageStyles(stage).count()}>
179
+ {stage.count}
180
+ </span>
181
+ {/if}
182
+ {/if}
183
+ </div>
184
+ </div>
185
+ {/each}
186
+ </div>
@@ -0,0 +1,17 @@
1
+ import type { Snippet } from 'svelte';
2
+ export type PipelineStage = {
3
+ label: string;
4
+ count?: number | string;
5
+ color?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info';
6
+ active?: boolean;
7
+ };
8
+ interface Props {
9
+ stages: PipelineStage[];
10
+ class?: string;
11
+ size?: 'sm' | 'base' | 'lg';
12
+ equalWidth?: boolean;
13
+ children?: Snippet<[PipelineStage, number]>;
14
+ }
15
+ declare const Pipeline: import("svelte").Component<Props, {}, "">;
16
+ type Pipeline = ReturnType<typeof Pipeline>;
17
+ export default Pipeline;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makolabs/ripple",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Simple Svelte 5 powered component library ✨",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {