@raketa-builder/menu-builder 0.2.0 → 0.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.
@@ -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 58.88 KB
8
- CJS ⚡️ Build success in 109ms
7
+ CJS dist/index.js 61.18 KB
8
+ CJS ⚡️ Build success in 70ms
@@ -1,13 +1,13 @@
1
1
  $ TIMING=1 eslint "**/*.js"
2
2
  Rule | Time (ms) | Relative
3
3
  :------------------------------|----------:|--------:
4
- react/display-name | 62.734 | 32.2%
5
- react/no-direct-mutation-state | 54.706 | 28.1%
6
- react/require-render-return | 26.708 | 13.7%
7
- react-hooks/rules-of-hooks | 8.407 | 4.3%
8
- react/no-deprecated | 7.358 | 3.8%
9
- react/no-string-refs | 5.153 | 2.6%
10
- react-hooks/exhaustive-deps | 4.800 | 2.5%
11
- react/no-unescaped-entities | 3.236 | 1.7%
12
- react/jsx-no-comment-textnodes | 2.427 | 1.2%
13
- react/no-danger-with-children | 2.052 | 1.1%
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%
package/dist/index.js CHANGED
@@ -105,11 +105,13 @@ var require_dist = __commonJS({
105
105
  Col: () => Col,
106
106
  Container: () => Container_default,
107
107
  DataGrid: () => DataGrid_default,
108
+ DefaultAvatar: () => DefaultAvatar_default,
108
109
  Field: () => Field_default,
109
110
  FormGroup: () => FormGroup_default,
110
111
  H: () => H_default,
111
112
  Handle: () => Handle_default,
112
113
  Hint: () => Hint_default,
114
+ ImageAvatar: () => ImageAvatar_default,
113
115
  Input: () => Input_default,
114
116
  Label: () => Label_default,
115
117
  LanguageSwitcher: () => LanguageSwitcher_default,
@@ -830,7 +832,7 @@ var require_dist = __commonJS({
830
832
  pathname: router.pathname,
831
833
  query: __spreadValues2(__spreadValues2({}, router.query), { page: currentPage - 1 })
832
834
  },
833
- children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("a", { children: "Previous" })
835
+ children: "Previous"
834
836
  }
835
837
  );
836
838
  };
@@ -845,7 +847,7 @@ var require_dist = __commonJS({
845
847
  pathname: router.pathname,
846
848
  query: __spreadValues2(__spreadValues2({}, router.query), { page: currentPage + 1 })
847
849
  },
848
- children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("a", { children: "Next" })
850
+ children: "Next"
849
851
  }
850
852
  );
851
853
  };
@@ -876,7 +878,7 @@ var require_dist = __commonJS({
876
878
  pathname: router.pathname,
877
879
  query: __spreadValues2(__spreadValues2({}, router.query), { page: pageNum })
878
880
  },
879
- children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("a", { children: pageNum })
881
+ children: pageNum
880
882
  },
881
883
  pageNum
882
884
  );
@@ -1019,6 +1021,64 @@ var require_dist = __commonJS({
1019
1021
  ] });
1020
1022
  };
1021
1023
  var LanguageSwitcher_default = LanguageSwitcher;
