@apipass/design-system 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/embedded-styles.js +1 -1
- package/dist/lib/json-viewer.index.cjs +1 -1
- package/dist/lib/json-viewer.index.js +4 -2
- package/dist/lib/json-viewer.index.js.map +1 -1
- package/dist/lib/style.css +1 -1
- package/dist/lib/ui/primitives/JsonViewer/JsonEditor.cjs +2 -0
- package/dist/lib/ui/primitives/JsonViewer/JsonEditor.cjs.map +1 -0
- package/dist/lib/ui/primitives/JsonViewer/JsonEditor.js +95 -0
- package/dist/lib/ui/primitives/JsonViewer/JsonEditor.js.map +1 -0
- package/dist/lib/ui/primitives/JsonViewer/JsonViewer.cjs +1 -1
- package/dist/lib/ui/primitives/JsonViewer/JsonViewer.cjs.map +1 -1
- package/dist/lib/ui/primitives/JsonViewer/JsonViewer.js +37 -88
- package/dist/lib/ui/primitives/JsonViewer/JsonViewer.js.map +1 -1
- package/dist/lib/ui/primitives/JsonViewer/json-code-mirror.cjs +2 -0
- package/dist/lib/ui/primitives/JsonViewer/json-code-mirror.cjs.map +1 -0
- package/dist/lib/ui/primitives/JsonViewer/json-code-mirror.js +64 -0
- package/dist/lib/ui/primitives/JsonViewer/json-code-mirror.js.map +1 -0
- package/dist/lib/ui/primitives/Menu/Menu.cjs +1 -1
- package/dist/lib/ui/primitives/Menu/Menu.cjs.map +1 -1
- package/dist/lib/ui/primitives/Menu/Menu.js +71 -51
- package/dist/lib/ui/primitives/Menu/Menu.js.map +1 -1
- package/dist/lib/ui/primitives/PermissionGate/PermissionGate.cjs.map +1 -1
- package/dist/lib/ui/primitives/PermissionGate/PermissionGate.js.map +1 -1
- package/dist/types/json-viewer.index.d.ts +1 -0
- package/dist/types/ui/primitives/JsonViewer/JsonEditor.d.ts +18 -0
- package/dist/types/ui/primitives/JsonViewer/json-code-mirror.d.ts +17 -0
- package/dist/types/ui/primitives/Menu/Menu.d.ts +1 -1
- package/dist/types/ui/primitives/PermissionGate/PermissionGate.d.ts +20 -0
- package/package.json +1 -1
|
@@ -1,96 +1,116 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
1
|
+
import { jsx as t, jsxs as m, Fragment as d } from "react/jsx-runtime";
|
|
2
2
|
import { clsx as o } from "../../../vendor/clsx/dist/clsx.js";
|
|
3
|
-
import
|
|
3
|
+
import u from "react";
|
|
4
|
+
import { PermissionGate as f } from "../PermissionGate/PermissionGate.js";
|
|
5
|
+
import { Menu as M, MenuTrigger as p, Popover as N, MenuItem as h, Separator as g } from "react-aria-components";
|
|
4
6
|
/* empty css */
|
|
5
|
-
import { IconChevronDown as
|
|
6
|
-
import { Label as
|
|
7
|
-
import { IconButton as
|
|
8
|
-
import { Button as
|
|
9
|
-
import { useOverlayPortalContainer as
|
|
10
|
-
import { TextHeading as
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
import { IconChevronDown as v } from "../../icons/IconChevronDown.js";
|
|
8
|
+
import { Label as I, Description as x, Keyboard as y } from "../Fieldset/Fieldset.js";
|
|
9
|
+
import { IconButton as b } from "../IconButton/IconButton.js";
|
|
10
|
+
import { Button as B } from "../Button/Button.js";
|
|
11
|
+
import { useOverlayPortalContainer as C } from "../../hooks/useOverlayPortal.js";
|
|
12
|
+
import { TextHeading as P } from "../Text/Text.js";
|
|
13
|
+
let i = !1;
|
|
14
|
+
function c(n) {
|
|
15
|
+
i || u.Children.forEach(n, (e) => {
|
|
16
|
+
if (u.isValidElement(e)) {
|
|
17
|
+
if (e.type === u.Fragment) {
|
|
18
|
+
c(
|
|
19
|
+
e.props.children
|
|
20
|
+
);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
e.type === f && (i = !0, console.error(
|
|
24
|
+
"[design-system] Menu: PermissionGate não pode envolver um MenuItem — o react-aria descarta esse item e os seguintes, e o menu abre vazio quando ele é o primeiro. Mova o gate para dentro do MenuItem, em volta do conteúdo do item."
|
|
25
|
+
));
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function S({ className: n, ...e }) {
|
|
30
|
+
return c(
|
|
31
|
+
typeof e.children == "function" ? null : e.children
|
|
32
|
+
), /* @__PURE__ */ t(M, { className: o(n, "menu"), ...e });
|
|
13
33
|
}
|
|
14
|
-
function
|
|
15
|
-
return /* @__PURE__ */ t(
|
|
34
|
+
function T({ ...n }) {
|
|
35
|
+
return /* @__PURE__ */ t(p, { ...n });
|
|
16
36
|
}
|
|
17
|
-
function
|
|
37
|
+
function z({
|
|
18
38
|
label: n,
|
|
19
39
|
children: e,
|
|
20
40
|
icon: r,
|
|
21
|
-
placement:
|
|
22
|
-
variant:
|
|
23
|
-
...
|
|
41
|
+
placement: a,
|
|
42
|
+
variant: s,
|
|
43
|
+
...l
|
|
24
44
|
}) {
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
r ? /* @__PURE__ */ t(
|
|
27
|
-
/* @__PURE__ */ t(
|
|
45
|
+
return /* @__PURE__ */ m(T, { children: [
|
|
46
|
+
r ? /* @__PURE__ */ t(b, { variant: s, "aria-label": n, children: r }) : /* @__PURE__ */ t(B, { variant: s, children: n }),
|
|
47
|
+
/* @__PURE__ */ t($, { placement: a, children: /* @__PURE__ */ t(S, { ...l, children: e }) })
|
|
28
48
|
] });
|
|
29
49
|
}
|
|
30
|
-
function
|
|
50
|
+
function $({
|
|
31
51
|
UNSTABLE_portalContainer: n,
|
|
32
52
|
...e
|
|
33
53
|
}) {
|
|
34
|
-
const r =
|
|
54
|
+
const r = C();
|
|
35
55
|
return /* @__PURE__ */ t(
|
|
36
|
-
|
|
56
|
+
N,
|
|
37
57
|
{
|
|
38
58
|
...e,
|
|
39
59
|
UNSTABLE_portalContainer: n ?? r
|
|
40
60
|
}
|
|
41
61
|
);
|
|
42
62
|
}
|
|
43
|
-
function
|
|
44
|
-
const r = o(n, "menu-item"),
|
|
45
|
-
return /* @__PURE__ */ t(
|
|
63
|
+
function K({ className: n, ...e }) {
|
|
64
|
+
const r = o(n, "menu-item"), a = e.textValue || (typeof e.children == "string" ? e.children : void 0);
|
|
65
|
+
return /* @__PURE__ */ t(h, { ...e, className: r, textValue: a, children: ({ hasSubmenu: s }) => /* @__PURE__ */ m(d, { children: [
|
|
46
66
|
e.children,
|
|
47
|
-
|
|
67
|
+
s && /* @__PURE__ */ t(v, {})
|
|
48
68
|
] }) });
|
|
49
69
|
}
|
|
50
|
-
function
|
|
70
|
+
function U({ className: n, ...e }) {
|
|
51
71
|
const r = o(n, "menu-header");
|
|
52
72
|
return /* @__PURE__ */ t("div", { ...e, className: r });
|
|
53
73
|
}
|
|
54
|
-
function
|
|
74
|
+
function W({ className: n, ...e }) {
|
|
55
75
|
const r = o(n, "menu-section");
|
|
56
76
|
return /* @__PURE__ */ t("div", { ...e, className: r });
|
|
57
77
|
}
|
|
58
|
-
function
|
|
78
|
+
function _({ className: n, ...e }) {
|
|
59
79
|
const r = o(n, "menu-heading");
|
|
60
|
-
return /* @__PURE__ */ t(
|
|
80
|
+
return /* @__PURE__ */ t(P, { ...e, className: r });
|
|
61
81
|
}
|
|
62
|
-
function
|
|
82
|
+
function k({ className: n, ...e }) {
|
|
63
83
|
const r = o(n, "menu-separator");
|
|
64
|
-
return /* @__PURE__ */ t(
|
|
84
|
+
return /* @__PURE__ */ t(g, { ...e, className: r });
|
|
65
85
|
}
|
|
66
|
-
function
|
|
86
|
+
function J({ className: n, ...e }) {
|
|
67
87
|
const r = o(n, "menu-label");
|
|
68
|
-
return /* @__PURE__ */ t(
|
|
88
|
+
return /* @__PURE__ */ t(I, { ...e, className: r });
|
|
69
89
|
}
|
|
70
|
-
function
|
|
90
|
+
function Q({ className: n, ...e }) {
|
|
71
91
|
const r = o(n, "menu-description");
|
|
72
|
-
return /* @__PURE__ */ t(
|
|
92
|
+
return /* @__PURE__ */ t(x, { ...e, className: r });
|
|
73
93
|
}
|
|
74
|
-
function
|
|
94
|
+
function R({
|
|
75
95
|
children: n,
|
|
76
96
|
className: e,
|
|
77
97
|
...r
|
|
78
98
|
}) {
|
|
79
|
-
const
|
|
80
|
-
return /* @__PURE__ */ t(
|
|
99
|
+
const a = o(e, "menu-shortcut");
|
|
100
|
+
return /* @__PURE__ */ t(y, { ...r, className: a, children: n });
|
|
81
101
|
}
|
|
82
102
|
export {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
103
|
+
S as Menu,
|
|
104
|
+
z as MenuButton,
|
|
105
|
+
Q as MenuDescription,
|
|
106
|
+
U as MenuHeader,
|
|
107
|
+
_ as MenuHeading,
|
|
108
|
+
K as MenuItem,
|
|
109
|
+
J as MenuLabel,
|
|
110
|
+
$ as MenuPopover,
|
|
111
|
+
W as MenuSection,
|
|
112
|
+
k as MenuSeparator,
|
|
113
|
+
R as MenuShortcut,
|
|
114
|
+
T as MenuTrigger
|
|
95
115
|
};
|
|
96
116
|
//# sourceMappingURL=Menu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.js","sources":["../../../../../src/ui/primitives/Menu/Menu.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport { IconChevronDown } from \"icons\";\nimport {\n Button,\n ButtonProps,\n Description,\n DescriptionProps,\n IconButton,\n Keyboard,\n KeyboardProps,\n Label,\n LabelProps,\n TextHeading,\n type TextHeadingProps,\n} from \"primitives\";\nimport type React from \"react\";\nimport {\n Menu as RACMenu,\n MenuItem as RACMenuItem,\n MenuTrigger as RACMenuTrigger,\n Popover as RACPopover,\n Separator as RACSeparator,\n type MenuItemProps as RACMenuItemProps,\n type MenuProps as RACMenuProps,\n type MenuTriggerProps as RACMenuTriggerProps,\n type PopoverProps as RACPopoverProps,\n type SeparatorProps as RACSeparatorProps,\n} from \"react-aria-components\";\nimport \"./menu.css\";\n\nexport type MenuProps<T> = RACMenuProps<T>;\nexport function Menu<T extends object>({ className, ...props }: MenuProps<T>) {\n return <RACMenu className={clsx(className, \"menu\")} {...props} />;\n}\n\nexport type MenuTriggerProps = RACMenuTriggerProps;\nexport function MenuTrigger({ ...props }: MenuTriggerProps) {\n return <RACMenuTrigger {...props} />;\n}\n\nexport interface MenuButtonProps<T>\n extends RACMenuProps<T>,\n Omit<RACMenuTriggerProps, \"children\"> {\n label: string;\n variant?: ButtonProps[\"variant\"];\n placement?: MenuPopoverProps[\"placement\"];\n icon?: React.ReactNode;\n}\nexport function MenuButton<T extends object>({\n label,\n children,\n icon,\n placement,\n variant,\n ...props\n}: MenuButtonProps<T>) {\n return (\n <MenuTrigger>\n {icon ? (\n <IconButton variant={variant} aria-label={label}>\n {icon}\n </IconButton>\n ) : (\n <Button variant={variant}>{label}</Button>\n )}\n <MenuPopover placement={placement}>\n <Menu {...props}>{children}</Menu>\n </MenuPopover>\n </MenuTrigger>\n );\n}\n\nexport type MenuPopoverProps = RACPopoverProps;\nexport function MenuPopover({\n UNSTABLE_portalContainer,\n ...props\n}: MenuPopoverProps) {\n // Sem container explícito o menu faz portal no document.body — fora da shadow\n // root do MFE, sem CSS. Ver ui/hooks/useOverlayPortal.\n const portalContainer = useOverlayPortalContainer();\n return (\n <RACPopover\n {...props}\n UNSTABLE_portalContainer={UNSTABLE_portalContainer ?? portalContainer}\n />\n );\n}\n\nexport type MenuItemProps = RACMenuItemProps;\nexport function MenuItem({ className, ...props }: MenuItemProps) {\n const classNames = clsx(className, \"menu-item\");\n const textValue =\n props.textValue ||\n (typeof props.children === \"string\" ? props.children : undefined);\n return (\n <RACMenuItem {...props} className={classNames} textValue={textValue}>\n {({ hasSubmenu }) => (\n <>\n {props.children}\n {hasSubmenu && <IconChevronDown />}\n </>\n )}\n </RACMenuItem>\n );\n}\n\nexport type MenuHeaderProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function MenuHeader({ className, ...props }: MenuHeaderProps) {\n const classNames = clsx(className, \"menu-header\");\n return <div {...props} className={classNames} />;\n}\n\nexport type MenuSectionProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function MenuSection({ className, ...props }: MenuSectionProps) {\n const classNames = clsx(className, \"menu-section\");\n return <div {...props} className={classNames} />;\n}\n\nexport type MenuHeadingProps = TextHeadingProps;\nexport function MenuHeading({ className, ...props }: MenuHeadingProps) {\n const classNames = clsx(className, \"menu-heading\");\n return <TextHeading {...props} className={classNames} />;\n}\n\nexport type MenuSeparatorProps = RACSeparatorProps;\nexport function MenuSeparator({ className, ...props }: MenuSeparatorProps) {\n const classNames = clsx(className, \"menu-separator\");\n return <RACSeparator {...props} className={classNames} />;\n}\n\nexport type MenuLabelProps = LabelProps;\nexport function MenuLabel({ className, ...props }: MenuLabelProps) {\n const classNames = clsx(className, \"menu-label\");\n return <Label {...props} className={classNames} />;\n}\n\nexport type MenuDescriptionProps = DescriptionProps;\nexport function MenuDescription({ className, ...props }: MenuDescriptionProps) {\n const classNames = clsx(className, \"menu-description\");\n return <Description {...props} className={classNames} />;\n}\n\nexport type MenuShortcutProps = KeyboardProps;\nexport function MenuShortcut({\n children,\n className,\n ...props\n}: MenuShortcutProps) {\n const classNames = clsx(className, \"menu-shortcut\");\n return (\n <Keyboard {...props} className={classNames}>\n {children}\n </Keyboard>\n );\n}\n"],"names":["Menu","className","props","jsx","RACMenu","clsx","MenuTrigger","RACMenuTrigger","MenuButton","label","children","icon","placement","variant","IconButton","Button","MenuPopover","UNSTABLE_portalContainer","portalContainer","useOverlayPortalContainer","RACPopover","MenuItem","classNames","textValue","RACMenuItem","hasSubmenu","jsxs","Fragment","IconChevronDown","MenuHeader","MenuSection","MenuHeading","TextHeading","MenuSeparator","RACSeparator","MenuLabel","Label","MenuDescription","Description","MenuShortcut","Keyboard"],"mappings":";;;;;;;;;;AAgCO,SAASA,EAAuB,EAAE,WAAAC,GAAW,GAAGC,KAAuB;AAC5E,SAAO,gBAAAC,EAACC,KAAQ,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,UAAAZ,GACH;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"Menu.js","sources":["../../../../../src/ui/primitives/Menu/Menu.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport { IconChevronDown } from \"icons\";\nimport {\n Button,\n ButtonProps,\n Description,\n DescriptionProps,\n IconButton,\n Keyboard,\n KeyboardProps,\n Label,\n LabelProps,\n TextHeading,\n type TextHeadingProps,\n} from \"primitives\";\nimport React from \"react\";\nimport { PermissionGate } from \"../PermissionGate/PermissionGate\";\nimport {\n Menu as RACMenu,\n MenuItem as RACMenuItem,\n MenuTrigger as RACMenuTrigger,\n Popover as RACPopover,\n Separator as RACSeparator,\n type MenuItemProps as RACMenuItemProps,\n type MenuProps as RACMenuProps,\n type MenuTriggerProps as RACMenuTriggerProps,\n type PopoverProps as RACPopoverProps,\n type SeparatorProps as RACSeparatorProps,\n} from \"react-aria-components\";\nimport \"./menu.css\";\n\n/**\n * Aviso de desenvolvimento: um `PermissionGate` EM VOLTA de um `MenuItem` quebra\n * o menu. O collection builder do react-aria-components só entende nós de\n * coleção (`MenuItem`, `MenuSeparator`, `MenuSection`); o `<span>` que o gate\n * renderiza no ramo negado entra na coleção com `node` nulo e arrebenta a lista\n * encadeada de chaves — o item envolvido e todos os seguintes desaparecem, e se\n * ele for o primeiro filho o menu abre VAZIO, levando embora também os itens\n * permitidos. Não há erro no console, e a forma errada passa despercebida em QA\n * feito com um usuário que tem todas as permissões, porque o ramo que envolve só\n * é renderizado quando a ação é negada.\n *\n * O gate deve ficar DENTRO do item, em volta do conteúdo — ali é seguro, porque\n * o conteúdo do item é renderizado no DOM real, fora da coleção. Mesmo padrão\n * das ações de linha do `DataTable`.\n *\n * O aviso é incondicional, e não atrás de `process.env.NODE_ENV`: o build da lib\n * (`vite.lib.config.ts`) substitui essa variável pelo literal `\"production\"`, o\n * que transformaria o guard em código morto justamente nos consumidores. Só\n * dispara uma vez por sessão, e só quando já existe um bug na árvore.\n */\nlet hasWarnedAboutGateAroundItem = false;\n\nfunction warnOnGateAroundItem(children: React.ReactNode) {\n if (hasWarnedAboutGateAroundItem) return;\n React.Children.forEach(children, (child) => {\n if (!React.isValidElement(child)) return;\n if (child.type === React.Fragment) {\n warnOnGateAroundItem(\n (child.props as { children?: React.ReactNode }).children,\n );\n return;\n }\n if (child.type === PermissionGate) {\n hasWarnedAboutGateAroundItem = true;\n // eslint-disable-next-line no-console\n console.error(\n \"[design-system] Menu: PermissionGate não pode envolver um MenuItem — \" +\n \"o react-aria descarta esse item e os seguintes, e o menu abre vazio \" +\n \"quando ele é o primeiro. Mova o gate para dentro do MenuItem, em \" +\n \"volta do conteúdo do item.\",\n );\n }\n });\n}\n\nexport type MenuProps<T> = RACMenuProps<T>;\nexport function Menu<T extends object>({ className, ...props }: MenuProps<T>) {\n // children pode ser uma função nas coleções dinâmicas do react-aria.\n warnOnGateAroundItem(\n typeof props.children === \"function\" ? null : props.children,\n );\n return <RACMenu className={clsx(className, \"menu\")} {...props} />;\n}\n\nexport type MenuTriggerProps = RACMenuTriggerProps;\nexport function MenuTrigger({ ...props }: MenuTriggerProps) {\n return <RACMenuTrigger {...props} />;\n}\n\nexport interface MenuButtonProps<T>\n extends RACMenuProps<T>,\n Omit<RACMenuTriggerProps, \"children\"> {\n label: string;\n variant?: ButtonProps[\"variant\"];\n placement?: MenuPopoverProps[\"placement\"];\n icon?: React.ReactNode;\n}\nexport function MenuButton<T extends object>({\n label,\n children,\n icon,\n placement,\n variant,\n ...props\n}: MenuButtonProps<T>) {\n return (\n <MenuTrigger>\n {icon ? (\n <IconButton variant={variant} aria-label={label}>\n {icon}\n </IconButton>\n ) : (\n <Button variant={variant}>{label}</Button>\n )}\n <MenuPopover placement={placement}>\n <Menu {...props}>{children}</Menu>\n </MenuPopover>\n </MenuTrigger>\n );\n}\n\nexport type MenuPopoverProps = RACPopoverProps;\nexport function MenuPopover({\n UNSTABLE_portalContainer,\n ...props\n}: MenuPopoverProps) {\n // Sem container explícito o menu faz portal no document.body — fora da shadow\n // root do MFE, sem CSS. Ver ui/hooks/useOverlayPortal.\n const portalContainer = useOverlayPortalContainer();\n return (\n <RACPopover\n {...props}\n UNSTABLE_portalContainer={UNSTABLE_portalContainer ?? portalContainer}\n />\n );\n}\n\nexport type MenuItemProps = RACMenuItemProps;\nexport function MenuItem({ className, ...props }: MenuItemProps) {\n const classNames = clsx(className, \"menu-item\");\n const textValue =\n props.textValue ||\n (typeof props.children === \"string\" ? props.children : undefined);\n return (\n <RACMenuItem {...props} className={classNames} textValue={textValue}>\n {({ hasSubmenu }) => (\n <>\n {props.children}\n {hasSubmenu && <IconChevronDown />}\n </>\n )}\n </RACMenuItem>\n );\n}\n\nexport type MenuHeaderProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function MenuHeader({ className, ...props }: MenuHeaderProps) {\n const classNames = clsx(className, \"menu-header\");\n return <div {...props} className={classNames} />;\n}\n\nexport type MenuSectionProps = React.ComponentPropsWithoutRef<\"div\">;\nexport function MenuSection({ className, ...props }: MenuSectionProps) {\n const classNames = clsx(className, \"menu-section\");\n return <div {...props} className={classNames} />;\n}\n\nexport type MenuHeadingProps = TextHeadingProps;\nexport function MenuHeading({ className, ...props }: MenuHeadingProps) {\n const classNames = clsx(className, \"menu-heading\");\n return <TextHeading {...props} className={classNames} />;\n}\n\nexport type MenuSeparatorProps = RACSeparatorProps;\nexport function MenuSeparator({ className, ...props }: MenuSeparatorProps) {\n const classNames = clsx(className, \"menu-separator\");\n return <RACSeparator {...props} className={classNames} />;\n}\n\nexport type MenuLabelProps = LabelProps;\nexport function MenuLabel({ className, ...props }: MenuLabelProps) {\n const classNames = clsx(className, \"menu-label\");\n return <Label {...props} className={classNames} />;\n}\n\nexport type MenuDescriptionProps = DescriptionProps;\nexport function MenuDescription({ className, ...props }: MenuDescriptionProps) {\n const classNames = clsx(className, \"menu-description\");\n return <Description {...props} className={classNames} />;\n}\n\nexport type MenuShortcutProps = KeyboardProps;\nexport function MenuShortcut({\n children,\n className,\n ...props\n}: MenuShortcutProps) {\n const classNames = clsx(className, \"menu-shortcut\");\n return (\n <Keyboard {...props} className={classNames}>\n {children}\n </Keyboard>\n );\n}\n"],"names":["hasWarnedAboutGateAroundItem","warnOnGateAroundItem","children","React","child","PermissionGate","Menu","className","props","jsx","RACMenu","clsx","MenuTrigger","RACMenuTrigger","MenuButton","label","icon","placement","variant","IconButton","Button","MenuPopover","UNSTABLE_portalContainer","portalContainer","useOverlayPortalContainer","RACPopover","MenuItem","classNames","textValue","RACMenuItem","hasSubmenu","jsxs","Fragment","IconChevronDown","MenuHeader","MenuSection","MenuHeading","TextHeading","MenuSeparator","RACSeparator","MenuLabel","Label","MenuDescription","Description","MenuShortcut","Keyboard"],"mappings":";;;;;;;;;;;;AAoDA,IAAIA,IAA+B;AAEnC,SAASC,EAAqBC,GAA2B;AACvD,EAAIF,KACJG,EAAM,SAAS,QAAQD,GAAU,CAACE,MAAU;AAC1C,QAAKD,EAAM,eAAeC,CAAK,GAC/B;AAAA,UAAIA,EAAM,SAASD,EAAM,UAAU;AACjC,QAAAF;AAAA,UACGG,EAAM,MAAyC;AAAA,QAAA;AAElD;AAAA,MACF;AACA,MAAIA,EAAM,SAASC,MACjBL,IAA+B,IAE/B,QAAQ;AAAA,QACN;AAAA,MAAA;AAAA;AAAA,EAMN,CAAC;AACH;AAGO,SAASM,EAAuB,EAAE,WAAAC,GAAW,GAAGC,KAAuB;AAE5E,SAAAP;AAAA,IACE,OAAOO,EAAM,YAAa,aAAa,OAAOA,EAAM;AAAA,EAAA,GAE/C,gBAAAC,EAACC,KAAQ,WAAWC,EAAKJ,GAAW,MAAM,GAAI,GAAGC,GAAO;AACjE;AAGO,SAASI,EAAY,EAAE,GAAGJ,KAA2B;AAC1D,SAAO,gBAAAC,EAACI,GAAA,EAAgB,GAAGL,EAAA,CAAO;AACpC;AAUO,SAASM,EAA6B;AAAA,EAC3C,OAAAC;AAAA,EACA,UAAAb;AAAA,EACA,MAAAc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KAA2B;AACrE,QAAMmB,IAAahB,EAAKJ,GAAW,cAAc;AACjD,SAAO,gBAAAE,EAAC,OAAA,EAAK,GAAGD,GAAO,WAAWmB,GAAY;AAChD;AAGO,SAASS,EAAY,EAAE,WAAA7B,GAAW,GAAGC,KAA2B;AACrE,QAAMmB,IAAahB,EAAKJ,GAAW,cAAc;AACjD,SAAO,gBAAAE,EAAC4B,GAAA,EAAa,GAAG7B,GAAO,WAAWmB,GAAY;AACxD;AAGO,SAASW,EAAc,EAAE,WAAA/B,GAAW,GAAGC,KAA6B;AACzE,QAAMmB,IAAahB,EAAKJ,GAAW,gBAAgB;AACnD,SAAO,gBAAAE,EAAC8B,GAAA,EAAc,GAAG/B,GAAO,WAAWmB,GAAY;AACzD;AAGO,SAASa,EAAU,EAAE,WAAAjC,GAAW,GAAGC,KAAyB;AACjE,QAAMmB,IAAahB,EAAKJ,GAAW,YAAY;AAC/C,SAAO,gBAAAE,EAACgC,GAAA,EAAO,GAAGjC,GAAO,WAAWmB,GAAY;AAClD;AAGO,SAASe,EAAgB,EAAE,WAAAnC,GAAW,GAAGC,KAA+B;AAC7E,QAAMmB,IAAahB,EAAKJ,GAAW,kBAAkB;AACrD,SAAO,gBAAAE,EAACkC,GAAA,EAAa,GAAGnC,GAAO,WAAWmB,GAAY;AACxD;AAGO,SAASiB,EAAa;AAAA,EAC3B,UAAA1C;AAAA,EACA,WAAAK;AAAA,EACA,GAAGC;AACL,GAAsB;AACpB,QAAMmB,IAAahB,EAAKJ,GAAW,eAAe;AAClD,2BACGsC,GAAA,EAAU,GAAGrC,GAAO,WAAWmB,GAC7B,UAAAzB,GACH;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionGate.cjs","sources":["../../../../../src/ui/primitives/PermissionGate/PermissionGate.tsx"],"sourcesContent":["import React from \"react\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\n\nexport interface PermissionGateProps {\n /** Whether the current user has permission to perform this action. */\n isAllowed: boolean;\n /** Tooltip text shown when the action is not allowed. */\n noAccessLabel: string;\n /**\n * Either a React element or a render prop that receives `isAllowed`.\n * Use the render prop to avoid repeating the permission check inside the child.\n */\n children: React.ReactElement | ((isAllowed: boolean) => React.ReactElement);\n}\n\n/**\n * Wraps any interactive element with a tooltip that appears when `isAllowed` is false.\n *\n * When allowed, renders the trigger directly with no wrapper.\n * When not allowed, wraps in a DS Tooltip with hover trigger.\n * A `<span>` wrapper ensures disabled elements still receive pointer events.\n */\nexport function PermissionGate({\n isAllowed,\n noAccessLabel,\n children,\n}: PermissionGateProps) {\n const trigger =\n typeof children === \"function\" ? children(isAllowed) : children;\n\n if (isAllowed) {\n return trigger;\n }\n\n return (\n <Tooltip content={noAccessLabel} trigger=\"hover\" placement=\"top\" offset={4}>\n <span style={{ display: \"inline-flex\" }}>{trigger}</span>\n </Tooltip>\n );\n}\n"],"names":["PermissionGate","isAllowed","noAccessLabel","children","trigger","Tooltip","jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PermissionGate.cjs","sources":["../../../../../src/ui/primitives/PermissionGate/PermissionGate.tsx"],"sourcesContent":["import React from \"react\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\n\nexport interface PermissionGateProps {\n /** Whether the current user has permission to perform this action. */\n isAllowed: boolean;\n /** Tooltip text shown when the action is not allowed. */\n noAccessLabel: string;\n /**\n * Either a React element or a render prop that receives `isAllowed`.\n * Use the render prop to avoid repeating the permission check inside the child.\n */\n children: React.ReactElement | ((isAllowed: boolean) => React.ReactElement);\n}\n\n/**\n * Wraps any interactive element with a tooltip that appears when `isAllowed` is false.\n *\n * When allowed, renders the trigger directly with no wrapper.\n * When not allowed, wraps in a DS Tooltip with hover trigger.\n * A `<span>` wrapper ensures disabled elements still receive pointer events.\n *\n * Dentro de coleções do react-aria-components (`Menu`, `ListBox`, `Table`,\n * `Tree`) o gate vai NO CONTEÚDO do nó, nunca em volta dele:\n *\n * ```tsx\n * // ERRADO — o react-aria descarta esse item e os seguintes, e o menu abre\n * // vazio se ele for o primeiro. Sem erro no console.\n * <PermissionGate …><MenuItem>…</MenuItem></PermissionGate>\n *\n * // CERTO\n * <MenuItem isDisabled={!allowed}>\n * <PermissionGate …><span>…</span></PermissionGate>\n * </MenuItem>\n * ```\n *\n * O collection builder só reconhece nós de coleção; o `<span>` do ramo negado\n * entra na coleção com `node` nulo e quebra a lista encadeada de chaves. Já o\n * conteúdo de um nó é renderizado no DOM real, fora da coleção, e por isso é\n * seguro — é onde o `DataTable` põe o gate nas ações de linha. O `Menu` avisa no\n * console em desenvolvimento se o gate aparecer em volta de um item.\n */\nexport function PermissionGate({\n isAllowed,\n noAccessLabel,\n children,\n}: PermissionGateProps) {\n const trigger =\n typeof children === \"function\" ? children(isAllowed) : children;\n\n if (isAllowed) {\n return trigger;\n }\n\n return (\n <Tooltip content={noAccessLabel} trigger=\"hover\" placement=\"top\" offset={4}>\n <span style={{ display: \"inline-flex\" }}>{trigger}</span>\n </Tooltip>\n );\n}\n"],"names":["PermissionGate","isAllowed","noAccessLabel","children","trigger","Tooltip","jsx"],"mappings":"yJA0CO,SAASA,EAAe,CAC7B,UAAAC,EACA,cAAAC,EACA,SAAAC,CACF,EAAwB,CACtB,MAAMC,EACJ,OAAOD,GAAa,WAAaA,EAASF,CAAS,EAAIE,EAEzD,OAAIF,EACKG,QAINC,UAAA,CAAQ,QAASH,EAAe,QAAQ,QAAQ,UAAU,MAAM,OAAQ,EACvE,SAAAI,MAAC,QAAK,MAAO,CAAE,QAAS,aAAA,EAAkB,WAAQ,EACpD,CAEJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionGate.js","sources":["../../../../../src/ui/primitives/PermissionGate/PermissionGate.tsx"],"sourcesContent":["import React from \"react\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\n\nexport interface PermissionGateProps {\n /** Whether the current user has permission to perform this action. */\n isAllowed: boolean;\n /** Tooltip text shown when the action is not allowed. */\n noAccessLabel: string;\n /**\n * Either a React element or a render prop that receives `isAllowed`.\n * Use the render prop to avoid repeating the permission check inside the child.\n */\n children: React.ReactElement | ((isAllowed: boolean) => React.ReactElement);\n}\n\n/**\n * Wraps any interactive element with a tooltip that appears when `isAllowed` is false.\n *\n * When allowed, renders the trigger directly with no wrapper.\n * When not allowed, wraps in a DS Tooltip with hover trigger.\n * A `<span>` wrapper ensures disabled elements still receive pointer events.\n */\nexport function PermissionGate({\n isAllowed,\n noAccessLabel,\n children,\n}: PermissionGateProps) {\n const trigger =\n typeof children === \"function\" ? children(isAllowed) : children;\n\n if (isAllowed) {\n return trigger;\n }\n\n return (\n <Tooltip content={noAccessLabel} trigger=\"hover\" placement=\"top\" offset={4}>\n <span style={{ display: \"inline-flex\" }}>{trigger}</span>\n </Tooltip>\n );\n}\n"],"names":["PermissionGate","isAllowed","noAccessLabel","children","trigger","Tooltip","jsx"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"PermissionGate.js","sources":["../../../../../src/ui/primitives/PermissionGate/PermissionGate.tsx"],"sourcesContent":["import React from \"react\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\n\nexport interface PermissionGateProps {\n /** Whether the current user has permission to perform this action. */\n isAllowed: boolean;\n /** Tooltip text shown when the action is not allowed. */\n noAccessLabel: string;\n /**\n * Either a React element or a render prop that receives `isAllowed`.\n * Use the render prop to avoid repeating the permission check inside the child.\n */\n children: React.ReactElement | ((isAllowed: boolean) => React.ReactElement);\n}\n\n/**\n * Wraps any interactive element with a tooltip that appears when `isAllowed` is false.\n *\n * When allowed, renders the trigger directly with no wrapper.\n * When not allowed, wraps in a DS Tooltip with hover trigger.\n * A `<span>` wrapper ensures disabled elements still receive pointer events.\n *\n * Dentro de coleções do react-aria-components (`Menu`, `ListBox`, `Table`,\n * `Tree`) o gate vai NO CONTEÚDO do nó, nunca em volta dele:\n *\n * ```tsx\n * // ERRADO — o react-aria descarta esse item e os seguintes, e o menu abre\n * // vazio se ele for o primeiro. Sem erro no console.\n * <PermissionGate …><MenuItem>…</MenuItem></PermissionGate>\n *\n * // CERTO\n * <MenuItem isDisabled={!allowed}>\n * <PermissionGate …><span>…</span></PermissionGate>\n * </MenuItem>\n * ```\n *\n * O collection builder só reconhece nós de coleção; o `<span>` do ramo negado\n * entra na coleção com `node` nulo e quebra a lista encadeada de chaves. Já o\n * conteúdo de um nó é renderizado no DOM real, fora da coleção, e por isso é\n * seguro — é onde o `DataTable` põe o gate nas ações de linha. O `Menu` avisa no\n * console em desenvolvimento se o gate aparecer em volta de um item.\n */\nexport function PermissionGate({\n isAllowed,\n noAccessLabel,\n children,\n}: PermissionGateProps) {\n const trigger =\n typeof children === \"function\" ? children(isAllowed) : children;\n\n if (isAllowed) {\n return trigger;\n }\n\n return (\n <Tooltip content={noAccessLabel} trigger=\"hover\" placement=\"top\" offset={4}>\n <span style={{ display: \"inline-flex\" }}>{trigger}</span>\n </Tooltip>\n );\n}\n"],"names":["PermissionGate","isAllowed","noAccessLabel","children","trigger","Tooltip","jsx"],"mappings":";;AA0CO,SAASA,EAAe;AAAA,EAC7B,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AACF,GAAwB;AACtB,QAAMC,IACJ,OAAOD,KAAa,aAAaA,EAASF,CAAS,IAAIE;AAEzD,SAAIF,IACKG,sBAINC,GAAA,EAAQ,SAASH,GAAe,SAAQ,SAAQ,WAAU,OAAM,QAAQ,GACvE,UAAA,gBAAAI,EAAC,UAAK,OAAO,EAAE,SAAS,cAAA,GAAkB,aAAQ,GACpD;AAEJ;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import "./jsonviewer.css";
|
|
2
|
+
export interface JsonEditorProps {
|
|
3
|
+
value: string;
|
|
4
|
+
onChange?: (value: string) => void;
|
|
5
|
+
expandAllLabel: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
height?: string | number;
|
|
8
|
+
isDisabled?: boolean;
|
|
9
|
+
isReadOnly?: boolean;
|
|
10
|
+
"aria-label"?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Editable sibling of `JsonViewer`: same CodeMirror-based visual (syntax
|
|
14
|
+
* colors, gutter, scrollbar, border/background) but with typing enabled.
|
|
15
|
+
* `JsonViewer` stays read-only-only on purpose so its bundle keeps assuming
|
|
16
|
+
* a static document; this component owns the editable/controlled behavior.
|
|
17
|
+
*/
|
|
18
|
+
export declare function JsonEditor({ value, onChange, expandAllLabel, className, height, isDisabled, isReadOnly, "aria-label": ariaLabel, }: JsonEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HighlightStyle } from "@codemirror/language";
|
|
2
|
+
export declare const jsonHighlightStyle: HighlightStyle;
|
|
3
|
+
export declare const jsonEditorTheme: import("@codemirror/state").Extension;
|
|
4
|
+
export declare const jsonEditorExtensions: import("@codemirror/state").Extension[];
|
|
5
|
+
export declare function serializeJson(value: unknown): string;
|
|
6
|
+
export declare function toCssSize(size: string | number): string;
|
|
7
|
+
/**
|
|
8
|
+
* Finds the fold range of every direct child (depth 1) of the root object/array
|
|
9
|
+
* by scanning the text itself for matching brackets. This mirrors what
|
|
10
|
+
* CodeMirror's `foldable()` would compute, but doesn't depend on the lezer
|
|
11
|
+
* parser having finished tokenizing the document — which for a multi-MB
|
|
12
|
+
* document is not guaranteed synchronously at mount time.
|
|
13
|
+
*/
|
|
14
|
+
export declare function computeFirstLevelFoldRanges(text: string): {
|
|
15
|
+
from: number;
|
|
16
|
+
to: number;
|
|
17
|
+
}[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ButtonProps, DescriptionProps, KeyboardProps, LabelProps, type TextHeadingProps } from "primitives";
|
|
2
|
-
import
|
|
2
|
+
import React from "react";
|
|
3
3
|
import { type MenuItemProps as RACMenuItemProps, type MenuProps as RACMenuProps, type MenuTriggerProps as RACMenuTriggerProps, type PopoverProps as RACPopoverProps, type SeparatorProps as RACSeparatorProps } from "react-aria-components";
|
|
4
4
|
import "./menu.css";
|
|
5
5
|
export type MenuProps<T> = RACMenuProps<T>;
|
|
@@ -16,5 +16,25 @@ export interface PermissionGateProps {
|
|
|
16
16
|
* When allowed, renders the trigger directly with no wrapper.
|
|
17
17
|
* When not allowed, wraps in a DS Tooltip with hover trigger.
|
|
18
18
|
* A `<span>` wrapper ensures disabled elements still receive pointer events.
|
|
19
|
+
*
|
|
20
|
+
* Dentro de coleções do react-aria-components (`Menu`, `ListBox`, `Table`,
|
|
21
|
+
* `Tree`) o gate vai NO CONTEÚDO do nó, nunca em volta dele:
|
|
22
|
+
*
|
|
23
|
+
* ```tsx
|
|
24
|
+
* // ERRADO — o react-aria descarta esse item e os seguintes, e o menu abre
|
|
25
|
+
* // vazio se ele for o primeiro. Sem erro no console.
|
|
26
|
+
* <PermissionGate …><MenuItem>…</MenuItem></PermissionGate>
|
|
27
|
+
*
|
|
28
|
+
* // CERTO
|
|
29
|
+
* <MenuItem isDisabled={!allowed}>
|
|
30
|
+
* <PermissionGate …><span>…</span></PermissionGate>
|
|
31
|
+
* </MenuItem>
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* O collection builder só reconhece nós de coleção; o `<span>` do ramo negado
|
|
35
|
+
* entra na coleção com `node` nulo e quebra a lista encadeada de chaves. Já o
|
|
36
|
+
* conteúdo de um nó é renderizado no DOM real, fora da coleção, e por isso é
|
|
37
|
+
* seguro — é onde o `DataTable` põe o gate nas ações de linha. O `Menu` avisa no
|
|
38
|
+
* console em desenvolvimento se o gate aparecer em volta de um item.
|
|
19
39
|
*/
|
|
20
40
|
export declare function PermissionGate({ isAllowed, noAccessLabel, children, }: PermissionGateProps): import("react/jsx-runtime").JSX.Element;
|