@sonic-equipment/ui 0.0.21 → 0.0.22
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/algolia/algolia-active-filters.d.ts +1 -1
- package/dist/icons/arrows/right-arrow-filled-icon.d.ts +0 -1
- package/dist/index.d.ts +175 -25
- package/dist/index.js +1709 -156
- package/dist/product-listing/product-listing.d.ts +0 -18
- package/dist/product-listing/product-listing.stories.d.ts +1 -2
- package/dist/shared/providers/cart-provider.d.ts +6 -6
- package/dist/shared/types/cart.d.ts +4 -4
- package/dist/styles.css +93 -93
- package/package.json +22 -22
|
@@ -7,25 +7,7 @@ export interface Filters {
|
|
|
7
7
|
}[];
|
|
8
8
|
};
|
|
9
9
|
}
|
|
10
|
-
declare const sortOptions: {
|
|
11
|
-
readonly new: "New";
|
|
12
|
-
readonly popular: "Popular";
|
|
13
|
-
readonly price_asc: "Price: Low - High";
|
|
14
|
-
readonly price_desc: "Price: High - Low";
|
|
15
|
-
readonly recommended: "Recommended";
|
|
16
|
-
};
|
|
17
|
-
type SortKey = keyof typeof sortOptions;
|
|
18
|
-
export type ActiveFilters = {
|
|
19
|
-
colors: string[];
|
|
20
|
-
};
|
|
21
10
|
export type ProductListingProps = {
|
|
22
|
-
activeFilters: ActiveFilters;
|
|
23
|
-
filters: Filters;
|
|
24
11
|
isLoading?: boolean;
|
|
25
|
-
onFilterChange: (filters: ActiveFilters) => void;
|
|
26
|
-
onSortChange: (sort: SortKey) => void;
|
|
27
|
-
sort: SortKey;
|
|
28
|
-
total: number;
|
|
29
12
|
};
|
|
30
13
|
export declare function ProductListing({ isLoading }: ProductListingProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
-
export {};
|
|
@@ -3,8 +3,7 @@ import { StoryObj } from '@storybook/react';
|
|
|
3
3
|
import { ProductListing } from './product-listing';
|
|
4
4
|
declare const meta: {
|
|
5
5
|
args: {
|
|
6
|
-
|
|
7
|
-
onSortChange: import("@vitest/spy").Mock<[sort: "new" | "popular" | "price_asc" | "price_desc" | "recommended"], void>;
|
|
6
|
+
isLoading: false;
|
|
8
7
|
online: false;
|
|
9
8
|
};
|
|
10
9
|
component: typeof ProductListing;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { Cart, CartLine } from 'shared/types/cart';
|
|
2
|
-
interface Props {
|
|
2
|
+
interface Props<TCartLine extends CartLine = CartLine, TCart extends Cart<TCartLine> = Cart<TCartLine>> {
|
|
3
3
|
addToCart: (args: {
|
|
4
4
|
productId: string;
|
|
5
5
|
quantity: number;
|
|
6
6
|
}) => void;
|
|
7
|
-
currentCart:
|
|
7
|
+
currentCart: Readonly<TCart> | undefined;
|
|
8
8
|
isLoaded: boolean;
|
|
9
9
|
isLoading: boolean;
|
|
10
10
|
loadCurrentCart: VoidFunction;
|
|
11
11
|
removeCartLine: (args: {
|
|
12
12
|
cartLineId: string;
|
|
13
13
|
}) => void;
|
|
14
|
-
updateCartLine: (cartLine:
|
|
14
|
+
updateCartLine: (cartLine: TCartLine) => void;
|
|
15
15
|
}
|
|
16
|
-
export declare function CartProvider(props: Props): null;
|
|
17
|
-
export declare function useCart(): Props
|
|
16
|
+
export declare function CartProvider<TCartLine extends CartLine = CartLine, TCart extends Cart<TCartLine> = Cart<TCartLine>>(props: Props<TCartLine, TCart>): null;
|
|
17
|
+
export declare function useCart(): Props<CartLine, Cart<CartLine>>;
|
|
18
18
|
export declare function useProductCartLine(productId: string): {
|
|
19
19
|
addToCart: (args: {
|
|
20
20
|
productId: string;
|
|
21
21
|
quantity: number;
|
|
22
22
|
}) => void;
|
|
23
23
|
cartLine: CartLine | undefined;
|
|
24
|
-
currentCart: Cart;
|
|
24
|
+
currentCart: Readonly<Cart<CartLine>> | undefined;
|
|
25
25
|
isLoaded: boolean;
|
|
26
26
|
isLoading: boolean;
|
|
27
27
|
loadCurrentCart: VoidFunction;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export interface CartLine {
|
|
2
2
|
id: string;
|
|
3
|
-
productId: string;
|
|
4
|
-
qtyOrdered: number;
|
|
3
|
+
productId: string | null;
|
|
4
|
+
qtyOrdered: number | null;
|
|
5
5
|
}
|
|
6
|
-
export interface Cart {
|
|
7
|
-
cartLines
|
|
6
|
+
export interface Cart<T extends CartLine = CartLine> {
|
|
7
|
+
cartLines?: T[] | null;
|
|
8
8
|
}
|
package/dist/styles.css
CHANGED
|
@@ -359,6 +359,99 @@
|
|
|
359
359
|
color: var(--color-red-300);
|
|
360
360
|
}
|
|
361
361
|
|
|
362
|
+
.icon-button-module-4PDK- {
|
|
363
|
+
all: unset;
|
|
364
|
+
display: flex;
|
|
365
|
+
align-items: center;
|
|
366
|
+
justify-content: center;
|
|
367
|
+
cursor: pointer;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.icon-button-module-4PDK-[data-disabled] {
|
|
371
|
+
cursor: default;
|
|
372
|
+
opacity: 0.4;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/*********************************************************
|
|
376
|
+
*
|
|
377
|
+
* Sizes
|
|
378
|
+
*
|
|
379
|
+
*********************************************************/
|
|
380
|
+
|
|
381
|
+
.icon-button-module-k3s9J svg {
|
|
382
|
+
width: 24px;
|
|
383
|
+
height: 24px;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.icon-button-module-agk6Y svg {
|
|
387
|
+
width: 32px;
|
|
388
|
+
height: 32px;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/*********************************************************
|
|
392
|
+
*
|
|
393
|
+
* Variants
|
|
394
|
+
*
|
|
395
|
+
*********************************************************/
|
|
396
|
+
|
|
397
|
+
.icon-button-module-fTeP4 {
|
|
398
|
+
color: var(--color-brand-black);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.icon-button-module-dM0eo {
|
|
402
|
+
color: var(--color-brand-dark-gray);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.icon-button-module-fTeP4:where([data-hovered]), .icon-button-module-dM0eo:where([data-hovered]) {
|
|
406
|
+
color: var(--color-brand-red);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.icon-button-module-fTeP4:where([data-pressed]), .icon-button-module-dM0eo:where([data-pressed]) {
|
|
410
|
+
color: var(--color-brand-dark-red);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
.favorite-button-module-tXSS3:where(.favorite-button-module-l557q) {
|
|
414
|
+
color: var(--color-brand-red);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.link-button-module-6i75g {
|
|
418
|
+
all: unset;
|
|
419
|
+
position: relative;
|
|
420
|
+
display: inline-flex;
|
|
421
|
+
align-items: center;
|
|
422
|
+
color: var(--color-brand-red);
|
|
423
|
+
cursor: pointer;
|
|
424
|
+
font: inherit;
|
|
425
|
+
font-size: var(--font-size-14);
|
|
426
|
+
gap: var(--space-4);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.link-button-module-6i75g svg {
|
|
430
|
+
display: block;
|
|
431
|
+
width: 12px;
|
|
432
|
+
height: 12px;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.link-button-module-6i75g:where([data-disabled]) {
|
|
436
|
+
cursor: default;
|
|
437
|
+
opacity: 0.4;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.link-button-module-6i75g:where([data-pressed]),
|
|
441
|
+
.link-button-module-6i75g:where([data-hovered]) {
|
|
442
|
+
color: var(--color-brand-dark-red);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.link-button-module-6i75g:where([data-pressed])::after, .link-button-module-6i75g:where([data-hovered])::after {
|
|
446
|
+
position: absolute;
|
|
447
|
+
bottom: 0;
|
|
448
|
+
left: 0;
|
|
449
|
+
width: 100%;
|
|
450
|
+
height: 1px;
|
|
451
|
+
background-color: var(--color-brand-dark-red);
|
|
452
|
+
content: '';
|
|
453
|
+
}
|
|
454
|
+
|
|
362
455
|
.field-error-module-FXnIg {
|
|
363
456
|
color: var(--color-brand-red);
|
|
364
457
|
}
|
|
@@ -492,99 +585,6 @@
|
|
|
492
585
|
width: 28px;
|
|
493
586
|
}
|
|
494
587
|
|
|
495
|
-
.icon-button-module-4PDK- {
|
|
496
|
-
all: unset;
|
|
497
|
-
display: flex;
|
|
498
|
-
align-items: center;
|
|
499
|
-
justify-content: center;
|
|
500
|
-
cursor: pointer;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
.icon-button-module-4PDK-[data-disabled] {
|
|
504
|
-
cursor: default;
|
|
505
|
-
opacity: 0.4;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
/*********************************************************
|
|
509
|
-
*
|
|
510
|
-
* Sizes
|
|
511
|
-
*
|
|
512
|
-
*********************************************************/
|
|
513
|
-
|
|
514
|
-
.icon-button-module-k3s9J svg {
|
|
515
|
-
width: 24px;
|
|
516
|
-
height: 24px;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
.icon-button-module-agk6Y svg {
|
|
520
|
-
width: 32px;
|
|
521
|
-
height: 32px;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
/*********************************************************
|
|
525
|
-
*
|
|
526
|
-
* Variants
|
|
527
|
-
*
|
|
528
|
-
*********************************************************/
|
|
529
|
-
|
|
530
|
-
.icon-button-module-fTeP4 {
|
|
531
|
-
color: var(--color-brand-black);
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
.icon-button-module-dM0eo {
|
|
535
|
-
color: var(--color-brand-dark-gray);
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
.icon-button-module-fTeP4:where([data-hovered]), .icon-button-module-dM0eo:where([data-hovered]) {
|
|
539
|
-
color: var(--color-brand-red);
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
.icon-button-module-fTeP4:where([data-pressed]), .icon-button-module-dM0eo:where([data-pressed]) {
|
|
543
|
-
color: var(--color-brand-dark-red);
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
.favorite-button-module-tXSS3:where(.favorite-button-module-l557q) {
|
|
547
|
-
color: var(--color-brand-red);
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
.link-button-module-6i75g {
|
|
551
|
-
all: unset;
|
|
552
|
-
position: relative;
|
|
553
|
-
display: inline-flex;
|
|
554
|
-
align-items: center;
|
|
555
|
-
color: var(--color-brand-red);
|
|
556
|
-
cursor: pointer;
|
|
557
|
-
font: inherit;
|
|
558
|
-
font-size: var(--font-size-14);
|
|
559
|
-
gap: var(--space-4);
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
.link-button-module-6i75g svg {
|
|
563
|
-
display: block;
|
|
564
|
-
width: 12px;
|
|
565
|
-
height: 12px;
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
.link-button-module-6i75g:where([data-disabled]) {
|
|
569
|
-
cursor: default;
|
|
570
|
-
opacity: 0.4;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
.link-button-module-6i75g:where([data-pressed]),
|
|
574
|
-
.link-button-module-6i75g:where([data-hovered]) {
|
|
575
|
-
color: var(--color-brand-dark-red);
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
.link-button-module-6i75g:where([data-pressed])::after, .link-button-module-6i75g:where([data-hovered])::after {
|
|
579
|
-
position: absolute;
|
|
580
|
-
bottom: 0;
|
|
581
|
-
left: 0;
|
|
582
|
-
width: 100%;
|
|
583
|
-
height: 1px;
|
|
584
|
-
background-color: var(--color-brand-dark-red);
|
|
585
|
-
content: '';
|
|
586
|
-
}
|
|
587
|
-
|
|
588
588
|
.tag-module-B7r15 {
|
|
589
589
|
--tag-bg-color: var(--color-brand-red);
|
|
590
590
|
--tag-fg-color: var(--color-brand-white);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonic-equipment/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -39,29 +39,27 @@
|
|
|
39
39
|
"react-dom": "^18"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@algolia/client-search": "^4.23.3",
|
|
43
|
-
"@algolia/transporter": "^4.23.3",
|
|
44
42
|
"@chromatic-com/storybook": "^1.4.0",
|
|
45
43
|
"@csstools/postcss-global-data": "^2.1.1",
|
|
46
44
|
"@rollup/plugin-alias": "^5.1.0",
|
|
47
|
-
"@rollup/plugin-commonjs": "^25.0.
|
|
45
|
+
"@rollup/plugin-commonjs": "^25.0.8",
|
|
48
46
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
49
47
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
50
|
-
"@storybook/addon-docs": "^8.1.
|
|
51
|
-
"@storybook/addon-essentials": "^8.1.
|
|
52
|
-
"@storybook/addon-interactions": "^8.1.
|
|
53
|
-
"@storybook/addon-links": "^8.1.
|
|
54
|
-
"@storybook/addon-viewport": "^8.1.
|
|
55
|
-
"@storybook/blocks": "^8.1.
|
|
56
|
-
"@storybook/preview-api": "^8.1.
|
|
57
|
-
"@storybook/react": "^8.1.
|
|
58
|
-
"@storybook/react-vite": "^8.1.
|
|
59
|
-
"@storybook/test": "^8.1.
|
|
48
|
+
"@storybook/addon-docs": "^8.1.3",
|
|
49
|
+
"@storybook/addon-essentials": "^8.1.3",
|
|
50
|
+
"@storybook/addon-interactions": "^8.1.3",
|
|
51
|
+
"@storybook/addon-links": "^8.1.3",
|
|
52
|
+
"@storybook/addon-viewport": "^8.1.3",
|
|
53
|
+
"@storybook/blocks": "^8.1.3",
|
|
54
|
+
"@storybook/preview-api": "^8.1.3",
|
|
55
|
+
"@storybook/react": "^8.1.3",
|
|
56
|
+
"@storybook/react-vite": "^8.1.3",
|
|
57
|
+
"@storybook/test": "^8.1.3",
|
|
60
58
|
"@types/react": "^18.3.2",
|
|
61
59
|
"@types/react-dom": "^18.3.0",
|
|
62
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
63
|
-
"@typescript-eslint/parser": "^7.
|
|
64
|
-
"@vitejs/plugin-react": "^4.
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^7.10.0",
|
|
61
|
+
"@typescript-eslint/parser": "^7.10.0",
|
|
62
|
+
"@vitejs/plugin-react": "^4.3.0",
|
|
65
63
|
"autoprefixer": "^10.4.19",
|
|
66
64
|
"concurrently": "^8.2.2",
|
|
67
65
|
"eslint": "^8.57.0",
|
|
@@ -89,11 +87,12 @@
|
|
|
89
87
|
"react": "^18.3.1",
|
|
90
88
|
"react-dom": "^18.3.1",
|
|
91
89
|
"rimraf": "^5.0.7",
|
|
92
|
-
"rollup": "^4.
|
|
93
|
-
"rollup-plugin-dts": "^6.1.
|
|
90
|
+
"rollup": "^4.18.0",
|
|
91
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
94
92
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
95
93
|
"rollup-plugin-postcss": "^4.0.2",
|
|
96
|
-
"
|
|
94
|
+
"rollup-plugin-ts": "^3.4.5",
|
|
95
|
+
"storybook": "^8.1.3",
|
|
97
96
|
"stylelint": "^16.5.0",
|
|
98
97
|
"stylelint-config-css-modules": "^4.4.0",
|
|
99
98
|
"stylelint-config-idiomatic-order": "^10.0.0",
|
|
@@ -103,10 +102,11 @@
|
|
|
103
102
|
"vite-tsconfig-paths": "^4.3.2"
|
|
104
103
|
},
|
|
105
104
|
"dependencies": {
|
|
105
|
+
"@algolia/client-search": "^4.23.3",
|
|
106
106
|
"algoliasearch": "^4.23.3",
|
|
107
107
|
"clsx": "^2.1.1",
|
|
108
|
-
"react-aria-components": "^1.2.
|
|
109
|
-
"react-instantsearch": "^7.
|
|
108
|
+
"react-aria-components": "^1.2.1",
|
|
109
|
+
"react-instantsearch": "^7.9.0"
|
|
110
110
|
},
|
|
111
111
|
"publishConfig": {
|
|
112
112
|
"access": "public"
|