@nukleus-sports/ui-patterns 0.2.0 → 0.3.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.
@@ -1,70 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, MouseEvent } from 'react';
3
-
4
- type EntityType = "player" | "coach" | "team" | "contact" | "company" | "agency" | "initials";
5
- type EntityAvatarSize = "xs" | "sm" | "md" | "lg" | "xl";
6
- interface BaseEntityData {
7
- first_name?: string | null;
8
- last_name?: string | null;
9
- player_image_url?: string | null;
10
- coach_image_url?: string | null;
11
- profile_image_url?: string | null;
12
- team?: string | null;
13
- nickname?: string | null;
14
- team_logo_url?: string | null;
15
- name?: string | null;
16
- avatar_url?: string | null;
17
- }
18
- /**
19
- * CSS pixel size of each avatar size step, mirroring `sizeClasses`/`contactSizeClasses` below.
20
- * Exported so a consuming app's `resolveImageUrl` adapter can request an appropriately
21
- * sized render (e.g. nukleus-clientapp's `sizedStorageImage(rawUrl, ENTITY_AVATAR_SIZE_PX[size], "cover")`)
22
- * without this package needing to know about that CDN's resize API.
23
- */
24
- declare const ENTITY_AVATAR_SIZE_PX: Record<EntityAvatarSize, number>;
25
- /**
26
- * Turns a raw, possibly-relative stored image path into a renderable URL.
27
- *
28
- * Both source apps resolved this inline by calling Supabase-storage-specific helpers
29
- * (`getStoragePublicUrl`, `sizedStorageImage`, cache-busting query params) straight out of
30
- * `@/lib/image-utils`. This package has no legitimate reason to talk to Supabase or know
31
- * about a particular CDN's URL shape, so that resolution step is lifted out to this
32
- * injectable adapter instead of being baked into the shared component — the same
33
- * data-arrives-through-props principle this repo already applies to page-shells.
34
- *
35
- * Return `null` to fall back to initials/the default placeholder image.
36
- */
37
- type EntityImageResolver = (rawUrl: string, context: {
38
- entityType: EntityType;
39
- size: EntityAvatarSize;
40
- cacheBreaker?: string | number;
41
- }) => string | null;
42
- interface EntityAvatarProps {
43
- /**
44
- * Drives image resolution and the placeholder shown when there's no image.
45
- * Defaults to "initials" — image when one is supplied, initials otherwise —
46
- * which is the behaviour every plain `name` + `imageUrl` call site expects.
47
- */
48
- entityType?: EntityType;
49
- entityData?: BaseEntityData | null;
50
- firstName?: string | null;
51
- lastName?: string | null;
52
- name?: string | null;
53
- imageUrl?: string | null;
54
- /**
55
- * Resolves a raw stored image path/URL into something renderable. Omit it to only
56
- * render already-absolute URLs (`http(s)://...` or `data:...`) as-is — anything else
57
- * (a bare storage path) falls back to initials/the default placeholder, since this
58
- * package can't resolve it itself. See `EntityImageResolver` for why.
59
- */
60
- resolveImageUrl?: EntityImageResolver;
61
- size?: EntityAvatarSize;
62
- className?: string;
63
- fallbackClassName?: string;
64
- showInitials?: boolean;
65
- cacheBreaker?: string | number;
66
- }
67
- declare function EntityAvatar({ entityType, entityData, firstName, lastName, name, imageUrl, resolveImageUrl, size, className, fallbackClassName, showInitials, cacheBreaker, }: EntityAvatarProps): react.JSX.Element;
3
+ import { EntityImageResolver } from './index.cjs';
68
4
 
