@sesamehr/react-design-system 1.3.0 → 1.4.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.
@@ -0,0 +1,23 @@
1
+ import { BulletVariants } from '../../../Feedback/Bullet/index.ts';
2
+ import { AvatarRoundedVariants } from '../index.ts';
3
+ export interface AvatarRoundedProps extends React.HTMLAttributes<HTMLSpanElement>, Pick<React.ImgHTMLAttributes<HTMLImageElement>, 'alt'> {
4
+ /** Image source URL. When set it replaces the children. */
5
+ src?: string;
6
+ /** Avatar size */
7
+ size?: AvatarRoundedVariants['size'];
8
+ /** Colour pair used when there is no image */
9
+ tone?: AvatarRoundedVariants['tone'];
10
+ /** Dimmed appearance, layered over whatever the avatar shows */
11
+ disabled?: boolean;
12
+ /** Status indicator colour — sits on the circle's edge */
13
+ status?: BulletVariants['color'];
14
+ /** Rendered on the top-right edge, over the avatar */
15
+ action?: React.ReactNode;
16
+ /** Rendered centred on the bottom edge */
17
+ label?: React.ReactNode;
18
+ dataTestid: string;
19
+ }
20
+ /**
21
+ * AvatarRounded — mirrors `@sesame/orxata-core` AvatarRounded.
22
+ */
23
+ export declare const AvatarRounded: import('react').ForwardRefExoticComponent<AvatarRoundedProps & import('react').RefAttributes<HTMLSpanElement>>;
@@ -0,0 +1,23 @@
1
+ import { BulletVariants } from '../../../Feedback/Bullet/index.ts';
2
+ import { AvatarSquareVariants } from '../index.ts';
3
+ export interface AvatarSquareProps extends React.HTMLAttributes<HTMLSpanElement>, Pick<React.ImgHTMLAttributes<HTMLImageElement>, 'alt'> {
4
+ /** Image source URL. When set it replaces the children. */
5
+ src?: string;
6
+ /** Avatar size */
7
+ size?: AvatarSquareVariants['size'];
8
+ /** Colour pair used when there is no image */
9
+ tone?: AvatarSquareVariants['tone'];
10
+ /** Dimmed appearance, layered over whatever the avatar shows */
11
+ disabled?: boolean;
12
+ /** Status indicator colour — sits on the shape's corner */
13
+ status?: BulletVariants['color'];
14
+ /** Rendered on the top-right corner, over the avatar */
15
+ action?: React.ReactNode;
16
+ /** Rendered centred on the bottom edge */
17
+ label?: React.ReactNode;
18
+ dataTestid: string;
19
+ }
20
+ /**
21
+ * AvatarSquare — mirrors `@sesame/orxata-core` AvatarSquare.
22
+ */
23
+ export declare const AvatarSquare: import('react').ForwardRefExoticComponent<AvatarSquareProps & import('react').RefAttributes<HTMLSpanElement>>;
@@ -1,16 +1,9 @@
1
- import { AvatarVariants } from '..';
2
- type AvatarSize = NonNullable<AvatarVariants['size']>;
3
- interface BulletTopStyle {
4
- top: string;
5
- left: string;
6
- }
7
- interface BulletBottomStyle {
8
- bottom: string;
9
- left: string;
10
- }
11
- export type BulletStyle = BulletTopStyle | BulletBottomStyle;
1
+ import { AvatarSize } from '../index.ts';
2
+ /**
3
+ * Picks the status bullet's size for a given avatar size. Where the bullet sits
4
+ * is not here: both shapes hang it off their own 45° point, which is a corner
5
+ * offset each component states once in CSS rather than a per-size map.
6
+ */
12
7
  export declare function useAvatarBullet(size: AvatarSize): {
13
8
  bulletSize: "24" | "16" | "12" | "8" | null | undefined;
14
- bulletStyle: BulletStyle;
15
9
  };
16
- export {};
@@ -1,9 +1,35 @@
1
1
  import { VariantProps } from 'class-variance-authority';
