@radish-ui/core 0.1.0-prerelease.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 saebyn
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,72 @@
1
+ # @radish-ui/core
2
+
3
+ [![npm](https://img.shields.io/npm/v/%40radish-ui%2Fcore?label=%40radish-ui%2Fcore)](https://www.npmjs.com/package/@radish-ui/core)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/saebyn/radish-ui/blob/main/LICENSE)
5
+
6
+ Headless [react-admin](https://marmelab.com/react-admin/) wrappers and Tailwind CSS utilities for [radish-ui](https://github.com/saebyn/radish-ui).
7
+
8
+ > [!WARNING]
9
+ > **Early development — not production-ready.**
10
+ > The API may change rapidly without notice and is not yet stable.
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ pnpm add @radish-ui/core ra-core react react-dom tailwindcss
16
+ # or
17
+ npm install @radish-ui/core ra-core react react-dom tailwindcss
18
+ ```
19
+
20
+ ## What's included
21
+
22
+ ### `cn()` utility
23
+
24
+ A `clsx` + `tailwind-merge` helper for conditionally joining Tailwind class names without conflicts:
25
+
26
+ ```ts
27
+ import { cn } from "@radish-ui/core";
28
+
29
+ <div className={cn("px-4 py-2", isActive && "bg-primary-500", className)} />
30
+ ```
31
+
32
+ ### Admin, ListBase, and ra-core wrappers
33
+
34
+ Thin wrappers around `ra-core` primitives so you can import everything from one package:
35
+
36
+ ```ts
37
+ import { Admin, ListBase, EditBase, CreateBase, ShowBase } from "@radish-ui/core";
38
+ import { useFieldValue } from "@radish-ui/core";
39
+ ```
40
+
41
+ ### Tailwind CSS preset (`@radish-ui/core/preset`)
42
+
43
+ A Tailwind preset that registers semantic color tokens. Registry components use these tokens so you can retheme everything by overriding one value in your config.
44
+
45
+ | Token | Default palette | Purpose |
46
+ | --------- | --------------- | --------------------------------------- |
47
+ | `primary` | indigo | Brand / interactive color |
48
+ | `neutral` | gray | Borders, dividers, muted text |
49
+ | `danger` | red | Destructive actions and error states |
50
+ | `success` | green | Positive states and confirmations |
51
+ | `info` | blue | Informational states |
52
+ | `warning` | yellow | Warning states |
53
+ | `canvas` | gray + white | Surface backgrounds (page, card, input) |
54
+
55
+ ```ts
56
+ // tailwind.config.ts
57
+ import radishPreset from "@radish-ui/core/preset";
58
+ import colors from "tailwindcss/colors";
59
+
60
+ export default {
61
+ presets: [radishPreset],
62
+ content: ["./index.html", "./src/**/*.{ts,tsx}"],
63
+ // Override the primary brand color for your project:
64
+ theme: { extend: { colors: { primary: colors.violet } } },
65
+ };
66
+ ```
67
+
68
+ ## Learn more
69
+
70
+ - [radish-ui on GitHub](https://github.com/saebyn/radish-ui)
71
+ - [Documentation](https://saebyn.github.io/radish-ui/)
72
+ - [react-admin / ra-core](https://marmelab.com/react-admin/)
package/dist/index.cjs ADDED
@@ -0,0 +1,143 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ Admin: () => Admin,
24
+ CreateBase: () => import_ra_core4.CreateBase,
25
+ EditBase: () => import_ra_core4.EditBase,
26
+ ListBase: () => import_ra_core2.ListBase,
27
+ RecordContextProvider: () => import_ra_core4.RecordContextProvider,
28
+ ResourceContextProvider: () => import_ra_core4.ResourceContextProvider,
29
+ ShowBase: () => import_ra_core4.ShowBase,
30
+ cn: () => cn,
31
+ radishMessages: () => radishMessages,
32
+ useFieldValue: () => useFieldValue
33
+ });
34
+ module.exports = __toCommonJS(index_exports);
35
+
36
+ // src/admin.tsx
37
+ var import_ra_core = require("ra-core");
38
+ var import_jsx_runtime = require("react/jsx-runtime");
39
+ function Admin({
40
+ // CoreAdminContext props
41
+ dataProvider,
42
+ authProvider,
43
+ i18nProvider,
44
+ store,
45
+ queryClient,
46
+ basename,
47
+ // CoreAdminUI props
48
+ layout,
49
+ dashboard,
50
+ catchAll,
51
+ loading,
52
+ requireAuth,
53
+ ready,
54
+ title,
55
+ // children (Resources)
56
+ children
57
+ }) {
58
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
59
+ import_ra_core.CoreAdminContext,
60
+ {
61
+ dataProvider,
62
+ authProvider,
63
+ i18nProvider,
64
+ store,
65
+ queryClient,
66
+ basename,
67
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
68
+ import_ra_core.CoreAdminUI,
69
+ {
70
+ layout,
71
+ dashboard,
72
+ catchAll,
73
+ loading,
74
+ requireAuth,
75
+ ready,
76
+ title,
77
+ children
78
+ }
79
+ )
80
+ }
81
+ );
82
+ }
83
+
84
+ // src/list.tsx
85
+ var import_ra_core2 = require("ra-core");
86
+
87
+ // src/hooks/use-field-value.ts
88
+ var import_ra_core3 = require("ra-core");
89
+ function useFieldValue({ source }) {
90
+ const record = (0, import_ra_core3.useRecordContext)();
91
+ if (!record) return void 0;
92
+ return getByPath(record, source);
93
+ }
94
+ function getByPath(obj, path) {
95
+ return path.split(".").reduce((current, key) => {
96
+ if (current === null || current === void 0) return void 0;
97
+ return current[key];
98
+ }, obj);
99
+ }
100
+
101
+ // src/utils/cn.ts
102
+ var import_clsx = require("clsx");
103
+ var import_tailwind_merge = require("tailwind-merge");
104
+ function cn(...inputs) {
105
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
106
+ }
107
+
108
+ // src/i18n.ts
109
+ var radishMessages = {
110
+ radish: {
111
+ action: {
112
+ /** Label shown on a delete button while the deletion is in progress. */
113
+ deleting: "Deleting\u2026"
114
+ },
115
+ message: {
116
+ /** Confirm dialog title shown by <DeleteButton>. */
117
+ delete_confirm_title: "Are you sure you want to delete this record?"
118
+ },
119
+ notification: {
120
+ /** aria-label for the dismiss button inside each toast. */
121
+ dismiss: "Dismiss notification",
122
+ /** aria-label for the notifications container. */
123
+ label: "Notifications"
124
+ }
125
+ }
126
+ };
127
+
128
+ // src/index.ts
129
+ var import_ra_core4 = require("ra-core");
130
+ // Annotate the CommonJS export names for ESM import in node:
131
+ 0 && (module.exports = {
132
+ Admin,
133
+ CreateBase,
134
+ EditBase,
135
+ ListBase,
136
+ RecordContextProvider,
137
+ ResourceContextProvider,
138
+ ShowBase,
139
+ cn,
140
+ radishMessages,
141
+ useFieldValue
142
+ });
143
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/admin.tsx","../src/list.tsx","../src/hooks/use-field-value.ts","../src/utils/cn.ts","../src/i18n.ts"],"sourcesContent":["// Admin wrapper\nexport { Admin } from \"./admin\";\nexport type { AdminProps } from \"./admin\";\n\n// List\nexport { ListBase } from \"./list\";\nexport type { ListBaseProps } from \"./list\";\n\n// Hooks\nexport { useFieldValue } from \"./hooks\";\n\n// Utilities\nexport { cn } from \"./utils/cn\";\n\n// i18n\nexport { radishMessages } from \"./i18n\";\nexport type { RadishMessages } from \"./i18n\";\n\n// Re-exports from ra-core for convenient single-package imports\nexport {\n EditBase,\n CreateBase,\n ShowBase,\n ResourceContextProvider,\n RecordContextProvider,\n} from \"ra-core\";\n","import React from \"react\";\nimport {\n CoreAdminContext,\n CoreAdminUI,\n type CoreAdminContextProps,\n type CoreAdminUIProps,\n} from \"ra-core\";\n\nexport type AdminProps = CoreAdminContextProps &\n Omit<CoreAdminUIProps, \"children\"> & {\n children?: React.ReactNode;\n };\n\n/**\n * Root Admin component that wires up ra-core's CoreAdminContext and CoreAdminUI.\n * Drop-in replacement for react-admin's <Admin> without any Material UI dependency.\n *\n * @example\n * <Admin dataProvider={dataProvider} layout={Layout}>\n * <Resource name=\"posts\" list={PostList} />\n * </Admin>\n */\nexport function Admin({\n // CoreAdminContext props\n dataProvider,\n authProvider,\n i18nProvider,\n store,\n queryClient,\n basename,\n // CoreAdminUI props\n layout,\n dashboard,\n catchAll,\n loading,\n requireAuth,\n ready,\n title,\n // children (Resources)\n children,\n}: AdminProps) {\n return (\n <CoreAdminContext\n dataProvider={dataProvider}\n authProvider={authProvider}\n i18nProvider={i18nProvider}\n store={store}\n queryClient={queryClient}\n basename={basename}\n >\n <CoreAdminUI\n layout={layout}\n dashboard={dashboard}\n catchAll={catchAll}\n loading={loading}\n requireAuth={requireAuth}\n ready={ready}\n title={title}\n >\n {children}\n </CoreAdminUI>\n </CoreAdminContext>\n );\n}\n","export { ListBase } from \"ra-core\";\nexport type { ListBaseProps } from \"ra-core\";\n","import { useRecordContext } from \"ra-core\";\n\n/**\n * Resolves a value from the current record context using a dot-notation path.\n *\n * @param options.source - The field path, e.g. \"title\" or \"author.name\"\n * @returns The resolved value, or undefined if not found\n *\n * @example\n * const title = useFieldValue({ source: \"title\" });\n * const authorName = useFieldValue({ source: \"author.name\" });\n */\nexport function useFieldValue({ source }: { source: string }) {\n const record = useRecordContext();\n if (!record) return undefined;\n return getByPath(record, source);\n}\n\n/**\n * Simple dot-notation path resolver.\n * Handles paths like \"author.name\" or \"meta.tags.0\".\n */\nfunction getByPath(obj: Record<string, unknown>, path: string): unknown {\n return path.split(\".\").reduce<unknown>((current, key) => {\n if (current === null || current === undefined) return undefined;\n return (current as Record<string, unknown>)[key];\n }, obj);\n}\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge Tailwind CSS classes without style conflicts.\n * Uses clsx for conditional classes and tailwind-merge to resolve conflicts.\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","/**\n * The shape of the `radish.*` translation namespace.\n *\n * Use this type when building a translated bundle for a language other than\n * English so TypeScript can catch missing or misspelled keys:\n *\n * @example\n * import type { RadishMessages } from \"@radish-ui/core\";\n *\n * const frenchRadishMessages: RadishMessages = {\n * radish: {\n * action: { deleting: \"Suppression…\" },\n * message: { delete_confirm_title: \"Êtes-vous sûr de vouloir supprimer cet enregistrement ?\" },\n * notification: { dismiss: \"Fermer la notification\", label: \"Notifications\" },\n * },\n * };\n */\nexport interface RadishMessages {\n radish: {\n action: {\n /** Label shown on a delete button while the deletion is in progress. */\n deleting: string;\n };\n message: {\n /** Confirm dialog title shown by <DeleteButton>. */\n delete_confirm_title: string;\n };\n notification: {\n /** aria-label for the dismiss button inside each toast. */\n dismiss: string;\n /** aria-label for the notifications container. */\n label: string;\n };\n };\n}\n\n/**\n * Default English message bundle for the `radish.*` i18n namespace.\n *\n * These keys have no direct equivalent in `ra-language-english` and are\n * specific to radish-ui components. Merge this object into your i18n\n * provider messages so that these strings are translatable.\n *\n * @example\n * import polyglotI18nProvider from \"ra-i18n-polyglot\";\n * import englishMessages from \"ra-language-english\";\n * import { radishMessages } from \"@radish-ui/core\";\n *\n * const i18nProvider = polyglotI18nProvider(\n * () => ({ ...englishMessages, ...radishMessages }),\n * \"en\",\n * );\n */\nexport const radishMessages: RadishMessages = {\n radish: {\n action: {\n /** Label shown on a delete button while the deletion is in progress. */\n deleting: \"Deleting…\",\n },\n message: {\n /** Confirm dialog title shown by <DeleteButton>. */\n delete_confirm_title: \"Are you sure you want to delete this record?\",\n },\n notification: {\n /** aria-label for the dismiss button inside each toast. */\n dismiss: \"Dismiss notification\",\n /** aria-label for the notifications container. */\n label: \"Notifications\",\n },\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,qBAKO;AA4CD;AA5BC,SAAS,MAAM;AAAA;AAAA,EAEpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AACF,GAAe;AACb,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UAEC;AAAA;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;;;AC/DA,IAAAA,kBAAyB;;;ACAzB,IAAAC,kBAAiC;AAY1B,SAAS,cAAc,EAAE,OAAO,GAAuB;AAC5D,QAAM,aAAS,kCAAiB;AAChC,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,UAAU,QAAQ,MAAM;AACjC;AAMA,SAAS,UAAU,KAA8B,MAAuB;AACtE,SAAO,KAAK,MAAM,GAAG,EAAE,OAAgB,CAAC,SAAS,QAAQ;AACvD,QAAI,YAAY,QAAQ,YAAY,OAAW,QAAO;AACtD,WAAQ,QAAoC,GAAG;AAAA,EACjD,GAAG,GAAG;AACR;;;AC3BA,kBAAsC;AACtC,4BAAwB;AAMjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;AC4CO,IAAM,iBAAiC;AAAA,EAC5C,QAAQ;AAAA,IACN,QAAQ;AAAA;AAAA,MAEN,UAAU;AAAA,IACZ;AAAA,IACA,SAAS;AAAA;AAAA,MAEP,sBAAsB;AAAA,IACxB;AAAA,IACA,cAAc;AAAA;AAAA,MAEZ,SAAS;AAAA;AAAA,MAET,OAAO;AAAA,IACT;AAAA,EACF;AACF;;;ALnDA,IAAAC,kBAMO;","names":["import_ra_core","import_ra_core","import_ra_core"]}
@@ -0,0 +1,95 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React from 'react';
3
+ import { CoreAdminContextProps, CoreAdminUIProps } from 'ra-core';
4
+ export { CreateBase, EditBase, ListBase, ListBaseProps, RecordContextProvider, ResourceContextProvider, ShowBase } from 'ra-core';
5
+ import { ClassValue } from 'clsx';
6
+
7
+ type AdminProps = CoreAdminContextProps & Omit<CoreAdminUIProps, "children"> & {
8
+ children?: React.ReactNode;
9
+ };
10
+ /**
11
+ * Root Admin component that wires up ra-core's CoreAdminContext and CoreAdminUI.
12
+ * Drop-in replacement for react-admin's <Admin> without any Material UI dependency.
13
+ *
14
+ * @example
15
+ * <Admin dataProvider={dataProvider} layout={Layout}>
16
+ * <Resource name="posts" list={PostList} />
17
+ * </Admin>
18
+ */
19
+ declare function Admin({ dataProvider, authProvider, i18nProvider, store, queryClient, basename, layout, dashboard, catchAll, loading, requireAuth, ready, title, children, }: AdminProps): react_jsx_runtime.JSX.Element;
20
+
21
+ /**
22
+ * Resolves a value from the current record context using a dot-notation path.
23
+ *
24
+ * @param options.source - The field path, e.g. "title" or "author.name"
25
+ * @returns The resolved value, or undefined if not found
26
+ *
27
+ * @example
28
+ * const title = useFieldValue({ source: "title" });
29
+ * const authorName = useFieldValue({ source: "author.name" });
30
+ */
31
+ declare function useFieldValue({ source }: {
32
+ source: string;
33
+ }): unknown;
34
+
35
+ /**
36
+ * Merge Tailwind CSS classes without style conflicts.
37
+ * Uses clsx for conditional classes and tailwind-merge to resolve conflicts.
38
+ */
39
+ declare function cn(...inputs: ClassValue[]): string;
40
+
41
+ /**
42
+ * The shape of the `radish.*` translation namespace.
43
+ *
44
+ * Use this type when building a translated bundle for a language other than
45
+ * English so TypeScript can catch missing or misspelled keys:
46
+ *
47
+ * @example
48
+ * import type { RadishMessages } from "@radish-ui/core";
49
+ *
50
+ * const frenchRadishMessages: RadishMessages = {
51
+ * radish: {
52
+ * action: { deleting: "Suppression…" },
53
+ * message: { delete_confirm_title: "Êtes-vous sûr de vouloir supprimer cet enregistrement ?" },
54
+ * notification: { dismiss: "Fermer la notification", label: "Notifications" },
55
+ * },
56
+ * };
57
+ */
58
+ interface RadishMessages {
59
+ radish: {
60
+ action: {
61
+ /** Label shown on a delete button while the deletion is in progress. */
62
+ deleting: string;
63
+ };
64
+ message: {
65
+ /** Confirm dialog title shown by <DeleteButton>. */
66
+ delete_confirm_title: string;
67
+ };
68
+ notification: {
69
+ /** aria-label for the dismiss button inside each toast. */
70
+ dismiss: string;
71
+ /** aria-label for the notifications container. */
72
+ label: string;
73
+ };
74
+ };
75
+ }
76
+ /**
77
+ * Default English message bundle for the `radish.*` i18n namespace.
78
+ *
79
+ * These keys have no direct equivalent in `ra-language-english` and are
80
+ * specific to radish-ui components. Merge this object into your i18n
81
+ * provider messages so that these strings are translatable.
82
+ *
83
+ * @example
84
+ * import polyglotI18nProvider from "ra-i18n-polyglot";
85
+ * import englishMessages from "ra-language-english";
86
+ * import { radishMessages } from "@radish-ui/core";
87
+ *
88
+ * const i18nProvider = polyglotI18nProvider(
89
+ * () => ({ ...englishMessages, ...radishMessages }),
90
+ * "en",
91
+ * );
92
+ */
93
+ declare const radishMessages: RadishMessages;
94
+
95
+ export { Admin, type AdminProps, type RadishMessages, cn, radishMessages, useFieldValue };
@@ -0,0 +1,95 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React from 'react';
3
+ import { CoreAdminContextProps, CoreAdminUIProps } from 'ra-core';
4
+ export { CreateBase, EditBase, ListBase, ListBaseProps, RecordContextProvider, ResourceContextProvider, ShowBase } from 'ra-core';
5
+ import { ClassValue } from 'clsx';
6
+
7
+ type AdminProps = CoreAdminContextProps & Omit<CoreAdminUIProps, "children"> & {
8
+ children?: React.ReactNode;
9
+ };
10
+ /**
11
+ * Root Admin component that wires up ra-core's CoreAdminContext and CoreAdminUI.
12
+ * Drop-in replacement for react-admin's <Admin> without any Material UI dependency.
13
+ *
14
+ * @example
15
+ * <Admin dataProvider={dataProvider} layout={Layout}>
16
+ * <Resource name="posts" list={PostList} />
17
+ * </Admin>
18
+ */
19
+ declare function Admin({ dataProvider, authProvider, i18nProvider, store, queryClient, basename, layout, dashboard, catchAll, loading, requireAuth, ready, title, children, }: AdminProps): react_jsx_runtime.JSX.Element;
20
+
21
+ /**
22
+ * Resolves a value from the current record context using a dot-notation path.
23
+ *
24
+ * @param options.source - The field path, e.g. "title" or "author.name"
25
+ * @returns The resolved value, or undefined if not found
26
+ *
27
+ * @example
28
+ * const title = useFieldValue({ source: "title" });
29
+ * const authorName = useFieldValue({ source: "author.name" });
30
+ */
31
+ declare function useFieldValue({ source }: {
32
+ source: string;
33
+ }): unknown;
34
+
35
+ /**
36
+ * Merge Tailwind CSS classes without style conflicts.
37
+ * Uses clsx for conditional classes and tailwind-merge to resolve conflicts.
38
+ */
39
+ declare function cn(...inputs: ClassValue[]): string;
40
+
41
+ /**
42
+ * The shape of the `radish.*` translation namespace.
43
+ *
44
+ * Use this type when building a translated bundle for a language other than
45
+ * English so TypeScript can catch missing or misspelled keys:
46
+ *
47
+ * @example
48
+ * import type { RadishMessages } from "@radish-ui/core";
49
+ *
50
+ * const frenchRadishMessages: RadishMessages = {
51
+ * radish: {
52
+ * action: { deleting: "Suppression…" },
53
+ * message: { delete_confirm_title: "Êtes-vous sûr de vouloir supprimer cet enregistrement ?" },
54
+ * notification: { dismiss: "Fermer la notification", label: "Notifications" },
55
+ * },
56
+ * };
57
+ */
58
+ interface RadishMessages {
59
+ radish: {
60
+ action: {
61
+ /** Label shown on a delete button while the deletion is in progress. */
62
+ deleting: string;
63
+ };
64
+ message: {
65
+ /** Confirm dialog title shown by <DeleteButton>. */
66
+ delete_confirm_title: string;
67
+ };
68
+ notification: {
69
+ /** aria-label for the dismiss button inside each toast. */
70
+ dismiss: string;
71
+ /** aria-label for the notifications container. */
72
+ label: string;
73
+ };
74
+ };
75
+ }
76
+ /**
77
+ * Default English message bundle for the `radish.*` i18n namespace.
78
+ *
79
+ * These keys have no direct equivalent in `ra-language-english` and are
80
+ * specific to radish-ui components. Merge this object into your i18n
81
+ * provider messages so that these strings are translatable.
82
+ *
83
+ * @example
84
+ * import polyglotI18nProvider from "ra-i18n-polyglot";
85
+ * import englishMessages from "ra-language-english";
86
+ * import { radishMessages } from "@radish-ui/core";
87
+ *
88
+ * const i18nProvider = polyglotI18nProvider(
89
+ * () => ({ ...englishMessages, ...radishMessages }),
90
+ * "en",
91
+ * );
92
+ */
93
+ declare const radishMessages: RadishMessages;
94
+
95
+ export { Admin, type AdminProps, type RadishMessages, cn, radishMessages, useFieldValue };
package/dist/index.js ADDED
@@ -0,0 +1,116 @@
1
+ // src/admin.tsx
2
+ import {
3
+ CoreAdminContext,
4
+ CoreAdminUI
5
+ } from "ra-core";
6
+ import { jsx } from "react/jsx-runtime";
7
+ function Admin({
8
+ // CoreAdminContext props
9
+ dataProvider,
10
+ authProvider,
11
+ i18nProvider,
12
+ store,
13
+ queryClient,
14
+ basename,
15
+ // CoreAdminUI props
16
+ layout,
17
+ dashboard,
18
+ catchAll,
19
+ loading,
20
+ requireAuth,
21
+ ready,
22
+ title,
23
+ // children (Resources)
24
+ children
25
+ }) {
26
+ return /* @__PURE__ */ jsx(
27
+ CoreAdminContext,
28
+ {
29
+ dataProvider,
30
+ authProvider,
31
+ i18nProvider,
32
+ store,
33
+ queryClient,
34
+ basename,
35
+ children: /* @__PURE__ */ jsx(
36
+ CoreAdminUI,
37
+ {
38
+ layout,
39
+ dashboard,
40
+ catchAll,
41
+ loading,
42
+ requireAuth,
43
+ ready,
44
+ title,
45
+ children
46
+ }
47
+ )
48
+ }
49
+ );
50
+ }
51
+
52
+ // src/list.tsx
53
+ import { ListBase } from "ra-core";
54
+
55
+ // src/hooks/use-field-value.ts
56
+ import { useRecordContext } from "ra-core";
57
+ function useFieldValue({ source }) {
58
+ const record = useRecordContext();
59
+ if (!record) return void 0;
60
+ return getByPath(record, source);
61
+ }
62
+ function getByPath(obj, path) {
63
+ return path.split(".").reduce((current, key) => {
64
+ if (current === null || current === void 0) return void 0;
65
+ return current[key];
66
+ }, obj);
67
+ }
68
+
69
+ // src/utils/cn.ts
70
+ import { clsx } from "clsx";
71
+ import { twMerge } from "tailwind-merge";
72
+ function cn(...inputs) {
73
+ return twMerge(clsx(inputs));
74
+ }
75
+
76
+ // src/i18n.ts
77
+ var radishMessages = {
78
+ radish: {
79
+ action: {
80
+ /** Label shown on a delete button while the deletion is in progress. */
81
+ deleting: "Deleting\u2026"
82
+ },
83
+ message: {
84
+ /** Confirm dialog title shown by <DeleteButton>. */
85
+ delete_confirm_title: "Are you sure you want to delete this record?"
86
+ },
87
+ notification: {
88
+ /** aria-label for the dismiss button inside each toast. */
89
+ dismiss: "Dismiss notification",
90
+ /** aria-label for the notifications container. */
91
+ label: "Notifications"
92
+ }
93
+ }
94
+ };
95
+
96
+ // src/index.ts
97
+ import {
98
+ EditBase,
99
+ CreateBase,
100
+ ShowBase,
101
+ ResourceContextProvider,
102
+ RecordContextProvider
103
+ } from "ra-core";
104
+ export {
105
+ Admin,
106
+ CreateBase,
107
+ EditBase,
108
+ ListBase,
109
+ RecordContextProvider,
110
+ ResourceContextProvider,
111
+ ShowBase,
112
+ cn,
113
+ radishMessages,
114
+ useFieldValue
115
+ };
116
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/admin.tsx","../src/list.tsx","../src/hooks/use-field-value.ts","../src/utils/cn.ts","../src/i18n.ts","../src/index.ts"],"sourcesContent":["import React from \"react\";\nimport {\n CoreAdminContext,\n CoreAdminUI,\n type CoreAdminContextProps,\n type CoreAdminUIProps,\n} from \"ra-core\";\n\nexport type AdminProps = CoreAdminContextProps &\n Omit<CoreAdminUIProps, \"children\"> & {\n children?: React.ReactNode;\n };\n\n/**\n * Root Admin component that wires up ra-core's CoreAdminContext and CoreAdminUI.\n * Drop-in replacement for react-admin's <Admin> without any Material UI dependency.\n *\n * @example\n * <Admin dataProvider={dataProvider} layout={Layout}>\n * <Resource name=\"posts\" list={PostList} />\n * </Admin>\n */\nexport function Admin({\n // CoreAdminContext props\n dataProvider,\n authProvider,\n i18nProvider,\n store,\n queryClient,\n basename,\n // CoreAdminUI props\n layout,\n dashboard,\n catchAll,\n loading,\n requireAuth,\n ready,\n title,\n // children (Resources)\n children,\n}: AdminProps) {\n return (\n <CoreAdminContext\n dataProvider={dataProvider}\n authProvider={authProvider}\n i18nProvider={i18nProvider}\n store={store}\n queryClient={queryClient}\n basename={basename}\n >\n <CoreAdminUI\n layout={layout}\n dashboard={dashboard}\n catchAll={catchAll}\n loading={loading}\n requireAuth={requireAuth}\n ready={ready}\n title={title}\n >\n {children}\n </CoreAdminUI>\n </CoreAdminContext>\n );\n}\n","export { ListBase } from \"ra-core\";\nexport type { ListBaseProps } from \"ra-core\";\n","import { useRecordContext } from \"ra-core\";\n\n/**\n * Resolves a value from the current record context using a dot-notation path.\n *\n * @param options.source - The field path, e.g. \"title\" or \"author.name\"\n * @returns The resolved value, or undefined if not found\n *\n * @example\n * const title = useFieldValue({ source: \"title\" });\n * const authorName = useFieldValue({ source: \"author.name\" });\n */\nexport function useFieldValue({ source }: { source: string }) {\n const record = useRecordContext();\n if (!record) return undefined;\n return getByPath(record, source);\n}\n\n/**\n * Simple dot-notation path resolver.\n * Handles paths like \"author.name\" or \"meta.tags.0\".\n */\nfunction getByPath(obj: Record<string, unknown>, path: string): unknown {\n return path.split(\".\").reduce<unknown>((current, key) => {\n if (current === null || current === undefined) return undefined;\n return (current as Record<string, unknown>)[key];\n }, obj);\n}\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge Tailwind CSS classes without style conflicts.\n * Uses clsx for conditional classes and tailwind-merge to resolve conflicts.\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","/**\n * The shape of the `radish.*` translation namespace.\n *\n * Use this type when building a translated bundle for a language other than\n * English so TypeScript can catch missing or misspelled keys:\n *\n * @example\n * import type { RadishMessages } from \"@radish-ui/core\";\n *\n * const frenchRadishMessages: RadishMessages = {\n * radish: {\n * action: { deleting: \"Suppression…\" },\n * message: { delete_confirm_title: \"Êtes-vous sûr de vouloir supprimer cet enregistrement ?\" },\n * notification: { dismiss: \"Fermer la notification\", label: \"Notifications\" },\n * },\n * };\n */\nexport interface RadishMessages {\n radish: {\n action: {\n /** Label shown on a delete button while the deletion is in progress. */\n deleting: string;\n };\n message: {\n /** Confirm dialog title shown by <DeleteButton>. */\n delete_confirm_title: string;\n };\n notification: {\n /** aria-label for the dismiss button inside each toast. */\n dismiss: string;\n /** aria-label for the notifications container. */\n label: string;\n };\n };\n}\n\n/**\n * Default English message bundle for the `radish.*` i18n namespace.\n *\n * These keys have no direct equivalent in `ra-language-english` and are\n * specific to radish-ui components. Merge this object into your i18n\n * provider messages so that these strings are translatable.\n *\n * @example\n * import polyglotI18nProvider from \"ra-i18n-polyglot\";\n * import englishMessages from \"ra-language-english\";\n * import { radishMessages } from \"@radish-ui/core\";\n *\n * const i18nProvider = polyglotI18nProvider(\n * () => ({ ...englishMessages, ...radishMessages }),\n * \"en\",\n * );\n */\nexport const radishMessages: RadishMessages = {\n radish: {\n action: {\n /** Label shown on a delete button while the deletion is in progress. */\n deleting: \"Deleting…\",\n },\n message: {\n /** Confirm dialog title shown by <DeleteButton>. */\n delete_confirm_title: \"Are you sure you want to delete this record?\",\n },\n notification: {\n /** aria-label for the dismiss button inside each toast. */\n dismiss: \"Dismiss notification\",\n /** aria-label for the notifications container. */\n label: \"Notifications\",\n },\n },\n};\n","// Admin wrapper\nexport { Admin } from \"./admin\";\nexport type { AdminProps } from \"./admin\";\n\n// List\nexport { ListBase } from \"./list\";\nexport type { ListBaseProps } from \"./list\";\n\n// Hooks\nexport { useFieldValue } from \"./hooks\";\n\n// Utilities\nexport { cn } from \"./utils/cn\";\n\n// i18n\nexport { radishMessages } from \"./i18n\";\nexport type { RadishMessages } from \"./i18n\";\n\n// Re-exports from ra-core for convenient single-package imports\nexport {\n EditBase,\n CreateBase,\n ShowBase,\n ResourceContextProvider,\n RecordContextProvider,\n} from \"ra-core\";\n"],"mappings":";AACA;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AA4CD;AA5BC,SAAS,MAAM;AAAA;AAAA,EAEpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AACF,GAAe;AACb,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UAEC;AAAA;AAAA,MACH;AAAA;AAAA,EACF;AAEJ;;;AC/DA,SAAS,gBAAgB;;;ACAzB,SAAS,wBAAwB;AAY1B,SAAS,cAAc,EAAE,OAAO,GAAuB;AAC5D,QAAM,SAAS,iBAAiB;AAChC,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,UAAU,QAAQ,MAAM;AACjC;AAMA,SAAS,UAAU,KAA8B,MAAuB;AACtE,SAAO,KAAK,MAAM,GAAG,EAAE,OAAgB,CAAC,SAAS,QAAQ;AACvD,QAAI,YAAY,QAAQ,YAAY,OAAW,QAAO;AACtD,WAAQ,QAAoC,GAAG;AAAA,EACjD,GAAG,GAAG;AACR;;;AC3BA,SAAS,YAA6B;AACtC,SAAS,eAAe;AAMjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;AC4CO,IAAM,iBAAiC;AAAA,EAC5C,QAAQ;AAAA,IACN,QAAQ;AAAA;AAAA,MAEN,UAAU;AAAA,IACZ;AAAA,IACA,SAAS;AAAA;AAAA,MAEP,sBAAsB;AAAA,IACxB;AAAA,IACA,cAAc;AAAA;AAAA,MAEZ,SAAS;AAAA;AAAA,MAET,OAAO;AAAA,IACT;AAAA,EACF;AACF;;;ACnDA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/preset.ts
31
+ var preset_exports = {};
32
+ __export(preset_exports, {
33
+ default: () => preset_default
34
+ });
35
+ module.exports = __toCommonJS(preset_exports);
36
+ var import_colors = __toESM(require("tailwindcss/colors"), 1);
37
+ var preset = {
38
+ darkMode: "class",
39
+ theme: {
40
+ extend: {
41
+ colors: {
42
+ primary: import_colors.default.indigo,
43
+ neutral: import_colors.default.gray,
44
+ danger: import_colors.default.red,
45
+ success: import_colors.default.green,
46
+ info: import_colors.default.blue,
47
+ warning: import_colors.default.yellow,
48
+ canvas: {
49
+ ...import_colors.default.gray,
50
+ // Extend the gray scale with shade 0 = pure white,
51
+ // so bg-canvas-0 can be used for the lightest surface (cards, inputs).
52
+ 0: import_colors.default.white
53
+ }
54
+ }
55
+ }
56
+ }
57
+ };
58
+ var preset_default = preset;
59
+ //# sourceMappingURL=preset.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/preset.ts"],"sourcesContent":["import type { Config } from \"tailwindcss\";\nimport colors from \"tailwindcss/colors\";\n\n/**\n * Radish UI Tailwind CSS preset.\n *\n * Registers semantic design tokens that components use for colors.\n * Override any token in your own tailwind.config.ts to retheme all\n * radish-ui components without touching component code.\n *\n * Color scale tokens (expose the full 50–950 shade range):\n * - `primary` – brand / interactive color (default: indigo)\n * - `neutral` – borders, dividers, and muted text (default: gray)\n * - `danger` – destructive actions and error states (default: red)\n * - `success` – positive states and confirmations (default: green)\n * - `info` – informational states, e.g. info notifications (default: blue)\n * - `warning` – warning states, e.g. warning notifications (default: yellow)\n * - `canvas` – surface backgrounds: page, card, panel, input (default: gray)\n *\n * @example\n * // tailwind.config.ts\n * import radishPreset from \"@radish-ui/core/preset\";\n * import colors from \"tailwindcss/colors\";\n *\n * export default {\n * presets: [radishPreset],\n * content: [\"./index.html\", \"./src/**\\/*.{ts,tsx}\"],\n * // Override the primary brand color:\n * theme: { extend: { colors: { primary: colors.violet } } },\n * };\n */\nconst preset = {\n darkMode: \"class\",\n theme: {\n extend: {\n colors: {\n primary: colors.indigo,\n neutral: colors.gray,\n danger: colors.red,\n success: colors.green,\n info: colors.blue,\n warning: colors.yellow,\n canvas: {\n ...colors.gray,\n // Extend the gray scale with shade 0 = pure white,\n // so bg-canvas-0 can be used for the lightest surface (cards, inputs).\n 0: colors.white,\n },\n },\n },\n },\n} satisfies Partial<Config>;\n\nexport default preset;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAAmB;AA8BnB,IAAM,SAAS;AAAA,EACb,UAAU;AAAA,EACV,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,QAAQ;AAAA,QACN,SAAS,cAAAA,QAAO;AAAA,QAChB,SAAS,cAAAA,QAAO;AAAA,QAChB,QAAQ,cAAAA,QAAO;AAAA,QACf,SAAS,cAAAA,QAAO;AAAA,QAChB,MAAM,cAAAA,QAAO;AAAA,QACb,SAAS,cAAAA,QAAO;AAAA,QAChB,QAAQ;AAAA,UACN,GAAG,cAAAA,QAAO;AAAA;AAAA;AAAA,UAGV,GAAG,cAAAA,QAAO;AAAA,QACZ;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,iBAAQ;","names":["colors"]}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Radish UI Tailwind CSS preset.
3
+ *
4
+ * Registers semantic design tokens that components use for colors.
5
+ * Override any token in your own tailwind.config.ts to retheme all
6
+ * radish-ui components without touching component code.
7
+ *
8
+ * Color scale tokens (expose the full 50–950 shade range):
9
+ * - `primary` – brand / interactive color (default: indigo)
10
+ * - `neutral` – borders, dividers, and muted text (default: gray)
11
+ * - `danger` – destructive actions and error states (default: red)
12
+ * - `success` – positive states and confirmations (default: green)
13
+ * - `info` – informational states, e.g. info notifications (default: blue)
14
+ * - `warning` – warning states, e.g. warning notifications (default: yellow)
15
+ * - `canvas` – surface backgrounds: page, card, panel, input (default: gray)
16
+ *
17
+ * @example
18
+ * // tailwind.config.ts
19
+ * import radishPreset from "@radish-ui/core/preset";
20
+ * import colors from "tailwindcss/colors";
21
+ *
22
+ * export default {
23
+ * presets: [radishPreset],
24
+ * content: ["./index.html", "./src/**\/*.{ts,tsx}"],
25
+ * // Override the primary brand color:
26
+ * theme: { extend: { colors: { primary: colors.violet } } },
27
+ * };
28
+ */
29
+ declare const preset: {
30
+ darkMode: "class";
31
+ theme: {
32
+ extend: {
33
+ colors: {
34
+ primary: {
35
+ '50': "#eef2ff";
36
+ '100': "#e0e7ff";
37
+ '200': "#c7d2fe";
38
+ '300': "#a5b4fc";
39
+ '400': "#818cf8";
40
+ '500': "#6366f1";
41
+ '600': "#4f46e5";
42
+ '700': "#4338ca";
43
+ '800': "#3730a3";
44
+ '900': "#312e81";
45
+ '950': "#1e1b4b";
46
+ };
47
+ neutral: {
48
+ '50': "#f9fafb";
49
+ '100': "#f3f4f6";
50
+ '200': "#e5e7eb";
51
+ '300': "#d1d5db";
52
+ '400': "#9ca3af";
53
+ '500': "#6b7280";
54
+ '600': "#4b5563";
55
+ '700': "#374151";
56
+ '800': "#1f2937";
57
+ '900': "#111827";
58
+ '950': "#030712";
59
+ };
60
+ danger: {
61
+ '50': "#fef2f2";
62
+ '100': "#fee2e2";
63
+ '200': "#fecaca";
64
+ '300': "#fca5a5";
65
+ '400': "#f87171";
66
+ '500': "#ef4444";
67
+ '600': "#dc2626";
68
+ '700': "#b91c1c";
69
+ '800': "#991b1b";
70
+ '900': "#7f1d1d";
71
+ '950': "#450a0a";
72
+ };
73
+ success: {
74
+ '50': "#f0fdf4";
75
+ '100': "#dcfce7";
76
+ '200': "#bbf7d0";
77
+ '300': "#86efac";
78
+ '400': "#4ade80";
79
+ '500': "#22c55e";
80
+ '600': "#16a34a";
81
+ '700': "#15803d";
82
+ '800': "#166534";
83
+ '900': "#14532d";
84
+ '950': "#052e16";
85
+ };
86
+ info: {
87
+ '50': "#eff6ff";
88
+ '100': "#dbeafe";
89
+ '200': "#bfdbfe";
90
+ '300': "#93c5fd";
91
+ '400': "#60a5fa";
92
+ '500': "#3b82f6";
93
+ '600': "#2563eb";
94
+ '700': "#1d4ed8";
95
+ '800': "#1e40af";
96
+ '900': "#1e3a8a";
97
+ '950': "#172554";
98
+ };
99
+ warning: {
100
+ '50': "#fefce8";
101
+ '100': "#fef9c3";
102
+ '200': "#fef08a";
103
+ '300': "#fde047";
104
+ '400': "#facc15";
105
+ '500': "#eab308";
106
+ '600': "#ca8a04";
107
+ '700': "#a16207";
108
+ '800': "#854d0e";
109
+ '900': "#713f12";
110
+ '950': "#422006";
111
+ };
112
+ canvas: {
113
+ 0: "#fff";
114
+ '50': "#f9fafb";
115
+ '100': "#f3f4f6";
116
+ '200': "#e5e7eb";
117
+ '300': "#d1d5db";
118
+ '400': "#9ca3af";
119
+ '500': "#6b7280";
120
+ '600': "#4b5563";
121
+ '700': "#374151";
122
+ '800': "#1f2937";
123
+ '900': "#111827";
124
+ '950': "#030712";
125
+ };
126
+ };
127
+ };
128
+ };
129
+ };
130
+
131
+ export { preset as default };
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Radish UI Tailwind CSS preset.
3
+ *
4
+ * Registers semantic design tokens that components use for colors.
5
+ * Override any token in your own tailwind.config.ts to retheme all
6
+ * radish-ui components without touching component code.
7
+ *
8
+ * Color scale tokens (expose the full 50–950 shade range):
9
+ * - `primary` – brand / interactive color (default: indigo)
10
+ * - `neutral` – borders, dividers, and muted text (default: gray)
11
+ * - `danger` – destructive actions and error states (default: red)
12
+ * - `success` – positive states and confirmations (default: green)
13
+ * - `info` – informational states, e.g. info notifications (default: blue)
14
+ * - `warning` – warning states, e.g. warning notifications (default: yellow)
15
+ * - `canvas` – surface backgrounds: page, card, panel, input (default: gray)
16
+ *
17
+ * @example
18
+ * // tailwind.config.ts
19
+ * import radishPreset from "@radish-ui/core/preset";
20
+ * import colors from "tailwindcss/colors";
21
+ *
22
+ * export default {
23
+ * presets: [radishPreset],
24
+ * content: ["./index.html", "./src/**\/*.{ts,tsx}"],
25
+ * // Override the primary brand color:
26
+ * theme: { extend: { colors: { primary: colors.violet } } },
27
+ * };
28
+ */
29
+ declare const preset: {
30
+ darkMode: "class";
31
+ theme: {
32
+ extend: {
33
+ colors: {
34
+ primary: {
35
+ '50': "#eef2ff";
36
+ '100': "#e0e7ff";
37
+ '200': "#c7d2fe";
38
+ '300': "#a5b4fc";
39
+ '400': "#818cf8";
40
+ '500': "#6366f1";
41
+ '600': "#4f46e5";
42
+ '700': "#4338ca";
43
+ '800': "#3730a3";
44
+ '900': "#312e81";
45
+ '950': "#1e1b4b";
46
+ };
47
+ neutral: {
48
+ '50': "#f9fafb";
49
+ '100': "#f3f4f6";
50
+ '200': "#e5e7eb";
51
+ '300': "#d1d5db";
52
+ '400': "#9ca3af";
53
+ '500': "#6b7280";
54
+ '600': "#4b5563";
55
+ '700': "#374151";
56
+ '800': "#1f2937";
57
+ '900': "#111827";
58
+ '950': "#030712";
59
+ };
60
+ danger: {
61
+ '50': "#fef2f2";
62
+ '100': "#fee2e2";
63
+ '200': "#fecaca";
64
+ '300': "#fca5a5";
65
+ '400': "#f87171";
66
+ '500': "#ef4444";
67
+ '600': "#dc2626";
68
+ '700': "#b91c1c";
69
+ '800': "#991b1b";
70
+ '900': "#7f1d1d";
71
+ '950': "#450a0a";
72
+ };
73
+ success: {
74
+ '50': "#f0fdf4";
75
+ '100': "#dcfce7";
76
+ '200': "#bbf7d0";
77
+ '300': "#86efac";
78
+ '400': "#4ade80";
79
+ '500': "#22c55e";
80
+ '600': "#16a34a";
81
+ '700': "#15803d";
82
+ '800': "#166534";
83
+ '900': "#14532d";
84
+ '950': "#052e16";
85
+ };
86
+ info: {
87
+ '50': "#eff6ff";
88
+ '100': "#dbeafe";
89
+ '200': "#bfdbfe";
90
+ '300': "#93c5fd";
91
+ '400': "#60a5fa";
92
+ '500': "#3b82f6";
93
+ '600': "#2563eb";
94
+ '700': "#1d4ed8";
95
+ '800': "#1e40af";
96
+ '900': "#1e3a8a";
97
+ '950': "#172554";
98
+ };
99
+ warning: {
100
+ '50': "#fefce8";
101
+ '100': "#fef9c3";
102
+ '200': "#fef08a";
103
+ '300': "#fde047";
104
+ '400': "#facc15";
105
+ '500': "#eab308";
106
+ '600': "#ca8a04";
107
+ '700': "#a16207";
108
+ '800': "#854d0e";
109
+ '900': "#713f12";
110
+ '950': "#422006";
111
+ };
112
+ canvas: {
113
+ 0: "#fff";
114
+ '50': "#f9fafb";
115
+ '100': "#f3f4f6";
116
+ '200': "#e5e7eb";
117
+ '300': "#d1d5db";
118
+ '400': "#9ca3af";
119
+ '500': "#6b7280";
120
+ '600': "#4b5563";
121
+ '700': "#374151";
122
+ '800': "#1f2937";
123
+ '900': "#111827";
124
+ '950': "#030712";
125
+ };
126
+ };
127
+ };
128
+ };
129
+ };
130
+
131
+ export { preset as default };
package/dist/preset.js ADDED
@@ -0,0 +1,28 @@
1
+ // src/preset.ts
2
+ import colors from "tailwindcss/colors";
3
+ var preset = {
4
+ darkMode: "class",
5
+ theme: {
6
+ extend: {
7
+ colors: {
8
+ primary: colors.indigo,
9
+ neutral: colors.gray,
10
+ danger: colors.red,
11
+ success: colors.green,
12
+ info: colors.blue,
13
+ warning: colors.yellow,
14
+ canvas: {
15
+ ...colors.gray,
16
+ // Extend the gray scale with shade 0 = pure white,
17
+ // so bg-canvas-0 can be used for the lightest surface (cards, inputs).
18
+ 0: colors.white
19
+ }
20
+ }
21
+ }
22
+ }
23
+ };
24
+ var preset_default = preset;
25
+ export {
26
+ preset_default as default
27
+ };
28
+ //# sourceMappingURL=preset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/preset.ts"],"sourcesContent":["import type { Config } from \"tailwindcss\";\nimport colors from \"tailwindcss/colors\";\n\n/**\n * Radish UI Tailwind CSS preset.\n *\n * Registers semantic design tokens that components use for colors.\n * Override any token in your own tailwind.config.ts to retheme all\n * radish-ui components without touching component code.\n *\n * Color scale tokens (expose the full 50–950 shade range):\n * - `primary` – brand / interactive color (default: indigo)\n * - `neutral` – borders, dividers, and muted text (default: gray)\n * - `danger` – destructive actions and error states (default: red)\n * - `success` – positive states and confirmations (default: green)\n * - `info` – informational states, e.g. info notifications (default: blue)\n * - `warning` – warning states, e.g. warning notifications (default: yellow)\n * - `canvas` – surface backgrounds: page, card, panel, input (default: gray)\n *\n * @example\n * // tailwind.config.ts\n * import radishPreset from \"@radish-ui/core/preset\";\n * import colors from \"tailwindcss/colors\";\n *\n * export default {\n * presets: [radishPreset],\n * content: [\"./index.html\", \"./src/**\\/*.{ts,tsx}\"],\n * // Override the primary brand color:\n * theme: { extend: { colors: { primary: colors.violet } } },\n * };\n */\nconst preset = {\n darkMode: \"class\",\n theme: {\n extend: {\n colors: {\n primary: colors.indigo,\n neutral: colors.gray,\n danger: colors.red,\n success: colors.green,\n info: colors.blue,\n warning: colors.yellow,\n canvas: {\n ...colors.gray,\n // Extend the gray scale with shade 0 = pure white,\n // so bg-canvas-0 can be used for the lightest surface (cards, inputs).\n 0: colors.white,\n },\n },\n },\n },\n} satisfies Partial<Config>;\n\nexport default preset;\n"],"mappings":";AACA,OAAO,YAAY;AA8BnB,IAAM,SAAS;AAAA,EACb,UAAU;AAAA,EACV,OAAO;AAAA,IACL,QAAQ;AAAA,MACN,QAAQ;AAAA,QACN,SAAS,OAAO;AAAA,QAChB,SAAS,OAAO;AAAA,QAChB,QAAQ,OAAO;AAAA,QACf,SAAS,OAAO;AAAA,QAChB,MAAM,OAAO;AAAA,QACb,SAAS,OAAO;AAAA,QAChB,QAAQ;AAAA,UACN,GAAG,OAAO;AAAA;AAAA;AAAA,UAGV,GAAG,OAAO;AAAA,QACZ;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,iBAAQ;","names":[]}
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@radish-ui/core",
3
+ "version": "0.1.0-prerelease.1",
4
+ "description": "Headless react-admin wrappers and Tailwind utilities for radish-ui",
5
+ "keywords": [
6
+ "components",
7
+ "headless",
8
+ "ra-core",
9
+ "radish-ui",
10
+ "react-admin",
11
+ "tailwindcss",
12
+ "ui"
13
+ ],
14
+ "homepage": "https://saebyn.github.io/radish-ui/",
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/saebyn/radish-ui.git",
19
+ "directory": "packages/core"
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "README.md"
24
+ ],
25
+ "type": "module",
26
+ "main": "./dist/index.cjs",
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
+ "require": "./dist/index.cjs"
34
+ },
35
+ "./preset": {
36
+ "types": "./dist/preset.d.ts",
37
+ "import": "./dist/preset.js",
38
+ "require": "./dist/preset.cjs"
39
+ }
40
+ },
41
+ "dependencies": {
42
+ "clsx": "^2.1.1",
43
+ "tailwind-merge": "^2.3.0"
44
+ },
45
+ "devDependencies": {
46
+ "@types/react": "^18.3.3",
47
+ "@types/react-dom": "^18.3.0",
48
+ "ra-core": "^5.3.3",
49
+ "react": "^18.3.1",
50
+ "react-dom": "^18.3.1",
51
+ "tailwindcss": "^3.4.4",
52
+ "tsup": "^8.1.0",
53
+ "typescript": "^5.4.5"
54
+ },
55
+ "peerDependencies": {
56
+ "ra-core": "^5",
57
+ "react": "^18 || ^19",
58
+ "react-dom": "^18 || ^19",
59
+ "tailwindcss": "^3 || ^4"
60
+ },
61
+ "scripts": {
62
+ "build": "tsup",
63
+ "dev": "tsup --watch"
64
+ }
65
+ }