@greghowe79/the-lib 0.4.8 → 0.5.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.
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("@builder.io/qwik/jsx-runtime");
4
+ const qwik = require("@builder.io/qwik");
5
+ const styles = require("./styles.css.qwik.cjs");
6
+ require("@fontsource/roboto-condensed/500.css");
7
+ const Input = qwik.component$(({ id, type, placeholder, value, error, onValidate$ }) => {
8
+ qwik.useStylesScoped$(styles);
9
+ const internalError = qwik.useSignal(null);
10
+ const showError = error ?? internalError;
11
+ const inputHandler = qwik.$(async (_, elem) => {
12
+ if (onValidate$) {
13
+ const result = await onValidate$(elem.value);
14
+ if (!error) internalError.value = result;
15
+ }
16
+ });
17
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", {
18
+ class: "input-container",
19
+ children: [
20
+ /* @__PURE__ */ jsxRuntime.jsx("label", {
21
+ class: "input-label",
22
+ children: /* @__PURE__ */ jsxRuntime.jsx("input", {
23
+ id,
24
+ type,
25
+ class: `input ${showError.value ? "error" : ""}`,
26
+ placeholder,
27
+ "bind:value": value,
28
+ onInput$: inputHandler,
29
+ onBlur$: inputHandler,
30
+ required: true
31
+ })
32
+ }),
33
+ showError.value && /* @__PURE__ */ jsxRuntime.jsx("div", {
34
+ class: "error-message",
35
+ children: showError.value
36
+ })
37
+ ]
38
+ });
39
+ });
40
+ exports.Input = Input;
@@ -0,0 +1,40 @@
1
+ import { jsxs, jsx } from "@builder.io/qwik/jsx-runtime";
2
+ import { component$, useStylesScoped$, useSignal, $ } from "@builder.io/qwik";
3
+ import styles from "./styles.css.qwik.mjs";
4
+ import "@fontsource/roboto-condensed/500.css";
5
+ const Input = component$(({ id, type, placeholder, value, error, onValidate$ }) => {
6
+ useStylesScoped$(styles);
7
+ const internalError = useSignal(null);
8
+ const showError = error ?? internalError;
9
+ const inputHandler = $(async (_, elem) => {
10
+ if (onValidate$) {
11
+ const result = await onValidate$(elem.value);
12
+ if (!error) internalError.value = result;
13
+ }
14
+ });
15
+ return /* @__PURE__ */ jsxs("div", {
16
+ class: "input-container",
17
+ children: [
18
+ /* @__PURE__ */ jsx("label", {
19
+ class: "input-label",
20
+ children: /* @__PURE__ */ jsx("input", {
21
+ id,
22
+ type,
23
+ class: `input ${showError.value ? "error" : ""}`,
24
+ placeholder,
25
+ "bind:value": value,
26
+ onInput$: inputHandler,
27
+ onBlur$: inputHandler,
28
+ required: true
29
+ })
30
+ }),
31
+ showError.value && /* @__PURE__ */ jsx("div", {
32
+ class: "error-message",
33
+ children: showError.value
34
+ })
35
+ ]
36
+ });
37
+ });
38
+ export {
39
+ Input
40
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ const styles = ".input-label:not([type='checkbox']) {\r\n border-radius: 8px;\r\n font-size: 13px;\r\n line-height: 1.85;\r\n letter-spacing: 1px;\r\n color: #333;\r\n position: relative;\r\n height: 50px;\r\n display: flex;\r\n min-width: 0;\r\n background: rgba(0, 0, 0, 0.04);\r\n transition:\r\n color 0.3s ease,\r\n box-shadow 0.3s ease,\r\n background 0.3s ease;\r\n}\r\n\r\n.input {\r\n background: transparent;\r\n padding: 0 15px;\r\n flex: 1;\r\n font-size: 16px;\r\n font-family: 'Roboto Condensed', sans-serif;\r\n font-weight: 100;\r\n letter-spacing: inherit;\r\n color: inherit;\r\n height: 100%;\r\n border: none;\r\n -webkit-appearance: none;\r\n -moz-appearance: none;\r\n appearance: none;\r\n white-space: nowrap;\r\n text-overflow: ellipsis;\r\n overflow: hidden;\r\n opacity: 0.4;\r\n}\r\n\r\n.input:focus {\r\n outline: none;\r\n opacity: 1;\r\n}\r\n\r\n.error-message {\r\n color: #e74c3c;\r\n font-size: 0.875rem;\r\n margin-top: 0.25rem;\r\n font-size: 16px;\r\n font-family: 'Roboto Condensed', sans-serif;\r\n}\r\n";
3
+ module.exports = styles;
@@ -0,0 +1,4 @@
1
+ const styles = ".input-label:not([type='checkbox']) {\r\n border-radius: 8px;\r\n font-size: 13px;\r\n line-height: 1.85;\r\n letter-spacing: 1px;\r\n color: #333;\r\n position: relative;\r\n height: 50px;\r\n display: flex;\r\n min-width: 0;\r\n background: rgba(0, 0, 0, 0.04);\r\n transition:\r\n color 0.3s ease,\r\n box-shadow 0.3s ease,\r\n background 0.3s ease;\r\n}\r\n\r\n.input {\r\n background: transparent;\r\n padding: 0 15px;\r\n flex: 1;\r\n font-size: 16px;\r\n font-family: 'Roboto Condensed', sans-serif;\r\n font-weight: 100;\r\n letter-spacing: inherit;\r\n color: inherit;\r\n height: 100%;\r\n border: none;\r\n -webkit-appearance: none;\r\n -moz-appearance: none;\r\n appearance: none;\r\n white-space: nowrap;\r\n text-overflow: ellipsis;\r\n overflow: hidden;\r\n opacity: 0.4;\r\n}\r\n\r\n.input:focus {\r\n outline: none;\r\n opacity: 1;\r\n}\r\n\r\n.error-message {\r\n color: #e74c3c;\r\n font-size: 0.875rem;\r\n margin-top: 0.25rem;\r\n font-size: 16px;\r\n font-family: 'Roboto Condensed', sans-serif;\r\n}\r\n";
2
+ export {
3
+ styles as default
4
+ };
@@ -53,7 +53,7 @@ const Modal = qwik.component$(({ title, open, primaryButtonLabel, secondaryButto
53
53
  id: "confirm-button",
54
54
  label: primaryButtonLabel,
55
55
  onClick$: primaryAction,
56
- isLoading: isLoading?.value
56
+ isLoading
57
57
  })
58
58
  ]
59
59
  })
