@pihanga2/shadcn 0.2.5 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/AGENT.building-cards.md +87 -0
  2. package/AGENT.using-cards.md +47 -0
  3. package/README.md +7 -1
  4. package/cards/avatar/avatar.component.d.ts +11 -0
  5. package/cards/avatar/avatar.component.js +26 -0
  6. package/cards/avatar/avatar.component.js.map +1 -0
  7. package/cards/avatar/avatar.types.d.ts +46 -0
  8. package/cards/avatar/avatar.types.js +7 -0
  9. package/cards/avatar/avatar.types.js.map +1 -0
  10. package/cards/avatar/index.d.ts +1 -0
  11. package/cards/avatar/index.js +12 -0
  12. package/cards/avatar/index.js.map +1 -0
  13. package/cards/badge/badge.component.js +4 -4
  14. package/cards/codeMirror/codeMirror.component.d.ts +4 -0
  15. package/cards/codeMirror/codeMirror.types.d.ts +83 -0
  16. package/cards/codeMirror/index.d.ts +1 -0
  17. package/cards/collapsibleCard/collapsibleCard.component.d.ts +4 -0
  18. package/cards/collapsibleCard/collapsibleCard.component.js +61 -0
  19. package/cards/collapsibleCard/collapsibleCard.component.js.map +1 -0
  20. package/cards/collapsibleCard/collapsibleCard.types.d.ts +91 -0
  21. package/cards/collapsibleCard/collapsibleCard.types.js +7 -0
  22. package/cards/collapsibleCard/collapsibleCard.types.js.map +1 -0
  23. package/cards/collapsibleCard/index.d.ts +1 -0
  24. package/cards/collapsibleCard/index.js +13 -0
  25. package/cards/collapsibleCard/index.js.map +1 -0
  26. package/cards/collapsibleCard.d.ts +1 -0
  27. package/cards/dataTable/dataTable.component.js +43 -42
  28. package/cards/dataTable/dataTable.component.js.map +1 -1
  29. package/cards/dataTable/dataTable.types.d.ts +26 -2
  30. package/cards/dataTable/dataTable.types.js +1 -0
  31. package/cards/dataTable/dataTable.types.js.map +1 -1
  32. package/cards/drawer/drawer.component.d.ts +4 -0
  33. package/cards/drawer/drawer.component.js +83 -0
  34. package/cards/drawer/drawer.component.js.map +1 -0
  35. package/cards/drawer/drawer.types.d.ts +95 -0
  36. package/cards/drawer/drawer.types.js +11 -0
  37. package/cards/drawer/drawer.types.js.map +1 -0
  38. package/cards/drawer/index.d.ts +1 -0
  39. package/cards/drawer/index.js +13 -0
  40. package/cards/drawer/index.js.map +1 -0
  41. package/cards/dropDownMenu/dropdown-menu.ui.js +41 -41
  42. package/cards/emptyCard/emptyCard.component.d.ts +4 -0
  43. package/cards/emptyCard/emptyCard.types.d.ts +36 -0
  44. package/cards/emptyCard/index.d.ts +1 -0
  45. package/cards/emptyCard.d.ts +1 -7
  46. package/cards/fileDrop/fileDrop.component.js +1 -1
  47. package/cards/fileDrop/fileDrop.css +1 -0
  48. package/cards/flexGrid/flexGrid.types.d.ts +1 -2
  49. package/cards/flexGrid/flexGrid.types.js.map +1 -1
  50. package/cards/graphin/eventDispatcher.component.d.ts +3 -1
  51. package/cards/graphin/graphin.types.d.ts +14 -0
  52. package/cards/infoCard/index.d.ts +1 -0
  53. package/cards/infoCard/index.js +12 -0
  54. package/cards/infoCard/index.js.map +1 -0
  55. package/cards/infoCard/infoCard.component.d.ts +4 -0
  56. package/cards/infoCard/infoCard.component.js +55 -0
  57. package/cards/infoCard/infoCard.component.js.map +1 -0
  58. package/cards/infoCard/infoCard.types.d.ts +65 -0
  59. package/cards/infoCard/infoCard.types.js +7 -0
  60. package/cards/infoCard/infoCard.types.js.map +1 -0
  61. package/cards/infoCard.d.ts +1 -0
  62. package/cards/jsonViewer/jsonViewer.component.js +1 -1
  63. package/cards/jsonViewer/jsonViewer.css +1 -0
  64. package/cards/list/list.component.js +21 -21
  65. package/cards/loadingOverlay/loadingOverlay.component.js +1 -1
  66. package/cards/loadingOverlay/loadingOverlay.css +1 -0
  67. package/cards/pageWithNavbar/pageWithNavbar.component.js +1 -1
  68. package/cards/pageWithNavbar/pageWithNavbar.css +1 -0
  69. package/cards/pageWithNavbarMeta/index.d.ts +1 -0
  70. package/cards/pageWithNavbarMeta/index.js +118 -0
  71. package/cards/pageWithNavbarMeta/index.js.map +1 -0
  72. package/cards/pageWithNavbarMeta/pageWithNavbarMeta.types.d.ts +78 -0
  73. package/cards/pageWithNavbarMeta/pageWithNavbarMeta.types.js +7 -0
  74. package/cards/pageWithNavbarMeta/pageWithNavbarMeta.types.js.map +1 -0
  75. package/cards/pasteTarget/pasteTarget.component.js +1 -1
  76. package/cards/pasteTarget/pasteTarget.css +1 -0
  77. package/cards/scrollbarWithAnnotations/index.d.ts +1 -0
  78. package/cards/scrollbarWithAnnotations/index.js +13 -0
  79. package/cards/scrollbarWithAnnotations/index.js.map +1 -0
  80. package/cards/scrollbarWithAnnotations/scrollbarWithAnnotations.component.d.ts +23 -0
  81. package/cards/scrollbarWithAnnotations/scrollbarWithAnnotations.component.js +78 -0
  82. package/cards/scrollbarWithAnnotations/scrollbarWithAnnotations.component.js.map +1 -0
  83. package/cards/scrollbarWithAnnotations/scrollbarWithAnnotations.css +1 -0
  84. package/cards/scrollbarWithAnnotations/scrollbarWithAnnotations.types.d.ts +123 -0
  85. package/cards/scrollbarWithAnnotations/scrollbarWithAnnotations.types.js +7 -0
  86. package/cards/scrollbarWithAnnotations/scrollbarWithAnnotations.types.js.map +1 -0
  87. package/cards/slider/slider.component.js +67 -48
  88. package/cards/slider/slider.component.js.map +1 -1
  89. package/cards/slider/slider.types.d.ts +31 -0
  90. package/cards/slider/slider.types.js.map +1 -1
  91. package/cards/stepper/stepper.component.js +1 -1
  92. package/cards/stepper/stepper.css +1 -0
  93. package/cards/toggleGroup/toggleGroup.component.js +1 -1
  94. package/cards/toggleGroup/toggleGroup.component.js.map +1 -1
  95. package/components/ui/avatar.js +5 -5
  96. package/components/ui/badge.js +7 -7
  97. package/components/ui/button.js +6 -6
  98. package/components/ui/card.js +50 -0
  99. package/components/ui/card.js.map +1 -0
  100. package/components/ui/drawer.js +79 -0
  101. package/components/ui/drawer.js.map +1 -0
  102. package/components/ui/field.js +16 -16
  103. package/components/ui/label.js +3 -3
  104. package/components/ui/separator.js +1 -1
  105. package/components/ui/toggle-group.js +5 -5
  106. package/components/ui/toggle.js +2 -2
  107. package/lib/utils.d.ts +15 -0
  108. package/lib/utils.js.map +1 -1
  109. package/package.json +39 -3
  110. package/pihanga-shadcn.css +0 -2