69
5
  interface RowAction {
70
6
  /** Visible text. */
@@ -554,4 +490,4 @@ interface ProjectDealCardProps {
554
490
  }
555
491
  declare function ProjectDealCard({ deal, isCompleted, collabMembership, collabHref, onCollabClick, resolveImageUrl, asideFooter, className, }: ProjectDealCardProps): react.JSX.Element;
556
492
 
557
- export { ContractDetailsCard, type ContractDetailsCardDeliverable, type ContractDetailsCardProps, type ContractDetailsCardWarning, DealEmptyState, type DealEmptyStateProps, ENTITY_AVATAR_SIZE_PX, EntityAvatar, type EntityAvatarProps, type EntityAvatarSize, type EntityImageResolver, type EntityType, type ManualDeal, ManualDealCard, type ManualDealCardProps, type ManualDealDocumentRef, type ManualDealMetadata, ManualDealPreviewDialog, type ManualDealPreviewDialogProps, type MarketingDealContractDetails, type ProjectCollabMembership, type ProjectDeal, ProjectDealCard, type ProjectDealCardProps, type RowAction, RowActionsDropdown, type RowActionsDropdownProps, resolveDealDocument };
493
+ export { ContractDetailsCard, type ContractDetailsCardDeliverable, type ContractDetailsCardProps, type ContractDetailsCardWarning, DealEmptyState, type DealEmptyStateProps, type ManualDeal, ManualDealCard, type ManualDealCardProps, type ManualDealDocumentRef, type ManualDealMetadata, ManualDealPreviewDialog, type ManualDealPreviewDialogProps, type MarketingDealContractDetails, type ProjectCollabMembership, type ProjectDeal, ProjectDealCard, type ProjectDealCardProps, type RowAction, RowActionsDropdown, type RowActionsDropdownProps, resolveDealDocument };
@@ -1,70 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, MouseEvent } from 'react';
3
-
4
- type EntityType = "player" | "coach" | "team" | "contact" | "company" | "agency" | "initials";
5
- type EntityAvatarSize = "xs" | "sm" | "md" | "lg" | "xl";
6
- interface BaseEntityData {
7
- first_name?: string | null;
8
- last_name?: string | null;
9
- player_image_url?: string | null;
10
- coach_image_url?: string | null;
11
- profile_image_url?: string | null;
12
- team?: string | null;
13
- nickname?: string | null;
14
- team_logo_url?: string | null;
15
- name?: string | null;
16
- avatar_url?: string | null;
17
- }
18
- /**
19
- * CSS pixel size of each avatar size step, mirroring `sizeClasses`/`contactSizeClasses` below.
20
- * Exported so a consuming app's `resolveImageUrl` adapter can request an appropriately
21
- * sized render (e.g. nukleus-clientapp's `sizedStorageImage(rawUrl, ENTITY_AVATAR_SIZE_PX[size], "cover")`)
22
- * without this package needing to know about that CDN's resize API.
23
- */
24
- declare const ENTITY_AVATAR_SIZE_PX: Record<EntityAvatarSize, number>;
25
- /**
26
- * Turns a raw, possibly-relative stored image path into a renderable URL.
27
- *
28
- * Both source apps resolved this inline by calling Supabase-storage-specific helpers
29
- * (`getStoragePublicUrl`, `sizedStorageImage`, cache-busting query params) straight out of
30
- * `@/lib/image-utils`. This package has no legitimate reason to talk to Supabase or know
31
- * about a particular CDN's URL shape, so that resolution step is lifted out to this
32
- * injectable adapter instead of being baked into the shared component — the same
33
- * data-arrives-through-props principle this repo already applies to page-shells.
34
- *
35
- * Return `null` to fall back to initials/the default placeholder image.
36
- */
37
- type EntityImageResolver = (rawUrl: string, context: {
38
- entityType: EntityType;
39
- size: EntityAvatarSize;
40
- cacheBreaker?: string | number;
41
- }) => string | null;
42
- interface EntityAvatarProps {
43
- /**
44
- * Drives image resolution and the placeholder shown when there's no image.
45
- * Defaults to "initials" — image when one is supplied, initials otherwise —
46
- * which is the behaviour every plain `name` + `imageUrl` call site expects.
47
- */
48
- entityType?: EntityType;
49
- entityData?: BaseEntityData | null;
50
- firstName?: string | null;
51
- lastName?: string | null;
52
- name?: string | null;
53
- imageUrl?: string | null;
54
- /**
55
- * Resolves a raw stored image path/URL into something renderable. Omit it to only
56
- * render already-absolute URLs (`http(s)://...` or `data:...`) as-is — anything else
57
- * (a bare storage path) falls back to initials/the default placeholder, since this
58
- * package can't resolve it itself. See `EntityImageResolver` for why.
59
- */
60
- resolveImageUrl?: EntityImageResolver;
61
- size?: EntityAvatarSize;
62
- className?: string;
63
- fallbackClassName?: string;
64
- showInitials?: boolean;
65
- cacheBreaker?: string | number;
66
- }
67
- declare function EntityAvatar({ entityType, entityData, firstName, lastName, name, imageUrl, resolveImageUrl, size, className, fallbackClassName, showInitials, cacheBreaker, }: EntityAvatarProps): react.JSX.Element;
3
+ import { EntityImageResolver } from './index.js';
68
4
 
69
5
  interface RowAction {
70
6
  /** Visible text. */
@@ -554,4 +490,4 @@ interface ProjectDealCardProps {
554
490
  }
555
491
  declare function ProjectDealCard({ deal, isCompleted, collabMembership, collabHref, onCollabClick, resolveImageUrl, asideFooter, className, }: ProjectDealCardProps): react.JSX.Element;
556
492
 
557
- export { ContractDetailsCard, type ContractDetailsCardDeliverable, type ContractDetailsCardProps, type ContractDetailsCardWarning, DealEmptyState, type DealEmptyStateProps, ENTITY_AVATAR_SIZE_PX, EntityAvatar, type EntityAvatarProps, type EntityAvatarSize, type EntityImageResolver, type EntityType, type ManualDeal, ManualDealCard, type ManualDealCardProps, type ManualDealDocumentRef, type ManualDealMetadata, ManualDealPreviewDialog, type ManualDealPreviewDialogProps, type MarketingDealContractDetails, type ProjectCollabMembership, type ProjectDeal, ProjectDealCard, type ProjectDealCardProps, type RowAction, RowActionsDropdown, type RowActionsDropdownProps, resolveDealDocument };
493
+ export { ContractDetailsCard, type ContractDetailsCardDeliverable, type ContractDetailsCardProps, type ContractDetailsCardWarning, DealEmptyState, type DealEmptyStateProps, type ManualDeal, ManualDealCard, type ManualDealCardProps, type ManualDealDocumentRef, type ManualDealMetadata, ManualDealPreviewDialog, type ManualDealPreviewDialogProps, type MarketingDealContractDetails, type ProjectCollabMembership, type ProjectDeal, ProjectDealCard, type ProjectDealCardProps, type RowAction, RowActionsDropdown, type RowActionsDropdownProps, resolveDealDocument };