@raystack/apsara 0.48.2 → 0.48.4

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 (122) hide show
  1. package/dist/components/avatar/avatar.cjs +1 -1
  2. package/dist/components/avatar/avatar.cjs.map +1 -1
  3. package/dist/components/avatar/avatar.d.ts.map +1 -1
  4. package/dist/components/avatar/avatar.js +1 -1
  5. package/dist/components/avatar/avatar.js.map +1 -1
  6. package/dist/components/breadcrumb/breadcrumb-item.cjs +26 -0
  7. package/dist/components/breadcrumb/breadcrumb-item.cjs.map +1 -0
  8. package/dist/components/breadcrumb/breadcrumb-item.d.ts +14 -0
  9. package/dist/components/breadcrumb/breadcrumb-item.d.ts.map +1 -0
  10. package/dist/components/breadcrumb/breadcrumb-item.js +24 -0
  11. package/dist/components/breadcrumb/breadcrumb-item.js.map +1 -0
  12. package/dist/components/breadcrumb/breadcrumb-misc.cjs +20 -0
  13. package/dist/components/breadcrumb/breadcrumb-misc.cjs.map +1 -0
  14. package/dist/components/breadcrumb/breadcrumb-misc.d.ts +8 -0
  15. package/dist/components/breadcrumb/breadcrumb-misc.d.ts.map +1 -0
  16. package/dist/components/breadcrumb/breadcrumb-misc.js +17 -0
  17. package/dist/components/breadcrumb/breadcrumb-misc.js.map +1 -0
  18. package/dist/components/breadcrumb/breadcrumb-root.cjs +25 -0
  19. package/dist/components/breadcrumb/breadcrumb-root.cjs.map +1 -0
  20. package/dist/components/breadcrumb/breadcrumb-root.d.ts +10 -0
  21. package/dist/components/breadcrumb/breadcrumb-root.d.ts.map +1 -0
  22. package/dist/components/breadcrumb/breadcrumb-root.js +23 -0
  23. package/dist/components/breadcrumb/breadcrumb-root.js.map +1 -0
  24. package/dist/components/breadcrumb/breadcrumb.cjs +7 -53
  25. package/dist/components/breadcrumb/breadcrumb.cjs.map +1 -1
  26. package/dist/components/breadcrumb/breadcrumb.d.ts +5 -27
  27. package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
  28. package/dist/components/breadcrumb/breadcrumb.js +7 -53
  29. package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
  30. package/dist/components/breadcrumb/breadcrumb.module.css.cjs +1 -1
  31. package/dist/components/breadcrumb/breadcrumb.module.css.js +1 -1
  32. package/dist/components/breadcrumb/index.d.ts +1 -1
  33. package/dist/components/data-table/utils/filter-operations.cjs +46 -22
  34. package/dist/components/data-table/utils/filter-operations.cjs.map +1 -1
  35. package/dist/components/data-table/utils/filter-operations.d.ts +10 -9
  36. package/dist/components/data-table/utils/filter-operations.d.ts.map +1 -1
  37. package/dist/components/data-table/utils/filter-operations.js +46 -22
  38. package/dist/components/data-table/utils/filter-operations.js.map +1 -1
  39. package/dist/components/dropdown-menu/dropdown-menu-misc.cjs +1 -1
  40. package/dist/components/dropdown-menu/dropdown-menu-misc.cjs.map +1 -1
  41. package/dist/components/dropdown-menu/dropdown-menu-misc.js +1 -1
  42. package/dist/components/dropdown-menu/dropdown-menu-misc.js.map +1 -1
  43. package/dist/components/dropdown-menu/dropdown-menu-root.cjs +10 -10
  44. package/dist/components/dropdown-menu/dropdown-menu-root.cjs.map +1 -1
  45. package/dist/components/dropdown-menu/dropdown-menu-root.d.ts +8 -5
  46. package/dist/components/dropdown-menu/dropdown-menu-root.d.ts.map +1 -1
  47. package/dist/components/dropdown-menu/dropdown-menu-root.js +11 -11
  48. package/dist/components/dropdown-menu/dropdown-menu-root.js.map +1 -1
  49. package/dist/components/dropdown-menu/dropdown-menu-trigger.cjs +6 -2
  50. package/dist/components/dropdown-menu/dropdown-menu-trigger.cjs.map +1 -1
  51. package/dist/components/dropdown-menu/dropdown-menu-trigger.d.ts +1 -0
  52. package/dist/components/dropdown-menu/dropdown-menu-trigger.d.ts.map +1 -1
  53. package/dist/components/dropdown-menu/dropdown-menu-trigger.js +6 -2
  54. package/dist/components/dropdown-menu/dropdown-menu-trigger.js.map +1 -1
  55. package/dist/components/dropdown-menu/dropdown-menu.d.ts +1 -1
  56. package/dist/components/filter-chip/filter-chip-operation.cjs +31 -0
  57. package/dist/components/filter-chip/filter-chip-operation.cjs.map +1 -0
  58. package/dist/components/filter-chip/filter-chip-operation.d.ts +11 -0
  59. package/dist/components/filter-chip/filter-chip-operation.d.ts.map +1 -0
  60. package/dist/components/filter-chip/filter-chip-operation.js +29 -0
  61. package/dist/components/filter-chip/filter-chip-operation.js.map +1 -0
  62. package/dist/components/filter-chip/filter-chip.cjs +37 -41
  63. package/dist/components/filter-chip/filter-chip.cjs.map +1 -1
  64. package/dist/components/filter-chip/filter-chip.d.ts +6 -5
  65. package/dist/components/filter-chip/filter-chip.d.ts.map +1 -1
  66. package/dist/components/filter-chip/filter-chip.js +37 -41
  67. package/dist/components/filter-chip/filter-chip.js.map +1 -1
  68. package/dist/components/filter-chip/filter-chip.module.css.cjs +1 -1
  69. package/dist/components/filter-chip/filter-chip.module.css.js +1 -1
  70. package/dist/components/select/select-item.cjs +2 -1
  71. package/dist/components/select/select-item.cjs.map +1 -1
  72. package/dist/components/select/select-item.d.ts.map +1 -1
  73. package/dist/components/select/select-item.js +2 -1
  74. package/dist/components/select/select-item.js.map +1 -1
  75. package/dist/components/select/select-root.cjs +2 -2
  76. package/dist/components/select/select-root.cjs.map +1 -1
  77. package/dist/components/select/select-root.d.ts.map +1 -1
  78. package/dist/components/select/select-root.js +2 -2
  79. package/dist/components/select/select-root.js.map +1 -1
  80. package/dist/components/sidebar/index.d.ts +1 -1
  81. package/dist/components/sidebar/sidebar.cjs +11 -12
  82. package/dist/components/sidebar/sidebar.cjs.map +1 -1
  83. package/dist/components/sidebar/sidebar.d.ts +5 -10
  84. package/dist/components/sidebar/sidebar.d.ts.map +1 -1
  85. package/dist/components/sidebar/sidebar.js +12 -13
  86. package/dist/components/sidebar/sidebar.js.map +1 -1
  87. package/dist/components/sidebar/sidebar.module.css.cjs +1 -1
  88. package/dist/components/sidebar/sidebar.module.css.js +1 -1
  89. package/dist/components/tooltip/index.d.ts +1 -1
  90. package/dist/components/tooltip/index.d.ts.map +1 -1
  91. package/dist/components/tooltip/tooltip-provider.cjs +17 -0
  92. package/dist/components/tooltip/tooltip-provider.cjs.map +1 -0
  93. package/dist/components/tooltip/tooltip-provider.d.ts +9 -0
  94. package/dist/components/tooltip/tooltip-provider.d.ts.map +1 -0
  95. package/dist/components/tooltip/tooltip-provider.js +14 -0
  96. package/dist/components/tooltip/tooltip-provider.js.map +1 -0
  97. package/dist/components/tooltip/tooltip-root.cjs +65 -0
  98. package/dist/components/tooltip/tooltip-root.cjs.map +1 -0
  99. package/dist/components/tooltip/tooltip-root.d.ts +29 -0
  100. package/dist/components/tooltip/tooltip-root.d.ts.map +1 -0
  101. package/dist/components/tooltip/tooltip-root.js +62 -0
  102. package/dist/components/tooltip/tooltip-root.js.map +1 -0
  103. package/dist/components/tooltip/tooltip.cjs +4 -50
  104. package/dist/components/tooltip/tooltip.cjs.map +1 -1
  105. package/dist/components/tooltip/tooltip.d.ts +3 -30
  106. package/dist/components/tooltip/tooltip.d.ts.map +1 -1
  107. package/dist/components/tooltip/tooltip.js +5 -50
  108. package/dist/components/tooltip/tooltip.js.map +1 -1
  109. package/dist/index.cjs +0 -1
  110. package/dist/index.cjs.map +1 -1
  111. package/dist/index.d.ts +1 -1
  112. package/dist/index.d.ts.map +1 -1
  113. package/dist/index.js +1 -1
  114. package/dist/node_modules/.pnpm/@radix-ui_react-tooltip@1.2.7_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-tooltip/dist/index.cjs +8 -8
  115. package/dist/style.css +1 -1
  116. package/dist/types/filters.cjs +26 -21
  117. package/dist/types/filters.cjs.map +1 -1
  118. package/dist/types/filters.d.ts +19 -6
  119. package/dist/types/filters.d.ts.map +1 -1
  120. package/dist/types/filters.js +26 -21
  121. package/dist/types/filters.js.map +1 -1
  122. package/package.json +1 -1
@@ -24,7 +24,7 @@ const DropdownMenuSeparator = forwardRef(({ className, asChild, ...props }, ref)
24
24
  if (shouldFilter) {
25
25
  return null;
26
26
  }
27
- return (jsxRuntimeExports.jsx(MenuSeparator, { ref: ref, className: cx(styles.separator, className), render: asChild ? jsxRuntimeExports.jsx(Slot, {}) : undefined, ...props }));
27
+ return (jsxRuntimeExports.jsx(MenuSeparator, { ref: ref, className: cx(styles.separator, className), render: asChild ? jsxRuntimeExports.jsx(Slot, {}) : jsxRuntimeExports.jsx("div", {}), ...props }));
28
28
  });
29
29
  const DropdownMenuEmptyState = forwardRef(({ className, children, ...props }, ref) => (jsxRuntimeExports.jsx("div", { ref: ref, className: cx(styles.empty, className), ...props, children: children })));
