@immich/ui 0.43.0 → 0.45.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/dist/common/context.svelte.d.ts +1 -1
- package/dist/components/AnnouncementBanner/AnnouncementBanner.svelte +6 -6
- package/dist/components/Badge/Badge.svelte +69 -0
- package/dist/components/Badge/Badge.svelte.d.ts +13 -0
- package/dist/components/Card/Card.svelte +6 -6
- package/dist/components/Checkbox/Checkbox.svelte +2 -2
- package/dist/components/DatePicker/DatePicker.svelte +45 -0
- package/dist/components/DatePicker/DatePicker.svelte.d.ts +4 -0
- package/dist/components/FormModal/FormModal.svelte +65 -0
- package/dist/components/FormModal/FormModal.svelte.d.ts +17 -0
- package/dist/components/Input/Input.svelte +24 -15
- package/dist/components/Label/Label.svelte +11 -5
- package/dist/components/Switch/Switch.svelte +11 -11
- package/dist/components/Textarea/Textarea.svelte +3 -3
- package/dist/components/Toast/ToastContainer.svelte +12 -45
- package/dist/components/Toast/ToastContent.svelte +3 -11
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/internal/Button.svelte +6 -6
- package/dist/internal/CommandPaletteModal.svelte +29 -18
- package/dist/internal/DatePicker.svelte +159 -0
- package/dist/internal/DatePicker.svelte.d.ts +15 -0
- package/dist/internal/Select.svelte +2 -2
- package/dist/services/command-palette-manager.svelte.d.ts +5 -2
- package/dist/services/command-palette-manager.svelte.js +42 -10
- package/dist/services/translation.svelte.d.ts +5 -0
- package/dist/services/translation.svelte.js +5 -0
- package/dist/styles.d.ts +9 -0
- package/dist/styles.js +9 -0
- package/dist/theme/default.css +194 -21
- package/dist/types.d.ts +12 -2
- package/package.json +2 -1
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
false: '',
|
|
30
30
|
},
|
|
31
31
|
color: {
|
|
32
|
-
primary: 'bg-primary
|
|
33
|
-
secondary: '
|
|
32
|
+
primary: 'bg-primary-100 text-primary dark:bg-primary-900',
|
|
33
|
+
secondary: 'text-dark dark:bg-dark/25 bg-gray-200',
|
|
34
34
|
muted: 'bg-subtle text-subtle dark:bg-subtle',
|
|
35
|
-
info: 'bg-info
|
|
36
|
-
warning: 'bg-warning
|
|
37
|
-
danger: 'bg-danger
|
|
38
|
-
success: 'bg-success
|
|
35
|
+
info: 'bg-info-100 text-info dark:bg-info-900',
|
|
36
|
+
warning: 'bg-warning-100 text-warning dark:bg-warning-900',
|
|
37
|
+
danger: 'bg-danger-100 text-danger dark:bg-danger-900',
|
|
38
|
+
success: 'bg-success-100 text-success dark:bg-success-900',
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { styleVariants } from '../../styles.js';
|
|
3
|
+
import type { Color, Shape, Size } from '../../types.js';
|
|
4
|
+
import { cleanClass } from '../../utilities/internal.js';
|
|
5
|
+
import type { Snippet } from 'svelte';
|
|
6
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
7
|
+
import { tv } from 'tailwind-variants';
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
size?: Size;
|
|
11
|
+
color?: Color;
|
|
12
|
+
shape?: Shape;
|
|
13
|
+
children?: Snippet;
|
|
14
|
+
class?: string;
|
|
15
|
+
} & Omit<HTMLAttributes<HTMLSpanElement>, 'color'>;
|
|
16
|
+
|
|
17
|
+
let {
|
|
18
|
+
size = 'medium',
|
|
19
|
+
class: className,
|
|
20
|
+
color = 'primary',
|
|
21
|
+
shape = 'semi-round',
|
|
22
|
+
children,
|
|
23
|
+
...props
|
|
24
|
+
}: Props = $props();
|
|
25
|
+
|
|
26
|
+
const styles = tv({
|
|
27
|
+
base: 'border px-2 py-0.5',
|
|
28
|
+
variants: {
|
|
29
|
+
shape: styleVariants.shape,
|
|
30
|
+
color: {
|
|
31
|
+
primary: 'bg-primary-200 text-primary-950 dark:text-primary-50 dark:bg-primary-800',
|
|
32
|
+
secondary: 'bg-neutral-200 text-neutral-950 dark:bg-neutral-800 dark:text-neutral-50',
|
|
33
|
+
success: 'bg-success-200 text-success-950 dark:text-success-50 dark:bg-success-800',
|
|
34
|
+
danger: 'bg-danger-200 text-danger-950 dark:text-danger-50 dark:bg-danger-800',
|
|
35
|
+
warning: 'bg-warning-200 text-warning-950 dark:text-warning-50 dark:bg-warning-800',
|
|
36
|
+
info: 'bg-info-200 text-info-950 dark:text-info-50 dark:bg-info-800',
|
|
37
|
+
},
|
|
38
|
+
textSize: styleVariants.textSize,
|
|
39
|
+
paddingSize: {
|
|
40
|
+
tiny: 'px-1 py-0.5',
|
|
41
|
+
small: 'px-2 py-0.5',
|
|
42
|
+
medium: 'px-2 py-0.5',
|
|
43
|
+
large: 'px-2 py-1.5',
|
|
44
|
+
giant: 'px-3 py-1',
|
|
45
|
+
},
|
|
46
|
+
roundedSize: {
|
|
47
|
+
tiny: 'rounded-sm',
|
|
48
|
+
small: 'rounded-sm',
|
|
49
|
+
medium: 'rounded-sm',
|
|
50
|
+
large: 'rounded-md',
|
|
51
|
+
giant: 'rounded-md',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<span
|
|
58
|
+
{...props}
|
|
59
|
+
class={cleanClass(
|
|
60
|
+
className,
|
|
61
|
+
styles({
|
|
62
|
+
color,
|
|
63
|
+
textSize: size,
|
|
64
|
+
paddingSize: size,
|
|
65
|
+
shape,
|
|
66
|
+
roundedSize: shape === 'semi-round' ? size : undefined,
|
|
67
|
+
}),
|
|
68
|
+
)}>{@render children?.()}</span
|
|
69
|
+
>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Color, Shape, Size } from '../../types.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
type Props = {
|
|
5
|
+
size?: Size;
|
|
6
|
+
color?: Color;
|
|
7
|
+
shape?: Shape;
|
|
8
|
+
children?: Snippet;
|
|
9
|
+
class?: string;
|
|
10
|
+
} & Omit<HTMLAttributes<HTMLSpanElement>, 'color'>;
|
|
11
|
+
declare const Badge: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type Badge = ReturnType<typeof Badge>;
|
|
13
|
+
export default Badge;
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
base: 'flex w-full grow flex-col',
|
|
50
50
|
variants: {
|
|
51
51
|
color: {
|
|
52
|
-
primary: 'bg-primary
|
|
53
|
-
secondary: 'text-dark bg-gray-
|
|
54
|
-
success: 'bg-success
|
|
55
|
-
danger: 'bg-danger
|
|
56
|
-
warning: 'bg-warning
|
|
57
|
-
info: 'bg-info
|
|
52
|
+
primary: 'bg-primary-100 dark:bg-primary-900',
|
|
53
|
+
secondary: 'text-dark bg-gray-100 dark:bg-neutral-900 dark:text-white',
|
|
54
|
+
success: 'bg-success-100 dark:bg-success-900',
|
|
55
|
+
danger: 'bg-danger-100 dark:bg-danger-900',
|
|
56
|
+
warning: 'bg-warning-100 dark:bg-warning-900',
|
|
57
|
+
info: 'bg-info-100 dark:bg-info-900',
|
|
58
58
|
},
|
|
59
59
|
},
|
|
60
60
|
});
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
|
|
82
82
|
<div class="flex flex-col gap-1">
|
|
83
83
|
{#if label}
|
|
84
|
-
<Label id={labelId} for={inputId} {label} {...labelProps} />
|
|
84
|
+
<Label id={labelId} for={inputId} {label} requiredIndicator={required === 'indicator'} {...labelProps} />
|
|
85
85
|
{#if description}
|
|
86
86
|
<Text color="secondary" size="small" id={descriptionId}>{description}</Text>
|
|
87
87
|
{/if}
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
)}
|
|
101
101
|
bind:checked
|
|
102
102
|
disabled={disabled || readOnly}
|
|
103
|
-
{required}
|
|
103
|
+
required={!!required}
|
|
104
104
|
aria-readonly={disabled || readOnly}
|
|
105
105
|
aria-describedby={descriptionId}
|
|
106
106
|
{...restProps}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import DatePickerInternal from '../../internal/DatePicker.svelte';
|
|
3
|
+
import type { DatePickerProps } from '../../types.js';
|
|
4
|
+
import { CalendarDate, type DateValue } from '@internationalized/date';
|
|
5
|
+
import { DateTime } from 'luxon';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
value = $bindable<DateTime | undefined>(undefined),
|
|
9
|
+
onChange,
|
|
10
|
+
minDate,
|
|
11
|
+
maxDate,
|
|
12
|
+
...rest
|
|
13
|
+
}: DatePickerProps = $props();
|
|
14
|
+
|
|
15
|
+
// Note: DatePickerInternal/bits.ui uses DateValue, while this component uses DateTime from luxon
|
|
16
|
+
|
|
17
|
+
// Convert DateTime to DateValue
|
|
18
|
+
const toDateValue = (dateTime?: DateTime): DateValue | undefined => {
|
|
19
|
+
if (!dateTime) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
return new CalendarDate(dateTime.year, dateTime.month, dateTime.day);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Convert DateValue to DateTime
|
|
26
|
+
const toDateTime = (dateValue?: DateValue): DateTime | undefined => {
|
|
27
|
+
if (!dateValue) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return DateTime.fromObject({ year: dateValue.year, month: dateValue.month, day: dateValue.day });
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const handleChange = (date: DateValue | undefined) => {
|
|
35
|
+
onChange?.(toDateTime(date));
|
|
36
|
+
};
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<DatePickerInternal
|
|
40
|
+
bind:date={() => toDateValue(value), (dateValue) => (value = toDateTime(dateValue))}
|
|
41
|
+
minDate={toDateValue(minDate)}
|
|
42
|
+
maxDate={toDateValue(maxDate)}
|
|
43
|
+
onChange={handleChange}
|
|
44
|
+
{...rest}
|
|
45
|
+
/>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Button from '../Button/Button.svelte';
|
|
3
|
+
import Modal from '../Modal/Modal.svelte';
|
|
4
|
+
import ModalBody from '../Modal/ModalBody.svelte';
|
|
5
|
+
import ModalFooter from '../Modal/ModalFooter.svelte';
|
|
6
|
+
import HStack from '../Stack/HStack.svelte';
|
|
7
|
+
import { t } from '../../services/translation.svelte.js';
|
|
8
|
+
import type { Color } from '../../types.js';
|
|
9
|
+
import { generateId } from '../../utilities/internal.js';
|
|
10
|
+
import type { Snippet } from 'svelte';
|
|
11
|
+
|
|
12
|
+
type Props = {
|
|
13
|
+
title: string;
|
|
14
|
+
icon?: string | boolean;
|
|
15
|
+
submitText?: string;
|
|
16
|
+
submitColor?: Color;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
size?: 'small' | 'medium';
|
|
19
|
+
preventDefault?: boolean;
|
|
20
|
+
onClose: () => void;
|
|
21
|
+
onSubmit: (event: SubmitEvent) => void;
|
|
22
|
+
children: Snippet;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
let {
|
|
26
|
+
title,
|
|
27
|
+
icon,
|
|
28
|
+
submitText = t('save'),
|
|
29
|
+
submitColor = 'primary',
|
|
30
|
+
disabled = false,
|
|
31
|
+
size = 'small',
|
|
32
|
+
preventDefault = true,
|
|
33
|
+
onClose = () => {},
|
|
34
|
+
onSubmit,
|
|
35
|
+
children,
|
|
36
|
+
}: Props = $props();
|
|
37
|
+
|
|
38
|
+
const onsubmit = (event: SubmitEvent) => {
|
|
39
|
+
if (preventDefault) {
|
|
40
|
+
event.preventDefault();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
onSubmit(event);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const formId = generateId();
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<Modal {title} {onClose} {size} {icon}>
|
|
50
|
+
<ModalBody>
|
|
51
|
+
<form {onsubmit} id={formId}>
|
|
52
|
+
{@render children()}
|
|
53
|
+
</form>
|
|
54
|
+
</ModalBody>
|
|
55
|
+
<ModalFooter>
|
|
56
|
+
<HStack fullWidth>
|
|
57
|
+
<Button shape="round" color="secondary" fullWidth onclick={onClose}>
|
|
58
|
+
{t('cancel')}
|
|
59
|
+
</Button>
|
|
60
|
+
<Button shape="round" type="submit" tabindex={1} color={submitColor} fullWidth {disabled} form={formId}>
|
|
61
|
+
{submitText}
|
|
62
|
+
</Button>
|
|
63
|
+
</HStack>
|
|
64
|
+
</ModalFooter>
|
|
65
|
+
</Modal>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Color } from '../../types.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type Props = {
|
|
4
|
+
title: string;
|
|
5
|
+
icon?: string | boolean;
|
|
6
|
+
submitText?: string;
|
|
7
|
+
submitColor?: Color;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
size?: 'small' | 'medium';
|
|
10
|
+
preventDefault?: boolean;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
onSubmit: (event: SubmitEvent) => void;
|
|
13
|
+
children: Snippet;
|
|
14
|
+
};
|
|
15
|
+
declare const FormModal: import("svelte").Component<Props, {}, "">;
|
|
16
|
+
type FormModal = ReturnType<typeof FormModal>;
|
|
17
|
+
export default FormModal;
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
const { label, description, readOnly, required, invalid, disabled, ...labelProps } = $derived(getFieldContext());
|
|
26
26
|
|
|
27
27
|
const iconStyles = tv({
|
|
28
|
-
base: 'flex
|
|
28
|
+
base: 'flex shrink-0 items-center justify-center',
|
|
29
29
|
variants: {
|
|
30
30
|
size: {
|
|
31
31
|
tiny: 'w-6',
|
|
@@ -38,25 +38,19 @@
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
const containerStyles = tv({
|
|
41
|
-
base: 'flex w-full items-center
|
|
41
|
+
base: cleanClass(styleVariants.inputContainerCommon, 'mt-0.5 flex w-full items-center'),
|
|
42
42
|
variants: {
|
|
43
43
|
shape: styleVariants.shape,
|
|
44
|
-
roundedSize:
|
|
45
|
-
tiny: 'rounded-xl',
|
|
46
|
-
small: 'rounded-xl',
|
|
47
|
-
medium: 'rounded-2xl',
|
|
48
|
-
large: 'rounded-2xl',
|
|
49
|
-
giant: 'rounded-2xl',
|
|
50
|
-
},
|
|
44
|
+
roundedSize: styleVariants.inputRoundedSize,
|
|
51
45
|
invalid: {
|
|
52
|
-
true: '
|
|
46
|
+
true: 'focus-within:ring-danger dark:focus-within:ring-danger dark:ring-danger-300 ring-danger-300 ring-1',
|
|
53
47
|
false: '',
|
|
54
48
|
},
|
|
55
49
|
},
|
|
56
50
|
});
|
|
57
51
|
|
|
58
52
|
const inputStyles = tv({
|
|
59
|
-
base: 'flex-1
|
|
53
|
+
base: cleanClass(styleVariants.inputCommon, 'flex-1 py-2'),
|
|
60
54
|
variants: {
|
|
61
55
|
textSize: styleVariants.textSize,
|
|
62
56
|
leadingPadding: {
|
|
@@ -67,6 +61,13 @@
|
|
|
67
61
|
base: 'pr-4',
|
|
68
62
|
icon: 'pr-0',
|
|
69
63
|
},
|
|
64
|
+
roundedSize: {
|
|
65
|
+
tiny: 'rounded-lg',
|
|
66
|
+
small: 'rounded-lg',
|
|
67
|
+
medium: 'rounded-lg',
|
|
68
|
+
large: 'rounded-lg',
|
|
69
|
+
giant: 'rounded-lg',
|
|
70
|
+
},
|
|
70
71
|
},
|
|
71
72
|
});
|
|
72
73
|
|
|
@@ -87,11 +88,18 @@
|
|
|
87
88
|
|
|
88
89
|
<div class="flex w-full flex-col gap-1" bind:this={containerRef}>
|
|
89
90
|
{#if label}
|
|
90
|
-
<Label
|
|
91
|
+
<Label
|
|
92
|
+
id={labelId}
|
|
93
|
+
for={inputId}
|
|
94
|
+
{label}
|
|
95
|
+
requiredIndicator={required === 'indicator'}
|
|
96
|
+
{...labelProps}
|
|
97
|
+
class="font-medium"
|
|
98
|
+
/>
|
|
91
99
|
{/if}
|
|
92
100
|
|
|
93
101
|
{#if description}
|
|
94
|
-
<Text color="
|
|
102
|
+
<Text color="muted" size="small" id={descriptionId} class="mb-1">{description}</Text>
|
|
95
103
|
{/if}
|
|
96
104
|
|
|
97
105
|
<div
|
|
@@ -117,8 +125,8 @@
|
|
|
117
125
|
<input
|
|
118
126
|
id={inputId}
|
|
119
127
|
aria-labelledby={label && labelId}
|
|
120
|
-
{required}
|
|
121
|
-
aria-required={required}
|
|
128
|
+
required={!!required}
|
|
129
|
+
aria-required={!!required}
|
|
122
130
|
{disabled}
|
|
123
131
|
aria-disabled={disabled}
|
|
124
132
|
aria-describedby={descriptionId}
|
|
@@ -129,6 +137,7 @@
|
|
|
129
137
|
textSize: size,
|
|
130
138
|
leadingPadding: leadingIcon ? 'icon' : 'base',
|
|
131
139
|
trailingPadding: trailingIcon || trailingText ? 'icon' : 'base',
|
|
140
|
+
roundedSize: shape === 'semi-round' ? size : undefined,
|
|
132
141
|
})}
|
|
133
142
|
bind:this={ref}
|
|
134
143
|
bind:value
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { cleanClass } from '../../utilities/internal.js';
|
|
5
5
|
import { tv } from 'tailwind-variants';
|
|
6
6
|
|
|
7
|
-
const { label, size, color, class: className, children, ...restProps }: LabelProps = $props();
|
|
7
|
+
const { label, size, color, class: className, children, requiredIndicator, ...restProps }: LabelProps = $props();
|
|
8
8
|
|
|
9
9
|
const styles = tv({
|
|
10
10
|
base: '',
|
|
@@ -15,7 +15,13 @@
|
|
|
15
15
|
});
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
|
-
<
|
|
19
|
-
{
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
<div class="inline-block">
|
|
19
|
+
<label class={cleanClass(styles({ size, color }), className)} {...restProps}>
|
|
20
|
+
{#if label}{label}{/if}
|
|
21
|
+
{@render children?.()}
|
|
22
|
+
</label>
|
|
23
|
+
|
|
24
|
+
{#if requiredIndicator}
|
|
25
|
+
<span aria-hidden="true" class="text-danger">*</span>
|
|
26
|
+
{/if}
|
|
27
|
+
</div>
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
base: 'h-8 w-13 rounded-full border-2',
|
|
42
42
|
variants: {
|
|
43
43
|
fillColor: {
|
|
44
|
-
default: 'border-gray-400 bg-gray-
|
|
45
|
-
primary: 'bg-primary
|
|
46
|
-
secondary: 'bg-dark
|
|
47
|
-
success: 'bg-success
|
|
48
|
-
danger: 'bg-danger
|
|
49
|
-
warning: 'bg-warning
|
|
50
|
-
info: 'bg-info
|
|
44
|
+
default: 'border-gray-400 bg-gray-200 dark:border-gray-500 dark:bg-gray-800',
|
|
45
|
+
primary: 'bg-primary-200 dark:bg-primary-800 border-transparent',
|
|
46
|
+
secondary: 'border-transparent bg-neutral-300 dark:bg-neutral-700',
|
|
47
|
+
success: 'bg-success-200 dark:bg-success-800 border-transparent',
|
|
48
|
+
danger: 'bg-danger-200 dark:bg-danger-800 border-transparent',
|
|
49
|
+
warning: 'bg-warning-200 dark:bg-warning-800 border-transparent',
|
|
50
|
+
info: 'bg-info-200 dark:bg-info-800 border-transparent',
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
53
|
});
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
false: 'translate-x-2 rtl:-translate-x-2',
|
|
61
61
|
},
|
|
62
62
|
fillColor: {
|
|
63
|
-
default: 'bg-gray-
|
|
64
|
-
primary: 'bg-
|
|
63
|
+
default: 'bg-gray-600 dark:bg-gray-500',
|
|
64
|
+
primary: 'bg-primary',
|
|
65
65
|
secondary: 'bg-dark',
|
|
66
66
|
success: 'bg-success',
|
|
67
67
|
danger: 'bg-danger',
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
bind:ref
|
|
82
82
|
id={inputId}
|
|
83
83
|
disabled={disabled || readOnly}
|
|
84
|
-
{required}
|
|
84
|
+
required={!!required}
|
|
85
85
|
class={cleanClass(label && 'w-full', className)}
|
|
86
86
|
aria-readonly={readOnly}
|
|
87
87
|
aria-labelledby={labelId}
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
<div class={cleanClass(label && 'flex items-center justify-between gap-1')}>
|
|
94
94
|
{#if label}
|
|
95
95
|
<div class="text-start">
|
|
96
|
-
<Label id={labelId} for={inputId} {label} {...labelProps} />
|
|
96
|
+
<Label id={labelId} for={inputId} {label} requiredIndicator={required === 'indicator'} {...labelProps} />
|
|
97
97
|
{#if description}
|
|
98
98
|
<Text color="secondary" size="small" id={descriptionId}>{description}</Text>
|
|
99
99
|
{/if}
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
|
|
67
67
|
<div class="flex w-full flex-col gap-1" bind:this={containerRef}>
|
|
68
68
|
{#if label}
|
|
69
|
-
<Label id={labelId} for={inputId} {label} {...labelProps} />
|
|
69
|
+
<Label id={labelId} for={inputId} {label} requiredIndicator={required === 'indicator'} {...labelProps} />
|
|
70
70
|
{/if}
|
|
71
71
|
|
|
72
72
|
{#if description}
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
oninput={onInput}
|
|
79
79
|
id={inputId}
|
|
80
80
|
aria-labelledby={label && labelId}
|
|
81
|
-
{required}
|
|
82
|
-
aria-required={required}
|
|
81
|
+
required={!!required}
|
|
82
|
+
aria-required={!!required}
|
|
83
83
|
{disabled}
|
|
84
84
|
aria-disabled={disabled}
|
|
85
85
|
aria-describedby={descriptionId}
|
|
@@ -9,15 +9,23 @@
|
|
|
9
9
|
color = 'primary',
|
|
10
10
|
shape = 'semi-round',
|
|
11
11
|
size = 'medium',
|
|
12
|
-
variant = 'filled',
|
|
13
12
|
class: className,
|
|
14
13
|
children,
|
|
15
14
|
...restProps
|
|
16
15
|
}: ToastContainerProps = $props();
|
|
17
16
|
|
|
18
17
|
const containerStyles = tv({
|
|
19
|
-
base: 'bg-light text-dark overflow-hidden shadow-xs transition-all',
|
|
18
|
+
base: 'bg-light text-dark overflow-hidden py-1.5 shadow-xs transition-all',
|
|
20
19
|
variants: {
|
|
20
|
+
color: {
|
|
21
|
+
primary: 'bg-primary-100 dark:bg-primary-900',
|
|
22
|
+
secondary: 'bg-neutral-100 dark:bg-neutral-900',
|
|
23
|
+
muted: 'bg-subtle dark:bg-subtle',
|
|
24
|
+
info: 'bg-info-100 dark:bg-info-900',
|
|
25
|
+
warning: 'bg-warning-100 dark:bg-warning-900',
|
|
26
|
+
danger: 'bg-danger-100 dark:bg-danger-900',
|
|
27
|
+
success: 'bg-success-100 dark:bg-success-900',
|
|
28
|
+
},
|
|
21
29
|
shape: styleVariants.shape,
|
|
22
30
|
size: {
|
|
23
31
|
tiny: 'w-64',
|
|
@@ -27,16 +35,6 @@
|
|
|
27
35
|
giant: 'w-lg',
|
|
28
36
|
full: 'w-full',
|
|
29
37
|
},
|
|
30
|
-
|
|
31
|
-
border: styleVariants.border,
|
|
32
|
-
borderColor: {
|
|
33
|
-
primary: 'border-primary/25',
|
|
34
|
-
secondary: 'border-dark/25',
|
|
35
|
-
success: 'border-success/25',
|
|
36
|
-
danger: 'border-danger/25',
|
|
37
|
-
warning: 'border-warning/25',
|
|
38
|
-
info: 'border-info/25',
|
|
39
|
-
},
|
|
40
38
|
roundedSize: {
|
|
41
39
|
tiny: 'rounded-lg',
|
|
42
40
|
small: 'rounded-lg',
|
|
@@ -46,29 +44,6 @@
|
|
|
46
44
|
},
|
|
47
45
|
},
|
|
48
46
|
});
|
|
49
|
-
|
|
50
|
-
const container2Styles = tv({
|
|
51
|
-
base: 'py-1.5',
|
|
52
|
-
variants: {
|
|
53
|
-
filled: {
|
|
54
|
-
primary: 'bg-primary/15 dark:bg-primary/25',
|
|
55
|
-
secondary: 'bg-dark/15 dark:bg-dark/25',
|
|
56
|
-
muted: 'bg-subtle dark:bg-subtle',
|
|
57
|
-
info: 'bg-info/15 dark:bg-info/25',
|
|
58
|
-
warning: 'bg-warning/15 dark:bg-warning/25',
|
|
59
|
-
danger: 'bg-danger/15 dark:bg-danger/25',
|
|
60
|
-
success: 'bg-success/15 dark:bg-success/25',
|
|
61
|
-
},
|
|
62
|
-
outline: {
|
|
63
|
-
primary: 'bg-primary/2 text-primary dark:bg-primary/5',
|
|
64
|
-
secondary: 'bg-dark/2 text-dark dark:bg-dark/5',
|
|
65
|
-
success: 'bg-success/2 text-success dark:bg-success/5',
|
|
66
|
-
danger: 'bg-danger/2 text-danger dark:bg-danger/5',
|
|
67
|
-
warning: 'bg-warning/2 text-warning dark:bg-warning/5',
|
|
68
|
-
info: 'bg-info/2 text-info dark:bg-info/5',
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
47
|
</script>
|
|
73
48
|
|
|
74
49
|
<div
|
|
@@ -78,20 +53,12 @@
|
|
|
78
53
|
containerStyles({
|
|
79
54
|
shape,
|
|
80
55
|
size,
|
|
56
|
+
color,
|
|
81
57
|
roundedSize: shape === 'semi-round' ? 'medium' : undefined,
|
|
82
|
-
border: variant === 'outline',
|
|
83
|
-
borderColor: variant === 'outline' ? color : undefined,
|
|
84
58
|
}),
|
|
85
59
|
className,
|
|
86
60
|
)}
|
|
87
61
|
{...restProps}
|
|
88
62
|
>
|
|
89
|
-
|
|
90
|
-
class={container2Styles({
|
|
91
|
-
outline: variant === 'outline' ? color : undefined,
|
|
92
|
-
filled: variant === 'filled' ? color : undefined,
|
|
93
|
-
})}
|
|
94
|
-
>
|
|
95
|
-
{@render children?.()}
|
|
96
|
-
</div>
|
|
63
|
+
{@render children?.()}
|
|
97
64
|
</div>
|
|
@@ -9,15 +9,7 @@
|
|
|
9
9
|
import { type Snippet } from 'svelte';
|
|
10
10
|
import { tv } from 'tailwind-variants';
|
|
11
11
|
|
|
12
|
-
let {
|
|
13
|
-
color = 'primary',
|
|
14
|
-
variant = 'filled',
|
|
15
|
-
icon: iconOverride,
|
|
16
|
-
title,
|
|
17
|
-
description,
|
|
18
|
-
onClose,
|
|
19
|
-
children,
|
|
20
|
-
}: ToastContentProps = $props();
|
|
12
|
+
let { color = 'primary', icon: iconOverride, title, description, onClose, children }: ToastContentProps = $props();
|
|
21
13
|
|
|
22
14
|
const icon = $derived(
|
|
23
15
|
resolveIcon({
|
|
@@ -49,7 +41,7 @@
|
|
|
49
41
|
<div class="flex items-center px-2">
|
|
50
42
|
<div class="flex items-center">
|
|
51
43
|
{#if icon}
|
|
52
|
-
<Icon {icon} class={iconStyles({ color
|
|
44
|
+
<Icon {icon} class={iconStyles({ color })} />
|
|
53
45
|
{/if}
|
|
54
46
|
</div>
|
|
55
47
|
<div class="flex grow justify-between">
|
|
@@ -63,7 +55,7 @@
|
|
|
63
55
|
</div>
|
|
64
56
|
{#if onClose}
|
|
65
57
|
<div class="flex items-center">
|
|
66
|
-
<CloseButton color=
|
|
58
|
+
<CloseButton color="secondary" variant="ghost" onclick={onClose} />
|
|
67
59
|
</div>
|
|
68
60
|
{/if}
|
|
69
61
|
</div>
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export { default as AppShell } from './components/AppShell/AppShell.svelte';
|
|
|
16
16
|
export { default as AppShellHeader } from './components/AppShell/AppShellHeader.svelte';
|
|
17
17
|
export { default as AppShellSidebar } from './components/AppShell/AppShellSidebar.svelte';
|
|
18
18
|
export { default as Avatar } from './components/Avatar/Avatar.svelte';
|
|
19
|
+
export { default as Badge } from './components/Badge/Badge.svelte';
|
|
19
20
|
export { default as Button } from './components/Button/Button.svelte';
|
|
20
21
|
export { default as Card } from './components/Card/Card.svelte';
|
|
21
22
|
export { default as CardBody } from './components/Card/CardBody.svelte';
|
|
@@ -30,8 +31,10 @@ export { default as CodeBlock } from './components/CodeBlock/CodeBlock.svelte';
|
|
|
30
31
|
export { default as CommandPaletteContext } from './components/CommandPalette/CommandPaletteContext.svelte';
|
|
31
32
|
export { default as ConfirmModal } from './components/ConfirmModal/ConfirmModal.svelte';
|
|
32
33
|
export { default as Container } from './components/Container/Container.svelte';
|
|
34
|
+
export { default as DatePicker } from './components/DatePicker/DatePicker.svelte';
|
|
33
35
|
export { default as Field } from './components/Field/Field.svelte';
|
|
34
36
|
export { default as FormatBytes } from './components/FormatBytes/FormatBytes.svelte';
|
|
37
|
+
export { default as FormModal } from './components/FormModal/FormModal.svelte';
|
|
35
38
|
export { default as Heading } from './components/Heading/Heading.svelte';
|
|
36
39
|
export { default as HelperText } from './components/HelperText/HelperText.svelte';
|
|
37
40
|
export { default as Icon } from './components/Icon/Icon.svelte';
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ export { default as AppShell } from './components/AppShell/AppShell.svelte';
|
|
|
18
18
|
export { default as AppShellHeader } from './components/AppShell/AppShellHeader.svelte';
|
|
19
19
|
export { default as AppShellSidebar } from './components/AppShell/AppShellSidebar.svelte';
|
|
20
20
|
export { default as Avatar } from './components/Avatar/Avatar.svelte';
|
|
21
|
+
export { default as Badge } from './components/Badge/Badge.svelte';
|
|
21
22
|
export { default as Button } from './components/Button/Button.svelte';
|
|
22
23
|
export { default as Card } from './components/Card/Card.svelte';
|
|
23
24
|
export { default as CardBody } from './components/Card/CardBody.svelte';
|
|
@@ -32,8 +33,10 @@ export { default as CodeBlock } from './components/CodeBlock/CodeBlock.svelte';
|
|
|
32
33
|
export { default as CommandPaletteContext } from './components/CommandPalette/CommandPaletteContext.svelte';
|
|
33
34
|
export { default as ConfirmModal } from './components/ConfirmModal/ConfirmModal.svelte';
|
|
34
35
|
export { default as Container } from './components/Container/Container.svelte';
|
|
36
|
+
export { default as DatePicker } from './components/DatePicker/DatePicker.svelte';
|
|
35
37
|
export { default as Field } from './components/Field/Field.svelte';
|
|
36
38
|
export { default as FormatBytes } from './components/FormatBytes/FormatBytes.svelte';
|
|
39
|
+
export { default as FormModal } from './components/FormModal/FormModal.svelte';
|
|
37
40
|
export { default as Heading } from './components/Heading/Heading.svelte';
|
|
38
41
|
export { default as HelperText } from './components/HelperText/HelperText.svelte';
|
|
39
42
|
export { default as Icon } from './components/Icon/Icon.svelte';
|