@sprawlify/react 0.0.5 → 0.0.7
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/{collapsible-C5ZpjCRe.mjs → collapsible-B06GGGE7.mjs} +7 -4
- package/dist/{collapsible-D_cXuaRy.cjs → collapsible-D5kle6Bc.cjs} +12 -9
- package/dist/collection-BKabYqpE.cjs +229 -0
- package/dist/collection-DEsp9z6X.mjs +187 -0
- package/dist/components/accordion/index.cjs +19 -24
- package/dist/components/accordion/index.d.cts +11 -9
- package/dist/components/accordion/index.d.mts +11 -9
- package/dist/components/accordion/index.mjs +9 -14
- package/dist/components/angle-slider/index.cjs +12 -9
- package/dist/components/angle-slider/index.d.cts +13 -11
- package/dist/components/angle-slider/index.d.mts +13 -11
- package/dist/components/angle-slider/index.mjs +7 -4
- package/dist/components/avatar/index.cjs +128 -0
- package/dist/components/avatar/index.d.cts +49 -0
- package/dist/components/avatar/index.d.mts +49 -0
- package/dist/components/avatar/index.mjs +110 -0
- package/dist/components/bottom-sheet/index.cjs +213 -0
- package/dist/components/bottom-sheet/index.d.cts +80 -0
- package/dist/components/bottom-sheet/index.d.mts +81 -0
- package/dist/components/bottom-sheet/index.mjs +190 -0
- package/dist/components/carousel/index.cjs +263 -0
- package/dist/components/carousel/index.d.cts +95 -0
- package/dist/components/carousel/index.d.mts +95 -0
- package/dist/components/carousel/index.mjs +242 -0
- package/dist/components/checkbox/index.cjs +308 -0
- package/dist/components/checkbox/index.d.cts +115 -0
- package/dist/components/checkbox/index.d.mts +115 -0
- package/dist/components/checkbox/index.mjs +289 -0
- package/dist/components/client-only/index.cjs +14 -0
- package/dist/components/client-only/index.d.cts +8 -0
- package/dist/components/client-only/index.d.mts +8 -0
- package/dist/components/client-only/index.mjs +13 -0
- package/dist/components/clipboard/index.cjs +185 -0
- package/dist/components/clipboard/index.d.cts +71 -0
- package/dist/components/clipboard/index.d.mts +71 -0
- package/dist/components/clipboard/index.mjs +163 -0
- package/dist/components/collapsible/index.cjs +6 -3
- package/dist/components/collapsible/index.d.cts +10 -8
- package/dist/components/collapsible/index.d.mts +10 -8
- package/dist/components/collapsible/index.mjs +6 -3
- package/dist/components/collection/index.cjs +11 -0
- package/dist/components/collection/index.d.cts +2 -0
- package/dist/components/collection/index.d.mts +2 -0
- package/dist/components/collection/index.mjs +5 -0
- package/dist/components/color-picker/index.cjs +613 -0
- package/dist/components/color-picker/index.d.cts +181 -0
- package/dist/components/color-picker/index.d.mts +182 -0
- package/dist/components/color-picker/index.mjs +570 -0
- package/dist/components/combobox/index.cjs +416 -0
- package/dist/components/combobox/index.d.cts +132 -0
- package/dist/components/combobox/index.d.mts +133 -0
- package/dist/components/combobox/index.mjs +387 -0
- package/dist/components/field/index.cjs +27 -0
- package/dist/components/field/index.d.cts +116 -0
- package/dist/components/field/index.d.mts +116 -0
- package/dist/components/field/index.mjs +9 -0
- package/dist/components/fieldset/index.cjs +23 -0
- package/dist/components/fieldset/index.d.cts +73 -0
- package/dist/components/fieldset/index.d.mts +73 -0
- package/dist/components/fieldset/index.mjs +9 -0
- package/dist/components/highlight/index.cjs +32 -0
- package/dist/components/highlight/index.d.cts +14 -0
- package/dist/components/highlight/index.d.mts +14 -0
- package/dist/components/highlight/index.mjs +30 -0
- package/dist/components/portal/index.cjs +32 -0
- package/dist/components/portal/index.d.cts +11 -0
- package/dist/components/portal/index.d.mts +11 -0
- package/dist/components/portal/index.mjs +31 -0
- package/dist/components/presence/index.cjs +11 -0
- package/dist/components/presence/index.d.cts +2 -0
- package/dist/components/presence/index.d.mts +4 -0
- package/dist/components/presence/index.mjs +7 -0
- package/dist/components/select/index.cjs +419 -0
- package/dist/components/select/index.d.cts +132 -0
- package/dist/components/select/index.d.mts +133 -0
- package/dist/components/select/index.mjs +384 -0
- package/dist/{factory-DbgGeb_e.mjs → core-C0F-4KYH.mjs} +4 -154
- package/dist/{factory-CfqPG186.cjs → core-CPLjF6nm.cjs} +0 -198
- package/dist/{create-context-DCEySQ7J.cjs → create-context-D6DyFRSf.cjs} +1 -1
- package/dist/environment-BXkWNF2O.mjs +46 -0
- package/dist/environment-DLPiALpf.cjs +58 -0
- package/dist/factory-BbbIuDqa.d.mts +15 -0
- package/dist/factory-CDX-oCN5.cjs +81 -0
- package/dist/factory-DQlmCPH2.mjs +63 -0
- package/dist/factory-DaNWFLLN.d.cts +15 -0
- package/dist/field-CGCTFCx2.mjs +322 -0
- package/dist/field-CXhpW6zO.cjs +404 -0
- package/dist/fieldset-CuSSYZxV.cjs +237 -0
- package/dist/fieldset-poJ8RDvB.mjs +184 -0
- package/dist/index-BUN9wyVM.d.mts +34 -0
- package/dist/index-Dhthtdz_.d.mts +74 -0
- package/dist/index-DqRXPiW_.d.cts +34 -0
- package/dist/index-DsZldSch.d.cts +74 -0
- package/dist/index-DtdZfcpz.d.mts +25 -0
- package/dist/index.cjs +14 -11
- package/dist/index.d.cts +7 -5
- package/dist/index.d.mts +7 -5
- package/dist/index.mjs +6 -3
- package/dist/normalize-props-sqcs77GC.d.cts +13 -0
- package/dist/presence-2A4loEJY.mjs +71 -0
- package/dist/presence-BX1tNsGA.cjs +101 -0
- package/dist/providers-Bk3ALTxZ.cjs +78 -0
- package/dist/providers-CyTYcOU1.mjs +54 -0
- package/dist/render-strategy-D3w8btTD.mjs +13 -0
- package/dist/render-strategy-k1JmEGnq.cjs +30 -0
- package/dist/types-DYWV3uAj.d.cts +5 -0
- package/dist/types-FLvjyw__.d.mts +5 -0
- package/dist/use-event-BcyNH29h.mjs +19 -0
- package/dist/use-event-CGMgV6xB.cjs +25 -0
- package/dist/use-safe-layout-effect-BlOhFUAp.mjs +17 -0
- package/dist/use-safe-layout-effect-vuYaDIpT.cjs +35 -0
- package/dist/utils/index.cjs +2 -2
- package/dist/utils/index.d.cts +1 -1
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.mjs +2 -2
- package/package.json +152 -2
- package/dist/factory-CNfD9NVO.d.mts +0 -41
- package/dist/factory-D5qarvEF.d.cts +0 -29
- /package/dist/{chunk-DJTHdtxa.mjs → chunk-DLP0tNsH.mjs} +0 -0
- /package/dist/{create-context-DLMHiig4.mjs → create-context-CdjrBhu7.mjs} +0 -0
- /package/dist/{create-split-props-DvwGh64U.mjs → create-split-props-BJQdOyld.mjs} +0 -0
- /package/dist/{create-split-props-CSaOnJRj.cjs → create-split-props-CSkzaUOy.cjs} +0 -0
- /package/dist/{index--Dciu8yd.d.mts → index-BwTxN5vG.d.mts} +0 -0
- /package/dist/{index-wpUGMM30.d.cts → index-zOmANnUL.d.cts} +0 -0
- /package/dist/{render-strategy-G1aEn-1X.d.cts → render-strategy-CdpAg9jb.d.cts} +0 -0
- /package/dist/{render-strategy-D37ixdTi.d.mts → render-strategy-GetMScNK.d.mts} +0 -0
- /package/dist/{utils-BQjTDAMH.mjs → utils-DflO0-3U.mjs} +0 -0
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { t as __export } from "./chunk-DLP0tNsH.mjs";
|
|
2
|
+
import { t as mergeProps$1 } from "./core-C0F-4KYH.mjs";
|
|
3
|
+
import { t as createContext$1 } from "./create-context-CdjrBhu7.mjs";
|
|
4
|
+
import { n as useEnvironmentContext } from "./environment-BXkWNF2O.mjs";
|
|
5
|
+
import { n as sprawlify, r as composeRefs } from "./factory-DQlmCPH2.mjs";
|
|
6
|
+
import { t as createSplitProps } from "./create-split-props-BJQdOyld.mjs";
|
|
7
|
+
import { r as useFieldsetContext, t as useSafeLayoutEffect } from "./use-safe-layout-effect-BlOhFUAp.mjs";
|
|
8
|
+
import { mergeProps } from "@sprawlify/primitives/core";
|
|
9
|
+
import { forwardRef, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
import { ariaAttr, dataAttr } from "@sprawlify/primitives/dom-query";
|
|
12
|
+
import { createAnatomy } from "@sprawlify/primitives/anatomy";
|
|
13
|
+
import { autoresizeTextarea } from "@sprawlify/primitives/auto-resize";
|
|
14
|
+
|
|
15
|
+
//#region src/components/field/use-field-context.ts
|
|
16
|
+
const [FieldProvider, useFieldContext] = createContext$1({
|
|
17
|
+
name: "FieldContext",
|
|
18
|
+
hookName: "useFieldContext",
|
|
19
|
+
providerName: "<FieldProvider />",
|
|
20
|
+
strict: false
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/components/field/field-context.tsx
|
|
25
|
+
const FieldContext = (props) => props.children(useFieldContext());
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/components/field/field-error-text.tsx
|
|
29
|
+
const FieldErrorText = forwardRef((props, ref) => {
|
|
30
|
+
const field = useFieldContext();
|
|
31
|
+
const mergedProps = mergeProps$1(field.getErrorTextProps(), props);
|
|
32
|
+
if (field?.invalid) return /* @__PURE__ */ jsx(sprawlify.span, {
|
|
33
|
+
...mergedProps,
|
|
34
|
+
ref
|
|
35
|
+
});
|
|
36
|
+
return null;
|
|
37
|
+
});
|
|
38
|
+
FieldErrorText.displayName = "FieldErrorText";
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/components/field/field-helper-text.tsx
|
|
42
|
+
const FieldHelperText = forwardRef((props, ref) => {
|
|
43
|
+
const mergedProps = mergeProps$1(useFieldContext()?.getHelperTextProps(), props);
|
|
44
|
+
return /* @__PURE__ */ jsx(sprawlify.span, {
|
|
45
|
+
...mergedProps,
|
|
46
|
+
ref
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
FieldHelperText.displayName = "FieldHelperText";
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/components/field/field-input.tsx
|
|
53
|
+
const FieldInput = forwardRef((props, ref) => {
|
|
54
|
+
const mergedProps = mergeProps$1(useFieldContext()?.getInputProps(), props);
|
|
55
|
+
return /* @__PURE__ */ jsx(sprawlify.input, {
|
|
56
|
+
...mergedProps,
|
|
57
|
+
ref
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
FieldInput.displayName = "FieldInput";
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/components/field/field-label.tsx
|
|
64
|
+
const FieldLabel = forwardRef((props, ref) => {
|
|
65
|
+
const mergedProps = mergeProps$1(useFieldContext()?.getLabelProps(), props);
|
|
66
|
+
return /* @__PURE__ */ jsx(sprawlify.label, {
|
|
67
|
+
...mergedProps,
|
|
68
|
+
ref
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
FieldLabel.displayName = "FieldLabel";
|
|
72
|
+
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/components/field/field-required-indicator.tsx
|
|
75
|
+
const FieldRequiredIndicator = forwardRef(({ fallback, ...props }, ref) => {
|
|
76
|
+
const field = useFieldContext();
|
|
77
|
+
if (!field.required) return fallback;
|
|
78
|
+
const mergedProps = mergeProps(field.getRequiredIndicatorProps(), props);
|
|
79
|
+
return /* @__PURE__ */ jsx(sprawlify.span, {
|
|
80
|
+
...mergedProps,
|
|
81
|
+
ref,
|
|
82
|
+
children: props.children ?? "*"
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
FieldRequiredIndicator.displayName = "FieldRequiredIndicator";
|
|
86
|
+
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/components/field/field-anatomy.ts
|
|
89
|
+
const fieldAnatomy = createAnatomy("field").parts("root", "errorText", "helperText", "input", "label", "select", "textarea", "requiredIndicator");
|
|
90
|
+
const parts = fieldAnatomy.build();
|
|
91
|
+
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/components/field/use-field.ts
|
|
94
|
+
const useField = (props = {}) => {
|
|
95
|
+
const fieldset = useFieldsetContext();
|
|
96
|
+
const env = useEnvironmentContext();
|
|
97
|
+
const { ids, disabled = Boolean(fieldset?.disabled), invalid = false, readOnly = false, required = false } = props;
|
|
98
|
+
const [hasErrorText, setHasErrorText] = useState(false);
|
|
99
|
+
const [hasHelperText, setHasHelperText] = useState(false);
|
|
100
|
+
const uid = useId();
|
|
101
|
+
const id = props.id ?? uid;
|
|
102
|
+
const rootRef = useRef(null);
|
|
103
|
+
const rootId = ids?.control ?? `field::${id}`;
|
|
104
|
+
const errorTextId = ids?.errorText ?? `field::${id}::error-text`;
|
|
105
|
+
const helperTextId = ids?.helperText ?? `field::${id}::helper-text`;
|
|
106
|
+
const labelId = ids?.label ?? `field::${id}::label`;
|
|
107
|
+
useSafeLayoutEffect(() => {
|
|
108
|
+
const rootNode = rootRef.current;
|
|
109
|
+
if (!rootNode) return;
|
|
110
|
+
const checkTextElements = () => {
|
|
111
|
+
const docOrShadowRoot = env.getRootNode();
|
|
112
|
+
setHasErrorText(!!docOrShadowRoot.getElementById(errorTextId));
|
|
113
|
+
setHasHelperText(!!docOrShadowRoot.getElementById(helperTextId));
|
|
114
|
+
};
|
|
115
|
+
checkTextElements();
|
|
116
|
+
const observer = new (env.getWindow()).MutationObserver(checkTextElements);
|
|
117
|
+
observer.observe(rootNode, {
|
|
118
|
+
childList: true,
|
|
119
|
+
subtree: true
|
|
120
|
+
});
|
|
121
|
+
return () => observer.disconnect();
|
|
122
|
+
}, [
|
|
123
|
+
env,
|
|
124
|
+
errorTextId,
|
|
125
|
+
helperTextId
|
|
126
|
+
]);
|
|
127
|
+
const labelIds = useMemo(() => {
|
|
128
|
+
const ids$1 = [];
|
|
129
|
+
if (hasErrorText && invalid) ids$1.push(errorTextId);
|
|
130
|
+
if (hasHelperText) ids$1.push(helperTextId);
|
|
131
|
+
return ids$1.join(" ") || void 0;
|
|
132
|
+
}, [
|
|
133
|
+
invalid,
|
|
134
|
+
errorTextId,
|
|
135
|
+
helperTextId,
|
|
136
|
+
hasErrorText,
|
|
137
|
+
hasHelperText
|
|
138
|
+
]);
|
|
139
|
+
const getRootProps = useMemo(() => () => ({
|
|
140
|
+
...parts.root.attrs,
|
|
141
|
+
id: rootId,
|
|
142
|
+
ref: rootRef,
|
|
143
|
+
role: "group",
|
|
144
|
+
"data-disabled": dataAttr(disabled),
|
|
145
|
+
"data-invalid": dataAttr(invalid),
|
|
146
|
+
"data-readonly": dataAttr(readOnly)
|
|
147
|
+
}), [
|
|
148
|
+
disabled,
|
|
149
|
+
invalid,
|
|
150
|
+
readOnly,
|
|
151
|
+
rootId
|
|
152
|
+
]);
|
|
153
|
+
const getLabelProps = useMemo(() => () => ({
|
|
154
|
+
...parts.label.attrs,
|
|
155
|
+
id: labelId,
|
|
156
|
+
"data-disabled": dataAttr(disabled),
|
|
157
|
+
"data-invalid": dataAttr(invalid),
|
|
158
|
+
"data-readonly": dataAttr(readOnly),
|
|
159
|
+
"data-required": dataAttr(required),
|
|
160
|
+
htmlFor: id
|
|
161
|
+
}), [
|
|
162
|
+
disabled,
|
|
163
|
+
invalid,
|
|
164
|
+
readOnly,
|
|
165
|
+
required,
|
|
166
|
+
id,
|
|
167
|
+
labelId
|
|
168
|
+
]);
|
|
169
|
+
const getControlProps = useMemo(() => () => ({
|
|
170
|
+
"aria-describedby": labelIds,
|
|
171
|
+
"aria-invalid": ariaAttr(invalid),
|
|
172
|
+
"data-invalid": dataAttr(invalid),
|
|
173
|
+
"data-required": dataAttr(required),
|
|
174
|
+
"data-readonly": dataAttr(readOnly),
|
|
175
|
+
id,
|
|
176
|
+
required,
|
|
177
|
+
disabled,
|
|
178
|
+
readOnly
|
|
179
|
+
}), [
|
|
180
|
+
labelIds,
|
|
181
|
+
invalid,
|
|
182
|
+
required,
|
|
183
|
+
readOnly,
|
|
184
|
+
id,
|
|
185
|
+
disabled
|
|
186
|
+
]);
|
|
187
|
+
const getInputProps = useMemo(() => () => ({
|
|
188
|
+
...getControlProps(),
|
|
189
|
+
...parts.input.attrs
|
|
190
|
+
}), [getControlProps]);
|
|
191
|
+
const getTextareaProps = useMemo(() => () => ({
|
|
192
|
+
...getControlProps(),
|
|
193
|
+
...parts.textarea.attrs
|
|
194
|
+
}), [getControlProps]);
|
|
195
|
+
const getSelectProps = useMemo(() => () => ({
|
|
196
|
+
...getControlProps(),
|
|
197
|
+
...parts.select.attrs
|
|
198
|
+
}), [getControlProps]);
|
|
199
|
+
const getHelperTextProps = useMemo(() => () => ({
|
|
200
|
+
id: helperTextId,
|
|
201
|
+
...parts.helperText.attrs,
|
|
202
|
+
"data-disabled": dataAttr(disabled)
|
|
203
|
+
}), [disabled, helperTextId]);
|
|
204
|
+
const getErrorTextProps = useMemo(() => () => ({
|
|
205
|
+
id: errorTextId,
|
|
206
|
+
...parts.errorText.attrs,
|
|
207
|
+
"aria-live": "polite"
|
|
208
|
+
}), [errorTextId]);
|
|
209
|
+
const getRequiredIndicatorProps = useMemo(() => () => ({
|
|
210
|
+
"aria-hidden": true,
|
|
211
|
+
...parts.requiredIndicator.attrs
|
|
212
|
+
}), []);
|
|
213
|
+
return {
|
|
214
|
+
ariaDescribedby: labelIds,
|
|
215
|
+
ids: {
|
|
216
|
+
root: rootId,
|
|
217
|
+
control: id,
|
|
218
|
+
label: labelId,
|
|
219
|
+
errorText: errorTextId,
|
|
220
|
+
helperText: helperTextId
|
|
221
|
+
},
|
|
222
|
+
refs: { rootRef },
|
|
223
|
+
disabled,
|
|
224
|
+
invalid,
|
|
225
|
+
readOnly,
|
|
226
|
+
required,
|
|
227
|
+
getLabelProps,
|
|
228
|
+
getRootProps,
|
|
229
|
+
getInputProps,
|
|
230
|
+
getTextareaProps,
|
|
231
|
+
getSelectProps,
|
|
232
|
+
getHelperTextProps,
|
|
233
|
+
getErrorTextProps,
|
|
234
|
+
getRequiredIndicatorProps
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/components/field/field-root.tsx
|
|
240
|
+
const splitRootProps = createSplitProps();
|
|
241
|
+
const FieldRoot = forwardRef((props, ref) => {
|
|
242
|
+
const [useFieldProps, localProps] = splitRootProps(props, [
|
|
243
|
+
"id",
|
|
244
|
+
"ids",
|
|
245
|
+
"disabled",
|
|
246
|
+
"invalid",
|
|
247
|
+
"readOnly",
|
|
248
|
+
"required"
|
|
249
|
+
]);
|
|
250
|
+
const field = useField(useFieldProps);
|
|
251
|
+
const mergedProps = mergeProps$1(field.getRootProps(), localProps);
|
|
252
|
+
return /* @__PURE__ */ jsx(FieldProvider, {
|
|
253
|
+
value: field,
|
|
254
|
+
children: /* @__PURE__ */ jsx(sprawlify.div, {
|
|
255
|
+
...mergedProps,
|
|
256
|
+
ref: composeRefs(ref, field.refs.rootRef)
|
|
257
|
+
})
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
FieldRoot.displayName = "FieldRoot";
|
|
261
|
+
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region src/components/field/field-root-provider.tsx
|
|
264
|
+
const splitRootProviderProps = createSplitProps();
|
|
265
|
+
const FieldRootProvider = forwardRef((props, ref) => {
|
|
266
|
+
const [{ value: field }, localProps] = splitRootProviderProps(props, ["value"]);
|
|
267
|
+
const mergedProps = mergeProps$1(field.getRootProps(), localProps);
|
|
268
|
+
return /* @__PURE__ */ jsx(FieldProvider, {
|
|
269
|
+
value: field,
|
|
270
|
+
children: /* @__PURE__ */ jsx(sprawlify.div, {
|
|
271
|
+
...mergedProps,
|
|
272
|
+
ref
|
|
273
|
+
})
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
FieldRootProvider.displayName = "FieldRootProvider";
|
|
277
|
+
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region src/components/field/field-select.tsx
|
|
280
|
+
const FieldSelect = forwardRef((props, ref) => {
|
|
281
|
+
const mergedProps = mergeProps$1(useFieldContext()?.getSelectProps(), props);
|
|
282
|
+
return /* @__PURE__ */ jsx(sprawlify.select, {
|
|
283
|
+
...mergedProps,
|
|
284
|
+
ref
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
FieldSelect.displayName = "FieldSelect";
|
|
288
|
+
|
|
289
|
+
//#endregion
|
|
290
|
+
//#region src/components/field/field-textarea.tsx
|
|
291
|
+
const FieldTextarea = forwardRef((props, ref) => {
|
|
292
|
+
const { autoresize, ...textareaProps } = props;
|
|
293
|
+
const textareaRef = useRef(null);
|
|
294
|
+
const mergedProps = mergeProps$1(useFieldContext()?.getTextareaProps(), { style: { resize: autoresize ? "none" : void 0 } }, textareaProps);
|
|
295
|
+
useEffect(() => {
|
|
296
|
+
if (!autoresize) return;
|
|
297
|
+
return autoresizeTextarea(textareaRef.current);
|
|
298
|
+
}, [autoresize]);
|
|
299
|
+
return /* @__PURE__ */ jsx(sprawlify.textarea, {
|
|
300
|
+
...mergedProps,
|
|
301
|
+
ref: composeRefs(ref, textareaRef)
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
FieldTextarea.displayName = "FieldTextarea";
|
|
305
|
+
|
|
306
|
+
//#endregion
|
|
307
|
+
//#region src/components/field/field.ts
|
|
308
|
+
var field_exports = /* @__PURE__ */ __export({
|
|
309
|
+
Context: () => FieldContext,
|
|
310
|
+
ErrorText: () => FieldErrorText,
|
|
311
|
+
HelperText: () => FieldHelperText,
|
|
312
|
+
Input: () => FieldInput,
|
|
313
|
+
Label: () => FieldLabel,
|
|
314
|
+
RequiredIndicator: () => FieldRequiredIndicator,
|
|
315
|
+
Root: () => FieldRoot,
|
|
316
|
+
RootProvider: () => FieldRootProvider,
|
|
317
|
+
Select: () => FieldSelect,
|
|
318
|
+
Textarea: () => FieldTextarea
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
//#endregion
|
|
322
|
+
export { FieldRoot as a, FieldRequiredIndicator as c, FieldHelperText as d, FieldErrorText as f, FieldRootProvider as i, FieldLabel as l, useFieldContext as m, FieldTextarea as n, useField as o, FieldContext as p, FieldSelect as r, fieldAnatomy as s, field_exports as t, FieldInput as u };
|