@pihanga2/shadcn 0.2.0 → 0.2.1

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 (39) hide show
  1. package/AGENT.md +10 -3
  2. package/AGENT.using-cards.md +55 -246
  3. package/cards/box/box.component.js +2 -2
  4. package/cards/box/box.component.js.map +1 -1
  5. package/cards/button/button.types.d.ts +3 -0
  6. package/cards/button/button.types.js +2 -2
  7. package/cards/button/button.types.js.map +1 -1
  8. package/cards/button/index.js +5 -5
  9. package/cards/chartGraph/chartGraph.component.d.ts +4 -0
  10. package/cards/chartGraph/chartGraph.types.d.ts +102 -0
  11. package/cards/chartGraph/index.d.ts +1 -0
  12. package/cards/conditional/conditional.component.d.ts +14 -3
  13. package/cards/conditional/conditional.component.js +17 -9
  14. package/cards/conditional/conditional.component.js.map +1 -1
  15. package/cards/conditional/conditional.types.d.ts +100 -8
  16. package/cards/conditional/conditional.types.js.map +1 -1
  17. package/cards/core-index.js +31 -31
  18. package/cards/graphin/contextMenu.component.d.ts +28 -0
  19. package/cards/graphin/eventDispatcher.component.d.ts +8 -0
  20. package/cards/graphin/graphin.component.d.ts +2 -2
  21. package/cards/graphin/graphin.playground-cards.d.ts +1 -0
  22. package/cards/graphin/graphin.types.d.ts +444 -4
  23. package/cards/graphin/graphinOpHandler.component.d.ts +8 -0
  24. package/cards/graphin/index.d.ts +1 -0
  25. package/cards/graphin/tooltip.component.d.ts +13 -1
  26. package/cards/slider/index.d.ts +1 -0
  27. package/cards/slider/slider.component.d.ts +4 -0
  28. package/cards/slider/slider.types.d.ts +102 -0
  29. package/cards/sliderValue/index.d.ts +1 -0
  30. package/cards/sliderValue/sliderValue.component.d.ts +15 -0
  31. package/cards/sliderValue/sliderValue.types.d.ts +21 -0
  32. package/cards/tabs/tabs.component.js +51 -25
  33. package/cards/tabs/tabs.component.js.map +1 -1
  34. package/cards/tabs/tabs.types.d.ts +10 -0
  35. package/cards/tabs/tabs.types.js.map +1 -1
  36. package/components/hooks/use-breakpoint.d.ts +49 -0
  37. package/components/hooks/use-breakpoint.js +73 -0
  38. package/components/hooks/use-breakpoint.js.map +1 -0
  39. package/package.json +1 -1
@@ -1,15 +1,23 @@
1
- import { Card as e } from "@pihanga2/core";
2
- import "react";
3
- import { jsx as t } from "react/jsx-runtime";
1
+ import { useBreakpoint as e, useContainerBreakpoint as t } from "../../components/hooks/use-breakpoint.js";
2
+ import { Card as n } from "@pihanga2/core";
3
+ import * as r from "react";
4
+ import { jsx as i } from "react/jsx-runtime";
4
5
  //#region src/cards/conditional/conditional.component.tsx
