@c2n/stat 0.0.13 → 0.0.15
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/custom-elements.json +1 -1
- package/dist/stat.js +1 -1
- package/package.json +3 -3
- package/react.d.ts +2 -3
- package/types/src/stat.d.ts +7 -0
- package/types/src/stat.d.ts.map +1 -1
package/custom-elements.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"schemaVersion":"1.0.0","readme":"","modules":[{"kind":"javascript-module","path":"src/stat.ts","declarations":[{"kind":"class","description":"A compact KPI block with an optional icon and trend. Text can be supplied through attributes for simple cases or\nreplaced with slots when the value needs richer formatting.","name":"Stat","cssProperties":[{"type":{"text":"padding"},"name":"--c2-stat--padding","default":"16px"},{"type":{"text":"pixel"},"name":"--c2-stat--gap","default":"12px"},{"type":{"text":"color"},"name":"--c2-stat--background","default":"#ffffff"},{"type":{"text":"color"},"name":"--c2-stat--color","default":"#18181b"},{"type":{"text":"border"},"name":"--c2-stat--border","default":"1px solid #e4e4e7"},{"type":{"text":"border-radius"},"name":"--c2-stat--border-radius","default":"8px"},{"type":{"text":"box-shadow"},"name":"--c2-stat--box-shadow","default":"none"},{"type":{"text":"pixel"},"name":"--c2-stat__icon--size","default":"40px"},{"type":{"text":"color"},"name":"--c2-stat__icon--background","default":"#f4f4f5"},{"type":{"text":"color"},"name":"--c2-stat__icon--color","default":"#71717a"},{"type":{"text":"border-radius"},"name":"--c2-stat__icon--border-radius","default":"8px"},{"type":{"text":"color"},"name":"--c2-stat__icon__positive--background","default":"#dcfce7"},{"type":{"text":"color"},"name":"--c2-stat__icon__positive--color","default":"#15803d"},{"type":{"text":"color"},"name":"--c2-stat__icon__negative--background","default":"#fee2e2"},{"type":{"text":"color"},"name":"--c2-stat__icon__negative--color","default":"#b91c1c"},{"type":{"text":"color"},"name":"--c2-stat__icon__warning--background","default":"#fef3c7"},{"type":{"text":"color"},"name":"--c2-stat__icon__warning--color","default":"#a16207"},{"type":{"text":"font-size"},"name":"--c2-stat__value--font-size","default":"24px"},{"type":{"text":"font-weight"},"name":"--c2-stat__value--font-weight","default":"600"},{"type":{"text":"pixel"},"name":"--c2-stat__value--line-height","default":"32px"},{"type":{"text":"font-size"},"name":"--c2-stat__label--font-size","default":"14px"},{"type":{"text":"color"},"name":"--c2-stat__label--color","default":"#71717a"},{"type":{"text":"font-size"},"name":"--c2-stat__description--font-size","default":"12px"},{"type":{"text":"color"},"name":"--c2-stat__description--color","default":"#71717a"}],"cssParts":[{"
|
|
1
|
+
{"schemaVersion":"1.0.0","readme":"","modules":[{"kind":"javascript-module","path":"src/stat.ts","declarations":[{"kind":"class","description":"A compact KPI block with an optional icon and trend. Text can be supplied through attributes for simple cases or\nreplaced with slots when the value needs richer formatting.","name":"Stat","cssProperties":[{"type":{"text":"padding"},"name":"--c2-stat--padding","default":"16px"},{"type":{"text":"pixel"},"name":"--c2-stat--gap","default":"12px"},{"type":{"text":"color"},"name":"--c2-stat--background","default":"#ffffff"},{"type":{"text":"color"},"name":"--c2-stat--color","default":"#18181b"},{"type":{"text":"border"},"name":"--c2-stat--border","default":"1px solid #e4e4e7"},{"type":{"text":"border-radius"},"name":"--c2-stat--border-radius","default":"8px"},{"type":{"text":"box-shadow"},"name":"--c2-stat--box-shadow","default":"none"},{"type":{"text":"pixel"},"name":"--c2-stat__icon--size","default":"40px"},{"type":{"text":"color"},"name":"--c2-stat__icon--background","default":"#f4f4f5"},{"type":{"text":"color"},"name":"--c2-stat__icon--color","default":"#71717a"},{"type":{"text":"border-radius"},"name":"--c2-stat__icon--border-radius","default":"8px"},{"type":{"text":"color"},"name":"--c2-stat__icon__positive--background","default":"#dcfce7"},{"type":{"text":"color"},"name":"--c2-stat__icon__positive--color","default":"#15803d"},{"type":{"text":"color"},"name":"--c2-stat__icon__negative--background","default":"#fee2e2"},{"type":{"text":"color"},"name":"--c2-stat__icon__negative--color","default":"#b91c1c"},{"type":{"text":"color"},"name":"--c2-stat__icon__warning--background","default":"#fef3c7"},{"type":{"text":"color"},"name":"--c2-stat__icon__warning--color","default":"#a16207"},{"type":{"text":"font-size"},"name":"--c2-stat__value--font-size","default":"24px"},{"type":{"text":"font-weight"},"name":"--c2-stat__value--font-weight","default":"600"},{"type":{"text":"pixel"},"name":"--c2-stat__value--line-height","default":"32px"},{"type":{"text":"font-size"},"name":"--c2-stat__label--font-size","default":"14px"},{"type":{"text":"color"},"name":"--c2-stat__label--color","default":"#71717a"},{"type":{"text":"font-size"},"name":"--c2-stat__description--font-size","default":"12px"},{"type":{"text":"color"},"name":"--c2-stat__description--color","default":"#71717a"}],"cssParts":[{"description":"The outer statistic layout container.","name":"container"},{"description":"Container wrapping the assigned leading `icon` slot.","name":"icon"},{"description":"Container wrapping the assigned primary `value` slot.","name":"value"},{"description":"Container wrapping the assigned `trend` slot badge or text.","name":"trend"},{"description":"Container wrapping the assigned statistic `label` slot.","name":"label"},{"description":"Container wrapping the assigned supporting `description` slot.","name":"description"}],"slots":[{"description":"Replaces the `value` text.","name":"value"},{"description":"Replaces the `label` text.","name":"label"},{"description":"Icon shown in the tinted leading container.","name":"icon"},{"description":"Badge or short trend text shown beside the value.","name":"trend"},{"description":"Supporting context below the label.","name":"description"}],"members":[{"kind":"field","name":"value","type":{"text":"string"},"default":"''","description":"Plain-text metric. Use the `value` slot for formatted markup.","attribute":"value"},{"kind":"field","name":"label","type":{"text":"string"},"default":"''","description":"Plain-text label. Use the `label` slot for formatted markup.","attribute":"label"},{"kind":"field","name":"tone","type":{"text":"StatTone"},"default":"'neutral'","description":"Semantic colour applied to the icon container.","attribute":"tone","reflects":true}],"attributes":[{"name":"value","type":{"text":"string"},"default":"''","description":"Plain-text metric. Use the `value` slot for formatted markup.","fieldName":"value"},{"name":"label","type":{"text":"string"},"default":"''","description":"Plain-text label. Use the `label` slot for formatted markup.","fieldName":"label"},{"name":"tone","type":{"text":"StatTone"},"default":"'neutral'","description":"Semantic colour applied to the icon container.","fieldName":"tone"}],"superclass":{"name":"LitElement","package":"lit"},"tagName":"c2-stat","customElement":true}],"exports":[{"kind":"js","name":"Stat","declaration":{"name":"Stat","module":"src/stat.ts"}},{"kind":"custom-element-definition","name":"c2-stat","declaration":{"name":"Stat","module":"src/stat.ts"}}]}]}
|
package/dist/stat.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement, html, unsafeCSS } from "lit";
|
|
2
|
-
import { property } from "lit
|
|
2
|
+
import { property } from "@c2n/core/lit-helper.js";
|
|
3
3
|
import { customElement } from "@c2n/core/element-helper.js";
|
|
4
4
|
//#region src/stat.scss?inline
|
|
5
5
|
var stat_default = "/* ex : var((width: 24px), width, c2-checkbox) returns var(--c2-checkbox-width, 24px) */\n:host {\n display: block;\n}\n\n.c2-stat {\n display: flex;\n align-items: flex-start;\n gap: var(--c2-stat--gap,12px);\n padding: var(--c2-stat--padding,16px);\n color: var(--c2-stat--color,#18181b);\n background: var(--c2-stat--background,#ffffff);\n border: var(--c2-stat--border,1px solid #e4e4e7);\n border-radius: var(--c2-stat--border-radius,8px);\n box-shadow: var(--c2-stat--box-shadow,none);\n}\n\n.icon {\n display: grid;\n width: var(--c2-stat__icon--size,40px);\n height: var(--c2-stat__icon--size,40px);\n flex: 0 0 var(--c2-stat__icon--size,40px);\n place-items: center;\n color: var(--c2-stat__icon--color,#71717a);\n background: var(--c2-stat__icon--background,#f4f4f5);\n border-radius: var(--c2-stat__icon--border-radius,8px);\n}\n.icon ::slotted(*) {\n width: 50%;\n height: 50%;\n}\n\n:host(:not(:has(> [slot=icon]))) .icon,\n:host(:not(:has(> [slot=description]))) .description {\n display: none;\n}\n\n.content {\n min-width: 0;\n margin: 0;\n}\n\n.value-row {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.value,\n.trend,\n.description {\n margin: 0;\n}\n\n.value {\n font-size: var(--c2-stat__value--font-size,24px);\n font-weight: var(--c2-stat__value--font-weight,600);\n line-height: var(--c2-stat__value--line-height,32px);\n}\n\n.label {\n color: var(--c2-stat__label--color,#71717a);\n font-size: var(--c2-stat__label--font-size,14px);\n}\n\n.description {\n margin-top: 4px;\n color: var(--c2-stat__description--color,#71717a);\n font-size: var(--c2-stat__description--font-size,12px);\n}\n\n:host([tone=positive]) .icon {\n color: var(--c2-stat__icon__positive--color,#15803d);\n background: var(--c2-stat__icon__positive--background,#dcfce7);\n}\n\n:host([tone=negative]) .icon {\n color: var(--c2-stat__icon__negative--color,#b91c1c);\n background: var(--c2-stat__icon__negative--background,#fee2e2);\n}\n\n:host([tone=warning]) .icon {\n color: var(--c2-stat__icon__warning--color,#a16207);\n background: var(--c2-stat__icon__warning--background,#fef3c7);\n}";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c2n/stat",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/stat.js",
|
|
6
6
|
"exports": {
|
|
@@ -63,12 +63,12 @@
|
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@c2n/core": "0.0.
|
|
66
|
+
"@c2n/core": "0.0.15",
|
|
67
67
|
"lit": "3.3.3"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@c2n/config": "*"
|
|
71
71
|
},
|
|
72
72
|
"customElements": "custom-elements.json",
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "129a6e537c68c04ed2a36508789bf42c9781e196"
|
|
74
74
|
}
|
package/react.d.ts
CHANGED
|
@@ -9,15 +9,14 @@
|
|
|
9
9
|
//
|
|
10
10
|
// On a server-rendered page (Next.js, React Router SSR) write a camelCase property by its kebab-case attribute
|
|
11
11
|
// name ('row-key', not rowKey): the server emits props verbatim, HTML lowercases them, and hydration does not
|
|
12
|
-
// set properties. Those names are listed next to the properties below.
|
|
12
|
+
// set properties. Those names are listed next to the properties below. Structured converter-backed values
|
|
13
|
+
// also accept their serialized string form, so server JSX can emit the same JSON/CSV attribute used by HTML.
|
|
13
14
|
|
|
14
15
|
import type { DetailedHTMLProps, HTMLAttributes } from 'react'
|
|
15
16
|
import type { Stat } from '@c2n/stat'
|
|
16
17
|
|
|
17
18
|
/** Standard React host-element attributes plus the element's own public properties. */
|
|
18
19
|
type C2Props<T> = DetailedHTMLProps<HTMLAttributes<T>, T> & Partial<Omit<T, keyof HTMLElement>>
|
|
19
|
-
/** What React writes to a custom element's attribute: true becomes the empty string, false removes it. */
|
|
20
|
-
type Attribute = string | number | boolean
|
|
21
20
|
|
|
22
21
|
declare module 'react' {
|
|
23
22
|
namespace JSX {
|
package/types/src/stat.d.ts
CHANGED
|
@@ -10,6 +10,13 @@ export type StatTone = 'neutral' | 'positive' | 'negative' | 'warning';
|
|
|
10
10
|
* @slot icon - Icon shown in the tinted leading container.
|
|
11
11
|
* @slot trend - Badge or short trend text shown beside the value.
|
|
12
12
|
* @slot description - Supporting context below the label.
|
|
13
|
+
* @csspart container - The outer statistic layout container.
|
|
14
|
+
* @csspart icon - Container wrapping the assigned leading `icon` slot.
|
|
15
|
+
* @csspart value - Container wrapping the assigned primary `value` slot.
|
|
16
|
+
* @csspart trend - Container wrapping the assigned `trend` slot badge or text.
|
|
17
|
+
* @csspart label - Container wrapping the assigned statistic `label` slot.
|
|
18
|
+
* @csspart description - Container wrapping the assigned supporting `description` slot.
|
|
19
|
+
*
|
|
13
20
|
* @cssproperty {padding} [--c2-stat--padding=16px]
|
|
14
21
|
* @cssproperty {pixel} [--c2-stat--gap=12px]
|
|
15
22
|
* @cssproperty {color} [--c2-stat--background=#ffffff]
|
package/types/src/stat.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stat.d.ts","sourceRoot":"","sources":["../../src/stat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,KAAK,CAAA;AAKjD,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAA;AAEtE
|
|
1
|
+
{"version":3,"file":"stat.d.ts","sourceRoot":"","sources":["../../src/stat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmB,MAAM,KAAK,CAAA;AAKjD,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAA;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,qBACa,IAAK,SAAQ,UAAU;IAClC,OAAgB,MAAM,0BAAoB;IAE1C,oEAAoE;IACxD,KAAK,SAAK;IAEtB,mEAAmE;IACvD,KAAK,SAAK;IAEtB,qDAAqD;IACxB,IAAI,EAAE,QAAQ,CAAY;IAE9C,MAAM;CAiBhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,IAAI,CAAA;KAChB;CACF"}
|