@salt-ds/core 1.65.1 → 1.67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/css/salt-core.css +145 -3
  3. package/dist-cjs/aria-announcer/AriaAnnouncerProvider.js +28 -11
  4. package/dist-cjs/aria-announcer/AriaAnnouncerProvider.js.map +1 -1
  5. package/dist-cjs/border-layout/BorderLayout.js +28 -7
  6. package/dist-cjs/border-layout/BorderLayout.js.map +1 -1
  7. package/dist-cjs/dialog/Dialog.js +3 -2
  8. package/dist-cjs/dialog/Dialog.js.map +1 -1
  9. package/dist-cjs/drawer/Drawer.js +2 -1
  10. package/dist-cjs/drawer/Drawer.js.map +1 -1
  11. package/dist-cjs/file-drop-zone/FileDropZone.js +19 -4
  12. package/dist-cjs/file-drop-zone/FileDropZone.js.map +1 -1
  13. package/dist-cjs/file-drop-zone/FileDropZoneTrigger.js +3 -2
  14. package/dist-cjs/file-drop-zone/FileDropZoneTrigger.js.map +1 -1
  15. package/dist-cjs/grid-layout/GridLayout.css.js +1 -1
  16. package/dist-cjs/index.js +22 -0
  17. package/dist-cjs/index.js.map +1 -1
  18. package/dist-cjs/mega-menu/MegaMenu.js +81 -0
  19. package/dist-cjs/mega-menu/MegaMenu.js.map +1 -0
  20. package/dist-cjs/mega-menu/MegaMenuActions.css.js +6 -0
  21. package/dist-cjs/mega-menu/MegaMenuActions.css.js.map +1 -0
  22. package/dist-cjs/mega-menu/MegaMenuActions.js +37 -0
  23. package/dist-cjs/mega-menu/MegaMenuActions.js.map +1 -0
  24. package/dist-cjs/mega-menu/MegaMenuAside.css.js +6 -0
  25. package/dist-cjs/mega-menu/MegaMenuAside.css.js.map +1 -0
  26. package/dist-cjs/mega-menu/MegaMenuAside.js +37 -0
  27. package/dist-cjs/mega-menu/MegaMenuAside.js.map +1 -0
  28. package/dist-cjs/mega-menu/MegaMenuContent.css.js +6 -0
  29. package/dist-cjs/mega-menu/MegaMenuContent.css.js.map +1 -0
  30. package/dist-cjs/mega-menu/MegaMenuContent.js +29 -0
  31. package/dist-cjs/mega-menu/MegaMenuContent.js.map +1 -0
  32. package/dist-cjs/mega-menu/MegaMenuContext.js +18 -0
  33. package/dist-cjs/mega-menu/MegaMenuContext.js.map +1 -0
  34. package/dist-cjs/mega-menu/MegaMenuGroup.css.js +6 -0
  35. package/dist-cjs/mega-menu/MegaMenuGroup.css.js.map +1 -0
  36. package/dist-cjs/mega-menu/MegaMenuGroup.js +44 -0
  37. package/dist-cjs/mega-menu/MegaMenuGroup.js.map +1 -0
  38. package/dist-cjs/mega-menu/MegaMenuGroupContext.js +23 -0
  39. package/dist-cjs/mega-menu/MegaMenuGroupContext.js.map +1 -0
  40. package/dist-cjs/mega-menu/MegaMenuGroupHeading.css.js +6 -0
  41. package/dist-cjs/mega-menu/MegaMenuGroupHeading.css.js.map +1 -0
  42. package/dist-cjs/mega-menu/MegaMenuGroupHeading.js +44 -0
  43. package/dist-cjs/mega-menu/MegaMenuGroupHeading.js.map +1 -0
  44. package/dist-cjs/mega-menu/MegaMenuGroups.css.js +6 -0
  45. package/dist-cjs/mega-menu/MegaMenuGroups.css.js.map +1 -0
  46. package/dist-cjs/mega-menu/MegaMenuGroups.js +29 -0
  47. package/dist-cjs/mega-menu/MegaMenuGroups.js.map +1 -0
  48. package/dist-cjs/mega-menu/MegaMenuList.css.js +6 -0
  49. package/dist-cjs/mega-menu/MegaMenuList.css.js.map +1 -0
  50. package/dist-cjs/mega-menu/MegaMenuList.js +47 -0
  51. package/dist-cjs/mega-menu/MegaMenuList.js.map +1 -0
  52. package/dist-cjs/mega-menu/MegaMenuListItem.css.js +6 -0
  53. package/dist-cjs/mega-menu/MegaMenuListItem.css.js.map +1 -0
  54. package/dist-cjs/mega-menu/MegaMenuListItem.js +50 -0
  55. package/dist-cjs/mega-menu/MegaMenuListItem.js.map +1 -0
  56. package/dist-cjs/mega-menu/MegaMenuPanel.css.js +6 -0
  57. package/dist-cjs/mega-menu/MegaMenuPanel.css.js.map +1 -0
  58. package/dist-cjs/mega-menu/MegaMenuPanel.js +94 -0
  59. package/dist-cjs/mega-menu/MegaMenuPanel.js.map +1 -0
  60. package/dist-cjs/mega-menu/MegaMenuTrigger.js +97 -0
  61. package/dist-cjs/mega-menu/MegaMenuTrigger.js.map +1 -0
  62. package/dist-cjs/mega-menu/useMegaMenu.js +15 -0
  63. package/dist-cjs/mega-menu/useMegaMenu.js.map +1 -0
  64. package/dist-cjs/mega-menu/useMegaMenuNavigation.js +282 -0
  65. package/dist-cjs/mega-menu/useMegaMenuNavigation.js.map +1 -0
  66. package/dist-cjs/mega-menu/usePageMargin.js +28 -0
  67. package/dist-cjs/mega-menu/usePageMargin.js.map +1 -0
  68. package/dist-cjs/overlay/OverlayPanel.js +2 -1
  69. package/dist-cjs/overlay/OverlayPanel.js.map +1 -1
  70. package/dist-cjs/semantic-icon-provider/SemanticIconProvider.js +1 -0
  71. package/dist-cjs/semantic-icon-provider/SemanticIconProvider.js.map +1 -1
  72. package/dist-es/aria-announcer/AriaAnnouncerProvider.js +29 -12
  73. package/dist-es/aria-announcer/AriaAnnouncerProvider.js.map +1 -1
  74. package/dist-es/border-layout/BorderLayout.js +28 -7
  75. package/dist-es/border-layout/BorderLayout.js.map +1 -1
  76. package/dist-es/dialog/Dialog.js +3 -2
  77. package/dist-es/dialog/Dialog.js.map +1 -1
  78. package/dist-es/drawer/Drawer.js +2 -1
  79. package/dist-es/drawer/Drawer.js.map +1 -1
  80. package/dist-es/file-drop-zone/FileDropZone.js +20 -5
  81. package/dist-es/file-drop-zone/FileDropZone.js.map +1 -1
  82. package/dist-es/file-drop-zone/FileDropZoneTrigger.js +3 -2
  83. package/dist-es/file-drop-zone/FileDropZoneTrigger.js.map +1 -1
  84. package/dist-es/grid-layout/GridLayout.css.js +1 -1
  85. package/dist-es/index.js +11 -0
  86. package/dist-es/index.js.map +1 -1
  87. package/dist-es/mega-menu/MegaMenu.js +79 -0
  88. package/dist-es/mega-menu/MegaMenu.js.map +1 -0
  89. package/dist-es/mega-menu/MegaMenuActions.css.js +4 -0
  90. package/dist-es/mega-menu/MegaMenuActions.css.js.map +1 -0
  91. package/dist-es/mega-menu/MegaMenuActions.js +35 -0
  92. package/dist-es/mega-menu/MegaMenuActions.js.map +1 -0
  93. package/dist-es/mega-menu/MegaMenuAside.css.js +4 -0
  94. package/dist-es/mega-menu/MegaMenuAside.css.js.map +1 -0
  95. package/dist-es/mega-menu/MegaMenuAside.js +35 -0
  96. package/dist-es/mega-menu/MegaMenuAside.js.map +1 -0
  97. package/dist-es/mega-menu/MegaMenuContent.css.js +4 -0
  98. package/dist-es/mega-menu/MegaMenuContent.css.js.map +1 -0
  99. package/dist-es/mega-menu/MegaMenuContent.js +27 -0
  100. package/dist-es/mega-menu/MegaMenuContent.js.map +1 -0
  101. package/dist-es/mega-menu/MegaMenuContext.js +16 -0
  102. package/dist-es/mega-menu/MegaMenuContext.js.map +1 -0
  103. package/dist-es/mega-menu/MegaMenuGroup.css.js +4 -0
  104. package/dist-es/mega-menu/MegaMenuGroup.css.js.map +1 -0
  105. package/dist-es/mega-menu/MegaMenuGroup.js +42 -0
  106. package/dist-es/mega-menu/MegaMenuGroup.js.map +1 -0
  107. package/dist-es/mega-menu/MegaMenuGroupContext.js +20 -0
  108. package/dist-es/mega-menu/MegaMenuGroupContext.js.map +1 -0
  109. package/dist-es/mega-menu/MegaMenuGroupHeading.css.js +4 -0
  110. package/dist-es/mega-menu/MegaMenuGroupHeading.css.js.map +1 -0
  111. package/dist-es/mega-menu/MegaMenuGroupHeading.js +42 -0
  112. package/dist-es/mega-menu/MegaMenuGroupHeading.js.map +1 -0
  113. package/dist-es/mega-menu/MegaMenuGroups.css.js +4 -0
  114. package/dist-es/mega-menu/MegaMenuGroups.css.js.map +1 -0
  115. package/dist-es/mega-menu/MegaMenuGroups.js +27 -0
  116. package/dist-es/mega-menu/MegaMenuGroups.js.map +1 -0
  117. package/dist-es/mega-menu/MegaMenuList.css.js +4 -0
  118. package/dist-es/mega-menu/MegaMenuList.css.js.map +1 -0
  119. package/dist-es/mega-menu/MegaMenuList.js +45 -0
  120. package/dist-es/mega-menu/MegaMenuList.js.map +1 -0
  121. package/dist-es/mega-menu/MegaMenuListItem.css.js +4 -0
  122. package/dist-es/mega-menu/MegaMenuListItem.css.js.map +1 -0
  123. package/dist-es/mega-menu/MegaMenuListItem.js +48 -0
  124. package/dist-es/mega-menu/MegaMenuListItem.js.map +1 -0
  125. package/dist-es/mega-menu/MegaMenuPanel.css.js +4 -0
  126. package/dist-es/mega-menu/MegaMenuPanel.css.js.map +1 -0
  127. package/dist-es/mega-menu/MegaMenuPanel.js +92 -0
  128. package/dist-es/mega-menu/MegaMenuPanel.js.map +1 -0
  129. package/dist-es/mega-menu/MegaMenuTrigger.js +95 -0
  130. package/dist-es/mega-menu/MegaMenuTrigger.js.map +1 -0
  131. package/dist-es/mega-menu/useMegaMenu.js +13 -0
  132. package/dist-es/mega-menu/useMegaMenu.js.map +1 -0
  133. package/dist-es/mega-menu/useMegaMenuNavigation.js +278 -0
  134. package/dist-es/mega-menu/useMegaMenuNavigation.js.map +1 -0
  135. package/dist-es/mega-menu/usePageMargin.js +26 -0
  136. package/dist-es/mega-menu/usePageMargin.js.map +1 -0
  137. package/dist-es/overlay/OverlayPanel.js +2 -1
  138. package/dist-es/overlay/OverlayPanel.js.map +1 -1
  139. package/dist-es/semantic-icon-provider/SemanticIconProvider.js +1 -0
  140. package/dist-es/semantic-icon-provider/SemanticIconProvider.js.map +1 -1
  141. package/dist-types/index.d.ts +1 -0
  142. package/dist-types/mega-menu/MegaMenu.d.ts +36 -0
  143. package/dist-types/mega-menu/MegaMenuActions.d.ts +10 -0
  144. package/dist-types/mega-menu/MegaMenuAside.d.ts +9 -0
  145. package/dist-types/mega-menu/MegaMenuContent.d.ts +9 -0
  146. package/dist-types/mega-menu/MegaMenuContext.d.ts +28 -0
  147. package/dist-types/mega-menu/MegaMenuGroup.d.ts +9 -0
  148. package/dist-types/mega-menu/MegaMenuGroupContext.d.ts +12 -0
  149. package/dist-types/mega-menu/MegaMenuGroupHeading.d.ts +13 -0
  150. package/dist-types/mega-menu/MegaMenuGroups.d.ts +8 -0
  151. package/dist-types/mega-menu/MegaMenuList.d.ts +16 -0
  152. package/dist-types/mega-menu/MegaMenuListItem.d.ts +25 -0
  153. package/dist-types/mega-menu/MegaMenuPanel.d.ts +8 -0
  154. package/dist-types/mega-menu/MegaMenuTrigger.d.ts +9 -0
  155. package/dist-types/mega-menu/index.d.ts +11 -0
  156. package/dist-types/mega-menu/useMegaMenu.d.ts +6 -0
  157. package/dist-types/mega-menu/useMegaMenuNavigation.d.ts +16 -0
  158. package/dist-types/mega-menu/usePageMargin.d.ts +6 -0
  159. package/dist-types/semantic-icon-provider/SemanticIconProvider.d.ts +1 -0
  160. package/dist-types/tooltip/useTooltip.d.ts +1 -1
  161. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"BorderLayout.js","sources":["../src/border-layout/BorderLayout.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n Children,\n type ElementType,\n type ForwardedRef,\n type FunctionComponent,\n forwardRef,\n isValidElement,\n type ReactNode,\n useEffect,\n} from \"react\";\n\nimport type { BorderPosition } from \"../border-item\";\nimport { GridLayout, type GridLayoutProps } from \"../grid-layout\";\nimport {\n makePrefixer,\n type PolymorphicComponentPropWithRef,\n type ResponsiveProp,\n} from \"../utils\";\n\nexport type BorderLayoutProps<T extends ElementType> =\n PolymorphicComponentPropWithRef<\n T,\n {\n /**\n * Defines the size of the gutter between the columns and the rows by setting a density multiplier. Defaults to 0\n */\n gap?: GridLayoutProps<T>[\"gap\"];\n /**\n * Defines the size of the gutter between the columns by setting a density multiplier. Defaults to 0\n */\n columnGap?: GridLayoutProps<T>[\"columnGap\"];\n /**\n * Defines the size of the gutter between the rows by setting a density multiplier. Defaults to 0\n */\n rowGap?: GridLayoutProps<T>[\"rowGap\"];\n /**\n * Border item components to be rendered.\n */\n children: ReactNode;\n /**\n * Defines the margin around the component. It can be specified as a number (which acts as a multiplier) or a string representing the margin value. Default is `0`.\n */\n margin?: ResponsiveProp<number | string>;\n /**\n * Defines the padding within the component. It can be specified as a number (which acts as a multiplier) or a string representing the padding value. Default is `0`.\n */\n padding?: ResponsiveProp<number | string>;\n }\n >;\n\nconst withBaseName = makePrefixer(\"saltBorderLayout\");\n\nconst numberOfColumns = 3;\n\ntype BorderLayoutComponent = <T extends ElementType = \"div\">(\n props: BorderLayoutProps<T>,\n) => ReturnType<FunctionComponent>;\n\nexport const BorderLayout: BorderLayoutComponent = forwardRef(\n function BorderLayout<T extends ElementType>(\n props: unknown,\n ref?: ForwardedRef<unknown>,\n ) {\n // Props need to be typed this way due to polymorphic types not working with required props.\n const { as, children, className, gap, style, ...rest } =\n props as BorderLayoutProps<T>;\n\n const borderAreas = Children.map(\n children,\n (child) => isValidElement(child) && child.props.position,\n ) as BorderPosition[];\n\n const topSection = borderAreas.includes(\"north\")\n ? \"north \".repeat(numberOfColumns)\n : \"none \".repeat(numberOfColumns);\n\n const leftSection = borderAreas.includes(\"west\") ? \"west\" : \"center\";\n\n const rightSection = borderAreas.includes(\"east\") ? \"east\" : \"center\";\n\n const midSection = `${leftSection} center ${rightSection}`;\n\n const bottomSection = borderAreas.includes(\"south\")\n ? \"south \".repeat(numberOfColumns)\n : \"none \".repeat(numberOfColumns);\n\n const gridTemplateAreas = `\"${topSection}\" \"${midSection}\" \"${bottomSection}\"`;\n\n const hasMainSection = borderAreas.includes(\"center\");\n\n useEffect(() => {\n if (process.env.NODE_ENV !== \"production\") {\n if (!hasMainSection) {\n console.warn(\n \"No main section has been found. A main section should be provided.\",\n );\n }\n }\n }, [hasMainSection]);\n\n const borderLayoutStyles = {\n ...style,\n \"--gridLayout-gridTemplate\": gridTemplateAreas,\n };\n\n return (\n <GridLayout\n as={as as ElementType}\n className={clsx(withBaseName(), className, \"saltGridLayout-area\")}\n columns={num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iB,WAAA,CAAY,QAAA,CAAS,QAAQ,CAAA;AAEpD,IAAA,SAAA,CAAU,MAAM;AACd,MAAA,IAAI,OAAA,CAAQ,GAAA,CAAI,QAAA,KAAa,YAAA,EAAc;AACzC,QAAA,IAAI,CAAC,cAAA,EAAgB;AACnB,UAAA,OAAA,CAAQ,IAAA;AAAA,YACN;AAAA,WACF;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAA,EAAG,CAAC,cAAc,CAAC,CAAA;AAEnB,IAAA,MAAM,kBAAA,GAAqB;AAAA,MACzB,GAAG,KAAA;AAAA,MACH,2BAAA,EAA6B;AAAA,KAC/B;AAEA,IAAA,uBACE,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,EAAA;AAAA,QACA,SAAA,EAAW,IAAA,CAAK,YAAA,EAAa,EAAG,WAAW,qBAAqB,CAAA;AAAA,QAChE,OAAA,EAAS,eAAA;AAAA,QACT,KAAK,GAAA,IAAO,CAAA;AAAA,QACZ,KAAA,EAAO,kBAAA;AAAA,QACP,GAAA;AAAA,QACC,GAAG,IAAA;AAAA,QAEH;AAAA;AAAA,KACH;AAAA,EAEJ;AACF;;;;"}
