@htmlbricks/hb-shop-item-cell 0.71.35 → 0.71.37

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 (3) hide show
  1. package/README.md +135 -27
  2. package/manifest.json +30 -12
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,51 +1,159 @@
1
- ## `hb-shop-item-cell` shop item cell
1
+ # `hb-shop-item-cell` (shop-item-cell)
2
2
 
3
3
  **Category:** commerce
4
- **Tags:** commerce, product
4
+ **Tags:** commerce, product
5
+ **Package:** `@htmlbricks/hb-shop-item-cell`
5
6
 
6
- ### What it does
7
+ ## Overview
7
8
 
8
- Vertical shop product card: top image with optional badge, then the same body as `hb-shop-item-row` (title, subtitle, text, stars, reviews, prices, footer) with **Bulma** `card`, `tag`, `title` / `subtitle`, and matching slots.
9
+ `hb-shop-item-cell` is a vertical **shop product card** web component: a top **image** area with an optional **badge**, then a **Bulma**-styled `card` body (title, subtitle, description, star rating, reviews link, prices) and an optional **footer** row. The content model mirrors **`hb-shop-item-row`** so you can reuse the same attributes and slot names across grid and list layouts.
9
10
 
10
- ### Custom element
11
+ Star icons use **Bootstrap Icons** SVGs embedded in the shadow tree; layout and typography follow **Bulma 1.x** (`card`, `image`, `content`, `title`, `subtitle`, `tag`, flex helpers).
11
12
 
12
- `hb-shop-item-cell`
13
+ ## Custom element
13
14
 
14
- ### Attributes (snake_case; use string values in HTML)
15
+ ```html
16
+ <hb-shop-item-cell …></hb-shop-item-cell>
17
+ ```
18
+
19
+ ## Layout behavior
20
+
21
+ - **Image** — The image block (linked figure + optional badge) renders only when the `img` attribute is non-empty. The image link uses `url` when set; otherwise the anchor has no effective destination (treat empty `url` as “image only”).
22
+ - **Title** — The main title is a link when `url` is provided; same `url` is used for the image link.
23
+ - **Rating row** — The row appears when there is a non-zero **`rating`**, or when **`reviews`** / the **`reviews`** slot supplies content. Star icons render only when **`rating`** is truthy (non-zero in practice). After the stars, the numeric score uses the **`rating`** slot or the `rating` value as text.
24
+ - **Stars** — The component renders **`ratingscale`** star positions (default in examples is `5`; you can use e.g. `10` for a 10-point scale). Values support **fractional** ratings for half-star display.
25
+ - **Reviews** — The text in parentheses is linked with **`reviewsurl`** when that attribute is set.
26
+ - **Prices** — Current **`price`** (bold) and optional struck-through **`regularprice`**; either can be driven by attributes or slots.
27
+ - **Footer** — Optional **`footer`** row at the bottom of the card.
28
+
29
+ ## Attributes
30
+
31
+ Web component **attribute names are `snake_case`**. In HTML, pass **strings** only: use `""` for empty text fields, and encode **numbers** as their string form (e.g. `"4"`, `"5"`).
32
+
33
+ | Attribute | Required | Type / encoding | Description |
34
+ |-----------|----------|-----------------|-------------|
35
+ | `id` | No | string | Optional host id on the root element. |
36
+ | `style` | No | string | Optional inline style string (see component typings). |
37
+ | `img` | Yes* | string | Product image URL. If empty, the image (and image badge) section is omitted. |
38
+ | `url` | Yes* | string | Destination for the image and title links; empty disables a useful `href`. |
39
+ | `badge` | Yes* | string | Short label on the image (rounded tag). Hidden when empty and the `badge` slot is unused. |
40
+ | `title` | Yes* | string | Primary product name (linked with `url`). |
41
+ | `subtitle` | Yes* | string | Muted secondary line under the title. |
42
+ | `text` | Yes* | string | Body / marketing copy in the card content. |
43
+ | `rating` | Yes* | number as string | Score used for stars and numeric display; `0` or empty suppresses the star strip (reviews-only row can still show). |
44
+ | `ratingscale` | Yes* | number as string | Number of star icons (scale length), e.g. `"5"` or `"10"`. |
45
+ | `reviews` | Yes* | string | Text inside the linked parentheses next to the rating row. |
46
+ | `reviewsurl` | Yes* | string | URL for the reviews link. |
47
+ | `price` | Yes* | string | Current or sale price (bold). |
48
+ | `regularprice` | Yes* | string | Compare-at / list price (struck through beside `price`). |
49
+ | `footer` | Yes* | string | Footer strip content below the main card body. |
50
+
51
+ \*The TypeScript `Component` type lists these fields for authoring; in HTML you still pass **strings** (including empty `""` where something is unused).
52
+
53
+ ## Slots
15
54
 
