@scm-manager/ui-buttons 2.43.1 → 2.43.2-20230425-175303

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.d.ts CHANGED
@@ -18,25 +18,56 @@ declare type BaseButtonProps = {
18
18
  testId?: string;
19
19
  };
20
20
  /**
21
- * Styled html button
21
+ * Styled html button.
22
+ *
23
+ * A button has to declare an `aria-label` if it exclusively contains an {@link Icon} as its children.
22
24
  *
23
25
  * @beta
24
26
  * @since 2.41.0
25
27
  */
26
28
  declare const Button: React.ForwardRefExoticComponent<BaseButtonProps & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
27
29
  /**
28
- * Styled react router link
30
+ * Styled react router link.
31
+ *
32
+ * A button has to declare an `aria-label` if it exclusively contains an {@link Icon} as its children.
29
33
  *
30
34
  * @beta
31
35
  * @since 2.41.0
32
36
  */
33
37
  declare const LinkButton: React.ForwardRefExoticComponent<BaseButtonProps & LinkProps<unknown> & React.RefAttributes<HTMLAnchorElement>>;
34
38
  /**
35
- * Styled html anchor
39
+ * External links open in a new browser tab with rel flags "noopener" and "noreferrer" set by default.
40
+ *
41
+ * @beta
42
+ * @since 2.44.0
43
+ */
44
+ declare const ExternalLink: React.ForwardRefExoticComponent<React.AnchorHTMLAttributes<HTMLAnchorElement> & React.RefAttributes<HTMLAnchorElement>>;
45
+ /**
46
+ * Styled {@link ExternalLink}.
47
+ *
48
+ * A button has to declare an `aria-label` if it exclusively contains an {@link Icon} as its children.
36
49
  *
37
50
  * @beta
38
51
  * @since 2.41.0
52
+ * @see ExternalLink
39
53
  */
40
54
  declare const ExternalLinkButton: React.ForwardRefExoticComponent<BaseButtonProps & React.AnchorHTMLAttributes<HTMLAnchorElement> & React.RefAttributes<HTMLAnchorElement>>;
41
55
 
42
- export { Button, ButtonVariants, ExternalLinkButton, LinkButton };
56
+ declare type Props = React.HTMLProps<HTMLElement> & {
57
+ children?: string;
58
+ };
59
+ /**
60
+ * Icons are hidden to assistive technologies by default.
61
+ *
62
+ * If your icon does convey a state, unset `aria-hidden` and set an appropriate `aria-label`.
63
+ *
64
+ * The children have to be a single text node containing a valid fontawesome icon name.
65
+ *
66
+ * @beta
67
+ * @since 2.44.0
68
+ * @see https://bulma.io/documentation/elements/icon/
69
+ * @see https://fontawesome.com/search?o=r&m=free
70
+ */
71
+ declare const Icon: React.ForwardRefExoticComponent<Pick<Props, "children" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "default" | "type" | "className" | "key" | "dateTime" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "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" | "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" | "onClick" | "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" | "onSelect" | "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" | "list" | "as" | "name" | "alt" | "src" | "href" | "disabled" | "action" | "download" | "hrefLang" | "media" | "rel" | "target" | "value" | "size" | "open" | "step" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "height" | "max" | "method" | "min" | "width" | "crossOrigin" | "classID" | "useMap" | "wmode" | "coords" | "shape" | "autoPlay" | "controls" | "loop" | "mediaGroup" | "muted" | "playsInline" | "preload" | "acceptCharset" | "autoComplete" | "encType" | "noValidate" | "manifest" | "allowFullScreen" | "allowTransparency" | "frameBorder" | "marginHeight" | "marginWidth" | "sandbox" | "scrolling" | "seamless" | "srcDoc" | "sizes" | "srcSet" | "async" | "accept" | "capture" | "checked" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "challenge" | "keyType" | "keyParams" | "htmlFor" | "integrity" | "charSet" | "content" | "httpEquiv" | "high" | "low" | "optimum" | "reversed" | "start" | "selected" | "defer" | "nonce" | "scoped" | "cellPadding" | "cellSpacing" | "colSpan" | "headers" | "rowSpan" | "scope" | "cols" | "rows" | "wrap" | "kind" | "srcLang" | "poster"> & React.RefAttributes<HTMLElement>>;
72
+
73
+ export { Button, ButtonVariants, ExternalLink, ExternalLinkButton, Icon, LinkButton };
package/build/index.js CHANGED
@@ -28,7 +28,9 @@ var src_exports = {};
28
28
  __export(src_exports, {
29
29
  Button: () => Button,
30
30
  ButtonVariants: () => ButtonVariants,
31
+ ExternalLink: () => ExternalLink,
31
32
  ExternalLinkButton: () => ExternalLinkButton,
33
+ Icon: () => Icon_default,
32
34
  LinkButton: () => LinkButton
33
35
  });
34
36
  module.exports = __toCommonJS(src_exports);
@@ -69,18 +71,47 @@ var LinkButton = import_react.default.forwardRef(
69
71
  ...(0, import_ui_components.createAttributesForTesting)(testId)
70
72
  }, children)
71
73
  );
