@htmlbricks/hb-dashboard-card1 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.
- package/README.md +170 -23
- package/manifest.json +7 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,45 +1,192 @@
|
|
|
1
|
-
|
|
1
|
+
# `hb-dashboard-card1`
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Package:** `@htmlbricks/hb-dashboard-card1`
|
|
4
|
+
**Category:** data · **Tags:** data, dashboard
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
## Purpose
|
|
6
7
|
|
|
7
|
-
Bulma card
|
|
8
|
+
`hb-dashboard-card1` is a compact **Bulma card** layout for dashboards and admin shells. You configure the **header** (optional Bootstrap Icon, title, optional right-aligned tag) and **body** (optional removal of inner padding) via **JSON strings** on attributes. Use the **`header_content`** and **`content`** slots when you need full control over markup inside the card header and body regions.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
The component applies Bulma’s **light theme** tokens on `:host` and loads **Bootstrap Icons** for the optional header icon (`bi-*` classes).
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
---
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
## Registration and usage
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
Load your built script (or bundle) so the custom element is defined, then use the tag in HTML or in any framework that renders real DOM. Attribute names are **`snake_case`**. From HTML, **structured props are JSON strings** (see [Attributes](#attributes)).
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Custom element
|
|
21
|
+
|
|
22
|
+
| Tag |
|
|
23
|
+
| --- |
|
|
24
|
+
| `hb-dashboard-card1` |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Attributes
|
|
29
|
+
|
|
30
|
+
All reflected / declarative inputs are **strings** at the DOM boundary (HTML `attributes` or `setAttribute`). Pass **objects as JSON**.
|
|
31
|
+
|
|
32
|
+
| Attribute | Required | Description |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| `id` | No | Passed through for identification / testing (host element `id`). |
|
|
35
|
+
| `header` | No | JSON object describing the header row. If omitted, invalid, or empty after parse, the default header chrome still renders but **title and icon stay empty** unless you use the `header_content` slot. |
|
|
36
|
+
| `body` | No | JSON object for body options. If omitted or invalid, defaults to `{ "noborder": false }`. |
|
|
37
|
+
|
|
38
|
+
### `header` JSON shape
|
|
39
|
+
|
|
40
|
+
| Field | Type | Description |
|
|
41
|
+
| --- | --- | --- |
|
|
42
|
+
| `label` | string | Main title text (truncates with ellipsis when space is tight). |
|
|
43
|
+
| `icon` | string | Optional Bootstrap Icons **glyph name only** (no `bi-` prefix), e.g. `"graph-up"`, `"bell"`. |
|
|
44
|
+
| `badge` | string | Optional text for a Bulma **`tag`** on the right (status, delta, count). |
|
|
45
|
+
|
|
46
|
+
Example:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{ "label": "Revenue", "icon": "graph-up", "badge": "+12%" }
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### `body` JSON shape
|
|
53
|
+
|
|
54
|
+
| Field | Type | Description |
|
|
16
55
|
| --- | --- | --- |
|
|
17
|
-
| `
|
|
18
|
-
| `style` | string (optional) | Inline style string. |
|
|
19
|
-
| `header` | object (optional) | JSON `{ icon?: string; label: string; badge?: string }`. |
|
|
20
|
-
| `body` | object (optional) | JSON `{ noborder?: boolean }`. |
|
|
56
|
+
| `noborder` | boolean | When `true`, the main **`card-content`** area uses **no padding** (`p-0`), useful for charts or tables that should bleed to the card edges. |
|
|
21
57
|
|
|
22
|
-
|
|
58
|
+
Example:
|
|
23
59
|
|
|
24
|
-
|
|
60
|
+
```json
|
|
61
|
+
{ "noborder": true }
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Parsing behavior
|
|
65
|
+
|
|
66
|
+
- **`header` and `body`** accept either a **string** (parsed with `JSON.parse`) or an object when set from JavaScript on the custom element’s property layer.
|
|
67
|
+
- **Invalid JSON** or non-object values for `body` fall back to **`{ noborder: false }`**.
|
|
68
|
+
- **Invalid or empty `header` JSON** yields **no parsed header**; the component does not throw.
|
|
69
|
+
|
|
70
|
+
### `style` (TypeScript only)
|
|
71
|
+
|
|
72
|
+
The authoring type `Component` includes an optional **`style`** field for wrappers and tooling. The current Svelte implementation does **not** destructure or apply that prop inside the component; use normal **host** `style` / CSS if you need outer layout tweaks.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Slots
|
|
77
|
+
|
|
78
|
+
Shadow slots let you replace the default fragments Bulma would otherwise own.
|
|
25
79
|
|
|
26
|
-
|
|
80
|
+
| Slot | Default | When you use it |
|
|
81
|
+
| --- | --- | --- |
|
|
82
|
+
| `header_content` | Built-in **`card-header-title`** row: optional icon, `label`, optional `badge`. | Supplying **children with `slot="header_content"` replaces the entire default title row**. Use this for fully custom header markup. |
|
|
83
|
+
| `content` | Empty (reserved for your body markup). | Main **`card-content`** area: charts, tables, metrics, etc. |
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Custom events
|
|
88
|
+
|
|
89
|
+
None. The `Events` contract for this component is **empty**—there are no documented `CustomEvent` outputs from the host.
|
|
27
90
|
|
|
28
|
-
|
|
91
|
+
---
|
|
29
92
|
|
|
30
|
-
|
|
93
|
+
## Styling
|
|
31
94
|
|
|
32
|
-
###
|
|
95
|
+
### Bulma CSS variables (`:host`)
|
|
33
96
|
|
|
34
|
-
|
|
35
|
-
- Use `::part(card)` and related parts for host-level theming inside shadow root.
|
|
36
|
-
- No i18n in `docs.ts`.
|
|
97
|
+
Set **`--bulma-*`** variables on the host or an ancestor; they flow into the shadow tree with this component’s Bulma setup.
|
|
37
98
|
|
|
38
|
-
|
|
99
|
+
| Variable | Role |
|
|
100
|
+
| --- | --- |
|
|
101
|
+
| `--bulma-card-background-color` | Card panel background. |
|
|
102
|
+
| `--bulma-card-shadow` | Elevation / shadow around the card. |
|
|
103
|
+
| `--bulma-card-header-color` | Header title text color. |
|
|
104
|
+
| `--bulma-text-strong` | Strong text context used with header styling. |
|
|
105
|
+
|
|
106
|
+
Defaults and longer descriptions are listed in `extra/docs.ts` (`styleSetup.vars`) for catalog and design tools.
|
|
107
|
+
|
|
108
|
+
### CSS parts
|
|
109
|
+
|
|
110
|
+
| Part | Element | Use |
|
|
111
|
+
| --- | --- | --- |
|
|
112
|
+
| `card` | Root `.card` container | Host-level tweaks to the whole widget (radius, border, background overrides complementary to variables). |
|
|
113
|
+
|
|
114
|
+
### Icons
|
|
115
|
+
|
|
116
|
+
- **In-component icon:** `header.icon` uses classes `bi bi-{icon}`; names match [Bootstrap Icons](https://icons.getbootstrap.com/).
|
|
117
|
+
- **Stylesheets:** Icons are loaded from a CDN in the component (`svelte:head`) and the shared stylesheet also references Bootstrap Icons for consistent font loading—integrators typically do not need to add another icon link unless they strip shadow assets.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Markup structure (Bulma)
|
|
122
|
+
|
|
123
|
+
The implementation uses Bulma **`card`**, **`card-header`**, **`card-header-title`**, **`card-content`**, and **`tag`**. Header layout uses flex helpers so long **labels truncate** and the **badge stays right-aligned**.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Internationalization
|
|
128
|
+
|
|
129
|
+
No built-in i18n strings; all visible text comes from your **`header`** JSON, slot content, or slotted children.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Examples
|
|
134
|
+
|
|
135
|
+
### Minimal header with icon and badge
|
|
39
136
|
|
|
40
137
|
```html
|
|
41
138
|
<hb-dashboard-card1
|
|
42
139
|
header='{"label":"Revenue","icon":"graph-up","badge":"+12%"}'
|
|
43
|
-
body='{"noborder":false}'
|
|
44
140
|
></hb-dashboard-card1>
|
|
45
141
|
```
|
|
142
|
+
|
|
143
|
+
### Title only, padded body
|
|
144
|
+
|
|
145
|
+
```html
|
|
146
|
+
<hb-dashboard-card1 header='{"label":"Active users"}'></hb-dashboard-card1>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Tight body for a chart or table
|
|
150
|
+
|
|
151
|
+
```html
|
|
152
|
+
<hb-dashboard-card1
|
|
153
|
+
header='{"label":"Metrics","icon":"graph-up","badge":"live"}'
|
|
154
|
+
body='{"noborder":true}'
|
|
155
|
+
>
|
|
156
|
+
<div slot="content" style="height: 200px; background: linear-gradient(...)"></div>
|
|
157
|
+
</hb-dashboard-card1>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Custom header via slot
|
|
161
|
+
|
|
162
|
+
Replacing the default row removes the built-in icon/label/badge layout; style slotted nodes from **your** stylesheet (shadow Bulma rules do not target slotted light DOM unless the component exposes `::slotted(...)` rules).
|
|
163
|
+
|
|
164
|
+
```html
|
|
165
|
+
<hb-dashboard-card1 body='{"noborder":true}'>
|
|
166
|
+
<div slot="header_content" style="display:flex;align-items:center;gap:0.5rem;width:100%;">
|
|
167
|
+
<strong>Custom</strong>
|
|
168
|
+
<span style="margin-left:auto;">meta</span>
|
|
169
|
+
</div>
|
|
170
|
+
<p slot="content">Body from slot.</p>
|
|
171
|
+
</hb-dashboard-card1>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### JavaScript: set properties
|
|
175
|
+
|
|
176
|
+
```js
|
|
177
|
+
const el = document.querySelector("hb-dashboard-card1");
|
|
178
|
+
el.header = { label: "Alerts", icon: "bell", badge: "3" };
|
|
179
|
+
el.body = { noborder: false };
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Files in this package (for contributors)
|
|
185
|
+
|
|
186
|
+
| File | Role |
|
|
187
|
+
| --- | --- |
|
|
188
|
+
| `component.wc.svelte` | Custom element implementation |
|
|
189
|
+
| `types/webcomponent.type.d.ts` | `Component` / `Events` authoring types |
|
|
190
|
+
| `extra/docs.ts` | Catalog metadata, CSS vars, parts, slots, Storybook args |
|
|
191
|
+
| `styles/bulma.scss` | Bulma modules + theme on `:host` |
|
|
192
|
+
| `styles/webcomponent.scss` | Layout tweaks, icon import |
|
package/manifest.json
CHANGED
|
@@ -75,19 +75,19 @@
|
|
|
75
75
|
"name": "--bulma-card-background-color",
|
|
76
76
|
"valueType": "color",
|
|
77
77
|
"defaultValue": "#ffffff",
|
|
78
|
-
"description": "
|
|
78
|
+
"description": "Controls the visible card panel background so dashboard widgets match your shell while keeping inner content contrast clear for readers."
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
"name": "--bulma-card-shadow",
|
|
82
82
|
"valueType": "other",
|
|
83
83
|
"defaultValue": "0 0.5em 1em -0.125em rgba(10, 10, 10, 0.1)",
|
|
84
|
-
"description": "
|
|
84
|
+
"description": "Defines the drop shadow around the whole card, letting you tune depth against flat dashboards or dense grids without editing shadow markup."
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
"name": "--bulma-card-header-color",
|
|
88
88
|
"valueType": "color",
|
|
89
89
|
"defaultValue": "#363636",
|
|
90
|
-
"description": "
|
|
90
|
+
"description": "Sets the header title ink color so the metric label stays legible when you customize the card background or embed it on dark sections."
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
93
|
"name": "--bulma-text-strong",
|
|
@@ -97,17 +97,9 @@
|
|
|
97
97
|
}
|
|
98
98
|
],
|
|
99
99
|
"parts": [
|
|
100
|
-
{
|
|
101
|
-
"name": "text_placeholder",
|
|
102
|
-
"description": "Text placeholder css div element part"
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
"name": "badge",
|
|
106
|
-
"description": "badge"
|
|
107
|
-
},
|
|
108
100
|
{
|
|
109
101
|
"name": "card",
|
|
110
|
-
"description": "
|
|
102
|
+
"description": "Root Bulma `card` element; use for elevation, border, or background on the whole widget."
|
|
111
103
|
}
|
|
112
104
|
]
|
|
113
105
|
},
|
|
@@ -115,11 +107,11 @@
|
|
|
115
107
|
"htmlSlots": [
|
|
116
108
|
{
|
|
117
109
|
"name": "header_content",
|
|
118
|
-
"description": "
|
|
110
|
+
"description": "Optional markup between the icon/title row and the end of `card-header` (extra controls or meta)."
|
|
119
111
|
},
|
|
120
112
|
{
|
|
121
113
|
"name": "content",
|
|
122
|
-
"description": "Main card body."
|
|
114
|
+
"description": "Main `card-content` body; replaces or augments the default padded content area."
|
|
123
115
|
}
|
|
124
116
|
],
|
|
125
117
|
"i18n": [],
|
|
@@ -192,5 +184,5 @@
|
|
|
192
184
|
"size": {},
|
|
193
185
|
"iifePath": "main.iife.js",
|
|
194
186
|
"repoName": "@htmlbricks/hb-dashboard-card1",
|
|
195
|
-
"version": "0.71.
|
|
187
|
+
"version": "0.71.37"
|
|
196
188
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@htmlbricks/hb-dashboard-card1",
|
|
3
|
-
"version": "0.71.
|
|
3
|
+
"version": "0.71.37",
|
|
4
4
|
"contributors": [],
|
|
5
5
|
"description": "Bulma card shell for dashboards: JSON `header` supplies optional Bootstrap Icon name, title label, and right-aligned tag; JSON `body` can remove inner padding with `noborder`. Default slots `header_content` and `content` let you inject arbitrary markup between the standard header row and body.",
|
|
6
6
|
"licenses": [
|