@apipass/design-system 4.0.0 → 4.2.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 (93) hide show
  1. package/dist/lib/embedded-styles.js +1 -1
  2. package/dist/lib/json-viewer.index.cjs +1 -1
  3. package/dist/lib/json-viewer.index.js +4 -2
  4. package/dist/lib/json-viewer.index.js.map +1 -1
  5. package/dist/lib/lib.index.cjs +1 -1
  6. package/dist/lib/lib.index.js +696 -694
  7. package/dist/lib/lib.index.js.map +1 -1
  8. package/dist/lib/style.css +1 -1
  9. package/dist/lib/ui/components/DataTable/DataTable.cjs +1 -1
  10. package/dist/lib/ui/components/Widget/Widget.cjs +1 -1
  11. package/dist/lib/ui/components/WidgetGrid/WidgetGrid.cjs +1 -1
  12. package/dist/lib/ui/primitives/Button/Button.cjs +1 -1
  13. package/dist/lib/ui/primitives/CodeBlock/CodeBlock.cjs +1 -1
  14. package/dist/lib/ui/primitives/CodeEditor/CodeEditor.cjs +1 -1
  15. package/dist/lib/ui/primitives/ComboBox/ComboBox.cjs +1 -1
  16. package/dist/lib/ui/primitives/ComboBox/ComboBox.cjs.map +1 -1
  17. package/dist/lib/ui/primitives/ComboBox/ComboBox.js +60 -37
  18. package/dist/lib/ui/primitives/ComboBox/ComboBox.js.map +1 -1
  19. package/dist/lib/ui/primitives/DateRangePicker/DateRangePicker.cjs +1 -1
  20. package/dist/lib/ui/primitives/FileUpload/FileUpload.cjs +1 -1
  21. package/dist/lib/ui/primitives/FileUpload/FileUpload.js +10 -10
  22. package/dist/lib/ui/primitives/IconButton/IconButton.cjs +1 -1
  23. package/dist/lib/ui/primitives/Input/Input.js +2 -2
  24. package/dist/lib/ui/primitives/JsonViewer/JsonEditor.cjs +2 -0
  25. package/dist/lib/ui/primitives/JsonViewer/JsonEditor.cjs.map +1 -0
  26. package/dist/lib/ui/primitives/JsonViewer/JsonEditor.js +95 -0
  27. package/dist/lib/ui/primitives/JsonViewer/JsonEditor.js.map +1 -0
  28. package/dist/lib/ui/primitives/JsonViewer/JsonViewer.cjs +1 -1
  29. package/dist/lib/ui/primitives/JsonViewer/JsonViewer.cjs.map +1 -1
  30. package/dist/lib/ui/primitives/JsonViewer/JsonViewer.js +37 -88
  31. package/dist/lib/ui/primitives/JsonViewer/JsonViewer.js.map +1 -1
  32. package/dist/lib/ui/primitives/JsonViewer/json-code-mirror.cjs +2 -0
  33. package/dist/lib/ui/primitives/JsonViewer/json-code-mirror.cjs.map +1 -0
  34. package/dist/lib/ui/primitives/JsonViewer/json-code-mirror.js +64 -0
  35. package/dist/lib/ui/primitives/JsonViewer/json-code-mirror.js.map +1 -0
  36. package/dist/lib/ui/primitives/Link/Link.cjs +1 -1
  37. package/dist/lib/ui/primitives/Link/Link.js +3 -3
  38. package/dist/lib/ui/primitives/Menu/Menu.cjs +1 -1
  39. package/dist/lib/ui/primitives/Menu/Menu.cjs.map +1 -1
  40. package/dist/lib/ui/primitives/Menu/Menu.js +65 -45
  41. package/dist/lib/ui/primitives/Menu/Menu.js.map +1 -1
  42. package/dist/lib/ui/primitives/PermissionGate/PermissionGate.cjs.map +1 -1
  43. package/dist/lib/ui/primitives/PermissionGate/PermissionGate.js.map +1 -1
  44. package/dist/lib/ui/primitives/Search/Search.cjs +1 -1
  45. package/dist/lib/ui/primitives/Search/Search.js +8 -8
  46. package/dist/lib/ui/primitives/Select/MultiSelect.cjs +2 -0
  47. package/dist/lib/ui/primitives/Select/MultiSelect.cjs.map +1 -0
  48. package/dist/lib/ui/primitives/Select/MultiSelect.js +113 -0
  49. package/dist/lib/ui/primitives/Select/MultiSelect.js.map +1 -0
  50. package/dist/lib/ui/primitives/Select/Select.cjs +1 -1
  51. package/dist/lib/ui/primitives/Select/Select.cjs.map +1 -1
  52. package/dist/lib/ui/primitives/Select/Select.js +19 -12
  53. package/dist/lib/ui/primitives/Select/Select.js.map +1 -1
  54. package/dist/lib/vendor/@monaco-editor/react/dist/index.cjs +1 -1
  55. package/dist/lib/vendor/@monaco-editor/react/dist/index.cjs.map +1 -1
  56. package/dist/lib/vendor/@monaco-editor/react/dist/index.js +21 -21
  57. package/dist/lib/vendor/@react-aria/interactions/dist/useFocusable.cjs +1 -1
  58. package/dist/lib/vendor/@react-aria/interactions/dist/useFocusable.js +4 -4
  59. package/dist/lib/vendor/@react-aria/ssr/dist/SSRProvider.js.map +1 -1
  60. package/dist/lib/vendor/@react-stately/utils/dist/useControlledState.cjs +1 -1
  61. package/dist/lib/vendor/react-draggable/build/cjs/Draggable.cjs +2 -2
  62. package/dist/lib/vendor/react-draggable/build/cjs/Draggable.js +8 -8
  63. package/dist/lib/vendor/react-grid-layout/build/GridItem.cjs +1 -1
  64. package/dist/lib/vendor/react-grid-layout/build/ReactGridLayout.cjs +1 -1
  65. package/dist/lib/vendor/react-grid-layout/build/ReactGridLayout.js +6 -6
  66. package/dist/lib/vendor/react-grid-layout/build/ReactGridLayout.js.map +1 -1
  67. package/dist/lib/vendor/react-grid-layout/build/ReactGridLayoutPropTypes.js +2 -2
  68. package/dist/lib/vendor/react-grid-layout/build/ResponsiveReactGridLayout.cjs +1 -1
  69. package/dist/lib/vendor/react-grid-layout/build/ResponsiveReactGridLayout.js.map +1 -1
  70. package/dist/lib/vendor/react-grid-layout/build/components/WidthProvider.cjs +1 -1
  71. package/dist/lib/vendor/react-grid-layout/build/components/WidthProvider.js +6 -6
  72. package/dist/lib/vendor/react-grid-layout/build/components/WidthProvider.js.map +1 -1
  73. package/dist/lib/vendor/react-grid-layout/build/utils.cjs +1 -1
  74. package/dist/lib/vendor/react-grid-layout/build/utils.js +27 -27
  75. package/dist/lib/vendor/react-resizable/build/Resizable.cjs +1 -1
  76. package/dist/lib/vendor/react-resizable/build/Resizable.js +17 -17
  77. package/dist/lib/vendor/react-resizable/build/Resizable.js.map +1 -1
  78. package/dist/lib/vendor/react-resizable/build/ResizableBox.cjs +1 -1
  79. package/dist/lib/vendor/react-resizable/build/ResizableBox.js +5 -5
  80. package/dist/lib/vendor/react-resizable/build/ResizableBox.js.map +1 -1
  81. package/dist/lib/vendor/react-resizable/build/utils.cjs +1 -1
  82. package/dist/lib/vendor/react-resizable/build/utils.cjs.map +1 -1
  83. package/dist/lib/vendor/react-resizable/build/utils.js +2 -2
  84. package/dist/lib/vendor/react-toastify/dist/index.cjs +1 -1
  85. package/dist/lib/vendor/react-toastify/dist/index.js +10 -10
  86. package/dist/types/json-viewer.index.d.ts +1 -0
  87. package/dist/types/ui/primitives/JsonViewer/JsonEditor.d.ts +18 -0
  88. package/dist/types/ui/primitives/JsonViewer/json-code-mirror.d.ts +17 -0
  89. package/dist/types/ui/primitives/Menu/Menu.d.ts +1 -1
  90. package/dist/types/ui/primitives/PermissionGate/PermissionGate.d.ts +20 -0
  91. package/dist/types/ui/primitives/Select/MultiSelect.d.ts +15 -0
  92. package/dist/types/ui/primitives/index.d.ts +1 -0
  93. package/package.json +1 -1
