@molecule/app-hero-metric-card-solid 0.0.0-stage → 1.1.0

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,236 @@
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-18T23:41:54.034Z
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-hero-metric-card-solid
10
+
11
+ Solid hero metric card primitives.
12
+
13
+ Exports:
14
+
15
+ - `<HeroMetricCard>` — top-of-dashboard hero metric card.
16
+ - `<HeroMetricTrendChip>` — directional ▲/▼ + delta chip used inside the card.
17
+ - Type aliases: `HeroMetricCardProps`, `HeroMetricTrend`,
18
+ `HeroMetricTrendDirection`, `HeroMetricAccent`, `HeroMetricSemanticAccent`,
19
+ `HeroMetricTrendChipProps`.
20
+
21
+ This is the Solid counterpart of `@molecule/app-hero-metric-card-react`: the
22
+ same exports, the same props (React names), and the same DOM for the same
23
+ input, so an app switches framework by changing only the package name in its
24
+ imports.
25
+
26
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
27
+ > It is written to be read by coding agents as much as by people, and is generated from this
28
+ > package's source — edit `src/index.ts` JSDoc, not this file.
29
+
30
+ ## Quick Start
31
+
32
+ ```tsx
33
+ import { HeroMetricCard } from '@molecule/app-hero-metric-card-solid'
34
+
35
+ ;<HeroMetricCard
36
+ title="Total Revenue"
37
+ value="$84,320"
38
+ unit="USD"
39
+ trend={{ direction: 'up', delta: '+12.4%' }}
40
+ subtitle="vs last month"
41
+ accent="success"
42
+ onClick={() => navigate('/revenue')}
43
+ />
44
+ ```
45
+
46
+ ## Type
47
+
48
+ `feature`
49
+
50
+ ## Installation
51
+
52
+ ```bash
53
+ npm install @molecule/app-hero-metric-card-solid @molecule/app-i18n @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js
54
+ ```
55
+
56
+ ## API
57
+
58
+ ### Interfaces
59
+
60
+ #### `HeroMetricTrend`
61
+
62
+ Trend chip rendered below the hero value.
63
+
64
+ `delta` is rendered verbatim — the caller is responsible for sign,
65
+ units, and locale formatting.
66
+
67
+ ```typescript
68
+ interface HeroMetricTrend {
69
+ /** Direction arrow / color. */
70
+ direction: HeroMetricTrendDirection
71
+ /** Pre-formatted delta string, e.g. `'+2.4%'` or `'-12 bpm'`. */
72
+ delta: string
73
+ }
74
+ ```
75
+
76
+ #### `HeroMetricCardProps`
77
+
78
+ Props for `<HeroMetricCard>`.
79
+
80
+ ```typescript
81
+ interface HeroMetricCardProps {
82
+ /** Title / label for the metric (usually `t('...')`). */
83
+ title: JSX.Element
84
+ /** The large primary value (string or formatted number). */
85
+ value: JSX.Element
86
+ /** Optional unit shown next to the value (e.g. `'kcal'`, `'bpm'`). */
87
+ unit?: JSX.Element | null
88
+ /** Optional trend chip rendered below the value. */
89
+ trend?: HeroMetricTrend
90
+ /** Optional supporting text below the trend / value. */
91
+ subtitle?: JSX.Element
92
+ /** Optional progress ring or sparkline node shown to the right. */
93
+ progressRing?: JSX.Element
94
+ /** Optional leading icon (used when no `progressRing` is provided). */
95
+ icon?: JSX.Element
96
+ /** Optional accent border color (top edge). */
97
+ accent?: HeroMetricAccent
98
+ /** Optional click handler — turns the card into a button-role interactive. */
99
+ onClick?: () => void
100
+ /**
101
+ * When `true`, swaps the value for a localized loading line and
102
+ * announces a loading state to assistive tech.
103
+ */
104
+ loading?: boolean
105
+ /** Extra classes on the outer Card. */
106
+ className?: string
107
+ /** `data-mol-id` for AI-agent selectors. */
108
+ dataMolId?: string
109
+ }
110
+ ```
111
+
112
+ #### `HeroMetricTrendChipProps`
113
+
114
+ Props for `<HeroMetricTrendChip>`.
115
+
116
+ ```typescript
117
+ interface HeroMetricTrendChipProps {
118
+ /** Direction + pre-formatted delta string. */
119
+ trend: HeroMetricTrend
120
+ /** Extra classes. */
121
+ className?: string
122
+ }
123
+ ```
124
+
125
+ ### Types
126
+
127
+ #### `HeroMetricTrendDirection`
128
+
129
+ Direction of a hero-metric trend chip.
130
+
131
+ - `'up'` — value rose since the prior period.
132
+ - `'down'` — value fell since the prior period.
133
+
134
+ ```typescript
135
+ type HeroMetricTrendDirection = 'up' | 'down'
136
+ ```
137
+
138
+ #### `HeroMetricSemanticAccent`
139
+
140
+ Semantic accent names for the hero card's top-edge accent bar.
141
+
142
+ Each name resolves at render time to a real ClassMap `ColorVariant` (and
143
+ therefore a real, theme-aware color token). Note the two the theme has no
144
+ matching token for: `'danger'` → `error` and `'neutral'` → `secondary`.
145
+
146
+ ```typescript
147
+ type HeroMetricSemanticAccent = 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'neutral'
148
+ ```
149
+
150
+ #### `HeroMetricAccent`
151
+
152
+ Optional accent color for the hero card's top edge.
153
+
154
+ A semantic name ({@link HeroMetricSemanticAccent}) is resolved through
155
+ `cm.progressColor()` to a real, theme-aware ClassMap color token, so the
156
+ accent bar is visibly colored in both light and dark themes. An arbitrary
157
+ CSS color string is also accepted and applied inline (a one-off accent
158
+ color — the documented ClassMap exception).
159
+
160
+ ```typescript
161
+ type HeroMetricAccent = HeroMetricSemanticAccent | (string & { __raw?: never })
162
+ ```
163
+
164
+ ### Functions
165
+
166
+ #### `HeroMetricCard(props)`
167
+
168
+ Top-of-dashboard hero metric card.
169
+
170
+ Layout: large value left (with optional unit + trend chip + subtitle),
171
+ `progressRing` or `icon` slot to the right. The card's padding moves onto
172
+ the inner wrapper so the accent bar can sit full-bleed against the top
173
+ edge; `overflow: hidden` clips the bar to the card's rounded corners.
174
+
175
+ ```typescript
176
+ function HeroMetricCard(props: HeroMetricCardProps): JSX.Element
177
+ ```
178
+
179
+ - `props` — Component props (see {@link HeroMetricCardProps}).
180
+
181
+ **Returns:** The rendered hero metric card.
182
+
183
+ #### `HeroMetricTrendChip(props)`
184
+
185
+ Compact trend indicator rendered below the hero value.
186
+
187
+ Shows a directional arrow (▲ / ▼) followed by the caller-provided
188
+ delta string. The arrow's `aria-label` is localized via
189
+ `@molecule/app-i18n` so screen readers announce "Trending up" or
190
+ "Trending down" rather than the bare glyph.
191
+
192
+ ```typescript
193
+ function HeroMetricTrendChip(props: HeroMetricTrendChipProps): JSX.Element
194
+ ```
195
+
196
+ - `props` — Component props (see {@link HeroMetricTrendChipProps}).
197
+
198
+ **Returns:** The rendered trend chip.
199
+
200
+ ## Injection Notes
201
+
202
+ ### Requirements
203
+
204
+ Peer dependencies:
205
+
206
+ - `@molecule/app-i18n` ^1.0.1
207
+ - `@molecule/app-solid` ^3.5.0
208
+ - `@molecule/app-ui` ^1.3.11
209
+ - `@molecule/app-ui-solid` ^1.1.0
210
+ - `solid-js` ^1.8.0
211
+
212
+ ### Runtime Dependencies
213
+
214
+ - `@molecule/app-i18n`
215
+ - `@molecule/app-solid`
216
+ - `@molecule/app-ui`
217
+ - `@molecule/app-ui-solid`
218
+ - `solid-js`
219
+
220
+ - Every semantic `accent` (`primary`/`success`/`warning`/`danger`/`info`/
221
+ `neutral`) resolves to a REAL, theme-aware ClassMap color via
222
+ `cm.progressColor()` — visibly colored in both light and dark themes.
223
+ `danger` maps to the theme's `error` token and `neutral` to `secondary`
224
+ (the theme defines no `danger`/`neutral` token). A raw CSS color string is
225
+ also accepted for one-off brand accents.
226
+ - Styling routes through `getClassMap()` (muted text = `cm.textMuted`,
227
+ caps/tracking = `cm.uppercase`/`cm.trackingWide`). The lone raw utility
228
+ (`leading-none` on the big value) comes from `cm.heroMetricCardValue`.
229
+ - `getClassMap()` requires a bonded ClassMap. Text uses
230
+ `@molecule/app-i18n`'s `t()` through `useTranslation()`, so it follows a
231
+ locale switch, with English fallbacks — the companion
232
+ `@molecule/app-locales-hero-metric-card` bond supplies translations.
233
+
234
+ ## Translations
235
+
236
+ Translation strings are provided by `@molecule/app-locales-hero-metric-card`.
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Solid top-of-dashboard hero metric card — the counterpart of
3
+ * `@molecule/app-hero-metric-card-react`'s `HeroMetricCard`: the same props
4
+ * (React names), the same ClassMap tokens, and the same DOM for the same
5
+ * input.
6
+ *
7
+ * @module
8
+ */
9
+ import { type Component } from 'solid-js';
10
+ import type { HeroMetricCardProps } from './types.js';
11
+ /**
12
+ * Top-of-dashboard hero metric card.
13
+ *
14
+ * Layout: large value left (with optional unit + trend chip + subtitle),
15
+ * `progressRing` or `icon` slot to the right. The card's padding moves onto
16
+ * the inner wrapper so the accent bar can sit full-bleed against the top
17
+ * edge; `overflow: hidden` clips the bar to the card's rounded corners.
18
+ *
19
+ * @param props - Component props (see {@link HeroMetricCardProps}).
20
+ * @returns The rendered hero metric card.
21
+ */
22
+ export declare const HeroMetricCard: Component<HeroMetricCardProps>;
23
+ //# sourceMappingURL=HeroMetricCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeroMetricCard.d.ts","sourceRoot":"","sources":["../src/HeroMetricCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAkB,MAAM,UAAU,CAAA;AAQzD,OAAO,KAAK,EAAoB,mBAAmB,EAA4B,MAAM,YAAY,CAAA;AAyCjG;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,CAAC,mBAAmB,CA+FzD,CAAA"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Solid top-of-dashboard hero metric card — the counterpart of
3
+ * `@molecule/app-hero-metric-card-react`'s `HeroMetricCard`: the same props
4
+ * (React names), the same ClassMap tokens, and the same DOM for the same
5
+ * input.
6
+ *
7
+ * @module
8
+ */
9
+ import { Show } from 'solid-js';
10
+ import { useTranslation } from '@molecule/app-solid';
11
+ import { getClassMap } from '@molecule/app-ui';
12
+ import { Card } from '@molecule/app-ui-solid';
13
+ import { HeroMetricTrendChip } from './HeroMetricTrendChip.jsx';
14
+ /**
15
+ * Maps a semantic hero accent to a real ClassMap {@link ColorVariant}.
16
+ *
17
+ * The theme exposes no `danger`/`neutral` color token, so those names are
18
+ * translated to the tokens that DO exist (`danger → error`, `neutral →
19
+ * secondary`).
20
+ */
21
+ const ACCENT_COLOR_VARIANT = {
22
+ primary: 'primary',
23
+ success: 'success',
24
+ warning: 'warning',
25
+ danger: 'error',
26
+ info: 'info',
27
+ neutral: 'secondary',
28
+ };
29
+ /**
30
+ * Resolves the top-edge accent bar's color.
31
+ *
32
+ * Semantic accents route through `cm.progressColor()` — the ClassMap's
33
+ * per-variant color resolver — so the bar picks up a real, theme-aware token
34
+ * (`bg-primary`, `bg-error`, …). Any other string is treated as a one-off CSS
35
+ * color and applied inline (the documented colored-accent exception).
36
+ *
37
+ * @param cm - The active ClassMap resolver.
38
+ * @param accent - The accent token or raw color string.
39
+ * @returns A ClassMap color class and/or an inline background color.
40
+ */
41
+ function resolveAccentBar(cm, accent) {
42
+ const variant = ACCENT_COLOR_VARIANT[accent];
43
+ if (variant) {
44
+ return { className: cm.progressColor(variant) };
45
+ }
46
+ return { backgroundColor: accent };
47
+ }
48
+ /**
49
+ * Top-of-dashboard hero metric card.
50
+ *
51
+ * Layout: large value left (with optional unit + trend chip + subtitle),
52
+ * `progressRing` or `icon` slot to the right. The card's padding moves onto
53
+ * the inner wrapper so the accent bar can sit full-bleed against the top
54
+ * edge; `overflow: hidden` clips the bar to the card's rounded corners.
55
+ *
56
+ * @param props - Component props (see {@link HeroMetricCardProps}).
57
+ * @returns The rendered hero metric card.
58
+ */
59
+ export const HeroMetricCard = (props) => {
60
+ const { t } = useTranslation();
61
+ const cm = getClassMap();
62
+ const loading = () => Boolean(props.loading);
63
+ const clickable = () => typeof props.onClick === 'function';
64
+ const accentBar = () => props.accent ? resolveAccentBar(cm, props.accent) : undefined;
65
+ const rightSlot = () => props.progressRing ?? props.icon;
66
+ const hasUnit = () => props.unit !== undefined && props.unit !== null;
67
+ const loadingLabel = () => t('hero-metric-card.loading', {}, { defaultValue: 'Loading metric…' });
68
+ return (<Card className={cm.cn(props.className)} padding="none" style={accentBar() ? { overflow: 'hidden' } : undefined} interactive={clickable()} onClick={props.onClick} data-mol-id={props.dataMolId}>
69
+ <Show when={accentBar()}>
70
+ {(bar) => (<span aria-hidden="true" class={cm.cn(bar().className)} style={{
71
+ display: 'block',
72
+ height: '4px',
73
+ 'background-color': bar().backgroundColor,
74
+ }}/>)}
75
+ </Show>
76
+ <div class={cm.cardPadding('md')}>
77
+ <div class={cm.flex({ justify: 'between', align: 'center', gap: 'md' })} aria-busy={loading() || undefined}>
78
+ <div class={cm.stack(2)}>
79
+ <span class={cm.cn(cm.textSize('xs'), cm.fontWeight('bold'), cm.uppercase, cm.trackingWide, cm.textMuted)}>
80
+ {props.title}
81
+ </span>
82
+ <Show when={!loading()} fallback={<span class={cm.cn(cm.textSize('5xl'), cm.fontWeight('bold'))} role="status" aria-live="polite">
83
+ {loadingLabel()}
84
+ </span>}>
85
+ <div class={cm.flex({ align: 'baseline', gap: 'xs' })}>
86
+ <span class={cm.cn(cm.textSize('5xl'), cm.fontWeight('extrabold'), cm.heroMetricCardValue)}>
87
+ {props.value}
88
+ </span>
89
+ <Show when={hasUnit()}>
90
+ <span class={cm.cn(cm.textSize('lg'), cm.fontWeight('medium'), cm.textMuted)}>
91
+ {props.unit}
92
+ </span>
93
+ </Show>
94
+ </div>
95
+ </Show>
96
+ <Show when={!loading() && props.trend}>
97
+ {(trend) => <HeroMetricTrendChip trend={trend()}/>}
98
+ </Show>
99
+ <Show when={!loading() && props.subtitle}>
100
+ <span class={cm.cn(cm.textSize('sm'), cm.textMuted)}>{props.subtitle}</span>
101
+ </Show>
102
+ </div>
103
+ <Show when={rightSlot()}>
104
+ <div class={cm.flex({ align: 'center', justify: 'center' })}>{rightSlot()}</div>
105
+ </Show>
106
+ </div>
107
+ </div>
108
+ </Card>);
109
+ };
110
+ //# sourceMappingURL=HeroMetricCard.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeroMetricCard.jsx","sourceRoot":"","sources":["../src/HeroMetricCard.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAA4B,IAAI,EAAE,MAAM,UAAU,CAAA;AAEzD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAE7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAG/D;;;;;;GAMG;AACH,MAAM,oBAAoB,GAAmD;IAC3E,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,OAAO;IACf,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,WAAW;CACrB,CAAA;AAED;;;;;;;;;;;GAWG;AACH,SAAS,gBAAgB,CACvB,EAAkC,EAClC,MAAwB;IAExB,MAAM,OAAO,GAAG,oBAAoB,CAAC,MAAkC,CAAC,CAAA;IACxE,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAA;IACjD,CAAC;IACD,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,CAAA;AACpC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,cAAc,GAAmC,CAAC,KAAK,EAAE,EAAE;IACtE,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAA;IAC9B,MAAM,EAAE,GAAG,WAA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AC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,IAAI,CAC7E;YAAA,EAAE,IAAI,CACR;UAAA,EAAE,GAAG,CACL;UAAA,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC,CACtB;YAAA,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,EAAE,GAAG,CACjF;UAAA,EAAE,IAAI,CACR;QAAA,EAAE,GAAG,CACP;MAAA,EAAE,GAAG,CACP;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Solid directional ▲/▼ + delta chip — the counterpart of
3
+ * `@molecule/app-hero-metric-card-react`'s `HeroMetricTrendChip`: the same
4
+ * props (React names), the same ClassMap tokens, and the same DOM for the
5
+ * same input.
6
+ *
7
+ * @module
8
+ */
9
+ import type { Component } from 'solid-js';
10
+ import type { HeroMetricTrendChipProps } from './types.js';
11
+ /**
12
+ * Compact trend indicator rendered below the hero value.
13
+ *
14
+ * Shows a directional arrow (▲ / ▼) followed by the caller-provided
15
+ * delta string. The arrow's `aria-label` is localized via
16
+ * `@molecule/app-i18n` so screen readers announce "Trending up" or
17
+ * "Trending down" rather than the bare glyph.
18
+ *
19
+ * @param props - Component props (see {@link HeroMetricTrendChipProps}).
20
+ * @returns The rendered trend chip.
21
+ */
22
+ export declare const HeroMetricTrendChip: Component<HeroMetricTrendChipProps>;
23
+ //# sourceMappingURL=HeroMetricTrendChip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeroMetricTrendChip.d.ts","sourceRoot":"","sources":["../src/HeroMetricTrendChip.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAKzC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAE1D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,CAAC,wBAAwB,CAyBnE,CAAA"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Solid directional ▲/▼ + delta chip — the counterpart of
3
+ * `@molecule/app-hero-metric-card-react`'s `HeroMetricTrendChip`: the same
4
+ * props (React names), the same ClassMap tokens, and the same DOM for the
5
+ * same input.
6
+ *
7
+ * @module
8
+ */
9
+ import { useTranslation } from '@molecule/app-solid';
10
+ import { getClassMap } from '@molecule/app-ui';
11
+ /**
12
+ * Compact trend indicator rendered below the hero value.
13
+ *
14
+ * Shows a directional arrow (▲ / ▼) followed by the caller-provided
15
+ * delta string. The arrow's `aria-label` is localized via
16
+ * `@molecule/app-i18n` so screen readers announce "Trending up" or
17
+ * "Trending down" rather than the bare glyph.
18
+ *
19
+ * @param props - Component props (see {@link HeroMetricTrendChipProps}).
20
+ * @returns The rendered trend chip.
21
+ */
22
+ export const HeroMetricTrendChip = (props) => {
23
+ const { t } = useTranslation();
24
+ const cm = getClassMap();
25
+ const arrow = () => (props.trend.direction === 'up' ? '▲' : '▼');
26
+ const label = () => props.trend.direction === 'up'
27
+ ? t('hero-metric-card.trend.up', {}, { defaultValue: 'Trending up' })
28
+ : t('hero-metric-card.trend.down', {}, { defaultValue: 'Trending down' });
29
+ return (<span class={cm.cn(cm.flex({ align: 'center', gap: 'xs' }), cm.textSize('sm'), cm.fontWeight('semibold'), props.className)}>
30
+ <span aria-label={label()} role="img">
31
+ {arrow()}
32
+ </span>
33
+ <span>{props.trend.delta}</span>
34
+ </span>);
35
+ };
36
+ //# sourceMappingURL=HeroMetricTrendChip.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeroMetricTrendChip.jsx","sourceRoot":"","sources":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AAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,IAAI,CACjC;IAAA,EAAE,IAAI,CAAC,CACR,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Solid hero metric card primitives.
3
+ *
4
+ * Exports:
5
+ * - `<HeroMetricCard>` — top-of-dashboard hero metric card.
6
+ * - `<HeroMetricTrendChip>` — directional ▲/▼ + delta chip used inside the card.
7
+ * - Type aliases: `HeroMetricCardProps`, `HeroMetricTrend`,
8
+ * `HeroMetricTrendDirection`, `HeroMetricAccent`, `HeroMetricSemanticAccent`,
9
+ * `HeroMetricTrendChipProps`.
10
+ *
11
+ * This is the Solid counterpart of `@molecule/app-hero-metric-card-react`: the
12
+ * same exports, the same props (React names), and the same DOM for the same
13
+ * input, so an app switches framework by changing only the package name in its
14
+ * imports.
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * import { HeroMetricCard } from '@molecule/app-hero-metric-card-solid'
19
+ *
20
+ * <HeroMetricCard
21
+ * title="Total Revenue"
22
+ * value="$84,320"
23
+ * unit="USD"
24
+ * trend={{ direction: 'up', delta: '+12.4%' }}
25
+ * subtitle="vs last month"
26
+ * accent="success"
27
+ * onClick={() => navigate('/revenue')}
28
+ * />
29
+ * ```
30
+ *
31
+ * @remarks
32
+ * - Every semantic `accent` (`primary`/`success`/`warning`/`danger`/`info`/
33
+ * `neutral`) resolves to a REAL, theme-aware ClassMap color via
34
+ * `cm.progressColor()` — visibly colored in both light and dark themes.
35
+ * `danger` maps to the theme's `error` token and `neutral` to `secondary`
36
+ * (the theme defines no `danger`/`neutral` token). A raw CSS color string is
37
+ * also accepted for one-off brand accents.
38
+ * - Styling routes through `getClassMap()` (muted text = `cm.textMuted`,
39
+ * caps/tracking = `cm.uppercase`/`cm.trackingWide`). The lone raw utility
40
+ * (`leading-none` on the big value) comes from `cm.heroMetricCardValue`.
41
+ * - `getClassMap()` requires a bonded ClassMap. Text uses
42
+ * `@molecule/app-i18n`'s `t()` through `useTranslation()`, so it follows a
43
+ * locale switch, with English fallbacks — the companion
44
+ * `@molecule/app-locales-hero-metric-card` bond supplies translations.
45
+ *
46
+ * @module
47
+ */
48
+ export * from './HeroMetricCard.jsx';
49
+ export * from './HeroMetricTrendChip.jsx';
50
+ export * from './types.js';
51
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,YAAY,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Solid hero metric card primitives.
3
+ *
4
+ * Exports:
5
+ * - `<HeroMetricCard>` — top-of-dashboard hero metric card.
6
+ * - `<HeroMetricTrendChip>` — directional ▲/▼ + delta chip used inside the card.
7
+ * - Type aliases: `HeroMetricCardProps`, `HeroMetricTrend`,
8
+ * `HeroMetricTrendDirection`, `HeroMetricAccent`, `HeroMetricSemanticAccent`,
9
+ * `HeroMetricTrendChipProps`.
10
+ *
11
+ * This is the Solid counterpart of `@molecule/app-hero-metric-card-react`: the
12
+ * same exports, the same props (React names), and the same DOM for the same
13
+ * input, so an app switches framework by changing only the package name in its
14
+ * imports.
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * import { HeroMetricCard } from '@molecule/app-hero-metric-card-solid'
19
+ *
20
+ * <HeroMetricCard
21
+ * title="Total Revenue"
22
+ * value="$84,320"
23
+ * unit="USD"
24
+ * trend={{ direction: 'up', delta: '+12.4%' }}
25
+ * subtitle="vs last month"
26
+ * accent="success"
27
+ * onClick={() => navigate('/revenue')}
28
+ * />
29
+ * ```
30
+ *
31
+ * @remarks
32
+ * - Every semantic `accent` (`primary`/`success`/`warning`/`danger`/`info`/
33
+ * `neutral`) resolves to a REAL, theme-aware ClassMap color via
34
+ * `cm.progressColor()` — visibly colored in both light and dark themes.
35
+ * `danger` maps to the theme's `error` token and `neutral` to `secondary`
36
+ * (the theme defines no `danger`/`neutral` token). A raw CSS color string is
37
+ * also accepted for one-off brand accents.
38
+ * - Styling routes through `getClassMap()` (muted text = `cm.textMuted`,
39
+ * caps/tracking = `cm.uppercase`/`cm.trackingWide`). The lone raw utility
40
+ * (`leading-none` on the big value) comes from `cm.heroMetricCardValue`.
41
+ * - `getClassMap()` requires a bonded ClassMap. Text uses
42
+ * `@molecule/app-i18n`'s `t()` through `useTranslation()`, so it follows a
43
+ * locale switch, with English fallbacks — the companion
44
+ * `@molecule/app-locales-hero-metric-card` bond supplies translations.
45
+ *
46
+ * @module
47
+ */
48
+ export * from './HeroMetricCard.jsx';
49
+ export * from './HeroMetricTrendChip.jsx';
50
+ export * from './types.js';
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,YAAY,CAAA"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Types of `@molecule/app-hero-metric-card-solid` — the Solid counterpart of
3
+ * `@molecule/app-hero-metric-card-react`, with the same prop names and values.
4
+ *
5
+ * @module
6
+ */
7
+ import type { JSX } from 'solid-js';
8
+ /**
9
+ * Direction of a hero-metric trend chip.
10
+ *
11
+ * - `'up'` — value rose since the prior period.
12
+ * - `'down'` — value fell since the prior period.
13
+ */
14
+ export type HeroMetricTrendDirection = 'up' | 'down';
15
+ /**
16
+ * Trend chip rendered below the hero value.
17
+ *
18
+ * `delta` is rendered verbatim — the caller is responsible for sign,
19
+ * units, and locale formatting.
20
+ */
21
+ export interface HeroMetricTrend {
22
+ /** Direction arrow / color. */
23
+ direction: HeroMetricTrendDirection;
24
+ /** Pre-formatted delta string, e.g. `'+2.4%'` or `'-12 bpm'`. */
25
+ delta: string;
26
+ }
27
+ /**
28
+ * Semantic accent names for the hero card's top-edge accent bar.
29
+ *
30
+ * Each name resolves at render time to a real ClassMap `ColorVariant` (and
31
+ * therefore a real, theme-aware color token). Note the two the theme has no
32
+ * matching token for: `'danger'` → `error` and `'neutral'` → `secondary`.
33
+ */
34
+ export type HeroMetricSemanticAccent = 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'neutral';
35
+ /**
36
+ * Optional accent color for the hero card's top edge.
37
+ *
38
+ * A semantic name ({@link HeroMetricSemanticAccent}) is resolved through
39
+ * `cm.progressColor()` to a real, theme-aware ClassMap color token, so the
40
+ * accent bar is visibly colored in both light and dark themes. An arbitrary
41
+ * CSS color string is also accepted and applied inline (a one-off accent
42
+ * color — the documented ClassMap exception).
43
+ */
44
+ export type HeroMetricAccent = HeroMetricSemanticAccent | (string & {
45
+ __raw?: never;
46
+ });
47
+ /**
48
+ * Props for `<HeroMetricCard>`.
49
+ */
50
+ export interface HeroMetricCardProps {
51
+ /** Title / label for the metric (usually `t('...')`). */
52
+ title: JSX.Element;
53
+ /** The large primary value (string or formatted number). */
54
+ value: JSX.Element;
55
+ /** Optional unit shown next to the value (e.g. `'kcal'`, `'bpm'`). */
56
+ unit?: JSX.Element | null;
57
+ /** Optional trend chip rendered below the value. */
58
+ trend?: HeroMetricTrend;
59
+ /** Optional supporting text below the trend / value. */
60
+ subtitle?: JSX.Element;
61
+ /** Optional progress ring or sparkline node shown to the right. */
62
+ progressRing?: JSX.Element;
63
+ /** Optional leading icon (used when no `progressRing` is provided). */
64
+ icon?: JSX.Element;
65
+ /** Optional accent border color (top edge). */
66
+ accent?: HeroMetricAccent;
67
+ /** Optional click handler — turns the card into a button-role interactive. */
68
+ onClick?: () => void;
69
+ /**
70
+ * When `true`, swaps the value for a localized loading line and
71
+ * announces a loading state to assistive tech.
72
+ */
73
+ loading?: boolean;
74
+ /** Extra classes on the outer Card. */
75
+ className?: string;
76
+ /** `data-mol-id` for AI-agent selectors. */
77
+ dataMolId?: string;
78
+ }
79
+ /** Props for `<HeroMetricTrendChip>`. */
80
+ export interface HeroMetricTrendChipProps {
81
+ /** Direction + pre-formatted delta string. */
82
+ trend: HeroMetricTrend;
83
+ /** Extra classes. */
84
+ className?: string;
85
+ }
86
+ //# 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;;;;;GAKG;AACH,MAAM,MAAM,wBAAwB,GAAG,IAAI,GAAG,MAAM,CAAA;AAEpD;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,+BAA+B;IAC/B,SAAS,EAAE,wBAAwB,CAAA;IACnC,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;;;GAMG;AACH,MAAM,MAAM,wBAAwB,GAClC,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAA;AAEnE;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,GAAG,wBAAwB,GAAG,CAAC,MAAM,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAAA;AAEtF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,KAAK,EAAE,GAAG,CAAC,OAAO,CAAA;IAClB,4DAA4D;IAC5D,KAAK,EAAE,GAAG,CAAC,OAAO,CAAA;IAClB,sEAAsE;IACtE,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,IAAI,CAAA;IACzB,oDAAoD;IACpD,KAAK,CAAC,EAAE,eAAe,CAAA;IACvB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACtB,mEAAmE;IACnE,YAAY,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IAC1B,uEAAuE;IACvE,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IAClB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,gBAAgB,CAAA;IACzB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,yCAAyC;AACzC,MAAM,WAAW,wBAAwB;IACvC,8CAA8C;IAC9C,KAAK,EAAE,eAAe,CAAA;IACtB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Types of `@molecule/app-hero-metric-card-solid` — the Solid counterpart of
3
+ * `@molecule/app-hero-metric-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,67 @@
1
1
  {
2
2
  "name": "@molecule/app-hero-metric-card-solid",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.1.0",
4
+ "description": "Top-of-dashboard hero metric card — large primary value, optional trend chip + progress-ring slot, accent border",
5
+ "homepage": "https://www.molecule.dev/packages/app-hero-metric-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
+ "hero-metric-card",
28
+ "dashboard",
29
+ "solid"
30
+ ],
31
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
32
+ "license": "Apache-2.0",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/molecule-dev/molecule.git",
36
+ "directory": "packages/app/features/hero-metric-card-solid"
37
+ },
38
+ "engines": {
39
+ "node": ">=20"
40
+ },
41
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "peerDependencies": {
46
+ "@molecule/app-i18n": "^1.0.1",
47
+ "@molecule/app-solid": "^3.5.0",
48
+ "@molecule/app-ui": "^1.3.11",
49
+ "@molecule/app-ui-solid": "^1.1.0",
50
+ "solid-js": "^1.8.0"
51
+ },
52
+ "devDependencies": {
53
+ "@molecule/app-framework-conformance": "0.0.0",
54
+ "@molecule/app-i18n": "1.2.2",
55
+ "@molecule/app-icons": "1.0.4",
56
+ "@molecule/app-solid": "3.7.2",
57
+ "@molecule/app-ui": "1.4.0",
58
+ "@molecule/app-ui-solid": "1.1.5",
59
+ "@molecule/app-ui-tailwind": "1.3.0",
60
+ "@types/node": "26.6.5",
61
+ "jsdom": "30.1.3",
62
+ "solid-js": "1.9.17",
63
+ "typescript": "6.0.3",
64
+ "vite-plugin-solid": "2.11.15",
65
+ "vitest": "4.1.12"
66
+ }
67
+ }