@@ -51,7 +51,7 @@ const Modal = component$(({ title, open, primaryButtonLabel, secondaryButtonLabe
51
51
  id: "confirm-button",
52
52
  label: primaryButtonLabel,
53
53
  onClick$: primaryAction,
54
- isLoading: isLoading?.value
54
+ isLoading
55
55
  })
56
56
  ]
57
57
  })
@@ -6,9 +6,11 @@ const button = require("./components/button/button.qwik.cjs");
6
6
  const NavigationMenu = require("./components/navigationmenu/NavigationMenu.qwik.cjs");
7
7
  const modal = require("./components/modal/modal.qwik.cjs");
8
8
  const loader = require("./components/loader/loader.qwik.cjs");
9
+ const input = require("./components/input/input.qwik.cjs");
9
10
  exports.Logo = logo.Logo;
10
11
  exports.Counter = counter.Counter;
11
12
  exports.Button = button.Button;
12
13
  exports.NavigationMenu = NavigationMenu.NavigationMenu;
13
14
  exports.Modal = modal.Modal;
14
15
  exports.Loader = loader.Loader;
16
+ exports.Input = input.Input;
@@ -4,9 +4,11 @@ import { Button } from "./components/button/button.qwik.mjs";
4
4
  import { NavigationMenu } from "./components/navigationmenu/NavigationMenu.qwik.mjs";
5
5
  import { Modal } from "./components/modal/modal.qwik.mjs";
6
6
  import { Loader } from "./components/loader/loader.qwik.mjs";
7
+ import { Input } from "./components/input/input.qwik.mjs";
7
8
  export {
8
9
  Button,
9
10
  Counter,
11
+ Input,
10
12
  Loader,
11
13
  Logo,
12
14
  Modal,
@@ -0,0 +1,12 @@
1
+ import { QRL, Signal } from '@builder.io/qwik';
2
+ import '@fontsource/roboto-condensed/500.css';
3
+ export type InputType = 'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | 'search' | 'hidden' | 'checkbox' | 'radio' | 'file';
4
+ export interface InputProps {
5
+ id: string;
6
+ type: InputType;
7
+ placeholder?: string;
8
+ value: Signal<string>;
9
+ error?: Signal<string | null>;
10
+ onValidate$?: QRL<(value: string) => string | null>;
11
+ }
12
+ export declare const Input: import("@builder.io/qwik").Component<InputProps>;
@@ -4,3 +4,4 @@ export { Button } from './components/button/button';
4
4
  export { NavigationMenu } from './components/navigationmenu/NavigationMenu';
5
5
  export { Modal } from './components/modal/modal';
6
6
  export { Loader } from './components/loader/loader';
7
+ export { Input } from './components/input/input';
@@ -0,0 +1,6 @@
1
+ import type { Meta, StoryObj } from 'storybook-framework-qwik';
2
+ import { type InputProps } from '../components/input/input';
3
+ declare const meta: Meta<InputProps>;
4
+ export default meta;
5
+ type Story = StoryObj<InputProps>;
6
+ export declare const Email: Story;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greghowe79/the-lib",
3
- "version": "0.4.8",
3
+ "version": "0.5.0",
4
4
  "description": "Collection of fast components for Qwik",
5
5
  "main": "./lib/index.qwik.mjs",
6
6
  "qwik": "./lib/index.qwik.mjs",