@@ -1,96 +1,116 @@
1
- import { jsx as t, jsxs as u, Fragment as i } from "react/jsx-runtime";
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 { Menu as m, MenuTrigger as l, Popover as f, MenuItem as d, Separator as M } from "react-aria-components";
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 N } from "../../icons/IconChevronDown.js";
6
- import { Label as h, Description as p, Keyboard as g } from "../Fieldset/Fieldset.js";
7
- import { IconButton as x } from "../IconButton/IconButton.js";
8
- import { Button as v } from "../Button/Button.js";
9
- import { useOverlayPortalContainer as I } from "../../hooks/useOverlayPortal.js";
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 C } from "../Button/Button.js";
11
+ import { useOverlayPortalContainer as P } from "../../hooks/useOverlayPortal.js";
10
12
  import { TextHeading as S } 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
+ }
11
29
  function T({ className: n, ...e }) {
12
- return /* @__PURE__ */ t(m, { className: o(n, "menu"), ...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 b({ ...n }) {
15
- return /* @__PURE__ */ t(l, { ...n });
34
+ function A({ ...n }) {
35
+ return /* @__PURE__ */ t(p, { ...n });
16
36
  }
17
- function A({
37
+ function z({
18
38
  label: n,
19
39
  children: e,
20
40
  icon: r,
21
- placement: s,
22
- variant: a,
23
- ...c
41
+ placement: a,
42
+ variant: s,
43
+ ...l
24
44
  }) {
25
- return /* @__PURE__ */ u(b, { children: [
26
- r ? /* @__PURE__ */ t(x, { variant: a, "aria-label": n, children: r }) : /* @__PURE__ */ t(v, { variant: a, children: n }),
27
- /* @__PURE__ */ t(B, { placement: s, children: /* @__PURE__ */ t(T, { ...c, children: e }) })
45
+ return /* @__PURE__ */ m(A, { children: [
46
+ r ? /* @__PURE__ */ t(b, { variant: s, "aria-label": n, children: r }) : /* @__PURE__ */ t(C, { variant: s, children: n }),
47
+ /* @__PURE__ */ t(B, { placement: a, children: /* @__PURE__ */ t(T, { ...l, children: e }) })
28
48
  ] });
29
49
  }
30
50
  function B({
31
51
  UNSTABLE_portalContainer: n,
32
52
  ...e
33
53
  }) {
34
- const r = I();
54
+ const r = P();
35
55
  return /* @__PURE__ */ t(
36
- f,
56
+ N,
37
57
  {
38
58
  ...e,
39
59
  UNSTABLE_portalContainer: n ?? r
40
60
  }
41
61
  );
42
62
  }
43
- function E({ className: n, ...e }) {
44
- const r = o(n, "menu-item"), s = e.textValue || (typeof e.children == "string" ? e.children : void 0);
45
- return /* @__PURE__ */ t(d, { ...e, className: r, textValue: s, children: ({ hasSubmenu: a }) => /* @__PURE__ */ u(i, { children: [
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
- a && /* @__PURE__ */ t(N, {})
67
+ s && /* @__PURE__ */ t(v, {})
48
68
  ] }) });
49
69
  }
50
- function F({ className: n, ...e }) {
70
+ function R({ className: n, ...e }) {
51
71
  const r = o(n, "menu-header");
52
72
  return /* @__PURE__ */ t("div", { ...e, className: r });
53
73
  }
54
- function K({ className: n, ...e }) {
74
+ function U({ className: n, ...e }) {
55
75
  const r = o(n, "menu-section");
56
76
  return /* @__PURE__ */ t("div", { ...e, className: r });
57
77
  }
58
- function O({ className: n, ...e }) {
78
+ function W({ className: n, ...e }) {
59
79
  const r = o(n, "menu-heading");
60
80
  return /* @__PURE__ */ t(S, { ...e, className: r });
61
81
  }
62
- function U({ className: n, ...e }) {
82
+ function _({ className: n, ...e }) {
63
83
  const r = o(n, "menu-separator");
64
- return /* @__PURE__ */ t(M, { ...e, className: r });
84
+ return /* @__PURE__ */ t(g, { ...e, className: r });
65
85
  }
66
- function _({ className: n, ...e }) {
86
+ function k({ className: n, ...e }) {
67
87
  const r = o(n, "menu-label");
68
- return /* @__PURE__ */ t(h, { ...e, className: r });
88
+ return /* @__PURE__ */ t(I, { ...e, className: r });
69
89
  }
70
- function k({ className: n, ...e }) {
90
+ function J({ className: n, ...e }) {
71
91
  const r = o(n, "menu-description");
72
- return /* @__PURE__ */ t(p, { ...e, className: r });
92
+ return /* @__PURE__ */ t(x, { ...e, className: r });
73
93
  }
74
- function q({
94
+ function Q({
75
95
  children: n,
76
96
  className: e,
77
97
  ...r
78
98
  }) {
79
- const s = o(e, "menu-shortcut");
80
- return /* @__PURE__ */ t(g, { ...r, className: s, children: n });
99
+ const a = o(e, "menu-shortcut");
100
+ return /* @__PURE__ */ t(y, { ...r, className: a, children: n });
81
101
  }
82
102
  export {
83
103
  T as Menu,
84
- A as MenuButton,
85
- k as MenuDescription,
86
- F as MenuHeader,
87
- O as MenuHeading,
88
- E as MenuItem,
89
- _ as MenuLabel,
104
+ z as MenuButton,
105
+ J as MenuDescription,
106
+ R as MenuHeader,
107
+ W as MenuHeading,
108
+ K as MenuItem,
109
+ k as MenuLabel,
90
110
  B as MenuPopover,
91
- K as MenuSection,
92
- U as MenuSeparator,
93
- q as MenuShortcut,
94
- b as MenuTrigger
111
+ U as MenuSection,
112
+ _ as MenuSeparator,
113
+ Q as MenuShortcut,
114
+ A 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,K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GAAA,EAAU,GAAGtC,GAAO,WAAWoB,GAC7B,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 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,IAC/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;AA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,GAAW,GAAGC,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":"yJAsBO,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
+ {"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":";;AAsBO,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;"}
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;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),d=require("../../../vendor/clsx/dist/clsx.cjs"),a=require("react"),u=require("react-aria-components");;/* empty css */const q=require("../../icons/IconX.cjs"),S=require("../../icons/IconSearch.cjs"),b=require("../../hooks/useOverlayPortal.cjs"),B=require("../Fieldset/Fieldset.cjs"),f=require("../Input/Input.cjs"),h=require("../IconButton/IconButton.cjs"),x=require("../ListBox/ListBox.cjs"),v=a.forwardRef(function({className:m,results:c,onSearch:o,...i},n){const[l,j]=a.useState(""),t=a.useRef(null),s=e=>{j(e),o&&o(e)},p=d.clsx(m,"search-input-container"),I=b.useOverlayPortalContainer();return r.jsxs(u.ComboBox,{className:p,children:[r.jsx(B.Label,{hidden:!0,children:i["aria-label"]||"Search"}),r.jsx(f.Input,{type:"search",className:"search-input",value:l,onInput:e=>s(e.currentTarget.value),ref:e=>{t.current=e,typeof n=="function"?n(e):n&&(n.current=e)},...i}),r.jsx("span",{className:"search-icon",children:l?r.jsx(h.IconButton,{"aria-label":"Clear search",onPress:()=>s(""),size:"small",variant:"subtle",children:r.jsx(q.IconX,{})}):r.jsx(h.IconButton,{"aria-label":"Clear search",onPress:()=>{var e;return(e=t==null?void 0:t.current)==null?void 0:e.focus()},size:"small",variant:"subtle",children:r.jsx(S.IconSearch,{})})}),r.jsx(u.Popover,{UNSTABLE_portalContainer:I,children:r.jsx(x.ListBox,{children:c==null?void 0:c.map(e=>r.jsx(x.ListBoxItem,{onAction:()=>s(e),children:e},e))})})]})});exports.Search=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),d=require("../../../vendor/clsx/dist/clsx.cjs"),a=require("react"),u=require("react-aria-components");;/* empty css */const q=require("../../icons/IconX.cjs"),S=require("../../icons/IconSearch.cjs"),b=require("../../hooks/useOverlayPortal.cjs"),f=require("../Fieldset/Fieldset.cjs"),v=require("../Input/Input.cjs"),h=require("../IconButton/IconButton.cjs"),x=require("../ListBox/ListBox.cjs"),B=a.forwardRef(function({className:m,results:c,onSearch:o,...i},n){const[l,j]=a.useState(""),t=a.useRef(null),s=e=>{j(e),o&&o(e)},p=d.clsx(m,"search-input-container"),I=b.useOverlayPortalContainer();return r.jsxs(u.ComboBox,{className:p,children:[r.jsx(f.Label,{hidden:!0,children:i["aria-label"]||"Search"}),r.jsx(v.Input,{type:"search",className:"search-input",value:l,onInput:e=>s(e.currentTarget.value),ref:e=>{t.current=e,typeof n=="function"?n(e):n&&(n.current=e)},...i}),r.jsx("span",{className:"search-icon",children:l?r.jsx(h.IconButton,{"aria-label":"Clear search",onPress:()=>s(""),size:"small",variant:"subtle",children:r.jsx(q.IconX,{})}):r.jsx(h.IconButton,{"aria-label":"Clear search",onPress:()=>{var e;return(e=t==null?void 0:t.current)==null?void 0:e.focus()},size:"small",variant:"subtle",children:r.jsx(S.IconSearch,{})})}),r.jsx(u.Popover,{UNSTABLE_portalContainer:I,children:r.jsx(x.ListBox,{children:c==null?void 0:c.map(e=>r.jsx(x.ListBoxItem,{onAction:()=>s(e),children:e},e))})})]})});exports.Search=B;
2
2
  //# sourceMappingURL=Search.cjs.map
@@ -1,16 +1,16 @@
1
1
  import { jsxs as f, jsx as e } from "react/jsx-runtime";
2
2
  import { clsx as d } from "../../../vendor/clsx/dist/clsx.js";
3
3
  import I, { useState as b, useRef as x } from "react";
4
- import { ComboBox as v, Popover as B } from "react-aria-components";
4
+ import { ComboBox as v, Popover as C } from "react-aria-components";
5
5
  /* empty css */
6
- import { IconX as C } from "../../icons/IconX.js";
7
- import { IconSearch as S } from "../../icons/IconSearch.js";
6
+ import { IconX as S } from "../../icons/IconX.js";
7
+ import { IconSearch as B } from "../../icons/IconSearch.js";
8
8
  import { useOverlayPortalContainer as N } from "../../hooks/useOverlayPortal.js";
9
9
  import { Label as L } from "../Fieldset/Fieldset.js";
10
10
  import { Input as P } from "../Input/Input.js";
11
11
  import { IconButton as m } from "../IconButton/IconButton.js";
12
12
  import { ListBox as T, ListBoxItem as y } from "../ListBox/ListBox.js";
13
- const q = I.forwardRef(function({ className: l, results: a, onSearch: c, ...i }, o) {
13
+ const D = I.forwardRef(function({ className: l, results: a, onSearch: c, ...i }, o) {
14
14
  const [s, p] = b(""), t = x(null), n = (r) => {
15
15
  p(r), c && c(r);
16
16
  }, h = d(l, "search-input-container"), u = N();
@@ -36,7 +36,7 @@ const q = I.forwardRef(function({ className: l, results: a, onSearch: c, ...i },
36
36
  onPress: () => n(""),
37
37
  size: "small",
38
38
  variant: "subtle",
39
- children: /* @__PURE__ */ e(C, {})
39
+ children: /* @__PURE__ */ e(S, {})
40
40
  }
41
41
  ) : /* @__PURE__ */ e(
42
42
  m,
@@ -48,13 +48,13 @@ const q = I.forwardRef(function({ className: l, results: a, onSearch: c, ...i },
48
48
  },
49
49
  size: "small",
50
50
  variant: "subtle",
51
- children: /* @__PURE__ */ e(S, {})
51
+ children: /* @__PURE__ */ e(B, {})
52
52
  }
53
53
  ) }),
54
- /* @__PURE__ */ e(B, { UNSTABLE_portalContainer: u, children: /* @__PURE__ */ e(T, { children: a == null ? void 0 : a.map((r) => /* @__PURE__ */ e(y, { onAction: () => n(r), children: r }, r)) }) })
54
+ /* @__PURE__ */ e(C, { UNSTABLE_portalContainer: u, children: /* @__PURE__ */ e(T, { children: a == null ? void 0 : a.map((r) => /* @__PURE__ */ e(y, { onAction: () => n(r), children: r }, r)) }) })
55
55
  ] });
56
56
  });
57
57
  export {
58
- q as Search
58
+ D as Search
59
59
  };
60
60
  //# sourceMappingURL=Search.js.map
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),E=require("../../../vendor/clsx/dist/clsx.cjs"),s=require("react"),h=require("react-aria-components");;/* empty css */const F=require("../../icons/IconChevronDown.cjs"),N=require("../../hooks/useOverlayPortal.cjs"),u=require("../Fieldset/Fieldset.cjs"),R=require("../ListBox/ListBox.cjs");function v(t){const{id:e}=t.props;return String(e??t.key??"")}function I(t){const{textValue:e,children:r}=t.props;return e!==void 0?e:typeof r=="string"?r:""}function m(t,e){s.Children.forEach(t,r=>{s.isValidElement(r)&&e(r)})}function M(t){const e=new Set;return m(t,r=>e.add(v(r))),e}function O(t,e){const r=new Set([...e].map(String)),o=[];return m(t,c=>{r.has(v(c))&&o.push(I(c))}),o.join(", ")}function B({className:t,label:e,description:r,errorMessage:o,placeholder:c,children:d,selectedKeys:x,onSelectionChange:j,isDisabled:S,isInvalid:y,disallowEmptySelection:q,"aria-label":g}){const C=E.clsx(t,"select-container"),b=N.useOverlayPortalContainer(),l=s.useRef(null),[T,w]=s.useState(),f=s.useCallback(()=>{l.current&&w(`${l.current.offsetWidth}px`)},[]);s.useLayoutEffect(()=>{f();const i=l.current;if(!i||typeof ResizeObserver>"u")return;const p=new ResizeObserver(f);return p.observe(i),()=>p.disconnect()},[f]);const a=O(d,x);return n.jsx("div",{className:C,children:n.jsxs(u.Field,{children:[e&&n.jsx(u.Label,{children:e}),n.jsxs(h.MenuTrigger,{children:[n.jsxs(h.Button,{ref:l,className:"select","aria-label":g,isDisabled:S,"data-invalid":y||void 0,children:[n.jsx("span",{className:"select-value","data-placeholder":a===""||void 0,title:a||void 0,children:a===""?c:a}),n.jsx(F.IconChevronDown,{"aria-hidden":"true"})]}),n.jsx(h.Popover,{className:"select-popover",style:{"--trigger-width":T},UNSTABLE_portalContainer:b,children:n.jsx(R.ListBox,{"aria-label":e??g,autoFocus:!0,selectionMode:"multiple",disallowEmptySelection:q,selectedKeys:x,onSelectionChange:i=>j(i==="all"?M(d):new Set(i)),children:d})})]}),r&&n.jsx(u.Description,{children:r}),n.jsx(u.FieldError,{children:o})]})})}exports.MultiSelectField=B;
2
+ //# sourceMappingURL=MultiSelect.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultiSelect.cjs","sources":["../../../../../src/ui/primitives/Select/MultiSelect.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport { IconChevronDown } from \"icons\";\nimport {\n Description,\n Field,\n FieldError,\n Label,\n ListBox,\n SharedFieldProps,\n} from \"primitives\";\nimport React, { useCallback, useLayoutEffect, useRef, useState } from \"react\";\nimport {\n Button as RACButton,\n MenuTrigger as RACMenuTrigger,\n Popover as RACPopover,\n type Key as RACKey,\n type Selection as RACSelection,\n} from \"react-aria-components\";\nimport \"./select.css\";\n\nfunction itemKey(item: React.ReactElement): string {\n const { id } = item.props as { id?: RACKey };\n return String(id ?? item.key ?? \"\");\n}\n\nfunction itemText(item: React.ReactElement): string {\n const { textValue, children } = item.props as {\n textValue?: string;\n children?: React.ReactNode;\n };\n if (textValue !== undefined) return textValue;\n return typeof children === \"string\" ? children : \"\";\n}\n\nfunction forEachItem(\n children: React.ReactNode,\n visit: (item: React.ReactElement) => void,\n) {\n React.Children.forEach(children, (child) => {\n if (React.isValidElement(child)) visit(child);\n });\n}\n\nfunction allItemKeys(children: React.ReactNode): Set<RACKey> {\n const keys = new Set<RACKey>();\n forEachItem(children, (item) => keys.add(itemKey(item)));\n return keys;\n}\n\nfunction selectedItemsText(\n children: React.ReactNode,\n selectedKeys: Iterable<RACKey>,\n): string {\n const selected = new Set([...selectedKeys].map(String));\n const texts: string[] = [];\n forEachItem(children, (item) => {\n if (selected.has(itemKey(item))) texts.push(itemText(item));\n });\n return texts.join(\", \");\n}\n\nexport interface MultiSelectFieldProps extends SharedFieldProps {\n children: React.ReactNode;\n selectedKeys: Iterable<RACKey>;\n onSelectionChange: (keys: Set<RACKey>) => void;\n className?: string;\n isDisabled?: boolean;\n isInvalid?: boolean;\n disallowEmptySelection?: boolean;\n \"aria-label\"?: string;\n}\n\nexport function MultiSelectField({\n className,\n label,\n description,\n errorMessage,\n placeholder,\n children,\n selectedKeys,\n onSelectionChange,\n isDisabled,\n isInvalid,\n disallowEmptySelection,\n \"aria-label\": ariaLabel,\n}: MultiSelectFieldProps) {\n const classNames = clsx(className, \"select-container\");\n const portalContainer = useOverlayPortalContainer();\n const triggerRef = useRef<HTMLButtonElement>(null);\n const [triggerWidth, setTriggerWidth] = useState<string>();\n\n const measureTrigger = useCallback(() => {\n if (triggerRef.current) {\n setTriggerWidth(`${triggerRef.current.offsetWidth}px`);\n }\n }, []);\n\n useLayoutEffect(() => {\n measureTrigger();\n const trigger = triggerRef.current;\n if (!trigger || typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(measureTrigger);\n observer.observe(trigger);\n return () => observer.disconnect();\n }, [measureTrigger]);\n\n const chosenText = selectedItemsText(children, selectedKeys);\n\n return (\n <div className={classNames}>\n <Field>\n {label && <Label>{label}</Label>}\n <RACMenuTrigger>\n <RACButton\n ref={triggerRef}\n className=\"select\"\n aria-label={ariaLabel}\n isDisabled={isDisabled}\n data-invalid={isInvalid || undefined}\n >\n <span\n className=\"select-value\"\n data-placeholder={chosenText === \"\" || undefined}\n title={chosenText || undefined}\n >\n {chosenText === \"\" ? placeholder : chosenText}\n </span>\n <IconChevronDown aria-hidden=\"true\" />\n </RACButton>\n <RACPopover\n className=\"select-popover\"\n style={{ \"--trigger-width\": triggerWidth } as React.CSSProperties}\n UNSTABLE_portalContainer={portalContainer}\n >\n <ListBox\n aria-label={label ?? ariaLabel}\n autoFocus\n selectionMode=\"multiple\"\n disallowEmptySelection={disallowEmptySelection}\n selectedKeys={selectedKeys}\n onSelectionChange={(keys: RACSelection) =>\n onSelectionChange(\n keys === \"all\" ? allItemKeys(children) : new Set(keys),\n )\n }\n >\n {children}\n </ListBox>\n </RACPopover>\n </RACMenuTrigger>\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n </Field>\n </div>\n );\n}\n"],"names":["itemKey","item","id","itemText","textValue","children","forEachItem","visit","React","child","allItemKeys","keys","selectedItemsText","selectedKeys","selected","texts","MultiSelectField","className","label","description","errorMessage","placeholder","onSelectionChange","isDisabled","isInvalid","disallowEmptySelection","ariaLabel","classNames","clsx","portalContainer","useOverlayPortalContainer","triggerRef","useRef","triggerWidth","setTriggerWidth","useState","measureTrigger","useCallback","useLayoutEffect","trigger","observer","chosenText","jsx","Field","Label","RACMenuTrigger","jsxs","RACButton","IconChevronDown","RACPopover","ListBox","Description","FieldError"],"mappings":"kaAqBA,SAASA,EAAQC,EAAkC,CACjD,KAAM,CAAE,GAAAC,GAAOD,EAAK,MACpB,OAAO,OAAOC,GAAMD,EAAK,KAAO,EAAE,CACpC,CAEA,SAASE,EAASF,EAAkC,CAClD,KAAM,CAAE,UAAAG,EAAW,SAAAC,CAAA,EAAaJ,EAAK,MAIrC,OAAIG,IAAc,OAAkBA,EAC7B,OAAOC,GAAa,SAAWA,EAAW,EACnD,CAEA,SAASC,EACPD,EACAE,EACA,CACAC,EAAM,SAAS,QAAQH,EAAWI,GAAU,CACtCD,EAAM,eAAeC,CAAK,KAASA,CAAK,CAC9C,CAAC,CACH,CAEA,SAASC,EAAYL,EAAwC,CAC3D,MAAMM,MAAW,IACjB,OAAAL,EAAYD,EAAWJ,GAASU,EAAK,IAAIX,EAAQC,CAAI,CAAC,CAAC,EAChDU,CACT,CAEA,SAASC,EACPP,EACAQ,EACQ,CACR,MAAMC,EAAW,IAAI,IAAI,CAAC,GAAGD,CAAY,EAAE,IAAI,MAAM,CAAC,EAChDE,EAAkB,CAAA,EACxB,OAAAT,EAAYD,EAAWJ,GAAS,CAC1Ba,EAAS,IAAId,EAAQC,CAAI,CAAC,GAAGc,EAAM,KAAKZ,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,EAAAA,IAACM,EAAAA,gBAAA,CAAgB,cAAY,MAAA,CAAO,CAAA,CAAA,CAAA,EAEtCN,EAAAA,IAACO,EAAAA,QAAA,CACC,UAAU,iBACV,MAAO,CAAE,kBAAmBhB,CAAA,EAC5B,yBAA0BJ,EAE1B,SAAAa,EAAAA,IAACQ,EAAAA,QAAA,CACC,aAAYhC,GAASQ,EACrB,UAAS,GACT,cAAc,WACd,uBAAAD,EACA,aAAAZ,EACA,kBAAoBF,GAClBW,EACEX,IAAS,MAAQD,EAAYL,CAAQ,EAAI,IAAI,IAAIM,CAAI,CAAA,EAIxD,SAAAN,CAAA,CAAA,CACH,CAAA,CACF,EACF,EACCc,GAAeuB,EAAAA,IAACS,EAAAA,YAAA,CAAa,SAAAhC,CAAA,CAAY,EAC1CuB,EAAAA,IAACU,EAAAA,YAAY,SAAAhC,CAAA,CAAa,CAAA,CAAA,CAC5B,CAAA,CACF,CAEJ"}
@@ -0,0 +1,113 @@
1
+ import { jsx as n, jsxs as d } from "react/jsx-runtime";
2
+ import { clsx as N } from "../../../vendor/clsx/dist/clsx.js";
3
+ import h, { useRef as R, useState as F, useCallback as I, useLayoutEffect as j } from "react";
4
+ import { MenuTrigger as B, Button as L, Popover as M } from "react-aria-components";
5
+ /* empty css */
6
+ import { IconChevronDown as O } from "../../icons/IconChevronDown.js";
7
+ import { useOverlayPortalContainer as W } from "../../hooks/useOverlayPortal.js";
8
+ import { Field as k, Label as z, Description as D, FieldError as P } from "../Fieldset/Fieldset.js";
9
+ import { ListBox as V } from "../ListBox/ListBox.js";
10
+ function g(t) {
11
+ const { id: e } = t.props;
12
+ return String(e ?? t.key ?? "");
13
+ }
14
+ function A(t) {
15
+ const { textValue: e, children: r } = t.props;
16
+ return e !== void 0 ? e : typeof r == "string" ? r : "";
17
+ }
18
+ function v(t, e) {
19
+ h.Children.forEach(t, (r) => {
20
+ h.isValidElement(r) && e(r);
21
+ });
22
+ }
23
+ function K(t) {
24
+ const e = /* @__PURE__ */ new Set();
25
+ return v(t, (r) => e.add(g(r))), e;
26
+ }
27
+ function U(t, e) {
28
+ const r = new Set([...e].map(String)), i = [];
29
+ return v(t, (s) => {
30
+ r.has(g(s)) && i.push(A(s));
31
+ }), i.join(", ");
32
+ }
33
+ function Z({
34
+ className: t,
35
+ label: e,
36
+ description: r,
37
+ errorMessage: i,
38
+ placeholder: s,
39
+ children: a,
40
+ selectedKeys: f,
41
+ onSelectionChange: x,
42
+ isDisabled: S,
43
+ isInvalid: y,
44
+ disallowEmptySelection: C,
45
+ "aria-label": m
46
+ }) {
47
+ const T = N(t, "select-container"), b = W(), c = R(null), [w, E] = F(), u = I(() => {
48
+ c.current && E(`${c.current.offsetWidth}px`);
49
+ }, []);
50
+ j(() => {
51
+ u();
52
+ const o = c.current;
53
+ if (!o || typeof ResizeObserver > "u") return;
54
+ const p = new ResizeObserver(u);
55
+ return p.observe(o), () => p.disconnect();
56
+ }, [u]);
57
+ const l = U(a, f);
58
+ return /* @__PURE__ */ n("div", { className: T, children: /* @__PURE__ */ d(k, { children: [
59
+ e && /* @__PURE__ */ n(z, { children: e }),
60
+ /* @__PURE__ */ d(B, { children: [
61
+ /* @__PURE__ */ d(
62
+ L,
63
+ {
64
+ ref: c,
65
+ className: "select",
66
+ "aria-label": m,
67
+ isDisabled: S,
68
+ "data-invalid": y || void 0,
69
+ children: [
70
+ /* @__PURE__ */ n(
71
+ "span",
72
+ {
73
+ className: "select-value",
74
+ "data-placeholder": l === "" || void 0,
75
+ title: l || void 0,
76
+ children: l === "" ? s : l
77
+ }
78
+ ),
79
+ /* @__PURE__ */ n(O, { "aria-hidden": "true" })
80
+ ]
81
+ }
82
+ ),
83
+ /* @__PURE__ */ n(
84
+ M,
85
+ {
86
+ className: "select-popover",
87
+ style: { "--trigger-width": w },
88
+ UNSTABLE_portalContainer: b,
89
+ children: /* @__PURE__ */ n(
90
+ V,
91
+ {
92
+ "aria-label": e ?? m,
93
+ autoFocus: !0,
94
+ selectionMode: "multiple",
95
+ disallowEmptySelection: C,
96
+ selectedKeys: f,
97
+ onSelectionChange: (o) => x(
98
+ o === "all" ? K(a) : new Set(o)
99
+ ),
100
+ children: a
101
+ }
102
+ )
103
+ }
104
+ )
105
+ ] }),
106
+ r && /* @__PURE__ */ n(D, { children: r }),
107
+ /* @__PURE__ */ n(P, { children: i })
108
+ ] }) });
109
+ }
110
+ export {
111
+ Z as MultiSelectField
112
+ };
113
+ //# sourceMappingURL=MultiSelect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultiSelect.js","sources":["../../../../../src/ui/primitives/Select/MultiSelect.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport { IconChevronDown } from \"icons\";\nimport {\n Description,\n Field,\n FieldError,\n Label,\n ListBox,\n SharedFieldProps,\n} from \"primitives\";\nimport React, { useCallback, useLayoutEffect, useRef, useState } from \"react\";\nimport {\n Button as RACButton,\n MenuTrigger as RACMenuTrigger,\n Popover as RACPopover,\n type Key as RACKey,\n type Selection as RACSelection,\n} from \"react-aria-components\";\nimport \"./select.css\";\n\nfunction itemKey(item: React.ReactElement): string {\n const { id } = item.props as { id?: RACKey };\n return String(id ?? item.key ?? \"\");\n}\n\nfunction itemText(item: React.ReactElement): string {\n const { textValue, children } = item.props as {\n textValue?: string;\n children?: React.ReactNode;\n };\n if (textValue !== undefined) return textValue;\n return typeof children === \"string\" ? children : \"\";\n}\n\nfunction forEachItem(\n children: React.ReactNode,\n visit: (item: React.ReactElement) => void,\n) {\n React.Children.forEach(children, (child) => {\n if (React.isValidElement(child)) visit(child);\n });\n}\n\nfunction allItemKeys(children: React.ReactNode): Set<RACKey> {\n const keys = new Set<RACKey>();\n forEachItem(children, (item) => keys.add(itemKey(item)));\n return keys;\n}\n\nfunction selectedItemsText(\n children: React.ReactNode,\n selectedKeys: Iterable<RACKey>,\n): string {\n const selected = new Set([...selectedKeys].map(String));\n const texts: string[] = [];\n forEachItem(children, (item) => {\n if (selected.has(itemKey(item))) texts.push(itemText(item));\n });\n return texts.join(\", \");\n}\n\nexport interface MultiSelectFieldProps extends SharedFieldProps {\n children: React.ReactNode;\n selectedKeys: Iterable<RACKey>;\n onSelectionChange: (keys: Set<RACKey>) => void;\n className?: string;\n isDisabled?: boolean;\n isInvalid?: boolean;\n disallowEmptySelection?: boolean;\n \"aria-label\"?: string;\n}\n\nexport function MultiSelectField({\n className,\n label,\n description,\n errorMessage,\n placeholder,\n children,\n selectedKeys,\n onSelectionChange,\n isDisabled,\n isInvalid,\n disallowEmptySelection,\n \"aria-label\": ariaLabel,\n}: MultiSelectFieldProps) {\n const classNames = clsx(className, \"select-container\");\n const portalContainer = useOverlayPortalContainer();\n const triggerRef = useRef<HTMLButtonElement>(null);\n const [triggerWidth, setTriggerWidth] = useState<string>();\n\n const measureTrigger = useCallback(() => {\n if (triggerRef.current) {\n setTriggerWidth(`${triggerRef.current.offsetWidth}px`);\n }\n }, []);\n\n useLayoutEffect(() => {\n measureTrigger();\n const trigger = triggerRef.current;\n if (!trigger || typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(measureTrigger);\n observer.observe(trigger);\n return () => observer.disconnect();\n }, [measureTrigger]);\n\n const chosenText = selectedItemsText(children, selectedKeys);\n\n return (\n <div className={classNames}>\n <Field>\n {label && <Label>{label}</Label>}\n <RACMenuTrigger>\n <RACButton\n ref={triggerRef}\n className=\"select\"\n aria-label={ariaLabel}\n isDisabled={isDisabled}\n data-invalid={isInvalid || undefined}\n >\n <span\n className=\"select-value\"\n data-placeholder={chosenText === \"\" || undefined}\n title={chosenText || undefined}\n >\n {chosenText === \"\" ? placeholder : chosenText}\n </span>\n <IconChevronDown aria-hidden=\"true\" />\n </RACButton>\n <RACPopover\n className=\"select-popover\"\n style={{ \"--trigger-width\": triggerWidth } as React.CSSProperties}\n UNSTABLE_portalContainer={portalContainer}\n >\n <ListBox\n aria-label={label ?? ariaLabel}\n autoFocus\n selectionMode=\"multiple\"\n disallowEmptySelection={disallowEmptySelection}\n selectedKeys={selectedKeys}\n onSelectionChange={(keys: RACSelection) =>\n onSelectionChange(\n keys === \"all\" ? allItemKeys(children) : new Set(keys),\n )\n }\n >\n {children}\n </ListBox>\n </RACPopover>\n </RACMenuTrigger>\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n </Field>\n </div>\n );\n}\n"],"names":["itemKey","item","id","itemText","textValue","children","forEachItem","visit","React","child","allItemKeys","keys","selectedItemsText","selectedKeys","selected","texts","MultiSelectField","className","label","description","errorMessage","placeholder","onSelectionChange","isDisabled","isInvalid","disallowEmptySelection","ariaLabel","classNames","clsx","portalContainer","useOverlayPortalContainer","triggerRef","useRef","triggerWidth","setTriggerWidth","useState","measureTrigger","useCallback","useLayoutEffect","trigger","observer","chosenText","jsx","Field","Label","RACMenuTrigger","jsxs","RACButton","IconChevronDown","RACPopover","ListBox","Description","FieldError"],"mappings":";;;;;;;;;AAqBA,SAASA,EAAQC,GAAkC;AACjD,QAAM,EAAE,IAAAC,MAAOD,EAAK;AACpB,SAAO,OAAOC,KAAMD,EAAK,OAAO,EAAE;AACpC;AAEA,SAASE,EAASF,GAAkC;AAClD,QAAM,EAAE,WAAAG,GAAW,UAAAC,EAAA,IAAaJ,EAAK;AAIrC,SAAIG,MAAc,SAAkBA,IAC7B,OAAOC,KAAa,WAAWA,IAAW;AACnD;AAEA,SAASC,EACPD,GACAE,GACA;AACA,EAAAC,EAAM,SAAS,QAAQH,GAAU,CAACI,MAAU;AAC1C,IAAID,EAAM,eAAeC,CAAK,OAASA,CAAK;AAAA,EAC9C,CAAC;AACH;AAEA,SAASC,EAAYL,GAAwC;AAC3D,QAAMM,wBAAW,IAAA;AACjB,SAAAL,EAAYD,GAAU,CAACJ,MAASU,EAAK,IAAIX,EAAQC,CAAI,CAAC,CAAC,GAChDU;AACT;AAEA,SAASC,EACPP,GACAQ,GACQ;AACR,QAAMC,IAAW,IAAI,IAAI,CAAC,GAAGD,CAAY,EAAE,IAAI,MAAM,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AA,UACC,KAAKhB;AAAA,UACL,WAAU;AAAA,UACV,cAAYL;AAAA,UACZ,YAAAH;AAAA,UACA,gBAAcC,KAAa;AAAA,UAE3B,UAAA;AAAA,YAAA,gBAAAkB;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAU;AAAA,gBACV,oBAAkBD,MAAe,MAAM;AAAA,gBACvC,OAAOA,KAAc;AAAA,gBAEpB,UAAAA,MAAe,KAAKpB,IAAcoB;AAAA,cAAA;AAAA,YAAA;AAAA,YAErC,gBAAAC,EAACM,GAAA,EAAgB,eAAY,OAAA,CAAO;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,MAEtC,gBAAAN;AAAA,QAACO;AAAAA,QAAA;AAAA,UACC,WAAU;AAAA,UACV,OAAO,EAAE,mBAAmBhB,EAAA;AAAA,UAC5B,0BAA0BJ;AAAA,UAE1B,UAAA,gBAAAa;AAAA,YAACQ;AAAA,YAAA;AAAA,cACC,cAAYhC,KAASQ;AAAA,cACrB,WAAS;AAAA,cACT,eAAc;AAAA,cACd,wBAAAD;AAAA,cACA,cAAAZ;AAAA,cACA,mBAAmB,CAACF,MAClBW;AAAA,gBACEX,MAAS,QAAQD,EAAYL,CAAQ,IAAI,IAAI,IAAIM,CAAI;AAAA,cAAA;AAAA,cAIxD,UAAAN;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IACF,GACF;AAAA,IACCc,KAAe,gBAAAuB,EAACS,GAAA,EAAa,UAAAhC,EAAA,CAAY;AAAA,IAC1C,gBAAAuB,EAACU,KAAY,UAAAhC,EAAA,CAAa;AAAA,EAAA,EAAA,CAC5B,EAAA,CACF;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("../../../vendor/clsx/dist/clsx.cjs"),n=require("react-aria-components");;/* empty css */const h=require("../../icons/IconChevronDown.cjs"),S=require("../../icons/IconCheck.cjs"),q=require("../../hooks/useOverlayPortal.cjs"),r=require("../Fieldset/Fieldset.cjs"),a=require("../ListBox/ListBox.cjs");function C({className:t,label:s,description:c,errorMessage:l,children:o,items:x,...j}){const m=i.clsx(t,"select-container"),d=q.useOverlayPortalContainer();return e.jsx(u,{className:m,...j,children:e.jsxs(r.Field,{children:[s&&e.jsx(r.Label,{children:s}),e.jsxs(n.Button,{className:"select",children:[e.jsx(n.SelectValue,{className:"select-value"}),e.jsx(h.IconChevronDown,{"aria-hidden":"true"})]}),e.jsx(n.Popover,{UNSTABLE_portalContainer:d,children:e.jsx(a.ListBox,{items:x,children:o})}),c&&e.jsx(r.Description,{children:c}),e.jsx(r.FieldError,{children:l})]})})}function u({...t}){return e.jsx(n.Select,{...t})}function N({children:t,className:s,...c}){const l=i.clsx(s,"select-item"),o=typeof t=="string"?t:"";return e.jsx(a.ListBoxItem,{textValue:o,className:l,...c,children:e.jsxs(e.Fragment,{children:[e.jsx(S.IconCheck,{className:"select-item-check"}),t]})})}exports.Select=u;exports.SelectField=C;exports.SelectItem=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("../../../vendor/clsx/dist/clsx.cjs"),n=require("react-aria-components");;/* empty css */const h=require("../../icons/IconChevronDown.cjs"),S=require("../../icons/IconCheck.cjs"),q=require("../../hooks/useOverlayPortal.cjs"),r=require("../Fieldset/Fieldset.cjs"),a=require("../ListBox/ListBox.cjs");function N({className:s,label:t,description:c,errorMessage:l,children:o,items:x,...m}){const j=i.clsx(s,"select-container"),d=q.useOverlayPortalContainer();return e.jsx(u,{className:j,...m,children:e.jsxs(r.Field,{children:[t&&e.jsx(r.Label,{children:t}),e.jsxs(n.Button,{className:"select",children:[e.jsx(n.SelectValue,{className:"select-value"}),e.jsx(h.IconChevronDown,{"aria-hidden":"true"})]}),e.jsx(n.Popover,{className:"select-popover",UNSTABLE_portalContainer:d,children:e.jsx(a.ListBox,{items:x,children:o})}),c&&e.jsx(r.Description,{children:c}),e.jsx(r.FieldError,{children:l})]})})}function u({...s}){return e.jsx(n.Select,{...s})}function p({children:s,className:t,...c}){const l=i.clsx(t,"select-item"),o=typeof s=="string"?s:"";return e.jsx(a.ListBoxItem,{textValue:o,className:l,...c,children:e.jsxs(e.Fragment,{children:[e.jsx(S.IconCheck,{className:"select-item-check"}),s]})})}exports.Select=u;exports.SelectField=N;exports.SelectItem=p;
2
2
  //# sourceMappingURL=Select.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Select.cjs","sources":["../../../../../src/ui/primitives/Select/Select.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport { IconCheck, IconChevronDown } from \"icons\";\nimport {\n Description,\n Field,\n FieldError,\n Label,\n ListBox,\n ListBoxItem,\n SharedFieldProps,\n type ListBoxItemProps,\n} from \"primitives\";\nimport {\n Button as RACButton,\n Popover as RACPopover,\n Select as RACSelect,\n SelectValue as RACSelectValue,\n type SelectProps as RACSelectProps,\n} from \"react-aria-components\";\nimport \"./select.css\";\n\nexport interface SelectFieldProps<T extends object>\n extends Omit<SelectProps<T>, \"children\">,\n SharedFieldProps {\n items?: Iterable<T>;\n children: React.ReactNode | ((item: T) => React.ReactNode);\n}\nexport function SelectField<T extends object>({\n className,\n label,\n description,\n errorMessage,\n children,\n items,\n ...props\n}: SelectFieldProps<T>) {\n const classNames = clsx(className, \"select-container\");\n // Sem container explícito o dropdown faz portal no document.body — fora da\n // shadow root do MFE, sem CSS. Ver ui/hooks/useOverlayPortal.\n const portalContainer = useOverlayPortalContainer();\n return (\n <Select className={classNames} {...props}>\n <Field>\n {label && <Label>{label}</Label>}\n <RACButton className=\"select\">\n <RACSelectValue className=\"select-value\" />\n <IconChevronDown aria-hidden=\"true\" />\n </RACButton>\n <RACPopover UNSTABLE_portalContainer={portalContainer}>\n <ListBox items={items}>{children}</ListBox>\n </RACPopover>\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n </Field>\n </Select>\n );\n}\n\nexport type SelectProps<T extends object> = RACSelectProps<T>;\nexport function Select<T extends object>({ ...props }: SelectProps<T>) {\n return <RACSelect<T> {...props} />;\n}\n\nexport type SelectItemProps = ListBoxItemProps;\nexport function SelectItem({ children, className, ...props }: SelectItemProps) {\n const classNames = clsx(className, \"select-item\");\n const textValue = typeof children === \"string\" ? children : \"\";\n return (\n <ListBoxItem textValue={textValue} className={classNames} {...props}>\n <>\n <IconCheck className=\"select-item-check\" />\n {children}\n </>\n </ListBoxItem>\n );\n}\n"],"names":["SelectField","className","label","description","errorMessage","children","items","props","classNames","clsx","portalContainer","useOverlayPortalContainer","Select","Field","jsx","Label","jsxs","RACButton","RACSelectValue","IconChevronDown","RACPopover","ListBox","Description","FieldError","RACSelect","SelectItem","textValue","ListBoxItem","Fragment","IconCheck"],"mappings":"sbA4BO,SAASA,EAA8B,CAC5C,UAAAC,EACA,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,SAAAC,EACA,MAAAC,EACA,GAAGC,CACL,EAAwB,CACtB,MAAMC,EAAaC,EAAAA,KAAKR,EAAW,kBAAkB,EAG/CS,EAAkBC,EAAAA,0BAAA,EACxB,aACGC,EAAA,CAAO,UAAWJ,EAAa,GAAGD,EACjC,gBAACM,EAAAA,MAAA,CACE,SAAA,CAAAX,GAASY,EAAAA,IAACC,EAAAA,OAAO,SAAAb,CAAA,CAAM,EACxBc,EAAAA,KAACC,EAAAA,OAAA,CAAU,UAAU,SACnB,SAAA,CAAAH,EAAAA,IAACI,EAAAA,YAAA,CAAe,UAAU,cAAA,CAAe,EACzCJ,EAAAA,IAACK,EAAAA,gBAAA,CAAgB,cAAY,MAAA,CAAO,CAAA,EACtC,EACAL,EAAAA,IAACM,EAAAA,SAAW,yBAA0BV,EACpC,eAACW,EAAAA,QAAA,CAAQ,MAAAf,EAAe,SAAAD,EAAS,CAAA,CACnC,EACCF,GAAeW,EAAAA,IAACQ,EAAAA,YAAA,CAAa,SAAAnB,CAAA,CAAY,EAC1CW,EAAAA,IAACS,EAAAA,YAAY,SAAAnB,CAAA,CAAa,CAAA,CAAA,CAC5B,CAAA,CACF,CAEJ,CAGO,SAASQ,EAAyB,CAAE,GAAGL,GAAyB,CACrE,OAAOO,MAACU,EAAAA,OAAA,CAAc,GAAGjB,CAAA,CAAO,CAClC,CAGO,SAASkB,EAAW,CAAE,SAAApB,EAAU,UAAAJ,EAAW,GAAGM,GAA0B,CAC7E,MAAMC,EAAaC,EAAAA,KAAKR,EAAW,aAAa,EAC1CyB,EAAY,OAAOrB,GAAa,SAAWA,EAAW,GAC5D,aACGsB,EAAAA,YAAA,CAAY,UAAAD,EAAsB,UAAWlB,EAAa,GAAGD,EAC5D,SAAAS,EAAAA,KAAAY,EAAAA,SAAA,CACE,SAAA,CAAAd,EAAAA,IAACe,EAAAA,UAAA,CAAU,UAAU,mBAAA,CAAoB,EACxCxB,CAAA,CAAA,CACH,CAAA,CACF,CAEJ"}
1
+ {"version":3,"file":"Select.cjs","sources":["../../../../../src/ui/primitives/Select/Select.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport { IconCheck, IconChevronDown } from \"icons\";\nimport {\n Description,\n Field,\n FieldError,\n Label,\n ListBox,\n ListBoxItem,\n SharedFieldProps,\n type ListBoxItemProps,\n} from \"primitives\";\nimport {\n Button as RACButton,\n Popover as RACPopover,\n Select as RACSelect,\n SelectValue as RACSelectValue,\n type SelectProps as RACSelectProps,\n} from \"react-aria-components\";\nimport \"./select.css\";\n\nexport interface SelectFieldProps<T extends object>\n extends Omit<SelectProps<T>, \"children\">,\n SharedFieldProps {\n items?: Iterable<T>;\n children: React.ReactNode | ((item: T) => React.ReactNode);\n}\nexport function SelectField<T extends object>({\n className,\n label,\n description,\n errorMessage,\n children,\n items,\n ...props\n}: SelectFieldProps<T>) {\n const classNames = clsx(className, \"select-container\");\n // Sem container explícito o dropdown faz portal no document.body — fora da\n // shadow root do MFE, sem CSS. Ver ui/hooks/useOverlayPortal.\n const portalContainer = useOverlayPortalContainer();\n return (\n <Select className={classNames} {...props}>\n <Field>\n {label && <Label>{label}</Label>}\n <RACButton className=\"select\">\n <RACSelectValue className=\"select-value\" />\n <IconChevronDown aria-hidden=\"true\" />\n </RACButton>\n <RACPopover\n className=\"select-popover\"\n UNSTABLE_portalContainer={portalContainer}\n >\n <ListBox items={items}>{children}</ListBox>\n </RACPopover>\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n </Field>\n </Select>\n );\n}\n\nexport type SelectProps<T extends object> = RACSelectProps<T>;\nexport function Select<T extends object>({ ...props }: SelectProps<T>) {\n return <RACSelect<T> {...props} />;\n}\n\nexport type SelectItemProps = ListBoxItemProps;\nexport function SelectItem({ children, className, ...props }: SelectItemProps) {\n const classNames = clsx(className, \"select-item\");\n const textValue = typeof children === \"string\" ? children : \"\";\n return (\n <ListBoxItem textValue={textValue} className={classNames} {...props}>\n <>\n <IconCheck className=\"select-item-check\" />\n {children}\n </>\n </ListBoxItem>\n );\n}\n"],"names":["SelectField","className","label","description","errorMessage","children","items","props","classNames","clsx","portalContainer","useOverlayPortalContainer","Select","Field","jsx","Label","jsxs","RACButton","RACSelectValue","IconChevronDown","RACPopover","ListBox","Description","FieldError","RACSelect","SelectItem","textValue","ListBoxItem","Fragment","IconCheck"],"mappings":"sbA4BO,SAASA,EAA8B,CAC5C,UAAAC,EACA,MAAAC,EACA,YAAAC,EACA,aAAAC,EACA,SAAAC,EACA,MAAAC,EACA,GAAGC,CACL,EAAwB,CACtB,MAAMC,EAAaC,EAAAA,KAAKR,EAAW,kBAAkB,EAG/CS,EAAkBC,EAAAA,0BAAA,EACxB,aACGC,EAAA,CAAO,UAAWJ,EAAa,GAAGD,EACjC,gBAACM,EAAAA,MAAA,CACE,SAAA,CAAAX,GAASY,EAAAA,IAACC,EAAAA,OAAO,SAAAb,CAAA,CAAM,EACxBc,EAAAA,KAACC,EAAAA,OAAA,CAAU,UAAU,SACnB,SAAA,CAAAH,EAAAA,IAACI,EAAAA,YAAA,CAAe,UAAU,cAAA,CAAe,EACzCJ,EAAAA,IAACK,EAAAA,gBAAA,CAAgB,cAAY,MAAA,CAAO,CAAA,EACtC,EACAL,EAAAA,IAACM,EAAAA,QAAA,CACC,UAAU,iBACV,yBAA0BV,EAE1B,SAAAI,EAAAA,IAACO,EAAAA,QAAA,CAAQ,MAAAf,EAAe,SAAAD,CAAA,CAAS,CAAA,CAAA,EAElCF,GAAeW,EAAAA,IAACQ,EAAAA,YAAA,CAAa,SAAAnB,CAAA,CAAY,EAC1CW,EAAAA,IAACS,EAAAA,YAAY,SAAAnB,CAAA,CAAa,CAAA,CAAA,CAC5B,CAAA,CACF,CAEJ,CAGO,SAASQ,EAAyB,CAAE,GAAGL,GAAyB,CACrE,OAAOO,MAACU,EAAAA,OAAA,CAAc,GAAGjB,CAAA,CAAO,CAClC,CAGO,SAASkB,EAAW,CAAE,SAAApB,EAAU,UAAAJ,EAAW,GAAGM,GAA0B,CAC7E,MAAMC,EAAaC,EAAAA,KAAKR,EAAW,aAAa,EAC1CyB,EAAY,OAAOrB,GAAa,SAAWA,EAAW,GAC5D,aACGsB,EAAAA,YAAA,CAAY,UAAAD,EAAsB,UAAWlB,EAAa,GAAGD,EAC5D,SAAAS,EAAAA,KAAAY,EAAAA,SAAA,CACE,SAAA,CAAAd,EAAAA,IAACe,EAAAA,UAAA,CAAU,UAAU,mBAAA,CAAoB,EACxCxB,CAAA,CAAA,CACH,CAAA,CACF,CAEJ"}
@@ -1,38 +1,45 @@
1
1
  import { jsx as e, jsxs as l, Fragment as u } from "react/jsx-runtime";
2
- import { clsx as s } from "../../../vendor/clsx/dist/clsx.js";
3
- import { Button as f, SelectValue as d, Popover as h, Select as x } from "react-aria-components";
2
+ import { clsx as n } from "../../../vendor/clsx/dist/clsx.js";
3
+ import { Button as f, SelectValue as d, Popover as h, Select as N } from "react-aria-components";
4
4
  /* empty css */
5
- import { IconChevronDown as N } from "../../icons/IconChevronDown.js";
5
+ import { IconChevronDown as x } from "../../icons/IconChevronDown.js";
6
6
  import { IconCheck as S } from "../../icons/IconCheck.js";
7
- import { useOverlayPortalContainer as C } from "../../hooks/useOverlayPortal.js";
8
- import { Field as v, Label as B, Description as F, FieldError as I } from "../Fieldset/Fieldset.js";
7
+ import { useOverlayPortalContainer as v } from "../../hooks/useOverlayPortal.js";
8
+ import { Field as C, Label as B, Description as F, FieldError as I } from "../Fieldset/Fieldset.js";
9
9
  import { ListBox as L, ListBoxItem as V } from "../ListBox/ListBox.js";
10
10
  function T({
11
11
  className: t,
12
12
  label: r,
13
13
  description: o,
14
14
  errorMessage: c,
15
- children: n,
15
+ children: s,
16
16
  items: i,
17
17
  ...a
18
18
  }) {
19
- const m = s(t, "select-container"), p = C();
20
- return /* @__PURE__ */ e(g, { className: m, ...a, children: /* @__PURE__ */ l(v, { children: [
19
+ const m = n(t, "select-container"), p = v();
20
+ return /* @__PURE__ */ e(g, { className: m, ...a, children: /* @__PURE__ */ l(C, { children: [
21
21
  r && /* @__PURE__ */ e(B, { children: r }),
22
22
  /* @__PURE__ */ l(f, { className: "select", children: [
23
23
  /* @__PURE__ */ e(d, { className: "select-value" }),
24
- /* @__PURE__ */ e(N, { "aria-hidden": "true" })
24
+ /* @__PURE__ */ e(x, { "aria-hidden": "true" })
25
25
  ] }),
26
- /* @__PURE__ */ e(h, { UNSTABLE_portalContainer: p, children: /* @__PURE__ */ e(L, { items: i, children: n }) }),
26
+ /* @__PURE__ */ e(
27
+ h,
28
+ {
29
+ className: "select-popover",
30
+ UNSTABLE_portalContainer: p,
31
+ children: /* @__PURE__ */ e(L, { items: i, children: s })
32
+ }
33
+ ),
27
34
  o && /* @__PURE__ */ e(F, { children: o }),
28
35
  /* @__PURE__ */ e(I, { children: c })
29
36
  ] }) });
30
37
  }
31
38
  function g({ ...t }) {
32
- return /* @__PURE__ */ e(x, { ...t });
39
+ return /* @__PURE__ */ e(N, { ...t });
33
40
  }
34
41
  function U({ children: t, className: r, ...o }) {
35
- const c = s(r, "select-item");
42
+ const c = n(r, "select-item");
36
43
  return /* @__PURE__ */ e(V, { textValue: typeof t == "string" ? t : "", className: c, ...o, children: /* @__PURE__ */ l(u, { children: [
37
44
  /* @__PURE__ */ e(S, { className: "select-item-check" }),
38
45
  t
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","sources":["../../../../../src/ui/primitives/Select/Select.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport { IconCheck, IconChevronDown } from \"icons\";\nimport {\n Description,\n Field,\n FieldError,\n Label,\n ListBox,\n ListBoxItem,\n SharedFieldProps,\n type ListBoxItemProps,\n} from \"primitives\";\nimport {\n Button as RACButton,\n Popover as RACPopover,\n Select as RACSelect,\n SelectValue as RACSelectValue,\n type SelectProps as RACSelectProps,\n} from \"react-aria-components\";\nimport \"./select.css\";\n\nexport interface SelectFieldProps<T extends object>\n extends Omit<SelectProps<T>, \"children\">,\n SharedFieldProps {\n items?: Iterable<T>;\n children: React.ReactNode | ((item: T) => React.ReactNode);\n}\nexport function SelectField<T extends object>({\n className,\n label,\n description,\n errorMessage,\n children,\n items,\n ...props\n}: SelectFieldProps<T>) {\n const classNames = clsx(className, \"select-container\");\n // Sem container explícito o dropdown faz portal no document.body — fora da\n // shadow root do MFE, sem CSS. Ver ui/hooks/useOverlayPortal.\n const portalContainer = useOverlayPortalContainer();\n return (\n <Select className={classNames} {...props}>\n <Field>\n {label && <Label>{label}</Label>}\n <RACButton className=\"select\">\n <RACSelectValue className=\"select-value\" />\n <IconChevronDown aria-hidden=\"true\" />\n </RACButton>\n <RACPopover UNSTABLE_portalContainer={portalContainer}>\n <ListBox items={items}>{children}</ListBox>\n </RACPopover>\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n </Field>\n </Select>\n );\n}\n\nexport type SelectProps<T extends object> = RACSelectProps<T>;\nexport function Select<T extends object>({ ...props }: SelectProps<T>) {\n return <RACSelect<T> {...props} />;\n}\n\nexport type SelectItemProps = ListBoxItemProps;\nexport function SelectItem({ children, className, ...props }: SelectItemProps) {\n const classNames = clsx(className, \"select-item\");\n const textValue = typeof children === \"string\" ? children : \"\";\n return (\n <ListBoxItem textValue={textValue} className={classNames} {...props}>\n <>\n <IconCheck className=\"select-item-check\" />\n {children}\n </>\n </ListBoxItem>\n );\n}\n"],"names":["SelectField","className","label","description","errorMessage","children","items","props","classNames","clsx","portalContainer","useOverlayPortalContainer","Select","Field","jsx","Label","jsxs","RACButton","RACSelectValue","IconChevronDown","RACPopover","ListBox","Description","FieldError","RACSelect","SelectItem","ListBoxItem","Fragment","IconCheck"],"mappings":";;;;;;;;;AA4BO,SAASA,EAA8B;AAAA,EAC5C,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,GAAwB;AACtB,QAAMC,IAAaC,EAAKR,GAAW,kBAAkB,GAG/CS,IAAkBC,EAAA;AACxB,2BACGC,GAAA,EAAO,WAAWJ,GAAa,GAAGD,GACjC,4BAACM,GAAA,EACE,UAAA;AAAA,IAAAX,KAAS,gBAAAY,EAACC,KAAO,UAAAb,EAAA,CAAM;AAAA,IACxB,gBAAAc,EAACC,GAAA,EAAU,WAAU,UACnB,UAAA;AAAA,MAAA,gBAAAH,EAACI,GAAA,EAAe,WAAU,eAAA,CAAe;AAAA,MACzC,gBAAAJ,EAACK,GAAA,EAAgB,eAAY,OAAA,CAAO;AAAA,IAAA,GACtC;AAAA,IACA,gBAAAL,EAACM,KAAW,0BAA0BV,GACpC,4BAACW,GAAA,EAAQ,OAAAf,GAAe,UAAAD,GAAS,EAAA,CACnC;AAAA,IACCF,KAAe,gBAAAW,EAACQ,GAAA,EAAa,UAAAnB,EAAA,CAAY;AAAA,IAC1C,gBAAAW,EAACS,KAAY,UAAAnB,EAAA,CAAa;AAAA,EAAA,EAAA,CAC5B,EAAA,CACF;AAEJ;AAGO,SAASQ,EAAyB,EAAE,GAAGL,KAAyB;AACrE,SAAO,gBAAAO,EAACU,GAAA,EAAc,GAAGjB,EAAA,CAAO;AAClC;AAGO,SAASkB,EAAW,EAAE,UAAApB,GAAU,WAAAJ,GAAW,GAAGM,KAA0B;AAC7E,QAAMC,IAAaC,EAAKR,GAAW,aAAa;AAEhD,2BACGyB,GAAA,EAAY,WAFG,OAAOrB,KAAa,WAAWA,IAAW,IAEvB,WAAWG,GAAa,GAAGD,GAC5D,UAAA,gBAAAS,EAAAW,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAb,EAACc,GAAA,EAAU,WAAU,oBAAA,CAAoB;AAAA,IACxCvB;AAAA,EAAA,EAAA,CACH,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"Select.js","sources":["../../../../../src/ui/primitives/Select/Select.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { useOverlayPortalContainer } from \"hooks\";\nimport { IconCheck, IconChevronDown } from \"icons\";\nimport {\n Description,\n Field,\n FieldError,\n Label,\n ListBox,\n ListBoxItem,\n SharedFieldProps,\n type ListBoxItemProps,\n} from \"primitives\";\nimport {\n Button as RACButton,\n Popover as RACPopover,\n Select as RACSelect,\n SelectValue as RACSelectValue,\n type SelectProps as RACSelectProps,\n} from \"react-aria-components\";\nimport \"./select.css\";\n\nexport interface SelectFieldProps<T extends object>\n extends Omit<SelectProps<T>, \"children\">,\n SharedFieldProps {\n items?: Iterable<T>;\n children: React.ReactNode | ((item: T) => React.ReactNode);\n}\nexport function SelectField<T extends object>({\n className,\n label,\n description,\n errorMessage,\n children,\n items,\n ...props\n}: SelectFieldProps<T>) {\n const classNames = clsx(className, \"select-container\");\n // Sem container explícito o dropdown faz portal no document.body — fora da\n // shadow root do MFE, sem CSS. Ver ui/hooks/useOverlayPortal.\n const portalContainer = useOverlayPortalContainer();\n return (\n <Select className={classNames} {...props}>\n <Field>\n {label && <Label>{label}</Label>}\n <RACButton className=\"select\">\n <RACSelectValue className=\"select-value\" />\n <IconChevronDown aria-hidden=\"true\" />\n </RACButton>\n <RACPopover\n className=\"select-popover\"\n UNSTABLE_portalContainer={portalContainer}\n >\n <ListBox items={items}>{children}</ListBox>\n </RACPopover>\n {description && <Description>{description}</Description>}\n <FieldError>{errorMessage}</FieldError>\n </Field>\n </Select>\n );\n}\n\nexport type SelectProps<T extends object> = RACSelectProps<T>;\nexport function Select<T extends object>({ ...props }: SelectProps<T>) {\n return <RACSelect<T> {...props} />;\n}\n\nexport type SelectItemProps = ListBoxItemProps;\nexport function SelectItem({ children, className, ...props }: SelectItemProps) {\n const classNames = clsx(className, \"select-item\");\n const textValue = typeof children === \"string\" ? children : \"\";\n return (\n <ListBoxItem textValue={textValue} className={classNames} {...props}>\n <>\n <IconCheck className=\"select-item-check\" />\n {children}\n </>\n </ListBoxItem>\n );\n}\n"],"names":["SelectField","className","label","description","errorMessage","children","items","props","classNames","clsx","portalContainer","useOverlayPortalContainer","Select","Field","jsx","Label","jsxs","RACButton","RACSelectValue","IconChevronDown","RACPopover","ListBox","Description","FieldError","RACSelect","SelectItem","ListBoxItem","Fragment","IconCheck"],"mappings":";;;;;;;;;AA4BO,SAASA,EAA8B;AAAA,EAC5C,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,GAAwB;AACtB,QAAMC,IAAaC,EAAKR,GAAW,kBAAkB,GAG/CS,IAAkBC,EAAA;AACxB,2BACGC,GAAA,EAAO,WAAWJ,GAAa,GAAGD,GACjC,4BAACM,GAAA,EACE,UAAA;AAAA,IAAAX,KAAS,gBAAAY,EAACC,KAAO,UAAAb,EAAA,CAAM;AAAA,IACxB,gBAAAc,EAACC,GAAA,EAAU,WAAU,UACnB,UAAA;AAAA,MAAA,gBAAAH,EAACI,GAAA,EAAe,WAAU,eAAA,CAAe;AAAA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