@xanui/ui 1.2.8 → 1.2.11
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/Accordion/index.cjs +5 -5
- package/Accordion/index.cjs.map +1 -1
- package/Accordion/index.d.ts +1 -0
- package/Accordion/index.js +5 -5
- package/Accordion/index.js.map +1 -1
- package/Alert/index.cjs +8 -8
- package/Alert/index.cjs.map +1 -1
- package/Alert/index.js +8 -8
- package/Alert/index.js.map +1 -1
- package/Autocomplete/index.cjs +2 -2
- package/Autocomplete/index.cjs.map +1 -1
- package/Autocomplete/index.d.ts +1 -1
- package/Autocomplete/index.js +2 -2
- package/Autocomplete/index.js.map +1 -1
- package/Avatar/index.cjs +2 -2
- package/Avatar/index.cjs.map +1 -1
- package/Avatar/index.js +2 -2
- package/Avatar/index.js.map +1 -1
- package/AvatarBox/index.cjs +1 -1
- package/AvatarBox/index.cjs.map +1 -1
- package/AvatarBox/index.js +1 -1
- package/AvatarBox/index.js.map +1 -1
- package/AvatarPicker/index.cjs +3 -3
- package/AvatarPicker/index.cjs.map +1 -1
- package/AvatarPicker/index.d.ts +1 -1
- package/AvatarPicker/index.js +3 -3
- package/AvatarPicker/index.js.map +1 -1
- package/Badge/index.cjs +1 -1
- package/Badge/index.cjs.map +1 -1
- package/Badge/index.js +1 -1
- package/Badge/index.js.map +1 -1
- package/Button/index.cjs +1 -1
- package/Button/index.cjs.map +1 -1
- package/Button/index.js +1 -1
- package/Button/index.js.map +1 -1
- package/ButtonGroup/index.cjs +1 -1
- package/ButtonGroup/index.cjs.map +1 -1
- package/ButtonGroup/index.js +1 -1
- package/ButtonGroup/index.js.map +1 -1
- package/Calendar/index.cjs +9 -9
- package/Calendar/index.cjs.map +1 -1
- package/Calendar/index.js +9 -9
- package/Calendar/index.js.map +1 -1
- package/CalendarInput/index.cjs +1 -1
- package/CalendarInput/index.cjs.map +1 -1
- package/CalendarInput/index.js +1 -1
- package/CalendarInput/index.js.map +1 -1
- package/Card/index.cjs +4 -4
- package/Card/index.cjs.map +1 -1
- package/Card/index.d.ts +1 -1
- package/Card/index.js +4 -4
- package/Card/index.js.map +1 -1
- package/Checkbox/index.cjs +1 -1
- package/Checkbox/index.cjs.map +1 -1
- package/Checkbox/index.js +1 -1
- package/Checkbox/index.js.map +1 -1
- package/CircleProgress/index.cjs +7 -7
- package/CircleProgress/index.cjs.map +1 -1
- package/CircleProgress/index.js +7 -7
- package/CircleProgress/index.js.map +1 -1
- package/DataFilter/options/DateFilter.cjs +2 -2
- package/DataFilter/options/DateFilter.cjs.map +1 -1
- package/DataFilter/options/DateFilter.js +2 -2
- package/DataFilter/options/DateFilter.js.map +1 -1
- package/DataFilter/options/DateRangeFilter.cjs +1 -1
- package/DataFilter/options/DateRangeFilter.cjs.map +1 -1
- package/DataFilter/options/DateRangeFilter.js +1 -1
- package/DataFilter/options/DateRangeFilter.js.map +1 -1
- package/DataFilter/options/MultiSelectFilter.cjs +2 -2
- package/DataFilter/options/MultiSelectFilter.cjs.map +1 -1
- package/DataFilter/options/MultiSelectFilter.js +2 -2
- package/DataFilter/options/MultiSelectFilter.js.map +1 -1
- package/DataFilter/options/NumberFilter.cjs +1 -1
- package/DataFilter/options/NumberFilter.cjs.map +1 -1
- package/DataFilter/options/NumberFilter.js +1 -1
- package/DataFilter/options/NumberFilter.js.map +1 -1
- package/DataFilter/options/NumberRangeFilter.cjs +1 -1
- package/DataFilter/options/NumberRangeFilter.cjs.map +1 -1
- package/DataFilter/options/NumberRangeFilter.js +1 -1
- package/DataFilter/options/NumberRangeFilter.js.map +1 -1
- package/DataFilter/options/SelectFilter.cjs +2 -2
- package/DataFilter/options/SelectFilter.cjs.map +1 -1
- package/DataFilter/options/SelectFilter.js +2 -2
- package/DataFilter/options/SelectFilter.js.map +1 -1
- package/DataFilter/options/TextFilter.cjs +1 -1
- package/DataFilter/options/TextFilter.cjs.map +1 -1
- package/DataFilter/options/TextFilter.js +1 -1
- package/DataFilter/options/TextFilter.js.map +1 -1
- package/Datatable/FilterBox.cjs +2 -2
- package/Datatable/FilterBox.cjs.map +1 -1
- package/Datatable/FilterBox.js +2 -2
- package/Datatable/FilterBox.js.map +1 -1
- package/Datatable/Row.cjs +1 -1
- package/Datatable/Row.cjs.map +1 -1
- package/Datatable/Row.js +1 -1
- package/Datatable/Row.js.map +1 -1
- package/Datatable/SelectedBox.cjs +1 -1
- package/Datatable/SelectedBox.cjs.map +1 -1
- package/Datatable/SelectedBox.js +1 -1
- package/Datatable/SelectedBox.js.map +1 -1
- package/Datatable/Table.cjs +1 -1
- package/Datatable/Table.cjs.map +1 -1
- package/Datatable/Table.js +1 -1
- package/Datatable/Table.js.map +1 -1
- package/Datatable/TableHead.cjs +3 -3
- package/Datatable/TableHead.cjs.map +1 -1
- package/Datatable/TableHead.js +3 -3
- package/Datatable/TableHead.js.map +1 -1
- package/Datatable/index.cjs +1 -1
- package/Datatable/index.cjs.map +1 -1
- package/Datatable/index.js +1 -1
- package/Datatable/index.js.map +1 -1
- package/Divider/index.cjs +3 -3
- package/Divider/index.cjs.map +1 -1
- package/Divider/index.js +3 -3
- package/Divider/index.js.map +1 -1
- package/Drawer/index.cjs +1 -1
- package/Drawer/index.cjs.map +1 -1
- package/Drawer/index.js +1 -1
- package/Drawer/index.js.map +1 -1
- package/FilePicker/index.d.ts +1 -1
- package/Form/index.cjs +1 -1
- package/Form/index.cjs.map +1 -1
- package/Form/index.js +1 -1
- package/Form/index.js.map +1 -1
- package/GalleryPicker/index.cjs +5 -5
- package/GalleryPicker/index.cjs.map +1 -1
- package/GalleryPicker/index.d.ts +1 -1
- package/GalleryPicker/index.js +5 -5
- package/GalleryPicker/index.js.map +1 -1
- package/Input/index.cjs +7 -7
- package/Input/index.cjs.map +1 -1
- package/Input/index.d.ts +1 -1
- package/Input/index.js +7 -7
- package/Input/index.js.map +1 -1
- package/Label/index.cjs +1 -1
- package/Label/index.cjs.map +1 -1
- package/Label/index.js +1 -1
- package/Label/index.js.map +1 -1
- package/LineProgress/index.cjs +2 -2
- package/LineProgress/index.cjs.map +1 -1
- package/LineProgress/index.js +2 -2
- package/LineProgress/index.js.map +1 -1
- package/ListItem/index.cjs +2 -2
- package/ListItem/index.cjs.map +1 -1
- package/ListItem/index.js +2 -2
- package/ListItem/index.js.map +1 -1
- package/Menu/index.cjs +1 -1
- package/Menu/index.cjs.map +1 -1
- package/Menu/index.js +1 -1
- package/Menu/index.js.map +1 -1
- package/Modal/index.cjs +1 -1
- package/Modal/index.cjs.map +1 -1
- package/Modal/index.js +1 -1
- package/Modal/index.js.map +1 -1
- package/PasswordInput/index.cjs +1 -1
- package/PasswordInput/index.cjs.map +1 -1
- package/PasswordInput/index.js +1 -1
- package/PasswordInput/index.js.map +1 -1
- package/RangeSlider/index.cjs +2 -2
- package/RangeSlider/index.cjs.map +1 -1
- package/RangeSlider/index.js +2 -2
- package/RangeSlider/index.js.map +1 -1
- package/Skeleton/index.cjs +1 -1
- package/Skeleton/index.cjs.map +1 -1
- package/Skeleton/index.js +1 -1
- package/Skeleton/index.js.map +1 -1
- package/Switch/index.cjs +1 -1
- package/Switch/index.cjs.map +1 -1
- package/Switch/index.d.ts +1 -1
- package/Switch/index.js +1 -1
- package/Switch/index.js.map +1 -1
- package/Tab/index.cjs +1 -1
- package/Tab/index.cjs.map +1 -1
- package/Tab/index.js +1 -1
- package/Tab/index.js.map +1 -1
- package/Table/index.cjs +4 -4
- package/Table/index.cjs.map +1 -1
- package/Table/index.js +4 -4
- package/Table/index.js.map +1 -1
- package/TableCell/index.cjs +1 -1
- package/TableCell/index.cjs.map +1 -1
- package/TableCell/index.js +1 -1
- package/TableCell/index.js.map +1 -1
- package/TablePagination/index.cjs +2 -2
- package/TablePagination/index.cjs.map +1 -1
- package/TablePagination/index.js +2 -2
- package/TablePagination/index.js.map +1 -1
- package/Tabs/index.cjs +1 -1
- package/Tabs/index.cjs.map +1 -1
- package/Tabs/index.js +1 -1
- package/Tabs/index.js.map +1 -1
- package/Text/index.cjs +1 -1
- package/Text/index.cjs.map +1 -1
- package/Text/index.js +1 -1
- package/Text/index.js.map +1 -1
- package/Tooltip/index.cjs +2 -2
- package/Tooltip/index.cjs.map +1 -1
- package/Tooltip/index.js +2 -2
- package/Tooltip/index.js.map +1 -1
- package/package.json +2 -2
- package/readme.md +4 -4
- package/useBlurCss/index.cjs +1 -1
- package/useBlurCss/index.cjs.map +1 -1
- package/useBlurCss/index.js +1 -1
- package/useBlurCss/index.js.map +1 -1
- package/useContextMenu/index.cjs +1 -1
- package/useContextMenu/index.cjs.map +1 -1
- package/useContextMenu/index.js +1 -1
- package/useContextMenu/index.js.map +1 -1
package/readme.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Xanui Library
|
|
2
2
|
|
|
3
|
-
Xanui is a React design-system toolkit powered by `@xanui/core`. It combines low-level primitives (e.g., `Box`, `Stack`, `Layer`) with application-ready components (e.g., `Accordion`, `Modal`, `Datatable`, `Toast`) so product teams can build polished
|
|
3
|
+
Xanui is a React design-system toolkit powered by `@xanui/core`. It combines low-level primitives (e.g., `Box`, `Stack`, `Layer`) with application-ready components (e.g., `Accordion`, `Modal`, `Datatable`, `Toast`) so product teams can build polished defaults quickly while keeping full control over styling tokens.
|
|
4
4
|
|
|
5
5
|
## Highlights
|
|
6
6
|
|
|
7
|
-
- **Unified prop
|
|
7
|
+
- **Unified prop default** – every component extends the `Tag` API, so spacing, layout, breakpoints, and system tokens behave identically across the library.
|
|
8
8
|
- **Production-ready defaults** – the color palette, typography scale, shadows, and radii mirror modern SaaS expectations yet remain overridable.
|
|
9
9
|
- **Server compatible** – SSR-safe patterns ensure components render on the server and hydrate cleanly on the client.
|
|
10
10
|
- **Documentation first** – each component ships with a dedicated Markdown guide in `docs/`, ready for consumption by the upcoming Next.js documentation site.
|
|
@@ -65,7 +65,7 @@ npm run dev
|
|
|
65
65
|
|
|
66
66
|
| Category | Components | Docs |
|
|
67
67
|
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
68
|
-
| Layout &
|
|
68
|
+
| Layout & defaults | Box, Stack, Container, GridContainer, GridItem, Paper, Layer, ViewBox, Divider | `docs/Box.md`, `docs/Stack.md`, `docs/Container.md`, `docs/GridContainer.md`, `docs/GridItem.md`, `docs/Paper.md`, `docs/Layer.md`, `docs/ViewBox.md`, `docs/Divider.md` |
|
|
69
69
|
| Navigation | Tabs, Tab, List, ListItem, Menu, Drawer | `docs/Tabs.md`, `docs/Tab.md`, `docs/List.md`, `docs/ListItem.md`, `docs/Menu.md`, `docs/Drawer.md` |
|
|
70
70
|
| Data Display | Table (and TableBody/TableCell/TableFooter/TableHead/TablePagination/TableRow), Datatable, Chip, Avatar, Image, Badge, CircleProgress, LineProgress, LoadingBox | `docs/Table*.md`, `docs/Datatable.md`, `docs/Chip.md`, `docs/Avatar.md`, `docs/Image.md`, `docs/Badge.md`, `docs/CircleProgress.md`, `docs/LineProgress.md`, `docs/LoadingBox.md` |
|
|
71
71
|
| Inputs & Forms | Button, ButtonGroup, IconButton, Form, Input, Select, Option, Checkbox, Radio, Switch, Calendar, CalendarInput, Label | `docs/Button.md`, `docs/ButtonGroup.md`, `docs/IconButton.md`, `docs/Form.md`, `docs/Input.md`, `docs/Select.md`, `docs/Option.md`, `docs/Checkbox.md`, `docs/Radio.md`, `docs/Switch.md`, `docs/Calendar.md`, `docs/CalendarInput.md`, `docs/Label.md` |
|
|
@@ -94,7 +94,7 @@ The development workflow encourages updating `docs/` alongside the corresponding
|
|
|
94
94
|
|
|
95
95
|
Guidelines:
|
|
96
96
|
|
|
97
|
-
- Keep new components aligned with the `TagProps`
|
|
97
|
+
- Keep new components aligned with the `TagProps` default (spacing, layout, color tokens, responsive props).
|
|
98
98
|
- Provide at least one example in `example/` when adding new UI patterns.
|
|
99
99
|
- Maintain the established documentation structure (overview, basic example, props table, scenario demos).
|
|
100
100
|
|
package/useBlurCss/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@ var React = require('react');
|
|
|
6
6
|
let _d;
|
|
7
7
|
const useBlurCss = (blur, mode) => {
|
|
8
8
|
return React.useMemo(() => {
|
|
9
|
-
let transparent = { bgcolor: "
|
|
9
|
+
let transparent = { bgcolor: "default.ghost" };
|
|
10
10
|
if (typeof window === 'undefined' || mode === 'transparent') {
|
|
11
11
|
return transparent;
|
|
12
12
|
}
|
package/useBlurCss/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/useBlurCss/index.tsx"],"sourcesContent":["\"use client\"\nimport { useMemo } from \"react\"\n\nlet _d: CSSStyleDeclaration;\n\nconst useBlurCss = (blur: number, mode?: \"transparent\" | \"blur\") => {\n return useMemo(() => {\n let transparent = { bgcolor: \"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/useBlurCss/index.tsx"],"sourcesContent":["\"use client\"\nimport { useMemo } from \"react\"\n\nlet _d: CSSStyleDeclaration;\n\nconst useBlurCss = (blur: number, mode?: \"transparent\" | \"blur\") => {\n return useMemo(() => {\n let transparent = { bgcolor: \"default.ghost\" }\n if (typeof window === 'undefined' || mode === 'transparent') {\n return transparent\n }\n const d = _d || (_d = window.document.createElement(\"div\").style)\n return d['backdropFilter'] !== undefined ? { backdropFilter: `blur(${(blur / 100) * 10}px)` } : transparent\n }, [blur])\n}\n\n\nexport default useBlurCss"],"names":[],"mappings":";;;;;AAGA;AAEA;;AAEM;;AAEG;;AAEH;;AAEH;AACH;;"}
|
package/useBlurCss/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { useMemo } from 'react';
|
|
|
4
4
|
let _d;
|
|
5
5
|
const useBlurCss = (blur, mode) => {
|
|
6
6
|
return useMemo(() => {
|
|
7
|
-
let transparent = { bgcolor: "
|
|
7
|
+
let transparent = { bgcolor: "default.ghost" };
|
|
8
8
|
if (typeof window === 'undefined' || mode === 'transparent') {
|
|
9
9
|
return transparent;
|
|
10
10
|
}
|
package/useBlurCss/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/useBlurCss/index.tsx"],"sourcesContent":["\"use client\"\nimport { useMemo } from \"react\"\n\nlet _d: CSSStyleDeclaration;\n\nconst useBlurCss = (blur: number, mode?: \"transparent\" | \"blur\") => {\n return useMemo(() => {\n let transparent = { bgcolor: \"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/useBlurCss/index.tsx"],"sourcesContent":["\"use client\"\nimport { useMemo } from \"react\"\n\nlet _d: CSSStyleDeclaration;\n\nconst useBlurCss = (blur: number, mode?: \"transparent\" | \"blur\") => {\n return useMemo(() => {\n let transparent = { bgcolor: \"default.ghost\" }\n if (typeof window === 'undefined' || mode === 'transparent') {\n return transparent\n }\n const d = _d || (_d = window.document.createElement(\"div\").style)\n return d['backdropFilter'] !== undefined ? { backdropFilter: `blur(${(blur / 100) * 10}px)` } : transparent\n }, [blur])\n}\n\n\nexport default useBlurCss"],"names":[],"mappings":";;;AAGA;AAEA;;AAEM;;AAEG;;AAEH;;AAEH;AACH;;"}
|
package/useContextMenu/index.cjs
CHANGED
|
@@ -18,7 +18,7 @@ const useContextMenu = (_a) => {
|
|
|
18
18
|
core.Renderar.unrender(Comp);
|
|
19
19
|
};
|
|
20
20
|
}, []);
|
|
21
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(core.Tag, { baseClass: "context-menu-target", ref: ref, position: "fixed", top: y, left: x, zIndex: 99999999999999, bgcolor: "
|
|
21
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(core.Tag, { baseClass: "context-menu-target", ref: ref, position: "fixed", top: y, left: x, zIndex: 99999999999999, bgcolor: "default.base", height: 0, width: 0 }), jsxRuntime.jsx(index, Object.assign({}, props, { target: target, onClickOutside: (e) => {
|
|
22
22
|
core.Renderar.unrender(Comp);
|
|
23
23
|
onClickOutside && onClickOutside(e);
|
|
24
24
|
}, children: children }))] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/useContextMenu/index.tsx"],"sourcesContent":["\"use client\"\nimport { Renderar, Tag, TagComponentType } from \"@xanui/core\"\nimport { useEffect, useRef, useState } from \"react\"\nimport Menu, { MenuProps } from \"../Menu\"\n\n\nconst useContextMenu = ({ children, onExited, onClickOutside, ...props }: MenuProps) => {\n\n const Comp = ({ x, y }: any) => {\n const ref = useRef(null)\n const [target, setTarget] = useState<any>()\n\n useEffect(() => {\n setTarget(ref.current)\n return () => {\n Renderar.unrender(Comp)\n }\n }, [])\n\n return (\n <>\n <Tag\n baseClass=\"context-menu-target\"\n ref={ref}\n position={\"fixed\"}\n top={y}\n left={x}\n zIndex={99999999999999}\n bgcolor=\"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/useContextMenu/index.tsx"],"sourcesContent":["\"use client\"\nimport { Renderar, Tag, TagComponentType } from \"@xanui/core\"\nimport { useEffect, useRef, useState } from \"react\"\nimport Menu, { MenuProps } from \"../Menu\"\n\n\nconst useContextMenu = ({ children, onExited, onClickOutside, ...props }: MenuProps) => {\n\n const Comp = ({ x, y }: any) => {\n const ref = useRef(null)\n const [target, setTarget] = useState<any>()\n\n useEffect(() => {\n setTarget(ref.current)\n return () => {\n Renderar.unrender(Comp)\n }\n }, [])\n\n return (\n <>\n <Tag\n baseClass=\"context-menu-target\"\n ref={ref}\n position={\"fixed\"}\n top={y}\n left={x}\n zIndex={99999999999999}\n bgcolor=\"default.base\"\n height={0}\n width={0}\n />\n <Menu\n {...props}\n target={target!}\n onClickOutside={(e) => {\n Renderar.unrender(Comp)\n onClickOutside && onClickOutside(e)\n }}\n >\n {children}\n </Menu>\n </>\n )\n }\n\n const onContextMenu = (e: React.MouseEvent<TagComponentType, MouseEvent>) => {\n e.preventDefault()\n Renderar.render(Comp, {\n x: e.pageX,\n y: e.pageY,\n open: true,\n })\n }\n\n onContextMenu.close = () => {\n Renderar.unrender(Comp)\n }\n\n return onContextMenu\n}\n\nexport default useContextMenu"],"names":[],"mappings":";;;;;;;;;AAMA;;;AAGM;;;AAIG;AACA;AACG;AACH;;;AAoBS;AACA;AACH;AAMZ;AAEA;;AAEG;;;AAGG;AACF;AACJ;AAEA;AACG;AACH;AAEA;AACH;;"}
|
package/useContextMenu/index.js
CHANGED
|
@@ -16,7 +16,7 @@ const useContextMenu = (_a) => {
|
|
|
16
16
|
Renderar.unrender(Comp);
|
|
17
17
|
};
|
|
18
18
|
}, []);
|
|
19
|
-
return (jsxs(Fragment, { children: [jsx(Tag, { baseClass: "context-menu-target", ref: ref, position: "fixed", top: y, left: x, zIndex: 99999999999999, bgcolor: "
|
|
19
|
+
return (jsxs(Fragment, { children: [jsx(Tag, { baseClass: "context-menu-target", ref: ref, position: "fixed", top: y, left: x, zIndex: 99999999999999, bgcolor: "default.base", height: 0, width: 0 }), jsx(Menu, Object.assign({}, props, { target: target, onClickOutside: (e) => {
|
|
20
20
|
Renderar.unrender(Comp);
|
|
21
21
|
onClickOutside && onClickOutside(e);
|
|
22
22
|
}, children: children }))] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/useContextMenu/index.tsx"],"sourcesContent":["\"use client\"\nimport { Renderar, Tag, TagComponentType } from \"@xanui/core\"\nimport { useEffect, useRef, useState } from \"react\"\nimport Menu, { MenuProps } from \"../Menu\"\n\n\nconst useContextMenu = ({ children, onExited, onClickOutside, ...props }: MenuProps) => {\n\n const Comp = ({ x, y }: any) => {\n const ref = useRef(null)\n const [target, setTarget] = useState<any>()\n\n useEffect(() => {\n setTarget(ref.current)\n return () => {\n Renderar.unrender(Comp)\n }\n }, [])\n\n return (\n <>\n <Tag\n baseClass=\"context-menu-target\"\n ref={ref}\n position={\"fixed\"}\n top={y}\n left={x}\n zIndex={99999999999999}\n bgcolor=\"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/useContextMenu/index.tsx"],"sourcesContent":["\"use client\"\nimport { Renderar, Tag, TagComponentType } from \"@xanui/core\"\nimport { useEffect, useRef, useState } from \"react\"\nimport Menu, { MenuProps } from \"../Menu\"\n\n\nconst useContextMenu = ({ children, onExited, onClickOutside, ...props }: MenuProps) => {\n\n const Comp = ({ x, y }: any) => {\n const ref = useRef(null)\n const [target, setTarget] = useState<any>()\n\n useEffect(() => {\n setTarget(ref.current)\n return () => {\n Renderar.unrender(Comp)\n }\n }, [])\n\n return (\n <>\n <Tag\n baseClass=\"context-menu-target\"\n ref={ref}\n position={\"fixed\"}\n top={y}\n left={x}\n zIndex={99999999999999}\n bgcolor=\"default.base\"\n height={0}\n width={0}\n />\n <Menu\n {...props}\n target={target!}\n onClickOutside={(e) => {\n Renderar.unrender(Comp)\n onClickOutside && onClickOutside(e)\n }}\n >\n {children}\n </Menu>\n </>\n )\n }\n\n const onContextMenu = (e: React.MouseEvent<TagComponentType, MouseEvent>) => {\n e.preventDefault()\n Renderar.render(Comp, {\n x: e.pageX,\n y: e.pageY,\n open: true,\n })\n }\n\n onContextMenu.close = () => {\n Renderar.unrender(Comp)\n }\n\n return onContextMenu\n}\n\nexport default useContextMenu"],"names":[],"mappings":";;;;;;;AAMA;;;AAGM;;;AAIG;AACA;AACG;AACH;;;AAoBS;AACA;AACH;AAMZ;AAEA;;AAEG;;;AAGG;AACF;AACJ;AAEA;AACG;AACH;AAEA;AACH;;"}
|