@behivetech/atoms.text-field 0.0.0-stage → 0.3.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.
package/README.md CHANGED
@@ -1,3 +1,28 @@
1
- # Temporary Holding Version
1
+ # TextField
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A bare text input — the native `<input>` is this component's own root element. It has no built-in label/hint/error; wrap it in `FormField` for that chrome. Works standalone too — not every input needs the full form suite.
4
+
5
+ ## Usage
6
+
7
+ ```jsx
8
+ import { TextField } from '@behivetech/atoms.text-field';
9
+ import { FormField } from '@behivetech/forms.form-field';
10
+
11
+ const [value, setValue] = useState('');
12
+
13
+ <TextField value={value} onChange={(e) => setValue(e.target.value)} />
14
+
15
+ <FormField label="Email" htmlFor="email" hint="We'll never share this">
16
+ <TextField id="email" type="email" />
17
+ </FormField>
18
+ ```
19
+
20
+ Pass `aria-invalid="true"` to visually mark the field as invalid (pair with `FormField`'s `error` prop for the message).
21
+
22
+ ## Props
23
+
24
+ Extends the native `<input>` element's attributes (minus `size`, which conflicts with a future sizing prop) with:
25
+
26
+ | Prop | Type | Default | Description |
27
+ | ----------- | -------- | ------- | ---------------------- |
28
+ | `className` | `string` | — | Additional class names |
package/dist/index.cjs ADDED
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+
33
+ // ../../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js
34
+ var require_classnames = __commonJS({
35
+ "../../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js"(exports2, module2) {
36
+ "use strict";
37
+ (function() {
38
+ "use strict";
39
+ var hasOwn = {}.hasOwnProperty;
40
+ function classNames() {
41
+ var classes = "";
42
+ for (var i = 0; i < arguments.length; i++) {
43
+ var arg = arguments[i];
44
+ if (arg) {
45
+ classes = appendClass(classes, parseValue(arg));
46
+ }
47
+ }
48
+ return classes;
49
+ }
50
+ function parseValue(arg) {
51
+ if (typeof arg === "string" || typeof arg === "number") {
52
+ return arg;
53
+ }
54
+ if (typeof arg !== "object") {
55
+ return "";
56
+ }
57
+ if (Array.isArray(arg)) {
58
+ return classNames.apply(null, arg);
59
+ }
60
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
61
+ return arg.toString();
62
+ }
63
+ var classes = "";
64
+ for (var key in arg) {
65
+ if (hasOwn.call(arg, key) && arg[key]) {
66
+ classes = appendClass(classes, key);
67
+ }
68
+ }
69
+ return classes;
70
+ }
71
+ function appendClass(value, newClass) {
72
+ if (!newClass) {
73
+ return value;
74
+ }
75
+ if (value) {
76
+ return value + " " + newClass;
77
+ }
78
+ return value + newClass;
79
+ }
80
+ if (typeof module2 !== "undefined" && module2.exports) {
81
+ classNames.default = classNames;
82
+ module2.exports = classNames;
83
+ } else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
84
+ define("classnames", [], function() {
85
+ return classNames;
86
+ });
87
+ } else {
88
+ window.classNames = classNames;
89
+ }
90
+ })();
91
+ }
92
+ });
93
+
94
+ // index.ts
95
+ var index_exports = {};
96
+ __export(index_exports, {
97
+ TextField: () => TextField
98
+ });
99
+ module.exports = __toCommonJS(index_exports);
100
+
101
+ // text-field.tsx
102
+ var import_react = require("react");
103
+
104
+ // ../../../../packages/registry/class-names/dist/index.js
105
+ var import_classnames = __toESM(require_classnames(), 1);
106
+ var getClassName = ({
107
+ className,
108
+ modifiers = {},
109
+ rootClass,
110
+ styles = {}
111
+ }) => {
112
+ function getModifiers() {
113
+ const updatedModifiers = {};
114
+ const modifierKeys = Object.keys(modifiers);
115
+ if (modifierKeys.length) {
116
+ modifierKeys.forEach((modKey) => {
117
+ const classKey = `${rootClass}--${modKey}`;
118
+ const newClassName = styles[classKey] || classKey;
119
+ updatedModifiers[newClassName] = modifiers[modKey] ?? false;
120
+ });
121
+ }
122
+ return updatedModifiers;
123
+ }
124
+ function getChildClass(childClassName) {
125
+ const classKey = `${rootClass}__${childClassName}`;
126
+ return styles[classKey] || classKey;
127
+ }
128
+ function getRootStyles() {
129
+ return (0, import_classnames.default)(
130
+ className,
131
+ {
132
+ ...getModifiers()
133
+ },
134
+ styles[rootClass] || rootClass
135
+ );
136
+ }
137
+ return [getRootStyles(), getChildClass];
138
+ };
139
+
140
+ // text-field.module.scss
141
+ var text_field_module_default = {
142
+ "BHT__TextField": "BHT__TextField"
143
+ };
144
+
145
+ // text-field.tsx
146
+ var import_jsx_runtime = require("react/jsx-runtime");
147
+ var TextField = ({ className, id, ...rest }) => {
148
+ const generatedId = (0, import_react.useId)();
149
+ const fieldId = id ?? generatedId;
150
+ const [rootClass] = getClassName({
151
+ className,
152
+ rootClass: "BHT__TextField",
153
+ styles: text_field_module_default
154
+ });
155
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { ...rest, id: fieldId, className: rootClass });
156
+ };
157
+ // Annotate the CommonJS export names for ESM import in node:
158
+ 0 && (module.exports = {
159
+ TextField
160
+ });
161
+ /*! Bundled license information:
162
+
163
+ classnames/index.js:
164
+ (*!
165
+ Copyright (c) 2018 Jed Watson.
166
+ Licensed under the MIT License (MIT), see
167
+ http://jedwatson.github.io/classnames
168
+ *)
169
+ */
package/dist/index.css ADDED
@@ -0,0 +1,43 @@
1
+ /* esbuild-sass-plugin:css-chunktext-field.module.scss */
2
+ .BHT__TextField {
3
+ width: 100%;
4
+ padding: var(--spacing-2, 0.5rem) var(--spacing-3, 0.75rem);
5
+ font-family: var(--md-sys-typescale-body-large-font, var(--font-body));
6
+ font-size: var(--md-sys-typescale-body-large-size, 1rem);
7
+ font-weight: var(--md-sys-typescale-body-large-weight, 400);
8
+ line-height: var(--md-sys-typescale-body-large-line-height, 1.5rem);
9
+ letter-spacing: var(--md-sys-typescale-body-large-tracking, 0.0313em);
10
+ color: var(--md-sys-color-on-surface, var(--color-on-surface));
11
+ caret-color: var(--md-sys-color-primary, var(--color-primary));
12
+ background: transparent;
13
+ border: 1px solid var(--md-sys-color-outline, var(--color-border-strong));
14
+ border-radius: var(--md-sys-shape-corner-extra-small, 4px);
15
+ transition: border-color var(--md-sys-motion-duration-short-3, 150ms) var(--md-sys-motion-easing-standard, ease), box-shadow var(--md-sys-motion-duration-short-3, 150ms) var(--md-sys-motion-easing-standard, ease);
16
+ outline: none;
17
+ min-height: 2.5rem;
18
+ }
19
+ .BHT__TextField::placeholder {
20
+ color: var(--md-sys-color-on-surface-variant, var(--color-text-muted));
21
+ }
22
+ .BHT__TextField:hover:not(:disabled, :focus) {
23
+ border-color: var(--md-sys-color-on-surface, var(--color-on-surface));
24
+ }
25
+ .BHT__TextField:focus {
26
+ border-color: var(--md-sys-color-primary, var(--color-border-focus));
27
+ box-shadow: inset 0 0 0 1px var(--md-sys-color-primary, var(--color-border-focus));
28
+ }
29
+ .BHT__TextField:disabled {
30
+ opacity: 0.45;
31
+ cursor: not-allowed;
32
+ }
33
+ .BHT__TextField[aria-invalid=true] {
34
+ border-color: var(--md-sys-color-error, var(--color-error));
35
+ caret-color: var(--md-sys-color-error, var(--color-error));
36
+ }
37
+ .BHT__TextField[aria-invalid=true]:hover:not(:disabled, :focus) {
38
+ border-color: var(--md-sys-color-on-error-container, var(--color-error));
39
+ }
40
+ .BHT__TextField[aria-invalid=true]:focus {
41
+ border-color: var(--md-sys-color-error, var(--color-error));
42
+ box-shadow: inset 0 0 0 1px var(--md-sys-color-error, var(--color-error));
43
+ }
@@ -0,0 +1,15 @@
1
+ import * as react from 'react';
2
+ import { InputHTMLAttributes } from 'react';
3
+
4
+ interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
5
+ /** Additional class names to merge with the component root element */
6
+ className?: string;
7
+ }
8
+ /**
9
+ * Bare text input — the native `<input>` is this component's own root
10
+ * element, no built-in label/hint/error. Wrap it in `FormField` for that
11
+ * chrome: `<FormField label="..." htmlFor="x"><TextField id="x" /></FormField>`.
12
+ */
13
+ declare const TextField: ({ className, id, ...rest }: TextFieldProps) => react.JSX.Element;
14
+
15
+ export { TextField, type TextFieldProps };
package/dist/index.js ADDED
@@ -0,0 +1,155 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ // ../../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js
28
+ var require_classnames = __commonJS({
29
+ "../../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js"(exports, module) {
30
+ "use strict";
31
+ (function() {
32
+ "use strict";
33
+ var hasOwn = {}.hasOwnProperty;
34
+ function classNames() {
35
+ var classes = "";
36
+ for (var i = 0; i < arguments.length; i++) {
37
+ var arg = arguments[i];
38
+ if (arg) {
39
+ classes = appendClass(classes, parseValue(arg));
40
+ }
41
+ }
42
+ return classes;
43
+ }
44
+ function parseValue(arg) {
45
+ if (typeof arg === "string" || typeof arg === "number") {
46
+ return arg;
47
+ }
48
+ if (typeof arg !== "object") {
49
+ return "";
50
+ }
51
+ if (Array.isArray(arg)) {
52
+ return classNames.apply(null, arg);
53
+ }
54
+ if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
55
+ return arg.toString();
56
+ }
57
+ var classes = "";
58
+ for (var key in arg) {
59
+ if (hasOwn.call(arg, key) && arg[key]) {
60
+ classes = appendClass(classes, key);
61
+ }
62
+ }
63
+ return classes;
64
+ }
65
+ function appendClass(value, newClass) {
66
+ if (!newClass) {
67
+ return value;
68
+ }
69
+ if (value) {
70
+ return value + " " + newClass;
71
+ }
72
+ return value + newClass;
73
+ }
74
+ if (typeof module !== "undefined" && module.exports) {
75
+ classNames.default = classNames;
76
+ module.exports = classNames;
77
+ } else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
78
+ define("classnames", [], function() {
79
+ return classNames;
80
+ });
81
+ } else {
82
+ window.classNames = classNames;
83
+ }
84
+ })();
85
+ }
86
+ });
87
+
88
+ // text-field.tsx
89
+ import { useId } from "react";
90
+
91
+ // ../../../../packages/registry/class-names/dist/index.js
92
+ var import_classnames = __toESM(require_classnames(), 1);
93
+ var getClassName = ({
94
+ className,
95
+ modifiers = {},
96
+ rootClass,
97
+ styles = {}
98
+ }) => {
99
+ function getModifiers() {
100
+ const updatedModifiers = {};
101
+ const modifierKeys = Object.keys(modifiers);
102
+ if (modifierKeys.length) {
103
+ modifierKeys.forEach((modKey) => {
104
+ const classKey = `${rootClass}--${modKey}`;
105
+ const newClassName = styles[classKey] || classKey;
106
+ updatedModifiers[newClassName] = modifiers[modKey] ?? false;
107
+ });
108
+ }
109
+ return updatedModifiers;
110
+ }
111
+ function getChildClass(childClassName) {
112
+ const classKey = `${rootClass}__${childClassName}`;
113
+ return styles[classKey] || classKey;
114
+ }
115
+ function getRootStyles() {
116
+ return (0, import_classnames.default)(
117
+ className,
118
+ {
119
+ ...getModifiers()
120
+ },
121
+ styles[rootClass] || rootClass
122
+ );
123
+ }
124
+ return [getRootStyles(), getChildClass];
125
+ };
126
+
127
+ // text-field.module.scss
128
+ var text_field_module_default = {
129
+ "BHT__TextField": "BHT__TextField"
130
+ };
131
+
132
+ // text-field.tsx
133
+ import { jsx } from "react/jsx-runtime";
134
+ var TextField = ({ className, id, ...rest }) => {
135
+ const generatedId = useId();
136
+ const fieldId = id ?? generatedId;
137
+ const [rootClass] = getClassName({
138
+ className,
139
+ rootClass: "BHT__TextField",
140
+ styles: text_field_module_default
141
+ });
142
+ return /* @__PURE__ */ jsx("input", { ...rest, id: fieldId, className: rootClass });
143
+ };
144
+ export {
145
+ TextField
146
+ };
147
+ /*! Bundled license information:
148
+
149
+ classnames/index.js:
150
+ (*!
151
+ Copyright (c) 2018 Jed Watson.
152
+ Licensed under the MIT License (MIT), see
153
+ http://jedwatson.github.io/classnames
154
+ *)
155
+ */
package/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { TextField } from "./text-field.js";
2
+ export type { TextFieldProps } from "./text-field.js";
package/package.json CHANGED
@@ -1,6 +1,60 @@
1
1
  {
2
2
  "name": "@behivetech/atoms.text-field",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.3.3",
4
+ "license": "MIT",
5
+ "type": "module",
6
+ "private": false,
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.cjs"
12
+ },
13
+ "./styles.css": "./dist/index.css"
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md",
18
+ "index.ts",
19
+ "text-field.tsx",
20
+ "text-field.module.scss",
21
+ "*.example.tsx",
22
+ "docs.json"
23
+ ],
24
+ "registry": {
25
+ "status": "stable",
26
+ "tags": []
27
+ },
28
+ "peerDependencies": {
29
+ "react": "^19.2.7",
30
+ "react-dom": "^19.2.7"
31
+ },
32
+ "devDependencies": {
33
+ "@types/react": "19.2.17",
34
+ "@types/react-dom": "19.2.3",
35
+ "eslint": "^9.39.5",
36
+ "tsup": "^8.5.1",
37
+ "typescript": "^6.0.3",
38
+ "vitest": "^4.1.10",
39
+ "@behivetech/forms.form-field": "0.3.3",
40
+ "@bht-component-registry/class-names": "0.0.6",
41
+ "@bht-component-registry/env": "0.1.0"
42
+ },
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "https://github.com/behivetech/bht-galaxy.git",
46
+ "directory": "registry/behivetech/atoms/text-field"
47
+ },
48
+ "publishConfig": {
49
+ "registry": "https://registry.npmjs.org",
50
+ "access": "public",
51
+ "provenance": true
52
+ },
53
+ "scripts": {
54
+ "build": "tsup && bht-registry-docgen",
55
+ "dev": "tsup --watch",
56
+ "lint": "eslint . --max-warnings 0",
57
+ "check-types": "tsc --noEmit",
58
+ "test": "vitest run"
59
+ }
6
60
  }