1024
+ var import_styled_components25 = __toESM2(require("styled-components"));
1025
+ var ImageAvatar = import_styled_components25.default.img`
1026
+ ${reset_default};
1027
+ display: block;
1028
+ width: ${(props) => props.size};
1029
+ height: ${(props) => props.size};
1030
+ border-radius: 50%;
1031
+ `;
1032
+ ImageAvatar.defaultProps = {
1033
+ size: "24px"
1034
+ };
1035
+ var ImageAvatar_default = ImageAvatar;
1036
+ var import_react82 = __toESM2(require("react"));
1037
+ var import_styled_components26 = __toESM2(require("styled-components"));
1038
+ var import_jsx_runtime82 = require("react/jsx-runtime");
1039
+ var AVATAR_COLORS = [
1040
+ "darkkhaki",
1041
+ "palevioletred",
1042
+ "mediumseagreen",
1043
+ "olivedrab",
1044
+ "steelblue",
1045
+ "salmon",
1046
+ "indianred",
1047
+ "mediumpurple",
1048
+ "coral",
1049
+ "rosybrown",
1050
+ "lightseagreen",
1051
+ "plum",
1052
+ "tan"
1053
+ ];
1054
+ var initialsToColor = (initials, colors) => {
1055
+ let asciiVal = initials.charCodeAt(0);
1056
+ asciiVal += initials.charCodeAt(1);
1057
+ let colorIndex = asciiVal % colors.length;
1058
+ return colors[colorIndex];
1059
+ };
1060
+ var DefaultAvatarStyles = import_styled_components26.default.div`
1061
+ ${reset_default};
1062
+ display: flex;
1063
+ justify-content: center;
1064
+ align-items: center;
1065
+ width: ${(props) => props.size};
1066
+ height: ${(props) => props.size};
1067
+ border-radius: 50%;
1068
+ background-color: ${(props) => initialsToColor(props.initials, AVATAR_COLORS)};
1069
+ color: #fff;
1070
+ font-size: calc(${(props) => props.size} * 0.4);
1071
+ text-shadow: 1px 1px rgba(0, 0, 0, 0.1)
1072
+ `;
1073
+ var DefaultAvatar = (_a) => {
1074
+ var _b = _a, { initials } = _b, props = __objRest(_b, ["initials"]);
1075
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(DefaultAvatarStyles, __spreadProps2(__spreadValues2({ initials }, props), { children: initials }));
1076
+ };
1077
+ DefaultAvatar.defaultProps = {
1078
+ size: "24px",
1079
+ initials: "AA"
1080
+ };
1081
+ var DefaultAvatar_default = DefaultAvatar;
1022
1082
  }
1023
1083
  });
1024
1084
 
@@ -1057,6 +1117,7 @@ var append = (items, item) => [...items, item];
1057
1117
  var Factories = {
1058
1118
  item: () => ({
1059
1119
  id: rand(4),
1120
+ html_id: "",
1060
1121
  label: "New item",
1061
1122
  url: "#",
1062
1123
  target: "",
@@ -1186,6 +1247,20 @@ var ItemForm = ({ item, onChange, onRemove, onDuplicate }) => /* @__PURE__ */ (0
1186
1247
  }
1187
1248
  )
1188
1249
  ] }),
1250
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ui2.FormGroup, { children: [
1251
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui2.Label, { htmlFor: "html_id", children: "ID" }),
1252
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1253
+ import_ui2.Input,
1254
+ {
1255
+ name: "html_id",
1256
+ type: "text",
1257
+ value: item.html_id,
1258
+ onChange: (e) => onChange(__spreadProps(__spreadValues({}, item), {
1259
+ html_id: e.target.value
1260
+ }))
1261
+ }
1262
+ )
1263
+ ] }),
1189
1264
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ui2.FormGroup, { children: [
1190
1265
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui2.Label, { htmlFor: "target", children: "Target" }),
1191
1266
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raketa-builder/menu-builder",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "MIT",
@@ -3,6 +3,7 @@ import { rand } from "./utils";
3
3
  const Factories = {
4
4
  item: () => ({
5
5
  id: rand(4),
6
+ html_id: "",
6
7
  label: "New item",
7
8
  url: "#",
8
9
  target: "",
@@ -46,6 +46,22 @@ const ItemForm = ({ item, onChange, onRemove, onDuplicate }) => (
46
46
  />
47
47
  </FormGroup>
48
48
 
49
+ <FormGroup>
50
+ <Label htmlFor="html_id">ID</Label>
51
+
52
+ <Input
53
+ name="html_id"
54
+ type="text"
55
+ value={item.html_id}
56
+ onChange={(e) =>
57
+ onChange({
58
+ ...item,
59
+ html_id: e.target.value,
60
+ })
61
+ }
62
+ />
63
+ </FormGroup>
64
+
49
65
  <FormGroup>
50
66
  <Label htmlFor="target">Target</Label>
51
67