willba-component-library 0.0.21 → 0.0.24
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/lib/index.umd.js +115 -0
- package/lib/index.umd.js.map +1 -0
- package/package.json +1 -1
- package/rollup.config.mjs +13 -0
package/lib/index.umd.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.index = {}, global.React));
|
|
5
|
+
})(this, (function (exports, React) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function getDefaultExportFromCjs (x) {
|
|
8
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
var classnames = {exports: {}};
|
|
12
|
+
|
|
13
|
+
/*!
|
|
14
|
+
Copyright (c) 2018 Jed Watson.
|
|
15
|
+
Licensed under the MIT License (MIT), see
|
|
16
|
+
http://jedwatson.github.io/classnames
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
(function (module) {
|
|
20
|
+
/* global define */
|
|
21
|
+
|
|
22
|
+
(function () {
|
|
23
|
+
|
|
24
|
+
var hasOwn = {}.hasOwnProperty;
|
|
25
|
+
|
|
26
|
+
function classNames() {
|
|
27
|
+
var classes = [];
|
|
28
|
+
|
|
29
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
30
|
+
var arg = arguments[i];
|
|
31
|
+
if (!arg) continue;
|
|
32
|
+
|
|
33
|
+
var argType = typeof arg;
|
|
34
|
+
|
|
35
|
+
if (argType === 'string' || argType === 'number') {
|
|
36
|
+
classes.push(arg);
|
|
37
|
+
} else if (Array.isArray(arg)) {
|
|
38
|
+
if (arg.length) {
|
|
39
|
+
var inner = classNames.apply(null, arg);
|
|
40
|
+
if (inner) {
|
|
41
|
+
classes.push(inner);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
} else if (argType === 'object') {
|
|
45
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
|
|
46
|
+
classes.push(arg.toString());
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
for (var key in arg) {
|
|
51
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
52
|
+
classes.push(key);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return classes.join(' ');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (module.exports) {
|
|
62
|
+
classNames.default = classNames;
|
|
63
|
+
module.exports = classNames;
|
|
64
|
+
} else {
|
|
65
|
+
window.classNames = classNames;
|
|
66
|
+
}
|
|
67
|
+
}());
|
|
68
|
+
} (classnames));
|
|
69
|
+
|
|
70
|
+
var classnamesExports = classnames.exports;
|
|
71
|
+
var classNames = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
|
|
72
|
+
|
|
73
|
+
function styleInject(css, ref) {
|
|
74
|
+
if ( ref === void 0 ) ref = {};
|
|
75
|
+
var insertAt = ref.insertAt;
|
|
76
|
+
|
|
77
|
+
if (!css || typeof document === 'undefined') { return; }
|
|
78
|
+
|
|
79
|
+
var head = document.head || document.getElementsByTagName('head')[0];
|
|
80
|
+
var style = document.createElement('style');
|
|
81
|
+
style.type = 'text/css';
|
|
82
|
+
|
|
83
|
+
if (insertAt === 'top') {
|
|
84
|
+
if (head.firstChild) {
|
|
85
|
+
head.insertBefore(style, head.firstChild);
|
|
86
|
+
} else {
|
|
87
|
+
head.appendChild(style);
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
head.appendChild(style);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (style.styleSheet) {
|
|
94
|
+
style.styleSheet.cssText = css;
|
|
95
|
+
} else {
|
|
96
|
+
style.appendChild(document.createTextNode(css));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
var css_248z = ".storybook-button {\n font-family: 'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;\n font-weight: 700;\n border: 0;\n border-radius: 3em;\n cursor: pointer;\n display: inline-block;\n line-height: 1;\n}\n.storybook-button--primary {\n color: white;\n background-color: #1ea7fd;\n}\n.storybook-button--secondary {\n color: #333;\n background-color: transparent;\n box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 0px 1px inset;\n}\n.storybook-button--small {\n font-size: 12px;\n padding: 10px 16px;\n}\n.storybook-button--medium {\n font-size: 14px;\n padding: 11px 20px;\n}\n.storybook-button--large {\n font-size: 16px;\n padding: 12px 24px;\n}";
|
|
101
|
+
styleInject(css_248z);
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Primary UI component for user interaction
|
|
105
|
+
*/
|
|
106
|
+
var Button = function (_a) {
|
|
107
|
+
var _b = _a.type, type = _b === void 0 ? "primary" : _b, textColor = _a.textColor, _c = _a.size, size = _c === void 0 ? "medium" : _c, onClick = _a.onClick, label = _a.label;
|
|
108
|
+
var _d = React.useState(4), theState = _d[0]; _d[1];
|
|
109
|
+
return (React.createElement("button", { type: "button", className: classNames("storybook-button", "storybook-button--".concat(size), "storybook-button--".concat(type)), style: textColor ? { color: textColor } : {}, onClick: onClick }, "".concat(label, " ").concat(theState)));
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
exports.Button = Button;
|
|
113
|
+
|
|
114
|
+
}));
|
|
115
|
+
//# sourceMappingURL=index.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../node_modules/classnames/index.js","../node_modules/style-inject/dist/style-inject.es.js","../src/components/Button/Button.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\tvar nativeCodeString = '[native code]';\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) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\tif (arg.length) {\n\t\t\t\t\tvar inner = classNames.apply(null, arg);\n\t\t\t\t\tif (inner) {\n\t\t\t\t\t\tclasses.push(inner);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\t\t\tclasses.push(arg.toString());\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\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","function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n","import React, { useState } from \"react\";\nimport classNames from \"classnames\";\nimport \"./button.css\";\n\nexport interface ButtonProps {\n /**\n * Is this the principal call to action on the page?\n */\n type?: \"primary\" | \"secondary\";\n /**\n * What background color to use\n */\n textColor?: string;\n /**\n * How large should the button be?\n */\n size?: \"small\" | \"medium\" | \"large\";\n /**\n * Button contents\n */\n label: string;\n /**\n * Optional click handler\n */\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n}\n\n/**\n * Primary UI component for user interaction\n */\nconst Button = ({\n type = \"primary\",\n textColor,\n size = \"medium\",\n onClick,\n label,\n}: ButtonProps) => {\n const [theState, setTheState] = useState(4);\n\n return (\n <button\n type=\"button\"\n className={classNames(\n \"storybook-button\",\n `storybook-button--${size}`,\n `storybook-button--${type}`\n )}\n style={textColor ? { color: textColor } : {}}\n onClick={onClick}\n >\n {`${label} ${theState}`}\n </button>\n );\n};\n\nexport default Button;\n"],"names":["useState"],"mappings":";;;;;;;;;;;;;;;;;;;CAKA;AACA;CACA,CAAA,CAAC,YAAY;AAEb;CACA,EAAC,IAAI,MAAM,GAAG,EAAE,CAAC,cAAc,CAAC;AAEhC;GACC,SAAS,UAAU,GAAG;CACvB,GAAE,IAAI,OAAO,GAAG,EAAE,CAAC;AACnB;CACA,GAAE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;CAC7C,IAAG,IAAI,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;CAC1B,IAAG,IAAI,CAAC,GAAG,EAAE,SAAS;AACtB;CACA,IAAG,IAAI,OAAO,GAAG,OAAO,GAAG,CAAC;AAC5B;KACG,IAAI,OAAO,KAAK,QAAQ,I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AA,IAAe,EAAf,IAAI,GAAA,EAAA,KAAA,KAAA,CAAA,GAAG,QAAQ,GAAA,EAAA,EACf,OAAO,GAAA,EAAA,CAAA,OAAA,EACP,KAAK,GAAA,EAAA,CAAA,KAAA,CAAA;KAEC,IAAA,EAAA,GAA0BA,cAAQ,CAAC,CAAC,CAAC,CAApC,CAAA,QAAQ,GAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAa,EAAA,CAAA,CAAA,EAAgB;KAE5C,QACE,gCACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,UAAU,CACnB,kBAAkB,EAClB,oBAAqB,CAAA,MAAA,CAAA,IAAI,CAAE,EAC3B,oBAAA,CAAA,MAAA,CAAqB,IAAI,CAAE,CAC5B,EACD,KAAK,EAAE,SAAS,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,EAC5C,OAAO,EAAE,OAAO,IAEf,EAAG,CAAA,MAAA,CAAA,KAAK,cAAI,QAAQ,CAAE,CAChB,EACT;CACJ;;;;;;;;","x_google_ignoreList":[0,1]}
|
package/package.json
CHANGED
package/rollup.config.mjs
CHANGED
|
@@ -12,6 +12,12 @@ import { createRequire } from "node:module";
|
|
|
12
12
|
const requireFile = createRequire(import.meta.url);
|
|
13
13
|
const packageJson = requireFile("./package.json");
|
|
14
14
|
|
|
15
|
+
const globals = {
|
|
16
|
+
react: "React",
|
|
17
|
+
"react-dom": "ReactDOM",
|
|
18
|
+
"react-query": "ReactQuery",
|
|
19
|
+
};
|
|
20
|
+
|
|
15
21
|
export default [
|
|
16
22
|
{
|
|
17
23
|
input: "src/index.ts",
|
|
@@ -26,6 +32,13 @@ export default [
|
|
|
26
32
|
format: "esm",
|
|
27
33
|
sourcemap: true,
|
|
28
34
|
},
|
|
35
|
+
{
|
|
36
|
+
name: "index",
|
|
37
|
+
file: `lib/index.umd.js`,
|
|
38
|
+
format: "umd",
|
|
39
|
+
sourcemap: true,
|
|
40
|
+
globals,
|
|
41
|
+
},
|
|
29
42
|
],
|
|
30
43
|
plugins: [
|
|
31
44
|
peerDepsExternal(),
|