@immich/ui 0.43.0 → 0.44.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.
|
@@ -4,6 +4,6 @@ const fieldKey = Symbol(withPrefix('field'));
|
|
|
4
4
|
export const setFieldContext = (field) => setContext(fieldKey, field);
|
|
5
5
|
export const hasFieldContext = () => hasContext(fieldKey);
|
|
6
6
|
export const getFieldContext = () => {
|
|
7
|
-
const { label, color = 'secondary', invalid = false, readOnly = false, required = false, disabled = false, description, } = getContext(fieldKey) || {};
|
|
8
|
-
return { label, description, color, invalid, readOnly, required, disabled };
|
|
7
|
+
const { label, color = 'secondary', invalid = false, readOnly = false, required = false, requiredIndicator = false, disabled = false, description, } = getContext(fieldKey) || {};
|
|
8
|
+
return { label, description, color, invalid, readOnly, required, requiredIndicator, disabled };
|
|
9
9
|
};
|
|
@@ -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>
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
const disabled = $derived((restProps as HTMLButtonAttributes).disabled || loading);
|
|
37
37
|
|
|
38
38
|
const buttonVariants = tv({
|
|
39
|
-
base: 'ring-offset-background focus-visible:ring-ring flex items-center justify-center gap-1 rounded-md text-sm font-medium
|
|
39
|
+
base: 'ring-offset-background focus-visible:ring-ring flex items-center justify-center gap-1 rounded-md text-sm font-medium transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none',
|
|
40
40
|
variants: {
|
|
41
41
|
disabled: {
|
|
42
42
|
true: 'disabled:pointer-events-none disabled:opacity-50 aria-disabled:opacity-50',
|
package/dist/types.d.ts
CHANGED
|
@@ -96,6 +96,7 @@ export type LabelProps = {
|
|
|
96
96
|
class?: string;
|
|
97
97
|
size?: Size;
|
|
98
98
|
color?: TextColor;
|
|
99
|
+
requiredIndicator?: boolean;
|
|
99
100
|
children?: Snippet;
|
|
100
101
|
} & HTMLLabelAttributes;
|
|
101
102
|
export type FieldContext = {
|
|
@@ -104,6 +105,7 @@ export type FieldContext = {
|
|
|
104
105
|
invalid?: boolean;
|
|
105
106
|
disabled?: boolean;
|
|
106
107
|
required?: boolean;
|
|
108
|
+
requiredIndicator?: boolean;
|
|
107
109
|
readOnly?: boolean;
|
|
108
110
|
} & LabelProps;
|
|
109
111
|
type BaseInputProps<T> = {
|