1
+ {"version":3,"file":"BorderLayout.js","sources":["../src/border-layout/BorderLayout.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n Children,\n type ElementType,\n type ForwardedRef,\n type FunctionComponent,\n forwardRef,\n isValidElement,\n type ReactNode,\n useEffect,\n} from \"react\";\n\nimport type { BorderPosition } from \"../border-item\";\nimport { GridLayout, type GridLayoutProps } from \"../grid-layout\";\nimport {\n makePrefixer,\n type PolymorphicComponentPropWithRef,\n type ResponsiveProp,\n} from \"../utils\";\n\nexport type BorderLayoutProps<T extends ElementType> =\n PolymorphicComponentPropWithRef<\n T,\n {\n /**\n * Defines the size of the gutter between the columns and the rows by setting a density multiplier. Defaults to 0\n */\n gap?: GridLayoutProps<T>[\"gap\"];\n /**\n * Defines the size of the gutter between the columns by setting a density multiplier. Defaults to 0\n */\n columnGap?: GridLayoutProps<T>[\"columnGap\"];\n /**\n * Defines the size of the gutter between the rows by setting a density multiplier. Defaults to 0\n */\n rowGap?: GridLayoutProps<T>[\"rowGap\"];\n /**\n * Border item components to be rendered.\n */\n children: ReactNode;\n /**\n * Defines the margin around the component. It can be specified as a number (which acts as a multiplier) or a string representing the margin value. Default is `0`.\n */\n margin?: ResponsiveProp<number | string>;\n /**\n * Defines the padding within the component. It can be specified as a number (which acts as a multiplier) or a string representing the padding value. Default is `0`.\n */\n padding?: ResponsiveProp<number | string>;\n }\n >;\n\nconst withBaseName = makePrefixer(\"saltBorderLayout\");\n\nconst numberOfColumns = 3;\n\ntype BorderLayoutComponent = <T extends ElementType = \"div\">(\n props: BorderLayoutProps<T>,\n) => ReturnType<FunctionComponent>;\n\nexport const BorderLayout: BorderLayoutComponent = forwardRef(\n function BorderLayout<T extends ElementType>(\n props: unknown,\n ref?: ForwardedRef<unknown>,\n ) {\n // Props need to be typed this way due to polymorphic types not working with required props.\n const { as, children, className, gap, style, ...rest } =\n props as BorderLayoutProps<T>;\n\n const borderAreas = Children.map(\n children,\n (child) => isValidElement(child) && child.props.position,\n ) as BorderPosition[];\n\n const hasNorth = borderAreas.includes(\"north\");\n const hasWest = borderAreas.includes(\"west\");\n const hasEast = borderAreas.includes(\"east\");\n const hasSouth = borderAreas.includes(\"south\");\n\n const middleColumns = [\n hasWest ? \"west\" : undefined,\n \"center\",\n hasEast ? \"east\" : undefined,\n ].filter(Boolean) as BorderPosition[];\n\n const gridTemplateColumns = [\n hasWest ? \"min-content\" : undefined,\n \"1fr\",\n hasEast ? \"min-content\" : undefined,\n ]\n .filter(Boolean)\n .join(\" \");\n\n const gridTemplateRows = [\n hasNorth ? \"min-content\" : undefined,\n \"1fr\",\n hasSouth ? \"min-content\" : undefined,\n ]\n .filter(Boolean)\n .join(\" \");\n\n const gridTemplateSections = [\n hasNorth\n ? `\"${\"north \".repeat(middleColumns.length).trimEnd()}\"`\n : undefined,\n `\"${middleColumns.join(\" \")}\"`,\n hasSouth\n ? `\"${\"south \".repeat(middleColumns.length).trimEnd()}\"`\n : undefined,\n ].filter(Boolean);\n\n const gridTemplateAreas = gridTemplateSections.join(\" \");\n\n const hasMainSection = borderAreas.includes(\"center\");\n\n useEffect(() => {\n if (process.env.NODE_ENV !== \"production\") {\n if (!hasMainSection) {\n console.warn(\n \"No main section has been found. A main section should be provided.\",\n );\n }\n }\n }, [hasMainSection]);\n\n const borderLayoutStyles = {\n ...style,\n \"--gridLayout-gridTemplate\": gridTemplateAreas,\n \"--gridLayout-areaColumns\": gridTemplateColumns,\n \"--gridLayout-areaRows\": gridTemplateRows,\n };\n\n return (\n <GridLayout\n as={as as ElementType}\n className={clsx(withBaseName(), className, \"saltGridLayout-area\")}\n columns={numberOfColumns}\n gap={gap || 0}\n style={borderLayoutStyles}\n ref={ref}\n {...rest}\n >\n {children}\n </GridLayout>\n );\n },\n);\n"],"names":["BorderLayout"],"mappings":";;;;;;;;;;AAmDA,MAAM,YAAA,GAAe,aAAa,kBAAkB,CAAA;AAEpD,MAAM,eAAA,GAAkB,CAAA;AAMjB,MAAM,YAAA,GAAsC,UAAA;AAAA,EACjD,SAASA,aAAAA,CACP,KAAA,EACA,GAAA,EACA;AAEA,IAAA,MAAM,EAAE,IAAI,QAAA,EAAU,SAAA,EAAW,KAAK,KAAA,EAAO,GAAG,MAAK,GACnD,KAAA;AAEF,IAAA,MAAM,cAAc,QAAA,CAAS,GAAA;AAAA,MAC3B,QAAA;AAAA,MACA,CAAC,KAAA,KAAU,cAAA,CAAe,KAAK,CAAA,IAAK,MAAM,KAAA,CAAM;AAAA,KAClD;AAEA,IAAA,MAAM,QAAA,GAAW,WAAA,CAAY,QAAA,CAAS,OAAO,CAAA;AAC7C,IAAA,MAAM,OAAA,GAAU,WAAA,CAAY,QAAA,CAAS,MAAM,CAAA;AAC3C,IAAA,MAAM,OAAA,GAAU,WAAA,CAAY,QAAA,CAAS,MAAM,CAAA;AAC3C,IA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AA,EAAgB;AACnB,UAAA,OAAA,CAAQ,IAAA;AAAA,YACN;AAAA,WACF;AAAA,QACF;AAAA,MACF;AAAA,IACF,CAAA,EAAG,CAAC,cAAc,CAAC,CAAA;AAEnB,IAAA,MAAM,kBAAA,GAAqB;AAAA,MACzB,GAAG,KAAA;AAAA,MACH,2BAAA,EAA6B,iBAAA;AAAA,MAC7B,0BAAA,EAA4B,mBAAA;AAAA,MAC5B,uBAAA,EAAyB;AAAA,KAC3B;AAEA,IAAA,uBACE,GAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,EAAA;AAAA,QACA,SAAA,EAAW,IAAA,CAAK,YAAA,EAAa,EAAG,WAAW,qBAAqB,CAAA;AAAA,QAChE,OAAA,EAAS,eAAA;AAAA,QACT,KAAK,GAAA,IAAO,CAAA;AAAA,QACZ,KAAA,EAAO,kBAAA;AAAA,QACP,GAAA;AAAA,QACC,GAAG,IAAA;AAAA,QAEH;AAAA;AAAA,KACH;AAAA,EAEJ;AACF;;;;"}
@@ -57,7 +57,7 @@ const Dialog = forwardRef(
57
57
  });
