@ox0/ui 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,6 +7,7 @@ export interface SelectOption {
|
|
|
7
7
|
export interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, "value" | "defaultValue" | "onChange" | "aria-label" | "disabled"> {
|
|
8
8
|
readonly label?: ReactNode;
|
|
9
9
|
readonly ariaLabel?: string;
|
|
10
|
+
readonly description?: ReactNode;
|
|
10
11
|
readonly isDisabled?: boolean;
|
|
11
12
|
readonly isInvalid?: boolean;
|
|
12
13
|
readonly errorMessage?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/components/select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,oBAAoB,EAK1B,MAAM,OAAO,CAAA;AAId,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED,MAAM,WAAW,WAAY,SAAQ,IAAI,CACvC,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,CAClE;IACC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAA;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAA;IACzC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5C;AAED,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/components/select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EACd,KAAK,oBAAoB,EAK1B,MAAM,OAAO,CAAA;AAId,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAC5B;AAED,MAAM,WAAW,WAAY,SAAQ,IAAI,CACvC,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,CAClE;IACC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAA;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAA;IAChC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAA;IACzC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5C;AAED,eAAO,MAAM,MAAM,2GAqGjB,CAAA"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { type InputHTMLAttributes, type ReactNode } from "react";
|
|
2
|
-
|
|
2
|
+
import type { IconComponent } from "./button";
|
|
3
|
+
export interface TextFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "disabled" | "onChange" | "readOnly" | "aria-label"> {
|
|
4
|
+
readonly ariaLabel?: string;
|
|
3
5
|
readonly description?: ReactNode;
|
|
4
6
|
readonly errorMessage?: ReactNode;
|
|
7
|
+
readonly icon?: IconComponent;
|
|
8
|
+
readonly isClearable?: boolean;
|
|
5
9
|
readonly isDisabled?: boolean;
|
|
6
10
|
readonly isInvalid?: boolean;
|
|
11
|
+
readonly isReadOnly?: boolean;
|
|
7
12
|
readonly label?: ReactNode;
|
|
13
|
+
readonly onClear?: () => void;
|
|
8
14
|
readonly onChange?: (value: string) => void;
|
|
15
|
+
readonly variant?: "default" | "flat";
|
|
9
16
|
}
|
|
10
17
|
export declare const TextField: import("react").ForwardRefExoticComponent<TextFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
11
18
|
//# sourceMappingURL=text-field.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-field.d.ts","sourceRoot":"","sources":["../../src/components/text-field.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"text-field.d.ts","sourceRoot":"","sources":["../../src/components/text-field.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAI7C,MAAM,WAAW,cAAe,SAAQ,IAAI,CAC1C,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,CAC7D;IACC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAA;IAChC,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,CAAA;IACjC,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAA;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAA;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3C,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,CAAA;CACtC;AAED,eAAO,MAAM,SAAS,6GA0IpB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -372,7 +372,7 @@ var __webpack_modules__ = {
|
|
|
372
372
|
var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_rsbuild_core_1_2_19_node_modules_rsbuild_core_compiled_css_loader_api_js__WEBPACK_IMPORTED_MODULE_1___default()(_node_modules_pnpm_rsbuild_core_1_2_19_node_modules_rsbuild_core_compiled_css_loader_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default());
|
|
373
373
|
___CSS_LOADER_EXPORT___.push([
|
|
374
374
|
module.id,
|
|
375
|
-
".root-FHU2Km{gap:var(--ox0-space-xs);display:grid}.label-QcwXLk{color:var(--ox0-color-muted);font-size:var(--ox0-font-size-sm);font-weight:var(--ox0-font-weight-medium)}.select-gSATBt{background:var(--ox0-color-surface);border:1px solid var(--ox0-color-border);border-radius:var(--ox0-radius-sm);color:var(--ox0-color-foreground);font:inherit;font-size:var(--ox0-font-size-md);min-height:34px;padding:0 var(--ox0-space-md);transition:border-color var(--ox0-duration-fast)var(--ox0-ease-crisp),box-shadow var(--ox0-duration-fast)var(--ox0-ease-crisp)}.select-gSATBt:hover{border-color:var(--ox0-color-border-strong)}.select-gSATBt:focus{outline:none}.select-gSATBt.focusVisible-jXb33t{border-color:var(--ox0-color-accent);box-shadow:0 0 0 3px var(--ox0-color-focus-ring)}.select-gSATBt:disabled{background:var(--ox0-color-canvas);color:var(--ox0-color-disabled);cursor:not-allowed}.select-gSATBt.invalid-KfZYsG{border-color:var(--ox0-color-danger)}.select-gSATBt.invalid-KfZYsG.focusVisible-jXb33t{box-shadow:0 0 0 3px var(--ox0-color-danger-subtle)}.error-j2vRdG{color:var(--ox0-color-danger-text);font-size:var(--ox0-font-size-sm)}",
|
|
375
|
+
".root-FHU2Km{gap:var(--ox0-space-xs);display:grid}.label-QcwXLk{color:var(--ox0-color-muted);font-size:var(--ox0-font-size-sm);font-weight:var(--ox0-font-weight-medium)}.select-gSATBt{background:var(--ox0-color-surface);border:1px solid var(--ox0-color-border);border-radius:var(--ox0-radius-sm);color:var(--ox0-color-foreground);font:inherit;font-size:var(--ox0-font-size-md);min-height:34px;padding:0 var(--ox0-space-md);transition:border-color var(--ox0-duration-fast)var(--ox0-ease-crisp),box-shadow var(--ox0-duration-fast)var(--ox0-ease-crisp)}.select-gSATBt:hover{border-color:var(--ox0-color-border-strong)}.select-gSATBt:focus{outline:none}.select-gSATBt.focusVisible-jXb33t{border-color:var(--ox0-color-accent);box-shadow:0 0 0 3px var(--ox0-color-focus-ring)}.select-gSATBt:disabled{background:var(--ox0-color-canvas);color:var(--ox0-color-disabled);cursor:not-allowed}.select-gSATBt.invalid-KfZYsG{border-color:var(--ox0-color-danger)}.select-gSATBt.invalid-KfZYsG.focusVisible-jXb33t{box-shadow:0 0 0 3px var(--ox0-color-danger-subtle)}.description-wugNPd{color:var(--ox0-color-muted);font-size:var(--ox0-font-size-sm)}.error-j2vRdG{color:var(--ox0-color-danger-text);font-size:var(--ox0-font-size-sm)}",
|
|
376
376
|
""
|
|
377
377
|
]);
|
|
378
378
|
___CSS_LOADER_EXPORT___.locals = {
|
|
@@ -381,6 +381,7 @@ var __webpack_modules__ = {
|
|
|
381
381
|
select: "select-gSATBt",
|
|
382
382
|
focusVisible: "focusVisible-jXb33t",
|
|
383
383
|
invalid: "invalid-KfZYsG",
|
|
384
|
+
description: "description-wugNPd",
|
|
384
385
|
error: "error-j2vRdG"
|
|
385
386
|
};
|
|
386
387
|
const __WEBPACK_DEFAULT_EXPORT__ = ___CSS_LOADER_EXPORT___;
|
|
@@ -452,14 +453,18 @@ var __webpack_modules__ = {
|
|
|
452
453
|
var ___CSS_LOADER_EXPORT___ = _node_modules_pnpm_rsbuild_core_1_2_19_node_modules_rsbuild_core_compiled_css_loader_api_js__WEBPACK_IMPORTED_MODULE_1___default()(_node_modules_pnpm_rsbuild_core_1_2_19_node_modules_rsbuild_core_compiled_css_loader_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default());
|
|
453
454
|
___CSS_LOADER_EXPORT___.push([
|
|
454
455
|
module.id,
|
|
455
|
-
".root-EDj_sz{color:var(--ox0-color-foreground);font-size:var(--ox0-font-size-md);gap:var(--ox0-space-xs);display:grid}.label-S2rwc9{font-weight:var(--ox0-font-weight-medium)}.
|
|
456
|
+
".root-EDj_sz{color:var(--ox0-color-foreground);font-size:var(--ox0-font-size-md);gap:var(--ox0-space-xs);display:grid}.label-S2rwc9{font-weight:var(--ox0-font-weight-medium)}.control-Vog3id{background:var(--ox0-color-surface);border:1px solid var(--ox0-color-border);border-radius:var(--ox0-radius-sm);align-items:center;gap:var(--ox0-space-xs);min-height:36px;padding-inline:var(--ox0-space-md);transition:border-color var(--ox0-duration-fast)var(--ox0-ease-crisp),box-shadow var(--ox0-duration-fast)var(--ox0-ease-crisp);display:flex}.control-Vog3id:hover{border-color:var(--ox0-color-border-strong)}.control-Vog3id.focusVisible-r4K4nT{border-color:var(--ox0-color-accent);box-shadow:0 0 0 3px var(--ox0-color-focus-ring)}.control-Vog3id.invalid-M29JY3{border-color:var(--ox0-color-danger)}.control-Vog3id.invalid-M29JY3.focusVisible-r4K4nT{box-shadow:0 0 0 3px var(--ox0-color-danger-subtle)}.control-Vog3id[data-variant=flat]{border:none;border-bottom:1px solid var(--ox0-color-border);padding-inline:var(--ox0-space-xs);background:0 0;border-radius:0}.control-Vog3id[data-variant=flat]:hover{border-bottom-color:var(--ox0-color-border-strong)}.control-Vog3id[data-variant=flat].focusVisible-r4K4nT{border-bottom-color:var(--ox0-color-accent);box-shadow:none}.icon-SJ2fI8{color:var(--ox0-color-muted);flex:none;display:inline-flex}.input-pJgRNM{color:inherit;font:inherit;background:0 0;border:none;outline:none;flex:auto;min-inline-size:0;padding-block:.625rem}.input-pJgRNM::placeholder{color:var(--ox0-color-disabled)}.input-pJgRNM:disabled{color:var(--ox0-color-disabled);cursor:not-allowed}.control-Vog3id:has(.input-pJgRNM:disabled){background:var(--ox0-color-canvas);cursor:not-allowed}.clear-eMD0M3{block-size:24px;color:var(--ox0-color-muted);cursor:pointer;background:0 0;border:none;border-radius:999px;flex:none;justify-content:center;align-items:center;inline-size:24px;display:inline-flex}.clear-eMD0M3:hover{color:var(--ox0-color-foreground)}.description-U5SfzR{color:var(--ox0-color-muted);font-size:var(--ox0-font-size-sm)}.error-PaIi5f{color:var(--ox0-color-danger-text);font-size:var(--ox0-font-size-sm)}",
|
|
456
457
|
""
|
|
457
458
|
]);
|
|
458
459
|
___CSS_LOADER_EXPORT___.locals = {
|
|
459
460
|
root: "root-EDj_sz",
|
|
460
461
|
label: "label-S2rwc9",
|
|
461
|
-
|
|
462
|
+
control: "control-Vog3id",
|
|
463
|
+
focusVisible: "focusVisible-r4K4nT",
|
|
462
464
|
invalid: "invalid-M29JY3",
|
|
465
|
+
icon: "icon-SJ2fI8",
|
|
466
|
+
input: "input-pJgRNM",
|
|
467
|
+
clear: "clear-eMD0M3",
|
|
463
468
|
description: "description-U5SfzR",
|
|
464
469
|
error: "error-PaIi5f"
|
|
465
470
|
};
|
|
@@ -3202,10 +3207,11 @@ select_module_options.domAPI = styleDomAPI_default();
|
|
|
3202
3207
|
select_module_options.insertStyleElement = insertStyleElement_default();
|
|
3203
3208
|
injectStylesIntoStyleTag_default()(select_module.Z, select_module_options);
|
|
3204
3209
|
const components_select_module = select_module.Z && select_module.Z.locals ? select_module.Z.locals : void 0;
|
|
3205
|
-
const select_Select = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRef)(function({ ariaLabel, className, defaultValue, errorMessage, id, isDisabled, isInvalid, label, onChange, options, placeholder, value: valueProp, ...props }, ref) {
|
|
3210
|
+
const select_Select = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRef)(function({ ariaLabel, className, defaultValue, description, errorMessage, id, isDisabled, isInvalid, label, onChange, options, placeholder, value: valueProp, ...props }, ref) {
|
|
3206
3211
|
if (!label && !ariaLabel) throw new Error("Select requires `label` or `ariaLabel`.");
|
|
3207
3212
|
const generatedId = (0, __WEBPACK_EXTERNAL_MODULE_react__.useId)();
|
|
3208
3213
|
const controlId = id ?? generatedId;
|
|
3214
|
+
const descriptionId = description ? `${controlId}-description` : void 0;
|
|
3209
3215
|
const errorId = errorMessage ? `${controlId}-error` : void 0;
|
|
3210
3216
|
const invalid = isInvalid || !!errorMessage;
|
|
3211
3217
|
const isControlled = void 0 !== valueProp;
|
|
@@ -3229,7 +3235,10 @@ const select_Select = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwar
|
|
|
3229
3235
|
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("select", {
|
|
3230
3236
|
...props,
|
|
3231
3237
|
ref: ref,
|
|
3232
|
-
"aria-describedby":
|
|
3238
|
+
"aria-describedby": [
|
|
3239
|
+
descriptionId,
|
|
3240
|
+
errorId
|
|
3241
|
+
].filter(Boolean).join(" ") || void 0,
|
|
3233
3242
|
"aria-invalid": invalid || void 0,
|
|
3234
3243
|
"aria-label": ariaLabel,
|
|
3235
3244
|
className: [
|
|
@@ -3267,6 +3276,11 @@ const select_Select = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwar
|
|
|
3267
3276
|
}, o.value))
|
|
3268
3277
|
]
|
|
3269
3278
|
}),
|
|
3279
|
+
description ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
|
|
3280
|
+
className: components_select_module.description,
|
|
3281
|
+
id: descriptionId,
|
|
3282
|
+
children: description
|
|
3283
|
+
}) : null,
|
|
3270
3284
|
errorMessage ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
|
|
3271
3285
|
className: components_select_module.error,
|
|
3272
3286
|
id: errorId,
|
|
@@ -3440,7 +3454,7 @@ const text_area_TextArea = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.f
|
|
|
3440
3454
|
]
|
|
3441
3455
|
});
|
|
3442
3456
|
});
|
|
3443
|
-
const text_field_TextField = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRef)(function({
|
|
3457
|
+
const text_field_TextField = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.forwardRef)(function({ ariaLabel, description, errorMessage, icon: Icon, id: idProp, isClearable = false, isDisabled, isInvalid, isReadOnly, label, onBlur, onClear, onChange, onFocus, onKeyDown, onPointerDown, variant = "default", ...props }, ref) {
|
|
3444
3458
|
const generatedId = (0, __WEBPACK_EXTERNAL_MODULE_react__.useId)();
|
|
3445
3459
|
const id = idProp ?? generatedId;
|
|
3446
3460
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
@@ -3450,6 +3464,28 @@ const text_field_TextField = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__
|
|
|
3450
3464
|
errorId
|
|
3451
3465
|
].filter(Boolean).join(" ") || void 0;
|
|
3452
3466
|
const invalid = isInvalid || !!errorMessage;
|
|
3467
|
+
const inputRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
|
|
3468
|
+
const setInputRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)((node)=>{
|
|
3469
|
+
inputRef.current = node;
|
|
3470
|
+
if (!ref) return;
|
|
3471
|
+
if ("function" == typeof ref) {
|
|
3472
|
+
ref(node);
|
|
3473
|
+
return;
|
|
3474
|
+
}
|
|
3475
|
+
if ("current" in ref) ref.current = node;
|
|
3476
|
+
}, [
|
|
3477
|
+
ref
|
|
3478
|
+
]);
|
|
3479
|
+
const [isFocusVisible, setIsFocusVisible] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
|
|
3480
|
+
const pointerActive = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(false);
|
|
3481
|
+
const handleClear = (0, __WEBPACK_EXTERNAL_MODULE_react__.useCallback)(()=>{
|
|
3482
|
+
onChange?.("");
|
|
3483
|
+
onClear?.();
|
|
3484
|
+
inputRef.current?.focus();
|
|
3485
|
+
}, [
|
|
3486
|
+
onChange,
|
|
3487
|
+
onClear
|
|
3488
|
+
]);
|
|
3453
3489
|
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
|
|
3454
3490
|
className: components_text_field_module.root,
|
|
3455
3491
|
children: [
|
|
@@ -3458,19 +3494,74 @@ const text_field_TextField = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__
|
|
|
3458
3494
|
htmlFor: id,
|
|
3459
3495
|
children: label
|
|
3460
3496
|
}) : null,
|
|
3461
|
-
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.
|
|
3462
|
-
...props,
|
|
3463
|
-
ref: ref,
|
|
3464
|
-
"aria-describedby": describedBy,
|
|
3465
|
-
"aria-invalid": invalid || void 0,
|
|
3497
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsxs)("div", {
|
|
3466
3498
|
className: [
|
|
3467
|
-
components_text_field_module.
|
|
3499
|
+
components_text_field_module.control,
|
|
3468
3500
|
invalid ? components_text_field_module.invalid : null,
|
|
3469
|
-
|
|
3501
|
+
isFocusVisible ? components_text_field_module.focusVisible : null
|
|
3470
3502
|
].filter(Boolean).join(" "),
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3503
|
+
"data-variant": variant,
|
|
3504
|
+
children: [
|
|
3505
|
+
Icon ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
|
|
3506
|
+
"aria-hidden": "true",
|
|
3507
|
+
className: components_text_field_module.icon,
|
|
3508
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(Icon, {
|
|
3509
|
+
size: 12
|
|
3510
|
+
})
|
|
3511
|
+
}) : null,
|
|
3512
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("input", {
|
|
3513
|
+
...props,
|
|
3514
|
+
ref: setInputRef,
|
|
3515
|
+
"aria-describedby": describedBy,
|
|
3516
|
+
"aria-invalid": invalid || void 0,
|
|
3517
|
+
"aria-label": ariaLabel,
|
|
3518
|
+
className: components_text_field_module.input,
|
|
3519
|
+
disabled: isDisabled,
|
|
3520
|
+
id: id,
|
|
3521
|
+
readOnly: isReadOnly,
|
|
3522
|
+
onPointerDown: (e)=>{
|
|
3523
|
+
pointerActive.current = true;
|
|
3524
|
+
onPointerDown?.(e);
|
|
3525
|
+
},
|
|
3526
|
+
onFocus: (e)=>{
|
|
3527
|
+
if (!pointerActive.current) setIsFocusVisible(true);
|
|
3528
|
+
pointerActive.current = false;
|
|
3529
|
+
onFocus?.(e);
|
|
3530
|
+
},
|
|
3531
|
+
onBlur: (e)=>{
|
|
3532
|
+
setIsFocusVisible(false);
|
|
3533
|
+
onBlur?.(e);
|
|
3534
|
+
},
|
|
3535
|
+
onKeyDown: (e)=>{
|
|
3536
|
+
if (isClearable && "Escape" === e.key) {
|
|
3537
|
+
e.preventDefault();
|
|
3538
|
+
handleClear();
|
|
3539
|
+
}
|
|
3540
|
+
onKeyDown?.(e);
|
|
3541
|
+
},
|
|
3542
|
+
onChange: onChange ? (e)=>onChange(e.target.value) : void 0
|
|
3543
|
+
}),
|
|
3544
|
+
isClearable ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("button", {
|
|
3545
|
+
"aria-label": "Clear",
|
|
3546
|
+
className: components_text_field_module.clear,
|
|
3547
|
+
tabIndex: -1,
|
|
3548
|
+
type: "button",
|
|
3549
|
+
onClick: handleClear,
|
|
3550
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("svg", {
|
|
3551
|
+
"aria-hidden": "true",
|
|
3552
|
+
fill: "none",
|
|
3553
|
+
height: "12",
|
|
3554
|
+
viewBox: "0 0 12 12",
|
|
3555
|
+
width: "12",
|
|
3556
|
+
children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("path", {
|
|
3557
|
+
d: "M2 2L10 10M10 2L2 10",
|
|
3558
|
+
stroke: "currentColor",
|
|
3559
|
+
strokeLinecap: "round",
|
|
3560
|
+
strokeWidth: "1.5"
|
|
3561
|
+
})
|
|
3562
|
+
})
|
|
3563
|
+
}) : null
|
|
3564
|
+
]
|
|
3474
3565
|
}),
|
|
3475
3566
|
description ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
|
|
3476
3567
|
className: components_text_field_module.description,
|