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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Nicolás Omar González Passerino
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 C, jsx as l } from "react/jsx-runtime";
2
- import { useMemo as t } from "react";
3
- import { parseClasses as g, parseTestId as n } from "../../../functions/parsers.js";
4
- const a = (s) => s ? "-with-component" : "", I = ({
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: o = null,
7
- cssClasses: d = null,
8
- containerCssClasses: c = null,
9
- style: i = null,
10
- containerStyle: r = null,
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: h,
14
- isDisabled: x = !1,
15
- onClick: k,
16
- onChange: u,
17
- onBlur: m
13
+ name: t,
14
+ value: x,
15
+ isDisabled: k = !1,
16
+ onClick: u,
17
+ onChange: m,
18
+ onBlur: b
18
19
  }) => {
19
- const b = t(
20
- () => g(["checkbox", c]),
21
- [c]
22
- ), f = t(
23
- () => o ?? n({
20
+ const f = o(
21
+ () => v(["checkbox", l]),
22
+ [l]
23
+ ), y = o(
24
+ () => c ?? a({
24
25
  tag: "checkbox-container",
25
- parsedClasses: a(e)
26
+ parsedClasses: d(e)
26
27
  }),
27
- [o, e]
28
- ), y = t(
29
- () => s ?? n({
28
+ [c, e]
29
+ ), C = o(
30
+ () => s ?? a({
30
31
  tag: "checkbox",
31
- parsedClasses: a(e)
32
+ parsedClasses: d(e)
32
33
  }),
33
34
  [s, e]
34
35
  );
35
- return /* @__PURE__ */ C(
36
- "label",
36
+ return /* @__PURE__ */ g(
37
+ "section",
37
38
  {
38
- "data-testid": f,
39
- className: b,
40
- style: r ?? void 0,
39
+ "data-testid": y,
40
+ className: f,
41
+ style: h ?? void 0,
41
42
  children: [
42
- /* @__PURE__ */ l(
43
+ /* @__PURE__ */ n(
43
44
  "input",
44
45
  {
45
- "data-testid": y,
46
+ id: t,
47
+ "data-testid": C,
46
48
  type: "checkbox",
47
- name: h,
48
- className: d ?? void 0,
49
- style: i ?? void 0,
49
+ name: t,
50
+ value: x,
51
+ className: i ?? void 0,
52
+ style: r ?? void 0,
50
53
  defaultChecked: p,
51
- disabled: x,
52
- onClick: k,
53
- onChange: u,
54
- onBlur: m
54
+ disabled: k,
55
+ onClick: u,
56
+ onChange: m,
57
+ onBlur: b
55
58
  }
56
59
  ),
57
- /* @__PURE__ */ l("p", { style: {
58
- display: "inline-block",
59
- marginLeft: "5px"
60
- }, children: e })
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
- I as default
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 x, parseTestId as I } from "../../../functions/parsers.js";
4
- import { generateKey as f } from "../../../functions/generators.js";
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: c = null,
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 = x([
15
+ const i = v([
16
16
  "control",
17
17
  n
18
- ]), u = o ?? I({
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-${f()}`
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": u,
58
+ "data-testid": c,
58
59
  className: i,
59
- style: c ?? void 0,
60
+ style: u ?? void 0,
60
61
  children: m
61
62
  }
62
63
  );
@@ -1,92 +1,114 @@
1
- import { jsxs as u, Fragment as p, jsx as r } from "react/jsx-runtime";
2
- import { useMemo as s } from "react";
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 g from "../../atoms/Checkbox/index.js";
7
- import N from "../../atoms/RadioButton/index.js";
8
- import x from "../InputControl/index.js";
9
- import { FormFieldType as t } from "../../../interfaces/moleculeProps.js";
10
- const m = ({ testId: c, element: o, isHorizontal: i }) => {
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 n = {
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 t.INPUT:
18
- return /* @__PURE__ */ r(
19
- x,
24
+ case n.INPUT:
25
+ return /* @__PURE__ */ t(
26
+ b,
20
27
  {
21
28
  ...o.config,
22
- ...n,
23
- isHorizontal: i
29
+ ...e,
30
+ isHorizontal: s
24
31
  }
25
32
  );
26
- case t.SELECT:
27
- return /* @__PURE__ */ r("section", { className: "control", children: /* @__PURE__ */ r(
28
- h,
29
- {
30
- ...o.config,
31
- ...n
32
- }
33
- ) });
34
- case t.CHECKBOX:
35
- return /* @__PURE__ */ r("section", { className: "control", children: /* @__PURE__ */ r(
36
- g,
37
- {
38
- ...o.config,
39
- ...n
40
- }
41
- ) });
42
- case t.RADIOBUTTON:
43
- return /* @__PURE__ */ r("section", { className: "control", children: /* @__PURE__ */ r(
44
- N,
45
- {
46
- ...o.config,
47
- ...n
48
- }
49
- ) });
50
- case t.TEXTAREA:
51
- return /* @__PURE__ */ r("section", { className: "control", children: /* @__PURE__ */ r(
52
- T,
53
- {
54
- ...o.config,
55
- ...n
56
- }
57
- ) });
58
- case t.BUTTON:
59
- return /* @__PURE__ */ r("section", { className: "control", children: /* @__PURE__ */ r(
60
- d,
61
- {
62
- ...o.config,
63
- ...n
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
- }, j = ({
89
+ }, R = ({
68
90
  testId: c,
69
91
  mainInput: o,
70
- leftInput: i = null,
71
- rightInput: n = null,
72
- isHorizontal: e = !1
92
+ leftInput: s = null,
93
+ rightInput: e = null,
94
+ isHorizontal: r = !1
73
95
  }) => {
74
- const f = s(
75
- () => m({ testId: c, element: o, isHorizontal: e }),
76
- [c, o, e]
77
- ), a = s(
78
- () => m({ testId: c, element: i, isHorizontal: e }),
79
- [c, i, e]
80
- ), l = s(
81
- () => m({ testId: c, element: n, isHorizontal: e }),
82
- [c, n, e]
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__ */ u(p, { children: [
85
- a,
106
+ return /* @__PURE__ */ i(p, { children: [
107
+ m,
86
108
  f,
87
- l
109
+ u
88
110
  ] });
89
111
  };
90
112
  export {
91
- j as default
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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactive-bulma",
3
- "version": "5.0.2",
3
+ "version": "5.0.4",
4
4
  "type": "module",
5
5
  "description": "A component library based on React, Bulma, Typescript and Vite",
6
6
  "keywords": [