58
58
  const { getFloatingProps } = useInteractions([
59
59
  useClick(context),
60
- useDismiss(context, { enabled: !disableDismiss })
60
+ useDismiss(context, { outsidePress: !disableDismiss })
61
61
  ]);
62
62
  const { Component: FloatingComponent } = useFloatingComponent();
63
63
  const floatingRef = useForkRef(floating, ref);
@@ -90,7 +90,8 @@ const Dialog = forwardRef(
90
90
  lockScroll: true,
91
91
  focusManagerProps: {
92
92
  context,
93
- initialFocus
93
+ initialFocus,
94
+ outsideElementsInert: true
94
95
  },
95
96
  className: clsx(
96
97
  withBaseName(),
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.js","sources":["../src/dialog/Dialog.tsx"],"sourcesContent":["import {\n type FloatingFocusManager,\n useClick,\n useDismiss,\n useInteractions,\n} from \"@floating-ui/react\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentProps,\n forwardRef,\n type HTMLAttributes,\n type ReactNode,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { Scrim } from \"../scrim\";\nimport type { ValidationStatus } from \"../status-indicator\";\nimport {\n makePrefixer,\n useCurrentBreakpoint,\n useFloatingComponent,\n useFloatingUI,\n useForkRef,\n useId,\n} from \"../utils\";\nimport dialogCss from \"./Dialog.css\";\nimport { DialogContext } from \"./DialogContext\";\n\ninterface ConditionalScrimWrapperProps {\n children?: ReactNode;\n condition: boolean;\n}\n\nexport const ConditionalScrimWrapper = ({\n condition,\n children,\n}: ConditionalScrimWrapperProps) => {\n return condition ? <Scrim fixed>{children}</Scrim> : <>{children} </>;\n};\n\nexport interface DialogProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Display or hide the component.\n */\n open?: boolean;\n /**\n * Callback function triggered when open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * The status of the Dialog\n * */\n status?: ValidationStatus;\n /**\n * Which element to initially focus. Can be either a number (tabbable index as specified by the order) or a ref.\n * Default value is 0 (first tabbable element).\n * */\n initialFocus?: ComponentProps<typeof FloatingFocusManager>[\"initialFocus\"];\n /**\n * Size of the Dialog\n * */\n size?: \"small\" | \"medium\" | \"large\";\n /**\n * Prevent the dialog closing on click away\n * */\n disableDismiss?: boolean;\n /**\n * Prevent Scrim from rendering\n * */\n disableScrim?: boolean;\n /**\n * @deprecated IDs are now auto-generated internally for proper ARIA labeling.\n *\n * Optional id prop\n * Used for accessibility purposes to announce the title and subtitle when using a screen reader\n * */\n idProp?: string;\n}\n\nconst withBaseName = makePrefixer(\"saltDialog\");\n\nexport const Dialog = forwardRef<HTMLDivElement, DialogProps>(\n function Dialog(props, ref) {\n const {\n children,\n className,\n open = false,\n onOpenChange,\n status,\n disableDismiss,\n size = \"medium\",\n disableScrim,\n idProp,\n initialFocus,\n id,\n \"aria-labelledby\": ariaLabelledBy,\n ...rest\n } = props;\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-dialog\",\n css: dialogCss,\n window: targetWindow,\n });\n\n const dialogId = useId(id);\n const currentBreakpoint = useCurrentBreakpoint();\n\n const [showComponent, setShowComponent] = useState(false);\n const [headerId, setHeaderId] = useState(idProp);\n\n const { context, floating, elements } = useFloatingUI({\n open: showComponent,\n onOpenChange,\n });\n\n const { getFloatingProps } = useInteractions([\n useClick(context),\n useDismiss(context, { enabled: !disableDismiss }),\n ]);\n\n const { Component: FloatingComponent } = useFloatingComponent();\n\n const floatingRef = useForkRef<HTMLDivElement>(floating, ref);\n\n useEffect(() => {\n if (open && !showComponent) {\n setShowComponent(true);\n }\n\n if (!open && showComponent) {\n const animate = setTimeout(() => {\n setShowComponent(false);\n }, 300); // var(--salt-duration-perceptible)\n return () => clearTimeout(animate);\n }\n }, [open, showComponent]);\n\n const contextValue = useMemo(\n () => ({ status, id: headerId, setId: setHeaderId, dialogId }),\n [status, headerId, dialogId],\n );\n\n return (\n <DialogContext.Provider value={contextValue}>\n <ConditionalScrimWrapper condition={showComponent && !disableScrim}>\n <FloatingComponent\n id={dialogId}\n open={showComponent}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={clsx(ariaLabelledBy, headerId) || undefined}\n ref={floatingRef}\n width={elements.floating?.offsetWidth}\n height={elements.floating?.offsetHeight}\n lockScroll\n focusManagerProps={{\n context: context,\n initialFocus,\n }}\n className={clsx(\n withBaseName(),\n withBaseName(size, currentBreakpoint),\n {\n [withBaseName(\"enterAnimation\")]: open,\n [withBaseName(\"exitAnimation\")]: !open,\n [withBaseName(status as string)]: status,\n },\n className,\n )}\n onAnimationEnd={() => {\n if (!open && showComponent) {\n setShowComponent(false);\n }\n }}\n {...getFloatingProps()}\n {...rest}\n >\n {children}\n </FloatingComponent>\n </ConditionalScrimWrapper>\n </DialogContext.Provider>\n );\n },\n);\n"],"names":["Dialog","dialogCss"],"mappings":";;;;;;;;;;;;;;;AAoCO,MAAM,0BAA0B,CAAC;AAAA,EACtC,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AW,MAAA;AAAA,QACX,iBAAA,EAAiB,IAAA,CAAK,cAAA,EAAgB,QAAQ,CAAA,IAAK,MAAA;AAAA,QACnD,GAAA,EAAK,WAAA;AAAA,QACL,KAAA,EAAA,CAAO,EAAA,GAAA,QAAA,CAAS,QAAA,KAAT,IAAA,GAAA,MAAA,GAAA,EAAA,CAAmB,WAAA;AAAA,QAC1B,MAAA,EAAA,CAAQ,EAAA,GAAA,QAAA,CAAS,QAAA,KAAT,IAAA,GAAA,MAAA,GAAA,EAAA,CAAmB,YAAA;AAAA,QAC3B,UAAA,EAAU,IAAA;AAAA,QACV,iBAAA,EAAmB;AAAA,UACjB,OAAA;AAAA,UACA;AAAA,SACF;AAAA,QACA,SAAA,EAAW,IAAA;AAAA,UACT,YAAA,EAAa;AAAA,UACb,YAAA,CAAa,MAAM,iBAAiB,CAAA;AAAA,UACpC;AAAA,YACE,CAAC,YAAA,CAAa,gBAAgB,CAAC,GAAG,IAAA;AAAA,YAClC,CAAC,YAAA,CAAa,eAAe,CAAC,GAAG,CAAC,IAAA;AAAA,YAClC,CAAC,YAAA,CAAa,MAAgB,CAAC,GAAG;AAAA,WACpC;AAAA,UACA;AAAA,SACF;AAAA,QACA,gBAAgB,MAAM;AACpB,UAAA,IAAI,CAAC,QAAQ,aAAA,EAAe;AAC1B,YAAA,gBAAA,CAAiB,KAAK,CAAA;AAAA,UACxB;AAAA,QACF,CAAA;AAAA,QACC,GAAG,gBAAA,EAAiB;AAAA,QACpB,GAAG,IAAA;AAAA,QAEH;AAAA;AAAA,OAEL,CAAA,EACF,CAAA;AAAA,EAEJ;AACF;;;;"}
1
+ {"version":3,"file":"Dialog.js","sources":["../src/dialog/Dialog.tsx"],"sourcesContent":["import {\n type FloatingFocusManager,\n useClick,\n useDismiss,\n useInteractions,\n} from \"@floating-ui/react\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentProps,\n forwardRef,\n type HTMLAttributes,\n type ReactNode,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { Scrim } from \"../scrim\";\nimport type { ValidationStatus } from \"../status-indicator\";\nimport {\n makePrefixer,\n useCurrentBreakpoint,\n useFloatingComponent,\n useFloatingUI,\n useForkRef,\n useId,\n} from \"../utils\";\nimport dialogCss from \"./Dialog.css\";\nimport { DialogContext } from \"./DialogContext\";\n\ninterface ConditionalScrimWrapperProps {\n children?: ReactNode;\n condition: boolean;\n}\n\nexport const ConditionalScrimWrapper = ({\n condition,\n children,\n}: ConditionalScrimWrapperProps) => {\n return condition ? <Scrim fixed>{children}</Scrim> : <>{children} </>;\n};\n\nexport interface DialogProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Display or hide the component.\n */\n open?: boolean;\n /**\n * Callback function triggered when open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * The status of the Dialog\n * */\n status?: ValidationStatus;\n /**\n * Which element to initially focus. Can be either a number (tabbable index as specified by the order) or a ref.\n * Default value is 0 (first tabbable element).\n * */\n initialFocus?: ComponentProps<typeof FloatingFocusManager>[\"initialFocus\"];\n /**\n * Size of the Dialog\n * */\n size?: \"small\" | \"medium\" | \"large\";\n /**\n * Prevent the dialog closing on click away\n * */\n disableDismiss?: boolean;\n /**\n * Prevent Scrim from rendering\n * */\n disableScrim?: boolean;\n /**\n * @deprecated IDs are now auto-generated internally for proper ARIA labeling.\n *\n * Optional id prop\n * Used for accessibility purposes to announce the title and subtitle when using a screen reader\n * */\n idProp?: string;\n}\n\nconst withBaseName = makePrefixer(\"saltDialog\");\n\nexport const Dialog = forwardRef<HTMLDivElement, DialogProps>(\n function Dialog(props, ref) {\n const {\n children,\n className,\n open = false,\n onOpenChange,\n status,\n disableDismiss,\n size = \"medium\",\n disableScrim,\n idProp,\n initialFocus,\n id,\n \"aria-labelledby\": ariaLabelledBy,\n ...rest\n } = props;\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-dialog\",\n css: dialogCss,\n window: targetWindow,\n });\n\n const dialogId = useId(id);\n const currentBreakpoint = useCurrentBreakpoint();\n\n const [showComponent, setShowComponent] = useState(false);\n const [headerId, setHeaderId] = useState(idProp);\n\n const { context, floating, elements } = useFloatingUI({\n open: showComponent,\n onOpenChange,\n });\n\n const { getFloatingProps } = useInteractions([\n useClick(context),\n useDismiss(context, { outsidePress: !disableDismiss }),\n ]);\n\n const { Component: FloatingComponent } = useFloatingComponent();\n\n const floatingRef = useForkRef<HTMLDivElement>(floating, ref);\n\n useEffect(() => {\n if (open && !showComponent) {\n setShowComponent(true);\n }\n\n if (!open && showComponent) {\n const animate = setTimeout(() => {\n setShowComponent(false);\n }, 300); // var(--salt-duration-perceptible)\n return () => clearTimeout(animate);\n }\n }, [open, showComponent]);\n\n const contextValue = useMemo(\n () => ({ status, id: headerId, setId: setHeaderId, dialogId }),\n [status, headerId, dialogId],\n );\n\n return (\n <DialogContext.Provider value={contextValue}>\n <ConditionalScrimWrapper condition={showComponent && !disableScrim}>\n <FloatingComponent\n id={dialogId}\n open={showComponent}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={clsx(ariaLabelledBy, headerId) || undefined}\n ref={floatingRef}\n width={elements.floating?.offsetWidth}\n height={elements.floating?.offsetHeight}\n lockScroll\n focusManagerProps={{\n context: context,\n initialFocus,\n outsideElementsInert: true,\n }}\n className={clsx(\n withBaseName(),\n withBaseName(size, currentBreakpoint),\n {\n [withBaseName(\"enterAnimation\")]: open,\n [withBaseName(\"exitAnimation\")]: !open,\n [withBaseName(status as string)]: status,\n },\n className,\n )}\n onAnimationEnd={() => {\n if (!open && showComponent) {\n setShowComponent(false);\n }\n }}\n {...getFloatingProps()}\n {...rest}\n >\n {children}\n </FloatingComponent>\n </ConditionalScrimWrapper>\n </DialogContext.Provider>\n );\n },\n);\n"],"names":["Dialog","dialogCss"],"mappings":";;;;;;;;;;;;;;;AAoCO,MAAM,0BAA0B,CAAC;AAAA,EACtC,SAAA;AAAA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AAA,QACX,iBAAA,EAAiB,IAAA,CAAK,cAAA,EAAgB,QAAQ,CAAA,IAAK,MAAA;AAAA,QACnD,GAAA,EAAK,WAAA;AAAA,QACL,KAAA,EAAA,CAAO,EAAA,GAAA,QAAA,CAAS,QAAA,KAAT,IAAA,GAAA,MAAA,GAAA,EAAA,CAAmB,WAAA;AAAA,QAC1B,MAAA,EAAA,CAAQ,EAAA,GAAA,QAAA,CAAS,QAAA,KAAT,IAAA,GAAA,MAAA,GAAA,EAAA,CAAmB,YAAA;AAAA,QAC3B,UAAA,EAAU,IAAA;AAAA,QACV,iBAAA,EAAmB;AAAA,UACjB,OAAA;AAAA,UACA,YAAA;AAAA,UACA,oBAAA,EAAsB;AAAA,SACxB;AAAA,QACA,SAAA,EAAW,IAAA;AAAA,UACT,YAAA,EAAa;AAAA,UACb,YAAA,CAAa,MAAM,iBAAiB,CAAA;AAAA,UACpC;AAAA,YACE,CAAC,YAAA,CAAa,gBAAgB,CAAC,GAAG,IAAA;AAAA,YAClC,CAAC,YAAA,CAAa,eAAe,CAAC,GAAG,CAAC,IAAA;AAAA,YAClC,CAAC,YAAA,CAAa,MAAgB,CAAC,GAAG;AAAA,WACpC;AAAA,UACA;AAAA,SACF;AAAA,QACA,gBAAgB,MAAM;AACpB,UAAA,IAAI,CAAC,QAAQ,aAAA,EAAe;AAC1B,YAAA,gBAAA,CAAiB,KAAK,CAAA;AAAA,UACxB;AAAA,QACF,CAAA;AAAA,QACC,GAAG,gBAAA,EAAiB;AAAA,QACpB,GAAG,IAAA;AAAA,QAEH;AAAA;AAAA,OAEL,CAAA,EACF,CAAA;AAAA,EAEJ;AACF;;;;"}
@@ -81,7 +81,8 @@ const Drawer = forwardRef(
81
81
  "aria-modal": "true",
82
82
  focusManagerProps: {
83
83
  context,
84
- initialFocus
84
+ initialFocus,
85
+ outsideElementsInert: true
85
86
  },
86
87
  className: clsx(
87
88
  withBaseName(),
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.js","sources":["../src/drawer/Drawer.tsx"],"sourcesContent":["import {\n type FloatingFocusManager,\n useClick,\n useDismiss,\n useInteractions,\n} from \"@floating-ui/react\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type PropsWithChildren,\n useEffect,\n useState,\n} from \"react\";\nimport { Scrim } from \"../scrim\";\nimport {\n makePrefixer,\n useFloatingComponent,\n useFloatingUI,\n useForkRef,\n} from \"../utils\";\nimport drawerCss from \"./Drawer.css\";\n\ninterface ConditionalScrimWrapperProps extends PropsWithChildren {\n condition: boolean;\n}\n\nconst ConditionalScrimWrapper = ({\n condition,\n children,\n}: ConditionalScrimWrapperProps) => {\n return condition ? <Scrim fixed> {children} </Scrim> : <>{children} </>;\n};\n\nexport interface DrawerProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * Defines the drawer position within the screen. Defaults to `left`.\n */\n position?: \"left\" | \"top\" | \"right\" | \"bottom\";\n /**\n * Display or hide the component.\n */\n open?: boolean;\n /**\n * Callback function triggered when open state changes.\n */\n onOpenChange?: (newOpen: boolean) => void;\n /**\n * Change background color palette\n */\n variant?: \"primary\" | \"secondary\" | \"tertiary\";\n /**\n * Prevent the dialog closing on click away\n * */\n disableDismiss?: boolean;\n /**\n * Prevent Scrim from rendering\n * */\n disableScrim?: boolean;\n /**\n * Which element to initially focus. Can be either a number (tabbable index as specified by the order) or a ref.\n * Default value is 0 (first tabbable element).\n * */\n initialFocus?: ComponentPropsWithoutRef<\n typeof FloatingFocusManager\n >[\"initialFocus\"];\n}\n\nconst withBaseName = makePrefixer(\"saltDrawer\");\n\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(\n function Drawer(props, ref) {\n const {\n children,\n className,\n position = \"left\",\n open = false,\n onOpenChange,\n variant = \"primary\",\n disableDismiss,\n disableScrim,\n initialFocus,\n ...rest\n } = props;\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-drawer\",\n css: drawerCss,\n window: targetWindow,\n });\n\n const [showComponent, setShowComponent] = useState(false);\n const { Component: FloatingComponent } = useFloatingComponent();\n\n const { context, floating, elements } = useFloatingUI({\n open: showComponent,\n onOpenChange,\n });\n\n const { getFloatingProps } = useInteractions([\n useClick(context),\n useDismiss(context, { enabled: !disableDismiss }),\n ]);\n\n const handleRef = useForkRef<HTMLDivElement>(floating, ref);\n\n useEffect(() => {\n if (open && !showComponent) {\n setShowComponent(true);\n }\n\n if (!open && showComponent) {\n const animate = setTimeout(() => {\n setShowComponent(false);\n }, 300); // var(--salt-duration-perceptible)\n return () => clearTimeout(animate);\n }\n }, [open, showComponent]);\n\n return (\n <ConditionalScrimWrapper condition={showComponent && !disableScrim}>\n <FloatingComponent\n open={showComponent}\n ref={handleRef}\n role={\"dialog\"}\n width={elements.floating?.offsetWidth}\n height={elements.floating?.offsetHeight}\n aria-modal=\"true\"\n focusManagerProps={{\n context: context,\n initialFocus,\n }}\n className={clsx(\n withBaseName(),\n withBaseName(position),\n {\n [withBaseName(\"enterAnimation\")]: open,\n [withBaseName(\"exitAnimation\")]: !open,\n [withBaseName(variant)]: variant,\n },\n className,\n )}\n {...getFloatingProps()}\n {...rest}\n >\n {children}\n </FloatingComponent>\n </ConditionalScrimWrapper>\n );\n },\n);\n"],"names":["Drawer","drawerCss"],"mappings":";;;;;;;;;;;;;;;AA6BA,MAAM,0BAA0B,CAAC;AAAA,EAC/B,SAAA;AAAA,EACA;AACF,CAAA,KAAoC;AAClC,EAAA,OAAO,SAAA,mBAAY,IAAA,CAAC,KAAA,EAAA,EAAM,KAAA,EAAK,IAAA,EAAC,QAAA,EAAA;AAAA,IAAA,GAAA;AAAA,IAAE,QAAA;AAAA,IAAS;AAAA,GAAA,EAAC,oBAAW,IAAA,CAAA,QAAA,EAAA,EAAG,QAAA,EAAA;AAAA,IAAA,QAAA;AAAA,IAAS;AAAA,GAAA,EAAC,CAAA;AACtE,CAAA;AA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file":"Drawer.js","sources":["../src/drawer/Drawer.tsx"],"sourcesContent":["import {\n type FloatingFocusManager,\n useClick,\n useDismiss,\n useInteractions,\n} from \"@floating-ui/react\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type PropsWithChildren,\n useEffect,\n useState,\n} from \"react\";\nimport { Scrim } from \"../scrim\";\nimport {\n makePrefixer,\n useFloatingComponent,\n useFloatingUI,\n useForkRef,\n} from \"../utils\";\nimport drawerCss from \"./Drawer.css\";\n\ninterface ConditionalScrimWrapperProps extends PropsWithChildren {\n condition: boolean;\n}\n\nconst ConditionalScrimWrapper = ({\n condition,\n children,\n}: ConditionalScrimWrapperProps) => {\n return condition ? <Scrim fixed> {children} </Scrim> : <>{children} </>;\n};\n\nexport interface DrawerProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * Defines the drawer position within the screen. Defaults to `left`.\n */\n position?: \"left\" | \"top\" | \"right\" | \"bottom\";\n /**\n * Display or hide the component.\n */\n open?: boolean;\n /**\n * Callback function triggered when open state changes.\n */\n onOpenChange?: (newOpen: boolean) => void;\n /**\n * Change background color palette\n */\n variant?: \"primary\" | \"secondary\" | \"tertiary\";\n /**\n * Prevent the dialog closing on click away\n * */\n disableDismiss?: boolean;\n /**\n * Prevent Scrim from rendering\n * */\n disableScrim?: boolean;\n /**\n * Which element to initially focus. Can be either a number (tabbable index as specified by the order) or a ref.\n * Default value is 0 (first tabbable element).\n * */\n initialFocus?: ComponentPropsWithoutRef<\n typeof FloatingFocusManager\n >[\"initialFocus\"];\n}\n\nconst withBaseName = makePrefixer(\"saltDrawer\");\n\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(\n function Drawer(props, ref) {\n const {\n children,\n className,\n position = \"left\",\n open = false,\n onOpenChange,\n variant = \"primary\",\n disableDismiss,\n disableScrim,\n initialFocus,\n ...rest\n } = props;\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-drawer\",\n css: drawerCss,\n window: targetWindow,\n });\n\n const [showComponent, setShowComponent] = useState(false);\n const { Component: FloatingComponent } = useFloatingComponent();\n\n const { context, floating, elements } = useFloatingUI({\n open: showComponent,\n onOpenChange,\n });\n\n const { getFloatingProps } = useInteractions([\n useClick(context),\n useDismiss(context, { enabled: !disableDismiss }),\n ]);\n\n const handleRef = useForkRef<HTMLDivElement>(floating, ref);\n\n useEffect(() => {\n if (open && !showComponent) {\n setShowComponent(true);\n }\n\n if (!open && showComponent) {\n const animate = setTimeout(() => {\n setShowComponent(false);\n }, 300); // var(--salt-duration-perceptible)\n return () => clearTimeout(animate);\n }\n }, [open, showComponent]);\n\n return (\n <ConditionalScrimWrapper condition={showComponent && !disableScrim}>\n <FloatingComponent\n open={showComponent}\n ref={handleRef}\n role={\"dialog\"}\n width={elements.floating?.offsetWidth}\n height={elements.floating?.offsetHeight}\n aria-modal=\"true\"\n focusManagerProps={{\n context: context,\n initialFocus,\n outsideElementsInert: true,\n }}\n className={clsx(\n withBaseName(),\n withBaseName(position),\n {\n [withBaseName(\"enterAnimation\")]: open,\n [withBaseName(\"exitAnimation\")]: !open,\n [withBaseName(variant)]: variant,\n },\n className,\n )}\n {...getFloatingProps()}\n {...rest}\n >\n {children}\n </FloatingComponent>\n </ConditionalScrimWrapper>\n );\n },\n);\n"],"names":["Drawer","drawerCss"],"mappings":";;;;;;;;;;;;;;;AA6BA,MAAM,0BAA0B,CAAC;AAAA,EAC/B,SAAA;AAAA,EACA;AACF,CAAA,KAAoC;AAClC,EAAA,OAAO,SAAA,mBAAY,IAAA,CAAC,KAAA,EAAA,EAAM,KAAA,EAAK,IAAA,EAAC,QAAA,EAAA;AAAA,IAAA,GAAA;AAAA,IAAE,QAAA;AAAA,IAAS;AAAA,GAAA,EAAC,oBAAW,IAAA,CAAA,QAAA,EAAA,EAAG,QAAA,EAAA;AAAA,IAAA,QAAA;AAAA,IAAS;AAA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;AAAA;AAAA,KACH,EACF,CAAA;AAAA,EAEJ;AACF;;;;"}
@@ -10,7 +10,7 @@ import '../utils/useId.js';
10
10
  import '../salt-provider/SaltProvider.js';
