@sonic-equipment/ui 155.0.0 → 156.0.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.
package/dist/exports.d.ts CHANGED
@@ -102,6 +102,7 @@ export * from './global-search/search-result-panel/panel-content';
102
102
  export * from './global-search/search-result-panel/search-result-panel';
103
103
  export * from './global-search/search-result-panel/sections/no-search';
104
104
  export * from './global-search/search-result-panel/sections/no-search-results';
105
+ export * from './global-search/search-result-panel/sections/searching';
105
106
  export * from './global-search/search-result-panel/sections/section-container';
106
107
  export * from './global-search/search-result-panel/sections/with-results';
107
108
  export * from './global-search/search-section/search-list';
@@ -6,8 +6,11 @@ import { NoSearchResults } from './sections/no-search-results.js';
6
6
  import { WithResults } from './sections/with-results.js';
7
7
 
8
8
  function PanelContent() {
9
- const { hasResults, state } = useAlgoliaSearch();
10
- return (jsx(Fragment, { children: state.query.length === 0 ? (jsx(NoSearch, {})) : hasResults ? (jsx(WithResults, {})) : (jsx(NoSearchResults, {})) }));
9
+ const { state } = useAlgoliaSearch();
10
+ const hasSearchQuery = state.query.length > 0;
11
+ const isLoading = (state.status === 'loading' || state.status === 'stalled') && hasSearchQuery;
12
+ const hasResults = (state.collections.find(collection => collection.source.sourceId === 'productsPlugin')?.items.length || 0) > 0;
13
+ return (jsx(Fragment, { children: hasResults ? (jsx(WithResults, { isLoading: isLoading })) : hasSearchQuery && !isLoading ? (jsx(NoSearchResults, { isLoading: isLoading })) : (jsx(NoSearch, { isLoading: isLoading })) }));
11
14
  }
12
15
 
13
16
  export { PanelContent };
@@ -1 +1,3 @@
1
- export declare function NoSearchResults(): import("react/jsx-runtime").JSX.Element;
1
+ export declare function NoSearchResults({ isLoading }: {
2
+ isLoading?: boolean;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -6,11 +6,12 @@ import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
6
6
  import { CategoriesGrid } from '../../categories-grid/categories-grid.js';
7
7
  import { useGlobalSearchDisclosure } from '../../global-search-provider/use-search-disclosure.js';
8
8
  import { SearchSection } from '../../search-section/search-section.js';
9
+ import { SearchingSection } from './searching.js';
9
10
  import { SectionContainer } from './section-container.js';
10
11
  import styles from './search-content.module.css.js';
11
12
 
12
- function NoSearchResults() {
13
- return (jsx(Fragment, { children: jsx(SectionContainer, { leftContent: jsx(NotFound, {}), rightContent: jsx(PopularCategoriesSection, {}) }) }));
13
+ function NoSearchResults({ isLoading }) {
14
+ return (jsx(Fragment, { children: jsx(SectionContainer, { leftContent: jsx(NotFound, {}), rightContent: isLoading ? jsx(SearchingSection, {}) : jsx(PopularCategoriesSection, {}) }) }));
14
15
  }
15
16
  function NotFound() {
16
17
  const { state } = useAlgoliaSearch();
@@ -1 +1,5 @@
1
- export declare function NoSearch(): import("react/jsx-runtime").JSX.Element;
1
+ export declare function NoSearch({ isLoading }: {
2
+ isLoading?: boolean;
3
+ }): import("react/jsx-runtime").JSX.Element;
4
+ export declare function PopularSearchesSection(): import("react/jsx-runtime").JSX.Element | null;
5
+ export declare function RecentSearchesSection(): import("react/jsx-runtime").JSX.Element | null;
@@ -12,11 +12,12 @@ import { Highlight } from '../../search-highlight/highlight.js';
12
12
  import { SearchList } from '../../search-section/search-list.js';
13
13
  import { SearchListItem } from '../../search-section/search-list-item.js';
14
14
  import { SearchSection } from '../../search-section/search-section.js';
15
+ import { SearchingSection } from './searching.js';
15
16
  import { SectionContainer } from './section-container.js';
16
17
  import styles from './search-content.module.css.js';
17
18
 
18
- function NoSearch() {
19
- return (jsx(SectionContainer, { leftContent: jsxs("div", { children: [jsx(RecentSearchesSection, {}), jsx(PopularSearchesSection, {})] }), rightContent: jsx(QuickAccessSection, {}) }));
19
+ function NoSearch({ isLoading }) {
20
+ return (jsx(SectionContainer, { leftContent: jsxs("div", { children: [jsx(RecentSearchesSection, {}), jsx(PopularSearchesSection, {})] }), rightContent: isLoading ? jsx(SearchingSection, {}) : jsx(QuickAccessSection, {}) }));
20
21
  }
21
22
  function PopularSearchesSection() {
22
23
  const { autocomplete, popularSearches: collection } = useAlgoliaSearch();
@@ -55,4 +56,4 @@ function QuickAccessSection() {
55
56
  , { href: item.action.url, image: item.image, onClick: close }, `${index}-${item.action.url}`))), cardsPerView: "auto", cardWidth: "narrow" }) }) }));
