reactive-bulma 5.0.2 → 5.0.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/LICENSE +1 -1
- package/dist/components/atoms/Checkbox/index.js +53 -43
- package/dist/components/atoms/RadioButton/index.js +9 -8
- package/dist/components/molecules/FormFieldInput/index.js +93 -71
- package/dist/components/molecules/FormFieldInput/index.stories.d.ts +4 -0
- package/dist/interfaces/atomProps.d.ts +5 -1
- package/dist/interfaces/moleculeProps.d.ts +1 -0
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2025 Nicolás Omar González Passerino
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,67 +1,77 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { parseClasses as
|
|
4
|
-
const
|
|
1
|
+
import { jsxs as g, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as o } from "react";
|
|
3
|
+
import { parseClasses as v, parseTestId as a } from "../../../functions/parsers.js";
|
|
4
|
+
const d = (s) => s ? "-with-component" : "", N = ({
|
|
5
5
|
testId: s = null,
|
|
6
|
-
containerTestId:
|
|
7
|
-
cssClasses:
|
|
8
|
-
containerCssClasses:
|
|
9
|
-
style:
|
|
10
|
-
containerStyle:
|
|
6
|
+
containerTestId: c = null,
|
|
7
|
+
cssClasses: i = null,
|
|
8
|
+
containerCssClasses: l = null,
|
|
9
|
+
style: r = null,
|
|
10
|
+
containerStyle: h = null,
|
|
11
11
|
label: e = null,
|
|
12
12
|
isChecked: p,
|
|
13
|
-
name:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
name: t,
|
|
14
|
+
value: x,
|
|
15
|
+
isDisabled: k = !1,
|
|
16
|
+
onClick: u,
|
|
17
|
+
onChange: m,
|
|
18
|
+
onBlur: b
|
|
18
19
|
}) => {
|
|
19
|
-
const
|
|
20
|
-
() =>
|
|
21
|
-
[
|
|
22
|
-
),
|
|
23
|
-
() =>
|
|
20
|
+
const f = o(
|
|
21
|
+
() => v(["checkbox", l]),
|
|
22
|
+
[l]
|
|
23
|
+
), y = o(
|
|
24
|
+
() => c ?? a({
|
|
24
25
|
tag: "checkbox-container",
|
|
25
|
-
parsedClasses:
|
|
26
|
+
parsedClasses: d(e)
|
|
26
27
|
}),
|
|
27
|
-
[
|
|
28
|
-
),
|
|
29
|
-
() => s ??
|
|
28
|
+
[c, e]
|
|
29
|
+
), C = o(
|
|
30
|
+
() => s ?? a({
|
|
30
31
|
tag: "checkbox",
|
|
31
|
-
parsedClasses:
|
|
32
|
+
parsedClasses: d(e)
|
|
32
33
|
}),
|
|
33
34
|
[s, e]
|
|
34
35
|
);
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
"
|
|
36
|
+
return /* @__PURE__ */ g(
|
|
37
|
+
"section",
|
|
37
38
|
{
|
|
38
|
-
"data-testid":
|
|
39
|
-
className:
|
|
40
|
-
style:
|
|
39
|
+
"data-testid": y,
|
|
40
|
+
className: f,
|
|
41
|
+
style: h ?? void 0,
|
|
41
42
|
children: [
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ n(
|
|
43
44
|
"input",
|
|
44
45
|
{
|
|
45
|
-
|
|
46
|
+
id: t,
|
|
47
|
+
"data-testid": C,
|
|
46
48
|
type: "checkbox",
|
|
47
|
-
name:
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
name: t,
|
|
50
|
+
value: x,
|
|
51
|
+
className: i ?? void 0,
|
|
52
|
+
style: r ?? void 0,
|
|
50
53
|
defaultChecked: p,
|
|
51
|
-
disabled:
|
|
52
|
-
onClick:
|
|
53
|
-
onChange:
|
|
54
|
-
onBlur:
|
|
54
|
+
disabled: k,
|
|
55
|
+
onClick: u,
|
|
56
|
+
onChange: m,
|
|
57
|
+
onBlur: b
|
|
55
58
|
}
|
|
56
59
|
),
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
/* @__PURE__ */ n(
|
|
61
|
+
"label",
|
|
62
|
+
{
|
|
63
|
+
style: {
|
|
64
|
+
display: "inline-block",
|
|
65
|
+
marginLeft: "5px"
|
|
66
|
+
},
|
|
67
|
+
htmlFor: t,
|
|
68
|
+
children: e
|
|
69
|
+
}
|
|
70
|
+
)
|
|
61
71
|
]
|
|
62
72
|
}
|
|
63
73
|
);
|
|
64
74
|
};
|
|
65
75
|
export {
|
|
66
|
-
|
|
76
|
+
N as default
|
|
67
77
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { jsxs as B, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as h } from "react";
|
|
3
|
-
import { parseClasses as
|
|
4
|
-
import { generateKey as
|
|
3
|
+
import { parseClasses as v, parseTestId as x } from "../../../functions/parsers.js";
|
|
4
|
+
import { generateKey as I } from "../../../functions/generators.js";
|
|
5
5
|
const N = ({
|
|
6
6
|
containerTestId: o = null,
|
|
7
7
|
containerCssClasses: n = null,
|
|
8
|
-
containerStyle:
|
|
8
|
+
containerStyle: u = null,
|
|
9
9
|
options: s,
|
|
10
10
|
name: a,
|
|
11
11
|
onClick: r,
|
|
12
12
|
onChange: d,
|
|
13
13
|
onBlur: l
|
|
14
14
|
}) => {
|
|
15
|
-
const i =
|
|
15
|
+
const i = v([
|
|
16
16
|
"control",
|
|
17
17
|
n
|
|
18
|
-
]),
|
|
18
|
+
]), c = o ?? x({
|
|
19
19
|
tag: "container-",
|
|
20
20
|
parsedClasses: i
|
|
21
21
|
}), m = h(
|
|
@@ -36,6 +36,7 @@ const N = ({
|
|
|
36
36
|
type: "radio",
|
|
37
37
|
style: t.style ?? void 0,
|
|
38
38
|
name: a,
|
|
39
|
+
value: t.value,
|
|
39
40
|
defaultChecked: t.isChecked,
|
|
40
41
|
disabled: t.isDisabled,
|
|
41
42
|
onClick: r,
|
|
@@ -46,7 +47,7 @@ const N = ({
|
|
|
46
47
|
/* @__PURE__ */ e("p", { style: b, children: t.label })
|
|
47
48
|
]
|
|
48
49
|
},
|
|
49
|
-
`radio-button-item-${
|
|
50
|
+
`radio-button-item-${I()}`
|
|
50
51
|
);
|
|
51
52
|
}),
|
|
52
53
|
[s, a, r, d, l]
|
|
@@ -54,9 +55,9 @@ const N = ({
|
|
|
54
55
|
return /* @__PURE__ */ e(
|
|
55
56
|
"section",
|
|
56
57
|
{
|
|
57
|
-
"data-testid":
|
|
58
|
+
"data-testid": c,
|
|
58
59
|
className: i,
|
|
59
|
-
style:
|
|
60
|
+
style: u ?? void 0,
|
|
60
61
|
children: m
|
|
61
62
|
}
|
|
62
63
|
);
|
|
@@ -1,92 +1,114 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useMemo as
|
|
1
|
+
import { jsxs as i, Fragment as p, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as l } from "react";
|
|
3
3
|
import d from "../../atoms/Button/index.js";
|
|
4
4
|
import T from "../../atoms/TextArea/index.js";
|
|
5
5
|
import h from "../../atoms/Select/index.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { FormFieldType as
|
|
10
|
-
const
|
|
6
|
+
import N from "../../atoms/Checkbox/index.js";
|
|
7
|
+
import g from "../../atoms/RadioButton/index.js";
|
|
8
|
+
import b from "../InputControl/index.js";
|
|
9
|
+
import { FormFieldType as n } from "../../../interfaces/moleculeProps.js";
|
|
10
|
+
const a = ({ testId: c, element: o, isHorizontal: s }) => {
|
|
11
11
|
if (o === null) return null;
|
|
12
|
-
const
|
|
12
|
+
const e = {
|
|
13
13
|
testId: o.config?.testId ?? c ?? `test-form-field-${o.type}`,
|
|
14
14
|
containerTestId: c ?? `test-form-field-container-${o.type}`
|
|
15
|
-
}
|
|
15
|
+
}, r = o.fieldLabel ? /* @__PURE__ */ t(
|
|
16
|
+
"label",
|
|
17
|
+
{
|
|
18
|
+
"data-testid": `test-form-field-${o.type}-label`,
|
|
19
|
+
className: "label",
|
|
20
|
+
children: o.fieldLabel
|
|
21
|
+
}
|
|
22
|
+
) : null;
|
|
16
23
|
switch (o.type) {
|
|
17
|
-
case
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
|
|
24
|
+
case n.INPUT:
|
|
25
|
+
return /* @__PURE__ */ t(
|
|
26
|
+
b,
|
|
20
27
|
{
|
|
21
28
|
...o.config,
|
|
22
|
-
...
|
|
23
|
-
isHorizontal:
|
|
29
|
+
...e,
|
|
30
|
+
isHorizontal: s
|
|
24
31
|
}
|
|
25
32
|
);
|
|
26
|
-
case
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
33
|
+
case n.SELECT:
|
|
34
|
+
return /* @__PURE__ */ i("section", { className: "control", children: [
|
|
35
|
+
r,
|
|
36
|
+
/* @__PURE__ */ t(
|
|
37
|
+
h,
|
|
38
|
+
{
|
|
39
|
+
...o.config,
|
|
40
|
+
...e
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
] });
|
|
44
|
+
case n.CHECKBOX:
|
|
45
|
+
return /* @__PURE__ */ i("section", { className: "control", children: [
|
|
46
|
+
r,
|
|
47
|
+
/* @__PURE__ */ t(
|
|
48
|
+
N,
|
|
49
|
+
{
|
|
50
|
+
...o.config,
|
|
51
|
+
...e
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
] });
|
|
55
|
+
case n.RADIOBUTTON:
|
|
56
|
+
return /* @__PURE__ */ i("section", { className: "control", children: [
|
|
57
|
+
r,
|
|
58
|
+
/* @__PURE__ */ t(
|
|
59
|
+
g,
|
|
60
|
+
{
|
|
61
|
+
...o.config,
|
|
62
|
+
...e
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
] });
|
|
66
|
+
case n.TEXTAREA:
|
|
67
|
+
return /* @__PURE__ */ i("section", { className: "control", children: [
|
|
68
|
+
r,
|
|
69
|
+
/* @__PURE__ */ t(
|
|
70
|
+
T,
|
|
71
|
+
{
|
|
72
|
+
...o.config,
|
|
73
|
+
...e
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
] });
|
|
77
|
+
case n.BUTTON:
|
|
78
|
+
return /* @__PURE__ */ i("section", { className: "control", children: [
|
|
79
|
+
r,
|
|
80
|
+
/* @__PURE__ */ t(
|
|
81
|
+
d,
|
|
82
|
+
{
|
|
83
|
+
...o.config,
|
|
84
|
+
...e
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
] });
|
|
66
88
|
}
|
|
67
|
-
},
|
|
89
|
+
}, R = ({
|
|
68
90
|
testId: c,
|
|
69
91
|
mainInput: o,
|
|
70
|
-
leftInput:
|
|
71
|
-
rightInput:
|
|
72
|
-
isHorizontal:
|
|
92
|
+
leftInput: s = null,
|
|
93
|
+
rightInput: e = null,
|
|
94
|
+
isHorizontal: r = !1
|
|
73
95
|
}) => {
|
|
74
|
-
const f =
|
|
75
|
-
() =>
|
|
76
|
-
[c, o,
|
|
77
|
-
),
|
|
78
|
-
() =>
|
|
79
|
-
[c,
|
|
80
|
-
),
|
|
81
|
-
() =>
|
|
82
|
-
[c,
|
|
96
|
+
const f = l(
|
|
97
|
+
() => a({ testId: c, element: o, isHorizontal: r }),
|
|
98
|
+
[c, o, r]
|
|
99
|
+
), m = l(
|
|
100
|
+
() => a({ testId: c, element: s, isHorizontal: r }),
|
|
101
|
+
[c, s, r]
|
|
102
|
+
), u = l(
|
|
103
|
+
() => a({ testId: c, element: e, isHorizontal: r }),
|
|
104
|
+
[c, e, r]
|
|
83
105
|
);
|
|
84
|
-
return /* @__PURE__ */
|
|
85
|
-
|
|
106
|
+
return /* @__PURE__ */ i(p, { children: [
|
|
107
|
+
m,
|
|
86
108
|
f,
|
|
87
|
-
|
|
109
|
+
u
|
|
88
110
|
] });
|
|
89
111
|
};
|
|
90
112
|
export {
|
|
91
|
-
|
|
113
|
+
R as default
|
|
92
114
|
};
|
|
@@ -5,7 +5,11 @@ declare const _default: Meta<typeof FormFieldInput>;
|
|
|
5
5
|
export default _default;
|
|
6
6
|
export declare const BasicExample: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, FormFieldInputProps>;
|
|
7
7
|
export declare const SelectCase: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, FormFieldInputProps>;
|
|
8
|
+
export declare const SelectWithLabel: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, FormFieldInputProps>;
|
|
8
9
|
export declare const CheckboxCase: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, FormFieldInputProps>;
|
|
10
|
+
export declare const CheckboxWithLabel: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, FormFieldInputProps>;
|
|
9
11
|
export declare const RadiobuttonCase: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, FormFieldInputProps>;
|
|
12
|
+
export declare const RadiobuttonWithLabel: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, FormFieldInputProps>;
|
|
10
13
|
export declare const TextareaCase: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, FormFieldInputProps>;
|
|
14
|
+
export declare const TextareaWithLabel: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, FormFieldInputProps>;
|
|
11
15
|
export declare const LeftAddonSelect: import('storybook/internal/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, FormFieldInputProps>;
|
|
@@ -211,6 +211,8 @@ export interface FileProps extends ComposedElementProps, InteractiveProps, Named
|
|
|
211
211
|
size?: SizeWithNormalType;
|
|
212
212
|
}
|
|
213
213
|
export interface CheckBoxProps extends ComposedElementProps, InteractiveOnChangeProps, NamedInputProps {
|
|
214
|
+
/** `Attribute` `Required` Sets checkbox's value */
|
|
215
|
+
value: string | number;
|
|
214
216
|
/** `Attribute` Shows the checkbox as checked or unchecked */
|
|
215
217
|
isChecked?: boolean;
|
|
216
218
|
/** `Attribute` Sets checkbox's text that will be shown next to its control */
|
|
@@ -219,8 +221,10 @@ export interface CheckBoxProps extends ComposedElementProps, InteractiveOnChange
|
|
|
219
221
|
isDisabled?: boolean;
|
|
220
222
|
}
|
|
221
223
|
export interface RadioButtonItemProps extends Pick<ElementProps, 'testId' | 'style'>, InteractiveOnChangeProps, NamedInputProps {
|
|
222
|
-
/** `Attribute` `Required` Sets radiobutton's text*/
|
|
224
|
+
/** `Attribute` `Required` Sets radiobutton's text */
|
|
223
225
|
label: string;
|
|
226
|
+
/** `Attribute` `Required` Sets radiobutton's value */
|
|
227
|
+
value: string | number;
|
|
224
228
|
/** `Attribute` Shows the radiobutton as checked or unchecked */
|
|
225
229
|
isChecked?: boolean;
|
|
226
230
|
/** `Attribute` Will disable the checkbox */
|
|
@@ -255,6 +255,7 @@ export declare enum FormFieldType {
|
|
|
255
255
|
export type FormFieldConfig = InputControlProps | SelectProps | CheckBoxProps | RadioButtonProps | TextAreaProps | ButtonProps;
|
|
256
256
|
export interface FormFieldElement {
|
|
257
257
|
type: FormFieldType;
|
|
258
|
+
fieldLabel?: string;
|
|
258
259
|
config: FormFieldConfig;
|
|
259
260
|
}
|
|
260
261
|
export interface FormFieldInputProps extends ElementProps {
|