74
+ var ExternalLink = import_react.default.forwardRef(
75
+ ({ children, ...props }, ref) => /* @__PURE__ */ import_react.default.createElement("a", {
76
+ target: "_blank",
77
+ rel: "noreferrer noopener",
78
+ ...props,
79
+ ref
80
+ }, children)
81
+ );
72
82
  var ExternalLinkButton = import_react.default.forwardRef(
73
- ({ className, variant, isLoading, testId, children, ...props }, ref) => /* @__PURE__ */ import_react.default.createElement("a", {
83
+ ({ className, variant, isLoading, testId, children, ...props }, ref) => /* @__PURE__ */ import_react.default.createElement(ExternalLink, {
74
84
  ...props,
75
85
  className: (0, import_classnames.default)(createButtonClasses(variant, isLoading), className),
76
86
  ref,
77
87
  ...(0, import_ui_components.createAttributesForTesting)(testId)
78
88
  }, children)
79
89
  );
90
+
91
+ // src/Icon.tsx
92
+ var import_react2 = __toESM(require("react"));
93
+ var import_classnames2 = __toESM(require("classnames"));
94
+ var Icon = import_react2.default.forwardRef(({ children, className, ...props }, ref) => {
95
+ return /* @__PURE__ */ import_react2.default.createElement("span", {
96
+ className: (0, import_classnames2.default)(className, "icon"),
97
+ "aria-hidden": "true",
98
+ ...props,
99
+ ref
100
+ }, /* @__PURE__ */ import_react2.default.createElement("i", {
101
+ className: (0, import_classnames2.default)(`fas fa-fw fa-${children}`, {
102
+ "fa-xs": className == null ? void 0 : className.includes("is-small"),
103
+ "fa-lg": className == null ? void 0 : className.includes("is-medium"),
104
+ "fa-2x": className == null ? void 0 : className.includes("is-large")
105
+ })
106
+ }));
107
+ });
108
+ var Icon_default = Icon;
80
109
  // Annotate the CommonJS export names for ESM import in node:
81
110
  0 && (module.exports = {
82
111
  Button,
83
112
  ButtonVariants,
113
+ ExternalLink,
84
114
  ExternalLinkButton,
115
+ Icon,
85
116
  LinkButton
86
117
  });
package/build/index.mjs CHANGED
@@ -34,17 +34,46 @@ var LinkButton = React.forwardRef(
34
34
  ...createAttributesForTesting(testId)
35
35
  }, children)
36
36
  );
37
+ var ExternalLink = React.forwardRef(
38
+ ({ children, ...props }, ref) => /* @__PURE__ */ React.createElement("a", {
39
+ target: "_blank",
40
+ rel: "noreferrer noopener",
41
+ ...props,
42
+ ref
43
+ }, children)
44
+ );
37
45
  var ExternalLinkButton = React.forwardRef(
38
- ({ className, variant, isLoading, testId, children, ...props }, ref) => /* @__PURE__ */ React.createElement("a", {
46
+ ({ className, variant, isLoading, testId, children, ...props }, ref) => /* @__PURE__ */ React.createElement(ExternalLink, {
39
47
  ...props,
40
48
  className: classNames(createButtonClasses(variant, isLoading), className),
41
49
  ref,
42
50
  ...createAttributesForTesting(testId)
43
51
  }, children)
44
52
  );
53
+
54
+ // src/Icon.tsx
55
+ import React2 from "react";
56
+ import classNames2 from "classnames";
57
+ var Icon = React2.forwardRef(({ children, className, ...props }, ref) => {
58
+ return /* @__PURE__ */ React2.createElement("span", {
59
+ className: classNames2(className, "icon"),
60
+ "aria-hidden": "true",
61
+ ...props,
62
+ ref
63
+ }, /* @__PURE__ */ React2.createElement("i", {
64
+ className: classNames2(`fas fa-fw fa-${children}`, {
65
+ "fa-xs": className == null ? void 0 : className.includes("is-small"),
66
+ "fa-lg": className == null ? void 0 : className.includes("is-medium"),
67
+ "fa-2x": className == null ? void 0 : className.includes("is-large")
68
+ })
69
+ }));
70
+ });
71
+ var Icon_default = Icon;
45
72
  export {
46
73
  Button,
47
74
  ButtonVariants,
75
+ ExternalLink,
48
76
  ExternalLinkButton,
77
+ Icon_default as Icon,
49
78
  LinkButton
50
79
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-manager/ui-buttons",
3
- "version": "2.43.1",
3
+ "version": "2.43.2-20230425-175303",
4
4
  "private": false,
5
5
  "main": "build/index.js",
6
6
  "module": "build/index.mjs",
@@ -24,11 +24,11 @@
24
24
  "react-dom": "^17.0.1",
25
25
  "react-router-dom": "^5.3.1",
26
26
  "classnames": "^2.2.6",
27
- "@scm-manager/ui-components": "2.43.1"
27
+ "@scm-manager/ui-components": "2.43.2-20230425-175303"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@scm-manager/prettier-config": "^2.11.1",
31
- "@scm-manager/ui-api": "2.43.1",
31
+ "@scm-manager/ui-api": "2.43.2-20230425-175303",
32
32
  "@scm-manager/eslint-config": "^2.17.0",
33
33
  "@babel/core": "^7.17.8",
34
34
  "@scm-manager/tsconfig": "^2.12.0",