30
30
 
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-menu-misc.js","sources":["../../../components/dropdown-menu/dropdown-menu-misc.tsx"],"sourcesContent":["import {\n MenuGroup,\n MenuGroupLabel,\n MenuGroupLabelProps,\n MenuGroupProps,\n MenuSeparator,\n MenuSeparatorProps\n} from '@ariakit/react';\nimport { cx } from 'class-variance-authority';\nimport { Slot } from 'radix-ui';\nimport {\n ElementRef,\n Fragment,\n HTMLAttributes,\n ReactNode,\n forwardRef\n} from 'react';\nimport { useDropdownContext } from './dropdown-menu-root';\nimport styles from './dropdown-menu.module.css';\nimport { WithAsChild } from './types';\n\nexport const DropdownMenuGroup = forwardRef<\n ElementRef<typeof MenuGroup>,\n WithAsChild<MenuGroupProps>\n>(({ className, asChild, ...props }, ref) => {\n const { shouldFilter } = useDropdownContext();\n\n return (\n <MenuGroup\n ref={ref}\n className={cx(styles.menugroup, className)}\n render={shouldFilter ? <Fragment /> : asChild ? <Slot.Root /> : undefined}\n {...props}\n />\n );\n});\n\nexport const DropdownMenuLabel = forwardRef<\n ElementRef<typeof MenuGroupLabel>,\n WithAsChild<MenuGroupLabelProps>\n>(({ className, asChild, ...props }, ref) => {\n const { shouldFilter } = useDropdownContext();\n\n if (shouldFilter) {\n return null;\n }\n\n return (\n <MenuGroupLabel\n ref={ref}\n className={cx(styles.label, className)}\n render={asChild ? <Slot.Root /> : undefined}\n {...props}\n />\n );\n});\n\nexport const DropdownMenuSeparator = forwardRef<\n ElementRef<typeof MenuSeparator>,\n WithAsChild<MenuSeparatorProps>\n>(({ className, asChild, ...props }, ref) => {\n const { shouldFilter } = useDropdownContext();\n\n if (shouldFilter) {\n return null;\n }\n\n return (\n <MenuSeparator\n ref={ref}\n className={cx(styles.separator, className)}\n render={asChild ? <Slot.Root /> : undefined}\n {...props}\n />\n );\n});\n\nexport const DropdownMenuEmptyState = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement> & {\n children: ReactNode;\n }\n>(({ className, children, ...props }, ref) => (\n <div ref={ref} className={cx(styles.empty, className)} {...props}>\n {children}\n </div>\n));\n"],"names":["_jsx","Slot.Root"],"mappings":";;;;;;;;;;AAqBa,MAAA,iBAAiB,GAAG,UAAU,CAGzC,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;AAC1C,IAAA,MAAM,EAAE,YAAY,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAE9C,QACEA,sBAAC,SAAS,EAAA,EACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,EAC1C,MAAM,EAAE,YAAY,GAAGA,qBAAC,CAAA,QAAQ,KAAG,GAAG,OAAO,GAAGA,qBAAC,CAAAC,IAAS,EAAA,EAAA,CAAG,GAAG,SAAS,EACrE,GAAA,KAAK,EACT,CAAA,EACF;AACJ,CAAC,EAAE;AAEU,MAAA,iBAAiB,GAAG,UAAU,CAGzC,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;AAC1C,IAAA,MAAM,EAAE,YAAY,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAE9C,IAAI,YAAY,EAAE;AAChB,QAAA,OAAO,IAAI,CAAC;KACb;AAED,IAAA,QACED,qBAAC,CAAA,cAAc,EACb,EAAA,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,EACtC,MAAM,EAAE,OAAO,GAAGA,qBAAA,CAACC,IAAS,EAAG,EAAA,CAAA,GAAG,SAAS,KACvC,KAAK,EAAA,CACT,EACF;AACJ,CAAC,EAAE;AAEU,MAAA,qBAAqB,GAAG,UAAU,CAG7C,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;AAC1C,IAAA,MAAM,EAAE,YAAY,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAE9C,IAAI,YAAY,EAAE;AAChB,QAAA,OAAO,IAAI,CAAC;KACb;AAED,IAAA,QACED,qBAAC,CAAA,aAAa,EACZ,EAAA,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,EAC1C,MAAM,EAAE,OAAO,GAAGA,qBAAA,CAACC,IAAS,EAAG,EAAA,CAAA,GAAG,SAAS,KACvC,KAAK,EAAA,CACT,EACF;AACJ,CAAC,EAAE;AAEU,MAAA,sBAAsB,GAAG,UAAU,CAK9C,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MACvCD,+BAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,KAAM,KAAK,EAAA,QAAA,EAC7D,QAAQ,EACL,CAAA,CACP;;;;"}
1
+ {"version":3,"file":"dropdown-menu-misc.js","sources":["../../../components/dropdown-menu/dropdown-menu-misc.tsx"],"sourcesContent":["import {\n MenuGroup,\n MenuGroupLabel,\n MenuGroupLabelProps,\n MenuGroupProps,\n MenuSeparator,\n MenuSeparatorProps\n} from '@ariakit/react';\nimport { cx } from 'class-variance-authority';\nimport { Slot } from 'radix-ui';\nimport {\n ElementRef,\n Fragment,\n HTMLAttributes,\n ReactNode,\n forwardRef\n} from 'react';\nimport { useDropdownContext } from './dropdown-menu-root';\nimport styles from './dropdown-menu.module.css';\nimport { WithAsChild } from './types';\n\nexport const DropdownMenuGroup = forwardRef<\n ElementRef<typeof MenuGroup>,\n WithAsChild<MenuGroupProps>\n>(({ className, asChild, ...props }, ref) => {\n const { shouldFilter } = useDropdownContext();\n\n return (\n <MenuGroup\n ref={ref}\n className={cx(styles.menugroup, className)}\n render={shouldFilter ? <Fragment /> : asChild ? <Slot.Root /> : undefined}\n {...props}\n />\n );\n});\n\nexport const DropdownMenuLabel = forwardRef<\n ElementRef<typeof MenuGroupLabel>,\n WithAsChild<MenuGroupLabelProps>\n>(({ className, asChild, ...props }, ref) => {\n const { shouldFilter } = useDropdownContext();\n\n if (shouldFilter) {\n return null;\n }\n\n return (\n <MenuGroupLabel\n ref={ref}\n className={cx(styles.label, className)}\n render={asChild ? <Slot.Root /> : undefined}\n {...props}\n />\n );\n});\n\nexport const DropdownMenuSeparator = forwardRef<\n ElementRef<typeof MenuSeparator>,\n WithAsChild<MenuSeparatorProps>\n>(({ className, asChild, ...props }, ref) => {\n const { shouldFilter } = useDropdownContext();\n\n if (shouldFilter) {\n return null;\n }\n\n return (\n <MenuSeparator\n ref={ref}\n className={cx(styles.separator, className)}\n render={asChild ? <Slot.Root /> : <div />}\n {...props}\n />\n );\n});\n\nexport const DropdownMenuEmptyState = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement> & {\n children: ReactNode;\n }\n>(({ className, children, ...props }, ref) => (\n <div ref={ref} className={cx(styles.empty, className)} {...props}>\n {children}\n </div>\n));\n"],"names":["_jsx","Slot.Root"],"mappings":";;;;;;;;;;AAqBa,MAAA,iBAAiB,GAAG,UAAU,CAGzC,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;AAC1C,IAAA,MAAM,EAAE,YAAY,EAAE,GAAG,kBAAkB,EAAE,CAAC;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D,qBAAA,CAAA,KAAA,EAAA,EAAA,CAAO,KACrC,KAAK,EAAA,CACT,EACF;AACJ,CAAC,EAAE;AAEU,MAAA,sBAAsB,GAAG,UAAU,CAK9C,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,MACvCA,+BAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,KAAM,KAAK,EAAA,QAAA,EAC7D,QAAQ,EACL,CAAA,CACP;;;;"}
@@ -15,35 +15,35 @@ const useDropdownContext = () => {
15
15
  if (!context)
16
16
  return {};
17
17
  const shouldFilter = !!(context?.autocomplete &&
18
- context?.autocompleteMode === "auto" &&
18
+ context?.autocompleteMode === 'auto' &&
19
19
  context?.searchValue?.length);
20
20
  const shouldFilterParent = !!(context?.parent?.autocomplete &&
21
- context?.parent?.autocompleteMode === "auto" &&
21
+ context?.parent?.autocompleteMode === 'auto' &&
22
22
  context?.parent?.searchValue?.length);
23
23
  return {
24
24
  ...context,
25
25
  shouldFilter,
26
26
  parent: context?.parent && {
27
27
  ...context.parent,
28
- shouldFilter: shouldFilterParent,
29
- },
28
+ shouldFilter: shouldFilterParent
29
+ }
30
30
  };
31
31
  };
32
- const DropdownMenuRoot = ({ autocomplete, autocompleteMode = "auto", searchValue: providedSearchValue, onSearch, focusLoop = true, defaultSearchValue = "", ...props }) => {
32
+ const DropdownMenuRoot = ({ autocomplete, autocompleteMode = 'auto', searchValue: providedSearchValue, onSearch, focusLoop = true, defaultSearchValue = '', onOpenChange, ...props }) => {
33
33
  const [internalSearchValue, setInternalSearchValue] = React.useState(defaultSearchValue);
34
34
  const dropdownContext = useDropdownContext();
35
35
  const searchValue = providedSearchValue ?? internalSearchValue;
36
- const setValue = (value) => {
36
+ const setValue = React.useCallback((value) => {
37
37
  setInternalSearchValue(value);
38
38
  onSearch?.(value);
39
- };
40
- const element = jsxRuntime.jsxRuntimeExports.jsx(menuProvider.MenuProvider, { focusLoop: focusLoop, ...props });
39
+ }, [onSearch]);
40
+ const element = (jsxRuntime.jsxRuntimeExports.jsx(menuProvider.MenuProvider, { focusLoop: focusLoop, setOpen: onOpenChange, ...props }));
41
41
  return (jsxRuntime.jsxRuntimeExports.jsx(DropdownContext.Provider, { value: {
42
42
  autocomplete,
43
43
  parent: dropdownContext,
44
44
  autocompleteMode,
45
- searchValue,
46
- }, children: autocomplete ? (jsxRuntime.jsxRuntimeExports.jsx(comboboxProvider.ComboboxProvider, { resetValueOnHide: true, focusLoop: focusLoop, includesBaseElement: false, value: searchValue, setValue: setValue, children: element })) : (element) }));
45
+ searchValue
46
+ }, children: autocomplete ? (jsxRuntime.jsxRuntimeExports.jsx(comboboxProvider.ComboboxProvider, { resetValueOnHide: true, focusLoop: focusLoop, includesBaseElement: false, value: searchValue, setOpen: onOpenChange, setValue: setValue, children: element })) : (element) }));
47
47
  };
48
48
 
