@danalazar/metro-ui 0.0.1 → 0.0.3

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 (70) hide show
  1. package/dist/assets/button.css +1 -1
  2. package/dist/assets/formField.css +1 -0
  3. package/dist/assets/input.css +1 -0
  4. package/dist/assets/inputWithAction.css +1 -0
  5. package/dist/assets/keypad.css +1 -0
  6. package/dist/assets/modal.css +1 -0
  7. package/dist/assets/select.css +1 -0
  8. package/dist/assets/spinner.css +1 -0
  9. package/dist/button-DTU9l2Gg.js +44 -0
  10. package/dist/clsx-ROFf4vs9.js +16 -0
  11. package/dist/components/button/button.d.ts +10 -5
  12. package/dist/components/button/button.js +2 -1
  13. package/dist/components/button/button.stories.d.ts +48 -0
  14. package/dist/components/button/button.stories.js +82 -0
  15. package/dist/components/button/button.test.d.ts +1 -0
  16. package/dist/components/button/button.test.js +42 -0
  17. package/dist/components/formField/formField.d.ts +8 -0
  18. package/dist/components/formField/formField.js +2 -0
  19. package/dist/components/formField/formField.stories.d.ts +15 -0
  20. package/dist/components/formField/formField.stories.js +77 -0
  21. package/dist/components/formField/formField.test.d.ts +1 -0
  22. package/dist/components/formField/formField.test.js +40 -0
  23. package/dist/components/input/input.d.ts +11 -0
  24. package/dist/components/input/input.js +2 -0
  25. package/dist/components/inputWithActions/inputWithAction.d.ts +5 -0
  26. package/dist/components/inputWithActions/inputWithAction.js +2 -0
  27. package/dist/components/inputWithActions/inputWithAction.stories.d.ts +9 -0
  28. package/dist/components/inputWithActions/inputWithAction.stories.js +83 -0
  29. package/dist/components/inputWithActions/inputWithAction.test.d.ts +1 -0
  30. package/dist/components/inputWithActions/inputWithAction.test.js +9 -0
  31. package/dist/components/keypad/keypad.d.ts +16 -0
  32. package/dist/components/keypad/keypad.js +4 -0
  33. package/dist/components/keypad/keypad.stories.d.ts +6 -0
  34. package/dist/components/keypad/keypad.stories.js +17 -0
  35. package/dist/components/keypad/keypad.test.d.ts +1 -0
  36. package/dist/components/keypad/keypad.test.js +31 -0
  37. package/dist/components/modal/modal.d.ts +9 -0
  38. package/dist/components/modal/modal.js +4 -0
  39. package/dist/components/modal/modal.stories.d.ts +32 -0
  40. package/dist/components/modal/modal.stories.js +78 -0
  41. package/dist/components/modal/modal.test.d.ts +1 -0
  42. package/dist/components/modal/modal.test.js +35 -0
  43. package/dist/components/select/select.d.ts +16 -0
  44. package/dist/components/select/select.js +2 -0
  45. package/dist/components/select/select.stories.d.ts +38 -0
  46. package/dist/components/select/select.stories.js +44 -0
  47. package/dist/components/select/select.test.d.ts +1 -0
  48. package/dist/components/select/select.test.js +36 -0
  49. package/dist/components/spinner/spinner.d.ts +6 -0
  50. package/dist/components/spinner/spinner.js +2 -0
  51. package/dist/components/spinner/spinner.stories.d.ts +30 -0
  52. package/dist/components/spinner/spinner.stories.js +32 -0
  53. package/dist/components/spinner/spinner.test.d.ts +1 -0
  54. package/dist/components/spinner/spinner.test.js +21 -0
  55. package/dist/formField-BdRLOA0x.js +30 -0
  56. package/dist/input-q5h2lA4L.js +20 -0
  57. package/dist/inputWithAction-VBlCurUV.js +8 -0
  58. package/dist/keypad-Bu5TjaRH.js +135 -0
  59. package/dist/lib-JrI87syO.js +5604 -0
  60. package/dist/magic-string.es-D07BpzB1.js +659 -0
  61. package/dist/main.d.ts +7 -0
  62. package/dist/main.js +9 -2
  63. package/dist/modal-mu0n0R19.js +48 -0
  64. package/dist/react.esm-CQZuoo0_.js +31060 -0
  65. package/dist/select-NHAc5xjZ.js +26 -0
  66. package/dist/spinner-Co2caOhH.js +19 -0
  67. package/dist/test/setup.d.ts +0 -0
  68. package/dist/test/setup.js +2002 -0
  69. package/package.json +40 -14
  70. package/dist/button-DU_N71pa.js +0 -6
