@propeller-commerce/propeller-v2-react-ui 0.4.6
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/CHANGELOG.md +359 -0
- package/LICENSE +21 -0
- package/MIGRATION.md +217 -0
- package/README.md +668 -0
- package/STYLING.md +145 -0
- package/dist/index.cjs +17345 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +6478 -0
- package/dist/index.d.ts +6478 -0
- package/dist/index.js +17218 -0
- package/dist/index.js.map +1 -0
- package/dist/pure.cjs +974 -0
- package/dist/pure.cjs.map +1 -0
- package/dist/pure.d.cts +556 -0
- package/dist/pure.d.ts +556 -0
- package/dist/pure.js +938 -0
- package/dist/pure.js.map +1 -0
- package/dist/shared.cjs +14 -0
- package/dist/shared.cjs.map +1 -0
- package/dist/shared.d.cts +24 -0
- package/dist/shared.d.ts +24 -0
- package/dist/shared.js +3 -0
- package/dist/shared.js.map +1 -0
- package/dist/styles.css +2 -0
- package/package.json +93 -0
package/STYLING.md
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# Styling propeller-v2-react-ui
|
|
2
|
+
|
|
3
|
+
The package ships a precompiled stylesheet (`dist/styles.css`) that bundles
|
|
4
|
+
every Tailwind utility class its components reference plus the theme
|
|
5
|
+
tokens those utilities resolve against. Consumers import it once:
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
// app/layout.tsx (or your root)
|
|
9
|
+
import 'propeller-v2-react-ui/styles.css';
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
If you don't want default styling at all, skip the import — every
|
|
13
|
+
component will render unstyled (Tailwind classes resolve to nothing) and
|
|
14
|
+
you'll be on your own.
|
|
15
|
+
|
|
16
|
+
## Three override surfaces
|
|
17
|
+
|
|
18
|
+
All three are verified by the boilerplate's e2e suite
|
|
19
|
+
(`e2e/tests/anonymous/styling-overrides.spec.ts`). Pick the one that
|
|
20
|
+
matches the scope of your change.
|
|
21
|
+
|
|
22
|
+
### 1. Theme tokens (most cases)
|
|
23
|
+
|
|
24
|
+
The package's `:root` block declares CSS variables like `--card`,
|
|
25
|
+
`--primary`, `--border`, `--radius-container`, etc. at low specificity.
|
|
26
|
+
A consumer that re-declares the same variable anywhere with equal or
|
|
27
|
+
higher specificity wins, and every utility that resolved against it
|
|
28
|
+
updates instantly.
|
|
29
|
+
|
|
30
|
+
```css
|
|
31
|
+
/* app/globals.css — re-skin the whole package without touching components */
|
|
32
|
+
:root {
|
|
33
|
+
--primary: #ff7043; /* changes bg-primary, text-primary, … */
|
|
34
|
+
--primary-foreground: #ffffff;
|
|
35
|
+
--card: #fafafa;
|
|
36
|
+
--border: #e1e1e1;
|
|
37
|
+
--radius-container: 12px;
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Scope-limited overrides work too:
|
|
42
|
+
|
|
43
|
+
```css
|
|
44
|
+
.brand-x { --primary: #1e88e5; }
|
|
45
|
+
.brand-y { --primary: #43a047; }
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`<div class="brand-x"> <ProductCard ... /> </div>` and the embedded
|
|
49
|
+
`bg-primary`/`text-primary` calls inside the card resolve to blue. Same
|
|
50
|
+
component, different scope, no React re-render needed.
|
|
51
|
+
|
|
52
|
+
Full token list (declared in `src/styles.css`): background, foreground,
|
|
53
|
+
foreground-subtle, card, card-foreground, popover, popover-foreground,
|
|
54
|
+
surface-hover, primary (+fg), secondary (+fg), muted (+fg), accent (+fg),
|
|
55
|
+
destructive (+fg), success (+fg), warning (+fg), border, border-subtle,
|
|
56
|
+
input, ring, radius, radius-control, radius-container.
|
|
57
|
+
|
|
58
|
+
### 2. BEM hooks (component-specific overrides)
|
|
59
|
+
|
|
60
|
+
Every styled element in every component carries a BEM class alongside its
|
|
61
|
+
Tailwind utilities — `.propeller-product-card`, `.propeller-product-card__price`,
|
|
62
|
+
`.propeller-breadcrumbs`, `.propeller-cart-summary`, etc. The package emits
|
|
63
|
+
its utilities inside `@layer utilities`, so any unlayered consumer rule
|
|
64
|
+
that targets a BEM class wins by cascade order regardless of where it
|
|
65
|
+
appears in the stylesheet.
|
|
66
|
+
|
|
67
|
+
```css
|
|
68
|
+
/* app/globals.css — fork-free local edits */
|
|
69
|
+
.propeller-product-card {
|
|
70
|
+
background: #fff8e1;
|
|
71
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.propeller-product-card__price {
|
|
75
|
+
font-weight: 700;
|
|
76
|
+
color: #b45309;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.propeller-breadcrumbs__separator { display: none; }
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The `@layer utilities` vs plain-rule cascade rule is part of the CSS
|
|
83
|
+
spec — no `!important` is required, no escalating specificity, no Tailwind
|
|
84
|
+
prefix gymnastics.
|
|
85
|
+
|
|
86
|
+
A short list of available hooks (grep `propeller-` in the package's
|
|
87
|
+
source for the full set):
|
|
88
|
+
|
|
89
|
+
- `.propeller-product-card`, `.propeller-product-card__{image,badges,title,sku,price,manufacturer,description,labels,label,cta,body,footer,favorite-btn,media,image-placeholder}`
|
|
90
|
+
- `.propeller-cluster-card`, `.propeller-cluster-card__{image,name,sku,price,…}`
|
|
91
|
+
- `.propeller-cart-summary`, `.propeller-cart-icon-and-sidebar__*`
|
|
92
|
+
- `.propeller-breadcrumbs`, `.propeller-breadcrumbs__{item,separator}`
|
|
93
|
+
- `.propeller-add-to-cart`, `.propeller-add-to-favorite`
|
|
94
|
+
- `.propeller-grid-toolbar`, `.propeller-grid-filters`, `.propeller-grid-pagination`
|
|
95
|
+
- `.propeller-order-list`, `.propeller-order-item-card`, `.propeller-order-totals`, `.propeller-order-summary`
|
|
96
|
+
- `.propeller-account-icon-and-menu`, `.propeller-menu`
|
|
97
|
+
- `.propeller-product-tabs`, `.propeller-product-gallery`, `.propeller-product-info`
|
|
98
|
+
|
|
99
|
+
### 3. Per-instance `className`
|
|
100
|
+
|
|
101
|
+
Every component appends `props.className` on its root, so a one-off
|
|
102
|
+
override is a regular prop:
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
<ProductCard
|
|
106
|
+
product={p}
|
|
107
|
+
className="bg-yellow-100 ring-2 ring-yellow-400"
|
|
108
|
+
/>
|
|
109
|
+
|
|
110
|
+
<Breadcrumbs
|
|
111
|
+
categoryPath={[]}
|
|
112
|
+
currentLabel="Home"
|
|
113
|
+
className="text-sm text-muted-foreground"
|
|
114
|
+
/>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Because the consumer's class lands at the end of the className list, the
|
|
118
|
+
last-defined rule wins in the cascade. `props.className` does NOT replace
|
|
119
|
+
the package's base classes — it adds to them. If you need to *strip* a
|
|
120
|
+
default (e.g. remove a built-in border), use the BEM hook approach.
|
|
121
|
+
|
|
122
|
+
## What does NOT work
|
|
123
|
+
|
|
124
|
+
- **No `dangerouslySetInnerHTML` / no replacing internal markup.** The
|
|
125
|
+
compound API (`ProductCard.Image`, `ProductCard.Price`, ...) is the
|
|
126
|
+
supported way to restructure what's rendered. See
|
|
127
|
+
`app/examples/compound-api/page.tsx` in the boilerplate for a worked
|
|
128
|
+
example.
|
|
129
|
+
- **No global `@apply` directives that target package classes from the
|
|
130
|
+
host's Tailwind config.** The package's `bg-card` etc. are not registered
|
|
131
|
+
in your `@apply` resolver — they only exist in `dist/styles.css`. If you
|
|
132
|
+
want a host-side utility, write it as plain CSS targeting the BEM hook.
|
|
133
|
+
- **No theme tokens you didn't declare.** Tailwind v4 utility classes that
|
|
134
|
+
reference tokens absent from the cascade resolve to nothing. The package
|
|
135
|
+
declares the full set listed above; if you want, say, `bg-brand-mint`,
|
|
136
|
+
declare `--color-brand-mint` in your own `@theme` block AND add the same
|
|
137
|
+
utility to your own globals.css scan path.
|
|
138
|
+
|
|
139
|
+
## Tailwind dependency
|
|
140
|
+
|
|
141
|
+
The package's styles compile to vanilla CSS at build time. **Consumers do
|
|
142
|
+
NOT need Tailwind** to use the package — `dist/styles.css` works in any
|
|
143
|
+
project. If you happen to also use Tailwind, importing the package's CSS
|
|
144
|
+
doesn't conflict; your own Tailwind output is a separate stylesheet with
|
|
145
|
+
its own utilities.
|