@activecollab/components 1.0.267 → 1.0.268

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.
@@ -37,14 +37,16 @@ var Badge = function Badge(_ref) {
37
37
  _ref$backgroundColor = _ref.backgroundColor,
38
38
  backgroundColor = _ref$backgroundColor === void 0 ? "#40C37D" : _ref$backgroundColor,
39
39
  _ref$isVisible = _ref.isVisible,
40
- isVisible = _ref$isVisible === void 0 ? true : _ref$isVisible;
40
+ isVisible = _ref$isVisible === void 0 ? true : _ref$isVisible,
41
+ value = _ref.value;
41
42
  return isVisible ? /*#__PURE__*/_react.default.createElement(_Styles.StyledBadge, {
42
43
  className: (0, _classnames.default)("c-badge", className),
43
44
  dimension: dimension,
44
45
  position: position,
45
46
  backgroundColor: backgroundColor,
46
- role: "status"
47
- }) : null;
47
+ role: "status",
48
+ value: value
49
+ }, value && value > 100 ? 99 + "+" : value) : null;
48
50
  };
49
51
  exports.Badge = Badge;
50
52
  //# sourceMappingURL=Badge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.js","names":["Badge","dimension","className","position","backgroundColor","isVisible","classNames"],"sources":["../../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import classNames from \"classnames\";\nimport React from \"react\";\nimport { StyledBadge } from \"./Styles\";\n\ntype Position = \"top-left\" | \"top-right\" | \"bottom-right\" | \"bottom-left\";\n\nexport interface BadgeProps {\n position?: Position;\n dimension?: number;\n className?: string;\n backgroundColor?: string;\n isVisible?: boolean;\n}\n\n/**\n * @component Badge\n * @description\n * In some products, you might need to show a badge on the right corner of the avatar.\n * We call this a badge. Here's an example that shows if the user is online.\n *\n * @prop {position} - dictates the position of a badge.\n * @prop {dimension} - controls the size of a badge (width and height) in pixels.\n * @prop {backgroundColor} - background-color of a badge.\n * @prop {isVisible} - dictates if badge should be visible or not.\n *\n * @example\n * <IconButton variant=\"text gray\" size=\"big\">\n * <BellOffIcon />\n * <Badge position=\"top-right\" backgroundColor=\"red\" dimension={16} />\n * </IconButton>\n *\n * @see\n * https://system.activecollab.com/?path=/story/components-button-indicators-badge--badge\n */\nexport const Badge = ({\n dimension = 8,\n className,\n position = \"bottom-left\",\n backgroundColor = \"#40C37D\",\n isVisible = true,\n}: BadgeProps) => {\n return isVisible ? (\n <StyledBadge\n className={classNames(\"c-badge\", className)}\n dimension={dimension}\n position={position}\n backgroundColor={backgroundColor}\n role=\"status\"\n />\n ) : null;\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AAAuC;AAYvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,KAAK,GAAG,SAARA,KAAK,OAMA;EAAA,0BALhBC,SAAS;IAATA,SAAS,+BAAG,CAAC;IACbC,SAAS,QAATA,SAAS;IAAA,qBACTC,QAAQ;IAARA,QAAQ,8BAAG,aAAa;IAAA,4BACxBC,eAAe;IAAfA,eAAe,qCAAG,SAAS;IAAA,sBAC3BC,SAAS;IAATA,SAAS,+BAAG,IAAI;EAEhB,OAAOA,SAAS,gBACd,6BAAC,mBAAW;IACV,SAAS,EAAE,IAAAC,mBAAU,EAAC,SAAS,EAAEJ,SAAS,CAAE;IAC5C,SAAS,EAAED,SAAU;IACrB,QAAQ,EAAEE,QAAS;IACnB,eAAe,EAAEC,eAAgB;IACjC,IAAI,EAAC;EAAQ,EACb,GACA,IAAI;AACV,CAAC;AAAC"}
