@purpurds/color-dot 5.4.3 → 5.6.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.
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime");function f(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var i={exports:{}};/*!
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime");function a(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var i={exports:{}};/*!
2
2
  Copyright (c) 2018 Jed Watson.
3
3
  Licensed under the MIT License (MIT), see
4
4
  http://jedwatson.github.io/classnames
5
- */(function(t){(function(){var u={}.hasOwnProperty;function e(){for(var r="",o=0;o<arguments.length;o++){var s=arguments[o];s&&(r=n(r,c(s)))}return r}function c(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return e.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var o="";for(var s in r)u.call(r,s)&&r[s]&&(o=n(o,s));return o}function n(r,o){return o?r?r+" "+o:r+o:r}t.exports?(e.default=e,t.exports=e):window.classNames=e})()})(i);var _=i.exports;const m=f(_),p={"purpur-color-dot":"_purpur-color-dot_1n98k_1","purpur-color-dot--xs":"_purpur-color-dot--xs_1n98k_6","purpur-color-dot--sm":"_purpur-color-dot--sm_1n98k_9","purpur-color-dot--md":"_purpur-color-dot--md_1n98k_12","purpur-color-dot--lg":"_purpur-color-dot--lg_1n98k_15","purpur-color-dot--with-border":"_purpur-color-dot--with-border_1n98k_18"},l="purpur-color-dot",d={XS:"xs",SM:"sm",MD:"md",LG:"lg"},O=Object.values(d),S=({color:t,["data-testid"]:u,size:e,withBorder:c,...n})=>a.jsx("div",{className:m([p[l],p[`${l}--${e}`],{[p[`${l}--with-border`]]:c}]),"data-testid":u,style:{backgroundColor:t},...n});exports.COLOR_DOT_SIZE=d;exports.ColorDot=S;exports.colorDotSizes=O;
5
+ */(function(r){(function(){var u={}.hasOwnProperty;function s(){for(var t="",o=0;o<arguments.length;o++){var e=arguments[o];e&&(t=n(t,c.call(this,e)))}return t}function c(t){if(typeof t=="string"||typeof t=="number")return this&&this[t]||t;if(typeof t!="object")return"";if(Array.isArray(t))return s.apply(this,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var o="";for(var e in t)u.call(t,e)&&t[e]&&(o=n(o,this&&this[e]||e));return o}function n(t,o){return o?t?t+" "+o:t+o:t}r.exports?(s.default=s,r.exports=s):window.classNames=s})()})(i);var f=i.exports;const _=a(f),m={"purpur-color-dot":"_purpur-color-dot_1n98k_1","purpur-color-dot--xs":"_purpur-color-dot--xs_1n98k_6","purpur-color-dot--sm":"_purpur-color-dot--sm_1n98k_9","purpur-color-dot--md":"_purpur-color-dot--md_1n98k_12","purpur-color-dot--lg":"_purpur-color-dot--lg_1n98k_15","purpur-color-dot--with-border":"_purpur-color-dot--with-border_1n98k_18"},b=_.bind(m),p="purpur-color-dot",l={XS:"xs",SM:"sm",MD:"md",LG:"lg"},h=Object.values(l),O=({color:r,["data-testid"]:u,size:s,withBorder:c,className:n,...t})=>d.jsx("div",{...t,className:b([n,p,`${p}--${s}`,{[`${p}--with-border`]:c}]),"data-testid":u,style:{backgroundColor:r}});exports.COLOR_DOT_SIZE=l;exports.ColorDot=O;exports.colorDotSizes=h;
6
6
  //# sourceMappingURL=color-dot.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"color-dot.cjs.js","sources":["../../../common/temp/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js","../src/color-dot.tsx"],"sourcesContent":["/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import React from \"react\";\nimport c from \"classnames\";\n\nimport styles from \"./color-dot.module.scss\";\nconst rootClassName = \"purpur-color-dot\";\n\nexport const COLOR_DOT_SIZE = {\n XS: \"xs\",\n SM: \"sm\",\n MD: \"md\",\n LG: \"lg\",\n} as const;\n\nexport const colorDotSizes = Object.values(COLOR_DOT_SIZE);\nexport type ColorDotSize = (typeof COLOR_DOT_SIZE)[keyof typeof COLOR_DOT_SIZE];\n\nexport type ColorDotProps = {\n color: string;\n [\"data-testid\"]?: string;\n size: ColorDotSize;\n withBorder?: boolean;\n};\nexport const ColorDot = ({\n color,\n [\"data-testid\"]: dataTestid,\n size,\n withBorder,\n ...props\n}: ColorDotProps) => (\n <div\n className={c([\n styles[rootClassName],\n styles[`${rootClassName}--${size}`],\n { [styles[`${rootClassName}--with-border`]]: withBorder },\n ])}\n data-testid={dataTestid}\n style={{\n backgroundColor: color,\n }}\n {...props}\n />\n);\n"],"names":["hasOwn","classNames","classes","i","arg","appendClass","parseValue","key","value","newClass","module","rootClassName","COLOR_DOT_SIZE","colorDotSizes","ColorDot","color","dataTestid","size","withBorder","props","jsx","c","styles"],"mappings":";;;;gBAOC,UAAY,CAGZ,IAAIA,EAAS,CAAE,EAAC,eAEhB,SAASC,GAAc,CAGtB,QAFIC,EAAU,GAELC,EAAI,EAAGA,EAAI,UAAU,OAAQA,IAAK,CAC1C,IAAIC,EAAM,UAAUD,CAAC,EACjBC,IACHF,EAAUG,EAAYH,EAASI,EAAWF,CAAG,CAAC,EAE/C,CAED,OAAOF,CACP,CAED,SAASI,EAAYF,EAAK,CACzB,GAAI,OAAOA,GAAQ,UAAY,OAAOA,GAAQ,SAC7C,OAAOA,EAGR,GAAI,OAAOA,GAAQ,SAClB,MAAO,GAGR,GAAI,MAAM,QAAQA,CAAG,EACpB,OAAOH,EAAW,MAAM,KAAMG,CAAG,EAGlC,GAAIA,EAAI,WAAa,OAAO,UAAU,UAAY,CAACA,EAAI,SAAS,SAAQ,EAAG,SAAS,eAAe,EAClG,OAAOA,EAAI,WAGZ,IAAIF,EAAU,GAEd,QAASK,KAAOH,EACXJ,EAAO,KAAKI,EAAKG,CAAG,GAAKH,EAAIG,CAAG,IACnCL,EAAUG,EAAYH,EAASK,CAAG,GAIpC,OAAOL,CACP,CAED,SAASG,EAAaG,EAAOC,EAAU,CACtC,OAAKA,EAIDD,EACIA,EAAQ,IAAMC,EAGfD,EAAQC,EAPPD,CAQR,CAEoCE,EAAO,SAC3CT,EAAW,QAAUA,EACrBS,EAAA,QAAiBT,GAOjB,OAAO,WAAaA,CAEtB,kYCxEMU,EAAgB,mBAETC,EAAiB,CAC5B,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,IACN,EAEaC,EAAgB,OAAO,OAAOD,CAAc,EAS5CE,EAAW,CAAC,CACvB,MAAAC,EACA,CAAC,eAAgBC,EACjB,KAAAC,EACA,WAAAC,EACA,GAAGC,CACL,IACEC,EAAA,IAAC,MAAA,CACC,UAAWC,EAAE,CACXC,EAAOX,CAAa,EACpBW,EAAO,GAAGX,CAAa,KAAKM,CAAI,EAAE,EAClC,CAAE,CAACK,EAAO,GAAGX,CAAa,eAAe,CAAC,EAAGO,CAAW,CAAA,CACzD,EACD,cAAaF,EACb,MAAO,CACL,gBAAiBD,CACnB,EACC,GAAGI,CAAA,CACN","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"color-dot.cjs.js","sources":["../../../common/temp/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/bind.js","../src/color-dot.tsx"],"sourcesContent":["/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue.call(this, arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn this && this[arg] || arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(this, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, this && this[key] || key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import React, { DetailedHTMLProps, HTMLAttributes } from \"react\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./color-dot.module.scss\";\n\nconst cx = c.bind(styles);\nconst rootClassName = \"purpur-color-dot\";\n\nexport const COLOR_DOT_SIZE = {\n XS: \"xs\",\n SM: \"sm\",\n MD: \"md\",\n LG: \"lg\",\n} as const;\n\nexport const colorDotSizes = Object.values(COLOR_DOT_SIZE);\nexport type ColorDotSize = (typeof COLOR_DOT_SIZE)[keyof typeof COLOR_DOT_SIZE];\n\ntype InheritedProps = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;\n\nexport type ColorDotProps = {\n color: string;\n [\"data-testid\"]?: string;\n size: ColorDotSize;\n withBorder?: boolean;\n} & InheritedProps;\n\nexport const ColorDot = ({\n color,\n [\"data-testid\"]: dataTestid,\n size,\n withBorder,\n className,\n ...props\n}: ColorDotProps) => (\n <div\n {...props}\n className={cx([\n className,\n rootClassName,\n `${rootClassName}--${size}`,\n { [`${rootClassName}--with-border`]: withBorder },\n ])}\n data-testid={dataTestid}\n style={{\n backgroundColor: color,\n }}\n />\n);\n"],"names":["hasOwn","classNames","classes","i","arg","appendClass","parseValue","key","value","newClass","module","cx","c","styles","rootClassName","COLOR_DOT_SIZE","colorDotSizes","ColorDot","color","dataTestid","size","withBorder","className","props","jsx"],"mappings":";;;;gBAOC,UAAY,CAGZ,IAAIA,EAAS,CAAE,EAAC,eAEhB,SAASC,GAAc,CAGtB,QAFIC,EAAU,GAELC,EAAI,EAAGA,EAAI,UAAU,OAAQA,IAAK,CAC1C,IAAIC,EAAM,UAAUD,CAAC,EACjBC,IACHF,EAAUG,EAAYH,EAASI,EAAW,KAAK,KAAMF,CAAG,CAAC,EAE1D,CAED,OAAOF,CACP,CAED,SAASI,EAAYF,EAAK,CACzB,GAAI,OAAOA,GAAQ,UAAY,OAAOA,GAAQ,SAC7C,OAAO,MAAQ,KAAKA,CAAG,GAAKA,EAG7B,GAAI,OAAOA,GAAQ,SAClB,MAAO,GAGR,GAAI,MAAM,QAAQA,CAAG,EACpB,OAAOH,EAAW,MAAM,KAAMG,CAAG,EAGlC,GAAIA,EAAI,WAAa,OAAO,UAAU,UAAY,CAACA,EAAI,SAAS,SAAQ,EAAG,SAAS,eAAe,EAClG,OAAOA,EAAI,WAGZ,IAAIF,EAAU,GAEd,QAASK,KAAOH,EACXJ,EAAO,KAAKI,EAAKG,CAAG,GAAKH,EAAIG,CAAG,IACnCL,EAAUG,EAAYH,EAAS,MAAQ,KAAKK,CAAG,GAAKA,CAAG,GAIzD,OAAOL,CACP,CAED,SAASG,EAAaG,EAAOC,EAAU,CACtC,OAAKA,EAIDD,EACIA,EAAQ,IAAMC,EAGfD,EAAQC,EAPPD,CAQR,CAEoCE,EAAO,SAC3CT,EAAW,QAAUA,EACrBS,EAAA,QAAiBT,GAOjB,OAAO,WAAaA,CAEtB,kYCvEMU,EAAKC,EAAE,KAAKC,CAAM,EAClBC,EAAgB,mBAETC,EAAiB,CAC5B,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,IACN,EAEaC,EAAgB,OAAO,OAAOD,CAAc,EAY5CE,EAAW,CAAC,CACvB,MAAAC,EACA,CAAC,eAAgBC,EACjB,KAAAC,EACA,WAAAC,EACA,UAAAC,EACA,GAAGC,CACL,IACEC,EAAA,IAAC,MAAA,CACE,GAAGD,EACJ,UAAWZ,EAAG,CACZW,EACAR,EACA,GAAGA,CAAa,KAAKM,CAAI,GACzB,CAAE,CAAC,GAAGN,CAAa,eAAe,EAAGO,CAAW,CAAA,CACjD,EACD,cAAaF,EACb,MAAO,CACL,gBAAiBD,CACnB,CAAA,CACF","x_google_ignoreList":[0]}
@@ -1,4 +1,4 @@
1
- import { default as React } from 'react';
1
+ import { default as React, DetailedHTMLProps, HTMLAttributes } from 'react';
2
2
 
3
3
  export declare const COLOR_DOT_SIZE: {
4
4
  readonly XS: "xs";
@@ -8,11 +8,13 @@ export declare const COLOR_DOT_SIZE: {
8
8
  };
9
9
  export declare const colorDotSizes: ("xs" | "sm" | "md" | "lg")[];
10
10
  export type ColorDotSize = (typeof COLOR_DOT_SIZE)[keyof typeof COLOR_DOT_SIZE];
11
+ type InheritedProps = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
11
12
  export type ColorDotProps = {
12
13
  color: string;
13
14
  ["data-testid"]?: string;
14
15
  size: ColorDotSize;
15
16
  withBorder?: boolean;
16
- };
17
- export declare const ColorDot: ({ color, ["data-testid"]: dataTestid, size, withBorder, ...props }: ColorDotProps) => React.JSX.Element;
17
+ } & InheritedProps;
18
+ export declare const ColorDot: ({ color, ["data-testid"]: dataTestid, size, withBorder, className, ...props }: ColorDotProps) => React.JSX.Element;
19
+ export {};
18
20
  //# sourceMappingURL=color-dot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"color-dot.d.ts","sourceRoot":"","sources":["../src/color-dot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC;AAEX,eAAO,MAAM,aAAa,+BAAgC,CAAC;AAC3D,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAEhF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,QAAQ,uEAMlB,aAAa,sBAaf,CAAC"}
1
+ {"version":3,"file":"color-dot.d.ts","sourceRoot":"","sources":["../src/color-dot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAQjE,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC;AAEX,eAAO,MAAM,aAAa,+BAAgC,CAAC;AAC3D,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAEhF,KAAK,cAAc,GAAG,iBAAiB,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC,CAAC;AAExF,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,cAAc,CAAC;AAEnB,eAAO,MAAM,QAAQ,kFAOlB,aAAa,sBAcf,CAAC"}
@@ -1,80 +1,82 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- function a(t) {
3
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ function d(o) {
3
+ return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
4
4
  }
5
- var d = { exports: {} };
5
+ var i = { exports: {} };
6
6
  /*!
7
7
  Copyright (c) 2018 Jed Watson.
8
8
  Licensed under the MIT License (MIT), see
9
9
  http://jedwatson.github.io/classnames
10
10
  */
11
- (function(t) {
11
+ (function(o) {
12
12
  (function() {
13
13
  var u = {}.hasOwnProperty;
14
14
  function s() {
15
- for (var r = "", o = 0; o < arguments.length; o++) {
16
- var e = arguments[o];
17
- e && (r = n(r, p(e)));
15
+ for (var r = "", t = 0; t < arguments.length; t++) {
16
+ var n = arguments[t];
17
+ n && (r = e(r, p.call(this, n)));
18
18
  }
19
19
  return r;
20
20
  }
21
21
  function p(r) {
22
22
  if (typeof r == "string" || typeof r == "number")
23
- return r;
23
+ return this && this[r] || r;
24
24
  if (typeof r != "object")
25
25
  return "";
26
26
  if (Array.isArray(r))
27
- return s.apply(null, r);
27
+ return s.apply(this, r);
28
28
  if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
29
29
  return r.toString();
30
- var o = "";
31
- for (var e in r)
32
- u.call(r, e) && r[e] && (o = n(o, e));
33
- return o;
30
+ var t = "";
31
+ for (var n in r)
32
+ u.call(r, n) && r[n] && (t = e(t, this && this[n] || n));
33
+ return t;
34
34
  }
35
- function n(r, o) {
36
- return o ? r ? r + " " + o : r + o : r;
35
+ function e(r, t) {
36
+ return t ? r ? r + " " + t : r + t : r;
37
37
  }
38
- t.exports ? (s.default = s, t.exports = s) : window.classNames = s;
38
+ o.exports ? (s.default = s, o.exports = s) : window.classNames = s;
39
39
  })();
40
- })(d);
41
- var f = d.exports;
42
- const _ = /* @__PURE__ */ a(f), c = {
40
+ })(i);
41
+ var a = i.exports;
42
+ const f = /* @__PURE__ */ d(a), _ = {
43
43
  "purpur-color-dot": "_purpur-color-dot_1n98k_1",
44
44
  "purpur-color-dot--xs": "_purpur-color-dot--xs_1n98k_6",
45
45
  "purpur-color-dot--sm": "_purpur-color-dot--sm_1n98k_9",
46
46
  "purpur-color-dot--md": "_purpur-color-dot--md_1n98k_12",
47
47
  "purpur-color-dot--lg": "_purpur-color-dot--lg_1n98k_15",
48
48
  "purpur-color-dot--with-border": "_purpur-color-dot--with-border_1n98k_18"
49
- }, l = "purpur-color-dot", m = {
49
+ }, m = f.bind(_), c = "purpur-color-dot", h = {
50
50
  XS: "xs",
51
51
  SM: "sm",
52
52
  MD: "md",
53
53
  LG: "lg"
54
- }, b = Object.values(m), O = ({
55
- color: t,
54
+ }, y = Object.values(h), O = ({
55
+ color: o,
56
56
  ["data-testid"]: u,
57
57
  size: s,
58
58
  withBorder: p,
59
- ...n
60
- }) => /* @__PURE__ */ i(
59
+ className: e,
60
+ ...r
61
+ }) => /* @__PURE__ */ l(
61
62
  "div",
62
63
  {
63
- className: _([
64
- c[l],
65
- c[`${l}--${s}`],
66
- { [c[`${l}--with-border`]]: p }
64
+ ...r,
65
+ className: m([
66
+ e,
67
+ c,
68
+ `${c}--${s}`,
69
+ { [`${c}--with-border`]: p }
67
70
  ]),
68
71
  "data-testid": u,
69
72
  style: {
70
- backgroundColor: t
71
- },
72
- ...n
73
+ backgroundColor: o
74
+ }
73
75
  }
74
76
  );
75
77
  export {
76
- m as COLOR_DOT_SIZE,
78
+ h as COLOR_DOT_SIZE,
77
79
  O as ColorDot,
78
- b as colorDotSizes
80
+ y as colorDotSizes
79
81
  };
80
82
  //# sourceMappingURL=color-dot.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"color-dot.es.js","sources":["../../../common/temp/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js","../src/color-dot.tsx"],"sourcesContent":["/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import React from \"react\";\nimport c from \"classnames\";\n\nimport styles from \"./color-dot.module.scss\";\nconst rootClassName = \"purpur-color-dot\";\n\nexport const COLOR_DOT_SIZE = {\n XS: \"xs\",\n SM: \"sm\",\n MD: \"md\",\n LG: \"lg\",\n} as const;\n\nexport const colorDotSizes = Object.values(COLOR_DOT_SIZE);\nexport type ColorDotSize = (typeof COLOR_DOT_SIZE)[keyof typeof COLOR_DOT_SIZE];\n\nexport type ColorDotProps = {\n color: string;\n [\"data-testid\"]?: string;\n size: ColorDotSize;\n withBorder?: boolean;\n};\nexport const ColorDot = ({\n color,\n [\"data-testid\"]: dataTestid,\n size,\n withBorder,\n ...props\n}: ColorDotProps) => (\n <div\n className={c([\n styles[rootClassName],\n styles[`${rootClassName}--${size}`],\n { [styles[`${rootClassName}--with-border`]]: withBorder },\n ])}\n data-testid={dataTestid}\n style={{\n backgroundColor: color,\n }}\n {...props}\n />\n);\n"],"names":["hasOwn","classNames","classes","i","arg","appendClass","parseValue","key","value","newClass","module","rootClassName","COLOR_DOT_SIZE","colorDotSizes","ColorDot","color","dataTestid","size","withBorder","props","jsx","c","styles"],"mappings":";;;;;;;;;;;AAOA,GAAC,WAAY;AAGZ,QAAIA,IAAS,CAAE,EAAC;AAEhB,aAASC,IAAc;AAGtB,eAFIC,IAAU,IAELC,IAAI,GAAGA,IAAI,UAAU,QAAQA,KAAK;AAC1C,YAAIC,IAAM,UAAUD,CAAC;AACrB,QAAIC,MACHF,IAAUG,EAAYH,GAASI,EAAWF,CAAG,CAAC;AAAA,MAE/C;AAED,aAAOF;AAAA,IACP;AAED,aAASI,EAAYF,GAAK;AACzB,UAAI,OAAOA,KAAQ,YAAY,OAAOA,KAAQ;AAC7C,eAAOA;AAGR,UAAI,OAAOA,KAAQ;AAClB,eAAO;AAGR,UAAI,MAAM,QAAQA,CAAG;AACpB,eAAOH,EAAW,MAAM,MAAMG,CAAG;AAGlC,UAAIA,EAAI,aAAa,OAAO,UAAU,YAAY,CAACA,EAAI,SAAS,SAAQ,EAAG,SAAS,eAAe;AAClG,eAAOA,EAAI;AAGZ,UAAIF,IAAU;AAEd,eAASK,KAAOH;AACf,QAAIJ,EAAO,KAAKI,GAAKG,CAAG,KAAKH,EAAIG,CAAG,MACnCL,IAAUG,EAAYH,GAASK,CAAG;AAIpC,aAAOL;AAAA,IACP;AAED,aAASG,EAAaG,GAAOC,GAAU;AACtC,aAAKA,IAIDD,IACIA,IAAQ,MAAMC,IAGfD,IAAQC,IAPPD;AAAA,IAQR;AAED,IAAqCE,EAAO,WAC3CT,EAAW,UAAUA,GACrBS,EAAA,UAAiBT,KAOjB,OAAO,aAAaA;AAAA,EAEtB;;;;;;;;;;GCxEMU,IAAgB,oBAETC,IAAiB;AAAA,EAC5B,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEaC,IAAgB,OAAO,OAAOD,CAAc,GAS5CE,IAAW,CAAC;AAAA,EACvB,OAAAC;AAAA,EACA,CAAC,gBAAgBC;AAAA,EACjB,MAAAC;AAAA,EACA,YAAAC;AAAA,EACA,GAAGC;AACL,MACE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC,EAAE;AAAA,MACXC,EAAOX,CAAa;AAAA,MACpBW,EAAO,GAAGX,CAAa,KAAKM,CAAI,EAAE;AAAA,MAClC,EAAE,CAACK,EAAO,GAAGX,CAAa,eAAe,CAAC,GAAGO,EAAW;AAAA,IAAA,CACzD;AAAA,IACD,eAAaF;AAAA,IACb,OAAO;AAAA,MACL,iBAAiBD;AAAA,IACnB;AAAA,IACC,GAAGI;AAAA,EAAA;AACN;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"color-dot.es.js","sources":["../../../common/temp/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/bind.js","../src/color-dot.tsx"],"sourcesContent":["/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue.call(this, arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn this && this[arg] || arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(this, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, this && this[key] || key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import React, { DetailedHTMLProps, HTMLAttributes } from \"react\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./color-dot.module.scss\";\n\nconst cx = c.bind(styles);\nconst rootClassName = \"purpur-color-dot\";\n\nexport const COLOR_DOT_SIZE = {\n XS: \"xs\",\n SM: \"sm\",\n MD: \"md\",\n LG: \"lg\",\n} as const;\n\nexport const colorDotSizes = Object.values(COLOR_DOT_SIZE);\nexport type ColorDotSize = (typeof COLOR_DOT_SIZE)[keyof typeof COLOR_DOT_SIZE];\n\ntype InheritedProps = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;\n\nexport type ColorDotProps = {\n color: string;\n [\"data-testid\"]?: string;\n size: ColorDotSize;\n withBorder?: boolean;\n} & InheritedProps;\n\nexport const ColorDot = ({\n color,\n [\"data-testid\"]: dataTestid,\n size,\n withBorder,\n className,\n ...props\n}: ColorDotProps) => (\n <div\n {...props}\n className={cx([\n className,\n rootClassName,\n `${rootClassName}--${size}`,\n { [`${rootClassName}--with-border`]: withBorder },\n ])}\n data-testid={dataTestid}\n style={{\n backgroundColor: color,\n }}\n />\n);\n"],"names":["hasOwn","classNames","classes","i","arg","appendClass","parseValue","key","value","newClass","module","cx","c","styles","rootClassName","COLOR_DOT_SIZE","colorDotSizes","ColorDot","color","dataTestid","size","withBorder","className","props","jsx"],"mappings":";;;;;;;;;;;AAOA,GAAC,WAAY;AAGZ,QAAIA,IAAS,CAAE,EAAC;AAEhB,aAASC,IAAc;AAGtB,eAFIC,IAAU,IAELC,IAAI,GAAGA,IAAI,UAAU,QAAQA,KAAK;AAC1C,YAAIC,IAAM,UAAUD,CAAC;AACrB,QAAIC,MACHF,IAAUG,EAAYH,GAASI,EAAW,KAAK,MAAMF,CAAG,CAAC;AAAA,MAE1D;AAED,aAAOF;AAAA,IACP;AAED,aAASI,EAAYF,GAAK;AACzB,UAAI,OAAOA,KAAQ,YAAY,OAAOA,KAAQ;AAC7C,eAAO,QAAQ,KAAKA,CAAG,KAAKA;AAG7B,UAAI,OAAOA,KAAQ;AAClB,eAAO;AAGR,UAAI,MAAM,QAAQA,CAAG;AACpB,eAAOH,EAAW,MAAM,MAAMG,CAAG;AAGlC,UAAIA,EAAI,aAAa,OAAO,UAAU,YAAY,CAACA,EAAI,SAAS,SAAQ,EAAG,SAAS,eAAe;AAClG,eAAOA,EAAI;AAGZ,UAAIF,IAAU;AAEd,eAASK,KAAOH;AACf,QAAIJ,EAAO,KAAKI,GAAKG,CAAG,KAAKH,EAAIG,CAAG,MACnCL,IAAUG,EAAYH,GAAS,QAAQ,KAAKK,CAAG,KAAKA,CAAG;AAIzD,aAAOL;AAAA,IACP;AAED,aAASG,EAAaG,GAAOC,GAAU;AACtC,aAAKA,IAIDD,IACIA,IAAQ,MAAMC,IAGfD,IAAQC,IAPPD;AAAA,IAQR;AAED,IAAqCE,EAAO,WAC3CT,EAAW,UAAUA,GACrBS,EAAA,UAAiBT,KAOjB,OAAO,aAAaA;AAAA,EAEtB;;;;;;;;;;GCvEMU,IAAKC,EAAE,KAAKC,CAAM,GAClBC,IAAgB,oBAETC,IAAiB;AAAA,EAC5B,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEaC,IAAgB,OAAO,OAAOD,CAAc,GAY5CE,IAAW,CAAC;AAAA,EACvB,OAAAC;AAAA,EACA,CAAC,gBAAgBC;AAAA,EACjB,MAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,MACE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACE,GAAGD;AAAA,IACJ,WAAWZ,EAAG;AAAA,MACZW;AAAA,MACAR;AAAA,MACA,GAAGA,CAAa,KAAKM,CAAI;AAAA,MACzB,EAAE,CAAC,GAAGN,CAAa,eAAe,GAAGO,EAAW;AAAA,IAAA,CACjD;AAAA,IACD,eAAaF;AAAA,IACb,OAAO;AAAA,MACL,iBAAiBD;AAAA,IACnB;AAAA,EAAA;AACF;","x_google_ignoreList":[0]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@purpurds/color-dot",
3
- "version": "5.4.3",
3
+ "version": "5.6.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "main": "./dist/color-dot.cjs.js",
6
6
  "types": "./dist/color-dot.d.ts",
@@ -15,7 +15,7 @@
15
15
  "source": "src/color-dot.tsx",
16
16
  "dependencies": {
17
17
  "classnames": "~2.5.0",
18
- "@purpurds/tokens": "5.4.3"
18
+ "@purpurds/tokens": "5.6.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@rushstack/eslint-patch": "~1.10.0",
package/readme.mdx CHANGED
@@ -35,10 +35,6 @@ In MyComponent.tsx
35
35
  import { ColorDot } from "@purpurds/purpur";
36
36
 
37
37
  export const MyComponent = () => {
38
- return (
39
- <div>
40
- <ColorDot {...someProps}>Some content</ColorDot>
41
- </div>
42
- );
38
+ return <ColorDot color="#000000" size="sm" withBorder />;
43
39
  };
44
40
  ```
@@ -1,16 +1,53 @@
1
1
  import React from "react";
2
2
  import * as matchers from "@testing-library/jest-dom/matchers";
3
- import { render, screen } from "@testing-library/react";
4
- import { describe, expect, it } from "vitest";
3
+ import { cleanup, render, screen } from "@testing-library/react";
4
+ import { afterEach, describe, expect, it } from "vitest";
5
5
 
6
6
  import { ColorDot } from "./color-dot";
7
7
 
8
8
  expect.extend(matchers);
9
9
 
10
10
  describe("ColorDot", () => {
11
+ afterEach(cleanup);
12
+
11
13
  it("should use the color prop as background color", () => {
12
14
  render(<ColorDot color="#000000" size="md" data-testid="color-dot" />);
13
15
 
14
16
  expect(screen.getByTestId("color-dot")).toHaveStyle("background-color: #000000");
15
17
  });
18
+
19
+ it("should be extendable for styling, also keep existing", () => {
20
+ render(
21
+ <ColorDot
22
+ color="#000000"
23
+ size="md"
24
+ withBorder={true}
25
+ className="custom-styling"
26
+ data-testid="color-dot"
27
+ />
28
+ );
29
+
30
+ const colorDot = screen.getByTestId("color-dot");
31
+
32
+ expect(colorDot).toHaveClass("purpur-color-dot");
33
+ expect(colorDot).toHaveClass("purpur-color-dot--md");
34
+ expect(colorDot).toHaveClass("purpur-color-dot--with-border");
35
+ expect(colorDot).toHaveClass("custom-styling");
36
+ });
37
+
38
+ it('should pass through "data-" & accessibility attributes', () => {
39
+ render(
40
+ <ColorDot
41
+ color="#000000"
42
+ size="md"
43
+ data-testid="color-dot"
44
+ data-test-id="other-convention"
45
+ aria-label="red colored dot"
46
+ />
47
+ );
48
+
49
+ const colorDot = screen.getByTestId("color-dot");
50
+ expect(colorDot).toHaveAttribute("data-test-id", "other-convention");
51
+ expect(colorDot).toHaveAccessibleName("red colored dot");
52
+ });
16
53
  });
package/src/color-dot.tsx CHANGED
@@ -1,7 +1,9 @@
1
- import React from "react";
2
- import c from "classnames";
1
+ import React, { DetailedHTMLProps, HTMLAttributes } from "react";
2
+ import c from "classnames/bind";
3
3
 
4
4
  import styles from "./color-dot.module.scss";
5
+
6
+ const cx = c.bind(styles);
5
7
  const rootClassName = "purpur-color-dot";
6
8
 
7
9
  export const COLOR_DOT_SIZE = {
@@ -14,29 +16,34 @@ export const COLOR_DOT_SIZE = {
14
16
  export const colorDotSizes = Object.values(COLOR_DOT_SIZE);
15
17
  export type ColorDotSize = (typeof COLOR_DOT_SIZE)[keyof typeof COLOR_DOT_SIZE];
16
18
 
19
+ type InheritedProps = DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
20
+
17
21
  export type ColorDotProps = {
18
22
  color: string;
19
23
  ["data-testid"]?: string;
20
24
  size: ColorDotSize;
21
25
  withBorder?: boolean;
22
- };
26
+ } & InheritedProps;
27
+
23
28
  export const ColorDot = ({
24
29
  color,
25
30
  ["data-testid"]: dataTestid,
26
31
  size,
27
32
  withBorder,
33
+ className,
28
34
  ...props
29
35
  }: ColorDotProps) => (
30
36
  <div
31
- className={c([
32
- styles[rootClassName],
33
- styles[`${rootClassName}--${size}`],
34
- { [styles[`${rootClassName}--with-border`]]: withBorder },
37
+ {...props}
38
+ className={cx([
39
+ className,
40
+ rootClassName,
41
+ `${rootClassName}--${size}`,
42
+ { [`${rootClassName}--with-border`]: withBorder },
35
43
  ])}
36
44
  data-testid={dataTestid}
37
45
  style={{
38
46
  backgroundColor: color,
39
47
  }}
40
- {...props}
41
48
  />
42
49
  );