16
- - `id`, `style` (optional): strings.
17
- - `img`, `url`, `badge`, `title`, `subtitle`, `text`, `reviews`, `reviewsurl`, `price`, `regularprice`, `footer` (required in types): strings (use `""` when empty).
18
- - `rating`, `ratingscale` (required): numbers as strings.
55
+ Each named slot falls back to the **same-named attribute** when the slot has no content (see `extra/docs.ts`).
19
56
 
20
- ### Events
57
+ | Slot | Role |
58
+ |------|------|
59
+ | `badge` | Label over the product image; default: `badge`. |
60
+ | `title` | Main product name in the title link; default: `title`. |
61
+ | `subtitle` | Muted line under the title; default: `subtitle`. |
62
+ | `text` | Description in the card body; default: `text`. |
63
+ | `rating` | Text shown after the stars; default: string form of `rating`. |
64
+ | `reviews` | Text inside the parentheses; default: `reviews` (link uses `reviewsurl`). |
65
+ | `price` | Bold current price; default: `price`. |
66
+ | `regularprice` | Struck-through compare price; default: `regularprice`. |
67
+ | `footer` | Full-width footer row; default: `footer`. |
21
68
 
22
- None declared.
69
+ There are no documented **`::part`** hooks for this package (`styleSetup.parts` is empty).
23
70
 
24
- ### Styling (Bulma)
71
+ ## Events
25
72
 
26
- Bundles **Bulma 1.x** (`card`, `image`, `content`, `title`, `tag`, helpers). Set **`--bulma-*`** on the light DOM to match your theme. Star icons still use Bootstrap Icons SVG class names in markup (no icon font required for the default stars).
73
+ No custom events are declared in `types/webcomponent.type.d.ts`.
27
74
 
28
- ### Usage notes
75
+ ## Theming (CSS custom properties)
29
76
 
30
- - **Slots:** `badge`, `title`, `subtitle`, `text`, `rating`, `reviews`, `price`, `footer`, `regularprice`.
31
- - Mirror `hb-shop-item-row` content model for consistent catalog UI.
77
+ The card respects **Bulma CSS variables** on the host page (for example on `body` or `:root`). Typical variables used by this layout are listed in `extra/docs.ts` / `styleSetup`:
32
78
 
33
- ### Minimal HTML example
79
+ | Variable | Role |
80
+ |----------|------|
81
+ | `--bulma-primary` | Accent / interactive emphasis. |
82
+ | `--bulma-card-background-color` | Card shell background (image area, content, footer). |
83
+ | `--bulma-text` | Primary text (titles, body, numeric rating, bold price). |
84
+ | `--bulma-text-weak` | Muted text (subtitle, reviews line, struck price). |
85
+ | `--bulma-border` | Card frame and separators. |
86
+ | `--bulma-radius` | Corner rounding for card and media. |
87
+ | `--bulma-link` | Linked title and reviews link color. |
88
+
89
+ See [Bulma: CSS variables](https://bulma.io/documentation/features/css-variables/) for the full variable system.
90
+
91
+ ## Examples
92
+
93
+ ### Full card (image, badge, rating, sale price, footer)
34
94
 
35
95
  ```html
36
96
  <hb-shop-item-cell
37
- img="https://placehold.co/120"
38
- url="/p/1"
39
- badge=""
40
- title="Product"
41
- subtitle="Short line"
42
- text="Description"
97
+ img="https://placehold.co/320x240/363636/ffffff?text=Product"
98
+ url="https://example.com/p/1"
99
+ badge="New"
100
+ title="Wireless earbuds"
101
+ subtitle="ANC · 32h battery"
102
+ text="Compact charging case and IPX4 splash resistance."
43
103
  rating="4"
44
104
  ratingscale="5"
45
- reviews="12 reviews"
46
- reviewsurl="/p/1#reviews"
47
- price="€19"
105
+ reviews="128 reviews"
106
+ reviewsurl="https://example.com/p/1#reviews"
107
+ price="€79.00"
108
+ regularprice="€99.00"
109
+ footer="Free returns within 30 days"
110
+ ></hb-shop-item-cell>
111
+ ```
112
+
113
+ ### Minimal listing (image, title, price)
114
+
115
+ ```html
116
+ <hb-shop-item-cell
117
+ img="https://placehold.co/320x240/363636/ffffff?text=Product"
118
+ url=""
119
+ badge=""
120
+ title="Mug — ceramic"
121
+ subtitle=""
122
+ text=""
123
+ rating="0"
124
+ ratingscale="5"
125
+ reviews=""
126
+ reviewsurl=""
127
+ price="€14.00"
48
128
  regularprice=""
49
129
  footer=""
50
130
  ></hb-shop-item-cell>
51
131
  ```
132
+
133
+ ### Ten-point rating scale
134
+
135
+ ```html
136
+ <hb-shop-item-cell
137
+ img="https://placehold.co/320x240/363636/ffffff?text=Product"
138
+ url="https://example.com/p/2"
139
+ badge=""
140
+ title="Desk lamp"
141
+ subtitle="LED dimmable"
142
+ text=""
143
+ rating="9"
144
+ ratingscale="10"
145
+ reviews="See all"
146
+ reviewsurl="https://example.com/p/2#reviews"
147
+ price="€45.00"
148
+ regularprice=""
149
+ footer=""
150
+ ></hb-shop-item-cell>
151
+ ```
152
+
153
+ ## Related components
154
+
155
+ Use **`hb-shop-item-row`** when you need the same product fields in a horizontal row layout; attributes and slots are aligned between the two.
156
+
157
+ ## License
158
+
159
+ Package metadata references **Apache-2.0** (see `LICENSE.md` in the published package when consuming from npm).
package/manifest.json CHANGED
@@ -163,19 +163,37 @@
163
163
  "name": "--bulma-card-background-color",
164
164
  "valueType": "color",
165
165
  "defaultValue": "#ffffff",
166
- "description": "Card surface."
166
+ "description": "Background fill for the card shell (image area, content, footer)."
167
167
  },