11
11
  import '../viewport/ViewportProvider.js';
12
12
  import css_248z from './FileDropZone.css.js';
13
- import { extractFiles, containsFiles } from './internal/utils.js';
13
+ import { containsFiles, extractFiles } from './internal/utils.js';
14
14
 
15
15
  const withBaseName = makePrefixer("saltFileDropZone");
16
16
  const FileDropZone = forwardRef(
@@ -34,8 +34,19 @@ const FileDropZone = forwardRef(
34
34
  const regionRef = useRef(null);
35
35
  const handleRef = useForkRef(ref, regionRef);
36
36
  const handleDragOver = (event) => {
37
+ onDragOver == null ? void 0 : onDragOver(event);
38
+ const hasFiles = containsFiles(event);
37
39
  event.preventDefault();
38
40
  event.stopPropagation();
41
+ if (!hasFiles) {
42
+ if (event.dataTransfer) {
43
+ event.dataTransfer.dropEffect = "none";
44
+ }
45
+ if (isActive) {
46
+ setActive(false);
47
+ }
48
+ return;
49
+ }
39
50
  if (disabled) {
40
51
  if (event.dataTransfer) {
41
52
  event.dataTransfer.dropEffect = "none";
@@ -45,10 +56,9 @@ const FileDropZone = forwardRef(
45
56
  if (event.dataTransfer) {
46
57
  event.dataTransfer.dropEffect = "copy";
47
58
  }
48
- if (!isActive && containsFiles(event)) {
59
+ if (!isActive) {
49
60
  setActive(true);
50
61
  }
51
- onDragOver == null ? void 0 : onDragOver(event);
52
62
  };
53
63
  const handleDragLeave = (event) => {
54
64
  if (disabled) {
@@ -56,16 +66,21 @@ const FileDropZone = forwardRef(
56
66
  }
57
67
  const region = regionRef == null ? void 0 : regionRef.current;
58
68
  const eventTarget = event.relatedTarget;
59
- if (eventTarget !== region && !(region == null ? void 0 : region.contains(eventTarget))) {
69
+ if (eventTarget !== region && (!(eventTarget instanceof Node) || !(region == null ? void 0 : region.contains(eventTarget)))) {
60
70
  setActive(false);
61
71
  }
62
72
  onDragLeave == null ? void 0 : onDragLeave(event);
63
73
  };
64
74
  const handleDrop = (event) => {
75
+ event.preventDefault();
76
+ if (!containsFiles(event)) {
77
+ setActive(false);
78
+ return;
79
+ }
65
80
  if (disabled) {
81
+ setActive(false);
66
82
  return;
67
83
  }
68
- event.preventDefault();
69
84
  const files = extractFiles(event);
70
85
  setActive(false);
71
86
  onDrop == null ? void 0 : onDrop(event, files);
@@ -1 +1 @@
1
- {"version":3,"file":"FileDropZone.js","sources":["../src/file-drop-zone/FileDropZone.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n type DragEvent,\n type DragEventHandler,\n forwardRef,\n useRef,\n useState,\n} from \"react\";\nimport type { ValidationStatus } from \"../status-indicator\";\nimport { makePrefixer, useForkRef } from \"../utils\";\nimport fileDropZoneCss from \"./FileDropZone.css\";\nimport { containsFiles, extractFiles } from \"./internal/utils\";\n\nexport interface FileDropZoneProps\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"onDrop\"> {\n /**\n * If `true`, the file drop zone will be disabled.\n */\n disabled?: boolean;\n /**\n * Status indicator to be displayed.\n */\n status?: Exclude<ValidationStatus, \"info\" | \"warning\">;\n /**\n * Callback for on drop event\n */\n onDrop?: (event: DragEvent<HTMLDivElement>, files: File[]) => void;\n}\n\nconst withBaseName = makePrefixer(\"saltFileDropZone\");\n\nexport const FileDropZone = forwardRef<HTMLDivElement, FileDropZoneProps>(\n function FileDropZone(\n {\n status,\n className,\n children,\n disabled,\n onDragOver,\n onDragLeave,\n onDrop,\n ...restProps\n },\n ref,\n ) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-file-drop-zone\",\n css: fileDropZoneCss,\n window: targetWindow,\n });\n const [isActive, setActive] = useState(false);\n\n const regionRef = useRef<HTMLDivElement>(null);\n const handleRef = useForkRef(ref, regionRef);\n\n const handleDragOver: DragEventHandler<HTMLDivElement> = (event) => {\n // Need to cancel the default events to allow drop\n // https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Drag_operations#droptargets\n\n event.preventDefault();\n event.stopPropagation();\n\n if (disabled) {\n if (event.dataTransfer) {\n event.dataTransfer.dropEffect = \"none\";\n }\n return;\n }\n if (event.dataTransfer) {\n event.dataTransfer.dropEffect = \"copy\";\n }\n if (!isActive && containsFiles(event)) {\n setActive(true);\n }\n onDragOver?.(event);\n };\n\n const handleDragLeave: DragEventHandler<HTMLDivElement> = (event) => {\n if (disabled) {\n return;\n }\n const region = regionRef?.current;\n const eventTarget = event.relatedTarget;\n if (eventTarget !== region && !region?.contains(eventTarget as Node)) {\n setActive(false);\n }\n onDragLeave?.(event);\n };\n\n const handleDrop: DragEventHandler<HTMLDivElement> = (event) => {\n if (disabled) {\n return;\n }\n event.preventDefault();\n const files = extractFiles(event);\n setActive(false);\n onDrop?.(event, files);\n };\n\n return (\n <div\n className={clsx(\n withBaseName(),\n {\n [withBaseName(status as string)]: status,\n [withBaseName(\"active\")]: isActive,\n [withBaseName(\"disabled\")]: disabled,\n },\n className,\n )}\n aria-disabled={disabled}\n onDragLeave={handleDragLeave}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n ref={handleRef}\n {...restProps}\n >\n {children}\n </div>\n );\n },\n);\n"],"names":["FileDropZone","fileDropZoneCss"],"mappings":";;;;;;;;;;;;;;AAgCA,MAAM,YAAA,GAAe,aAAa,kBAAkB,CAAA;AAE7C,MAAM,YAAA,GAAe,UAAA;AAAA,EAC1B,SAASA,aAAAA,CACP;AAAA,IACE,MAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,IACA,MAAA;AAAA,IACA,GAAG;AAAA,KAEL,GAAA,EACA;AACA,IAAA,MAAM,eAAe,SAAA,EAAU;AAC/B,IAAA,wBAAA,CAAyB;AAAA,MACvB,MAAA,EAAQ,qBAAA;AAAA,MACR,GAAA,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IAAA,IAAA,GAAA,MAAA,GAAA,WAAA,CAAc,KAAA,CAAA;AAAA,IAChB,CAAA;AAEA,IAAA,MAAM,UAAA,GAA+C,CAAC,KAAA,KAAU;AAC9D,MAAA,IAAI,QAAA,EAAU;AACZ,QAAA;AAAA,MACF;AACA,MAAA,KAAA,CAAM,cAAA,EAAe;AACrB,MAAA,MAAM,KAAA,GAAQ,aAAa,KAAK,CAAA;AAChC,MAAA,SAAA,CAAU,KAAK,CAAA;AACf,MAAA,MAAA,IAAA,IAAA,GAAA,MAAA,GAAA,MAAA,CAAS,KAAA,EAAO,KAAA,CAAA;AAAA,IAClB,CAAA;AAEA,IAAA,uBACE,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,IAAA;AAAA,UACT,YAAA,EAAa;AAAA,UACb;AAAA,YACE,CAAC,YAAA,CAAa,MAAgB,CAAC,GAAG,MAAA;AAAA,YAClC,CAAC,YAAA,CAAa,QAAQ,CAAC,GAAG,QAAA;AAAA,YAC1B,CAAC,YAAA,CAAa,UAAU,CAAC,GAAG;AAAA,WAC9B;AAAA,UACA;AAAA,SACF;AAAA,QACA,eAAA,EAAe,QAAA;AAAA,QACf,WAAA,EAAa,eAAA;AAAA,QACb,UAAA,EAAY,cAAA;AAAA,QACZ,MAAA,EAAQ,UAAA;AAAA,QACR,GAAA,EAAK,SAAA;AAAA,QACJ,GAAG,SAAA;AAAA,QAEH;AAAA;AAAA,KACH;AAAA,EAEJ;AACF;;;;"}
1
+ {"version":3,"file":"FileDropZone.js","sources":["../src/file-drop-zone/FileDropZone.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n type DragEvent,\n type DragEventHandler,\n forwardRef,\n useRef,\n useState,\n} from \"react\";\nimport type { ValidationStatus } from \"../status-indicator\";\nimport { makePrefixer, useForkRef } from \"../utils\";\nimport fileDropZoneCss from \"./FileDropZone.css\";\nimport { containsFiles, extractFiles } from \"./internal/utils\";\n\nexport interface FileDropZoneProps\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"onDrop\"> {\n /**\n * If `true`, the file drop zone will be disabled.\n */\n disabled?: boolean;\n /**\n * Status indicator to be displayed.\n */\n status?: Exclude<ValidationStatus, \"info\" | \"warning\">;\n /**\n * Callback for on drop event\n */\n onDrop?: (event: DragEvent<HTMLDivElement>, files: File[]) => void;\n}\n\nconst withBaseName = makePrefixer(\"saltFileDropZone\");\n\nexport const FileDropZone = forwardRef<HTMLDivElement, FileDropZoneProps>(\n function FileDropZone(\n {\n status,\n className,\n children,\n disabled,\n onDragOver,\n onDragLeave,\n onDrop,\n ...restProps\n },\n ref,\n ) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-file-drop-zone\",\n css: fileDropZoneCss,\n window: targetWindow,\n });\n const [isActive, setActive] = useState(false);\n\n const regionRef = useRef<HTMLDivElement>(null);\n const handleRef = useForkRef(ref, regionRef);\n\n const handleDragOver: DragEventHandler<HTMLDivElement> = (event) => {\n onDragOver?.(event);\n\n const hasFiles = containsFiles(event);\n // Need to cancel the default events to allow drop\n // https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/Drag_operations#droptargets\n event.preventDefault();\n event.stopPropagation();\n\n if (!hasFiles) {\n if (event.dataTransfer) {\n event.dataTransfer.dropEffect = \"none\";\n }\n if (isActive) {\n setActive(false);\n }\n return;\n }\n\n if (disabled) {\n if (event.dataTransfer) {\n event.dataTransfer.dropEffect = \"none\";\n }\n return;\n }\n if (event.dataTransfer) {\n event.dataTransfer.dropEffect = \"copy\";\n }\n if (!isActive) {\n setActive(true);\n }\n };\n\n const handleDragLeave: DragEventHandler<HTMLDivElement> = (event) => {\n if (disabled) {\n return;\n }\n const region = regionRef?.current;\n const eventTarget = event.relatedTarget;\n if (\n eventTarget !== region &&\n (!(eventTarget instanceof Node) || !region?.contains(eventTarget))\n ) {\n setActive(false);\n }\n onDragLeave?.(event);\n };\n\n const handleDrop: DragEventHandler<HTMLDivElement> = (event) => {\n event.preventDefault();\n\n if (!containsFiles(event)) {\n setActive(false);\n return;\n }\n\n if (disabled) {\n setActive(false);\n return;\n }\n\n const files = extractFiles(event);\n setActive(false);\n onDrop?.(event, files);\n };\n\n return (\n <div\n className={clsx(\n withBaseName(),\n {\n [withBaseName(status as string)]: status,\n [withBaseName(\"active\")]: isActive,\n [withBaseName(\"disabled\")]: disabled,\n },\n className,\n )}\n aria-disabled={disabled}\n onDragLeave={handleDragLeave}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n ref={handleRef}\n {...restProps}\n >\n {children}\n </div>\n );\n },\n);\n"],"names":["FileDropZone","fileDropZoneCss"],"mappings":";;;;;;;;;;;;;;AAgCA,MAAM,YAAA,GAAe,aAAa,kBAAkB,CAAA;AAE7C,MAAM,YAAA,GAAe,UAAA;AAAA,EAC1B,SAASA,aAAAA,CACP;AAAA,IACE,MAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,WAAA;AAAA,IACA,MAAA;AAAA,IACA,GAAG;AAAA,KAEL,GAAA,EACA;AACA,IAAA,MAAM,eAAe,SAAA,EAAU;AAC/B,IAAA,wBAAA,CAAyB;AAAA,MACvB,MAAA,EAAQ,qBAAA;AAAA,MACR,GAAA,EAAKC,QAAA;AAAA,MACL,MAAA,EAAQ;AAAA,KACT,CAAA;AACD,IAAA,MAAM,CAAC,QAAA,EAAU,SAAS,CAAA,GAAI,SAAS,KAAK,CAAA;AAE5C,IAAA,MAAM,SAAA,GAAY,OAAuB,IAAI,CAAA;AAC7C,IAAA,MAAM,SAAA,GAAY,UAAA,CAAW,GAAA,EAAK,SAAS,CAAA;AAE3C,IAAA,MAAM,cAAA,GAAmD,CAAC,KAAA,KAAU;AAClE,MAAA,UAAA,IAAA,IAAA,GAAA,MAAA,GAAA,UAAA,CA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A,MAAM,UAAA,GAA+C,CAAC,KAAA,KAAU;AAC9D,MAAA,KAAA,CAAM,cAAA,EAAe;AAErB,MAAA,IAAI,CAAC,aAAA,CAAc,KAAK,CAAA,EAAG;AACzB,QAAA,SAAA,CAAU,KAAK,CAAA;AACf,QAAA;AAAA,MACF;AAEA,MAAA,IAAI,QAAA,EAAU;AACZ,QAAA,SAAA,CAAU,KAAK,CAAA;AACf,QAAA;AAAA,MACF;AAEA,MAAA,MAAM,KAAA,GAAQ,aAAa,KAAK,CAAA;AAChC,MAAA,SAAA,CAAU,KAAK,CAAA;AACf,MAAA,MAAA,IAAA,IAAA,GAAA,MAAA,GAAA,MAAA,CAAS,KAAA,EAAO,KAAA,CAAA;AAAA,IAClB,CAAA;AAEA,IAAA,uBACE,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,IAAA;AAAA,UACT,YAAA,EAAa;AAAA,UACb;AAAA,YACE,CAAC,YAAA,CAAa,MAAgB,CAAC,GAAG,MAAA;AAAA,YAClC,CAAC,YAAA,CAAa,QAAQ,CAAC,GAAG,QAAA;AAAA,YAC1B,CAAC,YAAA,CAAa,UAAU,CAAC,GAAG;AAAA,WAC9B;AAAA,UACA;AAAA,SACF;AAAA,QACA,eAAA,EAAe,QAAA;AAAA,QACf,WAAA,EAAa,eAAA;AAAA,QACb,UAAA,EAAY,cAAA;AAAA,QACZ,MAAA,EAAQ,UAAA;AAAA,QACR,GAAA,EAAK,SAAA;AAAA,QACJ,GAAG,SAAA;AAAA,QAEH;AAAA;AAAA,KACH;AAAA,EAEJ;AACF;;;;"}
@@ -8,7 +8,7 @@ import '../utils/useId.js';
8
8
  import '../salt-provider/SaltProvider.js';
9
9
  import '../viewport/ViewportProvider.js';
10
10
 
11
- const FileDropZoneTrigger = forwardRef(function FileDropZoneTrigger2({ accept, children, disabled, multiple = false, onChange, ...rest }, ref) {
11
+ const FileDropZoneTrigger = forwardRef(function FileDropZoneTrigger2({ accept, children, disabled, multiple = false, onClick, onChange, ...rest }, ref) {
12
12
  const buttonRef = useRef(null);
13
13
  const fileInputRef = useRef(null);
14
14
  const triggerRef = useForkRef(ref, buttonRef);
@@ -19,13 +19,14 @@ const FileDropZoneTrigger = forwardRef(function FileDropZoneTrigger2({ accept, c
19
19
  };
20
20
  const handleClick = (event) => {
21
21
  var _a;
22
+ onClick == null ? void 0 : onClick(event);
22
23
  event.stopPropagation();
23
24
  (_a = fileInputRef.current) == null ? void 0 : _a.click();
24
25
  };
25
26
  const handleChange = (event) => {
26
27
  const files = Array.from(event.target.files ?? []);
27
- event.target.value = "";
28
28
  onChange == null ? void 0 : onChange(event, files);
29
+ event.target.value = "";
29
30
  };
30
31
  return /* @__PURE__ */ jsxs(Fragment, { children: [
31
32
  /* @__PURE__ */ jsx(
@@ -1 +1 @@
1
- {"version":3,"file":"FileDropZoneTrigger.js","sources":["../src/file-drop-zone/FileDropZoneTrigger.tsx"],"sourcesContent":["import {\n type ChangeEvent,\n type ComponentPropsWithoutRef,\n type FocusEvent,\n forwardRef,\n type SyntheticEvent,\n useRef,\n} from \"react\";\nimport { Button, type ButtonProps } from \"../button\";\nimport { useForkRef } from \"../utils\";\n\nexport interface FileDropZoneTriggerProps\n extends Omit<ComponentPropsWithoutRef<\"button\">, \"onChange\"> {\n /**\n * `accept` attribute for HTML <input>.\n *\n * A comma separated list of file types the user can pick from the file input dialog box.\n */\n accept?: string;\n /**\n * Disable all trigger elements.\n */\n disabled?: boolean;\n /**\n * Allows multiple files to be uploaded.\n */\n multiple?: boolean;\n /**\n * Callback for input change event\n */\n onChange?: (event: ChangeEvent<HTMLInputElement>, files: File[]) => void;\n /**\n * The appearance of the button. Options are 'solid', 'bordered', and 'transparent'.\n * 'solid' is the default value.\n */\n appearance?: ButtonProps[\"appearance\"];\n /**\n * The sentiment of the button. Options are 'accented' and 'neutral'.\n * 'neutral' is the default value.\n *\n */\n sentiment?: Extract<ButtonProps[\"sentiment\"], \"accented\" | \"neutral\">;\n}\n\nexport const FileDropZoneTrigger = forwardRef<\n HTMLButtonElement,\n FileDropZoneTriggerProps\n>(function FileDropZoneTrigger(\n { accept, children, disabled, multiple = false, onChange, ...rest },\n ref,\n) {\n const buttonRef = useRef<HTMLButtonElement>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const triggerRef = useForkRef(ref, buttonRef);\n\n // As an ADA requirement when dialog is closed and the focus is returned to the input, we need to\n // move focus back on the button element so that all labels can be announced correctly\n const handleFocus = (event: FocusEvent<HTMLInputElement>) => {\n event.stopPropagation();\n buttonRef.current?.focus();\n };\n\n const handleClick = (event: SyntheticEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n fileInputRef.current?.click();\n };\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const files = Array.from((event.target as HTMLInputElement).files ?? []);\n // Allow selecting the same file multiple times - #3591\n // User would still be able to put back the value in onChange, if necessary\n event.target.value = \"\";\n onChange?.(event, files);\n };\n return (\n <>\n <Button\n onClick={handleClick}\n disabled={disabled}\n ref={triggerRef}\n {...rest}\n >\n {children ?? \"Browse files\"}\n </Button>\n <input\n accept={accept}\n style={{ display: \"none\" }}\n disabled={disabled}\n multiple={multiple}\n onChange={handleChange}\n onFocus={handleFocus}\n ref={fileInputRef}\n type=\"file\"\n />\n </>\n );\n});\n"],"names":["FileDropZoneTrigger"],"mappings":";;;;;;;;;;AA4CO,MAAM,mBAAA,GAAsB,UAAA,CAGjC,SAASA,oBAAAA,CACT,EAAE,MAAA,EAAQ,QAAA,EAAU,QAAA,EAAU,QAAA,GAAW,KAAA,EAAO,QAAA,EAAU,GAAG,IAAA,IAC7D,GAAA,EACA;AACA,EAAA,MAAM,SAAA,GAAY,OAA0B,IAAI,CAAA;AAChD,EAAA,MAAM,YAAA,GAAe,OAAyB,IAAI,CAAA;AAClD,EAAA,MAAM,UAAA,GAAa,UAAA,CAAW,GAAA,EAAK,SAAS,CAAA;AAI5C,EAAA,MAAM,WAAA,GAAc,CAAC,KAAA,KAAw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AA;AAAA;AACP,GAAA,EACF,CAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"FileDropZoneTrigger.js","sources":["../src/file-drop-zone/FileDropZoneTrigger.tsx"],"sourcesContent":["import {\n type ChangeEvent,\n type ComponentPropsWithoutRef,\n type FocusEvent,\n forwardRef,\n type MouseEvent,\n useRef,\n} from \"react\";\nimport { Button, type ButtonProps } from \"../button\";\nimport { useForkRef } from \"../utils\";\n\nexport interface FileDropZoneTriggerProps\n extends Omit<ComponentPropsWithoutRef<\"button\">, \"onChange\"> {\n /**\n * `accept` attribute for HTML <input>.\n *\n * A comma separated list of file types the user can pick from the file input dialog box.\n */\n accept?: string;\n /**\n * Disable all trigger elements.\n */\n disabled?: boolean;\n /**\n * Allows multiple files to be uploaded.\n */\n multiple?: boolean;\n /**\n * Callback for input change event\n */\n onChange?: (event: ChangeEvent<HTMLInputElement>, files: File[]) => void;\n /**\n * The appearance of the button. Options are 'solid', 'bordered', and 'transparent'.\n * 'solid' is the default value.\n */\n appearance?: ButtonProps[\"appearance\"];\n /**\n * The sentiment of the button. Options are 'accented' and 'neutral'.\n * 'neutral' is the default value.\n *\n */\n sentiment?: Extract<ButtonProps[\"sentiment\"], \"accented\" | \"neutral\">;\n}\n\nexport const FileDropZoneTrigger = forwardRef<\n HTMLButtonElement,\n FileDropZoneTriggerProps\n>(function FileDropZoneTrigger(\n { accept, children, disabled, multiple = false, onClick, onChange, ...rest },\n ref,\n) {\n const buttonRef = useRef<HTMLButtonElement>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const triggerRef = useForkRef(ref, buttonRef);\n\n // As an ADA requirement when dialog is closed and the focus is returned to the input, we need to\n // move focus back on the button element so that all labels can be announced correctly\n const handleFocus = (event: FocusEvent<HTMLInputElement>) => {\n event.stopPropagation();\n buttonRef.current?.focus();\n };\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n event.stopPropagation();\n fileInputRef.current?.click();\n };\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const files = Array.from((event.target as HTMLInputElement).files ?? []);\n onChange?.(event, files);\n\n // Reset after onChange so consumers can read the selected files first.\n // Clearing the value allows selecting the same file again - #3591.\n event.target.value = \"\";\n };\n return (\n <>\n <Button\n onClick={handleClick}\n disabled={disabled}\n ref={triggerRef}\n {...rest}\n >\n {children ?? \"Browse files\"}\n </Button>\n <input\n accept={accept}\n style={{ display: \"none\" }}\n disabled={disabled}\n multiple={multiple}\n onChange={handleChange}\n onFocus={handleFocus}\n ref={fileInputRef}\n type=\"file\"\n />\n </>\n );\n});\n"],"names":["FileDropZoneTrigger"],"mappings":";;;;;;;;;;AA4CO,MAAM,mBAAA,GAAsB,UAAA,CAGjC,SAASA,oBAAAA,CACT,EAAE,MAAA,EAAQ,QAAA,EAAU,QAAA,EAAU,QAAA,GAAW,OAAO,OAAA,EAAS,QAAA,EAAU,GAAG,IAAA,IACtE,GAAA,EACA;AACA,EAAA,MAAM,SAAA,GAAY,OAA0B,IAAI,CAAA;AAChD,EAAA,MAAM,YAAA,GAAe,OAAyB,IAAI,CAAA;AAClD,EAAA,MAAM,UAAA,GAAa,UAAA,CAAW,GAAA,EAAK,SAAS,CAAA;AAI5C,EAAA,MAAM,WAAA,GAAc,CAAC,KAAA,KAAwC;AAzD/D,IAAA,IAAA,EAAA;AA0DI,IAAA,KAAA,CAAM,eAAA,EAAgB;AACtB,IAAA,CAAA,EAAA,GAAA,SAAA,CAAU,YAAV,IAAA,GAAA,MAAA,GAAA,EAAA,CAAmB,KAAA,EAAA;AAAA,EACrB,CAAA;AAEA,EAAA,MAAM,WAAA,GAAc,CAAC,KAAA,KAAyC;AA9DhE,IAAA,IAAA,EAAA;AA+DI,IAAA,OAAA,IAAA,IAAA,GAAA,MAAA,GAAA,OAAA,CAAU,KAAA,CAAA;AACV,IAAA,KAAA,CAAM,eAAA,EAAgB;AACtB,IAAA,CAAA,EAAA,GAAA,YAAA,CAAa,YAAb,IAAA,GAAA,MAAA,GAAA,EAAA,CAAsB,KAAA,EAAA;AAAA,EACxB,CAAA;AAEA,EAAA,MAAM,YAAA,GAAe,CAAC,KAAA,KAAyC;AAC7D,IAAA,MAAM,QAAQ,KAAA,CAAM,IAAA,CAAM,MAAM,MAAA,CAA4B,KAAA,IAAS,EAAE,CAAA;AACvE,IAAA,QAAA,IAAA,IAAA,GAAA,MAAA,GAAA,QAAA,CAAW,KAAA,EAAO,KAAA,CAAA;AAIlB,IAAA,KAAA,CAAM,OAAO,KAAA,GAAQ,EAAA;AAAA,EACvB,CAAA;AACA,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAS,WAAA;AAAA,QACT,QAAA;AAAA,QACA,GAAA,EAAK,UAAA;AAAA,QACJ,GAAG,IAAA;AAAA,QAEH,QAAA,EAAA,QAAA,IAAY;AAAA;AAAA,KACf;AAAA,oBACA,GAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,MAAA;AAAA,QACA,KAAA,EAAO,EAAE,OAAA,EAAS,MAAA,EAAO;AAAA,QACzB,QAAA;AAAA,QACA,QAAA;AAAA,QACA,QAAA,EAAU,YAAA;AAAA,QACV,OAAA,EAAS,WAAA;AAAA,QACT,GAAA,EAAK,YAAA;AAAA,QACL,IAAA,EAAK;AAAA;AAAA;AACP,GAAA,EACF,CAAA;AAEJ,CAAC;;;;"}
@@ -1,4 +1,4 @@
1
- var css_248z = "/* Style applied to the root element */\n.saltGridLayout {\n display: grid;\n column-gap: var(--gridLayout-columnGap);\n row-gap: var(--gridLayout-rowGap);\n grid-template-columns: var(--gridLayout-columns);\n grid-template-rows: var(--gridLayout-rows);\n margin: var(--gridLayout-margin);\n padding: var(--gridLayout-padding);\n grid-auto-columns: auto;\n grid-auto-rows: auto;\n}\n\n.saltGridLayout-area {\n grid-template: var(--gridLayout-gridTemplate);\n grid-template-columns: min-content 1fr min-content;\n grid-template-rows: min-content 1fr min-content;\n}\n";
1
+ var css_248z = "/* Style applied to the root element */\n.saltGridLayout {\n display: grid;\n column-gap: var(--gridLayout-columnGap);\n row-gap: var(--gridLayout-rowGap);\n grid-template-columns: var(--gridLayout-columns);\n grid-template-rows: var(--gridLayout-rows);\n margin: var(--gridLayout-margin);\n padding: var(--gridLayout-padding);\n grid-auto-columns: auto;\n grid-auto-rows: auto;\n}\n\n.saltGridLayout-area {\n grid-template: var(--gridLayout-gridTemplate);\n grid-template-columns: var(--gridLayout-areaColumns, min-content 1fr min-content);\n grid-template-rows: var(--gridLayout-areaRows, min-content 1fr min-content);\n}\n";
2
2
 
3
3
  export { css_248z as default };
4
4
  //# sourceMappingURL=GridLayout.css.js.map
package/dist-es/index.js CHANGED
@@ -58,6 +58,17 @@ export { Link } from './link/Link.js';
58
58
  export { LinkCard } from './link-card/LinkCard.js';
59
59
  export { ListBox } from './list-box/ListBox.js';
60
60
  export { useListControlContext } from './list-control/ListControlContext.js';
61
+ export { MegaMenu } from './mega-menu/MegaMenu.js';
62
+ export { MegaMenuActions } from './mega-menu/MegaMenuActions.js';
63
+ export { MegaMenuAside } from './mega-menu/MegaMenuAside.js';
64
+ export { MegaMenuContent } from './mega-menu/MegaMenuContent.js';
65
+ export { MegaMenuGroup } from './mega-menu/MegaMenuGroup.js';
66
+ export { MegaMenuGroupHeading } from './mega-menu/MegaMenuGroupHeading.js';
67
+ export { MegaMenuGroups } from './mega-menu/MegaMenuGroups.js';
68
+ export { MegaMenuList } from './mega-menu/MegaMenuList.js';
69
+ export { MegaMenuListItem } from './mega-menu/MegaMenuListItem.js';
70
+ export { MegaMenuPanel } from './mega-menu/MegaMenuPanel.js';
71
+ export { MegaMenuTrigger } from './mega-menu/MegaMenuTrigger.js';
61
72
  export { Menu } from './menu/Menu.js';
62
73
  export { MenuGroup } from './menu/MenuGroup.js';
63
74
  export { MenuItem } from './menu/MenuItem.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,79 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useFloatingRootContext, useInteractions, useClick, useDismiss } from '@floating-ui/react';
3
+ import { useState, useRef, useCallback, useMemo } from 'react';
4
+ import 'clsx';
5
+ import { useControlled } from '../utils/useControlled.js';
6
+ import '../utils/useFloatingUI/useFloatingUI.js';
7
+ import '../utils/useId.js';
8
+ import '../salt-provider/SaltProvider.js';
9
+ import '../viewport/ViewportProvider.js';
10
+ import { MegaMenuContext } from './MegaMenuContext.js';
11
+ import { useMegaMenuNavigation } from './useMegaMenuNavigation.js';
12
+
13
+ function MegaMenu({
14
+ children,
15
+ open,
16
+ defaultOpen = false,
17
+ onOpenChange,
18
+ placement = "bottom"
19
+ }) {
20
+ const [openState, setOpenState] = useControlled({
21
+ controlled: open,
22
+ default: defaultOpen,
23
+ name: "MegaMenu",
24
+ state: "open"
25
+ });
26
+ const [reference, setReference] = useState(null);
27
+ const [floating, setFloating] = useState(null);
28
+ const focusFirstItemOnOpenRef = useRef(false);
29
+ const [panelId, setPanelId] = useState();
30
+ const setOpen = useCallback(
31
+ (newOpen) => {
32
+ if (!newOpen) {
33
+ focusFirstItemOnOpenRef.current = false;
34
+ }
35
+ setOpenState(newOpen);
36
+ onOpenChange == null ? void 0 : onOpenChange(newOpen);
37
+ },
38
+ [onOpenChange]
39
+ );
40
+ const floatingRootContext = useFloatingRootContext({
41
+ open: openState,
42
+ onOpenChange: setOpen,
43
+ elements: { reference, floating }
44
+ });
45
+ const megaMenuNavigation = useMegaMenuNavigation(floatingRootContext);
46
+ const { getReferenceProps, getFloatingProps } = useInteractions([
47
+ useClick(floatingRootContext),
48
+ useDismiss(floatingRootContext),
49
+ megaMenuNavigation
50
+ ]);
51
+ const contextValue = useMemo(
52
+ () => ({
53
+ openState,
54
+ floatingRootContext,
55
+ placement,
56
+ getFloatingProps,
57
+ getReferenceProps,
58
+ setFloating,
59
+ setReference,
60
+ setOpen,
61
+ focusFirstItemOnOpenRef,
62
+ panelId,
63
+ setPanelId
64
+ }),
65
+ [
66
+ openState,
67
+ floatingRootContext,
68
+ placement,
69
+ getFloatingProps,
70
+ getReferenceProps,
71
+ setOpen,
72
+ panelId
73
+ ]
74
+ );
75
+ return /* @__PURE__ */ jsx(MegaMenuContext.Provider, { value: contextValue, children });
76
+ }
77
+
78
+ export { MegaMenu };
79
+ //# sourceMappingURL=MegaMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MegaMenu.js","sources":["../src/mega-menu/MegaMenu.tsx"],"sourcesContent":["import {\n useClick,\n useDismiss,\n useFloatingRootContext,\n useInteractions,\n} from \"@floating-ui/react\";\nimport { type ReactNode, useCallback, useMemo, useRef, useState } from \"react\";\nimport { useControlled } from \"../utils\";\nimport { MegaMenuContext } from \"./MegaMenuContext\";\nimport { useMegaMenuNavigation } from \"./useMegaMenuNavigation\";\n\n/**\n * Supported placements for the mega menu panel.\n */\nexport type MegaMenuPlacement = \"bottom\" | \"bottom-start\" | \"bottom-end\";\n\nexport interface MegaMenuProps {\n /**\n * The content of the mega menu, typically `MegaMenuTrigger` and `MegaMenuPanel`.\n */\n children?: ReactNode;\n /**\n * Whether the mega menu is open. Use for controlled mode.\n */\n open?: boolean;\n /**\n * Whether the mega menu is initially open. Use for uncontrolled mode.\n * @default false\n */\n defaultOpen?: boolean;\n /**\n * Callback fired when the open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * The placement of the mega menu panel relative to the trigger.\n * @default \"bottom\"\n */\n placement?: MegaMenuPlacement;\n}\n\n/**\n * Root of a mega menu, coordinating its trigger and panel.\n *\n * Not intended to be nested inside another floating overlay (e.g. a dialog or\n * popover): the mega menu does not participate in floating-ui's `FloatingTree`\n */\nexport function MegaMenu({\n children,\n open,\n defaultOpen = false,\n onOpenChange,\n placement = \"bottom\",\n}: MegaMenuProps) {\n const [openState, setOpenState] = useControlled({\n controlled: open,\n default: defaultOpen,\n name: \"MegaMenu\",\n state: \"open\",\n });\n\n const [reference, setReference] = useState<HTMLElement | null>(null);\n const [floating, setFloating] = useState<HTMLElement | null>(null);\n const focusFirstItemOnOpenRef = useRef(false);\n const [panelId, setPanelId] = useState<string>();\n\n const setOpen = useCallback(\n (newOpen: boolean) => {\n if (!newOpen) {\n focusFirstItemOnOpenRef.current = false;\n }\n setOpenState(newOpen);\n onOpenChange?.(newOpen);\n },\n [onOpenChange],\n );\n\n const floatingRootContext = useFloatingRootContext({\n open: openState,\n onOpenChange: setOpen,\n elements: { reference, floating },\n });\n\n const megaMenuNavigation = useMegaMenuNavigation(floatingRootContext);\n\n const { getReferenceProps, getFloatingProps } = useInteractions([\n useClick(floatingRootContext),\n useDismiss(floatingRootContext),\n megaMenuNavigation,\n ]);\n\n const contextValue = useMemo(\n () => ({\n openState,\n floatingRootContext,\n placement,\n getFloatingProps,\n getReferenceProps,\n setFloating,\n setReference,\n setOpen,\n focusFirstItemOnOpenRef,\n panelId,\n setPanelId,\n }),\n [\n openState,\n floatingRootContext,\n placement,\n getFloatingProps,\n getReferenceProps,\n setOpen,\n panelId,\n ],\n );\n\n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,CAAA;AAEpE,EAAA,MAAM,EAAE,iBAAA,EAAmB,gBAAA,EAAiB,GAAI,eAAA,CAAgB;AAAA,IAC9D,SAAS,mBAAmB,CAAA;AAAA,IAC5B,WAAW,mBAAmB,CAAA;AAAA,IAC9B;AAAA,GACD,CAAA;AAED,EAAA,MAAM,YAAA,GAAe,OAAA;AAAA,IACnB,OAAO;AAAA,MACL,SAAA;AAAA,MACA,mBAAA;AAAA,MACA,SAAA;AAAA,MACA,gBAAA;AAAA,MACA,iBAAA;AAAA,MACA,WAAA;AAAA,MACA,YAAA;AAAA,MACA,OAAA;AAAA,MACA,uBAAA;AAAA,MACA,OAAA;AAAA,MACA;AAAA,KACF,CAAA;AAAA,IACA;AAAA,MACE,SAAA;AAAA,MACA,mBAAA;AAAA,MACA,SAAA;AAAA,MACA,gBAAA;AAAA,MACA,iBAAA;AAAA,MACA,OAAA;AAAA,MACA;AAAA;AACF,GACF;AAEA,EAAA,2BACG,eAAA,CAAgB,QAAA,EAAhB,EAAyB,KAAA,EAAO,cAC9B,QAAA,EACH,CAAA;AAEJ;;;;"}
@@ -0,0 +1,4 @@
1
+ var css_248z = ".saltMegaMenuActions {\n display: flex;\n flex-wrap: wrap;\n margin-block-start: auto;\n}\n";
2
+
3
+ export { css_248z as default };
4
+ //# sourceMappingURL=MegaMenuActions.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MegaMenuActions.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,35 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useComponentCssInjection } from '@salt-ds/styles';
3
+ import { useWindow } from '@salt-ds/window';
4
+ import { clsx } from 'clsx';
5
+ import { forwardRef } from 'react';
6
+ import { makePrefixer } from '../utils/makePrefixer.js';
7
+ import '../utils/useFloatingUI/useFloatingUI.js';
8
+ import '../utils/useId.js';
9
+ import '../salt-provider/SaltProvider.js';
10
+ import '../viewport/ViewportProvider.js';
11
+ import css_248z from './MegaMenuActions.css.js';
12
+
13
+ const withBaseName = makePrefixer("saltMegaMenuActions");
14
+ const MegaMenuActions = forwardRef(
15
+ function MegaMenuActions2({ className, ...rest }, ref) {
16
+ const targetWindow = useWindow();
17
+ useComponentCssInjection({
18
+ testId: "salt-mega-menu-actions",
19
+ css: css_248z,
20
+ window: targetWindow
21
+ });
22
+ return /* @__PURE__ */ jsx(
23
+ "div",
24
+ {
25
+ "data-mega-menu-actions": "",
26
+ className: clsx(withBaseName(), className),
27
+ ref,
28
+ ...rest
29
+ }
30
+ );
31
+ }
32
+ );
33
+
34
+ export { MegaMenuActions };
35
+ //# sourceMappingURL=MegaMenuActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MegaMenuActions.js","sources":["../src/mega-menu/MegaMenuActions.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type ReactNode,\n} from \"react\";\nimport { makePrefixer } from \"../utils\";\nimport megaMenuActionsCss from \"./MegaMenuActions.css\";\n\nconst withBaseName = makePrefixer(\"saltMegaMenuActions\");\n\nexport interface MegaMenuActionsProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * The content of the actions. Place `MegaMenuActions` inside\n * `MegaMenuContent`, after `MegaMenuGroups`; it renders as a band beneath the\n * groups, spanning their width.\n */\n children?: ReactNode;\n}\n\nexport const MegaMenuActions = forwardRef<HTMLDivElement, MegaMenuActionsProps>(\n function MegaMenuActions({ className, ...rest }, ref) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-mega-menu-actions\",\n css: megaMenuActionsCss,\n window: targetWindow,\n });\n\n return (\n <div\n data-mega-menu-actions=\"\"\n className={clsx(withBaseName(), className)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\n"],"names":["MegaMenuActions","megaMenuActionsCss"],"mappings":";;;;;;;;;;;;AAWA,MAAM,YAAA,GAAe,aAAa,qBAAqB,CAAA;AAWhD,MAAM,eAAA,GAAkB,UAAA;AAAA,EAC7B,SAASA,gBAAAA,CAAgB,EAAE,WAAW,GAAG,IAAA,IAAQ,GAAA,EAAK;AACpD,IAAA,MAAM,eAAe,SAAA,EAAU;AAC/B,IAAA,wBAAA,CAAyB;AAAA,MACvB,MAAA,EAAQ,wBAAA;AAAA,MACR,GAAA,EAAKC,QAAA;AAAA,MACL,MAAA,EAAQ;AAAA,KACT,CAAA;AAED,IAAA,uBACE,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,wBAAA,EAAuB,EAAA;AAAA,QACvB,SAAA,EAAW,IAAA,CAAK,YAAA,EAAa,EAAG,SAAS,CAAA;AAAA,QACzC,GAAA;AAAA,QACC,GAAG;AAAA;AAAA,KACN;AAAA,EAEJ;AACF;;;;"}
@@ -0,0 +1,4 @@
1
+ var css_248z = ".saltMegaMenuAside {\n flex: 0 0 auto;\n display: flex;\n flex-direction: column;\n padding: var(--salt-spacing-300);\n}\n";
2
+
3
+ export { css_248z as default };
4
+ //# sourceMappingURL=MegaMenuAside.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MegaMenuAside.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,35 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useComponentCssInjection } from '@salt-ds/styles';
3
+ import { useWindow } from '@salt-ds/window';
4
+ import { clsx } from 'clsx';
5
+ import { forwardRef } from 'react';
6
+ import { makePrefixer } from '../utils/makePrefixer.js';
7
+ import '../utils/useFloatingUI/useFloatingUI.js';
8
+ import '../utils/useId.js';
9
+ import '../salt-provider/SaltProvider.js';
10
+ import '../viewport/ViewportProvider.js';
11
+ import css_248z from './MegaMenuAside.css.js';
12
+
13
+ const withBaseName = makePrefixer("saltMegaMenuAside");
14
+ const MegaMenuAside = forwardRef(
15
+ function MegaMenuAside2({ className, ...rest }, ref) {
16
+ const targetWindow = useWindow();
17
+ useComponentCssInjection({
18
+ testId: "salt-mega-menu-aside",
19
+ css: css_248z,
20
+ window: targetWindow
21
+ });
22
+ return /* @__PURE__ */ jsx(
23
+ "aside",
24
+ {
25
+ "data-mega-menu-column": "",
26
+ className: clsx(withBaseName(), className),
27
+ ref,
28
+ ...rest
29
+ }
30
+ );
31
+ }
32
+ );
33
+
34
+ export { MegaMenuAside };
35
+ //# sourceMappingURL=MegaMenuAside.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MegaMenuAside.js","sources":["../src/mega-menu/MegaMenuAside.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type ReactNode,\n} from \"react\";\nimport { makePrefixer } from \"../utils\";\nimport megaMenuAsideCss from \"./MegaMenuAside.css\";\n\nconst withBaseName = makePrefixer(\"saltMegaMenuAside\");\n\nexport interface MegaMenuAsideProps extends ComponentPropsWithoutRef<\"aside\"> {\n /**\n * The content. Renders to the left of `MegaMenuContent` when placed before\n * it, and to the right when placed after.\n */\n children?: ReactNode;\n}\n\nexport const MegaMenuAside = forwardRef<HTMLElement, MegaMenuAsideProps>(\n function MegaMenuAside({ className, ...rest }, ref) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-mega-menu-aside\",\n css: megaMenuAsideCss,\n window: targetWindow,\n });\n\n // Side content is also a navigation column (`data-mega-menu-column`).\n return (\n <aside\n data-mega-menu-column=\"\"\n className={clsx(withBaseName(), className)}\n ref={ref}\n {...rest}\n />\n );\n },\n);\n"],"names":["MegaMenuAside","megaMenuAsideCss"],"mappings":";;;;;;;;;;;;AAWA,MAAM,YAAA,GAAe,aAAa,mBAAmB,CAAA;AAU9C,MAAM,aAAA,GAAgB,UAAA;AAAA,EAC3B,SAASA,cAAAA,CAAc,EAAE,WAAW,GAAG,IAAA,IAAQ,GAAA,EAAK;AAClD,IAAA,MAAM,eAAe,SAAA,EAAU;AAC/B,IAAA,wBAAA,CAAyB;AAAA,MACvB,MAAA,EAAQ,sBAAA;AAAA,MACR,GAAA,EAAKC,QAAA;AAAA,MACL,MAAA,EAAQ;AAAA,KACT,CAAA;AAGD,IAAA,uBACE,GAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,uBAAA,EAAsB,EAAA;AAAA,QACtB,SAAA,EAAW,IAAA,CAAK,YAAA,EAAa,EAAG,SAAS,CAAA;AAAA,QACzC,GAAA;AAAA,QACC,GAAG;AAAA;AAAA,KACN;AAAA,EAEJ;AACF;;;;"}
@@ -0,0 +1,4 @@
1
+ var css_248z = ".saltMegaMenuContent {\n display: flex;\n flex-direction: column;\n gap: var(--salt-spacing-300);\n padding: var(--salt-spacing-300);\n min-width: 0;\n flex: 0 1 auto;\n max-inline-size: var(--saltMegaMenuPanel-availableWidth);\n box-sizing: border-box;\n}\n";
2
+
3
+ export { css_248z as default };
4
+ //# sourceMappingURL=MegaMenuContent.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MegaMenuContent.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,27 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useComponentCssInjection } from '@salt-ds/styles';
3
+ import { useWindow } from '@salt-ds/window';
4
+ import { clsx } from 'clsx';
5
+ import { forwardRef } from 'react';
6
+ import { makePrefixer } from '../utils/makePrefixer.js';
7
+ import '../utils/useFloatingUI/useFloatingUI.js';
8
+ import '../utils/useId.js';
9
+ import '../salt-provider/SaltProvider.js';
10
+ import '../viewport/ViewportProvider.js';
11
+ import css_248z from './MegaMenuContent.css.js';
12
+
13
+ const withBaseName = makePrefixer("saltMegaMenuContent");
14
+ const MegaMenuContent = forwardRef(
15
+ function MegaMenuContent2({ children, className, ...rest }, ref) {
16
+ const targetWindow = useWindow();
17
+ useComponentCssInjection({
18
+ testId: "salt-mega-menu-content",
19
+ css: css_248z,
20
+ window: targetWindow
21
+ });
22
+ return /* @__PURE__ */ jsx("div", { className: clsx(withBaseName(), className), ref, ...rest, children });
23
+ }
24
+ );
25
+
26
+ export { MegaMenuContent };
27
+ //# sourceMappingURL=MegaMenuContent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MegaMenuContent.js","sources":["../src/mega-menu/MegaMenuContent.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type ReactNode,\n} from \"react\";\nimport { makePrefixer } from \"../utils\";\nimport megaMenuContentCss from \"./MegaMenuContent.css\";\n\nconst withBaseName = makePrefixer(\"saltMegaMenuContent\");\n\nexport interface MegaMenuContentProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * The content of the mega menu navigation area, typically a `MegaMenuGroups`\n * and an optional `MegaMenuActions`.\n */\n children?: ReactNode;\n}\n\nexport const MegaMenuContent = forwardRef<HTMLDivElement, MegaMenuContentProps>(\n function MegaMenuContent({ children, className, ...rest }, ref) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-mega-menu-content\",\n css: megaMenuContentCss,\n window: targetWindow,\n });\n\n return (\n <div className={clsx(withBaseName(), className)} ref={ref} {...rest}>\n {children}\n </div>\n );\n },\n);\n"],"names":["MegaMenuContent","megaMenuContentCss"],"mappings":";;;;;;;;;;;;AAWA,MAAM,YAAA,GAAe,aAAa,qBAAqB,CAAA;AAUhD,MAAM,eAAA,GAAkB,UAAA;AAAA,EAC7B,SAASA,iBAAgB,EAAE,QAAA,EAAU,WAAW,GAAG,IAAA,IAAQ,GAAA,EAAK;AAC9D,IAAA,MAAM,eAAe,SAAA,EAAU;AAC/B,IAAA,wBAAA,CAAyB;AAAA,MACvB,MAAA,EAAQ,wBAAA;AAAA,MACR,GAAA,EAAKC,QAAA;AAAA,MACL,MAAA,EAAQ;AAAA,KACT,CAAA;AAED,IAAA,uBACE,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAW,IAAA,CAAK,YAAA,EAAa,EAAG,SAAS,CAAA,EAAG,GAAA,EAAW,GAAG,IAAA,EAC5D,QAAA,EACH,CAAA;AAAA,EAEJ;AACF;;;;"}
@@ -0,0 +1,16 @@
1
+ import { createContext } from '../utils/createContext.js';
2
+ import 'react';
3
+ import 'clsx';
4
+ import 'react/jsx-runtime';
5
+ import '../utils/useFloatingUI/useFloatingUI.js';
6
+ import '../utils/useId.js';
7
+ import '../salt-provider/SaltProvider.js';
8
+ import '../viewport/ViewportProvider.js';
9
+
10
+ const MegaMenuContext = createContext(
11
+ "MegaMenuContext",
12
+ void 0
13
+ );
14
+
15
+ export { MegaMenuContext };
16
+ //# sourceMappingURL=MegaMenuContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MegaMenuContext.js","sources":["../src/mega-menu/MegaMenuContext.ts"],"sourcesContent":["import type { FloatingRootContext } from \"@floating-ui/react\";\nimport type {\n Dispatch,\n HTMLProps,\n MutableRefObject,\n SetStateAction,\n} from \"react\";\nimport { createContext } from \"../utils\";\nimport type { MegaMenuPlacement } from \"./MegaMenu\";\n\nexport interface MegaMenuContextValue {\n /** Whether the mega menu is currently open. */\n openState: boolean;\n /** Toggle or set the open state of the mega menu. */\n setOpen: (open: boolean) => void;\n /** The floating-ui root context for coordinating interactions. */\n floatingRootContext: FloatingRootContext;\n /** The placement of the mega menu panel relative to the trigger. */\n placement: MegaMenuPlacement;\n /** Props getter for the trigger (reference) element. Merges floating-ui interaction props with user props. */\n getReferenceProps: (\n userProps?: HTMLProps<Element> | undefined,\n ) => Record<string, unknown>;\n /** Props getter for the floating panel element. Merges floating-ui interaction props with user props. */\n getFloatingProps: (\n userProps?: HTMLProps<HTMLElement> | undefined,\n ) => Record<string, unknown>;\n /** Ref setter for the floating panel element. */\n setFloating: Dispatch<SetStateAction<HTMLElement | null>>;\n /** Ref setter for the trigger (reference) element. */\n setReference: Dispatch<SetStateAction<HTMLElement | null>>;\n /** Whether the first item should receive focus when the panel opens. */\n focusFirstItemOnOpenRef: MutableRefObject<boolean>;\n /** The id of the mega menu panel, used for aria-controls on the trigger. */\n panelId: string | undefined;\n /** Registers the panel's id so the trigger's aria-controls stays in sync. */\n setPanelId: Dispatch<SetStateAction<string | undefined>>;\n}\n\nexport const MegaMenuContext = createContext<MegaMenuContextValue | undefined>(\n \"MegaMenuContext\",\n undefined,\n);\n"],"names":[],"mappings":";;;;;;;;;AAuCO,MAAM,eAAA,GAAkB,aAAA;AAAA,EAC7B,iBAAA;AAAA,EACA;AACF;;;;"}
@@ -0,0 +1,4 @@
1
+ var css_248z = ".saltMegaMenuGroup {\n display: flex;\n flex-direction: column;\n}\n";
2
+
3
+ export { css_248z as default };
4
+ //# sourceMappingURL=MegaMenuGroup.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MegaMenuGroup.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}