@dxos/react-input 0.8.1 → 0.8.2-main.10c050d
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/browser/index.mjs +161 -111
- package/dist/lib/browser/index.mjs.map +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +161 -111
- package/dist/lib/node/index.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +161 -111
- package/dist/lib/node-esm/index.mjs.map +1 -1
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// packages/ui/primitives/react-input/src/InputMeta.tsx
|
|
2
|
+
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
2
3
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
3
4
|
import { Slot } from "@radix-ui/react-slot";
|
|
4
5
|
import React2, { forwardRef } from "react";
|
|
5
6
|
|
|
6
7
|
// packages/ui/primitives/react-input/src/Root.tsx
|
|
8
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
7
9
|
import { createContextScope } from "@radix-ui/react-context";
|
|
8
10
|
import React from "react";
|
|
9
11
|
import { useId } from "@dxos/react-hooks";
|
|
@@ -11,152 +13,200 @@ var INPUT_NAME = "Input";
|
|
|
11
13
|
var [createInputContext, createInputScope] = createContextScope(INPUT_NAME, []);
|
|
12
14
|
var [InputProvider, useInputContext] = createInputContext(INPUT_NAME);
|
|
13
15
|
var InputRoot = ({ __inputScope, id: propsId, descriptionId: propsDescriptionId, errorMessageId: propsErrorMessageId, validationValence = "neutral", children }) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
var _effect = _useSignals();
|
|
17
|
+
try {
|
|
18
|
+
const id = useId("input", propsId);
|
|
19
|
+
const descriptionId = useId("input__description", propsDescriptionId);
|
|
20
|
+
const errorMessageId = useId("input__error-message", propsErrorMessageId);
|
|
21
|
+
return /* @__PURE__ */ React.createElement(InputProvider, {
|
|
22
|
+
id,
|
|
23
|
+
descriptionId,
|
|
24
|
+
errorMessageId,
|
|
25
|
+
validationValence,
|
|
26
|
+
scope: __inputScope
|
|
27
|
+
}, children);
|
|
28
|
+
} finally {
|
|
29
|
+
_effect.f();
|
|
30
|
+
}
|
|
24
31
|
};
|
|
25
32
|
InputRoot.displayName = INPUT_NAME;
|
|
26
33
|
|
|
27
34
|
// packages/ui/primitives/react-input/src/InputMeta.tsx
|
|
28
35
|
var Label = /* @__PURE__ */ forwardRef(({ __inputScope, asChild, children, ...props }, forwardedRef) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
var _effect = _useSignals2();
|
|
37
|
+
try {
|
|
38
|
+
const { id } = useInputContext(INPUT_NAME, __inputScope);
|
|
39
|
+
const Root = asChild ? Slot : Primitive.label;
|
|
40
|
+
return /* @__PURE__ */ React2.createElement(Root, {
|
|
41
|
+
...props,
|
|
42
|
+
htmlFor: id,
|
|
43
|
+
ref: forwardedRef
|
|
44
|
+
}, children);
|
|
45
|
+
} finally {
|
|
46
|
+
_effect.f();
|
|
47
|
+
}
|
|
36
48
|
});
|
|
37
49
|
var Description = /* @__PURE__ */ forwardRef(({ __inputScope, asChild, children, ...props }, forwardedRef) => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
id: descriptionId
|
|
44
|
-
},
|
|
45
|
-
ref: forwardedRef
|
|
46
|
-
}, children);
|
|
47
|
-
});
|
|
48
|
-
var ErrorMessage = /* @__PURE__ */ forwardRef(({ __inputScope, asChild, children, ...props }, forwardedRef) => {
|
|
49
|
-
const { errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
50
|
-
const Root = asChild ? Slot : Primitive.span;
|
|
51
|
-
return /* @__PURE__ */ React2.createElement(Root, {
|
|
52
|
-
...props,
|
|
53
|
-
id: errorMessageId,
|
|
54
|
-
ref: forwardedRef
|
|
55
|
-
}, children);
|
|
56
|
-
});
|
|
57
|
-
var Validation = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
|
|
58
|
-
const { __inputScope, asChild, children, ...otherProps } = props;
|
|
59
|
-
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
60
|
-
if (validationValence === "error") {
|
|
61
|
-
return /* @__PURE__ */ React2.createElement(ErrorMessage, {
|
|
50
|
+
var _effect = _useSignals2();
|
|
51
|
+
try {
|
|
52
|
+
const { descriptionId, validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
53
|
+
const Root = asChild ? Slot : Primitive.span;
|
|
54
|
+
return /* @__PURE__ */ React2.createElement(Root, {
|
|
62
55
|
...props,
|
|
56
|
+
...validationValence === "error" && {
|
|
57
|
+
id: descriptionId
|
|
58
|
+
},
|
|
63
59
|
ref: forwardedRef
|
|
64
|
-
});
|
|
65
|
-
}
|
|
60
|
+
}, children);
|
|
61
|
+
} finally {
|
|
62
|
+
_effect.f();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
var ErrorMessage = /* @__PURE__ */ forwardRef(({ __inputScope, asChild, children, ...props }, forwardedRef) => {
|
|
66
|
+
var _effect = _useSignals2();
|
|
67
|
+
try {
|
|
68
|
+
const { errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
66
69
|
const Root = asChild ? Slot : Primitive.span;
|
|
67
70
|
return /* @__PURE__ */ React2.createElement(Root, {
|
|
68
|
-
...
|
|
71
|
+
...props,
|
|
72
|
+
id: errorMessageId,
|
|
69
73
|
ref: forwardedRef
|
|
70
74
|
}, children);
|
|
75
|
+
} finally {
|
|
76
|
+
_effect.f();
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
var Validation = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
|
|
80
|
+
var _effect = _useSignals2();
|
|
81
|
+
try {
|
|
82
|
+
const { __inputScope, asChild, children, ...otherProps } = props;
|
|
83
|
+
const { validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
84
|
+
if (validationValence === "error") {
|
|
85
|
+
return /* @__PURE__ */ React2.createElement(ErrorMessage, {
|
|
86
|
+
...props,
|
|
87
|
+
ref: forwardedRef
|
|
88
|
+
});
|
|
89
|
+
} else {
|
|
90
|
+
const Root = asChild ? Slot : Primitive.span;
|
|
91
|
+
return /* @__PURE__ */ React2.createElement(Root, {
|
|
92
|
+
...otherProps,
|
|
93
|
+
ref: forwardedRef
|
|
94
|
+
}, children);
|
|
95
|
+
}
|
|
96
|
+
} finally {
|
|
97
|
+
_effect.f();
|
|
71
98
|
}
|
|
72
99
|
});
|
|
73
100
|
var DescriptionAndValidation = /* @__PURE__ */ forwardRef(({ __inputScope, asChild, children, ...props }, forwardedRef) => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
101
|
+
var _effect = _useSignals2();
|
|
102
|
+
try {
|
|
103
|
+
const { descriptionId, validationValence } = useInputContext(INPUT_NAME, __inputScope);
|
|
104
|
+
const Root = asChild ? Slot : Primitive.p;
|
|
105
|
+
return /* @__PURE__ */ React2.createElement(Root, {
|
|
106
|
+
...props,
|
|
107
|
+
...validationValence !== "error" && {
|
|
108
|
+
id: descriptionId
|
|
109
|
+
},
|
|
110
|
+
ref: forwardedRef
|
|
111
|
+
}, children);
|
|
112
|
+
} finally {
|
|
113
|
+
_effect.f();
|
|
114
|
+
}
|
|
83
115
|
});
|
|
84
116
|
|
|
85
117
|
// packages/ui/primitives/react-input/src/PinInput.tsx
|
|
118
|
+
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
86
119
|
import { CodeInput, getSegmentCssWidth } from "rci";
|
|
87
120
|
import React3, { forwardRef as forwardRef2, useCallback } from "react";
|
|
88
121
|
import { useForwardedRef, useIsFocused } from "@dxos/react-hooks";
|
|
89
122
|
var PinInput = /* @__PURE__ */ forwardRef2(({ __inputScope, segmentClassName, inputClassName, segmentPadding = "8px", segmentHeight = "100%", ...props }, forwardedRef) => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
123
|
+
var _effect = _useSignals3();
|
|
124
|
+
try {
|
|
125
|
+
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
126
|
+
const width = getSegmentCssWidth(segmentPadding);
|
|
127
|
+
const inputRef = useForwardedRef(forwardedRef);
|
|
128
|
+
const inputFocused = useIsFocused(inputRef);
|
|
129
|
+
const renderSegment = useCallback(({ state, index }) => /* @__PURE__ */ React3.createElement("div", {
|
|
130
|
+
key: index,
|
|
131
|
+
className: segmentClassName?.({
|
|
132
|
+
focused: !!(inputFocused && state),
|
|
133
|
+
validationValence
|
|
134
|
+
}),
|
|
135
|
+
"data-state": state,
|
|
136
|
+
style: {
|
|
137
|
+
width,
|
|
138
|
+
height: segmentHeight
|
|
139
|
+
}
|
|
140
|
+
}), [
|
|
141
|
+
segmentClassName,
|
|
142
|
+
inputFocused,
|
|
98
143
|
validationValence
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
"aria-invalid": "true",
|
|
121
|
-
"aria-errormessage": errorMessageId
|
|
122
|
-
},
|
|
123
|
-
inputRef,
|
|
124
|
-
renderSegment,
|
|
125
|
-
className: inputClassName
|
|
126
|
-
});
|
|
144
|
+
]);
|
|
145
|
+
return /* @__PURE__ */ React3.createElement(CodeInput, {
|
|
146
|
+
padding: "8px",
|
|
147
|
+
spacing: "8px",
|
|
148
|
+
fontFamily: "",
|
|
149
|
+
spellCheck: false,
|
|
150
|
+
length: 6,
|
|
151
|
+
...props,
|
|
152
|
+
id,
|
|
153
|
+
"aria-describedby": descriptionId,
|
|
154
|
+
...validationValence === "error" && {
|
|
155
|
+
"aria-invalid": "true",
|
|
156
|
+
"aria-errormessage": errorMessageId
|
|
157
|
+
},
|
|
158
|
+
inputRef,
|
|
159
|
+
renderSegment,
|
|
160
|
+
className: inputClassName
|
|
161
|
+
});
|
|
162
|
+
} finally {
|
|
163
|
+
_effect.f();
|
|
164
|
+
}
|
|
127
165
|
});
|
|
128
166
|
|
|
129
167
|
// packages/ui/primitives/react-input/src/TextInput.tsx
|
|
168
|
+
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
130
169
|
import { Primitive as Primitive2 } from "@radix-ui/react-primitive";
|
|
131
170
|
import React4, { forwardRef as forwardRef3 } from "react";
|
|
132
171
|
var TextInput = /* @__PURE__ */ forwardRef3(({ __inputScope, ...props }, forwardedRef) => {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
"aria-
|
|
140
|
-
"
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
172
|
+
var _effect = _useSignals4();
|
|
173
|
+
try {
|
|
174
|
+
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
175
|
+
return /* @__PURE__ */ React4.createElement(Primitive2.input, {
|
|
176
|
+
...props,
|
|
177
|
+
id,
|
|
178
|
+
"aria-describedby": descriptionId,
|
|
179
|
+
...validationValence === "error" && {
|
|
180
|
+
"aria-invalid": "true",
|
|
181
|
+
"aria-errormessage": errorMessageId
|
|
182
|
+
},
|
|
183
|
+
ref: forwardedRef
|
|
184
|
+
});
|
|
185
|
+
} finally {
|
|
186
|
+
_effect.f();
|
|
187
|
+
}
|
|
144
188
|
});
|
|
145
189
|
|
|
146
190
|
// packages/ui/primitives/react-input/src/TextArea.tsx
|
|
191
|
+
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
147
192
|
import React5, { forwardRef as forwardRef4 } from "react";
|
|
148
193
|
var TextArea = /* @__PURE__ */ forwardRef4(({ __inputScope, ...props }, forwardedRef) => {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
"aria-
|
|
156
|
-
"
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
194
|
+
var _effect = _useSignals5();
|
|
195
|
+
try {
|
|
196
|
+
const { id, validationValence, descriptionId, errorMessageId } = useInputContext(INPUT_NAME, __inputScope);
|
|
197
|
+
return /* @__PURE__ */ React5.createElement("textarea", {
|
|
198
|
+
...props,
|
|
199
|
+
id,
|
|
200
|
+
"aria-describedby": descriptionId,
|
|
201
|
+
...validationValence === "error" && {
|
|
202
|
+
"aria-invalid": "true",
|
|
203
|
+
"aria-errormessage": errorMessageId
|
|
204
|
+
},
|
|
205
|
+
ref: forwardedRef
|
|
206
|
+
});
|
|
207
|
+
} finally {
|
|
208
|
+
_effect.f();
|
|
209
|
+
}
|
|
160
210
|
});
|
|
161
211
|
export {
|
|
162
212
|
Description,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/InputMeta.tsx", "../../../src/Root.tsx", "../../../src/PinInput.tsx", "../../../src/TextInput.tsx", "../../../src/TextArea.tsx"],
|
|
4
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 { createContextScope, type Scope } 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, InputRoot as Root, 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, forwardRef, useCallback } from 'react';\n\nimport { useForwardedRef, useIsFocused } from '@dxos/react-hooks';\n\nimport { INPUT_NAME, type InputScopedProps, useInputContext, type Valence } 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,\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": "
|
|
5
|
+
"mappings": ";;AAIA,SAASA,iBAAiB;AAC1B,SAASC,YAAY;AACrB,OAAOC,U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C,gBAAgB;QAChB,qBAAqBE;MACvB;MACAM,KAAKV;IACP,CAAA;;;;AAGN,CAAA;;;;ACxBF,OAAOW,UAAqCC,cAAAA,mBAAkB;AAM9D,IAAMC,WAAWC,gBAAAA,YACf,CAAC,EAAEC,cAAc,GAAGC,MAAAA,GAA0CC,iBAAAA;;;AAC5D,UAAM,EAAEC,IAAIC,mBAAmBC,eAAeC,eAAc,IAAKC,gBAAgBC,YAAYR,YAAAA;AAC7F,WACE,gBAAAS,OAAA,cAACC,YACK;MACF,GAAGT;MACHE;MACA,oBAAoBE;MACpB,GAAID,sBAAsB,WAAW;QACnC,gBAAgB;QAChB,qBAAqBE;MACvB;MACAK,KAAKT;IACP,CAAA;;;;AAGN,CAAA;",
|
|
6
6
|
"names": ["Primitive", "Slot", "React", "forwardRef", "createContextScope", "React", "useId", "INPUT_NAME", "createInputContext", "createInputScope", "createContextScope", "InputProvider", "useInputContext", "InputRoot", "__inputScope", "id", "propsId", "descriptionId", "propsDescriptionId", "errorMessageId", "propsErrorMessageId", "validationValence", "children", "useId", "scope", "displayName", "Label", "forwardRef", "__inputScope", "asChild", "children", "props", "forwardedRef", "id", "useInputContext", "INPUT_NAME", "Root", "Slot", "Primitive", "label", "React", "htmlFor", "ref", "Description", "descriptionId", "validationValence", "span", "ErrorMessage", "errorMessageId", "Validation", "otherProps", "DescriptionAndValidation", "p", "CodeInput", "getSegmentCssWidth", "React", "forwardRef", "useCallback", "useForwardedRef", "useIsFocused", "PinInput", "forwardRef", "__inputScope", "segmentClassName", "inputClassName", "segmentPadding", "segmentHeight", "props", "forwardedRef", "id", "validationValence", "descriptionId", "errorMessageId", "useInputContext", "INPUT_NAME", "width", "getSegmentCssWidth", "inputRef", "useForwardedRef", "inputFocused", "useIsFocused", "renderSegment", "useCallback", "state", "index", "React", "div", "key", "className", "focused", "data-state", "style", "height", "CodeInput", "padding", "spacing", "fontFamily", "spellCheck", "length", "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":{"packages/ui/primitives/react-input/src/Root.tsx":{"bytes":
|
|
1
|
+
{"inputs":{"packages/ui/primitives/react-input/src/Root.tsx":{"bytes":4897,"imports":[{"path":"@preact-signals/safe-react/tracking","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}],"format":"esm"},"packages/ui/primitives/react-input/src/InputMeta.tsx":{"bytes":10829,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"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":"packages/ui/primitives/react-input/src/Root.tsx","kind":"import-statement","original":"./Root"}],"format":"esm"},"packages/ui/primitives/react-input/src/PinInput.tsx":{"bytes":7337,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"rci","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"packages/ui/primitives/react-input/src/Root.tsx","kind":"import-statement","original":"./Root"}],"format":"esm"},"packages/ui/primitives/react-input/src/TextInput.tsx":{"bytes":3432,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/primitives/react-input/src/Root.tsx","kind":"import-statement","original":"./Root"}],"format":"esm"},"packages/ui/primitives/react-input/src/TextArea.tsx":{"bytes":3197,"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"packages/ui/primitives/react-input/src/Root.tsx","kind":"import-statement","original":"./Root"}],"format":"esm"},"packages/ui/primitives/react-input/src/index.ts":{"bytes":824,"imports":[{"path":"packages/ui/primitives/react-input/src/InputMeta.tsx","kind":"import-statement","original":"./InputMeta"},{"path":"packages/ui/primitives/react-input/src/Root.tsx","kind":"import-statement","original":"./Root"},{"path":"packages/ui/primitives/react-input/src/PinInput.tsx","kind":"import-statement","original":"./PinInput"},{"path":"packages/ui/primitives/react-input/src/TextInput.tsx","kind":"import-statement","original":"./TextInput"},{"path":"packages/ui/primitives/react-input/src/TextArea.tsx","kind":"import-statement","original":"./TextArea"}],"format":"esm"}},"outputs":{"packages/ui/primitives/react-input/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15057},"packages/ui/primitives/react-input/dist/lib/browser/index.mjs":{"imports":[{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"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":"@preact-signals/safe-react/tracking","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":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"rci","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@preact-signals/safe-react/tracking","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["Description","DescriptionAndValidation","ErrorMessage","INPUT_NAME","InputRoot","Label","PinInput","Root","TextArea","TextInput","Validation","createInputScope","useInputContext"],"entryPoint":"packages/ui/primitives/react-input/src/index.ts","inputs":{"packages/ui/primitives/react-input/src/InputMeta.tsx":{"bytesInOutput":2831},"packages/ui/primitives/react-input/src/Root.tsx":{"bytesInOutput":1050},"packages/ui/primitives/react-input/src/index.ts":{"bytesInOutput":0},"packages/ui/primitives/react-input/src/PinInput.tsx":{"bytesInOutput":1658},"packages/ui/primitives/react-input/src/TextInput.tsx":{"bytesInOutput":789},"packages/ui/primitives/react-input/src/TextArea.tsx":{"bytesInOutput":713}},"bytes":7627}}}
|