@dxos/react-input 0.9.1-staging.ee54ba693a → 0.11.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.
- package/dist/lib/index.mjs +241 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/types/src/InputContext.d.ts +28 -0
- package/dist/types/src/InputContext.d.ts.map +1 -0
- package/dist/types/src/Root.d.ts +3 -22
- package/dist/types/src/Root.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -0
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
- package/src/InputContext.ts +33 -0
- package/src/InputMeta.tsx +1 -1
- package/src/PinInput.tsx +1 -1
- package/src/Root.tsx +3 -26
- package/src/TextArea.tsx +1 -1
- package/src/TextInput.tsx +1 -1
- package/src/index.ts +1 -0
- package/dist/lib/browser/index.mjs +0 -298
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/node-esm/index.mjs +0 -300
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { Primitive } from "@radix-ui/react-primitive";
|
|
2
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
3
|
+
import { forwardRef, useCallback, useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { createContextScope } from "@radix-ui/react-context";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { useForwardedRef, useId, useIsFocused } from "@dxos/react-hooks";
|
|
7
|
+
//#region src/InputContext.ts
|
|
8
|
+
var INPUT_NAME = "Input";
|
|
9
|
+
var [createInputContext, createInputScope] = createContextScope(INPUT_NAME, []);
|
|
10
|
+
var [InputProvider, useInputContext] = createInputContext(INPUT_NAME);
|
|
11
|
+
//#endregion
|
|
12
|
+
//#region src/InputMeta.tsx
|
|
13
|
+
var Label = forwardRef(({ __inputScope, asChild, children, ...props }, forwardedRef) => {
|
|
14
|
+
const { id } = useInputContext(INPUT_NAME, __inputScope);
|
|
15
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : Primitive.label, {
|
|
16
|
+
...props,
|
|
17
|
+
htmlFor: id,
|
|
18
|
+
ref: forwardedRef,
|
|
19
|
+
children
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
var Description = forwardRef(({ __inputScope, asChild, children, ...props }, forwardedRef) => {
|
|
23
|
+
const { descriptionId, validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
24
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : Primitive.span, {
|
|
25
|
+
...props,
|
|
26
|
+
...validationValence === "error" && { id: descriptionId },
|
|
27
|
+
ref: forwardedRef,
|
|
28
|
+
children
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
var ErrorMessage = forwardRef(({ __inputScope, asChild, children, ...props }, forwardedRef) => {
|
|
32
|
+
const { errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
33
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : Primitive.span, {
|
|
34
|
+
...props,
|
|
35
|
+
id: errorMessageId,
|
|
36
|
+
ref: forwardedRef,
|
|
37
|
+
children
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
var Validation = forwardRef((props, forwardedRef) => {
|
|
41
|
+
const { __inputScope, asChild, children, ...otherProps } = props;
|
|
42
|
+
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
43
|
+
if (validationValence === "error") return /* @__PURE__ */ jsx(ErrorMessage, {
|
|
44
|
+
...props,
|
|
45
|
+
ref: forwardedRef
|
|
46
|
+
});
|
|
47
|
+
else return /* @__PURE__ */ jsx(asChild ? Slot : Primitive.span, {
|
|
48
|
+
...otherProps,
|
|
49
|
+
ref: forwardedRef,
|
|
50
|
+
children
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
var DescriptionAndValidation = forwardRef(({ __inputScope, asChild, children, ...props }, forwardedRef) => {
|
|
54
|
+
const { descriptionId, validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
55
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : Primitive.p, {
|
|
56
|
+
...props,
|
|
57
|
+
...validationValence !== "error" && { id: descriptionId },
|
|
58
|
+
ref: forwardedRef,
|
|
59
|
+
children
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/Root.tsx
|
|
64
|
+
var InputRoot = ({ __inputScope, id: propsId, descriptionId: propsDescriptionId, errorMessageId: propsErrorMessageId, validationValence = "neutral", children }) => {
|
|
65
|
+
return /* @__PURE__ */ jsx(InputProvider, {
|
|
66
|
+
id: useId("input", propsId),
|
|
67
|
+
descriptionId: useId("input__description", propsDescriptionId),
|
|
68
|
+
errorMessageId: useId("input__error-message", propsErrorMessageId),
|
|
69
|
+
validationValence,
|
|
70
|
+
scope: __inputScope,
|
|
71
|
+
children
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
InputRoot.displayName = INPUT_NAME;
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/PinInput.tsx
|
|
77
|
+
var PinInput = forwardRef(({ __inputScope, className, disabled, segmentClassName, length = 6, pattern, value: controlledValue, onChange, onPaste, ...props }, forwardedRef) => {
|
|
78
|
+
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
79
|
+
const inputRef = useForwardedRef(forwardedRef);
|
|
80
|
+
const inputFocused = useIsFocused(inputRef);
|
|
81
|
+
const [internalValue, setInternalValue] = useState("");
|
|
82
|
+
const [cursorPosition, setCursorPosition] = useState(0);
|
|
83
|
+
const value = controlledValue != null ? String(controlledValue) : internalValue;
|
|
84
|
+
const charPattern = useMemo(() => {
|
|
85
|
+
if (!pattern) return;
|
|
86
|
+
try {
|
|
87
|
+
const base = pattern.replace(/[*+?]$|\{\d+,?\d*\}$/g, "");
|
|
88
|
+
return new RegExp(`^${base}$`);
|
|
89
|
+
} catch {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
}, [pattern]);
|
|
93
|
+
/** Filter a string to only characters matching the pattern. */
|
|
94
|
+
const filterValue = useCallback((input) => {
|
|
95
|
+
if (!charPattern) return input;
|
|
96
|
+
return input.split("").filter((char) => charPattern.test(char)).join("");
|
|
97
|
+
}, [charPattern]);
|
|
98
|
+
const syncCursor = useCallback(() => {
|
|
99
|
+
const pos = inputRef.current?.selectionStart ?? value.length;
|
|
100
|
+
setCursorPosition(Math.min(pos, value.length));
|
|
101
|
+
}, [inputRef, value.length]);
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
setCursorPosition((prev) => Math.min(prev, value.length));
|
|
104
|
+
}, [value.length]);
|
|
105
|
+
const handleChange = useCallback((event) => {
|
|
106
|
+
const newValue = filterValue(event.target.value).slice(0, length);
|
|
107
|
+
if (controlledValue == null) setInternalValue(newValue);
|
|
108
|
+
setCursorPosition(event.target.selectionStart ?? newValue.length);
|
|
109
|
+
onChange?.(event);
|
|
110
|
+
}, [
|
|
111
|
+
length,
|
|
112
|
+
controlledValue,
|
|
113
|
+
onChange,
|
|
114
|
+
filterValue
|
|
115
|
+
]);
|
|
116
|
+
const handlePaste = useCallback((event) => {
|
|
117
|
+
onPaste?.(event);
|
|
118
|
+
if (event.defaultPrevented) return;
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
const pasted = filterValue(event.clipboardData.getData("text/plain")).slice(0, length);
|
|
121
|
+
const input = inputRef.current;
|
|
122
|
+
if (!input) return;
|
|
123
|
+
(Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set)?.call(input, pasted);
|
|
124
|
+
input.dispatchEvent(new Event("input", { bubbles: true }));
|
|
125
|
+
}, [
|
|
126
|
+
length,
|
|
127
|
+
inputRef,
|
|
128
|
+
onPaste,
|
|
129
|
+
filterValue
|
|
130
|
+
]);
|
|
131
|
+
const handleKeyDown = useCallback((event) => {
|
|
132
|
+
if (event.key === "ArrowLeft" || event.key === "ArrowRight") requestAnimationFrame(syncCursor);
|
|
133
|
+
else if (event.key === "Backspace" && value.length === 0) event.preventDefault();
|
|
134
|
+
else if (event.key.length === 1 && !event.metaKey && !event.ctrlKey && !event.altKey) {
|
|
135
|
+
if (charPattern && !charPattern.test(event.key)) {
|
|
136
|
+
event.preventDefault();
|
|
137
|
+
props.onKeyDown?.(event);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const input = inputRef.current;
|
|
141
|
+
const pos = input?.selectionStart ?? value.length;
|
|
142
|
+
if (pos < value.length && input) {
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
const newValue = value.slice(0, pos) + event.key + value.slice(pos + 1);
|
|
145
|
+
const newPos = Math.min(pos + 1, length);
|
|
146
|
+
if (controlledValue == null) setInternalValue(newValue);
|
|
147
|
+
setCursorPosition(newPos);
|
|
148
|
+
(Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set)?.call(input, newValue);
|
|
149
|
+
input.setSelectionRange(newPos, newPos);
|
|
150
|
+
onChange?.({
|
|
151
|
+
target: input,
|
|
152
|
+
currentTarget: input
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
props.onKeyDown?.(event);
|
|
157
|
+
}, [
|
|
158
|
+
value,
|
|
159
|
+
length,
|
|
160
|
+
props.onKeyDown,
|
|
161
|
+
syncCursor,
|
|
162
|
+
inputRef,
|
|
163
|
+
charPattern,
|
|
164
|
+
controlledValue,
|
|
165
|
+
onChange
|
|
166
|
+
]);
|
|
167
|
+
const handleSelect = useCallback(() => {
|
|
168
|
+
syncCursor();
|
|
169
|
+
}, [syncCursor]);
|
|
170
|
+
const activeIndex = Math.min(cursorPosition, value.length < length ? value.length : length - 1);
|
|
171
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
172
|
+
className: `relative inline-flex items-center gap-2 ${className ?? ""}`,
|
|
173
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
174
|
+
ref: inputRef,
|
|
175
|
+
id,
|
|
176
|
+
type: "text",
|
|
177
|
+
value,
|
|
178
|
+
onChange: handleChange,
|
|
179
|
+
onPaste: handlePaste,
|
|
180
|
+
onKeyDown: handleKeyDown,
|
|
181
|
+
onSelect: handleSelect,
|
|
182
|
+
maxLength: length,
|
|
183
|
+
disabled,
|
|
184
|
+
spellCheck: false,
|
|
185
|
+
"aria-describedby": descriptionId,
|
|
186
|
+
...validationValence === "error" && {
|
|
187
|
+
"aria-invalid": "true",
|
|
188
|
+
"aria-errormessage": errorMessageId
|
|
189
|
+
},
|
|
190
|
+
...props,
|
|
191
|
+
pattern,
|
|
192
|
+
className: "dx-fullscreen opacity-0",
|
|
193
|
+
style: {
|
|
194
|
+
caretColor: "transparent",
|
|
195
|
+
...props.style
|
|
196
|
+
}
|
|
197
|
+
}), Array.from({ length }, (_, index) => {
|
|
198
|
+
const char = value[index] || "\xA0";
|
|
199
|
+
return /* @__PURE__ */ jsx("div", {
|
|
200
|
+
className: segmentClassName,
|
|
201
|
+
...!!(inputFocused && index === activeIndex) && { "data-focused": "" },
|
|
202
|
+
"aria-hidden": "true",
|
|
203
|
+
children: char
|
|
204
|
+
}, index);
|
|
205
|
+
})]
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/TextInput.tsx
|
|
210
|
+
var TextInput = forwardRef(({ __inputScope, ...props }, forwardedRef) => {
|
|
211
|
+
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
212
|
+
return /* @__PURE__ */ jsx(Primitive.input, {
|
|
213
|
+
...props,
|
|
214
|
+
id,
|
|
215
|
+
"aria-describedby": descriptionId,
|
|
216
|
+
...validationValence === "error" && {
|
|
217
|
+
"aria-invalid": "true",
|
|
218
|
+
"aria-errormessage": errorMessageId
|
|
219
|
+
},
|
|
220
|
+
"ref": forwardedRef
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
//#endregion
|
|
224
|
+
//#region src/TextArea.tsx
|
|
225
|
+
var TextArea = forwardRef(({ __inputScope, ...props }, forwardedRef) => {
|
|
226
|
+
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
227
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
228
|
+
...props,
|
|
229
|
+
id,
|
|
230
|
+
"aria-describedby": descriptionId,
|
|
231
|
+
...validationValence === "error" && {
|
|
232
|
+
"aria-invalid": "true",
|
|
233
|
+
"aria-errormessage": errorMessageId
|
|
234
|
+
},
|
|
235
|
+
"ref": forwardedRef
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
//#endregion
|
|
239
|
+
export { Description, DescriptionAndValidation, ErrorMessage, INPUT_NAME, InputRoot, Label, PinInput, TextArea, TextInput, Validation, createInputScope, useInputContext };
|
|
240
|
+
|
|
241
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/InputContext.ts","../../src/InputMeta.tsx","../../src/Root.tsx","../../src/PinInput.tsx","../../src/TextInput.tsx","../../src/TextArea.tsx"],"sourcesContent":["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Scope, createContextScope } from '@radix-ui/react-context';\nimport { type PropsWithChildren } from 'react';\n\n// Kept out of `Root.tsx`: react-refresh only fast-refreshes a module whose exports are all\n// components, so a context and its hook exported beside them force a full page reload on every edit.\n\nexport const INPUT_NAME = 'Input';\n\nexport type Valence = 'success' | 'info' | 'warning' | 'error' | 'neutral';\n\nexport type InputScopedProps<P> = P & { __inputScope?: Scope };\n\nexport type InputRootProps = PropsWithChildren<{\n id?: string;\n validationValence?: Valence;\n descriptionId?: string;\n errorMessageId?: string;\n}>;\n\nexport const [createInputContext, createInputScope] = createContextScope(INPUT_NAME, []);\n\nexport type InputContextValue = {\n id: string;\n descriptionId: string;\n errorMessageId: string;\n validationValence: Valence;\n};\n\nexport const [InputProvider, useInputContext] = createInputContext<InputContextValue>(INPUT_NAME);\n","//\n// Copyright 2023 DXOS.org\n//\n\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, { type ComponentPropsWithRef, forwardRef } from 'react';\n\nimport { INPUT_NAME, type InputScopedProps, useInputContext } from './InputContext';\n\ntype LabelProps = ComponentPropsWithRef<typeof Primitive.label> & { asChild?: boolean };\n\nconst Label = forwardRef<HTMLLabelElement, LabelProps>(\n ({ __inputScope, asChild, children, ...props }: InputScopedProps<LabelProps>, forwardedRef) => {\n const { id } = useInputContext(INPUT_NAME, __inputScope);\n const Comp = asChild ? Slot : Primitive.label;\n return (\n <Comp {...props} htmlFor={id} ref={forwardedRef}>\n {children}\n </Comp>\n );\n },\n);\n\ntype DescriptionProps = Omit<ComponentPropsWithRef<typeof Primitive.span>, 'id'> & { asChild?: boolean };\n\nconst Description = forwardRef<HTMLSpanElement, DescriptionProps>(\n ({ __inputScope, asChild, children, ...props }: InputScopedProps<DescriptionProps>, forwardedRef) => {\n const { descriptionId, validationValence } = useInputContext(INPUT_NAME, __inputScope);\n const Comp = asChild ? Slot : Primitive.span;\n return (\n <Comp {...props} {...(validationValence === 'error' && { id: descriptionId })} ref={forwardedRef}>\n {children}\n </Comp>\n );\n },\n);\n\ntype ErrorMessageProps = Omit<ComponentPropsWithRef<typeof Primitive.span>, 'id'> & { asChild?: boolean };\n\nconst ErrorMessage = forwardRef<HTMLSpanElement, ErrorMessageProps>(\n ({ __inputScope, asChild, children, ...props }: InputScopedProps<ErrorMessageProps>, forwardedRef) => {\n const { errorMessageId } = useInputContext(INPUT_NAME, __inputScope);\n const Comp = asChild ? Slot : Primitive.span;\n return (\n <Comp {...props} id={errorMessageId} ref={forwardedRef}>\n {children}\n </Comp>\n );\n },\n);\n\ntype ValidationProps = Omit<ComponentPropsWithRef<typeof Primitive.span>, 'id'> & { asChild?: boolean };\n\nconst Validation = forwardRef<HTMLSpanElement, ValidationProps>(\n (props: InputScopedProps<ValidationProps>, forwardedRef) => {\n const { __inputScope, asChild, children, ...otherProps } = props;\n const { validationValence } = useInputContext(INPUT_NAME, __inputScope);\n if (validationValence === 'error') {\n return <ErrorMessage {...props} ref={forwardedRef} />;\n } else {\n const Comp = asChild ? Slot : Primitive.span;\n return (\n <Comp {...otherProps} ref={forwardedRef}>\n {children}\n </Comp>\n );\n }\n },\n);\n\ntype DescriptionAndValidationProps = ComponentPropsWithRef<typeof Primitive.p> & { asChild?: boolean };\n\nconst DescriptionAndValidation = forwardRef<HTMLParagraphElement, DescriptionAndValidationProps>(\n ({ __inputScope, asChild, children, ...props }: InputScopedProps<DescriptionAndValidationProps>, forwardedRef) => {\n const { descriptionId, validationValence } = useInputContext(INPUT_NAME, __inputScope);\n const Comp = asChild ? Slot : Primitive.p;\n return (\n <Comp {...props} {...(validationValence !== 'error' && { id: descriptionId })} ref={forwardedRef}>\n {children}\n </Comp>\n );\n },\n);\n\nexport { Description, DescriptionAndValidation, ErrorMessage, Label, Validation };\n\nexport type { DescriptionAndValidationProps, DescriptionProps, ErrorMessageProps, LabelProps, ValidationProps };\n","//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { useId } from '@dxos/react-hooks';\n\nimport { INPUT_NAME, InputProvider, type InputRootProps, type InputScopedProps, type Valence } from './InputContext';\n\nconst InputRoot = ({\n __inputScope,\n id: propsId,\n descriptionId: propsDescriptionId,\n errorMessageId: propsErrorMessageId,\n validationValence = 'neutral',\n children,\n}: InputScopedProps<InputRootProps>) => {\n const id = useId('input', propsId);\n const descriptionId = useId('input__description', propsDescriptionId);\n const errorMessageId = useId('input__error-message', propsErrorMessageId);\n return (\n <InputProvider {...{ id, descriptionId, errorMessageId, validationValence }} scope={__inputScope}>\n {children}\n </InputProvider>\n );\n};\n\nInputRoot.displayName = INPUT_NAME;\n\nexport { InputRoot };\n\nexport type { InputRootProps, InputScopedProps, Valence };\n","//\n// Copyright 2023 DXOS.org\n//\n\nimport React, {\n type ChangeEvent,\n type ClipboardEvent,\n type ComponentPropsWithRef,\n type KeyboardEvent,\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from 'react';\n\nimport { useForwardedRef, useIsFocused } from '@dxos/react-hooks';\n\nimport { INPUT_NAME, type InputScopedProps, useInputContext } from './InputContext';\n\ntype PinInputProps = Omit<ComponentPropsWithRef<'input'>, 'type' | 'maxLength'> & {\n /** Class name applied to each segment div. */\n segmentClassName?: string;\n /** Number of code segments. */\n length?: number;\n};\n\nconst PinInput = forwardRef<HTMLInputElement, PinInputProps>(\n (\n {\n __inputScope,\n className,\n disabled,\n segmentClassName,\n length = 6,\n pattern,\n value: controlledValue,\n onChange,\n onPaste,\n ...props\n }: InputScopedProps<PinInputProps>,\n forwardedRef,\n ) => {\n const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);\n const inputRef = useForwardedRef(forwardedRef);\n const inputFocused = useIsFocused(inputRef);\n const [internalValue, setInternalValue] = useState('');\n const [cursorPosition, setCursorPosition] = useState(0);\n\n const value = controlledValue != null ? String(controlledValue) : internalValue;\n\n // Derive a per-character filter from the `pattern` prop (e.g., `\\\\d*` → test each char against `\\\\d`).\n const charPattern = useMemo(() => {\n if (!pattern) {\n return undefined;\n }\n try {\n // Strip quantifiers (*, +, {n}) to get the base character class.\n const base = pattern.replace(/[*+?]$|\\{\\d+,?\\d*\\}$/g, '');\n return new RegExp(`^${base}$`);\n } catch {\n return undefined;\n }\n }, [pattern]);\n\n /** Filter a string to only characters matching the pattern. */\n const filterValue = useCallback(\n (input: string) => {\n if (!charPattern) {\n return input;\n }\n return input\n .split('')\n .filter((char) => charPattern.test(char))\n .join('');\n },\n [charPattern],\n );\n\n // Sync cursor position from the hidden input's selection.\n const syncCursor = useCallback(() => {\n const pos = inputRef.current?.selectionStart ?? value.length;\n setCursorPosition(Math.min(pos, value.length));\n }, [inputRef, value.length]);\n\n // Keep cursor in sync after value changes.\n useEffect(() => {\n setCursorPosition((prev) => Math.min(prev, value.length));\n }, [value.length]);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n const newValue = filterValue(event.target.value).slice(0, length);\n if (controlledValue == null) {\n setInternalValue(newValue);\n }\n setCursorPosition(event.target.selectionStart ?? newValue.length);\n onChange?.(event);\n },\n [length, controlledValue, onChange, filterValue],\n );\n\n const handlePaste = useCallback(\n (event: ClipboardEvent<HTMLInputElement>) => {\n onPaste?.(event);\n if (event.defaultPrevented) {\n return;\n }\n event.preventDefault();\n const pasted = filterValue(event.clipboardData.getData('text/plain')).slice(0, length);\n const input = inputRef.current;\n if (!input) {\n return;\n }\n // Use native setter to trigger React's synthetic onChange.\n const nativeInputValueSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set;\n nativeInputValueSetter?.call(input, pasted);\n input.dispatchEvent(new Event('input', { bubbles: true }));\n },\n [length, inputRef, onPaste, filterValue],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {\n // Let the native input handle cursor movement, then sync.\n requestAnimationFrame(syncCursor);\n } else if (event.key === 'Backspace' && value.length === 0) {\n event.preventDefault();\n } else if (event.key.length === 1 && !event.metaKey && !event.ctrlKey && !event.altKey) {\n // Reject characters that don't match the allow pattern.\n if (charPattern && !charPattern.test(event.key)) {\n event.preventDefault();\n props.onKeyDown?.(event);\n return;\n }\n // Overwrite mode: replace character at cursor position instead of inserting.\n const input = inputRef.current;\n const pos = input?.selectionStart ?? value.length;\n if (pos < value.length && input) {\n event.preventDefault();\n const newValue = value.slice(0, pos) + event.key + value.slice(pos + 1);\n const newPos = Math.min(pos + 1, length);\n // Update state and cursor synchronously to avoid flicker.\n if (controlledValue == null) {\n setInternalValue(newValue);\n }\n setCursorPosition(newPos);\n // Sync the native input to match.\n const nativeInputValueSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set;\n nativeInputValueSetter?.call(input, newValue);\n input.setSelectionRange(newPos, newPos);\n // Notify consumer via onChange with a synthetic-like event.\n onChange?.({ target: input, currentTarget: input } as ChangeEvent<HTMLInputElement>);\n }\n }\n props.onKeyDown?.(event);\n },\n [value, length, props.onKeyDown, syncCursor, inputRef, charPattern, controlledValue, onChange],\n );\n\n const handleSelect = useCallback(() => {\n syncCursor();\n }, [syncCursor]);\n\n const activeIndex = Math.min(cursorPosition, value.length < length ? value.length : length - 1);\n\n return (\n <div className={`relative inline-flex items-center gap-2 ${className ?? ''}`}>\n <input\n ref={inputRef}\n id={id}\n type='text'\n value={value}\n onChange={handleChange}\n onPaste={handlePaste}\n onKeyDown={handleKeyDown}\n onSelect={handleSelect}\n maxLength={length}\n disabled={disabled}\n spellCheck={false}\n aria-describedby={descriptionId}\n {...(validationValence === 'error' && {\n 'aria-invalid': 'true' as const,\n 'aria-errormessage': errorMessageId,\n })}\n {...props}\n pattern={pattern}\n className='dx-fullscreen opacity-0'\n style={{\n caretColor: 'transparent',\n ...props.style,\n }}\n />\n {Array.from({ length }, (_, index) => {\n const char = value[index] || '\\u00A0';\n const isCursor = !!(inputFocused && index === activeIndex);\n return (\n <div key={index} className={segmentClassName} {...(isCursor && { 'data-focused': '' })} aria-hidden='true'>\n {char}\n </div>\n );\n })}\n </div>\n );\n },\n);\n\nexport { PinInput };\n\nexport type { PinInputProps };\n","//\n// Copyright 2023 DXOS.org\n//\n\nimport { Primitive } from '@radix-ui/react-primitive';\nimport React, { type ComponentPropsWithRef, forwardRef } from 'react';\n\nimport { INPUT_NAME, type InputScopedProps, useInputContext } from './InputContext';\n\ntype TextInputProps = Omit<ComponentPropsWithRef<typeof Primitive.input>, 'id'>;\n\nconst TextInput = forwardRef<HTMLInputElement, TextInputProps>(\n ({ __inputScope, ...props }: InputScopedProps<TextInputProps>, forwardedRef) => {\n const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);\n return (\n <Primitive.input\n {...{\n ...props,\n id,\n 'aria-describedby': descriptionId,\n ...(validationValence === 'error' && {\n 'aria-invalid': 'true' as const,\n 'aria-errormessage': errorMessageId,\n }),\n 'ref': forwardedRef,\n }}\n />\n );\n },\n);\n\nexport { TextInput };\n\nexport type { TextInputProps };\n","//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type ComponentPropsWithRef, forwardRef } from 'react';\n\nimport { INPUT_NAME, type InputScopedProps, useInputContext } from './InputContext';\n\ntype TextAreaProps = Omit<ComponentPropsWithRef<'textarea'>, 'id'>;\n\nconst TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n ({ __inputScope, ...props }: InputScopedProps<TextAreaProps>, forwardedRef) => {\n const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);\n return (\n <textarea\n {...{\n ...props,\n id,\n 'aria-describedby': descriptionId,\n ...(validationValence === 'error' && {\n 'aria-invalid': 'true' as const,\n 'aria-errormessage': errorMessageId,\n }),\n 'ref': forwardedRef,\n }}\n />\n );\n },\n);\n\nexport { TextArea };\n\nexport type { TextAreaProps };\n"],"mappings":";;;;;;;AAUA,IAAa,aAAa;AAa1B,IAAa,CAAC,oBAAoB,oBAAoB,mBAAmB,YAAY,CAAC,CAAC;AASvF,IAAa,CAAC,eAAe,mBAAmB,mBAAsC,UAAU;;;ACpBhG,IAAM,QAAQ,YACX,EAAE,cAAc,SAAS,UAAU,GAAG,SAAuC,iBAAiB;CAC7F,MAAM,EAAE,OAAO,gBAAgB,YAAY,YAAY;CAEvD,OACE,oBAFW,UAAU,OAAO,UAAU,OAEtC;EAAM,GAAI;EAAO,SAAS;EAAI,KAAK;EAChC;CACG,CAAA;AAEV,CACF;AAIA,IAAM,cAAc,YACjB,EAAE,cAAc,SAAS,UAAU,GAAG,SAA6C,iBAAiB;CACnG,MAAM,EAAE,eAAe,sBAAsB,gBAAgB,YAAY,YAAY;CAErF,OACE,oBAFW,UAAU,OAAO,UAAU,MAEtC;EAAM,GAAI;EAAO,GA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,YACd,EAAE,cAAc,GAAG,SAA0C,iBAAiB;CAC7E,MAAM,EAAE,IAAI,mBAAmB,eAAe,mBAAmB,gBAAgB,YAAY,YAAY;CACzG,OACE,oBAAC,YAAD;EAEI,GAAG;EACH;EACA,oBAAoB;EACpB,GAAI,sBAAsB,WAAW;GACnC,gBAAgB;GAChB,qBAAqB;EACvB;EACA,OAAO;CAEV,CAAA;AAEL,CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type Scope } from '@radix-ui/react-context';
|
|
2
|
+
import { type PropsWithChildren } from 'react';
|
|
3
|
+
export declare const INPUT_NAME = "Input";
|
|
4
|
+
export type Valence = 'success' | 'info' | 'warning' | 'error' | 'neutral';
|
|
5
|
+
export type InputScopedProps<P> = P & {
|
|
6
|
+
__inputScope?: Scope;
|
|
7
|
+
};
|
|
8
|
+
export type InputRootProps = PropsWithChildren<{
|
|
9
|
+
id?: string;
|
|
10
|
+
validationValence?: Valence;
|
|
11
|
+
descriptionId?: string;
|
|
12
|
+
errorMessageId?: string;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const createInputContext: <ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType | undefined) => readonly [React.FC<ContextValueType & {
|
|
15
|
+
scope: Scope<ContextValueType>;
|
|
16
|
+
children: import("react").ReactNode;
|
|
17
|
+
}>, (consumerName: string, scope: Scope<ContextValueType | undefined>) => ContextValueType], createInputScope: import("@radix-ui/react-context").CreateScope;
|
|
18
|
+
export type InputContextValue = {
|
|
19
|
+
id: string;
|
|
20
|
+
descriptionId: string;
|
|
21
|
+
errorMessageId: string;
|
|
22
|
+
validationValence: Valence;
|
|
23
|
+
};
|
|
24
|
+
export declare const InputProvider: import("react").FC<InputContextValue & {
|
|
25
|
+
scope: Scope<InputContextValue>;
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
}>, useInputContext: (consumerName: string, scope: Scope<InputContextValue | undefined>) => InputContextValue;
|
|
28
|
+
//# sourceMappingURL=InputContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputContext.d.ts","sourceRoot":"","sources":["../../../src/InputContext.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,KAAK,EAAsB,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAK/C,eAAO,MAAM,UAAU,UAAU,CAAC;AAElC,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAE3E,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,YAAY,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAE/D,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAAC;IAC7C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC,CAAC;AAEH,eAAO,MAAO,kBAAkB;;;6FAAE,gBAAgB,+CAAsC,CAAC;AAEzF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAO,aAAa;;;IAAE,eAAe,0FAAqD,CAAC"}
|
package/dist/types/src/Root.d.ts
CHANGED
|
@@ -1,28 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
declare const INPUT_NAME = "Input";
|
|
4
|
-
type Valence = 'success' | 'info' | 'warning' | 'error' | 'neutral';
|
|
5
|
-
type InputScopedProps<P> = P & {
|
|
6
|
-
__inputScope?: Scope;
|
|
7
|
-
};
|
|
8
|
-
type InputRootProps = PropsWithChildren<{
|
|
9
|
-
id?: string;
|
|
10
|
-
validationValence?: Valence;
|
|
11
|
-
descriptionId?: string;
|
|
12
|
-
errorMessageId?: string;
|
|
13
|
-
}>;
|
|
14
|
-
declare const createInputScope: import("@radix-ui/react-context").CreateScope;
|
|
15
|
-
type InputContextValue = {
|
|
16
|
-
id: string;
|
|
17
|
-
descriptionId: string;
|
|
18
|
-
errorMessageId: string;
|
|
19
|
-
validationValence: Valence;
|
|
20
|
-
};
|
|
21
|
-
declare const useInputContext: (consumerName: string, scope: Scope<InputContextValue | undefined>) => InputContextValue;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type InputRootProps, type InputScopedProps, type Valence } from './InputContext';
|
|
22
3
|
declare function InputRoot({ __inputScope, id: propsId, descriptionId: propsDescriptionId, errorMessageId: propsErrorMessageId, validationValence, children }: InputScopedProps<InputRootProps>): React.JSX.Element;
|
|
23
4
|
declare namespace InputRoot {
|
|
24
5
|
var displayName: string;
|
|
25
6
|
}
|
|
26
|
-
export {
|
|
7
|
+
export { InputRoot };
|
|
27
8
|
export type { InputRootProps, InputScopedProps, Valence };
|
|
28
9
|
//# sourceMappingURL=Root.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Root.d.ts","sourceRoot":"","sources":["../../../src/Root.tsx"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"Root.d.ts","sourceRoot":"","sources":["../../../src/Root.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAA6B,KAAK,cAAc,EAAE,KAAK,gBAAgB,EAAE,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;2BAElG,EACjB,YAAY,EACZ,EAAE,EAAE,OAAO,EACX,aAAa,EAAE,kBAAkB,EACjC,cAAc,EAAE,mBAAmB,EACnC,iBAA6B,EAC7B,QAAQ,EACT,EAAE,gBAAgB,CAAC,cAAc,CAAC;;;;AAanC,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,YAAY,EAAE,cAAc,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AAEvB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtG,cAAc,QAAQ,CAAC;AAEvB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|