56
57
  }
57
58
 
58
- export { NoSearch };
59
+ export { NoSearch, PopularSearchesSection, RecentSearchesSection };
@@ -1,3 +1,3 @@
1
- var styles = {"section-container":"search-content-module-ZMwlB","content":"search-content-module-KIok6","left":"search-content-module-YRLIf","right":"search-content-module-qK5sg","button-container":"search-content-module-w-ORq","show-all-button":"search-content-module-bO1Q0","product-results":"search-content-module-bcFCH","quick-access-section-header":"search-content-module-HrHCE","product-results-section-header":"search-content-module-9bgxF","no-results-text":"search-content-module-H-FX2","query":"search-content-module-LbQnK","suggestions":"search-content-module-mhiBZ","list":"search-content-module-coPAt"};
1
+ var styles = {"section-container":"search-content-module-ZMwlB","content":"search-content-module-KIok6","left":"search-content-module-YRLIf","right":"search-content-module-qK5sg","button-container":"search-content-module-w-ORq","show-all-button":"search-content-module-bO1Q0","product-results":"search-content-module-bcFCH","quick-access-section-header":"search-content-module-HrHCE","product-results-section-header":"search-content-module-9bgxF","no-results-text":"search-content-module-H-FX2","query":"search-content-module-LbQnK","suggestions":"search-content-module-mhiBZ","list":"search-content-module-coPAt","search-section":"search-content-module-qQMqH"};
2
2
 
3
3
  export { styles as default };
