@common-origin/design-system 2.16.0 → 2.17.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,11 +1,21 @@
1
1
  import React from 'react';
2
+ /**
3
+ * How DateFormatter shows a date. `'relative'` is deprecated: it has always behaved exactly like
4
+ * `'smart'`, so use `'smart'`. It keeps working until it is removed in 3.0 (#82).
5
+ */
2
6
  export type DateFormatMode = 'absolute' | 'relative' | 'smart';
3
7
  export interface DateFormatterProps {
4
8
  /** ISO date string to format */
5
9
  dateString: string;
6
10
  /** Format pattern (defaults to 'yyyy') */
7
11
  formatString?: string;
8
- /** Date formatting mode: 'absolute' uses formatString, 'relative' shows "Today"/"Yesterday", 'smart' combines both */
12
+ /**
13
+ * `'absolute'` always uses `formatString`. `'smart'` shows "Today", "Yesterday" or the day name
14
+ * for dates this week, and formats older dates with `formatString`.
15
+ * `'relative'` is deprecated: it behaves exactly like `'smart'`, so use `'smart'`. It keeps
16
+ * working until it is removed in 3.0 (#82).
17
+ * @default 'absolute'
18
+ */
9
19
  mode?: DateFormatMode;
10
20
  /** Optional data-testid for testing */
11
21
  'data-testid'?: string;
@@ -5,6 +5,17 @@ export interface IconProps {
5
5
  name: IconName;
6
6
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
7
7
  iconColor?: 'default' | 'emphasis' | 'subdued' | 'disabled' | 'inverse' | 'interactive' | 'error' | 'success' | 'warning' | 'inherit';
8
+ /**
9
+ * Makes the icon meaningful: it's announced as an image with this name. Without `aria-label`
10
+ * or `title`, the icon is decorative and hidden from assistive technology (#85). Use a
11
+ * human-readable name, never the internal icon name; `icons.json`'s `ariaLabelDefault` is a
12
+ * starting point.
13
+ */
14
+ 'aria-label'?: string;
15
+ /**
16
+ * Like `aria-label`, and also shown as a tooltip. `aria-label` wins if both are given.
17
+ */
18
+ title?: string;
8
19
  'data-testid'?: string;
9
20
  }
10
21
  export declare const Icon: FC<IconProps>;
@@ -5,7 +5,10 @@ export interface DateGroupProps {
5
5
  date: Date | string;
6
6
  /** Children to render under the date header (typically transactions) */
7
7
  children: React.ReactNode;
8
- /** Format mode for date display */
8
+ /**
9
+ * Format mode for the date header, passed to DateFormatter's `mode`. `'relative'` is
10
+ * deprecated: it behaves exactly like `'smart'`, so use `'smart'` (#82).
11
+ */
9
12
  format?: DateFormatMode;
10
13
  /** Whether to show total amount for this date group */
11
14
  showTotal?: boolean;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { type ListSpacing } from './ListContext';
2
3
  export interface ListProps {
3
4
  /**
4
5
  * ListItem components
@@ -10,10 +11,10 @@ export interface ListProps {
10
11
  */
11
12
  dividers?: boolean;
12
13
  /**
13
- * Vertical spacing between items
14
+ * Density of the list's items: their padding. A ListItem's own `spacing` overrides it (#77).
14
15
  * @default 'comfortable'
15
16
  */
16
- spacing?: 'compact' | 'comfortable';
17
+ spacing?: ListSpacing;
17
18
  /**
18
19
  * Additional CSS class name
19
20
  */
@@ -0,0 +1,6 @@
1
+ export type ListSpacing = 'compact' | 'comfortable';
2
+ /**
3
+ * The spacing a List gives its items (#77). A ListItem without its own `spacing` uses it; outside
4
+ * a List it's `comfortable`. Internal: not exported from the package.
5
+ */
6
+ export declare const ListSpacingContext: import("react").Context<ListSpacing>;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { type ListSpacing } from './ListContext';
2
3
  export interface ListItemProps {
3
4
  /**
4
5
  * Main text/content
@@ -56,10 +57,10 @@ export interface ListItemProps {
56
57
  */
57
58
  destructive?: boolean;
58
59
  /**
59
- * Spacing variant from parent List
60
- * @default 'comfortable'
60
+ * Density of this item. Defaults to the parent List's `spacing`, or `comfortable` outside a
61
+ * List; set it to override the List for this item (#77).
61
62
  */
62
- spacing?: 'compact' | 'comfortable';
63
+ spacing?: ListSpacing;
63
64
  /**
64
65
  * Expanded content (shown when expanded=true)
65
66
  */
@@ -95,6 +96,6 @@ export interface ListItemProps {
95
96
  onKeyDown?: (e: React.KeyboardEvent) => void;
96
97
  }
97
98
  export declare const ListItem: {
98
- ({ primary, secondary, badge, icon, expandable, expanded, onToggle, interactive, onClick, disabled, selected, destructive, spacing, children, className, "data-testid": dataTestId, role: customRole, "aria-selected": ariaSelected, id, tabIndex: customTabIndex, onKeyDown: customOnKeyDown, ...props }: ListItemProps): import("react/jsx-runtime").JSX.Element;
99
+ ({ primary, secondary, badge, icon, expandable, expanded, onToggle, interactive, onClick, disabled, selected, destructive, spacing: spacingProp, children, className, "data-testid": dataTestId, role: customRole, "aria-selected": ariaSelected, id, tabIndex: customTabIndex, onKeyDown: customOnKeyDown, ...props }: ListItemProps): import("react/jsx-runtime").JSX.Element;
99
100
  displayName: string;
100
101
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common-origin/design-system",
3
- "version": "2.16.0",
3
+ "version": "2.17.0",
4
4
  "description": "Common Origin Design System - Framework-agnostic atomic design components with comprehensive WCAG 2.2 AA testing",
5
5
  "private": false,
6
6
  "main": "dist/index.js",