@dxos/react-input 0.8.4-main.ef1bc66f44 → 0.8.4-main.f466a3d56e
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/LICENSE +102 -5
- package/dist/lib/browser/index.mjs +162 -39
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +162 -39
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/PinInput.d.ts +5 -10
- package/dist/types/src/PinInput.d.ts.map +1 -1
- package/dist/types/src/Root.d.ts +4 -4
- package/dist/types/src/Root.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -5
- package/src/InputMeta.tsx +15 -15
- package/src/PinInput.tsx +176 -45
package/LICENSE
CHANGED
|
@@ -1,8 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2022 DXOS
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
## Abbreviation
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 DXOS
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
|
@@ -27,8 +27,8 @@ InputRoot.displayName = INPUT_NAME;
|
|
|
27
27
|
// src/InputMeta.tsx
|
|
28
28
|
var Label = /* @__PURE__ */ forwardRef(({ __inputScope, asChild, children, ...props }, forwardedRef) => {
|
|
29
29
|
const { id } = useInputContext(INPUT_NAME, __inputScope);
|
|
30
|
-
const
|
|
31
|
-
return /* @__PURE__ */ React2.createElement(
|
|
30
|
+
const Comp = asChild ? Slot : Primitive.label;
|
|
31
|
+
return /* @__PURE__ */ React2.createElement(Comp, {
|
|
32
32
|
...props,
|
|
33
33
|
htmlFor: id,
|
|
34
34
|
ref: forwardedRef
|
|
@@ -36,8 +36,8 @@ var Label = /* @__PURE__ */ forwardRef(({ __inputScope, asChild, children, ...pr
|
|
|
36
36
|
});
|
|
37
37
|
var Description = /* @__PURE__ */ forwardRef(({ __inputScope, asChild, children, ...props }, forwardedRef) => {
|
|
38
38
|
const { descriptionId, validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
39
|
-
const
|
|
40
|
-
return /* @__PURE__ */ React2.createElement(
|
|
39
|
+
const Comp = asChild ? Slot : Primitive.span;
|
|
40
|
+
return /* @__PURE__ */ React2.createElement(Comp, {
|
|
41
41
|
...props,
|
|
42
42
|
...validationValence === "error" && {
|
|
43
43
|
id: descriptionId
|
|
@@ -47,8 +47,8 @@ var Description = /* @__PURE__ */ forwardRef(({ __inputScope, asChild, children,
|
|
|
47
47
|
});
|
|
48
48
|
var ErrorMessage = /* @__PURE__ */ forwardRef(({ __inputScope, asChild, children, ...props }, forwardedRef) => {
|
|
49
49
|
const { errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
50
|
-
const
|
|
51
|
-
return /* @__PURE__ */ React2.createElement(
|
|
50
|
+
const Comp = asChild ? Slot : Primitive.span;
|
|
51
|
+
return /* @__PURE__ */ React2.createElement(Comp, {
|
|
52
52
|
...props,
|
|
53
53
|
id: errorMessageId,
|
|
54
54
|
ref: forwardedRef
|
|
@@ -63,8 +63,8 @@ var Validation = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
|
|
|
63
63
|
ref: forwardedRef
|
|
64
64
|
});
|
|
65
65
|
} else {
|
|
66
|
-
const
|
|
67
|
-
return /* @__PURE__ */ React2.createElement(
|
|
66
|
+
const Comp = asChild ? Slot : Primitive.span;
|
|
67
|
+
return /* @__PURE__ */ React2.createElement(Comp, {
|
|
68
68
|
...otherProps,
|
|
69
69
|
ref: forwardedRef
|
|
70
70
|
}, children);
|
|
@@ -72,8 +72,8 @@ var Validation = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
|
|
|
72
72
|
});
|
|
73
73
|
var DescriptionAndValidation = /* @__PURE__ */ forwardRef(({ __inputScope, asChild, children, ...props }, forwardedRef) => {
|
|
74
74
|
const { descriptionId, validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
75
|
-
const
|
|
76
|
-
return /* @__PURE__ */ React2.createElement(
|
|
75
|
+
const Comp = asChild ? Slot : Primitive.p;
|
|
76
|
+
return /* @__PURE__ */ React2.createElement(Comp, {
|
|
77
77
|
...props,
|
|
78
78
|
...validationValence !== "error" && {
|
|
79
79
|
id: descriptionId
|
|
@@ -83,47 +83,170 @@ var DescriptionAndValidation = /* @__PURE__ */ forwardRef(({ __inputScope, asChi
|
|
|
83
83
|
});
|
|
84
84
|
|
|
85
85
|
// src/PinInput.tsx
|
|
86
|
-
import {
|
|
87
|
-
import React3, { forwardRef as forwardRef2, useCallback } from "react";
|
|
86
|
+
import React3, { forwardRef as forwardRef2, useCallback, useEffect, useMemo, useState } from "react";
|
|
88
87
|
import { useForwardedRef, useIsFocused } from "@dxos/react-hooks";
|
|
89
|
-
var PinInput = /* @__PURE__ */ forwardRef2(({ __inputScope,
|
|
88
|
+
var PinInput = /* @__PURE__ */ forwardRef2(({ __inputScope, className, disabled, segmentClassName, length = 6, pattern, value: controlledValue, onChange, onPaste, ...props }, forwardedRef) => {
|
|
90
89
|
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
91
|
-
const width = getSegmentCssWidth(segmentPadding);
|
|
92
90
|
const inputRef = useForwardedRef(forwardedRef);
|
|
93
91
|
const inputFocused = useIsFocused(inputRef);
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
92
|
+
const [internalValue, setInternalValue] = useState("");
|
|
93
|
+
const [cursorPosition, setCursorPosition] = useState(0);
|
|
94
|
+
const value = controlledValue != null ? String(controlledValue) : internalValue;
|
|
95
|
+
const charPattern = useMemo(() => {
|
|
96
|
+
if (!pattern) {
|
|
97
|
+
return void 0;
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
const base = pattern.replace(/[*+?]$|\{\d+,?\d*\}$/g, "");
|
|
101
|
+
return new RegExp(`^${base}$`);
|
|
102
|
+
} catch {
|
|
103
|
+
return void 0;
|
|
104
104
|
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
inputFocused,
|
|
108
|
-
validationValence
|
|
105
|
+
}, [
|
|
106
|
+
pattern
|
|
109
107
|
]);
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
108
|
+
const filterValue = useCallback((input) => {
|
|
109
|
+
if (!charPattern) {
|
|
110
|
+
return input;
|
|
111
|
+
}
|
|
112
|
+
return input.split("").filter((char) => charPattern.test(char)).join("");
|
|
113
|
+
}, [
|
|
114
|
+
charPattern
|
|
115
|
+
]);
|
|
116
|
+
const syncCursor = useCallback(() => {
|
|
117
|
+
const pos = inputRef.current?.selectionStart ?? value.length;
|
|
118
|
+
setCursorPosition(Math.min(pos, value.length));
|
|
119
|
+
}, [
|
|
120
|
+
inputRef,
|
|
121
|
+
value.length
|
|
122
|
+
]);
|
|
123
|
+
useEffect(() => {
|
|
124
|
+
setCursorPosition((prev) => Math.min(prev, value.length));
|
|
125
|
+
}, [
|
|
126
|
+
value.length
|
|
127
|
+
]);
|
|
128
|
+
const handleChange = useCallback((event) => {
|
|
129
|
+
const newValue = filterValue(event.target.value).slice(0, length);
|
|
130
|
+
if (controlledValue == null) {
|
|
131
|
+
setInternalValue(newValue);
|
|
132
|
+
}
|
|
133
|
+
setCursorPosition(event.target.selectionStart ?? newValue.length);
|
|
134
|
+
onChange?.(event);
|
|
135
|
+
}, [
|
|
136
|
+
length,
|
|
137
|
+
controlledValue,
|
|
138
|
+
onChange,
|
|
139
|
+
filterValue
|
|
140
|
+
]);
|
|
141
|
+
const handlePaste = useCallback((event) => {
|
|
142
|
+
onPaste?.(event);
|
|
143
|
+
if (event.defaultPrevented) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
event.preventDefault();
|
|
147
|
+
const pasted = filterValue(event.clipboardData.getData("text/plain")).slice(0, length);
|
|
148
|
+
const input = inputRef.current;
|
|
149
|
+
if (!input) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
|
|
153
|
+
nativeInputValueSetter?.call(input, pasted);
|
|
154
|
+
input.dispatchEvent(new Event("input", {
|
|
155
|
+
bubbles: true
|
|
156
|
+
}));
|
|
157
|
+
}, [
|
|
158
|
+
length,
|
|
159
|
+
inputRef,
|
|
160
|
+
onPaste,
|
|
161
|
+
filterValue
|
|
162
|
+
]);
|
|
163
|
+
const handleKeyDown = useCallback((event) => {
|
|
164
|
+
if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
|
|
165
|
+
requestAnimationFrame(syncCursor);
|
|
166
|
+
} else if (event.key === "Backspace" && value.length === 0) {
|
|
167
|
+
event.preventDefault();
|
|
168
|
+
} else if (event.key.length === 1 && !event.metaKey && !event.ctrlKey && !event.altKey) {
|
|
169
|
+
if (charPattern && !charPattern.test(event.key)) {
|
|
170
|
+
event.preventDefault();
|
|
171
|
+
props.onKeyDown?.(event);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const input = inputRef.current;
|
|
175
|
+
const pos = input?.selectionStart ?? value.length;
|
|
176
|
+
if (pos < value.length && input) {
|
|
177
|
+
event.preventDefault();
|
|
178
|
+
const newValue = value.slice(0, pos) + event.key + value.slice(pos + 1);
|
|
179
|
+
const newPos = Math.min(pos + 1, length);
|
|
180
|
+
if (controlledValue == null) {
|
|
181
|
+
setInternalValue(newValue);
|
|
182
|
+
}
|
|
183
|
+
setCursorPosition(newPos);
|
|
184
|
+
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
|
|
185
|
+
nativeInputValueSetter?.call(input, newValue);
|
|
186
|
+
input.setSelectionRange(newPos, newPos);
|
|
187
|
+
onChange?.({
|
|
188
|
+
target: input,
|
|
189
|
+
currentTarget: input
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
props.onKeyDown?.(event);
|
|
194
|
+
}, [
|
|
195
|
+
value,
|
|
196
|
+
length,
|
|
197
|
+
props.onKeyDown,
|
|
198
|
+
syncCursor,
|
|
199
|
+
inputRef,
|
|
200
|
+
charPattern,
|
|
201
|
+
controlledValue,
|
|
202
|
+
onChange
|
|
203
|
+
]);
|
|
204
|
+
const handleSelect = useCallback(() => {
|
|
205
|
+
syncCursor();
|
|
206
|
+
}, [
|
|
207
|
+
syncCursor
|
|
208
|
+
]);
|
|
209
|
+
const activeIndex = Math.min(cursorPosition, value.length < length ? value.length : length - 1);
|
|
210
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
211
|
+
className: `relative inline-flex items-center gap-2 ${className ?? ""}`
|
|
212
|
+
}, /* @__PURE__ */ React3.createElement("input", {
|
|
213
|
+
ref: inputRef,
|
|
117
214
|
id,
|
|
215
|
+
type: "text",
|
|
216
|
+
value,
|
|
217
|
+
onChange: handleChange,
|
|
218
|
+
onPaste: handlePaste,
|
|
219
|
+
onKeyDown: handleKeyDown,
|
|
220
|
+
onSelect: handleSelect,
|
|
221
|
+
maxLength: length,
|
|
222
|
+
disabled,
|
|
223
|
+
spellCheck: false,
|
|
118
224
|
"aria-describedby": descriptionId,
|
|
119
225
|
...validationValence === "error" && {
|
|
120
226
|
"aria-invalid": "true",
|
|
121
227
|
"aria-errormessage": errorMessageId
|
|
122
228
|
},
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
className:
|
|
126
|
-
|
|
229
|
+
...props,
|
|
230
|
+
pattern,
|
|
231
|
+
className: "dx-fullscreen opacity-0",
|
|
232
|
+
style: {
|
|
233
|
+
caretColor: "transparent",
|
|
234
|
+
...props.style
|
|
235
|
+
}
|
|
236
|
+
}), Array.from({
|
|
237
|
+
length
|
|
238
|
+
}, (_, index) => {
|
|
239
|
+
const char = value[index] || "\xA0";
|
|
240
|
+
const isCursor = !!(inputFocused && index === activeIndex);
|
|
241
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
242
|
+
key: index,
|
|
243
|
+
className: segmentClassName,
|
|
244
|
+
...isCursor && {
|
|
245
|
+
"data-focused": ""
|
|
246
|
+
},
|
|
247
|
+
"aria-hidden": "true"
|
|
248
|
+
}, char);
|
|
249
|
+
}));
|
|
127
250
|
});
|
|
128
251
|
|
|
129
252
|
// src/TextInput.tsx
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/InputMeta.tsx", "../../../src/Root.tsx", "../../../src/PinInput.tsx", "../../../src/TextInput.tsx", "../../../src/TextArea.tsx"],
|
|
4
|
-
"sourcesContent": ["//\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 './Root';\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 Root = asChild ? Slot : Primitive.label;\n return (\n <Root {...props} htmlFor={id} ref={forwardedRef}>\n {children}\n </Root>\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 Root = asChild ? Slot : Primitive.span;\n return (\n <Root {...props} {...(validationValence === 'error' && { id: descriptionId })} ref={forwardedRef}>\n {children}\n </Root>\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 Root = asChild ? Slot : Primitive.span;\n return (\n <Root {...props} id={errorMessageId} ref={forwardedRef}>\n {children}\n </Root>\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 Root = asChild ? Slot : Primitive.span;\n return (\n <Root {...otherProps} ref={forwardedRef}>\n {children}\n </Root>\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 Root = asChild ? Slot : Primitive.p;\n return (\n <Root {...props} {...(validationValence !== 'error' && { id: descriptionId })} ref={forwardedRef}>\n {children}\n </Root>\n );\n },\n);\n\nexport { Label, Validation, Description, DescriptionAndValidation, ErrorMessage };\n\nexport type { LabelProps, ValidationProps, DescriptionProps, DescriptionAndValidationProps, ErrorMessageProps };\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Scope, createContextScope } from '@radix-ui/react-context';\nimport React, { type PropsWithChildren } from 'react';\n\nimport { useId } from '@dxos/react-hooks';\n\nconst INPUT_NAME = 'Input';\n\ntype Valence = 'success' | 'info' | 'warning' | 'error' | 'neutral';\n\ntype InputScopedProps<P> = P & { __inputScope?: Scope };\n\ntype InputRootProps = PropsWithChildren<{\n id?: string;\n validationValence?: Valence;\n descriptionId?: string;\n errorMessageId?: string;\n}>;\n\nconst [createInputContext, createInputScope] = createContextScope(INPUT_NAME, []);\n\ntype InputContextValue = {\n id: string;\n descriptionId: string;\n errorMessageId: string;\n validationValence: Valence;\n};\n\nconst [InputProvider, useInputContext] = createInputContext<InputContextValue>(INPUT_NAME);\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, createInputScope, useInputContext, INPUT_NAME };\n\nexport type { Valence, InputRootProps, InputScopedProps };\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { CodeInput, getSegmentCssWidth } from 'rci';\nimport React, { type ComponentProps, type ComponentPropsWithRef, type RefObject, forwardRef, useCallback } from 'react';\n\nimport { useForwardedRef, useIsFocused } from '@dxos/react-hooks';\n\nimport { INPUT_NAME, type InputScopedProps, type Valence, useInputContext } from './Root';\n\ntype PinInputProps = Omit<\n ComponentPropsWithRef<typeof CodeInput>,\n 'id' | 'className' | 'inputRef' | 'renderSegment'\n> & {\n inputClassName?: string;\n segmentClassName?: (styleProps: { focused: boolean; validationValence: Valence }) => string;\n segmentPadding?: string;\n segmentHeight?: string;\n};\n\nconst PinInput = forwardRef<HTMLInputElement, PinInputProps>(\n (\n {\n __inputScope,\n segmentClassName,\n inputClassName,\n segmentPadding = '8px',\n segmentHeight = '100%',\n ...props\n }: InputScopedProps<PinInputProps>,\n forwardedRef,\n ) => {\n const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);\n const width = getSegmentCssWidth(segmentPadding);\n const inputRef = useForwardedRef(forwardedRef);\n const inputFocused = useIsFocused(inputRef);\n\n const renderSegment = useCallback<ComponentProps<typeof CodeInput>['renderSegment']>(\n ({ state, index }) => (\n <div\n key={index}\n className={segmentClassName?.({\n focused: !!(inputFocused && state),\n validationValence,\n })}\n data-state={state}\n style={{ width, height: segmentHeight }}\n />\n ),\n [segmentClassName, inputFocused, validationValence],\n );\n\n return (\n <CodeInput\n {...{\n padding: '8px',\n spacing: '8px',\n fontFamily: '',\n spellCheck: false,\n length: 6,\n ...props,\n id,\n 'aria-describedby': descriptionId,\n ...(validationValence === 'error' && {\n 'aria-invalid': 'true' as const,\n 'aria-errormessage': errorMessageId,\n }),\n inputRef: inputRef as RefObject<HTMLInputElement>,\n renderSegment,\n className: inputClassName,\n }}\n />\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 './Root';\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 './Root';\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"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,iBAAiB;AAC1B,SAASC,YAAY;AACrB,OAAOC,UAAqCC,kBAAkB;;;ACF9D,SAAqBC,0BAA0B;AAC/C,OAAOC,WAAuC;AAE9C,SAASC,aAAa;AAEtB,IAAMC,aAAa;AAanB,IAAM,CAACC,oBAAoBC,gBAAAA,
|
|
6
|
-
"names": ["Primitive", "Slot", "React", "forwardRef", "createContextScope", "React", "useId", "INPUT_NAME", "createInputContext", "createInputScope", "
|
|
4
|
+
"sourcesContent": ["//\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 './Root';\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 { Label, Validation, Description, DescriptionAndValidation, ErrorMessage };\n\nexport type { LabelProps, ValidationProps, DescriptionProps, DescriptionAndValidationProps, ErrorMessageProps };\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Scope, createContextScope } from '@radix-ui/react-context';\nimport React, { type PropsWithChildren } from 'react';\n\nimport { useId } from '@dxos/react-hooks';\n\nconst INPUT_NAME = 'Input';\n\ntype Valence = 'success' | 'info' | 'warning' | 'error' | 'neutral';\n\ntype InputScopedProps<P> = P & { __inputScope?: Scope };\n\ntype InputRootProps = PropsWithChildren<{\n id?: string;\n validationValence?: Valence;\n descriptionId?: string;\n errorMessageId?: string;\n}>;\n\nconst [createInputContext, createInputScope] = createContextScope(INPUT_NAME, []);\n\ntype InputContextValue = {\n id: string;\n descriptionId: string;\n errorMessageId: string;\n validationValence: Valence;\n};\n\nconst [InputProvider, useInputContext] = createInputContext<InputContextValue>(INPUT_NAME);\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, createInputScope, useInputContext, INPUT_NAME };\n\nexport type { Valence, InputRootProps, InputScopedProps };\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 './Root';\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 './Root';\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 './Root';\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"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,iBAAiB;AAC1B,SAASC,YAAY;AACrB,OAAOC,UAAqCC,kBAAkB;;;ACF9D,SAAqBC,0BAA0B;AAC/C,OAAOC,WAAuC;AAE9C,SAASC,aAAa;AAEtB,IAAMC,aAAa;AAanB,IAAM,CAACC,oBAAoBC,gBAAAA,IAAoBL,mBAAmBG,YAAY,CAAA,CAAE;AAShF,IAAM,CAACG,eAAeC,eAAAA,IAAmBH,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U;AAC7B,UAAMC,WAAW,CAAC,EAAE7E,gBAAgB4E,UAAUd;AAC9C,WACE,gBAAAC,OAAA,cAACC,OAAAA;MAAIZ,KAAKwB;MAAO/F,WAAWE;MAAmB,GAAI8F,YAAY;QAAE,gBAAgB;MAAG;MAAIC,eAAY;OACjG3D,IAAAA;EAGP,CAAA,CAAA;AAGN,CAAA;;;ACzMF,SAAS4D,aAAAA,kBAAiB;AAC1B,OAAOC,UAAqCC,cAAAA,mBAAkB;AAM9D,IAAMC,YAAYC,gBAAAA,YAChB,CAAC,EAAEC,cAAc,GAAGC,MAAAA,GAA2CC,iBAAAA;AAC7D,QAAM,EAAEC,IAAIC,mBAAmBC,eAAeC,eAAc,IAAKC,gBAAgBC,YAAYR,YAAAA;AAC7F,SACE,gBAAAS,OAAA,cAACC,WAAUC,OACL;IACF,GAAGV;IACHE;IACA,oBAAoBE;IACpB,GAAID,sBAAsB,WAAW;MACnC,gBAAgB;MAChB,qBAAqBE;IACvB;IACAM,KAAKV;EACP,CAAA;AAGN,CAAA;;;ACxBF,OAAOW,UAAqCC,cAAAA,mBAAkB;AAM9D,IAAMC,WAAWC,gBAAAA,YACf,CAAC,EAAEC,cAAc,GAAGC,MAAAA,GAA0CC,iBAAAA;AAC5D,QAAM,EAAEC,IAAIC,mBAAmBC,eAAeC,eAAc,IAAKC,gBAAgBC,YAAYR,YAAAA;AAC7F,SACE,gBAAAS,OAAA,cAACC,YACK;IACF,GAAGT;IACHE;IACA,oBAAoBE;IACpB,GAAID,sBAAsB,WAAW;MACnC,gBAAgB;MAChB,qBAAqBE;IACvB;IACAK,KAAKT;EACP,CAAA;AAGN,CAAA;",
|
|
6
|
+
"names": ["Primitive", "Slot", "React", "forwardRef", "createContextScope", "React", "useId", "INPUT_NAME", "createInputContext", "createInputScope", "InputProvider", "useInputContext", "InputRoot", "__inputScope", "id", "propsId", "descriptionId", "propsDescriptionId", "errorMessageId", "propsErrorMessageId", "validationValence", "children", "scope", "displayName", "Label", "forwardRef", "__inputScope", "asChild", "children", "props", "forwardedRef", "id", "useInputContext", "INPUT_NAME", "Comp", "Slot", "Primitive", "label", "React", "htmlFor", "ref", "Description", "descriptionId", "validationValence", "span", "ErrorMessage", "errorMessageId", "Validation", "otherProps", "DescriptionAndValidation", "p", "React", "forwardRef", "useCallback", "useEffect", "useMemo", "useState", "useForwardedRef", "useIsFocused", "PinInput", "forwardRef", "__inputScope", "className", "disabled", "segmentClassName", "length", "pattern", "value", "controlledValue", "onChange", "onPaste", "props", "forwardedRef", "id", "validationValence", "descriptionId", "errorMessageId", "useInputContext", "INPUT_NAME", "inputRef", "useForwardedRef", "inputFocused", "useIsFocused", "internalValue", "setInternalValue", "useState", "cursorPosition", "setCursorPosition", "String", "charPattern", "useMemo", "undefined", "base", "replace", "RegExp", "filterValue", "useCallback", "input", "split", "filter", "char", "test", "join", "syncCursor", "pos", "current", "selectionStart", "Math", "min", "useEffect", "prev", "handleChange", "event", "newValue", "target", "slice", "handlePaste", "defaultPrevented", "preventDefault", "pasted", "clipboardData", "getData", "nativeInputValueSetter", "Object", "getOwnPropertyDescriptor", "HTMLInputElement", "prototype", "set", "call", "dispatchEvent", "Event", "bubbles", "handleKeyDown", "key", "requestAnimationFrame", "metaKey", "ctrlKey", "altKey", "onKeyDown", "newPos", "setSelectionRange", "currentTarget", "handleSelect", "activeIndex", "React", "div", "ref", "type", "onSelect", "maxLength", "spellCheck", "aria-describedby", "style", "caretColor", "Array", "from", "_", "index", "isCursor", "aria-hidden", "Primitive", "React", "forwardRef", "TextInput", "forwardRef", "__inputScope", "props", "forwardedRef", "id", "validationValence", "descriptionId", "errorMessageId", "useInputContext", "INPUT_NAME", "React", "Primitive", "input", "ref", "React", "forwardRef", "TextArea", "forwardRef", "__inputScope", "props", "forwardedRef", "id", "validationValence", "descriptionId", "errorMessageId", "useInputContext", "INPUT_NAME", "React", "textarea", "ref"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/Root.tsx":{"bytes":
|
|
1
|
+
{"inputs":{"src/Root.tsx":{"bytes":4510,"imports":[{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true}],"format":"esm"},"src/InputMeta.tsx":{"bytes":9992,"imports":[{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/Root.tsx","kind":"import-statement","original":"./Root"}],"format":"esm"},"src/PinInput.tsx":{"bytes":23950,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"src/Root.tsx","kind":"import-statement","original":"./Root"}],"format":"esm"},"src/TextInput.tsx":{"bytes":3107,"imports":[{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"src/Root.tsx","kind":"import-statement","original":"./Root"}],"format":"esm"},"src/TextArea.tsx":{"bytes":2873,"imports":[{"path":"react","kind":"import-statement","external":true},{"path":"src/Root.tsx","kind":"import-statement","original":"./Root"}],"format":"esm"},"src/index.ts":{"bytes":726,"imports":[{"path":"src/InputMeta.tsx","kind":"import-statement","original":"./InputMeta"},{"path":"src/Root.tsx","kind":"import-statement","original":"./Root"},{"path":"src/PinInput.tsx","kind":"import-statement","original":"./PinInput"},{"path":"src/TextInput.tsx","kind":"import-statement","original":"./TextInput"},{"path":"src/TextArea.tsx","kind":"import-statement","original":"./TextArea"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":23680},"dist/lib/browser/index.mjs":{"imports":[{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["Description","DescriptionAndValidation","ErrorMessage","INPUT_NAME","InputRoot","Label","PinInput","TextArea","TextInput","Validation","createInputScope","useInputContext"],"entryPoint":"src/index.ts","inputs":{"src/InputMeta.tsx":{"bytesInOutput":2282},"src/Root.tsx":{"bytesInOutput":875},"src/index.ts":{"bytesInOutput":0},"src/PinInput.tsx":{"bytesInOutput":5220},"src/TextInput.tsx":{"bytesInOutput":610},"src/TextArea.tsx":{"bytesInOutput":534}},"bytes":9876}}}
|