@aster-ui/prefixed 0.12.50
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 +15 -0
- package/README.md +40 -0
- package/dist/chart.d.ts +2 -0
- package/dist/chart.js +5 -0
- package/dist/chart.js.map +1 -0
- package/dist/components/Affix.d.ts +14 -0
- package/dist/components/Affix.js +57 -0
- package/dist/components/Affix.js.map +1 -0
- package/dist/components/Alert.d.ts +10 -0
- package/dist/components/Alert.js +31 -0
- package/dist/components/Alert.js.map +1 -0
- package/dist/components/Anchor.d.ts +55 -0
- package/dist/components/Anchor.js +116 -0
- package/dist/components/Anchor.js.map +1 -0
- package/dist/components/Autocomplete.d.ts +38 -0
- package/dist/components/Autocomplete.js +186 -0
- package/dist/components/Autocomplete.js.map +1 -0
- package/dist/components/Avatar.d.ts +28 -0
- package/dist/components/Avatar.js +65 -0
- package/dist/components/Avatar.js.map +1 -0
- package/dist/components/Badge.d.ts +39 -0
- package/dist/components/Badge.js +220 -0
- package/dist/components/Badge.js.map +1 -0
- package/dist/components/Breadcrumb.d.ts +32 -0
- package/dist/components/Breadcrumb.js +39 -0
- package/dist/components/Breadcrumb.js.map +1 -0
- package/dist/components/Browser.d.ts +7 -0
- package/dist/components/Browser.js +15 -0
- package/dist/components/Browser.js.map +1 -0
- package/dist/components/Button.d.ts +38 -0
- package/dist/components/Button.js +114 -0
- package/dist/components/Button.js.map +1 -0
- package/dist/components/Card.d.ts +57 -0
- package/dist/components/Card.js +202 -0
- package/dist/components/Card.js.map +1 -0
- package/dist/components/Carousel.d.ts +55 -0
- package/dist/components/Carousel.js +205 -0
- package/dist/components/Carousel.js.map +1 -0
- package/dist/components/Cascader.d.ts +71 -0
- package/dist/components/Cascader.js +416 -0
- package/dist/components/Cascader.js.map +1 -0
- package/dist/components/Chart.d.ts +19 -0
- package/dist/components/Chart.js +153 -0
- package/dist/components/Chart.js.map +1 -0
- package/dist/components/Chat.d.ts +11 -0
- package/dist/components/Chat.js +33 -0
- package/dist/components/Chat.js.map +1 -0
- package/dist/components/Checkbox.d.ts +42 -0
- package/dist/components/Checkbox.js +156 -0
- package/dist/components/Checkbox.js.map +1 -0
- package/dist/components/Code.d.ts +16 -0
- package/dist/components/Code.js +60 -0
- package/dist/components/Code.js.map +1 -0
- package/dist/components/Collapse.d.ts +45 -0
- package/dist/components/Collapse.js +115 -0
- package/dist/components/Collapse.js.map +1 -0
- package/dist/components/ColorPicker.d.ts +16 -0
- package/dist/components/ColorPicker.js +368 -0
- package/dist/components/ColorPicker.js.map +1 -0
- package/dist/components/Command.d.ts +65 -0
- package/dist/components/Command.js +422 -0
- package/dist/components/Command.js.map +1 -0
- package/dist/components/ConfigProvider.d.ts +59 -0
- package/dist/components/ConfigProvider.js +46 -0
- package/dist/components/ConfigProvider.js.map +1 -0
- package/dist/components/Container.d.ts +12 -0
- package/dist/components/Container.js +28 -0
- package/dist/components/Container.js.map +1 -0
- package/dist/components/ContextMenu.d.ts +59 -0
- package/dist/components/ContextMenu.js +206 -0
- package/dist/components/ContextMenu.js.map +1 -0
- package/dist/components/CopyButton.d.ts +37 -0
- package/dist/components/CopyButton.js +123 -0
- package/dist/components/CopyButton.js.map +1 -0
- package/dist/components/Countdown.d.ts +27 -0
- package/dist/components/Countdown.js +118 -0
- package/dist/components/Countdown.js.map +1 -0
- package/dist/components/DatePicker.d.ts +11 -0
- package/dist/components/DatePicker.js +188 -0
- package/dist/components/DatePicker.js.map +1 -0
- package/dist/components/Descriptions.d.ts +84 -0
- package/dist/components/Descriptions.js +234 -0
- package/dist/components/Descriptions.js.map +1 -0
- package/dist/components/Diff.d.ts +12 -0
- package/dist/components/Diff.js +22 -0
- package/dist/components/Diff.js.map +1 -0
- package/dist/components/Divider.d.ts +8 -0
- package/dist/components/Divider.js +36 -0
- package/dist/components/Divider.js.map +1 -0
- package/dist/components/Dock.d.ts +38 -0
- package/dist/components/Dock.js +47 -0
- package/dist/components/Dock.js.map +1 -0
- package/dist/components/Drawer.d.ts +81 -0
- package/dist/components/Drawer.js +246 -0
- package/dist/components/Drawer.js.map +1 -0
- package/dist/components/Dropdown.d.ts +104 -0
- package/dist/components/Dropdown.js +407 -0
- package/dist/components/Dropdown.js.map +1 -0
- package/dist/components/Empty.d.ts +17 -0
- package/dist/components/Empty.js +145 -0
- package/dist/components/Empty.js.map +1 -0
- package/dist/components/Fieldset.d.ts +21 -0
- package/dist/components/Fieldset.js +21 -0
- package/dist/components/Fieldset.js.map +1 -0
- package/dist/components/FileInput.d.ts +9 -0
- package/dist/components/FileInput.js +38 -0
- package/dist/components/FileInput.js.map +1 -0
- package/dist/components/Filter.d.ts +27 -0
- package/dist/components/Filter.js +57 -0
- package/dist/components/Filter.js.map +1 -0
- package/dist/components/Flex.d.ts +14 -0
- package/dist/components/Flex.js +66 -0
- package/dist/components/Flex.js.map +1 -0
- package/dist/components/FloatButton.d.ts +73 -0
- package/dist/components/FloatButton.js +187 -0
- package/dist/components/FloatButton.js.map +1 -0
- package/dist/components/Footer.d.ts +16 -0
- package/dist/components/Footer.js +22 -0
- package/dist/components/Footer.js.map +1 -0
- package/dist/components/Form.d.ts +107 -0
- package/dist/components/Form.js +277 -0
- package/dist/components/Form.js.map +1 -0
- package/dist/components/Grid.d.ts +26 -0
- package/dist/components/Grid.js +1090 -0
- package/dist/components/Grid.js.map +1 -0
- package/dist/components/Hero.d.ts +11 -0
- package/dist/components/Hero.js +21 -0
- package/dist/components/Hero.js.map +1 -0
- package/dist/components/HoverGallery.d.ts +10 -0
- package/dist/components/HoverGallery.js +20 -0
- package/dist/components/HoverGallery.js.map +1 -0
- package/dist/components/Image.d.ts +26 -0
- package/dist/components/Image.js +172 -0
- package/dist/components/Image.js.map +1 -0
- package/dist/components/Input.d.ts +36 -0
- package/dist/components/Input.js +263 -0
- package/dist/components/Input.js.map +1 -0
- package/dist/components/InputNumber.d.ts +19 -0
- package/dist/components/InputNumber.js +158 -0
- package/dist/components/InputNumber.js.map +1 -0
- package/dist/components/Join.d.ts +6 -0
- package/dist/components/Join.js +19 -0
- package/dist/components/Join.js.map +1 -0
- package/dist/components/Kbd.d.ts +9 -0
- package/dist/components/Kbd.js +20 -0
- package/dist/components/Kbd.js.map +1 -0
- package/dist/components/Layout.d.ts +67 -0
- package/dist/components/Layout.js +188 -0
- package/dist/components/Layout.js.map +1 -0
- package/dist/components/List.d.ts +79 -0
- package/dist/components/List.js +128 -0
- package/dist/components/List.js.map +1 -0
- package/dist/components/Loading.d.ts +9 -0
- package/dist/components/Loading.js +40 -0
- package/dist/components/Loading.js.map +1 -0
- package/dist/components/Mask.d.ts +14 -0
- package/dist/components/Mask.js +37 -0
- package/dist/components/Mask.js.map +1 -0
- package/dist/components/Masonry.d.ts +15 -0
- package/dist/components/Masonry.js +84 -0
- package/dist/components/Masonry.js.map +1 -0
- package/dist/components/Mention.d.ts +30 -0
- package/dist/components/Mention.js +179 -0
- package/dist/components/Mention.js.map +1 -0
- package/dist/components/Menu.d.ts +72 -0
- package/dist/components/Menu.js +163 -0
- package/dist/components/Menu.js.map +1 -0
- package/dist/components/Message.d.ts +20 -0
- package/dist/components/Message.js +57 -0
- package/dist/components/Message.js.map +1 -0
- package/dist/components/Modal.d.ts +57 -0
- package/dist/components/Modal.js +338 -0
- package/dist/components/Modal.js.map +1 -0
- package/dist/components/MonthCalendar.d.ts +31 -0
- package/dist/components/MonthCalendar.js +205 -0
- package/dist/components/MonthCalendar.js.map +1 -0
- package/dist/components/Navbar.d.ts +22 -0
- package/dist/components/Navbar.js +50 -0
- package/dist/components/Navbar.js.map +1 -0
- package/dist/components/Notification.d.ts +50 -0
- package/dist/components/Notification.js +150 -0
- package/dist/components/Notification.js.map +1 -0
- package/dist/components/OTPInput.d.ts +32 -0
- package/dist/components/OTPInput.js +114 -0
- package/dist/components/OTPInput.js.map +1 -0
- package/dist/components/Pagination.d.ts +18 -0
- package/dist/components/Pagination.js +175 -0
- package/dist/components/Pagination.js.map +1 -0
- package/dist/components/Phone.d.ts +8 -0
- package/dist/components/Phone.js +17 -0
- package/dist/components/Phone.js.map +1 -0
- package/dist/components/Popconfirm.d.ts +17 -0
- package/dist/components/Popconfirm.js +125 -0
- package/dist/components/Popconfirm.js.map +1 -0
- package/dist/components/Popover.d.ts +15 -0
- package/dist/components/Popover.js +89 -0
- package/dist/components/Popover.js.map +1 -0
- package/dist/components/Progress.d.ts +5 -0
- package/dist/components/Progress.js +23 -0
- package/dist/components/Progress.js.map +1 -0
- package/dist/components/QRCode.d.ts +19 -0
- package/dist/components/QRCode.js +75 -0
- package/dist/components/QRCode.js.map +1 -0
- package/dist/components/RadialProgress.d.ts +10 -0
- package/dist/components/RadialProgress.js +48 -0
- package/dist/components/RadialProgress.js.map +1 -0
- package/dist/components/Radio.d.ts +26 -0
- package/dist/components/Radio.js +61 -0
- package/dist/components/Radio.js.map +1 -0
- package/dist/components/Range.d.ts +16 -0
- package/dist/components/Range.js +57 -0
- package/dist/components/Range.js.map +1 -0
- package/dist/components/Rating.d.ts +30 -0
- package/dist/components/Rating.js +127 -0
- package/dist/components/Rating.js.map +1 -0
- package/dist/components/Responsive.d.ts +18 -0
- package/dist/components/Responsive.js +17 -0
- package/dist/components/Responsive.js.map +1 -0
- package/dist/components/ResponsiveDrawer.d.ts +34 -0
- package/dist/components/ResponsiveDrawer.js +75 -0
- package/dist/components/ResponsiveDrawer.js.map +1 -0
- package/dist/components/Result.d.ts +12 -0
- package/dist/components/Result.js +110 -0
- package/dist/components/Result.js.map +1 -0
- package/dist/components/RichTextEditor.d.ts +32 -0
- package/dist/components/RichTextEditor.js +335 -0
- package/dist/components/RichTextEditor.js.map +1 -0
- package/dist/components/Segmented.d.ts +37 -0
- package/dist/components/Segmented.js +73 -0
- package/dist/components/Segmented.js.map +1 -0
- package/dist/components/Select.d.ts +18 -0
- package/dist/components/Select.js +78 -0
- package/dist/components/Select.js.map +1 -0
- package/dist/components/Skeleton.d.ts +9 -0
- package/dist/components/Skeleton.js +24 -0
- package/dist/components/Skeleton.js.map +1 -0
- package/dist/components/Space.d.ts +11 -0
- package/dist/components/Space.js +61 -0
- package/dist/components/Space.js.map +1 -0
- package/dist/components/Splitter.d.ts +29 -0
- package/dist/components/Splitter.js +257 -0
- package/dist/components/Splitter.js.map +1 -0
- package/dist/components/Stat.d.ts +18 -0
- package/dist/components/Stat.js +26 -0
- package/dist/components/Stat.js.map +1 -0
- package/dist/components/Status.d.ts +18 -0
- package/dist/components/Status.js +34 -0
- package/dist/components/Status.js.map +1 -0
- package/dist/components/Steps.d.ts +52 -0
- package/dist/components/Steps.js +97 -0
- package/dist/components/Steps.js.map +1 -0
- package/dist/components/Table.d.ts +105 -0
- package/dist/components/Table.js +637 -0
- package/dist/components/Table.js.map +1 -0
- package/dist/components/Tabs.d.ts +45 -0
- package/dist/components/Tabs.js +86 -0
- package/dist/components/Tabs.js.map +1 -0
- package/dist/components/Tag.d.ts +34 -0
- package/dist/components/Tag.js +210 -0
- package/dist/components/Tag.js.map +1 -0
- package/dist/components/TextRotate.d.ts +13 -0
- package/dist/components/TextRotate.js +26 -0
- package/dist/components/TextRotate.js.map +1 -0
- package/dist/components/Textarea.d.ts +9 -0
- package/dist/components/Textarea.js +44 -0
- package/dist/components/Textarea.js.map +1 -0
- package/dist/components/ThemeController.d.ts +28 -0
- package/dist/components/ThemeController.js +162 -0
- package/dist/components/ThemeController.js.map +1 -0
- package/dist/components/TimePicker.d.ts +20 -0
- package/dist/components/TimePicker.js +304 -0
- package/dist/components/TimePicker.js.map +1 -0
- package/dist/components/Timeline.d.ts +79 -0
- package/dist/components/Timeline.js +151 -0
- package/dist/components/Timeline.js.map +1 -0
- package/dist/components/Toggle.d.ts +7 -0
- package/dist/components/Toggle.js +39 -0
- package/dist/components/Toggle.js.map +1 -0
- package/dist/components/Tooltip.d.ts +9 -0
- package/dist/components/Tooltip.js +37 -0
- package/dist/components/Tooltip.js.map +1 -0
- package/dist/components/Tour.d.ts +123 -0
- package/dist/components/Tour.js +400 -0
- package/dist/components/Tour.js.map +1 -0
- package/dist/components/Transfer.d.ts +22 -0
- package/dist/components/Transfer.js +214 -0
- package/dist/components/Transfer.js.map +1 -0
- package/dist/components/Tree.d.ts +118 -0
- package/dist/components/Tree.js +444 -0
- package/dist/components/Tree.js.map +1 -0
- package/dist/components/TreeSelect.d.ts +84 -0
- package/dist/components/TreeSelect.js +755 -0
- package/dist/components/TreeSelect.js.map +1 -0
- package/dist/components/Typography.d.ts +53 -0
- package/dist/components/Typography.js +182 -0
- package/dist/components/Typography.js.map +1 -0
- package/dist/components/Upload.d.ts +38 -0
- package/dist/components/Upload.js +261 -0
- package/dist/components/Upload.js.map +1 -0
- package/dist/components/VirtualList.d.ts +29 -0
- package/dist/components/VirtualList.js +69 -0
- package/dist/components/VirtualList.js.map +1 -0
- package/dist/components/Watermark.d.ts +40 -0
- package/dist/components/Watermark.js +129 -0
- package/dist/components/Watermark.js.map +1 -0
- package/dist/components/WeekCalendar.d.ts +35 -0
- package/dist/components/WeekCalendar.js +204 -0
- package/dist/components/WeekCalendar.js.map +1 -0
- package/dist/components/Window.d.ts +7 -0
- package/dist/components/Window.js +10 -0
- package/dist/components/Window.js.map +1 -0
- package/dist/contexts/IconSizeContext.d.ts +2 -0
- package/dist/contexts/IconSizeContext.js +6 -0
- package/dist/contexts/IconSizeContext.js.map +1 -0
- package/dist/editor.d.ts +1 -0
- package/dist/editor.js +5 -0
- package/dist/editor.js.map +1 -0
- package/dist/hooks/useBreakpoint.d.ts +10 -0
- package/dist/hooks/useBreakpoint.js +36 -0
- package/dist/hooks/useBreakpoint.js.map +1 -0
- package/dist/hooks/useClickOutside.d.ts +17 -0
- package/dist/hooks/useClickOutside.js +18 -0
- package/dist/hooks/useClickOutside.js.map +1 -0
- package/dist/hooks/useClipboard.d.ts +20 -0
- package/dist/hooks/useClipboard.js +17 -0
- package/dist/hooks/useClipboard.js.map +1 -0
- package/dist/hooks/useDebounce.d.ts +18 -0
- package/dist/hooks/useDebounce.js +16 -0
- package/dist/hooks/useDebounce.js.map +1 -0
- package/dist/hooks/useDisclosure.d.ts +20 -0
- package/dist/hooks/useDisclosure.js +9 -0
- package/dist/hooks/useDisclosure.js.map +1 -0
- package/dist/hooks/useHover.d.ts +18 -0
- package/dist/hooks/useHover.js +16 -0
- package/dist/hooks/useHover.js.map +1 -0
- package/dist/hooks/useKeyPress.d.ts +40 -0
- package/dist/hooks/useKeyPress.js +34 -0
- package/dist/hooks/useKeyPress.js.map +1 -0
- package/dist/hooks/useLocalStorage.d.ts +12 -0
- package/dist/hooks/useLocalStorage.js +49 -0
- package/dist/hooks/useLocalStorage.js.map +1 -0
- package/dist/hooks/usePrevious.d.ts +15 -0
- package/dist/hooks/usePrevious.js +11 -0
- package/dist/hooks/usePrevious.js.map +1 -0
- package/dist/hooks/useWindowSize.d.ts +21 -0
- package/dist/hooks/useWindowSize.js +21 -0
- package/dist/hooks/useWindowSize.js.map +1 -0
- package/dist/index.d.ts +216 -0
- package/dist/index.js +256 -0
- package/dist/index.js.map +1 -0
- package/dist/locale/de-DE.d.ts +3 -0
- package/dist/locale/de-DE.js +100 -0
- package/dist/locale/de-DE.js.map +1 -0
- package/dist/locale/en-CA.d.ts +3 -0
- package/dist/locale/en-CA.js +11 -0
- package/dist/locale/en-CA.js.map +1 -0
- package/dist/locale/en-GB.d.ts +3 -0
- package/dist/locale/en-GB.js +11 -0
- package/dist/locale/en-GB.js.map +1 -0
- package/dist/locale/en-US.d.ts +3 -0
- package/dist/locale/en-US.js +100 -0
- package/dist/locale/en-US.js.map +1 -0
- package/dist/locale/es-ES.d.ts +3 -0
- package/dist/locale/es-ES.js +100 -0
- package/dist/locale/es-ES.js.map +1 -0
- package/dist/locale/fr-FR.d.ts +3 -0
- package/dist/locale/fr-FR.js +100 -0
- package/dist/locale/fr-FR.js.map +1 -0
- package/dist/locale/index.d.ts +107 -0
- package/dist/locale/ja-JP.d.ts +3 -0
- package/dist/locale/ja-JP.js +100 -0
- package/dist/locale/ja-JP.js.map +1 -0
- package/dist/locale/ko-KR.d.ts +3 -0
- package/dist/locale/ko-KR.js +100 -0
- package/dist/locale/ko-KR.js.map +1 -0
- package/dist/locale/pt-BR.d.ts +3 -0
- package/dist/locale/pt-BR.js +100 -0
- package/dist/locale/pt-BR.js.map +1 -0
- package/dist/locale/zh-CN.d.ts +3 -0
- package/dist/locale/zh-CN.js +100 -0
- package/dist/locale/zh-CN.js.map +1 -0
- package/dist/qrcode.d.ts +2 -0
- package/dist/qrcode.js +5 -0
- package/dist/qrcode.js.map +1 -0
- package/dist/virtuallist.d.ts +2 -0
- package/dist/virtuallist.js +5 -0
- package/dist/virtuallist.js.map +1 -0
- package/package.json +130 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { jsx as w } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as C, useState as v, useEffect as M } from "react";
|
|
3
|
+
import O from "apexcharts";
|
|
4
|
+
function S(o) {
|
|
5
|
+
return typeof document > "u" ? "" : getComputedStyle(document.documentElement).getPropertyValue(o).trim();
|
|
6
|
+
}
|
|
7
|
+
function x(o) {
|
|
8
|
+
const e = o.match(/oklch\(\s*([\d.]+)%?\s+([\d.]+)\s+([\d.]+)/);
|
|
9
|
+
if (!e) return "";
|
|
10
|
+
const t = parseFloat(e[1]) / 100, r = parseFloat(e[2]), c = parseFloat(e[3]) * Math.PI / 180, l = r * Math.cos(c), u = r * Math.sin(c), n = t + 0.3963377774 * l + 0.2158037573 * u, f = t - 0.1055613458 * l - 0.0638541728 * u, i = t - 0.0894841775 * l - 1.291485548 * u, s = n * n * n, d = f * f * f, m = i * i * i;
|
|
11
|
+
let b = 4.0767416621 * s - 3.3077115913 * d + 0.2309699292 * m, y = -1.2684380046 * s + 2.6097574011 * d - 0.3413193965 * m, g = -0.0041960863 * s - 0.7034186147 * d + 1.707614701 * m;
|
|
12
|
+
const k = (p) => (p = Math.max(0, Math.min(1, p)), p <= 31308e-7 ? 12.92 * p : 1.055 * Math.pow(p, 1 / 2.4) - 0.055);
|
|
13
|
+
return b = Math.round(k(b) * 255), y = Math.round(k(y) * 255), g = Math.round(k(g) * 255), `#${b.toString(16).padStart(2, "0")}${y.toString(16).padStart(2, "0")}${g.toString(16).padStart(2, "0")}`;
|
|
14
|
+
}
|
|
15
|
+
function V() {
|
|
16
|
+
return typeof document > "u" ? [] : [
|
|
17
|
+
"--color-primary",
|
|
18
|
+
"--color-secondary",
|
|
19
|
+
"--color-accent",
|
|
20
|
+
"--color-info",
|
|
21
|
+
"--color-success",
|
|
22
|
+
"--color-warning",
|
|
23
|
+
"--color-error"
|
|
24
|
+
].map((e) => {
|
|
25
|
+
const t = S(e);
|
|
26
|
+
return t.includes("oklch") ? x(t) : t;
|
|
27
|
+
}).filter(Boolean);
|
|
28
|
+
}
|
|
29
|
+
function A() {
|
|
30
|
+
const o = V(), e = S("--color-base-content"), t = e.includes("oklch") ? x(e) : e || "#888888", r = S("--color-base-300"), a = r.includes("oklch") ? x(r) : r || "#e0e0e0", c = t.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i), l = c ? (parseInt(c[1], 16) + parseInt(c[2], 16) + parseInt(c[3], 16)) / 3 > 128 : !1;
|
|
31
|
+
return {
|
|
32
|
+
colors: o.length > 0 ? o : void 0,
|
|
33
|
+
theme: {
|
|
34
|
+
mode: l ? "dark" : "light"
|
|
35
|
+
},
|
|
36
|
+
chart: {
|
|
37
|
+
background: "transparent",
|
|
38
|
+
foreColor: t
|
|
39
|
+
},
|
|
40
|
+
grid: {
|
|
41
|
+
borderColor: a
|
|
42
|
+
},
|
|
43
|
+
xaxis: {
|
|
44
|
+
labels: {
|
|
45
|
+
style: {
|
|
46
|
+
colors: t
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
axisBorder: {
|
|
50
|
+
color: a
|
|
51
|
+
},
|
|
52
|
+
axisTicks: {
|
|
53
|
+
color: a
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
yaxis: {
|
|
57
|
+
labels: {
|
|
58
|
+
style: {
|
|
59
|
+
colors: t
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
legend: {
|
|
64
|
+
labels: {
|
|
65
|
+
colors: t
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
tooltip: {
|
|
69
|
+
theme: l ? "dark" : "light",
|
|
70
|
+
style: {
|
|
71
|
+
fontSize: "12px"
|
|
72
|
+
},
|
|
73
|
+
x: {
|
|
74
|
+
show: !0
|
|
75
|
+
},
|
|
76
|
+
marker: {
|
|
77
|
+
show: !0
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
dataLabels: {
|
|
81
|
+
style: {
|
|
82
|
+
colors: [t, t, t, t, t, t, t]
|
|
83
|
+
},
|
|
84
|
+
background: {
|
|
85
|
+
enabled: !1
|
|
86
|
+
},
|
|
87
|
+
dropShadow: {
|
|
88
|
+
enabled: !1
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function h(o, e) {
|
|
94
|
+
const t = { ...o };
|
|
95
|
+
for (const r in e)
|
|
96
|
+
e[r] !== void 0 && (typeof e[r] == "object" && e[r] !== null && !Array.isArray(e[r]) && typeof o[r] == "object" && o[r] !== null && !Array.isArray(o[r]) ? t[r] = h(
|
|
97
|
+
o[r],
|
|
98
|
+
e[r]
|
|
99
|
+
) : t[r] = e[r]);
|
|
100
|
+
return t;
|
|
101
|
+
}
|
|
102
|
+
const $ = ({
|
|
103
|
+
type: o,
|
|
104
|
+
series: e,
|
|
105
|
+
width: t = "100%",
|
|
106
|
+
height: r = 350,
|
|
107
|
+
options: a = {},
|
|
108
|
+
themed: c = !0,
|
|
109
|
+
className: l = ""
|
|
110
|
+
}) => {
|
|
111
|
+
const u = C(null), n = C(null), [, f] = v(!1), i = () => {
|
|
112
|
+
const s = {
|
|
113
|
+
chart: {
|
|
114
|
+
type: o,
|
|
115
|
+
width: t,
|
|
116
|
+
height: r
|
|
117
|
+
},
|
|
118
|
+
series: e
|
|
119
|
+
};
|
|
120
|
+
if (c) {
|
|
121
|
+
const d = A();
|
|
122
|
+
return h(h(s, d), a);
|
|
123
|
+
}
|
|
124
|
+
return h(s, a);
|
|
125
|
+
};
|
|
126
|
+
return M(() => {
|
|
127
|
+
if (!u.current) return;
|
|
128
|
+
const s = i();
|
|
129
|
+
return n.current = new O(u.current, s), n.current.render(), f(!0), () => {
|
|
130
|
+
n.current && (n.current.destroy(), n.current = null);
|
|
131
|
+
};
|
|
132
|
+
}, []), M(() => {
|
|
133
|
+
if (!n.current) return;
|
|
134
|
+
const s = i();
|
|
135
|
+
n.current.updateOptions(s, !0, !0);
|
|
136
|
+
}, [o, e, t, r, a, c]), M(() => {
|
|
137
|
+
if (!c || typeof window > "u") return;
|
|
138
|
+
const s = new MutationObserver(() => {
|
|
139
|
+
if (n.current) {
|
|
140
|
+
const d = i();
|
|
141
|
+
n.current.updateOptions(d, !0, !0);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
return s.observe(document.documentElement, {
|
|
145
|
+
attributes: !0,
|
|
146
|
+
attributeFilter: ["data-theme", "class"]
|
|
147
|
+
}), () => s.disconnect();
|
|
148
|
+
}, [c]), /* @__PURE__ */ w("div", { ref: u, className: l });
|
|
149
|
+
};
|
|
150
|
+
export {
|
|
151
|
+
$ as Chart
|
|
152
|
+
};
|
|
153
|
+
//# sourceMappingURL=Chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chart.js","sources":["../../src/components/Chart.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react'\nimport ApexCharts from 'apexcharts'\nimport type { ApexOptions } from 'apexcharts'\n\nexport interface ChartProps {\n /** Chart type */\n type: 'line' | 'area' | 'bar' | 'pie' | 'donut' | 'radialBar' | 'scatter' | 'bubble' | 'heatmap' | 'candlestick' | 'boxPlot' | 'radar' | 'polarArea' | 'rangeBar' | 'rangeArea' | 'treemap'\n /** Chart series data */\n series: ApexAxisChartSeries | ApexNonAxisChartSeries\n /** Chart width */\n width?: string | number\n /** Chart height */\n height?: string | number\n /** ApexCharts options (merged with theme defaults) */\n options?: ApexOptions\n /** Use daisyUI theme colors */\n themed?: boolean\n /** Additional CSS classes */\n className?: string\n}\n\n// Get CSS variable value from root\nfunction getCssVar(varName: string): string {\n if (typeof document === 'undefined') return ''\n return getComputedStyle(document.documentElement).getPropertyValue(varName).trim()\n}\n\n// Convert oklch to hex (approximate)\nfunction oklchToHex(oklch: string): string {\n // Parse oklch(L C H) format\n const match = oklch.match(/oklch\\(\\s*([\\d.]+)%?\\s+([\\d.]+)\\s+([\\d.]+)/)\n if (!match) return ''\n\n const l = parseFloat(match[1]) / 100 // Lightness 0-1\n const c = parseFloat(match[2]) // Chroma\n const h = parseFloat(match[3]) // Hue in degrees\n\n // Simplified oklch to sRGB conversion\n // This is an approximation - full conversion is complex\n const hRad = (h * Math.PI) / 180\n const a = c * Math.cos(hRad)\n const b = c * Math.sin(hRad)\n\n // Approximate conversion to linear RGB\n const l_ = l + 0.3963377774 * a + 0.2158037573 * b\n const m_ = l - 0.1055613458 * a - 0.0638541728 * b\n const s_ = l - 0.0894841775 * a - 1.2914855480 * b\n\n const l3 = l_ * l_ * l_\n const m3 = m_ * m_ * m_\n const s3 = s_ * s_ * s_\n\n let r = 4.0767416621 * l3 - 3.3077115913 * m3 + 0.2309699292 * s3\n let g = -1.2684380046 * l3 + 2.6097574011 * m3 - 0.3413193965 * s3\n let bl = -0.0041960863 * l3 - 0.7034186147 * m3 + 1.7076147010 * s3\n\n // Clamp and convert to sRGB\n const toSrgb = (x: number) => {\n x = Math.max(0, Math.min(1, x))\n return x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1/2.4) - 0.055\n }\n\n r = Math.round(toSrgb(r) * 255)\n g = Math.round(toSrgb(g) * 255)\n bl = Math.round(toSrgb(bl) * 255)\n\n return `#${r.toString(16).padStart(2, '0')}${g.toString(16).padStart(2, '0')}${bl.toString(16).padStart(2, '0')}`\n}\n\n// Get daisyUI theme colors from CSS variables\nfunction getThemeColors(): string[] {\n if (typeof document === 'undefined') return []\n\n const colorVars = [\n '--color-primary',\n '--color-secondary',\n '--color-accent',\n '--color-info',\n '--color-success',\n '--color-warning',\n '--color-error',\n ]\n\n return colorVars\n .map(varName => {\n const value = getCssVar(varName)\n if (value.includes('oklch')) {\n return oklchToHex(value)\n }\n return value\n })\n .filter(Boolean)\n}\n\n// Get theme-aware chart options\nfunction getThemedOptions(): Partial<ApexOptions> {\n const colors = getThemeColors()\n\n // Get text color from CSS variable\n const baseContentVar = getCssVar('--color-base-content')\n const textColor = baseContentVar.includes('oklch')\n ? oklchToHex(baseContentVar)\n : (baseContentVar || '#888888')\n\n // Get grid color from CSS variable\n const base300Var = getCssVar('--color-base-300')\n const gridColor = base300Var.includes('oklch')\n ? oklchToHex(base300Var)\n : (base300Var || '#e0e0e0')\n\n // Determine if dark theme by checking luminance of text color\n // If text is light, we're on dark theme\n const textMatch = textColor.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i)\n const isDark = textMatch\n ? (parseInt(textMatch[1], 16) + parseInt(textMatch[2], 16) + parseInt(textMatch[3], 16)) / 3 > 128\n : false\n\n return {\n colors: colors.length > 0 ? colors : undefined,\n theme: {\n mode: isDark ? 'dark' : 'light',\n },\n chart: {\n background: 'transparent',\n foreColor: textColor,\n },\n grid: {\n borderColor: gridColor,\n },\n xaxis: {\n labels: {\n style: {\n colors: textColor,\n },\n },\n axisBorder: {\n color: gridColor,\n },\n axisTicks: {\n color: gridColor,\n },\n },\n yaxis: {\n labels: {\n style: {\n colors: textColor,\n },\n },\n },\n legend: {\n labels: {\n colors: textColor,\n },\n },\n tooltip: {\n theme: isDark ? 'dark' : 'light',\n style: {\n fontSize: '12px',\n },\n x: {\n show: true,\n },\n marker: {\n show: true,\n },\n },\n dataLabels: {\n style: {\n colors: [textColor, textColor, textColor, textColor, textColor, textColor, textColor],\n },\n background: {\n enabled: false,\n },\n dropShadow: {\n enabled: false,\n },\n },\n }\n}\n\n// Deep merge objects\nfunction deepMerge<T extends Record<string, unknown>>(target: T, source: Partial<T>): T {\n const result = { ...target }\n\n for (const key in source) {\n if (source[key] !== undefined) {\n if (\n typeof source[key] === 'object' &&\n source[key] !== null &&\n !Array.isArray(source[key]) &&\n typeof target[key] === 'object' &&\n target[key] !== null &&\n !Array.isArray(target[key])\n ) {\n result[key] = deepMerge(\n target[key] as Record<string, unknown>,\n source[key] as Record<string, unknown>\n ) as T[Extract<keyof T, string>]\n } else {\n result[key] = source[key] as T[Extract<keyof T, string>]\n }\n }\n }\n\n return result\n}\n\nexport const Chart: React.FC<ChartProps> = ({\n type,\n series,\n width = '100%',\n height = 350,\n options = {},\n themed = true,\n className = '',\n}) => {\n const chartRef = useRef<HTMLDivElement>(null)\n const chartInstance = useRef<ApexCharts | null>(null)\n const [, setMounted] = useState(false)\n\n // Build final options\n const buildOptions = (): ApexOptions => {\n const baseOptions: ApexOptions = {\n chart: {\n type,\n width,\n height,\n },\n series,\n }\n\n if (themed) {\n const themedOpts = getThemedOptions()\n return deepMerge(deepMerge(baseOptions as unknown as Record<string, unknown>, themedOpts as unknown as Record<string, unknown>), options as unknown as Record<string, unknown>) as ApexOptions\n }\n\n return deepMerge(baseOptions as unknown as Record<string, unknown>, options as unknown as Record<string, unknown>) as ApexOptions\n }\n\n // Initialize chart\n useEffect(() => {\n if (!chartRef.current) return\n\n const opts = buildOptions()\n chartInstance.current = new ApexCharts(chartRef.current, opts)\n chartInstance.current.render()\n setMounted(true)\n\n return () => {\n if (chartInstance.current) {\n chartInstance.current.destroy()\n chartInstance.current = null\n }\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n // Update chart when props change\n useEffect(() => {\n if (!chartInstance.current) return\n\n const opts = buildOptions()\n chartInstance.current.updateOptions(opts, true, true)\n }, [type, series, width, height, options, themed]) // eslint-disable-line react-hooks/exhaustive-deps\n\n // Listen for theme changes\n useEffect(() => {\n if (!themed || typeof window === 'undefined') return\n\n const observer = new MutationObserver(() => {\n if (chartInstance.current) {\n const opts = buildOptions()\n chartInstance.current.updateOptions(opts, true, true)\n }\n })\n\n observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['data-theme', 'class'],\n })\n\n return () => observer.disconnect()\n }, [themed]) // eslint-disable-line react-hooks/exhaustive-deps\n\n return <div ref={chartRef} className={className} />\n}\n"],"names":["getCssVar","varName","oklchToHex","oklch","match","l","c","hRad","a","b","l_","m_","s_","l3","m3","s3","r","g","bl","toSrgb","x","getThemeColors","value","getThemedOptions","colors","baseContentVar","textColor","base300Var","gridColor","textMatch","isDark","deepMerge","target","source","result","key","Chart","type","series","width","height","options","themed","className","chartRef","useRef","chartInstance","setMounted","useState","buildOptions","baseOptions","themedOpts","useEffect","opts","ApexCharts","observer","jsx"],"mappings":";;;AAsBA,SAASA,EAAUC,GAAyB;AAC1C,SAAI,OAAO,WAAa,MAAoB,KACrC,iBAAiB,SAAS,eAAe,EAAE,iBAAiBA,CAAO,EAAE,KAAA;AAC9E;AAGA,SAASC,EAAWC,GAAuB;AAEzC,QAAMC,IAAQD,EAAM,MAAM,4CAA4C;AACtE,MAAI,CAACC,EAAO,QAAO;AAEnB,QAAMC,IAAI,WAAWD,EAAM,CAAC,CAAC,IAAI,KAC3BE,IAAI,WAAWF,EAAM,CAAC,CAAC,GAKvBG,IAJI,WAAWH,EAAM,CAAC,CAAC,IAIX,KAAK,KAAM,KACvBI,IAAIF,IAAI,KAAK,IAAIC,CAAI,GACrBE,IAAIH,IAAI,KAAK,IAAIC,CAAI,GAGrBG,IAAKL,IAAI,eAAeG,IAAI,eAAeC,GAC3CE,IAAKN,IAAI,eAAeG,IAAI,eAAeC,GAC3CG,IAAKP,IAAI,eAAeG,IAAI,cAAeC,GAE3CI,IAAKH,IAAKA,IAAKA,GACfI,IAAKH,IAAKA,IAAKA,GACfI,IAAKH,IAAKA,IAAKA;AAErB,MAAII,IAAI,eAAeH,IAAK,eAAeC,IAAK,eAAeC,GA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AAA,GACtBC,EAAW,EAAI,GAER,MAAM;AACX,MAAID,EAAc,YAChBA,EAAc,QAAQ,QAAA,GACtBA,EAAc,UAAU;AAAA,IAE5B;AAAA,EACF,GAAG,CAAA,CAAE,GAGLM,EAAU,MAAM;AACd,QAAI,CAACN,EAAc,QAAS;AAE5B,UAAMO,IAAOJ,EAAA;AACb,IAAAH,EAAc,QAAQ,cAAcO,GAAM,IAAM,EAAI;AAAA,EACtD,GAAG,CAAChB,GAAMC,GAAQC,GAAOC,GAAQC,GAASC,CAAM,CAAC,GAGjDU,EAAU,MAAM;AACd,QAAI,CAACV,KAAU,OAAO,SAAW,IAAa;AAE9C,UAAMa,IAAW,IAAI,iBAAiB,MAAM;AAC1C,UAAIT,EAAc,SAAS;AACzB,cAAMO,IAAOJ,EAAA;AACb,QAAAH,EAAc,QAAQ,cAAcO,GAAM,IAAM,EAAI;AAAA,MACtD;AAAA,IACF,CAAC;AAED,WAAAE,EAAS,QAAQ,SAAS,iBAAiB;AAAA,MACzC,YAAY;AAAA,MACZ,iBAAiB,CAAC,cAAc,OAAO;AAAA,IAAA,CACxC,GAEM,MAAMA,EAAS,WAAA;AAAA,EACxB,GAAG,CAACb,CAAM,CAAC,GAEJ,gBAAAc,EAAC,OAAA,EAAI,KAAKZ,GAAU,WAAAD,EAAA,CAAsB;AACnD;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ChatProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
message: React.ReactNode;
|
|
4
|
+
position?: 'start' | 'end';
|
|
5
|
+
avatar?: string;
|
|
6
|
+
avatarAlt?: string;
|
|
7
|
+
header?: React.ReactNode;
|
|
8
|
+
footer?: React.ReactNode;
|
|
9
|
+
color?: 'primary' | 'secondary' | 'accent' | 'neutral' | 'info' | 'success' | 'warning' | 'error';
|
|
10
|
+
}
|
|
11
|
+
export declare const Chat: React.FC<ChatProps>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsxs as i, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
const C = "d-chat", m = "d-chat-start", B = "d-chat-end", v = "d-chat-image", N = "d-chat-header", f = "d-chat-bubble", g = "d-chat-bubble-primary", p = "d-chat-bubble-secondary", y = "d-chat-bubble-accent", $ = "d-chat-bubble-neutral", j = "d-chat-bubble-info", w = "d-chat-bubble-success", x = "d-chat-bubble-warning", S = "d-chat-bubble-error", A = "d-chat-footer", E = "d-avatar", F = ({
|
|
3
|
+
message: b,
|
|
4
|
+
position: r = "start",
|
|
5
|
+
avatar: c,
|
|
6
|
+
avatarAlt: l = "",
|
|
7
|
+
header: s,
|
|
8
|
+
footer: e,
|
|
9
|
+
color: a,
|
|
10
|
+
className: h = "",
|
|
11
|
+
...o
|
|
12
|
+
}) => {
|
|
13
|
+
const u = r === "start" ? m : B, d = {
|
|
14
|
+
primary: g,
|
|
15
|
+
secondary: p,
|
|
16
|
+
accent: y,
|
|
17
|
+
neutral: $,
|
|
18
|
+
info: j,
|
|
19
|
+
success: w,
|
|
20
|
+
warning: x,
|
|
21
|
+
error: S
|
|
22
|
+
}, n = [f];
|
|
23
|
+
return a && d[a] && n.push(d[a]), /* @__PURE__ */ i("div", { className: `${C} ${u} ${h}`, ...o, children: [
|
|
24
|
+
c && /* @__PURE__ */ t("div", { className: `${v} ${E}`, children: /* @__PURE__ */ t("div", { className: "w-10 rounded-full", children: /* @__PURE__ */ t("img", { alt: l, src: c }) }) }),
|
|
25
|
+
s && /* @__PURE__ */ t("div", { className: N, children: s }),
|
|
26
|
+
/* @__PURE__ */ t("div", { className: n.join(" "), children: b }),
|
|
27
|
+
e && /* @__PURE__ */ t("div", { className: A, children: e })
|
|
28
|
+
] });
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
F as Chat
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=Chat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chat.js","sources":["../../src/components/Chat.tsx"],"sourcesContent":["import React from 'react'\n\n// DaisyUI classes\nconst dChat = 'd-chat'\nconst dChatStart = 'd-chat-start'\nconst dChatEnd = 'd-chat-end'\nconst dChatImage = 'd-chat-image'\nconst dChatHeader = 'd-chat-header'\nconst dChatBubble = 'd-chat-bubble'\nconst dChatBubblePrimary = 'd-chat-bubble-primary'\nconst dChatBubbleSecondary = 'd-chat-bubble-secondary'\nconst dChatBubbleAccent = 'd-chat-bubble-accent'\nconst dChatBubbleNeutral = 'd-chat-bubble-neutral'\nconst dChatBubbleInfo = 'd-chat-bubble-info'\nconst dChatBubbleSuccess = 'd-chat-bubble-success'\nconst dChatBubbleWarning = 'd-chat-bubble-warning'\nconst dChatBubbleError = 'd-chat-bubble-error'\nconst dChatFooter = 'd-chat-footer'\nconst dAvatar = 'd-avatar'\n\nexport interface ChatProps extends React.HTMLAttributes<HTMLDivElement> {\n message: React.ReactNode\n position?: 'start' | 'end'\n avatar?: string\n avatarAlt?: string\n header?: React.ReactNode\n footer?: React.ReactNode\n color?: 'primary' | 'secondary' | 'accent' | 'neutral' | 'info' | 'success' | 'warning' | 'error'\n}\n\nexport const Chat: React.FC<ChatProps> = ({\n message,\n position = 'start',\n avatar,\n avatarAlt = '',\n header,\n footer,\n color,\n className = '',\n ...rest\n}) => {\n const positionClass = position === 'start' ? dChatStart : dChatEnd\n\n const colorClasses: Record<string, string> = {\n primary: dChatBubblePrimary,\n secondary: dChatBubbleSecondary,\n accent: dChatBubbleAccent,\n neutral: dChatBubbleNeutral,\n info: dChatBubbleInfo,\n success: dChatBubbleSuccess,\n warning: dChatBubbleWarning,\n error: dChatBubbleError,\n }\n\n const bubbleClasses = [dChatBubble]\n if (color && colorClasses[color]) {\n bubbleClasses.push(colorClasses[color])\n }\n\n return (\n <div className={`${dChat} ${positionClass} ${className}`} {...rest}>\n {avatar && (\n <div className={`${dChatImage} ${dAvatar}`}>\n <div className=\"w-10 rounded-full\">\n <img alt={avatarAlt} src={avatar} />\n </div>\n </div>\n )}\n {header && <div className={dChatHeader}>{header}</div>}\n <div className={bubbleClasses.join(' ')}>{message}</div>\n {footer && <div className={dChatFooter}>{footer}</div>}\n </div>\n )\n}\n"],"names":["dChat","dChatStart","dChatEnd","dChatImage","dChatHeader","dChatBubble","dChatBubblePrimary","dChatBubbleSecondary","dChatBubbleAccent","dChatBubbleNeutral","dChatBubbleInfo","dChatBubbleSuccess","dChatBubbleWarning","dChatBubbleError","dChatFooter","dAvatar","Chat","message","position","avatar","avatarAlt","header","footer","color","className","rest","positionClass","colorClasses","bubbleClasses","jsxs","jsx"],"mappings":";AAGA,MAAMA,IAAQ,UACRC,IAAa,gBACbC,IAAW,cACXC,IAAa,gBACbC,IAAc,iBACdC,IAAc,iBACdC,IAAqB,yBACrBC,IAAuB,2BACvBC,IAAoB,wBACpBC,IAAqB,yBACrBC,IAAkB,sBAClBC,IAAqB,yBACrBC,IAAqB,yBACrBC,IAAmB,uBACnBC,IAAc,iBACdC,IAAU,YAYHC,IAA4B,CAAC;AAAA,EACxC,SAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,QAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAgBR,MAAa,UAAUjB,IAAaC,GAEpDyB,IAAuC;AAAA,IAC3C,SAASrB;AAAA,IACT,WAAWC;AAAA,IACX,QAAQC;AAAA,IACR,SAASC;AAAA,IACT,MAAMC;AAAA,IACN,SAASC;AAAA,IACT,SAASC;AAAA,IACT,OAAOC;AAAA,EAAA,GAGHe,IAAgB,CAACvB,CAAW;AAClC,SAAIkB,KAASI,EAAaJ,CAAK,KAC7BK,EAAc,KAAKD,EAAaJ,CAAK,CAAC,GAItC,gBAAAM,EAAC,OAAA,EAAI,WAAW,GAAG7B,CAAK,IAAI0B,CAAa,IAAIF,CAAS,IAAK,GAAGC,GAC3D,UAAA;AAAA,IAAAN,uBACE,OAAA,EAAI,WAAW,GAAGhB,CAAU,IAAIY,CAAO,IACtC,UAAA,gBAAAe,EAAC,SAAI,WAAU,qBACb,4BAAC,OAAA,EAAI,KAAKV,GAAW,KAAKD,GAAQ,GACpC,EAAA,CACF;AAAA,IAEDE,KAAU,gBAAAS,EAAC,OAAA,EAAI,WAAW1B,GAAc,UAAAiB,GAAO;AAAA,sBAC/C,OAAA,EAAI,WAAWO,EAAc,KAAK,GAAG,GAAI,UAAAX,GAAQ;AAAA,IACjDK,KAAU,gBAAAQ,EAAC,OAAA,EAAI,WAAWhB,GAAc,UAAAQ,EAAA,CAAO;AAAA,EAAA,GAClD;AAEJ;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface CheckboxSwapConfig {
|
|
3
|
+
/** Content shown when checked */
|
|
4
|
+
on: React.ReactNode;
|
|
5
|
+
/** Content shown when unchecked */
|
|
6
|
+
off: React.ReactNode;
|
|
7
|
+
/** Animation effect for the swap transition */
|
|
8
|
+
effect?: 'rotate' | 'flip';
|
|
9
|
+
}
|
|
10
|
+
export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
13
|
+
color?: 'primary' | 'secondary' | 'accent' | 'neutral' | 'success' | 'warning' | 'info' | 'error';
|
|
14
|
+
indeterminate?: boolean;
|
|
15
|
+
/** Swap mode: toggle between two visual states instead of showing a checkbox */
|
|
16
|
+
swap?: CheckboxSwapConfig;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface CheckboxOptionType {
|
|
20
|
+
label: React.ReactNode;
|
|
21
|
+
value: string | number;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface CheckboxGroupProps {
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
value?: (string | number)[];
|
|
27
|
+
defaultValue?: (string | number)[];
|
|
28
|
+
onChange?: (values: (string | number)[]) => void;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
options?: (string | number | CheckboxOptionType)[];
|
|
31
|
+
/** Layout direction for options */
|
|
32
|
+
direction?: 'horizontal' | 'vertical';
|
|
33
|
+
/** HTML name attribute for all checkboxes in the group (for form submission) */
|
|
34
|
+
name?: string;
|
|
35
|
+
className?: string;
|
|
36
|
+
'data-testid'?: string;
|
|
37
|
+
}
|
|
38
|
+
declare function CheckboxGroup({ children, value, defaultValue, onChange, disabled, options, direction, name, className, 'data-testid': testId }: CheckboxGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>> & {
|
|
40
|
+
Group: typeof CheckboxGroup;
|
|
41
|
+
};
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { jsxs as g, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import V, { forwardRef as G, useContext as O, createContext as P } from "react";
|
|
3
|
+
import { useConfig as B } from "./ConfigProvider.js";
|
|
4
|
+
const T = "d-checkbox", X = "d-checkbox-xs", A = "d-checkbox-sm", D = "d-checkbox-md", E = "d-checkbox-lg", F = "d-checkbox-xl", L = "d-checkbox-primary", M = "d-checkbox-secondary", W = "d-checkbox-accent", q = "d-checkbox-neutral", H = "d-checkbox-success", I = "d-checkbox-warning", J = "d-checkbox-info", K = "d-checkbox-error", Q = "d-swap", U = "d-swap-rotate", Y = "d-swap-flip", Z = "d-swap-on", _ = "d-swap-off", R = P(null);
|
|
5
|
+
function ee({
|
|
6
|
+
children: u,
|
|
7
|
+
value: b,
|
|
8
|
+
defaultValue: C,
|
|
9
|
+
onChange: i,
|
|
10
|
+
disabled: d = !1,
|
|
11
|
+
options: l,
|
|
12
|
+
direction: o = "vertical",
|
|
13
|
+
name: v,
|
|
14
|
+
className: m = "",
|
|
15
|
+
"data-testid": r
|
|
16
|
+
}) {
|
|
17
|
+
const [h, s] = V.useState(C || []), f = b !== void 0 ? b : h, t = {
|
|
18
|
+
value: f,
|
|
19
|
+
onChange: (x, e) => {
|
|
20
|
+
const n = e ? [...f, x] : f.filter((k) => k !== x);
|
|
21
|
+
b === void 0 && s(n), i?.(n);
|
|
22
|
+
},
|
|
23
|
+
disabled: d,
|
|
24
|
+
name: v
|
|
25
|
+
};
|
|
26
|
+
if (l) {
|
|
27
|
+
const x = o === "horizontal" ? "flex flex-row flex-wrap gap-4" : "flex flex-col gap-2";
|
|
28
|
+
return /* @__PURE__ */ c(R.Provider, { value: t, children: /* @__PURE__ */ c("div", { className: `${x} ${m}`.trim(), "data-testid": r, children: l.map((e) => {
|
|
29
|
+
if (typeof e == "string" || typeof e == "number") {
|
|
30
|
+
const n = r ? `${r}-option-${e}` : void 0;
|
|
31
|
+
return /* @__PURE__ */ g("label", { className: "flex items-center cursor-pointer gap-2", children: [
|
|
32
|
+
/* @__PURE__ */ c(y, { value: e, "data-testid": n }),
|
|
33
|
+
/* @__PURE__ */ c("span", { children: e })
|
|
34
|
+
] }, e);
|
|
35
|
+
} else {
|
|
36
|
+
const n = r ? `${r}-option-${e.value}` : void 0;
|
|
37
|
+
return /* @__PURE__ */ g("label", { className: "flex items-center cursor-pointer gap-2", children: [
|
|
38
|
+
/* @__PURE__ */ c(y, { value: e.value, disabled: e.disabled, "data-testid": n }),
|
|
39
|
+
/* @__PURE__ */ c("span", { children: e.label })
|
|
40
|
+
] }, e.value);
|
|
41
|
+
}
|
|
42
|
+
}) }) });
|
|
43
|
+
}
|
|
44
|
+
return /* @__PURE__ */ c(R.Provider, { value: t, children: /* @__PURE__ */ c("div", { className: m, children: u }) });
|
|
45
|
+
}
|
|
46
|
+
const y = G(
|
|
47
|
+
({
|
|
48
|
+
children: u,
|
|
49
|
+
size: b,
|
|
50
|
+
color: C,
|
|
51
|
+
indeterminate: i = !1,
|
|
52
|
+
swap: d,
|
|
53
|
+
className: l = "",
|
|
54
|
+
value: o,
|
|
55
|
+
checked: v,
|
|
56
|
+
onChange: m,
|
|
57
|
+
disabled: r,
|
|
58
|
+
...h
|
|
59
|
+
}, s) => {
|
|
60
|
+
const { componentSize: f } = B(), w = b ?? f ?? "md", t = O(R), x = {
|
|
61
|
+
xs: X,
|
|
62
|
+
sm: A,
|
|
63
|
+
md: D,
|
|
64
|
+
lg: E,
|
|
65
|
+
xl: F
|
|
66
|
+
}, e = {
|
|
67
|
+
primary: L,
|
|
68
|
+
secondary: M,
|
|
69
|
+
accent: W,
|
|
70
|
+
neutral: q,
|
|
71
|
+
success: H,
|
|
72
|
+
warning: I,
|
|
73
|
+
info: J,
|
|
74
|
+
error: K
|
|
75
|
+
}, n = [
|
|
76
|
+
T,
|
|
77
|
+
w && x[w],
|
|
78
|
+
C && e[C]
|
|
79
|
+
].filter(Boolean).join(" "), k = t?.name ?? h.name, S = i ? "mixed" : void 0, p = t && o !== void 0 && (typeof o == "string" || typeof o == "number") ? t.value?.includes(o) ?? !1 : v, N = t?.disabled || r, $ = (a) => {
|
|
80
|
+
t && o !== void 0 && (typeof o == "string" || typeof o == "number") && t.onChange?.(o, a.target.checked), m?.(a);
|
|
81
|
+
}, z = V.useCallback(
|
|
82
|
+
(a) => {
|
|
83
|
+
a && (a.indeterminate = i), typeof s == "function" ? s(a) : s && (s.current = a);
|
|
84
|
+
},
|
|
85
|
+
[i, s]
|
|
86
|
+
), j = i ? "indeterminate" : p ? "checked" : "unchecked";
|
|
87
|
+
if (d) {
|
|
88
|
+
const a = [
|
|
89
|
+
Q,
|
|
90
|
+
d.effect === "rotate" && U,
|
|
91
|
+
d.effect === "flip" && Y,
|
|
92
|
+
l
|
|
93
|
+
].filter(Boolean).join(" ");
|
|
94
|
+
return /* @__PURE__ */ g("label", { className: a, children: [
|
|
95
|
+
/* @__PURE__ */ c(
|
|
96
|
+
"input",
|
|
97
|
+
{
|
|
98
|
+
ref: s,
|
|
99
|
+
type: "checkbox",
|
|
100
|
+
name: k,
|
|
101
|
+
checked: p,
|
|
102
|
+
onChange: $,
|
|
103
|
+
disabled: N,
|
|
104
|
+
"aria-checked": S,
|
|
105
|
+
"data-state": j,
|
|
106
|
+
...h
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
/* @__PURE__ */ c("div", { className: Z, children: d.on }),
|
|
110
|
+
/* @__PURE__ */ c("div", { className: _, children: d.off })
|
|
111
|
+
] });
|
|
112
|
+
}
|
|
113
|
+
return u ? /* @__PURE__ */ g("label", { className: `flex items-center cursor-pointer gap-2 ${l}`.trim(), children: [
|
|
114
|
+
/* @__PURE__ */ c(
|
|
115
|
+
"input",
|
|
116
|
+
{
|
|
117
|
+
ref: z,
|
|
118
|
+
type: "checkbox",
|
|
119
|
+
className: n,
|
|
120
|
+
name: k,
|
|
121
|
+
value: o,
|
|
122
|
+
checked: p,
|
|
123
|
+
onChange: $,
|
|
124
|
+
disabled: N,
|
|
125
|
+
"aria-checked": S,
|
|
126
|
+
"data-state": j,
|
|
127
|
+
...h
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
/* @__PURE__ */ c("span", { children: u })
|
|
131
|
+
] }) : /* @__PURE__ */ c(
|
|
132
|
+
"input",
|
|
133
|
+
{
|
|
134
|
+
ref: z,
|
|
135
|
+
type: "checkbox",
|
|
136
|
+
className: `${n} ${l}`.trim(),
|
|
137
|
+
name: k,
|
|
138
|
+
value: o,
|
|
139
|
+
checked: p,
|
|
140
|
+
onChange: $,
|
|
141
|
+
disabled: N,
|
|
142
|
+
"aria-checked": S,
|
|
143
|
+
"data-state": j,
|
|
144
|
+
...h
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
y.displayName = "Checkbox";
|
|
150
|
+
const ne = Object.assign(y, {
|
|
151
|
+
Group: ee
|
|
152
|
+
});
|
|
153
|
+
export {
|
|
154
|
+
ne as Checkbox
|
|
155
|
+
};
|
|
156
|
+
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../src/components/Checkbox.tsx"],"sourcesContent":["import React, { forwardRef, createContext, useContext } from 'react'\nimport { useConfig } from './ConfigProvider'\n\n// DaisyUI classes\nconst dCheckbox = 'd-checkbox'\nconst dCheckboxXs = 'd-checkbox-xs'\nconst dCheckboxSm = 'd-checkbox-sm'\nconst dCheckboxMd = 'd-checkbox-md'\nconst dCheckboxLg = 'd-checkbox-lg'\nconst dCheckboxXl = 'd-checkbox-xl'\nconst dCheckboxPrimary = 'd-checkbox-primary'\nconst dCheckboxSecondary = 'd-checkbox-secondary'\nconst dCheckboxAccent = 'd-checkbox-accent'\nconst dCheckboxNeutral = 'd-checkbox-neutral'\nconst dCheckboxSuccess = 'd-checkbox-success'\nconst dCheckboxWarning = 'd-checkbox-warning'\nconst dCheckboxInfo = 'd-checkbox-info'\nconst dCheckboxError = 'd-checkbox-error'\nconst dSwap = 'd-swap'\nconst dSwapRotate = 'd-swap-rotate'\nconst dSwapFlip = 'd-swap-flip'\nconst dSwapOn = 'd-swap-on'\nconst dSwapOff = 'd-swap-off'\n\nexport interface CheckboxSwapConfig {\n /** Content shown when checked */\n on: React.ReactNode\n /** Content shown when unchecked */\n off: React.ReactNode\n /** Animation effect for the swap transition */\n effect?: 'rotate' | 'flip'\n}\n\nexport interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'type'> {\n children?: React.ReactNode\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n color?: 'primary' | 'secondary' | 'accent' | 'neutral' | 'success' | 'warning' | 'info' | 'error'\n indeterminate?: boolean\n /** Swap mode: toggle between two visual states instead of showing a checkbox */\n swap?: CheckboxSwapConfig\n className?: string\n}\n\nexport interface CheckboxOptionType {\n label: React.ReactNode\n value: string | number\n disabled?: boolean\n}\n\nexport interface CheckboxGroupProps {\n children?: React.ReactNode\n value?: (string | number)[]\n defaultValue?: (string | number)[]\n onChange?: (values: (string | number)[]) => void\n disabled?: boolean\n options?: (string | number | CheckboxOptionType)[]\n /** Layout direction for options */\n direction?: 'horizontal' | 'vertical'\n /** HTML name attribute for all checkboxes in the group (for form submission) */\n name?: string\n className?: string\n 'data-testid'?: string\n}\n\ninterface CheckboxGroupContextValue {\n value?: (string | number)[]\n onChange?: (checkedValue: string | number, checked: boolean) => void\n disabled?: boolean\n name?: string\n}\n\nconst CheckboxGroupContext = createContext<CheckboxGroupContextValue | null>(null)\n\nfunction CheckboxGroup({\n children,\n value,\n defaultValue,\n onChange,\n disabled = false,\n options,\n direction = 'vertical',\n name,\n className = '',\n 'data-testid': testId\n}: CheckboxGroupProps) {\n const [internalValue, setInternalValue] = React.useState<(string | number)[]>(defaultValue || [])\n const currentValue = value !== undefined ? value : internalValue\n\n const handleChange = (checkedValue: string | number, checked: boolean) => {\n const newValue = checked\n ? [...currentValue, checkedValue]\n : currentValue.filter((v) => v !== checkedValue)\n\n if (value === undefined) {\n setInternalValue(newValue)\n }\n onChange?.(newValue)\n }\n\n const contextValue: CheckboxGroupContextValue = {\n value: currentValue,\n onChange: handleChange,\n disabled,\n name,\n }\n\n // If options are provided, render checkboxes automatically\n if (options) {\n const directionClasses = direction === 'horizontal' ? 'flex flex-row flex-wrap gap-4' : 'flex flex-col gap-2'\n return (\n <CheckboxGroupContext.Provider value={contextValue}>\n <div className={`${directionClasses} ${className}`.trim()} data-testid={testId}>\n {options.map((option) => {\n if (typeof option === 'string' || typeof option === 'number') {\n const optionTestId = testId ? `${testId}-option-${option}` : undefined\n return (\n <label key={option} className=\"flex items-center cursor-pointer gap-2\">\n <CheckboxRoot value={option} data-testid={optionTestId} />\n <span>{option}</span>\n </label>\n )\n } else {\n const optionTestId = testId ? `${testId}-option-${option.value}` : undefined\n return (\n <label key={option.value} className=\"flex items-center cursor-pointer gap-2\">\n <CheckboxRoot value={option.value} disabled={option.disabled} data-testid={optionTestId} />\n <span>{option.label}</span>\n </label>\n )\n }\n })}\n </div>\n </CheckboxGroupContext.Provider>\n )\n }\n\n return (\n <CheckboxGroupContext.Provider value={contextValue}>\n <div className={className}>{children}</div>\n </CheckboxGroupContext.Provider>\n )\n}\n\nconst CheckboxRoot = forwardRef<HTMLInputElement, CheckboxProps>(\n (\n {\n children,\n size,\n color,\n indeterminate = false,\n swap,\n className = '',\n value,\n checked,\n onChange,\n disabled: disabledProp,\n ...props\n },\n ref\n ) => {\n const { componentSize } = useConfig()\n const effectiveSize = size ?? componentSize ?? 'md'\n const groupContext = useContext(CheckboxGroupContext)\n\n const sizeClasses = {\n xs: dCheckboxXs,\n sm: dCheckboxSm,\n md: dCheckboxMd,\n lg: dCheckboxLg,\n xl: dCheckboxXl,\n }\n\n const colorClasses = {\n primary: dCheckboxPrimary,\n secondary: dCheckboxSecondary,\n accent: dCheckboxAccent,\n neutral: dCheckboxNeutral,\n success: dCheckboxSuccess,\n warning: dCheckboxWarning,\n info: dCheckboxInfo,\n error: dCheckboxError,\n }\n\n const checkboxClasses = [\n dCheckbox,\n effectiveSize && sizeClasses[effectiveSize],\n color && colorClasses[color],\n ]\n .filter(Boolean)\n .join(' ')\n\n // Get name from group context or props\n const inputName = groupContext?.name ?? props.name\n\n // aria-checked should be \"mixed\" for indeterminate state\n const ariaChecked = indeterminate ? 'mixed' : undefined\n\n // If in a group, use group's value to determine checked state\n const isChecked = groupContext && value !== undefined && (typeof value === 'string' || typeof value === 'number')\n ? groupContext.value?.includes(value) ?? false\n : checked\n\n const isDisabled = groupContext?.disabled || disabledProp\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (groupContext && value !== undefined && (typeof value === 'string' || typeof value === 'number')) {\n groupContext.onChange?.(value, e.target.checked)\n }\n onChange?.(e)\n }\n\n // Handle indeterminate state\n const checkboxRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n if (node) {\n node.indeterminate = indeterminate\n }\n if (typeof ref === 'function') {\n ref(node)\n } else if (ref) {\n ref.current = node\n }\n },\n [indeterminate, ref]\n )\n\n const dataState = indeterminate ? 'indeterminate' : isChecked ? 'checked' : 'unchecked'\n\n // Swap mode: render as a swap toggle instead of checkbox\n if (swap) {\n const swapClasses = [\n dSwap,\n swap.effect === 'rotate' && dSwapRotate,\n swap.effect === 'flip' && dSwapFlip,\n className,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <label className={swapClasses}>\n <input\n ref={ref}\n type=\"checkbox\"\n name={inputName}\n checked={isChecked}\n onChange={handleChange}\n disabled={isDisabled}\n aria-checked={ariaChecked}\n data-state={dataState}\n {...props}\n />\n <div className={dSwapOn}>{swap.on}</div>\n <div className={dSwapOff}>{swap.off}</div>\n </label>\n )\n }\n\n // If children provided, wrap in label\n if (children) {\n return (\n <label className={`flex items-center cursor-pointer gap-2 ${className}`.trim()}>\n <input\n ref={checkboxRef}\n type=\"checkbox\"\n className={checkboxClasses}\n name={inputName}\n value={value}\n checked={isChecked}\n onChange={handleChange}\n disabled={isDisabled}\n aria-checked={ariaChecked}\n data-state={dataState}\n {...props}\n />\n <span>{children}</span>\n </label>\n )\n }\n\n // Bare checkbox input (no children, no swap)\n return (\n <input\n ref={checkboxRef}\n type=\"checkbox\"\n className={`${checkboxClasses} ${className}`.trim()}\n name={inputName}\n value={value}\n checked={isChecked}\n onChange={handleChange}\n disabled={isDisabled}\n aria-checked={ariaChecked}\n data-state={dataState}\n {...props}\n />\n )\n }\n)\n\nCheckboxRoot.displayName = 'Checkbox'\n\nexport const Checkbox = Object.assign(CheckboxRoot, {\n Group: CheckboxGroup,\n})\n"],"names":["dCheckbox","dCheckboxXs","dCheckboxSm","dCheckboxMd","dCheckboxLg","dCheckboxXl","dCheckboxPrimary","dCheckboxSecondary","dCheckboxAccent","dCheckboxNeutral","dCheckboxSuccess","dCheckboxWarning","dCheckboxInfo","dCheckboxError","dSwap","dSwapRotate","dSwapFlip","dSwapOn","dSwapOff","CheckboxGroupContext","createContext","CheckboxGroup","children","value","defaultValue","onChange","disabled","options","direction","name","className","testId","internalValue","setInternalValue","React","currentValue","contextValue","checkedValue","checked","newValue","v","directionClasses","jsx","option","optionTestId","jsxs","CheckboxRoot","forwardRef","size","color","indeterminate","swap","disabledProp","props","ref","componentSize","useConfig","effectiveSize","groupContext","useContext","sizeClasses","colorClasses","checkboxClasses","inputName","ariaChecked","isChecked","isDisabled","handleChange","e","checkboxRef","node","dataState","swapClasses","Checkbox"],"mappings":";;;AAIA,MAAMA,IAAY,cACZC,IAAc,iBACdC,IAAc,iBACdC,IAAc,iBACdC,IAAc,iBACdC,IAAc,iBACdC,IAAmB,sBACnBC,IAAqB,wBACrBC,IAAkB,qBAClBC,IAAmB,sBACnBC,IAAmB,sBACnBC,IAAmB,sBACnBC,IAAgB,mBAChBC,IAAiB,oBACjBC,IAAQ,UACRC,IAAc,iBACdC,IAAY,eACZC,IAAU,aACVC,IAAW,cAiDXC,IAAuBC,EAAgD,IAAI;AAEjF,SAASC,GAAc;AAAA,EACrB,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,SAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,MAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,eAAeC;AACjB,GAAuB;AACrB,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAM,SAA8BV,KAAgB,EAAE,GAC1FW,IAAeZ,MAAU,SAAYA,IAAQS,GAa7CI,IAA0C;AAAA,IAC9C,OAAOD;AAAA,IACP,UAbmB,CAACE,GAA+BC,MAAqB;AACxE,YAAMC,IAAWD,IACb,CAAC,GAAGH,GAAcE,CAAY,IAC9BF,EAAa,OAAO,CAACK,MAAMA,MAAMH,CAAY;AAEjD,MAAId,MAAU,UACZU,EAAiBM,CAAQ,GAE3Bd,IAAWc,CAAQ;AAAA,IACrB;AAAA,IAKE,UAAAb;AAAA,IACA,MAAA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KAAK2B;AAAA,QACL,MAAK;AAAA,QACL,WAAW,GAAGP,CAAe,IAAIhC,CAAS,GAAG,KAAA;AAAA,QAC7C,MAAMiC;AAAA,QACN,OAAAxC;AAAA,QACA,SAAS0C;AAAA,QACT,UAAUE;AAAA,QACV,UAAUD;AAAA,QACV,gBAAcF;AAAA,QACd,cAAYO;AAAA,QACX,GAAGlB;AAAA,MAAA;AAAA,IAAA;AAAA,EAGV;AACF;AAEAP,EAAa,cAAc;AAEpB,MAAM2B,KAAW,OAAO,OAAO3B,GAAc;AAAA,EAClD,OAAOzB;AACT,CAAC;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface CodeLineProps extends React.HTMLAttributes<HTMLPreElement> {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
prefix?: string;
|
|
5
|
+
highlight?: boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const Line: React.FC<CodeLineProps>;
|
|
8
|
+
export interface CodeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
/** Show copy button. Pass true to auto-extract text, or a string to specify custom copy text */
|
|
11
|
+
copyable?: boolean | string;
|
|
12
|
+
}
|
|
13
|
+
export declare const Code: React.FC<CodeProps> & {
|
|
14
|
+
Line: typeof Line;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsxs as c, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import p from "react";
|
|
3
|
+
import { CopyButton as l } from "./CopyButton.js";
|
|
4
|
+
const d = "d-mockup-code", a = ({
|
|
5
|
+
children: e,
|
|
6
|
+
prefix: o = "$",
|
|
7
|
+
highlight: t = !1,
|
|
8
|
+
className: n = "",
|
|
9
|
+
...i
|
|
10
|
+
}) => /* @__PURE__ */ r(
|
|
11
|
+
"pre",
|
|
12
|
+
{
|
|
13
|
+
"data-prefix": o,
|
|
14
|
+
className: `${t ? "bg-warning text-warning-content" : ""} ${n}`,
|
|
15
|
+
...i,
|
|
16
|
+
children: /* @__PURE__ */ r("code", { children: e })
|
|
17
|
+
}
|
|
18
|
+
), f = (e) => {
|
|
19
|
+
const o = [];
|
|
20
|
+
return p.Children.forEach(e, (t) => {
|
|
21
|
+
if (p.isValidElement(t) && t.props?.children) {
|
|
22
|
+
const n = typeof t.props.children == "string" ? t.props.children : "";
|
|
23
|
+
n && o.push(n);
|
|
24
|
+
}
|
|
25
|
+
}), o.join(`
|
|
26
|
+
`);
|
|
27
|
+
}, m = ({
|
|
28
|
+
children: e,
|
|
29
|
+
className: o = "",
|
|
30
|
+
copyable: t,
|
|
31
|
+
style: n,
|
|
32
|
+
...i
|
|
33
|
+
}) => {
|
|
34
|
+
const s = typeof t == "string" ? t : t ? f(e) : null;
|
|
35
|
+
return /* @__PURE__ */ c(
|
|
36
|
+
"div",
|
|
37
|
+
{
|
|
38
|
+
className: `${d} ${o}`,
|
|
39
|
+
style: { position: "relative", overflow: "hidden", ...n },
|
|
40
|
+
...i,
|
|
41
|
+
children: [
|
|
42
|
+
e,
|
|
43
|
+
s !== null && /* @__PURE__ */ r("div", { style: { position: "absolute", top: 8, right: 8 }, children: /* @__PURE__ */ r(
|
|
44
|
+
l,
|
|
45
|
+
{
|
|
46
|
+
text: s,
|
|
47
|
+
size: "xs",
|
|
48
|
+
variant: "ghost",
|
|
49
|
+
showTooltip: !0
|
|
50
|
+
}
|
|
51
|
+
) })
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
m.Line = a;
|
|
57
|
+
export {
|
|
58
|
+
m as Code
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=Code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Code.js","sources":["../../src/components/Code.tsx"],"sourcesContent":["import React from 'react'\nimport { CopyButton } from './CopyButton'\n\n// DaisyUI classes\nconst dMockupCode = 'd-mockup-code'\n\nexport interface CodeLineProps extends React.HTMLAttributes<HTMLPreElement> {\n children: React.ReactNode\n prefix?: string\n highlight?: boolean\n}\n\nconst Line: React.FC<CodeLineProps> = ({\n children,\n prefix = '$',\n highlight = false,\n className = '',\n ...rest\n}) => {\n return (\n <pre\n data-prefix={prefix}\n className={`${highlight ? 'bg-warning text-warning-content' : ''} ${className}`}\n {...rest}\n >\n <code>{children}</code>\n </pre>\n )\n}\n\nexport interface CodeProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n /** Show copy button. Pass true to auto-extract text, or a string to specify custom copy text */\n copyable?: boolean | string\n}\n\nconst extractTextFromChildren = (children: React.ReactNode): string => {\n const lines: string[] = []\n React.Children.forEach(children, (child) => {\n if (React.isValidElement<{ children?: React.ReactNode }>(child) && child.props?.children) {\n const text = typeof child.props.children === 'string'\n ? child.props.children\n : ''\n if (text) lines.push(text)\n }\n })\n return lines.join('\\n')\n}\n\nexport const Code: React.FC<CodeProps> & { Line: typeof Line } = ({\n children,\n className = '',\n copyable,\n style,\n ...rest\n}) => {\n const copyText = typeof copyable === 'string'\n ? copyable\n : copyable\n ? extractTextFromChildren(children)\n : null\n\n return (\n <div\n className={`${dMockupCode} ${className}`}\n style={{ position: 'relative', overflow: 'hidden', ...style }}\n {...rest}\n >\n {children}\n {copyText !== null && (\n <div style={{ position: 'absolute', top: 8, right: 8 }}>\n <CopyButton\n text={copyText}\n size=\"xs\"\n variant=\"ghost\"\n showTooltip\n />\n </div>\n )}\n </div>\n )\n}\n\nCode.Line = Line\n"],"names":["dMockupCode","Line","children","prefix","highlight","className","rest","jsx","extractTextFromChildren","lines","React","child","text","Code","copyable","style","copyText","jsxs","CopyButton"],"mappings":";;;AAIA,MAAMA,IAAc,iBAQdC,IAAgC,CAAC;AAAA,EACrC,UAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,WAAAC,IAAY;AAAA,EACZ,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAEI,gBA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AIR;AAEAH,EAAK,OAAOZ;"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type CollapseSize = 'sm' | 'md' | 'lg';
|
|
3
|
+
export type CollapseIconPosition = 'start' | 'end';
|
|
4
|
+
export type CollapseCollapsible = 'header' | 'icon' | 'disabled';
|
|
5
|
+
export interface CollapseItemType {
|
|
6
|
+
/** Unique key for the panel */
|
|
7
|
+
key: string | number;
|
|
8
|
+
/** Panel header/label */
|
|
9
|
+
label: React.ReactNode;
|
|
10
|
+
/** Panel content */
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/** Extra element in the corner */
|
|
13
|
+
extra?: React.ReactNode;
|
|
14
|
+
/** Whether to show the arrow icon */
|
|
15
|
+
showArrow?: boolean;
|
|
16
|
+
/** Collapsible mode for this panel */
|
|
17
|
+
collapsible?: CollapseCollapsible;
|
|
18
|
+
/** Custom class name for this panel */
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface CollapseProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
22
|
+
/** Collapse items */
|
|
23
|
+
items?: CollapseItemType[];
|
|
24
|
+
/** Currently active panel keys (controlled) */
|
|
25
|
+
activeKey?: string | number | (string | number)[];
|
|
26
|
+
/** Default active panel keys (uncontrolled) */
|
|
27
|
+
defaultActiveKey?: string | number | (string | number)[];
|
|
28
|
+
/** Accordion mode - only one panel open at a time */
|
|
29
|
+
accordion?: boolean;
|
|
30
|
+
/** Show border around panels */
|
|
31
|
+
bordered?: boolean;
|
|
32
|
+
/** Ghost mode - transparent background */
|
|
33
|
+
ghost?: boolean;
|
|
34
|
+
/** Size variant */
|
|
35
|
+
size?: CollapseSize;
|
|
36
|
+
/** Icon type */
|
|
37
|
+
icon?: 'arrow' | 'plus' | 'none';
|
|
38
|
+
/** Icon placement */
|
|
39
|
+
expandIconPlacement?: CollapseIconPosition;
|
|
40
|
+
/** Callback when panels change */
|
|
41
|
+
onChange?: (activeKey: (string | number)[]) => void;
|
|
42
|
+
/** Test ID */
|
|
43
|
+
'data-testid'?: string;
|
|
44
|
+
}
|
|
45
|
+
export declare const Collapse: React.ForwardRefExoticComponent<CollapseProps & React.RefAttributes<HTMLDivElement>>;
|