@oneplatformdev/ui 0.1.99-beta.35 → 0.1.99-beta.37
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/CHANGELOG.md +32 -0
- package/Form/FormRenderControl.d.ts.map +1 -1
- package/Form/FormRenderControl.js +26 -13
- package/Form/FormRenderControl.js.map +1 -1
- package/Form/FormRenderControl.types.d.ts +2 -1
- package/Form/FormRenderControl.types.d.ts.map +1 -1
- package/Form/FormTooltipButton.d.ts +6 -0
- package/Form/FormTooltipButton.d.ts.map +1 -0
- package/Form/FormTooltipButton.js +34 -0
- package/Form/FormTooltipButton.js.map +1 -0
- package/FormInput/FormInput.d.ts.map +1 -1
- package/FormInput/FormInput.js +22 -21
- package/FormInput/FormInput.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
## 0.1.99-beta.37 (2026-01-13)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- **Textarea:** disable resizing and adjust padding for counter display ([4b23449](https://github.com/oneplatformdev/core-web/commit/4b23449))
|
|
6
|
+
|
|
7
|
+
### 🧱 Updated Dependencies
|
|
8
|
+
|
|
9
|
+
- Updated @oneplatformdev/utils to 0.1.99-beta.37
|
|
10
|
+
- Updated @oneplatformdev/hooks to 0.1.99-beta.37
|
|
11
|
+
- Updated @oneplatformdev/tokens to 0.1.99-beta.37
|
|
12
|
+
|
|
13
|
+
### ❤️ Thank You
|
|
14
|
+
|
|
15
|
+
- Bohdan Radchenko
|
|
16
|
+
|
|
17
|
+
## 0.1.99-beta.36 (2026-01-13)
|
|
18
|
+
|
|
19
|
+
### 🩹 Fixes
|
|
20
|
+
|
|
21
|
+
- **Textarea:** disable resizing and adjust padding for counter display ([35bcccc](https://github.com/oneplatformdev/core-web/commit/35bcccc))
|
|
22
|
+
|
|
23
|
+
### 🧱 Updated Dependencies
|
|
24
|
+
|
|
25
|
+
- Updated @oneplatformdev/utils to 0.1.99-beta.36
|
|
26
|
+
- Updated @oneplatformdev/hooks to 0.1.99-beta.36
|
|
27
|
+
- Updated @oneplatformdev/tokens to 0.1.99-beta.36
|
|
28
|
+
|
|
29
|
+
### ❤️ Thank You
|
|
30
|
+
|
|
31
|
+
- Bohdan Radchenko
|
|
32
|
+
|
|
1
33
|
## 0.1.99-beta.35 (2026-01-13)
|
|
2
34
|
|
|
3
35
|
### 🩹 Fixes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormRenderControl.d.ts","sourceRoot":"","sources":["../../src/Form/FormRenderControl.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"FormRenderControl.d.ts","sourceRoot":"","sources":["../../src/Form/FormRenderControl.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI9C,eAAO,MAAM,iBAAiB,GAC5B,IAAI,SAAS,WAAW,GAAG,WAAW,EAEtC,OAAO,sBAAsB,CAAC,IAAI,CAAC,4CA4BpC,CAAC"}
|
|
@@ -1,22 +1,35 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { FormField as
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { jsx as r, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
import { FormField as a, FormItem as d, FormLabel as F, FormMessage as f } from "./Form.js";
|
|
3
|
+
import { cn as x } from "@oneplatformdev/utils";
|
|
4
|
+
import { FormTooltipButton as h } from "./FormTooltipButton.js";
|
|
5
|
+
const B = (n) => {
|
|
6
|
+
const { form: m, name: l, label: o, tooltip: e, render: s, containerProps: c = {}, ...i } = n;
|
|
5
7
|
return /* @__PURE__ */ r(
|
|
6
|
-
|
|
8
|
+
a,
|
|
7
9
|
{
|
|
8
|
-
control:
|
|
9
|
-
name:
|
|
10
|
-
render: (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
control: m.control,
|
|
11
|
+
name: l,
|
|
12
|
+
render: (p) => /* @__PURE__ */ t(d, { ...c, children: [
|
|
13
|
+
(o || e) && /* @__PURE__ */ t(
|
|
14
|
+
F,
|
|
15
|
+
{
|
|
16
|
+
className: x(
|
|
17
|
+
"flex items-center gap-1"
|
|
18
|
+
),
|
|
19
|
+
children: [
|
|
20
|
+
o && /* @__PURE__ */ r("span", { children: o }),
|
|
21
|
+
e && /* @__PURE__ */ r(h, { content: e })
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
),
|
|
25
|
+
s(p),
|
|
26
|
+
/* @__PURE__ */ r(f, {})
|
|
14
27
|
] }),
|
|
15
|
-
...
|
|
28
|
+
...i
|
|
16
29
|
}
|
|
17
30
|
);
|
|
18
31
|
};
|
|
19
32
|
export {
|
|
20
|
-
|
|
33
|
+
B as FormRenderControl
|
|
21
34
|
};
|
|
22
35
|
//# sourceMappingURL=FormRenderControl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormRenderControl.js","sources":["../../src/Form/FormRenderControl.tsx"],"sourcesContent":["import { FormField, FormItem, FormLabel, FormMessage } from
|
|
1
|
+
{"version":3,"file":"FormRenderControl.js","sources":["../../src/Form/FormRenderControl.tsx"],"sourcesContent":["import { FormField, FormItem, FormLabel, FormMessage } from \"./Form\";\nimport { FormRenderControlProps } from \"./FormRenderControl.types\";\nimport { FieldValues } from \"react-hook-form\";\nimport { cn } from \"@oneplatformdev/utils\";\nimport { FormTooltipButton } from \"./FormTooltipButton\";\n\nexport const FormRenderControl = <\n Data extends FieldValues = FieldValues,\n>(\n props: FormRenderControlProps<Data>\n) => {\n const { form, name, label, tooltip, render, containerProps = {}, ...rest } = props;\n return (\n <FormField\n control={form.control}\n name={name}\n render={(params) => (\n <FormItem {...containerProps}>\n {(label || tooltip) && (\n <FormLabel\n className={cn(\n \"flex items-center gap-1\"\n )}\n >\n {label && <span>{label}</span>}\n {tooltip && (\n <FormTooltipButton content={tooltip} />\n )}\n </FormLabel>\n )}\n {render(params)}\n <FormMessage />\n </FormItem>\n )}\n {...rest}\n />\n );\n};\n"],"names":["FormRenderControl","props","form","name","label","tooltip","render","containerProps","rest","jsx","FormField","params","jsxs","FormItem","FormLabel","cn","FormTooltipButton","FormMessage"],"mappings":";;;;AAMO,MAAMA,IAAoB,CAG/BC,MACG;AACH,QAAM,EAAE,MAAAC,GAAM,MAAAC,GAAM,OAAAC,GAAO,SAAAC,GAAS,QAAAC,GAAQ,gBAAAC,IAAiB,CAAA,GAAI,GAAGC,EAAA,IAASP;AAC7E,SACE,gBAAAQ;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAASR,EAAK;AAAA,MACd,MAAAC;AAAA,MACA,QAAQ,CAACQ,MACP,gBAAAC,EAACC,GAAA,EAAU,GAAGN,GACV,UAAA;AAAA,SAAAH,KAASC,MACT,gBAAAO;AAAA,UAACE;AAAA,UAAA;AAAA,YACC,WAAWC;AAAA,cACT;AAAA,YAAA;AAAA,YAGD,UAAA;AAAA,cAAAX,KAAS,gBAAAK,EAAC,UAAM,UAAAL,EAAA,CAAM;AAAA,cACtBC,KACC,gBAAAI,EAACO,GAAA,EAAkB,SAASX,EAAA,CAAS;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,QAI1CC,EAAOK,CAAM;AAAA,0BACbM,GAAA,CAAA,CAAY;AAAA,MAAA,GACf;AAAA,MAED,GAAGT;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HTMLAttributes, ReactElement } from 'react';
|
|
1
|
+
import { HTMLAttributes, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { ControllerFieldState, ControllerRenderProps, FieldPath, FieldValues, UseFormReturn, UseFormStateReturn } from 'react-hook-form';
|
|
3
3
|
export type FormRenderProps<Data extends FieldValues> = ({ field, fieldState, formState, }: {
|
|
4
4
|
field: ControllerRenderProps<Data, FieldPath<Data>>;
|
|
@@ -9,6 +9,7 @@ export interface FormRenderControlProps<Data extends FieldValues = FieldValues>
|
|
|
9
9
|
form: UseFormReturn<Data>;
|
|
10
10
|
name: FieldPath<Data>;
|
|
11
11
|
label?: string;
|
|
12
|
+
tooltip?: ReactNode;
|
|
12
13
|
render: FormRenderProps<Data>;
|
|
13
14
|
containerProps?: HTMLAttributes<HTMLDivElement>;
|
|
14
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormRenderControl.types.d.ts","sourceRoot":"","sources":["../../src/Form/FormRenderControl.types.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FormRenderControl.types.d.ts","sourceRoot":"","sources":["../../src/Form/FormRenderControl.types.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACrB,SAAS,EACT,WAAW,EACX,aAAa,EACb,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,eAAe,CAAC,IAAI,SAAS,WAAW,IAAI,CAAC,EACvD,KAAK,EACL,UAAU,EACV,SAAS,GACV,EAAE;IACD,KAAK,EAAE,qBAAqB,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACpD,UAAU,EAAE,oBAAoB,CAAC;IACjC,SAAS,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;CACrC,KAAK,YAAY,CAAC;AAEnB,MAAM,WAAW,sBAAsB,CACrC,IAAI,SAAS,WAAW,GAAG,WAAW;IAEtC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAC1B,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;IAC9B,cAAc,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CACjD;AAED,MAAM,MAAM,4BAA4B,CACtC,IAAI,SAAS,WAAW,GAAG,WAAW,IACpC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormTooltipButton.d.ts","sourceRoot":"","sources":["../../src/Form/FormTooltipButton.tsx"],"names":[],"mappings":"AAKA,UAAU,sBAAsB;IAC9B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;AAED,eAAO,MAAM,iBAAiB,GAAI,aAAa,sBAAsB,4CA0BpE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsxs as e, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { cn as t } from "@oneplatformdev/utils";
|
|
3
|
+
import { CircleQuestionMarkIcon as n } from "lucide-react";
|
|
4
|
+
import { Popover as i, PopoverTrigger as m, PopoverContent as l } from "../Popover/Popover.js";
|
|
5
|
+
import { ButtonIcon as a } from "../ButtonIcon/ButtonIcon.js";
|
|
6
|
+
import "../ButtonIcon/buttonIconVariants.js";
|
|
7
|
+
const h = ({ content: o }) => /* @__PURE__ */ e(i, { children: [
|
|
8
|
+
/* @__PURE__ */ r(m, { asChild: !0, children: /* @__PURE__ */ r(
|
|
9
|
+
a,
|
|
10
|
+
{
|
|
11
|
+
color: "primary",
|
|
12
|
+
className: "w-2 h-2 rounded-full border-none",
|
|
13
|
+
size: "xs",
|
|
14
|
+
children: /* @__PURE__ */ r(n, { size: 4 })
|
|
15
|
+
}
|
|
16
|
+
) }),
|
|
17
|
+
/* @__PURE__ */ r(
|
|
18
|
+
l,
|
|
19
|
+
{
|
|
20
|
+
side: "right",
|
|
21
|
+
align: "center",
|
|
22
|
+
className: t(
|
|
23
|
+
"w-auto max-w-80 rounded-xl bg-white px-4 py-3 shadow-lg",
|
|
24
|
+
"text-sm text-primary font-manrope font-normal",
|
|
25
|
+
"text-md leading-normal tracking-normal align-middle"
|
|
26
|
+
),
|
|
27
|
+
children: o
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
] });
|
|
31
|
+
export {
|
|
32
|
+
h as FormTooltipButton
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=FormTooltipButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormTooltipButton.js","sources":["../../src/Form/FormTooltipButton.tsx"],"sourcesContent":["import { cn } from \"@oneplatformdev/utils\";\nimport { CircleQuestionMarkIcon } from \"lucide-react\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../Popover\";\nimport ButtonIcon from \"../ButtonIcon\";\n\ninterface FormTooltipButtonProps {\n content: React.ReactNode;\n}\n\nexport const FormTooltipButton = ({ content }: FormTooltipButtonProps) => {\n return (\n <Popover>\n <PopoverTrigger asChild>\n <ButtonIcon\n color=\"primary\"\n className=\"w-2 h-2 rounded-full border-none\"\n size=\"xs\"\n >\n <CircleQuestionMarkIcon size={4} />\n </ButtonIcon>\n </PopoverTrigger>\n\n <PopoverContent\n side=\"right\"\n align=\"center\"\n className={cn(\n \"w-auto max-w-80 rounded-xl bg-white px-4 py-3 shadow-lg\",\n \"text-sm text-primary font-manrope font-normal\",\n \"text-md leading-normal tracking-normal align-middle\"\n )}\n >\n {content}\n </PopoverContent>\n </Popover>\n );\n};\n"],"names":["FormTooltipButton","content","Popover","jsx","PopoverTrigger","ButtonIcon","CircleQuestionMarkIcon","PopoverContent","cn"],"mappings":";;;;;;AASO,MAAMA,IAAoB,CAAC,EAAE,SAAAC,0BAE/BC,GAAA,EACC,UAAA;AAAA,EAAA,gBAAAC,EAACC,GAAA,EAAe,SAAO,IACrB,UAAA,gBAAAD;AAAA,IAACE;AAAA,IAAA;AAAA,MACC,OAAM;AAAA,MACN,WAAU;AAAA,MACV,MAAK;AAAA,MAEL,UAAA,gBAAAF,EAACG,GAAA,EAAuB,MAAM,EAAA,CAAG;AAAA,IAAA;AAAA,EAAA,GAErC;AAAA,EAEA,gBAAAH;AAAA,IAACI;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,OAAM;AAAA,MACN,WAAWC;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,MAGD,UAAAP;AAAA,IAAA;AAAA,EAAA;AACH,GACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormInput.d.ts","sourceRoot":"","sources":["../../src/FormInput/FormInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAc,YAAY,EAAE,GAAG,EAAa,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FormInput.d.ts","sourceRoot":"","sources":["../../src/FormInput/FormInput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAc,YAAY,EAAE,GAAG,EAAa,MAAM,OAAO,CAAC;AAwGjE,eAAO,MAAM,SAAS,EAAiC,CAAC,IAAI,SAAS,WAAW,EAC9E,KAAK,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAA;CAAE,KAC1D,YAAY,CAAC"}
|
package/FormInput/FormInput.js
CHANGED
|
@@ -1,49 +1,50 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { FormControl as
|
|
3
|
-
import { FormRenderControl as
|
|
4
|
-
import { Input as
|
|
5
|
-
import { forwardRef as
|
|
6
|
-
function
|
|
7
|
-
const { form: u,
|
|
2
|
+
import { FormControl as F } from "../Form/Form.js";
|
|
3
|
+
import { FormRenderControl as I } from "../Form/FormRenderControl.js";
|
|
4
|
+
import { Input as P } from "../Input/Input.js";
|
|
5
|
+
import { forwardRef as y } from "react";
|
|
6
|
+
function B(c, e) {
|
|
7
|
+
const { form: u, tooltip: m, label: p, name: l, onChange: i, onBlur: f, onPaste: h, style: v, onPastePrepare: s, ...g } = c;
|
|
8
8
|
return /* @__PURE__ */ a(
|
|
9
|
-
|
|
9
|
+
I,
|
|
10
10
|
{
|
|
11
11
|
form: u,
|
|
12
12
|
name: l,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
tooltip: m,
|
|
14
|
+
label: p,
|
|
15
|
+
render: ({ field: n }) => /* @__PURE__ */ a(F, { children: /* @__PURE__ */ a(
|
|
16
|
+
P,
|
|
16
17
|
{
|
|
17
18
|
...n,
|
|
18
|
-
...
|
|
19
|
+
...g,
|
|
19
20
|
ref: (t) => {
|
|
20
21
|
n.ref(t), typeof e == "function" ? e(t) : e && (e.current = t);
|
|
21
22
|
},
|
|
22
|
-
style:
|
|
23
|
+
style: v,
|
|
23
24
|
value: n.value || "",
|
|
24
25
|
onChange: (...t) => {
|
|
25
|
-
n.onChange?.(...t),
|
|
26
|
+
n.onChange?.(...t), i?.(...t);
|
|
26
27
|
},
|
|
27
28
|
onPaste: (t) => {
|
|
28
|
-
const
|
|
29
|
-
let r = o.value.slice(0,
|
|
29
|
+
const d = t.clipboardData.getData("text"), o = t.currentTarget, C = o.selectionStart ?? o.value.length, x = o.selectionEnd ?? o.value.length;
|
|
30
|
+
let r = o.value.slice(0, C) + d + o.value.slice(x);
|
|
30
31
|
s && (r = s(r, t));
|
|
31
|
-
const
|
|
32
|
-
t.preventDefault(), u.setValue(l,
|
|
32
|
+
const D = r;
|
|
33
|
+
t.preventDefault(), u.setValue(l, D, {
|
|
33
34
|
shouldDirty: !0,
|
|
34
35
|
shouldTouch: !0
|
|
35
|
-
}),
|
|
36
|
+
}), h?.(t);
|
|
36
37
|
},
|
|
37
38
|
onBlur: (...t) => {
|
|
38
|
-
n.onBlur?.(),
|
|
39
|
+
n.onBlur?.(), f?.(...t);
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
) })
|
|
42
43
|
}
|
|
43
44
|
);
|
|
44
45
|
}
|
|
45
|
-
const
|
|
46
|
+
const E = y(B);
|
|
46
47
|
export {
|
|
47
|
-
|
|
48
|
+
E as FormInput
|
|
48
49
|
};
|
|
49
50
|
//# sourceMappingURL=FormInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormInput.js","sources":["../../src/FormInput/FormInput.tsx"],"sourcesContent":["import { FormControl, FormRenderControl } from '../Form';\nimport { Input } from '../Input';\nimport { FormInputProps } from './FormInput.types';\nimport { FieldValues, Path, PathValue } from 'react-hook-form';\nimport { forwardRef, ReactElement, Ref, RefObject } from 'react';\n\n// TODO: add description\n// export const FormInput = <Data extends FieldValues>(\n// props: FormInputProps<Data> & { inputRef?: Ref<HTMLInputElement> }\n// ) => {\n// const { inputRef, form, label, name, onChange, onBlur, style, ...rest } =\n// props;\n// return (\n// <FormRenderControl\n// form={form}\n// name={name}\n// label={label}\n// render={({ field }) => (\n// <FormControl>\n// <Input\n// {...field}\n// {...rest}\n// ref={(el) => {\n// field.ref(el);\n// if (typeof inputRef === 'function') {\n// inputRef(el);\n// } else if (inputRef) {\n// (inputRef as RefObject<HTMLInputElement | null>).current = el;\n// }\n// }}\n// style={style}\n// value={field.value || ''}\n// onChange={(...rest) => {\n// field.onChange?.(...rest);\n// onChange?.(...rest);\n// }}\n// onBlur={(...rest) => {\n// field.onBlur?.();\n// onBlur?.(...rest);\n// }}\n// />\n// </FormControl>\n// )}\n// />\n// );\n// };\n\nfunction FormInputInner<Data extends FieldValues>(\n props: FormInputProps<Data>,\n ref: Ref<HTMLInputElement>\n) {\n const { form, label, name, onChange, onBlur, onPaste, style, onPastePrepare, ...rest } = props;\n return (\n <FormRenderControl\n form={form}\n name={name}\n label={label}\n render={({ field }) => (\n <FormControl>\n <Input\n {...field}\n {...rest}\n ref={(el) => {\n field.ref(el);\n if (typeof ref === 'function') {\n ref(el);\n } else if (ref) {\n (ref as RefObject<HTMLInputElement | null>).current = el;\n }\n }}\n style={style}\n value={field.value || ''}\n onChange={(...rest) => {\n field.onChange?.(...rest);\n onChange?.(...rest);\n }}\n onPaste={(e) => {\n const pasted = e.clipboardData.getData('text');\n const t = e.currentTarget;\n\n const start = t.selectionStart ?? t.value.length;\n const end = t.selectionEnd ?? t.value.length;\n\n let next = t.value.slice(0, start) + pasted + t.value.slice(end);\n if(onPastePrepare) next = onPastePrepare(next, e);\n const value = next as unknown as PathValue<Data, Path<Data>>;\n\n e.preventDefault();\n\n form.setValue(name, value, {\n shouldDirty: true,\n shouldTouch: true,\n });\n\n onPaste?.(e);\n }}\n onBlur={(...rest) => {\n field.onBlur?.();\n onBlur?.(...rest);\n }}\n />\n </FormControl>\n )}\n />\n );\n}\n\nexport const FormInput = forwardRef(FormInputInner) as <Data extends FieldValues>(\n props: FormInputProps<Data> & { ref?: Ref<HTMLInputElement> }\n) => ReactElement;\n"],"names":["FormInputInner","props","ref","form","label","name","onChange","onBlur","onPaste","style","onPastePrepare","rest","jsx","FormRenderControl","field","FormControl","Input","el","e","pasted","t","start","end","next","value","FormInput","forwardRef"],"mappings":";;;;;AA+CA,SAASA,EACPC,GACAC,GACA;AACA,QAAM,EAAE,MAAAC,GAAM,OAAAC,GAAO,MAAAC,GAAM,UAAAC,GAAU,QAAAC,GAAQ,SAAAC,GAAS,OAAAC,GAAO,gBAAAC,GAAgB,GAAGC,EAAA,
|
|
1
|
+
{"version":3,"file":"FormInput.js","sources":["../../src/FormInput/FormInput.tsx"],"sourcesContent":["import { FormControl, FormRenderControl } from '../Form';\nimport { Input } from '../Input';\nimport { FormInputProps } from './FormInput.types';\nimport { FieldValues, Path, PathValue } from 'react-hook-form';\nimport { forwardRef, ReactElement, Ref, RefObject } from 'react';\n\n// TODO: add description\n// export const FormInput = <Data extends FieldValues>(\n// props: FormInputProps<Data> & { inputRef?: Ref<HTMLInputElement> }\n// ) => {\n// const { inputRef, form, label, name, onChange, onBlur, style, ...rest } =\n// props;\n// return (\n// <FormRenderControl\n// form={form}\n// name={name}\n// label={label}\n// render={({ field }) => (\n// <FormControl>\n// <Input\n// {...field}\n// {...rest}\n// ref={(el) => {\n// field.ref(el);\n// if (typeof inputRef === 'function') {\n// inputRef(el);\n// } else if (inputRef) {\n// (inputRef as RefObject<HTMLInputElement | null>).current = el;\n// }\n// }}\n// style={style}\n// value={field.value || ''}\n// onChange={(...rest) => {\n// field.onChange?.(...rest);\n// onChange?.(...rest);\n// }}\n// onBlur={(...rest) => {\n// field.onBlur?.();\n// onBlur?.(...rest);\n// }}\n// />\n// </FormControl>\n// )}\n// />\n// );\n// };\n\nfunction FormInputInner<Data extends FieldValues>(\n props: FormInputProps<Data>,\n ref: Ref<HTMLInputElement>\n) {\n const { form, tooltip, label, name, onChange, onBlur, onPaste, style, onPastePrepare, ...rest } = props;\n return (\n <FormRenderControl\n form={form}\n name={name}\n tooltip={tooltip}\n label={label}\n render={({ field }) => (\n <FormControl>\n <Input\n {...field}\n {...rest}\n ref={(el) => {\n field.ref(el);\n if (typeof ref === 'function') {\n ref(el);\n } else if (ref) {\n (ref as RefObject<HTMLInputElement | null>).current = el;\n }\n }}\n style={style}\n value={field.value || ''}\n onChange={(...rest) => {\n field.onChange?.(...rest);\n onChange?.(...rest);\n }}\n onPaste={(e) => {\n const pasted = e.clipboardData.getData('text');\n const t = e.currentTarget;\n\n const start = t.selectionStart ?? t.value.length;\n const end = t.selectionEnd ?? t.value.length;\n\n let next = t.value.slice(0, start) + pasted + t.value.slice(end);\n if(onPastePrepare) next = onPastePrepare(next, e);\n const value = next as unknown as PathValue<Data, Path<Data>>;\n\n e.preventDefault();\n\n form.setValue(name, value, {\n shouldDirty: true,\n shouldTouch: true,\n });\n\n onPaste?.(e);\n }}\n onBlur={(...rest) => {\n field.onBlur?.();\n onBlur?.(...rest);\n }}\n />\n </FormControl>\n )}\n />\n );\n}\n\nexport const FormInput = forwardRef(FormInputInner) as <Data extends FieldValues>(\n props: FormInputProps<Data> & { ref?: Ref<HTMLInputElement> }\n) => ReactElement;\n"],"names":["FormInputInner","props","ref","form","tooltip","label","name","onChange","onBlur","onPaste","style","onPastePrepare","rest","jsx","FormRenderControl","field","FormControl","Input","el","e","pasted","t","start","end","next","value","FormInput","forwardRef"],"mappings":";;;;;AA+CA,SAASA,EACPC,GACAC,GACA;AACA,QAAM,EAAE,MAAAC,GAAM,SAAAC,GAAS,OAAAC,GAAO,MAAAC,GAAM,UAAAC,GAAU,QAAAC,GAAQ,SAAAC,GAAS,OAAAC,GAAO,gBAAAC,GAAgB,GAAGC,EAAA,IAASX;AAClG,SACE,gBAAAY;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAAX;AAAA,MACA,MAAAG;AAAA,MACA,SAAAF;AAAA,MACA,OAAAC;AAAA,MACA,QAAQ,CAAC,EAAE,OAAAU,EAAA,wBACRC,GAAA,EACC,UAAA,gBAAAH;AAAA,QAACI;AAAA,QAAA;AAAA,UACE,GAAGF;AAAA,UACH,GAAGH;AAAA,UACJ,KAAK,CAACM,MAAO;AACX,YAAAH,EAAM,IAAIG,CAAE,GACR,OAAOhB,KAAQ,aACjBA,EAAIgB,CAAE,IACGhB,MACRA,EAA2C,UAAUgB;AAAA,UAE1D;AAAA,UACA,OAAAR;AAAA,UACA,OAAOK,EAAM,SAAS;AAAA,UACtB,UAAU,IAAIH,MAAS;AACrB,YAAAG,EAAM,WAAW,GAAGH,CAAI,GACxBL,IAAW,GAAGK,CAAI;AAAA,UACpB;AAAA,UACA,SAAS,CAACO,MAAM;AACd,kBAAMC,IAASD,EAAE,cAAc,QAAQ,MAAM,GACvCE,IAAIF,EAAE,eAENG,IAAQD,EAAE,kBAAkBA,EAAE,MAAM,QACpCE,IAAMF,EAAE,gBAAgBA,EAAE,MAAM;AAEtC,gBAAIG,IAAOH,EAAE,MAAM,MAAM,GAAGC,CAAK,IAAIF,IAASC,EAAE,MAAM,MAAME,CAAG;AAC/D,YAAGZ,MAAgBa,IAAOb,EAAea,GAAML,CAAC;AAChD,kBAAMM,IAAQD;AAEd,YAAAL,EAAE,eAAA,GAEFhB,EAAK,SAASG,GAAMmB,GAAO;AAAA,cACzB,aAAa;AAAA,cACb,aAAa;AAAA,YAAA,CACd,GAEDhB,IAAUU,CAAC;AAAA,UACb;AAAA,UACA,QAAQ,IAAIP,MAAS;AACnB,YAAAG,EAAM,SAAA,GACNP,IAAS,GAAGI,CAAI;AAAA,UAClB;AAAA,QAAA;AAAA,MAAA,EACF,CACF;AAAA,IAAA;AAAA,EAAA;AAIR;AAEO,MAAMc,IAAYC,EAAW3B,CAAc;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneplatformdev/ui",
|
|
3
|
-
"version": "0.1.99-beta.
|
|
3
|
+
"version": "0.1.99-beta.37",
|
|
4
4
|
"description": "UI component library for OnePlatform",
|
|
5
5
|
"author": "One Platform Development Team",
|
|
6
6
|
"keywords": [
|
|
@@ -105,9 +105,9 @@
|
|
|
105
105
|
"recharts": "^3.2.0",
|
|
106
106
|
"sonner": "^2.0.7",
|
|
107
107
|
"vaul": "^1.1.2",
|
|
108
|
-
"@oneplatformdev/tokens": "^0.1.99-beta.
|
|
109
|
-
"@oneplatformdev/
|
|
110
|
-
"@oneplatformdev/
|
|
108
|
+
"@oneplatformdev/tokens": "^0.1.99-beta.37",
|
|
109
|
+
"@oneplatformdev/utils": "^0.1.99-beta.37",
|
|
110
|
+
"@oneplatformdev/hooks": "^0.1.99-beta.37"
|
|
111
111
|
},
|
|
112
112
|
"scripts": {
|
|
113
113
|
"chromatic": "chromatic"
|