@insymetri/styleguide 0.1.0

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 (148) hide show
  1. package/dist/IIActionGroup/IIActionGroup.svelte +11 -0
  2. package/dist/IIActionGroup/IIActionGroup.svelte.d.ts +6 -0
  3. package/dist/IIActionGroup/index.d.ts +1 -0
  4. package/dist/IIActionGroup/index.js +1 -0
  5. package/dist/IIAsyncState/IIAsyncState.svelte +50 -0
  6. package/dist/IIAsyncState/IIAsyncState.svelte.d.ts +15 -0
  7. package/dist/IIAsyncState/index.d.ts +1 -0
  8. package/dist/IIAsyncState/index.js +1 -0
  9. package/dist/IIAuditTrail/IIAuditTrail.svelte +167 -0
  10. package/dist/IIAuditTrail/IIAuditTrail.svelte.d.ts +13 -0
  11. package/dist/IIAuditTrail/IIAuditTrail.types.d.ts +14 -0
  12. package/dist/IIAuditTrail/IIAuditTrail.types.js +1 -0
  13. package/dist/IIAuditTrail/index.d.ts +2 -0
  14. package/dist/IIAuditTrail/index.js +1 -0
  15. package/dist/IIBadge/IIBadge.svelte +46 -0
  16. package/dist/IIBadge/IIBadge.svelte.d.ts +11 -0
  17. package/dist/IIBadge/IIBadge.types.d.ts +1 -0
  18. package/dist/IIBadge/IIBadge.types.js +1 -0
  19. package/dist/IIBadge/index.d.ts +2 -0
  20. package/dist/IIBadge/index.js +1 -0
  21. package/dist/IIButton/IIButton.svelte +103 -0
  22. package/dist/IIButton/IIButton.svelte.d.ts +23 -0
  23. package/dist/IIButton/index.d.ts +1 -0
  24. package/dist/IIButton/index.js +1 -0
  25. package/dist/IICheckbox/IICheckbox.svelte +66 -0
  26. package/dist/IICheckbox/IICheckbox.svelte.d.ts +16 -0
  27. package/dist/IICheckbox/index.d.ts +1 -0
  28. package/dist/IICheckbox/index.js +1 -0
  29. package/dist/IICheckboxList/IICheckboxList.svelte +15 -0
  30. package/dist/IICheckboxList/IICheckboxList.svelte.d.ts +7 -0
  31. package/dist/IICheckboxList/index.d.ts +1 -0
  32. package/dist/IICheckboxList/index.js +1 -0
  33. package/dist/IICombobox/IICombobox.svelte +158 -0
  34. package/dist/IICombobox/IICombobox.svelte.d.ts +39 -0
  35. package/dist/IICombobox/index.d.ts +1 -0
  36. package/dist/IICombobox/index.js +1 -0
  37. package/dist/IIDatePicker/IIDatePicker.svelte +107 -0
  38. package/dist/IIDatePicker/IIDatePicker.svelte.d.ts +9 -0
  39. package/dist/IIDatePicker/index.d.ts +1 -0
  40. package/dist/IIDatePicker/index.js +1 -0
  41. package/dist/IIDropdownInput/IIDropdownInput.svelte +76 -0
  42. package/dist/IIDropdownInput/IIDropdownInput.svelte.d.ts +15 -0
  43. package/dist/IIDropdownInput/index.d.ts +1 -0
  44. package/dist/IIDropdownInput/index.js +1 -0
  45. package/dist/IIDropdownMenu/IIDropdownMenu.svelte +74 -0
  46. package/dist/IIDropdownMenu/IIDropdownMenu.svelte.d.ts +19 -0
  47. package/dist/IIDropdownMenu/index.d.ts +1 -0
  48. package/dist/IIDropdownMenu/index.js +1 -0
  49. package/dist/IIEditableBadges/IIEditableBadges.svelte +91 -0
  50. package/dist/IIEditableBadges/IIEditableBadges.svelte.d.ts +17 -0
  51. package/dist/IIEditableBadges/index.d.ts +1 -0
  52. package/dist/IIEditableBadges/index.js +1 -0
  53. package/dist/IIEditableText/IIEditableText.svelte +143 -0
  54. package/dist/IIEditableText/IIEditableText.svelte.d.ts +12 -0
  55. package/dist/IIEditableText/index.d.ts +1 -0
  56. package/dist/IIEditableText/index.js +1 -0
  57. package/dist/IIEmptyState/IIEmptyState.svelte +29 -0
  58. package/dist/IIEmptyState/IIEmptyState.svelte.d.ts +9 -0
  59. package/dist/IIEmptyState/index.d.ts +1 -0
  60. package/dist/IIEmptyState/index.js +1 -0
  61. package/dist/IIFilterChip/IIFilterChip.svelte +47 -0
  62. package/dist/IIFilterChip/IIFilterChip.svelte.d.ts +9 -0
  63. package/dist/IIFilterChip/index.d.ts +1 -0
  64. package/dist/IIFilterChip/index.js +1 -0
  65. package/dist/IIFormField/IIFormField.svelte +18 -0
  66. package/dist/IIFormField/IIFormField.svelte.d.ts +9 -0
  67. package/dist/IIFormField/index.d.ts +1 -0
  68. package/dist/IIFormField/index.js +1 -0
  69. package/dist/IIInput/IIInput.svelte +69 -0
  70. package/dist/IIInput/IIInput.svelte.d.ts +15 -0
  71. package/dist/IIInput/index.d.ts +1 -0
  72. package/dist/IIInput/index.js +1 -0
  73. package/dist/IIModal/IIModal.svelte +76 -0
  74. package/dist/IIModal/IIModal.svelte.d.ts +15 -0
  75. package/dist/IIModal/index.d.ts +1 -0
  76. package/dist/IIModal/index.js +1 -0
  77. package/dist/IIOverflowActions/IIOverflowActions.svelte +104 -0
  78. package/dist/IIOverflowActions/IIOverflowActions.svelte.d.ts +16 -0
  79. package/dist/IIOverflowActions/index.d.ts +1 -0
  80. package/dist/IIOverflowActions/index.js +1 -0
  81. package/dist/IIStatusBadge/IIStatusBadge.svelte +29 -0
  82. package/dist/IIStatusBadge/IIStatusBadge.svelte.d.ts +9 -0
  83. package/dist/IIStatusBadge/index.d.ts +1 -0
  84. package/dist/IIStatusBadge/index.js +1 -0
  85. package/dist/IISwitch/IISwitch.svelte +60 -0
  86. package/dist/IISwitch/IISwitch.svelte.d.ts +15 -0
  87. package/dist/IISwitch/index.d.ts +1 -0
  88. package/dist/IISwitch/index.js +1 -0
  89. package/dist/IITable/IITable.svelte +17 -0
  90. package/dist/IITable/IITable.svelte.d.ts +8 -0
  91. package/dist/IITable/index.d.ts +1 -0
  92. package/dist/IITable/index.js +1 -0
  93. package/dist/IITableSkeleton/IITableSkeleton.svelte +32 -0
  94. package/dist/IITableSkeleton/IITableSkeleton.svelte.d.ts +8 -0
  95. package/dist/IITableSkeleton/index.d.ts +1 -0
  96. package/dist/IITableSkeleton/index.js +1 -0
  97. package/dist/IITabs/IITabs.svelte +139 -0
  98. package/dist/IITabs/IITabs.svelte.d.ts +19 -0
  99. package/dist/IITabs/index.d.ts +1 -0
  100. package/dist/IITabs/index.js +1 -0
  101. package/dist/IITaskCardSkeleton/IITaskCardSkeleton.svelte +15 -0
  102. package/dist/IITaskCardSkeleton/IITaskCardSkeleton.svelte.d.ts +26 -0
  103. package/dist/IITaskCardSkeleton/index.d.ts +1 -0
  104. package/dist/IITaskCardSkeleton/index.js +1 -0
  105. package/dist/IITextarea/IITextarea.svelte +79 -0
  106. package/dist/IITextarea/IITextarea.svelte.d.ts +15 -0
  107. package/dist/IITextarea/index.d.ts +1 -0
  108. package/dist/IITextarea/index.js +1 -0
  109. package/dist/IIToaster/IIToaster.svelte +5 -0
  110. package/dist/IIToaster/IIToaster.svelte.d.ts +18 -0
  111. package/dist/IIToaster/index.d.ts +1 -0
  112. package/dist/IIToaster/index.js +1 -0
  113. package/dist/IIViewFilterChip/IIViewFilterChip.svelte +37 -0
  114. package/dist/IIViewFilterChip/IIViewFilterChip.svelte.d.ts +8 -0
  115. package/dist/IIViewFilterChip/index.d.ts +1 -0
  116. package/dist/IIViewFilterChip/index.js +1 -0
  117. package/dist/Typography/Typography.svelte +67 -0
  118. package/dist/Typography/Typography.svelte.d.ts +18 -0
  119. package/dist/Typography/index.d.ts +1 -0
  120. package/dist/Typography/index.js +1 -0
  121. package/dist/icons.d.ts +92 -0
  122. package/dist/icons.js +104 -0
  123. package/dist/index.d.ts +33 -0
  124. package/dist/index.js +35 -0
  125. package/dist/style/base.css +71 -0
  126. package/dist/style/colors.css +183 -0
  127. package/dist/style/global.css +2 -0
  128. package/dist/style/index.d.ts +1 -0
  129. package/dist/style/index.js +1 -0
  130. package/dist/style/tailwind/animations.js +89 -0
  131. package/dist/style/tailwind/colors.d.ts +217 -0
  132. package/dist/style/tailwind/colors.js +239 -0
  133. package/dist/style/tailwind/preset.js +103 -0
  134. package/dist/style/tailwind/radius.d.ts +1 -0
  135. package/dist/style/tailwind/radius.js +5 -0
  136. package/dist/style/tailwind/shadows.d.ts +15 -0
  137. package/dist/style/tailwind/shadows.js +27 -0
  138. package/dist/style/tailwind/spacing.d.ts +1 -0
  139. package/dist/style/tailwind/spacing.js +37 -0
  140. package/dist/style/tailwind/typography.d.ts +100 -0
  141. package/dist/style/tailwind/typography.js +39 -0
  142. package/dist/style/tailwind/z-index.d.ts +1 -0
  143. package/dist/style/tailwind/z-index.js +7 -0
  144. package/dist/toast.d.ts +16 -0
  145. package/dist/toast.js +24 -0
  146. package/dist/utils/cn.d.ts +2 -0
  147. package/dist/utils/cn.js +4 -0
  148. package/package.json +79 -0
