@raketa-builder/menu-builder 0.3.0 → 0.5.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.
@@ -4,5 +4,5 @@ CLI Using tsconfig: tsconfig.json
4
4
  CLI tsup v6.5.0
5
5
  CLI Target: es6
6
6
  CJS Build start
7
- CJS dist/index.js 61.18 KB
8
- CJS ⚡️ Build success in 70ms
7
+ CJS dist/index.js 61.29 KB
8
+ CJS ⚡️ Build success in 68ms
@@ -1,13 +1,13 @@
1
1
  $ TIMING=1 eslint "**/*.js"
2
- Rule | Time (ms) | Relative
3
- :------------------------------|----------:|--------:
4
- react/no-direct-mutation-state | 7.151 | 26.7%
5
- react/display-name | 7.135 | 26.6%
6
- react/require-render-return | 3.681 | 13.7%
7
- react-hooks/exhaustive-deps | 1.189 | 4.4%
8
- react/no-deprecated | 1.141 | 4.3%
9
- react-hooks/rules-of-hooks | 1.005 | 3.7%
10
- react/no-string-refs | 0.856 | 3.2%
11
- react/no-unescaped-entities | 0.658 | 2.5%
12
- react/no-danger-with-children | 0.460 | 1.7%
13
- react/jsx-no-comment-textnodes | 0.352 | 1.3%
2
+ Rule | Time (ms) | Relative
3
+ :---------------------------------|----------:|--------:
4
+ react/display-name | 28.043 | 25.4%
5
+ react/no-direct-mutation-state | 27.800 | 25.2%
6
+ react/require-render-return | 20.287 | 18.4%
7
+ react/no-deprecated | 4.712 | 4.3%
8
+ react-hooks/exhaustive-deps | 4.033 | 3.7%
9
+ react-hooks/rules-of-hooks | 3.917 | 3.5%
10
+ react/no-string-refs | 3.201 | 2.9%
11
+ react/no-unescaped-entities | 2.490 | 2.3%
12
+ react/jsx-no-comment-textnodes | 1.645 | 1.5%
13
+ jsx-a11y/role-supports-aria-props | 1.306 | 1.2%
package/dist/index.js CHANGED
@@ -1118,6 +1118,7 @@ var Factories = {
1118
1118
  item: () => ({
1119
1119
  id: rand(4),
1120
1120
  html_id: "",
1121
+ class_name: "",
1121
1122
  label: "New item",
1122
1123
  url: "#",
1123
1124
  target: "",
@@ -1261,6 +1262,20 @@ var ItemForm = ({ item, onChange, onRemove, onDuplicate }) => /* @__PURE__ */ (0
1261
1262
  }
1262
1263
  )
1263
1264
  ] }),
1265
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ui2.FormGroup, { children: [
1266
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui2.Label, { htmlFor: "class_name", children: "CSS class" }),
1267
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1268
+ import_ui2.Input,
1269
+ {
1270
+ name: "class_name",
1271
+ type: "text",
1272
+ value: item.class_name,
1273
+ onChange: (e) => onChange(__spreadProps(__spreadValues({}, item), {
1274
+ class_name: e.target.value
1275
+ }))
1276
+ }
1277
+ )
1278
+ ] }),
1264
1279
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ui2.FormGroup, { children: [
1265
1280
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui2.Label, { htmlFor: "target", children: "Target" }),
1266
1281
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
@@ -1705,7 +1720,12 @@ var MenuBuilder = ({ widgets, value, onChange }) => {
1705
1720
  items: state.items,
1706
1721
  tab: currentTab,
1707
1722
  onTab: (tab) => setState(__spreadProps(__spreadValues({}, state), { tab })),
1708
- onChange: (items) => setState(__spreadProps(__spreadValues({}, state), { items }))
1723
+ onChange: (items) => {
1724
+ const newState = __spreadProps(__spreadValues({}, state), { items });
1725
+ setState(newState);
1726
+ if (onChange)
1727
+ onChange(newState);
1728
+ }
1709
1729
  }
1710
1730
  ),
1711
1731
  currentItem && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-builder/menu-builder",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",
@@ -4,6 +4,7 @@ const Factories = {
4
4
  item: () => ({
5
5
  id: rand(4),
6
6
  html_id: "",
7
+ class_name: "",
7
8
  label: "New item",
8
9
  url: "#",
9
10
  target: "",
@@ -62,6 +62,22 @@ const ItemForm = ({ item, onChange, onRemove, onDuplicate }) => (
62
62
  />
63
63
  </FormGroup>
64
64
 
65
+ <FormGroup>
66
+ <Label htmlFor="class_name">CSS class</Label>
67
+
68
+ <Input
69
+ name="class_name"
70
+ type="text"
71
+ value={item.class_name}
72
+ onChange={(e) =>
73
+ onChange({
74
+ ...item,
75
+ class_name: e.target.value,
76
+ })
77
+ }
78
+ />
79
+ </FormGroup>
80
+
65
81
  <FormGroup>
66
82
  <Label htmlFor="target">Target</Label>
67
83
 
@@ -56,7 +56,12 @@ const MenuBuilder = ({ widgets, value, onChange }) => {
56
56
  items={state.items}
57
57
  tab={currentTab}
58
58
  onTab={(tab) => setState({ ...state, tab })}
59
- onChange={(items) => setState({ ...state, items })}
59
+ onChange={(items) => {
60
+ const newState = { ...state, items };
61
+
62
+ setState(newState);
63
+ if (onChange) onChange(newState);
64
+ }}
60
65
  />
61
66
 
62
67
  {currentItem && (