49
49
  exports.DropdownContext = DropdownContext;
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-menu-root.cjs","sources":["../../../components/dropdown-menu/dropdown-menu-root.tsx"],"sourcesContent":["import {\n ComboboxProvider,\n MenuProvider,\n MenuProviderProps,\n} from \"@ariakit/react\";\nimport { createContext, useContext, useState } from \"react\";\n\ninterface CommonProps {\n autocomplete?: boolean;\n autocompleteMode?: \"auto\" | \"manual\";\n searchValue?: string;\n}\n\ninterface DropdownContextValue extends CommonProps {\n parent?: CommonProps;\n}\n\ninterface UseDropdownContext extends DropdownContextValue {\n shouldFilter?: boolean;\n parent?: CommonProps & {\n shouldFilter?: boolean;\n };\n}\n\n/**\n Root context to manage the Dropdown control\n @remarks Only for internal usage.\n */\n\nexport const DropdownContext = createContext<DropdownContextValue | undefined>(\n undefined,\n);\n\nexport const useDropdownContext = (): UseDropdownContext => {\n const context = useContext(DropdownContext);\n if (!context) return {};\n\n const shouldFilter = !!(\n context?.autocomplete &&\n context?.autocompleteMode === \"auto\" &&\n context?.searchValue?.length\n );\n\n const shouldFilterParent = !!(\n context?.parent?.autocomplete &&\n context?.parent?.autocompleteMode === \"auto\" &&\n context?.parent?.searchValue?.length\n );\n\n return {\n ...context,\n shouldFilter,\n parent: context?.parent && {\n ...context.parent,\n shouldFilter: shouldFilterParent,\n },\n };\n};\n\nexport interface NormalDropdownMenuRootProps extends MenuProviderProps {\n autocomplete?: false;\n autocompleteMode?: never;\n searchValue?: never;\n onSearch?: never;\n defaultSearchValue?: never;\n}\n\nexport interface AutocompleteDropdownMenuRootProps\n extends MenuProviderProps,\n CommonProps {\n autocomplete: true;\n onSearch?: (value: string) => void;\n defaultSearchValue?: string;\n}\n\nexport type DropdownMenuRootProps =\n | NormalDropdownMenuRootProps\n | AutocompleteDropdownMenuRootProps;\n\nexport const DropdownMenuRoot = ({\n autocomplete,\n autocompleteMode = \"auto\",\n searchValue: providedSearchValue,\n onSearch,\n focusLoop = true,\n defaultSearchValue = \"\",\n ...props\n}: DropdownMenuRootProps) => {\n const [internalSearchValue, setInternalSearchValue] =\n useState(defaultSearchValue);\n const dropdownContext = useDropdownContext();\n\n const searchValue = providedSearchValue ?? internalSearchValue;\n\n const setValue = (value: string) => {\n setInternalSearchValue(value);\n onSearch?.(value);\n };\n\n const element = <MenuProvider focusLoop={focusLoop} {...props} />;\n\n return (\n <DropdownContext.Provider\n value={{\n autocomplete,\n parent: dropdownContext,\n autocompleteMode,\n searchValue,\n }}>\n {autocomplete ? (\n <ComboboxProvider\n resetValueOnHide\n focusLoop={focusLoop}\n includesBaseElement={false}\n value={searchValue}\n setValue={setValue}>\n {element}\n </ComboboxProvider>\n ) : (\n element\n )}\n </DropdownContext.Provider>\n );\n};\n"],"names":["createContext","useContext","useState","_jsx","MenuProvider","ComboboxProvider"],"mappings":";;;;;;;AAwBA;;;AAGG;MAEU,eAAe,GAAGA,mBAAa,CAC1C,SAAS,EACT;AAEK,MAAM,kBAAkB,GAAG,MAAyB;AACzD,IAAA,MAAM,OAAO,GAAGC,gBAAU,CAA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AE,SAAS,EAAA,GAAM,KAAK,EAAA,CAAI,CAAC;AAElE,IAAA,QACED,gCAAC,CAAA,eAAe,CAAC,QAAQ,EAAA,EACvB,KAAK,EAAE;YACL,YAAY;AACZ,YAAA,MAAM,EAAE,eAAe;YACvB,gBAAgB;YAChB,WAAW;AACZ,SAAA,EAAA,QAAA,EACA,YAAY,IACXA,iCAACE,iCAAgB,EAAA,EACf,gBAAgB,EAAA,IAAA,EAChB,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,KAAK,EAC1B,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,QAAQ,YACjB,OAAO,EAAA,CACS,KAEnB,OAAO,CACR,EAAA,CACwB,EAC3B;AACJ;;;;;;"}
1
+ {"version":3,"file":"dropdown-menu-root.cjs","sources":["../../../components/dropdown-menu/dropdown-menu-root.tsx"],"sourcesContent":["import {\n ComboboxProvider,\n MenuProvider,\n MenuProviderProps\n} from '@ariakit/react';\nimport { createContext, useCallback, useContext, useState } from 'react';\n\ninterface CommonProps {\n autocomplete?: boolean;\n autocompleteMode?: 'auto' | 'manual';\n searchValue?: string;\n}\n\ninterface DropdownContextValue extends CommonProps {\n parent?: CommonProps;\n}\n\ninterface UseDropdownContext extends DropdownContextValue {\n shouldFilter?: boolean;\n parent?: CommonProps & {\n shouldFilter?: boolean;\n };\n}\n\n/**\n Root context to manage the Dropdown control\n @remarks Only for internal usage.\n */\n\nexport const DropdownContext = createContext<DropdownContextValue | undefined>(\n undefined\n);\n\nexport const useDropdownContext = (): UseDropdownContext => {\n const context = useContext(DropdownContext);\n if (!context) return {};\n\n const shouldFilter = !!(\n context?.autocomplete &&\n context?.autocompleteMode === 'auto' &&\n context?.searchValue?.length\n );\n\n const shouldFilterParent = !!(\n context?.parent?.autocomplete &&\n context?.parent?.autocompleteMode === 'auto' &&\n context?.parent?.searchValue?.length\n );\n\n return {\n ...context,\n shouldFilter,\n parent: context?.parent && {\n ...context.parent,\n shouldFilter: shouldFilterParent\n }\n };\n};\n\nexport interface BaseMenuProviderProps\n extends Omit<MenuProviderProps, 'setOpen'> {\n onOpenChange?: MenuProviderProps['setOpen'];\n}\n\nexport interface NormalDropdownMenuRootProps extends BaseMenuProviderProps {\n autocomplete?: false;\n autocompleteMode?: never;\n searchValue?: never;\n onSearch?: never;\n defaultSearchValue?: never;\n}\n\nexport interface AutocompleteDropdownMenuRootProps\n extends BaseMenuProviderProps,\n CommonProps {\n autocomplete: true;\n onSearch?: (value: string) => void;\n defaultSearchValue?: string;\n}\n\nexport type DropdownMenuRootProps =\n | NormalDropdownMenuRootProps\n | AutocompleteDropdownMenuRootProps;\n\nexport const DropdownMenuRoot = ({\n autocomplete,\n autocompleteMode = 'auto',\n searchValue: providedSearchValue,\n onSearch,\n focusLoop = true,\n defaultSearchValue = '',\n onOpenChange,\n ...props\n}: DropdownMenuRootProps) => {\n const [internalSearchValue, setInternalSearchValue] =\n useState(defaultSearchValue);\n const dropdownContext = useDropdownContext();\n\n const searchValue = providedSearchValue ?? internalSearchValue;\n\n const setValue = useCallback(\n (value: string) => {\n setInternalSearchValue(value);\n onSearch?.(value);\n },\n [onSearch]\n );\n\n const element = (\n <MenuProvider focusLoop={focusLoop} setOpen={onOpenChange} {...props} />\n );\n\n return (\n <DropdownContext.Provider\n value={{\n autocomplete,\n parent: dropdownContext,\n autocompleteMode,\n searchValue\n }}\n >\n {autocomplete ? (\n <ComboboxProvider\n resetValueOnHide\n focusLoop={focusLoop}\n includesBaseElement={false}\n value={searchValue}\n setOpen={onOpenChange}\n setValue={setValue}\n >\n {element}\n </ComboboxProvider>\n ) : (\n element\n )}\n </DropdownContext.Provider>\n );\n};\n"],"names":["createContext","useContext","useState","useCallback","_jsx","MenuProvider","ComboboxProvider"],"mappings":";;;;;;;AAwBA;;;AAGG;MAEU,eAAe,GAAGA,mBAAa,CAC1C,SAAS,EACT;AAEK,MAAM,kBAAkB,GAAG,MAAyB;AACzD,IAAA,MAAM,OAAO,GAAGC,gBAAU,CAAC,eAAe,C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AAO,IACXC,gCAAC,CAAAC,yBAAY,IAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,KAAM,KAAK,EAAA,CAAI,CACzE,CAAC;AAEF,IAAA,QACED,gCAAC,CAAA,eAAe,CAAC,QAAQ,EAAA,EACvB,KAAK,EAAE;YACL,YAAY;AACZ,YAAA,MAAM,EAAE,eAAe;YACvB,gBAAgB;YAChB,WAAW;AACZ,SAAA,EAAA,QAAA,EAEA,YAAY,IACXA,gCAAA,CAACE,iCAAgB,EACf,EAAA,gBAAgB,EAChB,IAAA,EAAA,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,KAAK,EAC1B,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,QAAQ,EAEjB,QAAA,EAAA,OAAO,GACS,KAEnB,OAAO,CACR,EAAA,CACwB,EAC3B;AACJ;;;;;;"}
@@ -1,7 +1,7 @@
1
- import { MenuProviderProps } from "@ariakit/react";
1
+ import { MenuProviderProps } from '@ariakit/react';
2
2
  interface CommonProps {
3
3
  autocomplete?: boolean;
4
- autocompleteMode?: "auto" | "manual";
4
+ autocompleteMode?: 'auto' | 'manual';
5
5
  searchValue?: string;
6
6
  }
