@rnaga/wp-next-ui 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/Accordion.d.ts +4 -0
  2. package/Accordion.d.ts.map +1 -0
  3. package/Accordion.js +13 -0
  4. package/Accordions.d.ts +19 -0
  5. package/Accordions.d.ts.map +1 -0
  6. package/Accordions.js +39 -0
  7. package/Background.d.ts +5 -0
  8. package/Background.d.ts.map +1 -0
  9. package/Background.js +18 -0
  10. package/BadgeOnMouseOver.d.ts +12 -0
  11. package/BadgeOnMouseOver.d.ts.map +1 -0
  12. package/BadgeOnMouseOver.js +40 -0
  13. package/BasicMenuButton.d.ts +17 -0
  14. package/BasicMenuButton.d.ts.map +1 -0
  15. package/BasicMenuButton.js +61 -0
  16. package/Button.d.ts +10 -0
  17. package/Button.d.ts.map +1 -0
  18. package/Button.js +15 -0
  19. package/Card.d.ts +6 -0
  20. package/Card.d.ts.map +1 -0
  21. package/Card.js +13 -0
  22. package/CardImage.d.ts +10 -0
  23. package/CardImage.d.ts.map +1 -0
  24. package/CardImage.js +34 -0
  25. package/Checkbox.d.ts +6 -0
  26. package/Checkbox.d.ts.map +1 -0
  27. package/Checkbox.js +13 -0
  28. package/Chip.d.ts +10 -0
  29. package/Chip.d.ts.map +1 -0
  30. package/Chip.js +41 -0
  31. package/DateTimePicker.d.ts +6 -0
  32. package/DateTimePicker.d.ts.map +1 -0
  33. package/DateTimePicker.js +45 -0
  34. package/DraggableBox.d.ts +39 -0
  35. package/DraggableBox.d.ts.map +1 -0
  36. package/DraggableBox.js +171 -0
  37. package/Form.d.ts +4 -0
  38. package/Form.d.ts.map +1 -0
  39. package/Form.js +8 -0
  40. package/FormDataProvider.d.ts +5 -0
  41. package/FormDataProvider.d.ts.map +1 -0
  42. package/FormDataProvider.js +6 -0
  43. package/IconButtonDelete.d.ts +6 -0
  44. package/IconButtonDelete.d.ts.map +1 -0
  45. package/IconButtonDelete.js +14 -0
  46. package/Input.d.ts +14 -0
  47. package/Input.d.ts.map +1 -0
  48. package/Input.js +84 -0
  49. package/InputClickField.d.ts +13 -0
  50. package/InputClickField.d.ts.map +1 -0
  51. package/InputClickField.js +21 -0
  52. package/InputColor.d.ts +12 -0
  53. package/InputColor.d.ts.map +1 -0
  54. package/InputColor.js +141 -0
  55. package/InputMultiple.d.ts +15 -0
  56. package/InputMultiple.d.ts.map +1 -0
  57. package/InputMultiple.js +55 -0
  58. package/InputSearch.d.ts +7 -0
  59. package/InputSearch.d.ts.map +1 -0
  60. package/InputSearch.js +28 -0
  61. package/Link.d.ts +6 -0
  62. package/Link.d.ts.map +1 -0
  63. package/Link.js +15 -0
  64. package/LinkCopy.d.ts +6 -0
  65. package/LinkCopy.d.ts.map +1 -0
  66. package/LinkCopy.js +17 -0
  67. package/Loading.d.ts +7 -0
  68. package/Loading.d.ts.map +1 -0
  69. package/Loading.js +29 -0
  70. package/LoadingBox.d.ts +12 -0
  71. package/LoadingBox.d.ts.map +1 -0
  72. package/LoadingBox.js +30 -0
  73. package/MediaTag.d.ts +9 -0
  74. package/MediaTag.d.ts.map +1 -0
  75. package/MediaTag.js +19 -0
  76. package/Modal.d.ts +11 -0
  77. package/Modal.d.ts.map +1 -0
  78. package/Modal.js +65 -0
  79. package/ModalConfirm.d.ts +8 -0
  80. package/ModalConfirm.d.ts.map +1 -0
  81. package/ModalConfirm.js +58 -0
  82. package/PopperMenu.d.ts +7 -0
  83. package/PopperMenu.d.ts.map +1 -0
  84. package/PopperMenu.js +6 -0
  85. package/README.md +292 -0
  86. package/Select.d.ts +21 -0
  87. package/Select.d.ts.map +1 -0
  88. package/Select.js +23 -0
  89. package/SelectAutocomplete.d.ts +1208 -0
  90. package/SelectAutocomplete.d.ts.map +1 -0
  91. package/SelectAutocomplete.js +113 -0
  92. package/SelectMultiple.d.ts +16 -0
  93. package/SelectMultiple.d.ts.map +1 -0
  94. package/SelectMultiple.js +28 -0
  95. package/SelectWPPost.d.ts +17 -0
  96. package/SelectWPPost.d.ts.map +1 -0
  97. package/SelectWPPost.js +98 -0
  98. package/SelectWPTaxonomy.d.ts +9 -0
  99. package/SelectWPTaxonomy.d.ts.map +1 -0
  100. package/SelectWPTaxonomy.js +35 -0
  101. package/SelectWPTerm.d.ts +13 -0
  102. package/SelectWPTerm.d.ts.map +1 -0
  103. package/SelectWPTerm.js +92 -0
  104. package/SelectWPTerms.d.ts +27 -0
  105. package/SelectWPTerms.d.ts.map +1 -0
  106. package/SelectWPTerms.js +105 -0
  107. package/SelectWPUser.d.ts +16 -0
  108. package/SelectWPUser.d.ts.map +1 -0
  109. package/SelectWPUser.js +101 -0
  110. package/SortableList.d.ts +28 -0
  111. package/SortableList.d.ts.map +1 -0
  112. package/SortableList.js +195 -0
  113. package/Tabs.d.ts +17 -0
  114. package/Tabs.d.ts.map +1 -0
  115. package/Tabs.js +35 -0
  116. package/ThemeRegistry.d.ts +13 -0
  117. package/ThemeRegistry.d.ts.map +1 -0
  118. package/ThemeRegistry.js +36 -0
  119. package/Typography.d.ts +9 -0
  120. package/Typography.d.ts.map +1 -0
  121. package/Typography.js +12 -0
  122. package/Viewport.d.ts +6 -0
  123. package/Viewport.d.ts.map +1 -0
  124. package/Viewport.js +10 -0
  125. package/hooks/use-form-data.d.ts +39 -0
  126. package/hooks/use-form-data.d.ts.map +1 -0
  127. package/hooks/use-form-data.js +91 -0
  128. package/hooks/use-media-selector.d.ts +10 -0
  129. package/hooks/use-media-selector.d.ts.map +1 -0
  130. package/hooks/use-media-selector.js +33 -0
  131. package/hooks/use-mouse-move.d.ts +18 -0
  132. package/hooks/use-mouse-move.d.ts.map +1 -0
  133. package/hooks/use-mouse-move.js +112 -0
  134. package/hooks/use-scheme-toggle.d.ts +6 -0
  135. package/hooks/use-scheme-toggle.d.ts.map +1 -0
  136. package/hooks/use-scheme-toggle.js +16 -0
  137. package/hooks/use-viewport.d.ts +5 -0
  138. package/hooks/use-viewport.d.ts.map +1 -0
  139. package/hooks/use-viewport.js +9 -0
  140. package/list/ListGrid.d.ts +12 -0
  141. package/list/ListGrid.d.ts.map +1 -0
  142. package/list/ListGrid.js +15 -0
  143. package/list/ListTable.d.ts +43 -0
  144. package/list/ListTable.d.ts.map +1 -0
  145. package/list/ListTable.js +143 -0
  146. package/list/Pagination.d.ts +5 -0
  147. package/list/Pagination.d.ts.map +1 -0
  148. package/list/Pagination.js +24 -0
  149. package/list/index.d.ts +4 -0
  150. package/list/index.d.ts.map +1 -0
  151. package/list/index.js +3 -0
  152. package/media/MediaGridForm.d.ts +5 -0
  153. package/media/MediaGridForm.d.ts.map +1 -0
  154. package/media/MediaGridForm.js +128 -0
  155. package/media/MediaThumbnail.d.ts +4 -0
  156. package/media/MediaThumbnail.d.ts.map +1 -0
  157. package/media/MediaThumbnail.js +17 -0
  158. package/media/MediaUpload.d.ts +7 -0
  159. package/media/MediaUpload.d.ts.map +1 -0
  160. package/media/MediaUpload.js +76 -0
  161. package/media/index.d.ts +4 -0
  162. package/media/index.d.ts.map +1 -0
  163. package/media/index.js +3 -0
  164. package/media-selector/MediaSelectorList.d.ts +2 -0
  165. package/media-selector/MediaSelectorList.d.ts.map +1 -0
  166. package/media-selector/MediaSelectorList.js +43 -0
  167. package/media-selector/MediaSelectorPreview.d.ts +2 -0
  168. package/media-selector/MediaSelectorPreview.d.ts.map +1 -0
  169. package/media-selector/MediaSelectorPreview.js +80 -0
  170. package/media-selector/index.d.ts +2 -0
  171. package/media-selector/index.d.ts.map +1 -0
  172. package/media-selector/index.js +49 -0
  173. package/package.json +33 -0
  174. package/portal/Portal.d.ts +6 -0
  175. package/portal/Portal.d.ts.map +1 -0
  176. package/portal/Portal.js +7 -0
  177. package/portal/index.d.ts +3 -0
  178. package/portal/index.d.ts.map +1 -0
  179. package/portal/index.js +2 -0
  180. package/portal/use-portal.d.ts +4 -0
  181. package/portal/use-portal.d.ts.map +1 -0
  182. package/portal/use-portal.js +11 -0
  183. package/types/global-state.d.ts +27 -0
  184. package/types/hooks/filters.d.ts +20 -0
  185. package/types/hooks/index.d.ts +1 -0
  186. package/types/index.d.ts +3 -0
  187. package/types/wp-theme.d.ts +49 -0
  188. package/wp-theme/index.d.ts +3 -0
  189. package/wp-theme/index.d.ts.map +1 -0
  190. package/wp-theme/index.js +86 -0
