@sesamehr/react-design-system 2.0.0-beta.2 → 2.0.0-beta.4

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 (32) hide show
  1. package/README.md +34 -0
  2. package/dist/Data/Table/TableBody/TableBody.d.ts +3 -0
  3. package/dist/Data/Table/TableHead/TableHead.d.ts +25 -1
  4. package/dist/Data/Table/TableScrollbar/TableScrollbar.d.ts +19 -0
  5. package/dist/Data/Table/TableVirtualized/TableVirtualized.d.ts +45 -0
  6. package/dist/Data/Table/TableVirtualized/index.d.ts +2 -0
  7. package/dist/Data/Table/hooks/index.d.ts +3 -0
  8. package/dist/Data/Table/hooks/useDragToScroll/useDragToScroll.d.ts +12 -2
  9. package/dist/Data/Table/hooks/useTableVirtual/context.d.ts +16 -0
  10. package/dist/Data/Table/hooks/useTableVirtual/index.d.ts +3 -0
  11. package/dist/Data/Table/hooks/useTableVirtual/useTableVirtual.d.ts +36 -0
  12. package/dist/Data/Table/hooks/useTableVirtual/useTableVirtual.types.d.ts +61 -0
  13. package/dist/Data/Table/index.d.ts +2 -1
  14. package/dist/Display/Badge/Badge.d.ts +3 -2
  15. package/dist/Display/Badge/index.d.ts +10 -1
  16. package/dist/Display/ChatBubble/ChatBubble.d.ts +11 -0
  17. package/dist/Display/ChatBubble/ChatBubbleStatus/ChatBubbleStatus.d.ts +8 -0
  18. package/dist/Display/ChatBubble/ChatBubbleStatus/index.d.ts +10 -0
  19. package/dist/Display/ChatBubble/index.d.ts +13 -0
  20. package/dist/Display/Chip/Chip.d.ts +14 -4
  21. package/dist/Display/Chip/index.d.ts +14 -10
  22. package/dist/Forms/Field/Counter/Counter.d.ts +9 -0
  23. package/dist/Forms/Field/Counter/index.d.ts +13 -0
  24. package/dist/lib/cssModules.d.ts +13 -0
  25. package/dist/main.d.ts +5 -3
  26. package/dist/preflight.css +391 -0
  27. package/dist/react-design-system.css +1 -1
  28. package/dist/react-design-system.js +10369 -8860
  29. package/dist/react-design-system.umd.cjs +52 -39
  30. package/package.json +2 -1
  31. package/dist/Display/Tag/Tag.d.ts +0 -19
  32. package/dist/Display/Tag/index.d.ts +0 -2
package/README.md CHANGED
@@ -18,6 +18,10 @@ Import the stylesheet once at your app entry:
18
18
  import '@sesamehr/react-design-system/style.css';
19
19
  ```
20
20
 
21
+ That stylesheet paints this package's components and nothing else. It carries no
22
+ reset and no utility classes, so importing it cannot restyle the application
23
+ around it — see [What the stylesheet does not do](#what-the-stylesheet-does-not-do).
24
+
21
25
  Every component is exported with the `Ox` prefix:
22
26
 
23
27
  ```tsx
@@ -64,6 +68,36 @@ from your own Tailwind setup:
64
68
  @import '@sesamehr/react-design-system/assets/styles/mainTheme.css';
