@molecule/app-kpi-card-solid 0.0.0-stage → 0.0.1-stage

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,264 @@
1
- # Temporary Holding Version
1
+ <!--
2
+ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
+ Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
+ Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
+ To change this document, edit the module-level JSDoc in src/index.ts.
6
+ Generated: 2026-11-18T20:21:34.215Z
7
+ -->
2
8
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
9
+ # @molecule/app-kpi-card-solid
10
+
11
+ Solid KPI / metric card primitives.
12
+
13
+ Exports:
14
+
15
+ - `<KpiCard>` — single metric card. Props: `title`, `value`, `subtitle?`, `icon?`,
16
+ `trend?`, `action?`, `accentSide?` (`'left' | 'top' | 'none'`, default `'none'`),
17
+ `accentColor?` (ClassMap accent color, default the ClassMap's own),
18
+ `upperLabel?`, `emphasizeValue?`, `hoverLift?`, `className?`, `dataMolId?`.
19
+ - `<KpiCardTrend>` — arrow + delta for the `trend` slot. Props: `delta`,
20
+ `direction?` (derived from the sign of `delta` when omitted), `suffix?`
21
+ (default `'%'`), `className?`.
22
+ - `<KpiCardGrid>` — grid container. Props: `columns?` (2–6, default 4),
23
+ `gap?`, `className?`.
24
+ - `KpiTrendDirection`, `KpiCardAccentSide` types.
25
+
26
+ This is the Solid counterpart of `@molecule/app-kpi-card-react`: same
27
+ exports, same props and the same DOM for the same input, so an app switches
28
+ framework by changing only the package name in its imports.
29
+
30
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
31
+ > It is written to be read by coding agents as much as by people, and is generated from this
32
+ > package's source — edit `src/index.ts` JSDoc, not this file.
33
+
34
+ ## Quick Start
35
+
36
+ ```tsx
37
+ import { KpiCard, KpiCardGrid, KpiCardTrend } from '@molecule/app-kpi-card-solid'
38
+
39
+ export function Dashboard() {
40
+ return (
41
+ <KpiCardGrid columns={3}>
42
+ <KpiCard
43
+ title="Monthly Revenue"
44
+ value="$48,200"
45
+ trend={<KpiCardTrend delta={12.4} />}
46
+ accentSide="top"
47
+ upperLabel
48
+ emphasizeValue
49
+ hoverLift
50
+ dataMolId="kpi-revenue"
51
+ />
52
+ </KpiCardGrid>
53
+ )
54
+ }
55
+ ```
56
+
57
+ ## Type
58
+
59
+ `feature`
60
+
61
+ ## Installation
62
+
63
+ ```bash
64
+ npm install @molecule/app-kpi-card-solid @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js
65
+ ```
66
+
67
+ ## API
68
+
69
+ ### Interfaces
70
+
71
+ #### `KpiCardProps`
72
+
73
+ Props for {@link KpiCard}.
74
+
75
+ ```typescript
76
+ interface KpiCardProps {
77
+ /** Label describing the metric (usually `t('...')`). */
78
+ title?: JSX.Element
79
+ /** Large primary value — usually a string or formatted number. */
80
+ value?: JSX.Element
81
+ /** Optional supporting text below the value (e.g. "vs. last week"). */
82
+ subtitle?: JSX.Element
83
+ /** Optional leading icon. */
84
+ icon?: JSX.Element
85
+ /** Optional trend indicator (use `<KpiCardTrend>` for the default shape). */
86
+ trend?: JSX.Element
87
+ /** Optional right-side action (menu, info tooltip). */
88
+ action?: JSX.Element
89
+ /**
90
+ * Where to draw the 4px colored accent bar. Default `'none'`.
91
+ * - `'left'` — left edge (border-l-4) — used by blog, helpdesk-ticketing.
92
+ * - `'top'` — top edge (border-t-4) — used by crm, project-management.
93
+ * - `'none'` — no accent — bare card.
94
+ */
95
+ accentSide?: KpiCardAccentSide
96
+ /**
97
+ * Tailwind class for the accent bar's color, e.g. `'border-primary'` or
98
+ * `'border-success'`. Defaults to the ClassMap's accent color. Ignored when
99
+ * `accentSide === 'none'`.
100
+ */
101
+ accentColor?: string
102
+ /**
103
+ * When `true`, renders the title in 10px-uppercase-tracking-widest style
104
+ * matching the polished pattern. Default `false` keeps the older
105
+ * sentence-case look. Pass `true` for new dashboard call sites.
106
+ */
107
+ upperLabel?: boolean
108
+ /**
109
+ * When `true`, uses `font-extrabold` for the value (matches the polished
110
+ * pattern). Default `false` keeps `font-bold`.
111
+ */
112
+ emphasizeValue?: boolean
113
+ /**
114
+ * When `true`, applies a subtle hover lift. Polished dashboards use this.
115
+ * Default `false`.
116
+ */
117
+ hoverLift?: boolean
118
+ /** Extra classes on the outer Card. */
119
+ className?: string
120
+ /** `data-mol-id` for AI-agent selectors. */
121
+ dataMolId?: string
122
+ }
123
+ ```
124
+
125
+ #### `KpiCardGridProps`
126
+
127
+ Props for {@link KpiCardGrid}.
128
+
129
+ ```typescript
130
+ interface KpiCardGridProps {
131
+ /** KPI cards. */
132
+ children?: JSX.Element
133
+ /** Column count at the md+ breakpoint. 2–6. Defaults to 4. */
134
+ columns?: 2 | 3 | 4 | 5 | 6
135
+ /** Gap between cards. */
136
+ gap?: 'xs' | 'sm' | 'md' | 'lg'
137
+ /** Extra classes. */
138
+ className?: string
139
+ }
140
+ ```
141
+
142
+ #### `KpiCardTrendProps`
143
+
144
+ Props for {@link KpiCardTrend}.
145
+
146
+ ```typescript
147
+ interface KpiCardTrendProps {
148
+ /** Numeric delta to display (e.g. 12.3 for +12.3%). Sign drives direction when `direction` omitted. */
149
+ delta: number
150
+ /**
151
+ * Explicit direction override. When omitted, derived from the sign of `delta`
152
+ * (0 = flat, >0 = up, <0 = down).
153
+ */
154
+ direction?: KpiTrendDirection
155
+ /** Suffix appended to the delta. Defaults to `'%'`. */
156
+ suffix?: string
157
+ /** Extra classes. */
158
+ className?: string
159
+ }
160
+ ```
161
+
162
+ ### Types
163
+
164
+ #### `KpiTrendDirection`
165
+
166
+ Direction of a KPI trend indicator: rising, falling, or unchanged.
167
+
168
+ ```typescript
169
+ type KpiTrendDirection = 'up' | 'down' | 'flat'
170
+ ```
171
+
172
+ #### `KpiCardAccentSide`
173
+
174
+ Where (if anywhere) to draw the colored accent bar.
175
+
176
+ The polished flagship apps use a 4px colored bar — sometimes on the
177
+ left edge (`'left'`), sometimes across the top (`'top'`), and sometimes
178
+ none at all (`'none'`). Default is `'none'` to preserve back-compat for
179
+ call sites that don't pass the prop.
180
+
181
+ ```typescript
182
+ type KpiCardAccentSide = 'left' | 'top' | 'none'
183
+ ```
184
+
185
+ ### Functions
186
+
187
+ #### `KpiCard(props)`
188
+
189
+ Single KPI / metric display card.
190
+
191
+ Layout: `[icon? title action?] [value] [trend? / subtitle?]`.
192
+ Apps use this for dashboard metrics, report summaries, and admin
193
+ overviews.
194
+
195
+ ```typescript
196
+ function KpiCard(props: KpiCardProps): JSX.Element
197
+ ```
198
+
199
+ - `props` — Component props (see {@link KpiCardProps}).
200
+
201
+ **Returns:** The rendered KPI card.
202
+
203
+ #### `KpiCardGrid(props)`
204
+
205
+ Grid for KPI cards — a fixed `columns`-column grid at every viewport
206
+ width (it does not collapse on narrow viewports). Gap and column count
207
+ are tokens resolved against the wired ClassMap.
208
+
209
+ ```typescript
210
+ function KpiCardGrid(props: KpiCardGridProps): JSX.Element
211
+ ```
212
+
213
+ - `props` — Component props (see {@link KpiCardGridProps}).
214
+
215
+ **Returns:** The rendered KPI card grid.
216
+
217
+ #### `KpiCardTrend(props)`
218
+
219
+ Tiny arrow + delta% rendered inside a `<KpiCard>`'s trend slot.
220
+ The `direction` only picks the arrow glyph — no color is applied; pass a
221
+ semantic text color via `className` for red/green deltas.
222
+
223
+ ```typescript
224
+ function KpiCardTrend(props: KpiCardTrendProps): JSX.Element
225
+ ```
226
+
227
+ - `props` — Component props (see {@link KpiCardTrendProps}).
228
+
229
+ **Returns:** The rendered trend indicator.
230
+
231
+ ## Injection Notes
232
+
233
+ ### Requirements
234
+
235
+ Peer dependencies:
236
+
237
+ - `@molecule/app-solid` ^3.5.0
238
+ - `@molecule/app-ui` ^1.3.11
239
+ - `@molecule/app-ui-solid` ^1.1.0
240
+ - `solid-js` ^1.8.0
241
+
242
+ ### Runtime Dependencies
243
+
244
+ - `@molecule/app-solid`
245
+ - `@molecule/app-ui`
246
+ - `@molecule/app-ui-solid`
247
+ - `solid-js`
248
+
249
+ - The accent bar, hover lift, and uppercase-label variants emit ClassMap
250
+ tokens (`cm.kpiCardAccentLeft`, `cm.kpiCardAccentTop`,
251
+ `cm.kpiCardAccentColor`, `cm.kpiCardHoverLift`,
252
+ `cm.kpiCardTitleUppercase`). They only take effect when the app's ClassMap
253
+ bond is Tailwind-based AND the theme defines the `primary` /
254
+ `on-surface-variant` color tokens; under a non-Tailwind ClassMap these props
255
+ are inert.
256
+ - `<KpiCardTrend>` renders only the arrow glyph + number — it does NOT color
257
+ the delta by direction. Pass `className` with a semantic text color (e.g.
258
+ success/error) yourself if you want red/green deltas.
259
+ - `<KpiCardGrid columns={n}>` renders a responsive n-column grid (via
260
+ `cm.grid`): it starts at 1 column on phones and steps up to `n` at larger
261
+ breakpoints, so cards don't overflow on mobile. Override `className` if you
262
+ need a fixed (non-collapsing) grid.
263
+ - `value`/`title` are JSX elements — format numbers and translate labels
264
+ yourself (`t('...')`).
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Solid single KPI / metric display card — the counterpart of
3
+ * `@molecule/app-kpi-card-react`'s `KpiCard`: the same props (React names), the
4
+ * same ClassMap tokens, and the same DOM for the same input.
5
+ *
6
+ * @module
7
+ */
8
+ import { type Component } from 'solid-js';
9
+ import type { KpiCardProps } from './types.js';
10
+ /**
11
+ * Single KPI / metric display card.
12
+ *
13
+ * Layout: `[icon? title action?] [value] [trend? / subtitle?]`.
14
+ * Apps use this for dashboard metrics, report summaries, and admin
15
+ * overviews.
16
+ *
17
+ * @param props - Component props (see {@link KpiCardProps}).
18
+ * @returns The rendered KPI card.
19
+ */
20
+ export declare const KpiCard: Component<KpiCardProps>;
21
+ //# sourceMappingURL=KpiCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KpiCard.d.ts","sourceRoot":"","sources":["../src/KpiCard.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAQ,MAAM,UAAU,CAAA;AAK/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAE9C;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO,EAAE,SAAS,CAAC,YAAY,CA+C3C,CAAA"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Solid single KPI / metric display card — the counterpart of
3
+ * `@molecule/app-kpi-card-react`'s `KpiCard`: the same props (React names), the
4
+ * same ClassMap tokens, and the same DOM for the same input.
5
+ *
6
+ * @module
7
+ */
8
+ import { Show } from 'solid-js';
9
+ import { getClassMap } from '@molecule/app-ui';
10
+ import { Card } from '@molecule/app-ui-solid';
11
+ /**
12
+ * Single KPI / metric display card.
13
+ *
14
+ * Layout: `[icon? title action?] [value] [trend? / subtitle?]`.
15
+ * Apps use this for dashboard metrics, report summaries, and admin
16
+ * overviews.
17
+ *
18
+ * @param props - Component props (see {@link KpiCardProps}).
19
+ * @returns The rendered KPI card.
20
+ */
21
+ export const KpiCard = (props) => {
22
+ const cm = getClassMap();
23
+ const accentSide = () => props.accentSide ?? 'none';
24
+ const accent = () => props.accentColor ?? cm.kpiCardAccentColor;
25
+ const accentClass = () => accentSide() === 'left'
26
+ ? cm.cn(cm.kpiCardAccentLeft, accent())
27
+ : accentSide() === 'top'
28
+ ? cm.cn(cm.kpiCardAccentTop, accent())
29
+ : '';
30
+ const liftClass = () => (props.hoverLift ? cm.kpiCardHoverLift : '');
31
+ const titleClasses = () => props.upperLabel
32
+ ? cm.cn(cm.cn(cm.textSize('xs'), cm.fontWeight('bold'), cm.kpiCardTitleUppercase))
33
+ : cm.cn(cm.textSize('sm'), cm.fontWeight('medium'));
34
+ const valueClasses = () => cm.cn(cm.textSize('3xl'), props.emphasizeValue ? cm.fontWeight('extrabold') : cm.fontWeight('bold'));
35
+ const hasTrendRow = () => Boolean(props.trend || props.subtitle);
36
+ return (<Card className={cm.cn(accentClass(), liftClass(), props.className)} data-mol-id={props.dataMolId}>
37
+ <div class={cm.stack(3)}>
38
+ <div class={cm.flex({ justify: 'between', align: 'center', gap: 'sm' })}>
39
+ <div class={cm.flex({ align: 'center', gap: 'sm' })}>
40
+ {props.icon}
41
+ <span class={titleClasses()}>{props.title}</span>
42
+ </div>
43
+ {props.action}
44
+ </div>
45
+ <div class={valueClasses()}>{props.value}</div>
46
+ <Show when={hasTrendRow()}>
47
+ <div class={cm.flex({ align: 'center', gap: 'sm' })}>
48
+ {props.trend}
49
+ <Show when={props.subtitle}>
50
+ <span class={cm.textSize('sm')}>{props.subtitle}</span>
51
+ </Show>
52
+ </div>
53
+ </Show>
54
+ </div>
55
+ </Card>);
56
+ };
57
+ //# sourceMappingURL=KpiCard.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KpiCard.jsx","sourceRoot":"","sources":["../src/KpiCard.tsx"],"names":[],"mappings":"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"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Solid grid for KPI cards — the counterpart of `@molecule/app-kpi-card-react`'s
3
+ * `KpiCardGrid`: the same props (React names), the same ClassMap tokens, and
4
+ * the same DOM for the same input.
5
+ *
6
+ * @module
7
+ */
8
+ import type { Component } from 'solid-js';
9
+ import type { KpiCardGridProps } from './types.js';
10
+ /**
11
+ * Grid for KPI cards — a fixed `columns`-column grid at every viewport
12
+ * width (it does not collapse on narrow viewports). Gap and column count
13
+ * are tokens resolved against the wired ClassMap.
14
+ *
15
+ * @param props - Component props (see {@link KpiCardGridProps}).
16
+ * @returns The rendered KPI card grid.
17
+ */
18
+ export declare const KpiCardGrid: Component<KpiCardGridProps>;
19
+ //# sourceMappingURL=KpiCardGrid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KpiCardGrid.d.ts","sourceRoot":"","sources":["../src/KpiCardGrid.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAIzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,CAAC,gBAAgB,CAKnD,CAAA"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Solid grid for KPI cards — the counterpart of `@molecule/app-kpi-card-react`'s
3
+ * `KpiCardGrid`: the same props (React names), the same ClassMap tokens, and
4
+ * the same DOM for the same input.
5
+ *
6
+ * @module
7
+ */
8
+ import { getClassMap } from '@molecule/app-ui';
9
+ /**
10
+ * Grid for KPI cards — a fixed `columns`-column grid at every viewport
11
+ * width (it does not collapse on narrow viewports). Gap and column count
12
+ * are tokens resolved against the wired ClassMap.
13
+ *
14
+ * @param props - Component props (see {@link KpiCardGridProps}).
15
+ * @returns The rendered KPI card grid.
16
+ */
17
+ export const KpiCardGrid = (props) => {
18
+ const cm = getClassMap();
19
+ const gridClasses = () => cm.cn(cm.grid({ cols: props.columns ?? 4, gap: props.gap ?? 'md' }), props.className);
20
+ return <div class={gridClasses()}>{props.children}</div>;
21
+ };
22
+ //# sourceMappingURL=KpiCardGrid.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KpiCardGrid.jsx","sourceRoot":"","sources":["../src/KpiCardGrid.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAAgC,CAAC,KAAK,EAAE,EAAE;IAChE,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IACxB,MAAM,WAAW,GAAG,GAAW,EAAE,CAC/B,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,IAAI,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;IACvF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAA;AAC1D,CAAC,CAAA"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Solid arrow + delta trend indicator — the counterpart of
3
+ * `@molecule/app-kpi-card-react`'s `KpiCardTrend`: the same props (React
4
+ * names), the same ClassMap tokens, and the same DOM for the same input.
5
+ *
6
+ * @module
7
+ */
8
+ import type { Component } from 'solid-js';
9
+ import type { KpiCardTrendProps } from './types.js';
10
+ /**
11
+ * Tiny arrow + delta% rendered inside a `<KpiCard>`'s trend slot.
12
+ * The `direction` only picks the arrow glyph — no color is applied; pass a
13
+ * semantic text color via `className` for red/green deltas.
14
+ *
15
+ * @param props - Component props (see {@link KpiCardTrendProps}).
16
+ * @returns The rendered trend indicator.
17
+ */
18
+ export declare const KpiCardTrend: Component<KpiCardTrendProps>;
19
+ //# sourceMappingURL=KpiCardTrend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KpiCardTrend.d.ts","sourceRoot":"","sources":["../src/KpiCardTrend.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAIzC,OAAO,KAAK,EAAE,iBAAiB,EAAqB,MAAM,YAAY,CAAA;AAWtE;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,EAAE,SAAS,CAAC,iBAAiB,CAiBrD,CAAA"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Solid arrow + delta trend indicator — the counterpart of
3
+ * `@molecule/app-kpi-card-react`'s `KpiCardTrend`: the same props (React
4
+ * names), the same ClassMap tokens, and the same DOM for the same input.
5
+ *
6
+ * @module
7
+ */
8
+ import { getClassMap } from '@molecule/app-ui';
9
+ /**
10
+ * The arrow glyph for a direction — no color is applied.
11
+ *
12
+ * @param direction - The trend direction.
13
+ * @returns The arrow character.
14
+ */
15
+ const arrow = (direction) => direction === 'up' ? '▲' : direction === 'down' ? '▼' : '–';
16
+ /**
17
+ * Tiny arrow + delta% rendered inside a `<KpiCard>`'s trend slot.
18
+ * The `direction` only picks the arrow glyph — no color is applied; pass a
19
+ * semantic text color via `className` for red/green deltas.
20
+ *
21
+ * @param props - Component props (see {@link KpiCardTrendProps}).
22
+ * @returns The rendered trend indicator.
23
+ */
24
+ export const KpiCardTrend = (props) => {
25
+ const cm = getClassMap();
26
+ const direction = () => props.direction ?? (props.delta > 0 ? 'up' : props.delta < 0 ? 'down' : 'flat');
27
+ return (<span class={cm.cn(cm.flex({ align: 'center', gap: 'xs' }), cm.textSize('sm'), cm.fontWeight('semibold'), props.className)}>
28
+ <span aria-hidden="true">{arrow(direction())}</span>
29
+ <span>{`${Math.abs(props.delta)}${props.suffix ?? '%'}`}</span>
30
+ </span>);
31
+ };
32
+ //# sourceMappingURL=KpiCardTrend.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KpiCardTrend.jsx","sourceRoot":"","sources":["../src/KpiCardTrend.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAI9C;;;;;GAKG;AACH,MAAM,KAAK,GAAG,CAAC,SAA4B,EAAU,EAAE,CACrD,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;AAE7D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAiC,CAAC,KAAK,EAAE,EAAE;IAClE,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IACxB,MAAM,SAAS,GAAG,GAAsB,EAAE,CACxC,KAAK,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;IACjF,OAAO,CACL,CAAC,IAAI,CACH,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CACV,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,EACvC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EACjB,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EACzB,KAAK,CAAC,SAAS,CAChB,CAAC,CAEF;MAAA,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,IAAI,CACnD;MAAA,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC,EAAE,IAAI,CAChE;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Solid KPI / metric card primitives.
3
+ *
4
+ * Exports:
5
+ * - `<KpiCard>` — single metric card. Props: `title`, `value`, `subtitle?`, `icon?`,
6
+ * `trend?`, `action?`, `accentSide?` (`'left' | 'top' | 'none'`, default `'none'`),
7
+ * `accentColor?` (ClassMap accent color, default the ClassMap's own),
8
+ * `upperLabel?`, `emphasizeValue?`, `hoverLift?`, `className?`, `dataMolId?`.
9
+ * - `<KpiCardTrend>` — arrow + delta for the `trend` slot. Props: `delta`,
10
+ * `direction?` (derived from the sign of `delta` when omitted), `suffix?`
11
+ * (default `'%'`), `className?`.
12
+ * - `<KpiCardGrid>` — grid container. Props: `columns?` (2–6, default 4),
13
+ * `gap?`, `className?`.
14
+ * - `KpiTrendDirection`, `KpiCardAccentSide` types.
15
+ *
16
+ * This is the Solid counterpart of `@molecule/app-kpi-card-react`: same
17
+ * exports, same props and the same DOM for the same input, so an app switches
18
+ * framework by changing only the package name in its imports.
19
+ *
20
+ * @remarks
21
+ * - The accent bar, hover lift, and uppercase-label variants emit ClassMap
22
+ * tokens (`cm.kpiCardAccentLeft`, `cm.kpiCardAccentTop`,
23
+ * `cm.kpiCardAccentColor`, `cm.kpiCardHoverLift`,
24
+ * `cm.kpiCardTitleUppercase`). They only take effect when the app's ClassMap
25
+ * bond is Tailwind-based AND the theme defines the `primary` /
26
+ * `on-surface-variant` color tokens; under a non-Tailwind ClassMap these props
27
+ * are inert.
28
+ * - `<KpiCardTrend>` renders only the arrow glyph + number — it does NOT color
29
+ * the delta by direction. Pass `className` with a semantic text color (e.g.
30
+ * success/error) yourself if you want red/green deltas.
31
+ * - `<KpiCardGrid columns={n}>` renders a responsive n-column grid (via
32
+ * `cm.grid`): it starts at 1 column on phones and steps up to `n` at larger
33
+ * breakpoints, so cards don't overflow on mobile. Override `className` if you
34
+ * need a fixed (non-collapsing) grid.
35
+ * - `value`/`title` are JSX elements — format numbers and translate labels
36
+ * yourself (`t('...')`).
37
+ *
38
+ * @example
39
+ * ```tsx
40
+ * import { KpiCard, KpiCardGrid, KpiCardTrend } from '@molecule/app-kpi-card-solid'
41
+ *
42
+ * export function Dashboard() {
43
+ * return (
44
+ * <KpiCardGrid columns={3}>
45
+ * <KpiCard
46
+ * title="Monthly Revenue"
47
+ * value="$48,200"
48
+ * trend={<KpiCardTrend delta={12.4} />}
49
+ * accentSide="top"
50
+ * upperLabel
51
+ * emphasizeValue
52
+ * hoverLift
53
+ * dataMolId="kpi-revenue"
54
+ * />
55
+ * </KpiCardGrid>
56
+ * )
57
+ * }
58
+ * ```
59
+ *
60
+ * @module
61
+ */
62
+ export * from './KpiCard.jsx';
63
+ export * from './KpiCardGrid.jsx';
64
+ export * from './KpiCardTrend.jsx';
65
+ export * from './types.js';
66
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Solid KPI / metric card primitives.
3
+ *
4
+ * Exports:
5
+ * - `<KpiCard>` — single metric card. Props: `title`, `value`, `subtitle?`, `icon?`,
6
+ * `trend?`, `action?`, `accentSide?` (`'left' | 'top' | 'none'`, default `'none'`),
7
+ * `accentColor?` (ClassMap accent color, default the ClassMap's own),
8
+ * `upperLabel?`, `emphasizeValue?`, `hoverLift?`, `className?`, `dataMolId?`.
9
+ * - `<KpiCardTrend>` — arrow + delta for the `trend` slot. Props: `delta`,
10
+ * `direction?` (derived from the sign of `delta` when omitted), `suffix?`
11
+ * (default `'%'`), `className?`.
12
+ * - `<KpiCardGrid>` — grid container. Props: `columns?` (2–6, default 4),
13
+ * `gap?`, `className?`.
14
+ * - `KpiTrendDirection`, `KpiCardAccentSide` types.
15
+ *
16
+ * This is the Solid counterpart of `@molecule/app-kpi-card-react`: same
17
+ * exports, same props and the same DOM for the same input, so an app switches
18
+ * framework by changing only the package name in its imports.
19
+ *
20
+ * @remarks
21
+ * - The accent bar, hover lift, and uppercase-label variants emit ClassMap
22
+ * tokens (`cm.kpiCardAccentLeft`, `cm.kpiCardAccentTop`,
23
+ * `cm.kpiCardAccentColor`, `cm.kpiCardHoverLift`,
24
+ * `cm.kpiCardTitleUppercase`). They only take effect when the app's ClassMap
25
+ * bond is Tailwind-based AND the theme defines the `primary` /
26
+ * `on-surface-variant` color tokens; under a non-Tailwind ClassMap these props
27
+ * are inert.
28
+ * - `<KpiCardTrend>` renders only the arrow glyph + number — it does NOT color
29
+ * the delta by direction. Pass `className` with a semantic text color (e.g.
30
+ * success/error) yourself if you want red/green deltas.
31
+ * - `<KpiCardGrid columns={n}>` renders a responsive n-column grid (via
32
+ * `cm.grid`): it starts at 1 column on phones and steps up to `n` at larger
33
+ * breakpoints, so cards don't overflow on mobile. Override `className` if you
34
+ * need a fixed (non-collapsing) grid.
35
+ * - `value`/`title` are JSX elements — format numbers and translate labels
36
+ * yourself (`t('...')`).
37
+ *
38
+ * @example
39
+ * ```tsx
40
+ * import { KpiCard, KpiCardGrid, KpiCardTrend } from '@molecule/app-kpi-card-solid'
41
+ *
42
+ * export function Dashboard() {
43
+ * return (
44
+ * <KpiCardGrid columns={3}>
45
+ * <KpiCard
46
+ * title="Monthly Revenue"
47
+ * value="$48,200"
48
+ * trend={<KpiCardTrend delta={12.4} />}
49
+ * accentSide="top"
50
+ * upperLabel
51
+ * emphasizeValue
52
+ * hoverLift
53
+ * dataMolId="kpi-revenue"
54
+ * />
55
+ * </KpiCardGrid>
56
+ * )
57
+ * }
58
+ * ```
59
+ *
60
+ * @module
61
+ */
62
+ export * from './KpiCard.jsx';
63
+ export * from './KpiCardGrid.jsx';
64
+ export * from './KpiCardTrend.jsx';
65
+ export * from './types.js';
66
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Types of `@molecule/app-kpi-card-solid` — the Solid counterpart of
3
+ * `@molecule/app-kpi-card-react`, with the same prop names and values.
4
+ *
5
+ * @module
6
+ */
7
+ import type { JSX } from 'solid-js';
8
+ /** Direction of a KPI trend indicator: rising, falling, or unchanged. */
9
+ export type KpiTrendDirection = 'up' | 'down' | 'flat';
10
+ /**
11
+ * Where (if anywhere) to draw the colored accent bar.
12
+ *
13
+ * The polished flagship apps use a 4px colored bar — sometimes on the
14
+ * left edge (`'left'`), sometimes across the top (`'top'`), and sometimes
15
+ * none at all (`'none'`). Default is `'none'` to preserve back-compat for
16
+ * call sites that don't pass the prop.
17
+ */
18
+ export type KpiCardAccentSide = 'left' | 'top' | 'none';
19
+ /** Props for {@link KpiCard}. */
20
+ export interface KpiCardProps {
21
+ /** Label describing the metric (usually `t('...')`). */
22
+ title?: JSX.Element;
23
+ /** Large primary value — usually a string or formatted number. */
24
+ value?: JSX.Element;
25
+ /** Optional supporting text below the value (e.g. "vs. last week"). */
26
+ subtitle?: JSX.Element;
27
+ /** Optional leading icon. */
28
+ icon?: JSX.Element;
29
+ /** Optional trend indicator (use `<KpiCardTrend>` for the default shape). */
30
+ trend?: JSX.Element;
31
+ /** Optional right-side action (menu, info tooltip). */
32
+ action?: JSX.Element;
33
+ /**
34
+ * Where to draw the 4px colored accent bar. Default `'none'`.
35
+ * - `'left'` — left edge (border-l-4) — used by blog, helpdesk-ticketing.
36
+ * - `'top'` — top edge (border-t-4) — used by crm, project-management.
37
+ * - `'none'` — no accent — bare card.
38
+ */
39
+ accentSide?: KpiCardAccentSide;
40
+ /**
41
+ * Tailwind class for the accent bar's color, e.g. `'border-primary'` or
42
+ * `'border-success'`. Defaults to the ClassMap's accent color. Ignored when
43
+ * `accentSide === 'none'`.
44
+ */
45
+ accentColor?: string;
46
+ /**
47
+ * When `true`, renders the title in 10px-uppercase-tracking-widest style
48
+ * matching the polished pattern. Default `false` keeps the older
49
+ * sentence-case look. Pass `true` for new dashboard call sites.
50
+ */
51
+ upperLabel?: boolean;
52
+ /**
53
+ * When `true`, uses `font-extrabold` for the value (matches the polished
54
+ * pattern). Default `false` keeps `font-bold`.
55
+ */
56
+ emphasizeValue?: boolean;
57
+ /**
58
+ * When `true`, applies a subtle hover lift. Polished dashboards use this.
59
+ * Default `false`.
60
+ */
61
+ hoverLift?: boolean;
62
+ /** Extra classes on the outer Card. */
63
+ className?: string;
64
+ /** `data-mol-id` for AI-agent selectors. */
65
+ dataMolId?: string;
66
+ }
67
+ /** Props for {@link KpiCardGrid}. */
68
+ export interface KpiCardGridProps {
69
+ /** KPI cards. */
70
+ children?: JSX.Element;
71
+ /** Column count at the md+ breakpoint. 2–6. Defaults to 4. */
72
+ columns?: 2 | 3 | 4 | 5 | 6;
73
+ /** Gap between cards. */
74
+ gap?: 'xs' | 'sm' | 'md' | 'lg';
75
+ /** Extra classes. */
76
+ className?: string;
77
+ }
78
+ /** Props for {@link KpiCardTrend}. */
79
+ export interface KpiCardTrendProps {
80
+ /** Numeric delta to display (e.g. 12.3 for +12.3%). Sign drives direction when `direction` omitted. */
81
+ delta: number;
82
+ /**
83
+ * Explicit direction override. When omitted, derived from the sign of `delta`
84
+ * (0 = flat, >0 = up, <0 = down).
85
+ */
86
+ direction?: KpiTrendDirection;
87
+ /** Suffix appended to the delta. Defaults to `'%'`. */
88
+ suffix?: string;
89
+ /** Extra classes. */
90
+ className?: string;
91
+ }
92
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAEnC,yEAAyE;AACzE,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;AAEtD;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;AAEvD,iCAAiC;AACjC,MAAM,WAAW,YAAY;IAC3B,wDAAwD;IACxD,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACnB,kEAAkE;IAClE,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACnB,uEAAuE;IACvE,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACtB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IAClB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACnB,uDAAuD;IACvD,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACpB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,iBAAiB,CAAA;IAC9B;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB;IACjB,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACtB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC3B,yBAAyB;IACzB,GAAG,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IAC/B,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,sCAAsC;AACtC,MAAM,WAAW,iBAAiB;IAChC,uGAAuG;IACvG,KAAK,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,SAAS,CAAC,EAAE,iBAAiB,CAAA;IAC7B,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Types of `@molecule/app-kpi-card-solid` — the Solid counterpart of
3
+ * `@molecule/app-kpi-card-react`, with the same prop names and values.
4
+ *
5
+ * @module
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/package.json CHANGED
@@ -1,6 +1,64 @@
1
1
  {
2
2
  "name": "@molecule/app-kpi-card-solid",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.1-stage",
4
+ "description": "Solid KPI / metric card components with trend, icon, and grid variants",
5
+ "homepage": "https://www.molecule.dev/packages/app-kpi-card-solid",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "dev": "tsc --watch",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest"
24
+ },
25
+ "keywords": [
26
+ "molecule",
27
+ "kpi-card",
28
+ "solid"
29
+ ],
30
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
31
+ "license": "Apache-2.0",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/molecule-dev/molecule.git",
35
+ "directory": "packages/app/features/kpi-card-solid"
36
+ },
37
+ "engines": {
38
+ "node": ">=20"
39
+ },
40
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "peerDependencies": {
45
+ "@molecule/app-solid": "^3.5.0",
46
+ "@molecule/app-ui": "^1.3.11",
47
+ "@molecule/app-ui-solid": "^1.1.0",
48
+ "solid-js": "^1.8.0"
49
+ },
50
+ "devDependencies": {
51
+ "@molecule/app-framework-conformance": "0.0.0",
52
+ "@molecule/app-i18n": "1.2.2",
53
+ "@molecule/app-icons": "1.0.4",
54
+ "@molecule/app-solid": "3.7.1",
55
+ "@molecule/app-ui": "1.4.0",
56
+ "@molecule/app-ui-solid": "1.1.4",
57
+ "@types/node": "26.6.5",
58
+ "jsdom": "30.1.3",
59
+ "solid-js": "1.9.17",
60
+ "typescript": "6.0.3",
61
+ "vite-plugin-solid": "2.11.15",
62
+ "vitest": "4.1.12"
63
+ }
64
+ }