@purpurds/color-dot 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,31 @@
1
+ Name: classnames
2
+ Version: 2.5.1
3
+ License: MIT
4
+ Private: false
5
+ Description: A simple utility for conditionally joining classNames together
6
+ Repository: git+https://github.com/JedWatson/classnames.git
7
+ Author: Jed Watson
8
+ License Copyright:
9
+ ===
10
+
11
+ The MIT License (MIT)
12
+
13
+ Copyright (c) 2018 Jed Watson
14
+
15
+ Permission is hereby granted, free of charge, to any person obtaining a copy
16
+ of this software and associated documentation files (the "Software"), to deal
17
+ in the Software without restriction, including without limitation the rights
18
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
+ copies of the Software, and to permit persons to whom the Software is
20
+ furnished to do so, subject to the following conditions:
21
+
22
+ The above copyright notice and this permission notice shall be included in all
23
+ copies or substantial portions of the Software.
24
+
25
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ SOFTWARE.
@@ -0,0 +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:{}};/*!
2
+ Copyright (c) 2018 Jed Watson.
3
+ Licensed under the MIT License (MIT), see
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;
6
+ //# sourceMappingURL=color-dot.cjs.js.map
@@ -0,0 +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]}
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ export declare const COLOR_DOT_SIZE: {
3
+ readonly XS: "xs";
4
+ readonly SM: "sm";
5
+ readonly MD: "md";
6
+ readonly LG: "lg";
7
+ };
8
+ export declare const colorDotSizes: ("xs" | "sm" | "md" | "lg")[];
9
+ export type ColorDotSize = (typeof COLOR_DOT_SIZE)[keyof typeof COLOR_DOT_SIZE];
10
+ export type ColorDotProps = {
11
+ color: string;
12
+ ["data-testid"]?: string;
13
+ size: ColorDotSize;
14
+ withBorder?: boolean;
15
+ };
16
+ export declare const ColorDot: ({ color, ["data-testid"]: dataTestid, size, withBorder, ...props }: ColorDotProps) => React.JSX.Element;
17
+ //# sourceMappingURL=color-dot.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,80 @@
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;
4
+ }
5
+ var d = { exports: {} };
6
+ /*!
7
+ Copyright (c) 2018 Jed Watson.
8
+ Licensed under the MIT License (MIT), see
9
+ http://jedwatson.github.io/classnames
10
+ */
11
+ (function(t) {
12
+ (function() {
13
+ var u = {}.hasOwnProperty;
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)));
18
+ }
19
+ return r;
20
+ }
21
+ function p(r) {
22
+ if (typeof r == "string" || typeof r == "number")
23
+ return r;
24
+ if (typeof r != "object")
25
+ return "";
26
+ if (Array.isArray(r))
27
+ return s.apply(null, r);
28
+ if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
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;
34
+ }
35
+ function n(r, o) {
36
+ return o ? r ? r + " " + o : r + o : r;
37
+ }
38
+ t.exports ? (s.default = s, t.exports = s) : window.classNames = s;
39
+ })();
40
+ })(d);
41
+ var f = d.exports;
42
+ const _ = /* @__PURE__ */ a(f), c = {
43
+ "purpur-color-dot": "_purpur-color-dot_1n98k_1",
44
+ "purpur-color-dot--xs": "_purpur-color-dot--xs_1n98k_6",
45
+ "purpur-color-dot--sm": "_purpur-color-dot--sm_1n98k_9",
46
+ "purpur-color-dot--md": "_purpur-color-dot--md_1n98k_12",
47
+ "purpur-color-dot--lg": "_purpur-color-dot--lg_1n98k_15",
48
+ "purpur-color-dot--with-border": "_purpur-color-dot--with-border_1n98k_18"
49
+ }, l = "purpur-color-dot", m = {
50
+ XS: "xs",
51
+ SM: "sm",
52
+ MD: "md",
53
+ LG: "lg"
54
+ }, b = Object.values(m), O = ({
55
+ color: t,
56
+ ["data-testid"]: u,
57
+ size: s,
58
+ withBorder: p,
59
+ ...n
60
+ }) => /* @__PURE__ */ i(
61
+ "div",
62
+ {
63
+ className: _([
64
+ c[l],
65
+ c[`${l}--${s}`],
66
+ { [c[`${l}--with-border`]]: p }
67
+ ]),
68
+ "data-testid": u,
69
+ style: {
70
+ backgroundColor: t
71
+ },
72
+ ...n
73
+ }
74
+ );
75
+ export {
76
+ m as COLOR_DOT_SIZE,
77
+ O as ColorDot,
78
+ b as colorDotSizes
79
+ };
80
+ //# sourceMappingURL=color-dot.es.js.map
@@ -0,0 +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","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gBC;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]}
@@ -0,0 +1,6 @@
1
+ System.register(["react"],function(u,S){"use strict";var d;return{setters:[c=>{d=c.default}],execute:function(){function c(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var f={exports:{}};/*!
2
+ Copyright (c) 2018 Jed Watson.
3
+ Licensed under the MIT License (MIT), see
4
+ http://jedwatson.github.io/classnames
5
+ */(function(o){(function(){var i={}.hasOwnProperty;function e(){for(var r="",t=0;t<arguments.length;t++){var s=arguments[t];s&&(r=n(r,a(s)))}return r}function a(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 t="";for(var s in r)i.call(r,s)&&r[s]&&(t=n(t,s));return t}function n(r,t){return t?r?r+" "+t:r+t:r}o.exports?(e.default=e,o.exports=e):window.classNames=e})()})(f);var _=f.exports;const m=c(_),l={"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"},p="purpur-color-dot",O=u("COLOR_DOT_SIZE",{XS:"xs",SM:"sm",MD:"md",LG:"lg"}),y=u("colorDotSizes",Object.values(O)),b=u("ColorDot",({color:o,["data-testid"]:i,size:e,withBorder:a,...n})=>d.createElement("div",{className:m([l[p],l[`${p}--${e}`],{[l[`${p}--with-border`]]:a}]),"data-testid":i,style:{backgroundColor:o},...n}))}}});
6
+ //# sourceMappingURL=color-dot.system.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-dot.system.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","exports","colorDotSizes","ColorDot","color","dataTestid","size","withBorder","props","React","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,O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-border-radius-full);height:var(--size);width:var(--size)}._purpur-color-dot--xs_1n98k_6{--size: var(--purpur-spacing-150)}._purpur-color-dot--sm_1n98k_9{--size: var(--purpur-spacing-300)}._purpur-color-dot--md_1n98k_12{--size: var(--purpur-spacing-400)}._purpur-color-dot--lg_1n98k_15{--size: var(--purpur-spacing-600)}._purpur-color-dot--with-border_1n98k_18{--border-width: var(--purpur-border-width-xs);box-shadow:0 0 0 var(--border-width) var(--purpur-color-border-medium);height:calc(var(--size) - var(--border-width) * 2);margin:var(--border-width);width:calc(var(--size) - var(--border-width) * 2)}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@purpurds/color-dot",
3
+ "version": "3.0.0",
4
+ "license": "AGPL-3.0-only",
5
+ "main": "./dist/color-dot.cjs.js",
6
+ "types": "./dist/color-dot.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "require": "./dist/color-dot.cjs.js",
10
+ "systemjs": "./dist/color-dot.system.js",
11
+ "types": "./dist/color-dot.d.ts",
12
+ "default": "./dist/color-dot.es.js"
13
+ },
14
+ "./styles": "./dist/styles.css"
15
+ },
16
+ "source": "src/color-dot.tsx",
17
+ "dependencies": {
18
+ "classnames": "~2.5.0",
19
+ "@purpurds/tokens": "3.0.0"
20
+ },
21
+ "devDependencies": {
22
+ "@rushstack/eslint-patch": "~1.7.0",
23
+ "@storybook/blocks": "~7.6.0",
24
+ "@storybook/react": "~7.6.0",
25
+ "@telia/base-rig": "~8.2.0",
26
+ "@telia/react-rig": "~3.2.0",
27
+ "@testing-library/dom": "~9.3.3",
28
+ "@testing-library/jest-dom": "~6.3.0",
29
+ "@testing-library/react": "~14.1.2",
30
+ "@types/node": "18",
31
+ "@types/react-dom": "~18.2.17",
32
+ "@types/react": "~18.2.42",
33
+ "eslint-plugin-testing-library": "~6.2.0",
34
+ "eslint": "~8.56.0",
35
+ "jsdom": "~22.1.0",
36
+ "lint-staged": "~10.5.3",
37
+ "prettier": "~2.8.8",
38
+ "react-dom": "~18.2.0",
39
+ "react": "~18.2.0",
40
+ "typescript": "~5.2.2",
41
+ "vite": "~5.0.6",
42
+ "vitest": "~1.2.0",
43
+ "@purpurds/component-rig": "1.0.0"
44
+ },
45
+ "scripts": {
46
+ "build:dev": "vite",
47
+ "build:watch": "vite build --watch",
48
+ "build": "rm -rf dist && vite build && vite build --mode systemjs",
49
+ "ci:build": "rushx build",
50
+ "coverage": "vitest run --coverage",
51
+ "lint:fix": "eslint . --fix",
52
+ "lint": "lint-staged --no-stash 2>&1",
53
+ "sbdev": "rush sbdev",
54
+ "test:unit": "vitest run --passWithNoTests",
55
+ "test:watch": "vitest --watch",
56
+ "test": "rushx test:unit",
57
+ "typecheck": "tsc -p ./tsconfig.json"
58
+ }
59
+ }
package/readme.mdx ADDED
@@ -0,0 +1,56 @@
1
+ import { Meta, Stories, ArgTypes, Primary, Title, Subtitle } from "@storybook/blocks";
2
+
3
+ import * as ColorDotStories from "./src/color-dot.stories";
4
+ import packageInfo from "./package.json";
5
+
6
+ <Meta name="Docs" title="Components/ColorDot" of={ColorDotStories} />
7
+
8
+ # ColorDot
9
+
10
+ <Subtitle>Version {packageInfo.version}</Subtitle>
11
+
12
+ ### Showcase
13
+
14
+ <Primary />
15
+
16
+ ### Properties
17
+
18
+ <ArgTypes />
19
+
20
+ ### Installation
21
+
22
+ #### Via NPM
23
+
24
+ Add the dependency to your consumer app like `"@purpurds/color-dot": "x.y.z"`
25
+
26
+ #### From outside the monorepo (build-time)
27
+
28
+ To install this package, you need to setup access to the artifactory. [Click here to go to the guide on how to do that](https://github.com/telia-company/jfrog-documentation/blob/main/doc/JFrog/JFrog_Onboarding.md#getting-access-to-artifactory-and-other-jfrog-applications).
29
+
30
+ ---
31
+
32
+ In MyApp.tsx
33
+
34
+ ```tsx
35
+ import "@purpurds/tokens/index.css";
36
+ ```
37
+
38
+ and
39
+
40
+ ```tsx
41
+ import "@purpurds/color-dot/styles";
42
+ ```
43
+
44
+ In MyComponent.tsx
45
+
46
+ ```tsx
47
+ import { ColorDot } from "@purpurds/color-dot";
48
+
49
+ export const MyComponent = () => {
50
+ return (
51
+ <div>
52
+ <ColorDot {...someProps}>Some content</ColorDot>
53
+ </div>
54
+ );
55
+ };
56
+ ```
@@ -0,0 +1,30 @@
1
+ .purpur-color-dot {
2
+ border-radius: var(--purpur-border-radius-full);
3
+ height: var(--size);
4
+ width: var(--size);
5
+
6
+ &--xs {
7
+ --size: var(--purpur-spacing-150);
8
+ }
9
+
10
+ &--sm {
11
+ --size: var(--purpur-spacing-300);
12
+ }
13
+
14
+ &--md {
15
+ --size: var(--purpur-spacing-400);
16
+ }
17
+
18
+ &--lg {
19
+ --size: var(--purpur-spacing-600);
20
+ }
21
+
22
+ &--with-border {
23
+ --border-width: var(--purpur-border-width-xs);
24
+
25
+ box-shadow: 0 0 0 var(--border-width) var(--purpur-color-border-medium);
26
+ height: calc(var(--size) - var(--border-width) * 2);
27
+ margin: var(--border-width);
28
+ width: calc(var(--size) - var(--border-width) * 2);
29
+ }
30
+ }
@@ -0,0 +1,41 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+
3
+ import { ColorDot, colorDotSizes } from "./color-dot";
4
+
5
+ const meta: Meta<typeof ColorDot> = {
6
+ title: "Components/ColorDot",
7
+ component: ColorDot,
8
+ parameters: {
9
+ design: [
10
+ {
11
+ name: "ColorDot",
12
+ type: "figma",
13
+ url:
14
+ "https://www.figma.com/file/XEaIIFskrrxIBHMZDkIuIg/Purpur-DS---Component-Library?type=design&node-id=15231%3A11910&mode=design&t=TTWh3P41D9X0QeNO-1",
15
+ },
16
+ ],
17
+ },
18
+ argTypes: {
19
+ color: {
20
+ control: { type: "color" },
21
+ },
22
+ size: {
23
+ control: { type: "select" },
24
+ options: colorDotSizes,
25
+ },
26
+ withBorder: {
27
+ control: { type: "boolean" },
28
+ },
29
+ },
30
+ };
31
+ export default meta;
32
+
33
+ type Story = StoryObj<typeof ColorDot>;
34
+
35
+ export const Showcase: Story = {
36
+ args: {
37
+ color: "#990ae3",
38
+ size: "md",
39
+ withBorder: false,
40
+ },
41
+ };
@@ -0,0 +1,16 @@
1
+ import React from "react";
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";
5
+
6
+ import { ColorDot } from "./color-dot";
7
+
8
+ expect.extend(matchers);
9
+
10
+ describe("ColorDot", () => {
11
+ it("should use the color prop as background color", () => {
12
+ render(<ColorDot color="#000000" size="md" data-testid="color-dot" />);
13
+
14
+ expect(screen.getByTestId("color-dot")).toHaveStyle("background-color: #000000");
15
+ });
16
+ });
@@ -0,0 +1,42 @@
1
+ import React from "react";
2
+ import c from "classnames";
3
+
4
+ import styles from "./color-dot.module.scss";
5
+ const rootClassName = "purpur-color-dot";
6
+
7
+ export const COLOR_DOT_SIZE = {
8
+ XS: "xs",
9
+ SM: "sm",
10
+ MD: "md",
11
+ LG: "lg",
12
+ } as const;
13
+
14
+ export const colorDotSizes = Object.values(COLOR_DOT_SIZE);
15
+ export type ColorDotSize = (typeof COLOR_DOT_SIZE)[keyof typeof COLOR_DOT_SIZE];
16
+
17
+ export type ColorDotProps = {
18
+ color: string;
19
+ ["data-testid"]?: string;
20
+ size: ColorDotSize;
21
+ withBorder?: boolean;
22
+ };
23
+ export const ColorDot = ({
24
+ color,
25
+ ["data-testid"]: dataTestid,
26
+ size,
27
+ withBorder,
28
+ ...props
29
+ }: ColorDotProps) => (
30
+ <div
31
+ className={c([
32
+ styles[rootClassName],
33
+ styles[`${rootClassName}--${size}`],
34
+ { [styles[`${rootClassName}--with-border`]]: withBorder },
35
+ ])}
36
+ data-testid={dataTestid}
37
+ style={{
38
+ backgroundColor: color,
39
+ }}
40
+ {...props}
41
+ />
42
+ );
@@ -0,0 +1,4 @@
1
+ declare module "*.scss" {
2
+ const styles: { [className: string]: string };
3
+ export default styles;
4
+ }