package/Accordion.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { Accordion as MuiAccordion, AccordionSummary as MuiAccordionSummary } from "@mui/material";
2
+ export declare const Accordion: (props: Parameters<typeof MuiAccordion>[0]) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const AccordionSummary: (props: Parameters<typeof MuiAccordionSummary>[0]) => import("react/jsx-runtime").JSX.Element;
4
+ //# sourceMappingURL=Accordion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../src/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,IAAI,YAAY,EACzB,gBAAgB,IAAI,mBAAmB,EACxC,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,SAAS,GAAI,OAAO,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,4CAgBlE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,OAAO,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,4CAOjD,CAAC"}
package/Accordion.js ADDED
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Accordion as MuiAccordion, AccordionSummary as MuiAccordionSummary, } from "@mui/material";
3
+ import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
4
+ export const Accordion = (props) => {
5
+ return (_jsx(MuiAccordion, { disableGutters: true, elevation: 0, square: true, sx: {
6
+ backgroundColor: "transparent",
7
+ my: 0,
8
+ ...props.sx,
9
+ }, ...props, children: props.children }));
10
+ };
11
+ export const AccordionSummary = (props) => {
12
+ return (_jsx(MuiAccordionSummary, { expandIcon: _jsx(ExpandMoreIcon, {}), children: props.children }));
13
+ };
@@ -0,0 +1,19 @@
1
+ import { JSX } from "react";
2
+ import { Accordion, AccordionSummary as MuiAccodionSummary, SxProps } from "@mui/material";
3
+ import { Typography } from "./Typography";
4
+ export declare const Accordions: (props: {
5
+ items: {
6
+ title: string;
7
+ content: JSX.Element;
8
+ }[];
9
+ defaultExpanded?: number[];
10
+ allowSingleExpanded?: boolean;
11
+ height?: number;
12
+ sx?: SxProps;
13
+ slotProps?: {
14
+ summary?: Parameters<typeof MuiAccodionSummary>[0];
15
+ title?: Parameters<typeof Typography>[0];
16
+ };
17
+ size?: "small" | "medium";
18
+ } & Omit<Parameters<typeof Accordion>[0], "sx" | "defaultExpanded" | "children">) => import("react/jsx-runtime").JSX.Element[];
19
+ //# sourceMappingURL=Accordions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Accordions.d.ts","sourceRoot":"","sources":["../src/Accordions.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAM,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EACL,SAAS,EAET,gBAAgB,IAAI,kBAAkB,EACtC,OAAO,EACR,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,eAAO,MAAM,UAAU,GACrB,OAAO;IACL,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC;KACtB,EAAE,CAAC;IACJ,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAE3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,SAAS,CAAC,EAAE;QACV,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,KAAK,CAAC,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;KAC1C,CAAC;IACF,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC3B,GAAG,IAAI,CACN,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,EAC/B,IAAI,GAAG,iBAAiB,GAAG,UAAU,CACtC,8CA2EF,CAAC"}
package/Accordions.js ADDED
@@ -0,0 +1,39 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { Accordion, AccordionDetails, AccordionSummary as MuiAccodionSummary, } from "@mui/material";
4
+ import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
5
+ import { Typography } from "./Typography";
6
+ import { useWPTheme } from "./ThemeRegistry";
7
+ export const Accordions = (props) => {
8
+ const { items, defaultExpanded, sx, height, allowSingleExpanded = false, slotProps, size, ...rest } = props;
9
+ const [expdanded, setExpanded] = React.useState(defaultExpanded ? defaultExpanded[0] : -1);
10
+ const { wpTheme } = useWPTheme();
11
+ const { sx: summarySx, ...summarySlotProps } = slotProps?.summary || {};
12
+ const { sx: titleSx, ...titleSlotProps } = slotProps?.title || {};
13
+ return items.map((item, index) => {
14
+ return (_jsxs(Accordion, { expanded: allowSingleExpanded ? expdanded === index : undefined, ...(!allowSingleExpanded && {
15
+ defaultExpanded: defaultExpanded
16
+ ? defaultExpanded.includes(index)
17
+ : true,
18
+ }), disableGutters: true, elevation: 0, square: true, sx: {
19
+ //backgroundColor: wpTheme.background.color,
20
+ ...sx,
21
+ }, ...rest, children: [_jsx(MuiAccodionSummary, { expandIcon: _jsx(ExpandMoreIcon, {}), sx: {
22
+ minHeight: height ?? 20,
23
+ "& .MuiAccordionSummary-content": {
24
+ my: 0.5,
25
+ },
26
+ //color: wpTheme.text.color,
27
+ ...summarySx,
28
+ }, onClick: () => {
29
+ if (allowSingleExpanded) {
30
+ setExpanded(index === expdanded ? undefined : index);
31
+ }
32
+ }, ...summarySlotProps, children: _jsx(Typography, { size: size, sx: {
33
+ fontWeight: 600,
34
+ lineHeight: "20px",
35
+ my: 1,
36
+ ...titleSx,
37
+ }, ...titleSlotProps, children: item.title }) }), _jsx(AccordionDetails, { children: item.content })] }, index));
38
+ });
39
+ };
@@ -0,0 +1,5 @@
1
+ export declare const Background: (props: {
2
+ zIndex?: number;
3
+ onClose: () => void;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=Background.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Background.d.ts","sourceRoot":"","sources":["../src/Background.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,GAAI,OAAO;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,4CAqBzE,CAAC"}
package/Background.js ADDED
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Box } from "@mui/material";
3
+ export const Background = (props) => {
4
+ const { zIndex = 999, onClose } = props;
5
+ return (_jsx(Box, { sx: {
6
+ position: "fixed",
7
+ top: 0,
8
+ left: 0,
9
+ width: "100vw",
10
+ height: "100vh",
11
+ zIndex,
12
+ // background color a little lighter than the background
13
+ backgroundColor: "rgba(0,0,0,0.1)",
14
+ }, onMouseDown: (e) => {
15
+ e.stopPropagation();
16
+ onClose();
17
+ } }));
18
+ };
@@ -0,0 +1,12 @@
1
+ import { Badge, SxProps } from "@mui/material";
2
+ import { CSSProperties } from "react";
3
+ export declare const BadgeOnMouseOver: (props: {
4
+ label: string;
5
+ ref: React.RefObject<HTMLElement | null>;
6
+ onClick: (e: React.MouseEvent) => void;
7
+ slotSxProps?: {
8
+ badgeContent?: SxProps;
9
+ badge?: CSSProperties;
10
+ };
11
+ } & Omit<Parameters<typeof Badge>[0], "onClick" | "ref">) => import("react/jsx-runtime").JSX.Element;
12
+ //# sourceMappingURL=BadgeOnMouseOver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BadgeOnMouseOver.d.ts","sourceRoot":"","sources":["../src/BadgeOnMouseOver.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAO,OAAO,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,aAAa,EAAY,MAAM,OAAO,CAAC;AAGhD,eAAO,MAAM,gBAAgB,GAC3B,OAAO;IACL,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACzC,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACvC,WAAW,CAAC,EAAE;QACZ,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,KAAK,CAAC,EAAE,aAAa,CAAC;KACvB,CAAC;CACH,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,GAAG,KAAK,CAAC,4CA0DzD,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Badge, Box } from "@mui/material";
3
+ import { useState } from "react";
4
+ export const BadgeOnMouseOver = (props) => {
5
+ const { onClick, label, children, ref, sx, color, ...rest } = props;
6
+ const [invisible, setInvisible] = useState(true);
7
+ return (_jsx(Badge, { ref: (e) => {
8
+ if (!e)
9
+ return;
10
+ ref.current = e;
11
+ e.addEventListener("mouseover", () => {
12
+ setInvisible(false);
13
+ });
14
+ e.addEventListener("mouseleave", () => {
15
+ setInvisible(true);
16
+ });
17
+ }, invisible: invisible, badgeContent: _jsx(Box, { onClick: (e) => {
18
+ onClick(e);
19
+ }, sx: {
20
+ minWidth: 55,
21
+ ...props.slotSxProps?.badgeContent,
22
+ }, children: label }), anchorOrigin: {
23
+ vertical: "top",
24
+ horizontal: "right",
25
+ }, sx: {
26
+ "& .MuiBadge-badge": {
27
+ top: -11,
28
+ right: 30,
29
+ fontSize: 9,
30
+ opacity: 0.8,
31
+ borderRadius: 1,
32
+ cursor: "pointer",
33
+ "&:hover": {
34
+ opacity: 1,
35
+ },
36
+ ...props.slotSxProps?.badge,
37
+ },
38
+ ...sx,
39
+ }, color: color ?? "info", ...rest, children: children }));
40
+ };
@@ -0,0 +1,17 @@
1
+ import { Button } from "./Button";
2
+ import { RefObject } from "react";
3
+ export type BasicMenuButtonItem = {
4
+ label: string;
5
+ value: string;
6
+ };
7
+ export declare const BasicMenuButton: (props: {
8
+ ref?: RefObject<HTMLElement | null>;
9
+ items: BasicMenuButtonItem[];
10
+ onChange: (value: string, item: BasicMenuButtonItem) => void;
11
+ label?: string;
12
+ size?: "small" | "medium";
13
+ value?: string;
14
+ showArrowIcon?: boolean;
15
+ disabled?: boolean;
16
+ } & Omit<Parameters<typeof Button>[0], "onChange" | "ref" | "label" | "value" | "children" | "disabled">) => import("react/jsx-runtime").JSX.Element;
17
+ //# sourceMappingURL=BasicMenuButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BasicMenuButton.d.ts","sourceRoot":"","sources":["../src/BasicMenuButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAKlC,OAAO,EAAY,SAAS,EAA+B,MAAM,OAAO,CAAC;AAIzE,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,OAAO;IACL,GAAG,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACpC,KAAK,EAAE,mBAAmB,EAAE,CAAC;IAC7B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAC7D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,IAAI,CACN,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,EAC5B,UAAU,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CACjE,4CAwHF,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button } from "./Button";
3
+ import Menu from "@mui/material/Menu";
4
+ import MenuItem from "@mui/material/MenuItem";
5
+ import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
6
+ import ArrowDropUpIcon from "@mui/icons-material/ArrowDropUp";
7
+ import { Fragment, useEffect, useState } from "react";
8
+ import { Typography } from "./Typography";
9
+ import { useWPTheme } from "./ThemeRegistry";
10
+ export const BasicMenuButton = (props) => {
11
+ const { onChange, label, ref: buttonRef, size, showArrowIcon = true, disabled = false, ...rest } = props;
12
+ const fontSize = size == "medium" ? 14 : 12;
13
+ const { wpTheme } = useWPTheme();
14
+ const [anchorEl, setAnchorEl] = useState(null);
15
+ const open = Boolean(anchorEl);
16
+ const [buttonValue, setButtonValue] = useState();
17
+ const [buttonWidth, setButtonWidth] = useState("100px");
18
+ const [items, setItems] = useState();
19
+ const handleClick = (event) => {
20
+ setAnchorEl(event.currentTarget);
21
+ };
22
+ const handleClose = () => {
23
+ setAnchorEl(null);
24
+ };
25
+ useEffect(() => {
26
+ setButtonValue(label);
27
+ }, [label]);
28
+ useEffect(() => {
29
+ setItems(props.items);
30
+ }, [props.items]);
31
+ return (_jsxs(Fragment, { children: [_jsxs(Button, { ...rest, id: "basic-button", size: "small", disabled: disabled, "aria-controls": open ? "basic-menu" : undefined, "aria-haspopup": "true", "aria-expanded": open ? "true" : undefined, onClick: handleClick, sx: {
32
+ textTransform: "none",
33
+ border: "1px solid",
34
+ borderColor: wpTheme.border.color,
35
+ justifyContent: "space-between",
36
+ height: size == "medium" ? 32 : 24,
37
+ //color: (theme) => theme.palette.text.primary,
38
+ backgroundColor: wpTheme.background.color,
39
+ color: wpTheme.text.color,
40
+ ...rest.sx,
41
+ }, ref: (ref) => {
42
+ if (ref) {
43
+ setButtonWidth(ref.clientWidth + "px");
44
+ if (buttonRef) {
45
+ buttonRef.current = ref;
46
+ }
47
+ }
48
+ }, children: [_jsx(Typography, { fontSize: fontSize, sx: {
49
+ ...(disabled ? { opacity: 0.5 } : {}),
50
+ }, children: buttonValue }), disabled === false && (_jsxs(_Fragment, { children: [showArrowIcon && !open && _jsx(ArrowDropDownIcon, { fontSize: "small" }), showArrowIcon && open && _jsx(ArrowDropUpIcon, { fontSize: "small" })] }))] }), _jsx(Menu, { id: "basic-menu", anchorEl: anchorEl, open: disabled === true ? false : open, onClose: handleClose, sx: {
51
+ width: "100%",
52
+ }, children: items?.map((item, index) => (_jsx(MenuItem, { onClick: (e) => {
53
+ onChange(item.value, item);
54
+ setButtonValue(item.label);
55
+ handleClose();
56
+ }, sx: {
57
+ width: buttonWidth,
58
+ }, children: _jsx(Typography, { fontSize: fontSize, sx: {
59
+ minHeight: size == "medium" ? 20 : 16,
60
+ }, component: "div", children: item.label }) }, index))) })] }, label));
61
+ };
package/Button.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { Button as MuiButton } from "@mui/material";
2
+ export declare const Button: (props: {
3
+ children: React.ReactNode;
4
+ size?: "small" | "medium" | "large";
5
+ component?: React.ElementType;
6
+ bold?: boolean;
7
+ loading?: boolean;
8
+ color?: "info" | "success" | "warning" | "error" | "primary" | "secondary";
9
+ } & Omit<Parameters<typeof MuiButton>[0], "children" | "size">) => import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=Button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,eAAe,CAAC;AAIpD,eAAO,MAAM,MAAM,GACjB,OAAO;IACL,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAEpC,SAAS,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;CAC5E,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC,4CAwB/D,CAAC"}
package/Button.js ADDED
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Button as MuiButton } from "@mui/material";
3
+ import { CircularProgress } from "@mui/material";
4
+ import { useWPTheme } from "./ThemeRegistry";
5
+ export const Button = (props) => {
6
+ const { children, size, component, bold, loading, color, ...rest } = props;
7
+ const { wpTheme } = useWPTheme();
8
+ return (_jsx(MuiButton, { ...rest, component: component, variant: "contained", size: "small", disableElevation: true, disabled: loading, sx: {
9
+ textTransform: "none",
10
+ fontSize: size === "large" ? 16 : size === "medium" ? 14 : 12,
11
+ ...(bold ? { fontWeight: "bold" } : {}),
12
+ ...(color ? { backgroundColor: wpTheme.colors[color] } : {}),
13
+ ...rest.sx,
14
+ }, endIcon: loading ? _jsx(CircularProgress, { size: 20 }) : null, children: children }));
15
+ };
package/Card.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { Card as MuiCard } from "@mui/material";
2
+ export declare const Card: (props: {
3
+ children: React.ReactNode;
4
+ sx?: React.CSSProperties;
5
+ } & React.ComponentProps<typeof MuiCard>) => import("react/jsx-runtime").JSX.Element;
6
+ //# sourceMappingURL=Card.d.ts.map
package/Card.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../src/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,eAAe,CAAC;AAEhD,eAAO,MAAM,IAAI,GACf,OAAO;IACL,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,EAAE,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC1B,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,OAAO,CAAC,4CAmBzC,CAAC"}
package/Card.js ADDED
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Card as MuiCard } from "@mui/material";
3
+ export const Card = (props) => {
4
+ const { children, sx, ...rest } = props;
5
+ return (_jsx(MuiCard, { sx: {
6
+ padding: 2,
7
+ display: "flex",
8
+ flexDirection: "column",
9
+ justifyContent: "space-between",
10
+ gap: 2,
11
+ ...sx,
12
+ }, ...rest, children: children }));
13
+ };
package/CardImage.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { Card } from "@mui/material";
2
+ export declare const CardImage: (props: {
3
+ src?: string;
4
+ alt?: string;
5
+ width?: number | string;
6
+ height?: number | string;
7
+ component?: string;
8
+ placeholder?: string;
9
+ } & Parameters<typeof Card>[0]) => import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=CardImage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CardImage.d.ts","sourceRoot":"","sources":["../src/CardImage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,IAAI,EAAa,MAAM,eAAe,CAAC;AAOrD,eAAO,MAAM,SAAS,GACpB,OAAO;IACL,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,4CAgE/B,CAAC"}
package/CardImage.js ADDED
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Box, Card, CardMedia } from "@mui/material";
3
+ import { useWPTheme } from "./ThemeRegistry";
4
+ import { Typography } from "./Typography";
5
+ import { getMimeType } from "@rnaga/wp-next-core/client/utils/media";
6
+ import DocumentScannerOutlinedIcon from "@mui/icons-material/DocumentScannerOutlined";
7
+ export const CardImage = (props) => {
8
+ const { src, alt, width, height, sx, placeholder, component, ...rest } = props;
9
+ const { wpTheme } = useWPTheme();
10
+ const mimeType = getMimeType(src || "").split("/")[0];
11
+ const componentString = mimeType === "image" ? "img" : mimeType === "video" ? "video" : undefined;
12
+ return (_jsx(Card, { component: component || "li", variant: "outlined", sx: {
13
+ flexGrow: 1,
14
+ flexShrink: 0,
15
+ display: "flex",
16
+ justifyContent: "center",
17
+ alignItems: "center",
18
+ cursor: "pointer",
19
+ ...sx,
20
+ }, ...rest, children: !src ? (_jsx(Box, { sx: {
21
+ display: "flex",
22
+ justifyContent: "center",
23
+ alignItems: "center",
24
+ width: width || 120,
25
+ height: height || 120,
26
+ }, children: _jsx(Typography, { children: placeholder || "No image selected" }) })) : componentString ? (_jsx(CardMedia, { component: componentString, sx: {
27
+ maxWidth: "100%",
28
+ maxHeight: height || 200,
29
+ objectFit: "cover",
30
+ }, image: src, alt: alt || "Selected media" })) : (_jsx(DocumentScannerOutlinedIcon, { sx: {
31
+ width: width || 120,
32
+ height: height || 200,
33
+ } })) }));
34
+ };
package/Checkbox.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { Checkbox as MuiCheckbox } from "@mui/material";
2
+ export declare const Checkbox: (props: {
3
+ label?: string;
4
+ size?: "small" | "medium";
5
+ } & Parameters<typeof MuiCheckbox>[0]) => import("react/jsx-runtime").JSX.Element;
6
+ //# sourceMappingURL=Checkbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../src/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,QAAQ,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AAG7D,eAAO,MAAM,QAAQ,GACnB,OAAO;IACL,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC3B,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,4CAoBtC,CAAC"}
package/Checkbox.js ADDED
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Checkbox as MuiCheckbox } from "@mui/material";
3
+ import { Typography } from "./Typography";
4
+ export const Checkbox = (props) => {
5
+ const { label, size, ...rest } = props;
6
+ return (_jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [_jsx(MuiCheckbox, { size: "small", ...rest, sx: {
7
+ "& .MuiFormControlLabel-label": {
8
+ fontSize: "0.875rem",
9
+ },
10
+ height: size === "small" ? 16 : 20,
11
+ ...rest.sx,
12
+ } }), label && _jsx(Typography, { size: size, children: label })] }));
13
+ };
package/Chip.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { SxProps } from "@mui/material";
2
+ export declare const Chip: (props: {
3
+ size?: "small" | "medium" | "large";
4
+ color?: "yellow" | "orange" | "purple" | "grey";
5
+ label: string | number;
6
+ opacity?: number;
7
+ sx?: SxProps;
8
+ onClick?: () => void;
9
+ }) => import("react/jsx-runtime").JSX.Element;
10
+ //# sourceMappingURL=Chip.d.ts.map
package/Chip.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../src/Chip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwB,OAAO,EAAkB,MAAM,eAAe,CAAC;AAI9E,eAAO,MAAM,IAAI,GAAI,OAAO;IAC1B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IAChD,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,4CAwDA,CAAC"}
package/Chip.js ADDED
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Box } from "@mui/material";
3
+ import { Typography } from "./Typography";
4
+ export const Chip = (props) => {
5
+ const { size = "medium", label, sx, color, opacity, onClick } = props;
6
+ const defaultColor = "240, 240, 240";
7
+ const baseColor = color === "yellow"
8
+ ? "212, 178, 0"
9
+ : color === "orange"
10
+ ? "240, 101, 41"
11
+ : color === "purple"
12
+ ? "86, 61, 124"
13
+ : color === "grey"
14
+ ? "211, 211, 211" // lighter grey
15
+ : defaultColor;
16
+ const backgroundColor = baseColor !== undefined
17
+ ? `rgba(${baseColor}, ${opacity !== undefined ? opacity : 1})`
18
+ : undefined;
19
+ return (_jsx(Box, { sx: {
20
+ fontSize: size === "large" ? 12 : size === "medium" ? 10 : 8,
21
+ backgroundColor,
22
+ //color: backgroundColor == undefined ? undefined : "white",
23
+ display: "inline-flex",
24
+ justifyContent: "center",
25
+ alignItems: "center",
26
+ //width: size === "large" ? 32 : size === "medium" ? 24 : 20,
27
+ //height: size === "large" ? 32 : size === "medium" ? 24 : 20,
28
+ //borderRadius: "50%",
29
+ p: 0.5,
30
+ borderRadius: 1.5,
31
+ ...(onClick && {
32
+ cursor: "pointer",
33
+ }),
34
+ ...sx,
35
+ }, onClick: onClick, children: _jsx(Typography, { variant: "caption", sx: {
36
+ fontSize: size === "large" ? 12 : size === "medium" ? 10 : 8,
37
+ color: color === "grey" || !color ? "black" : "white",
38
+ m: 0,
39
+ p: 0,
40
+ }, bold: true, children: label }) }));
41
+ };
@@ -0,0 +1,6 @@
1
+ export declare const DateTimePicker: (props: {
2
+ value?: string | Date;
3
+ onChange?: (value: string | Date) => void;
4
+ size?: "small" | "medium" | "large";
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ //# sourceMappingURL=DateTimePicker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DateTimePicker.d.ts","sourceRoot":"","sources":["../src/DateTimePicker.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,GAAI,OAAO;IACpC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1C,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;CACrC,4CAiDA,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
3
+ import { DateTimePicker as MuiDateTimePicker } from "@mui/x-date-pickers/DateTimePicker";
4
+ import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
5
+ import dayjs from "dayjs";
6
+ import { useWPTheme } from "./ThemeRegistry";
7
+ export const DateTimePicker = (props) => {
8
+ const { value, onChange, size } = props;
9
+ const { wpTheme } = useWPTheme();
10
+ return (_jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, children: _jsx(MuiDateTimePicker, { value: dayjs(value), onChange: (newValue) => {
11
+ onChange && onChange(newValue?.toDate() || "");
12
+ }, slotProps: {
13
+ textField: {
14
+ size: "small",
15
+ slotProps: {
16
+ input: { disableUnderline: true, sx: { fontSize: 0.1 } },
17
+ },
18
+ sx: {
19
+ "& .MuiInputBase-input": {
20
+ py: 0.5,
21
+ px: 1,
22
+ },
23
+ "& .MuiOutlinedInput-root": {
24
+ fontSize: size === "large" ? 16 : size === "medium" ? 14 : 12,
25
+ height: size === "large" ? 36 : size == "medium" ? 32 : 24,
26
+ border: `1px solid ${wpTheme.border.color}`,
27
+ "& fieldset": {
28
+ border: "none",
29
+ },
30
+ "&.Mui-focused fieldset": {
31
+ border: "none",
32
+ },
33
+ "&:hover fieldset": {
34
+ border: "none",
35
+ },
36
+ },
37
+ "& .MuiSvgIcon-root": {
38
+ fontSize: size === "large" ? 26 : size === "medium" ? 22 : 18,
39
+ },
40
+ },
41
+ },
42
+ }, sx: {
43
+ width: "100%",
44
+ } }) }));
45
+ };
@@ -0,0 +1,39 @@
1
+ /**
2
+ * A draggable component that displays content in a floating container.
3
+ *
4
+ * Props:
5
+ * - children: The content to be displayed inside the draggable box.
6
+ * - open: Controls whether the box is visible or not.
7
+ * - onClose: Callback to close the box.
8
+ * - offset: Optional initial offset for the box's X and Y coordinates.
9
+ * - title: Optional title to display in the header.
10
+ * - size: Sets the Typography size ("small" | "medium").
11
+ * - targetRef: Reference to an element whose relative position determines the box's initial placement.
12
+ * - sx: Style overrides for the outer Box wrapping the content.
13
+ * - slotSxProps: Style overrides for the header and title.
14
+ */
15
+ import React, { RefObject } from "react";
16
+ import { SxProps } from "@mui/material";
17
+ type SlotSxProps = {
18
+ header?: SxProps;
19
+ title?: SxProps;
20
+ };
21
+ export declare const DraggableBox: (props: {
22
+ children: React.ReactNode;
23
+ open: boolean;
24
+ onClose: VoidFunction;
25
+ offset?: {
26
+ left?: number;
27
+ top?: number;
28
+ };
29
+ title?: string;
30
+ size?: "small" | "medium";
31
+ targetRef?: RefObject<HTMLElement | null>;
32
+ ref?: RefObject<HTMLElement | null>;
33
+ sx?: SxProps;
34
+ slotSxProps?: SlotSxProps;
35
+ zIndexLayer?: number;
36
+ placement?: "target" | "left";
37
+ }) => import("react/jsx-runtime").JSX.Element;
38
+ export {};
39
+ //# sourceMappingURL=DraggableBox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DraggableBox.d.ts","sourceRoot":"","sources":["../src/DraggableBox.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,EACZ,SAAS,EAKV,MAAM,OAAO,CAAC;AACf,OAAO,EAAgB,OAAO,EAAE,MAAM,eAAe,CAAC;AAMtD,KAAK,WAAW,GAAG;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC1C,GAAG,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACpC,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;CAC/B,4CAqNA,CAAC"}