@attrus-ds/core 1.0.13 → 1.0.14

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.
@@ -7,6 +7,10 @@ import * as React from 'react';
7
7
  */
8
8
 
9
9
  export interface SearchPillProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {
10
+ /** Field height: 'md' (40px, default) or 'sm' (32px). Named fieldSize because
11
+ the native input `size` attribute means character count, not height. Use
12
+ 'sm' inside a toolbar, where a 40px field towers over 32px buttons. */
13
+ fieldSize?: 'sm' | 'md';
10
14
  /** Keyboard hint rendered as a .kbd chip (e.g. "⌘K"). */
11
15
  shortcut?: string;
12
16
  /** Leading icon — defaults to the canonical search glyph. */
@@ -26,11 +30,12 @@ const SearchGlyph: React.FC = () => (
26
30
  export const SearchPill: React.FC<SearchPillProps> = ({
27
31
  shortcut,
28
32
  icon,
33
+ fieldSize = 'md',
29
34
  wrapperClassName,
30
35
  wrapperStyle,
31
36
  ...rest
32
37
  }) => (
33
- <div className={['pill-search', wrapperClassName || ''].filter(Boolean).join(' ')} style={wrapperStyle}>
38
+ <div className={['pill-search', fieldSize === 'sm' ? 'pill-search-sm' : '', wrapperClassName || ''].filter(Boolean).join(' ')} style={wrapperStyle}>
34
39
  {icon != null ? icon : <SearchGlyph />}
35
40
  <input type="search" {...rest} />
36
41
  {shortcut ? <span className="kbd">{shortcut}</span> : null}
@@ -12,6 +12,8 @@ export interface SSItem {
12
12
  }
13
13
 
14
14
  export interface SSSection {
15
+ /** `recent` renders `.ss-recent` — history styling, quieter than results. */
16
+ variant?: 'default' | 'recent';
15
17
  /** Uppercase section label (e.g. "Counterparties"). */
16
18
  label?: React.ReactNode;
17
19
  items: SSItem[];
@@ -26,6 +28,8 @@ export interface SSTypeButton {
26
28
  }
27
29
 
28
30
  export interface SmartSearchProps {
31
+ /** Empty-state line — renders `.ss-no-result` with the term emphasised. */
32
+ emptyQuery?: string;
29
33
  value: string;
30
34
  onChange?: (value: string) => void;
31
35
  placeholder?: string;
@@ -34,6 +34,9 @@ export interface SSItem {
34
34
  }
35
35
 
36
36
  export interface SSSection {
37
+ /** `recent` renders `.ss-recent`: leading icons shrink to bare glyphs so
38
+ history reads below live results instead of competing with them. */
39
+ variant?: 'default' | 'recent';
37
40
  /** Uppercase section label (e.g. "Counterparties"). */
38
41
  label?: React.ReactNode;
39
42
  items: SSItem[];
@@ -48,6 +51,9 @@ export interface SSTypeButton {
48
51
  }
49
52
 
50
53
  export interface SmartSearchProps {
54
+ /** Empty-state line, rendered as `.ss-no-result` with the term emphasised.
55
+ Pass the query so the message can name what failed. */
56
+ emptyQuery?: string;
51
57
  value: string;
52
58
  onChange?: (value: string) => void;
53
59
  placeholder?: string;
@@ -101,6 +107,7 @@ export const SmartSearch: React.FC<SmartSearchProps> = ({
101
107
  sections,
102
108
  onSelect,
103
109
  resultLabel,
110
+ emptyQuery,
104
111
  hint,
105
112
  typeButtons,
106
113
  onTypeSelect,
@@ -192,12 +199,18 @@ export const SmartSearch: React.FC<SmartSearchProps> = ({
192
199
  ) : null}
193
200
 
194
201
  {sections && sections.length ? sections.map((s, i) => (
195
- <div key={i} className="ss-section">
202
+ <div key={i} className={'ss-section' + (s.variant === 'recent' ? ' ss-recent' : '')}>
196
203
  {s.label != null ? <div className="ss-section-label">{s.label}</div> : null}
197
204
  <ul className="ss-list">{s.items.map(renderItem)}</ul>
198
205
  </div>
199
206
  )) : null}
200
207
 
208
+ {emptyQuery != null ? (
209
+ <div className="ss-section">
210
+ <div className="ss-no-result">No results for "<strong>{emptyQuery}</strong>".</div>
211
+ </div>
212
+ ) : null}
213
+
201
214
  {hint != null ? (
202
215
  <div className="ss-section"><div className="ss-hint">{hint}</div></div>
203
216
  ) : null}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@attrus-ds/core",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "ATTRUS / Cabiros design system — design tokens, component styles, brand assets, fonts and an optional typed React component layer.",
5
5
  "keywords": [
6
6
  "design-system",