@rkosafo/cai.components 0.0.16 → 0.0.18

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
@@ -23,7 +23,8 @@ export * from './ui/alertDialog/index.js';
23
23
  export * from './ui/accordion/index.js';
24
24
  export * from './ui/tab/index.js';
25
25
  export * from './ui/icons/index.js';
26
- export * from "./ui/box/index.js";
26
+ export * from './ui/box/index.js';
27
+ export * from './ui/breadcrumb/index.js';
27
28
  export * from './forms/input/index.js';
28
29
  export * from './forms/label/index.js';
29
30
  export * from './forms/datepicker/index.js';
package/dist/index.js CHANGED
@@ -24,7 +24,8 @@ export * from './ui/alertDialog/index.js';
24
24
  export * from './ui/accordion/index.js';
25
25
  export * from './ui/tab/index.js';
26
26
  export * from './ui/icons/index.js';
27
- export * from "./ui/box/index.js";
27
+ export * from './ui/box/index.js';
28
+ export * from './ui/breadcrumb/index.js';
28
29
  export * from './forms/input/index.js';
29
30
  export * from './forms/label/index.js';
30
31
  export * from './forms/datepicker/index.js';
@@ -178,4 +178,9 @@
178
178
  #tf-content nav .nav-link {
179
179
  display: none;
180
180
  }
181
+ }
182
+
183
+
184
+ .loginbox {
185
+ box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
181
186
  }
@@ -22,6 +22,7 @@ import type { RadioVariants } from '../forms/radio/theme.js';
22
22
  import type { CheckboxVariants } from '../forms/checkbox/theme.js';
23
23
  import type { AccordionItemVariants, AccordionVariants } from '../ui/accordion/theme.js';
24
24
  import type { TabsVaraints } from '../ui/tab/theme.js';
25
+ import type { ACTION_BUTTON_KINDS } from '../ui/buttons/ActionButton.svelte';
25
26
  export interface TFSidebarProps {
26
27
  homeUrl: string;
27
28
  logoUrl: string;
@@ -780,3 +781,39 @@ export interface BoxProps extends svelteHTML.HTMLAttributes<HTMLDivElement> {
780
781
  padding?: boolean;
781
782
  shadow?: boolean;
782
783
  }
784
+ export interface IBreadCrumb {
785
+ title: string;
786
+ component?: any;
787
+ props?: any;
788
+ path?: string;
789
+ }
790
+ export interface BreadCrumbProps {
791
+ options: IBreadCrumb[];
792
+ activeBreadCrumb: string;
793
+ onclik?: (val: IBreadCrumbClick) => void;
794
+ }
795
+ export interface IBreadCrumbClick {
796
+ title: string;
797
+ path?: string;
798
+ index: number;
799
+ }
800
+ export interface IButtonConfig {
801
+ kind: string;
802
+ label: string;
803
+ subLabel: string;
804
+ }
805
+ export interface ActionButtonProps {
806
+ icon?: string;
807
+ iconBgColor?: string;
808
+ iconSize?: number;
809
+ iconColor?: string;
810
+ label?: string;
811
+ subLabel?: string;
812
+ showBg?: boolean | null;
813
+ showArrow?: boolean;
814
+ showIconHover?: boolean;
815
+ moreHeight?: boolean;
816
+ href?: string | null;
817
+ kind?: keyof typeof ACTION_BUTTON_KINDS;
818
+ moreShadow?: boolean;
819
+ }
@@ -19,7 +19,7 @@
19
19
  otherClasses
20
20
  )}
21
21
  class:rounded-[5px]={rounded}
22
- class:bgWhite
22
+ class:bg-white={bgWhite}
23
23
  class:p-6={padding}
24
24
  class:shadow-sm={shadow}
25
25
  class:shadow-gray-400={shadow}