@@ -268,6 +268,93 @@ This string must match the `name` passed to `registerCardComponent` and the
268
268
 
269
269
  ### 2 — Define Props and Events (`*.types.ts`)
270
270
 
271
+ > **Rule: Card Props must only contain basic data types.**
272
+ >
273
+ > All props in a `CardProps` type must be JSON-serialisable primitives
274
+ > (`string`, `number`, `boolean`, `null`) or plain objects / arrays composed
275
+ > exclusively of those primitives. **Never put library interfaces, class
276
+ > instances, or opaque objects (e.g. `StreamParser`, `Extension[]`, `RegExp`,
277
+ > `Date`) directly in a props type.** Pihanga serialises card state through
278
+ > Redux; non-serialisable values break time-travel debugging, HMR, and the
279
+ > playground.
280
+ >
281
+ > When a card genuinely needs a complex third-party value (a parser, a theme
282
+ > extension, a set of keymaps…) use the **registry pattern** described below.
283
+
284
+ #### Registry pattern for complex prop values
285
+
286
+ 1. **Create a module-level registry** (a plain `Map`) keyed by a `string`.
287
+ 2. **Export a `register*` function** so callers can inject their value before
288
+ mounting the card.
289
+ 3. **Use the string key as the prop** — the component looks the value up at
290
+ render time.
291
+
292
+ **Example — `StreamParser` for the CodeMirror card:**
293
+
294
+ ```ts
295
+ // codeMirror.types.ts (public API)
296
+
297
+ /** Keys are arbitrary caller-chosen strings; values are StreamParsers. */
298
+ const streamParserRegistry = new Map<string, StreamParser<unknown>>();
299
+
300
+ /** Call this once at app initialisation time, before the card is rendered. */
301
+ export function registerStreamParser(key: string, parser: StreamParser<unknown>) {
302
+ streamParserRegistry.set(key, parser);
303
+ }
304
+
305
+ /** Internal — used only by the component. */
306
+ export function resolveStreamParser(key: string): StreamParser<unknown> | undefined {
307
+ return streamParserRegistry.get(key);
308
+ }
309
+
310
+ export type CodeMirrorCardProps = {
311
+ value?: string;
312
+ readOnly?: boolean;
313
+ /**
314
+ * Key of a StreamParser previously registered with `registerStreamParser()`.
315
+ * @example
316
+ * import { python } from "@codemirror/legacy-modes/mode/python";
317
+ * registerStreamParser("python", python);
318
+ * CodeMirrorCard({ streamLanguage: "python", value: "print('hello')" });
319
+ */
320
+ streamLanguage?: string; // ✅ plain string — not StreamParser<unknown>
321
+ extensionsKey?: string; // ✅ plain string — not Extension[]
322
+ };
323
+ ```
324
+
325
+ ```ts
326
+ // At app initialisation (e.g. app.pihanga.ts or a dedicated setup file):
327
+ import { python } from "@codemirror/legacy-modes/mode/python";
328
+ import { registerStreamParser } from "@pihanga2/shadcn/codeMirror";
329
+
330
+ registerStreamParser("python", python);
331
+ ```
332
+
333
+ ```tsx
334
+ // codeMirror.component.tsx — look up at render time:
335
+ import { resolveStreamParser } from "./codeMirror.types";
336
+
337
+ const parser = props.streamLanguage
338
+ ? resolveStreamParser(props.streamLanguage)
339
+ : undefined;
340
+ const extensions = parser ? [StreamLanguage.define(parser)] : [];
341
+ ```
342
+
343
+ The same pattern applies to **`Extension[]`** or any other opaque type.
344
+ Register a named bundle of extensions once; reference it by key in props.
345
+
346
+ **Quick checklist:**
347
+
348
+ | Prop value | Allowed directly in Props? | Alternative |
349
+ |---|---|---|
350
+ | `string`, `number`, `boolean` | ✅ | — |
351
+ | Plain `Record<string, string>` | ✅ | — |
352
+ | `StreamParser<T>`, `Extension` | ❌ | Registry pattern (string key) |
353
+ | `RegExp` | ❌ | Pass `string`; compile inside component |
354
+ | `Date` | ❌ | Pass ISO string; parse inside component |
355
+ | React component / function | ❌ | Reference an existing card type string |
356
+
357
+
271
358
  A typical types file has five parts:
272
359
 
273
360
  #### a) Card declaration factory
@@ -336,6 +336,7 @@ Or activate everything at once: `import "@pihanga2/shadcn"`.
336
336
  | dialog | `/r/dialog` | ✅ | |
337
337
  | dropDownMenu | `/r/dropDownMenu` | ✅ | |
338
338
  | field | `/r/field` | ✅ | |
339
+ | fileDrop | `/r/fileDrop` | ✅ | drag-and-drop file upload |
339
340
  | flexGrid | `/r/flexGrid` | ✅ | |
340
341
  | form | `/r/form` | ✅ | |
341
342
  | framework | `/r/framework` | ✅ | App root |
