@scm-manager/ui-overlays 2.43.1 → 2.43.2-20230419-125637

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.
@@ -0,0 +1,4 @@
1
+ {
2
+ "presets": ["@scm-manager/babel-preset"],
3
+ "plugins": ["@babel/plugin-syntax-dynamic-import"]
4
+ }
@@ -23,8 +23,9 @@
23
23
  */
24
24
 
25
25
  import React, { useEffect } from "react";
26
- import { I18nextProvider, initReactI18next } from "react-i18next";
26
+ import { initReactI18next } from "react-i18next";
27
27
  import i18n from "i18next";
28
+ import { withThemes } from "storybook-addon-themes";
28
29
 
29
30
  i18n.use(initReactI18next).init({
30
31
  whitelist: ["en", "de"],
@@ -36,7 +37,6 @@ i18n.use(initReactI18next).init({
36
37
  react: {
37
38
  useSuspense: false,
38
39
  },
39
-
40
40
  });
41
41
 
42
42
  const Decorator = ({ children, themeName }) => {
@@ -50,15 +50,10 @@ const Decorator = ({ children, themeName }) => {
50
50
  return <>{children}</>;
51
51
  };
52
52
 
53
+ export const decorators = [withThemes];
54
+
53
55
  export const parameters = {
54
56
  actions: { argTypesRegex: "^on[A-Z].*" },
55
- decorators: [
56
- (Story) => (
57
- <I18nextProvider i18n={i18n}>
58
- <Story />
59
- </I18nextProvider>
60
- ),
61
- ],
62
57
  themes: {
63
58
  Decorator,
64
59
  clearable: false,
@@ -1,4 +1,4 @@
1
- @scm-manager/ui-overlays:build: cache hit, replaying output 0396a4df6274bce9
1
+ @scm-manager/ui-overlays:build: cache hit, replaying output c4227fcee66f5e51
2
2
  @scm-manager/ui-overlays:build: $ tsup ./src/index.ts -d build --format esm,cjs --dts
3
3
  @scm-manager/ui-overlays:build: CLI Building entry: ./src/index.ts
4
4
  @scm-manager/ui-overlays:build: CLI Using tsconfig: tsconfig.json
@@ -6,10 +6,10 @@
6
6
  @scm-manager/ui-overlays:build: CLI Target: node14
7
7
  @scm-manager/ui-overlays:build: ESM Build start
8
8
  @scm-manager/ui-overlays:build: CJS Build start
9
- @scm-manager/ui-overlays:build: ESM build/index.mjs 1.26 KB
10
- @scm-manager/ui-overlays:build: ESM ⚡️ Build success in 273ms
11
- @scm-manager/ui-overlays:build: CJS build/index.js 2.80 KB
12
- @scm-manager/ui-overlays:build: CJS ⚡️ Build success in 193ms
9
+ @scm-manager/ui-overlays:build: CJS build/index.js 6.71 KB
10
+ @scm-manager/ui-overlays:build: CJS ⚡️ Build success in 237ms
11
+ @scm-manager/ui-overlays:build: ESM build/index.mjs 4.58 KB
12
+ @scm-manager/ui-overlays:build: ESM ⚡️ Build success in 297ms
13
13
  @scm-manager/ui-overlays:build: DTS Build start
14
- @scm-manager/ui-overlays:build: DTS ⚡️ Build success in 23262ms
15
- @scm-manager/ui-overlays:build: DTS build/index.d.ts 831.00 B
14
+ @scm-manager/ui-overlays:build: DTS ⚡️ Build success in 19895ms
15
+ @scm-manager/ui-overlays:build: DTS build/index.d.ts 16.78 KB
package/build/index.d.ts CHANGED
@@ -1,4 +1,8 @@
1
- import React, { ReactNode, ReactElement } from 'react';
1
+ import * as react_router_dom from 'react-router-dom';
2
+ import * as _radix_ui_react_menu from '@radix-ui/react-menu';
3
+ import * as _radix_ui_react_dropdown_menu from '@radix-ui/react-dropdown-menu';
4
+ import * as react from 'react';
5
+ import react__default, { ReactNode, ReactElement } from 'react';
2
6
  import * as RadixTooltip from '@radix-ui/react-tooltip';
3
7
 
4
8
  /**
@@ -7,7 +11,7 @@ import * as RadixTooltip from '@radix-ui/react-tooltip';
7
11
  * @since 2.41.0
8
12
  * @beta
9
13
  */
10
- declare const Tooltip: React.ForwardRefExoticComponent<{
14
+ declare const Tooltip: react__default.ForwardRefExoticComponent<{
11
15
  /**
12
16
  * The message to be displayed in the overlay.
13
17
  */
@@ -21,6 +25,33 @@ declare const Tooltip: React.ForwardRefExoticComponent<{
21
25
  * Class to be applied to the content container.
22
26
  */
23
27
  className?: string | undefined;
24
- } & Pick<RadixTooltip.TooltipContentProps, "side"> & React.RefAttributes<HTMLDivElement>>;
28
+ } & Pick<RadixTooltip.TooltipContentProps, "side"> & react__default.RefAttributes<HTMLDivElement>>;
25
29
 
26
- export { Tooltip };
30
+ declare const Menu: react.FC<{
31
+ className?: string | undefined;
32
+ trigger?: react.ReactElement<any, string | react.JSXElementConstructor<any>> | undefined;
33
+ } & Pick<_radix_ui_react_dropdown_menu.DropdownMenuContentProps, "side">> & {
34
+ Button: react.ForwardRefExoticComponent<Omit<react.ButtonHTMLAttributes<HTMLButtonElement>, "onClick" | "onSelect"> & Pick<Pick<_radix_ui_react_menu.MenuItemProps & react.RefAttributes<HTMLDivElement>, "onClick" | "onSelect" | "disabled" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "asChild" | "textValue">, "onSelect"> & react.RefAttributes<HTMLButtonElement>>;
35
+ Link: react.ForwardRefExoticComponent<Omit<react_router_dom.LinkProps<unknown>, "onSelect"> & Pick<Pick<_radix_ui_react_menu.MenuItemProps & react.RefAttributes<HTMLDivElement>, "onClick" | "onSelect" | "disabled" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "asChild" | "textValue">, "disabled"> & react.RefAttributes<HTMLAnchorElement>>;
36
+ ExternalLink: react.ForwardRefExoticComponent<Omit<react.AnchorHTMLAttributes<HTMLAnchorElement>, "onSelect"> & Pick<Pick<_radix_ui_react_menu.MenuItemProps & react.RefAttributes<HTMLDivElement>, "onClick" | "onSelect" | "disabled" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "asChild" | "textValue">, "disabled"> & react.RefAttributes<HTMLAnchorElement>>;
37
+ Trigger: react.ForwardRefExoticComponent<Pick<{
38
+ variant?: ("primary" | "secondary" | "tertiary" | "signal") | undefined;
39
+ isLoading?: boolean | undefined;
40
+ testId?: string | undefined;
41
+ } & react.ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>, keyof react.ButtonHTMLAttributes<HTMLButtonElement> | "key" | keyof {
42
+ variant?: ("primary" | "secondary" | "tertiary" | "signal") | undefined;
43
+ isLoading?: boolean | undefined;
44
+ testId?: string | undefined;
45
+ }> & react.RefAttributes<HTMLButtonElement>>;
46
+ DefaultTrigger: react.ForwardRefExoticComponent<Pick<{
47
+ variant?: ("primary" | "secondary" | "tertiary" | "signal") | undefined;
48
+ isLoading?: boolean | undefined;
49
+ testId?: string | undefined;
50
+ } & react.ButtonHTMLAttributes<HTMLButtonElement> & react.RefAttributes<HTMLButtonElement>, keyof react.ButtonHTMLAttributes<HTMLButtonElement> | "key" | keyof {
51
+ variant?: ("primary" | "secondary" | "tertiary" | "signal") | undefined;
52
+ isLoading?: boolean | undefined;
53
+ testId?: string | undefined;
54
+ }> & react.RefAttributes<HTMLButtonElement>>;
55
+ };
56
+
57
+ export { Menu, Tooltip };
package/build/index.js CHANGED
@@ -26,16 +26,104 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
26
26
  // src/index.ts
27
27
  var src_exports = {};
28
28
  __export(src_exports, {
29
+ Menu: () => Menu2,
29
30
  Tooltip: () => Tooltip_default
30
31
  });
31
32
  module.exports = __toCommonJS(src_exports);
32
33
 
33
- // src/tooltip/Tooltip.tsx
34
+ // src/menu/Menu.tsx
35
+ var import_react2 = __toESM(require("react"));
36
+ var RadixMenu2 = __toESM(require("@radix-ui/react-dropdown-menu"));
37
+ var import_styled_components = __toESM(require("styled-components"));
38
+
39
+ // src/menu/MenuTrigger.tsx
34
40
  var import_react = __toESM(require("react"));
35
- var RadixTooltip = __toESM(require("@radix-ui/react-tooltip"));
41
+ var import_ui_buttons = require("@scm-manager/ui-buttons");
42
+ var RadixMenu = __toESM(require("@radix-ui/react-dropdown-menu"));
43
+ var import_react_i18next = require("react-i18next");
36
44
  var import_classnames = __toESM(require("classnames"));
37
- var import_styled_components = __toESM(require("styled-components"));
38
- var StyledContent = (0, import_styled_components.default)(RadixTooltip.Content)`
45
+ var MenuTrigger = import_react.default.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ import_react.default.createElement(RadixMenu.Trigger, {
46
+ asChild: true
47
+ }, /* @__PURE__ */ import_react.default.createElement(import_ui_buttons.Button, {
48
+ ref,
49
+ ...props
50
+ }, children)));
51
+ var DefaultMenuTrigger = import_react.default.forwardRef(({ className, ...props }, ref) => {
52
+ const [t] = (0, import_react_i18next.useTranslation)("commons");
53
+ return /* @__PURE__ */ import_react.default.createElement(MenuTrigger, {
54
+ "aria-label": t("menu.defaultTriggerLabel"),
55
+ className: (0, import_classnames.default)(className, "is-borderless has-background-transparent has-hover-color-blue px-2"),
56
+ ref,
57
+ ...props
58
+ }, /* @__PURE__ */ import_react.default.createElement(import_ui_buttons.Icon, null, "ellipsis-v"));
59
+ });
60
+ var MenuTrigger_default = MenuTrigger;
61
+
62
+ // src/menu/Menu.tsx
63
+ var import_classnames2 = __toESM(require("classnames"));
64
+ var import_react_router_dom = require("react-router-dom");
65
+ var MenuContent = (0, import_styled_components.default)(RadixMenu2.Content)`
66
+ border: var(--scm-border);
67
+ background-color: var(--scm-secondary-background);
68
+ `;
69
+ var MenuItem = (0, import_styled_components.default)(RadixMenu2.Item).attrs({
70
+ className: "is-flex is-align-items-center px-3 py-2 has-text-inherit is-clickable is-size-6 has-hover-color-blue is-borderless has-background-transparent has-rounded-border"
71
+ })`
72
+ line-height: inherit;
73
+ :focus {
74
+ outline: #af3ee7 3px solid;
75
+ outline-offset: 0px;
76
+ }
77
+ &[data-disabled] {
78
+ color: unset !important;
79
+ opacity: 40%;
80
+ cursor: unset !important;
81
+ }
82
+ `;
83
+ var MenuLink = import_react2.default.forwardRef(({ children, disabled, ...props }, ref) => /* @__PURE__ */ import_react2.default.createElement(MenuItem, {
84
+ asChild: true,
85
+ disabled
86
+ }, /* @__PURE__ */ import_react2.default.createElement(import_react_router_dom.Link, {
87
+ ref,
88
+ ...props
89
+ }, children)));
90
+ var MenuExternalLink = import_react2.default.forwardRef(
91
+ ({ children, disabled, ...props }, ref) => /* @__PURE__ */ import_react2.default.createElement(MenuItem, {
92
+ asChild: true,
93
+ disabled
94
+ }, /* @__PURE__ */ import_react2.default.createElement("a", {
95
+ ref,
96
+ target: "_blank",
97
+ rel: "noopener noreferrer",
98
+ ...props
99
+ }, children))
100
+ );
101
+ var MenuButton = import_react2.default.forwardRef(
102
+ ({ children, onSelect, disabled, ...props }, ref) => /* @__PURE__ */ import_react2.default.createElement(MenuItem, {
103
+ asChild: true,
104
+ disabled,
105
+ onSelect
106
+ }, /* @__PURE__ */ import_react2.default.createElement("button", {
107
+ ref,
108
+ ...props
109
+ }, children))
110
+ );
111
+ var Menu = ({ children, side, className, trigger = /* @__PURE__ */ import_react2.default.createElement(DefaultMenuTrigger, null) }) => {
112
+ return /* @__PURE__ */ import_react2.default.createElement(RadixMenu2.Root, null, trigger, /* @__PURE__ */ import_react2.default.createElement(RadixMenu2.Portal, null, /* @__PURE__ */ import_react2.default.createElement(MenuContent, {
113
+ className: (0, import_classnames2.default)(className, "is-flex is-flex-direction-column has-rounded-border has-box-shadow"),
114
+ side,
115
+ sideOffset: 4,
116
+ collisionPadding: 4
117
+ }, children)));
118
+ };
119
+ var Menu_default = Menu;
120
+
121
+ // src/tooltip/Tooltip.tsx
122
+ var import_react3 = __toESM(require("react"));
123
+ var RadixTooltip = __toESM(require("@radix-ui/react-tooltip"));
124
+ var import_classnames3 = __toESM(require("classnames"));
125
+ var import_styled_components2 = __toESM(require("styled-components"));
126
+ var StyledContent = (0, import_styled_components2.default)(RadixTooltip.Content)`
39
127
  overflow: hidden;
40
128
  hyphens: auto;
41
129
  text-overflow: clip;
@@ -44,13 +132,13 @@ var StyledContent = (0, import_styled_components.default)(RadixTooltip.Content)`
44
132
  word-break: keep-all;
45
133
  z-index: 1020;
46
134
  `;
47
- var StyledArrow = (0, import_styled_components.default)(RadixTooltip.Arrow)`
135
+ var StyledArrow = (0, import_styled_components2.default)(RadixTooltip.Arrow)`
48
136
  z-index: 1020;
49
137
  `;
50
- var Tooltip = import_react.default.forwardRef(({ children, className, message, side }, ref) => /* @__PURE__ */ import_react.default.createElement(RadixTooltip.Provider, null, /* @__PURE__ */ import_react.default.createElement(RadixTooltip.Root, null, /* @__PURE__ */ import_react.default.createElement(RadixTooltip.Trigger, {
138
+ var Tooltip = import_react3.default.forwardRef(({ children, className, message, side }, ref) => /* @__PURE__ */ import_react3.default.createElement(RadixTooltip.Provider, null, /* @__PURE__ */ import_react3.default.createElement(RadixTooltip.Root, null, /* @__PURE__ */ import_react3.default.createElement(RadixTooltip.Trigger, {
51
139
  asChild: true
52
- }, children), /* @__PURE__ */ import_react.default.createElement(RadixTooltip.Portal, null, /* @__PURE__ */ import_react.default.createElement(StyledContent, {
53
- className: (0, import_classnames.default)(
140
+ }, children), /* @__PURE__ */ import_react3.default.createElement(RadixTooltip.Portal, null, /* @__PURE__ */ import_react3.default.createElement(StyledContent, {
141
+ className: (0, import_classnames3.default)(
54
142
  "is-size-7",
55
143
  "is-family-primary",
56
144
  "has-rounded-border",
@@ -61,13 +149,24 @@ var Tooltip = import_react.default.forwardRef(({ children, className, message, s
61
149
  className
62
150
  ),
63
151
  side,
64
- sideOffset: 5,
152
+ sideOffset: 4,
153
+ collisionPadding: 4,
65
154
  ref
66
- }, message, /* @__PURE__ */ import_react.default.createElement(StyledArrow, {
155
+ }, message, /* @__PURE__ */ import_react3.default.createElement(StyledArrow, {
67
156
  className: "tooltip-arrow-fill-color"
68
157
  }))))));
69
158
  var Tooltip_default = Tooltip;
159
+
160
+ // src/index.ts
161
+ var Menu2 = Object.assign(Menu_default, {
162
+ Button: MenuButton,
163
+ Link: MenuLink,
164
+ ExternalLink: MenuExternalLink,
165
+ Trigger: MenuTrigger_default,
166
+ DefaultTrigger: DefaultMenuTrigger
167
+ });
70
168
  // Annotate the CommonJS export names for ESM import in node:
71
169
  0 && (module.exports = {
170
+ Menu,
72
171
  Tooltip
73
172
  });
package/build/index.mjs CHANGED
@@ -1,9 +1,96 @@
1
- // src/tooltip/Tooltip.tsx
1
+ // src/menu/Menu.tsx
2
+ import React2 from "react";
3
+ import * as RadixMenu2 from "@radix-ui/react-dropdown-menu";
4
+ import styled from "styled-components";
5
+
6
+ // src/menu/MenuTrigger.tsx
2
7
  import React from "react";
3
- import * as RadixTooltip from "@radix-ui/react-tooltip";
8
+ import { Button, Icon } from "@scm-manager/ui-buttons";
9
+ import * as RadixMenu from "@radix-ui/react-dropdown-menu";
10
+ import { useTranslation } from "react-i18next";
4
11
  import classNames from "classnames";
5
- import styled from "styled-components";
6
- var StyledContent = styled(RadixTooltip.Content)`
12
+ var MenuTrigger = React.forwardRef(({ children, ...props }, ref) => /* @__PURE__ */ React.createElement(RadixMenu.Trigger, {
13
+ asChild: true
14
+ }, /* @__PURE__ */ React.createElement(Button, {
15
+ ref,
16
+ ...props
17
+ }, children)));
18
+ var DefaultMenuTrigger = React.forwardRef(({ className, ...props }, ref) => {
19
+ const [t] = useTranslation("commons");
20
+ return /* @__PURE__ */ React.createElement(MenuTrigger, {
21
+ "aria-label": t("menu.defaultTriggerLabel"),
22
+ className: classNames(className, "is-borderless has-background-transparent has-hover-color-blue px-2"),
23
+ ref,
24
+ ...props
25
+ }, /* @__PURE__ */ React.createElement(Icon, null, "ellipsis-v"));
26
+ });
27
+ var MenuTrigger_default = MenuTrigger;
28
+
29
+ // src/menu/Menu.tsx
30
+ import classNames2 from "classnames";
31
+ import { Link as ReactRouterLink } from "react-router-dom";
32
+ var MenuContent = styled(RadixMenu2.Content)`
33
+ border: var(--scm-border);
34
+ background-color: var(--scm-secondary-background);
35
+ `;
36
+ var MenuItem = styled(RadixMenu2.Item).attrs({
37
+ className: "is-flex is-align-items-center px-3 py-2 has-text-inherit is-clickable is-size-6 has-hover-color-blue is-borderless has-background-transparent has-rounded-border"
38
+ })`
39
+ line-height: inherit;
40
+ :focus {
41
+ outline: #af3ee7 3px solid;
42
+ outline-offset: 0px;
43
+ }
44
+ &[data-disabled] {
45
+ color: unset !important;
46
+ opacity: 40%;
47
+ cursor: unset !important;
48
+ }
49
+ `;
50
+ var MenuLink = React2.forwardRef(({ children, disabled, ...props }, ref) => /* @__PURE__ */ React2.createElement(MenuItem, {
51
+ asChild: true,
52
+ disabled
53
+ }, /* @__PURE__ */ React2.createElement(ReactRouterLink, {
54
+ ref,
55
+ ...props
56
+ }, children)));
57
+ var MenuExternalLink = React2.forwardRef(
58
+ ({ children, disabled, ...props }, ref) => /* @__PURE__ */ React2.createElement(MenuItem, {
59
+ asChild: true,
60
+ disabled
61
+ }, /* @__PURE__ */ React2.createElement("a", {
62
+ ref,
63
+ target: "_blank",
64
+ rel: "noopener noreferrer",
65
+ ...props
66
+ }, children))
67
+ );
68
+ var MenuButton = React2.forwardRef(
69
+ ({ children, onSelect, disabled, ...props }, ref) => /* @__PURE__ */ React2.createElement(MenuItem, {
70
+ asChild: true,
71
+ disabled,
72
+ onSelect
73
+ }, /* @__PURE__ */ React2.createElement("button", {
74
+ ref,
75
+ ...props
76
+ }, children))
77
+ );
78
+ var Menu = ({ children, side, className, trigger = /* @__PURE__ */ React2.createElement(DefaultMenuTrigger, null) }) => {
79
+ return /* @__PURE__ */ React2.createElement(RadixMenu2.Root, null, trigger, /* @__PURE__ */ React2.createElement(RadixMenu2.Portal, null, /* @__PURE__ */ React2.createElement(MenuContent, {
80
+ className: classNames2(className, "is-flex is-flex-direction-column has-rounded-border has-box-shadow"),
81
+ side,
82
+ sideOffset: 4,
83
+ collisionPadding: 4
84
+ }, children)));
85
+ };
86
+ var Menu_default = Menu;
87
+
88
+ // src/tooltip/Tooltip.tsx
89
+ import React3 from "react";
90
+ import * as RadixTooltip from "@radix-ui/react-tooltip";
91
+ import classNames3 from "classnames";
92
+ import styled2 from "styled-components";
93
+ var StyledContent = styled2(RadixTooltip.Content)`
7
94
  overflow: hidden;
8
95
  hyphens: auto;
9
96
  text-overflow: clip;
@@ -12,13 +99,13 @@ var StyledContent = styled(RadixTooltip.Content)`
12
99
  word-break: keep-all;
13
100
  z-index: 1020;
14
101
  `;
15
- var StyledArrow = styled(RadixTooltip.Arrow)`
102
+ var StyledArrow = styled2(RadixTooltip.Arrow)`
16
103
  z-index: 1020;
17
104
  `;
18
- var Tooltip = React.forwardRef(({ children, className, message, side }, ref) => /* @__PURE__ */ React.createElement(RadixTooltip.Provider, null, /* @__PURE__ */ React.createElement(RadixTooltip.Root, null, /* @__PURE__ */ React.createElement(RadixTooltip.Trigger, {
105
+ var Tooltip = React3.forwardRef(({ children, className, message, side }, ref) => /* @__PURE__ */ React3.createElement(RadixTooltip.Provider, null, /* @__PURE__ */ React3.createElement(RadixTooltip.Root, null, /* @__PURE__ */ React3.createElement(RadixTooltip.Trigger, {
19
106
  asChild: true
20
- }, children), /* @__PURE__ */ React.createElement(RadixTooltip.Portal, null, /* @__PURE__ */ React.createElement(StyledContent, {
21
- className: classNames(
107
+ }, children), /* @__PURE__ */ React3.createElement(RadixTooltip.Portal, null, /* @__PURE__ */ React3.createElement(StyledContent, {
108
+ className: classNames3(
22
109
  "is-size-7",
23
110
  "is-family-primary",
24
111
  "has-rounded-border",
@@ -29,12 +116,23 @@ var Tooltip = React.forwardRef(({ children, className, message, side }, ref) =>
29
116
  className
30
117
  ),
31
118
  side,
32
- sideOffset: 5,
119
+ sideOffset: 4,
120
+ collisionPadding: 4,
33
121
  ref
34
- }, message, /* @__PURE__ */ React.createElement(StyledArrow, {
122
+ }, message, /* @__PURE__ */ React3.createElement(StyledArrow, {
35
123
  className: "tooltip-arrow-fill-color"
36
124
  }))))));
37
125
  var Tooltip_default = Tooltip;
126
+
127
+ // src/index.ts
128
+ var Menu2 = Object.assign(Menu_default, {
129
+ Button: MenuButton,
130
+ Link: MenuLink,
131
+ ExternalLink: MenuExternalLink,
132
+ Trigger: MenuTrigger_default,
133
+ DefaultTrigger: DefaultMenuTrigger
134
+ });
38
135
  export {
136
+ Menu2 as Menu,
39
137
  Tooltip_default as Tooltip
40
138
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scm-manager/ui-overlays",
3
3
  "private": false,
4
- "version": "2.43.1",
4
+ "version": "2.43.2-20230419-125637",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
7
7
  "module": "build/index.mjs",
@@ -16,7 +16,7 @@
16
16
  "@scm-manager/eslint-config": "^2.16.0",
17
17
  "@scm-manager/prettier-config": "^2.10.1",
18
18
  "@scm-manager/tsconfig": "^2.13.0",
19
- "@scm-manager/ui-styles": "2.43.1",
19
+ "@scm-manager/ui-styles": "2.43.2-20230419-125637",
20
20
  "@storybook/addon-actions": "^6.5.10",
21
21
  "@storybook/addon-essentials": "^6.5.10",
22
22
  "@storybook/addon-interactions": "^6.5.10",
@@ -32,12 +32,17 @@
32
32
  "tsup": "^6.2.3"
33
33
  },
34
34
  "peerDependencies": {
35
- "classnames": "^2.3.1",
36
35
  "react": "17",
37
- "styled-components": "^5.3.6"
36
+ "react-dom": "17",
37
+ "react-router-dom": "5",
38
+ "classnames": "2",
39
+ "styled-components": "5",
40
+ "react-i18next": "11"
38
41
  },
39
42
  "dependencies": {
40
- "@radix-ui/react-tooltip": "1.0.2"
43
+ "@radix-ui/react-tooltip": "1.0.2",
44
+ "@radix-ui/react-dropdown-menu": "2.0.4",
45
+ "@scm-manager/ui-buttons": "2.43.2-20230419-125637"
41
46
  },
42
47
  "prettier": "@scm-manager/prettier-config",
43
48
  "eslintConfig": {
package/src/index.ts CHANGED
@@ -22,4 +22,15 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ import MenuComponent, { MenuButton, MenuExternalLink, MenuLink } from "./menu/Menu";
26
+ import MenuTrigger, { DefaultMenuTrigger } from "./menu/MenuTrigger";
27
+
25
28
  export { default as Tooltip } from "./tooltip/Tooltip";
29
+
30
+ export const Menu = Object.assign(MenuComponent, {
31
+ Button: MenuButton,
32
+ Link: MenuLink,
33
+ ExternalLink: MenuExternalLink,
34
+ Trigger: MenuTrigger,
35
+ DefaultTrigger: DefaultMenuTrigger,
36
+ });
@@ -0,0 +1,58 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2020-present Cloudogu GmbH and Contributors
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import StoryRouter from "storybook-react-router";
26
+ import { ComponentMeta, StoryFn } from "@storybook/react";
27
+ import React, { ComponentProps } from "react";
28
+ import { ExtractProps } from "@scm-manager/ui-extensions";
29
+ import Menu, { MenuButton, MenuExternalLink, MenuLink } from "./Menu";
30
+ import { Icon } from "@scm-manager/ui-buttons";
31
+
32
+ export default {
33
+ title: "Menu",
34
+ component: Menu,
35
+ decorators: [StoryRouter()],
36
+ } as ComponentMeta<typeof Menu>;
37
+
38
+ const Template: StoryFn<ExtractProps<typeof Menu>> = (args) => <Menu {...args} />;
39
+
40
+ export const Default = Template.bind({});
41
+ // More on args: https://storybook.js.org/docs/react/writing-stories/args
42
+ Default.args = {
43
+ children: [
44
+ // eslint-disable-next-line no-console
45
+ <MenuButton onSelect={() => console.log("A button has been clicked")}>
46
+ <Icon />A button
47
+ </MenuButton>,
48
+ <MenuLink to="/repos">
49
+ <Icon />A link
50
+ </MenuLink>,
51
+ <MenuExternalLink href="https://scm-manager.org">
52
+ <Icon>link</Icon>An external link
53
+ </MenuExternalLink>,
54
+ <MenuButton disabled>
55
+ <Icon>trash</Icon>A disabled button
56
+ </MenuButton>,
57
+ ],
58
+ } as ComponentProps<typeof Menu>;
@@ -0,0 +1,137 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2020-present Cloudogu GmbH and Contributors
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import React, { AnchorHTMLAttributes, ButtonHTMLAttributes, FC } from "react";
26
+ import * as RadixMenu from "@radix-ui/react-dropdown-menu";
27
+ import styled from "styled-components";
28
+ import { DefaultMenuTrigger } from "./MenuTrigger";
29
+ import classNames from "classnames";
30
+ import { Link as ReactRouterLink, LinkProps as ReactRouterLinkProps } from "react-router-dom";
31
+
32
+ const MenuContent = styled(RadixMenu.Content)`
33
+ border: var(--scm-border);
34
+ background-color: var(--scm-secondary-background);
35
+ `;
36
+
37
+ const MenuItem = styled(RadixMenu.Item).attrs({
38
+ className:
39
+ "is-flex is-align-items-center px-3 py-2 has-text-inherit is-clickable is-size-6 has-hover-color-blue is-borderless has-background-transparent has-rounded-border",
40
+ })`
41
+ line-height: inherit;
42
+ :focus {
43
+ outline: #af3ee7 3px solid;
44
+ outline-offset: 0px;
45
+ }
46
+ &[data-disabled] {
47
+ color: unset !important;
48
+ opacity: 40%;
49
+ cursor: unset !important;
50
+ }
51
+ `;
52
+
53
+ type MenuLinkProps = Omit<ReactRouterLinkProps, "onSelect"> & Pick<RadixMenu.MenuItemProps, "disabled">;
54
+
55
+ /**
56
+ * @beta
57
+ * @since 2.44.0
58
+ */
59
+ export const MenuLink = React.forwardRef<HTMLAnchorElement, MenuLinkProps>(({ children, disabled, ...props }, ref) => (
60
+ <MenuItem asChild disabled={disabled}>
61
+ <ReactRouterLink ref={ref} {...props}>
62
+ {children}
63
+ </ReactRouterLink>
64
+ </MenuItem>
65
+ ));
66
+
67
+ type MenuExternalLinkProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "onSelect"> &
68
+ Pick<RadixMenu.MenuItemProps, "disabled">;
69
+
70
+ /**
71
+ * External links open in a new browser tab with rel flags "noopener" and "noreferrer" set by default.
72
+ *
73
+ * @beta
74
+ * @since 2.44.0
75
+ */
76
+ export const MenuExternalLink = React.forwardRef<HTMLAnchorElement, MenuExternalLinkProps>(
77
+ ({ children, disabled, ...props }, ref) => (
78
+ <MenuItem asChild disabled={disabled}>
79
+ <a ref={ref} target="_blank" rel="noopener noreferrer" {...props}>
80
+ {children}
81
+ </a>
82
+ </MenuItem>
83
+ )
84
+ );
85
+
86
+ type MenuButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onClick" | "onSelect"> &
87
+ Pick<RadixMenu.MenuItemProps, "onSelect">;
88
+
89
+ /**
90
+ * Use {@link MenuButtonProps#onSelect} to handle menu item selection.
91
+ * The menu will close by default. This behavior can be overwritten by calling {@link Event.preventDefault} on the event.
92
+ *
93
+ * @beta
94
+ * @since 2.44.0
95
+ */
96
+ export const MenuButton = React.forwardRef<HTMLButtonElement, MenuButtonProps>(
97
+ ({ children, onSelect, disabled, ...props }, ref) => (
98
+ <MenuItem asChild disabled={disabled} onSelect={onSelect}>
99
+ <button ref={ref} {...props}>
100
+ {children}
101
+ </button>
102
+ </MenuItem>
103
+ )
104
+ );
105
+
106
+ type Props = {
107
+ className?: string;
108
+ trigger?: React.ReactElement;
109
+ } & Pick<RadixMenu.DropdownMenuContentProps, "side">;
110
+
111
+ /**
112
+ * A menu consists of a trigger button (vertical ellipsis icon button by default)
113
+ * and a dropdown container containing individual menu items.
114
+ *
115
+ * @beta
116
+ * @since 2.44.0
117
+ * @see https://www.w3.org/WAI/ARIA/apg/patterns/menubar/
118
+ */
119
+ const Menu: FC<Props> = ({ children, side, className, trigger = <DefaultMenuTrigger /> }) => {
120
+ return (
121
+ <RadixMenu.Root>
122
+ {trigger}
123
+ <RadixMenu.Portal>
124
+ <MenuContent
125
+ className={classNames(className, "is-flex is-flex-direction-column has-rounded-border has-box-shadow")}
126
+ side={side}
127
+ sideOffset={4}
128
+ collisionPadding={4}
129
+ >
130
+ {children}
131
+ </MenuContent>
132
+ </RadixMenu.Portal>
133
+ </RadixMenu.Root>
134
+ );
135
+ };
136
+
137
+ export default Menu;
@@ -0,0 +1,63 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2020-present Cloudogu GmbH and Contributors
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import React, { ComponentProps } from "react";
26
+ import { Button, Icon } from "@scm-manager/ui-buttons";
27
+ import * as RadixMenu from "@radix-ui/react-dropdown-menu";
28
+ import { useTranslation } from "react-i18next";
29
+ import classNames from "classnames";
30
+
31
+ type Props = ComponentProps<typeof Button>;
32
+
33
+ /**
34
+ * @beta
35
+ * @since 2.44.0
36
+ */
37
+ const MenuTrigger = React.forwardRef<HTMLButtonElement, Props>(({ children, ...props }, ref) => (
38
+ <RadixMenu.Trigger asChild>
39
+ <Button ref={ref} {...props}>
40
+ {children}
41
+ </Button>
42
+ </RadixMenu.Trigger>
43
+ ));
44
+
45
+ /**
46
+ * @beta
47
+ * @since 2.44.0
48
+ */
49
+ export const DefaultMenuTrigger = React.forwardRef<HTMLButtonElement, Props>(({ className, ...props }, ref) => {
50
+ const [t] = useTranslation("commons");
51
+ return (
52
+ <MenuTrigger
53
+ aria-label={t("menu.defaultTriggerLabel")}
54
+ className={classNames(className, "is-borderless has-background-transparent has-hover-color-blue px-2")}
55
+ ref={ref}
56
+ {...props}
57
+ >
58
+ <Icon>ellipsis-v</Icon>
59
+ </MenuTrigger>
60
+ );
61
+ });
62
+
63
+ export default MenuTrigger;
@@ -82,7 +82,8 @@ const Tooltip = React.forwardRef<HTMLDivElement, Props>(({ children, className,
82
82
  className
83
83
  )}
84
84
  side={side}
85
- sideOffset={5}
85
+ sideOffset={4}
86
+ collisionPadding={4}
86
87
  ref={ref}
87
88
  >
88
89
  {message}