5
- var n = (n) => {
6
- let { cardName: r, show: i, content: a } = n;
7
- return i ? /* @__PURE__ */ t(e, {
8
- cardName: a,
9
- parentCard: r
6
+ var a = (a) => {
7
+ let { cardName: o, show: s = !0, showOn: c, containerQuery: l = !1, content: u } = a, d = r.useRef(null), f = e(l ? void 0 : c), p = t(l ? c : void 0, d), m = s && (l ? p : f);
8
+ return l ? /* @__PURE__ */ i("div", {
9
+ ref: d,
10
+ style: { width: "100%" },
11
+ children: m && /* @__PURE__ */ i(n, {
12
+ cardName: u,
13
+ parentCard: o
14
+ })
15
+ }) : m ? /* @__PURE__ */ i(n, {
16
+ cardName: u,
17
+ parentCard: o
10
18
  }) : null;
11
19
  };
12
20
  //#endregion
13
- export { n as ConditionalComponent };
21
+ export { a as ConditionalComponent };
14
22
 
15
23
  //# sourceMappingURL=conditional.component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"conditional.component.js","names":[],"sources":["../../../src/cards/conditional/conditional.component.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {Card, type PiCardProps} from \"@pihanga2/core\";\nimport type {ConditionalProps} from \"./conditional.types\";\n\n/**\n * ConditionalComponent\n *\n * Transparent pass-through: renders the `content` card when `show` is `true`,\n * returns `null` otherwise. No extra DOM wrapper is added the mounted\n * card's own root element is the only node in the tree.\n */\nexport const ConditionalComponent = (\n props: PiCardProps<ConditionalProps>,\n): React.ReactNode => {\n const {cardName, show, content} = props;\n if (!show) return null;\n return <Card cardName={content} parentCard={cardName} />;\n};\n"],"mappings":";;;;AAWA,IAAa,KACX,MACoB;CACpB,IAAM,EAAC,aAAU,SAAM,eAAW;CAElC,OADK,IACE,kBAAC,GAAD;EAAM,UAAU;EAAS,YAAY;CAAW,CAAA,IADrC;AAEpB"}
1
+ {"version":3,"file":"conditional.component.js","names":[],"sources":["../../../src/cards/conditional/conditional.component.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {Card, type PiCardProps} from \"@pihanga2/core\";\nimport {\n useBreakpoint,\n useContainerBreakpoint,\n} from \"@/components/hooks/use-breakpoint\";\nimport type {ConditionalProps} from \"./conditional.types\";\n\n/**\n * ConditionalComponent\n *\n * Renders the `content` card when the combined visibility condition is `true`,\n * returns `null` otherwise.\n *\n * Visibility rules (all must be satisfied):\n * 1. `show` — manual boolean gate (defaults to `true` when omitted)\n * 2. `showOn` — breakpoint selector (always `true` when omitted)\n * • `containerQuery: false` (default) → evaluated against the **viewport**\n * via `window.matchMedia`\n * • `containerQuery: true` → evaluated against the width of the\n * **enclosing container** via `ResizeObserver`; a thin `<div>` wrapper\n * is rendered so the container width can be measured\n *\n * Both hooks are always called unconditionally (React rules); whichever is not\n * \"active\" receives `undefined` and returns `true` immediately.\n */\nexport const ConditionalComponent = (\n props: PiCardProps<ConditionalProps>,\n): React.ReactNode => {\n const {\n cardName,\n show = true,\n showOn,\n containerQuery = false,\n content,\n } = props;\n\n // Ref for container-query mode — attached to the wrapper div.\n // Always created (hooks must not be conditional).\n const wrapperRef = React.useRef<HTMLDivElement>(null);\n\n // Viewport breakpoint: active when containerQuery is false.\n const viewportMatch = useBreakpoint(containerQuery ? undefined : showOn);\n\n // Container breakpoint: active when containerQuery is true.\n const containerMatch = useContainerBreakpoint(\n containerQuery ? showOn : undefined,\n wrapperRef,\n );\n\n const breakpointMatch = containerQuery ? containerMatch : viewportMatch;\n const visible = show && breakpointMatch;\n\n // ── Container-query mode ─────────────────────────────────────────────────\n // Render a full-width wrapper so ResizeObserver has something to measure.\n // The wrapper is always in the DOM (measuring must be continuous), but the\n // content card inside it is mounted/unmounted based on `visible`.\n if (containerQuery) {\n return (\n <div ref={wrapperRef} style={{width: \"100%\"}}>\n {visible && <Card cardName={content} parentCard={cardName} />}\n </div>\n );\n }\n\n // ── Viewport / manual mode ───────────────────────────────────────────────\n // Transparent pass-through — no extra DOM node.\n if (!visible) return null;\n return <Card cardName={content} parentCard={cardName} />;\n};\n"],"mappings":";;;;;AA0BA,IAAa,KACX,MACoB;CACpB,IAAM,EACJ,aACA,UAAO,IACP,WACA,oBAAiB,IACjB,eACE,GAIE,IAAa,EAAM,OAAuB,IAAI,GAG9C,IAAgB,EAAc,IAAiB,KAAA,IAAY,CAAM,GAGjE,IAAiB,EACrB,IAAiB,IAAS,KAAA,GAC1B,CACF,GAGM,IAAU,MADQ,IAAiB,IAAiB;CAkB1D,OAXI,IAEA,kBAAC,OAAD;EAAK,KAAK;EAAY,OAAO,EAAC,OAAO,OAAM;YACxC,KAAW,kBAAC,GAAD;GAAM,UAAU;GAAS,YAAY;EAAW,CAAA;CACzD,CAAA,IAMJ,IACE,kBAAC,GAAD;EAAM,UAAU;EAAS,YAAY;CAAW,CAAA,IADlC;AAEvB"}
@@ -1,14 +1,39 @@
1
1
  import { PiCardRef } from '@pihanga2/core';
2
2
  export declare const CONDITIONAL_CARD = "shad/conditional";
3
3
  export declare const Conditional: <S extends import('@pihanga2/core').ReduxState>(p: import('@pihanga2/core').PiMapProps<ConditionalProps, S, {}>) => import('@pihanga2/core').PiCardDef;
4
+ /**
5
+ * Named Tailwind-compatible breakpoints or a custom pixel expression.
6
+ *
7
+ * Named breakpoints (Tailwind CSS defaults)
8
+ * ─────────────────────────────────────────
9
+ * `sm` → viewport ≥ 640 px
10
+ * `md` → viewport ≥ 768 px
11
+ * `lg` → viewport ≥ 1024 px
12
+ * `xl` → viewport ≥ 1280 px
13
+ * `2xl` → viewport ≥ 1536 px
14
+ *
15
+ * Pixel expressions
16
+ * ─────────────────
17
+ * `400px` → viewport ≥ 400 px (bare value = min-width)
18
+ * `>=640px` → viewport ≥ 640 px
19
+ * `>640px` → viewport > 640 px (min-width: 641px)
20
+ * `<=1024px` → viewport ≤ 1024 px
21
+ * `<1024px` → viewport < 1024 px (max-width: 1023px)
22
+ */
23
+ export type BreakpointSelector = "sm" | "md" | "lg" | "xl" | "2xl" | (string & Record<never, never>);
4
24
  /**
5
25
  * Props for the `shad/conditional` card.
6
26
  *
7
- * Renders `content` only when `show` is `true`; renders nothing otherwise.
8
- * This is a transparent pass-through — no extra DOM wrapper is added.
27
+ * The card renders `content` only when the combined visibility condition is
28
+ * `true`; it renders nothing otherwise. This is a transparent pass-through —
29
+ * no extra DOM wrapper is added.
30
+ *
31
+ * ## Modes
9
32
  *
10
- * In a real app, drive `show` from a `memo()` selector so the card
11
- * reactively mounts/unmounts as state changes:
33
+ * ### 1 · Manual boolean (existing behaviour)
34
+ *
35
+ * Drive `show` from a `memo()` selector so the card reactively mounts/unmounts
36
+ * as state changes:
12
37
  *
13
38
  * ```ts
14
39
  * import {memo, registerCard} from "@pihanga2/core";
@@ -19,11 +44,78 @@ export declare const Conditional: <S extends import('@pihanga2/core').ReduxState
19
44
  * content: "myApp/emptyStateHint",
20
45
  * }));
21
46
  * ```
47
+ *
48
+ * ### 2 · Breakpoint-based auto-selection (new)
49
+ *
50
+ * Set `showOn` to a breakpoint name or pixel expression. The component
51
+ * subscribes to `window.matchMedia` and automatically mounts/unmounts the
52
+ * content card as the viewport crosses the breakpoint — no state, no memo:
53
+ *
54
+ * ```ts
55
+ * // Show only on tablet-sized screens and up
56
+ * registerCard("myApp/sidebar", Conditional({
57
+ * showOn: "md",
58
+ * content: "myApp/desktopSidebar",
59
+ * }));
60
+ *
61
+ * // Show only on narrow viewports (mobile drawer)
62
+ * registerCard("myApp/mobileNav", Conditional({
63
+ * showOn: "<768px",
64
+ * content: "myApp/drawer",
65
+ * }));
66
+ * ```
67
+ *
68
+ * ### 3 · Combined
69
+ *
70
+ * Both conditions are ANDed — content renders only when the breakpoint matches
71
+ * **and** `show` is `true`:
72
+ *
73
+ * ```ts
74
+ * registerCard("myApp/adminSidebar", Conditional({
75
+ * show: memo((s: AppState) => s.isAdmin),
76
+ * showOn: "lg",
77
+ * content: "myApp/adminPanel",
78
+ * }));
79
+ * ```
22
80
  */
23
81
  export type ConditionalProps = {
24
- /** Render `content` only when this is `true`. Drive with `memo()` for
25
- * reactive mount/unmount behaviour. */
26
- show: boolean;
27
- /** The card to render when `show` is `true`. */
82
+ /**
83
+ * Manual boolean gate. When omitted it defaults to `true` so that a
84
+ * `showOn`-only card does not need to set it explicitly.
85
+ *
86
+ * Drive with `memo()` for reactive mount/unmount behaviour.
87
+ */
88
+ show?: boolean;
89
+ /**
90
+ * Viewport-width breakpoint selector. When set, the component subscribes
91
+ * to `window.matchMedia` and reactively shows/hides the content card
92
+ * whenever the viewport crosses the breakpoint.
93
+ *
94
+ * Supported values: `sm` | `md` | `lg` | `xl` | `2xl` (Tailwind),
95
+ * or pixel expressions such as `>400px`, `>=640px`, `<768px`, `<=1024px`,
96
+ * `400px`.
97
+ *
98
+ * When both `show` and `showOn` are provided the content is rendered only
99
+ * when **both** conditions are satisfied.
100
+ *
101
+ * By default the breakpoint is evaluated against the **viewport** width via
102
+ * `window.matchMedia`. Set `containerQuery: true` to evaluate it against
103
+ * the width of the **enclosing container** instead (uses `ResizeObserver`).
104
+ */
105
+ showOn?: BreakpointSelector;
106
+ /**
107
+ * When `true`, the `showOn` breakpoint is measured against the width of the
108
+ * component's **enclosing container** rather than the viewport.
109
+ *
110
+ * Internally the component renders a transparent `<div style="width:100%">`
111
+ * wrapper and observes it with `ResizeObserver`. This means a single extra
112
+ * DOM node is added when `containerQuery` is `true`.
113
+ *
114
+ * Has no effect when `showOn` is not set.
115
+ *
116
+ * @default false
117
+ */
118
+ containerQuery?: boolean;
119
+ /** The card to render when the visibility condition is met. */
28
120
  content: PiCardRef;
29
121
  };
@@ -1 +1 @@
1
- {"version":3,"file":"conditional.types.js","names":[],"sources":["../../../src/cards/conditional/conditional.types.ts"],"sourcesContent":["import {createCardDeclaration} from \"@pihanga2/core\";\nimport type {PiCardRef} from \"@pihanga2/core\";\n\n// ── Card id ───────────────────────────────────────────────────────────────────\n\nexport const CONDITIONAL_CARD = \"shad/conditional\";\n\n// ── Card declaration factory ──────────────────────────────────────────────────\n\nexport const Conditional =\n createCardDeclaration<ConditionalProps>(CONDITIONAL_CARD);\n\n// ── Props ─────────────────────────────────────────────────────────────────────\n\n/**\n * Props for the `shad/conditional` card.\n *\n * Renders `content` only when `show` is `true`; renders nothing otherwise.\n * This is a transparent pass-through no extra DOM wrapper is added.\n *\n * In a real app, drive `show` from a `memo()` selector so the card\n * reactively mounts/unmounts as state changes:\n *\n * ```ts\n * import {memo, registerCard} from \"@pihanga2/core\";\n * import {Conditional} from \"@/cards/conditional\";\n *\n * registerCard(\"myApp/hint\", Conditional({\n * show: memo((s: AppState) => s.items.length === 0 && !s.isLoading),\n * content: \"myApp/emptyStateHint\",\n * }));\n * ```\n */\nexport type ConditionalProps = {\n /** Render `content` only when this is `true`. Drive with `memo()` for\n * reactive mount/unmount behaviour. */\n show: boolean;\n\n /** The card to render when `show` is `true`. */\n content: PiCardRef;\n};\n"],"mappings":";;AAKA,IAAa,IAAmB,oBAInB,IACX,EAAwC,CAAgB"}
1
+ {"version":3,"file":"conditional.types.js","names":[],"sources":["../../../src/cards/conditional/conditional.types.ts"],"sourcesContent":["import {createCardDeclaration} from \"@pihanga2/core\";\nimport type {PiCardRef} from \"@pihanga2/core\";\n\n// ── Card id ───────────────────────────────────────────────────────────────────\n\nexport const CONDITIONAL_CARD = \"shad/conditional\";\n\n// ── Card declaration factory ──────────────────────────────────────────────────\n\nexport const Conditional =\n createCardDeclaration<ConditionalProps>(CONDITIONAL_CARD);\n\n// ── Types ─────────────────────────────────────────────────────────────────────\n\n/**\n * Named Tailwind-compatible breakpoints or a custom pixel expression.\n *\n * Named breakpoints (Tailwind CSS defaults)\n * ─────────────────────────────────────────\n * `sm` → viewport ≥ 640 px\n * `md` → viewport ≥ 768 px\n * `lg` → viewport ≥ 1024 px\n * `xl` → viewport ≥ 1280 px\n * `2xl` → viewport ≥ 1536 px\n *\n * Pixel expressions\n * ─────────────────\n * `400px` → viewport ≥ 400 px (bare value = min-width)\n * `>=640px` → viewport ≥ 640 px\n * `>640px` → viewport > 640 px (min-width: 641px)\n * `<=1024px` → viewport ≤ 1024 px\n * `<1024px` → viewport < 1024 px (max-width: 1023px)\n */\nexport type BreakpointSelector =\n | \"sm\"\n | \"md\"\n | \"lg\"\n | \"xl\"\n | \"2xl\"\n | (string & Record<never, never>); // allows arbitrary strings with IDE hints\n\n// ── Props ─────────────────────────────────────────────────────────────────────\n\n/**\n * Props for the `shad/conditional` card.\n *\n * The card renders `content` only when the combined visibility condition is\n * `true`; it renders nothing otherwise. This is a transparent pass-through —\n * no extra DOM wrapper is added.\n *\n * ## Modes\n *\n * ### 1 · Manual boolean (existing behaviour)\n *\n * Drive `show` from a `memo()` selector so the card reactively mounts/unmounts\n * as state changes:\n *\n * ```ts\n * import {memo, registerCard} from \"@pihanga2/core\";\n * import {Conditional} from \"@/cards/conditional\";\n *\n * registerCard(\"myApp/hint\", Conditional({\n * show: memo((s: AppState) => s.items.length === 0 && !s.isLoading),\n * content: \"myApp/emptyStateHint\",\n * }));\n * ```\n *\n * ### 2 · Breakpoint-based auto-selection (new)\n *\n * Set `showOn` to a breakpoint name or pixel expression. The component\n * subscribes to `window.matchMedia` and automatically mounts/unmounts the\n * content card as the viewport crosses the breakpoint — no state, no memo:\n *\n * ```ts\n * // Show only on tablet-sized screens and up\n * registerCard(\"myApp/sidebar\", Conditional({\n * showOn: \"md\",\n * content: \"myApp/desktopSidebar\",\n * }));\n *\n * // Show only on narrow viewports (mobile drawer)\n * registerCard(\"myApp/mobileNav\", Conditional({\n * showOn: \"<768px\",\n * content: \"myApp/drawer\",\n * }));\n * ```\n *\n * ### 3 · Combined\n *\n * Both conditions are ANDed — content renders only when the breakpoint matches\n * **and** `show` is `true`:\n *\n * ```ts\n * registerCard(\"myApp/adminSidebar\", Conditional({\n * show: memo((s: AppState) => s.isAdmin),\n * showOn: \"lg\",\n * content: \"myApp/adminPanel\",\n * }));\n * ```\n */\nexport type ConditionalProps = {\n /**\n * Manual boolean gate. When omitted it defaults to `true` so that a\n * `showOn`-only card does not need to set it explicitly.\n *\n * Drive with `memo()` for reactive mount/unmount behaviour.\n */\n show?: boolean;\n\n /**\n * Viewport-width breakpoint selector. When set, the component subscribes\n * to `window.matchMedia` and reactively shows/hides the content card\n * whenever the viewport crosses the breakpoint.\n *\n * Supported values: `sm` | `md` | `lg` | `xl` | `2xl` (Tailwind),\n * or pixel expressions such as `>400px`, `>=640px`, `<768px`, `<=1024px`,\n * `400px`.\n *\n * When both `show` and `showOn` are provided the content is rendered only\n * when **both** conditions are satisfied.\n *\n * By default the breakpoint is evaluated against the **viewport** width via\n * `window.matchMedia`. Set `containerQuery: true` to evaluate it against\n * the width of the **enclosing container** instead (uses `ResizeObserver`).\n */\n showOn?: BreakpointSelector;\n\n /**\n * When `true`, the `showOn` breakpoint is measured against the width of the\n * component's **enclosing container** rather than the viewport.\n *\n * Internally the component renders a transparent `<div style=\"width:100%\">`\n * wrapper and observes it with `ResizeObserver`. This means a single extra\n * DOM node is added when `containerQuery` is `true`.\n *\n * Has no effect when `showOn` is not set.\n *\n * @default false\n */\n containerQuery?: boolean;\n\n /** The card to render when the visibility condition is met. */\n content: PiCardRef;\n};\n"],"mappings":";;AAKA,IAAa,IAAmB,oBAInB,IACX,EAAwC,CAAgB"}
@@ -2,60 +2,60 @@ import { BADGE_CARD as e, ShadBadge as t } from "./badge/badge.types.js";
2
2
  import "./badge/index.js";
3
3
  import { BOX_CARD as n, Box as r } from "./box/box.types.js";
4
4
  import "./box/index.js";
5
- import { Button as i, PI_BUTTON_ACTION as a, PI_BUTTON_CARD as o, onPiButtonClicked as s } from "./button/button.types.js";
5
+ import { Button as i, PI_BUTTON_ACTION as a, PI_BUTTON_CARD as o, onButtonClicked as s, onPiButtonClicked as c } from "./button/button.types.js";
6
6
  import "./button/index.js";
7
- import { FormContext as c, useFormContext as l } from "./form/form.context.js";
8
- import { Checkbox as u, PI_CHECKBOX_ACTION as d, PI_CHECKBOX_CARD as f, onPiCheckboxChanged as p } from "./checkbox/checkbox.types.js";
7
+ import { FormContext as l, useFormContext as u } from "./form/form.context.js";
8
+ import { Checkbox as d, PI_CHECKBOX_ACTION as f, PI_CHECKBOX_CARD as p, onPiCheckboxChanged as m } from "./checkbox/checkbox.types.js";
9
9
  import "./checkbox/index.js";
10
- import { CONDITIONAL_CARD as m, Conditional as h } from "./conditional/conditional.types.js";
10
+ import { CONDITIONAL_CARD as h, Conditional as g } from "./conditional/conditional.types.js";
11
11
  import "./conditional/index.js";
12
- import { DATA_TABLE_ACTION as g, DATA_TABLE_CARD as _, DATA_TABLE_ROW_DETAIL_CARD as v, DataTable as y, DataTableRowDetail as b, onDataTableHideDetail as x, onDataTablePageChanged as S, onDataTableRowClicked as C, onDataTableShowDetail as w, onDataTableSortChanged as T } from "./dataTable/dataTable.types.js";
12
+ import { DATA_TABLE_ACTION as _, DATA_TABLE_CARD as v, DATA_TABLE_ROW_DETAIL_CARD as y, DataTable as b, DataTableRowDetail as x, onDataTableHideDetail as S, onDataTablePageChanged as C, onDataTableRowClicked as w, onDataTableShowDetail as T, onDataTableSortChanged as E } from "./dataTable/dataTable.types.js";
13
13
  import "./dataTable/index.js";
14
- import { Dialog as E, PI_DIALOG_ACTION as D, PI_DIALOG_CARD as O, onDialogClosed as k, onDialogOpenChanged as A, onDialogOpened as j } from "./dialog/dialog.types.js";
14
+ import { Dialog as D, PI_DIALOG_ACTION as O, PI_DIALOG_CARD as k, onDialogClosed as A, onDialogOpenChanged as j, onDialogOpened as M } from "./dialog/dialog.types.js";
15
15
  import "./dialog/index.js";
16
- import { DROP_DOWN_MENU_ACTION as M, DROP_DOWN_MENU_CARD as N, DropDownMenu as P, onDropDownMenuClicked as F } from "./dropDownMenu/drop-down.types.js";
16
+ import { DROP_DOWN_MENU_ACTION as N, DROP_DOWN_MENU_CARD as P, DropDownMenu as F, onDropDownMenuClicked as I } from "./dropDownMenu/drop-down.types.js";
17
17
  import "./dropDownMenu/index.js";
18
- import { Field as I, PI_FIELD_CARD as L } from "./field/field.types.js";
18
+ import { Field as L, PI_FIELD_CARD as R } from "./field/field.types.js";
19
19
  import "./field/index.js";
20
- import { FLEX_GRID_CARD as R, FlexGrid as z } from "./flexGrid/flexGrid.types.js";
20
+ import { FLEX_GRID_CARD as z, FlexGrid as B } from "./flexGrid/flexGrid.types.js";
21
21
  import "./flexGrid/index.js";
22
- import { Form as B, PI_FORM_ACTION as V, PI_FORM_CARD as H, onPiFormSubmitted as U } from "./form/form.types.js";
22
+ import { Form as V, PI_FORM_ACTION as H, PI_FORM_CARD as U, onPiFormSubmitted as W } from "./form/form.types.js";
23
23
  import "./form/index.js";
24
- import { SdFramework as W } from "./framework/index.js";
25
- import { PI_INPUT_ACTION as G, PI_INPUT_CARD as K, PiInput as q, onPiInputChanged as J, onPiInputCommitted as Y } from "./input/input.types.js";
24
+ import { SdFramework as G } from "./framework/index.js";
25
+ import { PI_INPUT_ACTION as K, PI_INPUT_CARD as q, PiInput as J, onPiInputChanged as Y, onPiInputCommitted as X } from "./input/input.types.js";
26
26
  import "./input/index.js";
27
- import { LIST_ACTION as X, LIST_CARD as Z, List as Q, onListItemClicked as $ } from "./list/list.types.js";
27
+ import { LIST_ACTION as Z, LIST_CARD as Q, List as $, onListItemClicked as ee } from "./list/list.types.js";
28
28
  import "./list/index.js";
29
- import { LOADING_OVERLAY_CARD as ee, LoadingOverlay as te } from "./loadingOverlay/loadingOverlay.types.js";
29
+ import { LOADING_OVERLAY_CARD as te, LoadingOverlay as ne } from "./loadingOverlay/loadingOverlay.types.js";
30
30
  import "./loadingOverlay/index.js";
31
- import { LOADING_SKELETON_CARD as ne, LoadingSkeleton as re } from "./loadingSkeleton/loading-skeleton.types.js";
31
+ import { LOADING_SKELETON_CARD as re, LoadingSkeleton as ie } from "./loadingSkeleton/loading-skeleton.types.js";
32
32
  import "./loadingSkeleton/index.js";
33
- import { MENU_ACTION as ie, MENU_CARD as ae, Menu as oe, onMenuClicked as se } from "./menu/menu.types.js";
33
+ import { MENU_ACTION as ae, MENU_CARD as oe, Menu as se, onMenuClicked as ce } from "./menu/menu.types.js";
34
34
  import "./menu/index.js";
35
- import { MODE_TOGGLE_ACTION as ce, MODE_TOGGLE_CARD as le, ModeToggle as ue, onModeToggleChanged as de } from "./modeToggle/mode-toggle.types.js";
35
+ import { MODE_TOGGLE_ACTION as le, MODE_TOGGLE_CARD as ue, ModeToggle as de, onModeToggleChanged as fe } from "./modeToggle/mode-toggle.types.js";
36
36
  import "./modeToggle/index.js";
37
- import { NAVBAR_SEARCH_ACTION as fe, NAVBAR_SEARCH_CARD as pe, NavbarSearch as me, onNavbarSearchFocus as he, onNavbarSearchItems as ge, onNavbarSearchSubmit as _e } from "./navbarSearch/navbarSearch.type.js";
37
+ import { NAVBAR_SEARCH_ACTION as pe, NAVBAR_SEARCH_CARD as me, NavbarSearch as he, onNavbarSearchFocus as ge, onNavbarSearchItems as _e, onNavbarSearchSubmit as ve } from "./navbarSearch/navbarSearch.type.js";
38
38
  import "./navbarSearch/index.js";
39
- import { PAGE_WITH_NAVBAR_ACTION as ve, PAGE_WITH_NAVBAR_CARD as ye, PageWithNavbar as be, onPageWithNavbarNavigateTo as xe } from "./pageWithNavbar/pageWithNavbar.type.js";
40
- import { SdPageWithNavbar as Se } from "./pageWithNavbar/index.js";
41
- import { DEF_ERROR_COLOR as Ce, DEF_EVENT_DURATION_SECONDS as we, DEF_HEIGHT as Te, DEF_OVERLAY_OPACITY as Ee, DEF_PASTE_FIRST_REMINDER as De, DEF_PASTE_TARGET_FILE_TYPES as Oe, DEF_SUCCESS_COLOR as ke, PASTE_TARGET_ACTION as Ae, PASTE_TARGET_CARD as je, PasteTarget as Me, onContentPasted as Ne, onPasteError as Pe } from "./pasteTarget/pasteTarget.types.js";
39
+ import { PAGE_WITH_NAVBAR_ACTION as ye, PAGE_WITH_NAVBAR_CARD as be, PageWithNavbar as xe, onPageWithNavbarNavigateTo as Se } from "./pageWithNavbar/pageWithNavbar.type.js";
40
+ import { SdPageWithNavbar as Ce } from "./pageWithNavbar/index.js";
41
+ import { DEF_ERROR_COLOR as we, DEF_EVENT_DURATION_SECONDS as Te, DEF_HEIGHT as Ee, DEF_OVERLAY_OPACITY as De, DEF_PASTE_FIRST_REMINDER as Oe, DEF_PASTE_TARGET_FILE_TYPES as ke, DEF_SUCCESS_COLOR as Ae, PASTE_TARGET_ACTION as je, PASTE_TARGET_CARD as Me, PasteTarget as Ne, onContentPasted as Pe, onPasteError as Fe } from "./pasteTarget/pasteTarget.types.js";
42
42
  import "./pasteTarget/index.js";
43
- import { PI_SELECT_ACTION as Fe, PI_SELECT_CARD as Ie, Select as Le, onPiSelectChanged as Re, onPiSelectClosed as ze, onPiSelectOpened as Be } from "./select/select.types.js";
43
+ import { PI_SELECT_ACTION as Ie, PI_SELECT_CARD as Le, Select as Re, onPiSelectChanged as ze, onPiSelectClosed as Be, onPiSelectOpened as Ve } from "./select/select.types.js";
44
44
  import "./select/index.js";
45
- import { STACK_CARD as Ve, Stack as He } from "./stack/stack.types.js";
45
+ import { STACK_CARD as He, Stack as Ue } from "./stack/stack.types.js";
46
46
  import "./stack/index.js";
47
- import { STEPPER_ACTION as Ue, STEPPER_CARD as We, Stepper as Ge, onStepperStepClicked as Ke } from "./stepper/stepper.types.js";
47
+ import { STEPPER_ACTION as We, STEPPER_CARD as Ge, Stepper as Ke, onStepperStepClicked as qe } from "./stepper/stepper.types.js";
48
48
  import "./stepper/index.js";
49
- import { PI_SWITCH_ACTION as qe, PI_SWITCH_CARD as Je, Switch as Ye, onPiSwitchChanged as Xe } from "./switch/switch.types.js";
49
+ import { PI_SWITCH_ACTION as Je, PI_SWITCH_CARD as Ye, Switch as Xe, onPiSwitchChanged as Ze } from "./switch/switch.types.js";
50
50
  import "./switch/index.js";
51
- import { SdTabs as Ze, TABS_ACTION as Qe, TABS_CARD as $e, Tabs as et, onTabsTabChanged as tt } from "./tabs/tabs.types.js";
51
+ import { SdTabs as Qe, TABS_ACTION as $e, TABS_CARD as et, Tabs as tt, onTabsTabChanged as nt } from "./tabs/tabs.types.js";
52
52
  import "./tabs/index.js";
53
- import { PI_TEXT_FIELD_ACTION as nt, PI_TEXT_FIELD_CARD as rt, TextField as it, onPiTextFieldChanged as at } from "./textField/textField.types.js";
53
+ import { PI_TEXT_FIELD_ACTION as rt, PI_TEXT_FIELD_CARD as it, TextField as at, onPiTextFieldChanged as ot } from "./textField/textField.types.js";
54
54
  import "./textField/index.js";
55
- import { PI_TOAST_ACTION as ot, PI_TOAST_CARD as st, TOAST_OP_ACTION as ct, Toast as lt, dispatchShowToast as ut, onPiToastClosed as dt, onShowToast as ft } from "./toast/toast.types.js";
55
+ import { PI_TOAST_ACTION as st, PI_TOAST_CARD as ct, TOAST_OP_ACTION as lt, Toast as ut, dispatchShowToast as dt, onPiToastClosed as ft, onShowToast as pt } from "./toast/toast.types.js";
56
56
  import "./toast/index.js";
57
- import { PI_TOGGLE_GROUP_ACTION as pt, PI_TOGGLE_GROUP_CARD as mt, ToggleGroup as ht, onPiToggleGroupChanged as gt } from "./toggleGroup/toggleGroup.types.js";
57
+ import { PI_TOGGLE_GROUP_ACTION as mt, PI_TOGGLE_GROUP_CARD as ht, ToggleGroup as gt, onPiToggleGroupChanged as _t } from "./toggleGroup/toggleGroup.types.js";
58
58
  import "./toggleGroup/index.js";
59
- import { TYPOGRAPHY_CARD as _t, Typography as vt } from "./typography/typography.types.js";
59
+ import { TYPOGRAPHY_CARD as vt, Typography as yt } from "./typography/typography.types.js";
60
60
  import "./typography/index.js";
61
- export { e as BADGE_CARD, n as BOX_CARD, r as Box, i as Button, m as CONDITIONAL_CARD, u as Checkbox, h as Conditional, g as DATA_TABLE_ACTION, _ as DATA_TABLE_CARD, v as DATA_TABLE_ROW_DETAIL_CARD, Ce as DEF_ERROR_COLOR, we as DEF_EVENT_DURATION_SECONDS, Te as DEF_HEIGHT, Ee as DEF_OVERLAY_OPACITY, De as DEF_PASTE_FIRST_REMINDER, Oe as DEF_PASTE_TARGET_FILE_TYPES, ke as DEF_SUCCESS_COLOR, M as DROP_DOWN_MENU_ACTION, N as DROP_DOWN_MENU_CARD, y as DataTable, b as DataTableRowDetail, E as Dialog, P as DropDownMenu, R as FLEX_GRID_CARD, I as Field, z as FlexGrid, B as Form, c as FormContext, X as LIST_ACTION, Z as LIST_CARD, ee as LOADING_OVERLAY_CARD, ne as LOADING_SKELETON_CARD, Q as List, te as LoadingOverlay, re as LoadingSkeleton, ie as MENU_ACTION, ae as MENU_CARD, ce as MODE_TOGGLE_ACTION, le as MODE_TOGGLE_CARD, oe as Menu, ue as ModeToggle, fe as NAVBAR_SEARCH_ACTION, pe as NAVBAR_SEARCH_CARD, me as NavbarSearch, ve as PAGE_WITH_NAVBAR_ACTION, ye as PAGE_WITH_NAVBAR_CARD, Ae as PASTE_TARGET_ACTION, je as PASTE_TARGET_CARD, a as PI_BUTTON_ACTION, o as PI_BUTTON_CARD, d as PI_CHECKBOX_ACTION, f as PI_CHECKBOX_CARD, D as PI_DIALOG_ACTION, O as PI_DIALOG_CARD, L as PI_FIELD_CARD, V as PI_FORM_ACTION, H as PI_FORM_CARD, G as PI_INPUT_ACTION, K as PI_INPUT_CARD, Fe as PI_SELECT_ACTION, Ie as PI_SELECT_CARD, qe as PI_SWITCH_ACTION, Je as PI_SWITCH_CARD, nt as PI_TEXT_FIELD_ACTION, rt as PI_TEXT_FIELD_CARD, ot as PI_TOAST_ACTION, st as PI_TOAST_CARD, pt as PI_TOGGLE_GROUP_ACTION, mt as PI_TOGGLE_GROUP_CARD, be as PageWithNavbar, Me as PasteTarget, q as PiInput, Ve as STACK_CARD, Ue as STEPPER_ACTION, We as STEPPER_CARD, W as SdFramework, Se as SdPageWithNavbar, Ze as SdTabs, Le as Select, t as ShadBadge, He as Stack, Ge as Stepper, Ye as Switch, Qe as TABS_ACTION, $e as TABS_CARD, ct as TOAST_OP_ACTION, _t as TYPOGRAPHY_CARD, et as Tabs, it as TextField, lt as Toast, ht as ToggleGroup, vt as Typography, ut as dispatchShowToast, Ne as onContentPasted, x as onDataTableHideDetail, S as onDataTablePageChanged, C as onDataTableRowClicked, w as onDataTableShowDetail, T as onDataTableSortChanged, k as onDialogClosed, A as onDialogOpenChanged, j as onDialogOpened, F as onDropDownMenuClicked, $ as onListItemClicked, se as onMenuClicked, de as onModeToggleChanged, he as onNavbarSearchFocus, ge as onNavbarSearchItems, _e as onNavbarSearchSubmit, xe as onPageWithNavbarNavigateTo, Pe as onPasteError, s as onPiButtonClicked, p as onPiCheckboxChanged, U as onPiFormSubmitted, J as onPiInputChanged, Y as onPiInputCommitted, Re as onPiSelectChanged, ze as onPiSelectClosed, Be as onPiSelectOpened, Xe as onPiSwitchChanged, at as onPiTextFieldChanged, dt as onPiToastClosed, gt as onPiToggleGroupChanged, ft as onShowToast, Ke as onStepperStepClicked, tt as onTabsTabChanged, l as useFormContext };
61
+ export { e as BADGE_CARD, n as BOX_CARD, r as Box, i as Button, h as CONDITIONAL_CARD, d as Checkbox, g as Conditional, _ as DATA_TABLE_ACTION, v as DATA_TABLE_CARD, y as DATA_TABLE_ROW_DETAIL_CARD, we as DEF_ERROR_COLOR, Te as DEF_EVENT_DURATION_SECONDS, Ee as DEF_HEIGHT, De as DEF_OVERLAY_OPACITY, Oe as DEF_PASTE_FIRST_REMINDER, ke as DEF_PASTE_TARGET_FILE_TYPES, Ae as DEF_SUCCESS_COLOR, N as DROP_DOWN_MENU_ACTION, P as DROP_DOWN_MENU_CARD, b as DataTable, x as DataTableRowDetail, D as Dialog, F as DropDownMenu, z as FLEX_GRID_CARD, L as Field, B as FlexGrid, V as Form, l as FormContext, Z as LIST_ACTION, Q as LIST_CARD, te as LOADING_OVERLAY_CARD, re as LOADING_SKELETON_CARD, $ as List, ne as LoadingOverlay, ie as LoadingSkeleton, ae as MENU_ACTION, oe as MENU_CARD, le as MODE_TOGGLE_ACTION, ue as MODE_TOGGLE_CARD, se as Menu, de as ModeToggle, pe as NAVBAR_SEARCH_ACTION, me as NAVBAR_SEARCH_CARD, he as NavbarSearch, ye as PAGE_WITH_NAVBAR_ACTION, be as PAGE_WITH_NAVBAR_CARD, je as PASTE_TARGET_ACTION, Me as PASTE_TARGET_CARD, a as PI_BUTTON_ACTION, o as PI_BUTTON_CARD, f as PI_CHECKBOX_ACTION, p as PI_CHECKBOX_CARD, O as PI_DIALOG_ACTION, k as PI_DIALOG_CARD, R as PI_FIELD_CARD, H as PI_FORM_ACTION, U as PI_FORM_CARD, K as PI_INPUT_ACTION, q as PI_INPUT_CARD, Ie as PI_SELECT_ACTION, Le as PI_SELECT_CARD, Je as PI_SWITCH_ACTION, Ye as PI_SWITCH_CARD, rt as PI_TEXT_FIELD_ACTION, it as PI_TEXT_FIELD_CARD, st as PI_TOAST_ACTION, ct as PI_TOAST_CARD, mt as PI_TOGGLE_GROUP_ACTION, ht as PI_TOGGLE_GROUP_CARD, xe as PageWithNavbar, Ne as PasteTarget, J as PiInput, He as STACK_CARD, We as STEPPER_ACTION, Ge as STEPPER_CARD, G as SdFramework, Ce as SdPageWithNavbar, Qe as SdTabs, Re as Select, t as ShadBadge, Ue as Stack, Ke as Stepper, Xe as Switch, $e as TABS_ACTION, et as TABS_CARD, lt as TOAST_OP_ACTION, vt as TYPOGRAPHY_CARD, tt as Tabs, at as TextField, ut as Toast, gt as ToggleGroup, yt as Typography, dt as dispatchShowToast, s as onButtonClicked, Pe as onContentPasted, S as onDataTableHideDetail, C as onDataTablePageChanged, w as onDataTableRowClicked, T as onDataTableShowDetail, E as onDataTableSortChanged, A as onDialogClosed, j as onDialogOpenChanged, M as onDialogOpened, I as onDropDownMenuClicked, ee as onListItemClicked, ce as onMenuClicked, fe as onModeToggleChanged, ge as onNavbarSearchFocus, _e as onNavbarSearchItems, ve as onNavbarSearchSubmit, Se as onPageWithNavbarNavigateTo, Fe as onPasteError, c as onPiButtonClicked, m as onPiCheckboxChanged, W as onPiFormSubmitted, Y as onPiInputChanged, X as onPiInputCommitted, ze as onPiSelectChanged, Be as onPiSelectClosed, Ve as onPiSelectOpened, Ze as onPiSwitchChanged, ot as onPiTextFieldChanged, ft as onPiToastClosed, _t as onPiToggleGroupChanged, pt as onShowToast, qe as onStepperStepClicked, nt as onTabsTabChanged, u as useFormContext };
@@ -0,0 +1,28 @@
1
+ import { default as React } from 'react';
2
+ import { GraphinContextMenu, GraphinNodeEventContext } from './graphin.types';
3
+ /**
4
+ * Context forwarded to the content card as props.
5
+ * Consumers can import this type to type their card props:
6
+ *
7
+ * ```ts
8
+ * type MyMenuProps = ContextMenuContext & { ... }
9
+ * ```
10
+ */
11
+ export type ContextMenuContext<T = Record<string, unknown>> = {
12
+ /** Whether this panel was triggered from an edge (vs node) */
13
+ isEdge?: boolean;
14
+ /** The G6 element id */
15
+ elementID?: string;
16
+ /** The element's raw `data` bag */
17
+ elementData?: T;
18
+ /**
19
+ * Call this to close the context menu panel from within the content card.
20
+ */
21
+ onClose?: () => void;
22
+ };
23
+ export declare function ContextMenuComponent(props: {
24
+ contentCards: GraphinContextMenu;
25
+ parentCard: string;
26
+ onOpen?: (ctx: GraphinNodeEventContext) => void;
27
+ onClose?: (ctx: GraphinNodeEventContext) => void;
28
+ }): React.ReactNode;
@@ -0,0 +1,8 @@
1
+ import { GraphinNodeEventContext } from './graphin.types';
2
+ export type GraphinEventDispatcherProps = {
3
+ onNodeHovered?: (ctx: GraphinNodeEventContext) => void;
4
+ onNodeHoverEnd?: (ctx: GraphinNodeEventContext) => void;
5
+ onNodeClicked?: (ctx: GraphinNodeEventContext) => void;
6
+ onNodeDblClicked?: (ctx: GraphinNodeEventContext) => void;
7
+ };
8
+ export declare function GraphinEventDispatcher(props: GraphinEventDispatcherProps): null;
@@ -1,4 +1,4 @@
1
1
  import { default as React } from 'react';
2
2
  import { PiCardProps } from '@pihanga2/core';
3
- import { GraphinProps } from './graphin.types';
4
- export declare const GraphinComponent: (props: PiCardProps<GraphinProps>) => React.ReactNode;
3
+ import { GraphinEvents, GraphinProps } from './graphin.types';
4
+ export declare const GraphinComponent: (props: PiCardProps<GraphinProps, GraphinEvents>) => React.ReactNode;
@@ -0,0 +1 @@
1
+ export {};