@@ -384,6 +385,18 @@ Full registry index: `https://ivcap-works.github.io/pihanga-shadcn/r/registry.js
384
385
  - `graphin`, `jsonViewer`, `markdownViewer`, `resizable` are not in the npm
385
386
  package — use the registry for those.
386
387
  - Point Tailwind at `node_modules/@pihanga2/shadcn/dist-lib` to scan classes.
388
+ - **Import types from the card index, not deep sub-paths.** The exports map
389
+ only exposes `@pihanga2/shadcn/cards/<card>` — every type from
390
+ `<card>.types.ts` is re-exported there. Deep paths like
391
+ `@pihanga2/shadcn/cards/fileDrop/fileDrop.types` are blocked by Node/Vite:
392
+
393
+ ```ts
394
+ // ❌ Deep sub-path — blocked by exports map, even if the .d.ts exists on disk
395
+ import type {FileDropProps} from "@pihanga2/shadcn/cards/fileDrop/fileDrop.types";
396
+
397
+ // ✅ Correct — all types re-exported from the card index
398
+ import type {FileDropProps} from "@pihanga2/shadcn/cards/fileDrop";
399
+ ```
387
400
 
388
401
  **Both channels:**
389
402
  - After activation, app-wiring APIs (`registerCard`, `registerFramework`,
@@ -1187,3 +1200,37 @@ yarn alternative or Node version constraint.
1187
1200
  | No `yarn dlx` alternative documented | Added `yarn dlx shadcn@latest` as the yarn-compatible alternative in the distribution channels table, Channel 1 init step, and "Adding individual cards" commands |
1188
1201
  | No warning about npm 11 + Node 24 incompatibility | Added a prominent compatibility callout at the top of *Channel 1 — shadcn registry prerequisites*, with the `nvm use 22` workaround and the `yarn dlx` alternative |
1189
1202
  | "Notes for AI agents" section did not mention the `npx` breakage | Added a bullet noting that `npx` fails on npm 11 + Node 24 and that `yarn dlx shadcn@latest` is a drop-in replacement |
1203
+
1204
+ ### 2026-07 user feedback — `fileDrop` import fails from `@pihanga2/shadcn@0.2.0`
1205
+
1206
+ Users on `@pihanga2/shadcn@0.2.0` reported two compounding errors when importing
1207
+ the `fileDrop` card:
1208
+
1209
+ 1. `./cards/fileDrop` was absent from the `exports` map in the published
1210
+ `package.json` — Node/TypeScript/Vite block any unlisted sub-path even when
1211
+ the file physically exists on disk.
1212
+ 2. The `cards/fileDrop/` directory contained only `.d.ts` type stubs — no `.js`
1213
+ runtime files — because `fileDrop` was type-stubbed before the `0.2.0` publish
1214
+ and the build was never re-run to include it.
1215
+
1216
+ **Resolution:** `@pihanga2/shadcn@0.2.5` ships `fileDrop` correctly (`.js` +
1217
+ `.d.ts` + exports map entry). **Upgrade to `>=0.2.5`.**
1218
+
1219
+ ```sh
1220
+ npm install @pihanga2/shadcn@latest
1221
+ # or:
1222
+ yarn add @pihanga2/shadcn@latest
1223
+ ```
1224
+
1225
+ A second mistake was also identified: users attempted to import types from the
1226
+ deep sub-path `@pihanga2/shadcn/cards/fileDrop/fileDrop.types`, which is NOT
1227
+ listed in the exports map and is therefore blocked. All types from `fileDrop.types`
1228
+ are re-exported from the card index — use the card index path instead (see
1229
+ *Notes for AI agents → npm channel* above).
1230
+
1231
+ | Root cause | Fix applied |
1232
+ |---|---|
1233
+ | `fileDrop` added to `core-cards.json` after `@pihanga2/shadcn@0.2.0` was published; package not rebuilt | Fixed in `@pihanga2/shadcn@0.2.5` — `fileDrop` is now fully built and in the exports map |
1234
+ | `react-drag-drop-files` mislabelled in `vite.lib.config.ts` as an "excluded-card guard" dep instead of a legitimate runtime dep | Moved to the runtime deps section with clarifying comment |
1235
+ | `fileDrop` missing from the Available cards table | Added to table |
1236
+ | No documentation that deep sub-path imports (`/cards/fileDrop/fileDrop.types`) are blocked | Added explicit ❌/✅ example to *Notes for AI agents → npm channel* |
package/README.md CHANGED
@@ -62,21 +62,25 @@ import "@pihanga2/shadcn/cards/dataTable";
62
62
 
63
63
  ---
64
64
 
65
- ## Included cards (35)
65
+ ## Included cards (41)
66
66
 
67
+ - `avatar`
67
68
  - `badge`
68
69
  - `box`
69
70
  - `button`
70
71
  - `checkbox`
72
+ - `collapsibleCard`
71
73
  - `conditional`
72
74
  - `dataTable`
73
75
  - `dialog`
76
+ - `drawer`
74
77
  - `dropDownMenu`
75
78
  - `field`
76
79
  - `fileDrop`
77
80
  - `flexGrid`
78
81
  - `form`
79
82
  - `framework`
83
+ - `infoCard`
80
84
  - `input`
81
85
  - `jsonViewer`
82
86
  - `list`
@@ -86,8 +90,10 @@ import "@pihanga2/shadcn/cards/dataTable";
86
90
  - `modeToggle`
87
91
  - `navbarSearch`
88
92
  - `pageWithNavbar`
93
+ - `pageWithNavbarMeta`
89
94
  - `pasteTarget`
90
95
  - `resizable`
96
+ - `scrollbarWithAnnotations`
91
97
  - `select`
92
98
  - `slider`
93
99
  - `sliderValue`
@@ -0,0 +1,11 @@
1
+ import { PiCardProps } from '@pihanga2/core';
2
+ import { AvatarCardProps } from './avatar.types';
3
+ import * as React from "react";
4
+ /**
5
+ * `shad/avatar` card component.
6
+ *
7
+ * Renders a shadcn `<Avatar>` with an optional image and a text fallback.
8
+ * The avatar degrades gracefully: if `src` is absent or the image fails to
9
+ * load, the `fallback` initials are shown inside a muted circle.
10
+ */
11
+ export declare const AvatarComponent: (props: PiCardProps<AvatarCardProps>) => React.ReactNode;
@@ -0,0 +1,26 @@
1
+ import { cn as e } from "../../lib/utils.js";
2
+ import { Avatar as t, AvatarFallback as n, AvatarImage as r } from "../../components/ui/avatar.js";
3
+ import "react";
4
+ import "@pihanga2/core";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ //#region src/cards/avatar/avatar.component.tsx
7
+ var o = {
8
+ sm: "size-6 text-xs",
9
+ md: "size-8 text-xs",
10
+ lg: "size-12 text-sm",
11
+ xl: "size-16 text-base"
12
+ }, s = (s) => {
13
+ let { src: c, alt: l = "", fallback: u, size: d = "md", className: f, cardName: p } = s;
14
+ return /* @__PURE__ */ a(t, {
15
+ className: e(o[d], f),
16
+ "data-pihanga": p,
17
+ children: [c && /* @__PURE__ */ i(r, {
18
+ src: c,
19
+ alt: l
20
+ }), /* @__PURE__ */ i(n, { children: u ?? l.slice(0, 2).toUpperCase() })]
21
+ });
22
+ };
23
+ //#endregion
24
+ export { s as AvatarComponent };
25
+
26
+ //# sourceMappingURL=avatar.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avatar.component.js","names":[],"sources":["../../../src/cards/avatar/avatar.component.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {type PiCardProps} from \"@pihanga2/core\";\nimport {Avatar, AvatarFallback, AvatarImage} from \"@/components/ui/avatar\";\nimport {cn} from \"@/lib/utils\";\nimport type {AvatarCardProps, AvatarSize} from \"./avatar.types\";\n\nconst SIZE_CLASS: Record<AvatarSize, string> = {\n sm: \"size-6 text-xs\",\n md: \"size-8 text-xs\",\n lg: \"size-12 text-sm\",\n xl: \"size-16 text-base\",\n};\n\n/**\n * `shad/avatar` card component.\n *\n * Renders a shadcn `<Avatar>` with an optional image and a text fallback.\n * The avatar degrades gracefully: if `src` is absent or the image fails to\n * load, the `fallback` initials are shown inside a muted circle.\n */\nexport const AvatarComponent = (\n props: PiCardProps<AvatarCardProps>,\n): React.ReactNode => {\n const {src, alt = \"\", fallback, size = \"md\", className, cardName} = props;\n\n return (\n <Avatar className={cn(SIZE_CLASS[size], className)} data-pihanga={cardName}>\n {src && <AvatarImage src={src} alt={alt} />}\n <AvatarFallback>\n {fallback ?? alt.slice(0, 2).toUpperCase()}\n </AvatarFallback>\n </Avatar>\n );\n};\n"],"mappings":";;;;;;AAMA,IAAM,IAAyC;CAC7C,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN,GASa,KACX,MACoB;CACpB,IAAM,EAAC,QAAK,SAAM,IAAI,aAAU,UAAO,MAAM,cAAW,gBAAY;CAEpE,OACE,kBAAC,GAAD;EAAQ,WAAW,EAAG,EAAW,IAAO,CAAS;EAAG,gBAAc;YAAlE,CACG,KAAO,kBAAC,GAAD;GAAkB;GAAU;EAAM,CAAA,GAC1C,kBAAC,GAAD,EAAA,UACG,KAAY,EAAI,MAAM,GAAG,CAAC,EAAE,YAAY,EAC3B,CAAA,CACV;;AAEZ"}
@@ -0,0 +1,46 @@
1
+ export declare const AVATAR_CARD = "shad/avatar";
2
+ /**
3
+ * Avatar size tokens — map to Tailwind `size-*` utilities.
4
+ *
5
+ * | Value | Tailwind | px |
6
+ * |--------|-----------|-----|
7
+ * | `"sm"` | `size-6` | 24 |
8
+ * | `"md"` | `size-8` | 32 |
9
+ * | `"lg"` | `size-12` | 48 |
10
+ * | `"xl"` | `size-16` | 64 |
11
+ */
12
+ export type AvatarSize = "sm" | "md" | "lg" | "xl";
13
+ export type AvatarCardProps = {
14
+ /**
15
+ * URL of the avatar image.
16
+ * When omitted or the image fails to load, `fallback` is shown instead.
17
+ */
18
+ src?: string;
19
+ /** Accessible alt text for the image. */
20
+ alt?: string;
21
+ /**
22
+ * Text rendered inside the fallback circle when no image is available.
23
+ * Typically one or two initials, e.g. `"JD"`.
24
+ */
25
+ fallback?: string;
26
+ /**
27
+ * Avatar diameter.
28
+ * @default "md"
29
+ */
30
+ size?: AvatarSize;
31
+ /** Additional Tailwind classes applied to the root `<span>` element. */
32
+ className?: string;
33
+ };
34
+ /**
35
+ * Factory function for declaring a `shad/avatar` card instance.
36
+ *
37
+ * ```ts
38
+ * import {ShadAvatar} from "@/cards/avatar";
39
+ *
40
+ * registerCard("myApp/userAvatar", ShadAvatar({
41
+ * src: memo((s: AppState) => s.user.avatarUrl),
42
+ * fallback: memo((s: AppState) => s.user.initials),
43
+ * }));
44
+ * ```
45
+ */
46
+ export declare const ShadAvatar: <S extends import('@pihanga2/core').ReduxState>(p: import('@pihanga2/core').PiMapProps<AvatarCardProps, S, {}>) => import('@pihanga2/core').PiCardDef;
@@ -0,0 +1,7 @@
1
+ import { createCardDeclaration as e } from "@pihanga2/core";
2
+ //#region src/cards/avatar/avatar.types.ts
3
+ var t = "shad/avatar", n = e(t);
4
+ //#endregion
5
+ export { t as AVATAR_CARD, n as ShadAvatar };
6
+
7
+ //# sourceMappingURL=avatar.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avatar.types.js","names":[],"sources":["../../../src/cards/avatar/avatar.types.ts"],"sourcesContent":["import {createCardDeclaration} from \"@pihanga2/core\";\n\nexport const AVATAR_CARD = \"shad/avatar\";\n\n/**\n * Avatar size tokens — map to Tailwind `size-*` utilities.\n *\n * | Value | Tailwind | px |\n * |--------|-----------|-----|\n * | `\"sm\"` | `size-6` | 24 |\n * | `\"md\"` | `size-8` | 32 |\n * | `\"lg\"` | `size-12` | 48 |\n * | `\"xl\"` | `size-16` | 64 |\n */\nexport type AvatarSize = \"sm\" | \"md\" | \"lg\" | \"xl\";\n\nexport type AvatarCardProps = {\n /**\n * URL of the avatar image.\n * When omitted or the image fails to load, `fallback` is shown instead.\n */\n src?: string;\n\n /** Accessible alt text for the image. */\n alt?: string;\n\n /**\n * Text rendered inside the fallback circle when no image is available.\n * Typically one or two initials, e.g. `\"JD\"`.\n */\n fallback?: string;\n\n /**\n * Avatar diameter.\n * @default \"md\"\n */\n size?: AvatarSize;\n\n /** Additional Tailwind classes applied to the root `<span>` element. */\n className?: string;\n};\n\n/**\n * Factory function for declaring a `shad/avatar` card instance.\n *\n * ```ts\n * import {ShadAvatar} from \"@/cards/avatar\";\n *\n * registerCard(\"myApp/userAvatar\", ShadAvatar({\n * src: memo((s: AppState) => s.user.avatarUrl),\n * fallback: memo((s: AppState) => s.user.initials),\n * }));\n * ```\n */\nexport const ShadAvatar = createCardDeclaration<AvatarCardProps>(AVATAR_CARD);\n"],"mappings":";;AAEA,IAAa,IAAc,eAoDd,IAAa,EAAuC,CAAW"}
@@ -0,0 +1 @@
1
+ export * from './avatar.types';
@@ -0,0 +1,12 @@
1
+ import { AvatarComponent as e } from "./avatar.component.js";
2
+ import { AVATAR_CARD as t, ShadAvatar as n } from "./avatar.types.js";
3
+ import { registerCardComponent as r } from "@pihanga2/core";
4
+ //#region src/cards/avatar/index.ts
5
+ r({
6
+ name: t,
7
+ component: e
8
+ });
9
+ //#endregion
10
+ export { t as AVATAR_CARD, n as ShadAvatar };
11
+
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/cards/avatar/index.ts"],"sourcesContent":["import {registerCardComponent} from \"@pihanga2/core\";\n\nimport {AvatarComponent} from \"./avatar.component\";\nimport {AVATAR_CARD} from \"./avatar.types\";\n\nexport * from \"./avatar.types\";\n\nregisterCardComponent({\n name: AVATAR_CARD,\n component: AvatarComponent,\n});\n"],"mappings":";;;;AAOA,EAAsB;CACpB,MAAM;CACN,WAAW;AACb,CAAC"}
@@ -1,14 +1,14 @@
1
- import { Badge as e } from "../../components/ui/badge.js";
2
- import { cn as t } from "../../lib/utils.js";
1
+ import { cn as e } from "../../lib/utils.js";
2
+ import { Badge as t } from "../../components/ui/badge.js";
3
3
  import "react";