168
168
  {
169
169
  "name": "--bulma-text",
170
170
  "valueType": "color",
171
171
  "defaultValue": "#363636",
172
- "description": "Body text."
172
+ "description": "Primary text color for titles, body copy, numeric rating, and bold price."
173
173
  },
174
174
  {
175
175
  "name": "--bulma-text-weak",
176
176
  "valueType": "color",
177
177
  "defaultValue": "#7a7a7a",
178
178
  "description": "Subtitle, muted price, reviews link."
179
+ },
180
+ {
181
+ "name": "--bulma-border",
182
+ "valueType": "color",
183
+ "defaultValue": "#dbdbdb",
184
+ "description": "Card frame and image area separators."
185
+ },
186
+ {
187
+ "name": "--bulma-radius",
188
+ "valueType": "number",
189
+ "defaultValue": "0.375rem",
190
+ "description": "Card and image rounding."
191
+ },
192
+ {
193
+ "name": "--bulma-link",
194
+ "valueType": "color",
195
+ "defaultValue": "#485fc7",
196
+ "description": "Linked title and reviews URL color."
179
197
  }
180
198
  ],
181
199
  "parts": []
@@ -184,39 +202,39 @@
184
202
  "htmlSlots": [
185
203
  {
186
204
  "name": "badge",
187
- "description": "badge"
205
+ "description": "Optional label over the product image inside a rounded tag; defaults to the `badge` attribute when the slot is empty."
188
206
  },
189
207
  {
190
208
  "name": "title",
191
- "description": "title"
209
+ "description": "Main product name in the card title link; defaults to the `title` attribute when the slot is empty."
192
210
  },
193
211
  {
194
212
  "name": "subtitle",
195
- "description": "subtitle"
213
+ "description": "Secondary line under the title (muted); defaults to the `subtitle` attribute when the slot is empty."
196
214
  },
197
215
  {
198
216
  "name": "text",
199
- "description": "text"
217
+ "description": "Product description or marketing copy in the card body; defaults to the `text` attribute when the slot is empty."
200
218
  },
201
219
  {
202
220
  "name": "rating",
203
- "description": "rating"
221
+ "description": "Numeric score shown after the star icons when `rating` is set; defaults to the `rating` attribute as plain text."
204
222
  },
205
223
  {
206
224
  "name": "reviews",
207
- "description": "reviews"
225
+ "description": "Review count or label inside the linked parentheses next to stars; defaults to the `reviews` attribute (link uses `reviewsurl`)."
208
226
  },
209
227
  {
210
228
  "name": "price",
211
- "description": "price"
229
+ "description": "Current or sale price (bold, baseline row); defaults to the `price` attribute when the slot is empty."
212
230
  },
213
231
  {
214
232
  "name": "footer",
215
- "description": "footer"
233
+ "description": "Optional full-width card footer row below content; defaults to the `footer` attribute when the slot is empty."
216
234
  },
217
235
  {
218
236
  "name": "regularprice",
219
- "description": "regularprice"
237
+ "description": "List or compare-at price shown struck-through beside `price`; defaults to the `regularprice` attribute when the slot is empty."
220
238
  }
221
239
  ],
222
240
  "i18n": [],
@@ -318,5 +336,5 @@
318
336
  "size": {},
319
337
  "iifePath": "main.iife.js",
320
338
  "repoName": "@htmlbricks/hb-shop-item-cell",
321
- "version": "0.71.35"
339
+ "version": "0.71.37"
322
340
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htmlbricks/hb-shop-item-cell",
3
- "version": "0.71.35",
3
+ "version": "0.71.37",
4
4
  "contributors": [],
5
5
  "description": "Vertical shop product card: top image with optional badge, then the same body as shop-item-row (title, subtitle, text, stars, reviews, prices, footer) with Bootstrap card styling and matching slots.",
6
6
  "licenses": [