1
+ {"version":3,"file":"Badge.js","names":["Badge","dimension","className","position","backgroundColor","isVisible","value","classNames"],"sources":["../../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import classNames from \"classnames\";\nimport React from \"react\";\nimport { StyledBadge } from \"./Styles\";\n\ntype Position = \"top-left\" | \"top-right\" | \"bottom-right\" | \"bottom-left\";\n\nexport interface BadgeProps {\n position?: Position;\n dimension?: number;\n className?: string;\n backgroundColor?: string;\n isVisible?: boolean;\n value?: number;\n}\n\n/**\n * @component Badge\n * @description\n * In some products, you might need to show a badge on the right corner of the avatar.\n * We call this a badge. Here's an example that shows if the user is online.\n *\n * @prop {position} - dictates the position of a badge.\n * @prop {dimension} - controls the size of a badge (width and height) in pixels.\n * @prop {backgroundColor} - background-color of a badge.\n * @prop {isVisible} - dictates if badge should be visible or not.\n *\n * @example\n * <IconButton variant=\"text gray\" size=\"big\">\n * <BellOffIcon />\n * <Badge position=\"top-right\" backgroundColor=\"red\" dimension={16} />\n * </IconButton>\n *\n * @see\n * https://system.activecollab.com/?path=/story/components-button-indicators-badge--badge\n */\nexport const Badge = ({\n dimension = 8,\n className,\n position = \"bottom-left\",\n backgroundColor = \"#40C37D\",\n isVisible = true,\n value,\n}: BadgeProps) => {\n return isVisible ? (\n <StyledBadge\n className={classNames(\"c-badge\", className)}\n dimension={dimension}\n position={position}\n backgroundColor={backgroundColor}\n role=\"status\"\n value={value}\n >\n {value && value > 100 ? 99 + \"+\" : value}\n </StyledBadge>\n ) : null;\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AAAuC;AAavC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,IAAMA,KAAK,GAAG,SAARA,KAAK,OAOA;EAAA,0BANhBC,SAAS;IAATA,SAAS,+BAAG,CAAC;IACbC,SAAS,QAATA,SAAS;IAAA,qBACTC,QAAQ;IAARA,QAAQ,8BAAG,aAAa;IAAA,4BACxBC,eAAe;IAAfA,eAAe,qCAAG,SAAS;IAAA,sBAC3BC,SAAS;IAATA,SAAS,+BAAG,IAAI;IAChBC,KAAK,QAALA,KAAK;EAEL,OAAOD,SAAS,gBACd,6BAAC,mBAAW;IACV,SAAS,EAAE,IAAAE,mBAAU,EAAC,SAAS,EAAEL,SAAS,CAAE;IAC5C,SAAS,EAAED,SAAU;IACrB,QAAQ,EAAEE,QAAS;IACnB,eAAe,EAAEC,eAAgB;IACjC,IAAI,EAAC,QAAQ;IACb,KAAK,EAAEE;EAAM,GAEZA,KAAK,IAAIA,KAAK,GAAG,GAAG,GAAG,EAAE,GAAG,GAAG,GAAGA,KAAK,CAC5B,GACZ,IAAI;AACV,CAAC;AAAC"}
@@ -6,17 +6,20 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.StyledBadge = void 0;
8
8
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
9
+ var _FontStyle = require("../FontStyle");
9
10
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10
11
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
11
12
  var StyledBadge = _styledComponents.default.div.withConfig({
12
13
  displayName: "Styles__StyledBadge",
13
14
  componentId: "sc-6o8do5-0"
14
- })(["background-color:", ";block-size:", ";border-radius:100%;border:2px solid var(--page-paper-main);inline-size:", ";position:absolute;pointer-events:none;z-index:1;", " ", " ", " ", ""], function (props) {
15
+ })(["", " align-items:center;background-color:", ";block-size:", ";border-radius:100%;border:2px solid var(--page-paper-main);color:var(--color-theme-100);display:flex;font-size:12px;font-weight:500;inline-size:", ";justify-content:center;padding:", ";pointer-events:none;position:absolute;z-index:1;", " ", " ", " ", ""], _FontStyle.FontStyle, function (props) {
15
16
  return props.backgroundColor;
16
17
  }, function (props) {
17
18
  return props.dimension + "px";
18
19
  }, function (props) {
19
20
  return props.dimension + "px";
21
+ }, function (props) {
22
+ return props.value && (props.value > 99 ? "4px" : props.value < 100 && "2px");
20
23
  }, function (_ref) {
21
24
  var position = _ref.position;
22
25
  return position === "top-left" && (0, _styledComponents.css)(["inset-block-start:0;inset-inline-start:0;"]);
@@ -1 +1 @@
1
- {"version":3,"file":"Styles.js","names":["StyledBadge","styled","div","props","backgroundColor","dimension","position","css"],"sources":["../../../../src/components/Badge/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport { BadgeProps } from \"./Badge\";\n\nexport const StyledBadge = styled.div<Partial<BadgeProps>>`\n background-color: ${(props) => props.backgroundColor};\n block-size: ${(props) => props.dimension + \"px\"};\n border-radius: 100%;\n border: 2px solid var(--page-paper-main);\n inline-size: ${(props) => props.dimension + \"px\"};\n position: absolute;\n pointer-events: none;\n z-index: 1;\n\n ${({ position }) =>\n position === \"top-left\" &&\n css`\n inset-block-start: 0;\n inset-inline-start: 0;\n `}\n\n ${({ position }) =>\n position === \"top-right\" &&\n css`\n inset-block-start: 0;\n inset-inline-end: 0;\n `}\n\n ${({ position }) =>\n position === \"bottom-right\" &&\n css`\n inset-block-end: 0;\n inset-inline-end: 0;\n `}\n\n ${({ position }) =>\n position === \"bottom-left\" &&\n css`\n inset-block-end: 0;\n inset-inline-start: 0;\n `}\n`;\n"],"mappings":";;;;;;;AAAA;AAAgD;AAAA;AAGzC,IAAMA,WAAW,GAAGC,yBAAM,CAACC,GAAG;EAAA;EAAA;AAAA,8LACf,UAACC,KAAK;EAAA,OAAKA,KAAK,CAACC,eAAe;AAAA,GACtC,UAACD,KAAK;EAAA,OAAKA,KAAK,CAACE,SAAS,GAAG,IAAI;AAAA,GAGhC,UAACF,KAAK;EAAA,OAAKA,KAAK,CAACE,SAAS,GAAG,IAAI;AAAA,GAK9C;EAAA,IAAGC,QAAQ,QAARA,QAAQ;EAAA,OACXA,QAAQ,KAAK,UAAU,QACvBC,qBAAG,gDAGF;AAAA,GAED;EAAA,IAAGD,QAAQ,SAARA,QAAQ;EAAA,OACXA,QAAQ,KAAK,WAAW,QACxBC,qBAAG,8CAGF;AAAA,GAEC;EAAA,IAAGD,QAAQ,SAARA,QAAQ;EAAA,OACbA,QAAQ,KAAK,cAAc,QAC3BC,qBAAG,4CAGF;AAAA,GAEC;EAAA,IAAGD,QAAQ,SAARA,QAAQ;EAAA,OACbA,QAAQ,KAAK,aAAa,QAC1BC,qBAAG,8CAGF;AAAA,EACJ;AAAC"}
1
+ {"version":3,"file":"Styles.js","names":["StyledBadge","styled","div","FontStyle","props","backgroundColor","dimension","value","position","css"],"sources":["../../../../src/components/Badge/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport { FontStyle } from \"../FontStyle\";\nimport { BadgeProps } from \"./Badge\";\n\nexport const StyledBadge = styled.div<Partial<BadgeProps>>`\n ${FontStyle}\n align-items: center;\n background-color: ${(props) => props.backgroundColor};\n block-size: ${(props) => props.dimension + \"px\"};\n border-radius: 100%;\n border: 2px solid var(--page-paper-main);\n color: var(--color-theme-100);\n display: flex;\n font-size: 12px;\n font-weight: 500;\n inline-size: ${(props) => props.dimension + \"px\"};\n justify-content: center;\n padding: ${(props) =>\n props.value && (props.value > 99 ? \"4px\" : props.value < 100 && \"2px\")};\n pointer-events: none;\n position: absolute;\n z-index: 1;\n\n ${({ position }) =>\n position === \"top-left\" &&\n css`\n inset-block-start: 0;\n inset-inline-start: 0;\n `}\n\n ${({ position }) =>\n position === \"top-right\" &&\n css`\n inset-block-start: 0;\n inset-inline-end: 0;\n `}\n\n ${({ position }) =>\n position === \"bottom-right\" &&\n css`\n inset-block-end: 0;\n inset-inline-end: 0;\n `}\n\n ${({ position }) =>\n position === \"bottom-left\" &&\n css`\n inset-block-end: 0;\n inset-inline-start: 0;\n `}\n`;\n"],"mappings":";;;;;;;AAAA;AACA;AAAyC;AAAA;AAGlC,IAAMA,WAAW,GAAGC,yBAAM,CAACC,GAAG;EAAA;EAAA;AAAA,mUACjCC,oBAAS,EAES,UAACC,KAAK;EAAA,OAAKA,KAAK,CAACC,eAAe;AAAA,GACtC,UAACD,KAAK;EAAA,OAAKA,KAAK,CAACE,SAAS,GAAG,IAAI;AAAA,GAOhC,UAACF,KAAK;EAAA,OAAKA,KAAK,CAACE,SAAS,GAAG,IAAI;AAAA,GAErC,UAACF,KAAK;EAAA,OACfA,KAAK,CAACG,KAAK,KAAKH,KAAK,CAACG,KAAK,GAAG,EAAE,GAAG,KAAK,GAAGH,KAAK,CAACG,KAAK,GAAG,GAAG,IAAI,KAAK,CAAC;AAAA,GAKtE;EAAA,IAAGC,QAAQ,QAARA,QAAQ;EAAA,OACXA,QAAQ,KAAK,UAAU,QACvBC,qBAAG,gDAGF;AAAA,GAED;EAAA,IAAGD,QAAQ,SAARA,QAAQ;EAAA,OACXA,QAAQ,KAAK,WAAW,QACxBC,qBAAG,8CAGF;AAAA,GAEC;EAAA,IAAGD,QAAQ,SAARA,QAAQ;EAAA,OACbA,QAAQ,KAAK,cAAc,QAC3BC,qBAAG,4CAGF;AAAA,GAEC;EAAA,IAAGD,QAAQ,SAARA,QAAQ;EAAA,OACbA,QAAQ,KAAK,aAAa,QAC1BC,qBAAG,8CAGF;AAAA,EACJ;AAAC"}
@@ -6,6 +6,7 @@ export interface BadgeProps {
6
6
  className?: string;
7
7
  backgroundColor?: string;
8
8
  isVisible?: boolean;
9
+ value?: number;
9
10
  }
10
11
  /**
11
12
  * @component Badge
@@ -27,6 +28,6 @@ export interface BadgeProps {
27
28
  * @see
28
29
  * https://system.activecollab.com/?path=/story/components-button-indicators-badge--badge
29
30
  */
30
- export declare const Badge: ({ dimension, className, position, backgroundColor, isVisible, }: BadgeProps) => JSX.Element | null;
31
+ export declare const Badge: ({ dimension, className, position, backgroundColor, isVisible, value, }: BadgeProps) => JSX.Element | null;
31
32
  export {};
32
33
  //# sourceMappingURL=Badge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":";AAIA,aAAK,QAAQ,GAAG,UAAU,GAAG,WAAW,GAAG,cAAc,GAAG,aAAa,CAAC;AAE1E,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,KAAK,oEAMf,UAAU,uBAUZ,CAAC"}
1
+ {"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":";AAIA,aAAK,QAAQ,GAAG,UAAU,GAAG,WAAW,GAAG,cAAc,GAAG,aAAa,CAAC;AAE1E,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,KAAK,2EAOf,UAAU,uBAaZ,CAAC"}
@@ -30,13 +30,15 @@ export var Badge = function Badge(_ref) {
30
30
  _ref$backgroundColor = _ref.backgroundColor,
31
31
  backgroundColor = _ref$backgroundColor === void 0 ? "#40C37D" : _ref$backgroundColor,
32
32
  _ref$isVisible = _ref.isVisible,
33
- isVisible = _ref$isVisible === void 0 ? true : _ref$isVisible;
33
+ isVisible = _ref$isVisible === void 0 ? true : _ref$isVisible,
34
+ value = _ref.value;
34
35
  return isVisible ? /*#__PURE__*/React.createElement(StyledBadge, {
35
36
  className: classNames("c-badge", className),
36
37
  dimension: dimension,
37
38
  position: position,
38
39
  backgroundColor: backgroundColor,
39
- role: "status"
40
- }) : null;
40
+ role: "status",
41
+ value: value
42
+ }, value && value > 100 ? 99 + "+" : value) : null;
41
43
  };
42
44
  //# sourceMappingURL=Badge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.js","names":["classNames","React","StyledBadge","Badge","dimension","className","position","backgroundColor","isVisible"],"sources":["../../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import classNames from \"classnames\";\nimport React from \"react\";\nimport { StyledBadge } from \"./Styles\";\n\ntype Position = \"top-left\" | \"top-right\" | \"bottom-right\" | \"bottom-left\";\n\nexport interface BadgeProps {\n position?: Position;\n dimension?: number;\n className?: string;\n backgroundColor?: string;\n isVisible?: boolean;\n}\n\n/**\n * @component Badge\n * @description\n * In some products, you might need to show a badge on the right corner of the avatar.\n * We call this a badge. Here's an example that shows if the user is online.\n *\n * @prop {position} - dictates the position of a badge.\n * @prop {dimension} - controls the size of a badge (width and height) in pixels.\n * @prop {backgroundColor} - background-color of a badge.\n * @prop {isVisible} - dictates if badge should be visible or not.\n *\n * @example\n * <IconButton variant=\"text gray\" size=\"big\">\n * <BellOffIcon />\n * <Badge position=\"top-right\" backgroundColor=\"red\" dimension={16} />\n * </IconButton>\n *\n * @see\n * https://system.activecollab.com/?path=/story/components-button-indicators-badge--badge\n */\nexport const Badge = ({\n dimension = 8,\n className,\n position = \"bottom-left\",\n backgroundColor = \"#40C37D\",\n isVisible = true,\n}: BadgeProps) => {\n return isVisible ? (\n <StyledBadge\n className={classNames(\"c-badge\", className)}\n dimension={dimension}\n position={position}\n backgroundColor={backgroundColor}\n role=\"status\"\n />\n ) : null;\n};\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,WAAW,QAAQ,UAAU;AAYtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,KAAK,GAAG,SAARA,KAAK,OAMA;EAAA,0BALhBC,SAAS;IAATA,SAAS,+BAAG,CAAC;IACbC,SAAS,QAATA,SAAS;IAAA,qBACTC,QAAQ;IAARA,QAAQ,8BAAG,aAAa;IAAA,4BACxBC,eAAe;IAAfA,eAAe,qCAAG,SAAS;IAAA,sBAC3BC,SAAS;IAATA,SAAS,+BAAG,IAAI;EAEhB,OAAOA,SAAS,gBACd,oBAAC,WAAW;IACV,SAAS,EAAER,UAAU,CAAC,SAAS,EAAEK,SAAS,CAAE;IAC5C,SAAS,EAAED,SAAU;IACrB,QAAQ,EAAEE,QAAS;IACnB,eAAe,EAAEC,eAAgB;IACjC,IAAI,EAAC;EAAQ,EACb,GACA,IAAI;AACV,CAAC"}
1
+ {"version":3,"file":"Badge.js","names":["classNames","React","StyledBadge","Badge","dimension","className","position","backgroundColor","isVisible","value"],"sources":["../../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import classNames from \"classnames\";\nimport React from \"react\";\nimport { StyledBadge } from \"./Styles\";\n\ntype Position = \"top-left\" | \"top-right\" | \"bottom-right\" | \"bottom-left\";\n\nexport interface BadgeProps {\n position?: Position;\n dimension?: number;\n className?: string;\n backgroundColor?: string;\n isVisible?: boolean;\n value?: number;\n}\n\n/**\n * @component Badge\n * @description\n * In some products, you might need to show a badge on the right corner of the avatar.\n * We call this a badge. Here's an example that shows if the user is online.\n *\n * @prop {position} - dictates the position of a badge.\n * @prop {dimension} - controls the size of a badge (width and height) in pixels.\n * @prop {backgroundColor} - background-color of a badge.\n * @prop {isVisible} - dictates if badge should be visible or not.\n *\n * @example\n * <IconButton variant=\"text gray\" size=\"big\">\n * <BellOffIcon />\n * <Badge position=\"top-right\" backgroundColor=\"red\" dimension={16} />\n * </IconButton>\n *\n * @see\n * https://system.activecollab.com/?path=/story/components-button-indicators-badge--badge\n */\nexport const Badge = ({\n dimension = 8,\n className,\n position = \"bottom-left\",\n backgroundColor = \"#40C37D\",\n isVisible = true,\n value,\n}: BadgeProps) => {\n return isVisible ? (\n <StyledBadge\n className={classNames(\"c-badge\", className)}\n dimension={dimension}\n position={position}\n backgroundColor={backgroundColor}\n role=\"status\"\n value={value}\n >\n {value && value > 100 ? 99 + \"+\" : value}\n </StyledBadge>\n ) : null;\n};\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,WAAW,QAAQ,UAAU;AAatC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMC,KAAK,GAAG,SAARA,KAAK,OAOA;EAAA,0BANhBC,SAAS;IAATA,SAAS,+BAAG,CAAC;IACbC,SAAS,QAATA,SAAS;IAAA,qBACTC,QAAQ;IAARA,QAAQ,8BAAG,aAAa;IAAA,4BACxBC,eAAe;IAAfA,eAAe,qCAAG,SAAS;IAAA,sBAC3BC,SAAS;IAATA,SAAS,+BAAG,IAAI;IAChBC,KAAK,QAALA,KAAK;EAEL,OAAOD,SAAS,gBACd,oBAAC,WAAW;IACV,SAAS,EAAER,UAAU,CAAC,SAAS,EAAEK,SAAS,CAAE;IAC5C,SAAS,EAAED,SAAU;IACrB,QAAQ,EAAEE,QAAS;IACnB,eAAe,EAAEC,eAAgB;IACjC,IAAI,EAAC,QAAQ;IACb,KAAK,EAAEE;EAAM,GAEZA,KAAK,IAAIA,KAAK,GAAG,GAAG,GAAG,EAAE,GAAG,GAAG,GAAGA,KAAK,CAC5B,GACZ,IAAI;AACV,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Badge/Styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,WAAW,qFAqCvB,CAAC"}
1
+ {"version":3,"file":"Styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Badge/Styles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,WAAW,qFA8CvB,CAAC"}
@@ -1,13 +1,16 @@
1
1
  import styled, { css } from "styled-components";
2
+ import { FontStyle } from "../FontStyle";
2
3
  export var StyledBadge = styled.div.withConfig({
3
4
  displayName: "Styles__StyledBadge",
4
5
  componentId: "sc-6o8do5-0"
5
- })(["background-color:", ";block-size:", ";border-radius:100%;border:2px solid var(--page-paper-main);inline-size:", ";position:absolute;pointer-events:none;z-index:1;", " ", " ", " ", ""], function (props) {
6
+ })(["", " align-items:center;background-color:", ";block-size:", ";border-radius:100%;border:2px solid var(--page-paper-main);color:var(--color-theme-100);display:flex;font-size:12px;font-weight:500;inline-size:", ";justify-content:center;padding:", ";pointer-events:none;position:absolute;z-index:1;", " ", " ", " ", ""], FontStyle, function (props) {
6
7
  return props.backgroundColor;
7
8
  }, function (props) {
8
9
  return props.dimension + "px";
9
10
  }, function (props) {
10
11
  return props.dimension + "px";
12
+ }, function (props) {
13
+ return props.value && (props.value > 99 ? "4px" : props.value < 100 && "2px");
11
14
  }, function (_ref) {
12
15
  var position = _ref.position;
13
16
  return position === "top-left" && css(["inset-block-start:0;inset-inline-start:0;"]);
@@ -1 +1 @@
1
- {"version":3,"file":"Styles.js","names":["styled","css","StyledBadge","div","props","backgroundColor","dimension","position"],"sources":["../../../../src/components/Badge/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport { BadgeProps } from \"./Badge\";\n\nexport const StyledBadge = styled.div<Partial<BadgeProps>>`\n background-color: ${(props) => props.backgroundColor};\n block-size: ${(props) => props.dimension + \"px\"};\n border-radius: 100%;\n border: 2px solid var(--page-paper-main);\n inline-size: ${(props) => props.dimension + \"px\"};\n position: absolute;\n pointer-events: none;\n z-index: 1;\n\n ${({ position }) =>\n position === \"top-left\" &&\n css`\n inset-block-start: 0;\n inset-inline-start: 0;\n `}\n\n ${({ position }) =>\n position === \"top-right\" &&\n css`\n inset-block-start: 0;\n inset-inline-end: 0;\n `}\n\n ${({ position }) =>\n position === \"bottom-right\" &&\n css`\n inset-block-end: 0;\n inset-inline-end: 0;\n `}\n\n ${({ position }) =>\n position === \"bottom-left\" &&\n css`\n inset-block-end: 0;\n inset-inline-start: 0;\n `}\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAG/C,OAAO,IAAMC,WAAW,GAAGF,MAAM,CAACG,GAAG;EAAA;EAAA;AAAA,8LACf,UAACC,KAAK;EAAA,OAAKA,KAAK,CAACC,eAAe;AAAA,GACtC,UAACD,KAAK;EAAA,OAAKA,KAAK,CAACE,SAAS,GAAG,IAAI;AAAA,GAGhC,UAACF,KAAK;EAAA,OAAKA,KAAK,CAACE,SAAS,GAAG,IAAI;AAAA,GAK9C;EAAA,IAAGC,QAAQ,QAARA,QAAQ;EAAA,OACXA,QAAQ,KAAK,UAAU,IACvBN,GAAG,+CAGF;AAAA,GAED;EAAA,IAAGM,QAAQ,SAARA,QAAQ;EAAA,OACXA,QAAQ,KAAK,WAAW,IACxBN,GAAG,6CAGF;AAAA,GAEC;EAAA,IAAGM,QAAQ,SAARA,QAAQ;EAAA,OACbA,QAAQ,KAAK,cAAc,IAC3BN,GAAG,2CAGF;AAAA,GAEC;EAAA,IAAGM,QAAQ,SAARA,QAAQ;EAAA,OACbA,QAAQ,KAAK,aAAa,IAC1BN,GAAG,6CAGF;AAAA,EACJ"}
1
+ {"version":3,"file":"Styles.js","names":["styled","css","FontStyle","StyledBadge","div","props","backgroundColor","dimension","value","position"],"sources":["../../../../src/components/Badge/Styles.ts"],"sourcesContent":["import styled, { css } from \"styled-components\";\nimport { FontStyle } from \"../FontStyle\";\nimport { BadgeProps } from \"./Badge\";\n\nexport const StyledBadge = styled.div<Partial<BadgeProps>>`\n ${FontStyle}\n align-items: center;\n background-color: ${(props) => props.backgroundColor};\n block-size: ${(props) => props.dimension + \"px\"};\n border-radius: 100%;\n border: 2px solid var(--page-paper-main);\n color: var(--color-theme-100);\n display: flex;\n font-size: 12px;\n font-weight: 500;\n inline-size: ${(props) => props.dimension + \"px\"};\n justify-content: center;\n padding: ${(props) =>\n props.value && (props.value > 99 ? \"4px\" : props.value < 100 && \"2px\")};\n pointer-events: none;\n position: absolute;\n z-index: 1;\n\n ${({ position }) =>\n position === \"top-left\" &&\n css`\n inset-block-start: 0;\n inset-inline-start: 0;\n `}\n\n ${({ position }) =>\n position === \"top-right\" &&\n css`\n inset-block-start: 0;\n inset-inline-end: 0;\n `}\n\n ${({ position }) =>\n position === \"bottom-right\" &&\n css`\n inset-block-end: 0;\n inset-inline-end: 0;\n `}\n\n ${({ position }) =>\n position === \"bottom-left\" &&\n css`\n inset-block-end: 0;\n inset-inline-start: 0;\n `}\n`;\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAC/C,SAASC,SAAS,QAAQ,cAAc;AAGxC,OAAO,IAAMC,WAAW,GAAGH,MAAM,CAACI,GAAG;EAAA;EAAA;AAAA,mUACjCF,SAAS,EAES,UAACG,KAAK;EAAA,OAAKA,KAAK,CAACC,eAAe;AAAA,GACtC,UAACD,KAAK;EAAA,OAAKA,KAAK,CAACE,SAAS,GAAG,IAAI;AAAA,GAOhC,UAACF,KAAK;EAAA,OAAKA,KAAK,CAACE,SAAS,GAAG,IAAI;AAAA,GAErC,UAACF,KAAK;EAAA,OACfA,KAAK,CAACG,KAAK,KAAKH,KAAK,CAACG,KAAK,GAAG,EAAE,GAAG,KAAK,GAAGH,KAAK,CAACG,KAAK,GAAG,GAAG,IAAI,KAAK,CAAC;AAAA,GAKtE;EAAA,IAAGC,QAAQ,QAARA,QAAQ;EAAA,OACXA,QAAQ,KAAK,UAAU,IACvBR,GAAG,+CAGF;AAAA,GAED;EAAA,IAAGQ,QAAQ,SAARA,QAAQ;EAAA,OACXA,QAAQ,KAAK,WAAW,IACxBR,GAAG,6CAGF;AAAA,GAEC;EAAA,IAAGQ,QAAQ,SAARA,QAAQ;EAAA,OACbA,QAAQ,KAAK,cAAc,IAC3BR,GAAG,2CAGF;AAAA,GAEC;EAAA,IAAGQ,QAAQ,SAARA,QAAQ;EAAA,OACbA,QAAQ,KAAK,aAAa,IAC1BR,GAAG,6CAGF;AAAA,EACJ"}
package/dist/index.js CHANGED
@@ -15693,12 +15693,14 @@
15693
15693
  var StyledBadge = styled__default["default"].div.withConfig({
15694
15694
  displayName: "Styles__StyledBadge",
15695
15695
  componentId: "sc-6o8do5-0"
15696
- })(["background-color:", ";block-size:", ";border-radius:100%;border:2px solid var(--page-paper-main);inline-size:", ";position:absolute;pointer-events:none;z-index:1;", " ", " ", " ", ""], function (props) {
15696
+ })(["", " align-items:center;background-color:", ";block-size:", ";border-radius:100%;border:2px solid var(--page-paper-main);color:var(--color-theme-100);display:flex;font-size:12px;font-weight:500;inline-size:", ";justify-content:center;padding:", ";pointer-events:none;position:absolute;z-index:1;", " ", " ", " ", ""], FontStyle, function (props) {
15697
15697
  return props.backgroundColor;
15698
15698
  }, function (props) {
15699
15699
  return props.dimension + "px";
15700
15700
  }, function (props) {
15701
15701
  return props.dimension + "px";
15702
+ }, function (props) {
15703
+ return props.value && (props.value > 99 ? "4px" : props.value < 100 && "2px");
15702
15704
  }, function (_ref) {
15703
15705
  var position = _ref.position;
15704
15706
  return position === "top-left" && styled.css(["inset-block-start:0;inset-inline-start:0;"]);
@@ -15742,14 +15744,16 @@
15742
15744
  _ref$backgroundColor = _ref.backgroundColor,
15743
15745
  backgroundColor = _ref$backgroundColor === void 0 ? "#40C37D" : _ref$backgroundColor,
15744
15746
  _ref$isVisible = _ref.isVisible,
15745
- isVisible = _ref$isVisible === void 0 ? true : _ref$isVisible;
15747
+ isVisible = _ref$isVisible === void 0 ? true : _ref$isVisible,
15748
+ value = _ref.value;
15746
15749
  return isVisible ? /*#__PURE__*/React__default["default"].createElement(StyledBadge, {
15747
15750
  className: classNames__default["default"]("c-badge", className),
15748
15751
  dimension: dimension,
15749
15752
  position: position,
15750
15753
  backgroundColor: backgroundColor,
15751
- role: "status"
15752
- }) : null;
15754
+ role: "status",
15755
+ value: value
15756
+ }, value && value > 100 ? 99 + "+" : value) : null;
15753
15757
  };
15754
15758
 
15755
15759
  exports.Accordion = Accordion;