@pihanga2/shadcn 0.2.9 → 0.2.11
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 +1 -1
- package/AGENT.using-cards.md +10 -4
- package/README.md +3 -1
- package/cards/box/box.component.js +10 -9
- package/cards/box/box.component.js.map +1 -1
- package/cards/box/box.types.d.ts +2 -0
- package/cards/box/box.types.js.map +1 -1
- package/cards/iconCard/iconCard.component.d.ts +11 -0
- package/cards/iconCard/iconCard.component.js +19 -0
- package/cards/iconCard/iconCard.component.js.map +1 -0
- package/cards/iconCard/iconCard.types.d.ts +23 -0
- package/cards/iconCard/iconCard.types.js +7 -0
- package/cards/iconCard/iconCard.types.js.map +1 -0
- package/cards/iconCard/index.d.ts +1 -0
- package/cards/iconCard/index.js +12 -0
- package/cards/iconCard/index.js.map +1 -0
- package/cards/sheetCard/index.d.ts +1 -0
- package/cards/sheetCard/index.js +13 -0
- package/cards/sheetCard/index.js.map +1 -0
- package/cards/sheetCard/sheetCard.component.d.ts +4 -0
- package/cards/sheetCard/sheetCard.component.js +88 -0
- package/cards/sheetCard/sheetCard.component.js.map +1 -0
- package/cards/sheetCard/sheetCard.types.d.ts +99 -0
- package/cards/sheetCard/sheetCard.types.js +11 -0
- package/cards/sheetCard/sheetCard.types.js.map +1 -0
- package/cards/sheetCard.d.ts +1 -0
- package/components/ui/sheet.js +39 -5
- package/components/ui/sheet.js.map +1 -1
- package/package.json +11 -1
- package/theme.css +1 -1
package/AGENT.building-cards.md
CHANGED
|
@@ -817,7 +817,7 @@ includes `@import "@pihanga2/shadcn/theme.css"`. That single import:
|
|
|
817
817
|
|
|
818
818
|
1. Defines the CSS custom property palette (`:root`, `.dark`)
|
|
819
819
|
2. Maps them to Tailwind v4 utility tokens (`@theme inline`)
|
|
820
|
-
3. Tells Tailwind to scan the library's compiled files (`@source "."`)
|
|
820
|
+
3. Tells Tailwind to scan the library's compiled files (`@source unsafe(".")`)
|
|
821
821
|
|
|
822
822
|
Apps that already use shadcn/ui with their own theme setup do not need the
|
|
823
823
|
import — their `:root` variables cascade over the defaults.
|
package/AGENT.using-cards.md
CHANGED
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
| **Cards available** | All 34 | 30 core (no graphin / jsonViewer / markdownViewer / resizable) |
|
|
83
83
|
| **Requires `shadcn init`** | Yes | No |
|
|
84
84
|
| **Files land in your project** | Yes — editable source | No — compiled bundle |
|
|
85
|
-
| **Tailwind** | Consumer's own Tailwind config |
|
|
85
|
+
| **Tailwind** | Consumer's own Tailwind config | `@import "@pihanga2/shadcn/theme.css"` handles source scanning automatically |
|
|
86
86
|
|
|
87
87
|
Use the **registry** for projects already on shadcn/ui or when you want to
|
|
88
88
|
customise card source. Use the **npm package** for monorepos, CI, or anywhere
|
|
@@ -137,11 +137,17 @@ Then use `registerCard(...)` in your init function exactly as with the registry.
|
|
|
137
137
|
**Cards NOT in the npm package** (registry-only due to heavy deps):
|
|
138
138
|
`graphin`, `jsonViewer`, `markdownViewer`, `resizable`.
|
|
139
139
|
|
|
140
|
-
**Tailwind:**
|
|
140
|
+
**Tailwind:** import `theme.css` from the package — it contains `@source "."` which tells Tailwind to scan the package automatically (Tailwind v4.3+):
|
|
141
141
|
```css
|
|
142
142
|
/* src/index.css — Tailwind v4 */
|
|
143
143
|
@import "tailwindcss";
|
|
144
|
-
@
|
|
144
|
+
@import "@pihanga2/shadcn/theme.css";
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
If you already have your own shadcn/ui theme and skip the `theme.css` import, add `@source` lines pointing at the package's compiled output instead:
|
|
148
|
+
```css
|
|
149
|
+
@source "../node_modules/@pihanga2/shadcn/cards";
|
|
150
|
+
@source "../node_modules/@pihanga2/shadcn/components";
|
|
145
151
|
```
|
|
146
152
|
|
|
147
153
|
### Migrating a card from npm to a local customised copy
|
|
@@ -384,7 +390,7 @@ Full registry index: `https://ivcap-works.github.io/pihanga-shadcn/r/registry.js
|
|
|
384
390
|
- Activate cards with `import "@pihanga2/shadcn"` (all) or per-card sub-paths.
|
|
385
391
|
- `graphin`, `jsonViewer`, `markdownViewer`, `resizable` are not in the npm
|
|
386
392
|
package — use the registry for those.
|
|
387
|
-
-
|
|
393
|
+
- Import `@pihanga2/shadcn/theme.css` — it handles Tailwind source scanning automatically via `@source "."`.
|
|
388
394
|
- **Import types from the card index, not deep sub-paths.** The exports map
|
|
389
395
|
only exposes `@pihanga2/shadcn/cards/<card>` — every type from
|
|
390
396
|
`<card>.types.ts` is re-exported there. Deep paths like
|
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ import "@pihanga2/shadcn/cards/dataTable";
|
|
|
62
62
|
|
|
63
63
|
---
|
|
64
64
|
|
|
65
|
-
## Included cards (
|
|
65
|
+
## Included cards (43)
|
|
66
66
|
|
|
67
67
|
- `avatar`
|
|
68
68
|
- `badge`
|
|
@@ -80,6 +80,7 @@ import "@pihanga2/shadcn/cards/dataTable";
|
|
|
80
80
|
- `flexGrid`
|
|
81
81
|
- `form`
|
|
82
82
|
- `framework`
|
|
83
|
+
- `iconCard`
|
|
83
84
|
- `infoCard`
|
|
84
85
|
- `input`
|
|
85
86
|
- `jsonViewer`
|
|
@@ -95,6 +96,7 @@ import "@pihanga2/shadcn/cards/dataTable";
|
|
|
95
96
|
- `resizable`
|
|
96
97
|
- `scrollbarWithAnnotations`
|
|
97
98
|
- `select`
|
|
99
|
+
- `sheetCard`
|
|
98
100
|
- `slider`
|
|
99
101
|
- `sliderValue`
|
|
100
102
|
- `stack`
|
|
@@ -3,19 +3,20 @@ import { Card as e } from "@pihanga2/core";
|
|
|
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,
|
|
7
|
-
r.height && (
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
let { content: i, singleContent: a, className: o, style: s, cardName: c } = r, l = { ...s };
|
|
7
|
+
r.height && (l.height = `${r.height}px`), r.width && (l.width = `${r.width}px`), r.marginTop && (l.marginTop = `${r.marginTop}px`), r.marginBottom && (l.marginBottom = `${r.marginBottom}px`), r.marginLeft && (l.marginLeft = `${r.marginLeft}px`), r.marginRight && (l.marginRight = `${r.marginRight}px`), r.paddingTop && (l.paddingTop = `${r.paddingTop}px`), r.paddingBottom && (l.paddingBottom = `${r.paddingBottom}px`), r.paddingLeft && (l.paddingLeft = `${r.paddingLeft}px`), r.paddingRight && (l.paddingRight = `${r.paddingRight}px`);
|
|
8
|
+
let u = a ? [a] : i;
|
|
9
|
+
function d() {
|
|
10
|
+
return u ? u.map((n, r) => /* @__PURE__ */ t(e, {
|
|
10
11
|
cardName: n,
|
|
11
|
-
parentCard:
|
|
12
|
+
parentCard: c
|
|
12
13
|
}, r)) : null;
|
|
13
14
|
}
|
|
14
15
|
return /* @__PURE__ */ n("div", {
|
|
15
|
-
className:
|
|
16
|
-
style:
|
|
17
|
-
"data-pihanga":
|
|
18
|
-
children: [
|
|
16
|
+
className: o,
|
|
17
|
+
style: l,
|
|
18
|
+
"data-pihanga": c,
|
|
19
|
+
children: [d(), r.children]
|
|
19
20
|
});
|
|
20
21
|
};
|
|
21
22
|
//#endregion
|
|
@@ -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 const sy: Record<string, string | number> = {\n ...(style as Record<string, string | number> | undefined),\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 (!
|
|
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, singleContent, className, style, cardName} = props;\n\n const sy: Record<string, string | number> = {\n ...(style as Record<string, string | number> | undefined),\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 const cards = singleContent ? [singleContent] : content;\n function renderContent() {\n if (!cards) return null;\n return cards.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,kBAAe,cAAW,UAAO,gBAAY,GAEvD,IAAsC,EAC1C,GAAI,EACN;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,IAAM,IAAQ,IAAgB,CAAC,CAAa,IAAI;CAChD,SAAS,IAAgB;EAEvB,OADK,IACE,EAAM,KAAK,GAAI,MACpB,kBAAC,GAAD;GAAM,UAAU;GAAI,YAAY;EAAmB,GAAJ,CAAI,CACpD,IAHkB;CAIrB;CAEA,OACE,kBAAC,OAAD;EAAgB;EAAW,OAAO;EAAI,gBAAc;YAApD,CACG,EAAc,GACd,EAAM,QACJ;;AAET"}
|
package/cards/box/box.types.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export type DisplayGridT = {
|
|
|
22
22
|
export type BoxProps<S = object> = {
|
|
23
23
|
/** Child card refs rendered inside the box */
|
|
24
24
|
content?: PiCardRef[];
|
|
25
|
+
/** Single child to make dynmic selection (s) => ... possible */
|
|
26
|
+
singleContent?: PiCardRef;
|
|
25
27
|
/** Override the root element type */
|
|
26
28
|
component?: React.ElementType;
|
|
27
29
|
/** Fixed height in pixels */
|
|
@@ -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\";\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 /** 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":";;AAEA,IAAa,IAAW,
|
|
1
|
+
{"version":3,"file":"box.types.js","names":[],"sources":["../../../src/cards/box/box.types.ts"],"sourcesContent":["import {type PiCardRef, createCardDeclaration} from \"@pihanga2/core\";\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 /** Single child to make dynmic selection (s) => ... possible */\n singleContent?: 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 /** 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":";;AAEA,IAAa,IAAW,YAqEX,IAAM,EAAgC,CAAQ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PiCardProps } from '@pihanga2/core';
|
|
3
|
+
import { IconCardProps } from './iconCard.types';
|
|
4
|
+
/**
|
|
5
|
+
* `shad/icon` card component.
|
|
6
|
+
*
|
|
7
|
+
* Renders a named icon (resolved via the pihanga icon registry) inside a
|
|
8
|
+
* plain `<div>`. The wrapping div accepts an optional `className` for
|
|
9
|
+
* Tailwind utilities and an optional `style` for inline CSS overrides.
|
|
10
|
+
*/
|
|
11
|
+
export declare const IconCardComponent: (props: PiCardProps<IconCardProps>) => React.ReactNode;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getIcon as e } from "../icons.js";
|
|
2
|
+
import { cn as t } from "../../lib/utils.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import "@pihanga2/core";
|
|
5
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
6
|
+
//#region src/cards/iconCard/iconCard.component.tsx
|
|
7
|
+
var r = (r) => {
|
|
8
|
+
let { iconName: i, iconProps: a, className: o, style: s, cardName: c } = r;
|
|
9
|
+
return /* @__PURE__ */ n("div", {
|
|
10
|
+
className: t(o),
|
|
11
|
+
style: s,
|
|
12
|
+
"data-pihanga": c,
|
|
13
|
+
children: e(i, a)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { r as IconCardComponent };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=iconCard.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iconCard.component.js","names":[],"sources":["../../../src/cards/iconCard/iconCard.component.tsx"],"sourcesContent":["import React from \"react\";\nimport {type PiCardProps} from \"@pihanga2/core\";\nimport {cn} from \"@/lib/utils\";\nimport {getIcon} from \"@/cards/icons\";\nimport type {IconCardProps} from \"./iconCard.types\";\n\n/**\n * `shad/icon` card component.\n *\n * Renders a named icon (resolved via the pihanga icon registry) inside a\n * plain `<div>`. The wrapping div accepts an optional `className` for\n * Tailwind utilities and an optional `style` for inline CSS overrides.\n */\nexport const IconCardComponent = (\n props: PiCardProps<IconCardProps>,\n): React.ReactNode => {\n const {iconName, iconProps, className, style, cardName} = props;\n\n return (\n <div className={cn(className)} style={style} data-pihanga={cardName}>\n {getIcon(iconName, iconProps)}\n </div>\n );\n};\n"],"mappings":";;;;;;AAaA,IAAa,KACX,MACoB;CACpB,IAAM,EAAC,aAAU,cAAW,cAAW,UAAO,gBAAY;CAE1D,OACE,kBAAC,OAAD;EAAK,WAAW,EAAG,CAAS;EAAU;EAAO,gBAAc;YACxD,EAAQ,GAAU,CAAS;CACzB,CAAA;AAET"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export declare const ICON_CARD = "shad/icon";
|
|
3
|
+
export type IconCardProps = {
|
|
4
|
+
/** Name of the icon as registered via `registerIcon` */
|
|
5
|
+
iconName: string;
|
|
6
|
+
/** Props forwarded to the icon element (e.g. size, strokeWidth) */
|
|
7
|
+
iconProps?: Record<string, any>;
|
|
8
|
+
/** Additional Tailwind classes applied to the wrapping `<div>` */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Inline styles applied to the wrapping `<div>` */
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Factory function for declaring a `shad/icon` card instance.
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* import {registerCard} from "@pihanga2/core";
|
|
18
|
+
* import {ShadIcon} from "@/cards/iconCard";
|
|
19
|
+
*
|
|
20
|
+
* registerCard("myApp/saveIcon", ShadIcon({iconName: "save", className: "text-primary"}));
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare const ShadIcon: <S extends import('@pihanga2/core').ReduxState>(p: import('@pihanga2/core').PiMapProps<IconCardProps, S, {}>) => import('@pihanga2/core').PiCardDef;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iconCard.types.js","names":[],"sources":["../../../src/cards/iconCard/iconCard.types.ts"],"sourcesContent":["import {createCardDeclaration} from \"@pihanga2/core\";\nimport type React from \"react\";\n\nexport const ICON_CARD = \"shad/icon\";\n\nexport type IconCardProps = {\n /** Name of the icon as registered via `registerIcon` */\n iconName: string;\n\n /** Props forwarded to the icon element (e.g. size, strokeWidth) */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n iconProps?: Record<string, any>;\n\n /** Additional Tailwind classes applied to the wrapping `<div>` */\n className?: string;\n\n /** Inline styles applied to the wrapping `<div>` */\n style?: React.CSSProperties;\n};\n\n/**\n * Factory function for declaring a `shad/icon` card instance.\n *\n * ```ts\n * import {registerCard} from \"@pihanga2/core\";\n * import {ShadIcon} from \"@/cards/iconCard\";\n *\n * registerCard(\"myApp/saveIcon\", ShadIcon({iconName: \"save\", className: \"text-primary\"}));\n * ```\n */\nexport const ShadIcon = createCardDeclaration<IconCardProps>(ICON_CARD);\n"],"mappings":";;AAGA,IAAa,IAAY,aA2BZ,IAAW,EAAqC,CAAS"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './iconCard.types';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IconCardComponent as e } from "./iconCard.component.js";
|
|
2
|
+
import { ICON_CARD as t, ShadIcon as n } from "./iconCard.types.js";
|
|
3
|
+
import { registerCardComponent as r } from "@pihanga2/core";
|
|
4
|
+
//#region src/cards/iconCard/index.ts
|
|
5
|
+
r({
|
|
6
|
+
name: t,
|
|
7
|
+
component: e
|
|
8
|
+
});
|
|
9
|
+
//#endregion
|
|
10
|
+
export { t as ICON_CARD, n as ShadIcon };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/cards/iconCard/index.ts"],"sourcesContent":["import {registerCardComponent} from \"@pihanga2/core\";\n\nimport {IconCardComponent} from \"./iconCard.component\";\nimport {ICON_CARD} from \"./iconCard.types\";\n\nexport * from \"./iconCard.types\";\n\nregisterCardComponent({\n name: ICON_CARD,\n component: IconCardComponent,\n});\n"],"mappings":";;;;AAOA,EAAsB;CACpB,MAAM;CACN,WAAW;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './sheetCard.types';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SheetCardComponent as e } from "./sheetCard.component.js";
|
|
2
|
+
import { PI_SHEET_ACTION as t, PI_SHEET_CARD as n, Sheet as r, onSheetClosed as i, onSheetOpenChanged as a, onSheetOpened as o } from "./sheetCard.types.js";
|
|
3
|
+
import { actionTypesToEvents as s, registerCardComponent as c } from "@pihanga2/core";
|
|
4
|
+
//#region src/cards/sheetCard/index.ts
|
|
5
|
+
c({
|
|
6
|
+
name: n,
|
|
7
|
+
component: e,
|
|
8
|
+
events: s(t)
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { t as PI_SHEET_ACTION, n as PI_SHEET_CARD, r as Sheet, i as onSheetClosed, a as onSheetOpenChanged, o as onSheetOpened };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/cards/sheetCard/index.ts"],"sourcesContent":["import {actionTypesToEvents, registerCardComponent} from \"@pihanga2/core\";\nimport {SheetCardComponent} from \"./sheetCard.component\";\nimport {PI_SHEET_ACTION, PI_SHEET_CARD} from \"./sheetCard.types\";\n\nexport * from \"./sheetCard.types\";\n\nregisterCardComponent({\n name: PI_SHEET_CARD,\n component: SheetCardComponent,\n events: actionTypesToEvents(PI_SHEET_ACTION),\n});\n"],"mappings":";;;;AAMA,EAAsB;CACpB,MAAM;CACN,WAAW;CACX,QAAQ,EAAoB,CAAe;AAC7C,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { Button as t } from "../../components/ui/button.js";
|
|
3
|
+
import { Sheet as n, SheetClose as r, SheetContent as i, SheetDescription as a, SheetFooter as o, SheetHeader as s, SheetTitle as c, SheetTrigger as l } from "../../components/ui/sheet.js";
|
|
4
|
+
import u from "react";
|
|
5
|
+
import { Card as d } from "@pihanga2/core";
|
|
6
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
7
|
+
//#region src/cards/sheetCard/sheetCard.component.tsx
|
|
8
|
+
var m = (m) => {
|
|
9
|
+
let { id: h, trigger: g, content: _, title: v, description: y, open: b, side: x = "right", footer: S, footerCloseButtonText: C, className: w, headerClassName: T, contentClassName: E, footerClassName: D, cardName: O, onOpened: k, onClosed: A, onOpenChanged: j } = m, M = C === void 0 ? "Close" : C, [N, P] = u.useState(!1), F = b ?? N, I = u.useRef(b);
|
|
10
|
+
u.useEffect(() => {
|
|
11
|
+
I.current === !0 && b === !1 && F === !1 && A({
|
|
12
|
+
id: h,
|
|
13
|
+
reason: "programmatic"
|
|
14
|
+
}), I.current = b;
|
|
15
|
+
}, [
|
|
16
|
+
b,
|
|
17
|
+
F,
|
|
18
|
+
h,
|
|
19
|
+
A
|
|
20
|
+
]);
|
|
21
|
+
let L = (e) => {
|
|
22
|
+
b === void 0 && P(e), j({
|
|
23
|
+
open: e,
|
|
24
|
+
id: h
|
|
25
|
+
}), e ? k({ id: h }) : b === void 0 && A({
|
|
26
|
+
id: h,
|
|
27
|
+
reason: "user"
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
function R() {
|
|
31
|
+
return !v && !y ? null : /* @__PURE__ */ p(s, {
|
|
32
|
+
className: T,
|
|
33
|
+
children: [v && /* @__PURE__ */ f(c, { children: v }), y && /* @__PURE__ */ f(a, { children: y })]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
function z() {
|
|
37
|
+
return S ? /* @__PURE__ */ f(o, {
|
|
38
|
+
className: D,
|
|
39
|
+
children: /* @__PURE__ */ f(d, {
|
|
40
|
+
cardName: S,
|
|
41
|
+
parentCard: O
|
|
42
|
+
})
|
|
43
|
+
}) : M === null ? null : /* @__PURE__ */ f(o, {
|
|
44
|
+
className: D,
|
|
45
|
+
children: /* @__PURE__ */ f(r, {
|
|
46
|
+
asChild: !0,
|
|
47
|
+
children: /* @__PURE__ */ f(t, {
|
|
48
|
+
variant: "outline",
|
|
49
|
+
children: M
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return /* @__PURE__ */ p(n, {
|
|
55
|
+
open: F,
|
|
56
|
+
onOpenChange: L,
|
|
57
|
+
children: [g && /* @__PURE__ */ f(l, {
|
|
58
|
+
asChild: !0,
|
|
59
|
+
children: /* @__PURE__ */ f("span", {
|
|
60
|
+
className: "inline-flex",
|
|
61
|
+
"data-pihanga-trigger-wrapper": !0,
|
|
62
|
+
children: /* @__PURE__ */ f(d, {
|
|
63
|
+
cardName: g,
|
|
64
|
+
parentCard: O
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
}), /* @__PURE__ */ p(i, {
|
|
68
|
+
"data-pihanga": O,
|
|
69
|
+
side: x,
|
|
70
|
+
className: w,
|
|
71
|
+
children: [
|
|
72
|
+
R(),
|
|
73
|
+
/* @__PURE__ */ f("div", {
|
|
74
|
+
className: e("flex-1 overflow-y-auto p-4", E),
|
|
75
|
+
children: /* @__PURE__ */ f(d, {
|
|
76
|
+
cardName: _,
|
|
77
|
+
parentCard: O
|
|
78
|
+
})
|
|
79
|
+
}),
|
|
80
|
+
z()
|
|
81
|
+
]
|
|
82
|
+
})]
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
//#endregion
|
|
86
|
+
export { m as SheetCardComponent };
|
|
87
|
+
|
|
88
|
+
//# sourceMappingURL=sheetCard.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheetCard.component.js","names":[],"sources":["../../../src/cards/sheetCard/sheetCard.component.tsx"],"sourcesContent":["import React from \"react\";\nimport {Card, type PiCardProps} from \"@pihanga2/core\";\nimport {cn} from \"@/lib/utils\";\nimport {\n Sheet as SheetRoot,\n SheetTrigger,\n SheetContent,\n SheetHeader,\n SheetTitle,\n SheetDescription,\n SheetFooter,\n SheetClose,\n} from \"@/registry/ui/sheet\";\nimport {Button} from \"@/registry/ui/button\";\n\nimport type {PiSheetEvents, PiSheetProps} from \"./sheetCard.types\";\n\nexport const SheetCardComponent = (\n props: PiCardProps<PiSheetProps, PiSheetEvents>,\n): React.ReactNode => {\n const {\n id,\n trigger,\n content,\n title,\n description,\n open: controlledOpen,\n side = \"right\",\n footer,\n footerCloseButtonText,\n className,\n headerClassName,\n contentClassName,\n footerClassName,\n cardName,\n onOpened,\n onClosed,\n onOpenChanged,\n } = props;\n\n const effectiveCloseText =\n footerCloseButtonText === undefined ? \"Close\" : footerCloseButtonText;\n\n const [internalOpen, setInternalOpen] = React.useState(false);\n const open = controlledOpen ?? internalOpen;\n const prevControlledOpenRef = React.useRef(controlledOpen);\n\n // Detect programmatic close (controlled open: true → false)\n React.useEffect(() => {\n if (\n prevControlledOpenRef.current === true &&\n controlledOpen === false &&\n open === false\n ) {\n onClosed({id, reason: \"programmatic\"});\n }\n prevControlledOpenRef.current = controlledOpen;\n }, [controlledOpen, open, id, onClosed]);\n\n const handleOpenChange = (nextOpen: boolean) => {\n if (controlledOpen === undefined) {\n setInternalOpen(nextOpen);\n }\n onOpenChanged({open: nextOpen, id});\n if (nextOpen) {\n onOpened({id});\n } else if (controlledOpen === undefined) {\n onClosed({id, reason: \"user\"});\n }\n };\n\n function renderHeader() {\n if (!title && !description) return null;\n return (\n <SheetHeader className={headerClassName}>\n {title && <SheetTitle>{title}</SheetTitle>}\n {description && <SheetDescription>{description}</SheetDescription>}\n </SheetHeader>\n );\n }\n\n function renderFooter() {\n if (footer) {\n return (\n <SheetFooter className={footerClassName}>\n <Card cardName={footer} parentCard={cardName} />\n </SheetFooter>\n );\n }\n if (effectiveCloseText !== null) {\n return (\n <SheetFooter className={footerClassName}>\n <SheetClose asChild>\n <Button variant=\"outline\">{effectiveCloseText}</Button>\n </SheetClose>\n </SheetFooter>\n );\n }\n return null;\n }\n\n return (\n <SheetRoot open={open} onOpenChange={handleOpenChange}>\n {trigger && (\n <SheetTrigger asChild>\n <span className=\"inline-flex\" data-pihanga-trigger-wrapper>\n <Card cardName={trigger} parentCard={cardName} />\n </span>\n </SheetTrigger>\n )}\n <SheetContent\n data-pihanga={cardName}\n side={side}\n className={className}\n >\n {renderHeader()}\n <div className={cn(\"flex-1 overflow-y-auto p-4\", contentClassName)}>\n <Card cardName={content} parentCard={cardName} />\n </div>\n {renderFooter()}\n </SheetContent>\n </SheetRoot>\n );\n};\n"],"mappings":";;;;;;;AAiBA,IAAa,KACX,MACoB;CACpB,IAAM,EACJ,OACA,YACA,YACA,UACA,gBACA,MAAM,GACN,UAAO,SACP,WACA,0BACA,cACA,oBACA,qBACA,oBACA,aACA,aACA,aACA,qBACE,GAEE,IACJ,MAA0B,KAAA,IAAY,UAAU,GAE5C,CAAC,GAAc,KAAmB,EAAM,SAAS,EAAK,GACtD,IAAO,KAAkB,GACzB,IAAwB,EAAM,OAAO,CAAc;CAGzD,EAAM,gBAAgB;EAQpB,AANE,EAAsB,YAAY,MAClC,MAAmB,MACnB,MAAS,MAET,EAAS;GAAC;GAAI,QAAQ;EAAc,CAAC,GAEvC,EAAsB,UAAU;CAClC,GAAG;EAAC;EAAgB;EAAM;EAAI;CAAQ,CAAC;CAEvC,IAAM,KAAoB,MAAsB;EAK9C,AAJI,MAAmB,KAAA,KACrB,EAAgB,CAAQ,GAE1B,EAAc;GAAC,MAAM;GAAU;EAAE,CAAC,GAC9B,IACF,EAAS,EAAC,MAAE,CAAC,IACJ,MAAmB,KAAA,KAC5B,EAAS;GAAC;GAAI,QAAQ;EAAM,CAAC;CAEjC;CAEA,SAAS,IAAe;EAEtB,OADI,CAAC,KAAS,CAAC,IAAoB,OAEjC,kBAAC,GAAD;GAAa,WAAW;aAAxB,CACG,KAAS,kBAAC,GAAD,EAAA,UAAa,EAAkB,CAAA,GACxC,KAAe,kBAAC,GAAD,EAAA,UAAmB,EAA8B,CAAA,CACtD;;CAEjB;CAEA,SAAS,IAAe;EAiBtB,OAhBI,IAEA,kBAAC,GAAD;GAAa,WAAW;aACtB,kBAAC,GAAD;IAAM,UAAU;IAAQ,YAAY;GAAW,CAAA;EACpC,CAAA,IAGb,MAAuB,OASpB,OAPH,kBAAC,GAAD;GAAa,WAAW;aACtB,kBAAC,GAAD;IAAY,SAAA;cACV,kBAAC,GAAD;KAAQ,SAAQ;eAAW;IAA2B,CAAA;GAC5C,CAAA;EACD,CAAA;CAInB;CAEA,OACE,kBAAC,GAAD;EAAiB;EAAM,cAAc;YAArC,CACG,KACC,kBAAC,GAAD;GAAc,SAAA;aACZ,kBAAC,QAAD;IAAM,WAAU;IAAc,gCAAA;cAC5B,kBAAC,GAAD;KAAM,UAAU;KAAS,YAAY;IAAW,CAAA;GAC5C,CAAA;EACM,CAAA,GAEhB,kBAAC,GAAD;GACE,gBAAc;GACR;GACK;aAHb;IAKG,EAAa;IACd,kBAAC,OAAD;KAAK,WAAW,EAAG,8BAA8B,CAAgB;eAC/D,kBAAC,GAAD;MAAM,UAAU;MAAS,YAAY;KAAW,CAAA;IAC7C,CAAA;IACJ,EAAa;GACF;IACL;;AAEf"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { PiCardRef } from '@pihanga2/core';
|
|
2
|
+
export declare const PI_SHEET_CARD = "pi/sheet";
|
|
3
|
+
export declare const Sheet: <S extends import('@pihanga2/core').ReduxState>(p: import('@pihanga2/core').PiMapProps<PiSheetProps, S, PiSheetEvents>) => import('@pihanga2/core').PiCardDef;
|
|
4
|
+
export declare const PI_SHEET_ACTION: {
|
|
5
|
+
CLOSED: string;
|
|
6
|
+
OPENED: string;
|
|
7
|
+
OPEN_CHANGED: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const onSheetOpened: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
10
|
+
cardID: string;
|
|
11
|
+
} & SheetOpenedEvent>) => void;
|
|
12
|
+
export declare const onSheetClosed: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
13
|
+
cardID: string;
|
|
14
|
+
} & SheetClosedEvent>) => void;
|
|
15
|
+
export declare const onSheetOpenChanged: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
16
|
+
cardID: string;
|
|
17
|
+
} & SheetOpenChangedEvent>) => void;
|
|
18
|
+
export type PiSheetProps = {
|
|
19
|
+
/**
|
|
20
|
+
* Optional id passed through to events for identification.
|
|
21
|
+
*/
|
|
22
|
+
id?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Optional trigger card (e.g. a Button).
|
|
25
|
+
*
|
|
26
|
+
* When provided, clicking it opens the sheet.
|
|
27
|
+
* When omitted, control the sheet via the `open` prop.
|
|
28
|
+
*/
|
|
29
|
+
trigger?: PiCardRef;
|
|
30
|
+
/**
|
|
31
|
+
* Card to render as the sheet body content.
|
|
32
|
+
*/
|
|
33
|
+
content: PiCardRef;
|
|
34
|
+
/**
|
|
35
|
+
* Optional sheet title (rendered in header).
|
|
36
|
+
*/
|
|
37
|
+
title?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Optional sheet description (rendered below title).
|
|
40
|
+
*/
|
|
41
|
+
description?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Controlled open state.
|
|
44
|
+
* When provided, visibility is fully managed externally.
|
|
45
|
+
*/
|
|
46
|
+
open?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Which edge the sheet slides in from.
|
|
49
|
+
* @default "right"
|
|
50
|
+
*/
|
|
51
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
52
|
+
/**
|
|
53
|
+
* Optional footer card.
|
|
54
|
+
* When provided, takes precedence over the default close button.
|
|
55
|
+
*/
|
|
56
|
+
footer?: PiCardRef;
|
|
57
|
+
/**
|
|
58
|
+
* Text for the default close button in the footer.
|
|
59
|
+
* Set to `null` to hide the default close button.
|
|
60
|
+
* @default "Close"
|
|
61
|
+
*/
|
|
62
|
+
footerCloseButtonText?: string | null;
|
|
63
|
+
/**
|
|
64
|
+
* Additional CSS classes for the sheet content panel.
|
|
65
|
+
*/
|
|
66
|
+
className?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Additional CSS classes for the sheet header.
|
|
69
|
+
*/
|
|
70
|
+
headerClassName?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Additional CSS classes for the sheet body (wraps `content`).
|
|
73
|
+
*/
|
|
74
|
+
contentClassName?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Additional CSS classes for the sheet footer.
|
|
77
|
+
*/
|
|
78
|
+
footerClassName?: string;
|
|
79
|
+
};
|
|
80
|
+
export type SheetOpenedEvent = {
|
|
81
|
+
id?: string;
|
|
82
|
+
};
|
|
83
|
+
export type SheetClosedEvent = {
|
|
84
|
+
id?: string;
|
|
85
|
+
/**
|
|
86
|
+
* - 'user': dismissed by user (outside click, ESC, X button)
|
|
87
|
+
* - 'programmatic': closed via props.open change
|
|
88
|
+
*/
|
|
89
|
+
reason?: "user" | "programmatic";
|
|
90
|
+
};
|
|
91
|
+
export type SheetOpenChangedEvent = {
|
|
92
|
+
open: boolean;
|
|
93
|
+
id?: string;
|
|
94
|
+
};
|
|
95
|
+
export type PiSheetEvents = {
|
|
96
|
+
onOpened: SheetOpenedEvent;
|
|
97
|
+
onClosed: SheetClosedEvent;
|
|
98
|
+
onOpenChanged: SheetOpenChangedEvent;
|
|
99
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createCardDeclaration as e, createOnAction as t, registerActions as n } from "@pihanga2/core";
|
|
2
|
+
//#region src/cards/sheetCard/sheetCard.types.ts
|
|
3
|
+
var r = "pi/sheet", i = e(r), a = n(r, [
|
|
4
|
+
"opened",
|
|
5
|
+
"closed",
|
|
6
|
+
"open_changed"
|
|
7
|
+
]), o = t(a.OPENED), s = t(a.CLOSED), c = t(a.OPEN_CHANGED);
|
|
8
|
+
//#endregion
|
|
9
|
+
export { a as PI_SHEET_ACTION, r as PI_SHEET_CARD, i as Sheet, s as onSheetClosed, c as onSheetOpenChanged, o as onSheetOpened };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=sheetCard.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sheetCard.types.js","names":[],"sources":["../../../src/cards/sheetCard/sheetCard.types.ts"],"sourcesContent":["import {\n createCardDeclaration,\n createOnAction,\n type PiCardRef,\n registerActions,\n} from \"@pihanga2/core\";\n\nexport const PI_SHEET_CARD = \"pi/sheet\";\n\nexport const Sheet = createCardDeclaration<PiSheetProps, PiSheetEvents>(\n PI_SHEET_CARD,\n);\n\nexport const PI_SHEET_ACTION = registerActions(PI_SHEET_CARD, [\n \"opened\",\n \"closed\",\n \"open_changed\",\n]);\n\nexport const onSheetOpened = createOnAction<SheetOpenedEvent>(\n PI_SHEET_ACTION.OPENED,\n);\n\nexport const onSheetClosed = createOnAction<SheetClosedEvent>(\n PI_SHEET_ACTION.CLOSED,\n);\n\nexport const onSheetOpenChanged = createOnAction<SheetOpenChangedEvent>(\n PI_SHEET_ACTION.OPEN_CHANGED,\n);\n\nexport type PiSheetProps = {\n /**\n * Optional id passed through to events for identification.\n */\n id?: string;\n\n /**\n * Optional trigger card (e.g. a Button).\n *\n * When provided, clicking it opens the sheet.\n * When omitted, control the sheet via the `open` prop.\n */\n trigger?: PiCardRef;\n\n /**\n * Card to render as the sheet body content.\n */\n content: PiCardRef;\n\n /**\n * Optional sheet title (rendered in header).\n */\n title?: string;\n\n /**\n * Optional sheet description (rendered below title).\n */\n description?: string;\n\n /**\n * Controlled open state.\n * When provided, visibility is fully managed externally.\n */\n open?: boolean;\n\n /**\n * Which edge the sheet slides in from.\n * @default \"right\"\n */\n side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n\n /**\n * Optional footer card.\n * When provided, takes precedence over the default close button.\n */\n footer?: PiCardRef;\n\n /**\n * Text for the default close button in the footer.\n * Set to `null` to hide the default close button.\n * @default \"Close\"\n */\n footerCloseButtonText?: string | null;\n\n /**\n * Additional CSS classes for the sheet content panel.\n */\n className?: string;\n\n /**\n * Additional CSS classes for the sheet header.\n */\n headerClassName?: string;\n\n /**\n * Additional CSS classes for the sheet body (wraps `content`).\n */\n contentClassName?: string;\n\n /**\n * Additional CSS classes for the sheet footer.\n */\n footerClassName?: string;\n};\n\nexport type SheetOpenedEvent = {\n id?: string;\n};\n\nexport type SheetClosedEvent = {\n id?: string;\n /**\n * - 'user': dismissed by user (outside click, ESC, X button)\n * - 'programmatic': closed via props.open change\n */\n reason?: \"user\" | \"programmatic\";\n};\n\nexport type SheetOpenChangedEvent = {\n open: boolean;\n id?: string;\n};\n\nexport type PiSheetEvents = {\n onOpened: SheetOpenedEvent;\n onClosed: SheetClosedEvent;\n onOpenChanged: SheetOpenChangedEvent;\n};\n"],"mappings":";;AAOA,IAAa,IAAgB,YAEhB,IAAQ,EACnB,CACF,GAEa,IAAkB,EAAgB,GAAe;CAC5D;CACA;CACA;AACF,CAAC,GAEY,IAAgB,EAC3B,EAAgB,MAClB,GAEa,IAAgB,EAC3B,EAAgB,MAClB,GAEa,IAAqB,EAChC,EAAgB,YAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './sheetCard/index';
|
package/components/ui/sheet.js
CHANGED
|
@@ -17,22 +17,28 @@ function o({ ...e }) {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
function s({ ...e }) {
|
|
20
|
+
return /* @__PURE__ */ t(i.Close, {
|
|
21
|
+
"data-slot": "sheet-close",
|
|
22
|
+
...e
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function c({ ...e }) {
|
|
20
26
|
return /* @__PURE__ */ t(i.Portal, {
|
|
21
27
|
"data-slot": "sheet-portal",
|
|
22
28
|
...e
|
|
23
29
|
});
|
|
24
30
|
}
|
|
25
|
-
function
|
|
31
|
+
function l({ className: n, ...r }) {
|
|
26
32
|
return /* @__PURE__ */ t(i.Overlay, {
|
|
27
33
|
"data-slot": "sheet-overlay",
|
|
28
34
|
className: e("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", n),
|
|
29
35
|
...r
|
|
30
36
|
});
|
|
31
37
|
}
|
|
32
|
-
function
|
|
33
|
-
return /* @__PURE__ */ n(
|
|
38
|
+
function u({ className: a, children: o, side: s = "right", ...u }) {
|
|
39
|
+
return /* @__PURE__ */ n(c, { children: [/* @__PURE__ */ t(l, {}), /* @__PURE__ */ n(i.Content, {
|
|
34
40
|
"data-slot": "sheet-content",
|
|
35
|
-
className: e("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
41
|
+
className: e("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500", s === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm", s === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm", s === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b", s === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t", a),
|
|
36
42
|
...u,
|
|
37
43
|
children: [o, /* @__PURE__ */ n(i.Close, {
|
|
38
44
|
className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",
|
|
@@ -43,7 +49,35 @@ function l({ className: a, children: o, side: l = "right", ...u }) {
|
|
|
43
49
|
})]
|
|
44
50
|
})] });
|
|
45
51
|
}
|
|
52
|
+
function d({ className: n, ...r }) {
|
|
53
|
+
return /* @__PURE__ */ t("div", {
|
|
54
|
+
"data-slot": "sheet-header",
|
|
55
|
+
className: e("flex flex-col gap-1.5 p-4", n),
|
|
56
|
+
...r
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function f({ className: n, ...r }) {
|
|
60
|
+
return /* @__PURE__ */ t("div", {
|
|
61
|
+
"data-slot": "sheet-footer",
|
|
62
|
+
className: e("mt-auto flex flex-col gap-2 p-4", n),
|
|
63
|
+
...r
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function p({ className: n, ...r }) {
|
|
67
|
+
return /* @__PURE__ */ t(i.Title, {
|
|
68
|
+
"data-slot": "sheet-title",
|
|
69
|
+
className: e("text-foreground font-semibold", n),
|
|
70
|
+
...r
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function m({ className: n, ...r }) {
|
|
74
|
+
return /* @__PURE__ */ t(i.Description, {
|
|
75
|
+
"data-slot": "sheet-description",
|
|
76
|
+
className: e("text-muted-foreground text-sm", n),
|
|
77
|
+
...r
|
|
78
|
+
});
|
|
79
|
+
}
|
|
46
80
|
//#endregion
|
|
47
|
-
export { a as Sheet,
|
|
81
|
+
export { a as Sheet, s as SheetClose, u as SheetContent, m as SheetDescription, f as SheetFooter, d as SheetHeader, p as SheetTitle, o as SheetTrigger };
|
|
48
82
|
|
|
49
83
|
//# sourceMappingURL=sheet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sheet.js","names":[],"sources":["../../../src/components/ui/sheet.tsx"],"sourcesContent":["import * as React from \"react\"\nimport * as SheetPrimitive from \"@radix-ui/react-dialog\"\nimport { XIcon } from \"lucide-react\"\n\nimport { cn } from \"@/components/lib/utils\"\n\nfunction Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {\n return <SheetPrimitive.Root data-slot=\"sheet\" {...props} />\n}\n\nfunction SheetTrigger({\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {\n return <SheetPrimitive.Trigger data-slot=\"sheet-trigger\" {...props} />\n}\n\nfunction SheetClose({\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Close>) {\n return <SheetPrimitive.Close data-slot=\"sheet-close\" {...props} />\n}\n\nfunction SheetPortal({\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Portal>) {\n return <SheetPrimitive.Portal data-slot=\"sheet-portal\" {...props} />\n}\n\nfunction SheetOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {\n return (\n <SheetPrimitive.Overlay\n data-slot=\"sheet-overlay\"\n className={cn(\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction SheetContent({\n className,\n children,\n side = \"right\",\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Content> & {\n side?: \"top\" | \"right\" | \"bottom\" | \"left\"\n}) {\n return (\n <SheetPortal>\n <SheetOverlay />\n <SheetPrimitive.Content\n data-slot=\"sheet-content\"\n className={cn(\n \"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500\",\n side === \"right\" &&\n \"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm\",\n side === \"left\" &&\n \"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm\",\n side === \"top\" &&\n \"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b\",\n side === \"bottom\" &&\n \"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t\",\n className\n )}\n {...props}\n >\n {children}\n <SheetPrimitive.Close className=\"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none\">\n <XIcon className=\"size-4\" />\n <span className=\"sr-only\">Close</span>\n </SheetPrimitive.Close>\n </SheetPrimitive.Content>\n </SheetPortal>\n )\n}\n\nfunction SheetHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sheet-header\"\n className={cn(\"flex flex-col gap-1.5 p-4\", className)}\n {...props}\n />\n )\n}\n\nfunction SheetFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sheet-footer\"\n className={cn(\"mt-auto flex flex-col gap-2 p-4\", className)}\n {...props}\n />\n )\n}\n\nfunction SheetTitle({\n className,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Title>) {\n return (\n <SheetPrimitive.Title\n data-slot=\"sheet-title\"\n className={cn(\"text-foreground font-semibold\", className)}\n {...props}\n />\n )\n}\n\nfunction SheetDescription({\n className,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Description>) {\n return (\n <SheetPrimitive.Description\n data-slot=\"sheet-description\"\n className={cn(\"text-muted-foreground text-sm\", className)}\n {...props}\n />\n )\n}\n\nexport {\n Sheet,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n}\n"],"mappings":";;;;;;AAMA,SAAS,EAAM,EAAE,GAAG,KAA2D;CAC7E,OAAO,kBAAC,EAAe,MAAhB;EAAqB,aAAU;EAAQ,GAAI;CAAQ,CAAA;AAC5D;AAEA,SAAS,EAAa,EACpB,GAAG,KACmD;CACtD,OAAO,kBAAC,EAAe,SAAhB;EAAwB,aAAU;EAAgB,GAAI;CAAQ,CAAA;AACvE;
|
|
1
|
+
{"version":3,"file":"sheet.js","names":[],"sources":["../../../src/components/ui/sheet.tsx"],"sourcesContent":["import * as React from \"react\"\nimport * as SheetPrimitive from \"@radix-ui/react-dialog\"\nimport { XIcon } from \"lucide-react\"\n\nimport { cn } from \"@/components/lib/utils\"\n\nfunction Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {\n return <SheetPrimitive.Root data-slot=\"sheet\" {...props} />\n}\n\nfunction SheetTrigger({\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {\n return <SheetPrimitive.Trigger data-slot=\"sheet-trigger\" {...props} />\n}\n\nfunction SheetClose({\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Close>) {\n return <SheetPrimitive.Close data-slot=\"sheet-close\" {...props} />\n}\n\nfunction SheetPortal({\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Portal>) {\n return <SheetPrimitive.Portal data-slot=\"sheet-portal\" {...props} />\n}\n\nfunction SheetOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {\n return (\n <SheetPrimitive.Overlay\n data-slot=\"sheet-overlay\"\n className={cn(\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction SheetContent({\n className,\n children,\n side = \"right\",\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Content> & {\n side?: \"top\" | \"right\" | \"bottom\" | \"left\"\n}) {\n return (\n <SheetPortal>\n <SheetOverlay />\n <SheetPrimitive.Content\n data-slot=\"sheet-content\"\n className={cn(\n \"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500\",\n side === \"right\" &&\n \"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm\",\n side === \"left\" &&\n \"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm\",\n side === \"top\" &&\n \"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b\",\n side === \"bottom\" &&\n \"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t\",\n className\n )}\n {...props}\n >\n {children}\n <SheetPrimitive.Close className=\"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none\">\n <XIcon className=\"size-4\" />\n <span className=\"sr-only\">Close</span>\n </SheetPrimitive.Close>\n </SheetPrimitive.Content>\n </SheetPortal>\n )\n}\n\nfunction SheetHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sheet-header\"\n className={cn(\"flex flex-col gap-1.5 p-4\", className)}\n {...props}\n />\n )\n}\n\nfunction SheetFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"sheet-footer\"\n className={cn(\"mt-auto flex flex-col gap-2 p-4\", className)}\n {...props}\n />\n )\n}\n\nfunction SheetTitle({\n className,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Title>) {\n return (\n <SheetPrimitive.Title\n data-slot=\"sheet-title\"\n className={cn(\"text-foreground font-semibold\", className)}\n {...props}\n />\n )\n}\n\nfunction SheetDescription({\n className,\n ...props\n}: React.ComponentProps<typeof SheetPrimitive.Description>) {\n return (\n <SheetPrimitive.Description\n data-slot=\"sheet-description\"\n className={cn(\"text-muted-foreground text-sm\", className)}\n {...props}\n />\n )\n}\n\nexport {\n Sheet,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n}\n"],"mappings":";;;;;;AAMA,SAAS,EAAM,EAAE,GAAG,KAA2D;CAC7E,OAAO,kBAAC,EAAe,MAAhB;EAAqB,aAAU;EAAQ,GAAI;CAAQ,CAAA;AAC5D;AAEA,SAAS,EAAa,EACpB,GAAG,KACmD;CACtD,OAAO,kBAAC,EAAe,SAAhB;EAAwB,aAAU;EAAgB,GAAI;CAAQ,CAAA;AACvE;AAEA,SAAS,EAAW,EAClB,GAAG,KACiD;CACpD,OAAO,kBAAC,EAAe,OAAhB;EAAsB,aAAU;EAAc,GAAI;CAAQ,CAAA;AACnE;AAEA,SAAS,EAAY,EACnB,GAAG,KACkD;CACrD,OAAO,kBAAC,EAAe,QAAhB;EAAuB,aAAU;EAAe,GAAI;CAAQ,CAAA;AACrE;AAEA,SAAS,EAAa,EACpB,cACA,GAAG,KACmD;CACtD,OACE,kBAAC,EAAe,SAAhB;EACE,aAAU;EACV,WAAW,EACT,0JACA,CACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,EAAa,EACpB,cACA,aACA,UAAO,SACP,GAAG,KAGF;CACD,OACE,kBAAC,GAAD,EAAA,UAAA,CACE,kBAAC,GAAD,CAAe,CAAA,GACf,kBAAC,EAAe,SAAhB;EACE,aAAU;EACV,WAAW,EACT,8MACA,MAAS,WACP,oIACF,MAAS,UACP,iIACF,MAAS,SACP,4GACF,MAAS,YACP,qHACF,CACF;EACA,GAAI;YAdN,CAgBG,GACD,kBAAC,EAAe,OAAhB;GAAsB,WAAU;aAAhC,CACE,kBAAC,GAAD,EAAO,WAAU,SAAU,CAAA,GAC3B,kBAAC,QAAD;IAAM,WAAU;cAAU;GAAW,CAAA,CACjB;IACA;GACb,EAAA,CAAA;AAEjB;AAEA,SAAS,EAAY,EAAE,cAAW,GAAG,KAAsC;CACzE,OACE,kBAAC,OAAD;EACE,aAAU;EACV,WAAW,EAAG,6BAA6B,CAAS;EACpD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,EAAY,EAAE,cAAW,GAAG,KAAsC;CACzE,OACE,kBAAC,OAAD;EACE,aAAU;EACV,WAAW,EAAG,mCAAmC,CAAS;EAC1D,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,EAAW,EAClB,cACA,GAAG,KACiD;CACpD,OACE,kBAAC,EAAe,OAAhB;EACE,aAAU;EACV,WAAW,EAAG,iCAAiC,CAAS;EACxD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,EAAiB,EACxB,cACA,GAAG,KACuD;CAC1D,OACE,kBAAC,EAAe,aAAhB;EACE,aAAU;EACV,WAAW,EAAG,iCAAiC,CAAS;EACxD,GAAI;CACL,CAAA;AAEL"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pihanga2/shadcn",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"description": "Pihanga core card components built on shadcn/ui and Radix UI — the npm distribution of pihanga-shadcn.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -68,6 +68,10 @@
|
|
|
68
68
|
"import": "./cards/framework/index.js",
|
|
69
69
|
"types": "./cards/framework/index.d.ts"
|
|
70
70
|
},
|
|
71
|
+
"./cards/iconCard": {
|
|
72
|
+
"import": "./cards/iconCard/index.js",
|
|
73
|
+
"types": "./cards/iconCard/index.d.ts"
|
|
74
|
+
},
|
|
71
75
|
"./cards/infoCard": {
|
|
72
76
|
"import": "./cards/infoCard/index.js",
|
|
73
77
|
"types": "./cards/infoCard/index.d.ts"
|
|
@@ -128,6 +132,10 @@
|
|
|
128
132
|
"import": "./cards/select/index.js",
|
|
129
133
|
"types": "./cards/select/index.d.ts"
|
|
130
134
|
},
|
|
135
|
+
"./cards/sheetCard": {
|
|
136
|
+
"import": "./cards/sheetCard/index.js",
|
|
137
|
+
"types": "./cards/sheetCard/index.d.ts"
|
|
138
|
+
},
|
|
131
139
|
"./cards/slider": {
|
|
132
140
|
"import": "./cards/slider/index.js",
|
|
133
141
|
"types": "./cards/slider/index.d.ts"
|
|
@@ -206,6 +214,7 @@
|
|
|
206
214
|
"./cards/flexGrid/index.js",
|
|
207
215
|
"./cards/form/index.js",
|
|
208
216
|
"./cards/framework/index.js",
|
|
217
|
+
"./cards/iconCard/index.js",
|
|
209
218
|
"./cards/infoCard/index.js",
|
|
210
219
|
"./cards/input/index.js",
|
|
211
220
|
"./cards/jsonViewer/index.js",
|
|
@@ -221,6 +230,7 @@
|
|
|
221
230
|
"./cards/resizable/index.js",
|
|
222
231
|
"./cards/scrollbarWithAnnotations/index.js",
|
|
223
232
|
"./cards/select/index.js",
|
|
233
|
+
"./cards/sheetCard/index.js",
|
|
224
234
|
"./cards/slider/index.js",
|
|
225
235
|
"./cards/sliderValue/index.js",
|
|
226
236
|
"./cards/stack/index.js",
|
package/theme.css
CHANGED