@danalazar/metro-ui 0.0.2 → 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.
Files changed (42) hide show
  1. package/README.md +33 -0
  2. package/dist/assets/button.css +1 -1
  3. package/dist/assets/formField.css +1 -0
  4. package/dist/assets/input.css +1 -0
  5. package/dist/assets/inputWithAction.css +1 -0
  6. package/dist/assets/keypad.css +1 -0
  7. package/dist/assets/modal.css +1 -0
  8. package/dist/assets/select.css +1 -0
  9. package/dist/assets/spinner.css +1 -0
  10. package/dist/button-D2IRRUFN.js +44 -0
  11. package/dist/clsx-CVy0r8TU.js +16 -0
  12. package/dist/components/button/button.d.ts +10 -5
  13. package/dist/components/button/button.js +2 -1
  14. package/dist/components/formField/formField.d.ts +13 -0
  15. package/dist/components/formField/formField.js +2 -0
  16. package/dist/components/input/input.d.ts +5 -0
  17. package/dist/components/input/input.js +2 -0
  18. package/dist/components/inputWithActions/inputWithAction.d.ts +5 -0
  19. package/dist/components/inputWithActions/inputWithAction.js +2 -0
  20. package/dist/components/keypad/keypad.d.ts +11 -0
  21. package/dist/components/keypad/keypad.js +4 -0
  22. package/dist/components/modal/modal.d.ts +9 -0
  23. package/dist/components/modal/modal.js +4 -0
  24. package/dist/components/select/select.d.ts +16 -0
  25. package/dist/components/select/select.js +2 -0
  26. package/dist/components/spinner/spinner.d.ts +6 -0
  27. package/dist/components/spinner/spinner.js +2 -0
  28. package/dist/formField-CYd3ghXm.js +39 -0
  29. package/dist/input-B4hjpmbq.js +20 -0
  30. package/dist/inputWithAction-DrO4FktP.js +8 -0
  31. package/dist/keypad-CrTKdzrB.js +111 -0
  32. package/dist/main.d.ts +7 -0
  33. package/dist/main.js +9 -2
  34. package/dist/modal-BcJDY1O7.js +48 -0
  35. package/dist/select-DmezR35h.js +26 -0
  36. package/dist/spinner-BThkQA3X.js +19 -0
  37. package/dist/test/setup.d.ts +0 -0
  38. package/dist/test/setup.js +7598 -0
  39. package/package.json +31 -6
  40. package/dist/button-CzP3GJ3Q.js +0 -7
  41. package/dist/components/button/button.stories.d.ts +0 -17
  42. package/dist/components/button/button.stories.js +0 -12
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 +1 @@
1
- ._button_6di44_1{color:#fff;background-color:#00f}
1
+ ._button_1wl47_1{cursor:pointer;border:none;border-radius:4px;justify-content:center;align-items:center;height:32px;padding:0 16px;font-weight:500;transition:all .2s;display:flex;position:relative;box-shadow:0 2px 4px #0000001a}._button_1wl47_1:hover{transform:translateY(-1px);box-shadow:0 4px 8px #00000026}._button_1wl47_1:active{transform:scale(.95)}._button--primary_1wl47_22{color:#fff;background:#0077a6}._button--primary_1wl47_22:hover{background:#00668f}._button--secondary_1wl47_29{color:#111827;background:0 0;border:2px solid #e5e7eb}._button--secondary_1wl47_29:hover{background:#f9fafb}._button--danger_1wl47_37{color:#fff;background:#d9482f}._button--danger_1wl47_37:hover{background:#b93e28}._button--dark_1wl47_44{color:#fff;background:#003d7a}._button--dark_1wl47_44:hover{background:#002d5a}._button--ghost_1wl47_51{color:#fff;background:0 0;border:2px solid #ffffff4d}._button--ghost_1wl47_51:hover{background:#ffffff1a}._button--sm_1wl47_59{height:32px;padding:0 12px;font-size:.875rem}._button--md_1wl47_64{height:40px;padding:0 16px;font-size:1rem}._button--lg_1wl47_69{height:48px;padding:0 20px;font-size:1.125rem}._button--disabled_1wl47_74{opacity:.5;cursor:not-allowed}._button--loading_1wl47_78{pointer-events:none}._hidden_1wl47_82{visibility:hidden}._spinnerWrapper_1wl47_86{justify-content:center;align-items:center;display:flex;position:absolute;inset:0}._spinner_1wl47_86{border:2px solid #0000;border-top-color:currentColor;border-radius:50%;animation:.8s linear infinite _spin_1wl47_86}._loadingContent_1wl47_101{align-items:center;gap:8px;display:flex}
@@ -0,0 +1 @@
1
+ ._wrapper_10d1v_1{flex-direction:column;align-items:stretch;gap:4px;display:flex}._wrapper_10d1v_1 input{flex:1}._label_10d1v_11{color:#374151;font-size:.875rem;font-weight:500}._control_10d1v_17{align-items:stretch;display:flex}._control_10d1v_17>*{align-items:center;display:flex}._control--error_10d1v_25 input{border-color:#d9482f}._message_10d1v_29{color:#374151;font-size:.75rem}._error_10d1v_34{color:#d9482f}
@@ -0,0 +1 @@
1
+ ._input_1838g_1{border:2px solid #e5e7eb;border-radius:4px;outline:none;padding:0 1rem;font-size:1rem;transition:all .2s}._input_1838g_1:focus{border-color:#0077a6;box-shadow:0 0 0 2px #0077a633}._input--disabled_1838g_13{opacity:.6;cursor:not-allowed}._input--sm_1838g_17{height:32px}._input--md_1838g_20{height:40px}._input--lg_1838g_23{height:48px}
@@ -0,0 +1 @@
1
+ ._wrapper_kdbo2_1{align-items:center;gap:8px;width:100%;display:flex}._wrapper_kdbo2_1>*{flex-shrink:0}._wrapper_kdbo2_1 input{flex:1}
@@ -0,0 +1 @@
1
+ ._keypad_1d13x_1{grid-template-columns:repeat(4,1fr);gap:8px;display:grid}._keypad__btn_1d13x_6{font-size:1.125rem}._keypad_1d13x_1 ._col-span-2_1d13x_9{grid-column:span 2}
@@ -0,0 +1 @@
1
+ ._metro-modal-overlay_1s4mh_1{z-index:9999;background-color:#0009;justify-content:center;align-items:center;display:flex;position:fixed;inset:0}._metro-modal_1s4mh_1{background-color:#fff;border-radius:4px;flex-direction:column;width:100%;max-width:520px;display:flex;overflow:hidden;box-shadow:0 10px 25px #0003}._metro-modal-header_1s4mh_22{color:#fff;background-color:#003d7a;justify-content:space-between;align-items:center;padding:16px 24px;display:flex}._metro-modal-header_1s4mh_22 h2{margin:0;font-size:1.25rem;font-weight:600}._metro-modal-header_1s4mh_22 button{cursor:pointer;color:#fff;background:0 0;border:none;justify-content:center;align-items:center;font-size:1.25rem;display:flex}._metro-modal-header_1s4mh_22 button:hover{opacity:.8}._metro-modal-content_1s4mh_49{flex-direction:column;gap:20px;padding:24px;display:flex}._expression-box_1s4mh_56{background-color:#f9fafb;border:1px solid #e5e7eb;border-radius:2px;padding:16px}._expression-box_1s4mh_56 p{color:#374151;margin:0}._expression-box_1s4mh_56 strong{color:#111827;margin-top:8px;font-size:1.125rem;display:block}._input-label_1s4mh_73{color:#374151;margin-bottom:6px;font-size:.875rem}._metro-modal-buttons_1s4mh_79{justify-content:space-between;gap:12px;padding:16px 24px;display:flex}._metro-modal-buttons_1s4mh_79 button{flex:1}
@@ -0,0 +1 @@
1
+ ._select_1azes_1{appearance:none;cursor:pointer;background-color:#fff;border:1px solid #e5e7eb;border-radius:4px;height:32px;padding:0 16px;font-size:.875rem;transition:all .2s}._select_1azes_1:focus{outline:none;box-shadow:0 0 0 2px #0077a633}._select--primary_1azes_16{border-color:#0077a6}._select--secondary_1azes_19{background:#f9fafb;border-color:#e5e7eb}._select--ghost_1azes_23{color:#fff;background:0 0;border:1px solid #ffffff4d}._select--disabled_1azes_28{opacity:.5;cursor:not-allowed}._select--sm_1azes_32{height:32px}._select--md_1azes_35{height:40px}._select--lg_1azes_38{height:48px}
@@ -0,0 +1 @@
1
+ ._spinner_wbe75_1{border:3px solid #0000;border-top-color:currentColor;border-radius:50%;animation:.8s linear infinite _spin_wbe75_1}._spinner--primary_wbe75_7{color:#0077a6}._spinner--secondary_wbe75_10{color:#111827}._spinner--white_wbe75_13{color:#fff}._spinner--sm_wbe75_16{width:16px;height:16px}._spinner--md_wbe75_20{width:24px;height:24px}._spinner--lg_wbe75_24{width:32px;height:32px}@keyframes _spin_wbe75_1{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
@@ -0,0 +1,44 @@
1
+ import { t as e } from "./clsx-CVy0r8TU.js";
2
+ import { t } from "./spinner-BThkQA3X.js";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ import './assets/button.css';//#region src/components/button/button.module.sass
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 = {
6
+ button: i,
7
+ "button--primary": "_button--primary_1wl47_22",
8
+ "button--secondary": "_button--secondary_1wl47_29",
9
+ "button--danger": "_button--danger_1wl47_37",
10
+ "button--dark": "_button--dark_1wl47_44",
11
+ "button--ghost": "_button--ghost_1wl47_51",
12
+ "button--sm": "_button--sm_1wl47_59",
13
+ "button--md": "_button--md_1wl47_64",
14
+ "button--lg": "_button--lg_1wl47_69",
15
+ "button--disabled": "_button--disabled_1wl47_74",
16
+ "button--loading": "_button--loading_1wl47_78",
17
+ hidden: a,
18
+ spinnerWrapper: o,
19
+ spinner: s,
20
+ spin: c,
21
+ loadingContent: l
22
+ }, d = ({ children: i, variant: a = "primary", disabled: o, size: s = "md", isLoading: c = !1, loadingText: l, className: d, onClick: f, ...p }) => {
23
+ let m = o || c, h = () => a === "dark" ? "white" : a === "ghost" ? "primary" : "white";
24
+ return /* @__PURE__ */ n("button", {
25
+ "data-variant": a,
26
+ "data-size": s,
27
+ className: e(u.button, u[`button--${a}`], u[`button--${s}`], {
28
+ [u["button--disabled"]]: m,
29
+ [u["button--loading"]]: c
30
+ }, d),
31
+ disabled: m,
32
+ onClick: f,
33
+ ...p,
34
+ children: c ? /* @__PURE__ */ r("span", {
35
+ className: u.loadingContent,
36
+ children: [/* @__PURE__ */ n(t, {
37
+ size: "sm",
38
+ variant: h()
39
+ }), /* @__PURE__ */ n("span", { children: l || i })]
40
+ }) : i
41
+ });
42
+ };
43
+ //#endregion
44
+ export { d as t };
@@ -0,0 +1,16 @@
1
+ //#region node_modules/clsx/dist/clsx.mjs
2
+ function e(t) {
3
+ var n, r, i = "";
4
+ if (typeof t == "string" || typeof t == "number") i += t;
5
+ else if (typeof t == "object") if (Array.isArray(t)) {
6
+ var a = t.length;
7
+ for (n = 0; n < a; n++) t[n] && (r = e(t[n])) && (i && (i += " "), i += r);
8
+ } else for (r in t) t[r] && (i && (i += " "), i += r);
9
+ return i;
10
+ }
11
+ function t() {
12
+ for (var t, n, r = 0, i = "", a = arguments.length; r < a; r++) (t = arguments[r]) && (n = e(t)) && (i && (i += " "), i += n);
13
+ return i;
14
+ }
15
+ //#endregion
16
+ export { t };
@@ -1,5 +1,10 @@
1
- type ButtonProps = Readonly<{
2
- children: string;
3
- }>;
4
- export declare const Button: (props: ButtonProps) => import("react/jsx-runtime").JSX.Element;
5
- export {};
1
+ export type ButtonVariant = "primary" | "secondary" | "danger" | "dark" | "ghost";
2
+ export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
3
+ children?: React.ReactNode;
4
+ variant?: ButtonVariant;
5
+ size?: "sm" | "md" | "lg";
6
+ isLoading?: boolean;
7
+ loadingText?: string;
8
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
9
+ }
10
+ export declare const Button: ({ children, variant, disabled, size, isLoading, loadingText, className, onClick, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,3 @@
1
- import { t as e } from "../../button-CzP3GJ3Q.js";
1
+ import { t as e } from "../../button-D2IRRUFN.js";
2
+ import "../../spinner-BThkQA3X.js";
2
3
  export { e as Button };
@@ -0,0 +1,13 @@
1
+ import { default as React } from 'react';
2
+ type InputLikeProps = React.InputHTMLAttributes<HTMLInputElement> & {
3
+ error?: boolean;
4
+ };
5
+ export interface FormFieldProps {
6
+ label?: string;
7
+ error?: string;
8
+ helperText?: string;
9
+ children?: React.ReactElement<InputLikeProps>;
10
+ id: string;
11
+ }
12
+ export declare const FormField: ({ label, error, helperText, children, id, }: FormFieldProps) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../../formField-CYd3ghXm.js";
2
+ export { e as FormField };
@@ -0,0 +1,5 @@
1
+ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
2
+ size?: "sm" | "md" | "lg";
3
+ error?: boolean;
4
+ }
5
+ export declare const Input: import('react').ForwardRefExoticComponent<InputProps & import('react').RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../../input-B4hjpmbq.js";
2
+ export { e as Input };
@@ -0,0 +1,5 @@
1
+ export interface InputWithActionProps {
2
+ children: React.ReactNode;
3
+ className?: string;
4
+ }
5
+ export declare const InputWithAction: ({ children, className, }: InputWithActionProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../../inputWithAction-DrO4FktP.js";
2
+ export { e as InputWithAction };
@@ -0,0 +1,11 @@
1
+ export type KeypadButton = {
2
+ label: string;
3
+ type: "number" | "operation" | "clear" | "decimal" | "equals" | "backspace";
4
+ value?: string;
5
+ span?: number;
6
+ };
7
+ type KeypadProps = {
8
+ onKeyPress: (key: KeypadButton) => void;
9
+ };
10
+ export declare const Keypad: ({ onKeyPress }: KeypadProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,4 @@
1
+ import "../../button-D2IRRUFN.js";
2
+ import "../../spinner-BThkQA3X.js";
3
+ import { t as e } from "../../keypad-CrTKdzrB.js";
4
+ export { e as Keypad };
@@ -0,0 +1,9 @@
1
+ import { default as React } from 'react';
2
+ export interface ModalProps {
3
+ isOpen: boolean;
4
+ title: string;
5
+ onClose: () => void;
6
+ children: React.ReactNode;
7
+ actions?: React.ReactNode;
8
+ }
9
+ export declare const Modal: React.FC<ModalProps>;
@@ -0,0 +1,4 @@
1
+ import "../../button-D2IRRUFN.js";
2
+ import "../../spinner-BThkQA3X.js";
3
+ import { t as e } from "../../modal-BcJDY1O7.js";
4
+ export { e as Modal };
@@ -0,0 +1,16 @@
1
+ export type SelectVariant = "primary" | "secondary" | "ghost";
2
+ export interface SelectOption {
3
+ label: string;
4
+ value: string;
5
+ }
6
+ export interface SelectProps {
7
+ options: SelectOption[];
8
+ value?: string;
9
+ onChange?: (value: string) => void;
10
+ ariaLabel?: string;
11
+ variant?: SelectVariant;
12
+ size?: "sm" | "md" | "lg";
13
+ disabled?: boolean;
14
+ className?: string;
15
+ }
16
+ export declare const Select: ({ options, value, onChange, ariaLabel, variant, size, disabled, className, }: SelectProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../../select-DmezR35h.js";
2
+ export { e as Select };
@@ -0,0 +1,6 @@
1
+ export interface SpinnerProps {
2
+ size?: "sm" | "md" | "lg";
3
+ variant?: "primary" | "secondary" | "white";
4
+ className?: string;
5
+ }
6
+ export declare const Spinner: ({ size, variant, className, }: SpinnerProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../../spinner-BThkQA3X.js";
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 };
@@ -0,0 +1,8 @@
1
+ import { t as e } from "./clsx-CVy0r8TU.js";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import './assets/inputWithAction.css';var n = { wrapper: "_wrapper_kdbo2_1" }, r = ({ children: r, className: i }) => /* @__PURE__ */ t("div", {
4
+ className: e(n.wrapper, i),
5
+ children: r
6
+ });
7
+ //#endregion
8
+ export { r as t };
@@ -0,0 +1,111 @@
1
+ import { t as e } from "./button-D2IRRUFN.js";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import './assets/keypad.css';var n = {
4
+ keypad: "_keypad_1d13x_1",
5
+ keypad__btn: "_keypad__btn_1d13x_6",
6
+ "col-span-2": "_col-span-2_1d13x_9"
7
+ }, r = [
8
+ {
9
+ label: "C",
10
+ type: "clear",
11
+ span: 2
12
+ },
13
+ {
14
+ label: "⌫",
15
+ type: "backspace"
16
+ },
17
+ {
18
+ label: "÷",
19
+ type: "operation"
20
+ },
21
+ {
22
+ label: "7",
23
+ type: "number",
24
+ value: "7"
25
+ },
26
+ {
27
+ label: "8",
28
+ type: "number",
29
+ value: "8"
30
+ },
31
+ {
32
+ label: "9",
33
+ type: "number",
34
+ value: "9"
35
+ },
36
+ {
37
+ label: "×",
38
+ type: "operation"
39
+ },
40
+ {
41
+ label: "4",
42
+ type: "number",
43
+ value: "4"
44
+ },
45
+ {
46
+ label: "5",
47
+ type: "number",
48
+ value: "5"
49
+ },
50
+ {
51
+ label: "6",
52
+ type: "number",
53
+ value: "6"
54
+ },
55
+ {
56
+ label: "-",
57
+ type: "operation"
58
+ },
59
+ {
60
+ label: "1",
61
+ type: "number",
62
+ value: "1"
63
+ },
64
+ {
65
+ label: "2",
66
+ type: "number",
67
+ value: "2"
68
+ },
69
+ {
70
+ label: "3",
71
+ type: "number",
72
+ value: "3"
73
+ },
74
+ {
75
+ label: "+",
76
+ type: "operation"
77
+ },
78
+ {
79
+ label: "0",
80
+ type: "number",
81
+ value: "0",
82
+ span: 2
83
+ },
84
+ {
85
+ label: ".",
86
+ type: "decimal"
87
+ },
88
+ {
89
+ label: "=",
90
+ type: "equals"
91
+ }
92
+ ], i = (e) => {
93
+ switch (e) {
94
+ case "operation": return "primary";
95
+ case "equals": return "dark";
96
+ case "clear":
97
+ case "backspace": return "danger";
98
+ default: return "secondary";
99
+ }
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
+ });
110
+ //#endregion
111
+ export { a as t };
package/dist/main.d.ts CHANGED
@@ -1 +1,8 @@
1
1
  export { Button } from './components/button/button';
2
+ export { InputWithAction } from './components/inputWithActions/inputWithAction';
3
+ export { Modal } from './components/modal/modal';
4
+ export { Spinner } from './components/spinner/spinner';
5
+ export { Select } from './components/select/select';
6
+ export { Input } from './components/input/input';
7
+ export { FormField } from './components/formField/formField';
8
+ export { Keypad } from './components/keypad/keypad';
package/dist/main.js CHANGED
@@ -1,2 +1,9 @@
1
- import { t as e } from "./button-CzP3GJ3Q.js";
2
- export { e as Button };
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
+ 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 };
@@ -0,0 +1,48 @@
1
+ import { t as e } from "./button-D2IRRUFN.js";
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ import r from "react";
4
+ import './assets/modal.css';//#region src/components/modal/modal.module.sass
5
+ var i = {
6
+ "metro-modal-overlay": "_metro-modal-overlay_1s4mh_1",
7
+ "metro-modal": "_metro-modal_1s4mh_1",
8
+ "metro-modal-header": "_metro-modal-header_1s4mh_22",
9
+ "metro-modal-content": "_metro-modal-content_1s4mh_49",
10
+ "expression-box": "_expression-box_1s4mh_56",
11
+ "input-label": "_input-label_1s4mh_73",
12
+ "metro-modal-buttons": "_metro-modal-buttons_1s4mh_79"
13
+ }, a = ({ isOpen: a, title: o, onClose: s, children: c, actions: l }) => {
14
+ let u = r.useId();
15
+ return a ? /* @__PURE__ */ t("div", {
16
+ className: i["metro-modal-overlay"],
17
+ children: /* @__PURE__ */ n("div", {
18
+ className: i["metro-modal"],
19
+ role: "dialog",
20
+ "aria-modal": "true",
21
+ "aria-labelledby": u,
22
+ children: [
23
+ /* @__PURE__ */ n("div", {
24
+ className: i["metro-modal-header"],
25
+ children: [/* @__PURE__ */ t("h2", {
26
+ id: u,
27
+ children: o
28
+ }), /* @__PURE__ */ t(e, {
29
+ variant: "ghost",
30
+ onClick: s,
31
+ "aria-label": "Close dialog",
32
+ children: "✕"
33
+ })]
34
+ }),
35
+ /* @__PURE__ */ t("div", {
36
+ className: i["metro-modal-content"],
37
+ children: c
38
+ }),
39
+ l && /* @__PURE__ */ t("div", {
40
+ className: i["metro-modal-buttons"],
41
+ children: l
42
+ })
43
+ ]
44
+ })
45
+ }) : null;
46
+ };
47
+ //#endregion
48
+ export { a as t };
@@ -0,0 +1,26 @@
1
+ import { t as e } from "./clsx-CVy0r8TU.js";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import './assets/select.css';var n = {
4
+ select: "_select_1azes_1",
5
+ "select--primary": "_select--primary_1azes_16",
6
+ "select--secondary": "_select--secondary_1azes_19",
7
+ "select--ghost": "_select--ghost_1azes_23",
8
+ "select--disabled": "_select--disabled_1azes_28",
9
+ "select--sm": "_select--sm_1azes_32",
10
+ "select--md": "_select--md_1azes_35",
11
+ "select--lg": "_select--lg_1azes_38"
12
+ }, r = ({ options: r, value: i, onChange: a, ariaLabel: o, variant: s = "primary", size: c = "md", disabled: l, className: u }) => /* @__PURE__ */ t("select", {
13
+ "aria-label": o ?? "Select",
14
+ "data-variant": s,
15
+ "data-size": c,
16
+ className: e(n.select, n[`select--${s}`], n[`select--${c}`], { [n["select--disabled"]]: l }, u),
17
+ value: i,
18
+ disabled: l,
19
+ onChange: (e) => a?.(e.target.value),
20
+ children: r.map((e) => /* @__PURE__ */ t("option", {
21
+ value: e.value,
22
+ children: e.label
23
+ }, e.value))
24
+ });
25
+ //#endregion
26
+ export { r as t };
@@ -0,0 +1,19 @@
1
+ import { t as e } from "./clsx-CVy0r8TU.js";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ import './assets/spinner.css';var n = {
4
+ spinner: "_spinner_wbe75_1",
5
+ spin: "_spin_wbe75_1",
6
+ "spinner--primary": "_spinner--primary_wbe75_7",
7
+ "spinner--secondary": "_spinner--secondary_wbe75_10",
8
+ "spinner--white": "_spinner--white_wbe75_13",
9
+ "spinner--sm": "_spinner--sm_wbe75_16",
10
+ "spinner--md": "_spinner--md_wbe75_20",
11
+ "spinner--lg": "_spinner--lg_wbe75_24"
12
+ }, r = ({ size: r = "md", variant: i = "primary", className: a }) => /* @__PURE__ */ t("div", {
13
+ "data-testid": "spinner",
14
+ "data-size": r,
15
+ "data-variant": i,
16
+ className: e(n.spinner, n[`spinner--${r}`], n[`spinner--${i}`], a)
17
+ });
18
+ //#endregion
19
+ export { r as t };
File without changes