@urbicon-ui/blocks 6.37.2 → 6.38.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 (55) hide show
  1. package/dist/components/AvatarGroup/AvatarGroup.svelte +60 -0
  2. package/dist/components/AvatarGroup/AvatarGroup.svelte.d.ts +4 -0
  3. package/dist/components/AvatarGroup/avatar-group.variants.d.ts +20 -0
  4. package/dist/components/AvatarGroup/avatar-group.variants.js +21 -0
  5. package/dist/components/AvatarGroup/index.d.ts +57 -0
  6. package/dist/components/AvatarGroup/index.js +2 -0
  7. package/dist/components/Calendar/calendar.variants.d.ts +126 -126
  8. package/dist/components/CopyButton/CopyButton.svelte +139 -0
  9. package/dist/components/CopyButton/CopyButton.svelte.d.ts +4 -0
  10. package/dist/components/CopyButton/copy-button.variants.d.ts +29 -0
  11. package/dist/components/CopyButton/copy-button.variants.js +32 -0
  12. package/dist/components/CopyButton/index.d.ts +55 -0
  13. package/dist/components/CopyButton/index.js +2 -0
  14. package/dist/components/FileUpload/FileUpload.svelte.d.ts +1 -1
  15. package/dist/components/PinInput/pin-input.variants.d.ts +7 -7
  16. package/dist/components/Planner/planner.variants.d.ts +34 -34
  17. package/dist/components/TimeInput/time-input.variants.d.ts +9 -9
  18. package/dist/components/index.d.ts +4 -0
  19. package/dist/components/index.js +2 -0
  20. package/dist/i18n/index.d.ts +6 -390
  21. package/dist/primitives/Accordion/accordion.variants.d.ts +7 -7
  22. package/dist/primitives/Alert/alert.variants.d.ts +8 -8
  23. package/dist/primitives/Avatar/avatar.variants.d.ts +12 -12
  24. package/dist/primitives/Badge/badge.variants.d.ts +10 -10
  25. package/dist/primitives/Button/button.variants.d.ts +4 -4
  26. package/dist/primitives/Card/card.variants.d.ts +5 -5
  27. package/dist/primitives/Checkbox/checkbox.variants.d.ts +7 -7
  28. package/dist/primitives/Collapsible/collapsible.variants.d.ts +6 -6
  29. package/dist/primitives/Combobox/combobox.variants.d.ts +50 -50
  30. package/dist/primitives/Input/input.variants.d.ts +27 -27
  31. package/dist/primitives/JourneyTimeline/journey-timeline.variants.d.ts +22 -22
  32. package/dist/primitives/Kbd/Kbd.svelte +44 -0
  33. package/dist/primitives/Kbd/Kbd.svelte.d.ts +4 -0
  34. package/dist/primitives/Kbd/index.d.ts +51 -0
  35. package/dist/primitives/Kbd/index.js +2 -0
  36. package/dist/primitives/Kbd/kbd.variants.d.ts +20 -0
  37. package/dist/primitives/Kbd/kbd.variants.js +27 -0
  38. package/dist/primitives/Progress/progress.variants.d.ts +11 -11
  39. package/dist/primitives/RadioGroup/radioGroup.variants.d.ts +6 -6
  40. package/dist/primitives/Select/select.variants.d.ts +34 -34
  41. package/dist/primitives/Skeleton/skeleton.variants.d.ts +3 -3
  42. package/dist/primitives/Spinner/spinner.variants.d.ts +48 -48
  43. package/dist/primitives/Stepper/stepper.variants.d.ts +11 -11
  44. package/dist/primitives/Textarea/textarea.variants.d.ts +21 -21
  45. package/dist/primitives/Toast/toast.variants.d.ts +12 -12
  46. package/dist/primitives/Toggle/toggle.variants.d.ts +7 -7
  47. package/dist/primitives/Toolbar/toolbar.variants.d.ts +6 -6
  48. package/dist/primitives/Tooltip/tooltip.variants.d.ts +3 -3
  49. package/dist/primitives/index.d.ts +2 -0
  50. package/dist/primitives/index.js +1 -0
  51. package/dist/translations/de.d.ts +4 -0
  52. package/dist/translations/de.js +4 -0
  53. package/dist/translations/en.d.ts +4 -0
  54. package/dist/translations/en.js +4 -0
  55. package/package.json +3 -3