4
4
  import "@pihanga2/core";
5
5
  import { jsx as n } from "react/jsx-runtime";
6
6
  //#region src/cards/badge/badge.component.tsx
7
7
  var r = (r) => {
8
8
  let { label: i, variant: a = "secondary", className: o, cardName: s } = r;
9
- return /* @__PURE__ */ n(e, {
9
+ return /* @__PURE__ */ n(t, {
10
10
  variant: a,
11
- className: t(o),
11
+ className: e(o),
12
12
  "data-pihanga": s,
13
13
  children: i
14
14
  });
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { PiCardProps } from '@pihanga2/core';
3
+ import { CodeMirrorCardProps, CodeMirrorCardEvents } from './codeMirror.types';
4
+ export declare const CodeMirrorComponent: (props: PiCardProps<CodeMirrorCardProps, CodeMirrorCardEvents>) => React.ReactNode;
@@ -0,0 +1,83 @@
1
+ import { Extension } from '@codemirror/state';
2
+ import { StreamParser } from '@codemirror/language';
3
+ export declare const CODE_MIRROR_CARD = "code-mirror";
4
+ export declare const CodeMirrorCard: <S extends import('@pihanga2/core').ReduxState>(p: import('@pihanga2/core').PiMapProps<CodeMirrorCardProps, S, CodeMirrorCardEvents>) => import('@pihanga2/core').PiCardDef;
5
+ export declare const CODE_MIRROR_ACTION: {
6
+ CHANGED: string;
7
+ };
8
+ export declare const onCodeMirrorChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
9
+ cardID: string;
10
+ } & ChangedEvent>) => void;
11
+ /**
12
+ * Register a StreamParser under a caller-chosen key.
13
+ * Call this once at app initialisation time, before the card is first rendered.
14
+ *
15
+ * @example
16
+ * import { python } from "@codemirror/legacy-modes/mode/python";
17
+ * import { registerStreamParser } from "@pihanga2/shadcn/codeMirror";
18
+ * registerStreamParser("python", python);
19
+ */
20
+ export declare function registerStreamParser(key: string, parser: StreamParser<unknown>): void;
21
+ /** @internal — used by the component only. */
22
+ export declare function resolveStreamParser(key: string): StreamParser<unknown> | undefined;
23
+ /**
24
+ * Register a bundle of CodeMirror 6 extensions (themes, linters, keymaps, …)
25
+ * under a caller-chosen key.
26
+ * Call this once at app initialisation time, before the card is first rendered.
27
+ *
28
+ * @example
29
+ * import { oneDark } from "@codemirror/theme-one-dark";
30
+ * import { registerExtensions } from "@pihanga2/shadcn/codeMirror";
31
+ * registerExtensions("oneDark", [oneDark]);
32
+ */
33
+ export declare function registerExtensions(key: string, exts: Extension[]): void;
34
+ /** @internal — used by the component only. */
35
+ export declare function resolveExtensions(key: string): Extension[] | undefined;
36
+ export type CodeMirrorCardProps = {
37
+ /** The code content to display or edit. */
38
+ value?: string;
39
+ /** When true the editor is read-only. Default: false. */
40
+ readOnly?: boolean;
41
+ /**
42
+ * Key of a StreamParser previously registered with `registerStreamParser()`.
43
+ * Props must be JSON-serialisable — pass the string key, not the parser itself.
44
+ *
45
+ * @example
46
+ * import { python } from "@codemirror/legacy-modes/mode/python";
47
+ * registerStreamParser("python", python);
48
+ * CodeMirrorCard({ streamLanguage: "python", value: "print('hello')" });
49
+ */
50
+ streamLanguage?: string;
51
+ /**
52
+ * Key of an Extension bundle previously registered with `registerExtensions()`.
53
+ * Props must be JSON-serialisable — pass the string key, not the Extension objects.
54
+ *
55
+ * @example
56
+ * import { oneDark } from "@codemirror/theme-one-dark";
57
+ * registerExtensions("oneDark", [oneDark]);
58
+ * CodeMirrorCard({ extensionsKey: "oneDark", ... });
59
+ */
60
+ extensionsKey?: string;
61
+ /**
62
+ * CodeMirror editor theme — "light" or "dark".
63
+ * For a custom Extension-based theme, register it via `registerExtensions()`
64
+ * and pass its key using the `extensions` prop instead.
65
+ */
66
+ theme?: "light" | "dark";
67
+ /** Show line numbers in the gutter. Default: true. */
68
+ lineNumbers?: boolean;
69
+ /**
70
+ * CSS height of the editor. Use "auto" to grow with content or a fixed
71
+ * value such as "400px". Default: "auto".
72
+ */
73
+ height?: string;
74
+ /** Additional CSS class applied to the outer wrapper div. */
75
+ className?: string;
76
+ };
77
+ export type ChangedEvent = {
78
+ /** The updated editor content after each change. */
79
+ value: string;
80
+ };
81
+ export type CodeMirrorCardEvents = {
82
+ onChanged: ChangedEvent;
83
+ };
@@ -0,0 +1 @@
1
+ export * from './codeMirror.types';
@@ -0,0 +1,4 @@
1
+ import { PiCardProps } from '@pihanga2/core';
2
+ import { CollapsibleCardProps, CollapsibleCardEvents } from './collapsibleCard.types';
3
+ import * as React from "react";
4
+ export declare const CollapsibleCardComponent: (props: PiCardProps<CollapsibleCardProps, CollapsibleCardEvents>) => React.ReactNode;
@@ -0,0 +1,61 @@
1
+ import { getIcon as e } from "../icons.js";
2
+ import { cn as t } from "../../lib/utils.js";
3
+ import * as n from "react";
4
+ import { Card as r } from "@pihanga2/core";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ import * as o from "@radix-ui/react-collapsible";
7
+ import { ChevronsUpDown as s } from "lucide-react";
8
+ //#region src/cards/collapsibleCard/collapsibleCard.component.tsx
9
+ var c = {
10
+ h1: "scroll-m-20 text-4xl font-extrabold tracking-tight",
11
+ h2: "scroll-m-20 text-3xl font-semibold tracking-tight",
12
+ h3: "scroll-m-20 text-2xl font-semibold tracking-tight",
13
+ h4: "scroll-m-20 text-xl font-semibold tracking-tight",
14
+ p: "leading-7",
15
+ lead: "text-xl text-muted-foreground",
16
+ large: "text-lg font-semibold",
17
+ small: "text-sm font-medium leading-none",
18
+ muted: "text-sm text-muted-foreground"
19
+ }, l = (l) => {
20
+ let { title: u, titleLevel: d = "h4", titleCard: f, icon: p, contentCard: m, defaultOpen: h = !1, open: g, onOpenChanged: _, className: v, headerClassName: y, contentClassName: b, style: x, cardName: S } = l, [C, w] = n.useState(h), T = g === void 0 ? C : g;
21
+ function E(e) {
22
+ w(e), _?.({ open: e });
23
+ }
24
+ let D = p ? e(p) : /* @__PURE__ */ i(s, { className: "h-4 w-4" });
25
+ return /* @__PURE__ */ a(o.Root, {
26
+ open: T,
27
+ onOpenChange: E,
28
+ className: t("w-full", v),
29
+ style: x,
30
+ "data-pihanga": S,
31
+ children: [/* @__PURE__ */ a("div", {
32
+ className: t("flex items-center justify-between space-x-4 py-2", y),
33
+ children: [f ? /* @__PURE__ */ i(r, {
34
+ cardName: f,
35
+ parentCard: S
36
+ }) : /* @__PURE__ */ i("span", {
37
+ className: c[d],
38
+ children: u
39
+ }), /* @__PURE__ */ i(o.Trigger, {
40
+ asChild: !0,
41
+ children: /* @__PURE__ */ i("button", {
42
+ type: "button",
43
+ className: "shrink-0 rounded-sm p-1 transition-colors hover:bg-accent hover:text-accent-foreground",
44
+ "aria-expanded": T,
45
+ "aria-label": T ? "Collapse" : "Expand",
46
+ children: D
47
+ })
48
+ })]
49
+ }), /* @__PURE__ */ i(o.Content, {
50
+ className: t("overflow-hidden", b),
51
+ children: m && /* @__PURE__ */ i(r, {
52
+ cardName: m,
53
+ parentCard: S
54
+ })
55
+ })]
56
+ });
57
+ };
58
+ //#endregion
59
+ export { l as CollapsibleCardComponent };
60
+
61
+ //# sourceMappingURL=collapsibleCard.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collapsibleCard.component.js","names":[],"sources":["../../../src/cards/collapsibleCard/collapsibleCard.component.tsx"],"sourcesContent":["import * as React from \"react\";\nimport * as CollapsiblePrimitive from \"@radix-ui/react-collapsible\";\nimport {ChevronsUpDown} from \"lucide-react\";\nimport {Card, type PiCardProps} from \"@pihanga2/core\";\nimport {cn} from \"@/lib/utils\";\nimport {getIcon} from \"@/cards/icons\";\nimport type {\n CollapsibleCardProps,\n CollapsibleCardEvents,\n CollapsibleTitleLevel,\n} from \"./collapsibleCard.types\";\n\nconst TITLE_CLASSES: Record<CollapsibleTitleLevel, string> = {\n h1: \"scroll-m-20 text-4xl font-extrabold tracking-tight\",\n h2: \"scroll-m-20 text-3xl font-semibold tracking-tight\",\n h3: \"scroll-m-20 text-2xl font-semibold tracking-tight\",\n h4: \"scroll-m-20 text-xl font-semibold tracking-tight\",\n p: \"leading-7\",\n lead: \"text-xl text-muted-foreground\",\n large: \"text-lg font-semibold\",\n small: \"text-sm font-medium leading-none\",\n muted: \"text-sm text-muted-foreground\",\n};\n\nexport const CollapsibleCardComponent = (\n props: PiCardProps<CollapsibleCardProps, CollapsibleCardEvents>,\n): React.ReactNode => {\n const {\n title,\n titleLevel = \"h4\",\n titleCard,\n icon,\n contentCard,\n defaultOpen = false,\n open,\n onOpenChanged,\n className,\n headerClassName,\n contentClassName,\n style,\n cardName,\n } = props;\n\n const [localOpen, setLocalOpen] = React.useState(defaultOpen);\n const openState = open !== undefined ? open : localOpen;\n\n function handleOpenChange(next: boolean): void {\n setLocalOpen(next);\n onOpenChanged?.({open: next});\n }\n\n const triggerIcon = icon ? (\n getIcon(icon)\n ) : (\n <ChevronsUpDown className=\"h-4 w-4\" />\n );\n\n return (\n <CollapsiblePrimitive.Root\n open={openState}\n onOpenChange={handleOpenChange}\n className={cn(\"w-full\", className)}\n style={style}\n data-pihanga={cardName}\n >\n <div\n className={cn(\n \"flex items-center justify-between space-x-4 py-2\",\n headerClassName,\n )}\n >\n {titleCard ? (\n <Card cardName={titleCard} parentCard={cardName} />\n ) : (\n <span className={TITLE_CLASSES[titleLevel]}>{title}</span>\n )}\n <CollapsiblePrimitive.Trigger asChild>\n <button\n type=\"button\"\n className=\"shrink-0 rounded-sm p-1 transition-colors hover:bg-accent hover:text-accent-foreground\"\n aria-expanded={openState}\n aria-label={openState ? \"Collapse\" : \"Expand\"}\n >\n {triggerIcon}\n </button>\n </CollapsiblePrimitive.Trigger>\n </div>\n <CollapsiblePrimitive.Content\n className={cn(\"overflow-hidden\", contentClassName)}\n >\n {contentCard && <Card cardName={contentCard} parentCard={cardName} />}\n </CollapsiblePrimitive.Content>\n </CollapsiblePrimitive.Root>\n );\n};\n"],"mappings":";;;;;;;;AAYA,IAAM,IAAuD;CAC3D,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,GAAG;CACH,MAAM;CACN,OAAO;CACP,OAAO;CACP,OAAO;AACT,GAEa,KACX,MACoB;CACpB,IAAM,EACJ,UACA,gBAAa,MACb,cACA,SACA,gBACA,iBAAc,IACd,SACA,kBACA,cACA,oBACA,qBACA,UACA,gBACE,GAEE,CAAC,GAAW,KAAgB,EAAM,SAAS,CAAW,GACtD,IAAY,MAAS,KAAA,IAAmB,IAAP;CAEvC,SAAS,EAAiB,GAAqB;EAE7C,AADA,EAAa,CAAI,GACjB,IAAgB,EAAC,MAAM,EAAI,CAAC;CAC9B;CAEA,IAAM,IAAc,IAClB,EAAQ,CAAI,IAEZ,kBAAC,GAAD,EAAgB,WAAU,UAAW,CAAA;CAGvC,OACE,kBAAC,EAAqB,MAAtB;EACE,MAAM;EACN,cAAc;EACd,WAAW,EAAG,UAAU,CAAS;EAC1B;EACP,gBAAc;YALhB,CAOE,kBAAC,OAAD;GACE,WAAW,EACT,oDACA,CACF;aAJF,CAMG,IACC,kBAAC,GAAD;IAAM,UAAU;IAAW,YAAY;GAAW,CAAA,IAElD,kBAAC,QAAD;IAAM,WAAW,EAAc;cAAc;GAAY,CAAA,GAE3D,kBAAC,EAAqB,SAAtB;IAA8B,SAAA;cAC5B,kBAAC,UAAD;KACE,MAAK;KACL,WAAU;KACV,iBAAe;KACf,cAAY,IAAY,aAAa;eAEpC;IACK,CAAA;GACoB,CAAA,CAC3B;MACL,kBAAC,EAAqB,SAAtB;GACE,WAAW,EAAG,mBAAmB,CAAgB;aAEhD,KAAe,kBAAC,GAAD;IAAM,UAAU;IAAa,YAAY;GAAW,CAAA;EACxC,CAAA,CACL;;AAE/B"}
@@ -0,0 +1,91 @@
1
+ import { PiCardRef } from '@pihanga2/core';
2
+ import { default as React } from 'react';
3
+ export declare const COLLAPSIBLE_CARD = "shad/collapsible";
4
+ export declare const COLLAPSIBLE_CARD_ACTION: {
5
+ OPENCHANGED: string;
6
+ };
7
+ export type CollapsibleCardOpenChangedEvent = {
8
+ open: boolean;
9
+ };
10
+ export declare const onCollapsibleCardOpenChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
11
+ cardID: string;
12
+ } & CollapsibleCardOpenChangedEvent>) => void;
13
+ export type CollapsibleCardEvents = {
14
+ onOpenChanged: CollapsibleCardOpenChangedEvent;
15
+ };
16
+ /**
17
+ * Subset of shadcn/ui typography levels supported for the built-in title slot.
18
+ */
19
+ export type CollapsibleTitleLevel = "h1" | "h2" | "h3" | "h4" | "p" | "lead" | "large" | "small" | "muted";
20
+ export type CollapsibleCardProps = {
21
+ /**
22
+ * Plain-text title rendered in the trigger row using the built-in
23
+ * Typography styles. Use `titleCard` instead to supply a full Pihanga card.
24
+ */
25
+ title?: string;
26
+ /**
27
+ * Typography level applied to `title`.
28
+ * @default "h4"
29
+ */
30
+ titleLevel?: CollapsibleTitleLevel;
31
+ /**
32
+ * Alternative to `title` — any Pihanga card reference rendered as the
33
+ * header (e.g. a `shad/typography` or `shad/badge` card).
34
+ * When provided, `title` and `titleLevel` are ignored.
35
+ */
36
+ titleCard?: PiCardRef;
37
+ /**
38
+ * Icon name from the Pihanga icon registry, shown inside the toggle button.
39
+ * Falls back to the built-in `ChevronsUpDown` icon when omitted.
40
+ *
41
+ * @example
42
+ * import {registerIcon} from "@/cards/icons";
43
+ * import {ChevronDown} from "lucide-react";
44
+ * registerIcon("chevron-down", ChevronDown);
45
+ * CollapsibleCard({ icon: "chevron-down", ... });
46
+ */
47
+ icon?: string;
48
+ /**
49
+ * Pihanga card reference rendered inside the collapsible body.
50
+ */
51
+ contentCard?: PiCardRef;
52
+ /**
53
+ * Whether the panel is open on first render (uncontrolled mode).
54
+ * @default false
55
+ */
56
+ defaultOpen?: boolean;
57
+ /**
58
+ * Controlled open state. When provided, the component delegates all open
59
+ * state management to the consumer — update this via `onOpenChanged`.
60
+ */
61
+ open?: boolean;
62
+ /** CSS classes applied to the root `<div>`. */
63
+ className?: string;
64
+ /** CSS classes applied to the trigger row (title + toggle button). */
65
+ headerClassName?: string;
66
+ /** CSS classes applied to the collapsible content wrapper `<div>`. */
67
+ contentClassName?: string;
68
+ /** Inline styles on the root element. */
69
+ style?: React.CSSProperties;
70
+ };
71
+ /**
72
+ * Factory function for declaring a `shad/collapsible` card instance.
73
+ *
74
+ * ```ts
75
+ * import {registerCard} from "@pihanga2/core";
76
+ * import {CollapsibleCard} from "@/cards/collapsibleCard";
77
+ * import {Typography} from "@/cards/typography";
78
+ *
79
+ * registerCard("myApp/details", CollapsibleCard({
80
+ * title: "Advanced options",
81
+ * titleLevel: "h4",
82
+ * contentCard: "myApp/detailsBody",
83
+ * }));
84
+ *
85
+ * registerCard("myApp/detailsBody", Typography({
86
+ * text: "Hidden content revealed when expanded.",
87
+ * level: "p",
88
+ * }));
89
+ * ```
90
+ */
91
+ export declare const CollapsibleCard: <S extends import('@pihanga2/core').ReduxState>(p: import('@pihanga2/core').PiMapProps<CollapsibleCardProps, S, CollapsibleCardEvents>) => import('@pihanga2/core').PiCardDef;
@@ -0,0 +1,7 @@
1
+ import { createCardDeclaration as e, createOnAction as t, registerActions as n } from "@pihanga2/core";
2
+ //#region src/cards/collapsibleCard/collapsibleCard.types.ts
3
+ var r = "shad/collapsible", i = n(r, ["openChanged"]), a = t(i.OPENCHANGED), o = e(r);
4
+ //#endregion
5
+ export { r as COLLAPSIBLE_CARD, i as COLLAPSIBLE_CARD_ACTION, o as CollapsibleCard, a as onCollapsibleCardOpenChanged };
6
+
7
+ //# sourceMappingURL=collapsibleCard.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collapsibleCard.types.js","names":[],"sources":["../../../src/cards/collapsibleCard/collapsibleCard.types.ts"],"sourcesContent":["import {\n createCardDeclaration,\n createOnAction,\n registerActions,\n type PiCardRef,\n} from \"@pihanga2/core\";\nimport type React from \"react\";\n\nexport const COLLAPSIBLE_CARD = \"shad/collapsible\";\n\nexport const COLLAPSIBLE_CARD_ACTION = registerActions(COLLAPSIBLE_CARD, [\n \"openChanged\",\n]);\n\nexport type CollapsibleCardOpenChangedEvent = {open: boolean};\n\nexport const onCollapsibleCardOpenChanged =\n createOnAction<CollapsibleCardOpenChangedEvent>(\n COLLAPSIBLE_CARD_ACTION.OPENCHANGED,\n );\n\nexport type CollapsibleCardEvents = {\n onOpenChanged: CollapsibleCardOpenChangedEvent;\n};\n\n/**\n * Subset of shadcn/ui typography levels supported for the built-in title slot.\n */\nexport type CollapsibleTitleLevel =\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"p\"\n | \"lead\"\n | \"large\"\n | \"small\"\n | \"muted\";\n\nexport type CollapsibleCardProps = {\n /**\n * Plain-text title rendered in the trigger row using the built-in\n * Typography styles. Use `titleCard` instead to supply a full Pihanga card.\n */\n title?: string;\n\n /**\n * Typography level applied to `title`.\n * @default \"h4\"\n */\n titleLevel?: CollapsibleTitleLevel;\n\n /**\n * Alternative to `title` — any Pihanga card reference rendered as the\n * header (e.g. a `shad/typography` or `shad/badge` card).\n * When provided, `title` and `titleLevel` are ignored.\n */\n titleCard?: PiCardRef;\n\n /**\n * Icon name from the Pihanga icon registry, shown inside the toggle button.\n * Falls back to the built-in `ChevronsUpDown` icon when omitted.\n *\n * @example\n * import {registerIcon} from \"@/cards/icons\";\n * import {ChevronDown} from \"lucide-react\";\n * registerIcon(\"chevron-down\", ChevronDown);\n * CollapsibleCard({ icon: \"chevron-down\", ... });\n */\n icon?: string;\n\n /**\n * Pihanga card reference rendered inside the collapsible body.\n */\n contentCard?: PiCardRef;\n\n /**\n * Whether the panel is open on first render (uncontrolled mode).\n * @default false\n */\n defaultOpen?: boolean;\n\n /**\n * Controlled open state. When provided, the component delegates all open\n * state management to the consumer — update this via `onOpenChanged`.\n */\n open?: boolean;\n\n /** CSS classes applied to the root `<div>`. */\n className?: string;\n\n /** CSS classes applied to the trigger row (title + toggle button). */\n headerClassName?: string;\n\n /** CSS classes applied to the collapsible content wrapper `<div>`. */\n contentClassName?: string;\n\n /** Inline styles on the root element. */\n style?: React.CSSProperties;\n};\n\n/**\n * Factory function for declaring a `shad/collapsible` card instance.\n *\n * ```ts\n * import {registerCard} from \"@pihanga2/core\";\n * import {CollapsibleCard} from \"@/cards/collapsibleCard\";\n * import {Typography} from \"@/cards/typography\";\n *\n * registerCard(\"myApp/details\", CollapsibleCard({\n * title: \"Advanced options\",\n * titleLevel: \"h4\",\n * contentCard: \"myApp/detailsBody\",\n * }));\n *\n * registerCard(\"myApp/detailsBody\", Typography({\n * text: \"Hidden content revealed when expanded.\",\n * level: \"p\",\n * }));\n * ```\n */\nexport const CollapsibleCard = createCardDeclaration<\n CollapsibleCardProps,\n CollapsibleCardEvents\n>(COLLAPSIBLE_CARD);\n"],"mappings":";;AAQA,IAAa,IAAmB,oBAEnB,IAA0B,EAAgB,GAAkB,CACvE,aACF,CAAC,GAIY,IACX,EACE,EAAwB,WAC1B,GAsGW,IAAkB,EAG7B,CAAgB"}
@@ -0,0 +1 @@
1
+ export * from './collapsibleCard.types';
@@ -0,0 +1,13 @@
1
+ import { CollapsibleCardComponent as e } from "./collapsibleCard.component.js";
2
+ import { COLLAPSIBLE_CARD as t, COLLAPSIBLE_CARD_ACTION as n, CollapsibleCard as r, onCollapsibleCardOpenChanged as i } from "./collapsibleCard.types.js";
3
+ import { actionTypesToEvents as a, registerCardComponent as o } from "@pihanga2/core";
4
+ //#region src/cards/collapsibleCard/index.tsx
5
+ o({
6
+ name: t,
7
+ component: e,
8
+ events: a(n)
9
+ });
10
+ //#endregion
11
+ export { t as COLLAPSIBLE_CARD, n as COLLAPSIBLE_CARD_ACTION, r as CollapsibleCard, i as onCollapsibleCardOpenChanged };
12
+
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/cards/collapsibleCard/index.tsx"],"sourcesContent":["import {actionTypesToEvents, registerCardComponent} from \"@pihanga2/core\";\n\nimport {CollapsibleCardComponent} from \"./collapsibleCard.component\";\nimport {\n COLLAPSIBLE_CARD,\n COLLAPSIBLE_CARD_ACTION,\n} from \"./collapsibleCard.types\";\n\nexport * from \"./collapsibleCard.types\";\n\nregisterCardComponent({\n name: COLLAPSIBLE_CARD,\n component: CollapsibleCardComponent,\n events: actionTypesToEvents(COLLAPSIBLE_CARD_ACTION),\n});\n"],"mappings":";;;;AAUA,EAAsB;CACpB,MAAM;CACN,WAAW;CACX,QAAQ,EAAoB,CAAuB;AACrD,CAAC"}