onchain-uikit 0.0.1 → 0.0.2
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/.storybook/main.ts +16 -0
- package/.storybook/preview.ts +14 -0
- package/dist/{index_BOZzJyB8.js → index.cjs.js} +3 -3
- package/dist/{index_gHgQSOb5.js → index.es.js} +30 -30
- package/eslint.config.js +28 -0
- package/index.html +13 -0
- package/package.json +4 -7
- package/public/vite.svg +1 -0
- package/src/App.css +42 -0
- package/src/App.tsx +35 -0
- package/src/assets/react.svg +1 -0
- package/src/index.css +68 -0
- package/src/index.ts +3 -0
- package/src/main.tsx +10 -0
- package/src/stories/Button.stories.ts +53 -0
- package/src/stories/Button.tsx +37 -0
- package/src/stories/Configure.mdx +364 -0
- package/src/stories/Header.stories.ts +33 -0
- package/src/stories/Header.tsx +56 -0
- package/src/stories/Page.stories.ts +32 -0
- package/src/stories/Page.tsx +73 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/button.css +30 -0
- package/src/stories/header.css +32 -0
- package/src/stories/page.css +68 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.app.json +26 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +94 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/vite.config.ts +31 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { StorybookConfig } from "@storybook/react-vite";
|
|
2
|
+
|
|
3
|
+
const config: StorybookConfig = {
|
|
4
|
+
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
|
5
|
+
addons: [
|
|
6
|
+
"@storybook/addon-onboarding",
|
|
7
|
+
"@storybook/addon-essentials",
|
|
8
|
+
"@chromatic-com/storybook",
|
|
9
|
+
"@storybook/addon-interactions",
|
|
10
|
+
],
|
|
11
|
+
framework: {
|
|
12
|
+
name: "@storybook/react-vite",
|
|
13
|
+
options: {},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
export default config;
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
`+q+e}}var B=!1,L;{var Le=typeof WeakMap=="function"?WeakMap:Map;L=new Le}function se(e,r){if(!e||B)return"";{var t=L.get(e);if(t!==void 0)return t}var n;B=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var u;u=N.current,N.current=null,We();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(v){n=v}Reflect.construct(e,[],o)}else{try{o.call()}catch(v){n=v}e.call(o.prototype)}}else{try{throw Error()}catch(v){n=v}e()}}catch(v){if(v&&n&&typeof v.stack=="string"){for(var a=v.stack.split(`
|
|
19
19
|
`),d=n.stack.split(`
|
|
20
20
|
`),s=a.length-1,l=d.length-1;s>=1&&l>=0&&a[s]!==d[l];)l--;for(;s>=1&&l>=0;s--,l--)if(a[s]!==d[l]){if(s!==1||l!==1)do if(s--,l--,l<0||a[s]!==d[l]){var b=`
|
|
21
|
-
`+a[s].replace(" at new "," at ");return e.displayName&&b.includes("<anonymous>")&&(b=b.replace("<anonymous>",e.displayName)),typeof e=="function"&&L.set(e,b),b}while(s>=1&&l>=0);break}}}finally{B=!1,N.current=u,Ye(),Error.prepareStackTrace=i}var j=e?e.displayName||e.name:"",T=j?Y(j):"";return typeof e=="function"&&L.set(e,T),T}function Me(e,r,t){return se(e,!1)}function Ve(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function M(e,r,t){if(e==null)return"";if(typeof e=="function")return se(e,Ve(e));if(typeof e=="string")return Y(e);switch(e){case P:return Y("Suspense");case p:return Y("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case f:return Me(e.render);case y:return M(e.type,r,t);case _:{var n=e,i=n._payload,u=n._init;try{return M(u(i),r,t)}catch{}}}return""}var A=Object.prototype.hasOwnProperty,le={},fe=C.ReactDebugCurrentFrame;function V(e){if(e){var r=e._owner,t=M(e.type,e._source,r?r.type:null);fe.setExtraStackFrame(t)}else fe.setExtraStackFrame(null)}function Ue(e,r,t,n,i){{var u=Function.call.bind(A);for(var o in e)if(u(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var d=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name="Invariant Violation",d}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(s){a=s}a&&!(a instanceof Error)&&(V(i),c("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,o,typeof a),V(null)),a instanceof Error&&!(a.message in le)&&(le[a.message]=!0,V(i),c("Failed %s type: %s",t,a.message),V(null))}}}var Ne=Array.isArray;function J(e){return Ne(e)}function qe(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function Be(e){try{return ce(e),!1}catch{return!0}}function ce(e){return""+e}function de(e){if(Be(e))return c("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",qe(e)),ce(e)}var ve=C.ReactCurrentOwner,Je={key:!0,ref:!0,__self:!0,__source:!0},pe,be;function Ke(e){if(A.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Ge(e){if(A.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function
|
|
21
|
+
`+a[s].replace(" at new "," at ");return e.displayName&&b.includes("<anonymous>")&&(b=b.replace("<anonymous>",e.displayName)),typeof e=="function"&&L.set(e,b),b}while(s>=1&&l>=0);break}}}finally{B=!1,N.current=u,Ye(),Error.prepareStackTrace=i}var j=e?e.displayName||e.name:"",T=j?Y(j):"";return typeof e=="function"&&L.set(e,T),T}function Me(e,r,t){return se(e,!1)}function Ve(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function M(e,r,t){if(e==null)return"";if(typeof e=="function")return se(e,Ve(e));if(typeof e=="string")return Y(e);switch(e){case P:return Y("Suspense");case p:return Y("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case f:return Me(e.render);case y:return M(e.type,r,t);case _:{var n=e,i=n._payload,u=n._init;try{return M(u(i),r,t)}catch{}}}return""}var A=Object.prototype.hasOwnProperty,le={},fe=C.ReactDebugCurrentFrame;function V(e){if(e){var r=e._owner,t=M(e.type,e._source,r?r.type:null);fe.setExtraStackFrame(t)}else fe.setExtraStackFrame(null)}function Ue(e,r,t,n,i){{var u=Function.call.bind(A);for(var o in e)if(u(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var d=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name="Invariant Violation",d}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(s){a=s}a&&!(a instanceof Error)&&(V(i),c("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,o,typeof a),V(null)),a instanceof Error&&!(a.message in le)&&(le[a.message]=!0,V(i),c("Failed %s type: %s",t,a.message),V(null))}}}var Ne=Array.isArray;function J(e){return Ne(e)}function qe(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function Be(e){try{return ce(e),!1}catch{return!0}}function ce(e){return""+e}function de(e){if(Be(e))return c("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",qe(e)),ce(e)}var ve=C.ReactCurrentOwner,Je={key:!0,ref:!0,__self:!0,__source:!0},pe,be;function Ke(e){if(A.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Ge(e){if(A.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Xe(e,r){typeof e.ref=="string"&&ve.current}function ze(e,r){{var t=function(){pe||(pe=!0,c("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function He(e,r){{var t=function(){be||(be=!0,c("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var Ze=function(e,r,t,n,i,u,o){var a={$$typeof:h,type:e,key:r,ref:t,props:o,_owner:u};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function Qe(e,r,t,n,i){{var u,o={},a=null,d=null;t!==void 0&&(de(t),a=""+t),Ge(r)&&(de(r.key),a=""+r.key),Ke(r)&&(d=r.ref,Xe(r,i));for(u in r)A.call(r,u)&&!Je.hasOwnProperty(u)&&(o[u]=r[u]);if(e&&e.defaultProps){var s=e.defaultProps;for(u in s)o[u]===void 0&&(o[u]=s[u])}if(a||d){var l=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&ze(o,l),d&&He(o,l)}return Ze(e,a,d,i,n,ve.current,o)}}var K=C.ReactCurrentOwner,ye=C.ReactDebugCurrentFrame;function w(e){if(e){var r=e._owner,t=M(e.type,e._source,r?r.type:null);ye.setExtraStackFrame(t)}else ye.setExtraStackFrame(null)}var G;G=!1;function X(e){return typeof e=="object"&&e!==null&&e.$$typeof===h}function ge(){{if(K.current){var e=E(K.current.type);if(e)return`
|
|
22
22
|
|
|
23
23
|
Check the render method of \``+e+"`."}return""}}function er(e){return""}var Ee={};function rr(e){{var r=ge();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+t+">.")}return r}}function he(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=rr(r);if(Ee[t])return;Ee[t]=!0;var n="";e&&e._owner&&e._owner!==K.current&&(n=" It was passed a child from "+E(e._owner.type)+"."),w(e),c('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),w(null)}}function Re(e,r){{if(typeof e!="object")return;if(J(e))for(var t=0;t<e.length;t++){var n=e[t];
|
|
25
|
+
Check the top-level render call using <`+t+">.")}return r}}function he(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=rr(r);if(Ee[t])return;Ee[t]=!0;var n="";e&&e._owner&&e._owner!==K.current&&(n=" It was passed a child from "+E(e._owner.type)+"."),w(e),c('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),w(null)}}function Re(e,r){{if(typeof e!="object")return;if(J(e))for(var t=0;t<e.length;t++){var n=e[t];X(n)&&he(n,r)}else if(X(e))e._store&&(e._store.validated=!0);else if(e){var i=we(e);if(typeof i=="function"&&i!==e.entries)for(var u=i.call(e),o;!(o=u.next()).done;)X(o.value)&&he(o.value,r)}}}function tr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===f||r.$$typeof===y))t=r.propTypes;else return;if(t){var n=E(r);Ue(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!G){G=!0;var i=E(r);c("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&c("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function nr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){w(e),c("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),w(null);break}}e.ref!==null&&(w(e),c("Invalid attribute `ref` supplied to `React.Fragment`."),w(null))}}var _e={};function me(e,r,t,n,i,u){{var o=Ie(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var d=er();d?a+=d:a+=ge();var s;e===null?s="null":J(e)?s="array":e!==void 0&&e.$$typeof===h?(s="<"+(E(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):s=typeof e,c("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",s,a)}var l=Qe(e,r,t,i,u);if(l==null)return l;if(o){var b=r.children;if(b!==void 0)if(n)if(J(b)){for(var j=0;j<b.length;j++)Re(b[j],e);Object.freeze&&Object.freeze(b)}else c("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Re(b,e)}if(A.call(r,"key")){var T=E(e),v=Object.keys(r).filter(function(lr){return lr!=="key"}),z=v.length>0?"{key: someKey, "+v.join(": ..., ")+": ...}":"{key: someKey}";if(!_e[T+z]){var sr=v.length>0?"{"+v.join(": ..., ")+": ...}":"{}";c(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,
|
|
30
|
+
<%s key={someKey} {...props} />`,z,T,sr,T),_e[T+z]=!0}}return e===g?nr(l):tr(l),l}}function ar(e,r,t){return me(e,r,t,!0)}function or(e,r,t){return me(e,r,t,!1)}var ir=or,ur=ar;$.Fragment=g,$.jsx=ir,$.jsxs=ur}()),$}var Se;function dr(){return Se||(Se=1,process.env.NODE_ENV==="production"?U.exports=fr():U.exports=cr()),U.exports}var vr=dr();const pr=({primary:x=!1,size:h="medium",backgroundColor:k,label:g,...O})=>{const S=x?"storybook-button--primary":"storybook-button--secondary";return vr.jsx("button",{type:"button",className:["storybook-button",`storybook-button--${h}`,S].join(" "),style:{backgroundColor:k},...O,children:g})};exports.XsButton=pr;
|
|
@@ -187,27 +187,27 @@ function cr() {
|
|
|
187
187
|
F < 0 && c("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
var N = C.ReactCurrentDispatcher,
|
|
190
|
+
var N = C.ReactCurrentDispatcher, B;
|
|
191
191
|
function Y(e, r, t) {
|
|
192
192
|
{
|
|
193
|
-
if (
|
|
193
|
+
if (B === void 0)
|
|
194
194
|
try {
|
|
195
195
|
throw Error();
|
|
196
196
|
} catch (i) {
|
|
197
197
|
var n = i.stack.trim().match(/\n( *(at )?)/);
|
|
198
|
-
|
|
198
|
+
B = n && n[1] || "";
|
|
199
199
|
}
|
|
200
200
|
return `
|
|
201
|
-
` +
|
|
201
|
+
` + B + e;
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
var
|
|
204
|
+
var J = !1, L;
|
|
205
205
|
{
|
|
206
206
|
var Le = typeof WeakMap == "function" ? WeakMap : Map;
|
|
207
207
|
L = new Le();
|
|
208
208
|
}
|
|
209
209
|
function se(e, r) {
|
|
210
|
-
if (!e ||
|
|
210
|
+
if (!e || J)
|
|
211
211
|
return "";
|
|
212
212
|
{
|
|
213
213
|
var t = L.get(e);
|
|
@@ -215,7 +215,7 @@ function cr() {
|
|
|
215
215
|
return t;
|
|
216
216
|
}
|
|
217
217
|
var n;
|
|
218
|
-
|
|
218
|
+
J = !0;
|
|
219
219
|
var i = Error.prepareStackTrace;
|
|
220
220
|
Error.prepareStackTrace = void 0;
|
|
221
221
|
var u;
|
|
@@ -272,7 +272,7 @@ function cr() {
|
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
274
|
} finally {
|
|
275
|
-
|
|
275
|
+
J = !1, N.current = u, Ye(), Error.prepareStackTrace = i;
|
|
276
276
|
}
|
|
277
277
|
var j = e ? e.displayName || e.name : "", T = j ? Y(j) : "";
|
|
278
278
|
return typeof e == "function" && L.set(e, T), T;
|
|
@@ -341,16 +341,16 @@ function cr() {
|
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
var Ne = Array.isArray;
|
|
344
|
-
function
|
|
344
|
+
function q(e) {
|
|
345
345
|
return Ne(e);
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function Be(e) {
|
|
348
348
|
{
|
|
349
349
|
var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
350
350
|
return t;
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
function
|
|
353
|
+
function Je(e) {
|
|
354
354
|
try {
|
|
355
355
|
return ce(e), !1;
|
|
356
356
|
} catch {
|
|
@@ -361,10 +361,10 @@ function cr() {
|
|
|
361
361
|
return "" + e;
|
|
362
362
|
}
|
|
363
363
|
function de(e) {
|
|
364
|
-
if (
|
|
365
|
-
return c("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
364
|
+
if (Je(e))
|
|
365
|
+
return c("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Be(e)), ce(e);
|
|
366
366
|
}
|
|
367
|
-
var ve = C.ReactCurrentOwner,
|
|
367
|
+
var ve = C.ReactCurrentOwner, qe = {
|
|
368
368
|
key: !0,
|
|
369
369
|
ref: !0,
|
|
370
370
|
__self: !0,
|
|
@@ -386,10 +386,10 @@ function cr() {
|
|
|
386
386
|
}
|
|
387
387
|
return e.key !== void 0;
|
|
388
388
|
}
|
|
389
|
-
function
|
|
389
|
+
function Xe(e, r) {
|
|
390
390
|
typeof e.ref == "string" && ve.current;
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function ze(e, r) {
|
|
393
393
|
{
|
|
394
394
|
var t = function() {
|
|
395
395
|
pe || (pe = !0, c("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
@@ -443,9 +443,9 @@ function cr() {
|
|
|
443
443
|
function Qe(e, r, t, n, i) {
|
|
444
444
|
{
|
|
445
445
|
var u, o = {}, a = null, d = null;
|
|
446
|
-
t !== void 0 && (de(t), a = "" + t), Ge(r) && (de(r.key), a = "" + r.key), Ke(r) && (d = r.ref,
|
|
446
|
+
t !== void 0 && (de(t), a = "" + t), Ge(r) && (de(r.key), a = "" + r.key), Ke(r) && (d = r.ref, Xe(r, i));
|
|
447
447
|
for (u in r)
|
|
448
|
-
A.call(r, u) && !
|
|
448
|
+
A.call(r, u) && !qe.hasOwnProperty(u) && (o[u] = r[u]);
|
|
449
449
|
if (e && e.defaultProps) {
|
|
450
450
|
var s = e.defaultProps;
|
|
451
451
|
for (u in s)
|
|
@@ -453,7 +453,7 @@ function cr() {
|
|
|
453
453
|
}
|
|
454
454
|
if (a || d) {
|
|
455
455
|
var f = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
456
|
-
a &&
|
|
456
|
+
a && ze(o, f), d && He(o, f);
|
|
457
457
|
}
|
|
458
458
|
return Ze(e, a, d, i, n, ve.current, o);
|
|
459
459
|
}
|
|
@@ -468,7 +468,7 @@ function cr() {
|
|
|
468
468
|
}
|
|
469
469
|
var G;
|
|
470
470
|
G = !1;
|
|
471
|
-
function
|
|
471
|
+
function X(e) {
|
|
472
472
|
return typeof e == "object" && e !== null && e.$$typeof === h;
|
|
473
473
|
}
|
|
474
474
|
function ge() {
|
|
@@ -516,18 +516,18 @@ Check the top-level render call using <` + t + ">.");
|
|
|
516
516
|
{
|
|
517
517
|
if (typeof e != "object")
|
|
518
518
|
return;
|
|
519
|
-
if (
|
|
519
|
+
if (q(e))
|
|
520
520
|
for (var t = 0; t < e.length; t++) {
|
|
521
521
|
var n = e[t];
|
|
522
|
-
|
|
522
|
+
X(n) && he(n, r);
|
|
523
523
|
}
|
|
524
|
-
else if (
|
|
524
|
+
else if (X(e))
|
|
525
525
|
e._store && (e._store.validated = !0);
|
|
526
526
|
else if (e) {
|
|
527
527
|
var i = we(e);
|
|
528
528
|
if (typeof i == "function" && i !== e.entries)
|
|
529
529
|
for (var u = i.call(e), o; !(o = u.next()).done; )
|
|
530
|
-
|
|
530
|
+
X(o.value) && he(o.value, r);
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
533
|
}
|
|
@@ -578,7 +578,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
578
578
|
var d = er();
|
|
579
579
|
d ? a += d : a += ge();
|
|
580
580
|
var s;
|
|
581
|
-
e === null ? s = "null" :
|
|
581
|
+
e === null ? s = "null" : q(e) ? s = "array" : e !== void 0 && e.$$typeof === h ? (s = "<" + (E(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : s = typeof e, c("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", s, a);
|
|
582
582
|
}
|
|
583
583
|
var f = Qe(e, r, t, i, u);
|
|
584
584
|
if (f == null)
|
|
@@ -587,7 +587,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
587
587
|
var b = r.children;
|
|
588
588
|
if (b !== void 0)
|
|
589
589
|
if (n)
|
|
590
|
-
if (
|
|
590
|
+
if (q(b)) {
|
|
591
591
|
for (var j = 0; j < b.length; j++)
|
|
592
592
|
Re(b[j], e);
|
|
593
593
|
Object.freeze && Object.freeze(b);
|
|
@@ -599,15 +599,15 @@ Check the top-level render call using <` + t + ">.");
|
|
|
599
599
|
if (A.call(r, "key")) {
|
|
600
600
|
var T = E(e), v = Object.keys(r).filter(function(fr) {
|
|
601
601
|
return fr !== "key";
|
|
602
|
-
}),
|
|
603
|
-
if (!_e[T +
|
|
602
|
+
}), z = v.length > 0 ? "{key: someKey, " + v.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
603
|
+
if (!_e[T + z]) {
|
|
604
604
|
var sr = v.length > 0 ? "{" + v.join(": ..., ") + ": ...}" : "{}";
|
|
605
605
|
c(`A props object containing a "key" prop is being spread into JSX:
|
|
606
606
|
let props = %s;
|
|
607
607
|
<%s {...props} />
|
|
608
608
|
React keys must be passed directly to JSX without using spread:
|
|
609
609
|
let props = %s;
|
|
610
|
-
<%s key={someKey} {...props} />`,
|
|
610
|
+
<%s key={someKey} {...props} />`, z, T, sr, T), _e[T + z] = !0;
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
613
|
return e === g ? nr(f) : tr(f), f;
|
|
@@ -648,5 +648,5 @@ const br = ({
|
|
|
648
648
|
);
|
|
649
649
|
};
|
|
650
650
|
export {
|
|
651
|
-
br as
|
|
651
|
+
br as XsButton
|
|
652
652
|
};
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import globals from 'globals'
|
|
3
|
+
import reactHooks from 'eslint-plugin-react-hooks'
|
|
4
|
+
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
5
|
+
import tseslint from 'typescript-eslint'
|
|
6
|
+
|
|
7
|
+
export default tseslint.config(
|
|
8
|
+
{ ignores: ['dist'] },
|
|
9
|
+
{
|
|
10
|
+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
|
11
|
+
files: ['**/*.{ts,tsx}'],
|
|
12
|
+
languageOptions: {
|
|
13
|
+
ecmaVersion: 2020,
|
|
14
|
+
globals: globals.browser,
|
|
15
|
+
},
|
|
16
|
+
plugins: {
|
|
17
|
+
'react-hooks': reactHooks,
|
|
18
|
+
'react-refresh': reactRefresh,
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
...reactHooks.configs.recommended.rules,
|
|
22
|
+
'react-refresh/only-export-components': [
|
|
23
|
+
'warn',
|
|
24
|
+
{ allowConstantExport: true },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
)
|
package/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite + React + TS</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onchain-uikit",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.
|
|
5
|
-
"type": "module",
|
|
4
|
+
"version": "0.0.2",
|
|
6
5
|
"scripts": {
|
|
7
6
|
"dev": "vite",
|
|
8
7
|
"build": "vite build",
|
|
@@ -11,11 +10,9 @@
|
|
|
11
10
|
"storybook": "storybook dev -p 6006",
|
|
12
11
|
"build-storybook": "storybook build"
|
|
13
12
|
},
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"module": "dist/esm/index.js",
|
|
18
|
-
"typings": "dist/esm/index.d.ts",
|
|
13
|
+
"main": "dist/index.cjs.js",
|
|
14
|
+
"module": "dist/index.es.js",
|
|
15
|
+
"typings": "dist/index.d.ts",
|
|
19
16
|
"peerDependencies": {
|
|
20
17
|
"antd": "5.1.4"
|
|
21
18
|
},
|
package/public/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/src/App.css
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#root {
|
|
2
|
+
max-width: 1280px;
|
|
3
|
+
margin: 0 auto;
|
|
4
|
+
padding: 2rem;
|
|
5
|
+
text-align: center;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.logo {
|
|
9
|
+
height: 6em;
|
|
10
|
+
padding: 1.5em;
|
|
11
|
+
will-change: filter;
|
|
12
|
+
transition: filter 300ms;
|
|
13
|
+
}
|
|
14
|
+
.logo:hover {
|
|
15
|
+
filter: drop-shadow(0 0 2em #646cffaa);
|
|
16
|
+
}
|
|
17
|
+
.logo.react:hover {
|
|
18
|
+
filter: drop-shadow(0 0 2em #61dafbaa);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@keyframes logo-spin {
|
|
22
|
+
from {
|
|
23
|
+
transform: rotate(0deg);
|
|
24
|
+
}
|
|
25
|
+
to {
|
|
26
|
+
transform: rotate(360deg);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
31
|
+
a:nth-of-type(2) .logo {
|
|
32
|
+
animation: logo-spin infinite 20s linear;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.card {
|
|
37
|
+
padding: 2em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.read-the-docs {
|
|
41
|
+
color: #888;
|
|
42
|
+
}
|
package/src/App.tsx
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import reactLogo from './assets/react.svg'
|
|
3
|
+
import viteLogo from '/vite.svg'
|
|
4
|
+
import './App.css'
|
|
5
|
+
|
|
6
|
+
function App() {
|
|
7
|
+
const [count, setCount] = useState(0)
|
|
8
|
+
|
|
9
|
+
return (
|
|
10
|
+
<>
|
|
11
|
+
<div>
|
|
12
|
+
<a href="https://vite.dev" target="_blank">
|
|
13
|
+
<img src={viteLogo} className="logo" alt="Vite logo" />
|
|
14
|
+
</a>
|
|
15
|
+
<a href="https://react.dev" target="_blank">
|
|
16
|
+
<img src={reactLogo} className="logo react" alt="React logo" />
|
|
17
|
+
</a>
|
|
18
|
+
</div>
|
|
19
|
+
<h1>Vite + React</h1>
|
|
20
|
+
<div className="card">
|
|
21
|
+
<button onClick={() => setCount((count) => count + 1)}>
|
|
22
|
+
count is {count}
|
|
23
|
+
</button>
|
|
24
|
+
<p>
|
|
25
|
+
Edit <code>src/App.tsx</code> and save to test HMR
|
|
26
|
+
</p>
|
|
27
|
+
</div>
|
|
28
|
+
<p className="read-the-docs">
|
|
29
|
+
Click on the Vite and React logos to learn more
|
|
30
|
+
</p>
|
|
31
|
+
</>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default App
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
package/src/index.css
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
3
|
+
line-height: 1.5;
|
|
4
|
+
font-weight: 400;
|
|
5
|
+
|
|
6
|
+
color-scheme: light dark;
|
|
7
|
+
color: rgba(255, 255, 255, 0.87);
|
|
8
|
+
background-color: #242424;
|
|
9
|
+
|
|
10
|
+
font-synthesis: none;
|
|
11
|
+
text-rendering: optimizeLegibility;
|
|
12
|
+
-webkit-font-smoothing: antialiased;
|
|
13
|
+
-moz-osx-font-smoothing: grayscale;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
a {
|
|
17
|
+
font-weight: 500;
|
|
18
|
+
color: #646cff;
|
|
19
|
+
text-decoration: inherit;
|
|
20
|
+
}
|
|
21
|
+
a:hover {
|
|
22
|
+
color: #535bf2;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
body {
|
|
26
|
+
margin: 0;
|
|
27
|
+
display: flex;
|
|
28
|
+
place-items: center;
|
|
29
|
+
min-width: 320px;
|
|
30
|
+
min-height: 100vh;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
h1 {
|
|
34
|
+
font-size: 3.2em;
|
|
35
|
+
line-height: 1.1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
button {
|
|
39
|
+
border-radius: 8px;
|
|
40
|
+
border: 1px solid transparent;
|
|
41
|
+
padding: 0.6em 1.2em;
|
|
42
|
+
font-size: 1em;
|
|
43
|
+
font-weight: 500;
|
|
44
|
+
font-family: inherit;
|
|
45
|
+
background-color: #1a1a1a;
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
transition: border-color 0.25s;
|
|
48
|
+
}
|
|
49
|
+
button:hover {
|
|
50
|
+
border-color: #646cff;
|
|
51
|
+
}
|
|
52
|
+
button:focus,
|
|
53
|
+
button:focus-visible {
|
|
54
|
+
outline: 4px auto -webkit-focus-ring-color;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@media (prefers-color-scheme: light) {
|
|
58
|
+
:root {
|
|
59
|
+
color: #213547;
|
|
60
|
+
background-color: #ffffff;
|
|
61
|
+
}
|
|
62
|
+
a:hover {
|
|
63
|
+
color: #747bff;
|
|
64
|
+
}
|
|
65
|
+
button {
|
|
66
|
+
background-color: #f9f9f9;
|
|
67
|
+
}
|
|
68
|
+
}
|
package/src/index.ts
ADDED
package/src/main.tsx
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { fn } from "@storybook/test";
|
|
3
|
+
|
|
4
|
+
import { Button } from "./Button";
|
|
5
|
+
|
|
6
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
7
|
+
const meta = {
|
|
8
|
+
title: "Example/Button",
|
|
9
|
+
component: Button,
|
|
10
|
+
parameters: {
|
|
11
|
+
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
12
|
+
layout: "centered",
|
|
13
|
+
},
|
|
14
|
+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
15
|
+
tags: ["autodocs"],
|
|
16
|
+
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
|
17
|
+
argTypes: {
|
|
18
|
+
backgroundColor: { control: "color" },
|
|
19
|
+
},
|
|
20
|
+
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
|
|
21
|
+
args: { onClick: fn() },
|
|
22
|
+
} satisfies Meta<typeof Button>;
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
type Story = StoryObj<typeof meta>;
|
|
26
|
+
|
|
27
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
28
|
+
export const Primary: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
primary: true,
|
|
31
|
+
label: "Button",
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const Secondary: Story = {
|
|
36
|
+
args: {
|
|
37
|
+
label: "Button",
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Large: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
size: "large",
|
|
44
|
+
label: "Button",
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const Small: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
size: "small",
|
|
51
|
+
label: "Button",
|
|
52
|
+
},
|
|
53
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import './button.css';
|
|
4
|
+
|
|
5
|
+
export interface ButtonProps {
|
|
6
|
+
/** Is this the principal call to action on the page? */
|
|
7
|
+
primary?: boolean;
|
|
8
|
+
/** What background color to use */
|
|
9
|
+
backgroundColor?: string;
|
|
10
|
+
/** How large should the button be? */
|
|
11
|
+
size?: 'small' | 'medium' | 'large';
|
|
12
|
+
/** Button contents */
|
|
13
|
+
label: string;
|
|
14
|
+
/** Optional click handler */
|
|
15
|
+
onClick?: () => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Primary UI component for user interaction */
|
|
19
|
+
export const Button = ({
|
|
20
|
+
primary = false,
|
|
21
|
+
size = 'medium',
|
|
22
|
+
backgroundColor,
|
|
23
|
+
label,
|
|
24
|
+
...props
|
|
25
|
+
}: ButtonProps) => {
|
|
26
|
+
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
|
|
27
|
+
return (
|
|
28
|
+
<button
|
|
29
|
+
type="button"
|
|
30
|
+
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
|
|
31
|
+
style={{ backgroundColor }}
|
|
32
|
+
{...props}
|
|
33
|
+
>
|
|
34
|
+
{label}
|
|
35
|
+
</button>
|
|
36
|
+
);
|
|
37
|
+
};
|