@fuf-stack/uniform 2.0.0-next.1 → 2.0.0-next.4
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/Checkboxes/index.d.mts +47 -27
- package/dist/Checkboxes/index.d.mts.map +1 -1
- package/dist/Checkboxes/index.mjs +26 -25
- package/dist/Checkboxes/index.mjs.map +1 -1
- package/dist/DatePicker/index.d.mts +63 -86
- package/dist/DatePicker/index.d.mts.map +1 -1
- package/dist/DatePicker/index.mjs +43 -49
- package/dist/DatePicker/index.mjs.map +1 -1
- package/dist/FieldArray/index.d.mts +8 -16
- package/dist/FieldArray/index.d.mts.map +1 -1
- package/dist/FieldArray/index.mjs +25 -37
- package/dist/FieldArray/index.mjs.map +1 -1
- package/dist/FieldCard/index.d.mts +0 -4
- package/dist/FieldCard/index.d.mts.map +1 -1
- package/dist/FieldCard/index.mjs +14 -25
- package/dist/FieldCard/index.mjs.map +1 -1
- package/dist/{FieldCopyTestIdButton-DV0tkdh2.mjs → FieldCopyTestIdButton-D3_jZYJ1.mjs} +3 -5
- package/dist/{FieldCopyTestIdButton-DV0tkdh2.mjs.map → FieldCopyTestIdButton-D3_jZYJ1.mjs.map} +1 -1
- package/dist/FieldHelper-B1DWl7eu.mjs +38 -0
- package/dist/FieldHelper-B1DWl7eu.mjs.map +1 -0
- package/dist/FieldLabel-DMTqq0Jj.mjs +29 -0
- package/dist/FieldLabel-DMTqq0Jj.mjs.map +1 -0
- package/dist/{FieldLayout-BLW5S-Jm.mjs → FieldLayout-C9MEBZAC.mjs} +11 -19
- package/dist/FieldLayout-C9MEBZAC.mjs.map +1 -0
- package/dist/FieldReset/index.d.mts +420 -0
- package/dist/FieldReset/index.d.mts.map +1 -0
- package/dist/FieldReset/index.mjs +258 -0
- package/dist/FieldReset/index.mjs.map +1 -0
- package/dist/{FieldValidationError-DgkCL3cC.mjs → FieldValidationError-BuLvuRyi.mjs} +5 -7
- package/dist/FieldValidationError-BuLvuRyi.mjs.map +1 -0
- package/dist/Form/index.d.mts +12 -14
- package/dist/Form/index.d.mts.map +1 -1
- package/dist/Form/index.mjs +7 -10
- package/dist/Form/index.mjs.map +1 -1
- package/dist/FormContext-BnNJYZOo.d.mts +124 -0
- package/dist/FormContext-BnNJYZOo.d.mts.map +1 -0
- package/dist/{FormContext-CHctWFAP.mjs → FormContext-PXkVlBdU.mjs} +5 -9
- package/dist/{FormContext-CHctWFAP.mjs.map → FormContext-PXkVlBdU.mjs.map} +1 -1
- package/dist/Grid/index.d.mts +0 -2
- package/dist/Grid/index.d.mts.map +1 -1
- package/dist/Grid/index.mjs +1 -1
- package/dist/{Grid-DfcZeuib.mjs → Grid-DBL29Kwb.mjs} +3 -5
- package/dist/{Grid-DfcZeuib.mjs.map → Grid-DBL29Kwb.mjs.map} +1 -1
- package/dist/Input/index.d.mts +610 -393
- package/dist/Input/index.d.mts.map +1 -1
- package/dist/Input/index.mjs +24 -31
- package/dist/Input/index.mjs.map +1 -1
- package/dist/RadioBoxes/index.d.mts +247 -2227
- package/dist/RadioBoxes/index.d.mts.map +1 -1
- package/dist/RadioBoxes/index.mjs +25 -37
- package/dist/RadioBoxes/index.mjs.map +1 -1
- package/dist/RadioTabs/index.d.mts +599 -289
- package/dist/RadioTabs/index.d.mts.map +1 -1
- package/dist/RadioTabs/index.mjs +24 -27
- package/dist/RadioTabs/index.mjs.map +1 -1
- package/dist/Radios/index.d.mts +164 -2077
- package/dist/Radios/index.d.mts.map +1 -1
- package/dist/Radios/index.mjs +12 -23
- package/dist/Radios/index.mjs.map +1 -1
- package/dist/Select/index.d.mts +809 -484
- package/dist/Select/index.d.mts.map +1 -1
- package/dist/Select/index.mjs +69 -54
- package/dist/Select/index.mjs.map +1 -1
- package/dist/Slider/index.d.mts +657 -281
- package/dist/Slider/index.d.mts.map +1 -1
- package/dist/Slider/index.mjs +42 -42
- package/dist/Slider/index.mjs.map +1 -1
- package/dist/SubmitButton/index.d.mts +0 -2
- package/dist/SubmitButton/index.d.mts.map +1 -1
- package/dist/SubmitButton/index.mjs +2 -4
- package/dist/SubmitButton/index.mjs.map +1 -1
- package/dist/Switch/index.d.mts +1 -1
- package/dist/Switch/index.mjs +25 -32
- package/dist/Switch/index.mjs.map +1 -1
- package/dist/Switch-aBYStBoY.d.mts +990 -0
- package/dist/Switch-aBYStBoY.d.mts.map +1 -0
- package/dist/SwitchBox/index.d.mts +606 -201
- package/dist/SwitchBox/index.d.mts.map +1 -1
- package/dist/SwitchBox/index.mjs +29 -33
- package/dist/SwitchBox/index.mjs.map +1 -1
- package/dist/TextArea/index.d.mts +565 -185
- package/dist/TextArea/index.d.mts.map +1 -1
- package/dist/TextArea/index.mjs +18 -23
- package/dist/TextArea/index.mjs.map +1 -1
- package/dist/Time/index.d.mts +60 -44
- package/dist/Time/index.d.mts.map +1 -1
- package/dist/Time/index.mjs +27 -36
- package/dist/Time/index.mjs.map +1 -1
- package/dist/fieldHelperVariants-ClP8taiS.mjs +20 -0
- package/dist/fieldHelperVariants-ClP8taiS.mjs.map +1 -0
- package/dist/fieldLabelVariants-C4ZqECec.mjs +13 -0
- package/dist/fieldLabelVariants-C4ZqECec.mjs.map +1 -0
- package/dist/{FieldDescription-C4l0HKGL.mjs → fieldProps-DWfz2jSO.mjs} +5 -17
- package/dist/fieldProps-DWfz2jSO.mjs.map +1 -0
- package/dist/helpers/index.d.mts +0 -6
- package/dist/helpers/index.d.mts.map +1 -1
- package/dist/helpers/index.mjs +3 -6
- package/dist/helpers/index.mjs.map +1 -1
- package/dist/hooks/useClientValidation/index.d.mts +0 -2
- package/dist/hooks/useClientValidation/index.d.mts.map +1 -1
- package/dist/hooks/useClientValidation/index.mjs +3 -5
- package/dist/hooks/useController/index.d.mts +0 -2
- package/dist/hooks/useController/index.d.mts.map +1 -1
- package/dist/hooks/useController/index.mjs +2 -3
- package/dist/hooks/useFormContext/index.d.mts +31 -52
- package/dist/hooks/useFormContext/index.d.mts.map +1 -1
- package/dist/hooks/useFormContext/index.mjs +2 -3
- package/dist/hooks/useInputValueDebounce/index.d.mts +0 -2
- package/dist/hooks/useInputValueDebounce/index.d.mts.map +1 -1
- package/dist/hooks/useInputValueDebounce/index.mjs +3 -5
- package/dist/hooks/useInputValueTransform/index.d.mts +1 -1
- package/dist/hooks/useInputValueTransform/index.mjs +2 -3
- package/dist/hooks/useWatchFormReset/index.d.mts +0 -2
- package/dist/hooks/useWatchFormReset/index.d.mts.map +1 -1
- package/dist/hooks/useWatchFormReset/index.mjs +3 -5
- package/dist/hooks/useWatchUserChange/index.d.mts +0 -2
- package/dist/hooks/useWatchUserChange/index.d.mts.map +1 -1
- package/dist/hooks/useWatchUserChange/index.mjs +3 -5
- package/dist/{index-BS8IoBOn.d.mts → index-cevZBrIN.d.mts} +1 -3
- package/dist/index-cevZBrIN.d.mts.map +1 -0
- package/dist/partials/FieldCopyTestIdButton/index.d.mts +0 -2
- package/dist/partials/FieldCopyTestIdButton/index.d.mts.map +1 -1
- package/dist/partials/FieldCopyTestIdButton/index.mjs +1 -1
- package/dist/{Switch-CvPO8IF9.d.mts → partials/FieldHelper/index.d.mts} +309 -361
- package/dist/partials/FieldHelper/index.d.mts.map +1 -0
- package/dist/partials/FieldHelper/index.mjs +7 -0
- package/dist/partials/FieldHelper/index.mjs.map +1 -0
- package/dist/partials/FieldLabel/index.d.mts +160 -0
- package/dist/partials/FieldLabel/index.d.mts.map +1 -0
- package/dist/partials/FieldLabel/index.mjs +7 -0
- package/dist/partials/FieldLabel/index.mjs.map +1 -0
- package/dist/partials/FieldValidationError/index.d.mts +13 -15
- package/dist/partials/FieldValidationError/index.d.mts.map +1 -1
- package/dist/partials/FieldValidationError/index.mjs +1 -1
- package/dist/{radioControlVariants-Cm6WufWo.mjs → radioControlVariants-CbtG5U4_.mjs} +28 -25
- package/dist/radioControlVariants-CbtG5U4_.mjs.map +1 -0
- package/dist/{switchVariants-BaQw2DA7.mjs → switchVariants-0Xa7TQYg.mjs} +8 -11
- package/dist/switchVariants-0Xa7TQYg.mjs.map +1 -0
- package/dist/{timeVariants-B9HDfNYt.mjs → timeVariants-Bkt4iwXx.mjs} +14 -12
- package/dist/timeVariants-Bkt4iwXx.mjs.map +1 -0
- package/dist/{useController-BCFeZbBZ.mjs → useController-JtIeurpw.mjs} +3 -4
- package/dist/{useController-BCFeZbBZ.mjs.map → useController-JtIeurpw.mjs.map} +1 -1
- package/dist/{useFormContext-BPjJjNnM.mjs → useFormContext-piqnN2L-.mjs} +3 -4
- package/dist/useFormContext-piqnN2L-.mjs.map +1 -0
- package/dist/{useInputValueTransform-Mw8YEOXT.mjs → useInputValueTransform-CXWWFhy_.mjs} +2 -3
- package/dist/{useInputValueTransform-Mw8YEOXT.mjs.map → useInputValueTransform-CXWWFhy_.mjs.map} +1 -1
- package/dist/{FieldLabel-DKzqkuY1.mjs → useUniformField-TTNPTsVn.mjs} +15 -37
- package/dist/useUniformField-TTNPTsVn.mjs.map +1 -0
- package/package.json +10 -7
- package/dist/FieldDescription-C4l0HKGL.mjs.map +0 -1
- package/dist/FieldLabel-DKzqkuY1.mjs.map +0 -1
- package/dist/FieldLayout-BLW5S-Jm.mjs.map +0 -1
- package/dist/FieldValidationError-DgkCL3cC.mjs.map +0 -1
- package/dist/FormContext-CsFiNvuJ.d.mts +0 -19
- package/dist/FormContext-CsFiNvuJ.d.mts.map +0 -1
- package/dist/Switch-CvPO8IF9.d.mts.map +0 -1
- package/dist/index-BS8IoBOn.d.mts.map +0 -1
- package/dist/radioControlVariants-Cm6WufWo.mjs.map +0 -1
- package/dist/switchVariants-BaQw2DA7.mjs.map +0 -1
- package/dist/timeVariants-B9HDfNYt.mjs.map +0 -1
- package/dist/useFormContext-BPjJjNnM.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/TextArea/textAreaVariants.ts","../../src/TextArea/TextArea.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/TextArea/textAre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AQ;;EAER;;EAEA;;EAEA;;EAEA;;;cAII,aAAY,WAAA,eAAA,MAAA,gBAAA,gBAMf,kCAAa,IAAA"}
|
package/dist/TextArea/index.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { n as useUniformField } from "../FieldLabel-DKzqkuY1.mjs";
|
|
2
|
-
import { n as getFieldControlProps, r as getFieldDataAttributes } from "../FieldDescription-C4l0HKGL.mjs";
|
|
3
|
-
import { t as FieldLayout } from "../FieldLayout-BLW5S-Jm.mjs";
|
|
4
1
|
import { useInputValueDebounce } from "../hooks/useInputValueDebounce/index.mjs";
|
|
2
|
+
import { t as useUniformField } from "../useUniformField-TTNPTsVn.mjs";
|
|
3
|
+
import { n as getFieldDataAttributes, t as getFieldControlProps } from "../fieldProps-DWfz2jSO.mjs";
|
|
4
|
+
import { t as FieldLayout } from "../FieldLayout-C9MEBZAC.mjs";
|
|
5
|
+
import { t as fieldHelperVariants } from "../fieldHelperVariants-ClP8taiS.mjs";
|
|
6
|
+
import { t as fieldLabelVariants } from "../fieldLabelVariants-C4ZqECec.mjs";
|
|
5
7
|
import { useState } from "react";
|
|
6
8
|
import { jsx } from "react/jsx-runtime";
|
|
7
9
|
import { tv } from "@fuf-stack/pixel-utils";
|
|
@@ -11,20 +13,15 @@ import { useFocusRing } from "react-aria/useFocusRing";
|
|
|
11
13
|
import { useObjectRef } from "react-aria/useObjectRef";
|
|
12
14
|
import { useTextField } from "react-aria/useTextField";
|
|
13
15
|
import TextareaAutosize from "react-textarea-autosize";
|
|
14
|
-
|
|
16
|
+
// src/TextArea/textAreaVariants.ts
|
|
15
17
|
/** Textarea slot styles with disabled, filled and invalid states */
|
|
16
18
|
const textAreaVariants = tv({
|
|
19
|
+
extend: fieldHelperVariants,
|
|
17
20
|
slots: {
|
|
18
21
|
/** Container for the label, input and messages */
|
|
19
22
|
base: "group relative flex w-full flex-col",
|
|
20
23
|
/** Reserved clear action slot */
|
|
21
24
|
clearButton: "",
|
|
22
|
-
/** Supporting text below the textarea */
|
|
23
|
-
description: "text-foreground-500 text-tiny",
|
|
24
|
-
/** Validation message container */
|
|
25
|
-
errorMessage: "text-danger text-tiny",
|
|
26
|
-
/** Container for help text and validation messages */
|
|
27
|
-
helperWrapper: "relative flex flex-col p-0",
|
|
28
25
|
/** Container around the autosizing textarea */
|
|
29
26
|
innerWrapper: "inline-flex w-full items-start",
|
|
30
27
|
/** Editable multiline text */
|
|
@@ -44,10 +41,11 @@ const textAreaVariants = tv({
|
|
|
44
41
|
"motion-reduce:transition-none"
|
|
45
42
|
],
|
|
46
43
|
/** Label above the textarea */
|
|
47
|
-
label:
|
|
44
|
+
label: [fieldLabelVariants.base, "block"]
|
|
48
45
|
},
|
|
49
46
|
variants: {
|
|
50
47
|
disabled: { true: { base: "pointer-events-none opacity-disabled" } },
|
|
48
|
+
readOnly: { true: { base: "cursor-not-allowed opacity-disabled **:cursor-not-allowed" } },
|
|
51
49
|
filled: { true: {
|
|
52
50
|
base: "is-filled",
|
|
53
51
|
input: "is-filled",
|
|
@@ -60,8 +58,7 @@ const textAreaVariants = tv({
|
|
|
60
58
|
} }
|
|
61
59
|
}
|
|
62
60
|
});
|
|
63
|
-
|
|
64
|
-
//#region src/TextArea/subcomponents/TextAreaInput.tsx
|
|
61
|
+
// src/TextArea/subcomponents/TextAreaInput.tsx
|
|
65
62
|
/**
|
|
66
63
|
* Autosizing textarea with wrapper focus routing and scroll-limit handling
|
|
67
64
|
*
|
|
@@ -71,13 +68,14 @@ const textAreaVariants = tv({
|
|
|
71
68
|
const TextAreaInput = ({ className: classNames, field, focused, hasValue, hovered, onHoverChange, placeholder }) => {
|
|
72
69
|
const controlRef = useObjectRef(field.ref);
|
|
73
70
|
const [limitReached, setLimitReached] = useState(false);
|
|
74
|
-
const { disabled, invalid, name, onBlur, onChange: onValueChange, required, testId, value } = field;
|
|
71
|
+
const { disabled, invalid, name, onBlur, onChange: onValueChange, readOnly, required, testId, value } = field;
|
|
75
72
|
const controlProps = getFieldControlProps(field);
|
|
76
73
|
const { inputProps } = useTextField({
|
|
77
74
|
...controlProps,
|
|
78
75
|
inputElementType: "textarea",
|
|
79
76
|
isDisabled: disabled,
|
|
80
77
|
isInvalid: invalid,
|
|
78
|
+
isReadOnly: readOnly,
|
|
81
79
|
isRequired: required,
|
|
82
80
|
name,
|
|
83
81
|
onBlur,
|
|
@@ -132,8 +130,7 @@ const TextAreaInput = ({ className: classNames, field, focused, hasValue, hovere
|
|
|
132
130
|
})
|
|
133
131
|
});
|
|
134
132
|
};
|
|
135
|
-
|
|
136
|
-
//#region src/TextArea/subcomponents/TextAreaControl.tsx
|
|
133
|
+
// src/TextArea/subcomponents/TextAreaControl.tsx
|
|
137
134
|
/**
|
|
138
135
|
* Multiline input presentation with autosizing, focus and field layout
|
|
139
136
|
*
|
|
@@ -147,12 +144,13 @@ const TextAreaControl = ({ field, className, placeholder }) => {
|
|
|
147
144
|
within: true
|
|
148
145
|
});
|
|
149
146
|
const [hovered, setHovered] = useState(false);
|
|
150
|
-
const { description, disabled, errorMessage, ids, invalid, label, required, value } = field;
|
|
147
|
+
const { description, disabled, errorMessage, ids, invalid, label, readOnly, required, value } = field;
|
|
151
148
|
const hasValue = value !== "" && value != null;
|
|
152
149
|
const variants = styling.resolve(textAreaVariants, {
|
|
153
150
|
disabled,
|
|
154
151
|
invalid,
|
|
155
|
-
filled: hasValue
|
|
152
|
+
filled: hasValue,
|
|
153
|
+
readOnly
|
|
156
154
|
});
|
|
157
155
|
const classNames = styling.variantsToClassNames(variants, className, "base");
|
|
158
156
|
return /* @__PURE__ */ jsx(FieldLayout, {
|
|
@@ -183,8 +181,7 @@ const TextAreaControl = ({ field, className, placeholder }) => {
|
|
|
183
181
|
})
|
|
184
182
|
});
|
|
185
183
|
};
|
|
186
|
-
|
|
187
|
-
//#region src/TextArea/TextArea.tsx
|
|
184
|
+
// src/TextArea/TextArea.tsx
|
|
188
185
|
/** Form input field for multiline text */
|
|
189
186
|
const TextArea = ({ className = void 0, debounceDelay = 300, name, placeholder = " ", ...uniformProps }) => {
|
|
190
187
|
const { field } = useUniformField({
|
|
@@ -210,10 +207,8 @@ const TextArea = ({ className = void 0, debounceDelay = 300, name, placeholder =
|
|
|
210
207
|
placeholder
|
|
211
208
|
});
|
|
212
209
|
};
|
|
213
|
-
|
|
214
|
-
//#region src/TextArea/index.ts
|
|
210
|
+
// src/TextArea/index.ts
|
|
215
211
|
var TextArea_default = TextArea;
|
|
216
|
-
//#endregion
|
|
217
212
|
export { TextArea_default as default, textAreaVariants };
|
|
218
213
|
|
|
219
214
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/TextArea/textAreaVariants.ts","../../src/TextArea/subcomponents/TextAreaInput.tsx","../../src/TextArea/subcomponents/TextAreaControl.tsx","../../src/TextArea/TextArea.tsx","../../src/TextArea/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\n/** Textarea slot styles with disabled, filled and invalid states */\nexport const textAreaVariants = tv({\n slots: {\n /** Container for the label, input and messages */\n base: 'group relative flex w-full flex-col',\n /** Reserved clear action slot */\n clearButton: '',\n /** Supporting text below the textarea */\n description: 'text-foreground-500 text-tiny',\n /** Validation message container */\n errorMessage: 'text-danger text-tiny',\n /** Container for help text and validation messages */\n helperWrapper: 'relative flex flex-col p-0',\n /** Container around the autosizing textarea */\n innerWrapper: 'inline-flex w-full items-start',\n /** Editable multiline text */\n input: [\n // editable text and transparent surface\n 'w-full min-w-0 resize-none bg-transparent bg-clip-text font-normal text-inherit outline-none',\n // autosize transition\n 'duration-100 transition-height text-small',\n // placeholder and autofill\n 'placeholder:text-foreground-500 autofill:bg-transparent',\n // scrollbar visibility and reduced motion\n 'data-[hide-scroll=true]:[scrollbar-width:none] motion-reduce:transition-none',\n // browser-specific textarea appearance\n 'dark:autofill:[-webkit-text-fill-color:var(--pixel-color-foreground)] data-[hide-scroll=true]:[&::-webkit-scrollbar]:hidden',\n ],\n /** Bordered surface around the textarea */\n inputWrapper: [\n // textarea frame and layout\n 'shadow-xs relative inline-flex w-full cursor-text items-start',\n // bordered surface and text\n 'rounded-medium border-medium border-default-200 bg-content1 px-3 py-2 text-foreground',\n // interaction transitions\n 'transition-colors',\n // hover and focus borders\n 'data-[hover=true]:border-default-400 group-data-[focus=true]:border-focus group-data-[focus=true]:data-[hover=true]:border-default-foreground',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n /** Label above the textarea */\n label: 'block pb-1.5 text-foreground text-small',\n },\n variants: {\n disabled: { true: { base: 'pointer-events-none opacity-disabled' } },\n filled: {\n true: {\n base: 'is-filled',\n input: 'is-filled',\n inputWrapper: 'is-filled',\n },\n },\n invalid: {\n true: {\n input: 'text-danger placeholder:text-danger',\n inputWrapper:\n 'border-danger data-[hover=true]:border-danger group-data-[focus=true]:border-danger group-data-[focus=true]:data-[hover=true]:border-danger',\n label: 'text-danger',\n },\n },\n },\n});\n\nexport type VariantProps = TVProps<typeof textAreaVariants>;\n\nexport type ClassName = TVClassName<typeof textAreaVariants>;\n\n/** Resolved class names for the multiline input slots */\nexport type TextAreaClassNames = Record<\n keyof ReturnType<typeof textAreaVariants>,\n string\n>;\n\nexport default textAreaVariants;\n","import type { ComponentProps, MouseEvent } from 'react';\nimport type { UniformField } from '../../hooks/useUniformField/types';\nimport type { TextAreaProps } from '../TextArea';\nimport type { TextAreaClassNames } from '../textAreaVariants';\n\nimport { useState } from 'react';\nimport { Group } from 'react-aria-components';\nimport { useObjectRef } from 'react-aria/useObjectRef';\nimport { useTextField } from 'react-aria/useTextField';\nimport TextareaAutosize from 'react-textarea-autosize';\n\nimport { getFieldControlProps } from '../../helpers/fieldProps/fieldProps';\n\ninterface TextAreaInputProps extends Pick<TextAreaProps, 'placeholder'> {\n /** CSS class name */\n className: TextAreaClassNames;\n /** Bound field values, interactions and metadata */\n field: UniformField<unknown, string>;\n /** Focus within the field */\n focused: boolean;\n /** Whether the field contains a value */\n hasValue: boolean;\n /** Pointer hover state on the input surface */\n hovered: boolean;\n /** Reports hover changes for the field root selectors */\n onHoverChange: (hovered: boolean) => void;\n}\n\n/**\n * Autosizing textarea with wrapper focus routing and scroll-limit handling\n *\n * @see https://react-aria.adobe.com/useTextField\n * @see https://react-aria.adobe.com/Group\n */\nconst TextAreaInput = ({\n className: classNames,\n field,\n focused,\n hasValue,\n hovered,\n onHoverChange,\n placeholder,\n}: TextAreaInputProps) => {\n const controlRef = useObjectRef<HTMLTextAreaElement>(field.ref);\n const [limitReached, setLimitReached] = useState(false);\n\n const {\n disabled,\n invalid,\n name,\n onBlur,\n onChange: onValueChange,\n required,\n testId,\n value,\n } = field;\n const controlProps = getFieldControlProps(field);\n\n const { inputProps } = useTextField(\n {\n ...controlProps,\n inputElementType: 'textarea',\n isDisabled: disabled,\n isInvalid: invalid,\n isRequired: required,\n name,\n onBlur,\n onChange: onValueChange,\n validationBehavior: 'aria',\n value: String(value ?? ''),\n },\n controlRef,\n );\n\n // the autosizer accepts numeric heights, other ARIA styles remain unchanged\n const inputStyle = inputProps.style\n ? {\n ...inputProps.style,\n height:\n typeof inputProps.style.height === 'number'\n ? inputProps.style.height\n : undefined,\n }\n : undefined;\n\n // focus the input when its wrapper padding is clicked\n const handleWrapperClick = (event: MouseEvent<HTMLElement>) => {\n if (!disabled && event.target === event.currentTarget) {\n controlRef.current?.focus();\n }\n };\n\n // track hover for the existing root and wrapper selectors\n const handleHoverStart = () => {\n onHoverChange(true);\n };\n\n const handleHoverEnd = () => {\n onHoverChange(false);\n };\n\n // hide scrolling until the eight-row display limit is reached\n const handleHeightChange: NonNullable<\n ComponentProps<typeof TextareaAutosize>['onHeightChange']\n > = (height, { rowHeight }) => {\n setLimitReached(height >= rowHeight * 8);\n };\n\n return (\n <Group\n className={classNames.inputWrapper}\n data-focus={focused || undefined}\n data-hover={hovered || undefined}\n data-slot=\"input-wrapper\"\n isDisabled={disabled}\n onClick={handleWrapperClick}\n onHoverEnd={handleHoverEnd}\n onHoverStart={handleHoverStart}\n role=\"presentation\"\n >\n <div className={classNames.innerWrapper} data-slot=\"inner-wrapper\">\n <TextareaAutosize\n {...inputProps}\n {...controlProps}\n ref={controlRef}\n style={inputStyle}\n className={classNames.input}\n data-filled={hasValue || undefined}\n data-hide-scroll={!limitReached || undefined}\n data-slot=\"input\"\n data-testid={testId}\n maxRows={8}\n minRows={3}\n onHeightChange={handleHeightChange}\n placeholder={placeholder}\n />\n </div>\n </Group>\n );\n};\n\nexport default TextAreaInput;\n","import type { UniformField } from '../../hooks/useUniformField/types';\nimport type { TextAreaProps } from '../TextArea';\n\nimport { useState } from 'react';\nimport { useFocusRing } from 'react-aria/useFocusRing';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { getFieldDataAttributes } from '../../helpers/fieldProps/fieldProps';\nimport FieldLayout from '../../partials/FieldLayout/FieldLayout';\nimport { textAreaVariants } from '../textAreaVariants';\nimport TextAreaInput from './TextAreaInput';\n\ninterface TextAreaControlProps extends Pick<\n TextAreaProps,\n 'className' | 'placeholder'\n> {\n /** Bound field values, interactions and metadata */\n field: UniformField<unknown, string>;\n}\n\n/**\n * Multiline input presentation with autosizing, focus and field layout\n *\n * @see https://react-aria.adobe.com/useTextField\n * @see https://react-aria.adobe.com/Group\n */\nconst TextAreaControl = ({\n field,\n className,\n placeholder,\n}: TextAreaControlProps) => {\n const styling = useStyling();\n const { focusProps, isFocused, isFocusVisible } = useFocusRing({\n isTextInput: true,\n within: true,\n });\n const [hovered, setHovered] = useState(false);\n\n const {\n description,\n disabled,\n errorMessage,\n ids,\n invalid,\n label,\n required,\n value,\n } = field;\n\n // zero counts as a filled value\n const hasValue = value !== '' && value != null;\n\n // classNames from slots\n const variants = styling.resolve(textAreaVariants, {\n disabled,\n invalid,\n filled: hasValue,\n });\n const classNames = styling.variantsToClassNames(variants, className, 'base');\n\n return (\n <FieldLayout\n baseProps={{\n ...focusProps,\n ...getFieldDataAttributes(field),\n 'data-component': 'text-area',\n 'data-filled': hasValue || undefined,\n 'data-focus': isFocused || undefined,\n 'data-focus-visible': isFocusVisible || undefined,\n 'data-hover': hovered || undefined,\n }}\n className={classNames}\n description={description}\n errorMessage={errorMessage}\n ids={ids}\n invalid={invalid}\n label={label}\n required={required}\n >\n <TextAreaInput\n className={classNames}\n field={field}\n focused={isFocused}\n hasValue={hasValue}\n hovered={hovered}\n onHoverChange={setHovered}\n placeholder={placeholder}\n />\n </FieldLayout>\n );\n};\n\nexport default TextAreaControl;\n","import type { ReactNode } from 'react';\nimport type { ClassName } from './textAreaVariants';\n\nimport { useInputValueDebounce } from '../hooks/useInputValueDebounce';\nimport useUniformField from '../hooks/useUniformField/useUniformField';\nimport TextAreaControl from './subcomponents/TextAreaControl';\n\nexport { default as textAreaVariants } from './textAreaVariants';\n\nexport interface TextAreaProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** Child components. The content of the textarea. */\n children?: ReactNode;\n /** CSS class name */\n className?: ClassName;\n /** debounce delay in milliseconds for form state updates (default: 300ms) */\n debounceDelay?: number;\n /** Help text associated with the editable control. */\n description?: ReactNode;\n /** Determines if the TextArea is disabled or not. */\n disabled?: boolean;\n /** Label displayed above the TextArea. */\n label?: ReactNode;\n /** Name the TextArea is registered at in HTML forms (react-hook-form). */\n name: string;\n /** placeholder for the textArea content. */\n placeholder?: string;\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/** Form input field for multiline text */\nconst TextArea = ({\n className = undefined,\n debounceDelay = 300,\n name,\n placeholder = ' ',\n ...uniformProps\n}: TextAreaProps) => {\n const { field } = useUniformField({\n ...uniformProps,\n name,\n placeholder,\n });\n\n // debounce form updates, flush pending edits on blur\n const { value, onChange, onBlur } = useInputValueDebounce({\n debounceDelay,\n name,\n onBlur: field.onBlur,\n onChange: field.onChange,\n value: field.value,\n });\n\n return (\n <TextAreaControl\n className={className}\n field={{ ...field, onBlur, onChange, value }}\n placeholder={placeholder}\n />\n );\n};\n\nexport default TextArea;\n","import TextArea from './TextArea';\n\nexport type { TextAreaProps } from './TextArea';\n\nexport { textAreaVariants } from './textAreaVariants';\n\nexport default TextArea;\n"],"mappings":";;;;;;;;;;;;;;;AAKA,MAAa,mBAAmB,GAAG;CACjC,OAAO;;EAEL,MAAM;;EAEN,aAAa;;EAEb,aAAa;;EAEb,cAAc;;EAEd,eAAe;;EAEf,cAAc;;EAEd,OAAO;GAEL;GAEA;GAEA;GAEA;GAEA;EACF;;EAEA,cAAc;GAEZ;GAEA;GAEA;GAEA;GAEA;EACF;;EAEA,OAAO;CACT;CACA,UAAU;EACR,UAAU,EAAE,MAAM,EAAE,MAAM,uCAAuC,EAAE;EACnE,QAAQ,EACN,MAAM;GACJ,MAAM;GACN,OAAO;GACP,cAAc;EAChB,EACF;EACA,SAAS,EACP,MAAM;GACJ,OAAO;GACP,cACE;GACF,OAAO;EACT,EACF;CACF;AACF,CAAC;;;;;;;;;AChCD,MAAM,iBAAiB,EACrB,WAAW,YACX,OACA,SACA,UACA,SACA,eACA,kBACwB;CACxB,MAAM,aAAa,aAAkC,MAAM,GAAG;CAC9D,MAAM,CAAC,cAAc,mBAAmB,SAAS,KAAK;CAEtD,MAAM,EACJ,UACA,SACA,MACA,QACA,UAAU,eACV,UACA,QACA,UACE;CACJ,MAAM,eAAe,qBAAqB,KAAK;CAE/C,MAAM,EAAE,eAAe,aACrB;EACE,GAAG;EACH,kBAAkB;EAClB,YAAY;EACZ,WAAW;EACX,YAAY;EACZ;EACA;EACA,UAAU;EACV,oBAAoB;EACpB,OAAO,OAAO,SAAS,EAAE;CAC3B,GACA,UACF;CAGA,MAAM,aAAa,WAAW,QAC1B;EACE,GAAG,WAAW;EACd,QACE,OAAO,WAAW,MAAM,WAAW,WAC/B,WAAW,MAAM,SACjB,KAAA;CACR,IACA,KAAA;CAGJ,MAAM,sBAAsB,UAAmC;EAC7D,IAAI,CAAC,YA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c,aAAa,KAAA;GAC3B,sBAAsB,kBAAkB,KAAA;GACxC,cAAc,WAAW,KAAA;EAC3B;EACA,WAAW;EACE;EACC;EACT;EACI;EACF;EACG;EAEV,UAAA,oBAAC,eAAD;GACE,WAAW;GACJ;GACP,SAAS;GACC;GACD;GACT,eAAe;GACF;EACd,CAAA;CACU,CAAA;AAEjB;;;;AC1DA,MAAM,YAAY,EAChB,YAAY,KAAA,GACZ,gBAAgB,KAChB,MACA,cAAc,KACd,GAAG,mBACgB;CACnB,MAAM,EAAE,UAAU,gBAAgB;EAChC,GAAG;EACH;EACA;CACF,CAAC;CAGD,MAAM,EAAE,OAAO,UAAU,WAAW,sBAAsB;EACxD;EACA;EACA,QAAQ,MAAM;EACd,UAAU,MAAM;EAChB,OAAO,MAAM;CACf,CAAC;CAED,OACE,oBAAC,iBAAD;EACa;EACX,OAAO;GAAE,GAAG;GAAO;GAAQ;GAAU;EAAM;EAC9B;CACd,CAAA;AAEL;;;ACxDA,IAAA,mBAAe"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/TextArea/textAreaVariants.ts","../../src/TextArea/subcomponents/TextAreaInput.tsx","../../src/TextArea/subcomponents/TextAreaControl.tsx","../../src/TextArea/TextArea.tsx","../../src/TextArea/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\nimport { fieldHelperVariants } from '../partials/FieldHelper/fieldHelperVariants';\nimport { fieldLabelVariants } from '../partials/FieldLabel/fieldLabelVariants';\n\n/** Textarea slot styles with disabled, filled and invalid states */\nexport const textAreaVariants = tv({\n extend: fieldHelperVariants,\n slots: {\n /** Container for the label, input and messages */\n base: 'group relative flex w-full flex-col',\n /** Reserved clear action slot */\n clearButton: '',\n /** Container around the autosizing textarea */\n innerWrapper: 'inline-flex w-full items-start',\n /** Editable multiline text */\n input: [\n // editable text and transparent surface\n 'w-full min-w-0 resize-none bg-transparent bg-clip-text font-normal text-inherit outline-none',\n // autosize transition\n 'duration-100 transition-height text-small',\n // placeholder and autofill\n 'placeholder:text-foreground-500 autofill:bg-transparent',\n // scrollbar visibility and reduced motion\n 'data-[hide-scroll=true]:[scrollbar-width:none] motion-reduce:transition-none',\n // browser-specific textarea appearance\n 'dark:autofill:[-webkit-text-fill-color:var(--pixel-color-foreground)] data-[hide-scroll=true]:[&::-webkit-scrollbar]:hidden',\n ],\n /** Bordered surface around the textarea */\n inputWrapper: [\n // textarea frame and layout\n 'shadow-xs relative inline-flex w-full cursor-text items-start',\n // bordered surface and text\n 'rounded-medium border-medium border-default-200 bg-content1 px-3 py-2 text-foreground',\n // interaction transitions\n 'transition-colors',\n // hover and focus borders\n 'data-[hover=true]:border-default-400 group-data-[focus=true]:border-focus group-data-[focus=true]:data-[hover=true]:border-default-foreground',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n /** Label above the textarea */\n label: [fieldLabelVariants.base, 'block'],\n },\n variants: {\n disabled: { true: { base: 'pointer-events-none opacity-disabled' } },\n readOnly: {\n true: {\n // inner controls set their own cursors, override every descendant\n base: 'cursor-not-allowed opacity-disabled **:cursor-not-allowed',\n },\n },\n filled: {\n true: {\n base: 'is-filled',\n input: 'is-filled',\n inputWrapper: 'is-filled',\n },\n },\n invalid: {\n true: {\n input: 'text-danger placeholder:text-danger',\n inputWrapper:\n 'border-danger data-[hover=true]:border-danger group-data-[focus=true]:border-danger group-data-[focus=true]:data-[hover=true]:border-danger',\n label: 'text-danger',\n },\n },\n },\n});\n\nexport type VariantProps = TVProps<typeof textAreaVariants>;\n\nexport type ClassName = TVClassName<typeof textAreaVariants>;\n\n/** Resolved class names for the multiline input slots */\nexport type TextAreaClassNames = Record<\n keyof ReturnType<typeof textAreaVariants>,\n string\n>;\n\nexport default textAreaVariants;\n","import type { ComponentProps, MouseEvent } from 'react';\nimport type { UniformField } from '../../hooks/useUniformField/types';\nimport type { TextAreaProps } from '../TextArea';\nimport type { TextAreaClassNames } from '../textAreaVariants';\n\nimport { useState } from 'react';\nimport { Group } from 'react-aria-components';\nimport { useObjectRef } from 'react-aria/useObjectRef';\nimport { useTextField } from 'react-aria/useTextField';\nimport TextareaAutosize from 'react-textarea-autosize';\n\nimport { getFieldControlProps } from '../../helpers/fieldProps/fieldProps';\n\ninterface TextAreaInputProps extends Pick<TextAreaProps, 'placeholder'> {\n /** CSS class name */\n className: TextAreaClassNames;\n /** Bound field values, interactions and metadata */\n field: UniformField<unknown, string>;\n /** Focus within the field */\n focused: boolean;\n /** Whether the field contains a value */\n hasValue: boolean;\n /** Pointer hover state on the input surface */\n hovered: boolean;\n /** Reports hover changes for the field root selectors */\n onHoverChange: (hovered: boolean) => void;\n}\n\n/**\n * Autosizing textarea with wrapper focus routing and scroll-limit handling\n *\n * @see https://react-aria.adobe.com/useTextField\n * @see https://react-aria.adobe.com/Group\n */\nconst TextAreaInput = ({\n className: classNames,\n field,\n focused,\n hasValue,\n hovered,\n onHoverChange,\n placeholder,\n}: TextAreaInputProps) => {\n const controlRef = useObjectRef<HTMLTextAreaElement>(field.ref);\n const [limitReached, setLimitReached] = useState(false);\n\n const {\n disabled,\n invalid,\n name,\n onBlur,\n onChange: onValueChange,\n readOnly,\n required,\n testId,\n value,\n } = field;\n const controlProps = getFieldControlProps(field);\n\n const { inputProps } = useTextField(\n {\n ...controlProps,\n inputElementType: 'textarea',\n isDisabled: disabled,\n isInvalid: invalid,\n isReadOnly: readOnly,\n isRequired: required,\n name,\n onBlur,\n onChange: onValueChange,\n validationBehavior: 'aria',\n value: String(value ?? ''),\n },\n controlRef,\n );\n\n // the autosizer accepts numeric heights, other ARIA styles remain unchanged\n const inputStyle = inputProps.style\n ? {\n ...inputProps.style,\n height:\n typeof inputProps.style.height === 'number'\n ? inputProps.style.height\n : undefined,\n }\n : undefined;\n\n // focus the input when its wrapper padding is clicked\n const handleWrapperClick = (event: MouseEvent<HTMLElement>) => {\n if (!disabled && event.target === event.currentTarget) {\n controlRef.current?.focus();\n }\n };\n\n // track hover for the existing root and wrapper selectors\n const handleHoverStart = () => {\n onHoverChange(true);\n };\n\n const handleHoverEnd = () => {\n onHoverChange(false);\n };\n\n // hide scrolling until the eight-row display limit is reached\n const handleHeightChange: NonNullable<\n ComponentProps<typeof TextareaAutosize>['onHeightChange']\n > = (height, { rowHeight }) => {\n setLimitReached(height >= rowHeight * 8);\n };\n\n return (\n <Group\n className={classNames.inputWrapper}\n data-focus={focused || undefined}\n data-hover={hovered || undefined}\n data-slot=\"input-wrapper\"\n isDisabled={disabled}\n onClick={handleWrapperClick}\n onHoverEnd={handleHoverEnd}\n onHoverStart={handleHoverStart}\n role=\"presentation\"\n >\n <div className={classNames.innerWrapper} data-slot=\"inner-wrapper\">\n <TextareaAutosize\n {...inputProps}\n {...controlProps}\n ref={controlRef}\n style={inputStyle}\n className={classNames.input}\n data-filled={hasValue || undefined}\n data-hide-scroll={!limitReached || undefined}\n data-slot=\"input\"\n data-testid={testId}\n maxRows={8}\n minRows={3}\n onHeightChange={handleHeightChange}\n placeholder={placeholder}\n />\n </div>\n </Group>\n );\n};\n\nexport default TextAreaInput;\n","import type { UniformField } from '../../hooks/useUniformField/types';\nimport type { TextAreaProps } from '../TextArea';\n\nimport { useState } from 'react';\nimport { useFocusRing } from 'react-aria/useFocusRing';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { getFieldDataAttributes } from '../../helpers/fieldProps/fieldProps';\nimport FieldLayout from '../../partials/FieldLayout/FieldLayout';\nimport { textAreaVariants } from '../textAreaVariants';\nimport TextAreaInput from './TextAreaInput';\n\ninterface TextAreaControlProps extends Pick<\n TextAreaProps,\n 'className' | 'placeholder'\n> {\n /** Bound field values, interactions and metadata */\n field: UniformField<unknown, string>;\n}\n\n/**\n * Multiline input presentation with autosizing, focus and field layout\n *\n * @see https://react-aria.adobe.com/useTextField\n * @see https://react-aria.adobe.com/Group\n */\nconst TextAreaControl = ({\n field,\n className,\n placeholder,\n}: TextAreaControlProps) => {\n const styling = useStyling();\n const { focusProps, isFocused, isFocusVisible } = useFocusRing({\n isTextInput: true,\n within: true,\n });\n const [hovered, setHovered] = useState(false);\n\n const {\n description,\n disabled,\n errorMessage,\n ids,\n invalid,\n label,\n readOnly,\n required,\n value,\n } = field;\n\n // zero counts as a filled value\n const hasValue = value !== '' && value != null;\n\n // classNames from slots\n const variants = styling.resolve(textAreaVariants, {\n disabled,\n invalid,\n filled: hasValue,\n readOnly,\n });\n const classNames = styling.variantsToClassNames(variants, className, 'base');\n\n return (\n <FieldLayout\n baseProps={{\n ...focusProps,\n ...getFieldDataAttributes(field),\n 'data-component': 'text-area',\n 'data-filled': hasValue || undefined,\n 'data-focus': isFocused || undefined,\n 'data-focus-visible': isFocusVisible || undefined,\n 'data-hover': hovered || undefined,\n }}\n className={classNames}\n description={description}\n errorMessage={errorMessage}\n ids={ids}\n invalid={invalid}\n label={label}\n required={required}\n >\n <TextAreaInput\n className={classNames}\n field={field}\n focused={isFocused}\n hasValue={hasValue}\n hovered={hovered}\n onHoverChange={setHovered}\n placeholder={placeholder}\n />\n </FieldLayout>\n );\n};\n\nexport default TextAreaControl;\n","import type { ReactNode } from 'react';\nimport type { ClassName } from './textAreaVariants';\n\nimport { useInputValueDebounce } from '../hooks/useInputValueDebounce';\nimport useUniformField from '../hooks/useUniformField/useUniformField';\nimport TextAreaControl from './subcomponents/TextAreaControl';\n\nexport { default as textAreaVariants } from './textAreaVariants';\n\nexport interface TextAreaProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** Child components. The content of the textarea. */\n children?: ReactNode;\n /** CSS class name */\n className?: ClassName;\n /** debounce delay in milliseconds for form state updates (default: 300ms) */\n debounceDelay?: number;\n /** Help text associated with the editable control. */\n description?: ReactNode;\n /** Determines if the TextArea is disabled or not. */\n disabled?: boolean;\n /** Label displayed above the TextArea. */\n label?: ReactNode;\n /** Name the TextArea is registered at in HTML forms (react-hook-form). */\n name: string;\n /** placeholder for the textArea content. */\n placeholder?: string;\n /** Prevents changes, the text can still be focused, copied and is submitted */\n readOnly?: boolean;\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/** Form input field for multiline text */\nconst TextArea = ({\n className = undefined,\n debounceDelay = 300,\n name,\n placeholder = ' ',\n ...uniformProps\n}: TextAreaProps) => {\n const { field } = useUniformField({\n ...uniformProps,\n name,\n placeholder,\n });\n\n // debounce form updates, flush pending edits on blur\n const { value, onChange, onBlur } = useInputValueDebounce({\n debounceDelay,\n name,\n onBlur: field.onBlur,\n onChange: field.onChange,\n value: field.value,\n });\n\n return (\n <TextAreaControl\n className={className}\n field={{ ...field, onBlur, onChange, value }}\n placeholder={placeholder}\n />\n );\n};\n\nexport default TextArea;\n","import TextArea from './TextArea';\n\nexport type { TextAreaProps } from './TextArea';\n\nexport { textAreaVariants } from './textAreaVariants';\n\nexport default TextArea;\n"],"mappings":";;;;;;;;;;;;;;;;;AAQA,MAAa,mBAAmB,GAAG;CACjC,QAAQ;CACR,OAAO;;EAEL,MAAM;;EAEN,aAAa;;EAEb,cAAc;;EAEd,OAAO;GAEL;GAEA;GAEA;GAEA;GAEA;EACF;;EAEA,cAAc;GAEZ;GAEA;GAEA;GAEA;GAEA;EACF;;EAEA,OAAO,CAAC,mBAAmB,MAAM,OAAO;CAC1C;CACA,UAAU;EACR,UAAU,EAAE,MAAM,EAAE,MAAM,uCAAuC,EAAE;EACnE,UAAU,EACR,MAAM,EAEJ,MAAM,4DACR,EACF;EACA,QAAQ,EACN,MAAM;GACJ,MAAM;GACN,OAAO;GACP,cAAc;EAChB,EACF;EACA,SAAS,EACP,MAAM;GACJ,OAAO;GACP,cACE;GACF,OAAO;EACT,EACF;CACF;AACF,CAAC;;;;;;;;ACpCD,MAAM,iBAAiB,EACrB,WAAW,YACX,OACA,SACA,UACA,SACA,eACA,kBACwB;CACxB,MAAM,aAAa,aAAkC,MAAM,GAAG;CAC9D,MAAM,CAAC,cAAc,mBAAmB,SAAS,KAAK;CAEtD,MAAM,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