65
69
  ```
66
70
 
71
+ ### What the stylesheet does not do
72
+
73
+ `style.css` contains this package's component rules and its tokens. It
74
+ deliberately does **not** contain:
75
+
76
+ - **Preflight**, or any other global reset. The components assume one — they are
77
+ written against `box-sizing: border-box`, `button { font: inherit }` and the
78
+ rest — but installing it is the application's call, not a library's. If your
79
+ app has Tailwind, you already have it. If it does not:
80
+
81
+ ```ts
82
+ import '@sesamehr/react-design-system/preflight.css';
83
+ ```
84
+
85
+ - **Utility classes.** No `.h-10`, no `.p-4`, no `.bg-brand`. Every component
86
+ carries its own `ox`-prefixed class and the declarations are compiled into it,
87
+ so nothing here can collide with the identically-named utilities your own
88
+ Tailwind build emits from your scale.
89
+
90
+ Component rules ship inside `@layer components`, which is where a Tailwind app
91
+ already sorts them: after `base`, before `utilities`. So a utility you pass in
92
+ wins — `<Button className="w-full">` is full width — without needing
93
+ `!important`.
94
+
95
+ Tokens are published under an `--ox-` prefix: override `--ox-color-brand-500`
96
+ to retheme, not `--color-brand-500`. Unprefixed, those are the names Tailwind
97
+ itself uses, and declaring them at `:root` would change what every `rounded-2xl`
98
+ in your application means.
99
+
100
+
67
101
  ## License
68
102
 
69
103
  MIT © Sesame HR
@@ -16,5 +16,8 @@ export interface TableBodyProps extends React.ComponentPropsWithoutRef<'tbody'>
16
16
  /**
17
17
  * Styled `<tbody>`. When `draggable`, wraps rows in a dnd-kit sortable
18
18
  * context. Sortable item ids are derived from the index of each `items` entry.
19
+ *
20
+ * Virtualised, it also renders the two rows that stand in for the ones not
21
+ * rendered — see `Spacer` below — and refuses to be draggable at the same time.
19
22
  */
20
23
  export declare const TableBody: import('react').ForwardRefExoticComponent<TableBodyProps & import('react').RefAttributes<HTMLTableSectionElement>>;
@@ -1,3 +1,27 @@
1
1
  export type TableHeadProps = React.ComponentPropsWithoutRef<'thead'>;
2
- /** Styled `<thead>` wrapping its children in a header row. */
2
+ /**
3
+ * Styled `<thead>`. Virtualised, it renders its row twice and keeps the copy on
4
+ * screen.
5
+ *
6
+ * A virtualised table is the one case where the table is certain to be taller
7
+ * than what you can see — that is what virtualising is for — and a header that
8
+ * scrolls away takes the column names and the select-all checkbox with it. At
9
+ * ten thousand rows, getting back to them means scrolling back through all of
10
+ * them.
11
+ *
12
+ * Neither obvious way works. `position: sticky` answers to the nearest
13
+ * scrolling ancestor and nothing above it, and with pinned columns that
14
+ * ancestor is the section that owns the horizontal scroll — a box that never
15
+ * moves vertically, so the header rides away with the rows. Moving the header
16
+ * from a scroll handler works but is always one frame behind what the
17
+ * compositor has already painted, which reads as the header dropping away and
18
+ * snapping back on every frame of a scroll.
19
+ *
20
+ * So the row is rendered twice. The one in the table stays and is hidden, still
21
+ * doing the two jobs only it can do: reserving the header's height and settling
22
+ * the column widths. The copy is positioned against an ancestor that does not
23
+ * scroll, so vertical scrolling does not move it and there is nothing to
24
+ * correct. It is the same elements rendered again rather than a cloned node, so
25
+ * sorting and select-all still work in the one you can see.
26
+ */
3
27
  export declare const TableHead: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>, "ref"> & import('react').RefAttributes<HTMLTableSectionElement>>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The scrollbar a virtualised table draws for itself.
3
+ *
4
+ * Every other table in the system hides its bar: they scroll sideways, the
5
+ * shadows at the edges say there is more, and a bar would be chrome. A list of
6
+ * ten thousand rows is the opposite case — without one there is nothing to read
7
+ * your position from, and no way to cross the list in one gesture.
8
+ *
9
+ * The browser's own bar cannot be that thing here. It runs the full height of
10
+ * the scrollport, and the scrollport has to contain the header, so it always
11
+ * cuts across the column names. This one starts below them.
12
+ *
13
+ * It behaves the way an overlay bar does: out of the way until you scroll or
14
+ * reach for the edge, and gone again shortly after.
15
+ */
16
+ export declare function TableScrollbar(): import("react/jsx-runtime").JSX.Element | null;
17
+ export declare namespace TableScrollbar {
18
+ var displayName: string;
19
+ }
@@ -0,0 +1,45 @@
1
+ import { TableComponentProps } from '../Table.tsx';
2
+ import { UseTableVirtualReturn } from '../hooks/useTableVirtual/useTableVirtual.types.ts';
3
+ export type TableVirtualizedProps<TData = unknown> = TableComponentProps<TData> & {
4
+ /**
5
+ * What `useTableVirtual()` returned.
6
+ *
7
+ * Not the rows — those you map yourself, the same as in any other table.
8
+ * This is the thing that works out which rows those are, and the table
9
+ * hands it the element they scroll inside.
10
+ */
11
+ virtualizer: UseTableVirtualReturn<never>;
12
+ };
13
+ /**
14
+ * A `Table` that renders only the rows on screen.
15
+ *
16
+ * Everything but `virtualizer` is a `Table` prop and is passed straight through.
17
+ * What goes inside is what goes inside a `Table`: this is the same component,
18
+ * told where its virtualiser is.
19
+ *
20
+ * ```tsx
21
+ * const virtual = useTableVirtual(employees, { height: '480px' });
22
+ *
23
+ * <TableVirtualized virtualizer={virtual}>
24
+ * <TableBody>
25
+ * {virtual.rows.map(row => <TableRow key={row.id}>…</TableRow>)}
26
+ * </TableBody>
27
+ * </TableVirtualized>
28
+ * ```
29
+ *
30
+ * It is the one piece the Vue side does not have, and it exists because of how
31
+ * the two frameworks differ rather than because the tables do. There
32
+ * `useTableVirtual` runs in the caller's `setup`, which is already above the
33
+ * table, so it provides itself and `<Table>` is written exactly as it always
34
+ * was. A hook has nothing to provide to until something renders — so this
35
+ * renders.
36
+ *
37
+ * The alternative was a prop on `Table`, and it would not have stopped there:
38
+ * the spacers belong inside `TableBody`'s `<tbody>` and the pinned header is
39
+ * `TableHead`'s, so it would have had to be threaded to both of those by hand
40
+ * as well. A wrapper reaches all three and leaves `Table`'s own API alone.
41
+ */
42
+ export declare function TableVirtualized<TData = unknown>({ virtualizer, ...props }: TableVirtualizedProps<TData>): import("react/jsx-runtime").JSX.Element;
43
+ export declare namespace TableVirtualized {
44
+ var displayName: string;
45
+ }
@@ -0,0 +1,2 @@
1
+ export { TableVirtualized } from './TableVirtualized.tsx';
2
+ export type { TableVirtualizedProps } from './TableVirtualized.tsx';
@@ -18,3 +18,6 @@ export { useDragToScroll } from './useDragToScroll/useDragToScroll.ts';
18
18
  export type { UseDragToScrollOptions, UseDragToScrollReturn, } from './useDragToScroll/useDragToScroll.ts';
19
19
  export { useFixedColumns } from './useFixedColumns.ts';
20
20
  export type { UseFixedColumnsOptions } from './useFixedColumns.ts';
21
+ export { useTableVirtual } from './useTableVirtual/useTableVirtual.ts';
22
+ export { TableVirtualContext, useTableVirtualContext, } from './useTableVirtual/context.ts';
23
+ export type { UseTableVirtualOptions, UseTableVirtualReturn, } from './useTableVirtual/useTableVirtual.types.ts';
@@ -4,6 +4,15 @@ export interface UseDragToScrollOptions {
4
4
  enabled?: boolean | (() => boolean);
5
5
  /** Cursor to show while dragging */
6
6
  cursor?: string;
7
+ /**
8
+ * Selector for elements that own their own drag, where panning must keep out.
9
+ *
10
+ * A pan and a row reorder are the same gesture, and this hook calls
11
+ * `preventDefault()` on every `mousedown` it sees — which is exactly what
12
+ * stops dnd-kit from ever starting. Bowing out over the grip lets the two
13
+ * share the table: the handle reorders, everywhere else pans.
14
+ */
15
+ ignore?: string;
7
16
  }
8
17
  export interface UseDragToScrollReturn {
9
18
  /** Whether the user is currently dragging to scroll */
@@ -13,7 +22,8 @@ export interface UseDragToScrollReturn {
13
22
  * Hook for drag-to-scroll functionality.
14
23
  * Allows horizontal scrolling by dragging with the mouse.
15
24
  *
16
- * Note: If using row drag & drop, set enabled=false to avoid conflicts.
17
- * Use @dnd-kit for row reordering instead.
25
+ * Coexists with row drag & drop: panning keeps out of whatever `ignore`
26
+ * matches, which by default is the design system's drag grip. Both gestures can
27
+ * be live on the same table, so there is no need to turn one off.
18
28
  */
19
29
  export declare function useDragToScroll(elementRef: RefObject<HTMLElement | null>, options?: UseDragToScrollOptions): UseDragToScrollReturn;
@@ -0,0 +1,16 @@
1
+ import { UseTableVirtualReturn } from './useTableVirtual.types.ts';
2
+ /**
3
+ * How the virtualiser reaches the parts of the table that need it.
4
+ *
5
+ * The Vue side has no equivalent: `useTableVirtual` runs in the caller's
6
+ * `setup`, which is above the table, so it provides itself and nothing has to
7
+ * be passed anywhere. A hook cannot do that — nothing is above anything until
8
+ * something renders — which is what `TableVirtualized` is for.
9
+ *
10
+ * They do need reaching. The spacers standing in for the unrendered rows have
11
+ * to sit inside the `<tbody>`, which `TableBody` renders from the caller's own
12
+ * markup, and the floating header belongs to `TableHead`. Handing each of them
13
+ * a prop is the boilerplate this removes.
14
+ */
15
+ export declare const TableVirtualContext: import('react').Context<UseTableVirtualReturn<unknown> | null>;
16
+ export declare function useTableVirtualContext(): UseTableVirtualReturn<unknown> | null;
@@ -0,0 +1,3 @@
1
+ export { TableVirtualContext, useTableVirtualContext } from './context.ts';
2
+ export { useTableVirtual } from './useTableVirtual.ts';
3
+ export type { UseTableVirtualOptions, UseTableVirtualReturn, } from './useTableVirtual.types.ts';
@@ -0,0 +1,36 @@
1
+ import { UseTableVirtualOptions, UseTableVirtualReturn } from './useTableVirtual.types.ts';
2
+ /**
3
+ * Renders only the rows that are on screen, however many the table is given.
4
+ *
5
+ * Hand it the whole list and map `rows` instead: at ten thousand rows that is
6
+ * about twenty in the DOM, and the browser stops doing the work of laying out
7
+ * the other nine thousand nine hundred and eighty.
8
+ *
9
+ * ```tsx
10
+ * const virtual = useTableVirtual(employees, { height: '480px' });
11
+ *
12
+ * <TableVirtualized virtualizer={virtual}>
13
+ * <TableBody>
14
+ * {virtual.rows.map(row => <TableRow key={row.id}>…</TableRow>)}
15
+ * </TableBody>
16
+ * </TableVirtualized>
17
+ * ```
18
+ *
19
+ * `TableVirtualized` is the one piece the Vue side does not have. There the
20
+ * composable provides itself from the caller's `setup`; a hook has nothing to
21
+ * provide to until something renders, so the wrapper does it instead — and
22
+ * `Table` itself gains no prop on either side.
23
+ *
24
+ * **Not with row reordering.** `TableBody` throws if both are on. Where a row
25
+ * sits in the DOM is not where it sits in the list once only part of it is
26
+ * rendered, and dragging across ten thousand rows is not a gesture anyone can
27
+ * make. A reorderable table is a paged one.
28
+ *
29
+ * **Why spacers.** Rendering twenty rows would leave a table twenty rows tall,
30
+ * with no scrollbar and so nothing to scroll — the window could never move.
31
+ * Something has to stand in for the height of everything that is not rendered,
32
+ * and in a `<table>` that something is a pair of empty rows, one above the
33
+ * window and one below. They belong inside the `<tbody>`, so `TableBody` is
34
+ * what renders them. A caller never writes a spacer, and never should have to.
35
+ */
36
+ export declare function useTableVirtual<TData>(items: TData[], options?: UseTableVirtualOptions): UseTableVirtualReturn<TData>;
@@ -0,0 +1,61 @@
1
+ import { RefObject } from 'react';
2
+ export interface UseTableVirtualOptions {
3
+ /**
4
+ * How tall the table's scrollport is, as a CSS length.
5
+ *
6
+ * Virtualising needs one. A table that grows to fit its rows has no scrollbar
7
+ * of its own — the page scrolls instead — and with nothing scrolling there is
8
+ * no position to work a window out from.
9
+ */
10
+ height?: string;
11
+ /**
12
+ * How tall one row is, in pixels.
13
+ *
14
+ * This is what turns a scroll position into a row index, so it is worth
15
+ * getting right: the error is paid on every row crossed, which is nothing at
16
+ * one click of the wheel and hundreds of rows after a flick. The default,
17
+ * 48px, is the height `TableRow` gives itself with plain text in it. Rows
18
+ * with an avatar or two lines of text are taller, and those tables should say
19
+ * so here.
20
+ *
21
+ * It is deliberately a number you give rather than one measured from the
22
+ * page. Measuring as you scroll means the total height changes as you scroll,
23
+ * and a table whose content grows and shrinks underneath the scrollbar throws
24
+ * you somewhere else every time it does.
25
+ */
26
+ estimateSize?: number;
27
+ /** How many rows to keep either side of the window, so scrolling stays smooth. */
28
+ overscan?: number;
29
+ }
30
+ export interface UseTableVirtualReturn<TData> {
31
+ /**
32
+ * The rows that belong on screen right now, as data rather than indices — a
33
+ * caller maps these exactly the way it would map the whole list.
34
+ */
35
+ rows: TData[];
36
+ /** How many rows there are in total, window or no window. */
37
+ total: number;
38
+ /** Where a windowed row sits in the full list, for callers that need to know. */
39
+ indexOf: (windowIndex: number) => number;
40
+ /**
41
+ * Everything below is how `Table` drives this, and no caller should have to
42
+ * touch it. The scrollport is the table's, the spacers are `TableBody`'s, and
43
+ * both reach it through `TableVirtualized` rather than by hand.
44
+ */
45
+ containerRef: RefObject<HTMLElement | null>;
46
+ /**
47
+ * How `Table` registers itself as the scrollport, and how a second one is
48
+ * stopped from taking it over.
49
+ */
50
+ claim: (element: HTMLElement | null) => void;
51
+ height: string | undefined;
52
+ /** The height of everything above the window, and of everything below it. */
53
+ padStart: number;
54
+ padEnd: number;
55
+ /**
56
+ * Measures a row that turned out taller than the estimate. Without it the
57
+ * scrollbar drifts: every row that wraps makes the list a little longer than
58
+ * the virtualiser thinks it is, and by the bottom the two disagree.
59
+ */
60
+ measure: (element: Element | null) => void;
61
+ }
@@ -1,4 +1,5 @@
1
1
  export { Table, type TableComponentProps } from './Table.tsx';
2
+ export { TableVirtualized, type TableVirtualizedProps, } from './TableVirtualized/TableVirtualized.tsx';
2
3
  export { TableHead, type TableHeadProps } from './TableHead/TableHead.tsx';
3
4
  export { TableBody, type TableBodyProps } from './TableBody/TableBody.tsx';
4
5
  export { TableRow, type TableRowProps } from './TableRow/TableRow.tsx';
@@ -13,5 +14,5 @@ export { TableAvatar, type TableAvatarProps, } from './TableAvatar/TableAvatar.t
13
14
  export { TableRowExpanded, type TableRowExpandedProps, } from './TableRowExpanded/TableRowExpanded.tsx';
14
15
  export { TableExpandCell, type TableExpandCellProps, } from './TableExpandCell/TableExpandCell.tsx';
15
16
  export { TableColumnVisibility, type TableColumnVisibilityProps, } from './TableColumnVisibility/TableColumnVisibility.tsx';
16
- export { useTable, type UseTableOptions, type UseTableReturn, useTableSelection, type SelectionInstance as UseTableSelectionReturn, useTableSorting, type SortingInstance as UseTableSortingReturn, useTablePagination, type UseTablePaginationOptions, type UseTablePaginationReturn, useTableDetailRow, type DetailRowInstance, type DetailRowOptions, type DetailRowPluginDef, useTablePinning, type PinningOptions as UseTablePinningOptions, type PinningInstance as UseTablePinningReturn, type CellInfo, type HeaderInfo, useTableColumns, type ColumnsOptions as UseTableColumnsOptions, type ColumnsInstance as UseTableColumnsReturn, useScrollShadow, type UseScrollShadowOptions, type UseScrollShadowReturn, useDragToScroll, type UseDragToScrollOptions, type UseDragToScrollReturn, useFixedColumns, type UseFixedColumnsOptions, } from './hooks/index.ts';
17
+ export { useTable, type UseTableOptions, type UseTableReturn, useTableSelection, type SelectionInstance as UseTableSelectionReturn, useTableSorting, type SortingInstance as UseTableSortingReturn, useTablePagination, type UseTablePaginationOptions, type UseTablePaginationReturn, useTableDetailRow, type DetailRowInstance, type DetailRowOptions, type DetailRowPluginDef, useTablePinning, type PinningOptions as UseTablePinningOptions, type PinningInstance as UseTablePinningReturn, type CellInfo, type HeaderInfo, useTableColumns, type ColumnsOptions as UseTableColumnsOptions, type ColumnsInstance as UseTableColumnsReturn, useScrollShadow, type UseScrollShadowOptions, type UseScrollShadowReturn, useDragToScroll, type UseDragToScrollOptions, type UseDragToScrollReturn, useFixedColumns, type UseFixedColumnsOptions, useTableVirtual, type UseTableVirtualOptions, type UseTableVirtualReturn, } from './hooks/index.ts';
17
18
  export type { TableProps, TableMode, ColumnDef, ColumnAlign, CellContext, SortingState, PaginationState, PaginationChangePayload, SortingChangePayload, SelectionChangePayload, FilterChangePayload, ColumnResizeMode, ColumnVisibilityState, ColumnOrderState, ExpandedState, ColumnVisibilityChangePayload, ColumnOrderChangePayload, RowExpandChangePayload, ColumnResizePayload, ColumnPinningState, } from './types';
@@ -1,7 +1,8 @@
1
1
  import { BadgeVariants } from './index.ts';
2
2
  export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
3
- variant?: BadgeVariants['variant'];
3
+ /** How big the counter is. `sm` is the bare dot and takes no content. */
4
+ size?: BadgeVariants['size'];
4
5
  dataTestid: string;
5
6
  }
6
- /** Badge — mirrors `@sesame/orxata-core` Badge (cva-only). */
7
+ /** Badge — mirrors `@sesame/orxata-core` Badge: a count, or a bare dot. */
7
8
  export declare const Badge: import('react').ForwardRefExoticComponent<BadgeProps & import('react').RefAttributes<HTMLSpanElement>>;
@@ -1,6 +1,15 @@
1
1
  import { VariantProps } from 'class-variance-authority';
2
2
  export { Badge, type BadgeProps } from './Badge.tsx';
3
+ /**
4
+ * A count, or a bare dot. Not a labelled pill.
5
+ *
6
+ * Figma's `Badges` set varies on one axis — size — and nothing else: `sm` is a
7
+ * 6px dot with no content, `md` a 16px circle and `lg` a 22px one, all of them
8
+ * `error` red with white text. The five colour variants this used to carry came
9
+ * from shadcn's Badge and were never in the design; a labelled pill is `Chip`
10
+ * or `StatusBadge`, both of which Figma does draw.
11
+ */
3
12
  export declare const badgeVariants: (props?: ({
4
- variant?: "default" | "destructive" | "outline" | "secondary" | "brand" | null | undefined;
13
+ size?: "sm" | "md" | "lg" | null | undefined;
5
14
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
6
15
  export type BadgeVariants = VariantProps<typeof badgeVariants>;
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from 'react';
2
+ import { ChatBubbleVariants } from './index.ts';
3
+ export interface ChatBubbleProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ /** Who said it: the reader, or someone else */
5
+ author?: ChatBubbleVariants['author'];
6
+ /** The line under the message — the timestamp, and a receipt if there is one */
7
+ meta?: ReactNode;
8
+ dataTestid: string;
9
+ }
10
+ /** ChatBubble — mirrors `@sesame/orxata-core` ChatBubble. */
11
+ export declare const ChatBubble: import('react').ForwardRefExoticComponent<ChatBubbleProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,8 @@
1
+ import { ChatBubbleStatusVariants } from './index.ts';
2
+ export interface ChatBubbleStatusProps extends React.SVGAttributes<SVGSVGElement> {
3
+ /** How far along the message is */
4
+ status?: NonNullable<ChatBubbleStatusVariants['status']>;
5
+ dataTestid: string;
6
+ }
7
+ /** ChatBubbleStatus — mirrors `@sesame/orxata-core` ChatBubbleStatus. */
8
+ export declare const ChatBubbleStatus: import('react').ForwardRefExoticComponent<ChatBubbleStatusProps & import('react').RefAttributes<SVGSVGElement>>;
@@ -0,0 +1,10 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ export { ChatBubbleStatus, type ChatBubbleStatusProps, } from './ChatBubbleStatus.tsx';
3
+ /**
4
+ * How far along a sent message is. Only the reader's own messages carry one —
5
+ * there is no receipt for what somebody else said.
6
+ */
7
+ export declare const chatBubbleStatusVariants: (props?: ({
8
+ status?: "pending" | "sent" | "delivered" | "read" | null | undefined;
9
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
10
+ export type ChatBubbleStatusVariants = VariantProps<typeof chatBubbleStatusVariants>;
@@ -0,0 +1,13 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ export { ChatBubble, type ChatBubbleProps } from './ChatBubble.tsx';
3
+ /**
4
+ * Who said it, which is the only thing that varies.
5
+ *
6
+ * The design draws a `Hover` state too, and it holds exactly one thing: a
7
+ * circled chevron for the message's actions menu. That is out of scope here, so
8
+ * hover has nothing left to change and the component does not pretend it does.
9
+ */
10
+ export declare const chatBubbleVariants: (props?: ({
11
+ author?: "other" | "user" | null | undefined;
12
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
13
+ export type ChatBubbleVariants = VariantProps<typeof chatBubbleVariants>;
@@ -1,8 +1,18 @@
1
1
  import { ChipVariants } from './index.ts';
2
- export interface ChipProps extends React.HTMLAttributes<HTMLSpanElement> {
3
- /** Which semantic colour it is tinted with */
4
- tone?: ChipVariants['tone'];
2
+ export interface ChipProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
3
+ /** How tall it is, and whether it holds a label or a single icon */
4
+ size?: ChipVariants['size'];
5
+ /** How its corners are cut */
6
+ shape?: ChipVariants['shape'];
7
+ /**
8
+ * Whether it is being dragged.
9
+ *
10
+ * Of the four states the design draws, this is the only one the browser
11
+ * cannot tell us about on its own: rest, hover and focus are `:hover` and
12
+ * `:focus-visible`, and there is no `:dragging`.
13
+ */
14
+ dragged?: boolean;
5
15
  dataTestid: string;
6
16
  }
7
17
  /** Chip — mirrors `@sesame/orxata-core` Chip. */
8
- export declare const Chip: import('react').ForwardRefExoticComponent<ChipProps & import('react').RefAttributes<HTMLSpanElement>>;
18
+ export declare const Chip: import('react').ForwardRefExoticComponent<ChipProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -2,18 +2,22 @@ import { VariantProps } from 'class-variance-authority';
2
2
  export { Chip } from './Chip.tsx';
3
3
  export type { ChipProps } from './Chip.tsx';
4
4
  /**
5
- * A chip is a piece of the user's own data — a value they picked, a label they
6
- * applied. `Badge` is the system talking back: a status it assigned, a count it
7
- * worked out. That is the line between the two, and it is why one is a soft
8
- * tint and the other a solid fill.
5
+ * A chip is a control the user acts on — a value they picked and can drop, a
6
+ * filter they can press. `Badge` is the system talking back: a status it
7
+ * assigned, a count it worked out, nothing to click. That is the line between
8
+ * them, and it is why this one is an outlined button and that one a solid fill.
9
9
  *
10
- * The tints are opacity over the semantic colour rather than a `-100` step,
11
- * because no such token exists for `warning` or `destructive` and inventing one
12
- * would put a colour in the theme that Figma has never seen. `Table` already
13
- * tints this way. The pair also cannot drift: background and text come off the
14
- * same token, so re-pointing `--success` moves both.
10
+ * Class names, not utilities: the declarations live in `Chip.module.css` behind
11
+ * `@apply`. See `Button/index.ts` for the full reasoning.
12
+ *
13
+ * The two axes are the design's own, with one renaming. Its `Form` is `shape`
14
+ * here because `form` on a `<button>` is a native attribute that associates the
15
+ * button with a form, and a prop of that name would quietly eat it. Its
16
+ * `Circle` is this `rounded`: an icon chip's box is already square, so the
17
+ * circle is the same radius as a text chip's pill and needs no value of its own.
15
18
  */
16
19
  export declare const chipVariants: (props?: ({
17
- tone?: "success" | "warning" | "neutral" | "brand" | "error" | null | undefined;
20
+ size?: "sm" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
21
+ shape?: "square" | "rounded" | null | undefined;
18
22
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
19
23
  export type ChipVariants = VariantProps<typeof chipVariants>;
@@ -0,0 +1,9 @@
1
+ export interface CounterProps extends React.HTMLAttributes<HTMLSpanElement> {
2
+ /** How much the field holds now */
3
+ value: number;
4
+ /** How much it is allowed to hold */
5
+ max: number;
6
+ dataTestid: string;
7
+ }
8
+ /** Counter — mirrors `@sesame/orxata-core` Counter. */
9
+ export declare const Counter: import('react').ForwardRefExoticComponent<CounterProps & import('react').RefAttributes<HTMLSpanElement>>;
@@ -0,0 +1,13 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ export { Counter, type CounterProps } from './Counter.tsx';
3
+ /**
4
+ * Whether the field is still within its limit.
5
+ *
6
+ * Not a prop: the component has `value` and `max`, so asking a caller to also
7
+ * tell it which state that adds up to invites the two to disagree — a red
8
+ * counter reading 20/100, or a grey one reading 150/100.
9
+ */
10
+ export declare const counterVariants: (props?: ({
11
+ state?: "over" | "within" | null | undefined;
12
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
13
+ export type CounterVariants = VariantProps<typeof counterVariants>;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Maps the class names a `cva()` returns through a CSS module's hashed names.
3
+ *
4
+ * The variant objects are copied verbatim between the two packages —
5
+ * `parity-variants` compares them as source text — so they have to hold the
6
+ * same literal strings on both sides: `'ox-button--default'`, not a
7
+ * `styles.oxButtonDefault` lookup that only exists here. The lookup happens
8
+ * afterwards, which is what this is.
9
+ *
10
+ * A name the module does not define passes through untouched, so a caller's own
11
+ * class survives being handed to it.
12
+ */
13
+ export declare const moduleClasses: (styles: Record<string, string>, names: string | undefined) => string;
package/dist/main.d.ts CHANGED
@@ -18,7 +18,8 @@ export { Badge as OxBadge, badgeVariants, type BadgeVariants, } from './Display/
18
18
  export { CalendarDate as OxCalendarDate, calendarDateVariants, type CalendarDateVariants, } from './Display/CalendarDate/index.ts';
19
19
  export { NumberFlow as OxNumberFlow, resolveNumberFlowPreset, NUMBER_FLOW_PRESETS, type NumberFlowConfig, type NumberFlowPreset, } from './Display/NumberFlow/index.ts';
20
20
  export { PaymentCard as OxPaymentCard, paymentCardVariants, type PaymentCardVariants, type BadgeType, type CardData, } from './Display/PaymentCard/index.ts';
21
- export { Tag as OxTag } from './Display/Tag/index.ts';
21
+ export { ChatBubble as OxChatBubble, chatBubbleVariants, type ChatBubbleVariants, } from './Display/ChatBubble/index.ts';
22
+ export { ChatBubbleStatus as OxChatBubbleStatus, chatBubbleStatusVariants, type ChatBubbleStatusVariants, } from './Display/ChatBubble/ChatBubbleStatus/index.ts';
22
23
  export { Chip as OxChip, chipVariants, type ChipVariants, } from './Display/Chip/index.ts';
23
24
  export { PointMarker as OxPointMarker, pointMarkerVariants, type PointMarkerVariants, } from './Display/PointMarker/index.ts';
24
25
  export { StatusBadge as OxStatusBadge, statusBadgeVariants, indicatorVariants, type StatusBadgeVariants, } from './Feedback/StatusBadge/index.ts';
@@ -32,7 +33,8 @@ export { Accordion as OxAccordion, AccordionItem as OxAccordionItem, AccordionTr
32
33
  export { ToggleTabs as OxToggleTabs, ToggleTabsList as OxToggleTabsList, ToggleTabsTrigger as OxToggleTabsTrigger, ToggleTabsContent as OxToggleTabsContent, } from './Navigation/ToggleTabs/index.ts';
33
34
  export { PageControl as OxPageControl, pageControlDots, PAGE_CONTROL_WINDOW, type PageControlDot, type PageControlDotSize, } from './Navigation/PageControl/index.ts';
34
35
  export { Breadcrumb as OxBreadcrumb, BreadcrumbList as OxBreadcrumbList, BreadcrumbItem as OxBreadcrumbItem, BreadcrumbLink as OxBreadcrumbLink, BreadcrumbPage as OxBreadcrumbPage, BreadcrumbSeparator as OxBreadcrumbSeparator, BreadcrumbEllipsis as OxBreadcrumbEllipsis, } from './Navigation/Breadcrumb/index.ts';
36
+ export { Counter as OxCounter, counterVariants, type CounterVariants, } from './Forms/Field/Counter/index.ts';
35
37
  export { FieldGroup as OxFieldGroup, FieldLabel as OxFieldLabel, FieldMessage as OxFieldMessage, type FieldGroupProps, } from './Forms/Field/index.ts';
36
38
  export { InputGroup as OxInputGroup, InputText as OxInputText, InputNumber as OxInputNumber, InputNumberContent as OxInputNumberContent, InputNumberDecrement as OxInputNumberDecrement, InputNumberIncrement as OxInputNumberIncrement, InputNumberInput as OxInputNumberInput, InputPassword as OxInputPassword, InputPasswordInput as OxInputPasswordInput, InputPasswordToggle as OxInputPasswordToggle, useInputPassword, InputOtp as OxInputOtp, InputOtpGroup as OxInputOtpGroup, InputOtpSlot as OxInputOtpSlot, InputOtpSeparator as OxInputOtpSeparator, useInputOtp, Combobox as OxCombobox, ComboboxInput as OxComboboxInput, ComboboxChipsInput as OxComboboxChipsInput, ComboboxContent as OxComboboxContent, ComboboxItem as OxComboboxItem, ComboboxEmpty as OxComboboxEmpty, ComboboxGroup as OxComboboxGroup, ComboboxSeparator as OxComboboxSeparator, Select as OxSelect, SelectTrigger as OxSelectTrigger, SelectContent as OxSelectContent, SelectItem as OxSelectItem, SelectGroup as OxSelectGroup, SelectSeparator as OxSelectSeparator, Switch as OxSwitch, Checkbox as OxCheckbox, RadioButton as OxRadioButton, RadioGroup as OxRadioGroup, ToggleGroup as OxToggleGroup, ToggleLabel as OxToggleLabel, ToggleDescription as OxToggleDescription, SWITCH_SIZES, type InputNumberProps, type InputPasswordProps, type InputPasswordContext, type InputOtpProps, type InputOtpSlotProps, type InputOtpContext, type ComboboxProps, type SelectProps, type RadioGroupProps, type ToggleGroupProps, type ToggleLabelProps, type ToggleDescriptionProps, } from './Forms/Inputs/index.ts';
37
- export { Table as OxTable, TableHead as OxTableHead, TableBody as OxTableBody, TableRow as OxTableRow, TableCell as OxTableCell, TableHeaderCell as OxTableHeaderCell, TableSelectCell as OxTableSelectCell, TableDragCell as OxTableDragCell, TableBulkHeader as OxTableBulkHeader, TablePagination as OxTablePagination, TableEmpty as OxTableEmpty, TableAvatar as OxTableAvatar, TableRowExpanded as OxTableRowExpanded, TableExpandCell as OxTableExpandCell, TableColumnVisibility as OxTableColumnVisibility, useTable, useTableSelection, useTableSorting, useTablePagination, useTableDetailRow, useTablePinning, useTableColumns, useScrollShadow, useDragToScroll, useFixedColumns, } from './Data/Table/index.ts';
38
- export type { UseTableOptions, UseTableReturn, UseTableSelectionReturn, UseTableSortingReturn, UseTablePaginationOptions, UseTablePaginationReturn, DetailRowInstance, DetailRowOptions, DetailRowPluginDef, UseTablePinningOptions, UseTablePinningReturn, CellInfo, HeaderInfo, UseTableColumnsOptions, UseTableColumnsReturn, UseScrollShadowOptions, UseScrollShadowReturn, UseDragToScrollOptions, UseDragToScrollReturn, UseFixedColumnsOptions, TableProps, TableMode, ColumnDef, ColumnAlign, CellContext, SortingState, PaginationState, PaginationChangePayload, SortingChangePayload, SelectionChangePayload, FilterChangePayload, ColumnResizeMode, ColumnVisibilityState, ColumnOrderState, ExpandedState, ColumnVisibilityChangePayload, ColumnOrderChangePayload, RowExpandChangePayload, ColumnResizePayload, ColumnPinningState, } from './Data/Table/index.ts';
39
+ export { Table as OxTable, TableVirtualized as OxTableVirtualized, TableHead as OxTableHead, TableBody as OxTableBody, TableRow as OxTableRow, TableCell as OxTableCell, TableHeaderCell as OxTableHeaderCell, TableSelectCell as OxTableSelectCell, TableDragCell as OxTableDragCell, TableBulkHeader as OxTableBulkHeader, TablePagination as OxTablePagination, TableEmpty as OxTableEmpty, TableAvatar as OxTableAvatar, TableRowExpanded as OxTableRowExpanded, TableExpandCell as OxTableExpandCell, TableColumnVisibility as OxTableColumnVisibility, useTable, useTableSelection, useTableSorting, useTablePagination, useTableDetailRow, useTablePinning, useTableColumns, useScrollShadow, useDragToScroll, useFixedColumns, useTableVirtual, } from './Data/Table/index.ts';
40
+ export type { UseTableOptions, UseTableReturn, UseTableSelectionReturn, UseTableSortingReturn, UseTablePaginationOptions, UseTablePaginationReturn, DetailRowInstance, DetailRowOptions, DetailRowPluginDef, UseTablePinningOptions, UseTablePinningReturn, CellInfo, HeaderInfo, UseTableVirtualOptions, UseTableVirtualReturn, UseTableColumnsOptions, UseTableColumnsReturn, UseScrollShadowOptions, UseScrollShadowReturn, UseDragToScrollOptions, UseDragToScrollReturn, UseFixedColumnsOptions, TableProps, TableMode, ColumnDef, ColumnAlign, CellContext, SortingState, PaginationState, PaginationChangePayload, SortingChangePayload, SelectionChangePayload, FilterChangePayload, ColumnResizeMode, ColumnVisibilityState, ColumnOrderState, ExpandedState, ColumnVisibilityChangePayload, ColumnOrderChangePayload, RowExpandChangePayload, ColumnResizePayload, ColumnPinningState, } from './Data/Table/index.ts';