@pihanga2/shadcn 0.2.14 → 0.2.17
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 +68 -0
- package/AGENT.using-cards.md +15 -3
- package/README.md +3 -1
- package/cards/conditional/conditional.component.js +30 -12
- package/cards/conditional/conditional.component.js.map +1 -1
- package/cards/conditional/conditional.types.d.ts +21 -3
- package/cards/conditional/conditional.types.js +1 -1
- package/cards/conditional/conditional.types.js.map +1 -1
- package/cards/fileDrop/fileDrop.component.js +64 -49
- package/cards/fileDrop/fileDrop.component.js.map +1 -1
- package/cards/fileDrop/fileDrop.css +1 -1
- package/cards/fileDrop/fileDrop.types.d.ts +49 -0
- package/cards/fileDrop/fileDrop.types.js +9 -2
- package/cards/fileDrop/fileDrop.types.js.map +1 -1
- package/cards/fileDrop/index.js +14 -8
- package/cards/fileDrop/index.js.map +1 -1
- package/cards/jsonViewer/jsonViewer.css +1 -1
- package/cards/keyboardOverlay/index.d.ts +1 -0
- package/cards/keyboardOverlay/index.js +13 -0
- package/cards/keyboardOverlay/index.js.map +1 -0
- package/cards/keyboardOverlay/keyboardOverlay.component.d.ts +4 -0
- package/cards/keyboardOverlay/keyboardOverlay.component.js +76 -0
- package/cards/keyboardOverlay/keyboardOverlay.component.js.map +1 -0
- package/cards/keyboardOverlay/keyboardOverlay.types.d.ts +92 -0
- package/cards/keyboardOverlay/keyboardOverlay.types.js +7 -0
- package/cards/keyboardOverlay/keyboardOverlay.types.js.map +1 -0
- package/cards/loadingOverlay/loadingOverlay.css +1 -1
- package/cards/modeToggle/mode-toggle.component.js +1 -1
- package/cards/modeToggle/mode-toggle.component.js.map +1 -1
- package/cards/pageWithNavbar/pageWithNavbar.css +1 -1
- package/cards/pasteTarget/pasteTarget.css +1 -1
- package/cards/resizableColumns/index.d.ts +1 -0
- package/cards/resizableColumns/resizableColumns.component.d.ts +4 -0
- package/cards/resizableColumns/resizableColumns.types.d.ts +22 -0
- package/cards/resizableGrid/index.d.ts +1 -0
- package/cards/resizableGrid/resizableGrid.component.d.ts +4 -0
- package/cards/resizableGrid/resizableGrid.types.d.ts +33 -0
- package/cards/scrollbarWithAnnotations/scrollbarWithAnnotations.css +1 -1
- package/cards/suspense/index.d.ts +1 -0
- package/cards/suspense/index.js +12 -0
- package/cards/suspense/index.js.map +1 -0
- package/cards/suspense/suspense.component.d.ts +15 -0
- package/cards/suspense/suspense.component.js +45 -0
- package/cards/suspense/suspense.component.js.map +1 -0
- package/cards/suspense/suspense.types.d.ts +67 -0
- package/cards/suspense/suspense.types.js +7 -0
- package/cards/suspense/suspense.types.js.map +1 -0
- package/cards/typography/typography.component.js +13 -12
- package/cards/typography/typography.component.js.map +1 -1
- package/cards/typography/typography.types.d.ts +2 -0
- package/cards/typography/typography.types.js.map +1 -1
- package/package.json +12 -2
|
@@ -16,27 +16,28 @@ var a = {
|
|
|
16
16
|
small: ["small", "text-sm font-medium leading-none"],
|
|
17
17
|
muted: ["p", "text-sm text-muted-foreground"]
|
|
18
18
|
}, o = (s) => {
|
|
19
|
-
let { text: c, childCard: l, paragraph: u, level: d, className: f, style: p,
|
|
20
|
-
function
|
|
19
|
+
let { text: c, childCard: l, paragraph: u, level: d, className: f, style: p, id: m, cardName: h, _dispatch: g, _cls: _ } = s, [v, y] = d ? a[d] : ["div", ""];
|
|
20
|
+
function b() {
|
|
21
21
|
return l ? /* @__PURE__ */ i(n, {
|
|
22
22
|
cardName: l,
|
|
23
|
-
parentCard:
|
|
24
|
-
}) : u ? /* @__PURE__ */ i(r, { children: u.map((e, t) =>
|
|
23
|
+
parentCard: h
|
|
24
|
+
}) : u ? /* @__PURE__ */ i(r, { children: u.map((e, t) => x(e, t)) }) : c;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function x(e, t) {
|
|
27
27
|
return typeof e == "string" ? e : e && typeof e == "object" ? o({
|
|
28
28
|
...e,
|
|
29
|
-
_dispatch:
|
|
30
|
-
_cls:
|
|
31
|
-
cardName:
|
|
29
|
+
_dispatch: g,
|
|
30
|
+
_cls: _,
|
|
31
|
+
cardName: h,
|
|
32
32
|
key: t
|
|
33
33
|
}) : null;
|
|
34
34
|
}
|
|
35
|
-
return t.createElement(
|
|
36
|
-
className: e(
|
|
35
|
+
return t.createElement(v, {
|
|
36
|
+
className: e(y, f),
|
|
37
37
|
style: p,
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
...m ? { id: m } : {},
|
|
39
|
+
"data-pihanga": h
|
|
40
|
+
}, b());
|
|
40
41
|
};
|
|
41
42
|
//#endregion
|
|
42
43
|
export { o as TypographyComponent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typography.component.js","names":[],"sources":["../../../src/cards/typography/typography.component.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {Card, type PiCardProps} from \"@pihanga2/core\";\nimport {cn} from \"@/lib/utils\";\nimport type {TypographyLevel, TypographyProps} from \"./typography.types\";\n\n/** Maps each level to [html element, tailwind classes] */\nconst LEVEL_CONFIG: Record<\n TypographyLevel,\n [keyof React.JSX.IntrinsicElements, string]\n> = {\n h1: [\"h1\", \"scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl\"],\n h2: [\n \"h2\",\n \"scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0\",\n ],\n h3: [\"h3\", \"scroll-m-20 text-2xl font-semibold tracking-tight\"],\n h4: [\"h4\", \"scroll-m-20 text-xl font-semibold tracking-tight\"],\n p: [\"p\", \"leading-7 [&:not(:first-child)]:mt-6\"],\n blockquote: [\"blockquote\", \"mt-6 border-l-2 pl-6 italic\"],\n code: [\n \"code\",\n \"relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold\",\n ],\n lead: [\"p\", \"text-xl text-muted-foreground\"],\n large: [\"div\", \"text-lg font-semibold\"],\n small: [\"small\", \"text-sm font-medium leading-none\"],\n muted: [\"p\", \"text-sm text-muted-foreground\"],\n};\n\nexport const TypographyComponent = (\n props: PiCardProps<TypographyProps>,\n): React.ReactNode => {\n const {\n text,\n childCard,\n paragraph,\n level,\n className,\n style,\n cardName,\n _dispatch,\n _cls,\n } = props;\n\n const [el, levelClass] = level ? LEVEL_CONFIG[level] : [\"div\", \"\"];\n\n function renderChildren(): React.ReactNode {\n if (childCard) {\n return <Card cardName={childCard} parentCard={cardName} />;\n }\n if (paragraph) {\n return <>{paragraph.map((item, i) => renderParaItem(item, i))}</>;\n }\n return text;\n }\n\n function renderParaItem(\n item: string | TypographyProps,\n key: number,\n ): React.ReactNode {\n if (typeof item === \"string\") {\n return item;\n }\n if (item && typeof item === \"object\") {\n return TypographyComponent({\n ...item,\n _dispatch,\n _cls,\n cardName,\n key,\n } as PiCardProps<TypographyProps> & {key: number});\n }\n return null;\n }\n\n return React.createElement(\n el,\n {\n className: cn(levelClass, className),\n style,\n \"data-pihanga\": cardName,\n },\n renderChildren(),\n );\n};\n"],"mappings":";;;;;AAMA,IAAM,IAGF;CACF,IAAI,CAAC,MAAM,gEAAgE;CAC3E,IAAI,CACF,MACA,4EACF;CACA,IAAI,CAAC,MAAM,mDAAmD;CAC9D,IAAI,CAAC,MAAM,kDAAkD;CAC7D,GAAG,CAAC,KAAK,sCAAsC;CAC/C,YAAY,CAAC,cAAc,6BAA6B;CACxD,MAAM,CACJ,QACA,mFACF;CACA,MAAM,CAAC,KAAK,+BAA+B;CAC3C,OAAO,CAAC,OAAO,uBAAuB;CACtC,OAAO,CAAC,SAAS,kCAAkC;CACnD,OAAO,CAAC,KAAK,+BAA+B;AAC9C,GAEa,KACX,MACoB;CACpB,IAAM,EACJ,SACA,cACA,cACA,UACA,cACA,UACA,aACA,cACA,YACE,GAEE,CAAC,GAAI,KAAc,IAAQ,EAAa,KAAS,CAAC,OAAO,EAAE;CAEjE,SAAS,IAAkC;EAOzC,OANI,IACK,kBAAC,GAAD;GAAM,UAAU;GAAW,YAAY;EAAW,CAAA,IAEvD,IACK,kBAAA,GAAA,EAAA,UAAG,EAAU,KAAK,GAAM,MAAM,EAAe,GAAM,CAAC,CAAC,EAAI,CAAA,IAE3D;CACT;CAEA,SAAS,EACP,GACA,GACiB;EAajB,OAZI,OAAO,KAAS,WACX,IAEL,KAAQ,OAAO,KAAS,WACnB,EAAoB;GACzB,GAAG;GACH;GACA;GACA;GACA;EACF,CAAiD,IAE5C;CACT;CAEA,OAAO,EAAM,cACX,GACA;EACE,WAAW,EAAG,GAAY,CAAS;EACnC;EACA,gBAAgB;CAClB,GACA,EAAe,CACjB;AACF"}
|
|
1
|
+
{"version":3,"file":"typography.component.js","names":[],"sources":["../../../src/cards/typography/typography.component.tsx"],"sourcesContent":["import * as React from \"react\";\nimport {Card, type PiCardProps} from \"@pihanga2/core\";\nimport {cn} from \"@/lib/utils\";\nimport type {TypographyLevel, TypographyProps} from \"./typography.types\";\n\n/** Maps each level to [html element, tailwind classes] */\nconst LEVEL_CONFIG: Record<\n TypographyLevel,\n [keyof React.JSX.IntrinsicElements, string]\n> = {\n h1: [\"h1\", \"scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl\"],\n h2: [\n \"h2\",\n \"scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0\",\n ],\n h3: [\"h3\", \"scroll-m-20 text-2xl font-semibold tracking-tight\"],\n h4: [\"h4\", \"scroll-m-20 text-xl font-semibold tracking-tight\"],\n p: [\"p\", \"leading-7 [&:not(:first-child)]:mt-6\"],\n blockquote: [\"blockquote\", \"mt-6 border-l-2 pl-6 italic\"],\n code: [\n \"code\",\n \"relative rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold\",\n ],\n lead: [\"p\", \"text-xl text-muted-foreground\"],\n large: [\"div\", \"text-lg font-semibold\"],\n small: [\"small\", \"text-sm font-medium leading-none\"],\n muted: [\"p\", \"text-sm text-muted-foreground\"],\n};\n\nexport const TypographyComponent = (\n props: PiCardProps<TypographyProps>,\n): React.ReactNode => {\n const {\n text,\n childCard,\n paragraph,\n level,\n className,\n style,\n id,\n cardName,\n _dispatch,\n _cls,\n } = props;\n\n const [el, levelClass] = level ? LEVEL_CONFIG[level] : [\"div\", \"\"];\n\n function renderChildren(): React.ReactNode {\n if (childCard) {\n return <Card cardName={childCard} parentCard={cardName} />;\n }\n if (paragraph) {\n return <>{paragraph.map((item, i) => renderParaItem(item, i))}</>;\n }\n return text;\n }\n\n function renderParaItem(\n item: string | TypographyProps,\n key: number,\n ): React.ReactNode {\n if (typeof item === \"string\") {\n return item;\n }\n if (item && typeof item === \"object\") {\n return TypographyComponent({\n ...item,\n _dispatch,\n _cls,\n cardName,\n key,\n } as PiCardProps<TypographyProps> & {key: number});\n }\n return null;\n }\n\n return React.createElement(\n el,\n {\n className: cn(levelClass, className),\n style,\n ...(id ? {id} : {}),\n \"data-pihanga\": cardName,\n },\n renderChildren(),\n );\n};\n"],"mappings":";;;;;AAMA,IAAM,IAGF;CACF,IAAI,CAAC,MAAM,gEAAgE;CAC3E,IAAI,CACF,MACA,4EACF;CACA,IAAI,CAAC,MAAM,mDAAmD;CAC9D,IAAI,CAAC,MAAM,kDAAkD;CAC7D,GAAG,CAAC,KAAK,sCAAsC;CAC/C,YAAY,CAAC,cAAc,6BAA6B;CACxD,MAAM,CACJ,QACA,mFACF;CACA,MAAM,CAAC,KAAK,+BAA+B;CAC3C,OAAO,CAAC,OAAO,uBAAuB;CACtC,OAAO,CAAC,SAAS,kCAAkC;CACnD,OAAO,CAAC,KAAK,+BAA+B;AAC9C,GAEa,KACX,MACoB;CACpB,IAAM,EACJ,SACA,cACA,cACA,UACA,cACA,UACA,OACA,aACA,cACA,YACE,GAEE,CAAC,GAAI,KAAc,IAAQ,EAAa,KAAS,CAAC,OAAO,EAAE;CAEjE,SAAS,IAAkC;EAOzC,OANI,IACK,kBAAC,GAAD;GAAM,UAAU;GAAW,YAAY;EAAW,CAAA,IAEvD,IACK,kBAAA,GAAA,EAAA,UAAG,EAAU,KAAK,GAAM,MAAM,EAAe,GAAM,CAAC,CAAC,EAAI,CAAA,IAE3D;CACT;CAEA,SAAS,EACP,GACA,GACiB;EAajB,OAZI,OAAO,KAAS,WACX,IAEL,KAAQ,OAAO,KAAS,WACnB,EAAoB;GACzB,GAAG;GACH;GACA;GACA;GACA;EACF,CAAiD,IAE5C;CACT;CAEA,OAAO,EAAM,cACX,GACA;EACE,WAAW,EAAG,GAAY,CAAS;EACnC;EACA,GAAI,IAAK,EAAC,MAAE,IAAI,CAAC;EACjB,gBAAgB;CAClB,GACA,EAAe,CACjB;AACF"}
|
|
@@ -16,6 +16,8 @@ export type TypographyProps = {
|
|
|
16
16
|
paragraph?: (string | TypographyProps)[];
|
|
17
17
|
/** Semantic level — controls the HTML element and default prose styling. */
|
|
18
18
|
level?: TypographyLevel;
|
|
19
|
+
/** HTML `id` attribute — enables `<a href="#id">` anchor scrolling. */
|
|
20
|
+
id?: string;
|
|
19
21
|
/** Additional CSS classes applied directly to the element. */
|
|
20
22
|
className?: string;
|
|
21
23
|
/** Inline styles applied directly to the element. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typography.types.js","names":[],"sources":["../../../src/cards/typography/typography.types.ts"],"sourcesContent":["import * as React from \"react\";\nimport {type PiCardRef, createCardDeclaration} from \"@pihanga2/core\";\n\nexport const TYPOGRAPHY_CARD = \"shad/typography\";\n\nexport const Typography =\n createCardDeclaration<TypographyProps>(TYPOGRAPHY_CARD);\n\n/**\n * Semantic level controls both the rendered HTML element and default\n * Tailwind prose styling (following shadcn/ui typography conventions).\n */\nexport type TypographyLevel =\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"p\"\n | \"blockquote\"\n | \"code\"\n | \"lead\" // large muted intro paragraph\n | \"large\" // large text, semibold\n | \"small\" // small, medium-weight\n | \"muted\"; // small, muted-foreground\n\nexport type TypographyProps = {\n /** Plain text content. */\n text?: string;\n /** A child card rendered as content. */\n childCard?: PiCardRef;\n /** Inline paragraph: mix of literal strings and nested TypographyProps. */\n paragraph?: (string | TypographyProps)[];\n\n /** Semantic level — controls the HTML element and default prose styling. */\n level?: TypographyLevel;\n\n /** Additional CSS classes applied directly to the element. */\n className?: string;\n /** Inline styles applied directly to the element. */\n style?: React.CSSProperties;\n};\n"],"mappings":";;;AAGA,IAAa,IAAkB,mBAElB,IACX,EAAuC,CAAe"}
|
|
1
|
+
{"version":3,"file":"typography.types.js","names":[],"sources":["../../../src/cards/typography/typography.types.ts"],"sourcesContent":["import * as React from \"react\";\nimport {type PiCardRef, createCardDeclaration} from \"@pihanga2/core\";\n\nexport const TYPOGRAPHY_CARD = \"shad/typography\";\n\nexport const Typography =\n createCardDeclaration<TypographyProps>(TYPOGRAPHY_CARD);\n\n/**\n * Semantic level controls both the rendered HTML element and default\n * Tailwind prose styling (following shadcn/ui typography conventions).\n */\nexport type TypographyLevel =\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"p\"\n | \"blockquote\"\n | \"code\"\n | \"lead\" // large muted intro paragraph\n | \"large\" // large text, semibold\n | \"small\" // small, medium-weight\n | \"muted\"; // small, muted-foreground\n\nexport type TypographyProps = {\n /** Plain text content. */\n text?: string;\n /** A child card rendered as content. */\n childCard?: PiCardRef;\n /** Inline paragraph: mix of literal strings and nested TypographyProps. */\n paragraph?: (string | TypographyProps)[];\n\n /** Semantic level — controls the HTML element and default prose styling. */\n level?: TypographyLevel;\n\n /** HTML `id` attribute — enables `<a href=\"#id\">` anchor scrolling. */\n id?: string;\n /** Additional CSS classes applied directly to the element. */\n className?: string;\n /** Inline styles applied directly to the element. */\n style?: React.CSSProperties;\n};\n"],"mappings":";;;AAGA,IAAa,IAAkB,mBAElB,IACX,EAAuC,CAAe"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pihanga2/shadcn",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.17",
|
|
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": {
|
|
@@ -84,6 +84,10 @@
|
|
|
84
84
|
"import": "./cards/jsonViewer/index.js",
|
|
85
85
|
"types": "./cards/jsonViewer/index.d.ts"
|
|
86
86
|
},
|
|
87
|
+
"./cards/keyboardOverlay": {
|
|
88
|
+
"import": "./cards/keyboardOverlay/index.js",
|
|
89
|
+
"types": "./cards/keyboardOverlay/index.d.ts"
|
|
90
|
+
},
|
|
87
91
|
"./cards/list": {
|
|
88
92
|
"import": "./cards/list/index.js",
|
|
89
93
|
"types": "./cards/list/index.d.ts"
|
|
@@ -152,6 +156,10 @@
|
|
|
152
156
|
"import": "./cards/stepper/index.js",
|
|
153
157
|
"types": "./cards/stepper/index.d.ts"
|
|
154
158
|
},
|
|
159
|
+
"./cards/suspense": {
|
|
160
|
+
"import": "./cards/suspense/index.js",
|
|
161
|
+
"types": "./cards/suspense/index.d.ts"
|
|
162
|
+
},
|
|
155
163
|
"./cards/switch": {
|
|
156
164
|
"import": "./cards/switch/index.js",
|
|
157
165
|
"types": "./cards/switch/index.d.ts"
|
|
@@ -218,6 +226,7 @@
|
|
|
218
226
|
"./cards/infoCard/index.js",
|
|
219
227
|
"./cards/input/index.js",
|
|
220
228
|
"./cards/jsonViewer/index.js",
|
|
229
|
+
"./cards/keyboardOverlay/index.js",
|
|
221
230
|
"./cards/list/index.js",
|
|
222
231
|
"./cards/loadingOverlay/index.js",
|
|
223
232
|
"./cards/loadingSkeleton/index.js",
|
|
@@ -235,6 +244,7 @@
|
|
|
235
244
|
"./cards/sliderValue/index.js",
|
|
236
245
|
"./cards/stack/index.js",
|
|
237
246
|
"./cards/stepper/index.js",
|
|
247
|
+
"./cards/suspense/index.js",
|
|
238
248
|
"./cards/switch/index.js",
|
|
239
249
|
"./cards/tabs/index.js",
|
|
240
250
|
"./cards/textField/index.js",
|
|
@@ -260,7 +270,7 @@
|
|
|
260
270
|
"peerDependencies": {
|
|
261
271
|
"react": "^19.1.0",
|
|
262
272
|
"react-dom": "^19.1.0",
|
|
263
|
-
"@pihanga2/core": "^0.3.
|
|
273
|
+
"@pihanga2/core": "^0.3.34",
|
|
264
274
|
"@pihanga2/cards": "*"
|
|
265
275
|
},
|
|
266
276
|
"dependencies": {
|