@ladder-ui/input 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.
Potentially problematic release.
This version of @ladder-ui/input might be problematic. Click here for more details.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +29 -0
- package/dist/index.mjs +24 -0
- package/dist/input.css +109 -0
- package/dist/input.d.ts +39 -0
- package/dist/input.vars.css +18 -0
- package/package.json +67 -0
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var concatClassNames = require('@ladder-ui/core/concatClassNames');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Input — a fully accessible, themeable text input.
|
|
10
|
+
*
|
|
11
|
+
* - Renders a single native `<input>` element with no wrapper.
|
|
12
|
+
* - Border, background, and focus ring are applied directly via `:focus-visible`.
|
|
13
|
+
* - `ref` is forwarded to the native `<input>` element (React 19 pattern).
|
|
14
|
+
* - `className` applies to the `<input>` itself.
|
|
15
|
+
* - `status="error"` automatically sets `aria-invalid="true"`.
|
|
16
|
+
* - Works with all standard HTML input types: text, email, password, number, search, tel,
|
|
17
|
+
* url, file, date, and more.
|
|
18
|
+
* - For icon decoration or button addons, use `InputGroup` from `@ladder-ui/input-group`.
|
|
19
|
+
*/
|
|
20
|
+
function Input({ ref, className, size = "md", status = "default", fullWidth = true, disabled, readOnly, ...props }) {
|
|
21
|
+
// Respect explicit aria-invalid from consumer; auto-set on error status.
|
|
22
|
+
const ariaInvalid = props["aria-invalid"] ?? (status === "error" ? true : undefined);
|
|
23
|
+
const inputClasses = concatClassNames("lui-input", `lui-input--${size}`, status !== "default" && `lui-input--${status}`, fullWidth && "lui-input--full-width", disabled && "lui-input--disabled", readOnly && "lui-input--readonly", className);
|
|
24
|
+
return (jsxRuntime.jsx("input", { ref: ref, className: inputClasses, disabled: disabled, readOnly: readOnly, "aria-invalid": ariaInvalid, ...props }));
|
|
25
|
+
}
|
|
26
|
+
Input.displayName = "Input";
|
|
27
|
+
|
|
28
|
+
exports.Input = Input;
|
|
29
|
+
exports.default = Input;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import concatClassNames from '@ladder-ui/core/concatClassNames';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Input — a fully accessible, themeable text input.
|
|
6
|
+
*
|
|
7
|
+
* - Renders a single native `<input>` element with no wrapper.
|
|
8
|
+
* - Border, background, and focus ring are applied directly via `:focus-visible`.
|
|
9
|
+
* - `ref` is forwarded to the native `<input>` element (React 19 pattern).
|
|
10
|
+
* - `className` applies to the `<input>` itself.
|
|
11
|
+
* - `status="error"` automatically sets `aria-invalid="true"`.
|
|
12
|
+
* - Works with all standard HTML input types: text, email, password, number, search, tel,
|
|
13
|
+
* url, file, date, and more.
|
|
14
|
+
* - For icon decoration or button addons, use `InputGroup` from `@ladder-ui/input-group`.
|
|
15
|
+
*/
|
|
16
|
+
function Input({ ref, className, size = "md", status = "default", fullWidth = true, disabled, readOnly, ...props }) {
|
|
17
|
+
// Respect explicit aria-invalid from consumer; auto-set on error status.
|
|
18
|
+
const ariaInvalid = props["aria-invalid"] ?? (status === "error" ? true : undefined);
|
|
19
|
+
const inputClasses = concatClassNames("lui-input", `lui-input--${size}`, status !== "default" && `lui-input--${status}`, fullWidth && "lui-input--full-width", disabled && "lui-input--disabled", readOnly && "lui-input--readonly", className);
|
|
20
|
+
return (jsx("input", { ref: ref, className: inputClasses, disabled: disabled, readOnly: readOnly, "aria-invalid": ariaInvalid, ...props }));
|
|
21
|
+
}
|
|
22
|
+
Input.displayName = "Input";
|
|
23
|
+
|
|
24
|
+
export { Input, Input as default };
|
package/dist/input.css
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
.lui-input {
|
|
2
|
+
display: block;
|
|
3
|
+
background-color: var(--lui-input-bg);
|
|
4
|
+
border: var(--lui-border-width) solid var(--lui-input-border);
|
|
5
|
+
border-radius: var(--lui-input-radius);
|
|
6
|
+
color: var(--lui-input-text);
|
|
7
|
+
font-family: var(--lui-font-family);
|
|
8
|
+
font-weight: var(--lui-font-weight);
|
|
9
|
+
line-height: 1.5;
|
|
10
|
+
min-width: 0;
|
|
11
|
+
transition: var(--lui-transition);
|
|
12
|
+
}
|
|
13
|
+
.lui-input:focus-visible {
|
|
14
|
+
outline: none;
|
|
15
|
+
border-color: var(--lui-input-focus-border);
|
|
16
|
+
box-shadow: 0 0 0 2px var(--lui-input-focus-ring-color);
|
|
17
|
+
}
|
|
18
|
+
.lui-input::placeholder {
|
|
19
|
+
color: var(--lui-input-placeholder);
|
|
20
|
+
}
|
|
21
|
+
.lui-input--disabled, .lui-input:disabled {
|
|
22
|
+
opacity: var(--lui-disabled-opacity);
|
|
23
|
+
cursor: not-allowed;
|
|
24
|
+
}
|
|
25
|
+
.lui-input--readonly {
|
|
26
|
+
cursor: default;
|
|
27
|
+
}
|
|
28
|
+
.lui-input--full-width {
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.lui-input--error {
|
|
33
|
+
border-color: var(--lui-error);
|
|
34
|
+
}
|
|
35
|
+
.lui-input--error:focus-visible {
|
|
36
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--lui-error) 40%, transparent);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.lui-input--success {
|
|
40
|
+
border-color: var(--lui-success);
|
|
41
|
+
}
|
|
42
|
+
.lui-input--success:focus-visible {
|
|
43
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--lui-success) 40%, transparent);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.lui-input--warning {
|
|
47
|
+
border-color: var(--lui-warning);
|
|
48
|
+
}
|
|
49
|
+
.lui-input--warning:focus-visible {
|
|
50
|
+
box-shadow: 0 0 0 2px color-mix(in srgb, var(--lui-warning) 40%, transparent);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.lui-input--xs {
|
|
54
|
+
padding: 0.25rem 0.5rem;
|
|
55
|
+
font-size: var(--lui-font-size-xs);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.lui-input--sm {
|
|
59
|
+
padding: 0.375rem 0.625rem;
|
|
60
|
+
font-size: var(--lui-font-size-sm);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.lui-input--md {
|
|
64
|
+
padding: 0.5rem 0.75rem;
|
|
65
|
+
font-size: var(--lui-font-size-md);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.lui-input--lg {
|
|
69
|
+
padding: 0.625rem 0.875rem;
|
|
70
|
+
font-size: var(--lui-font-size-lg);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.lui-input--xl {
|
|
74
|
+
padding: 0.75rem 1rem;
|
|
75
|
+
font-size: var(--lui-font-size-xl);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.lui-input[type=file] {
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
}
|
|
81
|
+
.lui-input[type=file]::file-selector-button {
|
|
82
|
+
font-family: var(--lui-font-family);
|
|
83
|
+
font-size: inherit;
|
|
84
|
+
font-weight: 500;
|
|
85
|
+
background: transparent;
|
|
86
|
+
color: var(--lui-surface-text);
|
|
87
|
+
border: none;
|
|
88
|
+
border-right: var(--lui-border-width) solid var(--lui-input-file-btn-border);
|
|
89
|
+
padding: 0 0.75em 0 0;
|
|
90
|
+
margin-right: 0.75em;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
transition: var(--lui-transition);
|
|
93
|
+
}
|
|
94
|
+
.lui-input[type=file]::file-selector-button:hover {
|
|
95
|
+
color: var(--lui-primary);
|
|
96
|
+
}
|
|
97
|
+
.lui-input[type=search]::-webkit-search-decoration, .lui-input[type=search]::-webkit-search-cancel-button, .lui-input[type=search]::-webkit-search-results-button, .lui-input[type=search]::-webkit-search-results-decoration {
|
|
98
|
+
-webkit-appearance: none;
|
|
99
|
+
}
|
|
100
|
+
.lui-input[type=number] {
|
|
101
|
+
-moz-appearance: textfield;
|
|
102
|
+
}
|
|
103
|
+
.lui-input[type=number]::-webkit-inner-spin-button, .lui-input[type=number]::-webkit-outer-spin-button {
|
|
104
|
+
-webkit-appearance: none;
|
|
105
|
+
margin: 0;
|
|
106
|
+
}
|
|
107
|
+
.lui-input[type=date], .lui-input[type=time], .lui-input[type=datetime-local], .lui-input[type=month], .lui-input[type=week] {
|
|
108
|
+
color-scheme: light dark;
|
|
109
|
+
}
|
package/dist/input.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Ref } from "react";
|
|
2
|
+
export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
3
|
+
/** React 19 ref — points to the native <input> element */
|
|
4
|
+
ref?: Ref<HTMLInputElement>;
|
|
5
|
+
/** Size variant. Follows the same scale as Button. @default "md" */
|
|
6
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
7
|
+
/**
|
|
8
|
+
* Visual status. Sets border color and focus ring.
|
|
9
|
+
* "error" also sets aria-invalid="true" on the native input.
|
|
10
|
+
* @default "default"
|
|
11
|
+
*/
|
|
12
|
+
status?: "default" | "error" | "success" | "warning";
|
|
13
|
+
/**
|
|
14
|
+
* Stretch the input to fill its container's full width.
|
|
15
|
+
* @default true
|
|
16
|
+
*/
|
|
17
|
+
fullWidth?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* className is applied directly to the <input> element.
|
|
20
|
+
* Use this to control width, margin, or layout of the input.
|
|
21
|
+
*/
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Input — a fully accessible, themeable text input.
|
|
26
|
+
*
|
|
27
|
+
* - Renders a single native `<input>` element with no wrapper.
|
|
28
|
+
* - Border, background, and focus ring are applied directly via `:focus-visible`.
|
|
29
|
+
* - `ref` is forwarded to the native `<input>` element (React 19 pattern).
|
|
30
|
+
* - `className` applies to the `<input>` itself.
|
|
31
|
+
* - `status="error"` automatically sets `aria-invalid="true"`.
|
|
32
|
+
* - Works with all standard HTML input types: text, email, password, number, search, tel,
|
|
33
|
+
* url, file, date, and more.
|
|
34
|
+
* - For icon decoration or button addons, use `InputGroup` from `@ladder-ui/input-group`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function Input({ ref, className, size, status, fullWidth, disabled, readOnly, ...props }: InputProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export declare namespace Input {
|
|
38
|
+
var displayName: string;
|
|
39
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@layer input {
|
|
2
|
+
:root {
|
|
3
|
+
/* Background & text */
|
|
4
|
+
--lui-input-bg: var(--lui-surface);
|
|
5
|
+
--lui-input-text: var(--lui-surface-text);
|
|
6
|
+
--lui-input-placeholder: color-mix(in srgb, var(--lui-surface-text) 40%, transparent);
|
|
7
|
+
/* Border */
|
|
8
|
+
--lui-input-border: color-mix(in srgb, var(--lui-surface-border) 93%, var(--lui-surface-text));
|
|
9
|
+
--lui-input-focus-border: var(--lui-primary);
|
|
10
|
+
--lui-input-focus-ring-color: color-mix(in srgb, var(--lui-primary) 40%, transparent);
|
|
11
|
+
/* Icon color */
|
|
12
|
+
--lui-input-icon-color: color-mix(in srgb, var(--lui-surface-text) 50%, transparent);
|
|
13
|
+
/* Shape */
|
|
14
|
+
--lui-input-radius: var(--lui-radius-sm);
|
|
15
|
+
/* File selector button */
|
|
16
|
+
--lui-input-file-btn-border: var(--lui-surface-border);
|
|
17
|
+
}
|
|
18
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ladder-ui/input",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"require": "./dist/index.js",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./*.css": "./dist/*.css",
|
|
15
|
+
"./styles/*.css": "./dist/*.css"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"nodejs",
|
|
22
|
+
"react",
|
|
23
|
+
"ui",
|
|
24
|
+
"components",
|
|
25
|
+
"library",
|
|
26
|
+
"input",
|
|
27
|
+
"form"
|
|
28
|
+
],
|
|
29
|
+
"author": "Ivan Avila <ivelaval@gmail.com> - https://www.vennet.dev",
|
|
30
|
+
"license": "ISC",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+ssh://git@github.com/ivelaval/ladder-ui.git"
|
|
34
|
+
},
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/ivelaval/ladder-ui/issues"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://github.com/ivelaval/ladder-ui#readme",
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
44
|
+
"@types/react": "^19.0.0",
|
|
45
|
+
"rollup": "^4.59.0",
|
|
46
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
47
|
+
"sass": "^1.90.0",
|
|
48
|
+
"tslib": "^2.6.2",
|
|
49
|
+
"typescript": "^5.3.3",
|
|
50
|
+
"@ladder-ui/core": "0.0.3"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"@ladder-ui/core": ">=0.0.0",
|
|
54
|
+
"react": ">=18.0.0"
|
|
55
|
+
},
|
|
56
|
+
"sideEffects": [
|
|
57
|
+
"**/*.css"
|
|
58
|
+
],
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "pnpm clean && rollup -c",
|
|
61
|
+
"dev": "rollup -c -w",
|
|
62
|
+
"test": "vitest run",
|
|
63
|
+
"test:watch": "vitest",
|
|
64
|
+
"type-check": "tsc --noEmit",
|
|
65
|
+
"clean": "rm -rf dist"
|
|
66
|
+
}
|
|
67
|
+
}
|