@@ -0,0 +1 @@
1
+ export declare function SearchingSection(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { ProgressCircle } from '../../../loading/progress-circle.js';
4
+ import { SearchSection } from '../../search-section/search-section.js';
5
+ import styles from './search-content.module.css.js';
6
+
7
+ function SearchingSection() {
8
+ return (jsx(SearchSection, { className: styles['search-section'], children: jsx(ProgressCircle, { variant: "gray" }) }));
9
+ }
10
+
11
+ export { SearchingSection };
@@ -1 +1,3 @@
1
- export declare function WithResults(): import("react/jsx-runtime").JSX.Element;
1
+ export declare function WithResults({ isLoading }: {
2
+ isLoading?: boolean;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -6,7 +6,6 @@ import { useAlgoliaInsights } from '../../../algolia/use-algolia-insights.js';
6
6
  import { useAlgoliaSearch } from '../../../algolia/use-algolia-search.js';
7
7
  import { ConnectedProductCard } from '../../../cards/product-card/connected-product-card.js';
8
8
  import { CardCarousel } from '../../../carousel/card-carousel/card-carousel.js';
9
- import { GlyphsArrowBoldCapsRightIcon } from '../../../icons/glyph/glyphs-arrow-boldcaps-right-icon.js';
10
9
  import { StrokeRecentIcon } from '../../../icons/stroke/stroke-recent-icon.js';
11
10
  import { StrokeSearchIcon } from '../../../icons/stroke/stroke-search-icon.js';
12
11
  import { FormattedMessage } from '../../../intl/formatted-message.js';
@@ -19,14 +18,15 @@ import { Highlight } from '../../search-highlight/highlight.js';
19
18
  import { SearchList } from '../../search-section/search-list.js';
20
19
  import { SearchListItem } from '../../search-section/search-list-item.js';
21
20
  import { SearchSection } from '../../search-section/search-section.js';
21
+ import { SearchingSection } from './searching.js';
22
22
  import { SectionContainer } from './section-container.js';
23
23
  import buttonStyles from '../../../buttons/button/button.module.css.js';
24
24
  import styles from './search-content.module.css.js';
25
25
 
26
- function WithResults() {
26
+ function WithResults({ isLoading }) {
27
27
  const { state } = useAlgoliaSearch();
28
28
  const { close } = useGlobalSearchDisclosure();
29
- return (jsx("div", { children: jsx(SectionContainer, { buttons: jsxs(RouteButton, { className: clsx(styles['show-all-button'], buttonStyles.button, buttonStyles.secondary, buttonStyles.outline, buttonStyles.md), href: `/search?keyword=${encodeURIComponent(state.query)}`, onClick: close, children: [jsx(FormattedMessage, { id: "See all results" }), jsx(GlyphsArrowBoldCapsRightIcon, { className: buttonStyles['right-arrow-icon'] })] }), leftContent: jsx(SuggestionsSection, {}), rightContent: jsx(ProductResultsSection, {}) }) }));
29
+ return (jsx("div", { children: jsx(SectionContainer, { buttons: !isLoading && (jsx(RouteButton, { withArrow: true, className: clsx(styles['show-all-button'], buttonStyles.button, buttonStyles.secondary, buttonStyles.outline, buttonStyles.md), href: `/search?keyword=${encodeURIComponent(state.query)}`, onClick: close, children: jsx(FormattedMessage, { id: "See all results" }) })), leftContent: jsx(SuggestionsSection, {}), rightContent: isLoading ? jsx(SearchingSection, {}) : jsx(ProductResultsSection, {}) }) }));
30
30
  }
31
31
  function SuggestionsSection() {
32
32
  const { autocomplete, categories, querySuggestions, recentSearches } = useAlgoliaSearch();
package/dist/index.js CHANGED
@@ -105,8 +105,9 @@ export { ConnectedSearchInput } from './global-search/search-input/connected-sea
105
105
  export { SearchInput } from './global-search/search-input/search-input.js';
106
106
  export { PanelContent } from './global-search/search-result-panel/panel-content.js';
107
107
  export { SearchResultPanel } from './global-search/search-result-panel/search-result-panel.js';
108
- export { NoSearch } from './global-search/search-result-panel/sections/no-search.js';
108
+ export { NoSearch, PopularSearchesSection, RecentSearchesSection } from './global-search/search-result-panel/sections/no-search.js';
109
109
  export { NoSearchResults } from './global-search/search-result-panel/sections/no-search-results.js';
110
+ export { SearchingSection } from './global-search/search-result-panel/sections/searching.js';
110
111
  export { SectionContainer } from './global-search/search-result-panel/sections/section-container.js';
111
112
  export { WithResults } from './global-search/search-result-panel/sections/with-results.js';
112
113
  export { SearchList } from './global-search/search-section/search-list.js';
@@ -55,6 +55,9 @@ function AdyenPayment({ amount, cartId, countryCode, currencyCode, customerId, d
55
55
  catch (error) {
56
56
  return onError(error, null);
57
57
  }
58
+ finally {
59
+ dropinDivRef.current?.classList.remove(styles.loading);
60
+ }
58
61
  }),
59
62
  onSubmit: (async (state, _component) => {
60
63
  try {
@@ -80,6 +83,9 @@ function AdyenPayment({ amount, cartId, countryCode, currencyCode, customerId, d
80
83
  catch (error) {
81
84
  return onError(error, null);
82
85
  }
86
+ finally {
87
+ dropinDivRef.current?.classList.remove(styles.loading);
88
+ }
83
89
  }),
84
90
  session: {
85
91
  ...adyenSession,
@@ -55,7 +55,12 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
55
55
  cart.billTo?.id &&
56
56
  countryCode;
57
57
  const hasReturnedFromAdyen = useHasReturnedFromAdyen();
58
- const isDisabled = hasReturnedFromAdyen || isProcessing;
58
+ const isDisabled = isProcessing;
59
+ useEffect(() => {
60
+ if (!hasReturnedFromAdyen)
61
+ return;
62
+ onProcessing(true);
63
+ }, [hasReturnedFromAdyen, onProcessing]);
59
64
  useEffect(() => {
60
65
  cartRef.current = _cart;
61
66
  }, [_cart]);
@@ -285,12 +290,12 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
285
290
  }
286
291
  }, [onPaymentComplete, onPlaceOrderCompleted, onProcessing, placeOrder]);
287
292
  const onError = useCallback((error, result) => {
293
+ onProcessing(false);
288
294
  invalidateAdyen();
289
- // invalidateCurrentCart()
290
295
  setPaymentError(error);
291
296
  logger.error(error);
292
297
  _onError?.(error, result);
293
- }, [_onError, invalidateAdyen]);
298
+ }, [_onError, invalidateAdyen, onProcessing]);
294
299
  return (jsxs(Form, { className: styles['payment-form'], "data-test-selector": "paymentForm", id: form, onSubmit: e => {
295
300
  e.preventDefault();
296
301
  onSubmit(e);
package/dist/styles.css CHANGED
@@ -718,6 +718,7 @@
718
718
  display: block;
719
719
  width: var(--width);
720
720
  height: var(--width);
721
+ box-sizing: border-box;
721
722
  border: 4px solid transparent;
722
723
  border-radius: var(--width);
723
724
  animation: progress-circle-module-kCf7K 0.6s infinite linear;
@@ -5033,6 +5034,16 @@ button.swiper-pagination-bullet {
5033
5034
  list-style: initial;
5034
5035
  }
5035
5036
 
5037
+ .search-content-module-qQMqH {
5038
+ display: flex;
5039
+ width: 100%;
5040
+ height: 100%;
5041
+ min-height: 200px;
5042
+ box-sizing: border-box;
5043
+ align-items: center;
5044
+ justify-content: center;
5045
+ }
5046
+
5036
5047
  @media (width >= 768px) {
5037
5048
  .search-content-module-ZMwlB {
5038
5049
  padding-left: var(--space-8);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonic-equipment/ui",
3
- "version": "155.0.0",
3
+ "version": "156.0.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "engines": {