@mirohq/design-system-icon-button 1.0.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.
package/dist/main.js ADDED
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var designSystemTooltip = require('@mirohq/design-system-tooltip');
7
+ var designSystemBadge = require('@mirohq/design-system-badge');
8
+ var baseButton = require('@mirohq/design-system-components/internal/base-button');
9
+
10
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
+
12
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
13
+
14
+ const IconButton = React__default["default"].forwardRef(
15
+ ({
16
+ children,
17
+ showBadge = false,
18
+ badgeContent,
19
+ label,
20
+ onPress,
21
+ onClick,
22
+ tooltipDelayDuration,
23
+ tooltipSkipDelayDuration,
24
+ tooltipAlign = "center",
25
+ tooltipSide = "bottom",
26
+ variant = "ghost",
27
+ size = "large",
28
+ ...restProps
29
+ }, forwardRef) => /* @__PURE__ */ React__default["default"].createElement(designSystemTooltip.Tooltip, {
30
+ delayDuration: tooltipDelayDuration,
31
+ skipDelayDuration: tooltipSkipDelayDuration
32
+ }, /* @__PURE__ */ React__default["default"].createElement(designSystemTooltip.Tooltip.Trigger, {
33
+ asChild: true
34
+ }, /* @__PURE__ */ React__default["default"].createElement(baseButton.BaseButton, {
35
+ ...restProps,
36
+ variant,
37
+ size,
38
+ ref: forwardRef
39
+ }, /* @__PURE__ */ React__default["default"].createElement(designSystemBadge.Badge, {
40
+ show: showBadge,
41
+ content: badgeContent
42
+ }, children))), /* @__PURE__ */ React__default["default"].createElement(designSystemTooltip.Tooltip.Content, {
43
+ align: tooltipAlign,
44
+ side: tooltipSide,
45
+ hideWhenDetached: true
46
+ }, label))
47
+ );
48
+
49
+ exports.IconButton = IconButton;
50
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sources":["../src/icon-button.tsx"],"sourcesContent":["import React from 'react'\nimport type { TooltipContentProps } from '@mirohq/design-system-tooltip'\nimport { Tooltip } from '@mirohq/design-system-tooltip'\nimport { Badge } from '@mirohq/design-system-badge'\nimport type { BaseButtonProps } from '@mirohq/design-system-components/internal/base-button'\nimport { BaseButton } from '@mirohq/design-system-components/internal/base-button'\nimport type { ElementRef } from 'react'\n\nexport interface IconButtonProps extends BaseButtonProps {\n /**\n * Icon button label used to provide a description.\n */\n label: string\n\n /**\n * The duration of a the delay before a tooltip is shown.\n */\n tooltipDelayDuration?: number\n\n /**\n * \tHow much time a user has to enter another trigger without incurring a\n * \tdelay again.\n */\n tooltipSkipDelayDuration?: number\n\n /**\n * The preferred side of the trigger to render against when open. Will be\n * reversed when collisions occur and avoidCollisions is enabled.\n */\n tooltipSide?: TooltipContentProps['side']\n\n /**\n * The preferred alignment against the trigger. May change when collisions\n * occur.\n */\n tooltipAlign?: TooltipContentProps['align']\n\n /**\n * Wraps the Icon button with a badge.\n */\n showBadge?: boolean\n\n /**\n * The content to be displayed inside of the badge.\n */\n badgeContent?: string\n}\n\nexport const IconButton = React.forwardRef<\n ElementRef<typeof BaseButton>,\n IconButtonProps\n>(\n (\n {\n children,\n showBadge = false,\n badgeContent,\n label,\n onPress,\n onClick,\n tooltipDelayDuration,\n tooltipSkipDelayDuration,\n tooltipAlign = 'center',\n tooltipSide = 'bottom',\n variant = 'ghost',\n size = 'large',\n ...restProps\n },\n forwardRef\n ) => (\n <Tooltip\n delayDuration={tooltipDelayDuration}\n skipDelayDuration={tooltipSkipDelayDuration}\n >\n <Tooltip.Trigger asChild>\n <BaseButton\n {...restProps}\n variant={variant}\n size={size}\n ref={forwardRef}\n >\n <Badge show={showBadge} content={badgeContent}>\n {children}\n </Badge>\n </BaseButton>\n </Tooltip.Trigger>\n <Tooltip.Content align={tooltipAlign} side={tooltipSide} hideWhenDetached>\n {label}\n </Tooltip.Content>\n </Tooltip>\n )\n)\n"],"names":["React","Tooltip","BaseButton","Badge"],"mappings":";;;;;;;;;;;;;AAgDO,MAAM,aAAaA,yBAAM,CAAA,UAAA;AAAA,EAI9B,CACE;AAAA,IACE,QAAA;AAAA,IACA,SAAY,GAAA,KAAA;AAAA,IACZ,YAAA;AAAA,IACA,KAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,oBAAA;AAAA,IACA,wBAAA;AAAA,IACA,YAAe,GAAA,QAAA;AAAA,IACf,WAAc,GAAA,QAAA;AAAA,IACd,OAAU,GAAA,OAAA;AAAA,IACV,IAAO,GAAA,OAAA;AAAA,IACJ,GAAA,SAAA;AAAA,GACL,EACA,+BAECA,yBAAA,CAAA,aAAA,CAAAC,2BAAA,EAAA;AAAA,IACC,aAAe,EAAA,oBAAA;AAAA,IACf,iBAAmB,EAAA,wBAAA;AAAA,GAEnB,kBAAAD,yBAAA,CAAA,aAAA,CAACC,4BAAQ,OAAR,EAAA;AAAA,IAAgB,OAAO,EAAA,IAAA;AAAA,GAAA,kBACrBD,yBAAA,CAAA,aAAA,CAAAE,qBAAA,EAAA;AAAA,IACE,GAAG,SAAA;AAAA,IACJ,OAAA;AAAA,IACA,IAAA;AAAA,IACA,GAAK,EAAA,UAAA;AAAA,GAAA,kBAEJF,yBAAA,CAAA,aAAA,CAAAG,uBAAA,EAAA;AAAA,IAAM,IAAM,EAAA,SAAA;AAAA,IAAW,OAAS,EAAA,YAAA;AAAA,GAAA,EAC9B,QACH,CACF,CACF,CACA,kBAAAH,yBAAA,CAAA,aAAA,CAACC,4BAAQ,OAAR,EAAA;AAAA,IAAgB,KAAO,EAAA,YAAA;AAAA,IAAc,IAAM,EAAA,WAAA;AAAA,IAAa,gBAAgB,EAAA,IAAA;AAAA,GAAA,EACtE,KACH,CACF,CAAA;AAEJ;;;;"}
package/dist/module.js ADDED
@@ -0,0 +1,42 @@
1
+ import React from 'react';
2
+ import { Tooltip } from '@mirohq/design-system-tooltip';
3
+ import { Badge } from '@mirohq/design-system-badge';
4
+ import { BaseButton } from '@mirohq/design-system-components/internal/base-button';
5
+
6
+ const IconButton = React.forwardRef(
7
+ ({
8
+ children,
9
+ showBadge = false,
10
+ badgeContent,
11
+ label,
12
+ onPress,
13
+ onClick,
14
+ tooltipDelayDuration,
15
+ tooltipSkipDelayDuration,
16
+ tooltipAlign = "center",
17
+ tooltipSide = "bottom",
18
+ variant = "ghost",
19
+ size = "large",
20
+ ...restProps
21
+ }, forwardRef) => /* @__PURE__ */ React.createElement(Tooltip, {
22
+ delayDuration: tooltipDelayDuration,
23
+ skipDelayDuration: tooltipSkipDelayDuration
24
+ }, /* @__PURE__ */ React.createElement(Tooltip.Trigger, {
25
+ asChild: true
26
+ }, /* @__PURE__ */ React.createElement(BaseButton, {
27
+ ...restProps,
28
+ variant,
29
+ size,
30
+ ref: forwardRef
31
+ }, /* @__PURE__ */ React.createElement(Badge, {
32
+ show: showBadge,
33
+ content: badgeContent
34
+ }, children))), /* @__PURE__ */ React.createElement(Tooltip.Content, {
35
+ align: tooltipAlign,
36
+ side: tooltipSide,
37
+ hideWhenDetached: true
38
+ }, label))
39
+ );
40
+
41
+ export { IconButton };
42
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sources":["../src/icon-button.tsx"],"sourcesContent":["import React from 'react'\nimport type { TooltipContentProps } from '@mirohq/design-system-tooltip'\nimport { Tooltip } from '@mirohq/design-system-tooltip'\nimport { Badge } from '@mirohq/design-system-badge'\nimport type { BaseButtonProps } from '@mirohq/design-system-components/internal/base-button'\nimport { BaseButton } from '@mirohq/design-system-components/internal/base-button'\nimport type { ElementRef } from 'react'\n\nexport interface IconButtonProps extends BaseButtonProps {\n /**\n * Icon button label used to provide a description.\n */\n label: string\n\n /**\n * The duration of a the delay before a tooltip is shown.\n */\n tooltipDelayDuration?: number\n\n /**\n * \tHow much time a user has to enter another trigger without incurring a\n * \tdelay again.\n */\n tooltipSkipDelayDuration?: number\n\n /**\n * The preferred side of the trigger to render against when open. Will be\n * reversed when collisions occur and avoidCollisions is enabled.\n */\n tooltipSide?: TooltipContentProps['side']\n\n /**\n * The preferred alignment against the trigger. May change when collisions\n * occur.\n */\n tooltipAlign?: TooltipContentProps['align']\n\n /**\n * Wraps the Icon button with a badge.\n */\n showBadge?: boolean\n\n /**\n * The content to be displayed inside of the badge.\n */\n badgeContent?: string\n}\n\nexport const IconButton = React.forwardRef<\n ElementRef<typeof BaseButton>,\n IconButtonProps\n>(\n (\n {\n children,\n showBadge = false,\n badgeContent,\n label,\n onPress,\n onClick,\n tooltipDelayDuration,\n tooltipSkipDelayDuration,\n tooltipAlign = 'center',\n tooltipSide = 'bottom',\n variant = 'ghost',\n size = 'large',\n ...restProps\n },\n forwardRef\n ) => (\n <Tooltip\n delayDuration={tooltipDelayDuration}\n skipDelayDuration={tooltipSkipDelayDuration}\n >\n <Tooltip.Trigger asChild>\n <BaseButton\n {...restProps}\n variant={variant}\n size={size}\n ref={forwardRef}\n >\n <Badge show={showBadge} content={badgeContent}>\n {children}\n </Badge>\n </BaseButton>\n </Tooltip.Trigger>\n <Tooltip.Content align={tooltipAlign} side={tooltipSide} hideWhenDetached>\n {label}\n </Tooltip.Content>\n </Tooltip>\n )\n)\n"],"names":[],"mappings":";;;;;AAgDO,MAAM,aAAa,KAAM,CAAA,UAAA;AAAA,EAI9B,CACE;AAAA,IACE,QAAA;AAAA,IACA,SAAY,GAAA,KAAA;AAAA,IACZ,YAAA;AAAA,IACA,KAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,oBAAA;AAAA,IACA,wBAAA;AAAA,IACA,YAAe,GAAA,QAAA;AAAA,IACf,WAAc,GAAA,QAAA;AAAA,IACd,OAAU,GAAA,OAAA;AAAA,IACV,IAAO,GAAA,OAAA;AAAA,IACJ,GAAA,SAAA;AAAA,GACL,EACA,+BAEC,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA;AAAA,IACC,aAAe,EAAA,oBAAA;AAAA,IACf,iBAAmB,EAAA,wBAAA;AAAA,GAEnB,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAQ,OAAR,EAAA;AAAA,IAAgB,OAAO,EAAA,IAAA;AAAA,GAAA,kBACrB,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA;AAAA,IACE,GAAG,SAAA;AAAA,IACJ,OAAA;AAAA,IACA,IAAA;AAAA,IACA,GAAK,EAAA,UAAA;AAAA,GAAA,kBAEJ,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,IAAM,IAAM,EAAA,SAAA;AAAA,IAAW,OAAS,EAAA,YAAA;AAAA,GAAA,EAC9B,QACH,CACF,CACF,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAQ,OAAR,EAAA;AAAA,IAAgB,KAAO,EAAA,YAAA;AAAA,IAAc,IAAM,EAAA,WAAA;AAAA,IAAa,gBAAgB,EAAA,IAAA;AAAA,GAAA,EACtE,KACH,CACF,CAAA;AAEJ;;;;"}
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { TooltipContentProps } from '@mirohq/design-system-tooltip';
3
+ import { BaseButtonProps } from '@mirohq/design-system-components/internal/base-button';
4
+
5
+ interface IconButtonProps extends BaseButtonProps {
6
+ /**
7
+ * Icon button label used to provide a description.
8
+ */
9
+ label: string;
10
+ /**
11
+ * The duration of a the delay before a tooltip is shown.
12
+ */
13
+ tooltipDelayDuration?: number;
14
+ /**
15
+ * How much time a user has to enter another trigger without incurring a
16
+ * delay again.
17
+ */
18
+ tooltipSkipDelayDuration?: number;
19
+ /**
20
+ * The preferred side of the trigger to render against when open. Will be
21
+ * reversed when collisions occur and avoidCollisions is enabled.
22
+ */
23
+ tooltipSide?: TooltipContentProps['side'];
24
+ /**
25
+ * The preferred alignment against the trigger. May change when collisions
26
+ * occur.
27
+ */
28
+ tooltipAlign?: TooltipContentProps['align'];
29
+ /**
30
+ * Wraps the Icon button with a badge.
31
+ */
32
+ showBadge?: boolean;
33
+ /**
34
+ * The content to be displayed inside of the badge.
35
+ */
36
+ badgeContent?: string;
37
+ }
38
+ declare const IconButton: React.ForwardRefExoticComponent<Pick<IconButtonProps, "color" | "translate" | "css" | "prefix" | "asChild" | "UNSAFE_style" | "form" | "label" | "slot" | "title" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "href" | "name" | "placeholder" | "rel" | "size" | "target" | "type" | "value" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "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" | "children" | "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" | "key" | "onPress" | "variant" | "onPressStart" | "onPressEnd" | "onPressChange" | "onFocusChange" | "excludeFromTabOrder" | "onHoverStart" | "onHoverEnd" | "onHoverChange" | "showBadge" | "badgeContent" | "tooltipDelayDuration" | "tooltipSkipDelayDuration" | "tooltipAlign" | "tooltipSide"> & React.RefAttributes<HTMLButtonElement>>;
39
+
40
+ export { IconButton, IconButtonProps };
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@mirohq/design-system-icon-button",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "author": "Miro",
6
+ "source": "src/index.ts",
7
+ "main": "dist/main.js",
8
+ "module": "dist/module.js",
9
+ "types": "dist/types.d.ts",
10
+ "sideEffects": false,
11
+ "exports": {
12
+ ".": {
13
+ "require": "./dist/main.js",
14
+ "import": "./dist/module.js",
15
+ "types": "./dist/types.d.ts"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "peerDependencies": {
25
+ "@stitches/react": "^1.2.8",
26
+ "react": "^16.14 || ^17"
27
+ },
28
+ "dependencies": {
29
+ "@mirohq/design-system-badge": "^0.1.0",
30
+ "@mirohq/design-system-base-button": "^0.2.0",
31
+ "@mirohq/design-system-icons": "^0.2.2",
32
+ "@mirohq/design-system-stitches": "^2.0.10",
33
+ "@mirohq/design-system-tooltip": "^3.1.9"
34
+ },
35
+ "devDependencies": {
36
+ "@mirohq/design-system-flex": "^2.0.12"
37
+ },
38
+ "scripts": {
39
+ "build": "rollup -c ../../../rollup.config.js",
40
+ "clean": "rm -rf dist",
41
+ "prebuild": "pnpm clean"
42
+ }
43
+ }