@nuskin/react-search-components 1.0.0 → 1.1.0-cx130-2624.2

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.
package/dist/index.d.mts CHANGED
@@ -23,6 +23,10 @@ interface CatalogSuggestionItem {
23
23
  productStatus: string | undefined;
24
24
  status: string | undefined;
25
25
  cartActionDisabled: boolean;
26
+ requiresProductPage?: boolean;
27
+ inventoryStatus?: string;
28
+ dangerousGoods?: boolean;
29
+ skuCount?: number;
26
30
  customProductType: string;
27
31
  slug: string | null;
28
32
  productSlug: string | null;
@@ -79,10 +83,28 @@ interface SearchPanelCopy {
79
83
  addToCart: (productName: string) => string;
80
84
  /** The accessible name of a bundle's action button, given the bundle's name. */
81
85
  openBundle: (productName: string) => string;
86
+ /** The accessible name of the product title/image control. */
87
+ openProductPage: (productName: string) => string;
82
88
  /** Announced while suggestions load. */
83
89
  suggestionsLoading: string;
84
90
  /** Announced when suggestions appear, given how many, for example "3 suggestions available". */
85
91
  suggestionsCount: (count: number) => string;
92
+ /** Accessible name of the presentational voice mark, when NUi icons are shown. */
93
+ voiceSearch: string;
94
+ /** Accessible name of the presentational sparkle mark, when NUi icons are shown. */
95
+ askNui: string;
96
+ }
97
+ /** Contentstack live-preview tags for the fields this panel shows. */
98
+ interface SearchEditTags {
99
+ cancelLabel?: Record<string, string>;
100
+ cancelShowIcon?: Record<string, string>;
101
+ searchPlaceholder?: Record<string, string>;
102
+ searchAriaLabel?: Record<string, string>;
103
+ mobileRotatingPlaceholder?: Record<string, string>;
104
+ recentSearchesHeading?: Record<string, string>;
105
+ clearAllLabel?: Record<string, string>;
106
+ enableRecentSearches?: Record<string, string>;
107
+ enableAutocomplete?: Record<string, string>;
86
108
  }
87
109
  /** The search box, controlled by the host. */
88
110
  interface SearchPanelInputProps {
@@ -103,7 +125,10 @@ interface SearchPanelSuggestionsProps {
103
125
  /** The query the suggestions belong to (passed to the "see more" link). */
104
126
  query: string;
105
127
  onSelect: (option: SuggestionOption) => void;
128
+ /** Bundle / multi-SKU CTA: open product page or bundle flow. */
106
129
  onRunAction: (option: SuggestionOption) => void;
130
+ /** Single-SKU cart icon on the product snippet; host adds via PubSub or direct cart API. */
131
+ onAddToCartAction?: (option: SuggestionOption) => void;
107
132
  onSeeMore: () => void;
108
133
  }
109
134
  /** Recent searches, shown while the search box is empty. */
@@ -111,6 +136,8 @@ interface SearchPanelRecentSearches {
111
136
  items: ReadonlyArray<string>;
112
137
  onSelect: (query: string) => void;
113
138
  onClear: () => void;
139
+ /** Show the heading and clear control even when there are no chips yet. */
140
+ showWhenEmpty?: boolean;
114
141
  }
115
142
  interface SearchPanelProps {
116
143
  isOpen: boolean;
@@ -120,12 +147,27 @@ interface SearchPanelProps {
120
147
  copy: SearchPanelCopy;
121
148
  input: SearchPanelInputProps;
122
149
  suggestions: SearchPanelSuggestionsProps;
150
+ /** When false, typeahead rows stay hidden. Defaults to true. */
151
+ showSuggestions?: boolean;
123
152
  recentSearches?: SearchPanelRecentSearches;
124
153
  /**
125
154
  * An embedded agent (the NUi widget). When set, the panel switches to its agent layout: the
126
155
  * search box, suggestions and recent searches are replaced by this content.
127
156
  */
128
157
  agentPanel?: React.ReactNode;
158
+ /** Show the branded voice and sparkle marks in the search box. They are not controls. */
159
+ showNuiIcons?: boolean;
160
+ /**
161
+ * Show the close icon beside the cancel label on desktop. Mobile never shows it.
162
+ * Defaults to showing it.
163
+ */
164
+ showCancelIcon?: boolean;
165
+ /** Placeholder phrases that rotate on small screens while the box is empty. */
166
+ rotatingPlaceholders?: ReadonlyArray<string>;
167
+ /** How long each rotating phrase is shown, in milliseconds. */
168
+ rotatingPlaceholderIntervalMs?: number;
169
+ /** Live-preview tags for the cancel control and the extended search box. */
170
+ editTags?: SearchEditTags;
129
171
  }
130
172
 
131
173
  /**
@@ -140,6 +182,6 @@ interface SearchPanelProps {
140
182
  * Presentational: it holds only UI state (highlighted row, expanded recent searches). Fetching,
141
183
  * routing, navigation and all of its text belong to the host.
142
184
  */
143
- declare function SearchPanel({ isOpen, onClose, logo, fallbackImageUrl, copy, input, suggestions, recentSearches, agentPanel, }: Readonly<SearchPanelProps>): React.ReactElement | null;
185
+ declare function SearchPanel({ isOpen, onClose, logo, fallbackImageUrl, copy, input, suggestions, showSuggestions, recentSearches, agentPanel, showNuiIcons, showCancelIcon, rotatingPlaceholders, rotatingPlaceholderIntervalMs, editTags, }: Readonly<SearchPanelProps>): React.ReactElement | null;
144
186
 
145
- export { type CatalogSuggestionItem, type DidYouMeanItem, SearchPanel, type SearchPanelCopy, type SearchPanelInputProps, type SearchPanelProps, type SearchPanelRecentSearches, type SearchPanelSuggestionsProps, type SuggestionOption };
187
+ export { type CatalogSuggestionItem, type DidYouMeanItem, type SearchEditTags, SearchPanel, type SearchPanelCopy, type SearchPanelInputProps, type SearchPanelProps, type SearchPanelRecentSearches, type SearchPanelSuggestionsProps, type SuggestionOption };
package/dist/index.d.ts CHANGED
@@ -23,6 +23,10 @@ interface CatalogSuggestionItem {
23
23
  productStatus: string | undefined;
24
24
  status: string | undefined;
25
25
  cartActionDisabled: boolean;
26
+ requiresProductPage?: boolean;
27
+ inventoryStatus?: string;
28
+ dangerousGoods?: boolean;
29
+ skuCount?: number;
26
30
  customProductType: string;
27
31
  slug: string | null;
28
32
  productSlug: string | null;
@@ -79,10 +83,28 @@ interface SearchPanelCopy {
79
83
  addToCart: (productName: string) => string;
80
84
  /** The accessible name of a bundle's action button, given the bundle's name. */
81
85
  openBundle: (productName: string) => string;
86
+ /** The accessible name of the product title/image control. */
87
+ openProductPage: (productName: string) => string;
82
88
  /** Announced while suggestions load. */
83
89
  suggestionsLoading: string;
84
90
  /** Announced when suggestions appear, given how many, for example "3 suggestions available". */
85
91
  suggestionsCount: (count: number) => string;
92
+ /** Accessible name of the presentational voice mark, when NUi icons are shown. */
93
+ voiceSearch: string;
94
+ /** Accessible name of the presentational sparkle mark, when NUi icons are shown. */
95
+ askNui: string;
96
+ }
97
+ /** Contentstack live-preview tags for the fields this panel shows. */
98
+ interface SearchEditTags {
99
+ cancelLabel?: Record<string, string>;
100
+ cancelShowIcon?: Record<string, string>;
101
+ searchPlaceholder?: Record<string, string>;
102
+ searchAriaLabel?: Record<string, string>;
103
+ mobileRotatingPlaceholder?: Record<string, string>;
104
+ recentSearchesHeading?: Record<string, string>;
105
+ clearAllLabel?: Record<string, string>;
106
+ enableRecentSearches?: Record<string, string>;
107
+ enableAutocomplete?: Record<string, string>;
86
108
  }
87
109
  /** The search box, controlled by the host. */
88
110
  interface SearchPanelInputProps {
@@ -103,7 +125,10 @@ interface SearchPanelSuggestionsProps {
103
125
  /** The query the suggestions belong to (passed to the "see more" link). */
104
126
  query: string;
105
127
  onSelect: (option: SuggestionOption) => void;
128
+ /** Bundle / multi-SKU CTA: open product page or bundle flow. */
106
129
  onRunAction: (option: SuggestionOption) => void;
130
+ /** Single-SKU cart icon on the product snippet; host adds via PubSub or direct cart API. */
131
+ onAddToCartAction?: (option: SuggestionOption) => void;
107
132
  onSeeMore: () => void;
108
133
  }
109
134
  /** Recent searches, shown while the search box is empty. */
@@ -111,6 +136,8 @@ interface SearchPanelRecentSearches {
111
136
  items: ReadonlyArray<string>;
112
137
  onSelect: (query: string) => void;
113
138
  onClear: () => void;
139
+ /** Show the heading and clear control even when there are no chips yet. */
140
+ showWhenEmpty?: boolean;
114
141
  }
115
142
  interface SearchPanelProps {
116
143
  isOpen: boolean;
@@ -120,12 +147,27 @@ interface SearchPanelProps {
120
147
  copy: SearchPanelCopy;
121
148
  input: SearchPanelInputProps;
122
149
  suggestions: SearchPanelSuggestionsProps;
150
+ /** When false, typeahead rows stay hidden. Defaults to true. */
151
+ showSuggestions?: boolean;
123
152
  recentSearches?: SearchPanelRecentSearches;
124
153
  /**
125
154
  * An embedded agent (the NUi widget). When set, the panel switches to its agent layout: the
126
155
  * search box, suggestions and recent searches are replaced by this content.
127
156
  */
128
157
  agentPanel?: React.ReactNode;
158
+ /** Show the branded voice and sparkle marks in the search box. They are not controls. */
159
+ showNuiIcons?: boolean;
160
+ /**
161
+ * Show the close icon beside the cancel label on desktop. Mobile never shows it.
162
+ * Defaults to showing it.
163
+ */
164
+ showCancelIcon?: boolean;
165
+ /** Placeholder phrases that rotate on small screens while the box is empty. */
166
+ rotatingPlaceholders?: ReadonlyArray<string>;
167
+ /** How long each rotating phrase is shown, in milliseconds. */
168
+ rotatingPlaceholderIntervalMs?: number;
169
+ /** Live-preview tags for the cancel control and the extended search box. */
170
+ editTags?: SearchEditTags;
129
171
  }
130
172
 
131
173
  /**
@@ -140,6 +182,6 @@ interface SearchPanelProps {
140
182
  * Presentational: it holds only UI state (highlighted row, expanded recent searches). Fetching,
141
183
  * routing, navigation and all of its text belong to the host.
142
184
  */
143
- declare function SearchPanel({ isOpen, onClose, logo, fallbackImageUrl, copy, input, suggestions, recentSearches, agentPanel, }: Readonly<SearchPanelProps>): React.ReactElement | null;
185
+ declare function SearchPanel({ isOpen, onClose, logo, fallbackImageUrl, copy, input, suggestions, showSuggestions, recentSearches, agentPanel, showNuiIcons, showCancelIcon, rotatingPlaceholders, rotatingPlaceholderIntervalMs, editTags, }: Readonly<SearchPanelProps>): React.ReactElement | null;
144
186
 
145
- export { type CatalogSuggestionItem, type DidYouMeanItem, SearchPanel, type SearchPanelCopy, type SearchPanelInputProps, type SearchPanelProps, type SearchPanelRecentSearches, type SearchPanelSuggestionsProps, type SuggestionOption };
187
+ export { type CatalogSuggestionItem, type DidYouMeanItem, type SearchEditTags, SearchPanel, type SearchPanelCopy, type SearchPanelInputProps, type SearchPanelProps, type SearchPanelRecentSearches, type SearchPanelSuggestionsProps, type SuggestionOption };