ag-common 0.0.582 → 0.0.584

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.
@@ -101,9 +101,9 @@ const ListItem = ({ render, onChange, selected, defaultV = false, }) => (react_1
101
101
  } }, render));
102
102
  function DropdownList(p) {
103
103
  var _a;
104
- const { options, value, placeholder, className, renderF, shadow = '#555', maxHeight = '50vh', } = p;
104
+ const { shadow = '#555', maxHeight = '50vh' } = p;
105
105
  const ref = (0, react_1.useRef)(null);
106
- const [state, setState] = (0, react_1.useState)(value);
106
+ const [state, setState] = (0, react_1.useState)(p.value);
107
107
  const [open, setOpen] = (0, react_1.useState)(p.open);
108
108
  const [bounced, setBounced] = (0, react_1.useState)(false);
109
109
  (0, useOnClickOutside_1.useOnClickOutside)({ disabled: !open, ref, moveMouseOutside: false }, () => {
@@ -111,11 +111,11 @@ function DropdownList(p) {
111
111
  setBounced(false);
112
112
  });
113
113
  (0, react_1.useEffect)(() => {
114
- const newv = value;
115
- if (JSON.stringify(newv) !== JSON.stringify(value)) {
114
+ const newv = p.value;
115
+ if (JSON.stringify(newv) !== JSON.stringify(state)) {
116
116
  setState(newv);
117
117
  }
118
- }, [options, value]);
118
+ }, [p.options, p.value]);
119
119
  const [style, setStyle] = (0, react_1.useState)({});
120
120
  (0, react_1.useEffect)(() => {
121
121
  var _a, _b, _c, _d;
@@ -145,7 +145,7 @@ function DropdownList(p) {
145
145
  if (JSON.stringify(style) !== JSON.stringify(newStyle)) {
146
146
  setStyle(newStyle);
147
147
  }
148
- }, [maxHeight, open, options, renderF, shadow, style]);
148
+ }, [maxHeight, open, p.options, p.renderF, shadow, style]);
149
149
  const defaultRender = !p.value ? react_1.default.createElement(KebabDots_1.KebabDots, null) : react_1.default.createElement(react_1.default.Fragment, null, p.renderF(p.value));
150
150
  const openDisplay = (_a = p.children) !== null && _a !== void 0 ? _a : (react_1.default.createElement(ListItem, { selected: true, render: defaultRender, key: defaultRender.key, defaultV: !p.value }));
151
151
  (0, react_1.useEffect)(() => {
@@ -153,13 +153,13 @@ function DropdownList(p) {
153
153
  setBounced(true);
154
154
  }
155
155
  }, [bounced, open]);
156
- return (react_1.default.createElement(Base, { className: className, ref: ref, title: placeholder, onClick: (e) => {
156
+ return (react_1.default.createElement(Base, { className: p.className, ref: ref, title: p.placeholder, onClick: (e) => {
157
157
  e.stopPropagation();
158
158
  e.preventDefault();
159
159
  setOpen(!open);
160
160
  } },
161
161
  react_1.default.createElement(DropItems, { "data-open": open, style: style, "data-bounced": bounced }, open &&
162
- options.map((s, i) => (react_1.default.createElement(ListItem, { key: typeof s === 'string' ? s : p.renderF(s).key, render: p.renderF(s), onChange: () => p.onChange(s, i), selected: s === state })))),
162
+ p.options.map((s, i) => (react_1.default.createElement(ListItem, { key: typeof s === 'string' ? s : p.renderF(s).key, render: p.renderF(s), onChange: () => p.onChange(s, i), selected: s === state })))),
163
163
  openDisplay));
164
164
  }
165
165
  exports.DropdownList = DropdownList;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.582",
2
+ "version": "0.0.584",
3
3
  "name": "ag-common",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
@@ -54,11 +54,11 @@
54
54
  "@storybook/theming": "7.6.7",
55
55
  "@types/jest": "29.5.11",
56
56
  "@types/jsonwebtoken": "9.0.5",
57
- "@types/node": "20.10.7",
57
+ "@types/node": "20.11.0",
58
58
  "@types/react": "18.2.47",
59
59
  "@types/react-dom": "18.2.18",
60
60
  "cross-env": "7.0.3",
61
- "eslint-config-e7npm": "0.0.72",
61
+ "eslint-config-e7npm": "0.0.73",
62
62
  "jest": "29.7.0",
63
63
  "rimraf": "5.0.5",
64
64
  "storybook": "7.6.7",