@sonic-equipment/ui 0.0.8 → 0.0.10
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/README.md +191 -0
- package/dist/{dts → buttons}/button/button.d.ts +1 -4
- package/dist/buttons/button/button.stories.d.ts +18 -0
- package/dist/buttons/favorite/favorite-button.d.ts +5 -0
- package/dist/buttons/favorite/favorite-button.stories.d.ts +17 -0
- package/dist/buttons/icon-button/icon-button.d.ts +7 -0
- package/dist/buttons/icon-button/icon-button.stories.d.ts +17 -0
- package/dist/cards/product-card/product-card.d.ts +9 -0
- package/dist/cards/product-card/product-card.stories.d.ts +13 -0
- package/dist/{base.css → fonts.css} +17 -107
- package/dist/icons/favorite/favorite-filled-icon.d.ts +2 -0
- package/dist/icons/favorite/favorite-outline-icon.d.ts +2 -0
- package/dist/index.d.ts +96 -0
- package/dist/index.js +74 -0
- package/dist/{dts → inputs}/checkbox/checkbox.d.ts +0 -1
- package/dist/inputs/checkbox/checkbox.stories.d.ts +17 -0
- package/dist/{dts/color-filter → product-listing/filters/colors}/color-filter.d.ts +5 -8
- package/dist/product-listing/filters/filter/filter.d.ts +7 -0
- package/dist/{dts/product-listing → product-listing}/product-listing.d.ts +1 -3
- package/dist/product-listing/product-listing.stories.d.ts +16 -0
- package/dist/{dts/product-listing → product-listing}/search-params.d.ts +2 -3
- package/dist/reset.css +0 -3
- package/dist/styles.css +297 -0
- package/package.json +51 -51
- package/dist/app.css +0 -12
- package/dist/dts/button/button.d.ts.map +0 -1
- package/dist/dts/checkbox/checkbox.d.ts.map +0 -1
- package/dist/dts/color-filter/color-filter.d.ts.map +0 -1
- package/dist/dts/filter/filter.d.ts +0 -8
- package/dist/dts/filter/filter.d.ts.map +0 -1
- package/dist/dts/product-card/product-card.d.ts +0 -10
- package/dist/dts/product-card/product-card.d.ts.map +0 -1
- package/dist/dts/product-listing/product-listing.d.ts.map +0 -1
- package/dist/dts/product-listing/search-params.d.ts.map +0 -1
- package/dist/product-card.js +0 -7
package/dist/index.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { Button as Button$1, Checkbox as Checkbox$1 } from 'react-aria-components';
|
|
4
|
+
|
|
5
|
+
var styles$3 = {"button":"button-module-V4meK","md":"button-module-GVTEW","lg":"button-module-nyNY8","solid":"button-module-AjvlY","primary":"button-module-tmyk8","outline":"button-module-vq9GI"};
|
|
6
|
+
|
|
7
|
+
function Button({ children, variant = "solid", size = "md", color = "primary", className, ...props }) {
|
|
8
|
+
return (jsx(Button$1, { ...props, className: clsx(styles$3.button, styles$3[variant], styles$3[size], styles$3[color], className), children: children }));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function FavoriteFilledIcon(props) {
|
|
12
|
+
return (jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...props, children: jsx("path", { d: "M12 22a.667.667 0 0 1-.534-.267L3.227 10.72C2.411 9.599 2 8.46 2 7.327A5.336 5.336 0 0 1 7.333 2c1.892 0 3.669.982 4.667 2.468C12.998 2.982 14.775 2 16.667 2 19.607 2 22 4.39 22 7.327c0 1.133-.411 2.272-1.222 3.387l-8.244 11.019A.667.667 0 0 1 12 22", fill: "currentColor", fillRule: "evenodd" }) }));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function FavoriteOutlinedIcon(props) {
|
|
16
|
+
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", ...props, children: jsx("path", { d: "M7.333 3.33c-2.206 0-4 1.793-4 3.997 0 .857.316 1.71.967 2.604L12 20.223l7.705-10.299c.646-.888.962-1.74.962-2.597a4.003 4.003 0 0 0-4-3.996c-1.813 0-3.545 1.232-4.028 2.865a.666.666 0 0 1-1.278 0C10.878 4.563 9.146 3.33 7.333 3.33M12 22c-.21 0-.408-.1-.534-.267L3.227 10.72C2.411 9.599 2 8.46 2 7.327A5.336 5.336 0 0 1 7.333 2c1.892 0 3.669.982 4.667 2.468C12.998 2.982 14.775 2 16.667 2 19.607 2 22 4.39 22 7.327c0 1.133-.411 2.272-1.222 3.387l-8.245 11.019A.667.667 0 0 1 12 22", fill: "currentColor", fillRule: "evenodd" }) }));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var styles$2 = {"iconButton":"icon-button-module-HJm0i","md":"icon-button-module-k3s9J","lg":"icon-button-module-agk6Y","primary":"icon-button-module-fTeP4","secondary":"icon-button-module-dM0eo"};
|
|
20
|
+
|
|
21
|
+
function IconButton({ size = "md", color = "primary", className, ...props }) {
|
|
22
|
+
return (jsx(Button$1, { ...props, className: clsx(styles$2.iconButton, styles$2[size], styles$2[color], className) }));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var styles$1 = {"isFavorite":"favorite-button-module-6FS3Q"};
|
|
26
|
+
|
|
27
|
+
function FavoriteButton({ isFavorite, onPress }) {
|
|
28
|
+
return (jsx(IconButton, { color: "secondary", onPress: () => onPress(), className: clsx({ [styles$1.isFavorite]: isFavorite }), children: isFavorite ? jsx(FavoriteFilledIcon, {}) : jsx(FavoriteOutlinedIcon, {}) }));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function ProductCard({ product, favoriteButton: FavoriteButton, }) {
|
|
32
|
+
return (jsxs("div", { children: [jsx("div", { children: jsx(FavoriteButton, { productId: product.id }) }), jsx("h2", { children: product.title })] }));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var styles = {"checkbox":"checkbox-module-y3eBg","box":"checkbox-module-TqLux","checkmark":"checkbox-module-Yhrdp"};
|
|
36
|
+
|
|
37
|
+
function Checkbox({ children, ...props }) {
|
|
38
|
+
return (jsxs(Checkbox$1, { ...props, className: styles.checkbox, children: [jsx("div", { className: styles.box, children: jsx("svg", { className: styles.checkmark, viewBox: "0 0 18 18", "aria-hidden": "true", children: jsx("polyline", { points: "1 9 7 14 15 4" }) }) }), children] }));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function Filter({ title, children }) {
|
|
42
|
+
return (jsxs("div", { children: [jsx("div", { children: jsx("h3", { children: title }) }), jsx("div", { children: children })] }));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function ColorFilter({ options, value, onChange }) {
|
|
46
|
+
return (jsx(Filter, { title: "Color", children: jsx("ul", { children: options.map((option) => (jsx("li", { children: jsx(Checkbox, { onChange: (isSelected) => onChange(isSelected
|
|
47
|
+
? [...value, option.value]
|
|
48
|
+
: value.filter((v) => v !== option.value)), value: option.value, isSelected: value.includes(option.value), children: option.label }) }, option.value))) }) }));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function ProductListing({ productCard: ProductCard, products, filters, isLoading = false, activeFilters, onFilterChange, onSortChange, }) {
|
|
52
|
+
return (jsxs("div", { children: [jsx("h1", { children: "Product listing" }), jsxs("aside", { children: [jsx("h2", { children: "Filter" }), jsx("div", { children: jsx(ColorFilter, { options: filters.color.options, value: activeFilters.colors, onChange: (colors) => onFilterChange({ colors }) }) })] }), jsx("main", { children: jsxs("select", { onChange: (e) => onSortChange({ by: e.target.value, direction: "asc" }), children: [jsx("option", { value: "", children: "Sort By" }), jsx("option", { value: "price", children: "Price" }), jsx("option", { value: "title", children: "Title" })] }) }), isLoading ? (jsx("p", { children: "Loading..." })) : (jsx("ul", { children: products.map((product) => (jsx("li", { children: jsx(ProductCard, { product: product }) }, product.id))) }))] }));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function createProductListingSearchParams(state) {
|
|
56
|
+
const params = new URLSearchParams();
|
|
57
|
+
if (state.filters.colors.length > 0) {
|
|
58
|
+
params.set("colors", state.filters.colors.join(","));
|
|
59
|
+
}
|
|
60
|
+
params.set("sortBy", state.sort.by);
|
|
61
|
+
params.set("sortDirection", state.sort.direction);
|
|
62
|
+
return params;
|
|
63
|
+
}
|
|
64
|
+
function parseProductListingSearchParams(params) {
|
|
65
|
+
return {
|
|
66
|
+
filters: { colors: params.get("colors")?.split(",") ?? [] },
|
|
67
|
+
sort: {
|
|
68
|
+
by: params.get("sortBy") ?? "relevance",
|
|
69
|
+
direction: params.get("sortDirection") ?? "asc",
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { Button, Checkbox, FavoriteButton, FavoriteFilledIcon, FavoriteOutlinedIcon, IconButton, ProductCard, ProductListing, createProductListingSearchParams, parseProductListingSearchParams };
|
|
@@ -2,4 +2,3 @@ import { Checkbox as AriaCheckbox } from "react-aria-components";
|
|
|
2
2
|
import { ComponentPropsWithoutRef } from "react";
|
|
3
3
|
export type CheckboxProps = ComponentPropsWithoutRef<typeof AriaCheckbox>;
|
|
4
4
|
export declare function Checkbox({ children, ...props }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react";
|
|
2
|
+
import { Checkbox } from "./checkbox";
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof Checkbox;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
tags: string[];
|
|
10
|
+
args: {
|
|
11
|
+
onChange: import("@storybook/test").Mock<[isSelected: boolean], void>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof Checkbox>;
|
|
16
|
+
export declare const Unchecked: Story;
|
|
17
|
+
export declare const Checked: Story;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { FilterProps } from "../filter/filter";
|
|
2
2
|
export type ColorFilterProps = FilterProps & {
|
|
3
|
-
options:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
];
|
|
3
|
+
options: {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
count: number;
|
|
7
|
+
}[];
|
|
10
8
|
value: string[];
|
|
11
9
|
onChange: (value: string[]) => void;
|
|
12
10
|
};
|
|
13
11
|
export declare function ColorFilter({ options, value, onChange }: ColorFilterProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
//# sourceMappingURL=color-filter.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
|
+
export type FilterProps = PropsWithChildren<{
|
|
3
|
+
title?: string;
|
|
4
|
+
isCollapseable?: boolean;
|
|
5
|
+
initialIsCollapsed?: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
export declare function Filter({ title, children }: FilterProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ComponentType } from "react";
|
|
2
|
-
import { ProductCardProps } from "../product-card/product-card";
|
|
3
2
|
export type Filters = {
|
|
4
3
|
color: {
|
|
5
4
|
options: {
|
|
@@ -17,7 +16,7 @@ export type Sort = {
|
|
|
17
16
|
direction: string;
|
|
18
17
|
};
|
|
19
18
|
export type ProductListingProps = {
|
|
20
|
-
productCard: ComponentType<
|
|
19
|
+
productCard: ComponentType<any>;
|
|
21
20
|
products: {
|
|
22
21
|
id: string;
|
|
23
22
|
title: string;
|
|
@@ -34,4 +33,3 @@ export type ProductListingProps = {
|
|
|
34
33
|
onSortChange: (sort: Sort) => void;
|
|
35
34
|
};
|
|
36
35
|
export declare function ProductListing({ productCard: ProductCard, products, filters, isLoading, activeFilters, onFilterChange, onSortChange, }: ProductListingProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
-
//# sourceMappingURL=product-listing.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
|
2
|
+
import { ProductListing } from "./product-listing";
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof ProductListing;
|
|
6
|
+
tags: string[];
|
|
7
|
+
args: {
|
|
8
|
+
onFilterChange: import("@storybook/test").Mock<[filters: import("./product-listing").ActiveFilters], void>;
|
|
9
|
+
onSortChange: import("@storybook/test").Mock<[sort: import("./product-listing").Sort], void>;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
type Story = StoryObj<typeof ProductListing>;
|
|
14
|
+
export declare const Default: Story;
|
|
15
|
+
export declare const Loading: Story;
|
|
16
|
+
export declare const WithActiveFilters: Story;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function
|
|
1
|
+
export declare function createProductListingSearchParams(state: {
|
|
2
2
|
sort: {
|
|
3
3
|
by: string;
|
|
4
4
|
direction: string;
|
|
@@ -7,7 +7,7 @@ export declare function createSearchParams(state: {
|
|
|
7
7
|
colors: string[];
|
|
8
8
|
};
|
|
9
9
|
}): URLSearchParams;
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function parseProductListingSearchParams(params: URLSearchParams): {
|
|
11
11
|
filters: {
|
|
12
12
|
colors: string[];
|
|
13
13
|
};
|
|
@@ -16,4 +16,3 @@ export declare function parseSearchParams(params: URLSearchParams): {
|
|
|
16
16
|
direction: string;
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
|
-
//# sourceMappingURL=search-params.d.ts.map
|
package/dist/reset.css
CHANGED
|
@@ -306,7 +306,6 @@ menu {
|
|
|
306
306
|
/*
|
|
307
307
|
Reset default styling for dialogs.
|
|
308
308
|
*/
|
|
309
|
-
|
|
310
309
|
dialog {
|
|
311
310
|
padding: 0;
|
|
312
311
|
}
|
|
@@ -347,7 +346,6 @@ button,
|
|
|
347
346
|
/*
|
|
348
347
|
Make sure disabled buttons don't get the pointer cursor.
|
|
349
348
|
*/
|
|
350
|
-
|
|
351
349
|
:disabled {
|
|
352
350
|
cursor: default;
|
|
353
351
|
}
|
|
@@ -381,7 +379,6 @@ video {
|
|
|
381
379
|
}
|
|
382
380
|
|
|
383
381
|
/* Make elements with the HTML hidden attribute stay hidden by default */
|
|
384
|
-
|
|
385
382
|
[hidden] {
|
|
386
383
|
display: none;
|
|
387
384
|
}
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--font-family-sonic: 'Pancetta', sans-serif;
|
|
3
|
+
|
|
4
|
+
--font-size-20: 0.75rem; /* 12px */
|
|
5
|
+
--font-size-24: 0.875rem; /* 14px */
|
|
6
|
+
--font-size-28: 1rem; /* 16px */
|
|
7
|
+
--font-size-32: 1.125rem; /* 18px */
|
|
8
|
+
--font-size-36: 1.25rem; /* 20px */
|
|
9
|
+
--font-size-40: 1.5rem; /* 24px */
|
|
10
|
+
--font-size-48: 1.875rem;/* 30px */
|
|
11
|
+
--font-size-56: 2.25rem; /* 36px */
|
|
12
|
+
--font-size-64: 3rem; /* 48px */
|
|
13
|
+
--font-size-72: 3.75rem; /* 60px */
|
|
14
|
+
--font-size-80: 4.5rem; /* 72px */
|
|
15
|
+
--font-size-96: 6rem; /* 96px */
|
|
16
|
+
--font-size-112: 8rem; /* 128px */
|
|
17
|
+
--font-size-base: var(--font-size-28);
|
|
18
|
+
|
|
19
|
+
--font-weight-thin: 100;
|
|
20
|
+
--font-weight-extralight: 200;
|
|
21
|
+
--font-weight-light: 300;
|
|
22
|
+
--font-weight-normal: 400;
|
|
23
|
+
--font-weight-medium: 500;
|
|
24
|
+
--font-weight-semibold: 600;
|
|
25
|
+
--font-weight-bold: 700;
|
|
26
|
+
--font-weight-extrabold: 800;
|
|
27
|
+
--font-weight-black: 900;
|
|
28
|
+
}
|
|
29
|
+
:root {
|
|
30
|
+
--breakpoint-sm: 640px;
|
|
31
|
+
--breakpoint-md: 768px;
|
|
32
|
+
--breakpoint-lg: 1024px;
|
|
33
|
+
--breakpoint-xl: 1280px;
|
|
34
|
+
--breakpoint-xxl: 1536px;
|
|
35
|
+
}
|
|
36
|
+
:root {
|
|
37
|
+
--space-1: 2px;
|
|
38
|
+
--space-2: 4px;
|
|
39
|
+
--space-3: 6px;
|
|
40
|
+
--space-4: 8px;
|
|
41
|
+
--space-5: 12px;
|
|
42
|
+
--space-6: 16px;
|
|
43
|
+
--space-8: 20px;
|
|
44
|
+
--space-10: 24px;
|
|
45
|
+
--space-12: 28px;
|
|
46
|
+
--space-14: 32px;
|
|
47
|
+
--space-17: 36px;
|
|
48
|
+
--space-20: 40px;
|
|
49
|
+
--space-24: 48px;
|
|
50
|
+
--space-28: 56px;
|
|
51
|
+
--space-32: 64px;
|
|
52
|
+
--space-38: 72px;
|
|
53
|
+
--space-44: 80px;
|
|
54
|
+
--space-52: 96px;
|
|
55
|
+
--space-60: 112px;
|
|
56
|
+
--space-70: 128px;
|
|
57
|
+
--space-80: 144px;
|
|
58
|
+
--space-92: 160px;
|
|
59
|
+
--space-104: 192px;
|
|
60
|
+
--space-120: 224px;
|
|
61
|
+
}
|
|
62
|
+
:root {
|
|
63
|
+
/*********************************************************
|
|
64
|
+
*
|
|
65
|
+
* Global color tokens
|
|
66
|
+
*
|
|
67
|
+
*********************************************************/
|
|
68
|
+
|
|
69
|
+
--color-white: #ffffff;
|
|
70
|
+
|
|
71
|
+
--color-red-50: #fff0f1;
|
|
72
|
+
--color-red-100: #ffdee0;
|
|
73
|
+
--color-red-200: #ffc3c7;
|
|
74
|
+
--color-red-300: #ff999f;
|
|
75
|
+
--color-red-400: #ff5e67;
|
|
76
|
+
--color-red-500: #ff2b37;
|
|
77
|
+
--color-red-600: #f60c1a;
|
|
78
|
+
--color-red-700: #e30613;
|
|
79
|
+
--color-red-800: #ab0913;
|
|
80
|
+
--color-red-900: #8d0f16;
|
|
81
|
+
--color-red-950: #4d0206;
|
|
82
|
+
|
|
83
|
+
--color-gray-100: #ededed;
|
|
84
|
+
--color-gray-500: #bcbcbc;
|
|
85
|
+
--color-gray-900: #6f6f6f;
|
|
86
|
+
|
|
87
|
+
--color-black: #000000;
|
|
88
|
+
|
|
89
|
+
/*********************************************************
|
|
90
|
+
*
|
|
91
|
+
* Alias color tokens
|
|
92
|
+
*
|
|
93
|
+
*********************************************************/
|
|
94
|
+
|
|
95
|
+
--color-brand-black: var(--color-black);
|
|
96
|
+
|
|
97
|
+
--color-brand-red: var(--color-red-700);
|
|
98
|
+
--color-brand-dark-red: var(--color-red-800);
|
|
99
|
+
|
|
100
|
+
--color-brand-light-gray: var(--color-gray-100);
|
|
101
|
+
--color-brand-medium-gray: var(--color-gray-500);
|
|
102
|
+
--color-brand-dark-gray: var(--color-gray-900);
|
|
103
|
+
|
|
104
|
+
--color-focus-ring: var(--color-brand-red);
|
|
105
|
+
}
|
|
106
|
+
:root {
|
|
107
|
+
--border-radius-0: 0px;
|
|
108
|
+
--border-radius-1: 2px;
|
|
109
|
+
--border-radius-2: 4px;
|
|
110
|
+
--border-radius-4: 6px;
|
|
111
|
+
--border-radius-6: 8px;
|
|
112
|
+
--border-radius-8: 12px;
|
|
113
|
+
--border-radius-12: 16px;
|
|
114
|
+
--border-radius-16: 20px;
|
|
115
|
+
--border-radius-20: 22px;
|
|
116
|
+
--border-radius-24: 30px;
|
|
117
|
+
--border-radius-full: 9999px;
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
--border-width-0: 0px;
|
|
122
|
+
--border-width-1: 1px;
|
|
123
|
+
--border-width-2: 2px;
|
|
124
|
+
--border-width-3: 4px;
|
|
125
|
+
}
|
|
126
|
+
.button-module-V4meK {
|
|
127
|
+
display: inline-flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
justify-content: center;
|
|
130
|
+
flex-shrink: 0;
|
|
131
|
+
-webkit-user-select: none;
|
|
132
|
+
-moz-user-select: none;
|
|
133
|
+
user-select: none;
|
|
134
|
+
vertical-align: top;
|
|
135
|
+
text-transform: uppercase;
|
|
136
|
+
font-style: italic;
|
|
137
|
+
font-weight: var(--font-weight-bold);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/*********************************************************
|
|
141
|
+
*
|
|
142
|
+
* Sizes
|
|
143
|
+
*
|
|
144
|
+
*********************************************************/
|
|
145
|
+
|
|
146
|
+
.button-module-GVTEW {
|
|
147
|
+
min-height: 40px;
|
|
148
|
+
border-radius: var(--border-radius-16);
|
|
149
|
+
padding-inline: var(--space-8);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.button-module-nyNY8 {
|
|
153
|
+
min-height: 44px;
|
|
154
|
+
border-radius: var(--border-radius-20);
|
|
155
|
+
padding-inline: var(--space-8);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/*********************************************************
|
|
159
|
+
*
|
|
160
|
+
* Variants
|
|
161
|
+
*
|
|
162
|
+
*********************************************************/
|
|
163
|
+
|
|
164
|
+
/* Primary */
|
|
165
|
+
|
|
166
|
+
.button-module-AjvlY:where(.button-module-tmyk8) {
|
|
167
|
+
background-color: var(--color-brand-red);
|
|
168
|
+
color: var(--color-white);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.button-module-AjvlY:where(.button-module-tmyk8):where([data-hovered]),
|
|
172
|
+
.button-module-AjvlY:where(.button-module-tmyk8):where([data-pressed]) {
|
|
173
|
+
background-color: var(--color-brand-dark-red);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/* Primary */
|
|
177
|
+
|
|
178
|
+
.button-module-vq9GI:where(.button-module-tmyk8) {
|
|
179
|
+
background-color: var(--color-white);
|
|
180
|
+
color: var(--color-black);
|
|
181
|
+
border: 1px solid var(--color-brand-medium-gray);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.button-module-vq9GI:where(.button-module-tmyk8):where([data-hovered]),
|
|
185
|
+
.button-module-vq9GI:where(.button-module-tmyk8):where([data-pressed]) {
|
|
186
|
+
background-color: var(--color-brand-light-gray);
|
|
187
|
+
}
|
|
188
|
+
.icon-button-module-HJm0i {
|
|
189
|
+
display: flex;
|
|
190
|
+
align-items: center;
|
|
191
|
+
justify-content: center;
|
|
192
|
+
cursor: pointer;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/*********************************************************
|
|
196
|
+
*
|
|
197
|
+
* Sizes
|
|
198
|
+
*
|
|
199
|
+
*********************************************************/
|
|
200
|
+
|
|
201
|
+
.icon-button-module-k3s9J svg {
|
|
202
|
+
width: 24px;
|
|
203
|
+
height: 24px;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.icon-button-module-agk6Y svg {
|
|
207
|
+
width: 32px;
|
|
208
|
+
height: 32px;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/*********************************************************
|
|
212
|
+
*
|
|
213
|
+
* Variants
|
|
214
|
+
*
|
|
215
|
+
*********************************************************/
|
|
216
|
+
|
|
217
|
+
.icon-button-module-fTeP4 {
|
|
218
|
+
color: var(--color-brand-black);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.icon-button-module-dM0eo {
|
|
222
|
+
color: var(--color-brand-dark-gray);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.icon-button-module-fTeP4:where([data-hovered]), .icon-button-module-dM0eo:where([data-hovered]) {
|
|
226
|
+
color: var(--color-brand-red);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.icon-button-module-fTeP4:where([data-pressed]), .icon-button-module-dM0eo:where([data-pressed]) {
|
|
230
|
+
color: var(--color-brand-dark-red);
|
|
231
|
+
}
|
|
232
|
+
.favorite-button-module-6FS3Q {
|
|
233
|
+
color: var(--color-brand-red);
|
|
234
|
+
}
|
|
235
|
+
.checkbox-module-y3eBg {
|
|
236
|
+
--selected-color: var(--color-brand-red);
|
|
237
|
+
--selected-color-pressed: var(--color-brand-dark-red);
|
|
238
|
+
--checkmark-color: var(--color-white);
|
|
239
|
+
|
|
240
|
+
display: flex;
|
|
241
|
+
align-items: center;
|
|
242
|
+
gap: 0.571rem;
|
|
243
|
+
font-size: var(--font-size-24);
|
|
244
|
+
line-height: 14px;
|
|
245
|
+
color: var(--color-brand-black);
|
|
246
|
+
forced-color-adjust: none;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.checkbox-module-y3eBg .checkbox-module-TqLux {
|
|
250
|
+
width: 16px;
|
|
251
|
+
height: 16px;
|
|
252
|
+
border: 2px solid var(--color-brand-medium-gray);
|
|
253
|
+
border-radius: var(--border-radius-1);
|
|
254
|
+
transition: all 200ms;
|
|
255
|
+
display: flex;
|
|
256
|
+
align-items: center;
|
|
257
|
+
justify-content: center;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.checkbox-module-y3eBg .checkbox-module-Yhrdp {
|
|
261
|
+
width: 1rem;
|
|
262
|
+
height: 1rem;
|
|
263
|
+
fill: none;
|
|
264
|
+
stroke: var(--checkmark-color);
|
|
265
|
+
stroke-width: 3px;
|
|
266
|
+
stroke-dasharray: 22px;
|
|
267
|
+
stroke-dashoffset: 66;
|
|
268
|
+
transition: all 200ms;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.checkbox-module-y3eBg[data-pressed] .checkbox-module-TqLux {
|
|
272
|
+
border-color: var(--color-brand-dark-gray);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.checkbox-module-y3eBg[data-focus-visible] .checkbox-module-TqLux {
|
|
276
|
+
outline: 2px solid var(--color-focus-ring);
|
|
277
|
+
outline-offset: 2px;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.checkbox-module-y3eBg[data-selected] .checkbox-module-TqLux, .checkbox-module-y3eBg[data-indeterminate] .checkbox-module-TqLux {
|
|
281
|
+
border-color: var(--selected-color);
|
|
282
|
+
background: var(--selected-color);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.checkbox-module-y3eBg[data-selected][data-pressed] .checkbox-module-TqLux, .checkbox-module-y3eBg[data-indeterminate][data-pressed] .checkbox-module-TqLux {
|
|
286
|
+
border-color: var(--selected-color-pressed);
|
|
287
|
+
background: var(--selected-color-pressed);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.checkbox-module-y3eBg[data-selected] .checkbox-module-Yhrdp, .checkbox-module-y3eBg[data-indeterminate] .checkbox-module-Yhrdp {
|
|
291
|
+
stroke-dashoffset: 44;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.checkbox-module-y3eBg[data-indeterminate] .checkbox-module-Yhrdp {
|
|
295
|
+
stroke: none;
|
|
296
|
+
fill: var(--checkmark-color);
|
|
297
|
+
}
|
package/package.json
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonic-equipment/ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"sideEffects": false,
|
|
6
5
|
"license": "MIT",
|
|
7
6
|
"exports": {
|
|
8
7
|
"./reset.css": "./dist/reset.css",
|
|
9
|
-
"./
|
|
10
|
-
"./
|
|
11
|
-
"
|
|
12
|
-
"types": "./
|
|
13
|
-
"default": "./dist/
|
|
14
|
-
}
|
|
15
|
-
"./button.css": "./dist/button.css",
|
|
16
|
-
"./checkbox": {
|
|
17
|
-
"types": "./src/checkbox/checkbox.tsx",
|
|
18
|
-
"default": "./dist/checkbox.js"
|
|
19
|
-
},
|
|
20
|
-
"./checkbox.css": "./dist/checkbox.css",
|
|
21
|
-
"./product-listing": {
|
|
22
|
-
"types": "./src/product-listing/product-listing.tsx",
|
|
23
|
-
"default": "./dist/product-listing.js"
|
|
24
|
-
},
|
|
25
|
-
"./search-params": {
|
|
26
|
-
"types": "./src/product-listing/search-params.ts",
|
|
27
|
-
"default": "./dist/search-params.js"
|
|
28
|
-
},
|
|
29
|
-
"./product-listing.css": "./dist/product-listing.css",
|
|
30
|
-
"./product-card": {
|
|
31
|
-
"types": "./src/product-card/product-card.tsx",
|
|
32
|
-
"default": "./dist/product-card.js"
|
|
33
|
-
},
|
|
34
|
-
"./product-card.css": "./dist/product-card.css"
|
|
8
|
+
"./fonts.css": "./dist/fonts.css",
|
|
9
|
+
"./styles.css": "./dist/styles.css",
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
35
14
|
},
|
|
36
15
|
"files": [
|
|
37
16
|
"dist",
|
|
38
17
|
"README.md"
|
|
39
18
|
],
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"lint": "eslint . --max-warnings 0",
|
|
44
|
-
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"react": "^18.2.0",
|
|
21
|
+
"react-dom": "^18.2.0"
|
|
45
22
|
},
|
|
46
23
|
"devDependencies": {
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
24
|
+
"@chromatic-com/storybook": "^1.2.26",
|
|
25
|
+
"@csstools/postcss-global-data": "^2.1.1",
|
|
26
|
+
"@rollup/plugin-commonjs": "^25.0.7",
|
|
27
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
49
28
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"
|
|
29
|
+
"@storybook/addon-essentials": "^8.0.5",
|
|
30
|
+
"@storybook/addon-interactions": "^8.0.5",
|
|
31
|
+
"@storybook/addon-links": "^8.0.5",
|
|
32
|
+
"@storybook/blocks": "^8.0.5",
|
|
33
|
+
"@storybook/react": "^8.0.5",
|
|
34
|
+
"@storybook/react-vite": "^8.0.5",
|
|
35
|
+
"@storybook/test": "^8.0.5",
|
|
36
|
+
"@types/react": "^18.2.66",
|
|
37
|
+
"@types/react-dom": "^18.2.22",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^7.2.0",
|
|
39
|
+
"@typescript-eslint/parser": "^7.2.0",
|
|
40
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
41
|
+
"autoprefixer": "^10.4.19",
|
|
53
42
|
"eslint": "^8.57.0",
|
|
54
|
-
"
|
|
43
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
44
|
+
"eslint-plugin-react-refresh": "^0.4.6",
|
|
45
|
+
"eslint-plugin-storybook": "^0.8.0",
|
|
46
|
+
"http-server": "^14.1.1",
|
|
47
|
+
"postcss": "^8.4.38",
|
|
55
48
|
"postcss-custom-media": "^10.0.4",
|
|
56
|
-
"postcss-
|
|
57
|
-
"postcss-import": "^16.0.1",
|
|
49
|
+
"postcss-import": "^16.1.0",
|
|
58
50
|
"postcss-nested": "^6.0.1",
|
|
59
|
-
"
|
|
51
|
+
"react": "^18.2.0",
|
|
52
|
+
"react-dom": "^18.2.0",
|
|
53
|
+
"rollup": "^4.14.1",
|
|
54
|
+
"rollup-plugin-dts": "^6.1.0",
|
|
55
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
60
56
|
"rollup-plugin-postcss": "^4.0.2",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
57
|
+
"storybook": "^8.0.5",
|
|
58
|
+
"typescript": "^5.2.2",
|
|
59
|
+
"vite": "^5.2.0"
|
|
64
60
|
},
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"react-
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"clsx": "^2.1.0",
|
|
63
|
+
"react-aria-components": "^1.1.1"
|
|
68
64
|
},
|
|
69
65
|
"publishConfig": {
|
|
70
66
|
"access": "restricted"
|
|
71
67
|
},
|
|
72
|
-
"
|
|
73
|
-
"
|
|
68
|
+
"scripts": {
|
|
69
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
70
|
+
"dev": "storybook dev -p 6006",
|
|
71
|
+
"build": "rollup --config",
|
|
72
|
+
"build-storybook": "storybook build",
|
|
73
|
+
"start": "http-server ./storybook-static"
|
|
74
74
|
}
|
|
75
|
-
}
|
|
75
|
+
}
|
package/dist/app.css
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
html {
|
|
2
|
-
font-family: var(--font-family-sonic);
|
|
3
|
-
font-size: var(--font-size-base);
|
|
4
|
-
-webkit-text-size-adjust: none;
|
|
5
|
-
-moz-text-size-adjust: none;
|
|
6
|
-
text-size-adjust: none;
|
|
7
|
-
|
|
8
|
-
font-synthesis: none;
|
|
9
|
-
text-rendering: optimizeLegibility;
|
|
10
|
-
-webkit-font-smoothing: antialiased;
|
|
11
|
-
-moz-osx-font-smoothing: grayscale;
|
|
12
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/button/button.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAE7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AAGjD,MAAM,MAAM,WAAW,GAAG,wBAAwB,CAAC,OAAO,UAAU,CAAC,GAAG;IACtE,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;IACxC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,YAAY,CAAC;CAC7D,CAAC;AAEF,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,OAAiB,EACjB,IAAW,EACX,KAAiB,EACjB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,WAAW,2CAeb;yBAtBe,MAAM"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/checkbox/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,wBAAwB,EAAa,MAAM,OAAO,CAAC;AAG5D,MAAM,MAAM,aAAa,GAAG,wBAAwB,CAAC,OAAO,YAAY,CAAC,CAAC;AAE1E,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,2CAW7D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"color-filter.d.ts","sourceRoot":"","sources":["../../../src/color-filter/color-filter.tsx"],"names":[],"mappings":"AACA,OAAO,EAAU,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG;IAC3C,OAAO,EAAE;QACP;YACE,KAAK,EAAE,MAAM,CAAC;YACd,KAAK,EAAE,MAAM,CAAC;YACd,KAAK,EAAE,MAAM,CAAC;SACf;KACF,CAAC;IACF,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACrC,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,gBAAgB,2CAwBzE"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
2
|
-
export type FilterProps = PropsWithChildren<{
|
|
3
|
-
title?: string;
|
|
4
|
-
isCollapseable?: boolean;
|
|
5
|
-
initialIsCollapsed?: boolean;
|
|
6
|
-
}>;
|
|
7
|
-
export declare function Filter({ title, children, isCollapseable, initialIsCollapsed, }: FilterProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
//# sourceMappingURL=filter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/filter/filter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,MAAM,WAAW,GAAG,iBAAiB,CAAC;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC,CAAC;AAEH,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,QAAQ,EACR,cAAqB,EACrB,kBAA0B,GAC3B,EAAE,WAAW,2CASb"}
|