@docubook/ui-react 0.1.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.
Files changed (80) hide show
  1. package/README.md +126 -0
  2. package/dist/breadcrumbs.cjs +13 -0
  3. package/dist/breadcrumbs.d.cts +19 -0
  4. package/dist/breadcrumbs.d.ts +19 -0
  5. package/dist/breadcrumbs.js +14 -0
  6. package/dist/chunk-42YUT467.cjs +41 -0
  7. package/dist/chunk-4DCBYM74.js +42 -0
  8. package/dist/chunk-54N6HTQV.cjs +49 -0
  9. package/dist/chunk-7HHY2WDF.cjs +43 -0
  10. package/dist/chunk-ACEM5N2Y.cjs +123 -0
  11. package/dist/chunk-BCJ3FW3Y.cjs +66 -0
  12. package/dist/chunk-EJCGJCVK.cjs +89 -0
  13. package/dist/chunk-EN2X23AN.cjs +330 -0
  14. package/dist/chunk-FGJ6EYLA.js +90 -0
  15. package/dist/chunk-HTNZRBKW.js +67 -0
  16. package/dist/chunk-I4CZWV3M.js +124 -0
  17. package/dist/chunk-IBKH77YN.js +50 -0
  18. package/dist/chunk-KHU72DOY.cjs +25 -0
  19. package/dist/chunk-LJV3UIMK.cjs +53 -0
  20. package/dist/chunk-LUO4YXRQ.js +38 -0
  21. package/dist/chunk-NJKWNMJF.js +44 -0
  22. package/dist/chunk-OB6B2KN5.js +54 -0
  23. package/dist/chunk-OKMEBWPL.cjs +133 -0
  24. package/dist/chunk-PB4SHWMJ.cjs +101 -0
  25. package/dist/chunk-Q55KNNKE.js +26 -0
  26. package/dist/chunk-QZH7EIFW.js +134 -0
  27. package/dist/chunk-VRODU4ZV.cjs +37 -0
  28. package/dist/chunk-W5G2ZBYA.js +102 -0
  29. package/dist/chunk-ZMIZV66S.js +331 -0
  30. package/dist/cn.cjs +6 -0
  31. package/dist/cn.d.cts +4 -0
  32. package/dist/cn.d.ts +4 -0
  33. package/dist/cn.js +7 -0
  34. package/dist/collapse.cjs +12 -0
  35. package/dist/collapse.d.cts +31 -0
  36. package/dist/collapse.d.ts +31 -0
  37. package/dist/collapse.js +13 -0
  38. package/dist/drawer.cjs +16 -0
  39. package/dist/drawer.d.cts +44 -0
  40. package/dist/drawer.d.ts +44 -0
  41. package/dist/drawer.js +17 -0
  42. package/dist/dropdown.cjs +12 -0
  43. package/dist/dropdown.d.cts +20 -0
  44. package/dist/dropdown.d.ts +20 -0
  45. package/dist/dropdown.js +13 -0
  46. package/dist/index.cjs +96 -0
  47. package/dist/index.d.cts +15 -0
  48. package/dist/index.d.ts +15 -0
  49. package/dist/index.js +97 -0
  50. package/dist/input.cjs +9 -0
  51. package/dist/input.d.cts +17 -0
  52. package/dist/input.d.ts +17 -0
  53. package/dist/input.js +10 -0
  54. package/dist/kbd.cjs +9 -0
  55. package/dist/kbd.d.cts +27 -0
  56. package/dist/kbd.d.ts +27 -0
  57. package/dist/kbd.js +10 -0
  58. package/dist/modal.cjs +10 -0
  59. package/dist/modal.d.cts +17 -0
  60. package/dist/modal.d.ts +17 -0
  61. package/dist/modal.js +11 -0
  62. package/dist/navbar.cjs +13 -0
  63. package/dist/navbar.d.cts +36 -0
  64. package/dist/navbar.d.ts +36 -0
  65. package/dist/navbar.js +14 -0
  66. package/dist/pagination.cjs +20 -0
  67. package/dist/pagination.d.cts +88 -0
  68. package/dist/pagination.d.ts +88 -0
  69. package/dist/pagination.js +21 -0
  70. package/dist/theme-controller.cjs +8 -0
  71. package/dist/theme-controller.d.cts +21 -0
  72. package/dist/theme-controller.d.ts +21 -0
  73. package/dist/theme-controller.js +9 -0
  74. package/dist/toggle.cjs +10 -0
  75. package/dist/toggle.d.cts +36 -0
  76. package/dist/toggle.d.ts +36 -0
  77. package/dist/toggle.js +11 -0
  78. package/dist/types-BZI5Cv8-.d.cts +6 -0
  79. package/dist/types-BZI5Cv8-.d.ts +6 -0
  80. package/package.json +200 -0
