@ledgerhq/lumen-ui-react 0.1.54 → 0.1.56
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/Components/core/Card/Card.d.ts.map +1 -1
- package/dist/lib/Components/core/Card/Card.js +29 -25
- package/dist/lib/Components/core/SearchInput/types.d.ts +2 -2
- package/dist/lib/Components/core/SearchInput/types.d.ts.map +1 -1
- package/dist/lib/Components/core/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/lib/Components/core/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/lib/Components/core/SegmentedControl/SegmentedControl.js +242 -97
- package/dist/lib/Components/core/SegmentedControl/SegmentedControlContext.d.ts +2 -1
- package/dist/lib/Components/core/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
- package/dist/lib/Components/core/SegmentedControl/types.d.ts +4 -3
- package/dist/lib/Components/core/SegmentedControl/types.d.ts.map +1 -1
- package/dist/lib/Components/core/SegmentedControl/usePillElementLayoutEffect.js +13 -12
- package/dist/lib/Components/core/SegmentedControl/useScrollArrows.d.ts +16 -0
- package/dist/lib/Components/core/SegmentedControl/useScrollArrows.d.ts.map +1 -0
- package/dist/lib/Components/core/SegmentedControl/useScrollArrows.js +51 -0
- package/dist/lib/Components/core/TextInput/types.d.ts +1 -2
- package/dist/lib/Components/core/TextInput/types.d.ts.map +1 -1
- package/dist/lib/Components/internal/BaseInput/BaseInput.d.ts +2 -16
- package/dist/lib/Components/internal/BaseInput/BaseInput.d.ts.map +1 -1
- package/dist/lib/Components/internal/BaseInput/BaseInput.js +141 -168
- package/dist/lib/Components/internal/BaseInput/BaseInputCounter.d.ts +8 -0
- package/dist/lib/Components/internal/BaseInput/BaseInputCounter.d.ts.map +1 -0
- package/dist/lib/Components/internal/BaseInput/BaseInputCounter.js +8 -0
- package/dist/lib/Components/internal/BaseInput/BaseInputHelperText.d.ts +8 -0
- package/dist/lib/Components/internal/BaseInput/BaseInputHelperText.d.ts.map +1 -0
- package/dist/lib/Components/internal/BaseInput/BaseInputHelperText.js +37 -0
- package/dist/lib/Components/internal/BaseInput/BaseInputLabel.d.ts +8 -0
- package/dist/lib/Components/internal/BaseInput/BaseInputLabel.d.ts.map +1 -0
- package/dist/lib/Components/internal/BaseInput/BaseInputLabel.js +48 -0
- package/dist/lib/Components/internal/BaseInput/BaseInputMultiline.d.ts +9 -0
- package/dist/lib/Components/internal/BaseInput/BaseInputMultiline.d.ts.map +1 -0
- package/dist/lib/Components/internal/BaseInput/BaseInputMultiline.js +88 -0
- package/dist/lib/Components/internal/BaseInput/BaseInputSingleLine.d.ts +8 -0
- package/dist/lib/Components/internal/BaseInput/BaseInputSingleLine.d.ts.map +1 -0
- package/dist/lib/Components/internal/BaseInput/BaseInputSingleLine.js +25 -0
- package/dist/lib/Components/internal/BaseInput/types.d.ts +72 -1
- package/dist/lib/Components/internal/BaseInput/types.d.ts.map +1 -1
- package/dist/lib/Components/internal/BaseInput/useAutosizeTextarea/index.d.ts +2 -0
- package/dist/lib/Components/internal/BaseInput/useAutosizeTextarea/index.d.ts.map +1 -0
- package/dist/lib/Components/internal/BaseInput/useAutosizeTextarea/useAutosizeTextarea.d.ts +20 -0
- package/dist/lib/Components/internal/BaseInput/useAutosizeTextarea/useAutosizeTextarea.d.ts.map +1 -0
- package/dist/lib/Components/internal/BaseInput/useAutosizeTextarea/useAutosizeTextarea.js +49 -0
- package/dist/lib/Components/internal/BaseInput/useBaseInputValue/useBaseInputValue.d.ts +26 -0
- package/dist/lib/Components/internal/BaseInput/useBaseInputValue/useBaseInputValue.d.ts.map +1 -0
- package/dist/lib/Components/internal/BaseInput/useBaseInputValue/useBaseInputValue.js +35 -0
- package/dist/package.json +3 -3
- package/package.json +2 -2
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export type ScrollDirection = 'left' | 'right';
|
|
3
|
+
/**
|
|
4
|
+
* Overflow state and the scroll action backing the left/right arrow buttons.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useScrollArrows(scrollRef: RefObject<HTMLDivElement | null>): {
|
|
7
|
+
canScrollLeft: boolean;
|
|
8
|
+
canScrollRight: boolean;
|
|
9
|
+
scrollBy: (direction: ScrollDirection) => void;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Centers the selected segment on mount only, so a later selection change never
|
|
13
|
+
* fights the scroll position the user set by hand.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useScrollSelectedIntoView(scrollRef: RefObject<HTMLDivElement | null>, selectedIndex: number): void;
|
|
16
|
+
//# sourceMappingURL=useScrollArrows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScrollArrows.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/core/SegmentedControl/useScrollArrows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,OAAO,CAAC;AA8C/C;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG;IAC5E,aAAa,EAAE,OAAO,CAAC;IACvB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,CAAC,SAAS,EAAE,eAAe,KAAK,IAAI,CAAC;CAChD,CAmBA;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,EAC3C,aAAa,EAAE,MAAM,GACpB,IAAI,CAmBN"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { useCallback as u, useLayoutEffect as f, useState as i } from "react";
|
|
2
|
+
function a(n) {
|
|
3
|
+
const [o, r] = i(!1), [s, c] = i(!1), e = u(() => {
|
|
4
|
+
const t = n.current;
|
|
5
|
+
t && (r(t.scrollLeft > 0), c(t.scrollLeft + t.clientWidth < t.scrollWidth - 1));
|
|
6
|
+
}, [n]);
|
|
7
|
+
return f(() => {
|
|
8
|
+
const t = n.current;
|
|
9
|
+
if (!t)
|
|
10
|
+
return;
|
|
11
|
+
e(), t.addEventListener("scroll", e, { passive: !0 });
|
|
12
|
+
const l = new ResizeObserver(e);
|
|
13
|
+
return l.observe(t), t.firstElementChild instanceof HTMLElement && l.observe(t.firstElementChild), () => {
|
|
14
|
+
t.removeEventListener("scroll", e), l.disconnect();
|
|
15
|
+
};
|
|
16
|
+
}, [e, n]), { canScrollLeft: o, canScrollRight: s };
|
|
17
|
+
}
|
|
18
|
+
function S(n) {
|
|
19
|
+
const { canScrollLeft: o, canScrollRight: r } = a(n), s = u(
|
|
20
|
+
(c) => {
|
|
21
|
+
const e = n.current;
|
|
22
|
+
if (!e)
|
|
23
|
+
return;
|
|
24
|
+
const t = e.clientWidth / 2;
|
|
25
|
+
e.scrollBy({
|
|
26
|
+
left: c === "left" ? -t : t,
|
|
27
|
+
behavior: "smooth"
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
[n]
|
|
31
|
+
);
|
|
32
|
+
return { canScrollLeft: o, canScrollRight: r, scrollBy: s };
|
|
33
|
+
}
|
|
34
|
+
function d(n, o) {
|
|
35
|
+
f(() => {
|
|
36
|
+
if (o < 0)
|
|
37
|
+
return;
|
|
38
|
+
const r = n.current;
|
|
39
|
+
if (!r)
|
|
40
|
+
return;
|
|
41
|
+
const c = r.querySelectorAll('button[role="radio"]')[o];
|
|
42
|
+
if (c) {
|
|
43
|
+
const { offsetLeft: e, offsetWidth: t } = c, { clientWidth: l } = r;
|
|
44
|
+
r.scrollLeft = e - (l - t) / 2;
|
|
45
|
+
}
|
|
46
|
+
}, []);
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
S as useScrollArrows,
|
|
50
|
+
d as useScrollSelectedIntoView
|
|
51
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ComponentPropsWithRef } from 'react';
|
|
2
1
|
import { BaseInputProps } from '../../internal/BaseInput/types';
|
|
3
|
-
export type TextInputProps = Omit<BaseInputProps, 'prefix' | 'labelClassName' | 'inputClassName'
|
|
2
|
+
export type TextInputProps = Omit<BaseInputProps, 'prefix' | 'labelClassName' | 'inputClassName'>;
|
|
4
3
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/core/TextInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/core/TextInput/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,cAAc,EACd,QAAQ,GAAG,gBAAgB,GAAG,gBAAgB,CAC/C,CAAC"}
|
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
import { BaseInputProps } from './types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* Shows a clear button by default when input has content. Use hideClearButton to hide it.
|
|
5
|
-
* This is an internal component used to build other input components.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Automatic clear button that works with both controlled and uncontrolled inputs
|
|
9
|
-
* - Native-like clear behavior using HTMLInputElement.prototype.value setter
|
|
10
|
-
* - Proper event dispatching that React can intercept for controlled components
|
|
11
|
-
* - Floating label with smooth transitions
|
|
12
|
-
* - Error state styling and accessibility
|
|
13
|
-
*
|
|
14
|
-
* Supports className customization for different elements:
|
|
15
|
-
* - `className`: Applied to the container/root element
|
|
16
|
-
* - `inputClassName`: Applied to the input element
|
|
17
|
-
* - `labelClassName`: Applied to the floating label element
|
|
3
|
+
* Internal field chrome shared by `TextInput`, `SearchInput`, and `AddressInput`.
|
|
18
4
|
*
|
|
19
5
|
* @internal
|
|
20
6
|
*/
|
|
21
|
-
export declare const BaseInput: ({ ref, className, containerClassName, inputClassName, labelClassName, label, id, disabled: disabledProp, helperText, maxCount, status, suffix, prefix, onClear, hideClearButton, readOnly, "aria-invalid": ariaInvalidProp, onChange: onChangeProp, placeholder: placeholderProp, ...props }: BaseInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const BaseInput: ({ ref, className, containerClassName, inputClassName, labelClassName, label, id, disabled: disabledProp, helperText, maxCount, status, suffix, prefix, onClear, hideClearButton, readOnly, "aria-invalid": ariaInvalidProp, onChange: onChangeProp, placeholder: placeholderProp, multiline, minLines, maxLines, scrollbarWidth, type, ...props }: BaseInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
8
|
//# sourceMappingURL=BaseInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInput.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/internal/BaseInput/BaseInput.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"BaseInput.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/internal/BaseInput/BaseInput.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAsC9C;;;;GAIG;AAEH,eAAO,MAAM,SAAS,GAAI,mVA0BvB,cAAc,4CA4JhB,CAAC"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useDisabledContext as
|
|
3
|
-
import { cva as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
1
|
+
import { jsx as e, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { useDisabledContext as Z, resolveBaseInputPlaceholder as _, cn as I } from "../../../../libs/utils-shared/dist/index.js";
|
|
3
|
+
import { cva as O } from "class-variance-authority";
|
|
4
|
+
import { useId as ee } from "react";
|
|
5
|
+
import { BaseInputCounter as te } from "./BaseInputCounter.js";
|
|
6
|
+
import { BaseInputHelperText as ae } from "./BaseInputHelperText.js";
|
|
7
|
+
import { BaseInputLabel as re } from "./BaseInputLabel.js";
|
|
8
|
+
import { BaseInputMultiline as ne } from "./BaseInputMultiline.js";
|
|
9
|
+
import { BaseInputSingleLine as se } from "./BaseInputSingleLine.js";
|
|
10
|
+
import { useBaseInputValue as ie } from "./useBaseInputValue/useBaseInputValue.js";
|
|
11
|
+
import { useCommonTranslation as oe } from "../../../../i18n/useCommonTranslation.js";
|
|
12
|
+
import { InteractiveIcon as le } from "../../core/InteractiveIcon/InteractiveIcon.js";
|
|
13
|
+
import { DeleteCircleFill as ce } from "../../symbols/icons/DeleteCircleFill.js";
|
|
14
|
+
const ue = O(
|
|
11
15
|
[
|
|
12
|
-
"group relative flex
|
|
16
|
+
"group relative flex w-full cursor-text gap-8 rounded-sm bg-muted px-16 transition-colors",
|
|
13
17
|
"focus-within:ring-2 focus-within:ring-active hover:bg-muted-hover",
|
|
14
18
|
"has-disabled:cursor-not-allowed has-disabled:bg-disabled has-disabled:text-disabled"
|
|
15
19
|
],
|
|
@@ -19,202 +23,171 @@ const le = g(
|
|
|
19
23
|
default: "",
|
|
20
24
|
error: "ring-1 ring-error focus-within:ring-2 focus-within:ring-error",
|
|
21
25
|
success: "ring-1 ring-success focus-within:ring-2 focus-within:ring-success"
|
|
26
|
+
},
|
|
27
|
+
multiline: {
|
|
28
|
+
true: "min-h-48 items-start",
|
|
29
|
+
false: "h-48 items-center"
|
|
30
|
+
},
|
|
31
|
+
hasLabel: {
|
|
32
|
+
true: "",
|
|
33
|
+
false: ""
|
|
22
34
|
}
|
|
23
35
|
},
|
|
36
|
+
compoundVariants: [
|
|
37
|
+
{ multiline: !0, hasLabel: !0, class: "py-6" },
|
|
38
|
+
{ multiline: !0, hasLabel: !1, class: "pt-12 pb-10" }
|
|
39
|
+
],
|
|
24
40
|
defaultVariants: {
|
|
25
|
-
status: "default"
|
|
41
|
+
status: "default",
|
|
42
|
+
multiline: !1,
|
|
43
|
+
hasLabel: !1
|
|
26
44
|
}
|
|
27
45
|
}
|
|
28
|
-
),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"[&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none",
|
|
34
|
-
"truncate"
|
|
35
|
-
), ce = s(
|
|
36
|
-
"pointer-events-none absolute top-6 left-16 origin-left body-4 text-muted transition-all duration-300",
|
|
37
|
-
"peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:scale-100 peer-placeholder-shown:body-2",
|
|
38
|
-
"group-has-disabled:text-disabled",
|
|
39
|
-
"peer-focus:top-6 peer-focus:translate-y-0 peer-focus:body-4",
|
|
40
|
-
"w-[calc(100%-var(--size-56))] truncate"
|
|
41
|
-
), de = g(ce, {
|
|
42
|
-
variants: {
|
|
43
|
-
status: {
|
|
44
|
-
default: "",
|
|
45
|
-
error: "text-error",
|
|
46
|
-
success: ""
|
|
47
|
-
},
|
|
48
|
-
floated: {
|
|
49
|
-
true: "peer-placeholder-shown:top-6 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:body-4",
|
|
50
|
-
false: ""
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
defaultVariants: {
|
|
54
|
-
status: "default",
|
|
55
|
-
floated: !1
|
|
56
|
-
}
|
|
57
|
-
}), ue = g("flex items-center gap-2 body-3", {
|
|
58
|
-
variants: {
|
|
59
|
-
status: {
|
|
60
|
-
default: "text-muted",
|
|
61
|
-
error: "text-error",
|
|
62
|
-
success: "text-success"
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
defaultVariants: {
|
|
66
|
-
status: "default"
|
|
67
|
-
}
|
|
68
|
-
}), Ce = ({
|
|
69
|
-
ref: a,
|
|
70
|
-
className: o,
|
|
71
|
-
containerClassName: t,
|
|
72
|
-
inputClassName: F,
|
|
46
|
+
), Ve = ({
|
|
47
|
+
ref: w,
|
|
48
|
+
className: B,
|
|
49
|
+
containerClassName: C,
|
|
50
|
+
inputClassName: L,
|
|
73
51
|
labelClassName: P,
|
|
74
|
-
label:
|
|
75
|
-
id:
|
|
76
|
-
disabled:
|
|
77
|
-
helperText:
|
|
78
|
-
maxCount:
|
|
79
|
-
status:
|
|
80
|
-
suffix:
|
|
81
|
-
prefix:
|
|
82
|
-
onClear:
|
|
83
|
-
hideClearButton:
|
|
84
|
-
readOnly:
|
|
85
|
-
"aria-invalid":
|
|
86
|
-
onChange:
|
|
87
|
-
placeholder:
|
|
88
|
-
|
|
52
|
+
label: t,
|
|
53
|
+
id: V,
|
|
54
|
+
disabled: x,
|
|
55
|
+
helperText: l,
|
|
56
|
+
maxCount: r,
|
|
57
|
+
status: n,
|
|
58
|
+
suffix: y,
|
|
59
|
+
prefix: N,
|
|
60
|
+
onClear: j,
|
|
61
|
+
hideClearButton: F = !1,
|
|
62
|
+
readOnly: m = !1,
|
|
63
|
+
"aria-invalid": D,
|
|
64
|
+
onChange: R,
|
|
65
|
+
placeholder: S,
|
|
66
|
+
multiline: s = !1,
|
|
67
|
+
minLines: A,
|
|
68
|
+
maxLines: H,
|
|
69
|
+
scrollbarWidth: W,
|
|
70
|
+
type: $,
|
|
71
|
+
...i
|
|
89
72
|
}) => {
|
|
90
|
-
const
|
|
73
|
+
const h = Z({
|
|
91
74
|
consumerName: "BaseInput",
|
|
92
|
-
mergeWith: { disabled:
|
|
93
|
-
}), { t:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
75
|
+
mergeWith: { disabled: x }
|
|
76
|
+
}), { t: k } = oe(), {
|
|
77
|
+
inputRef: q,
|
|
78
|
+
composedRef: f,
|
|
79
|
+
currentValue: z,
|
|
80
|
+
hasContent: M,
|
|
81
|
+
handleChange: T,
|
|
82
|
+
handleClear: E
|
|
83
|
+
} = ie({
|
|
84
|
+
value: i.value,
|
|
85
|
+
defaultValue: i.defaultValue,
|
|
86
|
+
onChange: R,
|
|
87
|
+
onClear: j,
|
|
88
|
+
ref: w
|
|
89
|
+
}), G = ee(), c = V || `input-${G}`, J = D ?? (n === "error" ? !0 : void 0), { inputPlaceholder: K, labelStaysFloatedWithPlaceholder: Q } = _({
|
|
90
|
+
label: t,
|
|
91
|
+
placeholder: S
|
|
92
|
+
}), U = M && !h && !m && !F, X = z.length, p = !!(r && r > 0), g = `${c}-helper`, o = !!l, b = {
|
|
93
|
+
id: c,
|
|
94
|
+
disabled: h,
|
|
95
|
+
readOnly: m,
|
|
96
|
+
placeholder: K,
|
|
97
|
+
"aria-invalid": J,
|
|
98
|
+
"aria-describedby": o ? g : void 0,
|
|
99
|
+
hasLabel: !!t,
|
|
100
|
+
className: L,
|
|
101
|
+
onChange: T
|
|
102
|
+
}, u = U ? /* @__PURE__ */ e(
|
|
103
|
+
le,
|
|
104
|
+
{
|
|
105
|
+
iconType: "filled",
|
|
106
|
+
icon: ce,
|
|
107
|
+
size: 20,
|
|
108
|
+
onClick: E,
|
|
109
|
+
"aria-label": k("components.baseInput.clearInputAriaLabel")
|
|
110
|
+
}
|
|
111
|
+
) : y;
|
|
112
|
+
return /* @__PURE__ */ d("div", { className: B, children: [
|
|
113
|
+
/* @__PURE__ */ d(
|
|
114
114
|
"div",
|
|
115
115
|
{
|
|
116
|
-
className:
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
className: I(
|
|
117
|
+
ue({ status: n, multiline: s, hasLabel: !!t }),
|
|
118
|
+
C
|
|
119
|
+
),
|
|
120
|
+
onPointerDown: (Y) => {
|
|
121
|
+
if (Y.target.closest("input, textarea, button, a")) return;
|
|
122
|
+
const a = q.current;
|
|
123
|
+
if (!a) return;
|
|
124
|
+
const v = a.value.length > 0 ? a.value.length : 0;
|
|
122
125
|
window.requestAnimationFrame(() => {
|
|
123
126
|
try {
|
|
124
|
-
|
|
127
|
+
a.setSelectionRange(v, v);
|
|
125
128
|
} catch {
|
|
126
129
|
}
|
|
127
|
-
|
|
130
|
+
a.focus();
|
|
128
131
|
});
|
|
129
132
|
},
|
|
130
133
|
children: [
|
|
131
|
-
|
|
132
|
-
/* @__PURE__ */ e(
|
|
133
|
-
|
|
134
|
+
N,
|
|
135
|
+
s ? /* @__PURE__ */ e(
|
|
136
|
+
ne,
|
|
134
137
|
{
|
|
135
|
-
ref:
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
"aria-describedby": h ? V : void 0,
|
|
142
|
-
className: s(
|
|
143
|
-
ie,
|
|
144
|
-
i && "pt-12 body-2",
|
|
145
|
-
F
|
|
146
|
-
),
|
|
147
|
-
onChange: q,
|
|
148
|
-
...u
|
|
138
|
+
ref: f,
|
|
139
|
+
minLines: A,
|
|
140
|
+
maxLines: H,
|
|
141
|
+
scrollbarWidth: W,
|
|
142
|
+
...b,
|
|
143
|
+
...i
|
|
149
144
|
}
|
|
150
|
-
)
|
|
151
|
-
|
|
152
|
-
"label",
|
|
145
|
+
) : /* @__PURE__ */ e(
|
|
146
|
+
se,
|
|
153
147
|
{
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
floated: G
|
|
159
|
-
}),
|
|
160
|
-
P
|
|
161
|
-
),
|
|
162
|
-
children: i
|
|
148
|
+
ref: f,
|
|
149
|
+
type: $,
|
|
150
|
+
...b,
|
|
151
|
+
...i
|
|
163
152
|
}
|
|
164
153
|
),
|
|
165
|
-
|
|
166
|
-
|
|
154
|
+
t && /* @__PURE__ */ e(
|
|
155
|
+
re,
|
|
167
156
|
{
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
157
|
+
htmlFor: c,
|
|
158
|
+
status: n,
|
|
159
|
+
floated: Q,
|
|
160
|
+
multiline: s,
|
|
161
|
+
className: P,
|
|
162
|
+
children: t
|
|
173
163
|
}
|
|
174
164
|
),
|
|
175
|
-
|
|
165
|
+
s && u ? /* @__PURE__ */ e("div", { className: "pt-2", children: u }) : u
|
|
176
166
|
]
|
|
177
167
|
}
|
|
178
168
|
),
|
|
179
|
-
(
|
|
169
|
+
(o || p) && /* @__PURE__ */ d(
|
|
180
170
|
"div",
|
|
181
171
|
{
|
|
182
|
-
className:
|
|
172
|
+
className: I(
|
|
183
173
|
"mt-8 flex items-start gap-8",
|
|
184
|
-
|
|
174
|
+
o ? "justify-between" : "justify-end"
|
|
185
175
|
),
|
|
186
176
|
children: [
|
|
187
|
-
|
|
188
|
-
|
|
177
|
+
o && l && /* @__PURE__ */ e(
|
|
178
|
+
ae,
|
|
189
179
|
{
|
|
190
|
-
id:
|
|
191
|
-
helperText:
|
|
192
|
-
status:
|
|
180
|
+
id: g,
|
|
181
|
+
helperText: l,
|
|
182
|
+
status: n
|
|
193
183
|
}
|
|
194
184
|
),
|
|
195
|
-
|
|
185
|
+
p && r != null && /* @__PURE__ */ e(te, { count: X, maxCount: r })
|
|
196
186
|
]
|
|
197
187
|
}
|
|
198
188
|
)
|
|
199
189
|
] });
|
|
200
|
-
}
|
|
201
|
-
id: a,
|
|
202
|
-
helperText: o,
|
|
203
|
-
status: t
|
|
204
|
-
}) => /* @__PURE__ */ f(
|
|
205
|
-
"div",
|
|
206
|
-
{
|
|
207
|
-
id: a,
|
|
208
|
-
className: ue({ status: t }),
|
|
209
|
-
role: t === "error" ? "alert" : void 0,
|
|
210
|
-
children: [
|
|
211
|
-
!t && /* @__PURE__ */ e(oe, { size: 16, className: "text-muted" }),
|
|
212
|
-
t === "error" && /* @__PURE__ */ e(B, { size: 16, className: "text-error" }),
|
|
213
|
-
t === "success" && /* @__PURE__ */ e(ne, { size: 16, className: "text-success" }),
|
|
214
|
-
/* @__PURE__ */ e("span", { className: "body-3", children: o })
|
|
215
|
-
]
|
|
216
|
-
}
|
|
217
|
-
), he = ({ count: a, maxCount: o }) => /* @__PURE__ */ e("span", { "aria-live": "polite", className: "shrink-0 body-3 text-muted", children: `${a}/${o}` });
|
|
190
|
+
};
|
|
218
191
|
export {
|
|
219
|
-
|
|
192
|
+
Ve as BaseInput
|
|
220
193
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseInputCounterProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Character counter rendered below the control inside `BaseInput`.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare const BaseInputCounter: ({ count, maxCount, }: BaseInputCounterProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=BaseInputCounter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseInputCounter.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/internal/BaseInput/BaseInputCounter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,sBAG9B,qBAAqB,4CAMvB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseInputHelperTextProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Hint, error or success copy rendered below the control inside `BaseInput`.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare const BaseInputHelperText: ({ id, helperText, status, }: BaseInputHelperTextProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=BaseInputHelperText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseInputHelperText.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/internal/BaseInput/BaseInputHelperText.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAexD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,6BAIjC,wBAAwB,4CAiB1B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsxs as a, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { cva as l } from "class-variance-authority";
|
|
3
|
+
import { InformationFill as o } from "../../symbols/icons/InformationFill.js";
|
|
4
|
+
import { DeleteCircleFill as c } from "../../symbols/icons/DeleteCircleFill.js";
|
|
5
|
+
import { CheckmarkCircleFill as i } from "../../symbols/icons/CheckmarkCircleFill.js";
|
|
6
|
+
const m = l("flex items-center gap-2 body-3", {
|
|
7
|
+
variants: {
|
|
8
|
+
status: {
|
|
9
|
+
default: "text-muted",
|
|
10
|
+
error: "text-error",
|
|
11
|
+
success: "text-success"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
status: "default"
|
|
16
|
+
}
|
|
17
|
+
}), u = ({
|
|
18
|
+
id: s,
|
|
19
|
+
helperText: t,
|
|
20
|
+
status: e
|
|
21
|
+
}) => /* @__PURE__ */ a(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
id: s,
|
|
25
|
+
className: m({ status: e }),
|
|
26
|
+
role: e === "error" ? "alert" : void 0,
|
|
27
|
+
children: [
|
|
28
|
+
!e && /* @__PURE__ */ r(o, { size: 16, className: "text-muted" }),
|
|
29
|
+
e === "error" && /* @__PURE__ */ r(c, { size: 16, className: "text-error" }),
|
|
30
|
+
e === "success" && /* @__PURE__ */ r(i, { size: 16, className: "text-success" }),
|
|
31
|
+
/* @__PURE__ */ r("span", { className: "body-3", children: t })
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
export {
|
|
36
|
+
u as BaseInputHelperText
|
|
37
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseInputLabelProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Floating label rendered over the control inside `BaseInput`.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare const BaseInputLabel: ({ htmlFor, status, floated, multiline, className, children, }: BaseInputLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=BaseInputLabel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseInputLabel.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/internal/BaseInput/BaseInputLabel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAiCnD;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,+DAO5B,mBAAmB,4CASrB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { cn as e } from "../../../../libs/utils-shared/dist/index.js";
|
|
3
|
+
import { cva as p } from "class-variance-authority";
|
|
4
|
+
const c = e(
|
|
5
|
+
"pointer-events-none absolute top-6 left-16 origin-left body-4 text-muted transition-all duration-300",
|
|
6
|
+
"peer-placeholder-shown:top-1/2 peer-placeholder-shown:-translate-y-1/2 peer-placeholder-shown:scale-100 peer-placeholder-shown:body-2",
|
|
7
|
+
"group-has-disabled:text-disabled",
|
|
8
|
+
"peer-focus:top-6 peer-focus:translate-y-0 peer-focus:body-4",
|
|
9
|
+
"w-[calc(100%-var(--size-56))] truncate"
|
|
10
|
+
), d = p(c, {
|
|
11
|
+
variants: {
|
|
12
|
+
status: {
|
|
13
|
+
default: "",
|
|
14
|
+
error: "text-error",
|
|
15
|
+
success: ""
|
|
16
|
+
},
|
|
17
|
+
multiline: {
|
|
18
|
+
true: "peer-placeholder-shown:top-14 peer-placeholder-shown:translate-y-0",
|
|
19
|
+
false: ""
|
|
20
|
+
},
|
|
21
|
+
floated: {
|
|
22
|
+
true: "peer-placeholder-shown:top-6 peer-placeholder-shown:translate-y-0 peer-placeholder-shown:body-4",
|
|
23
|
+
false: ""
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
status: "default",
|
|
28
|
+
multiline: !1,
|
|
29
|
+
floated: !1
|
|
30
|
+
}
|
|
31
|
+
}), f = ({
|
|
32
|
+
htmlFor: t,
|
|
33
|
+
status: a,
|
|
34
|
+
floated: l,
|
|
35
|
+
multiline: r,
|
|
36
|
+
className: o,
|
|
37
|
+
children: s
|
|
38
|
+
}) => /* @__PURE__ */ n(
|
|
39
|
+
"label",
|
|
40
|
+
{
|
|
41
|
+
htmlFor: t,
|
|
42
|
+
className: e(d({ status: a, floated: l, multiline: r }), o),
|
|
43
|
+
children: s
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
export {
|
|
47
|
+
f as BaseInputLabel
|
|
48
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseInputMultilineProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The auto-growing multi-line control rendered inside `BaseInput`, paired with the
|
|
4
|
+
* hidden clone it is measured against.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export declare const BaseInputMultiline: ({ ref, className, hasLabel, minLines, maxLines, scrollbarWidth, onChange, ...props }: BaseInputMultilineProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=BaseInputMultiline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseInputMultiline.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/internal/BaseInput/BaseInputMultiline.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAkEvD;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,sFAShC,uBAAuB,4CAyCzB,CAAC"}
|