@@ -0,0 +1,11 @@
1
+ <script lang="ts">
2
+ type Props = {
3
+ children?: import('svelte').Snippet
4
+ }
5
+
6
+ let {children}: Props = $props()
7
+ </script>
8
+
9
+ <div class="flex gap-8">
10
+ {@render children?.()}
11
+ </div>
@@ -0,0 +1,6 @@
1
+ type Props = {
2
+ children?: import('svelte').Snippet;
3
+ };
4
+ declare const IIActionGroup: import("svelte").Component<Props, {}, "">;
5
+ type IIActionGroup = ReturnType<typeof IIActionGroup>;
6
+ export default IIActionGroup;
@@ -0,0 +1 @@
1
+ export { default as IIActionGroup } from './IIActionGroup.svelte';
@@ -0,0 +1 @@
1
+ export { default as IIActionGroup } from './IIActionGroup.svelte';
@@ -0,0 +1,50 @@
1
+ <script lang="ts">
2
+ import type {Snippet} from 'svelte'
3
+
4
+ type Props = {
5
+ data: unknown
6
+ isLoading: boolean
7
+ isError?: boolean
8
+ error?: Error | null
9
+ loadingMessage?: string
10
+ errorMessage?: string
11
+ notFoundTitle?: string
12
+ notFoundMessage?: string
13
+ skeleton?: Snippet
14
+ children: Snippet<[data: NonNullable<typeof data>]>
15
+ }
16
+
17
+ let {
18
+ data,
19
+ isLoading,
20
+ isError = false,
21
+ error = null,
22
+ loadingMessage = 'Loading...',
23
+ errorMessage,
24
+ notFoundTitle = 'Not Found',
25
+ notFoundMessage = 'The requested resource could not be found.',
26
+ skeleton,
27
+ children,
28
+ }: Props = $props()
29
+ </script>
30
+
31
+ {#if isLoading}
32
+ {#if skeleton}
33
+ {@render skeleton()}
34
+ {:else}
35
+ <div class="p-32 text-center bg-surface border border-primary rounded-10">
36
+ <p class="text-secondary m-0">{loadingMessage}</p>
37
+ </div>
38
+ {/if}
39
+ {:else if isError}
40
+ <div class="p-32 text-center bg-surface border border-primary rounded-10">
41
+ <p class="text-error m-0">{errorMessage ?? error?.message ?? 'An error occurred'}</p>
42
+ </div>
43
+ {:else if !data}
44
+ <div class="p-32 text-center bg-surface border border-primary rounded-10">
45
+ <h3 class="text-h3 text-body m-0 mb-8">{notFoundTitle}</h3>
46
+ <p class="text-secondary m-0">{notFoundMessage}</p>
47
+ </div>
48
+ {:else}
49
+ {@render children(data)}
50
+ {/if}
@@ -0,0 +1,15 @@
1
+ import type { Snippet } from 'svelte';
2
+ declare const IIAsyncState: import("svelte").Component<{
3
+ data: unknown;
4
+ isLoading: boolean;
5
+ isError?: boolean;
6
+ error?: Error | null;
7
+ loadingMessage?: string;
8
+ errorMessage?: string;
9
+ notFoundTitle?: string;
10
+ notFoundMessage?: string;
11
+ skeleton?: Snippet;
12
+ children: Snippet<[data: NonNullable<unknown>]>;
13
+ }, {}, "">;
14
+ type IIAsyncState = ReturnType<typeof IIAsyncState>;
15
+ export default IIAsyncState;
@@ -0,0 +1 @@
1
+ export { default as IIAsyncState } from './IIAsyncState.svelte';
@@ -0,0 +1 @@
1
+ export { default as IIAsyncState } from './IIAsyncState.svelte';
@@ -0,0 +1,167 @@
1
+ <script lang="ts">
2
+ import type {Component} from 'svelte'
3
+ import {cn} from '../utils/cn'
4
+ import {
5
+ IconPayment,
6
+ IconDescription,
7
+ IconAssignment,
8
+ IconUpdate,
9
+ IconCall,
10
+ IconChat,
11
+ IconMail,
12
+ IconLogin,
13
+ IconPerson,
14
+ IconSms,
15
+ IconAdd,
16
+ IconUser,
17
+ IconCalendar,
18
+ IconCircle,
19
+ } from '../icons'
20
+
21
+ import type {Severity, AuditEvent, AuditFilter} from './IIAuditTrail.types'
22
+
23
+ type Props = {
24
+ events: AuditEvent[]
25
+ filters: AuditFilter[]
26
+ loading?: boolean
27
+ error?: string | null
28
+ emptyMessage?: string
29
+ maxHeight?: string
30
+ }
31
+
32
+ let {events, filters, loading = false, error = null, emptyMessage = 'No activity found', maxHeight}: Props = $props()
33
+
34
+ let activeFilter = $state('all')
35
+
36
+ const categoryIcons: Record<string, Component> = {
37
+ payment: IconPayment,
38
+ document: IconDescription,
39
+ loan: IconDescription,
40
+ application: IconAssignment,
41
+ task: IconAssignment,
42
+ contact: IconPerson,
43
+ phone: IconCall,
44
+ call: IconCall,
45
+ communication: IconChat,
46
+ login: IconLogin,
47
+ email: IconMail,
48
+ sms: IconSms,
49
+ created: IconAdd,
50
+ status: IconUpdate,
51
+ assignment: IconUser,
52
+ priority: IconCircle,
53
+ description: IconDescription,
54
+ deadline: IconCalendar,
55
+ }
56
+
57
+ function getCategoryIcon(category: string): Component {
58
+ return categoryIcons[category] || IconUpdate
59
+ }
60
+
61
+ const categorySeverity: Record<string, Severity> = {
62
+ payment: 'critical',
63
+ status: 'important',
64
+ created: 'standard',
65
+ assignment: 'standard',
66
+ application: 'standard',
67
+ loan: 'standard',
68
+ communication: 'standard',
69
+ phone: 'standard',
70
+ email: 'standard',
71
+ sms: 'standard',
72
+ contact: 'standard',
73
+ }
74
+
75
+ function getDefaultSeverity(category: string): Severity {
76
+ return categorySeverity[category] || 'routine'
77
+ }
78
+
79
+ function resolveSeverity(event: AuditEvent): Severity {
80
+ return event.severity || getDefaultSeverity(event.category)
81
+ }
82
+
83
+ function formatTimestamp(ts: string): string {
84
+ const date = new Date(ts)
85
+ return date.toLocaleString('en-US', {
86
+ year: 'numeric',
87
+ month: 'short',
88
+ day: 'numeric',
89
+ hour: 'numeric',
90
+ minute: '2-digit',
91
+ hour12: true,
92
+ })
93
+ }
94
+
95
+ const severityClasses: Record<string, {border: string; indicator: string}> = {
96
+ critical: {border: 'border-l-error', indicator: 'bg-error'},
97
+ important: {border: 'border-l-warning', indicator: 'bg-warning'},
98
+ standard: {border: 'border-l-info', indicator: 'bg-info'},
99
+ routine: {border: 'border-l-gray-400', indicator: 'bg-gray-400'},
100
+ }
101
+
102
+ const filteredEvents = $derived(activeFilter === 'all' ? events : events.filter(e => e.category === activeFilter))
103
+ </script>
104
+
105
+ {#if filters.length > 0}
106
+ <div class="flex gap-8 flex-wrap mb-16">
107
+ {#each filters as f (f.value)}
108
+ <button
109
+ class={cn(
110
+ 'flex items-center gap-4 px-12 py-8 rounded-full text-small-emphasis cursor-default',
111
+ activeFilter === f.value
112
+ ? 'bg-gray-100 text-body border border-strong'
113
+ : 'bg-surface text-secondary border border-primary hover:bg-gray-100 hover:border-strong'
114
+ )}
115
+ onclick={() => (activeFilter = f.value)}
116
+ >
117
+ {f.label}
118
+ </button>
119
+ {/each}
120
+ </div>
121
+ {/if}
122
+
123
+ {#if loading}
124
+ <div class="px-24 py-24 text-center text-secondary text-small">Loading history...</div>
125
+ {:else if error}
126
+ <div class="px-24 py-24 text-center text-error text-small">{error}</div>
127
+ {:else if events.length === 0}
128
+ <div class="px-24 py-24 text-center text-secondary text-small">{emptyMessage}</div>
129
+ {:else}
130
+ <div class={cn('flex flex-col', maxHeight && 'overflow-y-auto')} style:max-height={maxHeight}>
131
+ {#each filteredEvents as event (event.id)}
132
+ {@const EventIcon = getCategoryIcon(event.category)}
133
+ <div
134
+ class={cn(
135
+ 'flex gap-12 p-12 border-l-3 border-l-transparent transition-all duration-fast hover:bg-gray-50 [&:not(:last-child)]:border-b [&:not(:last-child)]:border-b-primary',
136
+ severityClasses[resolveSeverity(event)]?.border
137
+ )}
138
+ >
139
+ <div class={cn('w-8 h-8 rounded-full shrink-0 mt-8', severityClasses[resolveSeverity(event)]?.indicator)}></div>
140
+ <div class="flex-1">
141
+ <div class="flex justify-between items-start mb-4">
142
+ <div class="flex gap-8 items-start">
143
+ <span class="text-secondary flex">
144
+ <EventIcon class="w-20 h-20" />
145
+ </span>
146
+ <div class="flex-1">
147
+ <div class="text-small-emphasis text-body mb-4">{event.description}</div>
148
+ <div class="flex items-center gap-4 text-tiny text-tertiary">
149
+ <span>{formatTimestamp(event.timestamp)}</span>
150
+ <span class="text-muted">•</span>
151
+ <span class="font-medium">{event.actor}</span>
152
+ </div>
153
+ </div>
154
+ </div>
155
+ </div>
156
+ {#if event.details}
157
+ <div class="mt-8 ml-20 p-8 bg-gray-50 rounded-4 text-tiny text-secondary">
158
+ {event.details}
159
+ </div>
160
+ {/if}
161
+ </div>
162
+ </div>
163
+ {:else}
164
+ <div class="px-24 py-24 text-center text-secondary text-small">{emptyMessage}</div>
165
+ {/each}
166
+ </div>
167
+ {/if}
@@ -0,0 +1,13 @@
1
+ import type { Component } from 'svelte';
2
+ import type { AuditEvent, AuditFilter } from './IIAuditTrail.types';
3
+ type Props = {
4
+ events: AuditEvent[];
5
+ filters: AuditFilter[];
6
+ loading?: boolean;
7
+ error?: string | null;
8
+ emptyMessage?: string;
9
+ maxHeight?: string;
10
+ };
11
+ declare const IIAuditTrail: Component<Props, {}, "">;
12
+ type IIAuditTrail = ReturnType<typeof IIAuditTrail>;
13
+ export default IIAuditTrail;
@@ -0,0 +1,14 @@
1
+ export type Severity = 'critical' | 'important' | 'standard' | 'routine';
2
+ export type AuditEvent = {
3
+ id: string;
4
+ description: string;
5
+ details?: string | null;
6
+ timestamp: string;
7
+ actor: string;
8
+ severity?: Severity;
9
+ category: string;
10
+ };
11
+ export type AuditFilter = {
12
+ value: string;
13
+ label: string;
14
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default as IIAuditTrail } from './IIAuditTrail.svelte';
2
+ export type { AuditEvent, AuditFilter, Severity } from './IIAuditTrail.types';
@@ -0,0 +1 @@
1
+ export { default as IIAuditTrail } from './IIAuditTrail.svelte';
@@ -0,0 +1,46 @@
1
+ <script lang="ts">
2
+ import type {Snippet} from 'svelte'
3
+
4
+ import {cn} from '../utils/cn'
5
+
6
+ import type {BadgeVariant} from './IIBadge.types'
7
+
8
+ type Props = {
9
+ variant?: BadgeVariant
10
+ size?: 'sm' | 'md'
11
+ children?: Snippet
12
+ class?: string
13
+ }
14
+
15
+ let {variant = 'grey', size = 'md', children, class: className}: Props = $props()
16
+
17
+ const variantClasses: Record<string, string> = {
18
+ grey: 'bg-badge-grey text-badge-grey',
19
+ blue: 'bg-badge-blue text-badge-blue',
20
+ red: 'bg-badge-red text-badge-red',
21
+ purple: 'bg-badge-purple text-badge-purple',
22
+ green: 'bg-badge-green text-badge-green',
23
+ orange: 'bg-badge-orange text-badge-orange',
24
+ cyan: 'bg-badge-cyan text-badge-cyan',
25
+ pink: 'bg-badge-pink text-badge-pink',
26
+ teal: 'bg-badge-teal text-badge-teal',
27
+ amber: 'bg-badge-amber text-badge-amber',
28
+ yellow: 'bg-badge-yellow text-badge-yellow',
29
+ }
30
+
31
+ const sizeClasses: Record<string, string> = {
32
+ sm: 'px-8 py-4 text-tiny',
33
+ md: 'px-12 py-4 text-tiny',
34
+ }
35
+ </script>
36
+
37
+ <span
38
+ class={cn(
39
+ 'inline-flex items-center rounded-4 font-medium whitespace-nowrap',
40
+ sizeClasses[size],
41
+ variantClasses[variant],
42
+ className
43
+ )}
44
+ >
45
+ {@render children?.()}
46
+ </span>
@@ -0,0 +1,11 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { BadgeVariant } from './IIBadge.types';
3
+ type Props = {
4
+ variant?: BadgeVariant;
5
+ size?: 'sm' | 'md';
6
+ children?: Snippet;
7
+ class?: string;
8
+ };
9
+ declare const IIBadge: import("svelte").Component<Props, {}, "">;
10
+ type IIBadge = ReturnType<typeof IIBadge>;
11
+ export default IIBadge;
@@ -0,0 +1 @@
1
+ export type BadgeVariant = 'grey' | 'blue' | 'red' | 'purple' | 'green' | 'orange' | 'cyan' | 'pink' | 'teal' | 'amber' | 'yellow';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default as IIBadge } from './IIBadge.svelte';
2
+ export type { BadgeVariant } from './IIBadge.types';
@@ -0,0 +1 @@
1
+ export { default as IIBadge } from './IIBadge.svelte';
@@ -0,0 +1,103 @@
1
+ <script lang="ts">
2
+ import type {Snippet} from 'svelte'
3
+ import type {HTMLButtonAttributes, HTMLAnchorAttributes} from 'svelte/elements'
4
+ import {cn} from '../utils/cn'
5
+
6
+ type BaseProps = {
7
+ variant?: 'primary' | 'secondary' | 'ghost' | 'danger' | 'success'
8
+ size?: 'sm' | 'md' | 'lg'
9
+ iconOnly?: boolean
10
+ loading?: boolean
11
+ disabled?: boolean
12
+ children?: Snippet
13
+ class?: string
14
+ ref?: HTMLButtonElement | HTMLAnchorElement
15
+ }
16
+
17
+ type ButtonProps = BaseProps & Omit<HTMLButtonAttributes, 'disabled'> & {href?: never}
18
+ type AnchorProps = BaseProps & HTMLAnchorAttributes & {href: string; type?: never}
19
+
20
+ type Props = ButtonProps | AnchorProps
21
+
22
+ let {
23
+ variant = 'primary',
24
+ size = 'md',
25
+ iconOnly = false,
26
+ loading = false,
27
+ disabled = false,
28
+ children,
29
+ class: className,
30
+ href,
31
+ ref = $bindable(),
32
+ ...restProps
33
+ }: Props = $props()
34
+
35
+ const isDisabled = $derived(disabled || loading)
36
+
37
+ const baseClasses = $derived(
38
+ cn(
39
+ 'inline-flex items-center justify-center rounded-6 cursor-default transition-all duration-fast no-underline disabled:cursor-not-allowed motion-reduce:transition-none',
40
+ !iconOnly && 'gap-8 whitespace-nowrap'
41
+ )
42
+ )
43
+
44
+ const variantClasses = {
45
+ primary: 'bg-primary text-inverse border-0 hover:bg-primary-hover disabled:bg-disabled',
46
+ secondary: 'bg-surface text-gray-700 border border-strong hover:bg-gray-70 disabled:opacity-50',
47
+ ghost: 'bg-transparent text-secondary border-0 hover:bg-button-ghost-hover disabled:opacity-50',
48
+ danger: 'bg-error text-inverse border-0 hover:bg-error-hover disabled:bg-disabled',
49
+ success: 'bg-success text-inverse border-0 hover:bg-success-hover disabled:bg-disabled',
50
+ } as const
51
+
52
+ const sizeClasses = {
53
+ sm: 'py-4 px-8 text-tiny-emphasis h-20',
54
+ md: 'py-6 px-16 text-small h-28',
55
+ lg: 'py-10 px-24 text-large h-36',
56
+ } as const
57
+
58
+ const iconOnlySizeClasses = {
59
+ sm: 'w-24 h-24 p-0 text-small',
60
+ md: 'w-32 h-32 p-0 text-default',
61
+ lg: 'w-40 h-40 p-0 text-large',
62
+ } as const
63
+ </script>
64
+
65
+ {#if href}
66
+ <a
67
+ bind:this={ref}
68
+ {href}
69
+ class={cn(
70
+ baseClasses,
71
+ variantClasses[variant],
72
+ iconOnly ? iconOnlySizeClasses[size] : sizeClasses[size],
73
+ className
74
+ )}
75
+ {...restProps as HTMLAnchorAttributes}
76
+ >
77
+ {#if loading}
78
+ <span
79
+ class="w-[1em] h-[1em] border-2 border-current border-r-transparent rounded-full animate-spin motion-reduce:animate-none"
80
+ ></span>
81
+ {/if}
82
+ {@render children?.()}
83
+ </a>
84
+ {:else}
85
+ <button
86
+ bind:this={ref}
87
+ disabled={isDisabled}
88
+ class={cn(
89
+ baseClasses,
90
+ variantClasses[variant],
91
+ iconOnly ? iconOnlySizeClasses[size] : sizeClasses[size],
92
+ className
93
+ )}
94
+ {...restProps as HTMLButtonAttributes}
95
+ >
96
+ {#if loading}
97
+ <span
98
+ class="w-[1em] h-[1em] border-2 border-current border-r-transparent rounded-full animate-spin motion-reduce:animate-none"
99
+ ></span>
100
+ {/if}
101
+ {@render children?.()}
102
+ </button>
103
+ {/if}
@@ -0,0 +1,23 @@
1
+ import type { Snippet } from 'svelte';
2
+ import type { HTMLButtonAttributes, HTMLAnchorAttributes } from 'svelte/elements';
3
+ type BaseProps = {
4
+ variant?: 'primary' | 'secondary' | 'ghost' | 'danger' | 'success';
5
+ size?: 'sm' | 'md' | 'lg';
6
+ iconOnly?: boolean;
7
+ loading?: boolean;
8
+ disabled?: boolean;
9
+ children?: Snippet;
10
+ class?: string;
11
+ ref?: HTMLButtonElement | HTMLAnchorElement;
12
+ };
13
+ type ButtonProps = BaseProps & Omit<HTMLButtonAttributes, 'disabled'> & {
14
+ href?: never;
15
+ };
16
+ type AnchorProps = BaseProps & HTMLAnchorAttributes & {
17
+ href: string;
18
+ type?: never;
19
+ };
20
+ type Props = ButtonProps | AnchorProps;
21
+ declare const IIButton: import("svelte").Component<Props, {}, "ref">;
22
+ type IIButton = ReturnType<typeof IIButton>;
23
+ export default IIButton;
@@ -0,0 +1 @@
1
+ export { default as IIButton } from './IIButton.svelte';
@@ -0,0 +1 @@
1
+ export { default as IIButton } from './IIButton.svelte';
@@ -0,0 +1,66 @@
1
+ <script lang="ts">
2
+ import type {Snippet} from 'svelte'
3
+ import {Checkbox} from 'bits-ui'
4
+ import {IconCheck} from '../icons'
5
+ import {cn} from '../utils/cn'
6
+
7
+ type Props = {
8
+ checked: boolean
9
+ onCheckedChange?: (checked: boolean) => void
10
+ label?: string
11
+ children?: Snippet
12
+ disabled?: boolean
13
+ name?: string
14
+ value?: string
15
+ size?: 'sm' | 'md'
16
+ class?: string
17
+ [key: string]: unknown
18
+ }
19
+
20
+ let {
21
+ checked = $bindable(),
22
+ onCheckedChange,
23
+ label,
24
+ children,
25
+ disabled = false,
26
+ name,
27
+ value,
28
+ size = 'md',
29
+ class: className,
30
+ ...restProps
31
+ }: Props = $props()
32
+ </script>
33
+
34
+ <label class={cn('flex items-center gap-8', className)}>
35
+ <Checkbox.Root
36
+ class="peer [all:unset] cursor-default shrink-0 inline-block data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50"
37
+ {checked}
38
+ {onCheckedChange}
39
+ {disabled}
40
+ {name}
41
+ {value}
42
+ {...restProps}
43
+ >
44
+ <div
45
+ class={cn(
46
+ 'flex items-center justify-center border-2 rounded-4 transition-all duration-fast motion-reduce:transition-none',
47
+ size === 'sm' ? 'w-16 h-16' : 'w-18 h-18',
48
+ checked ? 'bg-primary border-primary' : 'border-strong bg-surface',
49
+ disabled && 'opacity-50'
50
+ )}
51
+ >
52
+ {#if checked}
53
+ <IconCheck class={size === 'sm' ? 'w-12 h-12 text-white' : 'w-14 h-14 text-white'} />
54
+ {/if}
55
+ </div>
56
+ </Checkbox.Root>
57
+ {#if label}
58
+ <span class={cn('text-small text-body select-none cursor-default', disabled && 'opacity-50 cursor-not-allowed')}
59
+ >{label}</span
60
+ >
61
+ {:else if children}
62
+ <span class={cn('text-small text-body select-none cursor-default', disabled && 'opacity-50 cursor-not-allowed')}>
63
+ {@render children()}
64
+ </span>
65
+ {/if}
66
+ </label>
@@ -0,0 +1,16 @@
1
+ import type { Snippet } from 'svelte';
2
+ type Props = {
3
+ checked: boolean;
4
+ onCheckedChange?: (checked: boolean) => void;
5
+ label?: string;
6
+ children?: Snippet;
7
+ disabled?: boolean;
8
+ name?: string;
9
+ value?: string;
10
+ size?: 'sm' | 'md';
11
+ class?: string;
12
+ [key: string]: unknown;
13
+ };
14
+ declare const IICheckbox: import("svelte").Component<Props, {}, "checked">;
15
+ type IICheckbox = ReturnType<typeof IICheckbox>;
16
+ export default IICheckbox;
@@ -0,0 +1 @@
1
+ export { default as IICheckbox } from './IICheckbox.svelte';
@@ -0,0 +1 @@
1
+ export { default as IICheckbox } from './IICheckbox.svelte';
@@ -0,0 +1,15 @@
1
+ <script lang="ts">
2
+ type Props = {
3
+ maxHeight?: string
4
+ children?: import('svelte').Snippet
5
+ }
6
+
7
+ let {maxHeight = '300px', children}: Props = $props()
8
+ </script>
9
+
10
+ <div
11
+ class="flex flex-col gap-8 overflow-y-auto p-8 border border-primary rounded-4 bg-background"
12
+ style:max-height={maxHeight}
13
+ >
14
+ {@render children?.()}
15
+ </div>
@@ -0,0 +1,7 @@
1
+ type Props = {
2
+ maxHeight?: string;
3
+ children?: import('svelte').Snippet;
4
+ };
5
+ declare const IICheckboxList: import("svelte").Component<Props, {}, "">;
6
+ type IICheckboxList = ReturnType<typeof IICheckboxList>;
7
+ export default IICheckboxList;
@@ -0,0 +1 @@
1
+ export { default as IICheckboxList } from './IICheckboxList.svelte';
@@ -0,0 +1 @@
1
+ export { default as IICheckboxList } from './IICheckboxList.svelte';