@@ -0,0 +1,34 @@
1
+ import { useState } from "react";
2
+ import { FormField } from "@behivetech/forms.form-field";
3
+ import { TextField } from "./text-field.js";
4
+
5
+ export const BasicTextField = () => {
6
+ const [value, setValue] = useState("");
7
+ return (
8
+ <TextField
9
+ value={value}
10
+ onChange={(e) => setValue(e.target.value)}
11
+ placeholder="Type here…"
12
+ />
13
+ );
14
+ };
15
+
16
+ export const TextFieldWithFormField = () => (
17
+ <FormField label="Email" htmlFor="email" hint="We'll never share this">
18
+ <TextField id="email" type="email" placeholder="you@example.com" />
19
+ </FormField>
20
+ );
21
+
22
+ export const TextFieldWithError = () => (
23
+ <FormField
24
+ label="Email"
25
+ htmlFor="email-error"
26
+ error="A valid email is required"
27
+ >
28
+ <TextField id="email-error" type="email" aria-invalid="true" />
29
+ </FormField>
30
+ );
31
+
32
+ export const DisabledTextField = () => (
33
+ <TextField disabled value="Can't touch this" />
34
+ );
@@ -0,0 +1,62 @@
1
+ // Material Design 3 outlined text field (the input only — label and supporting
2
+ // text live in FormField).
3
+ //
4
+ // The 2px focus/error edge is drawn as a 1px inset shadow on top of the 1px
5
+ // border rather than by widening the border, so the text never shifts when the
6
+ // field gains focus.
7
+
8
+ .BHT__TextField {
9
+ width: 100%;
10
+ padding: var(--spacing-2, 0.5rem) var(--spacing-3, 0.75rem);
11
+ font-family: var(--md-sys-typescale-body-large-font, var(--font-body));
12
+ font-size: var(--md-sys-typescale-body-large-size, 1rem);
13
+ font-weight: var(--md-sys-typescale-body-large-weight, 400);
14
+ line-height: var(--md-sys-typescale-body-large-line-height, 1.5rem);
15
+ letter-spacing: var(--md-sys-typescale-body-large-tracking, 0.0313em);
16
+ color: var(--md-sys-color-on-surface, var(--color-on-surface));
17
+ caret-color: var(--md-sys-color-primary, var(--color-primary));
18
+ // Outlined fields have no container fill; they take the surface they sit on.
19
+ background: transparent;
20
+ border: 1px solid var(--md-sys-color-outline, var(--color-border-strong));
21
+ border-radius: var(--md-sys-shape-corner-extra-small, 4px);
22
+ transition:
23
+ border-color var(--md-sys-motion-duration-short-3, 150ms)
24
+ var(--md-sys-motion-easing-standard, ease),
25
+ box-shadow var(--md-sys-motion-duration-short-3, 150ms)
26
+ var(--md-sys-motion-easing-standard, ease);
27
+ outline: none;
28
+ min-height: 2.5rem;
29
+
30
+ &::placeholder {
31
+ color: var(--md-sys-color-on-surface-variant, var(--color-text-muted));
32
+ }
33
+
34
+ &:hover:not(:disabled, :focus) {
35
+ border-color: var(--md-sys-color-on-surface, var(--color-on-surface));
36
+ }
37
+
38
+ &:focus {
39
+ border-color: var(--md-sys-color-primary, var(--color-border-focus));
40
+ box-shadow: inset 0 0 0 1px
41
+ var(--md-sys-color-primary, var(--color-border-focus));
42
+ }
43
+
44
+ &:disabled {
45
+ opacity: 0.45;
46
+ cursor: not-allowed;
47
+ }
48
+
49
+ &[aria-invalid="true"] {
50
+ border-color: var(--md-sys-color-error, var(--color-error));
51
+ caret-color: var(--md-sys-color-error, var(--color-error));
52
+
53
+ &:hover:not(:disabled, :focus) {
54
+ border-color: var(--md-sys-color-on-error-container, var(--color-error));
55
+ }
56
+
57
+ &:focus {
58
+ border-color: var(--md-sys-color-error, var(--color-error));
59
+ box-shadow: inset 0 0 0 1px var(--md-sys-color-error, var(--color-error));
60
+ }
61
+ }
62
+ }
package/text-field.tsx ADDED
@@ -0,0 +1,29 @@
1
+ import { type InputHTMLAttributes, useId } from "react";
2
+ import { getClassName } from "@bht-component-registry/class-names";
3
+ import styles from "./text-field.module.scss";
4
+
5
+ export interface TextFieldProps extends Omit<
6
+ InputHTMLAttributes<HTMLInputElement>,
7
+ "size"
8
+ > {
9
+ /** Additional class names to merge with the component root element */
10
+ className?: string;
11
+ }
12
+
13
+ /**
14
+ * Bare text input — the native `<input>` is this component's own root
15
+ * element, no built-in label/hint/error. Wrap it in `FormField` for that
16
+ * chrome: `<FormField label="..." htmlFor="x"><TextField id="x" /></FormField>`.
17
+ */
18
+ export const TextField = ({ className, id, ...rest }: TextFieldProps) => {
19
+ const generatedId = useId();
20
+ const fieldId = id ?? generatedId;
21
+
22
+ const [rootClass] = getClassName({
23
+ className,
24
+ rootClass: "BHT__TextField",
25
+ styles,
26
+ });
27
+
28
+ return <input {...rest} id={fieldId} className={rootClass} />;
29
+ };