@@ -0,0 +1,28 @@
1
+ <script lang="ts">
2
+ import { IconifyIcon, type BreadCrumbProps } from '../../index.js';
3
+
4
+ let { options = [], activeBreadCrumb = '', onclik }: BreadCrumbProps = $props();
5
+ </script>
6
+
7
+ <ul class="breadcrumb">
8
+ {#each options as { title, path }, index}
9
+ <li>
10
+ <button
11
+ onclick={() => onclik?.({ title, path, index })}
12
+ class="capitalize"
13
+ class:text-blue-500={activeBreadCrumb === title}
14
+ class:text-gray-500={activeBreadCrumb !== title}
15
+ class:hover:text-gray-400={activeBreadCrumb !== title}
16
+ class:cursor-default={activeBreadCrumb === title}>{title}</button
17
+ >
18
+ </li>
19
+ <!-- <li><i class="bx bx-chevron-right" /></li> -->
20
+ {#if index !== options.length - 1}
21
+ <IconifyIcon
22
+ icon="ri:arrow-right-double-line"
23
+ class="dark:text-gray-500"
24
+ style="font-size:18px"
25
+ />
26
+ {/if}
27
+ {/each}
28
+ </ul>
@@ -0,0 +1,4 @@
1
+ import { type BreadCrumbProps } from '../../index.js';
2
+ declare const Breadcrumb: import("svelte").Component<BreadCrumbProps, {}, "">;
3
+ type Breadcrumb = ReturnType<typeof Breadcrumb>;
4
+ export default Breadcrumb;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,232 @@
1
+ <script lang="ts" module>
2
+ export const ACTION_BUTTON_KINDS = {
3
+ generic: {
4
+ icon: 'solar:verified-check-bold',
5
+ iconBgColor: 'bg-green-300',
6
+ iconSize: 25,
7
+ iconColor: 'text-gray-800',
8
+ label: '',
9
+ subLabel: '',
10
+ showBg: true,
11
+ showArrow: false,
12
+ showIconHover: true,
13
+ moreHeight: false
14
+ },
15
+ enquiries: {
16
+ icon: 'entypo:chat',
17
+ iconBgColor: 'bg-orange-300',
18
+ iconSize: 25,
19
+ iconColor: 'text-orange-800',
20
+ label: '',
21
+ subLabel: '',
22
+ showBg: true,
23
+ showArrow: false,
24
+ showIconHover: true,
25
+ moreHeight: false
26
+ },
27
+ accept: {
28
+ icon: 'ph:check-circle',
29
+ iconBgColor: 'bg-green-300',
30
+ iconSize: 25,
31
+ iconColor: 'text-gray-800',
32
+ label: '',
33
+ subLabel: '',
34
+ showBg: true,
35
+ showArrow: false,
36
+ showIconHover: true,
37
+ moreHeight: false
38
+ },
39
+ approve: {
40
+ icon: 'ph:check-circle',
41
+ iconBgColor: 'bg-green-300',
42
+ iconSize: 25,
43
+ iconColor: 'text-gray-800',
44
+ label: '',
45
+ subLabel: '',
46
+ showBg: true,
47
+ showArrow: false,
48
+ showIconHover: true,
49
+ moreHeight: false
50
+ },
51
+ reject: {
52
+ icon: 'ph:x-circle',
53
+ iconBgColor: 'bg-red-400',
54
+ iconSize: 25,
55
+ iconColor: 'text-white',
56
+ label: '',
57
+ subLabel: '',
58
+ showBg: true,
59
+ showArrow: false,
60
+ showIconHover: true,
61
+ moreHeight: false
62
+ },
63
+ transfer: {
64
+ icon: 'mdi:file-sync',
65
+ iconBgColor: 'bg-sky-300',
66
+ iconSize: 25,
67
+ iconColor: 'text-gray-800',
68
+ label: '',
69
+ subLabel: '',
70
+ showBg: true,
71
+ showArrow: false,
72
+ showIconHover: true,
73
+ moreHeight: false
74
+ },
75
+ recommendation: {
76
+ icon: 'material-symbols:recommend-outline',
77
+ iconBgColor: 'bg-yellow-300',
78
+ iconSize: 25,
79
+ iconColor: 'text-gray-800',
80
+ label: '',
81
+ subLabel: '',
82
+ showBg: true,
83
+ showArrow: false,
84
+ showIconHover: true,
85
+ moreHeight: false
86
+ },
87
+ file: {
88
+ icon: 'ph:file-text',
89
+ iconBgColor: 'bg-gray-200',
90
+ iconSize: 25,
91
+ iconColor: 'text-gray-800',
92
+ label: '',
93
+ subLabel: '',
94
+ showBg: true,
95
+ showArrow: false,
96
+ showIconHover: true,
97
+ moreHeight: false
98
+ },
99
+ form: {
100
+ icon: 'game-icons:archive-register',
101
+ iconBgColor: 'bg-teal-100',
102
+ iconSize: 25,
103
+ iconColor: 'text-blue-800',
104
+ label: '',
105
+ subLabel: '',
106
+ showBg: true,
107
+ showArrow: false,
108
+ showIconHover: true,
109
+ moreHeight: false
110
+ }
111
+ } as const;
112
+ </script>
113
+
114
+ <script lang="ts">
115
+ import { cn, IconifyIcon, type ActionButtonProps } from '../../index.js';
116
+ import Button from './Button.svelte';
117
+
118
+ let {
119
+ icon = '',
120
+ iconBgColor = '',
121
+ iconSize = 0,
122
+ iconColor = '',
123
+ label = '',
124
+ subLabel = '',
125
+ showBg = null,
126
+ showArrow = false,
127
+ showIconHover = false,
128
+ moreHeight = false,
129
+ href = null,
130
+ kind = 'generic',
131
+ moreShadow = false,
132
+ ...rest
133
+ }: ActionButtonProps = $props();
134
+
135
+ // Derived configuration based on kind
136
+ const config = $derived(ACTION_BUTTON_KINDS[kind] ?? ACTION_BUTTON_KINDS.generic);
137
+
138
+ // Computed values with kind defaults
139
+ const computedIcon = $derived(icon || config.icon);
140
+ const computedIconBgColor = $derived(iconBgColor || config.iconBgColor);
141
+ const computedIconSize = $derived(iconSize || config.iconSize);
142
+ const computedIconColor = $derived(iconColor || config.iconColor);
143
+ const computedLabel = $derived(label || config.label);
144
+ const computedSubLabel = $derived(subLabel || config.subLabel);
145
+ const computedShowBg = $derived(showBg === null || showBg === undefined ? config.showBg : showBg);
146
+ const computedShowArrow = $derived(showArrow || config.showArrow);
147
+ const computedShowIconHover = $derived(showIconHover || config.showIconHover);
148
+ const computedMoreHeight = $derived(moreHeight || config.moreHeight);
149
+ </script>
150
+
151
+ <Button
152
+ color="alternative"
153
+ href={href || ''}
154
+ class={cn(
155
+ 'flex items-center rounded-[6px] py-2.5 pl-4',
156
+ computedShowBg && 'bg-white',
157
+ moreShadow && 'loginbox'
158
+ )}
159
+ >
160
+ <div class="flex w-full items-center justify-between pr-2">
161
+ <div class="flex w-full flex-grow items-center justify-start gap-3 truncate text-ellipsis">
162
+ <div class={`${computedIconBgColor} grid place-content-center rounded-[5px] p-2.5`}>
163
+ <IconifyIcon
164
+ icon={computedIcon}
165
+ style="font-size: {computedIconSize}x;"
166
+ class={computedIconColor}
167
+ />
168
+ </div>
169
+ <div class="flex flex-grow flex-col overflow-hidden text-left">
170
+ <span
171
+ class=" block w-full truncate overflow-hidden tracking-tight text-ellipsis whitespace-nowrap"
172
+ >
173
+ {computedLabel}
174
+ </span>
175
+ <span
176
+ title={computedSubLabel}
177
+ class="block w-full truncate overflow-hidden text-sm text-ellipsis whitespace-nowrap text-gray-500"
178
+ >
179
+ {computedSubLabel}
180
+ </span>
181
+ </div>
182
+ </div>
183
+ {#if computedShowArrow}
184
+ <p class="grid h-9 w-9 shrink-0 place-content-center rounded-full">
185
+ <IconifyIcon icon="iconamoon:arrow-right-2-light" style="font-size: 25px;" />
186
+ </p>
187
+ {/if}
188
+ </div>
189
+ </Button>
190
+
191
+ <!-- <a
192
+ {...rest}
193
+ {href}
194
+ class="w-full cursor-pointer rounded-[6px] border-gray-400/40 px-2 py-2.5 {!computedShowBg &&
195
+ 'hover:bg-blue-200/40'} "
196
+ class:bg-white={computedShowBg}
197
+ class:shadow={computedShowBg}
198
+ class:hover:scale-95={computedShowBg}
199
+ class:h-20={computedMoreHeight}
200
+ class:loginbox={moreShadow}
201
+ >
202
+ <div class="flex w-full items-center justify-between">
203
+ <div class="flex w-full flex-grow items-center justify-start gap-3">
204
+ <div class="{computedIconBgColor} grid place-content-center rounded-[5px] p-2.5">
205
+ <IconifyIcon
206
+ icon={computedIcon}
207
+ style="font-size: {computedIconSize}px;"
208
+ class={computedIconColor}
209
+ />
210
+ </div>
211
+ <div class="flex w-10 flex-grow flex-col overflow-hidden text-left">
212
+ <div
213
+ class="block w-full truncate overflow-hidden font-medium text-ellipsis whitespace-nowrap"
214
+ >
215
+ {computedLabel}
216
+ </div>
217
+ <div
218
+ class="block w-full truncate overflow-hidden text-sm text-ellipsis whitespace-nowrap text-gray-500"
219
+ >
220
+ {computedSubLabel}
221
+ </div>
222
+ </div>
223
+ </div>
224
+ <div
225
+ class:hidden={!computedShowArrow}
226
+ class="grid h-9 w-9 place-content-center rounded-full"
227
+ class:hover:bg-gray-200={computedShowIconHover}
228
+ >
229
+ <IconifyIcon icon="iconamoon:arrow-right-2-light" style="font-size: 25px;" />
230
+ </div>
231
+ </div>
232
+ </a> -->
@@ -0,0 +1,114 @@
1
+ export declare const ACTION_BUTTON_KINDS: {
2
+ readonly generic: {
3
+ readonly icon: "solar:verified-check-bold";
4
+ readonly iconBgColor: "bg-green-300";
5
+ readonly iconSize: 25;
6
+ readonly iconColor: "text-gray-800";
7
+ readonly label: "";
8
+ readonly subLabel: "";
9
+ readonly showBg: true;
10
+ readonly showArrow: false;
11
+ readonly showIconHover: true;
12
+ readonly moreHeight: false;
13
+ };
14
+ readonly enquiries: {
15
+ readonly icon: "entypo:chat";
16
+ readonly iconBgColor: "bg-orange-300";
17
+ readonly iconSize: 25;
18
+ readonly iconColor: "text-orange-800";
19
+ readonly label: "";
20
+ readonly subLabel: "";
21
+ readonly showBg: true;
22
+ readonly showArrow: false;
23
+ readonly showIconHover: true;
24
+ readonly moreHeight: false;
25
+ };
26
+ readonly accept: {
27
+ readonly icon: "ph:check-circle";
28
+ readonly iconBgColor: "bg-green-300";
29
+ readonly iconSize: 25;
30
+ readonly iconColor: "text-gray-800";
31
+ readonly label: "";
32
+ readonly subLabel: "";
33
+ readonly showBg: true;
34
+ readonly showArrow: false;
35
+ readonly showIconHover: true;
36
+ readonly moreHeight: false;
37
+ };
38
+ readonly approve: {
39
+ readonly icon: "ph:check-circle";
40
+ readonly iconBgColor: "bg-green-300";
41
+ readonly iconSize: 25;
42
+ readonly iconColor: "text-gray-800";
43
+ readonly label: "";
44
+ readonly subLabel: "";
45
+ readonly showBg: true;
46
+ readonly showArrow: false;
47
+ readonly showIconHover: true;
48
+ readonly moreHeight: false;
49
+ };
50
+ readonly reject: {
51
+ readonly icon: "ph:x-circle";
52
+ readonly iconBgColor: "bg-red-400";
53
+ readonly iconSize: 25;
54
+ readonly iconColor: "text-white";
55
+ readonly label: "";
56
+ readonly subLabel: "";
57
+ readonly showBg: true;
58
+ readonly showArrow: false;
59
+ readonly showIconHover: true;
60
+ readonly moreHeight: false;
61
+ };
62
+ readonly transfer: {
63
+ readonly icon: "mdi:file-sync";
64
+ readonly iconBgColor: "bg-sky-300";
65
+ readonly iconSize: 25;
66
+ readonly iconColor: "text-gray-800";
67
+ readonly label: "";
68
+ readonly subLabel: "";
69
+ readonly showBg: true;
70
+ readonly showArrow: false;
71
+ readonly showIconHover: true;
72
+ readonly moreHeight: false;
73
+ };
74
+ readonly recommendation: {
75
+ readonly icon: "material-symbols:recommend-outline";
76
+ readonly iconBgColor: "bg-yellow-300";
77
+ readonly iconSize: 25;
78
+ readonly iconColor: "text-gray-800";
79
+ readonly label: "";
80
+ readonly subLabel: "";
81
+ readonly showBg: true;
82
+ readonly showArrow: false;
83
+ readonly showIconHover: true;
84
+ readonly moreHeight: false;
85
+ };
86
+ readonly file: {
87
+ readonly icon: "ph:file-text";
88
+ readonly iconBgColor: "bg-gray-200";
89
+ readonly iconSize: 25;
90
+ readonly iconColor: "text-gray-800";
91
+ readonly label: "";
92
+ readonly subLabel: "";
93
+ readonly showBg: true;
94
+ readonly showArrow: false;
95
+ readonly showIconHover: true;
96
+ readonly moreHeight: false;
97
+ };
98
+ readonly form: {
99
+ readonly icon: "game-icons:archive-register";
100
+ readonly iconBgColor: "bg-teal-100";
101
+ readonly iconSize: 25;
102
+ readonly iconColor: "text-blue-800";
103
+ readonly label: "";
104
+ readonly subLabel: "";
105
+ readonly showBg: true;
106
+ readonly showArrow: false;
107
+ readonly showIconHover: true;
108
+ readonly moreHeight: false;
109
+ };
110
+ };
111
+ import { type ActionButtonProps } from '../../index.js';
112
+ declare const ActionButton: import("svelte").Component<ActionButtonProps, {}, "">;
113
+ type ActionButton = ReturnType<typeof ActionButton>;
114
+ export default ActionButton;
@@ -1,3 +1,4 @@
1
1
  export { default as Button } from './Button.svelte';
2
+ export { default as ActionButton } from './ActionButton.svelte';
2
3
  export { default as GradientButton } from './GradientButton.svelte';
3
4
  export { button, gradientButton } from './theme.js';
@@ -1,3 +1,4 @@
1
1
  export { default as Button } from './Button.svelte';
2
+ export { default as ActionButton } from './ActionButton.svelte';
2
3
  export { default as GradientButton } from './GradientButton.svelte';
3
4
  export { button, gradientButton } from './theme.js';
@@ -66,7 +66,7 @@
66
66
  <div class="py-2 text-center font-bold">Notifications</div>
67
67
  {/if}
68
68
  <div
69
- class="scrollbar-thumb-blue scrollbar-thumb-rounded scrollbar-track-blue-lighter scrollbar-w-2 scrolling-touch flex max-h-80 flex-col divide-y overflow-y-auto"
69
+ class="scrollbar-thumb-blue scrollbar-thumb-rounded scrollbar-track-blue-lighter scrollbar-w-2 scrolling-touch flex max-h-80 flex-col divide-y divide-gray-300 overflow-y-auto"
70
70
  >
71
71
  {#if busy}
72
72
  <div class="flex h-52 w-96 items-center justify-center">
@@ -196,7 +196,7 @@
196
196
  </thead>
197
197
  <tbody
198
198
  {...$tableBodyAttrs}
199
- class="divide-y"
199
+ class="divide-y divide-gray-300"
200
200
  class:bg-white={bgWhite}
201
201
  use:clickOutsideAction
202
202
  onclickoutside={closeDropDown}
@@ -10,7 +10,7 @@
10
10
  </th>
11
11
  {/each}
12
12
  </thead>
13
- <tbody class="divide-y border-t border-gray-400">
13
+ <tbody class="divide-y border-t border-gray-300">
14
14
  {#each Array(bodySize) as _}
15
15
  <tr>
16
16
  {#each Array(headerSize) as _}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rkosafo/cai.components",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",