@synerise/ds-tag 1.4.17 → 1.4.18

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/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.4.18](https://github.com/Synerise/synerise-design/compare/@synerise/ds-tag@1.4.17...@synerise/ds-tag@1.4.18) (2026-03-24)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-tag
9
+
6
10
  ## [1.4.17](https://github.com/Synerise/synerise-design/compare/@synerise/ds-tag@1.4.16...@synerise/ds-tag@1.4.17) (2026-03-20)
7
11
 
8
12
  **Note:** Version bump only for package @synerise/ds-tag
package/dist/Tag.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { default as React } from 'react';
2
2
  import { TagShape } from './Tag.types';
3
3
  declare const Tag: React.ForwardRefExoticComponent<{
4
4
  id?: string | number;
@@ -14,9 +14,9 @@ declare const Tag: React.ForwardRefExoticComponent<{
14
14
  onRemove?: (tag: string | number) => void;
15
15
  prefixel?: React.ReactNode;
16
16
  suffixel?: React.ReactNode;
17
- texts?: import("./Tag.types").TagTexts;
17
+ texts?: import('./Tag.types').TagTexts;
18
18
  asPill?: boolean;
19
19
  dashed?: boolean;
20
- tooltipProps?: import("@synerise/ds-tooltip").TooltipProps;
21
- } & Omit<React.HTMLAttributes<HTMLDivElement>, "className" | "id" | "color" | "onClick" | "name" | "textColor" | "image" | "shape" | "removable" | "disabled" | "onRemove" | "prefixel" | "suffixel" | "texts" | "asPill" | "dashed" | "tooltipProps"> & import("@synerise/ds-utils").DataAttributes & React.RefAttributes<HTMLDivElement>>;
20
+ tooltipProps?: import('@synerise/ds-tooltip').TooltipProps;
21
+ } & Omit<React.HTMLAttributes<HTMLDivElement>, "className" | "id" | "color" | "onClick" | "name" | "textColor" | "image" | "shape" | "removable" | "disabled" | "onRemove" | "prefixel" | "suffixel" | "texts" | "asPill" | "dashed" | "tooltipProps"> & import('@synerise/ds-utils').DataAttributes & React.RefAttributes<HTMLDivElement>>;
22
22
  export default Tag;
package/dist/Tag.js CHANGED
@@ -1,110 +1,70 @@
1
- var _excluded = ["id", "name", "className", "disabled", "removable", "image", "shape", "color", "textColor", "onRemove", "onClick", "prefixel", "suffixel", "texts", "asPill", "dashed", "tooltipProps"];
2
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
4
- import React, { forwardRef, useState } from 'react';
5
- import { useTheme } from '@synerise/ds-core';
6
- import Icon, { CloseS } from '@synerise/ds-icon';
7
- import Tooltip from '@synerise/ds-tooltip';
8
- import * as S from './Tag.styles';
9
- import { getColorText } from './Tag.styles';
10
- import { TagShape } from './Tag.types';
11
- import { useDefaultTexts } from './hooks/useDefaultTexts';
12
- var Tag = /*#__PURE__*/forwardRef(function (_ref, ref) {
13
- var id = _ref.id,
14
- name = _ref.name,
15
- className = _ref.className,
16
- disabled = _ref.disabled,
17
- removable = _ref.removable,
18
- image = _ref.image,
19
- _ref$shape = _ref.shape,
20
- shape = _ref$shape === void 0 ? TagShape.DEFAULT_ROUND && TagShape.DEFAULT_SQUARE : _ref$shape,
21
- color = _ref.color,
22
- textColor = _ref.textColor,
23
- onRemove = _ref.onRemove,
24
- onClick = _ref.onClick,
25
- prefixel = _ref.prefixel,
26
- suffixel = _ref.suffixel,
27
- texts = _ref.texts,
28
- asPill = _ref.asPill,
29
- dashed = _ref.dashed,
30
- tooltipProps = _ref.tooltipProps,
31
- htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
32
- var theme = useTheme();
33
- var allTexts = useDefaultTexts(texts);
34
- var isDefaultType = shape && [TagShape.DEFAULT_ROUND, TagShape.DEFAULT_SQUARE].includes(shape);
35
- var isDefaultRound = shape === TagShape.DEFAULT_ROUND;
36
- var isDefaultSquare = shape === TagShape.DEFAULT_SQUARE;
37
- var isStatusShape = shape && [TagShape.STATUS_ERROR, TagShape.STATUS_NEUTRAL, TagShape.STATUS_SUCCESS, TagShape.STATUS_WARNING].includes(shape);
38
- var isRemovable = removable && (isDefaultRound || isDefaultSquare);
39
- var isActionable = !disabled && isRemovable;
40
- var _useState = useState(false),
41
- isIconHovered = _useState[0],
42
- setIsIconHovered = _useState[1];
43
- var onRemoveCall = function onRemoveCall() {
44
- return !!onRemove && !!id && onRemove(id);
45
- };
46
- var renderPrefixel = function renderPrefixel() {
47
- if (typeof prefixel === 'string' || typeof prefixel === 'number') {
48
- return /*#__PURE__*/React.createElement(S.PrefixWrapper, {
49
- iconHover: isIconHovered
50
- }, prefixel);
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useState } from "react";
3
+ import { useTheme } from "@synerise/ds-core";
4
+ import Icon, { CloseS } from "@synerise/ds-icon";
5
+ import Tooltip from "@synerise/ds-tooltip";
6
+ import { Tag as Tag$1, Content, TagName, RemoveButton, getColorText, PrefixWrapper, DefaultPrefixWrapper, SuffixWrapper, DefaultSuffixWrapper } from "./Tag.styles.js";
7
+ import { TagShape } from "./Tag.types.js";
8
+ import { useDefaultTexts } from "./hooks/useDefaultTexts.js";
9
+ const Tag = forwardRef(({
10
+ id,
11
+ name,
12
+ className,
13
+ disabled,
14
+ removable,
15
+ image,
16
+ shape = TagShape.DEFAULT_ROUND && TagShape.DEFAULT_SQUARE,
17
+ color,
18
+ textColor,
19
+ onRemove,
20
+ onClick,
21
+ prefixel,
22
+ suffixel,
23
+ texts,
24
+ asPill,
25
+ dashed,
26
+ tooltipProps,
27
+ ...htmlAttributes
28
+ }, ref) => {
29
+ const theme = useTheme();
30
+ const allTexts = useDefaultTexts(texts);
31
+ const isDefaultType = shape && [TagShape.DEFAULT_ROUND, TagShape.DEFAULT_SQUARE].includes(shape);
32
+ const isDefaultRound = shape === TagShape.DEFAULT_ROUND;
33
+ const isDefaultSquare = shape === TagShape.DEFAULT_SQUARE;
34
+ const isStatusShape = shape && [TagShape.STATUS_ERROR, TagShape.STATUS_NEUTRAL, TagShape.STATUS_SUCCESS, TagShape.STATUS_WARNING].includes(shape);
35
+ const isRemovable = removable && (isDefaultRound || isDefaultSquare);
36
+ const isActionable = !disabled && isRemovable;
37
+ const [isIconHovered, setIsIconHovered] = useState(false);
38
+ const onRemoveCall = () => !!onRemove && !!id && onRemove(id);
39
+ const renderPrefixel = () => {
40
+ if (typeof prefixel === "string" || typeof prefixel === "number") {
41
+ return /* @__PURE__ */ jsx(PrefixWrapper, { iconHover: isIconHovered, children: prefixel });
51
42
  }
52
- return /*#__PURE__*/React.createElement(S.DefaultPrefixWrapper, {
53
- iconHover: isIconHovered
54
- }, prefixel);
43
+ return /* @__PURE__ */ jsx(DefaultPrefixWrapper, { iconHover: isIconHovered, children: prefixel });
55
44
  };
56
- var renderSuffixel = function renderSuffixel() {
57
- if (typeof suffixel === 'string' || typeof suffixel === 'number') {
58
- return /*#__PURE__*/React.createElement(S.SuffixWrapper, null, suffixel);
45
+ const renderSuffixel = () => {
46
+ if (typeof suffixel === "string" || typeof suffixel === "number") {
47
+ return /* @__PURE__ */ jsx(SuffixWrapper, { children: suffixel });
59
48
  }
60
- return /*#__PURE__*/React.createElement(S.DefaultSuffixWrapper, null, suffixel);
49
+ return /* @__PURE__ */ jsx(DefaultSuffixWrapper, { children: suffixel });
61
50
  };
62
- var handleMouseOver = function handleMouseOver(event) {
51
+ const handleMouseOver = (event) => {
63
52
  setIsIconHovered(true);
64
- htmlAttributes.onMouseOver == null || htmlAttributes.onMouseOver(event);
53
+ htmlAttributes.onMouseOver?.(event);
65
54
  };
66
- var handleMouseLeave = function handleMouseLeave(event) {
55
+ const handleMouseLeave = (event) => {
67
56
  setIsIconHovered(false);
68
- htmlAttributes.onMouseLeave == null || htmlAttributes.onMouseLeave(event);
57
+ htmlAttributes.onMouseLeave?.(event);
69
58
  };
70
- var renderedTag = /*#__PURE__*/React.createElement(S.Tag, _extends({
71
- ref: ref,
72
- className: "ds-tag " + (className != null ? className : ''),
73
- isStatusShape: isStatusShape,
74
- shape: shape,
75
- color: color,
76
- textColor: textColor,
77
- removable: removable,
78
- disabled: disabled,
79
- isActionable: isActionable,
80
- onClick: onClick,
81
- "data-testid": typeof id !== 'undefined' ? "tag-" + id : 'tag',
82
- preffixel: !!prefixel,
83
- suffixel: !!suffixel,
84
- hasImage: !!image,
85
- iconHover: isIconHovered,
86
- asPill: asPill,
87
- dashed: dashed
88
- }, htmlAttributes), /*#__PURE__*/React.createElement(S.Content, {
89
- iconHover: isIconHovered
90
- }, image && isDefaultType && /*#__PURE__*/React.createElement("img", {
91
- src: image,
92
- alt: ""
93
- }), !!prefixel && renderPrefixel(), /*#__PURE__*/React.createElement(S.TagName, null, name), !!suffixel && renderSuffixel(), isRemovable && /*#__PURE__*/React.createElement(Tooltip, {
94
- title: allTexts.deleteTooltip,
95
- open: isIconHovered,
96
- zIndex: parseInt(theme.variables['@zindex-tooltip'], 10) + 1
97
- }, /*#__PURE__*/React.createElement(S.RemoveButton, {
98
- onClick: onRemoveCall,
99
- onMouseOver: handleMouseOver,
100
- onMouseLeave: handleMouseLeave,
101
- "data-testid": "remove-btn"
102
- }, /*#__PURE__*/React.createElement(Icon, {
103
- className: "icon",
104
- component: /*#__PURE__*/React.createElement(CloseS, null),
105
- size: 24,
106
- color: getColorText(theme, color)
107
- })))));
108
- return tooltipProps ? /*#__PURE__*/React.createElement(Tooltip, tooltipProps, renderedTag) : renderedTag;
59
+ const renderedTag = /* @__PURE__ */ jsx(Tag$1, { ref, className: `ds-tag ${className ?? ""}`, isStatusShape, shape, color, textColor, removable, disabled, isActionable, onClick, "data-testid": typeof id !== "undefined" ? `tag-${id}` : "tag", preffixel: !!prefixel, suffixel: !!suffixel, hasImage: !!image, iconHover: isIconHovered, asPill, dashed, ...htmlAttributes, children: /* @__PURE__ */ jsxs(Content, { iconHover: isIconHovered, children: [
60
+ image && isDefaultType && /* @__PURE__ */ jsx("img", { src: image, alt: "" }),
61
+ !!prefixel && renderPrefixel(),
62
+ /* @__PURE__ */ jsx(TagName, { children: name }),
63
+ !!suffixel && renderSuffixel(),
64
+ isRemovable && /* @__PURE__ */ jsx(Tooltip, { title: allTexts.deleteTooltip, open: isIconHovered, zIndex: parseInt(theme.variables["@zindex-tooltip"], 10) + 1, children: /* @__PURE__ */ jsx(RemoveButton, { onClick: onRemoveCall, onMouseOver: handleMouseOver, onMouseLeave: handleMouseLeave, "data-testid": "remove-btn", children: /* @__PURE__ */ jsx(Icon, { className: "icon", component: /* @__PURE__ */ jsx(CloseS, {}), size: 24, color: getColorText(theme, color) }) }) })
65
+ ] }) });
66
+ return tooltipProps ? /* @__PURE__ */ jsx(Tooltip, { ...tooltipProps, children: renderedTag }) : renderedTag;
109
67
  });
110
- export default Tag;
68
+ export {
69
+ Tag as default
70
+ };
@@ -1,8 +1,8 @@
1
- import { type ThemeProps, type ThemePropsVars } from '@synerise/ds-core';
1
+ import { ThemeProps, ThemePropsVars } from '@synerise/ds-core';
2
2
  import { TagShape } from './Tag.types';
3
3
  export declare const getColorText: (theme: ThemePropsVars, color?: string) => string;
4
- export declare const TagName: import("styled-components").StyledComponent<"span", any, {}, never>;
5
- export declare const RemoveButton: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const TagName: import('styled-components').StyledComponent<"span", any, {}, never>;
5
+ export declare const RemoveButton: import('styled-components').StyledComponent<"div", any, {}, never>;
6
6
  type TagProps = {
7
7
  isStatusShape?: boolean;
8
8
  shape?: TagShape;
@@ -18,17 +18,17 @@ type TagProps = {
18
18
  asPill?: boolean;
19
19
  dashed?: boolean;
20
20
  } & ThemeProps;
21
- export declare const Content: import("styled-components").StyledComponent<"div", any, {
21
+ export declare const Content: import('styled-components').StyledComponent<"div", any, {
22
22
  iconHover?: boolean;
23
23
  }, never>;
24
- export declare const PrefixWrapper: import("styled-components").StyledComponent<"div", any, {
24
+ export declare const PrefixWrapper: import('styled-components').StyledComponent<"div", any, {
25
25
  iconHover?: boolean;
26
26
  }, never>;
27
- export declare const SuffixWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
28
- export declare const DefaultSuffixWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
29
- export declare const DefaultPrefixWrapper: import("styled-components").StyledComponent<"div", any, {
27
+ export declare const SuffixWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
28
+ export declare const DefaultSuffixWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
29
+ export declare const DefaultPrefixWrapper: import('styled-components').StyledComponent<"div", any, {
30
30
  iconHover?: boolean;
31
31
  }, never>;
32
- export declare const Tag: import("styled-components").StyledComponent<"div", any, TagProps, never>;
33
- export declare const DeleteButton: import("styled-components").StyledComponent<"div", any, {}, never>;
32
+ export declare const Tag: import('styled-components').StyledComponent<"div", any, TagProps, never>;
33
+ export declare const DeleteButton: import('styled-components').StyledComponent<"div", any, {}, never>;
34
34
  export {};
@@ -1,131 +1,139 @@
1
- import styled, { css } from 'styled-components';
2
- import { TagShape } from './Tag.types';
3
- var defaultStatusStyles = css(["border-radius:9px;font-size:10px;height:18px;font-weight:500;line-height:18px;text-transform:uppercase;letter-spacing:0.1px;padding:0 8px;line-height:18px;"]);
4
- export var getColorText = function getColorText(theme, color) {
5
- return color === theme.palette['grey-200'] ? theme.palette['grey-600'] : theme.palette.white;
1
+ import styled, { css } from "styled-components";
2
+ import { TagShape } from "./Tag.types.js";
3
+ const defaultStatusStyles = /* @__PURE__ */ css(["border-radius:9px;font-size:10px;height:18px;font-weight:500;line-height:18px;text-transform:uppercase;letter-spacing:0.1px;padding:0 8px;line-height:18px;"]);
4
+ const getColorText = (theme, color) => {
5
+ return color === theme.palette["grey-200"] ? theme.palette["grey-600"] : theme.palette.white;
6
6
  };
7
- var getWidthOnHover = function getWidthOnHover(props) {
7
+ const getWidthOnHover = (props) => {
8
8
  if (props.suffixel && props.preffixel || props.hasImage) {
9
- return 'calc(100% - 23px)';
9
+ return "calc(100% - 23px)";
10
10
  }
11
11
  if (props.preffixel) {
12
- return 'calc(100% - 35px)';
12
+ return "calc(100% - 35px)";
13
13
  }
14
14
  if (props.suffixel) {
15
- return 'calc(100% - 4px)';
15
+ return "calc(100% - 4px)";
16
16
  }
17
- return 'calc(100% - 10px)';
17
+ return "calc(100% - 10px)";
18
18
  };
19
- var getFilterColor = function getFilterColor(props) {
20
- if (props.iconHover && props.color === props.theme.palette['grey-200']) {
21
- return 'brightness(100%)';
19
+ const getFilterColor = (props) => {
20
+ if (props.iconHover && props.color === props.theme.palette["grey-200"]) {
21
+ return "brightness(100%)";
22
22
  }
23
- if (props.color === props.theme.palette['grey-200']) {
24
- return 'brightness(90%)';
23
+ if (props.color === props.theme.palette["grey-200"]) {
24
+ return "brightness(90%)";
25
25
  }
26
26
  if (props.iconHover) {
27
- return 'brightness(100%)';
27
+ return "brightness(100%)";
28
28
  }
29
- return 'brightness(110%)';
29
+ return "brightness(110%)";
30
30
  };
31
- var addonStyles = function addonStyles(props) {
32
- return "\n border: 1px solid;\n border-radius: 10px;\n height: 50%;\n padding: 0 3px;\n border-color: " + props.theme.palette.white + ";\n font-size: 9px;\n line-height: 10px;\n text-align: center;\n";
33
- };
34
- export var TagName = styled.span.withConfig({
31
+ const addonStyles = (props) => `
32
+ border: 1px solid;
33
+ border-radius: 10px;
34
+ height: 50%;
35
+ padding: 0 3px;
36
+ border-color: ${props.theme.palette.white};
37
+ font-size: 9px;
38
+ line-height: 10px;
39
+ text-align: center;
40
+ `;
41
+ const TagName = /* @__PURE__ */ styled.span.withConfig({
35
42
  displayName: "Tagstyles__TagName",
36
43
  componentId: "sc-1xw3den-0"
37
44
  })(["white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"]);
38
- export var RemoveButton = styled.div.withConfig({
45
+ const RemoveButton = /* @__PURE__ */ styled.div.withConfig({
39
46
  displayName: "Tagstyles__RemoveButton",
40
47
  componentId: "sc-1xw3den-1"
41
- })(["color:", ";height:18px;width:18px;border-radius:10px;padding:0;border:none;outline:none;margin:3px 3px 3px 5px;text-align:center;cursor:pointer;position:relative;overflow:hidden;display:none;opacity:0.8;&:before{color:", ";filter:brightness(70%);opacity:0.3;content:'';position:absolute;top:0;left:0;width:100%;height:100%;}&&&:hover{.ds-icon svg{fill:", " !important;}}.icon{&&{transform:translate(1px,-3px);}}"], function (_ref) {
42
- var color = _ref.color,
43
- theme = _ref.theme;
44
- return getColorText(theme, color);
45
- }, function (props) {
46
- return props.color || props.theme.palette['red-600'];
47
- }, function (props) {
48
- return props.theme.palette['red-600'];
49
- });
50
- var insertShapeStyles = function insertShapeStyles(props) {
48
+ })(["color:", ";height:18px;width:18px;border-radius:10px;padding:0;border:none;outline:none;margin:3px 3px 3px 5px;text-align:center;cursor:pointer;position:relative;overflow:hidden;display:none;opacity:0.8;&:before{color:", ";filter:brightness(70%);opacity:0.3;content:'';position:absolute;top:0;left:0;width:100%;height:100%;}&&&:hover{.ds-icon svg{fill:", " !important;}}.icon{&&{transform:translate(1px,-3px);}}"], ({
49
+ color,
50
+ theme
51
+ }) => getColorText(theme, color), (props) => props.color || props.theme.palette["red-600"], (props) => props.theme.palette["red-600"]);
52
+ const insertShapeStyles = (props) => {
51
53
  switch (props.shape) {
52
54
  case TagShape.SMALL_SQUARE:
53
- return css(["color:", ";border-radius:3px;font-size:10px;height:14px;line-height:14px;text-transform:uppercase;font-weight:500;letter-spacing:0.1px;padding:0 4px;"], props.textColor || '#fff');
55
+ return css(["color:", ";border-radius:3px;font-size:10px;height:14px;line-height:14px;text-transform:uppercase;font-weight:500;letter-spacing:0.1px;padding:0 4px;"], props.textColor || "#fff");
54
56
  case TagShape.SMALL_ROUND:
55
- return css(["color:", ";border-radius:8px;font-size:10px;height:14px;line-height:14px;text-transform:uppercase;letter-spacing:0.1px;padding:0 4px;"], props.textColor || '#fff');
57
+ return css(["color:", ";border-radius:8px;font-size:10px;height:14px;line-height:14px;text-transform:uppercase;letter-spacing:0.1px;padding:0 4px;"], props.textColor || "#fff");
56
58
  case TagShape.MEDIUM_ROUND:
57
59
  return css(["color:", ";", ""], props.textColor || getColorText(props.theme, props.color), defaultStatusStyles);
58
60
  case TagShape.DEFAULT_ROUND:
59
- return css(["color:", ";border-radius:12px;font-size:13px;height:24px;line-height:24px;padding:", ";", "{padding:", ";padding-left:", ";padding-right:", ";}", ""], props.textColor || getColorText(props.theme, props.color), props.removable ? '0' : '0 12px', TagName, props.removable ? '0 12px' : '0', props.removable && props.preffixel && '4px', props.removable && props.suffixel && '4px', props.isActionable && css(["&:hover{padding:", ";", "{display:inline-block;padding:", ";padding-left:", ";padding-right:", ";width:", ";}padding-right:", ";", "{margin-left:0px;margin-right:", ";.icon{position:absolute;left:-3px;top:-3px;}}}"], props.removable && props.suffixel && '0 15px 0 0px', TagName, props.removable ? '0 7px 0 12px' : '0', props.removable && props.preffixel && '4px', props.removable && props.suffixel && '10px', getWidthOnHover(props), !props.suffixel && '5px', RemoveButton, props.suffixel ? '2px' : '-2px'));
61
+ return css(["color:", ";border-radius:12px;font-size:13px;height:24px;line-height:24px;padding:", ";", "{padding:", ";padding-left:", ";padding-right:", ";}", ""], props.textColor || getColorText(props.theme, props.color), props.removable ? "0" : "0 12px", TagName, props.removable ? "0 12px" : "0", props.removable && props.preffixel && "4px", props.removable && props.suffixel && "4px", props.isActionable && css(["&:hover{padding:", ";", "{display:inline-block;padding:", ";padding-left:", ";padding-right:", ";width:", ";}padding-right:", ";", "{margin-left:0px;margin-right:", ";.icon{position:absolute;left:-3px;top:-3px;}}}"], props.removable && props.suffixel && "0 15px 0 0px", TagName, props.removable ? "0 7px 0 12px" : "0", props.removable && props.preffixel && "4px", props.removable && props.suffixel && "10px", getWidthOnHover(props), !props.suffixel && "5px", RemoveButton, props.suffixel ? "2px" : "-2px"));
60
62
  case TagShape.DEFAULT_SQUARE:
61
- return css(["color:", ";border-radius:3px;font-size:13px;height:24px;line-height:24px;padding:", ";", "{padding:", ";padding-left:", ";padding-right:", ";}", ""], props.textColor || getColorText(props.theme, props.color), props.removable ? '0' : '0 12px', TagName, props.removable ? '0 12px' : '0', props.removable && props.preffixel && '4px', props.removable && props.suffixel && '4px', props.isActionable && css(["&:hover{padding-right:", ";", "{display:inline-block;padding:", ";padding-left:", ";padding-right:", ";width:", ";}padding-right:", ";", "{margin-left:0px;margin-right:", ";.icon{position:absolute;left:-3px;top:-3px;}}}"], props.removable && props.suffixel && '15px', TagName, props.removable ? '0 7px 0 12px' : '0', props.removable && props.preffixel && '4px', props.removable && props.suffixel && '10px', getWidthOnHover(props), !props.suffixel && '5px', RemoveButton, props.suffixel ? '2px' : '-2px'));
63
+ return css(["color:", ";border-radius:3px;font-size:13px;height:24px;line-height:24px;padding:", ";", "{padding:", ";padding-left:", ";padding-right:", ";}", ""], props.textColor || getColorText(props.theme, props.color), props.removable ? "0" : "0 12px", TagName, props.removable ? "0 12px" : "0", props.removable && props.preffixel && "4px", props.removable && props.suffixel && "4px", props.isActionable && css(["&:hover{padding-right:", ";", "{display:inline-block;padding:", ";padding-left:", ";padding-right:", ";width:", ";}padding-right:", ";", "{margin-left:0px;margin-right:", ";.icon{position:absolute;left:-3px;top:-3px;}}}"], props.removable && props.suffixel && "15px", TagName, props.removable ? "0 7px 0 12px" : "0", props.removable && props.preffixel && "4px", props.removable && props.suffixel && "10px", getWidthOnHover(props), !props.suffixel && "5px", RemoveButton, props.suffixel ? "2px" : "-2px"));
62
64
  case TagShape.SINGLE_CHARACTER_ROUND:
63
65
  return css(["color:", ";border-radius:12px;font-size:13px;height:24px;width:24px;line-height:24px;justify-content:center;"], props.textColor || getColorText(props.theme, props.color));
64
66
  case TagShape.SINGLE_CHARACTER_SQUARE:
65
67
  return css(["color:", ";border-radius:3px;font-size:13px;height:24px;width:24px;line-height:24px;justify-content:center;"], props.textColor || getColorText(props.theme, props.color));
66
68
  case TagShape.STATUS_NEUTRAL:
67
- return css(["border:1px solid ", ";color:", ";", ""], props.color || props.theme.palette['grey-500'], props.textColor || props.color || props.theme.palette['grey-500'], defaultStatusStyles);
69
+ return css(["border:1px solid ", ";color:", ";", ""], props.color || props.theme.palette["grey-500"], props.textColor || props.color || props.theme.palette["grey-500"], defaultStatusStyles);
68
70
  case TagShape.STATUS_SUCCESS:
69
- return css(["border:1px solid ", ";color:", ";", ""], props.theme.palette['green-600'], props.theme.palette['green-600'], defaultStatusStyles);
71
+ return css(["border:1px solid ", ";color:", ";", ""], props.theme.palette["green-600"], props.theme.palette["green-600"], defaultStatusStyles);
70
72
  case TagShape.STATUS_ERROR:
71
- return css(["border:1px solid ", ";color:", ";", ""], props.theme.palette['red-600'], props.theme.palette['red-600'], defaultStatusStyles);
73
+ return css(["border:1px solid ", ";color:", ";", ""], props.theme.palette["red-600"], props.theme.palette["red-600"], defaultStatusStyles);
72
74
  case TagShape.STATUS_WARNING:
73
- return css(["border:1px solid ", ";color:", ";", ""], props.theme.palette['yellow-600'], props.theme.palette['yellow-600'], defaultStatusStyles);
75
+ return css(["border:1px solid ", ";color:", ";", ""], props.theme.palette["yellow-600"], props.theme.palette["yellow-600"], defaultStatusStyles);
74
76
  default:
75
77
  return css([""]);
76
78
  }
77
79
  };
78
- export var Content = styled.div.withConfig({
80
+ const Content = /* @__PURE__ */ styled.div.withConfig({
79
81
  displayName: "Tagstyles__Content",
80
82
  componentId: "sc-1xw3den-2"
81
- })(["position:relative;display:flex;align-items:center;flex-grow:0;flex-shrink:1;max-width:100%;", ""], function (props) {
82
- return !!props.iconHover && "\n &&& {\n color:" + props.theme.palette['red-600'] + ";\n }\n";
83
- });
84
- export var PrefixWrapper = styled.div.withConfig({
83
+ })(["position:relative;display:flex;align-items:center;flex-grow:0;flex-shrink:1;max-width:100%;", ""], (props) => !!props.iconHover && `
84
+ &&& {
85
+ color:${props.theme.palette["red-600"]};
86
+ }
87
+ `);
88
+ const PrefixWrapper = /* @__PURE__ */ styled.div.withConfig({
85
89
  displayName: "Tagstyles__PrefixWrapper",
86
90
  componentId: "sc-1xw3den-3"
87
- })(["", ";", ""], function (props) {
88
- return addonStyles(props);
89
- }, function (props) {
90
- return !!props.iconHover && ".ant-scroll-number{ \n color: " + props.theme.palette['red-600'] + "!important;\n box-shadow: 0 0 0 1px " + props.theme.palette['red-600'] + "!important;\n }\n .ds-icon svg {\n fill: " + props.theme.palette['red-600'] + ";\n}";
91
- });
92
- export var SuffixWrapper = styled.div.withConfig({
91
+ })(["", ";", ""], (props) => addonStyles(props), (props) => !!props.iconHover && `.ant-scroll-number{
92
+ color: ${props.theme.palette["red-600"]}!important;
93
+ box-shadow: 0 0 0 1px ${props.theme.palette["red-600"]}!important;
94
+ }
95
+ .ds-icon svg {
96
+ fill: ${props.theme.palette["red-600"]};
97
+ }`);
98
+ const SuffixWrapper = /* @__PURE__ */ styled.div.withConfig({
93
99
  displayName: "Tagstyles__SuffixWrapper",
94
100
  componentId: "sc-1xw3den-4"
95
- })(["", ";"], function (props) {
96
- return addonStyles(props);
97
- });
98
- export var DefaultSuffixWrapper = styled.div.withConfig({
101
+ })(["", ";"], (props) => addonStyles(props));
102
+ const DefaultSuffixWrapper = /* @__PURE__ */ styled.div.withConfig({
99
103
  displayName: "Tagstyles__DefaultSuffixWrapper",
100
104
  componentId: "sc-1xw3den-5"
101
105
  })([""]);
102
- export var DefaultPrefixWrapper = styled.div.withConfig({
106
+ const DefaultPrefixWrapper = /* @__PURE__ */ styled.div.withConfig({
103
107
  displayName: "Tagstyles__DefaultPrefixWrapper",
104
108
  componentId: "sc-1xw3den-6"
105
- })(["", ""], function (props) {
106
- return !!props.iconHover && ".ant-scroll-number{ \n color: " + props.theme.palette['red-600'] + "!important;\n box-shadow: 0 0 0 1px " + props.theme.palette['red-600'] + "!important;\n }\n.ds-icon svg {\n fill: " + props.theme.palette['red-600'] + ";\n}";
107
- });
108
- export var Tag = styled.div.withConfig({
109
+ })(["", ""], (props) => !!props.iconHover && `.ant-scroll-number{
110
+ color: ${props.theme.palette["red-600"]}!important;
111
+ box-shadow: 0 0 0 1px ${props.theme.palette["red-600"]}!important;
112
+ }
113
+ .ds-icon svg {
114
+ fill: ${props.theme.palette["red-600"]};
115
+ }`);
116
+ const Tag = /* @__PURE__ */ styled.div.withConfig({
109
117
  displayName: "Tagstyles__Tag",
110
118
  componentId: "sc-1xw3den-7"
111
- })(["position:relative;margin:4px;display:inline-flex;font-weight:500;overflow:hidden;cursor:default;", " ", ";", " ", " ", " .icon1{margin:0 -2px 0 1px;}", ";", ",", "{margin:", ";}", ",", "{margin:", ";}"], function (props) {
112
- return !props.asPill && css(["cursor:pointer;&:hover:before{filter:", ";}"], getFilterColor);
113
- }, function (props) {
114
- return insertShapeStyles(props);
115
- }, function (props) {
116
- return !!props.iconHover && "\n &&&:before{\n background-color:" + props.theme.palette['red-050'] + ";\n }\n";
117
- }, function (props) {
118
- return !!props.disabled && css(["opacity:0.4;cursor:not-allowed;"]);
119
- }, function (props) {
120
- return !props.isStatusShape && css(["&:before{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background-color:", ";}", ";"], props.color || props.theme.palette['grey-500'], props.isActionable && css(["&:hover:before{filter:", ";}"], getFilterColor));
121
- }, function (props) {
122
- return !!props.isActionable && css(["&:hover{", ",", "{display:none;}", "{position:absolute;top:0;right:", ";display:inline-block;}}"], SuffixWrapper, DefaultSuffixWrapper, RemoveButton, props.removable && props.suffixel ? '-15px' : '0');
123
- }, SuffixWrapper, DefaultSuffixWrapper, function (props) {
124
- return !props.removable && props.suffixel ? '0px -8px 3px 5px' : '0 4px 3px 1px';
125
- }, PrefixWrapper, DefaultPrefixWrapper, function (props) {
126
- return !props.removable && props.preffixel ? '0px 5px 3px -8px' : '0 1px 3px 4px';
127
- });
128
- export var DeleteButton = styled.div.withConfig({
119
+ })(["position:relative;margin:4px;display:inline-flex;font-weight:500;overflow:hidden;cursor:default;", " ", ";", " ", " ", " .icon1{margin:0 -2px 0 1px;}", ";", ",", "{margin:", ";}", ",", "{margin:", ";}"], (props) => !props.asPill && css(["cursor:pointer;&:hover:before{filter:", ";}"], getFilterColor), (props) => insertShapeStyles(props), (props) => !!props.iconHover && `
120
+ &&&:before{
121
+ background-color:${props.theme.palette["red-050"]};
122
+ }
123
+ `, (props) => !!props.disabled && css(["opacity:0.4;cursor:not-allowed;"]), (props) => !props.isStatusShape && css(["&:before{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background-color:", ";}", ";"], props.color || props.theme.palette["grey-500"], props.isActionable && css(["&:hover:before{filter:", ";}"], getFilterColor)), (props) => !!props.isActionable && css(["&:hover{", ",", "{display:none;}", "{position:absolute;top:0;right:", ";display:inline-block;}}"], SuffixWrapper, DefaultSuffixWrapper, RemoveButton, props.removable && props.suffixel ? "-15px" : "0"), SuffixWrapper, DefaultSuffixWrapper, (props) => !props.removable && props.suffixel ? "0px -8px 3px 5px" : "0 4px 3px 1px", PrefixWrapper, DefaultPrefixWrapper, (props) => !props.removable && props.preffixel ? "0px 5px 3px -8px" : "0 1px 3px 4px");
124
+ const DeleteButton = /* @__PURE__ */ styled.div.withConfig({
129
125
  displayName: "Tagstyles__DeleteButton",
130
126
  componentId: "sc-1xw3den-8"
131
- })([""]);
127
+ })([""]);
128
+ export {
129
+ Content,
130
+ DefaultPrefixWrapper,
131
+ DefaultSuffixWrapper,
132
+ DeleteButton,
133
+ PrefixWrapper,
134
+ RemoveButton,
135
+ SuffixWrapper,
136
+ Tag,
137
+ TagName,
138
+ getColorText
139
+ };
@@ -1,6 +1,6 @@
1
- import type { ReactNode } from 'react';
2
- import { type TooltipProps } from '@synerise/ds-tooltip';
3
- import type { WithHTMLAttributes } from '@synerise/ds-utils';
1
+ import { ReactNode } from 'react';
2
+ import { TooltipProps } from '@synerise/ds-tooltip';
3
+ import { WithHTMLAttributes } from '@synerise/ds-utils';
4
4
  export type TagTexts = {
5
5
  addButtonLabel?: ReactNode;
6
6
  searchPlaceholder?: string;
package/dist/Tag.types.js CHANGED
@@ -1,14 +1,17 @@
1
- export var TagShape = /*#__PURE__*/function (TagShape) {
2
- TagShape["SINGLE_CHARACTER_ROUND"] = "single_character_round";
3
- TagShape["SINGLE_CHARACTER_SQUARE"] = "single_character_square";
4
- TagShape["DEFAULT_ROUND"] = "default_round";
5
- TagShape["DEFAULT_SQUARE"] = "default_square";
6
- TagShape["MEDIUM_ROUND"] = "medium_round";
7
- TagShape["SMALL_ROUND"] = "small_round";
8
- TagShape["SMALL_SQUARE"] = "small_square";
9
- TagShape["STATUS_NEUTRAL"] = "status_custom";
10
- TagShape["STATUS_SUCCESS"] = "status_active";
11
- TagShape["STATUS_ERROR"] = "status_inactive";
12
- TagShape["STATUS_WARNING"] = "status_paused";
13
- return TagShape;
14
- }({});
1
+ var TagShape = /* @__PURE__ */ ((TagShape2) => {
2
+ TagShape2["SINGLE_CHARACTER_ROUND"] = "single_character_round";
3
+ TagShape2["SINGLE_CHARACTER_SQUARE"] = "single_character_square";
4
+ TagShape2["DEFAULT_ROUND"] = "default_round";
5
+ TagShape2["DEFAULT_SQUARE"] = "default_square";
6
+ TagShape2["MEDIUM_ROUND"] = "medium_round";
7
+ TagShape2["SMALL_ROUND"] = "small_round";
8
+ TagShape2["SMALL_SQUARE"] = "small_square";
9
+ TagShape2["STATUS_NEUTRAL"] = "status_custom";
10
+ TagShape2["STATUS_SUCCESS"] = "status_active";
11
+ TagShape2["STATUS_ERROR"] = "status_inactive";
12
+ TagShape2["STATUS_WARNING"] = "status_paused";
13
+ return TagShape2;
14
+ })(TagShape || {});
15
+ export {
16
+ TagShape
17
+ };
@@ -1,2 +1,2 @@
1
- import { type TagTexts } from '../Tag.types';
1
+ import { TagTexts } from '../Tag.types';
2
2
  export declare const useDefaultTexts: (texts?: Partial<TagTexts>) => TagTexts;
@@ -1,44 +1,26 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import React, { useMemo } from 'react';
3
- import { FormattedMessage, useIntl } from 'react-intl';
4
- export var useDefaultTexts = function useDefaultTexts(texts) {
5
- var _useIntl = useIntl(),
6
- formatMessage = _useIntl.formatMessage;
7
- var allTexts = useMemo(function () {
8
- return _extends({
9
- searchPlaceholder: formatMessage({
10
- id: 'DS.TAG.SEARCH-PLACEHOLDER',
11
- defaultMessage: 'Search'
12
- }),
13
- addButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
14
- id: "DS.TAG.ADD-BUTTON-LABEL",
15
- defaultMessage: "Add tag"
16
- }),
17
- manageLinkLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
18
- id: "DS.TAG.MANAGE-LINK-LABEL",
19
- defaultMessage: "Manage tags"
20
- }),
21
- createTagButtonLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
22
- id: "DS.TAG.CREATE-TAG-LABEL",
23
- defaultMessage: "Create tag"
24
- }),
25
- dropdownNoTags: /*#__PURE__*/React.createElement(FormattedMessage, {
26
- id: "DS.TAG.NO-TAGS",
27
- defaultMessage: "No data"
28
- }),
29
- clearTooltip: /*#__PURE__*/React.createElement(FormattedMessage, {
30
- id: "DS.TAG.CLEAR-TOOLTIP",
31
- defaultMessage: "Clear"
32
- }),
33
- deleteTooltip: /*#__PURE__*/React.createElement(FormattedMessage, {
34
- id: "DS.TAG.DELETE-TOOLTIP",
35
- defaultMessage: "Delete"
36
- }),
37
- noResultsLabel: /*#__PURE__*/React.createElement(FormattedMessage, {
38
- id: "DS.TAG.NO-SEARCH-RESULTS",
39
- defaultMessage: "No tags found"
40
- })
41
- }, texts || {});
42
- }, [texts, formatMessage]);
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { useIntl, FormattedMessage } from "react-intl";
4
+ const useDefaultTexts = (texts) => {
5
+ const {
6
+ formatMessage
7
+ } = useIntl();
8
+ const allTexts = useMemo(() => ({
9
+ searchPlaceholder: formatMessage({
10
+ id: "DS.TAG.SEARCH-PLACEHOLDER",
11
+ defaultMessage: "Search"
12
+ }),
13
+ addButtonLabel: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.TAG.ADD-BUTTON-LABEL", defaultMessage: "Add tag" }),
14
+ manageLinkLabel: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.TAG.MANAGE-LINK-LABEL", defaultMessage: "Manage tags" }),
15
+ createTagButtonLabel: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.TAG.CREATE-TAG-LABEL", defaultMessage: "Create tag" }),
16
+ dropdownNoTags: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.TAG.NO-TAGS", defaultMessage: "No data" }),
17
+ clearTooltip: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.TAG.CLEAR-TOOLTIP", defaultMessage: "Clear" }),
18
+ deleteTooltip: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.TAG.DELETE-TOOLTIP", defaultMessage: "Delete" }),
19
+ noResultsLabel: /* @__PURE__ */ jsx(FormattedMessage, { id: "DS.TAG.NO-SEARCH-RESULTS", defaultMessage: "No tags found" }),
20
+ ...texts || {}
21
+ }), [texts, formatMessage]);
43
22
  return allTexts;
44
- };
23
+ };
24
+ export {
25
+ useDefaultTexts
26
+ };
package/dist/index.js CHANGED
@@ -1,3 +1,8 @@
1
- export { default } from './Tag';
2
- export { TagShape } from './Tag.types';
3
- export { useDefaultTexts } from './hooks/useDefaultTexts';
1
+ import { default as default2 } from "./Tag.js";
2
+ import { TagShape } from "./Tag.types.js";
3
+ import { useDefaultTexts } from "./hooks/useDefaultTexts.js";
4
+ export {
5
+ TagShape,
6
+ default2 as default,
7
+ useDefaultTexts
8
+ };
package/dist/modules.d.js CHANGED
@@ -1 +1 @@
1
- import '@testing-library/jest-dom/extend-expect';
1
+ import "@testing-library/jest-dom/extend-expect";
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-tag",
3
- "version": "1.4.17",
3
+ "version": "1.4.18",
4
4
  "description": "Tag UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -16,10 +16,10 @@
16
16
  "access": "public"
17
17
  },
18
18
  "scripts": {
19
- "build": "pnpm run build:js && pnpm run build:css && pnpm run defs",
19
+ "build": "vite build",
20
20
  "build:css": "node ../../../scripts/style/less.js",
21
21
  "build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
22
- "build:watch": "pnpm run build:js -- --watch",
22
+ "build:watch": "vite build --watch",
23
23
  "defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
24
24
  "pack:ci": "pnpm pack --pack-destination ../../storybook/storybook-static/static",
25
25
  "prepublish": "pnpm run build",
@@ -35,14 +35,15 @@
35
35
  ],
36
36
  "types": "dist/index.d.ts",
37
37
  "dependencies": {
38
- "@synerise/ds-icon": "^1.15.0",
39
- "@synerise/ds-tooltip": "^1.4.9",
40
- "@synerise/ds-utils": "^1.7.0"
38
+ "@synerise/ds-icon": "^1.15.1",
39
+ "@synerise/ds-tooltip": "^1.4.10",
40
+ "@synerise/ds-utils": "^1.7.1",
41
+ "react-intl": "^6.8.7"
41
42
  },
42
43
  "peerDependencies": {
43
44
  "@synerise/ds-core": "*",
44
45
  "react": ">=16.9.0 <= 18.3.1",
45
46
  "styled-components": "^5.3.3"
46
47
  },
47
- "gitHead": "8efc031fa688c0b87c7b3915bae93546bb63bcac"
48
+ "gitHead": "e4ecca8944fc9b41c1b9d59c8bcad5e5e2013225"
48
49
  }