@pihanga2/shadcn 0.1.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.
- package/AGENT.building-cards.md +413 -0
- package/AGENT.md +57 -0
- package/AGENT.using-cards.md +1051 -0
- package/cards/box/box.component.js +2 -2
- package/cards/box/box.component.js.map +1 -1
- package/cards/box/box.types.d.ts +1 -4
- package/cards/box/box.types.js.map +1 -1
- package/cards/button/button.types.d.ts +3 -0
- package/cards/button/button.types.js +2 -2
- package/cards/button/button.types.js.map +1 -1
- package/cards/button/index.js +5 -5
- package/cards/chartGraph/chartGraph.component.d.ts +4 -0
- package/cards/chartGraph/chartGraph.types.d.ts +102 -0
- package/cards/chartGraph/index.d.ts +1 -0
- package/cards/conditional/conditional.component.d.ts +14 -3
- package/cards/conditional/conditional.component.js +17 -9
- package/cards/conditional/conditional.component.js.map +1 -1
- package/cards/conditional/conditional.types.d.ts +100 -8
- package/cards/conditional/conditional.types.js.map +1 -1
- package/cards/core-index.js +31 -31
- package/cards/fileDrop/fileDrop.component.d.ts +5 -0
- package/cards/fileDrop/fileDrop.types.d.ts +43 -0
- package/cards/fileDrop/index.d.ts +2 -0
- package/cards/graphin/contextMenu.component.d.ts +28 -0
- package/cards/graphin/eventDispatcher.component.d.ts +8 -0
- package/cards/graphin/graphin.component.d.ts +2 -2
- package/cards/graphin/graphin.playground-cards.d.ts +1 -0
- package/cards/graphin/graphin.types.d.ts +444 -4
- package/cards/graphin/graphinOpHandler.component.d.ts +8 -0
- package/cards/graphin/index.d.ts +1 -0
- package/cards/graphin/tooltip.component.d.ts +13 -1
- package/cards/icons.js +7 -3
- package/cards/icons.js.map +1 -1
- package/cards/index.d.ts +1 -0
- package/cards/slider/index.d.ts +1 -0
- package/cards/slider/slider.component.d.ts +4 -0
- package/cards/slider/slider.types.d.ts +102 -0
- package/cards/sliderValue/index.d.ts +1 -0
- package/cards/sliderValue/sliderValue.component.d.ts +15 -0
- package/cards/sliderValue/sliderValue.types.d.ts +21 -0
- package/cards/stack/stack.types.d.ts +19 -22
- package/cards/stack/stack.types.js +1 -1
- package/cards/stack/stack.types.js.map +1 -1
- package/cards/tabs/index.js +4 -4
- package/cards/tabs/tabs.component.js +51 -25
- package/cards/tabs/tabs.component.js.map +1 -1
- package/cards/tabs/tabs.types.d.ts +12 -0
- package/cards/tabs/tabs.types.js +2 -2
- package/cards/tabs/tabs.types.js.map +1 -1
- package/cards/types.d.ts +4 -0
- package/cards/types.js.map +1 -1
- package/components/hooks/use-breakpoint.d.ts +49 -0
- package/components/hooks/use-breakpoint.js +73 -0
- package/components/hooks/use-breakpoint.js.map +1 -0
- package/package.json +9 -1
- package/pihanga-shadcn.css +1 -1
- package/mountain-snow.svg +0 -4
- package/r/badge.json +0 -35
- package/r/box.json +0 -26
- package/r/button.json +0 -39
- package/r/checkbox.json +0 -31
- package/r/conditional.json +0 -30
- package/r/dataTable.json +0 -43
- package/r/dialog.json +0 -36
- package/r/dropDownMenu.json +0 -47
- package/r/field.json +0 -35
- package/r/flexGrid.json +0 -32
- package/r/form.json +0 -37
- package/r/framework.json +0 -28
- package/r/graphin.json +0 -42
- package/r/input.json +0 -35
- package/r/jsonViewer.json +0 -40
- package/r/list.json +0 -39
- package/r/loadingOverlay.json +0 -39
- package/r/loadingSkeleton.json +0 -30
- package/r/markdownViewer.json +0 -51
- package/r/menu.json +0 -34
- package/r/modeToggle.json +0 -36
- package/r/navbarSearch.json +0 -31
- package/r/pageWithNavbar.json +0 -46
- package/r/pasteTarget.json +0 -41
- package/r/pihanga-base.json +0 -11
- package/r/pihanga-cards-icons.json +0 -16
- package/r/pihanga-cards-types.json +0 -16
- package/r/pihanga-hook-use-is-touch-device.json +0 -15
- package/r/pihanga-lib-utils.json +0 -18
- package/r/pihanga-theme-provider.json +0 -25
- package/r/pihanga-ui-extras.json +0 -68
- package/r/registry.json +0 -171
- package/r/resizable.json +0 -35
- package/r/select.json +0 -35
- package/r/stack.json +0 -27
- package/r/stepper.json +0 -39
- package/r/switch.json +0 -36
- package/r/tabs.json +0 -33
- package/r/textField.json +0 -32
- package/r/toast.json +0 -32
- package/r/toggleGroup.json +0 -35
- package/r/typography.json +0 -31
|
@@ -3,8 +3,8 @@ import "react";
|
|
|
3
3
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
4
4
|
//#region src/cards/box/box.component.tsx
|
|
5
5
|
var r = (r) => {
|
|
6
|
-
let { content: i, className: a, style: o, cardName: s } = r, c = {};
|
|
7
|
-
r.height && (c.height = `${r.height}px`), r.width && (c.
|
|
6
|
+
let { content: i, className: a, style: o, cardName: s } = r, c = { ...o?.shad };
|
|
7
|
+
r.height && (c.height = `${r.height}px`), r.width && (c.width = `${r.width}px`), r.marginTop && (c.marginTop = `${r.marginTop}px`), r.marginBottom && (c.marginBottom = `${r.marginBottom}px`), r.marginLeft && (c.marginLeft = `${r.marginLeft}px`), r.marginRight && (c.marginRight = `${r.marginRight}px`), r.paddingTop && (c.paddingTop = `${r.paddingTop}px`), r.paddingBottom && (c.paddingBottom = `${r.paddingBottom}px`), r.paddingLeft && (c.paddingLeft = `${r.paddingLeft}px`), r.paddingRight && (c.paddingRight = `${r.paddingRight}px`);
|
|
8
8
|
function l() {
|
|
9
9
|
return i ? i.map((n, r) => /* @__PURE__ */ t(e, {
|
|
10
10
|
cardName: n,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box.component.js","names":[],"sources":["../../../src/cards/box/box.component.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport {Card, type PiCardProps} from \"@pihanga2/core\";\nimport type {BoxProps} from \"./box.types\";\n\nexport const BoxComponent = (props: PiCardProps<BoxProps>): React.ReactNode => {\n const {content, className, style, cardName} = props;\n\n
|
|
1
|
+
{"version":3,"file":"box.component.js","names":[],"sources":["../../../src/cards/box/box.component.tsx"],"sourcesContent":["import * as React from \"react\";\n\nimport {Card, type PiCardProps} from \"@pihanga2/core\";\nimport type {BoxProps} from \"./box.types\";\n\nexport const BoxComponent = (props: PiCardProps<BoxProps>): React.ReactNode => {\n const {content, className, style, cardName} = props;\n\n const sy: Record<string, string | number> = {\n ...(style as {shad?: Record<string, string | number>} | undefined)?.shad,\n };\n if (props.height) sy.height = `${props.height}px`;\n if (props.width) sy.width = `${props.width}px`;\n\n if (props.marginTop) sy.marginTop = `${props.marginTop}px`;\n if (props.marginBottom) sy.marginBottom = `${props.marginBottom}px`;\n if (props.marginLeft) sy.marginLeft = `${props.marginLeft}px`;\n if (props.marginRight) sy.marginRight = `${props.marginRight}px`;\n\n if (props.paddingTop) sy.paddingTop = `${props.paddingTop}px`;\n if (props.paddingBottom) sy.paddingBottom = `${props.paddingBottom}px`;\n if (props.paddingLeft) sy.paddingLeft = `${props.paddingLeft}px`;\n if (props.paddingRight) sy.paddingRight = `${props.paddingRight}px`;\n\n function renderContent() {\n if (!content) return null;\n return content.map((cn, i) => (\n <Card cardName={cn} parentCard={cardName} key={i} />\n ));\n }\n\n return (\n <div className={className} style={sy} data-pihanga={cardName}>\n {renderContent()}\n {props.children}\n </div>\n );\n};\n"],"mappings":";;;;AAKA,IAAa,KAAgB,MAAkD;CAC7E,IAAM,EAAC,YAAS,cAAW,UAAO,gBAAY,GAExC,IAAsC,EAC1C,GAAI,GAAgE,KACtE;CAYA,AAXI,EAAM,WAAQ,EAAG,SAAS,GAAG,EAAM,OAAO,MAC1C,EAAM,UAAO,EAAG,QAAQ,GAAG,EAAM,MAAM,MAEvC,EAAM,cAAW,EAAG,YAAY,GAAG,EAAM,UAAU,MACnD,EAAM,iBAAc,EAAG,eAAe,GAAG,EAAM,aAAa,MAC5D,EAAM,eAAY,EAAG,aAAa,GAAG,EAAM,WAAW,MACtD,EAAM,gBAAa,EAAG,cAAc,GAAG,EAAM,YAAY,MAEzD,EAAM,eAAY,EAAG,aAAa,GAAG,EAAM,WAAW,MACtD,EAAM,kBAAe,EAAG,gBAAgB,GAAG,EAAM,cAAc,MAC/D,EAAM,gBAAa,EAAG,cAAc,GAAG,EAAM,YAAY,MACzD,EAAM,iBAAc,EAAG,eAAe,GAAG,EAAM,aAAa;CAEhE,SAAS,IAAgB;EAEvB,OADK,IACE,EAAQ,KAAK,GAAI,MACtB,kBAAC,GAAD;GAAM,UAAU;GAAI,YAAY;EAAmB,GAAJ,CAAI,CACpD,IAHoB;CAIvB;CAEA,OACE,kBAAC,OAAD;EAAgB;EAAW,OAAO;EAAI,gBAAc;YAApD,CACG,EAAc,GACd,EAAM,QACJ;;AAET"}
|
package/cards/box/box.types.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { PiCardRef } from '@pihanga2/core';
|
|
2
|
+
import { AlignItemsT } from '../types';
|
|
2
3
|
export declare const BOX_CARD = "shad/box";
|
|
3
|
-
/**
|
|
4
|
-
* CSS `align-items` values supported by the Box card.
|
|
5
|
-
*/
|
|
6
|
-
export type AlignItemsT = "normal" | "stretch" | "center" | "flex-start" | "flex-end" | "start" | "end" | "baseline" | "initial" | "inherit";
|
|
7
4
|
/**
|
|
8
5
|
* Responsive display grid breakpoints.
|
|
9
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box.types.js","names":[],"sources":["../../../src/cards/box/box.types.ts"],"sourcesContent":["import {type PiCardRef, createCardDeclaration} from \"@pihanga2/core\";\
|
|
1
|
+
{"version":3,"file":"box.types.js","names":[],"sources":["../../../src/cards/box/box.types.ts"],"sourcesContent":["import {type PiCardRef, createCardDeclaration} from \"@pihanga2/core\";\nimport { AlignItemsT } from \"../types\";\n\nexport const BOX_CARD = \"shad/box\";\n\n/**\n * Responsive display grid breakpoints.\n *\n * Each key maps to a CSS display value applied at that viewport width:\n * - `xs`: < 640 px (default / mobile-first)\n * - `sm`: ≥ 640 px\n * - `md`: ≥ 768 px\n * - `lg`: ≥ 1024 px\n * - `xl`: ≥ 1280 px\n * - `xxl`: ≥ 1536 px\n */\nexport type DisplayGridT = {\n xs?: string;\n sm?: string;\n md?: string;\n lg?: string;\n xl?: string;\n xxl?: string;\n};\n\nexport type BoxProps<S = object> = {\n /** Child card refs rendered inside the box */\n content?: PiCardRef[];\n\n /** Override the root element type */\n component?: React.ElementType;\n\n /** Fixed height in pixels */\n height?: number;\n /** Fixed width in pixels */\n width?: number;\n\n marginTop?: number;\n marginBottom?: number;\n marginLeft?: number;\n marginRight?: number;\n\n paddingTop?: number;\n paddingBottom?: number;\n paddingLeft?: number;\n paddingRight?: number;\n\n alignItems?: AlignItemsT;\n /** Tailwind gap spacing units */\n gap?: number;\n /** Uniform padding in pixels */\n padding?: number;\n /** Responsive display grid breakpoints */\n display?: DisplayGridT;\n\n /** Card style object (use the `shad` key for Tailwind-compatible overrides) */\n style?: S;\n /** Additional Tailwind utility classes */\n className?: string;\n};\n\n/**\n * Factory function for declaring a `shad/box` card instance.\n *\n * ```ts\n * import {registerCard} from \"@pihanga2/core\";\n * import {Box} from \"@/cards/box\";\n *\n * registerCard(\"myApp/spacer\", Box({height: 24}));\n *\n * registerCard(\"myApp/contentRegion\", Box({\n * content: [\"myApp/card1\", \"myApp/card2\"],\n * paddingTop: 16,\n * className: \"rounded-lg border bg-card\",\n * }));\n * ```\n */\nexport const Box = createCardDeclaration<BoxProps>(BOX_CARD);\n"],"mappings":";;AAGA,IAAa,IAAW,YA0EX,IAAM,EAAgC,CAAQ"}
|
|
@@ -4,6 +4,9 @@ export declare const Button: <S extends import('@pihanga2/core').ReduxState>(p:
|
|
|
4
4
|
export declare const PI_BUTTON_ACTION: {
|
|
5
5
|
CLICKED: string;
|
|
6
6
|
};
|
|
7
|
+
export declare const onButtonClicked: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
8
|
+
cardID: string;
|
|
9
|
+
} & PiButtonClickedEvent>) => void;
|
|
7
10
|
export declare const onPiButtonClicked: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
8
11
|
cardID: string;
|
|
9
12
|
} & PiButtonClickedEvent>) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createCardDeclaration as e, createOnAction as t, registerActions as n } from "@pihanga2/core";
|
|
2
2
|
//#region src/cards/button/button.types.ts
|
|
3
|
-
var r = "pi/button", i = e(r), a = n(r, ["clicked"]), o = t(a.CLICKED);
|
|
3
|
+
var r = "pi/button", i = e(r), a = n(r, ["clicked"]), o = t(a.CLICKED), s = o;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { i as Button, a as PI_BUTTON_ACTION, r as PI_BUTTON_CARD, o as onPiButtonClicked };
|
|
5
|
+
export { i as Button, a as PI_BUTTON_ACTION, r as PI_BUTTON_CARD, o as onButtonClicked, s as onPiButtonClicked };
|
|
6
6
|
|
|
7
7
|
//# sourceMappingURL=button.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.types.js","names":[],"sources":["../../../src/cards/button/button.types.ts"],"sourcesContent":["import {\n createCardDeclaration,\n createOnAction,\n PiCardRef,\n registerActions,\n} from \"@pihanga2/core\";\n\nexport const PI_BUTTON_CARD = \"pi/button\";\n\nexport const Button = createCardDeclaration<PiButtonProps, PiButtonEvents>(\n PI_BUTTON_CARD,\n);\n\nexport const PI_BUTTON_ACTION = registerActions(PI_BUTTON_CARD, [\"clicked\"]);\n\nexport const
|
|
1
|
+
{"version":3,"file":"button.types.js","names":[],"sources":["../../../src/cards/button/button.types.ts"],"sourcesContent":["import {\n createCardDeclaration,\n createOnAction,\n PiCardRef,\n registerActions,\n} from \"@pihanga2/core\";\n\nexport const PI_BUTTON_CARD = \"pi/button\";\n\nexport const Button = createCardDeclaration<PiButtonProps, PiButtonEvents>(\n PI_BUTTON_CARD,\n);\n\nexport const PI_BUTTON_ACTION = registerActions(PI_BUTTON_CARD, [\"clicked\"]);\n\nexport const onButtonClicked = createOnAction<PiButtonClickedEvent>(\n PI_BUTTON_ACTION.CLICKED,\n);\n\n/* @deprecated Use `onButtonClicked` instead. */\nexport const onPiButtonClicked = onButtonClicked;\n\n/**\n * Declarative \"opts\" subset based on `src/registry/ui/button.tsx`.\n *\n * Notes:\n * - Any icon is referenced by name and resolved via `src/pihanga/icons.ts`.\n * - `children` are provided via `label` (simple) or `content` (card ref).\n */\nexport type PiButtonOpts = {\n /**\n * Visual style variant of the button.\n * Determines the button's appearance (colors, borders, etc.).\n */\n variant?:\n | \"default\"\n | \"destructive\"\n | \"outline\"\n | \"secondary\"\n | \"ghost\"\n | \"ghost2\"\n | \"ghost3\"\n | \"ghostActive\"\n | \"brand\"\n | \"nav\"\n | \"navAction\"\n | \"menuAction\"\n | \"blockAction\"\n | \"blockActionSecondary\"\n | \"primaryOutline\"\n | \"radio\"\n | \"none\";\n\n /**\n * Size of the button.\n * Controls padding, font size, and overall dimensions.\n */\n size?:\n | \"default\"\n | \"xs\"\n | \"sm\"\n | \"md\"\n | \"lg\"\n | \"icon\"\n | \"iconSm\"\n | \"navAction\"\n | \"menuAction\"\n | \"blockAction\"\n | \"none\";\n\n /** Truncate button content with ellipsis if it overflows. */\n truncate?: boolean;\n\n /** If true, button is rendered as a menu trigger button. */\n isMenu?: boolean;\n\n /** Custom CSS class to apply to the loading spinner/indicator. */\n loadingClassName?: string;\n\n /** Icon to display before the button content. Set 'size' to 'icon' if ONLY show icon */\n beforeIcon?: string;\n\n /** Icon to display after the button content */\n afterIcon?: string;\n};\n\nexport type PiButtonProps = {\n id?: string; // optional 'id' to be added to events\n\n /**\n * Optional explicit aria-label.\n *\n * Useful for icon-only / letter-only buttons where the visible content\n * shouldn't be used as the accessible name.\n */\n ariaLabel?: string;\n\n /**\n * Declarative options; maps closely to `@/registry/ui/button`.\n */\n opts?: PiButtonOpts;\n\n /** Simple label; used as children and aria-label fallback. */\n label?: string;\n\n /**\n * Icon name to use as the main button content (instead of text label).\n * Resolved via `src/pihanga/icons.ts`.\n * Takes precedence over `label` and `contentCard`.\n */\n iconLabel?: string;\n\n /**\n * If set, renders this card as the content instead of `label`.\n * (Useful for rich content.)\n */\n contentCard?: PiCardRef;\n\n /** When provided, button will render as an anchor. */\n href?: string;\n target?: string;\n\n tooltip?: string;\n\n /**\n * If set, renders this card as the tooltip content instead of `tooltip`.\n * (Useful for rich tooltip content.)\n */\n tooltipCard?: PiCardRef;\n\n /**\n * Controls tooltip visibility mode.\n * - 'auto' (default): Normal hover behavior\n * - 'open': Force tooltip to be visible\n * - 'closed': Force tooltip to be hidden\n */\n tooltipMode?: \"auto\" | \"open\" | \"closed\";\n\n /**\n * Controls tooltip placement/position.\n * - 'top': Tooltip appears above the button (default)\n * - 'right': Tooltip appears to the right of the button\n * - 'bottom': Tooltip appears below the button\n * - 'left': Tooltip appears to the left of the button\n */\n tooltipPlacement?: \"top\" | \"right\" | \"bottom\" | \"left\";\n\n /** Indicates whether the button is in an active/selected state. */\n active?: boolean;\n\n /** Indicates whether the button has focus state styling applied. */\n focused?: boolean;\n\n /** If true, disables the button and prevents interaction. */\n disabled?: boolean;\n\n /** If true, shows loading state and typically disables interaction. */\n loading?: boolean;\n\n /** If true, indicates an async operation is pending (similar to loading but distinct). */\n isPending?: boolean;\n\n className?: string;\n};\n\nexport type PiButtonClickedEvent = {\n id?: string;\n};\n\nexport type PiButtonEvents = {\n onClicked: PiButtonClickedEvent;\n};\n"],"mappings":";;AAOA,IAAa,IAAiB,aAEjB,IAAS,EACpB,CACF,GAEa,IAAmB,EAAgB,GAAgB,CAAC,SAAS,CAAC,GAE9D,IAAkB,EAC7B,EAAiB,OACnB,GAGa,IAAoB"}
|
package/cards/button/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ButtonComponent as e } from "./button.component.js";
|
|
2
|
-
import { Button as t, PI_BUTTON_ACTION as n, PI_BUTTON_CARD as r,
|
|
3
|
-
import { actionTypesToEvents as
|
|
2
|
+
import { Button as t, PI_BUTTON_ACTION as n, PI_BUTTON_CARD as r, onButtonClicked as i, onPiButtonClicked as a } from "./button.types.js";
|
|
3
|
+
import { actionTypesToEvents as o, registerCardComponent as s } from "@pihanga2/core";
|
|
4
4
|
//#region src/cards/button/index.ts
|
|
5
|
-
|
|
5
|
+
s({
|
|
6
6
|
name: r,
|
|
7
7
|
component: e,
|
|
8
|
-
events:
|
|
8
|
+
events: o(n)
|
|
9
9
|
});
|
|
10
10
|
//#endregion
|
|
11
|
-
export { t as Button, n as PI_BUTTON_ACTION, r as PI_BUTTON_CARD, i as onPiButtonClicked };
|
|
11
|
+
export { t as Button, n as PI_BUTTON_ACTION, r as PI_BUTTON_CARD, i as onButtonClicked, a as onPiButtonClicked };
|
|
12
12
|
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { ChartConfig } from '../../components/ui/chart';
|
|
2
|
+
export declare const PI_CHART_GRAPH_CARD = "shad/chart-graph";
|
|
3
|
+
export declare const ChartGraph: <S extends import('@pihanga2/core').ReduxState>(p: import('@pihanga2/core').PiMapProps<PiChartGraphProps, S, {}>) => import('@pihanga2/core').PiCardDef;
|
|
4
|
+
export type { ChartConfig };
|
|
5
|
+
export type PiChartSeries = {
|
|
6
|
+
/** Key in each data-point object whose value will be plotted on the y-axis. */
|
|
7
|
+
dataKey: string;
|
|
8
|
+
/** Human-readable label used in the tooltip and legend. Defaults to `dataKey`. */
|
|
9
|
+
label?: string;
|
|
10
|
+
/**
|
|
11
|
+
* CSS colour string for this series.
|
|
12
|
+
* Falls back to the shadcn chart CSS variables
|
|
13
|
+
* (`hsl(var(--chart-1))`, `hsl(var(--chart-2))`, …) in order.
|
|
14
|
+
*/
|
|
15
|
+
color?: string;
|
|
16
|
+
};
|
|
17
|
+
export type PiChartGraphProps = {
|
|
18
|
+
/**
|
|
19
|
+
* Whether to render an **area** chart (filled) or a **line** chart (stroke only).
|
|
20
|
+
*/
|
|
21
|
+
chartType: "area" | "line";
|
|
22
|
+
/**
|
|
23
|
+
* Array of data points. Each entry must contain:
|
|
24
|
+
* - a value for `xDataKey` (used for the x-axis labels), and
|
|
25
|
+
* - a numeric value for each `series[].dataKey`.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* [
|
|
30
|
+
* { month: "Jan", desktop: 186, mobile: 80 },
|
|
31
|
+
* { month: "Feb", desktop: 305, mobile: 200 },
|
|
32
|
+
* ]
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
data: Array<Record<string, unknown>>;
|
|
36
|
+
/**
|
|
37
|
+
* Series definitions. Each entry describes one plotted line or area.
|
|
38
|
+
* At least one series is required.
|
|
39
|
+
*/
|
|
40
|
+
series: PiChartSeries[];
|
|
41
|
+
/** Key inside each data-point object used for the x-axis tick labels. */
|
|
42
|
+
xDataKey: string;
|
|
43
|
+
/**
|
|
44
|
+
* Optional card title rendered above the chart.
|
|
45
|
+
* When either `title` or `description` is set the chart is wrapped in a
|
|
46
|
+
* shadcn `<Card>` shell; otherwise it renders as a bare `<div>`.
|
|
47
|
+
*/
|
|
48
|
+
title?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Optional subtitle rendered below `title`.
|
|
51
|
+
* Has no effect when `title` is not set.
|
|
52
|
+
*/
|
|
53
|
+
description?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Minimum chart height in pixels.
|
|
56
|
+
* The chart expands if the responsive container requires more space.
|
|
57
|
+
* Defaults to `250`.
|
|
58
|
+
*/
|
|
59
|
+
height?: number;
|
|
60
|
+
/** Show a legend beneath the chart. Defaults to `true`. */
|
|
61
|
+
showLegend?: boolean;
|
|
62
|
+
/** Show horizontal cartesian grid lines. Defaults to `true`. */
|
|
63
|
+
showGrid?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Show the y-axis with numeric tick labels on the left edge of the chart.
|
|
66
|
+
* Defaults to `false` (y-axis hidden) to keep the chart compact.
|
|
67
|
+
*/
|
|
68
|
+
showYAxis?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Unit string appended to every y-axis tick label (e.g. `"ms"`, `"%"`, `" km"`).
|
|
71
|
+
* Only visible when `showYAxis` is `true`.
|
|
72
|
+
*
|
|
73
|
+
* @example `yAxisUnit="%"` renders ticks as `"0%"`, `"50%"`, `"100%"`.
|
|
74
|
+
*/
|
|
75
|
+
yAxisUnit?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Unit string appended to every x-axis tick label.
|
|
78
|
+
* Useful when x-axis values are numeric (e.g. seconds, iterations).
|
|
79
|
+
* Has no effect when x-axis values are already formatted strings (e.g. month names).
|
|
80
|
+
*
|
|
81
|
+
* @example `xAxisUnit="s"` renders ticks as `"1s"`, `"2s"`, etc.
|
|
82
|
+
*/
|
|
83
|
+
xAxisUnit?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Stack all area series on top of each other (area chart only).
|
|
86
|
+
* When `false` (default) the filled areas overlap.
|
|
87
|
+
*/
|
|
88
|
+
stacked?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Opacity of the filled area (area chart only).
|
|
91
|
+
* Range 0–1. Defaults to `0.4`.
|
|
92
|
+
*/
|
|
93
|
+
fillOpacity?: number;
|
|
94
|
+
/**
|
|
95
|
+
* Suppress the recharts entry animation so the chart renders immediately
|
|
96
|
+
* without the "draw-in" / "unfold" effect.
|
|
97
|
+
* Defaults to `false` (animation enabled).
|
|
98
|
+
*/
|
|
99
|
+
suppressAnimation?: boolean;
|
|
100
|
+
/** Extra Tailwind / CSS classes forwarded to the outermost element. */
|
|
101
|
+
className?: string;
|
|
102
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './chartGraph.types';
|
|
@@ -4,8 +4,19 @@ import * as React from "react";
|
|
|
4
4
|
/**
|
|
5
5
|
* ConditionalComponent
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* returns `null` otherwise.
|
|
9
|
-
*
|
|
7
|
+
* Renders the `content` card when the combined visibility condition is `true`,
|
|
8
|
+
* returns `null` otherwise.
|
|
9
|
+
*
|
|
10
|
+
* Visibility rules (all must be satisfied):
|
|
11
|
+
* 1. `show` — manual boolean gate (defaults to `true` when omitted)
|
|
12
|
+
* 2. `showOn` — breakpoint selector (always `true` when omitted)
|
|
13
|
+
* • `containerQuery: false` (default) → evaluated against the **viewport**
|
|
14
|
+
* via `window.matchMedia`
|
|
15
|
+
* • `containerQuery: true` → evaluated against the width of the
|
|
16
|
+
* **enclosing container** via `ResizeObserver`; a thin `<div>` wrapper
|
|
17
|
+
* is rendered so the container width can be measured
|
|
18
|
+
*
|
|
19
|
+
* Both hooks are always called unconditionally (React rules); whichever is not
|
|
20
|
+
* "active" receives `undefined` and returns `true` immediately.
|
|
10
21
|
*/
|
|
11
22
|
export declare const ConditionalComponent: (props: PiCardProps<ConditionalProps>) => React.ReactNode;
|
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
3
|
-
import
|
|
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
|
|
6
|
-
let { cardName:
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
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 {
|
|
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 *
|
|
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
|
-
*
|
|
8
|
-
* This is a transparent pass-through —
|
|
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
|
-
*
|
|
11
|
-
*
|
|
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
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
|
|
27
|
-
|
|
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 *
|
|
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"}
|
package/cards/core-index.js
CHANGED
|
@@ -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,
|
|
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
|
|
8
|
-
import { Checkbox as
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
25
|
-
import { PI_INPUT_ACTION as
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
40
|
-
import { SdPageWithNavbar as
|
|
41
|
-
import { DEF_ERROR_COLOR as
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
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,5 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PiCardProps } from '@pihanga2/core';
|
|
3
|
+
import { FileDropEvents, FileDropProps } from './fileDrop.types';
|
|
4
|
+
export declare function get_last_dropped(name: string): File | null;
|
|
5
|
+
export declare const FileDropComponent: (props: PiCardProps<FileDropProps, FileDropEvents>) => React.ReactNode;
|