@faststore/ui 4.1.0-dev.3 → 4.1.0-dev.5

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.
Files changed (2) hide show
  1. package/README.md +73 -28
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <a href="https://faststore.dev">
2
+ <a href="https://developers.vtex.com/docs/guides/faststore">
3
3
  <img alt="Faststore" src="./static/logo.png" width="60" />
4
4
  </a>
5
5
  </p>
@@ -11,42 +11,87 @@
11
11
  Lightweight ecommerce component library
12
12
  </strong>
13
13
  </p>
14
-
15
- <div style="display: flex; justify-content: center; width: 100%">
16
- <a href="https://www.npmjs.com/package/@faststore/ui" style="padding: 0px 2px 0px 0px">
17
- <img src="https://badge.fury.io/js/%40faststore%2Fui.svg" />
18
- </a>
19
- <a href="https://bundlephobia.com/package/@faststore/ui" style="padding: 0px 2px 0px 2px">
20
- <img src="https://badgen.net/bundlephobia/minzip/@faststore/ui" />
21
- </a>
22
- <a href="https://bundlephobia.com/package/@faststore/ui" style="padding: 0px 2px 0px 2px">
23
- <img src="https://badgen.net/bundlephobia/tree-shaking/@faststore/ui" />
24
- </a>
25
- <a href="https://bundlephobia.com/package/@faststore/ui" style="padding: 0px 0px 0px 2px">
26
- <img src="https://badgen.net/bundlephobia/dependency-count/@faststore/ui" />
14
+ <p align="center">
15
+ <a href="https://www.npmjs.com/package/@faststore/ui">
16
+ <img src="https://badge.fury.io/js/%40faststore%2Fui.svg" alt="npm version" />
27
17
  </a>
28
- </div>
18
+ </p>
19
+
20
+ `@faststore/ui` is the styling layer for FastStore UI components. It re-exports all components from `@faststore/components` and adds two styling layers on top:
21
+
22
+ - **Design tokens** — global CSS custom properties for colors, typography, spacing, borders, and shadows
23
+ - **Structural styles** — minimum SCSS needed for components to function, using data attribute selectors
29
24
 
30
- ## Installation
25
+ Components in this package have no styles by default — all customization happens through the token system.
31
26
 
32
- From the command line in your project directory, run pnpm add `@faststore/ui`.
27
+ ## Package structure
33
28
 
34
- ```cmd
35
- pnpm add @faststore/ui
29
+ ```text
30
+ src/
31
+ ├── components/
32
+ │ ├── atoms/ # SCSS per atom (e.g. Badge/styles.scss, Button/styles.scss)
33
+ │ ├── molecules/ # SCSS per molecule
34
+ │ └── organisms/ # SCSS per organism
35
+ ├── styles/
36
+ │ ├── base/ # Global reset, tokens, typography, layout, utilities
37
+ │ ├── components.scss # Imports all component stylesheets
38
+ │ └── global.scss # Entry point for all styles
39
+ ├── typings/ # Shared TypeScript types
40
+ └── index.ts # Re-exports all components from @faststore/components
36
41
  ```
37
42
 
38
- ## Usage
43
+ ## How to run
44
+
45
+ ### Prerequisites
46
+
47
+ - Node.js ≥ 20
48
+ - pnpm
39
49
 
40
- ```tsx
41
- import React from 'react'
50
+ ### Local setup
42
51
 
43
- import { Button } from '@faststore/ui'
52
+ ```bash
53
+ # 1. Install dependencies (from the repo root)
54
+ pnpm install
44
55
 
45
- function MyComponent {
46
- return <Button variant="primary">Add to Cart</Button>
47
- }
56
+ # 2. Start the build in watch mode
57
+ pnpm dev
48
58
  ```
49
59
 
50
- ## Docs
60
+ For interactive visual testing, use Storybook. Run `pnpm dev` from `packages/storybook/`.
61
+
62
+ ## How to develop
63
+
64
+ ### Adding styles for a new component
65
+
66
+ 1. Create `src/components/{category}/{ComponentName}/styles.scss`
67
+ 2. Use the component's root data attribute as the selector:
68
+ ```scss
69
+ [data-fs-badge] {
70
+ // 1. Define local tokens mapped to global tokens
71
+ --fs-badge-padding: var(--fs-spacing-2);
72
+ --fs-badge-text-color: var(--fs-color-text);
73
+
74
+ // 2. Apply structural styles using local tokens
75
+ color: var(--fs-badge-text-color);
76
+
77
+ // 3. Variant styles using state attributes
78
+ &[data-fs-badge-variant="success"] {
79
+ --fs-badge-text-color: var(--fs-color-success-text);
80
+ }
81
+ }
82
+ ```
83
+ 3. Register the stylesheet in `src/styles/components.scss`:
84
+ ```scss
85
+ @import "../components/atoms/Badge/styles";
86
+ ```
87
+
88
+ > Always map local tokens to global tokens first — this ensures compatibility with theme customization. See [`AGENTS.md`](../../AGENTS.md#step-3-add-styling-faststoreui) for the full styling guidelines.
89
+
90
+ ## How to publish
91
+
92
+ Versioning and publishing are managed at the monorepo root by Lerna. Do not publish this package independently. Refer to the [Contributing guidelines](../../CONTRIBUTING.MD) for the full release workflow.
93
+
94
+ ## Documentation
51
95
 
52
- For more information, please refer to our FastStore UI documentation:https://developers.vtex.com/docs/guides/faststore/components-index
96
+ - **Component reference:** [developers.vtex.com/docs/guides/faststore/components-index](https://developers.vtex.com/docs/guides/faststore/components-index)
97
+ - **Styling guidelines:** [`AGENTS.md`](../../AGENTS.md#step-3-add-styling-faststoreui)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/ui",
3
- "version": "4.1.0-dev.3",
3
+ "version": "4.1.0-dev.5",
4
4
  "description": "A lightweight, framework agnostic component library for React",
5
5
  "author": "emersonlaurentino",
6
6
  "license": "MIT",
@@ -47,7 +47,7 @@
47
47
  }
48
48
  ],
49
49
  "dependencies": {
50
- "@faststore/components": "4.1.0-dev.3",
50
+ "@faststore/components": "4.1.0-dev.5",
51
51
  "include-media": "^2.0.0",
52
52
  "modern-normalize": "^1.1.0",
53
53
  "react-swipeable": "catalog:",
@@ -72,5 +72,5 @@
72
72
  "publishConfig": {
73
73
  "access": "public"
74
74
  },
75
- "gitHead": "83d08ea86efed01d93749e743f5c32172d41a5ab"
75
+ "gitHead": "813003efe6a7eebbdb78fa5f16ccc8923a305e74"
76
76
  }