@fabio.caffarello/react-design-system 1.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.
Files changed (55) hide show
  1. package/README.md +123 -0
  2. package/dist/App.d.ts +3 -0
  3. package/dist/index.cjs +22 -0
  4. package/dist/index.js +439 -0
  5. package/dist/main.d.ts +1 -0
  6. package/dist/setupTests.d.ts +1 -0
  7. package/dist/ui/atoms/BoxWrapper/BoxWrapper.d.ts +4 -0
  8. package/dist/ui/atoms/BoxWrapper/BoxWrapper.stories.d.ts +5 -0
  9. package/dist/ui/atoms/Button/Button.d.ts +6 -0
  10. package/dist/ui/atoms/Button/Button.stories.d.ts +5 -0
  11. package/dist/ui/atoms/Info/Info.d.ts +6 -0
  12. package/dist/ui/atoms/Info/Info.stories.d.ts +5 -0
  13. package/dist/ui/atoms/Input/Input.d.ts +4 -0
  14. package/dist/ui/atoms/Input/Input.stories.d.ts +5 -0
  15. package/dist/ui/atoms/Input/Input.test.d.ts +1 -0
  16. package/dist/ui/atoms/Text/Text.d.ts +11 -0
  17. package/dist/ui/atoms/Text/Text.stories.d.ts +5 -0
  18. package/dist/ui/atoms/Text/Text.test.d.ts +1 -0
  19. package/dist/ui/atoms/index.d.ts +5 -0
  20. package/dist/ui/index.d.ts +3 -0
  21. package/dist/ui/molecules/InputWithLabel/InputWithLabel.d.ts +6 -0
  22. package/dist/ui/molecules/InputWithLabel/InputWithLabel.stories.d.ts +5 -0
  23. package/dist/ui/molecules/index.d.ts +1 -0
  24. package/dist/ui/organisms/LoginBox/LoginBox.d.ts +6 -0
  25. package/dist/ui/organisms/LoginBox/LoginBox.stories.d.ts +5 -0
  26. package/dist/ui/organisms/index.d.ts +1 -0
  27. package/dist/vite.svg +1 -0
  28. package/package.json +71 -0
  29. package/src/App.css +42 -0
  30. package/src/App.tsx +35 -0
  31. package/src/assets/react.svg +1 -0
  32. package/src/index.css +68 -0
  33. package/src/main.tsx +15 -0
  34. package/src/setupTests.ts +1 -0
  35. package/src/style.css +30 -0
  36. package/src/ui/atoms/BoxWrapper/BoxWrapper.stories.tsx +15 -0
  37. package/src/ui/atoms/BoxWrapper/BoxWrapper.tsx +9 -0
  38. package/src/ui/atoms/Button/Button.stories.tsx +16 -0
  39. package/src/ui/atoms/Button/Button.tsx +35 -0
  40. package/src/ui/atoms/Info/Info.stories.tsx +15 -0
  41. package/src/ui/atoms/Info/Info.tsx +35 -0
  42. package/src/ui/atoms/Input/Input.stories.tsx +15 -0
  43. package/src/ui/atoms/Input/Input.test.tsx +54 -0
  44. package/src/ui/atoms/Input/Input.tsx +19 -0
  45. package/src/ui/atoms/Text/Text.stories.tsx +15 -0
  46. package/src/ui/atoms/Text/Text.test.tsx +47 -0
  47. package/src/ui/atoms/Text/Text.tsx +62 -0
  48. package/src/ui/atoms/index.ts +9 -0
  49. package/src/ui/index.ts +3 -0
  50. package/src/ui/molecules/InputWithLabel/InputWithLabel.stories.tsx +17 -0
  51. package/src/ui/molecules/InputWithLabel/InputWithLabel.tsx +21 -0
  52. package/src/ui/molecules/index.ts +1 -0
  53. package/src/ui/organisms/LoginBox/LoginBox.stories.tsx +22 -0
  54. package/src/ui/organisms/LoginBox/LoginBox.tsx +49 -0
  55. package/src/ui/organisms/index.ts +1 -0
