reactive-bulma 4.2.1 → 4.3.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.
@@ -1,4 +1,4 @@
1
1
  import { default as React } from 'react';
2
2
  import { CheckBoxProps } from '../../../interfaces/atomProps';
3
- declare const CheckBox: React.FC<CheckBoxProps>;
4
- export default CheckBox;
3
+ declare const Checkbox: React.FC<CheckBoxProps>;
4
+ export default Checkbox;
@@ -1,47 +1,47 @@
1
- import { jsxs as C, jsx as f } from "react/jsx-runtime";
2
- import { parseClasses as m, parseTestId as l } from "../../../functions/parsers.js";
3
- const a = (s) => typeof s == "string" ? `-${s == null ? void 0 : s.toString()}` : s !== null ? "-with-component" : "", I = ({
1
+ import { jsxs as C, jsx as m } from "react/jsx-runtime";
2
+ import { parseClasses as f, parseTestId as l } from "../../../functions/parsers.js";
3
+ const t = (s) => s ? "-with-component" : "", v = ({
4
4
  testId: s = null,
5
- containerTestId: r = null,
6
- cssClasses: t = null,
7
- containerCssClasses: o = null,
8
- style: i = null,
9
- containerStyle: c = null,
5
+ containerTestId: a = null,
6
+ cssClasses: o = null,
7
+ containerCssClasses: c = null,
8
+ style: n = null,
9
+ containerStyle: d = null,
10
10
  content: e = null,
11
- name: d,
12
- isDisabled: n = null,
13
- onClick: u,
14
- onChange: p,
11
+ name: r,
12
+ isDisabled: i = null,
13
+ onClick: p,
14
+ onChange: u,
15
15
  onBlur: x
16
16
  }) => {
17
- const h = m([
17
+ const b = f([
18
18
  "checkbox",
19
- o
20
- ]), b = r ?? l({
19
+ c
20
+ ]), h = a ?? l({
21
21
  tag: "checkbox-container",
22
- parsedClasses: a(e)
22
+ parsedClasses: t(e)
23
23
  }), k = s ?? l({
24
24
  tag: "checkbox",
25
- parsedClasses: a(e)
25
+ parsedClasses: t(e)
26
26
  });
27
27
  return /* @__PURE__ */ C(
28
28
  "label",
29
29
  {
30
- "data-testid": b,
31
- className: h,
32
- style: c ?? void 0,
30
+ "data-testid": h,
31
+ className: b,
32
+ style: d ?? void 0,
33
33
  children: [
34
- /* @__PURE__ */ f(
34
+ /* @__PURE__ */ m(
35
35
  "input",
36
36
  {
37
37
  "data-testid": k,
38
38
  type: "checkbox",
39
- name: d,
40
- className: t ?? void 0,
41
- style: i ?? void 0,
42
- disabled: n ?? !1,
43
- onClick: u,
44
- onChange: p,
39
+ name: r,
40
+ className: o ?? void 0,
41
+ style: n ?? void 0,
42
+ disabled: i ?? !1,
43
+ onClick: p,
44
+ onChange: u,
45
45
  onBlur: x
46
46
  }
47
47
  ),
@@ -51,5 +51,5 @@ const a = (s) => typeof s == "string" ? `-${s == null ? void 0 : s.toString()}`
51
51
  );
52
52
  };
53
53
  export {
54
- I as default
54
+ v as default
55
55
  };
@@ -1,9 +1,6 @@
1
1
  import { Meta } from '@storybook/react';
2
- import { default as CheckBox } from '.';
3
- import { CheckBoxProps } from '../../../interfaces/atomProps';
4
- declare const _default: Meta<typeof CheckBox>;
2
+ import { default as Checkbox } from '.';
3
+ declare const _default: Meta<typeof Checkbox>;
5
4
  export default _default;
6
- export declare const BasicExample: import('@storybook/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, CheckBoxProps>;
7
- export declare const WithTextContent: import('@storybook/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, CheckBoxProps>;
8
- export declare const WithComponentContent: import('@storybook/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, CheckBoxProps>;
9
- export declare const Disabled: import('@storybook/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, CheckBoxProps>;
5
+ export declare const BasicExample: import('@storybook/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, import('../../../interfaces/atomProps').CheckBoxProps>;
6
+ export declare const Disabled: import('@storybook/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, import('../../../interfaces/atomProps').CheckBoxProps>;
@@ -1,76 +1,150 @@
1
- import { jsxs as u, jsx as s } from "react/jsx-runtime";
2
- import A from "react";
3
- import m from "../../molecules/InputControl/index.js";
4
- import { parseClasses as N, parseTestId as b } from "../../../functions/parsers.js";
5
- import { generateKey as n } from "../../../functions/generators.js";
6
- const f = (e) => e ? /* @__PURE__ */ s(
7
- "label",
8
- {
9
- "data-testid": "test-form-field-label",
10
- className: "label",
11
- children: e
12
- }
13
- ) : null, p = (e, l) => l ? Array.isArray(e) ? e.map((a, c) => /* @__PURE__ */ s(
14
- m,
15
- {
16
- testId: `test-grouped-input-control-${c}`,
17
- ...a
18
- },
19
- `grouped-input-control-${n()}`
20
- )) : /* @__PURE__ */ s(m, { ...e }) : Array.isArray(e) ? /* @__PURE__ */ s(m, { ...e[0] }) : /* @__PURE__ */ s(m, { ...e }), I = (e) => {
1
+ import { jsx as t, jsxs as c, Fragment as a } from "react/jsx-runtime";
2
+ import B, { useMemo as F } from "react";
3
+ import E from "../../molecules/InputControl/index.js";
4
+ import { parseClasses as T, parseTestId as I } from "../../../functions/parsers.js";
5
+ import $ from "../../atoms/TextArea/index.js";
6
+ import x from "../../atoms/Select/index.js";
7
+ import S from "../../atoms/Checkbox/index.js";
8
+ import K from "../../atoms/RadioButton/index.js";
9
+ import { FormFieldType as n } from "../../../interfaces/organismProps.js";
10
+ import { generateKey as h } from "../../../functions/generators.js";
11
+ const m = (e) => {
21
12
  if (!e) return null;
22
- const l = N(["help", e.color]), a = b({
13
+ const s = T(["help", e.color]), l = I({
23
14
  tag: "form-field-help",
24
- parsedClasses: l,
15
+ parsedClasses: s,
25
16
  rules: [{ regExp: /help|is/gm, replacer: "" }]
26
17
  });
27
- return /* @__PURE__ */ s(
18
+ return /* @__PURE__ */ t(
28
19
  "p",
29
20
  {
30
- "data-testid": a,
31
- className: l,
21
+ "data-testid": l,
22
+ className: s,
32
23
  children: e.text
33
24
  }
34
25
  );
35
- }, B = ({
26
+ }, f = (e, s, l) => {
27
+ const r = {
28
+ key: s,
29
+ testId: l ?? `test-form-field-${e.type}`,
30
+ containerTestId: l ?? `test-form-field-container-${e.type}`
31
+ };
32
+ switch (e.type) {
33
+ case n.INPUT:
34
+ return /* @__PURE__ */ c(a, { children: [
35
+ /* @__PURE__ */ t(
36
+ E,
37
+ {
38
+ ...e.config,
39
+ ...r
40
+ }
41
+ ),
42
+ m(e.helper)
43
+ ] });
44
+ case n.SELECT:
45
+ return /* @__PURE__ */ c(a, { children: [
46
+ /* @__PURE__ */ t(
47
+ x,
48
+ {
49
+ ...e.config,
50
+ ...r
51
+ }
52
+ ),
53
+ m(e.helper)
54
+ ] });
55
+ case n.CHECKBOX:
56
+ return /* @__PURE__ */ c(a, { children: [
57
+ /* @__PURE__ */ t(
58
+ S,
59
+ {
60
+ ...e.config,
61
+ ...r
62
+ }
63
+ ),
64
+ m(e.helper)
65
+ ] });
66
+ case n.RADIOBUTTON:
67
+ return /* @__PURE__ */ c(a, { children: [
68
+ /* @__PURE__ */ t(
69
+ K,
70
+ {
71
+ ...e.config,
72
+ ...r
73
+ }
74
+ ),
75
+ m(e.helper)
76
+ ] });
77
+ case n.TEXTAREA:
78
+ return /* @__PURE__ */ c(a, { children: [
79
+ /* @__PURE__ */ t(
80
+ $,
81
+ {
82
+ ...e.config,
83
+ ...r
84
+ }
85
+ ),
86
+ m(e.helper)
87
+ ] });
88
+ default:
89
+ return null;
90
+ }
91
+ }, R = (e, s) => {
92
+ const l = s ? `grouped-input-control-body-${h()}` : `input-control-body-${h()}`;
93
+ return s ? Array.isArray(e) ? e.map(
94
+ (r, i) => f(
95
+ r,
96
+ l,
97
+ `test-grouped-input-control-${i}`
98
+ )
99
+ ) : f(e) : Array.isArray(e) ? f(e[0], l) : f(e, l);
100
+ }, M = ({
36
101
  testId: e = null,
37
- cssClasses: l = null,
38
- style: a = null,
39
- labelText: c = null,
40
- inputControlConfig: r,
41
- helperConfig: d = null,
42
- isHorizontal: i = !1,
43
- isGrouped: t = !1
102
+ cssClasses: s = null,
103
+ style: l = null,
104
+ labelText: r = null,
105
+ inputControlConfig: i,
106
+ isHorizontal: o = !1,
107
+ isGrouped: p = !1
44
108
  }) => {
45
- var F;
46
- const y = N([
109
+ const y = T([
47
110
  "field",
48
- i ? "is-horizontal" : null,
49
- t ? "is-grouped" : null,
50
- l
51
- ]), h = e ?? b({ tag: "field", parsedClasses: y });
52
- return !t && ((F = r == null ? void 0 : r.inputConfig) != null && F.color) && d && (d = {
53
- ...d,
54
- color: r.inputConfig.color
55
- }), /* @__PURE__ */ u(
111
+ o ? "is-horizontal" : null,
112
+ p ? "is-grouped" : null,
113
+ s
114
+ ]), b = e ?? I({ tag: "field", parsedClasses: y }), A = F(() => {
115
+ const d = r !== null ? /* @__PURE__ */ t(
116
+ "label",
117
+ {
118
+ "data-testid": "test-form-field-label",
119
+ className: "label",
120
+ children: r
121
+ }
122
+ ) : null;
123
+ return o ? /* @__PURE__ */ t("section", { className: "field-label", children: d }) : d;
124
+ }, [o, r]), N = F(() => {
125
+ const d = R(i, p), u = `input-control-container-${h()}`;
126
+ return o ? /* @__PURE__ */ t(
127
+ "section",
128
+ {
129
+ className: "field-body",
130
+ children: d
131
+ },
132
+ u
133
+ ) : /* @__PURE__ */ t(B.Fragment, { children: d }, u);
134
+ }, [o, i, p]);
135
+ return /* @__PURE__ */ c(
56
136
  "section",
57
137
  {
58
- "data-testid": h,
138
+ "data-testid": b,
59
139
  className: y,
60
- style: a ?? void 0,
140
+ style: l ?? void 0,
61
141
  children: [
62
- i ? /* @__PURE__ */ s("section", { className: "field-label", children: f(c) }) : f(c),
63
- i ? /* @__PURE__ */ u("section", { className: "field-body", children: [
64
- p(r, t),
65
- I(d)
66
- ] }) : /* @__PURE__ */ u(A.Fragment, { children: [
67
- p(r, t),
68
- I(d)
69
- ] })
142
+ A,
143
+ N
70
144
  ]
71
145
  }
72
146
  );
73
147
  };
74
148
  export {
75
- B as default
149
+ M as default
76
150
  };
@@ -7,5 +7,8 @@ export declare const WithLabel: import('@storybook/csf').AnnotatedStoryFn<import
7
7
  export declare const WithLabelAndHelper: import('@storybook/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, import('../../../interfaces/organismProps').FormFieldProps>;
8
8
  export declare const ErrorCase: import('@storybook/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, import('../../../interfaces/organismProps').FormFieldProps>;
9
9
  export declare const GroupedInputs: import('@storybook/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, import('../../../interfaces/organismProps').FormFieldProps>;
10
- export declare const ExpandedAndGroupedInputs: import('@storybook/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, import('../../../interfaces/organismProps').FormFieldProps>;
11
10
  export declare const Horizontal: import('@storybook/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, import('../../../interfaces/organismProps').FormFieldProps>;
11
+ export declare const SelectCase: import('@storybook/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, import('../../../interfaces/organismProps').FormFieldProps>;
12
+ export declare const CheckboxCase: import('@storybook/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, import('../../../interfaces/organismProps').FormFieldProps>;
13
+ export declare const RadiobuttonCase: import('@storybook/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, import('../../../interfaces/organismProps').FormFieldProps>;
14
+ export declare const TextareaCase: import('@storybook/csf').AnnotatedStoryFn<import('@storybook/react').ReactRenderer, import('../../../interfaces/organismProps').FormFieldProps>;
@@ -199,7 +199,7 @@ export interface FileProps extends ComposedElementProps, InteractiveProps, Named
199
199
  }
200
200
  export interface CheckBoxProps extends ComposedElementProps, InteractiveOnChangeProps, NamedInputProps {
201
201
  /** `Attribute` Sets checkbox's text that will be shown next to its control */
202
- content?: ChildrenType;
202
+ content?: string;
203
203
  /** `Attribute` Will disable the checkbox */
204
204
  isDisabled?: boolean;
205
205
  }
@@ -1,19 +1,30 @@
1
1
  import { ClickeableProps, ElementProps } from './commonProps';
2
2
  import { InputControlProps, LevelItemProps, NavBarBrandProps, NavBarDropdownProps, PanelBlockProps, PanelTabsProps, TableRowProps } from './moleculeProps';
3
- import { ImageProps, NavBarItemProps, TableHeadCellProps, TileProps } from './atomProps';
3
+ import { CheckBoxProps, ImageProps, NavBarItemProps, RadioButtonProps, SelectProps, TableHeadCellProps, TextAreaProps, TileProps } from './atomProps';
4
4
  import { BasicColorType, SizeWithHeightType } from '../types/styleTypes';
5
5
  import { ChildrenType, NavBarFixedPositionType } from '../types/domTypes';
6
- export interface FormFieldHelperProps {
6
+ export declare enum FormFieldType {
7
+ INPUT = "input",
8
+ SELECT = "select",
9
+ CHECKBOX = "checkbox",
10
+ RADIOBUTTON = "radiobutton",
11
+ TEXTAREA = "textarea"
12
+ }
13
+ export type FormFieldConfig = InputControlProps | SelectProps | CheckBoxProps | RadioButtonProps | TextAreaProps;
14
+ export interface FormFieldHelper {
7
15
  text?: string;
8
16
  color?: BasicColorType;
9
17
  }
18
+ export interface FormFieldInputProps {
19
+ type: FormFieldType;
20
+ config: FormFieldConfig;
21
+ helper?: FormFieldHelper;
22
+ }
10
23
  export interface FormFieldProps extends ElementProps {
11
- /** `Attribute` `Required` Single or multiple `InputControlProps` config objects which will be wrapped around the `FormField` */
12
- inputControlConfig: InputControlProps | InputControlProps[];
24
+ /** `Attribute` `Required` Single or multiple `FormFieldConfig` config objects which will be wrapped around the `FormField` */
25
+ inputControlConfig: FormFieldInputProps | FormFieldInputProps[];
13
26
  /** `Attribute` Sets a custom text before the wrapped input to indicate its usage */
14
27
  labelText?: string;
15
- /** `Attribute` Adds a helper text below the wrapped paragraph to provide context information */
16
- helperConfig?: FormFieldHelperProps;
17
28
  /** `Styling` Will adjust field's sections (label, input/s and helper) in horizontal position */
18
29
  isHorizontal?: boolean;
19
30
  /** `Styling` Will group the list of inputs in a same wrapper (useful for several inputs with same usage, as a complex address) */
@@ -1 +1,4 @@
1
-
1
+ var E = /* @__PURE__ */ ((t) => (t.INPUT = "input", t.SELECT = "select", t.CHECKBOX = "checkbox", t.RADIOBUTTON = "radiobutton", t.TEXTAREA = "textarea", t))(E || {});
2
+ export {
3
+ E as FormFieldType
4
+ };
@@ -1,6 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  export type ButtonType = 'submit' | 'reset' | 'button';
3
- export type InputType = 'text' | 'password' | 'email' | 'tel';
3
+ export type InputType = 'text' | 'password' | 'email' | 'tel' | 'number';
4
4
  export type DropdownItemType = 'item' | 'link' | 'divider';
5
5
  export type PanelBlockItemType = 'icon' | 'control' | 'button';
6
6
  export type ChildrenType = string | React.ReactElement | React.ReactElement[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reactive-bulma",
3
- "version": "4.2.1",
3
+ "version": "4.3.0",
4
4
  "type": "module",
5
5
  "description": "A component library based on React, Bulma, Typescript and Vite",
6
6
  "keywords": [
@@ -63,7 +63,7 @@
63
63
  "@babel/preset-react": "^7.26.3",
64
64
  "@babel/preset-typescript": "^7.26.0",
65
65
  "@eslint/compat": "^1.2.4",
66
- "@eslint/js": "^9.16.0",
66
+ "@eslint/js": "^9.17.0",
67
67
  "@mdi/font": "^7.4.47",
68
68
  "@semantic-release/changelog": "^6.0.3",
69
69
  "@semantic-release/commit-analyzer": "^13.0.0",
@@ -71,7 +71,7 @@
71
71
  "@semantic-release/git": "^10.0.1",
72
72
  "@semantic-release/github": "^11.0.1",
73
73
  "@semantic-release/npm": "^12.0.1",
74
- "@semantic-release/release-notes-generator": "^14.0.1",
74
+ "@semantic-release/release-notes-generator": "^14.0.2",
75
75
  "@storybook/addon-essentials": "^8.4.7",
76
76
  "@storybook/addon-interactions": "^8.4.7",
77
77
  "@storybook/addon-links": "^8.4.7",
@@ -85,16 +85,16 @@
85
85
  "@testing-library/user-event": "^14.5.2",
86
86
  "@types/css-modules": "^1.0.5",
87
87
  "@types/jest": "^29.5.14",
88
- "@types/node": "^22.10.1",
88
+ "@types/node": "^22.10.2",
89
89
  "@types/react": "^19.0.1",
90
- "@types/react-dom": "^19.0.1",
91
- "@typescript-eslint/eslint-plugin": "^8.17.0",
92
- "@typescript-eslint/parser": "^8.17.0",
90
+ "@types/react-dom": "^19.0.2",
91
+ "@typescript-eslint/eslint-plugin": "^8.18.1",
92
+ "@typescript-eslint/parser": "^8.18.1",
93
93
  "@vitejs/plugin-react": "^4.3.4",
94
94
  "babel-jest": "^29.7.0",
95
95
  "babel-loader": "^9.2.1",
96
96
  "bulma": "^0.9.4",
97
- "eslint": "^9.16.0",
97
+ "eslint": "^9.17.0",
98
98
  "eslint-config-prettier": "^9.1.0",
99
99
  "eslint-plugin-react": "^7.37.2",
100
100
  "eslint-plugin-react-hooks": "^5.1.0",
@@ -106,7 +106,7 @@
106
106
  "hygen": "^6.2.11",
107
107
  "jest": "^29.7.0",
108
108
  "jest-environment-jsdom": "^29.7.0",
109
- "lint-staged": "^15.2.10",
109
+ "lint-staged": "^15.2.11",
110
110
  "npm-check-updates": "^17.1.11",
111
111
  "prettier": "^3.4.2",
112
112
  "react": "^18.3.1",
@@ -115,7 +115,7 @@
115
115
  "storybook": "^8.4.7",
116
116
  "tslib": "^2.8.1",
117
117
  "typescript": "~5.7.2",
118
- "typescript-eslint": "^8.17.0",
118
+ "typescript-eslint": "^8.18.1",
119
119
  "vite": "^6.0.3",
120
120
  "vite-plugin-dts": "^4.3.0"
121
121
  },