@@ -0,0 +1,60 @@
1
+ <script lang="ts">
2
+ import { useBlocksI18n } from '../..';
3
+ import { Avatar } from '../../primitives/Avatar';
4
+ import { getBlocksConfig, resolveSlotClasses } from '../../provider';
5
+ import { avatarGroupVariants } from './avatar-group.variants';
6
+ import type { AvatarGroupProps } from './index';
7
+
8
+ let {
9
+ items,
10
+ size = 'md',
11
+ max,
12
+ spacing = 'normal',
13
+ borderColor = 'var(--color-surface-base)',
14
+ class: className = '',
15
+ unstyled: unstyledProp = false,
16
+ slotClasses: slotClassesProp = {},
17
+ preset,
18
+ ...restProps
19
+ }: AvatarGroupProps = $props();
20
+
21
+ const bt = useBlocksI18n();
22
+ const blocksConfig = getBlocksConfig();
23
+ const unstyled = $derived(unstyledProp || blocksConfig?.unstyled || false);
24
+
25
+ const styles = $derived(unstyled ? null : avatarGroupVariants({ spacing }));
26
+ const slotClasses = $derived(
27
+ resolveSlotClasses(blocksConfig, 'AvatarGroup', preset, { spacing, size }, slotClassesProp)
28
+ );
29
+
30
+ // When `max` is set and exceeded, show (max - 1) avatars + one "+N" chip so the
31
+ // total rendered count is exactly `max`.
32
+ const capped = $derived(typeof max === 'number' && max > 0 && items.length > max);
33
+ const shown = $derived(capped ? items.slice(0, (max as number) - 1) : items);
34
+ const overflow = $derived(capped ? items.length - ((max as number) - 1) : 0);
35
+
36
+ const baseClass = $derived(
37
+ [styles?.base(), slotClasses?.base, className].filter(Boolean).join(' ') || undefined
38
+ );
39
+ const overflowClass = $derived(
40
+ [styles?.overflow(), slotClasses?.overflow].filter(Boolean).join(' ') || undefined
41
+ );
42
+ </script>
43
+
44
+ <div class={baseClass} role="group" aria-label={bt('accessibility.avatarGroup')} {...restProps}>
45
+ {#each shown as avatar, i (`${avatar.name ?? avatar.src ?? ''}-${i}`)}
46
+ <Avatar {...avatar} {size} ring ringColor={borderColor} />
47
+ {/each}
48
+ {#if overflow > 0}
49
+ <Avatar
50
+ {size}
51
+ ring
52
+ ringColor={borderColor}
53
+ intent="neutral"
54
+ class={overflowClass}
55
+ aria-label={`+${overflow}`}
56
+ >
57
+ {#snippet children()}+{overflow}{/snippet}
58
+ </Avatar>
59
+ {/if}
60
+ </div>
@@ -0,0 +1,4 @@
1
+ import type { AvatarGroupProps } from './index.js';
2
+ declare const AvatarGroup: import("svelte").Component<AvatarGroupProps, {}, "">;
3
+ type AvatarGroup = ReturnType<typeof AvatarGroup>;
4
+ export default AvatarGroup;
@@ -0,0 +1,20 @@
1
+ import { type SlotNames, type VariantProps } from '../../utils/variants.js';
2
+ export declare const avatarGroupVariants: ((props?: {
3
+ spacing?: "normal" | "tight" | "loose" | undefined;
4
+ } | undefined) => {
5
+ base: (props?: ({
6
+ spacing?: "normal" | "tight" | "loose" | undefined;
7
+ } & {
8
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
9
+ }) | undefined) => string;
10
+ overflow: (props?: ({
11
+ spacing?: "normal" | "tight" | "loose" | undefined;
12
+ } & {
13
+ class?: string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | (string | number | false | /*elided*/ any | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined)[] | Record<string, boolean | null | undefined> | null | undefined;
14
+ }) | undefined) => string;
15
+ }) & {
16
+ readonly config: import("../../utils/variants.js").TVConfig;
17
+ };
18
+ export type AvatarGroupVariants = VariantProps<typeof avatarGroupVariants>;
19
+ /** Slot names derived from the `tv()` config above — single source of truth for `slotClasses`. */
20
+ export type AvatarGroupSlots = SlotNames<typeof avatarGroupVariants>;
@@ -0,0 +1,21 @@
1
+ import { tv } from '../../utils/variants.js';
2
+ // AvatarGroup stacks avatars with a controlled overlap and an optional "+N"
3
+ // overflow chip. It composes the public Avatar for each entry (and the chip),
4
+ // so per-avatar sizing/shape/ring come from Avatar — these variants own only the
5
+ // row layout (overlap amount) and a light emphasis on the overflow chip.
6
+ export const avatarGroupVariants = tv({
7
+ slots: {
8
+ base: ['inline-flex items-center'],
9
+ overflow: ['font-medium']
10
+ },
11
+ variants: {
12
+ spacing: {
13
+ tight: { base: '-space-x-4' },
14
+ normal: { base: '-space-x-3' },
15
+ loose: { base: '-space-x-2' }
16
+ }
17
+ },
18
+ defaultVariants: {
19
+ spacing: 'normal'
20
+ }
21
+ });
@@ -0,0 +1,57 @@
1
+ import type { HTMLAttributes } from 'svelte/elements';
2
+ import type { AvatarProps } from '../../primitives/Avatar/index.js';
3
+ import type { AvatarGroupSlots, AvatarGroupVariants } from './avatar-group.variants.js';
4
+ /**
5
+ * @description Stacks avatars into an overlapping row with an optional "+N" overflow chip —
6
+ * the canonical way to show a set of collaborators, assignees or participants compactly.
7
+ * Data-driven: pass an `items` array of Avatar props; the group propagates a shared `size`
8
+ * and a cut-out ring so the stack reads cleanly on any surface.
9
+ *
10
+ * @tag display
11
+ * @related Avatar
12
+ * @stability beta
13
+ *
14
+ * @example
15
+ * ```svelte
16
+ * <AvatarGroup items={[{ name: 'Ada Lovelace' }, { name: 'Alan Turing' }]} />
17
+ * ```
18
+ *
19
+ * @example
20
+ * ```svelte
21
+ * <AvatarGroup items={team} max={4} size="lg" />
22
+ * ```
23
+ */
24
+ export interface AvatarGroupProps extends AvatarGroupVariants, Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'class'> {
25
+ /** The avatars to stack. Each entry is a full set of Avatar props (src, name, status, …). */
26
+ items: AvatarProps[];
27
+ /** Shared size applied to every avatar and the overflow chip — xs, sm, md (default), lg, xl, 2xl. */
28
+ size?: AvatarProps['size'];
29
+ /**
30
+ * Maximum avatars to render. When `items` exceeds it, `max - 1` avatars are shown plus a
31
+ * single "+N" overflow chip — where N is the count of hidden avatars — so the total rendered
32
+ * count is exactly `max`. Unset (or `0`/negative) shows every avatar with no chip; use `≥ 2`
33
+ * so the chip sits alongside at least one visible face.
34
+ */
35
+ max?: number;
36
+ /** Overlap amount between avatars — tight, normal (default), loose. */
37
+ spacing?: 'tight' | 'normal' | 'loose';
38
+ /**
39
+ * Ring colour drawn around each avatar so the overlap reads as a cut-out. Any CSS colour;
40
+ * defaults to the base surface so the stack looks punched out of the page.
41
+ * @default 'var(--color-surface-base)'
42
+ */
43
+ borderColor?: string;
44
+ /** Additional CSS class merged onto the root row. */
45
+ class?: string;
46
+ /** Strip all default styles; combine with slotClasses to rebuild from scratch. */
47
+ unstyled?: boolean;
48
+ /** Per-slot class overrides. Slots: base | overflow */
49
+ slotClasses?: Partial<Record<AvatarGroupSlots, string>>;
50
+ /**
51
+ * Apply a named preset registered via `<BlocksProvider presets={{ AvatarGroup: {...} }}>`.
52
+ * Prefer this over `class` overrides when the requested look falls outside the semantic palette.
53
+ */
54
+ preset?: string;
55
+ }
56
+ export { default as AvatarGroup } from './AvatarGroup.svelte';
57
+ export { type AvatarGroupVariants, avatarGroupVariants } from './avatar-group.variants.js';
@@ -0,0 +1,2 @@
1
+ export { default as AvatarGroup } from './AvatarGroup.svelte';
2
+ export { avatarGroupVariants } from './avatar-group.variants.js';