@rkosafo/cai.components 0.0.78 → 0.0.80
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/README.md +8 -8
- package/dist/baseEditor/index.svelte +32 -32
- package/dist/builders/filters/FilterBuilder.svelte +641 -641
- package/dist/forms/FormCheckbox/FormCheckbox.svelte +53 -53
- package/dist/forms/FormClEditor/ClEdito.svelte +68 -68
- package/dist/forms/FormDatepicker/FormDatepicker.svelte +159 -159
- package/dist/forms/FormFileUpload/FormFileUplad.svelte +134 -134
- package/dist/forms/FormInput/FormInput.svelte +87 -87
- package/dist/forms/FormRadio/FormRadio.svelte +53 -53
- package/dist/forms/FormSelect/FormSelect.svelte +88 -88
- package/dist/forms/FormTextarea/FormTextarea.svelte +78 -78
- package/dist/forms/button-toggle/ButtonToggle.svelte +119 -119
- package/dist/forms/button-toggle/CheckIcon.svelte +28 -28
- package/dist/forms/checkbox/Checkbox.svelte +82 -82
- package/dist/forms/checkbox/CheckboxButton.svelte +92 -92
- package/dist/forms/datepicker/Datepicker.svelte +707 -707
- package/dist/forms/form/Form.svelte +69 -69
- package/dist/forms/input/Input.svelte +363 -363
- package/dist/forms/label/Label.svelte +38 -38
- package/dist/forms/radio/Radio.svelte +48 -48
- package/dist/forms/radio/RadioButton.svelte +22 -22
- package/dist/forms/select/Select.svelte +56 -56
- package/dist/forms/textarea/Textarea.svelte +165 -165
- package/dist/forms/toggle/Toggle.svelte +70 -70
- package/dist/layout/Chat/CategorySelector.svelte +52 -52
- package/dist/layout/Chat/ChatEntry.svelte +246 -246
- package/dist/layout/Chat/ChatEntrySkeleton.svelte +81 -81
- package/dist/layout/Chat/ChatHeader.svelte +172 -172
- package/dist/layout/Chat/ChatInput.svelte +207 -207
- package/dist/layout/Chat/DraggableWindow.svelte +230 -230
- package/dist/layout/Chat/PreviewPage.svelte +182 -182
- package/dist/layout/Chat/RichText.svelte +216 -216
- package/dist/layout/ComponentCanvas/Canvas.svelte +40 -40
- package/dist/layout/ComponentCanvas/ComponentRenderer.svelte +85 -85
- package/dist/layout/TF/Content/Content.svelte +21 -21
- package/dist/layout/TF/Header/Header.svelte +166 -166
- package/dist/layout/TF/Sidebar/Sidebar.svelte +148 -148
- package/dist/layout/TF/Wrapper/Wrapper.svelte +17 -17
- package/dist/layout/mailing/MailPaginator.svelte +36 -36
- package/dist/layout/mailing/MailSidebar.svelte +39 -39
- package/dist/layout/mailing/MailToolBar.svelte +174 -174
- package/dist/layout/mailing/MailingContent.svelte +10 -10
- package/dist/layout/mailing/MailingHeader.svelte +55 -55
- package/dist/layout/mailing/MailingMessageCard.svelte +112 -112
- package/dist/layout/mailing/MailingMessageViewer.svelte +87 -87
- package/dist/layout/mailing/MailingModule.svelte +448 -448
- package/dist/styles/docs.css +615 -615
- package/dist/styles/tf-layout.css +185 -185
- package/dist/themes/ThemeProvider.svelte +20 -20
- package/dist/types/index.d.ts +2 -0
- package/dist/typography/heading/Heading.svelte +35 -35
- package/dist/ui/accordion/Accordion.svelte +49 -49
- package/dist/ui/accordion/AccordionItem.svelte +173 -173
- package/dist/ui/alert/Alert.svelte +83 -83
- package/dist/ui/alertDialog/AlertDialog.svelte +40 -40
- package/dist/ui/avatar/Avatar.svelte +77 -77
- package/dist/ui/box/Box.svelte +28 -28
- package/dist/ui/breadcrumb/Breadcrumb.svelte +39 -39
- package/dist/ui/buttons/ActionButton.svelte +234 -234
- package/dist/ui/buttons/Button.svelte +102 -102
- package/dist/ui/buttons/GradientButton.svelte +59 -59
- package/dist/ui/datatable/Datatable.svelte +525 -525
- package/dist/ui/drawer/Drawer.svelte +300 -300
- package/dist/ui/dropdown/Dropdown.svelte +36 -36
- package/dist/ui/dropdown/DropdownDivider.svelte +11 -11
- package/dist/ui/dropdown/DropdownGroup.svelte +14 -14
- package/dist/ui/dropdown/DropdownHeader.svelte +14 -14
- package/dist/ui/dropdown/DropdownItem.svelte +52 -52
- package/dist/ui/footer/Footer.svelte +15 -15
- package/dist/ui/footer/FooterBrand.svelte +37 -37
- package/dist/ui/footer/FooterCopyright.svelte +45 -45
- package/dist/ui/footer/FooterIcon.svelte +22 -22
- package/dist/ui/footer/FooterLink.svelte +33 -33
- package/dist/ui/footer/FooterLinkGroup.svelte +13 -13
- package/dist/ui/icons/IconifyIcon.svelte +7 -7
- package/dist/ui/indicator/Indicator.svelte +42 -42
- package/dist/ui/modal/Modal.svelte +265 -265
- package/dist/ui/notificationList/NotificationList.svelte +123 -123
- package/dist/ui/pageLoader/PageLoader.svelte +14 -14
- package/dist/ui/pageLoader/PageLoader2.svelte +99 -0
- package/dist/ui/pageLoader/PageLoader2.svelte.d.ts +24 -0
- package/dist/ui/pageLoader/index.d.ts +2 -1
- package/dist/ui/pageLoader/index.js +2 -1
- package/dist/ui/paginate/Paginate.svelte +96 -96
- package/dist/ui/speedDial/SpeedDial.svelte +77 -77
- package/dist/ui/speedDial/SpeedDialButton.svelte +75 -75
- package/dist/ui/speedDial/SpeedDialTrigger.svelte +79 -79
- package/dist/ui/tab/Tab.svelte +93 -67
- package/dist/ui/table/Table.svelte +396 -396
- package/dist/ui/tableLoader/TableLoader.svelte +24 -24
- package/dist/ui/toast/Toast.svelte +337 -337
- package/dist/ui/toast/Toast.svelte.d.ts +10 -10
- package/dist/ui/toolbar/Toolbar.svelte +59 -59
- package/dist/ui/toolbar/ToolbarButton.svelte +56 -56
- package/dist/ui/toolbar/ToolbarGroup.svelte +43 -43
- package/dist/ui/tooltip/Tooltip.svelte +51 -51
- package/dist/utils/Popper.svelte +257 -257
- package/dist/utils/closeButton/CloseButton.svelte +88 -88
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +3 -3
- package/dist/utils/singleSelection.svelte.js +48 -48
- package/dist/youtube/index.svelte +12 -12
- package/package.json +1 -1
|
@@ -1,234 +1,234 @@
|
|
|
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
|
-
onclick,
|
|
133
|
-
...rest
|
|
134
|
-
}: ActionButtonProps = $props();
|
|
135
|
-
|
|
136
|
-
// Derived configuration based on kind
|
|
137
|
-
const config = $derived(ACTION_BUTTON_KINDS[kind] ?? ACTION_BUTTON_KINDS.generic);
|
|
138
|
-
|
|
139
|
-
// Computed values with kind defaults
|
|
140
|
-
const computedIcon = $derived(icon || config.icon);
|
|
141
|
-
const computedIconBgColor = $derived(iconBgColor || config.iconBgColor);
|
|
142
|
-
const computedIconSize = $derived(iconSize || config.iconSize);
|
|
143
|
-
const computedIconColor = $derived(iconColor || config.iconColor);
|
|
144
|
-
const computedLabel = $derived(label || config.label);
|
|
145
|
-
const computedSubLabel = $derived(subLabel || config.subLabel);
|
|
146
|
-
const computedShowBg = $derived(showBg === null || showBg === undefined ? config.showBg : showBg);
|
|
147
|
-
const computedShowArrow = $derived(showArrow || config.showArrow);
|
|
148
|
-
const computedShowIconHover = $derived(showIconHover || config.showIconHover);
|
|
149
|
-
const computedMoreHeight = $derived(moreHeight || config.moreHeight);
|
|
150
|
-
</script>
|
|
151
|
-
|
|
152
|
-
<Button
|
|
153
|
-
onclick={() => onclick?.()}
|
|
154
|
-
color="alternative"
|
|
155
|
-
href={href || ''}
|
|
156
|
-
class={cn(
|
|
157
|
-
'flex items-center rounded-[6px] py-2.5 pl-4',
|
|
158
|
-
computedShowBg && 'bg-white',
|
|
159
|
-
moreShadow && 'loginbox'
|
|
160
|
-
)}
|
|
161
|
-
>
|
|
162
|
-
<div class="flex w-full items-center justify-between pr-2">
|
|
163
|
-
<div class="flex w-full flex-grow items-center justify-start gap-3 truncate text-ellipsis">
|
|
164
|
-
<div class={`${computedIconBgColor} grid place-content-center rounded-[5px] p-2.5`}>
|
|
165
|
-
<IconifyIcon
|
|
166
|
-
icon={computedIcon}
|
|
167
|
-
style="font-size: {computedIconSize}x;"
|
|
168
|
-
class={computedIconColor}
|
|
169
|
-
/>
|
|
170
|
-
</div>
|
|
171
|
-
<div class="flex flex-grow flex-col overflow-hidden text-left">
|
|
172
|
-
<span
|
|
173
|
-
class=" block w-full truncate overflow-hidden tracking-tight text-ellipsis whitespace-nowrap"
|
|
174
|
-
>
|
|
175
|
-
{computedLabel}
|
|
176
|
-
</span>
|
|
177
|
-
<span
|
|
178
|
-
title={computedSubLabel}
|
|
179
|
-
class="block w-full truncate overflow-hidden text-sm text-ellipsis whitespace-nowrap text-gray-500"
|
|
180
|
-
>
|
|
181
|
-
{computedSubLabel}
|
|
182
|
-
</span>
|
|
183
|
-
</div>
|
|
184
|
-
</div>
|
|
185
|
-
{#if computedShowArrow}
|
|
186
|
-
<p class="grid h-9 w-9 shrink-0 place-content-center rounded-full">
|
|
187
|
-
<IconifyIcon icon="iconamoon:arrow-right-2-light" style="font-size: 25px;" />
|
|
188
|
-
</p>
|
|
189
|
-
{/if}
|
|
190
|
-
</div>
|
|
191
|
-
</Button>
|
|
192
|
-
|
|
193
|
-
<!-- <a
|
|
194
|
-
{...rest}
|
|
195
|
-
{href}
|
|
196
|
-
class="w-full cursor-pointer rounded-[6px] border-gray-400/40 px-2 py-2.5 {!computedShowBg &&
|
|
197
|
-
'hover:bg-blue-200/40'} "
|
|
198
|
-
class:bg-white={computedShowBg}
|
|
199
|
-
class:shadow={computedShowBg}
|
|
200
|
-
class:hover:scale-95={computedShowBg}
|
|
201
|
-
class:h-20={computedMoreHeight}
|
|
202
|
-
class:loginbox={moreShadow}
|
|
203
|
-
>
|
|
204
|
-
<div class="flex w-full items-center justify-between">
|
|
205
|
-
<div class="flex w-full flex-grow items-center justify-start gap-3">
|
|
206
|
-
<div class="{computedIconBgColor} grid place-content-center rounded-[5px] p-2.5">
|
|
207
|
-
<IconifyIcon
|
|
208
|
-
icon={computedIcon}
|
|
209
|
-
style="font-size: {computedIconSize}px;"
|
|
210
|
-
class={computedIconColor}
|
|
211
|
-
/>
|
|
212
|
-
</div>
|
|
213
|
-
<div class="flex w-10 flex-grow flex-col overflow-hidden text-left">
|
|
214
|
-
<div
|
|
215
|
-
class="block w-full truncate overflow-hidden font-medium text-ellipsis whitespace-nowrap"
|
|
216
|
-
>
|
|
217
|
-
{computedLabel}
|
|
218
|
-
</div>
|
|
219
|
-
<div
|
|
220
|
-
class="block w-full truncate overflow-hidden text-sm text-ellipsis whitespace-nowrap text-gray-500"
|
|
221
|
-
>
|
|
222
|
-
{computedSubLabel}
|
|
223
|
-
</div>
|
|
224
|
-
</div>
|
|
225
|
-
</div>
|
|
226
|
-
<div
|
|
227
|
-
class:hidden={!computedShowArrow}
|
|
228
|
-
class="grid h-9 w-9 place-content-center rounded-full"
|
|
229
|
-
class:hover:bg-gray-200={computedShowIconHover}
|
|
230
|
-
>
|
|
231
|
-
<IconifyIcon icon="iconamoon:arrow-right-2-light" style="font-size: 25px;" />
|
|
232
|
-
</div>
|
|
233
|
-
</div>
|
|
234
|
-
</a> -->
|
|
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
|
+
onclick,
|
|
133
|
+
...rest
|
|
134
|
+
}: ActionButtonProps = $props();
|
|
135
|
+
|
|
136
|
+
// Derived configuration based on kind
|
|
137
|
+
const config = $derived(ACTION_BUTTON_KINDS[kind] ?? ACTION_BUTTON_KINDS.generic);
|
|
138
|
+
|
|
139
|
+
// Computed values with kind defaults
|
|
140
|
+
const computedIcon = $derived(icon || config.icon);
|
|
141
|
+
const computedIconBgColor = $derived(iconBgColor || config.iconBgColor);
|
|
142
|
+
const computedIconSize = $derived(iconSize || config.iconSize);
|
|
143
|
+
const computedIconColor = $derived(iconColor || config.iconColor);
|
|
144
|
+
const computedLabel = $derived(label || config.label);
|
|
145
|
+
const computedSubLabel = $derived(subLabel || config.subLabel);
|
|
146
|
+
const computedShowBg = $derived(showBg === null || showBg === undefined ? config.showBg : showBg);
|
|
147
|
+
const computedShowArrow = $derived(showArrow || config.showArrow);
|
|
148
|
+
const computedShowIconHover = $derived(showIconHover || config.showIconHover);
|
|
149
|
+
const computedMoreHeight = $derived(moreHeight || config.moreHeight);
|
|
150
|
+
</script>
|
|
151
|
+
|
|
152
|
+
<Button
|
|
153
|
+
onclick={() => onclick?.()}
|
|
154
|
+
color="alternative"
|
|
155
|
+
href={href || ''}
|
|
156
|
+
class={cn(
|
|
157
|
+
'flex items-center rounded-[6px] py-2.5 pl-4',
|
|
158
|
+
computedShowBg && 'bg-white',
|
|
159
|
+
moreShadow && 'loginbox'
|
|
160
|
+
)}
|
|
161
|
+
>
|
|
162
|
+
<div class="flex w-full items-center justify-between pr-2">
|
|
163
|
+
<div class="flex w-full flex-grow items-center justify-start gap-3 truncate text-ellipsis">
|
|
164
|
+
<div class={`${computedIconBgColor} grid place-content-center rounded-[5px] p-2.5`}>
|
|
165
|
+
<IconifyIcon
|
|
166
|
+
icon={computedIcon}
|
|
167
|
+
style="font-size: {computedIconSize}x;"
|
|
168
|
+
class={computedIconColor}
|
|
169
|
+
/>
|
|
170
|
+
</div>
|
|
171
|
+
<div class="flex flex-grow flex-col overflow-hidden text-left">
|
|
172
|
+
<span
|
|
173
|
+
class=" block w-full truncate overflow-hidden tracking-tight text-ellipsis whitespace-nowrap"
|
|
174
|
+
>
|
|
175
|
+
{computedLabel}
|
|
176
|
+
</span>
|
|
177
|
+
<span
|
|
178
|
+
title={computedSubLabel}
|
|
179
|
+
class="block w-full truncate overflow-hidden text-sm text-ellipsis whitespace-nowrap text-gray-500"
|
|
180
|
+
>
|
|
181
|
+
{computedSubLabel}
|
|
182
|
+
</span>
|
|
183
|
+
</div>
|
|
184
|
+
</div>
|
|
185
|
+
{#if computedShowArrow}
|
|
186
|
+
<p class="grid h-9 w-9 shrink-0 place-content-center rounded-full">
|
|
187
|
+
<IconifyIcon icon="iconamoon:arrow-right-2-light" style="font-size: 25px;" />
|
|
188
|
+
</p>
|
|
189
|
+
{/if}
|
|
190
|
+
</div>
|
|
191
|
+
</Button>
|
|
192
|
+
|
|
193
|
+
<!-- <a
|
|
194
|
+
{...rest}
|
|
195
|
+
{href}
|
|
196
|
+
class="w-full cursor-pointer rounded-[6px] border-gray-400/40 px-2 py-2.5 {!computedShowBg &&
|
|
197
|
+
'hover:bg-blue-200/40'} "
|
|
198
|
+
class:bg-white={computedShowBg}
|
|
199
|
+
class:shadow={computedShowBg}
|
|
200
|
+
class:hover:scale-95={computedShowBg}
|
|
201
|
+
class:h-20={computedMoreHeight}
|
|
202
|
+
class:loginbox={moreShadow}
|
|
203
|
+
>
|
|
204
|
+
<div class="flex w-full items-center justify-between">
|
|
205
|
+
<div class="flex w-full flex-grow items-center justify-start gap-3">
|
|
206
|
+
<div class="{computedIconBgColor} grid place-content-center rounded-[5px] p-2.5">
|
|
207
|
+
<IconifyIcon
|
|
208
|
+
icon={computedIcon}
|
|
209
|
+
style="font-size: {computedIconSize}px;"
|
|
210
|
+
class={computedIconColor}
|
|
211
|
+
/>
|
|
212
|
+
</div>
|
|
213
|
+
<div class="flex w-10 flex-grow flex-col overflow-hidden text-left">
|
|
214
|
+
<div
|
|
215
|
+
class="block w-full truncate overflow-hidden font-medium text-ellipsis whitespace-nowrap"
|
|
216
|
+
>
|
|
217
|
+
{computedLabel}
|
|
218
|
+
</div>
|
|
219
|
+
<div
|
|
220
|
+
class="block w-full truncate overflow-hidden text-sm text-ellipsis whitespace-nowrap text-gray-500"
|
|
221
|
+
>
|
|
222
|
+
{computedSubLabel}
|
|
223
|
+
</div>
|
|
224
|
+
</div>
|
|
225
|
+
</div>
|
|
226
|
+
<div
|
|
227
|
+
class:hidden={!computedShowArrow}
|
|
228
|
+
class="grid h-9 w-9 place-content-center rounded-full"
|
|
229
|
+
class:hover:bg-gray-200={computedShowIconHover}
|
|
230
|
+
>
|
|
231
|
+
<IconifyIcon icon="iconamoon:arrow-right-2-light" style="font-size: 25px;" />
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
</a> -->
|
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
<script lang="ts">
|
|
4
|
-
import { getContext, type Snippet } from 'svelte';
|
|
5
|
-
import clsx from 'clsx';
|
|
6
|
-
import { button, getTheme, type ButtonProps, type SizeType } from '../../index.js';
|
|
7
|
-
|
|
8
|
-
const group: SizeType = getContext('group');
|
|
9
|
-
const ctxDisabled: boolean | undefined = getContext('disabled');
|
|
10
|
-
|
|
11
|
-
let {
|
|
12
|
-
children,
|
|
13
|
-
pill,
|
|
14
|
-
outline = false,
|
|
15
|
-
size = 'md',
|
|
16
|
-
color,
|
|
17
|
-
shadow = false,
|
|
18
|
-
tag = 'button',
|
|
19
|
-
disabled,
|
|
20
|
-
loading = false,
|
|
21
|
-
class: className,
|
|
22
|
-
leadingIcon,
|
|
23
|
-
trailingIcon,
|
|
24
|
-
ripple = true,
|
|
25
|
-
...restProps
|
|
26
|
-
}: ButtonProps = $props();
|
|
27
|
-
|
|
28
|
-
const theme = getTheme('button');
|
|
29
|
-
|
|
30
|
-
let actualSize = $derived(group ? 'sm' : size);
|
|
31
|
-
let actualColor = $derived(color ?? (group ? (outline ? 'dark' : 'alternative') : 'primary'));
|
|
32
|
-
let isDisabled = $derived(Boolean(ctxDisabled) || Boolean(disabled) || loading);
|
|
33
|
-
|
|
34
|
-
const {
|
|
35
|
-
base,
|
|
36
|
-
outline: outline_,
|
|
37
|
-
shadow: shadow_
|
|
38
|
-
} = $derived(
|
|
39
|
-
button({ color: actualColor, size: actualSize, disabled: isDisabled, pill, group: !!group })
|
|
40
|
-
);
|
|
41
|
-
let btnCls = $derived(
|
|
42
|
-
base({ class: clsx(outline && outline_(), shadow && shadow_(), theme?.base, className) })
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
function createRipple(event: MouseEvent) {
|
|
46
|
-
if (!ripple || isDisabled) {
|
|
47
|
-
// onclick?.(event as any);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const button = event.currentTarget as HTMLElement;
|
|
52
|
-
const diameter = Math.max(button.clientWidth, button.clientHeight);
|
|
53
|
-
const radius = diameter / 2;
|
|
54
|
-
|
|
55
|
-
const rippleSpan = document.createElement('span');
|
|
56
|
-
rippleSpan.style.width = rippleSpan.style.height = `${diameter}px`;
|
|
57
|
-
rippleSpan.style.left = `${event.clientX - button.getBoundingClientRect().left - radius}px`;
|
|
58
|
-
rippleSpan.style.top = `${event.clientY - button.getBoundingClientRect().top - radius}px`;
|
|
59
|
-
rippleSpan.classList.add('ripple', 'opacity-70');
|
|
60
|
-
|
|
61
|
-
rippleSpan.addEventListener('animationend', () => {
|
|
62
|
-
{
|
|
63
|
-
// onclick?.(event as any);
|
|
64
|
-
rippleSpan.remove();
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
button.appendChild(rippleSpan);
|
|
68
|
-
}
|
|
69
|
-
</script>
|
|
70
|
-
|
|
71
|
-
{#if restProps.href === undefined}
|
|
72
|
-
<button type="button" {...restProps} class={btnCls} disabled={isDisabled}>
|
|
73
|
-
{@render leadingIcon?.()}
|
|
74
|
-
{@render children?.()}
|
|
75
|
-
{@render trailingIcon?.()}
|
|
76
|
-
|
|
77
|
-
{#if loading}
|
|
78
|
-
<svg
|
|
79
|
-
class="ml-2 h-4 w-4 animate-spin text-white"
|
|
80
|
-
fill="none"
|
|
81
|
-
viewBox="0 0 24 24"
|
|
82
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
83
|
-
aria-hidden="true"
|
|
84
|
-
>
|
|
85
|
-
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
|
86
|
-
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z" />
|
|
87
|
-
</svg>
|
|
88
|
-
{/if}
|
|
89
|
-
</button>
|
|
90
|
-
{:else if restProps.href}
|
|
91
|
-
<a {...restProps} class={btnCls} role="button">
|
|
92
|
-
{@render leadingIcon?.()}
|
|
93
|
-
{@render children?.()}
|
|
94
|
-
{@render trailingIcon?.()}
|
|
95
|
-
</a>
|
|
96
|
-
{:else}
|
|
97
|
-
<svelte:element this={tag} {...restProps} class={btnCls}>
|
|
98
|
-
{@render leadingIcon?.()}
|
|
99
|
-
{@render children?.()}
|
|
100
|
-
{@render trailingIcon?.()}
|
|
101
|
-
</svelte:element>
|
|
102
|
-
{/if}
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
<script lang="ts">
|
|
4
|
+
import { getContext, type Snippet } from 'svelte';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { button, getTheme, type ButtonProps, type SizeType } from '../../index.js';
|
|
7
|
+
|
|
8
|
+
const group: SizeType = getContext('group');
|
|
9
|
+
const ctxDisabled: boolean | undefined = getContext('disabled');
|
|
10
|
+
|
|
11
|
+
let {
|
|
12
|
+
children,
|
|
13
|
+
pill,
|
|
14
|
+
outline = false,
|
|
15
|
+
size = 'md',
|
|
16
|
+
color,
|
|
17
|
+
shadow = false,
|
|
18
|
+
tag = 'button',
|
|
19
|
+
disabled,
|
|
20
|
+
loading = false,
|
|
21
|
+
class: className,
|
|
22
|
+
leadingIcon,
|
|
23
|
+
trailingIcon,
|
|
24
|
+
ripple = true,
|
|
25
|
+
...restProps
|
|
26
|
+
}: ButtonProps = $props();
|
|
27
|
+
|
|
28
|
+
const theme = getTheme('button');
|
|
29
|
+
|
|
30
|
+
let actualSize = $derived(group ? 'sm' : size);
|
|
31
|
+
let actualColor = $derived(color ?? (group ? (outline ? 'dark' : 'alternative') : 'primary'));
|
|
32
|
+
let isDisabled = $derived(Boolean(ctxDisabled) || Boolean(disabled) || loading);
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
base,
|
|
36
|
+
outline: outline_,
|
|
37
|
+
shadow: shadow_
|
|
38
|
+
} = $derived(
|
|
39
|
+
button({ color: actualColor, size: actualSize, disabled: isDisabled, pill, group: !!group })
|
|
40
|
+
);
|
|
41
|
+
let btnCls = $derived(
|
|
42
|
+
base({ class: clsx(outline && outline_(), shadow && shadow_(), theme?.base, className) })
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
function createRipple(event: MouseEvent) {
|
|
46
|
+
if (!ripple || isDisabled) {
|
|
47
|
+
// onclick?.(event as any);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const button = event.currentTarget as HTMLElement;
|
|
52
|
+
const diameter = Math.max(button.clientWidth, button.clientHeight);
|
|
53
|
+
const radius = diameter / 2;
|
|
54
|
+
|
|
55
|
+
const rippleSpan = document.createElement('span');
|
|
56
|
+
rippleSpan.style.width = rippleSpan.style.height = `${diameter}px`;
|
|
57
|
+
rippleSpan.style.left = `${event.clientX - button.getBoundingClientRect().left - radius}px`;
|
|
58
|
+
rippleSpan.style.top = `${event.clientY - button.getBoundingClientRect().top - radius}px`;
|
|
59
|
+
rippleSpan.classList.add('ripple', 'opacity-70');
|
|
60
|
+
|
|
61
|
+
rippleSpan.addEventListener('animationend', () => {
|
|
62
|
+
{
|
|
63
|
+
// onclick?.(event as any);
|
|
64
|
+
rippleSpan.remove();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
button.appendChild(rippleSpan);
|
|
68
|
+
}
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
{#if restProps.href === undefined}
|
|
72
|
+
<button type="button" {...restProps} class={btnCls} disabled={isDisabled}>
|
|
73
|
+
{@render leadingIcon?.()}
|
|
74
|
+
{@render children?.()}
|
|
75
|
+
{@render trailingIcon?.()}
|
|
76
|
+
|
|
77
|
+
{#if loading}
|
|
78
|
+
<svg
|
|
79
|
+
class="ml-2 h-4 w-4 animate-spin text-white"
|
|
80
|
+
fill="none"
|
|
81
|
+
viewBox="0 0 24 24"
|
|
82
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
83
|
+
aria-hidden="true"
|
|
84
|
+
>
|
|
85
|
+
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4" />
|
|
86
|
+
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z" />
|
|
87
|
+
</svg>
|
|
88
|
+
{/if}
|
|
89
|
+
</button>
|
|
90
|
+
{:else if restProps.href}
|
|
91
|
+
<a {...restProps} class={btnCls} role="button">
|
|
92
|
+
{@render leadingIcon?.()}
|
|
93
|
+
{@render children?.()}
|
|
94
|
+
{@render trailingIcon?.()}
|
|
95
|
+
</a>
|
|
96
|
+
{:else}
|
|
97
|
+
<svelte:element this={tag} {...restProps} class={btnCls}>
|
|
98
|
+
{@render leadingIcon?.()}
|
|
99
|
+
{@render children?.()}
|
|
100
|
+
{@render trailingIcon?.()}
|
|
101
|
+
</svelte:element>
|
|
102
|
+
{/if}
|