2
- export { Avatar, type AvatarProps } from './Avatar.tsx';
3
- export declare const avatarVariants: (props?: ({
4
- size?: "xs" | "sm" | "md" | "lg" | "2xl" | "xl" | "2xs" | null | undefined;
2
+ export { AvatarRounded } from './AvatarRounded/AvatarRounded.tsx';
3
+ export type { AvatarRoundedProps } from './AvatarRounded/AvatarRounded.tsx';
4
+ export { AvatarSquare } from './AvatarSquare/AvatarSquare.tsx';
5
+ export type { AvatarSquareProps } from './AvatarSquare/AvatarSquare.tsx';
6
+ export { useAvatarBullet } from './hooks/useAvatarBullet.ts';
7
+ /**
8
+ * The two shapes differ by their corner radius and nothing else, so everything
9
+ * below is deliberately written out twice rather than spread from a constant:
10
+ * `parity-variants` diffs these objects as source text against the Vue package,
11
+ * and a variant it cannot see is a variant it stops checking.
12
+ *
13
+ * Sizes are the five the design draws — 24, 32, 48, 64 and 80px. The type scale
14
+ * rides along with the box because the design pairs them one to one, and every
15
+ * pair lands on a Tailwind step exactly (24/32, 30/36, 36/40).
16
+ *
17
+ * `tone` only shows through when there is no image: `brand` is the design's
18
+ * `type=text`, `neutral` its `type=counter`. Nothing here reads the children, so
19
+ * a counter in brand or initials in grey are both reachable — the design couples
20
+ * content to colour, the component has no reason to.
21
+ */
22
+ export declare const avatarSquareVariants: (props?: ({
23
+ size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
24
+ tone?: "neutral" | "brand" | null | undefined;
25
+ disabled?: boolean | null | undefined;
5
26
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
6
- export declare const avatarTextVariants: (props?: ({
7
- size?: "xs" | "sm" | "md" | "lg" | "2xl" | "xl" | "2xs" | null | undefined;
27
+ export declare const avatarRoundedVariants: (props?: ({
28
+ size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
29
+ tone?: "neutral" | "brand" | null | undefined;
30
+ disabled?: boolean | null | undefined;
8
31
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
9
- export type AvatarVariants = VariantProps<typeof avatarVariants>;
32
+ export type AvatarSquareVariants = VariantProps<typeof avatarSquareVariants>;
33
+ export type AvatarRoundedVariants = VariantProps<typeof avatarRoundedVariants>;
34
+ export type AvatarSize = NonNullable<AvatarSquareVariants['size']>;
35
+ export type AvatarTone = NonNullable<AvatarSquareVariants['tone']>;
package/dist/main.d.ts CHANGED
@@ -9,7 +9,7 @@ export { Button as OxButton, buttonVariants, type ButtonVariants, } from './Butt
9
9
  export { Card as OxCard } from './Layout/Card/index.ts';
10
10
  export { Divider as OxDivider, type DividerProps, } from './Layout/Divider/index.ts';
11
11
  export { Resizable as OxResizable, ResizablePanel as OxResizablePanel, ResizableHandle as OxResizableHandle, } from './Layout/Resizable/index.ts';
12
- export { Avatar as OxAvatar, avatarVariants, avatarTextVariants, type AvatarVariants, } from './Display/Avatar/index.ts';
12
+ export { AvatarRounded as OxAvatarRounded, AvatarSquare as OxAvatarSquare, avatarRoundedVariants, avatarSquareVariants, type AvatarRoundedVariants, type AvatarSize, type AvatarSquareVariants, type AvatarTone, } from './Display/Avatar/index.ts';
13
13
  export { AvatarGroup as OxAvatarGroup, type AvatarItem, } from './Display/AvatarGroup/index.ts';
14
14
  export { Badge as OxBadge, badgeVariants, type BadgeVariants, } from './Display/Badge/index.ts';
15
15
  export { PaymentCard as OxPaymentCard, paymentCardVariants, type PaymentCardVariants, type BadgeType, type CardData, } from './Display/PaymentCard/index.ts';