@danalazar/metro-ui 0.0.3 → 0.0.4
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/README.md +33 -0
- package/dist/{button-DTU9l2Gg.js → button-D2IRRUFN.js} +2 -2
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.js +2 -2
- package/dist/components/formField/formField.d.ts +6 -1
- package/dist/components/formField/formField.js +1 -1
- package/dist/components/input/input.d.ts +3 -9
- package/dist/components/input/input.js +1 -1
- package/dist/components/inputWithActions/inputWithAction.js +1 -1
- package/dist/components/keypad/keypad.d.ts +2 -7
- package/dist/components/keypad/keypad.js +3 -3
- package/dist/components/modal/modal.js +3 -3
- package/dist/components/select/select.js +1 -1
- package/dist/components/spinner/spinner.js +1 -1
- package/dist/formField-CYd3ghXm.js +39 -0
- package/dist/input-B4hjpmbq.js +20 -0
- package/dist/{inputWithAction-VBlCurUV.js → inputWithAction-DrO4FktP.js} +1 -1
- package/dist/{keypad-Bu5TjaRH.js → keypad-CrTKdzrB.js} +11 -35
- package/dist/main.js +8 -8
- package/dist/{modal-mu0n0R19.js → modal-BcJDY1O7.js} +1 -1
- package/dist/{select-NHAc5xjZ.js → select-DmezR35h.js} +1 -1
- package/dist/{spinner-Co2caOhH.js → spinner-BThkQA3X.js} +1 -1
- package/dist/test/setup.js +6176 -580
- package/package.json +4 -3
- package/dist/components/button/button.stories.d.ts +0 -48
- package/dist/components/button/button.stories.js +0 -82
- package/dist/components/button/button.test.d.ts +0 -1
- package/dist/components/button/button.test.js +0 -42
- package/dist/components/formField/formField.stories.d.ts +0 -15
- package/dist/components/formField/formField.stories.js +0 -77
- package/dist/components/formField/formField.test.d.ts +0 -1
- package/dist/components/formField/formField.test.js +0 -40
- package/dist/components/inputWithActions/inputWithAction.stories.d.ts +0 -9
- package/dist/components/inputWithActions/inputWithAction.stories.js +0 -83
- package/dist/components/inputWithActions/inputWithAction.test.d.ts +0 -1
- package/dist/components/inputWithActions/inputWithAction.test.js +0 -9
- package/dist/components/keypad/keypad.stories.d.ts +0 -6
- package/dist/components/keypad/keypad.stories.js +0 -17
- package/dist/components/keypad/keypad.test.d.ts +0 -1
- package/dist/components/keypad/keypad.test.js +0 -31
- package/dist/components/modal/modal.stories.d.ts +0 -32
- package/dist/components/modal/modal.stories.js +0 -78
- package/dist/components/modal/modal.test.d.ts +0 -1
- package/dist/components/modal/modal.test.js +0 -35
- package/dist/components/select/select.stories.d.ts +0 -38
- package/dist/components/select/select.stories.js +0 -44
- package/dist/components/select/select.test.d.ts +0 -1
- package/dist/components/select/select.test.js +0 -36
- package/dist/components/spinner/spinner.stories.d.ts +0 -30
- package/dist/components/spinner/spinner.stories.js +0 -32
- package/dist/components/spinner/spinner.test.d.ts +0 -1
- package/dist/components/spinner/spinner.test.js +0 -21
- package/dist/formField-BdRLOA0x.js +0 -30
- package/dist/input-q5h2lA4L.js +0 -20
- package/dist/lib-JrI87syO.js +0 -5604
- package/dist/magic-string.es-D07BpzB1.js +0 -659
- package/dist/react.esm-CQZuoo0_.js +0 -31060
- /package/dist/{clsx-ROFf4vs9.js → clsx-CVy0r8TU.js} +0 -0
package/README.md
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Metro UI Library
|
|
2
|
+
|
|
3
|
+
## Descriere
|
|
4
|
+
|
|
5
|
+
`metro-ui` este o librărie de componente React reutilizabile, construită cu TypeScript și SASS modules. Librăria oferă componente UI modulare, tipate și gata de folosit în orice aplicație React.
|
|
6
|
+
|
|
7
|
+
Componente incluse în prezent in metro-calc:
|
|
8
|
+
|
|
9
|
+
- `Button` – suportă variante, dimensiuni, states (disabled, loading)
|
|
10
|
+
- `Input` – suportă variante, dimensiuni, states (disabled)
|
|
11
|
+
- `Modal` – generic, utilizabil pentru conținut custom
|
|
12
|
+
- `Keypad` – tastatură numerică + operații
|
|
13
|
+
- Alte componente: Select, InputWithActions, Form Field, Spinner
|
|
14
|
+
|
|
15
|
+
Scop: oferirea unui set de componente reutilizabile pentru aplicații multiple.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Instalare
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
git clone https://github.com/DanaLazar/metro-ui.git
|
|
23
|
+
cd metro-ui
|
|
24
|
+
npm install
|
|
25
|
+
npm run storybook
|
|
26
|
+
|
|
27
|
+
## Decizii arhitecturale
|
|
28
|
+
- TypeScript pentru tipare stricte și siguranță în folosirea componentelor
|
|
29
|
+
- SASS modules pentru styling customizabil și consistent
|
|
30
|
+
- Stories cu Storybook pentru vizualizare și test manual
|
|
31
|
+
- Componente independente, fără dependențe inutile
|
|
32
|
+
- States suportate: disabled, loading, error (unde este relevant)
|
|
33
|
+
```
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as e } from "./clsx-
|
|
2
|
-
import { t } from "./spinner-
|
|
1
|
+
import { t as e } from "./clsx-CVy0r8TU.js";
|
|
2
|
+
import { t } from "./spinner-BThkQA3X.js";
|
|
3
3
|
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
4
|
import './assets/button.css';//#region src/components/button/button.module.sass
|
|
5
5
|
var i = "_button_1wl47_1", a = "_hidden_1wl47_82", o = "_spinnerWrapper_1wl47_86", s = "_spinner_1wl47_86", c = "_spin_1wl47_86", l = "_loadingContent_1wl47_101", u = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type ButtonVariant = "primary" | "secondary" | "danger" | "dark" | "ghost";
|
|
2
|
-
export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children"
|
|
2
|
+
export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
|
|
3
3
|
children?: React.ReactNode;
|
|
4
4
|
variant?: ButtonVariant;
|
|
5
5
|
size?: "sm" | "md" | "lg";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as e } from "../../button-
|
|
2
|
-
import "../../spinner-
|
|
1
|
+
import { t as e } from "../../button-D2IRRUFN.js";
|
|
2
|
+
import "../../spinner-BThkQA3X.js";
|
|
3
3
|
export { e as Button };
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
type InputLikeProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
3
|
+
error?: boolean;
|
|
4
|
+
};
|
|
1
5
|
export interface FormFieldProps {
|
|
2
6
|
label?: string;
|
|
3
7
|
error?: string;
|
|
4
8
|
helperText?: string;
|
|
5
|
-
children?: React.ReactElement
|
|
9
|
+
children?: React.ReactElement<InputLikeProps>;
|
|
6
10
|
id: string;
|
|
7
11
|
}
|
|
8
12
|
export declare const FormField: ({ label, error, helperText, children, id, }: FormFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../formField-
|
|
1
|
+
import { t as e } from "../../formField-CYd3ghXm.js";
|
|
2
2
|
export { e as FormField };
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
export interface InputProps {
|
|
2
|
-
id: string;
|
|
3
|
-
value: string;
|
|
4
|
-
onChange: (value: string) => void;
|
|
5
|
-
placeholder?: string;
|
|
6
|
-
type?: "text" | "email" | "password" | "number";
|
|
7
|
-
disabled?: boolean;
|
|
1
|
+
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
8
2
|
size?: "sm" | "md" | "lg";
|
|
9
|
-
|
|
3
|
+
error?: boolean;
|
|
10
4
|
}
|
|
11
|
-
export declare const Input: (
|
|
5
|
+
export declare const Input: import('react').ForwardRefExoticComponent<InputProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../input-
|
|
1
|
+
import { t as e } from "../../input-B4hjpmbq.js";
|
|
2
2
|
export { e as Input };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../inputWithAction-
|
|
1
|
+
import { t as e } from "../../inputWithAction-DrO4FktP.js";
|
|
2
2
|
export { e as InputWithAction };
|
|
@@ -5,12 +5,7 @@ export type KeypadButton = {
|
|
|
5
5
|
span?: number;
|
|
6
6
|
};
|
|
7
7
|
type KeypadProps = {
|
|
8
|
-
|
|
9
|
-
onOperationClick: (label: string) => void;
|
|
10
|
-
onClear: () => void;
|
|
11
|
-
onDecimalClick: () => void;
|
|
12
|
-
onEqualsClick: () => void;
|
|
13
|
-
onBackspaceClick: () => void;
|
|
8
|
+
onKeyPress: (key: KeypadButton) => void;
|
|
14
9
|
};
|
|
15
|
-
export declare const Keypad: ({
|
|
10
|
+
export declare const Keypad: ({ onKeyPress }: KeypadProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
11
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../button-
|
|
2
|
-
import "../../spinner-
|
|
3
|
-
import { t as e } from "../../keypad-
|
|
1
|
+
import "../../button-D2IRRUFN.js";
|
|
2
|
+
import "../../spinner-BThkQA3X.js";
|
|
3
|
+
import { t as e } from "../../keypad-CrTKdzrB.js";
|
|
4
4
|
export { e as Keypad };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../button-
|
|
2
|
-
import "../../spinner-
|
|
3
|
-
import { t as e } from "../../modal-
|
|
1
|
+
import "../../button-D2IRRUFN.js";
|
|
2
|
+
import "../../spinner-BThkQA3X.js";
|
|
3
|
+
import { t as e } from "../../modal-BcJDY1O7.js";
|
|
4
4
|
export { e as Modal };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../select-
|
|
1
|
+
import { t as e } from "../../select-DmezR35h.js";
|
|
2
2
|
export { e as Select };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../spinner-
|
|
1
|
+
import { t as e } from "../../spinner-BThkQA3X.js";
|
|
2
2
|
export { e as Spinner };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { t as e } from "./clsx-CVy0r8TU.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import r from "react";
|
|
4
|
+
import './assets/formField.css';//#region src/components/formField/formField.module.sass
|
|
5
|
+
var i = "_wrapper_10d1v_1", a = "_label_10d1v_11", o = "_control_10d1v_17", s = "_message_10d1v_29", c = "_error_10d1v_34", l = {
|
|
6
|
+
wrapper: i,
|
|
7
|
+
label: a,
|
|
8
|
+
control: o,
|
|
9
|
+
"control--error": "_control--error_10d1v_25",
|
|
10
|
+
message: s,
|
|
11
|
+
error: c
|
|
12
|
+
}, u = ({ label: i, error: a, helperText: o, children: s, id: c }) => {
|
|
13
|
+
let u = `${c}-message`;
|
|
14
|
+
return /* @__PURE__ */ n("div", {
|
|
15
|
+
className: l.wrapper,
|
|
16
|
+
children: [
|
|
17
|
+
i && /* @__PURE__ */ t("label", {
|
|
18
|
+
htmlFor: c,
|
|
19
|
+
className: l.label,
|
|
20
|
+
children: i
|
|
21
|
+
}),
|
|
22
|
+
/* @__PURE__ */ t("div", {
|
|
23
|
+
className: e(l.control, { [l["control--error"]]: a }),
|
|
24
|
+
children: s && r.cloneElement(s, {
|
|
25
|
+
id: c,
|
|
26
|
+
error: !!a,
|
|
27
|
+
"aria-describedby": a || o ? u : void 0
|
|
28
|
+
})
|
|
29
|
+
}),
|
|
30
|
+
(a || o) && /* @__PURE__ */ t("span", {
|
|
31
|
+
id: u,
|
|
32
|
+
className: e(l.message, { [l.error]: a }),
|
|
33
|
+
children: a || o
|
|
34
|
+
})
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { u as t };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { t as e } from "./clsx-CVy0r8TU.js";
|
|
2
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as n } from "react";
|
|
4
|
+
import './assets/input.css';var r = {
|
|
5
|
+
input: "_input_1838g_1",
|
|
6
|
+
"input--disabled": "_input--disabled_1838g_13",
|
|
7
|
+
"input--sm": "_input--sm_1838g_17",
|
|
8
|
+
"input--md": "_input--md_1838g_20",
|
|
9
|
+
"input--lg": "_input--lg_1838g_23"
|
|
10
|
+
}, i = n(({ size: n = "md", className: i, disabled: a, error: o, value: s, onChange: c, ...l }, u) => /* @__PURE__ */ t("input", {
|
|
11
|
+
ref: u,
|
|
12
|
+
value: s,
|
|
13
|
+
onChange: c,
|
|
14
|
+
"data-size": n,
|
|
15
|
+
"aria-invalid": o || void 0,
|
|
16
|
+
className: e(r.input, r[`input--${n}`], { [r["input--disabled"]]: a }, i),
|
|
17
|
+
...l
|
|
18
|
+
}));
|
|
19
|
+
//#endregion
|
|
20
|
+
export { i as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./clsx-
|
|
1
|
+
import { t as e } from "./clsx-CVy0r8TU.js";
|
|
2
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
3
3
|
import './assets/inputWithAction.css';var n = { wrapper: "_wrapper_kdbo2_1" }, r = ({ children: r, className: i }) => /* @__PURE__ */ t("div", {
|
|
4
4
|
className: e(n.wrapper, i),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./button-
|
|
1
|
+
import { t as e } from "./button-D2IRRUFN.js";
|
|
2
2
|
import { jsx as t } from "react/jsx-runtime";
|
|
3
3
|
import './assets/keypad.css';var n = {
|
|
4
4
|
keypad: "_keypad_1d13x_1",
|
|
@@ -97,39 +97,15 @@ import './assets/keypad.css';var n = {
|
|
|
97
97
|
case "backspace": return "danger";
|
|
98
98
|
default: return "secondary";
|
|
99
99
|
}
|
|
100
|
-
}, a = ({
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
o();
|
|
111
|
-
break;
|
|
112
|
-
case "decimal":
|
|
113
|
-
c();
|
|
114
|
-
break;
|
|
115
|
-
case "equals":
|
|
116
|
-
l();
|
|
117
|
-
break;
|
|
118
|
-
case "backspace":
|
|
119
|
-
u();
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
return /* @__PURE__ */ t("div", {
|
|
124
|
-
className: n.keypad,
|
|
125
|
-
children: r.map((r, a) => /* @__PURE__ */ t(e, {
|
|
126
|
-
variant: i(r.type),
|
|
127
|
-
size: "md",
|
|
128
|
-
className: r.span === 2 ? n["col-span-2"] : "",
|
|
129
|
-
onClick: () => d(r),
|
|
130
|
-
children: r.label
|
|
131
|
-
}, a))
|
|
132
|
-
});
|
|
133
|
-
};
|
|
100
|
+
}, a = ({ onKeyPress: a }) => /* @__PURE__ */ t("div", {
|
|
101
|
+
className: n.keypad,
|
|
102
|
+
children: r.map((r) => /* @__PURE__ */ t(e, {
|
|
103
|
+
variant: i(r.type),
|
|
104
|
+
size: "md",
|
|
105
|
+
className: r.span === 2 ? n["col-span-2"] : "",
|
|
106
|
+
onClick: () => a(r),
|
|
107
|
+
children: r.label
|
|
108
|
+
}, r.label))
|
|
109
|
+
});
|
|
134
110
|
//#endregion
|
|
135
111
|
export { a as t };
|
package/dist/main.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as e } from "./button-
|
|
2
|
-
import { t } from "./spinner-
|
|
3
|
-
import { t as n } from "./inputWithAction-
|
|
4
|
-
import { t as r } from "./modal-
|
|
5
|
-
import { t as i } from "./select-
|
|
6
|
-
import { t as a } from "./input-
|
|
7
|
-
import { t as o } from "./formField-
|
|
8
|
-
import { t as s } from "./keypad-
|
|
1
|
+
import { t as e } from "./button-D2IRRUFN.js";
|
|
2
|
+
import { t } from "./spinner-BThkQA3X.js";
|
|
3
|
+
import { t as n } from "./inputWithAction-DrO4FktP.js";
|
|
4
|
+
import { t as r } from "./modal-BcJDY1O7.js";
|
|
5
|
+
import { t as i } from "./select-DmezR35h.js";
|
|
6
|
+
import { t as a } from "./input-B4hjpmbq.js";
|
|
7
|
+
import { t as o } from "./formField-CYd3ghXm.js";
|
|
8
|
+
import { t as s } from "./keypad-CrTKdzrB.js";
|
|
9
9
|
export { e as Button, o as FormField, a as Input, n as InputWithAction, s as Keypad, r as Modal, i as Select, t as Spinner };
|