@@ -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-ROFf4vs9.js";
2
+ import { t } from "./spinner-Co2caOhH.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) => void;
5
- export {};
1
+ export type ButtonVariant = "primary" | "secondary" | "danger" | "dark" | "ghost";
2
+ export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children" | "onClick"> {
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-DU_N71pa.js";
1
+ import { t as e } from "../../button-DTU9l2Gg.js";
2
+ import "../../spinner-Co2caOhH.js";
2
3
  export { e as Button };
@@ -0,0 +1,48 @@
1
+ import { StoryObj } from '@storybook/react-vite';
2
+ declare const meta: {
3
+ title: string;
4
+ component: ({ children, variant, disabled, size, isLoading, loadingText, className, onClick, ...props }: import('./button').ButtonProps) => import("react/jsx-runtime").JSX.Element;
5
+ parameters: {
6
+ layout: string;
7
+ };
8
+ tags: string[];
9
+ argTypes: {
10
+ variant: {
11
+ control: "select";
12
+ options: string[];
13
+ description: string;
14
+ };
15
+ size: {
16
+ control: "select";
17
+ options: string[];
18
+ description: string;
19
+ };
20
+ disabled: {
21
+ control: "boolean";
22
+ description: string;
23
+ };
24
+ onClick: {
25
+ action: string;
26
+ description: string;
27
+ };
28
+ };
29
+ args: {
30
+ children: string;
31
+ variant: "primary";
32
+ size: "md";
33
+ disabled: false;
34
+ };
35
+ };
36
+ export default meta;
37
+ type Story = StoryObj<typeof meta>;
38
+ export declare const Primary: Story;
39
+ export declare const Secondary: Story;
40
+ export declare const Danger: Story;
41
+ export declare const Dark: Story;
42
+ export declare const Ghost: Story;
43
+ export declare const Small: Story;
44
+ export declare const Medium: Story;
45
+ export declare const Large: Story;
46
+ export declare const Disabled: Story;
47
+ export declare const GhostLoading: Story;
48
+ export declare const DarkLoadingWithText: Story;
@@ -0,0 +1,82 @@
1
+ import { t as e } from "../../button-DTU9l2Gg.js";
2
+ import "../../spinner-Co2caOhH.js";
3
+ //#region src/components/button/button.stories.ts
4
+ var t = {
5
+ title: "Components/Button",
6
+ component: e,
7
+ parameters: { layout: "centered" },
8
+ tags: ["autodocs"],
9
+ argTypes: {
10
+ variant: {
11
+ control: "select",
12
+ options: [
13
+ "primary",
14
+ "secondary",
15
+ "danger",
16
+ "dark",
17
+ "ghost"
18
+ ],
19
+ description: "Button style variant"
20
+ },
21
+ size: {
22
+ control: "select",
23
+ options: [
24
+ "sm",
25
+ "md",
26
+ "lg"
27
+ ],
28
+ description: "Button size"
29
+ },
30
+ disabled: {
31
+ control: "boolean",
32
+ description: "Disable the button"
33
+ },
34
+ onClick: {
35
+ action: "clicked",
36
+ description: "Callback when button is clicked"
37
+ }
38
+ },
39
+ args: {
40
+ children: "Button",
41
+ variant: "primary",
42
+ size: "md",
43
+ disabled: !1
44
+ }
45
+ }, n = { args: {
46
+ variant: "primary",
47
+ children: "Primary Button"
48
+ } }, r = { args: {
49
+ variant: "secondary",
50
+ children: "Secondary Button"
51
+ } }, i = { args: {
52
+ variant: "danger",
53
+ children: "Danger Button"
54
+ } }, a = { args: {
55
+ variant: "dark",
56
+ children: "Dark Button"
57
+ } }, o = { args: {
58
+ variant: "ghost",
59
+ children: "Ghost Button"
60
+ } }, s = { args: {
61
+ size: "sm",
62
+ children: "Small Button"
63
+ } }, c = { args: {
64
+ size: "md",
65
+ children: "Medium Button"
66
+ } }, l = { args: {
67
+ size: "lg",
68
+ children: "Large Button"
69
+ } }, u = { args: {
70
+ disabled: !0,
71
+ children: "Disabled Button"
72
+ } }, d = { args: {
73
+ variant: "ghost",
74
+ isLoading: !0,
75
+ children: "Ghost"
76
+ } }, f = { args: {
77
+ variant: "dark",
78
+ isLoading: !0,
79
+ children: "Loading..."
80
+ } };
81
+ //#endregion
82
+ export { i as Danger, a as Dark, f as DarkLoadingWithText, u as Disabled, o as Ghost, d as GhostLoading, l as Large, c as Medium, n as Primary, r as Secondary, s as Small, t as default };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,42 @@
1
+ import "../../lib-JrI87syO.js";
2
+ import { t as e } from "../../button-DTU9l2Gg.js";
3
+ import "../../spinner-Co2caOhH.js";
4
+ import { i as t, n, o as r, r as i, s as a } from "../../react.esm-CQZuoo0_.js";
5
+ import { jsx as o } from "react/jsx-runtime";
6
+ //#region src/components/button/button.test.tsx
7
+ r("Button Component", () => {
8
+ a("renders children correctly", () => {
9
+ n(/* @__PURE__ */ o(e, { children: "Click me" })), t(i.getByText("Click me")).toBeInTheDocument();
10
+ }), a("applies primary variant by default", () => {
11
+ n(/* @__PURE__ */ o(e, { children: "Test" })), t(i.getByRole("button")).toHaveAttribute("data-variant", "primary");
12
+ }), a("applies disabled state when disabled prop is true", () => {
13
+ n(/* @__PURE__ */ o(e, {
14
+ disabled: !0,
15
+ children: "Test"
16
+ })), t(i.getByRole("button")).toBeDisabled();
17
+ }), a("renders with different variants", () => {
18
+ let { rerender: r } = n(/* @__PURE__ */ o(e, {
19
+ variant: "secondary",
20
+ children: "Secondary"
21
+ })), a = i.getByRole("button");
22
+ t(a).toHaveAttribute("data-variant", "secondary"), r(/* @__PURE__ */ o(e, {
23
+ variant: "danger",
24
+ children: "Danger"
25
+ })), a = i.getByRole("button"), t(a).toHaveAttribute("data-variant", "danger");
26
+ }), a("renders with different sizes", () => {
27
+ let { rerender: r } = n(/* @__PURE__ */ o(e, {
28
+ size: "sm",
29
+ children: "Small"
30
+ })), a = i.getByRole("button");
31
+ t(a).toHaveAttribute("data-size", "sm"), r(/* @__PURE__ */ o(e, {
32
+ size: "lg",
33
+ children: "Large"
34
+ })), a = i.getByRole("button"), t(a).toHaveAttribute("data-size", "lg");
35
+ }), a("shows spinner when loading", () => {
36
+ n(/* @__PURE__ */ o(e, {
37
+ isLoading: !0,
38
+ children: "Click"
39
+ })), t(i.getByRole("button")).toBeDisabled();
40
+ });
41
+ });
42
+ //#endregion
@@ -0,0 +1,8 @@
1
+ export interface FormFieldProps {
2
+ label?: string;
3
+ error?: string;
4
+ helperText?: string;
5
+ children?: React.ReactElement;
6
+ id: string;
7
+ }
8
+ export declare const FormField: ({ label, error, helperText, children, id, }: FormFieldProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../../formField-BdRLOA0x.js";
2
+ export { e as FormField };
@@ -0,0 +1,15 @@
1
+ import { StoryObj } from '@storybook/react-vite';
2
+ declare const meta: {
3
+ title: string;
4
+ component: ({ label, error, helperText, children, id, }: import('./formField').FormFieldProps) => import("react/jsx-runtime").JSX.Element;
5
+ parameters: {
6
+ layout: string;
7
+ };
8
+ tags: string[];
9
+ };
10
+ export default meta;
11
+ type Story = StoryObj<typeof meta>;
12
+ export declare const Default: Story;
13
+ export declare const Error: Story;
14
+ export declare const HelperText: Story;
15
+ export declare const WithAction: Story;
@@ -0,0 +1,77 @@
1
+ import { t as e } from "../../input-q5h2lA4L.js";
2
+ import { t } from "../../formField-BdRLOA0x.js";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ import { useState as r } from "react";
5
+ //#region src/components/formField/formField.stories.tsx
6
+ var i = {
7
+ title: "Components/FormField",
8
+ component: t,
9
+ parameters: { layout: "centered" },
10
+ tags: ["autodocs"]
11
+ }, a = {
12
+ args: { id: "formField-default" },
13
+ render: (i) => {
14
+ let [a, o] = r("");
15
+ return /* @__PURE__ */ n(t, {
16
+ ...i,
17
+ label: "Name",
18
+ children: /* @__PURE__ */ n(e, {
19
+ id: "formField-default-input",
20
+ value: a,
21
+ onChange: (e) => o(e)
22
+ })
23
+ });
24
+ }
25
+ }, o = {
26
+ args: { id: "formField-error" },
27
+ render: (i) => {
28
+ let [a, o] = r("");
29
+ return /* @__PURE__ */ n(t, {
30
+ ...i,
31
+ label: "Email",
32
+ error: "Invalid email",
33
+ children: /* @__PURE__ */ n(e, {
34
+ id: "formField-error-input",
35
+ value: a,
36
+ onChange: (e) => o(e)
37
+ })
38
+ });
39
+ }
40
+ }, s = {
41
+ args: { id: "formField-helperText" },
42
+ render: (i) => {
43
+ let [a, o] = r("");
44
+ return /* @__PURE__ */ n(t, {
45
+ ...i,
46
+ label: "Password",
47
+ helperText: "Must be at least 8 characters",
48
+ children: /* @__PURE__ */ n(e, {
49
+ id: "formField-helperText-input",
50
+ value: a,
51
+ onChange: (e) => o(e)
52
+ })
53
+ });
54
+ }
55
+ }, c = {
56
+ args: { id: "formField-withAction" },
57
+ render: (i) => {
58
+ let [a, o] = r("");
59
+ return /* @__PURE__ */ n(t, {
60
+ ...i,
61
+ label: "Search",
62
+ children: /* @__PURE__ */ n("div", {
63
+ style: {
64
+ display: "flex",
65
+ gap: "8px"
66
+ },
67
+ children: /* @__PURE__ */ n(e, {
68
+ id: "formField-withAction-input",
69
+ value: a,
70
+ onChange: (e) => o(e)
71
+ })
72
+ })
73
+ });
74
+ }
75
+ };
76
+ //#endregion
77
+ export { a as Default, o as Error, s as HelperText, c as WithAction, i as default };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,40 @@
1
+ import "../../lib-JrI87syO.js";
2
+ import { n as e, t } from "../../formField-BdRLOA0x.js";
3
+ import { i as n, n as r, o as i, r as a, s as o } from "../../react.esm-CQZuoo0_.js";
4
+ import { jsx as s } from "react/jsx-runtime";
5
+ //#region src/components/formField/formField.test.tsx
6
+ i("FormField", () => {
7
+ o("renders label", () => {
8
+ r(/* @__PURE__ */ s(t, {
9
+ label: "Email",
10
+ id: "email",
11
+ children: /* @__PURE__ */ s("input", {})
12
+ })), n(a.getByText("Email")).toBeInTheDocument();
13
+ }), o("renders children", () => {
14
+ r(/* @__PURE__ */ s(t, {
15
+ id: "test",
16
+ children: /* @__PURE__ */ s("input", { placeholder: "test" })
17
+ })), n(a.getByPlaceholderText("test")).toBeInTheDocument();
18
+ }), o("renders error message", () => {
19
+ r(/* @__PURE__ */ s(t, {
20
+ error: "Required",
21
+ id: "test",
22
+ children: /* @__PURE__ */ s("input", {})
23
+ })), n(a.getByText("Required")).toBeInTheDocument();
24
+ }), o("renders helper text when no error", () => {
25
+ r(/* @__PURE__ */ s(t, {
26
+ helperText: "Helpful info",
27
+ id: "test",
28
+ children: /* @__PURE__ */ s("input", {})
29
+ })), n(a.getByText("Helpful info")).toBeInTheDocument();
30
+ }), o("applies error class when error exists", () => {
31
+ r(/* @__PURE__ */ s(t, {
32
+ error: "Error",
33
+ id: "test",
34
+ children: /* @__PURE__ */ s("input", { "data-testid": "input" })
35
+ }));
36
+ let i = a.getByTestId("input").parentElement;
37
+ n(i).toHaveClass(e["control--error"]);
38
+ });
39
+ });
40
+ //#endregion
@@ -0,0 +1,11 @@
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;
8
+ size?: "sm" | "md" | "lg";
9
+ className?: string;
10
+ }
11
+ export declare const Input: ({ id, value, onChange, placeholder, type, disabled, size, className, }: InputProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { t as e } from "../../input-q5h2lA4L.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-VBlCurUV.js";
2
+ export { e as InputWithAction };
@@ -0,0 +1,9 @@
1
+ import { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { InputWithAction } from './inputWithAction';
3
+ declare const meta: Meta<typeof InputWithAction>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const SingleAction: Story;
7
+ export declare const WithFormField: Story;
8
+ export declare const Confirmation: Story;
9
+ export declare const LoadingAction: Story;
@@ -0,0 +1,83 @@
1
+ import { t as e } from "../../button-DTU9l2Gg.js";
2
+ import "../../spinner-Co2caOhH.js";
3
+ import { t } from "../../inputWithAction-VBlCurUV.js";
4
+ import { t as n } from "../../input-q5h2lA4L.js";
5
+ import { t as r } from "../../formField-BdRLOA0x.js";
6
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
7
+ import { useState as o } from "react";
8
+ //#region src/components/inputWithActions/inputWithAction.stories.tsx
9
+ var s = {
10
+ title: "Components/inputWithAction",
11
+ component: t,
12
+ parameters: { layout: "centered" },
13
+ tags: ["autodocs"]
14
+ }, c = { render: () => {
15
+ let [r, s] = o("");
16
+ return /* @__PURE__ */ a(t, { children: [/* @__PURE__ */ i(n, {
17
+ value: r,
18
+ onChange: s,
19
+ placeholder: "Search...",
20
+ id: "single-action-input"
21
+ }), /* @__PURE__ */ i(e, {
22
+ onClick: () => alert(r),
23
+ children: "Search"
24
+ })] });
25
+ } }, l = { render: () => {
26
+ let [s, c] = o(""), [l, u] = o("");
27
+ return /* @__PURE__ */ i(r, {
28
+ label: "Search",
29
+ error: l,
30
+ id: "with-form-field-input",
31
+ children: /* @__PURE__ */ a(t, { children: [/* @__PURE__ */ i(n, {
32
+ value: s,
33
+ onChange: c,
34
+ id: "with-form-field-input"
35
+ }), /* @__PURE__ */ i(e, {
36
+ onClick: () => {
37
+ u(s ? "" : "Field is required");
38
+ },
39
+ children: "Search"
40
+ })] })
41
+ });
42
+ } }, u = { render: () => {
43
+ let [s, c] = o(""), [l, u] = o("");
44
+ return /* @__PURE__ */ i(r, {
45
+ label: "Type DELETE to confirm",
46
+ error: l,
47
+ id: "confirmation-input",
48
+ children: /* @__PURE__ */ a(t, { children: [
49
+ /* @__PURE__ */ i(n, {
50
+ value: s,
51
+ onChange: c,
52
+ id: "confirmation-input"
53
+ }),
54
+ /* @__PURE__ */ i(e, {
55
+ variant: "secondary",
56
+ onClick: () => c(""),
57
+ children: "Cancel"
58
+ }),
59
+ /* @__PURE__ */ i(e, {
60
+ variant: "danger",
61
+ onClick: () => {
62
+ u(s === "DELETE" ? "" : "You must type DELETE");
63
+ },
64
+ children: "Delete"
65
+ })
66
+ ] })
67
+ });
68
+ } }, d = { render: () => {
69
+ let [r, s] = o(""), [c, l] = o(!1);
70
+ return /* @__PURE__ */ a(t, { children: [/* @__PURE__ */ i(n, {
71
+ value: r,
72
+ onChange: s,
73
+ id: "loading-action-input"
74
+ }), /* @__PURE__ */ i(e, {
75
+ isLoading: c,
76
+ onClick: async () => {
77
+ l(!0), await new Promise((e) => setTimeout(e, 1e3)), l(!1);
78
+ },
79
+ children: "Submit"
80
+ })] });
81
+ } };
82
+ //#endregion
83
+ export { u as Confirmation, d as LoadingAction, c as SingleAction, l as WithFormField, s as default };
@@ -0,0 +1,9 @@
1
+ import "../../lib-JrI87syO.js";
2
+ import { t as e } from "../../inputWithAction-VBlCurUV.js";
3
+ import { i as t, n, r, s as i } from "../../react.esm-CQZuoo0_.js";
4
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
+ //#region src/components/inputWithActions/inputWithAction.test.tsx
6
+ i("renders children", () => {
7
+ n(/* @__PURE__ */ o(e, { children: [/* @__PURE__ */ a("input", {}), /* @__PURE__ */ a("button", { children: "Click" })] })), t(r.getByRole("button")).toBeInTheDocument();
8
+ });
9
+ //#endregion
@@ -0,0 +1,16 @@
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
+ onNumberClick: (value: string) => void;
9
+ onOperationClick: (label: string) => void;
10
+ onClear: () => void;
11
+ onDecimalClick: () => void;
12
+ onEqualsClick: () => void;
13
+ onBackspaceClick: () => void;
14
+ };
15
+ export declare const Keypad: ({ onNumberClick, onClear, onOperationClick, onDecimalClick, onEqualsClick, onBackspaceClick, }: KeypadProps) => import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1,4 @@
1
+ import "../../button-DTU9l2Gg.js";
2
+ import "../../spinner-Co2caOhH.js";
3
+ import { t as e } from "../../keypad-Bu5TjaRH.js";
4
+ export { e as Keypad };
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { Keypad } from './keypad';
3
+ declare const meta: Meta<typeof Keypad>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Keypad>;
6
+ export declare const Default: Story;
@@ -0,0 +1,17 @@
1
+ import "../../button-DTU9l2Gg.js";
2
+ import "../../spinner-Co2caOhH.js";
3
+ import { t as e } from "../../keypad-Bu5TjaRH.js";
4
+ //#region src/components/keypad/keypad.stories.tsx
5
+ var t = {
6
+ title: "Components/Keypad",
7
+ component: e
8
+ }, n = { args: {
9
+ onNumberClick: (e) => console.log("number:", e),
10
+ onClear: () => console.log("clear"),
11
+ onOperationClick: (e) => console.log("operation:", e),
12
+ onDecimalClick: () => console.log("decimal"),
13
+ onEqualsClick: () => console.log("equals"),
14
+ onBackspaceClick: () => console.log("backspace")
15
+ } };
16
+ //#endregion
17
+ export { n as Default, t as default };
@@ -0,0 +1 @@
1
+ export {};