package/README.md ADDED
@@ -0,0 +1,123 @@
1
+ # React Design System
2
+
3
+ ![Vite](https://img.shields.io/badge/built%20with-vite-646cff)
4
+ ![TypeScript](https://img.shields.io/badge/typescript-%23007acc.svg?style=flat&logo=typescript&logoColor=white)
5
+ ![Storybook](https://img.shields.io/badge/storybook-%23FF4785.svg?style=flat&logo=storybook&logoColor=white)
6
+ ![Vitest](https://img.shields.io/badge/tested%20with-vitest-6E9F18)
7
+ ![TailwindCSS](https://img.shields.io/badge/styled%20with-tailwindcss-38bdf8)
8
+
9
+ ## Overview
10
+
11
+ This repository is a modern, scalable, and flexible Design System built with React, TypeScript, and Vite. It provides a robust foundation for building consistent, accessible, and reusable UI components across multiple frontend projects.
12
+
13
+ - **Atomic Design:** Organized into Atoms, Molecules, and Organisms for maximum reusability.
14
+ - **Interactive Documentation:** Storybook for live component visualization, documentation, and testing.
15
+ - **Automated Testing:** Vitest and Testing Library for unit and integration tests.
16
+ - **Styling:** TailwindCSS for utility-first, customizable styles.
17
+ - **Developer Experience:** ESLint, Prettier, and strict TypeScript configuration.
18
+
19
+ ## Technologies
20
+
21
+ - **React 19**
22
+ - **TypeScript 5**
23
+ - **Vite** (fast dev/build)
24
+ - **Storybook 10** (with accessibility and docs addons)
25
+ - **Vitest** (unit and story testing)
26
+ - **Testing Library** (DOM assertions)
27
+ - **TailwindCSS** (utility-first CSS)
28
+ - **Plop** (component code generation)
29
+ - **ESLint & Prettier** (code quality and formatting)
30
+
31
+ ## Folder Structure
32
+
33
+ ```sh
34
+ src/
35
+ ui/
36
+ atoms/ # Basic components (Button, Input, Text, etc.)
37
+ molecules/ # Combinations of atoms (InputWithLabel, etc.)
38
+ organisms/ # Complex blocks (LoginBox, etc.)
39
+ assets/ # Images, icons, etc.
40
+ style.css # TailwindCSS and custom theme variables
41
+ public/ # Static files
42
+ .storybook/ # Storybook configuration
43
+ plop-templates/ # Component and story templates
44
+ ```
45
+
46
+ ## Getting Started
47
+
48
+ 1. **Install dependencies:**
49
+
50
+ ```sh
51
+ npm install
52
+ ```
53
+
54
+ 2. **Start development server:**
55
+
56
+ ```sh
57
+ npm run dev
58
+ ```
59
+
60
+ 3. **View and document components in Storybook:**
61
+
62
+ ```sh
63
+ npm run storybook
64
+ ```
65
+
66
+ 4. **Run unit and story tests:**
67
+
68
+ ```sh
69
+ npm run test
70
+ ```
71
+
72
+ 5. **Lint and format code:**
73
+
74
+ ```sh
75
+ npm run lint
76
+ ```
77
+
78
+ ## Component Generation
79
+
80
+ Create new components using Plop:
81
+
82
+ ```sh
83
+ npm run plop
84
+ ```
85
+
86
+ Follow the prompts to generate Atoms, Molecules, Organisms, or Views with ready-to-use templates and Storybook stories.
87
+
88
+ ## Testing & Quality
89
+
90
+ - **Unit tests:** Located alongside components as `.test.tsx` files, run with Vitest.
91
+ - **Storybook tests:** Story files are also tested for visual and interaction regressions.
92
+ - **Linting:** ESLint with recommended rules for React, TypeScript, and Storybook.
93
+ - **Formatting:** Prettier for consistent code style.
94
+
95
+ ## TailwindCSS & Theming
96
+
97
+ - Utility classes are used throughout components for rapid styling.
98
+ - Custom theme variables are defined in `src/style.css` for spacing, colors, and shadows.
99
+ - Easily extend or override Tailwind and theme tokens for your brand.
100
+
101
+ ## Contribution
102
+
103
+ 1. Fork the repository and create a feature branch from `main`.
104
+ 2. Add or update components, stories, and tests.
105
+ 3. Ensure all tests and lints pass.
106
+ 4. Open a Pull Request with a clear description and motivation.
107
+
108
+ ## Storybook Demo
109
+
110
+ Explore the live documentation and interactive components:
111
+
112
+ [Storybook on GitHub Pages](https://fabiocaffarello.github.io/react-design-system)
113
+
114
+ ## Roadmap
115
+
116
+ - [x] Atomic Design structure
117
+ - [x] Storybook integration
118
+ - [x] Automated unit and story testing
119
+ - [x] TailwindCSS theming
120
+ - [ ] Improve components design
121
+ - [ ] New components (Cards, Modals, etc.)
122
+ - [ ] Customizable themes and dark mode
123
+ - [ ] Accessibility improvements
package/dist/App.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import "./App.css";
2
+ declare function App(): import("react/jsx-runtime").JSX.Element;
3
+ export default App;
package/dist/index.cjs ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const oe=require("react");var h={exports:{}},_={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var W;function se(){if(W)return _;W=1;var n=Symbol.for("react.transitional.element"),a=Symbol.for("react.fragment");function s(o,c,f){var m=null;if(f!==void 0&&(m=""+f),c.key!==void 0&&(m=""+c.key),"key"in c){f={};for(var d in c)d!=="key"&&(f[d]=c[d])}else f=c;return c=f.ref,{$$typeof:n,type:o,key:m,ref:c!==void 0?c:null,props:f}}return _.Fragment=a,_.jsx=s,_.jsxs=s,_}var E={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var D;function le(){return D||(D=1,process.env.NODE_ENV!=="production"&&(function(){function n(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===te?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case g:return"Fragment";case G:return"Profiler";case z:return"StrictMode";case Q:return"Suspense";case K:return"SuspenseList";case re:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case V:return"Portal";case H:return e.displayName||"Context";case X:return(e._context.displayName||"Context")+".Consumer";case Z:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ee:return r=e.displayName||null,r!==null?r:n(e.type)||"Memo";case R:r=e._payload,e=e._init;try{return n(e(r))}catch{}}return null}function a(e){return""+e}function s(e){try{a(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,l=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",l),a(e)}}function o(e){if(e===g)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===R)return"<...>";try{var r=n(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function c(){var e=T.A;return e===null?null:e.getOwner()}function f(){return Error("react-stack-top-frame")}function m(e){if(C.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function d(e,r){function t(){I||(I=!0,console.error("%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://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function b(){var e=n(this.type);return Y[e]||(Y[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function J(e,r,t,l,x,j){var u=t.ref;return e={$$typeof:P,type:e,key:r,props:t,_owner:l},(u!==void 0?u:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:b}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:x}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:j}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function O(e,r,t,l,x,j){var u=r.children;if(u!==void 0)if(l)if(ne(u)){for(l=0;l<u.length;l++)N(u[l]);Object.freeze&&Object.freeze(u)}else console.error("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 N(u);if(C.call(r,"key")){u=n(e);var p=Object.keys(r).filter(function(ae){return ae!=="key"});l=0<p.length?"{key: someKey, "+p.join(": ..., ")+": ...}":"{key: someKey}",L[u+l]||(p=0<p.length?"{"+p.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
+ let props = %s;
19
+ <%s {...props} />
20
+ React keys must be passed directly to JSX without using spread:
21
+ let props = %s;
22
+ <%s key={someKey} {...props} />`,l,u,p,u),L[u+l]=!0)}if(u=null,t!==void 0&&(s(t),u=""+t),m(r)&&(s(r.key),u=""+r.key),"key"in r){t={};for(var y in r)y!=="key"&&(t[y]=r[y])}else t=r;return u&&d(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),J(e,u,t,c(),x,j)}function N(e){A(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===R&&(e._payload.status==="fulfilled"?A(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function A(e){return typeof e=="object"&&e!==null&&e.$$typeof===P}var v=oe,P=Symbol.for("react.transitional.element"),V=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),z=Symbol.for("react.strict_mode"),G=Symbol.for("react.profiler"),X=Symbol.for("react.consumer"),H=Symbol.for("react.context"),Z=Symbol.for("react.forward_ref"),Q=Symbol.for("react.suspense"),K=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),R=Symbol.for("react.lazy"),re=Symbol.for("react.activity"),te=Symbol.for("react.client.reference"),T=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C=Object.prototype.hasOwnProperty,ne=Array.isArray,k=console.createTask?console.createTask:function(){return null};v={react_stack_bottom_frame:function(e){return e()}};var I,Y={},$=v.react_stack_bottom_frame.bind(v,f)(),F=k(o(f)),L={};E.Fragment=g,E.jsx=function(e,r,t){var l=1e4>T.recentlyCreatedOwnerStacks++;return O(e,r,t,!1,l?Error("react-stack-top-frame"):$,l?k(o(e)):F)},E.jsxs=function(e,r,t){var l=1e4>T.recentlyCreatedOwnerStacks++;return O(e,r,t,!0,l?Error("react-stack-top-frame"):$,l?k(o(e)):F)}})()),E}var M;function ue(){return M||(M=1,process.env.NODE_ENV==="production"?h.exports=se():h.exports=le()),h.exports}var i=ue();function ie({variant:n="info",className:a,...s}){const o=[a||""];switch(n){case"warning":{o.push("bg-yellow-100 text-yellow-800 border-yellow-500");break}case"error":{o.push("bg-red-100 text-red-800 border-red-500");break}default:case"info":{o.push("bg-blue-100 text-blue-800 border-blue-500");break}}return i.jsx("div",{role:"alert",className:`border px-4 py-2 rounded-lg ${o.join(" ")}`,...s})}function q({variant:n,bold:a,italic:s,className:o,as:c,color:f,...m}){const d=[o];let b;if(c)b=c;else switch(n){case"heading":b="h2";break;case"list":b="li";break;case"paragraph":default:b="p";break}return a&&d.push("font-bold"),s&&d.push("italic"),f&&d.push(`text-${f}`),i.jsx(b,{className:d.join(" "),...m})}function U({className:n,...a}){const s=[n,"px-large","border","border-1","border-grey-light","rounded","lh-form-element","h-form-element","text-base"];return i.jsx("input",{className:s.join(" "),...a})}function w({className:n,variant:a="regular",...s}){const o=[n,"rounded","h-form-element","lh-form-element","px-large","text-base"];switch(a){case"error":o.push("bg-red-light","text-red-dark","font-bold");break;case"secondary":o.push("bg-transparent","text-grey-minor","px-0");break;case"regular":default:o.push("bg-blue-light","text-blue-dark","font-bold");break}return i.jsx("button",{className:o.join(" "),...s})}function B({className:n,...a}){const s=[n,"p-large","bg-bg","rounded","shadow-card"];return i.jsx("div",{className:s.join(" "),...a})}function S({label:n,...a}){return a.id||console.error("InputWithLabel component requires an id prop"),i.jsxs("div",{className:"mb-medium grid gap-small",children:[i.jsx(q,{as:"label",htmlFor:a.id,className:"cursor-pointer",children:n}),i.jsx(U,{...a})]})}function ce({onForgotPasswordClick:n,className:a,...s}){return i.jsx(B,{className:a,children:i.jsxs("form",{...s,onSubmit:o=>{o.preventDefault(),s.onSubmit&&s.onSubmit(o)},children:[i.jsx(S,{id:"login-email",label:"Your email",placeholder:"myname@email.com"}),i.jsx(S,{id:"login-password",label:"Your password",placeholder:"••••••••",type:"password"}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx(w,{variant:"secondary",type:"button",onClick:n,children:"Forgot password?"}),i.jsx(w,{variant:"regular",type:"submit",children:"Sign in"})]})]})})}exports.BoxWrapper=B;exports.Button=w;exports.Info=ie;exports.Input=U;exports.InputWithLabel=S;exports.LoginBox=ce;exports.Text=q;
package/dist/index.js ADDED
@@ -0,0 +1,439 @@
1
+ import te from "react";
2
+ var x = { exports: {} }, _ = {};
3
+ /**
4
+ * @license React
5
+ * react-jsx-runtime.production.js
6
+ *
7
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
8
+ *
9
+ * This source code is licensed under the MIT license found in the
10
+ * LICENSE file in the root directory of this source tree.
11
+ */
12
+ var F;
13
+ function ne() {
14
+ if (F) return _;
15
+ F = 1;
16
+ var n = Symbol.for("react.transitional.element"), a = Symbol.for("react.fragment");
17
+ function s(o, c, f) {
18
+ var m = null;
19
+ if (f !== void 0 && (m = "" + f), c.key !== void 0 && (m = "" + c.key), "key" in c) {
20
+ f = {};
21
+ for (var d in c)
22
+ d !== "key" && (f[d] = c[d]);
23
+ } else f = c;
24
+ return c = f.ref, {
25
+ $$typeof: n,
26
+ type: o,
27
+ key: m,
28
+ ref: c !== void 0 ? c : null,
29
+ props: f
30
+ };
31
+ }
32
+ return _.Fragment = a, _.jsx = s, _.jsxs = s, _;
33
+ }
34
+ var E = {};
35
+ /**
36
+ * @license React
37
+ * react-jsx-runtime.development.js
38
+ *
39
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
40
+ *
41
+ * This source code is licensed under the MIT license found in the
42
+ * LICENSE file in the root directory of this source tree.
43
+ */
44
+ var D;
45
+ function ae() {
46
+ return D || (D = 1, process.env.NODE_ENV !== "production" && (function() {
47
+ function n(e) {
48
+ if (e == null) return null;
49
+ if (typeof e == "function")
50
+ return e.$$typeof === K ? null : e.displayName || e.name || null;
51
+ if (typeof e == "string") return e;
52
+ switch (e) {
53
+ case R:
54
+ return "Fragment";
55
+ case V:
56
+ return "Profiler";
57
+ case J:
58
+ return "StrictMode";
59
+ case X:
60
+ return "Suspense";
61
+ case H:
62
+ return "SuspenseList";
63
+ case Q:
64
+ return "Activity";
65
+ }
66
+ if (typeof e == "object")
67
+ switch (typeof e.tag == "number" && console.error(
68
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
69
+ ), e.$$typeof) {
70
+ case q:
71
+ return "Portal";
72
+ case G:
73
+ return e.displayName || "Context";
74
+ case z:
75
+ return (e._context.displayName || "Context") + ".Consumer";
76
+ case B:
77
+ var r = e.render;
78
+ return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
79
+ case Z:
80
+ return r = e.displayName || null, r !== null ? r : n(e.type) || "Memo";
81
+ case g:
82
+ r = e._payload, e = e._init;
83
+ try {
84
+ return n(e(r));
85
+ } catch {
86
+ }
87
+ }
88
+ return null;
89
+ }
90
+ function a(e) {
91
+ return "" + e;
92
+ }
93
+ function s(e) {
94
+ try {
95
+ a(e);
96
+ var r = !1;
97
+ } catch {
98
+ r = !0;
99
+ }
100
+ if (r) {
101
+ r = console;
102
+ var t = r.error, l = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
103
+ return t.call(
104
+ r,
105
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
106
+ l
107
+ ), a(e);
108
+ }
109
+ }
110
+ function o(e) {
111
+ if (e === R) return "<>";
112
+ if (typeof e == "object" && e !== null && e.$$typeof === g)
113
+ return "<...>";
114
+ try {
115
+ var r = n(e);
116
+ return r ? "<" + r + ">" : "<...>";
117
+ } catch {
118
+ return "<...>";
119
+ }
120
+ }
121
+ function c() {
122
+ var e = T.A;
123
+ return e === null ? null : e.getOwner();
124
+ }
125
+ function f() {
126
+ return Error("react-stack-top-frame");
127
+ }
128
+ function m(e) {
129
+ if (A.call(e, "key")) {
130
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
131
+ if (r && r.isReactWarning) return !1;
132
+ }
133
+ return e.key !== void 0;
134
+ }
135
+ function d(e, r) {
136
+ function t() {
137
+ P || (P = !0, console.error(
138
+ "%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://react.dev/link/special-props)",
139
+ r
140
+ ));
141
+ }
142
+ t.isReactWarning = !0, Object.defineProperty(e, "key", {
143
+ get: t,
144
+ configurable: !0
145
+ });
146
+ }
147
+ function b() {
148
+ var e = n(this.type);
149
+ return C[e] || (C[e] = !0, console.error(
150
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
151
+ )), e = this.props.ref, e !== void 0 ? e : null;
152
+ }
153
+ function U(e, r, t, l, h, j) {
154
+ var u = t.ref;
155
+ return e = {
156
+ $$typeof: N,
157
+ type: e,
158
+ key: r,
159
+ props: t,
160
+ _owner: l
161
+ }, (u !== void 0 ? u : null) !== null ? Object.defineProperty(e, "ref", {
162
+ enumerable: !1,
163
+ get: b
164
+ }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
165
+ configurable: !1,
166
+ enumerable: !1,
167
+ writable: !0,
168
+ value: 0
169
+ }), Object.defineProperty(e, "_debugInfo", {
170
+ configurable: !1,
171
+ enumerable: !1,
172
+ writable: !0,
173
+ value: null
174
+ }), Object.defineProperty(e, "_debugStack", {
175
+ configurable: !1,
176
+ enumerable: !1,
177
+ writable: !0,
178
+ value: h
179
+ }), Object.defineProperty(e, "_debugTask", {
180
+ configurable: !1,
181
+ enumerable: !1,
182
+ writable: !0,
183
+ value: j
184
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
185
+ }
186
+ function y(e, r, t, l, h, j) {
187
+ var u = r.children;
188
+ if (u !== void 0)
189
+ if (l)
190
+ if (ee(u)) {
191
+ for (l = 0; l < u.length; l++)
192
+ S(u[l]);
193
+ Object.freeze && Object.freeze(u);
194
+ } else
195
+ console.error(
196
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
197
+ );
198
+ else S(u);
199
+ if (A.call(r, "key")) {
200
+ u = n(e);
201
+ var p = Object.keys(r).filter(function(re) {
202
+ return re !== "key";
203
+ });
204
+ l = 0 < p.length ? "{key: someKey, " + p.join(": ..., ") + ": ...}" : "{key: someKey}", $[u + l] || (p = 0 < p.length ? "{" + p.join(": ..., ") + ": ...}" : "{}", console.error(
205
+ `A props object containing a "key" prop is being spread into JSX:
206
+ let props = %s;
207
+ <%s {...props} />
208
+ React keys must be passed directly to JSX without using spread:
209
+ let props = %s;
210
+ <%s key={someKey} {...props} />`,
211
+ l,
212
+ u,
213
+ p,
214
+ u
215
+ ), $[u + l] = !0);
216
+ }
217
+ if (u = null, t !== void 0 && (s(t), u = "" + t), m(r) && (s(r.key), u = "" + r.key), "key" in r) {
218
+ t = {};
219
+ for (var w in r)
220
+ w !== "key" && (t[w] = r[w]);
221
+ } else t = r;
222
+ return u && d(
223
+ t,
224
+ typeof e == "function" ? e.displayName || e.name || "Unknown" : e
225
+ ), U(
226
+ e,
227
+ u,
228
+ t,
229
+ c(),
230
+ h,
231
+ j
232
+ );
233
+ }
234
+ function S(e) {
235
+ O(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === g && (e._payload.status === "fulfilled" ? O(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
236
+ }
237
+ function O(e) {
238
+ return typeof e == "object" && e !== null && e.$$typeof === N;
239
+ }
240
+ var v = te, N = Symbol.for("react.transitional.element"), q = Symbol.for("react.portal"), R = Symbol.for("react.fragment"), J = Symbol.for("react.strict_mode"), V = Symbol.for("react.profiler"), z = Symbol.for("react.consumer"), G = Symbol.for("react.context"), B = Symbol.for("react.forward_ref"), X = Symbol.for("react.suspense"), H = Symbol.for("react.suspense_list"), Z = Symbol.for("react.memo"), g = Symbol.for("react.lazy"), Q = Symbol.for("react.activity"), K = Symbol.for("react.client.reference"), T = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, A = Object.prototype.hasOwnProperty, ee = Array.isArray, k = console.createTask ? console.createTask : function() {
241
+ return null;
242
+ };
243
+ v = {
244
+ react_stack_bottom_frame: function(e) {
245
+ return e();
246
+ }
247
+ };
248
+ var P, C = {}, Y = v.react_stack_bottom_frame.bind(
249
+ v,
250
+ f
251
+ )(), I = k(o(f)), $ = {};
252
+ E.Fragment = R, E.jsx = function(e, r, t) {
253
+ var l = 1e4 > T.recentlyCreatedOwnerStacks++;
254
+ return y(
255
+ e,
256
+ r,
257
+ t,
258
+ !1,
259
+ l ? Error("react-stack-top-frame") : Y,
260
+ l ? k(o(e)) : I
261
+ );
262
+ }, E.jsxs = function(e, r, t) {
263
+ var l = 1e4 > T.recentlyCreatedOwnerStacks++;
264
+ return y(
265
+ e,
266
+ r,
267
+ t,
268
+ !0,
269
+ l ? Error("react-stack-top-frame") : Y,
270
+ l ? k(o(e)) : I
271
+ );
272
+ };
273
+ })()), E;
274
+ }
275
+ var L;
276
+ function oe() {
277
+ return L || (L = 1, process.env.NODE_ENV === "production" ? x.exports = ne() : x.exports = ae()), x.exports;
278
+ }
279
+ var i = oe();
280
+ function ce({ variant: n = "info", className: a, ...s }) {
281
+ const o = [a || ""];
282
+ switch (n) {
283
+ case "warning": {
284
+ o.push("bg-yellow-100 text-yellow-800 border-yellow-500");
285
+ break;
286
+ }
287
+ case "error": {
288
+ o.push("bg-red-100 text-red-800 border-red-500");
289
+ break;
290
+ }
291
+ default:
292
+ case "info": {
293
+ o.push("bg-blue-100 text-blue-800 border-blue-500");
294
+ break;
295
+ }
296
+ }
297
+ return /* @__PURE__ */ i.jsx(
298
+ "div",
299
+ {
300
+ role: "alert",
301
+ className: `border px-4 py-2 rounded-lg ${o.join(" ")}`,
302
+ ...s
303
+ }
304
+ );
305
+ }
306
+ function se({
307
+ variant: n,
308
+ bold: a,
309
+ italic: s,
310
+ className: o,
311
+ as: c,
312
+ color: f,
313
+ ...m
314
+ }) {
315
+ const d = [o];
316
+ let b;
317
+ if (c)
318
+ b = c;
319
+ else
320
+ switch (n) {
321
+ case "heading":
322
+ b = "h2";
323
+ break;
324
+ case "list":
325
+ b = "li";
326
+ break;
327
+ case "paragraph":
328
+ default:
329
+ b = "p";
330
+ break;
331
+ }
332
+ return a && d.push("font-bold"), s && d.push("italic"), f && d.push(`text-${f}`), /* @__PURE__ */ i.jsx(b, { className: d.join(" "), ...m });
333
+ }
334
+ function le({ className: n, ...a }) {
335
+ const s = [
336
+ n,
337
+ "px-large",
338
+ "border",
339
+ "border-1",
340
+ "border-grey-light",
341
+ "rounded",
342
+ "lh-form-element",
343
+ "h-form-element",
344
+ "text-base"
345
+ ];
346
+ return /* @__PURE__ */ i.jsx("input", { className: s.join(" "), ...a });
347
+ }
348
+ function W({
349
+ className: n,
350
+ variant: a = "regular",
351
+ ...s
352
+ }) {
353
+ const o = [
354
+ n,
355
+ "rounded",
356
+ "h-form-element",
357
+ "lh-form-element",
358
+ "px-large",
359
+ "text-base"
360
+ ];
361
+ switch (a) {
362
+ case "error":
363
+ o.push("bg-red-light", "text-red-dark", "font-bold");
364
+ break;
365
+ case "secondary":
366
+ o.push("bg-transparent", "text-grey-minor", "px-0");
367
+ break;
368
+ case "regular":
369
+ default:
370
+ o.push("bg-blue-light", "text-blue-dark", "font-bold");
371
+ break;
372
+ }
373
+ return /* @__PURE__ */ i.jsx("button", { className: o.join(" "), ...s });
374
+ }
375
+ function ue({ className: n, ...a }) {
376
+ const s = [n, "p-large", "bg-bg", "rounded", "shadow-card"];
377
+ return /* @__PURE__ */ i.jsx("div", { className: s.join(" "), ...a });
378
+ }
379
+ function M({ label: n, ...a }) {
380
+ return a.id || console.error("InputWithLabel component requires an id prop"), /* @__PURE__ */ i.jsxs("div", { className: "mb-medium grid gap-small", children: [
381
+ /* @__PURE__ */ i.jsx(se, { as: "label", htmlFor: a.id, className: "cursor-pointer", children: n }),
382
+ /* @__PURE__ */ i.jsx(le, { ...a })
383
+ ] });
384
+ }
385
+ function fe({
386
+ onForgotPasswordClick: n,
387
+ className: a,
388
+ ...s
389
+ }) {
390
+ return /* @__PURE__ */ i.jsx(ue, { className: a, children: /* @__PURE__ */ i.jsxs(
391
+ "form",
392
+ {
393
+ ...s,
394
+ onSubmit: (o) => {
395
+ o.preventDefault(), s.onSubmit && s.onSubmit(o);
396
+ },
397
+ children: [
398
+ /* @__PURE__ */ i.jsx(
399
+ M,
400
+ {
401
+ id: "login-email",
402
+ label: "Your email",
403
+ placeholder: "myname@email.com"
404
+ }
405
+ ),
406
+ /* @__PURE__ */ i.jsx(
407
+ M,
408
+ {
409
+ id: "login-password",
410
+ label: "Your password",
411
+ placeholder: "••••••••",
412
+ type: "password"
413
+ }
414
+ ),
415
+ /* @__PURE__ */ i.jsxs("div", { className: "flex justify-between", children: [
416
+ /* @__PURE__ */ i.jsx(
417
+ W,
418
+ {
419
+ variant: "secondary",
420
+ type: "button",
421
+ onClick: n,
422
+ children: "Forgot password?"
423
+ }
424
+ ),
425
+ /* @__PURE__ */ i.jsx(W, { variant: "regular", type: "submit", children: "Sign in" })
426
+ ] })
427
+ ]
428
+ }
429
+ ) });
430
+ }
431
+ export {
432
+ ue as BoxWrapper,
433
+ W as Button,
434
+ ce as Info,
435
+ le as Input,
436
+ M as InputWithLabel,
437
+ fe as LoginBox,
438
+ se as Text
439
+ };
package/dist/main.d.ts ADDED
@@ -0,0 +1 @@
1
+ import "./style.css";
@@ -0,0 +1 @@
1
+ import "@testing-library/jest-dom";
@@ -0,0 +1,4 @@
1
+ import type { HTMLAttributes } from "react";
2
+ type Props = HTMLAttributes<HTMLDivElement>;
3
+ export default function BoxWrapper({ className, ...props }: Props): import("react/jsx-runtime").JSX.Element;
4
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import BoxWrapper from "./BoxWrapper";
3
+ declare const meta: Meta<typeof BoxWrapper>;
4
+ export declare const Primary: StoryObj<typeof BoxWrapper>;
5
+ export default meta;
@@ -0,0 +1,6 @@
1
+ import type { ButtonHTMLAttributes } from "react";
2
+ interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {
3
+ variant?: "regular" | "error" | "secondary";
4
+ }
5
+ export default function Button({ className, variant, ...props }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import Button from "./Button";
3
+ declare const meta: Meta<typeof Button>;
4
+ export declare const Primary: StoryObj<typeof Button>;
5
+ export default meta;
@@ -0,0 +1,6 @@
1
+ import type { HTMLAttributes } from "react";
2
+ interface Props extends HTMLAttributes<HTMLDivElement> {
3
+ variant?: "info" | "warning" | "error";
4
+ }
5
+ export default function Info({ variant, className, ...props }: Props): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import Info from "./Info";
3
+ declare const meta: Meta<typeof Info>;
4
+ export declare const Primary: StoryObj<typeof Info>;
5
+ export default meta;
@@ -0,0 +1,4 @@
1
+ import type { HTMLProps } from "react";
2
+ type Props = HTMLProps<HTMLInputElement>;
3
+ export default function Input({ className, ...props }: Props): import("react/jsx-runtime").JSX.Element;
4
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import Input from "./Input";
3
+ declare const meta: Meta<typeof Input>;
4
+ export declare const Primary: StoryObj<typeof Input>;
5
+ export default meta;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ import type { ComponentPropsWithoutRef, ElementType, HTMLAttributes, JSX } from "react";
2
+ interface Props<T extends ElementType> extends HTMLAttributes<JSX.IntrinsicElements> {
3
+ variant?: "heading" | "list" | "paragraph";
4
+ as?: T;
5
+ bold?: boolean;
6
+ italic?: boolean;
7
+ color?: string;
8
+ }
9
+ type ReturnProps<P extends ElementType> = Props<P> & Omit<ComponentPropsWithoutRef<P>, keyof Props<P>>;
10
+ export default function Text<T extends ElementType = "p">({ variant, bold, italic, className, as, color, ...rest }: ReturnProps<T>): import("react/jsx-runtime").JSX.Element;
11
+ export {};