@casinogate/ui 0.0.3
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 +171 -0
- package/dist/app.d.ts +15 -0
- package/dist/app.html +12 -0
- package/dist/assets/css/root.css +1057 -0
- package/dist/assets/css/theme.css +255 -0
- package/dist/assets/icons/check.svg +4 -0
- package/dist/assets/icons/chevron-down.svg +4 -0
- package/dist/assets/icons/chevron-left.svg +4 -0
- package/dist/assets/icons/chevron-right.svg +4 -0
- package/dist/assets/icons/chevron-small-down.svg +4 -0
- package/dist/assets/icons/chevron-small-left.svg +4 -0
- package/dist/assets/icons/chevron-small-right.svg +4 -0
- package/dist/assets/icons/chevron-small-up.svg +4 -0
- package/dist/assets/icons/chevron-up.svg +4 -0
- package/dist/assets/icons/error.svg +4 -0
- package/dist/assets/icons/info.svg +4 -0
- package/dist/assets/icons/minus.svg +4 -0
- package/dist/assets/icons/success.svg +4 -0
- package/dist/assets/icons/warning.svg +3 -0
- package/dist/components/button/button.component.svelte +173 -0
- package/dist/components/button/button.component.svelte.d.ts +239 -0
- package/dist/components/button/button.stories.svelte +106 -0
- package/dist/components/button/button.stories.svelte.d.ts +19 -0
- package/dist/components/button/index.d.ts +233 -0
- package/dist/components/button/index.js +4 -0
- package/dist/components/checkbox/checkbox.stories.svelte +52 -0
- package/dist/components/checkbox/checkbox.stories.svelte.d.ts +18 -0
- package/dist/components/checkbox/components/checkbox.group.svelte +3 -0
- package/dist/components/checkbox/components/checkbox.group.svelte.d.ts +18 -0
- package/dist/components/checkbox/components/checkbox.root.svelte +51 -0
- package/dist/components/checkbox/components/checkbox.root.svelte.d.ts +6 -0
- package/dist/components/checkbox/index.js +6 -0
- package/dist/components/checkbox/model/checkbox-model.svelte.d.ts +16 -0
- package/dist/components/checkbox/model/checkbox-model.svelte.js +25 -0
- package/dist/components/checkbox/model/index.d.ts +1 -0
- package/dist/components/checkbox/model/index.js +1 -0
- package/dist/components/checkbox/styles.d.ts +126 -0
- package/dist/components/checkbox/styles.js +60 -0
- package/dist/components/collapsible/collapsible.stories.svelte +53 -0
- package/dist/components/collapsible/collapsible.stories.svelte.d.ts +18 -0
- package/dist/components/collapsible/components/collapsaible.content.svelte +40 -0
- package/dist/components/collapsible/components/collapsaible.content.svelte.d.ts +5 -0
- package/dist/components/collapsible/components/collapsaible.group.svelte +0 -0
- package/dist/components/collapsible/components/collapsaible.group.svelte.d.ts +26 -0
- package/dist/components/collapsible/components/collapsaible.root.svelte +62 -0
- package/dist/components/collapsible/components/collapsaible.root.svelte.d.ts +5 -0
- package/dist/components/collapsible/components/collapsaible.svelte.d.ts +44 -0
- package/dist/components/collapsible/components/collapsaible.svelte.js +92 -0
- package/dist/components/collapsible/components/collapsaible.trigger.svelte +50 -0
- package/dist/components/collapsible/components/collapsaible.trigger.svelte.d.ts +8 -0
- package/dist/components/collapsible/index.d.ts +9 -0
- package/dist/components/collapsible/index.js +8 -0
- package/dist/components/collapsible/styles.d.ts +178 -0
- package/dist/components/collapsible/styles.js +27 -0
- package/dist/components/collapsible/types.d.ts +1 -0
- package/dist/components/collapsible/types.js +1 -0
- package/dist/components/switch/components/switch.root.svelte +27 -0
- package/dist/components/switch/components/switch.root.svelte.d.ts +6 -0
- package/dist/components/switch/components/switch.thumb.svelte +17 -0
- package/dist/components/switch/components/switch.thumb.svelte.d.ts +5 -0
- package/dist/components/switch/index.d.ts +5 -0
- package/dist/components/switch/index.js +7 -0
- package/dist/components/switch/model/index.d.ts +1 -0
- package/dist/components/switch/model/index.js +1 -0
- package/dist/components/switch/model/switch-model.svelte.d.ts +12 -0
- package/dist/components/switch/model/switch-model.svelte.js +18 -0
- package/dist/components/switch/styles.d.ts +74 -0
- package/dist/components/switch/styles.js +44 -0
- package/dist/components/switch/switch.stories.svelte +48 -0
- package/dist/components/switch/switch.stories.svelte.d.ts +18 -0
- package/dist/components/toast/toast.component.svelte +149 -0
- package/dist/components/toast/toast.component.svelte.d.ts +158 -0
- package/dist/components/toast/toast.stories.svelte +96 -0
- package/dist/components/toast/toast.stories.svelte.d.ts +19 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/internal/types/attrs.d.ts +1 -0
- package/dist/internal/types/attrs.js +3 -0
- package/dist/internal/types/common.d.ts +25 -0
- package/dist/internal/types/common.js +1 -0
- package/dist/internal/types/composition.d.ts +45 -0
- package/dist/internal/types/composition.js +1 -0
- package/dist/internal/types/html-attributes.d.ts +48 -0
- package/dist/internal/types/html-attributes.js +1 -0
- package/dist/internal/utils/arrays.d.ts +1 -0
- package/dist/internal/utils/arrays.js +30 -0
- package/dist/internal/utils/common.d.ts +6 -0
- package/dist/internal/utils/common.js +9 -0
- package/dist/internal/utils/tailwindcss.d.ts +3 -0
- package/dist/internal/utils/tailwindcss.js +29 -0
- package/package.json +75 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import ErrorIcon from '../../assets/icons/error.svg?component';
|
|
3
|
+
import InfoIcon from '../../assets/icons/info.svg?component';
|
|
4
|
+
import SuccessIcon from '../../assets/icons/success.svg?component';
|
|
5
|
+
import WarningIcon from '../../assets/icons/warning.svg?component';
|
|
6
|
+
import type { Without } from '../../internal/types/common.js';
|
|
7
|
+
import type { WithElementRef, WithVariants } from '../../internal/types/composition.js';
|
|
8
|
+
import type { PrimitiveDivAttributes } from '../../internal/types/html-attributes.js';
|
|
9
|
+
import { cn } from '../../internal/utils/common.js';
|
|
10
|
+
import { tv } from '../../internal/utils/tailwindcss.js';
|
|
11
|
+
import type { Snippet } from 'svelte';
|
|
12
|
+
|
|
13
|
+
const toastStyles = tv({
|
|
14
|
+
slots: {
|
|
15
|
+
root: [
|
|
16
|
+
'cgui:overflow-hidden cgui:relative cgui:min-w-42 cgui:max-w-80',
|
|
17
|
+
'cgui:flex cgui:items-center cgui:gap-2 cgui:p-3',
|
|
18
|
+
'cgui:shadow-toast cgui:bg-surface-white',
|
|
19
|
+
'cgui:transition-all cgui:duration-250 cgui:ease-in-out',
|
|
20
|
+
'cgui:before:content-[""] cgui:before:pointer-events-none cgui:before:absolute cgui:before:top-0 cgui:before:inset-x-0 cgui:before:h-1.5 cgui:before:block',
|
|
21
|
+
],
|
|
22
|
+
iconWrapper: ['cgui:shrink-0 cgui:size-6 cgui:flex cgui:items-center cgui:justify-center cgui:select-none'],
|
|
23
|
+
innerIcon: [],
|
|
24
|
+
body: ['cgui:flex cgui:flex-col cgui:gap-1 cgui:flex-1 cgui:text-left'],
|
|
25
|
+
title: ['cgui:text-body-2 cgui:text-fg-darkest'],
|
|
26
|
+
description: ['cgui:text-caption-2 cgui:text-fg-darkest'],
|
|
27
|
+
},
|
|
28
|
+
variants: {
|
|
29
|
+
variant: {
|
|
30
|
+
error: {
|
|
31
|
+
root: 'cgui:before:bg-state-error',
|
|
32
|
+
innerIcon: 'cgui:text-state-error',
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
warning: {
|
|
36
|
+
root: 'cgui:before:bg-state-warning',
|
|
37
|
+
innerIcon: 'cgui:text-state-warning',
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
success: {
|
|
41
|
+
root: 'cgui:before:bg-state-success',
|
|
42
|
+
innerIcon: 'cgui:text-state-success',
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
info: {
|
|
46
|
+
root: 'cgui:before:bg-state-info',
|
|
47
|
+
innerIcon: 'cgui:text-state-info',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
rounded: {
|
|
52
|
+
xs: {
|
|
53
|
+
root: 'cgui:rounded-xs',
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
sm: {
|
|
57
|
+
root: 'cgui:rounded-sm',
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
md: {
|
|
61
|
+
root: 'cgui:rounded-md',
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
lg: {
|
|
65
|
+
root: 'cgui:rounded-lg',
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
xl: {
|
|
69
|
+
root: 'cgui:rounded-xl',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
hasIcon: {
|
|
74
|
+
false: {
|
|
75
|
+
iconWrapper: 'cgui:hidden',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
type ToastPropsWithoutHTML = WithElementRef<
|
|
82
|
+
WithVariants<
|
|
83
|
+
{
|
|
84
|
+
title?: Snippet | string;
|
|
85
|
+
|
|
86
|
+
description?: Snippet | string;
|
|
87
|
+
|
|
88
|
+
icon?: Snippet;
|
|
89
|
+
},
|
|
90
|
+
typeof toastStyles
|
|
91
|
+
>
|
|
92
|
+
>;
|
|
93
|
+
|
|
94
|
+
export type ToastProps = ToastPropsWithoutHTML & Without<PrimitiveDivAttributes, ToastPropsWithoutHTML>;
|
|
95
|
+
</script>
|
|
96
|
+
|
|
97
|
+
<script lang="ts">
|
|
98
|
+
let {
|
|
99
|
+
variant = 'info',
|
|
100
|
+
rounded = 'xs',
|
|
101
|
+
hasIcon = true,
|
|
102
|
+
title,
|
|
103
|
+
description,
|
|
104
|
+
icon,
|
|
105
|
+
class: className,
|
|
106
|
+
ref = $bindable(null),
|
|
107
|
+
...props
|
|
108
|
+
}: ToastProps = $props();
|
|
109
|
+
|
|
110
|
+
const styles = $derived(toastStyles({ variant, rounded, hasIcon }));
|
|
111
|
+
|
|
112
|
+
const InnerIcon = $derived.by(() => {
|
|
113
|
+
if (variant === 'error') return ErrorIcon;
|
|
114
|
+
|
|
115
|
+
if (variant === 'warning') return WarningIcon;
|
|
116
|
+
|
|
117
|
+
if (variant === 'success') return SuccessIcon;
|
|
118
|
+
|
|
119
|
+
return InfoIcon;
|
|
120
|
+
});
|
|
121
|
+
</script>
|
|
122
|
+
|
|
123
|
+
<div bind:this={ref} class={cn(styles.root(), className)} {...props}>
|
|
124
|
+
<div class={styles.iconWrapper()}>
|
|
125
|
+
{#if icon}
|
|
126
|
+
{@render icon()}
|
|
127
|
+
{:else}
|
|
128
|
+
<InnerIcon class={styles.innerIcon()} />
|
|
129
|
+
{/if}
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
<div class={styles.body()}>
|
|
133
|
+
{#if typeof title === 'string'}
|
|
134
|
+
{#if title.trim().length}
|
|
135
|
+
<p class={styles.title()}>{title}</p>
|
|
136
|
+
{/if}
|
|
137
|
+
{:else}
|
|
138
|
+
{@render title?.()}
|
|
139
|
+
{/if}
|
|
140
|
+
|
|
141
|
+
{#if typeof description === 'string'}
|
|
142
|
+
{#if description.trim().length}
|
|
143
|
+
<p class={styles.description()}>{description}</p>
|
|
144
|
+
{/if}
|
|
145
|
+
{:else}
|
|
146
|
+
{@render description?.()}
|
|
147
|
+
{/if}
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type { Without } from '../../internal/types/common.js';
|
|
2
|
+
import type { WithElementRef, WithVariants } from '../../internal/types/composition.js';
|
|
3
|
+
import type { PrimitiveDivAttributes } from '../../internal/types/html-attributes.js';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
|
+
declare const toastStyles: import("tailwind-variants").TVReturnType<{
|
|
6
|
+
variant: {
|
|
7
|
+
error: {
|
|
8
|
+
root: string;
|
|
9
|
+
innerIcon: string;
|
|
10
|
+
};
|
|
11
|
+
warning: {
|
|
12
|
+
root: string;
|
|
13
|
+
innerIcon: string;
|
|
14
|
+
};
|
|
15
|
+
success: {
|
|
16
|
+
root: string;
|
|
17
|
+
innerIcon: string;
|
|
18
|
+
};
|
|
19
|
+
info: {
|
|
20
|
+
root: string;
|
|
21
|
+
innerIcon: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
rounded: {
|
|
25
|
+
xs: {
|
|
26
|
+
root: string;
|
|
27
|
+
};
|
|
28
|
+
sm: {
|
|
29
|
+
root: string;
|
|
30
|
+
};
|
|
31
|
+
md: {
|
|
32
|
+
root: string;
|
|
33
|
+
};
|
|
34
|
+
lg: {
|
|
35
|
+
root: string;
|
|
36
|
+
};
|
|
37
|
+
xl: {
|
|
38
|
+
root: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
hasIcon: {
|
|
42
|
+
false: {
|
|
43
|
+
iconWrapper: string;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
}, {
|
|
47
|
+
root: string[];
|
|
48
|
+
iconWrapper: string[];
|
|
49
|
+
innerIcon: never[];
|
|
50
|
+
body: string[];
|
|
51
|
+
title: string[];
|
|
52
|
+
description: string[];
|
|
53
|
+
}, undefined, {
|
|
54
|
+
variant: {
|
|
55
|
+
error: {
|
|
56
|
+
root: string;
|
|
57
|
+
innerIcon: string;
|
|
58
|
+
};
|
|
59
|
+
warning: {
|
|
60
|
+
root: string;
|
|
61
|
+
innerIcon: string;
|
|
62
|
+
};
|
|
63
|
+
success: {
|
|
64
|
+
root: string;
|
|
65
|
+
innerIcon: string;
|
|
66
|
+
};
|
|
67
|
+
info: {
|
|
68
|
+
root: string;
|
|
69
|
+
innerIcon: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
rounded: {
|
|
73
|
+
xs: {
|
|
74
|
+
root: string;
|
|
75
|
+
};
|
|
76
|
+
sm: {
|
|
77
|
+
root: string;
|
|
78
|
+
};
|
|
79
|
+
md: {
|
|
80
|
+
root: string;
|
|
81
|
+
};
|
|
82
|
+
lg: {
|
|
83
|
+
root: string;
|
|
84
|
+
};
|
|
85
|
+
xl: {
|
|
86
|
+
root: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
hasIcon: {
|
|
90
|
+
false: {
|
|
91
|
+
iconWrapper: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
}, {
|
|
95
|
+
root: string[];
|
|
96
|
+
iconWrapper: string[];
|
|
97
|
+
innerIcon: never[];
|
|
98
|
+
body: string[];
|
|
99
|
+
title: string[];
|
|
100
|
+
description: string[];
|
|
101
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
102
|
+
variant: {
|
|
103
|
+
error: {
|
|
104
|
+
root: string;
|
|
105
|
+
innerIcon: string;
|
|
106
|
+
};
|
|
107
|
+
warning: {
|
|
108
|
+
root: string;
|
|
109
|
+
innerIcon: string;
|
|
110
|
+
};
|
|
111
|
+
success: {
|
|
112
|
+
root: string;
|
|
113
|
+
innerIcon: string;
|
|
114
|
+
};
|
|
115
|
+
info: {
|
|
116
|
+
root: string;
|
|
117
|
+
innerIcon: string;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
rounded: {
|
|
121
|
+
xs: {
|
|
122
|
+
root: string;
|
|
123
|
+
};
|
|
124
|
+
sm: {
|
|
125
|
+
root: string;
|
|
126
|
+
};
|
|
127
|
+
md: {
|
|
128
|
+
root: string;
|
|
129
|
+
};
|
|
130
|
+
lg: {
|
|
131
|
+
root: string;
|
|
132
|
+
};
|
|
133
|
+
xl: {
|
|
134
|
+
root: string;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
hasIcon: {
|
|
138
|
+
false: {
|
|
139
|
+
iconWrapper: string;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
}, {
|
|
143
|
+
root: string[];
|
|
144
|
+
iconWrapper: string[];
|
|
145
|
+
innerIcon: never[];
|
|
146
|
+
body: string[];
|
|
147
|
+
title: string[];
|
|
148
|
+
description: string[];
|
|
149
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
150
|
+
type ToastPropsWithoutHTML = WithElementRef<WithVariants<{
|
|
151
|
+
title?: Snippet | string;
|
|
152
|
+
description?: Snippet | string;
|
|
153
|
+
icon?: Snippet;
|
|
154
|
+
}, typeof toastStyles>>;
|
|
155
|
+
export type ToastProps = ToastPropsWithoutHTML & Without<PrimitiveDivAttributes, ToastPropsWithoutHTML>;
|
|
156
|
+
declare const Toast: import("svelte").Component<ToastProps, {}, "ref">;
|
|
157
|
+
type Toast = ReturnType<typeof Toast>;
|
|
158
|
+
export default Toast;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { defineMeta } from '../../storybook/addon-svelte-csf';
|
|
3
|
+
import type { Meta, Parameters } from '../../storybook/sveltekit';
|
|
4
|
+
import type { ComponentProps } from 'svelte';
|
|
5
|
+
import Toast from './toast.component.svelte';
|
|
6
|
+
|
|
7
|
+
const parameters: Parameters = {
|
|
8
|
+
controls: {
|
|
9
|
+
include: ['variant', 'title', 'description', 'rounded', 'hasIcon'],
|
|
10
|
+
},
|
|
11
|
+
layout: 'centered',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const { Story } = defineMeta({
|
|
15
|
+
title: 'UI Kit/Toast',
|
|
16
|
+
component: Toast,
|
|
17
|
+
tags: ['autodocs'],
|
|
18
|
+
argTypes: {
|
|
19
|
+
variant: {
|
|
20
|
+
control: 'radio',
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
title: {
|
|
24
|
+
control: 'text',
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
description: {
|
|
28
|
+
control: 'text',
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
rounded: {
|
|
32
|
+
control: 'radio',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
parameters,
|
|
37
|
+
} satisfies Meta<typeof Toast>);
|
|
38
|
+
|
|
39
|
+
const args: ComponentProps<typeof Toast> = {
|
|
40
|
+
variant: 'info',
|
|
41
|
+
rounded: 'xs',
|
|
42
|
+
hasIcon: true,
|
|
43
|
+
title: 'System Update Available',
|
|
44
|
+
description: 'A new version is ready to install. Update now or schedule for later',
|
|
45
|
+
};
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<script lang="ts"></script>
|
|
49
|
+
|
|
50
|
+
<Story
|
|
51
|
+
name="Info"
|
|
52
|
+
args={{
|
|
53
|
+
...args,
|
|
54
|
+
variant: 'info',
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
{#snippet template(args)}
|
|
58
|
+
<Toast {...args}></Toast>
|
|
59
|
+
{/snippet}
|
|
60
|
+
</Story>
|
|
61
|
+
|
|
62
|
+
<Story
|
|
63
|
+
name="Success"
|
|
64
|
+
args={{
|
|
65
|
+
...args,
|
|
66
|
+
variant: 'success',
|
|
67
|
+
title: 'Changes Saved Successfully',
|
|
68
|
+
description: 'Your profile settings have been updated and are now active."',
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
Success
|
|
72
|
+
</Story>
|
|
73
|
+
|
|
74
|
+
<Story
|
|
75
|
+
name="Error"
|
|
76
|
+
args={{
|
|
77
|
+
...args,
|
|
78
|
+
variant: 'error',
|
|
79
|
+
title: 'Failed to Save Changes',
|
|
80
|
+
description: 'An error occurred while saving your changes. Please try again.',
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
Error
|
|
84
|
+
</Story>
|
|
85
|
+
|
|
86
|
+
<Story
|
|
87
|
+
name="Warning"
|
|
88
|
+
args={{
|
|
89
|
+
...args,
|
|
90
|
+
variant: 'warning',
|
|
91
|
+
title: 'System Update Available',
|
|
92
|
+
description: 'A new version is ready to install. Update now or schedule for later',
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
Warning
|
|
96
|
+
</Story>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Toast from './toast.component.svelte';
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Toast: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Toast = InstanceType<typeof Toast>;
|
|
19
|
+
export default Toast;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Button, type ButtonProps } from './components/button/button.component.svelte';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Button } from './components/button/button.component.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getDataDisabled(condition: boolean): '' | undefined;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { attachRef } from 'svelte-toolbelt';
|
|
2
|
+
export type Without<T extends object, U extends object> = Omit<T, keyof U>;
|
|
3
|
+
export type Arrayable<T> = T[] | T;
|
|
4
|
+
export type Fn = () => void;
|
|
5
|
+
export type AnyFn = (...args: any[]) => any;
|
|
6
|
+
interface DecrementMap {
|
|
7
|
+
10: 9;
|
|
8
|
+
9: 8;
|
|
9
|
+
8: 7;
|
|
10
|
+
7: 6;
|
|
11
|
+
6: 5;
|
|
12
|
+
5: 4;
|
|
13
|
+
4: 3;
|
|
14
|
+
3: 2;
|
|
15
|
+
2: 1;
|
|
16
|
+
1: 0;
|
|
17
|
+
0: never;
|
|
18
|
+
}
|
|
19
|
+
export type Path<ObjectType, CurrentPath extends string = '', Depth extends number = 10> = Depth extends 0 ? never : ObjectType extends Record<string, unknown> ? {
|
|
20
|
+
[PropertyKey in keyof ObjectType & string]: ObjectType[PropertyKey] extends Record<string, unknown> ? Path<ObjectType[PropertyKey], CurrentPath extends '' ? PropertyKey : `${CurrentPath}.${PropertyKey}`, DecrementMap[Depth & keyof DecrementMap]> : CurrentPath extends '' ? PropertyKey : `${CurrentPath}.${PropertyKey}`;
|
|
21
|
+
}[keyof ObjectType & string] : never;
|
|
22
|
+
export type ValueOf<T> = T[keyof T];
|
|
23
|
+
export type RefAttachment<T extends HTMLElement = HTMLElement> = ReturnType<typeof attachRef<T>>;
|
|
24
|
+
export type OnChangeFn<T> = (value: T) => void;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ReadableBoxedValues, WritableBoxedValues } from 'svelte-toolbelt';
|
|
3
|
+
import type { VariantProps } from 'tailwind-variants';
|
|
4
|
+
export type WithChild<Props extends Record<PropertyKey, unknown> = {}, SnippetProps extends Record<PropertyKey, unknown> = {
|
|
5
|
+
_default: never;
|
|
6
|
+
}, Ref = HTMLElement> = Omit<Props, 'child' | 'children'> & {
|
|
7
|
+
child?: SnippetProps extends {
|
|
8
|
+
_default: never;
|
|
9
|
+
} ? Snippet<[
|
|
10
|
+
{
|
|
11
|
+
props: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
]> : Snippet<[
|
|
14
|
+
SnippetProps & {
|
|
15
|
+
props: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
]>;
|
|
18
|
+
children?: SnippetProps extends {
|
|
19
|
+
_default: never;
|
|
20
|
+
} ? Snippet : Snippet<[SnippetProps]>;
|
|
21
|
+
style?: string | null | undefined;
|
|
22
|
+
ref?: Ref | null | undefined;
|
|
23
|
+
};
|
|
24
|
+
export type Polymorphic<Props extends Record<PropertyKey, unknown> = {}> = {
|
|
25
|
+
as?: keyof HTMLElementTagNameMap | null | undefined;
|
|
26
|
+
} & Props;
|
|
27
|
+
export type WithChildren<Props = {}> = Props & {
|
|
28
|
+
children?: Snippet | undefined;
|
|
29
|
+
};
|
|
30
|
+
export type WithRefProps<T = {}> = T & ReadableBoxedValues<{
|
|
31
|
+
id: string;
|
|
32
|
+
}> & WritableBoxedValues<{
|
|
33
|
+
ref: HTMLElement | null;
|
|
34
|
+
}>;
|
|
35
|
+
export type WithoutChild<T> = T extends {
|
|
36
|
+
child?: any;
|
|
37
|
+
} ? Omit<T, 'child'> : T;
|
|
38
|
+
export type WithoutChildrenOrChild<T> = WithoutChildren<WithoutChild<T>>;
|
|
39
|
+
export type WithoutChildren<T> = T extends {
|
|
40
|
+
children?: any;
|
|
41
|
+
} ? Omit<T, 'children'> : T;
|
|
42
|
+
export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & {
|
|
43
|
+
ref?: U | null;
|
|
44
|
+
};
|
|
45
|
+
export type WithVariants<TSource, TStyles extends (...args: any) => any, TOmit extends keyof VariantProps<TStyles> = never> = TSource & Omit<VariantProps<TStyles>, TOmit>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { HTMLAnchorAttributes, HTMLAttributes, HTMLButtonAttributes, HTMLImgAttributes, HTMLInputAttributes, HTMLLabelAttributes, HTMLLiAttributes, HTMLTableAttributes, HTMLTdAttributes, HTMLTextareaAttributes, HTMLThAttributes, SVGAttributes } from 'svelte/elements';
|
|
2
|
+
export type DivAttributes = HTMLAttributes<HTMLDivElement>;
|
|
3
|
+
export type SpanAttributes = HTMLAttributes<HTMLSpanElement>;
|
|
4
|
+
export type HeadingAttributes = HTMLAttributes<HTMLHeadingElement>;
|
|
5
|
+
export type UListAttributes = HTMLAttributes<HTMLUListElement>;
|
|
6
|
+
export type ElementAttributes = HTMLAttributes<HTMLElement>;
|
|
7
|
+
export type TableSectionAttributes = HTMLAttributes<HTMLTableSectionElement>;
|
|
8
|
+
export type TableRowAttributes = HTMLAttributes<HTMLTableRowElement>;
|
|
9
|
+
export type SVGElementAttributes = SVGAttributes<SVGElement>;
|
|
10
|
+
export type ParagraphAttributes = HTMLAttributes<HTMLParagraphElement>;
|
|
11
|
+
export type FormAttributes = HTMLAttributes<HTMLFormElement>;
|
|
12
|
+
/**
|
|
13
|
+
* We override the `id` prop type to not allow it to be `null`. We rely on the
|
|
14
|
+
* `id` heavily in the internals for node references. We also override
|
|
15
|
+
* children to allow for custom children snippet props. We extend `style` to allow
|
|
16
|
+
* for either a `StyleProperties` object or a string of CSS properties.
|
|
17
|
+
*/
|
|
18
|
+
type Primitive<T> = Omit<T, 'id' | 'children'> & {
|
|
19
|
+
id?: string;
|
|
20
|
+
};
|
|
21
|
+
export type PrimitiveButtonAttributes = Primitive<HTMLButtonAttributes>;
|
|
22
|
+
export type PrimitiveDivAttributes = Primitive<DivAttributes>;
|
|
23
|
+
export type PrimitiveInputAttributes = Primitive<HTMLInputAttributes>;
|
|
24
|
+
export type PrimitiveTextareaAttributes = Primitive<HTMLTextareaAttributes>;
|
|
25
|
+
export type PrimitiveSpanAttributes = Primitive<SpanAttributes>;
|
|
26
|
+
export type PrimitiveImgAttributes = Primitive<HTMLImgAttributes>;
|
|
27
|
+
export type PrimitiveHeadingAttributes = Primitive<HeadingAttributes>;
|
|
28
|
+
export type PrimitiveLabelAttributes = Primitive<HTMLLabelAttributes>;
|
|
29
|
+
export type PrimitiveSVGAttributes = Primitive<SVGElementAttributes>;
|
|
30
|
+
export type PrimitiveAnchorAttributes = Primitive<HTMLAnchorAttributes>;
|
|
31
|
+
export type PrimitiveLiAttributes = Primitive<HTMLLiAttributes>;
|
|
32
|
+
export type PrimitiveElementAttributes = Primitive<ElementAttributes>;
|
|
33
|
+
export type PrimitiveUListAttributes = Primitive<UListAttributes>;
|
|
34
|
+
export type PrimitiveTdAttributes = Primitive<HTMLTdAttributes>;
|
|
35
|
+
export type PrimitiveThAttributes = Primitive<HTMLThAttributes>;
|
|
36
|
+
export type PrimitiveTableAttributes = Primitive<HTMLTableAttributes>;
|
|
37
|
+
export type PrimitiveTbodyAttributes = Primitive<TableSectionAttributes>;
|
|
38
|
+
export type PrimitiveTrAttributes = Primitive<TableRowAttributes>;
|
|
39
|
+
export type PrimitiveTheadAttributes = Primitive<TableSectionAttributes>;
|
|
40
|
+
export type PrimitiveHeaderAttributes = Primitive<ElementAttributes>;
|
|
41
|
+
export type PrimitiveFormAttributes = Primitive<FormAttributes>;
|
|
42
|
+
export type ExtractPrimitiveEvents<Type extends Record<string, any>> = {
|
|
43
|
+
[K in keyof Type as K extends `on${string}` ? K : never]: Type[K];
|
|
44
|
+
};
|
|
45
|
+
export type ExcludePrimitiveEvents<Type extends Record<string, any>> = {
|
|
46
|
+
[K in keyof Type as K extends `on${string}` ? never : K]: Type[K];
|
|
47
|
+
};
|
|
48
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function arraysAreEqual<T extends Array<unknown>>(arr1: T, arr2: T): boolean;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export function arraysAreEqual(arr1, arr2) {
|
|
2
|
+
if (arr1.length !== arr2.length)
|
|
3
|
+
return false;
|
|
4
|
+
return arr1.every((value, index) => isEqual(value, arr2[index]));
|
|
5
|
+
}
|
|
6
|
+
function isEqual(a, b) {
|
|
7
|
+
if (Number.isNaN(a) && Number.isNaN(b))
|
|
8
|
+
return true;
|
|
9
|
+
if (Array.isArray(a) && Array.isArray(b))
|
|
10
|
+
return arraysAreEqual(a, b);
|
|
11
|
+
if (typeof a === 'object' && typeof b === 'object')
|
|
12
|
+
return isDeepEqual(a, b);
|
|
13
|
+
return Object.is(a, b);
|
|
14
|
+
}
|
|
15
|
+
function isDeepEqual(a, b) {
|
|
16
|
+
if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null)
|
|
17
|
+
return false;
|
|
18
|
+
const aKeys = Object.keys(a);
|
|
19
|
+
const bKeys = Object.keys(b);
|
|
20
|
+
if (aKeys.length !== bKeys.length)
|
|
21
|
+
return false;
|
|
22
|
+
for (const key of aKeys) {
|
|
23
|
+
if (!bKeys.includes(key))
|
|
24
|
+
return false;
|
|
25
|
+
if (!isEqual(a[key], b[key])) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ClassValue } from 'clsx';
|
|
2
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
3
|
+
export declare function noop(): void;
|
|
4
|
+
export declare function noopPromise(): Promise<any>;
|
|
5
|
+
export declare const atom: <T>(factory: () => T) => T;
|
|
6
|
+
export declare const keyWithPrefix: <TKey extends string, TPrefix extends string = "cgui">(key: TKey, prefix?: TPrefix) => `${TPrefix}-${TKey}`;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
|
+
import { twMerge } from './tailwindcss.js';
|
|
3
|
+
export function cn(...inputs) {
|
|
4
|
+
return twMerge(clsx(inputs));
|
|
5
|
+
}
|
|
6
|
+
export function noop() { }
|
|
7
|
+
export async function noopPromise() { }
|
|
8
|
+
export const atom = (factory) => factory();
|
|
9
|
+
export const keyWithPrefix = (key, prefix = 'cgui') => `${prefix}-${key}`;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { extendTailwindMerge, } from 'tailwind-merge';
|
|
2
|
+
import { createTV } from 'tailwind-variants';
|
|
3
|
+
const tailwindMergeConfig = {
|
|
4
|
+
extend: {
|
|
5
|
+
classGroups: {
|
|
6
|
+
'font-size': ['text-heading', 'text-heading-2', 'text-body', 'text-body-2', 'text-caption', 'text-caption-2'],
|
|
7
|
+
rounded: [
|
|
8
|
+
'rounded-null',
|
|
9
|
+
'rounded-xxs',
|
|
10
|
+
'rounded-xs',
|
|
11
|
+
'rounded-sm',
|
|
12
|
+
'rounded-md',
|
|
13
|
+
'rounded-lg',
|
|
14
|
+
'rounded-xl',
|
|
15
|
+
'rounded-2xl',
|
|
16
|
+
'rounded-xxl',
|
|
17
|
+
'rounded-2xxl',
|
|
18
|
+
'rounded-max',
|
|
19
|
+
],
|
|
20
|
+
blur: ['blur-xxs', 'blur-xs', 'blur-sm', 'blur-md', 'blur-lg', 'blur-xl', 'blur-2xl'],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
const twMerge = extendTailwindMerge(tailwindMergeConfig);
|
|
25
|
+
const tv = createTV({
|
|
26
|
+
twMerge: true,
|
|
27
|
+
twMergeConfig: tailwindMergeConfig,
|
|
28
|
+
});
|
|
29
|
+
export { tv, twMerge };
|