package/README.md ADDED
@@ -0,0 +1,126 @@
1
+ # @docubook/ui-react
2
+
3
+ React + DaisyUI component library for documentation sites. Works with **Next.js**, **Remix**, **React Router v7**, **Astro**, **TanStack Start**, and **Vite + React**.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add @docubook/ui-react
9
+ ```
10
+
11
+ ### Peer Dependencies
12
+
13
+ ```bash
14
+ pnpm add react tailwindcss daisyui lucide-react
15
+ ```
16
+
17
+ | Peer | Version |
18
+ | ------------ | ------------------ |
19
+ | react | ≥ 18.0.0 |
20
+ | tailwindcss | ≥ 4.0.0 |
21
+ | daisyui | ≥ 5.0.0 |
22
+ | lucide-react | ≥ 1.0.0 (optional) |
23
+
24
+ ## Usage
25
+
26
+ ```tsx
27
+ // Per-component import (tree-shaken)
28
+ import { Modal, useModal } from "@docubook/ui-react/modal";
29
+ import { Collapse, Accordion } from "@docubook/ui-react/collapse";
30
+ import { ThemeControllerToggle } from "@docubook/ui-react/theme-controller";
31
+ import { cn } from "@docubook/ui-react/cn";
32
+
33
+ // Barrel import
34
+ import { Modal, Collapse, Input, Navbar } from "@docubook/ui-react";
35
+ ```
36
+
37
+ ## Components
38
+
39
+ ### Primitives
40
+
41
+ | Component | Import Path | Description |
42
+ | ------------------------------------------ | ----------------------------- | ---------------------------------------------- |
43
+ | `Input`, `InputGroup` | `@docubook/ui-react/input` | Input with color/size/ghost variants |
44
+ | `Kbd`, `FnKey` | `@docubook/ui-react/kbd` | Keyboard key indicator with function key icons |
45
+ | `Toggle`, `ToggleGroup` | `@docubook/ui-react/toggle` | Toggle switch with label/description |
46
+ | `Dropdown`, `DropdownItem`, `DropdownLink` | `@docubook/ui-react/dropdown` | Details-based dropdown menu |
47
+
48
+ #### PaginationDocs with Custom Icons
49
+
50
+ ```tsx
51
+ import { PaginationDocs } from "@docubook/ui-react/pagination";
52
+ import { ChevronLeft, ChevronRight } from "lucide-react";
53
+
54
+ <PaginationDocs
55
+ prev={{ href: "/prev", title: "Previous Page" }}
56
+ next={{ href: "/next", title: "Next Page" }}
57
+ prevIcon={<ChevronLeft className="w-3 h-3" />}
58
+ nextIcon={<ChevronRight className="w-3 h-3" />}
59
+ />
60
+ ```
61
+
62
+ ### Composites
63
+
64
+ | Component | Import Path | Description |
65
+ | ------------------------------------------------------------------------------- | ------------------------------------- | ------------------------------------- |
66
+ | `Modal`, `useModal` | `@docubook/ui-react/modal` | Native dialog modal with hook |
67
+ | `Drawer`, `DrawerTrigger`, `DrawerSidePanel`, `DrawerContent`, `useDrawerState` | `@docubook/ui-react/drawer` | Responsive sidebar drawer |
68
+ | `Collapse`, `Accordion` | `@docubook/ui-react/collapse` | Collapsible content panels |
69
+ | `ThemeControllerToggle` | `@docubook/ui-react/theme-controller` | Theme toggle switch with render props |
70
+
71
+ ### Navigation
72
+
73
+ | Component | Import Path | Description |
74
+ | ------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------- | ------------------------- |
75
+ | `Navbar`, `Logo`, `NavMenu`, `NavMenuLink` | `@docubook/ui-react/navbar` | Navigation bar components |
76
+ | `Breadcrumb`, `BreadcrumbItem`, `BreadcrumbPage`, `BreadcrumbList` | `@docubook/ui-react/breadcrumbs` | Breadcrumb navigation |
77
+ | `PaginationItem`, `PaginationFull`, `PaginationDocs`, `PaginationButtons`, `PaginationRange`, `PaginationInfo`, `getPaginationRange` | `@docubook/ui-react/pagination` | Page navigation utilities |
78
+
79
+ ### Utilities
80
+
81
+ | Export | Import Path | Description |
82
+ | ------ | ----------------------- | -------------------------------------------------- |
83
+ | `cn()` | `@docubook/ui-react/cn` | Class name merging utility (clsx + tailwind-merge) |
84
+
85
+ ## Framework Setup
86
+
87
+ ### Next.js (App Router)
88
+
89
+ Components with hooks include `"use client"` — works out of the box.
90
+
91
+ ### Astro
92
+
93
+ ```astro
94
+ ---
95
+ import { Modal } from "@docubook/ui-react/modal";
96
+ ---
97
+ <Modal client:load>...</Modal>
98
+ ```
99
+
100
+ ### React Router v7 / Remix / Vite
101
+
102
+ No special setup needed — standard React components.
103
+
104
+ ### TanStack Start
105
+
106
+ No special setup needed — standard React components.
107
+
108
+ ## CSS Requirements
109
+
110
+ ### Dropdown Component
111
+
112
+ The `Dropdown` component uses native `<details>` element. To hide the default disclosure marker, add this CSS to your global stylesheet:
113
+
114
+ ```css
115
+ /* globals.css */
116
+ summary::-webkit-details-marker {
117
+ display: none;
118
+ }
119
+ summary::marker {
120
+ display: none;
121
+ }
122
+ ```
123
+
124
+ ## License
125
+
126
+ MIT
@@ -0,0 +1,13 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+ var _chunkKHU72DOYcjs = require('./chunk-KHU72DOY.cjs');
7
+ require('./chunk-7HHY2WDF.cjs');
8
+
9
+
10
+
11
+
12
+
13
+ exports.Breadcrumb = _chunkKHU72DOYcjs.Breadcrumb; exports.BreadcrumbItem = _chunkKHU72DOYcjs.BreadcrumbItem; exports.BreadcrumbList = _chunkKHU72DOYcjs.BreadcrumbList; exports.BreadcrumbPage = _chunkKHU72DOYcjs.BreadcrumbPage;
@@ -0,0 +1,19 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ interface BreadcrumbProps {
5
+ children: ReactNode;
6
+ className?: string;
7
+ }
8
+ interface BreadcrumbItemProps {
9
+ children: ReactNode;
10
+ className?: string;
11
+ }
12
+ declare function Breadcrumb({ children, className }: BreadcrumbProps): react_jsx_runtime.JSX.Element;
13
+ declare function BreadcrumbItem({ children, className }: BreadcrumbItemProps): react_jsx_runtime.JSX.Element;
14
+ declare function BreadcrumbPage({ children, className }: BreadcrumbItemProps): react_jsx_runtime.JSX.Element;
15
+ declare function BreadcrumbList({ children }: {
16
+ children: React.ReactNode;
17
+ }): react_jsx_runtime.JSX.Element;
18
+
19
+ export { Breadcrumb, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbList, BreadcrumbPage, type BreadcrumbProps };
@@ -0,0 +1,19 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ interface BreadcrumbProps {
5
+ children: ReactNode;
6
+ className?: string;
7
+ }
8
+ interface BreadcrumbItemProps {
9
+ children: ReactNode;
10
+ className?: string;
11
+ }
12
+ declare function Breadcrumb({ children, className }: BreadcrumbProps): react_jsx_runtime.JSX.Element;
13
+ declare function BreadcrumbItem({ children, className }: BreadcrumbItemProps): react_jsx_runtime.JSX.Element;
14
+ declare function BreadcrumbPage({ children, className }: BreadcrumbItemProps): react_jsx_runtime.JSX.Element;
15
+ declare function BreadcrumbList({ children }: {
16
+ children: React.ReactNode;
17
+ }): react_jsx_runtime.JSX.Element;
18
+
19
+ export { Breadcrumb, BreadcrumbItem, type BreadcrumbItemProps, BreadcrumbList, BreadcrumbPage, type BreadcrumbProps };
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ import {
3
+ Breadcrumb,
4
+ BreadcrumbItem,
5
+ BreadcrumbList,
6
+ BreadcrumbPage
7
+ } from "./chunk-Q55KNNKE.js";
8
+ import "./chunk-NJKWNMJF.js";
9
+ export {
10
+ Breadcrumb,
11
+ BreadcrumbItem,
12
+ BreadcrumbList,
13
+ BreadcrumbPage
14
+ };
@@ -0,0 +1,41 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+ var _chunk7HHY2WDFcjs = require('./chunk-7HHY2WDF.cjs');
7
+
8
+ // src/base/input.tsx
9
+ var _react = require('react');
10
+ var _jsxruntime = require('react/jsx-runtime');
11
+ var Input = _react.forwardRef.call(void 0,
12
+ (_a, ref) => {
13
+ var _b = _a, { className, color, inputSize, ghost } = _b, props = _chunk7HHY2WDFcjs.__objRest.call(void 0, _b, ["className", "color", "inputSize", "ghost"]);
14
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
15
+ "input",
16
+ _chunk7HHY2WDFcjs.__spreadValues.call(void 0, {
17
+ ref,
18
+ className: _chunk7HHY2WDFcjs.cn.call(void 0,
19
+ "input",
20
+ ghost && "input-ghost",
21
+ color && `input-${color}`,
22
+ inputSize && `input-${inputSize}`,
23
+ className
24
+ )
25
+ }, props)
26
+ );
27
+ }
28
+ );
29
+ Input.displayName = "Input";
30
+ var InputGroup = _react.forwardRef.call(void 0,
31
+ (_a, ref) => {
32
+ var _b = _a, { children, className } = _b, props = _chunk7HHY2WDFcjs.__objRest.call(void 0, _b, ["children", "className"]);
33
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "label", _chunk7HHY2WDFcjs.__spreadProps.call(void 0, _chunk7HHY2WDFcjs.__spreadValues.call(void 0, { ref, className: _chunk7HHY2WDFcjs.cn.call(void 0, "input", className) }, props), { children }));
34
+ }
35
+ );
36
+ InputGroup.displayName = "InputGroup";
37
+
38
+
39
+
40
+
41
+ exports.Input = Input; exports.InputGroup = InputGroup;
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ import {
3
+ __objRest,
4
+ __spreadProps,
5
+ __spreadValues,
6
+ cn
7
+ } from "./chunk-NJKWNMJF.js";
8
+
9
+ // src/base/input.tsx
10
+ import { forwardRef } from "react";
11
+ import { jsx } from "react/jsx-runtime";
12
+ var Input = forwardRef(
13
+ (_a, ref) => {
14
+ var _b = _a, { className, color, inputSize, ghost } = _b, props = __objRest(_b, ["className", "color", "inputSize", "ghost"]);
15
+ return /* @__PURE__ */ jsx(
16
+ "input",
17
+ __spreadValues({
18
+ ref,
19
+ className: cn(
20
+ "input",
21
+ ghost && "input-ghost",
22
+ color && `input-${color}`,
23
+ inputSize && `input-${inputSize}`,
24
+ className
25
+ )
26
+ }, props)
27
+ );
28
+ }
29
+ );
30
+ Input.displayName = "Input";
31
+ var InputGroup = forwardRef(
32
+ (_a, ref) => {
33
+ var _b = _a, { children, className } = _b, props = __objRest(_b, ["children", "className"]);
34
+ return /* @__PURE__ */ jsx("label", __spreadProps(__spreadValues({ ref, className: cn("input", className) }, props), { children }));
35
+ }
36
+ );
37
+ InputGroup.displayName = "InputGroup";
38
+
39
+ export {
40
+ Input,
41
+ InputGroup
42
+ };
@@ -0,0 +1,49 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+ var _chunk7HHY2WDFcjs = require('./chunk-7HHY2WDF.cjs');
7
+
8
+ // src/base/modal.tsx
9
+ var _react = require('react');
10
+ var _jsxruntime = require('react/jsx-runtime');
11
+ var Modal = _react.forwardRef.call(void 0,
12
+ (_a, ref) => {
13
+ var _b = _a, { children, className, closeOnBackdrop = true, placement, boxClassName } = _b, props = _chunk7HHY2WDFcjs.__objRest.call(void 0, _b, ["children", "className", "closeOnBackdrop", "placement", "boxClassName"]);
14
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
15
+ "dialog",
16
+ _chunk7HHY2WDFcjs.__spreadProps.call(void 0, _chunk7HHY2WDFcjs.__spreadValues.call(void 0, {
17
+ ref,
18
+ className: _chunk7HHY2WDFcjs.cn.call(void 0, "modal", placement && `modal-${placement}`, className)
19
+ }, props), {
20
+ children: [
21
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _chunk7HHY2WDFcjs.cn.call(void 0, "modal-box", boxClassName), children }),
22
+ closeOnBackdrop && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "form", { method: "dialog", className: "modal-backdrop", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { children: "esc" }) })
23
+ ]
24
+ })
25
+ );
26
+ }
27
+ );
28
+ Modal.displayName = "Modal";
29
+ function useModal() {
30
+ const ref = _react.useRef.call(void 0, null);
31
+ const open = _react.useCallback.call(void 0, () => {
32
+ var _a;
33
+ (_a = ref.current) == null ? void 0 : _a.showModal();
34
+ setTimeout(() => {
35
+ var _a2, _b;
36
+ (_b = (_a2 = ref.current) == null ? void 0 : _a2.querySelector("input, [autofocus]")) == null ? void 0 : _b.focus();
37
+ }, 0);
38
+ }, []);
39
+ const close = _react.useCallback.call(void 0, () => {
40
+ var _a;
41
+ return (_a = ref.current) == null ? void 0 : _a.close();
42
+ }, []);
43
+ return { ref, open, close };
44
+ }
45
+
46
+
47
+
48
+
49
+ exports.Modal = Modal; exports.useModal = useModal;
@@ -0,0 +1,43 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+
33
+ // src/utils/cn.ts
34
+ function cn(...inputs) {
35
+ return inputs.filter(Boolean).join(" ");
36
+ }
37
+
38
+
39
+
40
+
41
+
42
+
43
+ exports.__spreadValues = __spreadValues; exports.__spreadProps = __spreadProps; exports.__objRest = __objRest; exports.cn = cn;
@@ -0,0 +1,123 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+ var _chunk7HHY2WDFcjs = require('./chunk-7HHY2WDF.cjs');
6
+
7
+ // src/base/toggle.tsx
8
+ var _react = require('react');
9
+ var _jsxruntime = require('react/jsx-runtime');
10
+ var Toggle = _react.forwardRef.call(void 0, function Toggle2(_a, ref) {
11
+ var _b = _a, {
12
+ color = "primary",
13
+ size = "md",
14
+ label,
15
+ description,
16
+ indeterminate = false,
17
+ containerClassName,
18
+ labelClassName,
19
+ descriptionClassName,
20
+ className,
21
+ disabled,
22
+ checked,
23
+ defaultChecked,
24
+ onChange
25
+ } = _b, props = _chunk7HHY2WDFcjs.__objRest.call(void 0, _b, [
26
+ "color",
27
+ "size",
28
+ "label",
29
+ "description",
30
+ "indeterminate",
31
+ "containerClassName",
32
+ "labelClassName",
33
+ "descriptionClassName",
34
+ "className",
35
+ "disabled",
36
+ "checked",
37
+ "defaultChecked",
38
+ "onChange"
39
+ ]);
40
+ _react.useEffect.call(void 0, () => {
41
+ if (indeterminate && ref) {
42
+ const input = ref.current;
43
+ if (input) input.indeterminate = true;
44
+ }
45
+ }, [ref, indeterminate]);
46
+ const toggleEl = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
47
+ "input",
48
+ _chunk7HHY2WDFcjs.__spreadValues.call(void 0, {
49
+ ref,
50
+ type: "checkbox",
51
+ className: _chunk7HHY2WDFcjs.cn.call(void 0, `toggle-${color}`, `toggle-${size}`, className),
52
+ disabled,
53
+ checked,
54
+ defaultChecked,
55
+ onChange,
56
+ "data-indeterminate": indeterminate
57
+ }, props)
58
+ );
59
+ if (!label) return toggleEl;
60
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
61
+ "label",
62
+ {
63
+ className: _chunk7HHY2WDFcjs.cn.call(void 0,
64
+ "flex items-start gap-3",
65
+ disabled && "cursor-not-allowed opacity-50",
66
+ containerClassName
67
+ ),
68
+ children: [
69
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center pt-0.5", children: toggleEl }),
70
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-0.5", children: [
71
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: _chunk7HHY2WDFcjs.cn.call(void 0, "text-base-content cursor-pointer", labelClassName), children: label }),
72
+ description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: _chunk7HHY2WDFcjs.cn.call(void 0, "text-base-content/60 text-sm", descriptionClassName), children: description })
73
+ ] })
74
+ ]
75
+ }
76
+ );
77
+ });
78
+ function ToggleGroup({
79
+ items,
80
+ value,
81
+ defaultValue = [],
82
+ onChange,
83
+ color = "primary",
84
+ size = "md",
85
+ controlled = false,
86
+ className
87
+ }) {
88
+ const [internalValue, setInternalValue] = _react.useState.call(void 0, defaultValue);
89
+ const selectedValues = controlled ? value != null ? value : internalValue : internalValue;
90
+ const toggle = (itemValue) => {
91
+ const next = selectedValues.includes(itemValue) ? selectedValues.filter((v) => v !== itemValue) : [...selectedValues, itemValue];
92
+ if (!controlled) setInternalValue(next);
93
+ onChange == null ? void 0 : onChange(next);
94
+ };
95
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _chunk7HHY2WDFcjs.cn.call(void 0, "flex flex-col gap-3", className), children: items.map((item) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
96
+ "label",
97
+ {
98
+ className: _chunk7HHY2WDFcjs.cn.call(void 0,
99
+ "flex items-center gap-3",
100
+ item.disabled && "cursor-not-allowed opacity-50"
101
+ ),
102
+ children: [
103
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
104
+ "input",
105
+ {
106
+ type: "checkbox",
107
+ className: _chunk7HHY2WDFcjs.cn.call(void 0, `toggle-${color}`, `toggle-${size}`),
108
+ checked: selectedValues.includes(item.value),
109
+ disabled: item.disabled,
110
+ onChange: () => !item.disabled && toggle(item.value)
111
+ }
112
+ ),
113
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-base-content cursor-pointer", children: item.label })
114
+ ]
115
+ },
116
+ item.value
117
+ )) });
118
+ }
119
+
120
+
121
+
122
+
123
+ exports.Toggle = Toggle; exports.ToggleGroup = ToggleGroup;
@@ -0,0 +1,66 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunk7HHY2WDFcjs = require('./chunk-7HHY2WDF.cjs');
4
+
5
+ // src/base/theme-controller.tsx
6
+ var _react = require('react');
7
+ var _jsxruntime = require('react/jsx-runtime');
8
+ function applyTheme(theme) {
9
+ if (typeof document !== "undefined") {
10
+ document.documentElement.classList.toggle("dark", theme === "dark");
11
+ }
12
+ }
13
+ function useApplyThemeOnMount(theme) {
14
+ const applied = _react.useRef.call(void 0, false);
15
+ _react.useEffect.call(void 0, () => {
16
+ if (!applied.current) {
17
+ applyTheme(theme);
18
+ applied.current = true;
19
+ }
20
+ }, [theme]);
21
+ }
22
+ function ThemeControllerToggle({
23
+ defaultTheme = "light",
24
+ lightTheme = "light",
25
+ darkTheme = "dark",
26
+ onThemeChange,
27
+ className,
28
+ label,
29
+ size = "md",
30
+ children
31
+ }) {
32
+ const [checked, setChecked] = _react.useState.call(void 0, () => {
33
+ if (typeof window === "undefined") return false;
34
+ return (localStorage.getItem("theme") || defaultTheme) === darkTheme;
35
+ });
36
+ useApplyThemeOnMount(checked ? darkTheme : lightTheme);
37
+ const handleChange = (newChecked) => {
38
+ const newTheme = newChecked ? darkTheme : lightTheme;
39
+ setChecked(newChecked);
40
+ applyTheme(newTheme);
41
+ localStorage.setItem("theme", newTheme);
42
+ onThemeChange == null ? void 0 : onThemeChange(newTheme);
43
+ };
44
+ if (children) {
45
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className, children: children({ isDark: checked, checked, toggle: handleChange }) });
46
+ }
47
+ const toggleEl = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
48
+ "input",
49
+ {
50
+ type: "checkbox",
51
+ className: _chunk7HHY2WDFcjs.cn.call(void 0, "toggle theme-controller", `toggle-${size}`),
52
+ checked,
53
+ value: darkTheme,
54
+ onChange: (e) => handleChange(e.target.checked)
55
+ }
56
+ );
57
+ if (!label) return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className, children: toggleEl });
58
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { className: _chunk7HHY2WDFcjs.cn.call(void 0, "flex cursor-pointer items-center gap-3", className), children: [
59
+ toggleEl,
60
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-base-content", children: label })
61
+ ] });
62
+ }
63
+
64
+
65
+
66
+ exports.ThemeControllerToggle = ThemeControllerToggle;
@@ -0,0 +1,89 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+ var _chunk7HHY2WDFcjs = require('./chunk-7HHY2WDF.cjs');
7
+
8
+ // src/base/dropdown.tsx
9
+ var _react = require('react');
10
+ var _jsxruntime = require('react/jsx-runtime');
11
+ var Dropdown = _react.forwardRef.call(void 0,
12
+ (_a, ref) => {
13
+ var _b = _a, { className, align = "start", disabled = false, trigger, children, menuClassName } = _b, props = _chunk7HHY2WDFcjs.__objRest.call(void 0, _b, ["className", "align", "disabled", "trigger", "children", "menuClassName"]);
14
+ const detailsRef = _react.useRef.call(void 0, null);
15
+ _react.useEffect.call(void 0, () => {
16
+ const handler = (e) => {
17
+ if (detailsRef.current && !detailsRef.current.contains(e.target)) {
18
+ detailsRef.current.open = false;
19
+ }
20
+ };
21
+ document.addEventListener("click", handler);
22
+ return () => document.removeEventListener("click", handler);
23
+ }, []);
24
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
25
+ "details",
26
+ _chunk7HHY2WDFcjs.__spreadProps.call(void 0, _chunk7HHY2WDFcjs.__spreadValues.call(void 0, {
27
+ ref: (el) => {
28
+ detailsRef.current = el;
29
+ if (typeof ref === "function") ref(el);
30
+ else if (ref) ref.current = el;
31
+ },
32
+ className: _chunk7HHY2WDFcjs.cn.call(void 0, "relative", disabled && "pointer-events-none opacity-50", className)
33
+ }, props), {
34
+ children: [
35
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "summary", { className: "cursor-pointer", style: { listStyle: "none" }, children: trigger }),
36
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
37
+ "ul",
38
+ {
39
+ className: _chunk7HHY2WDFcjs.cn.call(void 0,
40
+ "bg-base-100 rounded-box border-base-300 absolute z-50 mt-1 min-w-[240px] space-y-1 border p-2 shadow-lg",
41
+ align === "end" ? "right-0" : "left-0",
42
+ menuClassName
43
+ ),
44
+ children
45
+ }
46
+ )
47
+ ]
48
+ })
49
+ );
50
+ }
51
+ );
52
+ Dropdown.displayName = "Dropdown";
53
+ var DropdownItem = _react.forwardRef.call(void 0,
54
+ (_a, ref) => {
55
+ var _b = _a, { className, children } = _b, props = _chunk7HHY2WDFcjs.__objRest.call(void 0, _b, ["className", "children"]);
56
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
57
+ "li",
58
+ _chunk7HHY2WDFcjs.__spreadProps.call(void 0, _chunk7HHY2WDFcjs.__spreadValues.call(void 0, {
59
+ ref,
60
+ className: _chunk7HHY2WDFcjs.cn.call(void 0,
61
+ "hover:bg-base-200 text-base-content/80 hover:text-base-content relative flex cursor-pointer items-center gap-2 rounded px-2 py-2 text-sm outline-none transition-colors",
62
+ className
63
+ ),
64
+ role: "menuitem"
65
+ }, props), {
66
+ children
67
+ })
68
+ );
69
+ }
70
+ );
71
+ DropdownItem.displayName = "DropdownItem";
72
+ var DropdownLink = _react.forwardRef.call(void 0, (_a, ref) => {
73
+ var _b = _a, { className, children, href } = _b, props = _chunk7HHY2WDFcjs.__objRest.call(void 0, _b, ["className", "children", "href"]);
74
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
75
+ "li",
76
+ {
77
+ role: "menuitem",
78
+ className: "hover:bg-base-200 text-base-content/80 hover:text-base-content relative flex cursor-pointer items-center gap-2 rounded px-2 py-2 text-sm outline-none transition-colors",
79
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "a", _chunk7HHY2WDFcjs.__spreadProps.call(void 0, _chunk7HHY2WDFcjs.__spreadValues.call(void 0, { ref, href, className: _chunk7HHY2WDFcjs.cn.call(void 0, "text-inherit no-underline", className) }, props), { children }))
80
+ }
81
+ );
82
+ });
83
+ DropdownLink.displayName = "DropdownLink";
84
+
85
+
86
+
87
+
88
+
89
+ exports.Dropdown = Dropdown; exports.DropdownItem = DropdownItem; exports.DropdownLink = DropdownLink;