@sesamehr/react-design-system 3.1.0 → 3.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.
@@ -3,6 +3,13 @@ export interface AvatarItem {
3
3
  src?: string;
4
4
  initials?: string;
5
5
  disabled?: boolean;
6
+ /**
7
+ * Who the avatar is. Shown in a tooltip on hover and read as the avatar's
8
+ * accessible name, so the name is not something only a pointer can reach:
9
+ * the items sit inside the group's `<button>`, which flattens them for a
10
+ * screen reader and leaves none of them individually focusable.
11
+ */
12
+ name?: string;
6
13
  }
7
14
  export interface AvatarGroupProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'> {
8
15
  /** List of avatars to display */
@@ -0,0 +1,31 @@
1
+ import { PixelArtOrder } from './index.ts';
2
+ export interface PixelArtProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ /**
4
+ * The drawing, one string per row: `#` paints a cell, `.` leaves it blank.
5
+ * The widest row sets the number of columns.
6
+ *
7
+ * Leave it out and there is no drawing: a 15x15 grid with every cell lit
8
+ * comes and goes instead, so the space still looks occupied and alive while
9
+ * there is no pixel art for it.
10
+ */
11
+ rows?: string[];
12
+ /**
13
+ * How the cells come in. `random` drops them in patches; `bottom-up` builds
14
+ * it floor by floor from the base and takes it apart in reverse, for
15
+ * drawings that read badly half done.
16
+ */
17
+ order?: PixelArtOrder;
18
+ dataTestid: string;
19
+ }
20
+ /**
21
+ * PixelArt — mirrors `@sesame/orxata-core` PixelArt.
22
+ *
23
+ * A small bitmap drawing that draws itself, holds, rubs itself out and starts
24
+ * again. Decoration for an empty state, so it is hidden from assistive
25
+ * technology: whatever it illustrates has to be said in text beside it.
26
+ *
27
+ * `--ox-pixel-art-columns` and each cell's `--ox-pixel-art-delay` are inline
28
+ * custom properties because they are per-instance and per-cell numbers; the
29
+ * stylesheet reads both with a fallback and decides what they do.
30
+ */
31
+ export declare const PixelArt: import('react').ForwardRefExoticComponent<PixelArtProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,49 @@
1
+ export { PixelArt } from './PixelArt.tsx';
2
+ export type { PixelArtProps } from './PixelArt.tsx';
3
+ /**
4
+ * How the cells come in. `random` drops them in patches; `bottom-up` builds the
5
+ * drawing floor by floor from the base (a little scrambled within each row) and
6
+ * takes it apart in reverse, for drawings that read badly half done.
7
+ */
8
+ export type PixelArtOrder = 'random' | 'bottom-up';
9
+ export declare const PIXEL_ART_ORDERS: PixelArtOrder[];
10
+ /**
11
+ * How often the next cell comes in, how long each one takes, and the pause
12
+ * holding the whole drawing before it starts to rub itself out.
13
+ *
14
+ * `PIXEL_ART_CELL_MS` is also the transition duration in the component's
15
+ * stylesheet. The two are one number: the loop waits `CELL_MS` after the last
16
+ * cell starts, so a longer transition would be cut short by the next toggle.
17
+ */
18
+ export declare const PIXEL_ART_STEP_MS = 55;
19
+ export declare const PIXEL_ART_CELL_MS = 500;
20
+ export declare const PIXEL_ART_HOLD_MS = 1200;
21
+ /**
22
+ * What renders when no drawing is given: 15x15 with every cell lit, so the
23
+ * space a drawing would take still looks occupied and alive rather than empty.
24
+ * 15 because that is the size every drawing in the design is.
25
+ */
26
+ export declare const PIXEL_ART_FULL_GRID: string[];
27
+ export interface PixelArtCell {
28
+ key: string;
29
+ x: number;
30
+ y: number;
31
+ on: boolean;
32
+ /** When it comes in, in ms from the start. Cells that are off have none. */
33
+ delay: number;
34
+ }
35
+ /**
36
+ * Every cell of the drawing, with the moment it comes in.
37
+ *
38
+ * `random` shuffles the turns, so the drawing reveals itself in loose patches
39
+ * instead of painting top to bottom. `bottom-up` sorts them by row, from the
40
+ * base up, with a random nudge of less than one row so each floor still comes
41
+ * in scrambled rather than left to right.
42
+ *
43
+ * `random` is injectable only so a test can pin it.
44
+ */
45
+ export declare const pixelArtCells: (rows: string[], order?: PixelArtOrder, random?: () => number) => PixelArtCell[];
46
+ /** How long the drawing takes to complete, first cell to last. */
47
+ export declare const pixelArtTravel: (cells: PixelArtCell[]) => number;
48
+ /** The widest row: a ragged drawing is laid out on the grid its longest row needs. */
49
+ export declare const pixelArtColumns: (rows: string[]) => number;
package/dist/main.d.ts CHANGED
@@ -25,6 +25,7 @@ export { AvatarGroup as OxAvatarGroup, type AvatarItem, } from './Display/Avatar
25
25
  export { Badge as OxBadge, badgeVariants, type BadgeVariants, } from './Display/Badge/index.ts';
26
26
  export { CalendarDate as OxCalendarDate, calendarDateVariants, type CalendarDateVariants, } from './Display/CalendarDate/index.ts';
27
27
  export { NumberFlow as OxNumberFlow, resolveNumberFlowPreset, NUMBER_FLOW_PRESETS, type NumberFlowConfig, type NumberFlowPreset, } from './Display/NumberFlow/index.ts';
28
+ export { PixelArt as OxPixelArt, type PixelArtOrder, } from './Display/PixelArt/index.ts';
28
29
  export { PaymentCard as OxPaymentCard, paymentCardVariants, type PaymentCardVariants, type BadgeType, type CardData, } from './Display/PaymentCard/index.ts';
29
30
  export { FileCard as OxFileCard } from './Display/FileCard/index.ts';
30
31
  export { FilePreviewCard as OxFilePreviewCard } from './Display/FilePreviewCard/index.ts';