sv5ui 1.3.0 → 1.5.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.
- package/README.md +16 -11
- package/dist/Checkbox/Checkbox.svelte +2 -11
- package/dist/CheckboxGroup/CheckboxGroup.svelte +2 -11
- package/dist/Collapsible/Collapsible.svelte +69 -0
- package/dist/Collapsible/Collapsible.svelte.d.ts +6 -0
- package/dist/Collapsible/CollapsibleTestWrapper.svelte +17 -0
- package/dist/Collapsible/CollapsibleTestWrapper.svelte.d.ts +4 -0
- package/dist/Collapsible/collapsible.types.d.ts +75 -0
- package/dist/Collapsible/collapsible.types.js +1 -0
- package/dist/Collapsible/collapsible.variants.d.ts +53 -0
- package/dist/Collapsible/collapsible.variants.js +21 -0
- package/dist/Collapsible/index.d.ts +2 -0
- package/dist/Collapsible/index.js +1 -0
- package/dist/Command/Command.svelte +183 -0
- package/dist/Command/Command.svelte.d.ts +6 -0
- package/dist/Command/CommandTestWrapper.svelte +13 -0
- package/dist/Command/CommandTestWrapper.svelte.d.ts +4 -0
- package/dist/Command/command.types.d.ts +98 -0
- package/dist/Command/command.types.js +1 -0
- package/dist/Command/command.variants.d.ts +226 -0
- package/dist/Command/command.variants.js +86 -0
- package/dist/Command/index.d.ts +2 -0
- package/dist/Command/index.js +1 -0
- package/dist/FormField/FormField.svelte +2 -6
- package/dist/Input/Input.svelte +2 -10
- package/dist/PinInput/PinInput.svelte +2 -11
- package/dist/RadioGroup/RadioGroup.svelte +2 -11
- package/dist/Select/Select.svelte +2 -10
- package/dist/Select/select.variants.js +1 -1
- package/dist/SelectMenu/SelectMenu.svelte +2 -10
- package/dist/SelectMenu/select-menu.variants.js +1 -1
- package/dist/Slider/Slider.svelte +2 -11
- package/dist/Switch/Switch.svelte +2 -11
- package/dist/Table/Table.svelte +752 -0
- package/dist/Table/Table.svelte.d.ts +26 -0
- package/dist/Table/index.d.ts +2 -0
- package/dist/Table/index.js +1 -0
- package/dist/Table/table.types.d.ts +199 -0
- package/dist/Table/table.types.js +1 -0
- package/dist/Table/table.utils.d.ts +51 -0
- package/dist/Table/table.utils.js +166 -0
- package/dist/Table/table.variants.d.ts +205 -0
- package/dist/Table/table.variants.js +126 -0
- package/dist/Textarea/Textarea.svelte +2 -10
- package/dist/Toast/Toaster.svelte +618 -0
- package/dist/Toast/Toaster.svelte.d.ts +5 -0
- package/dist/Toast/index.d.ts +4 -0
- package/dist/Toast/index.js +2 -0
- package/dist/Toast/toast.d.ts +38 -0
- package/dist/Toast/toast.js +73 -0
- package/dist/Toast/toast.types.d.ts +19 -0
- package/dist/Toast/toast.types.js +1 -0
- package/dist/Toast/toast.variants.d.ts +7 -0
- package/dist/Toast/toast.variants.js +5 -0
- package/dist/config.d.ts +4 -0
- package/dist/config.js +5 -1
- package/dist/hooks/index.d.ts +14 -0
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/useClickOutside.svelte.d.ts +31 -0
- package/dist/hooks/useClickOutside.svelte.js +37 -0
- package/dist/hooks/useClipboard.svelte.d.ts +30 -0
- package/dist/hooks/useClipboard.svelte.js +45 -0
- package/dist/hooks/useDebounce.svelte.d.ts +36 -0
- package/dist/hooks/useDebounce.svelte.js +56 -0
- package/dist/hooks/useEscapeKeydown.svelte.d.ts +31 -0
- package/dist/hooks/useEscapeKeydown.svelte.js +37 -0
- package/dist/hooks/useFormField.svelte.d.ts +21 -0
- package/dist/hooks/useFormField.svelte.js +17 -0
- package/dist/hooks/useInfiniteScroll.svelte.d.ts +57 -0
- package/dist/hooks/useInfiniteScroll.svelte.js +69 -0
- package/dist/hooks/useMediaQuery.svelte.d.ts +31 -0
- package/dist/hooks/useMediaQuery.svelte.js +38 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6 -0
- package/dist/theme.css +36 -0
- package/package.json +2 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const tableVariants = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
root: 'relative w-full overflow-x-auto rounded-xl border border-outline-variant/50 bg-surface [contain:inline-size]',
|
|
5
|
+
base: 'min-w-full',
|
|
6
|
+
caption: 'sr-only',
|
|
7
|
+
thead: 'relative bg-surface-container-low',
|
|
8
|
+
tbody: [
|
|
9
|
+
'[&>tr]:transition-colors [&>tr]:duration-150',
|
|
10
|
+
'[&>tr]:border-b [&>tr]:border-outline-variant/30',
|
|
11
|
+
'[&>tr:last-child]:border-b-0'
|
|
12
|
+
],
|
|
13
|
+
tfoot: 'relative bg-surface-container-low border-t border-outline-variant/50',
|
|
14
|
+
tr: 'data-[selected=true]:bg-primary-container/20 data-[pinned-row=true]:bg-surface-container-lowest',
|
|
15
|
+
th: [
|
|
16
|
+
'relative px-4 py-3 text-xs font-semibold uppercase tracking-wider',
|
|
17
|
+
'text-on-surface-variant text-left rtl:text-right',
|
|
18
|
+
'[&:has([role=checkbox])]:pe-0 [&:has([role=checkbox])]:w-12'
|
|
19
|
+
],
|
|
20
|
+
td: [
|
|
21
|
+
'px-4 py-3.5 text-sm text-on-surface',
|
|
22
|
+
'whitespace-nowrap max-sm:whitespace-normal max-sm:break-words',
|
|
23
|
+
'[&:has([role=checkbox])]:pe-0 [&:has([role=checkbox])]:w-12'
|
|
24
|
+
],
|
|
25
|
+
separator: 'h-px bg-outline-variant/50',
|
|
26
|
+
empty: 'py-10 text-center text-sm text-on-surface-variant/70',
|
|
27
|
+
loading: 'py-10 text-center'
|
|
28
|
+
},
|
|
29
|
+
variants: {
|
|
30
|
+
pinned: {
|
|
31
|
+
true: {
|
|
32
|
+
th: 'sticky bg-surface-container-low/95 backdrop-blur-sm z-1',
|
|
33
|
+
td: 'sticky bg-surface/95 backdrop-blur-sm z-1'
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
hoverable: {
|
|
37
|
+
true: {
|
|
38
|
+
tbody: '[&>tr]:data-[selectable=true]:cursor-pointer [&>tr]:data-[selectable=true]:hover:bg-surface-container/60 [&>tr]:data-[selectable=true]:focus-visible:outline-2 [&>tr]:data-[selectable=true]:focus-visible:outline-primary [&>tr]:data-[selectable=true]:focus-visible:outline-offset-[-2px]'
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
sticky: {
|
|
42
|
+
true: {
|
|
43
|
+
thead: 'sticky top-0 inset-x-0 bg-surface-container-low/95 backdrop-blur-sm z-10',
|
|
44
|
+
tfoot: 'sticky bottom-0 inset-x-0 bg-surface-container-low/95 backdrop-blur-sm z-10'
|
|
45
|
+
},
|
|
46
|
+
header: {
|
|
47
|
+
thead: 'sticky top-0 inset-x-0 bg-surface-container-low/95 backdrop-blur-sm z-10'
|
|
48
|
+
},
|
|
49
|
+
footer: {
|
|
50
|
+
tfoot: 'sticky bottom-0 inset-x-0 bg-surface-container-low/95 backdrop-blur-sm z-10'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
striped: {
|
|
54
|
+
true: {
|
|
55
|
+
tbody: '[&>tr:nth-child(even)]:bg-surface-container-lowest/60'
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
loading: {
|
|
59
|
+
true: {
|
|
60
|
+
thead: 'after:absolute after:top-0 after:left-0 after:z-20 after:h-0.5 after:rounded-full'
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
loadingColor: {
|
|
64
|
+
primary: '',
|
|
65
|
+
secondary: '',
|
|
66
|
+
tertiary: '',
|
|
67
|
+
success: '',
|
|
68
|
+
warning: '',
|
|
69
|
+
error: '',
|
|
70
|
+
info: '',
|
|
71
|
+
surface: ''
|
|
72
|
+
},
|
|
73
|
+
loadingAnimation: {
|
|
74
|
+
carousel: '',
|
|
75
|
+
'carousel-inverse': '',
|
|
76
|
+
swing: '',
|
|
77
|
+
elastic: ''
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
compoundVariants: [
|
|
81
|
+
// ========== LOADING COLOR ==========
|
|
82
|
+
{ loading: true, loadingColor: 'primary', class: { thead: 'after:bg-primary' } },
|
|
83
|
+
{ loading: true, loadingColor: 'secondary', class: { thead: 'after:bg-secondary' } },
|
|
84
|
+
{ loading: true, loadingColor: 'tertiary', class: { thead: 'after:bg-tertiary' } },
|
|
85
|
+
{ loading: true, loadingColor: 'success', class: { thead: 'after:bg-success' } },
|
|
86
|
+
{ loading: true, loadingColor: 'warning', class: { thead: 'after:bg-warning' } },
|
|
87
|
+
{ loading: true, loadingColor: 'error', class: { thead: 'after:bg-error' } },
|
|
88
|
+
{ loading: true, loadingColor: 'info', class: { thead: 'after:bg-info' } },
|
|
89
|
+
{ loading: true, loadingColor: 'surface', class: { thead: 'after:bg-on-surface' } },
|
|
90
|
+
// ========== LOADING ANIMATION ==========
|
|
91
|
+
{
|
|
92
|
+
loading: true,
|
|
93
|
+
loadingAnimation: 'carousel',
|
|
94
|
+
class: { thead: 'after:animate-[carousel_2s_ease-in-out_infinite]' }
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
loading: true,
|
|
98
|
+
loadingAnimation: 'carousel-inverse',
|
|
99
|
+
class: { thead: 'after:animate-[carousel-inverse_2s_ease-in-out_infinite]' }
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
loading: true,
|
|
103
|
+
loadingAnimation: 'swing',
|
|
104
|
+
class: { thead: 'after:animate-[swing_2s_ease-in-out_infinite]' }
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
loading: true,
|
|
108
|
+
loadingAnimation: 'elastic',
|
|
109
|
+
class: { thead: 'after:animate-[elastic_2s_ease-in-out_infinite]' }
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
defaultVariants: {
|
|
113
|
+
hoverable: true,
|
|
114
|
+
loadingColor: 'primary',
|
|
115
|
+
loadingAnimation: 'carousel'
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
export const tableDefaults = {
|
|
119
|
+
defaultVariants: {
|
|
120
|
+
...tableVariants.defaultVariants,
|
|
121
|
+
hoverable: true,
|
|
122
|
+
loadingColor: 'primary',
|
|
123
|
+
loadingAnimation: 'carousel'
|
|
124
|
+
},
|
|
125
|
+
slots: {}
|
|
126
|
+
};
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
type FieldGroupVariantProps
|
|
14
14
|
} from '../FieldGroup/field-group.variants.js'
|
|
15
15
|
import Icon from '../Icon/Icon.svelte'
|
|
16
|
-
import
|
|
16
|
+
import { useFormField } from '../hooks/useFormField.svelte.js'
|
|
17
17
|
|
|
18
18
|
const config = getComponentConfig('textarea', textareaDefaults)
|
|
19
19
|
const icons = getComponentConfig('icons', iconsDefaults)
|
|
@@ -44,15 +44,7 @@
|
|
|
44
44
|
...restProps
|
|
45
45
|
}: Props = $props()
|
|
46
46
|
|
|
47
|
-
const formFieldContext =
|
|
48
|
-
| {
|
|
49
|
-
name?: string
|
|
50
|
-
size: NonNullable<FormFieldProps['size']>
|
|
51
|
-
error?: string | boolean
|
|
52
|
-
ariaId: string
|
|
53
|
-
}
|
|
54
|
-
| undefined
|
|
55
|
-
>('formField')
|
|
47
|
+
const formFieldContext = useFormField()
|
|
56
48
|
|
|
57
49
|
const fieldGroupContext = getContext<
|
|
58
50
|
| {
|