7
7
  interface DropdownContextValue extends CommonProps {
@@ -19,19 +19,22 @@ interface UseDropdownContext extends DropdownContextValue {
19
19
  */
20
20
  export declare const DropdownContext: import("react").Context<DropdownContextValue | undefined>;
21
21
  export declare const useDropdownContext: () => UseDropdownContext;
22
- export interface NormalDropdownMenuRootProps extends MenuProviderProps {
22
+ export interface BaseMenuProviderProps extends Omit<MenuProviderProps, 'setOpen'> {
23
+ onOpenChange?: MenuProviderProps['setOpen'];
24
+ }
25
+ export interface NormalDropdownMenuRootProps extends BaseMenuProviderProps {
23
26
  autocomplete?: false;
24
27
  autocompleteMode?: never;
25
28
  searchValue?: never;
26
29
  onSearch?: never;
27
30
  defaultSearchValue?: never;
28
31
  }
29
- export interface AutocompleteDropdownMenuRootProps extends MenuProviderProps, CommonProps {
32
+ export interface AutocompleteDropdownMenuRootProps extends BaseMenuProviderProps, CommonProps {
30
33
  autocomplete: true;
31
34
  onSearch?: (value: string) => void;
32
35
  defaultSearchValue?: string;
33
36
  }
34
37
  export type DropdownMenuRootProps = NormalDropdownMenuRootProps | AutocompleteDropdownMenuRootProps;
35
- export declare const DropdownMenuRoot: ({ autocomplete, autocompleteMode, searchValue: providedSearchValue, onSearch, focusLoop, defaultSearchValue, ...props }: DropdownMenuRootProps) => import("react/jsx-runtime").JSX.Element;
38
+ export declare const DropdownMenuRoot: ({ autocomplete, autocompleteMode, searchValue: providedSearchValue, onSearch, focusLoop, defaultSearchValue, onOpenChange, ...props }: DropdownMenuRootProps) => import("react/jsx-runtime").JSX.Element;
36
39
  export {};
37
40
  //# sourceMappingURL=dropdown-menu-root.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-menu-root.d.ts","sourceRoot":"","sources":["../../../components/dropdown-menu/dropdown-menu-root.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAGxB,UAAU,WAAW;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,oBAAqB,SAAQ,WAAW;IAChD,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,UAAU,kBAAmB,SAAQ,oBAAoB;IACvD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,WAAW,GAAG;QACrB,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB,CAAC;CACH;AAED;;;GAGG;AAEH,eAAO,MAAM,eAAe,2DAE3B,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAO,kBAwBrC,CAAC;AAEF,MAAM,WAAW,2BAA4B,SAAQ,iBAAiB;IACpE,YAAY,CAAC,E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AAC,SAAS,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,2BAA4B,SAAQ,qBAAqB;IACxE,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,gBAAgB,CAAC,EAAE,KAAK,CAAC;IACzB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,kBAAkB,CAAC,EAAE,KAAK,CAAC;CAC5B;AAED,MAAM,WAAW,iCACf,SAAQ,qBAAqB,EAC3B,WAAW;IACb,YAAY,EAAE,IAAI,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,MAAM,qBAAqB,GAC7B,2BAA2B,GAC3B,iCAAiC,CAAC;AAEtC,eAAO,MAAM,gBAAgB,0IAS1B,qBAAqB,4CA4CvB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { j as jsxRuntimeExports } from '../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js';
2
2
  import { MenuProvider } from '../../node_modules/.pnpm/@ariakit_react-core@0.4.16_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@ariakit/react-core/esm/menu/menu-provider.js';
3
3
  import { ComboboxProvider } from '../../node_modules/.pnpm/@ariakit_react-core@0.4.16_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@ariakit/react-core/esm/combobox/combobox-provider.js';
4
- import { createContext, useContext, useState } from 'react';
4
+ import { createContext, useContext, useState, useCallback } from 'react';
5
5
 
6
6
  /**
7
7
  Root context to manage the Dropdown control
@@ -13,35 +13,35 @@ const useDropdownContext = () => {
13
13
  if (!context)
14
14
  return {};
15
15
  const shouldFilter = !!(context?.autocomplete &&
16
- context?.autocompleteMode === "auto" &&
16
+ context?.autocompleteMode === 'auto' &&
17
17
  context?.searchValue?.length);
18
18
  const shouldFilterParent = !!(context?.parent?.autocomplete &&
19
- context?.parent?.autocompleteMode === "auto" &&
19
+ context?.parent?.autocompleteMode === 'auto' &&
20
20
  context?.parent?.searchValue?.length);
21
21
  return {
22
22
  ...context,
23
23
  shouldFilter,
24
24
  parent: context?.parent && {
25
25
  ...context.parent,
26
- shouldFilter: shouldFilterParent,
27
- },
26
+ shouldFilter: shouldFilterParent
27
+ }
28
28
  };
29
29
  };
30
- const DropdownMenuRoot = ({ autocomplete, autocompleteMode = "auto", searchValue: providedSearchValue, onSearch, focusLoop = true, defaultSearchValue = "", ...props }) => {
30
+ const DropdownMenuRoot = ({ autocomplete, autocompleteMode = 'auto', searchValue: providedSearchValue, onSearch, focusLoop = true, defaultSearchValue = '', onOpenChange, ...props }) => {
31
31
  const [internalSearchValue, setInternalSearchValue] = useState(defaultSearchValue);
32
32
  const dropdownContext = useDropdownContext();
33
33
  const searchValue = providedSearchValue ?? internalSearchValue;
34
- const setValue = (value) => {
34
+ const setValue = useCallback((value) => {
35
35
  setInternalSearchValue(value);
36
36
  onSearch?.(value);
37
- };
38
- const element = jsxRuntimeExports.jsx(MenuProvider, { focusLoop: focusLoop, ...props });
37
+ }, [onSearch]);
38
+ const element = (jsxRuntimeExports.jsx(MenuProvider, { focusLoop: focusLoop, setOpen: onOpenChange, ...props }));
39
39
  return (jsxRuntimeExports.jsx(DropdownContext.Provider, { value: {
40
40
  autocomplete,
41
41
  parent: dropdownContext,
42
42
  autocompleteMode,
43
- searchValue,
44
- }, children: autocomplete ? (jsxRuntimeExports.jsx(ComboboxProvider, { resetValueOnHide: true, focusLoop: focusLoop, includesBaseElement: false, value: searchValue, setValue: setValue, children: element })) : (element) }));
43
+ searchValue
44
+ }, children: autocomplete ? (jsxRuntimeExports.jsx(ComboboxProvider, { resetValueOnHide: true, focusLoop: focusLoop, includesBaseElement: false, value: searchValue, setOpen: onOpenChange, setValue: setValue, children: element })) : (element) }));
45
45
  };
46
46
 
47
47
  export { DropdownContext, DropdownMenuRoot, useDropdownContext };
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-menu-root.js","sources":["../../../components/dropdown-menu/dropdown-menu-root.tsx"],"sourcesContent":["import {\n ComboboxProvider,\n MenuProvider,\n MenuProviderProps,\n} from \"@ariakit/react\";\nimport { createContext, useContext, useState } from \"react\";\n\ninterface CommonProps {\n autocomplete?: boolean;\n autocompleteMode?: \"auto\" | \"manual\";\n searchValue?: string;\n}\n\ninterface DropdownContextValue extends CommonProps {\n parent?: CommonProps;\n}\n\ninterface UseDropdownContext extends DropdownContextValue {\n shouldFilter?: boolean;\n parent?: CommonProps & {\n shouldFilter?: boolean;\n };\n}\n\n/**\n Root context to manage the Dropdown control\n @remarks Only for internal usage.\n */\n\nexport const DropdownContext = createContext<DropdownContextValue | undefined>(\n undefined,\n);\n\nexport const useDropdownContext = (): UseDropdownContext => {\n const context = useContext(DropdownContext);\n if (!context) return {};\n\n const shouldFilter = !!(\n context?.autocomplete &&\n context?.autocompleteMode === \"auto\" &&\n context?.searchValue?.length\n );\n\n const shouldFilterParent = !!(\n context?.parent?.autocomplete &&\n context?.parent?.autocompleteMode === \"auto\" &&\n context?.parent?.searchValue?.length\n );\n\n return {\n ...context,\n shouldFilter,\n parent: context?.parent && {\n ...context.parent,\n shouldFilter: shouldFilterParent,\n },\n };\n};\n\nexport interface NormalDropdownMenuRootProps extends MenuProviderProps {\n autocomplete?: false;\n autocompleteMode?: never;\n searchValue?: never;\n onSearch?: never;\n defaultSearchValue?: never;\n}\n\nexport interface AutocompleteDropdownMenuRootProps\n extends MenuProviderProps,\n CommonProps {\n autocomplete: true;\n onSearch?: (value: string) => void;\n defaultSearchValue?: string;\n}\n\nexport type DropdownMenuRootProps =\n | NormalDropdownMenuRootProps\n | AutocompleteDropdownMenuRootProps;\n\nexport const DropdownMenuRoot = ({\n autocomplete,\n autocompleteMode = \"auto\",\n searchValue: providedSearchValue,\n onSearch,\n focusLoop = true,\n defaultSearchValue = \"\",\n ...props\n}: DropdownMenuRootProps) => {\n const [internalSearchValue, setInternalSearchValue] =\n useState(defaultSearchValue);\n const dropdownContext = useDropdownContext();\n\n const searchValue = providedSearchValue ?? internalSearchValue;\n\n const setValue = (value: string) => {\n setInternalSearchValue(value);\n onSearch?.(value);\n };\n\n const element = <MenuProvider focusLoop={focusLoop} {...props} />;\n\n return (\n <DropdownContext.Provider\n value={{\n autocomplete,\n parent: dropdownContext,\n autocompleteMode,\n searchValue,\n }}>\n {autocomplete ? (\n <ComboboxProvider\n resetValueOnHide\n focusLoop={focusLoop}\n includesBaseElement={false}\n value={searchValue}\n setValue={setValue}>\n {element}\n </ComboboxProvider>\n ) : (\n element\n )}\n </DropdownContext.Provider>\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;AAwBA;;;AAGG;MAEU,eAAe,GAAG,aAAa,CAC1C,SAAS,EACT;AAEK,MAAM,kBAAkB,GAAG,MAAyB;AACzD,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;AAC5C,IAAA,IAAI,CAAC,OAAO;AAAE,QAAA,OAAO,EAAE,CAAC;AAExB,IAAA,MAAM,YAAY,GAAG,CAAC,EACpB,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE,gBAAgB,KAAK,MAAM;AACpC,QAAA,OAAO,EAAE,WAAW,EAAE,MAAM,CAC7B,CAAC;IAEF,MAAM,kBAAkB,GAAG,CAAC,EAC1B,OAAO,EAAE,MAAM,EAAE,YAAY;AAC7B,QAAA,OAAO,EAAE,MAAM,EAAE,gBAAgB,KAAK,MAAM;AAC5C,QAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CACrC,CAAC;IAEF,OAAO;AACL,QAAA,GAAG,OAAO;QACV,YAAY;AACZ,QAAA,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI;YACzB,GAAG,OAAO,CAAC,MAAM;AACjB,YAAA,YAAY,EAAE,kBAAkB;AACjC,SAAA;KACF,CAAC;AACJ,EAAE;AAsBK,MAAM,gBAAgB,GAAG,CAAC,EAC/B,YAAY,EACZ,gBAAgB,GAAG,MAAM,EACzB,WAAW,EAAE,mBAAmB,EAChC,QAAQ,EACR,SAAS,GAAG,IAAI,EAChB,kBAAkB,GAAG,EAAE,EACvB,GAAG,KAAK,EACc,KAAI;IAC1B,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GACjD,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AAC/B,IAAA,MAAM,eAAe,GAAG,kBAAkB,EAAE,CAAC;AAE7C,IAAA,MAAM,WAAW,GAAG,mBAAmB,IAAI,mBAAmB,CAAC;AAE/D,IAAA,MAAM,QAAQ,GAAG,CAAC,KAAa,KAAI;QACjC,sBAAsB,CAAC,KAAK,CAAC,CAAC;AAC9B,QAAA,QAAQ,GAAG,KAAK,CAAC,CAAC;AACpB,KAAC,CAAC;IAEF,MAAM,OAAO,GAAGA,qBAAA,CAAC,YAAY,EAAA,EAAC,SAAS,EAAE,SAAS,EAAA,GAAM,KAAK,EAAA,CAAI,CAAC;AAElE,IAAA,QACEA,qBAAC,CAAA,eAAe,CAAC,QAAQ,EAAA,EACvB,KAAK,EAAE;YACL,YAAY;AACZ,YAAA,MAAM,EAAE,eAAe;YACvB,gBAAgB;YAChB,WAAW;AACZ,SAAA,EAAA,QAAA,EACA,YAAY,IACXA,sBAAC,gBAAgB,EAAA,EACf,gBAAgB,EAAA,IAAA,EAChB,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,KAAK,EAC1B,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,QAAQ,YACjB,OAAO,EAAA,CACS,KAEnB,OAAO,CACR,EAAA,CACwB,EAC3B;AACJ;;;;"}
1
+ {"version":3,"file":"dropdown-menu-root.js","sources":["../../../components/dropdown-menu/dropdown-menu-root.tsx"],"sourcesContent":["import {\n ComboboxProvider,\n MenuProvider,\n MenuProviderProps\n} from '@ariakit/react';\nimport { createContext, useCallback, useContext, useState } from 'react';\n\ninterface CommonProps {\n autocomplete?: boolean;\n autocompleteMode?: 'auto' | 'manual';\n searchValue?: string;\n}\n\ninterface DropdownContextValue extends CommonProps {\n parent?: CommonProps;\n}\n\ninterface UseDropdownContext extends DropdownContextValue {\n shouldFilter?: boolean;\n parent?: CommonProps & {\n shouldFilter?: boolean;\n };\n}\n\n/**\n Root context to manage the Dropdown control\n @remarks Only for internal usage.\n */\n\nexport const DropdownContext = createContext<DropdownContextValue | undefined>(\n undefined\n);\n\nexport const useDropdownContext = (): UseDropdownContext => {\n const context = useContext(DropdownContext);\n if (!context) return {};\n\n const shouldFilter = !!(\n context?.autocomplete &&\n context?.autocompleteMode === 'auto' &&\n context?.searchValue?.length\n );\n\n const shouldFilterParent = !!(\n context?.parent?.autocomplete &&\n context?.parent?.autocompleteMode === 'auto' &&\n context?.parent?.searchValue?.length\n );\n\n return {\n ...context,\n shouldFilter,\n parent: context?.parent && {\n ...context.parent,\n shouldFilter: shouldFilterParent\n }\n };\n};\n\nexport interface BaseMenuProviderProps\n extends Omit<MenuProviderProps, 'setOpen'> {\n onOpenChange?: MenuProviderProps['setOpen'];\n}\n\nexport interface NormalDropdownMenuRootProps extends BaseMenuProviderProps {\n autocomplete?: false;\n autocompleteMode?: never;\n searchValue?: never;\n onSearch?: never;\n defaultSearchValue?: never;\n}\n\nexport interface AutocompleteDropdownMenuRootProps\n extends BaseMenuProviderProps,\n CommonProps {\n autocomplete: true;\n onSearch?: (value: string) => void;\n defaultSearchValue?: string;\n}\n\nexport type DropdownMenuRootProps =\n | NormalDropdownMenuRootProps\n | AutocompleteDropdownMenuRootProps;\n\nexport const DropdownMenuRoot = ({\n autocomplete,\n autocompleteMode = 'auto',\n searchValue: providedSearchValue,\n onSearch,\n focusLoop = true,\n defaultSearchValue = '',\n onOpenChange,\n ...props\n}: DropdownMenuRootProps) => {\n const [internalSearchValue, setInternalSearchValue] =\n useState(defaultSearchValue);\n const dropdownContext = useDropdownContext();\n\n const searchValue = providedSearchValue ?? internalSearchValue;\n\n const setValue = useCallback(\n (value: string) => {\n setInternalSearchValue(value);\n onSearch?.(value);\n },\n [onSearch]\n );\n\n const element = (\n <MenuProvider focusLoop={focusLoop} setOpen={onOpenChange} {...props} />\n );\n\n return (\n <DropdownContext.Provider\n value={{\n autocomplete,\n parent: dropdownContext,\n autocompleteMode,\n searchValue\n }}\n >\n {autocomplete ? (\n <ComboboxProvider\n resetValueOnHide\n focusLoop={focusLoop}\n includesBaseElement={false}\n value={searchValue}\n setOpen={onOpenChange}\n setValue={setValue}\n >\n {element}\n </ComboboxProvider>\n ) : (\n element\n )}\n </DropdownContext.Provider>\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;AAwBA;;;AAGG;MAEU,eAAe,GAAG,aAAa,CAC1C,SAAS,EACT;AAEK,MAAM,kBAAkB,GAAG,MAAyB;AACzD,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;AAC5C,IAAA,IAAI,CAAC,OAAO;AAAE,QAAA,OAAO,EAAE,CAAC;AAExB,IAAA,MAAM,YAAY,GAAG,CAAC,EACpB,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE,gBAAgB,KAAK,MAAM;AACpC,QAAA,OAAO,EAAE,WAAW,EAAE,MAAM,CAC7B,CAAC;IAEF,MAAM,kBAAkB,GAAG,CAAC,EAC1B,OAAO,EAAE,MAAM,EAAE,YAAY;AAC7B,QAAA,OAAO,EAAE,MAAM,EAAE,gBAAgB,KAAK,MAAM;AAC5C,QAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,CACrC,CAAC;IAEF,OAAO;AACL,QAAA,GAAG,OAAO;QACV,YAAY;AACZ,QAAA,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI;YACzB,GAAG,OAAO,CAAC,MAAM;AACjB,YAAA,YAAY,EAAE,kBAAkB;AACjC,SAAA;KACF,CAAC;AACJ,EAAE;AA2BK,MAAM,gBAAgB,GAAG,CAAC,EAC/B,YAAY,EACZ,gBAAgB,GAAG,MAAM,EACzB,WAAW,EAAE,mBAAmB,EAChC,QAAQ,EACR,SAAS,GAAG,IAAI,EAChB,kBAAkB,GAAG,EAAE,EACvB,YAAY,EACZ,GAAG,KAAK,EACc,KAAI;IAC1B,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GACjD,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AAC/B,IAAA,MAAM,eAAe,GAAG,kBAAkB,EAAE,CAAC;AAE7C,IAAA,MAAM,WAAW,GAAG,mBAAmB,IAAI,mBAAmB,CAAC;AAE/D,IAAA,MAAM,QAAQ,GAAG,WAAW,CAC1B,CAAC,KAAa,KAAI;QAChB,sBAAsB,CAAC,KAAK,CAAC,CAAC;AAC9B,QAAA,QAAQ,GAAG,KAAK,CAAC,CAAC;AACpB,KAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;AAEF,IAAA,MAAM,OAAO,IACXA,qBAAC,CAAA,YAAY,IAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,KAAM,KAAK,EAAA,CAAI,CACzE,CAAC;AAEF,IAAA,QACEA,qBAAC,CAAA,eAAe,CAAC,QAAQ,EAAA,EACvB,KAAK,EAAE;YACL,YAAY;AACZ,YAAA,MAAM,EAAE,eAAe;YACvB,gBAAgB;YAChB,WAAW;AACZ,SAAA,EAAA,QAAA,EAEA,YAAY,IACXA,qBAAA,CAAC,gBAAgB,EACf,EAAA,gBAAgB,EAChB,IAAA,EAAA,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,KAAK,EAC1B,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,QAAQ,EAEjB,QAAA,EAAA,OAAO,GACS,KAEnB,OAAO,CACR,EAAA,CACwB,EAC3B;AACJ;;;;"}
@@ -9,8 +9,12 @@ var dropdownMenuRoot = require('./dropdown-menu-root.cjs');
9
9
  var utils = require('./utils.cjs');
10
10
  var index = require('../../node_modules/.pnpm/@radix-ui_react-slot@1.2.3_@types_react@18.2.12_react@18.2.0/node_modules/@radix-ui/react-slot/dist/index.cjs');
11
11
 
12
- const DropdownMenuTrigger = React.forwardRef(({ children, asChild, ...props }, ref) => {
13
- return (jsxRuntime.jsxRuntimeExports.jsx(menuButton.MenuButton, { ref: ref, render: asChild ? jsxRuntime.jsxRuntimeExports.jsx(index.Root, {}) : undefined, ...props, children: children }));
12
+ const DropdownMenuTrigger = React.forwardRef(({ children, asChild, stopPropagation = true, onClick, ...props }, ref) => {
13
+ return (jsxRuntime.jsxRuntimeExports.jsx(menuButton.MenuButton, { ref: ref, render: asChild ? jsxRuntime.jsxRuntimeExports.jsx(index.Root, {}) : undefined, onClick: (e) => {
14
+ if (stopPropagation)
15
+ e.stopPropagation();
16
+ onClick?.(e);
17
+ }, ...props, children: children }));
14
18
  });
15
19
  /**
16
20
  * `TriggerItem` is a helper component that renders a `Trigger` as a `MenuItem`.
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-menu-trigger.cjs","sources":["../../../components/dropdown-menu/dropdown-menu-trigger.tsx"],"sourcesContent":["import { MenuButton, MenuButtonProps } from '@ariakit/react';\nimport { Slot } from 'radix-ui';\nimport { forwardRef } from 'react';\nimport { TriangleRightIcon } from '~/icons';\nimport { DropdownMenuItem, DropdownMenuItemProps } from './dropdown-menu-item';\nimport { useDropdownContext } from './dropdown-menu-root';\nimport { WithAsChild } from './types';\nimport { getMatch } from './utils';\n\nexport interface DropdownMenuTriggerProps\n extends WithAsChild<MenuButtonProps> {}\n\nexport const DropdownMenuTrigger = forwardRef<\n HTMLButtonElement,\n DropdownMenuTriggerProps\n>(({ children, asChild, ...props }, ref) => {\n return (\n <MenuButton\n ref={ref}\n render={asChild ? <Slot.Root /> : undefined}\n {...props}\n >\n {children}\n </MenuButton>\n );\n});\n\nexport interface DropdownMenuTriggerItemProps extends DropdownMenuItemProps {}\n\n/**\n * `TriggerItem` is a helper component that renders a `Trigger` as a `MenuItem`.\n */\nexport const DropdownMenuTriggerItem = forwardRef<\n HTMLButtonElement,\n DropdownMenuTriggerItemProps\n>(\n (\n { children, value, trailingIcon = <TriangleRightIcon />, ...props },\n ref\n ) => {\n const { parent } = useDropdownContext();\n\n if (\n parent?.shouldFilter &&\n !getMatch(value, children, parent?.searchValue)\n ) {\n return null;\n }\n\n return (\n <MenuButton\n ref={ref}\n render={\n <DropdownMenuItem\n value={value}\n trailingIcon={trailingIcon}\n {...props}\n forceRender={parent?.autocomplete ? 'combobox' : 'auto'}\n />\n }\n >\n {children}\n </MenuButton>\n );\n }\n);\n"],"names":["forwardRef","_jsx","MenuButton","Slot.Root","TriangleRightIcon","useDropdownContext","getMatch","DropdownMenuItem"],"mappings":";;;;;;;;;;;AAYa,MAAA,mBAAmB,GAAGA,gBAAU,CAG3C,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;AACzC,IAAA,QACEC,gCAAA,CAACC,qBAAU,EAAA,EACT,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,OAAO,GAAGD,gCAAC,CAAAE,UAAS,EAAG,EAAA,CAAA,GAAG,SAAS,EAAA,GACvC,KAAK,EAAA,QAAA,EAER,QAAQ,EAAA,CACE,EACb;AACJ,CAAC,EAAE;AAIH;;AAEG;AACU,MAAA,uBAAuB,GAAGH,gBAAU,CAI/C,CACE,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,GAAGC,gCAAA,CAACG,4BAAiB,EAAA,EAAA,CAAG,EAAE,GAAG,KAAK,EAAE,EACnE,GAAG,KACD;AACF,IAAA,MAAM,EAAE,MAAM,EAAE,GAAGC,mCAAkB,EAAE,CAAC;IAExC,IACE,MAAM,EAAE,YAAY;QACpB,CAACC,cAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAC/C;AACA,QAAA,OAAO,IAAI,CAAC;KACb;AAED,IAAA,QACEL,gCAAC,CAAAC,qBAAU,IACT,GAAG,EAAE,GAAG,EACR,MAAM,EACJD,gCAAA,CAACM,iCAAgB,EACf,EAAA,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EACtB,GAAA,KAAK,EACT,WAAW,EAAE,MAAM,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,EAAA,CACvD,YAGH,QAAQ,EAAA,CACE,EACb;AACJ,CAAC;;;;;"}
1
+ {"version":3,"file":"dropdown-menu-trigger.cjs","sources":["../../../components/dropdown-menu/dropdown-menu-trigger.tsx"],"sourcesContent":["import { MenuButton, MenuButtonProps } from '@ariakit/react';\nimport { Slot } from 'radix-ui';\nimport { PointerEvent, forwardRef } from 'react';\nimport { TriangleRightIcon } from '~/icons';\nimport { DropdownMenuItem, DropdownMenuItemProps } from './dropdown-menu-item';\nimport { useDropdownContext } from './dropdown-menu-root';\nimport { WithAsChild } from './types';\nimport { getMatch } from './utils';\n\nexport interface DropdownMenuTriggerProps extends WithAsChild<MenuButtonProps> {\n stopPropagation?: boolean;\n}\n\nexport const DropdownMenuTrigger = forwardRef<\n HTMLButtonElement,\n DropdownMenuTriggerProps\n>(({ children, asChild, stopPropagation = true, onClick, ...props }, ref) => {\n return (\n <MenuButton\n ref={ref}\n render={asChild ? <Slot.Root /> : undefined}\n onClick={(\n e: PointerEvent<HTMLButtonElement> & PointerEvent<HTMLDivElement>\n ) => {\n if (stopPropagation) e.stopPropagation();\n onClick?.(e);\n }}\n {...props}\n >\n {children}\n </MenuButton>\n );\n});\n\nexport interface DropdownMenuTriggerItemProps extends DropdownMenuItemProps {}\n\n/**\n * `TriggerItem` is a helper component that renders a `Trigger` as a `MenuItem`.\n */\nexport const DropdownMenuTriggerItem = forwardRef<\n HTMLButtonElement,\n DropdownMenuTriggerItemProps\n>(\n (\n { children, value, trailingIcon = <TriangleRightIcon />, ...props },\n ref\n ) => {\n const { parent } = useDropdownContext();\n\n if (\n parent?.shouldFilter &&\n !getMatch(value, children, parent?.searchValue)\n ) {\n return null;\n }\n\n return (\n <MenuButton\n ref={ref}\n render={\n <DropdownMenuItem\n value={value}\n trailingIcon={trailingIcon}\n {...props}\n forceRender={parent?.autocomplete ? 'combobox' : 'auto'}\n />\n }\n >\n {children}\n </MenuButton>\n );\n }\n);\n"],"names":["forwardRef","_jsx","MenuButton","Slot.Root","TriangleRightIcon","useDropdownContext","getMatch","DropdownMenuItem"],"mappings":";;;;;;;;;;;AAaa,MAAA,mBAAmB,GAAGA,gBAAU,CAG3C,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;AAC1E,IAAA,QACEC,gCAAA,CAACC,qBAAU,EAAA,EACT,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,OAAO,GAAGD,gCAAC,CAAAE,UAAS,EAAG,EAAA,CAAA,GAAG,SAAS,EAC3C,OAAO,EAAE,CACP,CAAiE,KAC/D;AACF,YAAA,IAAI,eAAe;gBAAE,CAAC,CAAC,eAAe,EAAE,CAAC;AACzC,YAAA,OAAO,GAAG,CAAC,CAAC,CAAC;AACf,SAAC,KACG,KAAK,EAAA,QAAA,EAER,QAAQ,EAAA,CACE,EACb;AACJ,CAAC,EAAE;AAIH;;AAEG;AACU,MAAA,uBAAuB,GAAGH,gBAAU,CAI/C,CACE,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,GAAGC,gCAAA,CAACG,4BAAiB,EAAA,EAAA,CAAG,EAAE,GAAG,KAAK,EAAE,EACnE,GAAG,KACD;AACF,IAAA,MAAM,EAAE,MAAM,EAAE,GAAGC,mCAAkB,EAAE,CAAC;IAExC,IACE,MAAM,EAAE,YAAY;QACpB,CAACC,cAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAC/C;AACA,QAAA,OAAO,IAAI,CAAC;KACb;AAED,IAAA,QACEL,gCAAC,CAAAC,qBAAU,IACT,GAAG,EAAE,GAAG,EACR,MAAM,EACJD,gCAAA,CAACM,iCAAgB,EACf,EAAA,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EACtB,GAAA,KAAK,EACT,WAAW,EAAE,MAAM,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,EAAA,CACvD,YAGH,QAAQ,EAAA,CACE,EACb;AACJ,CAAC;;;;;"}
@@ -2,6 +2,7 @@ import { MenuButtonProps } from '@ariakit/react';
2
2
  import { DropdownMenuItemProps } from './dropdown-menu-item';
3
3
  import { WithAsChild } from './types';
4
4
  export interface DropdownMenuTriggerProps extends WithAsChild<MenuButtonProps> {
5
+ stopPropagation?: boolean;
5
6
  }
6
7
  export declare const DropdownMenuTrigger: import("react").ForwardRefExoticComponent<Omit<DropdownMenuTriggerProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
7
8
  export interface DropdownMenuTriggerItemProps extends DropdownMenuItemProps {
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-menu-trigger.d.ts","sourceRoot":"","sources":["../../../components/dropdown-menu/dropdown-menu-trigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAI7D,OAAO,EAAoB,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,MAAM,WAAW,wBACf,SAAQ,WAAW,CAAC,eAAe,CAAC;CAAG;AAEzC,eAAO,MAAM,mBAAmB,qIAa9B,CAAC;AAEH,MAAM,WAAW,4BAA6B,SAAQ,qBAAqB;CAAG;AAE9E;;GAEG;AACH,eAAO,MAAM,uBAAuB,yIAiCnC,CAAC"}
1
+ {"version":3,"file":"dropdown-menu-trigger.d.ts","sourceRoot":"","sources":["../../../components/dropdown-menu/dropdown-menu-trigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAI7D,OAAO,EAAoB,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,MAAM,WAAW,wBAAyB,SAAQ,WAAW,CAAC,eAAe,CAAC;IAC5E,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,eAAO,MAAM,mBAAmB,qIAmB9B,CAAC;AAEH,MAAM,WAAW,4BAA6B,SAAQ,qBAAqB;CAAG;AAE9E;;GAEG;AACH,eAAO,MAAM,uBAAuB,yIAiCnC,CAAC"}
@@ -7,8 +7,12 @@ import { useDropdownContext } from './dropdown-menu-root.js';
7
7
  import { getMatch } from './utils.js';
8
8
  import { Root as Slot } from '../../node_modules/.pnpm/@radix-ui_react-slot@1.2.3_@types_react@18.2.12_react@18.2.0/node_modules/@radix-ui/react-slot/dist/index.js';
9
9
 
10
- const DropdownMenuTrigger = forwardRef(({ children, asChild, ...props }, ref) => {
11
- return (jsxRuntimeExports.jsx(MenuButton, { ref: ref, render: asChild ? jsxRuntimeExports.jsx(Slot, {}) : undefined, ...props, children: children }));
10
+ const DropdownMenuTrigger = forwardRef(({ children, asChild, stopPropagation = true, onClick, ...props }, ref) => {
11
+ return (jsxRuntimeExports.jsx(MenuButton, { ref: ref, render: asChild ? jsxRuntimeExports.jsx(Slot, {}) : undefined, onClick: (e) => {
12
+ if (stopPropagation)
13
+ e.stopPropagation();
14
+ onClick?.(e);
15
+ }, ...props, children: children }));
12
16
  });
13
17
  /**
14
18
  * `TriggerItem` is a helper component that renders a `Trigger` as a `MenuItem`.
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown-menu-trigger.js","sources":["../../../components/dropdown-menu/dropdown-menu-trigger.tsx"],"sourcesContent":["import { MenuButton, MenuButtonProps } from '@ariakit/react';\nimport { Slot } from 'radix-ui';\nimport { forwardRef } from 'react';\nimport { TriangleRightIcon } from '~/icons';\nimport { DropdownMenuItem, DropdownMenuItemProps } from './dropdown-menu-item';\nimport { useDropdownContext } from './dropdown-menu-root';\nimport { WithAsChild } from './types';\nimport { getMatch } from './utils';\n\nexport interface DropdownMenuTriggerProps\n extends WithAsChild<MenuButtonProps> {}\n\nexport const DropdownMenuTrigger = forwardRef<\n HTMLButtonElement,\n DropdownMenuTriggerProps\n>(({ children, asChild, ...props }, ref) => {\n return (\n <MenuButton\n ref={ref}\n render={asChild ? <Slot.Root /> : undefined}\n {...props}\n >\n {children}\n </MenuButton>\n );\n});\n\nexport interface DropdownMenuTriggerItemProps extends DropdownMenuItemProps {}\n\n/**\n * `TriggerItem` is a helper component that renders a `Trigger` as a `MenuItem`.\n */\nexport const DropdownMenuTriggerItem = forwardRef<\n HTMLButtonElement,\n DropdownMenuTriggerItemProps\n>(\n (\n { children, value, trailingIcon = <TriangleRightIcon />, ...props },\n ref\n ) => {\n const { parent } = useDropdownContext();\n\n if (\n parent?.shouldFilter &&\n !getMatch(value, children, parent?.searchValue)\n ) {\n return null;\n }\n\n return (\n <MenuButton\n ref={ref}\n render={\n <DropdownMenuItem\n value={value}\n trailingIcon={trailingIcon}\n {...props}\n forceRender={parent?.autocomplete ? 'combobox' : 'auto'}\n />\n }\n >\n {children}\n </MenuButton>\n );\n }\n);\n"],"names":["_jsx","Slot.Root","TriangleRightIcon"],"mappings":";;;;;;;;;AAYa,MAAA,mBAAmB,GAAG,UAAU,CAG3C,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;AACzC,IAAA,QACEA,qBAAA,CAAC,UAAU,EAAA,EACT,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,OAAO,GAAGA,qBAAC,CAAAC,IAAS,EAAG,EAAA,CAAA,GAAG,SAAS,EAAA,GACvC,KAAK,EAAA,QAAA,EAER,QAAQ,EAAA,CACE,EACb;AACJ,CAAC,EAAE;AAIH;;AAEG;AACU,MAAA,uBAAuB,GAAG,UAAU,CAI/C,CACE,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,GAAGD,qBAAA,CAACE,gBAAiB,EAAA,EAAA,CAAG,EAAE,GAAG,KAAK,EAAE,EACnE,GAAG,KACD;AACF,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAExC,IACE,MAAM,EAAE,YAAY;QACpB,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAC/C;AACA,QAAA,OAAO,IAAI,CAAC;KACb;AAED,IAAA,QACEF,qBAAC,CAAA,UAAU,IACT,GAAG,EAAE,GAAG,EACR,MAAM,EACJA,qBAAA,CAAC,gBAAgB,EACf,EAAA,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EACtB,GAAA,KAAK,EACT,WAAW,EAAE,MAAM,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,EAAA,CACvD,YAGH,QAAQ,EAAA,CACE,EACb;AACJ,CAAC;;;;"}
1
+ {"version":3,"file":"dropdown-menu-trigger.js","sources":["../../../components/dropdown-menu/dropdown-menu-trigger.tsx"],"sourcesContent":["import { MenuButton, MenuButtonProps } from '@ariakit/react';\nimport { Slot } from 'radix-ui';\nimport { PointerEvent, forwardRef } from 'react';\nimport { TriangleRightIcon } from '~/icons';\nimport { DropdownMenuItem, DropdownMenuItemProps } from './dropdown-menu-item';\nimport { useDropdownContext } from './dropdown-menu-root';\nimport { WithAsChild } from './types';\nimport { getMatch } from './utils';\n\nexport interface DropdownMenuTriggerProps extends WithAsChild<MenuButtonProps> {\n stopPropagation?: boolean;\n}\n\nexport const DropdownMenuTrigger = forwardRef<\n HTMLButtonElement,\n DropdownMenuTriggerProps\n>(({ children, asChild, stopPropagation = true, onClick, ...props }, ref) => {\n return (\n <MenuButton\n ref={ref}\n render={asChild ? <Slot.Root /> : undefined}\n onClick={(\n e: PointerEvent<HTMLButtonElement> & PointerEvent<HTMLDivElement>\n ) => {\n if (stopPropagation) e.stopPropagation();\n onClick?.(e);\n }}\n {...props}\n >\n {children}\n </MenuButton>\n );\n});\n\nexport interface DropdownMenuTriggerItemProps extends DropdownMenuItemProps {}\n\n/**\n * `TriggerItem` is a helper component that renders a `Trigger` as a `MenuItem`.\n */\nexport const DropdownMenuTriggerItem = forwardRef<\n HTMLButtonElement,\n DropdownMenuTriggerItemProps\n>(\n (\n { children, value, trailingIcon = <TriangleRightIcon />, ...props },\n ref\n ) => {\n const { parent } = useDropdownContext();\n\n if (\n parent?.shouldFilter &&\n !getMatch(value, children, parent?.searchValue)\n ) {\n return null;\n }\n\n return (\n <MenuButton\n ref={ref}\n render={\n <DropdownMenuItem\n value={value}\n trailingIcon={trailingIcon}\n {...props}\n forceRender={parent?.autocomplete ? 'combobox' : 'auto'}\n />\n }\n >\n {children}\n </MenuButton>\n );\n }\n);\n"],"names":["_jsx","Slot.Root","TriangleRightIcon"],"mappings":";;;;;;;;;AAaa,MAAA,mBAAmB,GAAG,UAAU,CAG3C,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;AAC1E,IAAA,QACEA,qBAAA,CAAC,UAAU,EAAA,EACT,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,OAAO,GAAGA,qBAAC,CAAAC,IAAS,EAAG,EAAA,CAAA,GAAG,SAAS,EAC3C,OAAO,EAAE,CACP,CAAiE,KAC/D;AACF,YAAA,IAAI,eAAe;gBAAE,CAAC,CAAC,eAAe,EAAE,CAAC;AACzC,YAAA,OAAO,GAAG,CAAC,CAAC,CAAC;AACf,SAAC,KACG,KAAK,EAAA,QAAA,EAER,QAAQ,EAAA,CACE,EACb;AACJ,CAAC,EAAE;AAIH;;AAEG;AACU,MAAA,uBAAuB,GAAG,UAAU,CAI/C,CACE,EAAE,QAAQ,EAAE,KAAK,EAAE,YAAY,GAAGD,qBAAA,CAACE,gBAAiB,EAAA,EAAA,CAAG,EAAE,GAAG,KAAK,EAAE,EACnE,GAAG,KACD;AACF,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,kBAAkB,EAAE,CAAC;IAExC,IACE,MAAM,EAAE,YAAY;QACpB,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAC/C;AACA,QAAA,OAAO,IAAI,CAAC;KACb;AAED,IAAA,QACEF,qBAAC,CAAA,UAAU,IACT,GAAG,EAAE,GAAG,EACR,MAAM,EACJA,qBAAA,CAAC,gBAAgB,EACf,EAAA,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,YAAY,EACtB,GAAA,KAAK,EACT,WAAW,EAAE,MAAM,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,EAAA,CACvD,YAGH,QAAQ,EAAA,CACE,EACb;AACJ,CAAC;;;;"}
@@ -1,4 +1,4 @@
1
- export declare const DropdownMenu: (({ autocomplete, autocompleteMode, searchValue: providedSearchValue, onSearch, focusLoop, defaultSearchValue, ...props }: import("./dropdown-menu-root").DropdownMenuRootProps) => import("react/jsx-runtime").JSX.Element) & {
1
+ export declare const DropdownMenu: (({ autocomplete, autocompleteMode, searchValue: providedSearchValue, onSearch, focusLoop, defaultSearchValue, onOpenChange, ...props }: import("./dropdown-menu-root").DropdownMenuRootProps) => import("react/jsx-runtime").JSX.Element) & {
2
2
  Trigger: import("react").ForwardRefExoticComponent<Omit<import("./dropdown-menu-trigger").DropdownMenuTriggerProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
3
3
  /**
4
4
  * `TriggerItem` is a helper component that renders a `Trigger` as a `MenuItem`.
@@ -0,0 +1,31 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.cjs');
4
+ var index = require('../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.cjs');
5
+ var React = require('react');
6
+ var select = require('../select/select.cjs');
7
+ var text = require('../text/text.cjs');
8
+ var filterChip_module = require('./filter-chip.module.css.cjs');
9
+
10
+ const Operation = ({ label, value, onChange, operations, showAlternateLabel = false }) => {
11
+ const operationValue = value?.value ?? '';
12
+ const handleValueChange = React.useCallback((newValue) => {
13
+ const operation = operations.find(o => o.value === newValue);
14
+ if (operation)
15
+ onChange(operation);
16
+ }, [operations, onChange]);
17
+ if (operations.length === 1)
18
+ return (jsxRuntime.jsxRuntimeExports.jsx(text.Text, { variant: 'secondary', className: index.cx(filterChip_module.default.selectValue, filterChip_module.default.operationValue), children: operations[0].label }));
19
+ return (jsxRuntime.jsxRuntimeExports.jsxs(select.Select, { value: operationValue, onValueChange: handleValueChange, "aria-labelledby": `${label}-label`, children: [jsxRuntime.jsxRuntimeExports.jsx(select.Select.Trigger, { variant: 'text', className: index.cx(filterChip_module.default.selectValue, filterChip_module.default.operationValue), "aria-label": `${label} filter operation`, iconProps: {
20
+ style: {
21
+ display: 'none'
22
+ }
23
+ }, children: jsxRuntime.jsxRuntimeExports.jsx(select.Select.Value, { placeholder: 'Select operation', className: filterChip_module.default.operationText }) }), jsxRuntime.jsxRuntimeExports.jsx(select.Select.Content, { "data-variant": 'filter', children: operations.map(operation => {
24
+ return (jsxRuntime.jsxRuntimeExports.jsx(select.Select.Item, { value: operation.value, "aria-label": `Filter ${label} ${operation.label}`, children: showAlternateLabel && operation?.alternateLabel
25
+ ? operation.alternateLabel
26
+ : operation.label }, operation.value));
27
+ }) })] }));
28
+ };
29
+
30
+ exports.Operation = Operation;
31
+ //# sourceMappingURL=filter-chip-operation.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-chip-operation.cjs","sources":["../../../components/filter-chip/filter-chip-operation.tsx"],"sourcesContent":["import { cx } from 'class-variance-authority';\nimport { useCallback } from 'react';\nimport { FilterOperation, FilterOperator } from '~/types/filters';\nimport { Select } from '../select';\nimport { Text } from '../text';\nimport styles from './filter-chip.module.css';\n\ninterface OperationProps {\n label: string;\n value?: FilterOperation;\n onChange: (operation: FilterOperation) => void;\n operations: FilterOperator<string>[];\n showAlternateLabel?: boolean;\n}\n\nexport const Operation = ({\n label,\n value,\n onChange,\n operations,\n showAlternateLabel = false\n}: OperationProps) => {\n const operationValue = value?.value ?? '';\n\n const handleValueChange = useCallback(\n (newValue: string) => {\n const operation = operations.find(o => o.value === newValue);\n if (operation) onChange(operation);\n },\n [operations, onChange]\n );\n\n if (operations.length === 1)\n return (\n <Text\n variant='secondary'\n className={cx(styles.selectValue, styles.operationValue)}\n >\n {operations[0].label}\n </Text>\n );\n\n return (\n <Select\n value={operationValue}\n onValueChange={handleValueChange}\n aria-labelledby={`${label}-label`}\n >\n <Select.Trigger\n variant='text'\n className={cx(styles.selectValue, styles.operationValue)}\n aria-label={`${label} filter operation`}\n iconProps={{\n style: {\n display: 'none'\n }\n }}\n >\n <Select.Value\n placeholder='Select operation'\n className={styles.operationText}\n />\n </Select.Trigger>\n <Select.Content data-variant='filter'>\n {operations.map(operation => {\n return (\n <Select.Item\n key={operation.value}\n value={operation.value}\n aria-label={`Filter ${label} ${operation.label}`}\n >\n {showAlternateLabel && operation?.alternateLabel\n ? operation.alternateLabel\n : operation.label}\n </Select.Item>\n );\n })}\n </Select.Content>\n </Select>\n );\n};\n"],"names":["useCallback","_jsx","Text","cx","styles","_jsxs","Select"],"mappings":";;;;;;;;;AAea,MAAA,SAAS,GAAG,CAAC,EACxB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,UAAU,EACV,kBAAkB,GAAG,KAAK,EACX,KAAI;AACnB,IAAA,MAAM,cAAc,GAAG,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC;AAE1C,IAAA,MAAM,iBAAiB,GAAGA,iBAAW,CACnC,CAAC,QAAgB,KAAI;AACnB,QAAA,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC;AAC7D,QAAA,IAAI,SAAS;YAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;AACrC,KAAC,EACD,CAAC,UAAU,EAAE,QAAQ,CAAC,CACvB,CAAC;AAEF,IAAA,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;AACzB,QAAA,QACEC,gCAAA,C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CACV,EAAA,CAAA,EACT;AACJ;;;;"}
@@ -0,0 +1,11 @@
1
+ import { FilterOperation, FilterOperator } from '~/types/filters';
2
+ interface OperationProps {
3
+ label: string;
4
+ value?: FilterOperation;
5
+ onChange: (operation: FilterOperation) => void;
6
+ operations: FilterOperator<string>[];
7
+ showAlternateLabel?: boolean;
8
+ }
9
+ export declare const Operation: ({ label, value, onChange, operations, showAlternateLabel }: OperationProps) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
11
+ //# sourceMappingURL=filter-chip-operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-chip-operation.d.ts","sourceRoot":"","sources":["../../../components/filter-chip/filter-chip-operation.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKlE,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,CAAC,SAAS,EAAE,eAAe,KAAK,IAAI,CAAC;IAC/C,UAAU,EAAE,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;IACrC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,SAAS,+DAMnB,cAAc,4CA2DhB,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { j as jsxRuntimeExports } from '../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js';
2
+ import { cx } from '../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js';
3
+ import { useCallback } from 'react';
4
+ import { Select } from '../select/select.js';
5
+ import { Text } from '../text/text.js';
6
+ import styles from './filter-chip.module.css.js';
7
+
8
+ const Operation = ({ label, value, onChange, operations, showAlternateLabel = false }) => {
9
+ const operationValue = value?.value ?? '';
10
+ const handleValueChange = useCallback((newValue) => {
11
+ const operation = operations.find(o => o.value === newValue);
12
+ if (operation)
13
+ onChange(operation);
14
+ }, [operations, onChange]);
15
+ if (operations.length === 1)
16
+ return (jsxRuntimeExports.jsx(Text, { variant: 'secondary', className: cx(styles.selectValue, styles.operationValue), children: operations[0].label }));
17
+ return (jsxRuntimeExports.jsxs(Select, { value: operationValue, onValueChange: handleValueChange, "aria-labelledby": `${label}-label`, children: [jsxRuntimeExports.jsx(Select.Trigger, { variant: 'text', className: cx(styles.selectValue, styles.operationValue), "aria-label": `${label} filter operation`, iconProps: {
18
+ style: {
19
+ display: 'none'
20
+ }
21
+ }, children: jsxRuntimeExports.jsx(Select.Value, { placeholder: 'Select operation', className: styles.operationText }) }), jsxRuntimeExports.jsx(Select.Content, { "data-variant": 'filter', children: operations.map(operation => {
22
+ return (jsxRuntimeExports.jsx(Select.Item, { value: operation.value, "aria-label": `Filter ${label} ${operation.label}`, children: showAlternateLabel && operation?.alternateLabel
23
+ ? operation.alternateLabel
24
+ : operation.label }, operation.value));
25
+ }) })] }));
26
+ };
27
+
28
+ export { Operation };
29
+ //# sourceMappingURL=filter-chip-operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-chip-operation.js","sources":["../../../components/filter-chip/filter-chip-operation.tsx"],"sourcesContent":["import { cx } from 'class-variance-authority';\nimport { useCallback } from 'react';\nimport { FilterOperation, FilterOperator } from '~/types/filters';\nimport { Select } from '../select';\nimport { Text } from '../text';\nimport styles from './filter-chip.module.css';\n\ninterface OperationProps {\n label: string;\n value?: FilterOperation;\n onChange: (operation: FilterOperation) => void;\n operations: FilterOperator<string>[];\n showAlternateLabel?: boolean;\n}\n\nexport const Operation = ({\n label,\n value,\n onChange,\n operations,\n showAlternateLabel = false\n}: OperationProps) => {\n const operationValue = value?.value ?? '';\n\n const handleValueChange = useCallback(\n (newValue: string) => {\n const operation = operations.find(o => o.value === newValue);\n if (operation) onChange(operation);\n },\n [operations, onChange]\n );\n\n if (operations.length === 1)\n return (\n <Text\n variant='secondary'\n className={cx(styles.selectValue, styles.operationValue)}\n >\n {operations[0].label}\n </Text>\n );\n\n return (\n <Select\n value={operationValue}\n onValueChange={handleValueChange}\n aria-labelledby={`${label}-label`}\n >\n <Select.Trigger\n variant='text'\n className={cx(styles.selectValue, styles.operationValue)}\n aria-label={`${label} filter operation`}\n iconProps={{\n style: {\n display: 'none'\n }\n }}\n >\n <Select.Value\n placeholder='Select operation'\n className={styles.operationText}\n />\n </Select.Trigger>\n <Select.Content data-variant='filter'>\n {operations.map(operation => {\n return (\n <Select.Item\n key={operation.value}\n value={operation.value}\n aria-label={`Filter ${label} ${operation.label}`}\n >\n {showAlternateLabel && operation?.alternateLabel\n ? operation.alternateLabel\n : operation.label}\n </Select.Item>\n );\n })}\n </Select.Content>\n </Select>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;AAea,MAAA,SAAS,GAAG,CAAC,EACxB,KAAK,EACL,KAAK,EACL,QAAQ,EACR,UAAU,EACV,kBAAkB,GAAG,KAAK,EACX,KAAI;AACnB,IAAA,MAAM,cAAc,GAAG,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC;AAE1C,IAAA,MAAM,iBAAiB,GAAG,WAAW,CACnC,CAAC,QAAgB,KAAI;AACnB,QAAA,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC;AAC7D,QAAA,IAAI,SAAS;YAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;AACrC,KAAC,EACD,CAAC,UAAU,EAAE,QAAQ,CAAC,CACvB,CAAC;AAEF,IAAA,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;AACzB,QAAA,QACEA,qBAAA,CAAC,IAAI,EAAA,EACH,OAAO,EAAC,WAAW,EACnB,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,cAAc,CAAC,EAEvD,QAAA,EAAA,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,EAAA,CACf,EACP;AAEJ,IAAA,QACEC,sBAAC,CAAA,MAAM,IACL,KAAK,EAAE,cAAc,EACrB,aAAa,EAAE,iBAAiB,EAAA,iBAAA,EACf,GAAG,KAAK,CAAA,MAAA,CAAQ,aAEjCD,qBAAC,CAAA,MAAM,CAAC,OAAO,EAAA,EACb,OAAO,EAAC,MAAM,EACd,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,cAAc,CAAC,EAC5C,YAAA,EAAA,CAAA,EAAG,KAAK,CAAmB,iBAAA,CAAA,EACvC,SAAS,EAAE;AACT,oBAAA,KAAK,EAAE;AACL,wBAAA,OAAO,EAAE,MAAM;AAChB,qBAAA;AACF,iBAAA,EAAA,QAAA,EAEDA,qBAAC,CAAA,MAAM,CAAC,KAAK,EACX,EAAA,WAAW,EAAC,kBAAkB,EAC9B,SAAS,EAAE,MAAM,CAAC,aAAa,EAAA,CAC/B,EACa,CAAA,EACjBA,qBAAC,CAAA,MAAM,CAAC,OAAO,EAAc,EAAA,cAAA,EAAA,QAAQ,EAClC,QAAA,EAAA,UAAU,CAAC,GAAG,CAAC,SAAS,IAAG;oBAC1B,QACEA,qBAAC,CAAA,MAAM,CAAC,IAAI,IAEV,KAAK,EAAE,SAAS,CAAC,KAAK,EAAA,YAAA,EACV,UAAU,KAAK,CAAA,CAAA,EAAI,SAAS,CAAC,KAAK,CAAA,CAAE,YAE/C,kBAAkB,IAAI,SAAS,EAAE,cAAc;8BAC5C,SAAS,CAAC,cAAc;8BACxB,SAAS,CAAC,KAAK,EAAA,EANd,SAAS,CAAC,KAAK,CAOR,EACd;AACJ,iBAAC,CAAC,EAAA,CACa,CACV,EAAA,CAAA,EACT;AACJ;;;;"}
@@ -2,9 +2,9 @@
2
2
 
3
3
  var jsxRuntime = require('../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.cjs');
4
4
  var reactIcons_esm = require('../../node_modules/.pnpm/@radix-ui_react-icons@1.3.0_react@18.2.0/node_modules/@radix-ui/react-icons/dist/react-icons.esm.cjs');
5
- var React = require('react');
6
- var box = require('../box/box.cjs');
7
5
  var index = require('../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.cjs');
6
+ var React = require('react');
7
+ var filters = require('../../types/filters.cjs');
8
8
  var flex = require('../flex/flex.cjs');
9
9
  require('../icon-button/icon-button.cjs');
10
10
  var select = require('../select/select.cjs');
@@ -16,61 +16,57 @@ require('../popover/popover.cjs');
16
16
  require('../input-field/input-field.cjs');
17
17
  var text = require('../text/text.cjs');
18
18
  var textfield = require('../textfield/textfield.cjs');
19
+ var filterChipOperation = require('./filter-chip-operation.cjs');
19
20
  var filterChip_module = require('./filter-chip.module.css.cjs');
20
- var filters = require('../../types/filters.cjs');
21
21
 
22
22
  const chip = index.cva(filterChip_module.default.chip, {
23
23
  variants: {
24
24
  variant: {
25
- default: filterChip_module.default["chip-default"],
26
- text: null,
27
- },
25
+ default: filterChip_module.default['chip-default'],
26
+ text: null
27
+ }
28
28
  },
29
29
  defaultVariants: {
30
- variant: "default",
31
- },
30
+ variant: 'default'
31
+ }
32
32
  });
33
- const Operation = ({ label, columnType = filters.FilterType.string, onOperationSelect, }) => {
34
- const filterOptions = filters.filterOperators[columnType] || [];
35
- // FilterOperatorTypes gives error as Select returns string
36
- const [value, setValue] = React.useState(filterOptions?.[0]?.value);
37
- React.useEffect(() => {
38
- const selectedOption = filterOptions.find(o => o.value === value);
39
- if (selectedOption) {
40
- onOperationSelect(selectedOption);
41
- }
42
- }, [value]);
43
- return (jsxRuntime.jsxRuntimeExports.jsxs(select.Select, { value: value, onValueChange: setValue, "aria-labelledby": `${label}-label`, children: [jsxRuntime.jsxRuntimeExports.jsx(select.Select.Trigger, { variant: "text", className: filterChip_module.default.selectValue, "aria-label": `${label} filter operation`, children: jsxRuntime.jsxRuntimeExports.jsx(select.Select.Value, { placeholder: "Select operation", className: filterChip_module.default.operationText }) }), jsxRuntime.jsxRuntimeExports.jsx(select.Select.Content, { "data-variant": "filter", children: filterOptions.map(opt => {
44
- return (jsxRuntime.jsxRuntimeExports.jsx(select.Select.Item, { value: opt.value, "aria-label": `Filter ${label} ${opt.label}`, children: opt.label }, opt.value));
45
- }) })] }));
46
- };
47
- const FilterChip = ({ label, value, onRemove, className, ref, columnType = filters.FilterType.string, options = [], onValueChange, onOperationChange, leadingIcon, variant, ...props }) => {
48
- const [operation, setOperation] = React.useState();
49
- const [filterValue, setFilterValue] = React.useState(value || "");
50
- const showOnRemove = typeof onRemove === "function";
51
- React.useEffect(() => {
52
- if (onOperationChange && operation?.value) {
53
- onOperationChange(operation?.value);
54
- }
55
- }, [operation?.value]);
56
- React.useEffect(() => {
57
- if (onValueChange) {
58
- onValueChange(filterValue);
59
- }
60
- }, [filterValue]);
33
+ const FilterChip = ({ label, value, onRemove, className, ref, columnType = filters.FilterType.string, options = [], onValueChange, onOperationChange, leadingIcon, variant, operations, ...props }) => {
34
+ const computedOperations = operations?.length
35
+ ? operations
36
+ : filters.filterOperators[columnType];
37
+ const [operation, setOperation] = React.useState(computedOperations?.[0]);
38
+ const [filterValue, setFilterValue] = React.useState(value || '');
39
+ const showOnRemove = typeof onRemove === 'function';
40
+ const isMultiSelectColumn = columnType === filters.FilterType.multiselect;
41
+ const handleOperationChange = React.useCallback((operation) => {
42
+ setOperation(operation);
43
+ if (operation?.value)
44
+ onOperationChange?.(operation.value);
45
+ }, [onOperationChange]);
46
+ const handleFilterValueChange = React.useCallback((value) => {
47
+ setFilterValue(value);
48
+ onValueChange?.(value, operation?.value ?? '');
49
+ }, [operation, onValueChange]);
61
50
  const renderValueInput = () => {
62
51
  switch (columnType) {
52
+ case filters.FilterType.multiselect:
63
53
  case filters.FilterType.select:
64
- return (jsxRuntime.jsxRuntimeExports.jsxs(select.Select, { value: filterValue.toString(), onValueChange: setFilterValue, children: [jsxRuntime.jsxRuntimeExports.jsx(select.Select.Trigger, { variant: "text", className: index.cx(filterChip_module.default.selectValue, filterChip_module.default.selectColumn), children: jsxRuntime.jsxRuntimeExports.jsx(select.Select.Value, { placeholder: "Select value" }) }), jsxRuntime.jsxRuntimeExports.jsx(select.Select.Content, { "data-variant": "filter", children: options.map(opt => (jsxRuntime.jsxRuntimeExports.jsx(select.Select.Item, { value: opt.value.toString(), children: opt.label }, opt.value.toString()))) })] }));
54
+ return (jsxRuntime.jsxRuntimeExports.jsxs(select.Select, { value: isMultiSelectColumn ? filterValue : filterValue.toString(), onValueChange: handleFilterValueChange, multiple: isMultiSelectColumn, children: [jsxRuntime.jsxRuntimeExports.jsx(select.Select.Trigger, { iconProps: {
55
+ style: {
56
+ display: 'none'
57
+ }
58
+ }, variant: 'text', className: index.cx(filterChip_module.default.selectValue, filterChip_module.default.selectColumn), children: jsxRuntime.jsxRuntimeExports.jsx(select.Select.Value, { placeholder: 'Select value', children: isMultiSelectColumn && filterValue.length > 1
59
+ ? `${filterValue.length} selected`
60
+ : undefined }) }), jsxRuntime.jsxRuntimeExports.jsx(select.Select.Content, { "data-variant": 'filter', children: options.map(opt => (jsxRuntime.jsxRuntimeExports.jsx(select.Select.Item, { value: opt.value.toString(), children: opt.label }, opt.value.toString()))) })] }));
65
61
  case filters.FilterType.date:
66
- return (jsxRuntime.jsxRuntimeExports.jsx("div", { className: filterChip_module.default.dateFieldWrapper, children: jsxRuntime.jsxRuntimeExports.jsx(datePicker.DatePicker, { value: filterValue, onSelect: date => setFilterValue(date), showCalendarIcon: false, inputFieldProps: { className: filterChip_module.default.dateField } }) }));
62
+ return (jsxRuntime.jsxRuntimeExports.jsx("div", { className: filterChip_module.default.dateFieldWrapper, children: jsxRuntime.jsxRuntimeExports.jsx(datePicker.DatePicker, { value: filterValue, onSelect: date => handleFilterValueChange(date), showCalendarIcon: false, inputFieldProps: { className: filterChip_module.default.dateField } }) }));
67
63
  default:
68
- return (jsxRuntime.jsxRuntimeExports.jsx("div", { className: filterChip_module.default.textFieldWrapper, children: jsxRuntime.jsxRuntimeExports.jsx(textfield.TextField, { className: filterChip_module.default.textField, value: filterValue, onChange: e => setFilterValue(e.target.value) }) }));
64
+ return (jsxRuntime.jsxRuntimeExports.jsx("div", { className: filterChip_module.default.textFieldWrapper, children: jsxRuntime.jsxRuntimeExports.jsx(textfield.TextField, { className: filterChip_module.default.textField, value: filterValue, onChange: e => handleFilterValueChange(e.target.value) }) }));
69
65
  }
70
66
  };
71
- return (jsxRuntime.jsxRuntimeExports.jsx(box.Box, { ref: ref, className: chip({ variant, className }), role: "group", "aria-label": `Filter by ${label}`, ...props, children: jsxRuntime.jsxRuntimeExports.jsxs(flex.Flex, { align: "center", children: [jsxRuntime.jsxRuntimeExports.jsxs(flex.Flex, { align: "center", gap: 2, children: [leadingIcon && (jsxRuntime.jsxRuntimeExports.jsx("span", { className: filterChip_module.default.leadingIcon, "aria-hidden": "true", children: leadingIcon })), jsxRuntime.jsxRuntimeExports.jsx(text.Text, { size: 2, weight: "normal", children: label })] }), jsxRuntime.jsxRuntimeExports.jsx(Operation, { columnType: columnType, label: label, onOperationSelect: setOperation }), renderValueInput(), showOnRemove && (jsxRuntime.jsxRuntimeExports.jsx("button", { className: filterChip_module.default.removeIconContainer, "aria-label": `Remove ${label} filter`, onClick: onRemove, children: jsxRuntime.jsxRuntimeExports.jsx(reactIcons_esm.Cross1Icon, { className: filterChip_module.default.removeIcon }) }))] }) }));
67
+ return (jsxRuntime.jsxRuntimeExports.jsxs(flex.Flex, { align: 'center', ref: ref, className: chip({ variant, className }), role: 'group', "aria-label": `Filter by ${label}`, ...props, children: [jsxRuntime.jsxRuntimeExports.jsxs(flex.Flex, { align: 'center', gap: 2, className: filterChip_module.default['chip-label'], children: [leadingIcon && (jsxRuntime.jsxRuntimeExports.jsx("span", { className: filterChip_module.default.leadingIcon, "aria-hidden": 'true', children: leadingIcon })), jsxRuntime.jsxRuntimeExports.jsx(text.Text, { size: 2, weight: 'normal', children: label })] }), jsxRuntime.jsxRuntimeExports.jsx(filterChipOperation.Operation, { operations: computedOperations, label: label, value: operation, onChange: handleOperationChange, showAlternateLabel: isMultiSelectColumn && filterValue.length <= 1 }), renderValueInput(), showOnRemove && (jsxRuntime.jsxRuntimeExports.jsx("button", { className: filterChip_module.default.removeIconContainer, "aria-label": `Remove ${label} filter`, onClick: onRemove, children: jsxRuntime.jsxRuntimeExports.jsx(reactIcons_esm.Cross1Icon, { className: filterChip_module.default.removeIcon }) }))] }));
72
68
  };
73
- FilterChip.displayName = "FilterChip";
69
+ FilterChip.displayName = 'FilterChip';
74
70
 
75
71
  exports.FilterChip = FilterChip;
76
72
  //# sourceMappingURL=filter-chip.cjs.map