@sonic-equipment/ui 0.0.9 → 0.0.11
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 -52
- package/dist/app.css +0 -12
- package/dist/button.css +0 -49
- package/dist/button.js +0 -12
- package/dist/checkbox.css +0 -63
- package/dist/checkbox.js +0 -10
- 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/product-listing.css +0 -63
- package/dist/product-listing.js +0 -25
- package/dist/search-params.ts +0 -20
package/README.md
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# @sonic-equipment/ui
|
|
2
|
+
|
|
3
|
+
`@sonic-equipment/ui` is a private, React component library designed with modularity and reusability in mind.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🔄 **Universally Compatible**: Our components seamlessly integrate across any meta framework, including Next.js, Remix, or Vite React with React Router, ensuring effortless adaptability.
|
|
8
|
+
- 🎨 **Styled with PostCSS:** Leveraging PostCSS modules for scoped and manageable styles and compatibility with React Server Components.
|
|
9
|
+
- 📚 **Documented with Storybook:** Components are documented and showcased using Storybook, with stories co-located alongside components for easy reference.
|
|
10
|
+
- 📦 **Bundled with Rollup:** Efficiently compiled for production with Rollup and published as a private NPM package.
|
|
11
|
+
|
|
12
|
+
## Getting Started
|
|
13
|
+
|
|
14
|
+
### Prerequisites
|
|
15
|
+
|
|
16
|
+
Ensure you have React 18 or newer in your project to use `@sonic-equipment/ui`.
|
|
17
|
+
|
|
18
|
+
### Installation
|
|
19
|
+
|
|
20
|
+
Since `@sonic-equipment/ui` is a private package, ensure you have access to the private npm registry configured in your project. Then, install the library using npm:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npm install @sonic-equipment/ui
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
#### Import styles
|
|
27
|
+
|
|
28
|
+
```css
|
|
29
|
+
@import "@sonic-equipment/ui/reset.css";
|
|
30
|
+
@import "@sonic-equipment/ui/fonts.css";
|
|
31
|
+
@import "@sonic-equipment/ui/styles.css";
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Or within your App.tsx
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import "@sonic-equipment/ui/reset.css";
|
|
38
|
+
import "@sonic-equipment/ui/fonts.css";
|
|
39
|
+
import "@sonic-equipment/ui/styles.css";
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
#### Apply base styles
|
|
43
|
+
|
|
44
|
+
```css
|
|
45
|
+
html {
|
|
46
|
+
font-family: var(--font-family-sonic);
|
|
47
|
+
font-size: var(--font-size-base);
|
|
48
|
+
text-size-adjust: none;
|
|
49
|
+
|
|
50
|
+
font-synthesis: none;
|
|
51
|
+
text-rendering: optimizeLegibility;
|
|
52
|
+
-webkit-font-smoothing: antialiased;
|
|
53
|
+
-moz-osx-font-smoothing: grayscale;
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Usage
|
|
58
|
+
|
|
59
|
+
Import and use a component from the library like so:
|
|
60
|
+
|
|
61
|
+
```jsx
|
|
62
|
+
import { Button } from "@sonic-equipment/ui";
|
|
63
|
+
|
|
64
|
+
const App = () => (
|
|
65
|
+
<Button variant="solid" color="primary">
|
|
66
|
+
Click Me
|
|
67
|
+
</Button>
|
|
68
|
+
);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Styling
|
|
72
|
+
|
|
73
|
+
This library uses PostCSS with modules CSS, allowing you to import styles directly into your React components for scoped styling. The PostCSS configuration includes the following plugins:
|
|
74
|
+
|
|
75
|
+
- **`postcss-import`**: Allows you to use the `@import` statement inside your CSS files, enabling you to split your CSS into smaller, more maintainable pieces. This plugin processes each import, inlining content directly into the CSS file, making it easier to organize and share styles across different files.
|
|
76
|
+
|
|
77
|
+
- **`postcss-nested`**: Enables you to write your CSS in a nested manner, similar to what you might be used to in preprocessors like SCSS or Less. This makes managing complex CSS structures simpler by keeping related rules nested within one another.
|
|
78
|
+
|
|
79
|
+
- **`postcss-custom-media`**: Provides the ability to define custom media query aliases inside your CSS, allowing for more readable and maintainable responsive design. By defining a custom name for media queries, you can reuse them throughout your stylesheets without repeating the conditions.
|
|
80
|
+
|
|
81
|
+
- **`autoprefixer`**: Automatically adds vendor prefixes to CSS rules using values from Can I Use. It ensures your CSS will work with as many browsers as possible by adding necessary prefixes for you, saving time and helping avoid potential errors in manual prefixing.
|
|
82
|
+
|
|
83
|
+
## Design Tokens
|
|
84
|
+
|
|
85
|
+
Design tokens in `@sonic-equipment/ui` serve as the foundational building blocks of our component library's visual design. They encapsulate and centralize the core stylistic attributes such as typography, colors, spacing, and borders, ensuring consistency across the library. Our tokens are organized and imported through `index.css`.
|
|
86
|
+
|
|
87
|
+
### Example: Color Tokens
|
|
88
|
+
|
|
89
|
+
Our color tokens, defined in `colors.css`, offer a wide palette ranging from grayscale to brand-specific hues. These tokens are used to maintain visual harmony and can be applied throughout your project for consistency and easy themeability.
|
|
90
|
+
|
|
91
|
+
```css
|
|
92
|
+
:root {
|
|
93
|
+
/* Global color tokens */
|
|
94
|
+
--color-white: #ffffff;
|
|
95
|
+
--color-black: #000000;
|
|
96
|
+
...
|
|
97
|
+
|
|
98
|
+
/* Brand-specific aliases */
|
|
99
|
+
--color-brand-red: var(--color-red-700);
|
|
100
|
+
--color-brand-dark-red: var(--color-red-800);
|
|
101
|
+
...
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Utilizing Tokens in Components
|
|
106
|
+
|
|
107
|
+
Design tokens are applied directly in our component styles, ensuring consistent look and feel. Here's how a token is used in the styling of our `Button` component:
|
|
108
|
+
|
|
109
|
+
```css
|
|
110
|
+
.solid {
|
|
111
|
+
&:where(.primary) {
|
|
112
|
+
background-color: var(--color-brand-red);
|
|
113
|
+
color: var(--color-white);
|
|
114
|
+
|
|
115
|
+
&:where([data-hovered]),
|
|
116
|
+
&:where([data-pressed]) {
|
|
117
|
+
background-color: var(--color-brand-dark-red);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Customizing Tokens
|
|
124
|
+
|
|
125
|
+
To customize these tokens for your project, override the default values in a global CSS file after importing the library's styles. This allows you to tailor the appearance of `@sonic-equipment/ui` components to fit your brand's identity:
|
|
126
|
+
|
|
127
|
+
```css
|
|
128
|
+
:root {
|
|
129
|
+
--color-brand-red: #ff0000; /* Your brand red */
|
|
130
|
+
--color-brand-dark-red: #cc0000; /* A darker shade of your brand red */
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
This approach ensures that any component from the `@sonic-equipment/ui` library not only adheres to your design system but is also flexible enough to accommodate brand-specific styling.
|
|
135
|
+
|
|
136
|
+
## Getting Started with Development
|
|
137
|
+
|
|
138
|
+
This section provides a step-by-step guide to setting up your development environment for `@sonic-equipment/ui`. Whether you're looking to contribute or simply want to run the library locally for development, follow the instructions below.
|
|
139
|
+
|
|
140
|
+
### Prerequisites
|
|
141
|
+
|
|
142
|
+
Before you begin, ensure you have the following installed on your system:
|
|
143
|
+
|
|
144
|
+
- [Node.js](https://nodejs.org/) (version 14 or newer)
|
|
145
|
+
- [pnpm](https://pnpm.io/) (as this project uses pnpm for dependency management)
|
|
146
|
+
|
|
147
|
+
### Installation
|
|
148
|
+
|
|
149
|
+
Run the following command in the root directory of the project to install the necessary dependencies:
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
pnpm install
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Running Storybook
|
|
156
|
+
|
|
157
|
+
To view and interact with the components in a development environment, this project utilizes Storybook. Run Storybook locally with the following command:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
pnpm dev
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
This will start the Storybook server, typically available at `http://localhost:6006`. You can browse through the component stories and work on components in real-time.
|
|
164
|
+
|
|
165
|
+
### Building the Library
|
|
166
|
+
|
|
167
|
+
The library uses Rollup for bundling, optimized for ESM format. When you're ready to build the library for production:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
pnpm build
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
This command triggers the Rollup build process as configured in the project, compiling your components into the `dist` directory.
|
|
174
|
+
|
|
175
|
+
### Linting
|
|
176
|
+
|
|
177
|
+
To ensure your code follows the project's coding standards and guidelines, run the linter with:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
pnpm lint
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
This will check your code for any stylistic or programming errors and help maintain code quality.
|
|
184
|
+
|
|
185
|
+
## Publishing
|
|
186
|
+
|
|
187
|
+
Publishing is handled via a private npm registry. Ensure you have the necessary permissions and authentication configured before attempting to publish. When ready, run:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
pnpm publish
|
|
191
|
+
```
|
|
@@ -4,9 +4,6 @@ export type ButtonProps = ComponentPropsWithoutRef<typeof AriaButton> & {
|
|
|
4
4
|
variant?: "solid" | "outline" | "ghost";
|
|
5
5
|
size?: "md" | "lg";
|
|
6
6
|
color?: "primary" | "secondary" | "tertiary" | "quaternary";
|
|
7
|
+
withArrow?: boolean;
|
|
7
8
|
};
|
|
8
9
|
export declare function Button({ children, variant, size, color, className, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export declare namespace Button {
|
|
10
|
-
var displayName: string;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react";
|
|
2
|
+
import { Button } from "./button";
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof Button;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
tags: string[];
|
|
10
|
+
args: {
|
|
11
|
+
onPress: import("@storybook/test").Mock<[e: import("react-aria-components").PressEvent], void>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
export declare const Solid: Story;
|
|
17
|
+
export declare const Outlined: Story;
|
|
18
|
+
export declare const Ghost: Story;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
|
2
|
+
import { FavoriteButton } from "./favorite-button";
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof FavoriteButton;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
tags: string[];
|
|
10
|
+
args: {
|
|
11
|
+
onPress: import("@storybook/test").Mock<[], void>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
export declare const InFavorites: Story;
|
|
17
|
+
export declare const NotInFavorites: Story;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import { Button as AriaButton } from "react-aria-components";
|
|
3
|
+
export type IconButtonProps = ComponentPropsWithoutRef<typeof AriaButton> & {
|
|
4
|
+
size?: "md" | "lg";
|
|
5
|
+
color?: "primary" | "secondary";
|
|
6
|
+
};
|
|
7
|
+
export declare function IconButton({ size, color, className, ...props }: IconButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react";
|
|
2
|
+
import { IconButton } from "./icon-button";
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof IconButton;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
tags: string[];
|
|
10
|
+
args: {
|
|
11
|
+
onPress: import("@storybook/test").Mock<[e: import("react-aria-components").PressEvent], void>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
export declare const Primary: Story;
|
|
17
|
+
export declare const Secondary: Story;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentType } from "react";
|
|
2
|
+
export type ProductCardProps = {
|
|
3
|
+
product: {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
};
|
|
7
|
+
favoriteButton: ComponentType<any>;
|
|
8
|
+
};
|
|
9
|
+
export declare function ProductCard({ product, favoriteButton: FavoriteButton, }: ProductCardProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StoryObj } from "@storybook/react";
|
|
2
|
+
import { ProductCard } from "./product-card";
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof ProductCard;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
tags: string[];
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
export declare const Default: Story;
|
|
@@ -1,36 +1,9 @@
|
|
|
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
1
|
/*********************************************************
|
|
30
2
|
*
|
|
31
3
|
* Pancetta
|
|
32
4
|
*
|
|
33
5
|
*********************************************************/
|
|
6
|
+
|
|
34
7
|
@font-face {
|
|
35
8
|
font-display: swap;
|
|
36
9
|
font-family: "Pancetta";
|
|
@@ -39,6 +12,7 @@
|
|
|
39
12
|
font-weight: 100;
|
|
40
13
|
font-style: normal;
|
|
41
14
|
}
|
|
15
|
+
|
|
42
16
|
@font-face {
|
|
43
17
|
font-display: swap;
|
|
44
18
|
font-family: "Pancetta";
|
|
@@ -47,6 +21,7 @@
|
|
|
47
21
|
font-weight: 100;
|
|
48
22
|
font-style: italic;
|
|
49
23
|
}
|
|
24
|
+
|
|
50
25
|
@font-face {
|
|
51
26
|
font-display: swap;
|
|
52
27
|
font-family: "Pancetta";
|
|
@@ -55,6 +30,7 @@
|
|
|
55
30
|
font-weight: 200;
|
|
56
31
|
font-style: normal;
|
|
57
32
|
}
|
|
33
|
+
|
|
58
34
|
@font-face {
|
|
59
35
|
font-display: swap;
|
|
60
36
|
font-family: "Pancetta";
|
|
@@ -63,6 +39,8 @@
|
|
|
63
39
|
font-weight: 200;
|
|
64
40
|
font-style: italic;
|
|
65
41
|
}
|
|
42
|
+
|
|
43
|
+
|
|
66
44
|
@font-face {
|
|
67
45
|
font-display: swap;
|
|
68
46
|
font-family: "Pancetta";
|
|
@@ -71,6 +49,7 @@
|
|
|
71
49
|
font-weight: 300;
|
|
72
50
|
font-style: normal;
|
|
73
51
|
}
|
|
52
|
+
|
|
74
53
|
@font-face {
|
|
75
54
|
font-display: swap;
|
|
76
55
|
font-family: "Pancetta";
|
|
@@ -79,6 +58,7 @@
|
|
|
79
58
|
font-weight: 300;
|
|
80
59
|
font-style: italic;
|
|
81
60
|
}
|
|
61
|
+
|
|
82
62
|
@font-face {
|
|
83
63
|
font-display: swap;
|
|
84
64
|
font-family: "Pancetta";
|
|
@@ -87,6 +67,7 @@
|
|
|
87
67
|
font-weight: 400;
|
|
88
68
|
font-style: normal;
|
|
89
69
|
}
|
|
70
|
+
|
|
90
71
|
@font-face {
|
|
91
72
|
font-display: swap;
|
|
92
73
|
font-family: "Pancetta";
|
|
@@ -95,6 +76,7 @@
|
|
|
95
76
|
font-weight: 400;
|
|
96
77
|
font-style: italic;
|
|
97
78
|
}
|
|
79
|
+
|
|
98
80
|
@font-face {
|
|
99
81
|
font-display: swap;
|
|
100
82
|
font-family: "Pancetta";
|
|
@@ -103,6 +85,7 @@
|
|
|
103
85
|
font-weight: 500;
|
|
104
86
|
font-style: normal;
|
|
105
87
|
}
|
|
88
|
+
|
|
106
89
|
@font-face {
|
|
107
90
|
font-display: swap;
|
|
108
91
|
font-family: "Pancetta";
|
|
@@ -111,6 +94,7 @@
|
|
|
111
94
|
font-weight: 500;
|
|
112
95
|
font-style: italic;
|
|
113
96
|
}
|
|
97
|
+
|
|
114
98
|
@font-face {
|
|
115
99
|
font-display: swap;
|
|
116
100
|
font-family: "Pancetta";
|
|
@@ -119,6 +103,7 @@
|
|
|
119
103
|
font-weight: 600;
|
|
120
104
|
font-style: normal;
|
|
121
105
|
}
|
|
106
|
+
|
|
122
107
|
@font-face {
|
|
123
108
|
font-display: swap;
|
|
124
109
|
font-family: "Pancetta";
|
|
@@ -127,6 +112,7 @@
|
|
|
127
112
|
font-weight: 600;
|
|
128
113
|
font-style: italic;
|
|
129
114
|
}
|
|
115
|
+
|
|
130
116
|
@font-face {
|
|
131
117
|
font-display: swap;
|
|
132
118
|
font-family: "Pancetta";
|
|
@@ -135,6 +121,7 @@
|
|
|
135
121
|
font-weight: 700;
|
|
136
122
|
font-style: normal;
|
|
137
123
|
}
|
|
124
|
+
|
|
138
125
|
@font-face {
|
|
139
126
|
font-display: swap;
|
|
140
127
|
font-family: "Pancetta";
|
|
@@ -143,6 +130,7 @@
|
|
|
143
130
|
font-weight: 700;
|
|
144
131
|
font-style: italic;
|
|
145
132
|
}
|
|
133
|
+
|
|
146
134
|
@font-face {
|
|
147
135
|
font-display: swap;
|
|
148
136
|
font-family: "Pancetta";
|
|
@@ -151,6 +139,7 @@
|
|
|
151
139
|
font-weight: 900;
|
|
152
140
|
font-style: normal;
|
|
153
141
|
}
|
|
142
|
+
|
|
154
143
|
@font-face {
|
|
155
144
|
font-display: swap;
|
|
156
145
|
font-family: "Pancetta";
|
|
@@ -159,82 +148,3 @@
|
|
|
159
148
|
font-weight: 900;
|
|
160
149
|
font-style: italic;
|
|
161
150
|
}
|
|
162
|
-
:root {
|
|
163
|
-
--breakpoint-sm: 640px;
|
|
164
|
-
--breakpoint-md: 768px;
|
|
165
|
-
--breakpoint-lg: 1024px;
|
|
166
|
-
--breakpoint-xl: 1280px;
|
|
167
|
-
--breakpoint-xxl: 1536px;
|
|
168
|
-
}
|
|
169
|
-
:root {
|
|
170
|
-
--space-2: 2px;
|
|
171
|
-
--space-4: 4px;
|
|
172
|
-
--space-6: 6px;
|
|
173
|
-
--space-8: 8px;
|
|
174
|
-
--space-12: 12px;
|
|
175
|
-
--space-16: 16px;
|
|
176
|
-
--space-20: 20px;
|
|
177
|
-
--space-26: 24px;
|
|
178
|
-
--space-28: 28px;
|
|
179
|
-
--space-32: 32px;
|
|
180
|
-
--space-36: 36px;
|
|
181
|
-
--space-40: 40px;
|
|
182
|
-
--space-48: 48px;
|
|
183
|
-
--space-64: 64px;
|
|
184
|
-
--space-80: 80px;
|
|
185
|
-
--space-96: 96px;
|
|
186
|
-
--space-112: 112px;
|
|
187
|
-
--space-128: 128px;
|
|
188
|
-
--space-160: 160px;
|
|
189
|
-
--space-192: 192px;
|
|
190
|
-
--space-224: 224px;
|
|
191
|
-
}
|
|
192
|
-
:root {
|
|
193
|
-
--white: #ffffff;
|
|
194
|
-
--red-50: #fff0f1;
|
|
195
|
-
--red-100: #ffdee0;
|
|
196
|
-
--red-200: #ffc3c7;
|
|
197
|
-
--red-300: #ff999f;
|
|
198
|
-
--red-400: #ff5e67;
|
|
199
|
-
--red-500: #ff2b37;
|
|
200
|
-
--red-600: #f60c1a;
|
|
201
|
-
--red-700: #e30613;
|
|
202
|
-
--red-800: #ab0913;
|
|
203
|
-
--red-900: #8d0f16;
|
|
204
|
-
--red-950: #4d0206;
|
|
205
|
-
|
|
206
|
-
--gray-100: #ededed;
|
|
207
|
-
--gray-500: #bcbcbc;
|
|
208
|
-
--gray-900: #6f6f6f;
|
|
209
|
-
|
|
210
|
-
--black: #000000;
|
|
211
|
-
|
|
212
|
-
--brand-color-black: var(--black);
|
|
213
|
-
|
|
214
|
-
--brand-color-red: var(--red-700);
|
|
215
|
-
--brand-color-dark-red: var(--red-800);
|
|
216
|
-
|
|
217
|
-
--brand-color-light-gray: var(--gray-100);
|
|
218
|
-
--brand-color-medium-gray: var(--gray-500);
|
|
219
|
-
--brand-color-dark-gray: var(--gray-900);
|
|
220
|
-
|
|
221
|
-
--focus-ring-color: var(--brand-color-red);
|
|
222
|
-
}
|
|
223
|
-
:root {
|
|
224
|
-
--border-radius-0: 0px;
|
|
225
|
-
--border-radius-1: 2px;
|
|
226
|
-
--border-radius-2: 4px;
|
|
227
|
-
--border-radius-3: 6px;
|
|
228
|
-
--border-radius-4: 8px;
|
|
229
|
-
--border-radius-5: 12px;
|
|
230
|
-
--border-radius-6: 16px;
|
|
231
|
-
--border-radius-7: 20px;
|
|
232
|
-
--border-radius-8: 22px;
|
|
233
|
-
--border-radius-9: 30px;
|
|
234
|
-
--border-radius-full: 9999px;
|
|
235
|
-
|
|
236
|
-
--border-width-0: 0px;
|
|
237
|
-
--border-width-1: 1px;
|
|
238
|
-
--border-width-2: 2px;
|
|
239
|
-
--border-width-3: 4px;
|
|
240
|
-
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
+
import { Button as Button$1, Checkbox as Checkbox$1 } from 'react-aria-components';
|
|
4
|
+
import { ComponentPropsWithoutRef, ComponentType } from 'react';
|
|
5
|
+
|
|
6
|
+
type ButtonProps = ComponentPropsWithoutRef<typeof Button$1> & {
|
|
7
|
+
variant?: "solid" | "outline" | "ghost";
|
|
8
|
+
size?: "md" | "lg";
|
|
9
|
+
color?: "primary" | "secondary" | "tertiary" | "quaternary";
|
|
10
|
+
withArrow?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare function Button({ children, variant, size, color, className, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
13
|
+
|
|
14
|
+
declare function FavoriteFilledIcon(props: React.SVGProps<SVGSVGElement>): react_jsx_runtime.JSX.Element;
|
|
15
|
+
|
|
16
|
+
declare function FavoriteOutlinedIcon(props: React.SVGProps<SVGSVGElement>): react_jsx_runtime.JSX.Element;
|
|
17
|
+
|
|
18
|
+
type FavoriteButtonProps = {
|
|
19
|
+
isFavorite: boolean;
|
|
20
|
+
onPress: () => void;
|
|
21
|
+
};
|
|
22
|
+
declare function FavoriteButton({ isFavorite, onPress }: FavoriteButtonProps): react_jsx_runtime.JSX.Element;
|
|
23
|
+
|
|
24
|
+
type IconButtonProps = ComponentPropsWithoutRef<typeof Button$1> & {
|
|
25
|
+
size?: "md" | "lg";
|
|
26
|
+
color?: "primary" | "secondary";
|
|
27
|
+
};
|
|
28
|
+
declare function IconButton({ size, color, className, ...props }: IconButtonProps): react_jsx_runtime.JSX.Element;
|
|
29
|
+
|
|
30
|
+
type ProductCardProps = {
|
|
31
|
+
product: {
|
|
32
|
+
id: string;
|
|
33
|
+
title: string;
|
|
34
|
+
};
|
|
35
|
+
favoriteButton: ComponentType<any>;
|
|
36
|
+
};
|
|
37
|
+
declare function ProductCard({ product, favoriteButton: FavoriteButton, }: ProductCardProps): react_jsx_runtime.JSX.Element;
|
|
38
|
+
|
|
39
|
+
type CheckboxProps = ComponentPropsWithoutRef<typeof Checkbox$1>;
|
|
40
|
+
declare function Checkbox({ children, ...props }: CheckboxProps): react_jsx_runtime.JSX.Element;
|
|
41
|
+
|
|
42
|
+
type Filters = {
|
|
43
|
+
color: {
|
|
44
|
+
options: {
|
|
45
|
+
value: string;
|
|
46
|
+
label: string;
|
|
47
|
+
count: number;
|
|
48
|
+
}[];
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
type ActiveFilters = {
|
|
52
|
+
colors: string[];
|
|
53
|
+
};
|
|
54
|
+
type Sort = {
|
|
55
|
+
by: string;
|
|
56
|
+
direction: string;
|
|
57
|
+
};
|
|
58
|
+
type ProductListingProps = {
|
|
59
|
+
productCard: ComponentType<any>;
|
|
60
|
+
products: {
|
|
61
|
+
id: string;
|
|
62
|
+
title: string;
|
|
63
|
+
}[];
|
|
64
|
+
total: number;
|
|
65
|
+
filters: Filters;
|
|
66
|
+
activeFilters: ActiveFilters;
|
|
67
|
+
sort: {
|
|
68
|
+
by: string;
|
|
69
|
+
direction: string;
|
|
70
|
+
};
|
|
71
|
+
isLoading?: boolean;
|
|
72
|
+
onFilterChange: (filters: ActiveFilters) => void;
|
|
73
|
+
onSortChange: (sort: Sort) => void;
|
|
74
|
+
};
|
|
75
|
+
declare function ProductListing({ productCard: ProductCard, products, filters, isLoading, activeFilters, onFilterChange, onSortChange, }: ProductListingProps): react_jsx_runtime.JSX.Element;
|
|
76
|
+
|
|
77
|
+
declare function createProductListingSearchParams(state: {
|
|
78
|
+
sort: {
|
|
79
|
+
by: string;
|
|
80
|
+
direction: string;
|
|
81
|
+
};
|
|
82
|
+
filters: {
|
|
83
|
+
colors: string[];
|
|
84
|
+
};
|
|
85
|
+
}): URLSearchParams;
|
|
86
|
+
declare function parseProductListingSearchParams(params: URLSearchParams): {
|
|
87
|
+
filters: {
|
|
88
|
+
colors: string[];
|
|
89
|
+
};
|
|
90
|
+
sort: {
|
|
91
|
+
by: string;
|
|
92
|
+
direction: string;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export { type ActiveFilters, Button, type ButtonProps, Checkbox, type CheckboxProps, FavoriteButton, type FavoriteButtonProps, FavoriteFilledIcon, FavoriteOutlinedIcon, type Filters, IconButton, type IconButtonProps, ProductCard, type ProductCardProps, ProductListing, type ProductListingProps, type Sort, createProductListingSearchParams, parseProductListingSearchParams };
|