@vibeflui/shadcn 1.0.0
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/LICENSE +21 -0
- package/README.md +16 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/renderers.d.ts +12 -0
- package/dist/renderers.d.ts.map +1 -0
- package/dist/renderers.js +30 -0
- package/package.json +67 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 VibeFlui contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# @vibeflui/shadcn
|
|
2
|
+
|
|
3
|
+
Shadcn theme and adapter plugin foundation for VibeFlui / FluiKit.
|
|
4
|
+
|
|
5
|
+
The foundation includes dark-aware status badges and switch fallback renderers while keeping full Shadcn component replacement in userland.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { FluiKit, FluiKitProvider } from "@vibeflui/core"
|
|
9
|
+
import { shadcnPlugin } from "@vibeflui/shadcn"
|
|
10
|
+
|
|
11
|
+
<FluiKitProvider plugins={[shadcnPlugin]}>
|
|
12
|
+
<FluiKit schema={schema} />
|
|
13
|
+
</FluiKitProvider>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Use `theme.preset: "shadcn"` or `adapter: "shadcn"` in schema. Component-level Shadcn renderer replacement can be passed through `createShadcnPlugin({ renderers, components })`.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FluiKitPlugin, FluiKitRuntimeRegistry } from "@vibeflui/core";
|
|
2
|
+
export { ShadcnStatusBadge, ShadcnSwitch } from "./renderers.js";
|
|
3
|
+
export type CreateShadcnPluginOptions = {
|
|
4
|
+
name?: string;
|
|
5
|
+
version?: string;
|
|
6
|
+
renderers?: FluiKitRuntimeRegistry["renderers"];
|
|
7
|
+
components?: FluiKitRuntimeRegistry["components"];
|
|
8
|
+
fieldAdapters?: FluiKitRuntimeRegistry["fieldAdapters"];
|
|
9
|
+
messages?: Record<string, string>;
|
|
10
|
+
};
|
|
11
|
+
export declare function createShadcnPlugin(options?: CreateShadcnPluginOptions): FluiKitPlugin;
|
|
12
|
+
export declare const shadcnPlugin: FluiKitPlugin;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAG3E,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAEhE,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,sBAAsB,CAAC,WAAW,CAAC,CAAA;IAC/C,UAAU,CAAC,EAAE,sBAAsB,CAAC,YAAY,CAAC,CAAA;IACjD,aAAa,CAAC,EAAE,sBAAsB,CAAC,eAAe,CAAC,CAAA;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAClC,CAAA;AAED,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,yBAA8B,GAAG,aAAa,CA8BzF;AAED,eAAO,MAAM,YAAY,eAAuB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createFluiKitPlugin, fluiKitAdapterPresets, fluiKitThemePresets } from "@vibeflui/core";
|
|
2
|
+
import { ShadcnStatusBadge, ShadcnSwitch } from "./renderers.js";
|
|
3
|
+
export { ShadcnStatusBadge, ShadcnSwitch } from "./renderers.js";
|
|
4
|
+
export function createShadcnPlugin(options = {}) {
|
|
5
|
+
return createFluiKitPlugin({
|
|
6
|
+
name: options.name ?? "@vibeflui/shadcn",
|
|
7
|
+
version: options.version ?? "1.0.0",
|
|
8
|
+
packageName: "@vibeflui/shadcn",
|
|
9
|
+
description: "Shadcn-compatible theme preset, renderers, and adapter metadata for FluiKit.",
|
|
10
|
+
compatibility: {
|
|
11
|
+
core: ">=1.0.0"
|
|
12
|
+
},
|
|
13
|
+
themes: {
|
|
14
|
+
shadcn: fluiKitThemePresets.shadcn
|
|
15
|
+
},
|
|
16
|
+
adapters: {
|
|
17
|
+
shadcn: fluiKitAdapterPresets.shadcn
|
|
18
|
+
},
|
|
19
|
+
renderers: {
|
|
20
|
+
StatusBadge: ShadcnStatusBadge,
|
|
21
|
+
...options.renderers
|
|
22
|
+
},
|
|
23
|
+
components: options.components,
|
|
24
|
+
fieldAdapters: {
|
|
25
|
+
Switch: ShadcnSwitch,
|
|
26
|
+
...options.fieldAdapters
|
|
27
|
+
},
|
|
28
|
+
messages: {
|
|
29
|
+
loadError: "Unable to load Shadcn data.",
|
|
30
|
+
submitError: "Unable to submit the Shadcn form.",
|
|
31
|
+
...options.messages
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export const shadcnPlugin = createShadcnPlugin();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FluiKitRuntimeComponentProps } from "@vibeflui/core";
|
|
2
|
+
/**
|
|
3
|
+
* Shadcn-styled status badge. Use as a table cell or dashboard renderer:
|
|
4
|
+
* `{ key: "status", type: "custom", renderer: "StatusBadge" }`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function ShadcnStatusBadge({ value }: FluiKitRuntimeComponentProps): import("react").JSX.Element;
|
|
7
|
+
/**
|
|
8
|
+
* Shadcn-styled sliding toggle. Register as a field adapter and reference with
|
|
9
|
+
* `{ name: "active", type: "switch", adapter: "Switch" }`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function ShadcnSwitch({ value, onChange, field }: FluiKitRuntimeComponentProps): import("react").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=renderers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderers.d.ts","sourceRoot":"","sources":["../src/renderers.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAqB,MAAM,gBAAgB,CAAA;AAUrF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,KAAK,EAAE,EAAE,4BAA4B,+BAaxE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,4BAA4B,+BAoBpF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { resolveStatusTone } from "@vibeflui/core";
|
|
3
|
+
const toneClassName = {
|
|
4
|
+
success: "bg-emerald-50 text-emerald-700 ring-emerald-600/20 dark:bg-emerald-500/15 dark:text-emerald-300 dark:ring-emerald-400/20",
|
|
5
|
+
warning: "bg-amber-50 text-amber-700 ring-amber-600/20 dark:bg-amber-500/15 dark:text-amber-300 dark:ring-amber-400/20",
|
|
6
|
+
danger: "bg-red-50 text-red-700 ring-red-600/20 dark:bg-red-500/15 dark:text-red-300 dark:ring-red-400/20",
|
|
7
|
+
info: "bg-blue-50 text-blue-700 ring-blue-600/20 dark:bg-blue-500/15 dark:text-blue-300 dark:ring-blue-400/20",
|
|
8
|
+
neutral: "bg-gray-100 text-gray-700 ring-gray-500/20 dark:bg-gray-800 dark:text-gray-300 dark:ring-gray-500/30"
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Shadcn-styled status badge. Use as a table cell or dashboard renderer:
|
|
12
|
+
* `{ key: "status", type: "custom", renderer: "StatusBadge" }`.
|
|
13
|
+
*/
|
|
14
|
+
export function ShadcnStatusBadge({ value }) {
|
|
15
|
+
if (value === undefined || value === null || value === "") {
|
|
16
|
+
return _jsx("span", { className: "text-gray-400 dark:text-gray-500", children: "-" });
|
|
17
|
+
}
|
|
18
|
+
const label = typeof value === "boolean" ? (value ? "Yes" : "No") : String(value);
|
|
19
|
+
const tone = resolveStatusTone(value);
|
|
20
|
+
return (_jsx("span", { className: `inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium capitalize ring-1 ring-inset ${toneClassName[tone]}`, children: label }));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Shadcn-styled sliding toggle. Register as a field adapter and reference with
|
|
24
|
+
* `{ name: "active", type: "switch", adapter: "Switch" }`.
|
|
25
|
+
*/
|
|
26
|
+
export function ShadcnSwitch({ value, onChange, field }) {
|
|
27
|
+
const checked = Boolean(value);
|
|
28
|
+
const disabled = field?.disabled;
|
|
29
|
+
return (_jsx("button", { type: "button", role: "switch", "aria-checked": checked, disabled: disabled, onClick: () => onChange?.(!checked), className: `relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${checked ? "bg-blue-600" : "bg-gray-200 dark:bg-gray-700"}`, children: _jsx("span", { className: `inline-block h-5 w-5 transform rounded-full bg-white shadow transition-transform ${checked ? "translate-x-5" : "translate-x-0.5"}` }) }));
|
|
30
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vibeflui/shadcn",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Shadcn theme and adapter plugin for VibeFlui / FluiKit.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "heloconia",
|
|
8
|
+
"url": "https://github.com/heloconia"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/heloconia/vibeflui#readme",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/heloconia/vibeflui.git",
|
|
14
|
+
"directory": "packages/shadcn"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/heloconia/vibeflui/issues"
|
|
18
|
+
},
|
|
19
|
+
"funding": [
|
|
20
|
+
{ "type": "ko-fi", "url": "https://ko-fi.com/heloconia" },
|
|
21
|
+
{ "type": "trakteer", "url": "https://trakteer.id/heloconia" },
|
|
22
|
+
{ "type": "saweria", "url": "https://saweria.co/heloconia" }
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"main": "./dist/index.js",
|
|
27
|
+
"module": "./dist/index.js",
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"import": "./dist/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=18.18.0"
|
|
40
|
+
},
|
|
41
|
+
"files": [
|
|
42
|
+
"dist",
|
|
43
|
+
"README.md"
|
|
44
|
+
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "tsc -p tsconfig.json",
|
|
47
|
+
"prepack": "test -f ../core/dist/index.d.ts || npm --prefix ../core run build && npm run build",
|
|
48
|
+
"typecheck": "tsc -p tsconfig.local.json --noEmit"
|
|
49
|
+
},
|
|
50
|
+
"keywords": [
|
|
51
|
+
"vibeflui",
|
|
52
|
+
"fluikit",
|
|
53
|
+
"form generator",
|
|
54
|
+
"table list generator",
|
|
55
|
+
"ui generator",
|
|
56
|
+
"json to ui",
|
|
57
|
+
"shadcn",
|
|
58
|
+
"tailwind",
|
|
59
|
+
"schema-driven"
|
|
60
|
+
],
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"@vibeflui/core": ">=1.0.0"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"typescript": "^5.4.5"
|
|
66
|
+
}
|
|
67
|
+
}
|