@fileverse-dev/fortune-react 1.2.3 → 1.2.5

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.
@@ -104,14 +104,14 @@ export var ColorSection = function ColorSection(_a) {
104
104
  title: color.name
105
105
  }));
106
106
  }), /*#__PURE__*/React.createElement("div", {
107
- className: "w-full flex justify-center",
107
+ className: "w-full flex justify-center color-picker-reset-btn",
108
108
  onClick: function onClick() {
109
109
  onPick("228, 232, 237");
110
110
  setIsOpen(false);
111
111
  }
112
112
  }, /*#__PURE__*/React.createElement(IconButton, {
113
113
  icon: "DropletOff",
114
- size: "md",
114
+ size: "sm",
115
115
  variant: "ghost",
116
116
  className: "color-picker-icon"
117
117
  }), /*#__PURE__*/React.createElement(Button, {
@@ -146,8 +146,15 @@ var DropDownList = function DropDownList() {
146
146
  display: isMul && selected.indexOf(v) >= 0 ? "inline" : "none"
147
147
  }
148
148
  }), v);
149
+ }), /*#__PURE__*/React.createElement("hr", {
150
+ style: {
151
+ border: "none",
152
+ height: "1px",
153
+ background: "hsl(var(--color-bg-default-hover, #F2F4F5))",
154
+ marginBottom: "4px"
155
+ }
149
156
  }), /*#__PURE__*/React.createElement("div", {
150
- className: "w-full flex align-center",
157
+ className: "w-full flex align-center edit-dropdown",
151
158
  style: {
152
159
  height: "28px"
153
160
  },
@@ -159,11 +166,14 @@ var DropDownList = function DropDownList() {
159
166
  icon: "Pencil",
160
167
  size: "sm",
161
168
  variant: "ghost",
162
- className: "color-picker-icon pt-2 color-picker"
169
+ className: "color-picker-icon color-picker edit-dropdown",
170
+ style: {
171
+ paddingTop: "0px !important"
172
+ }
163
173
  }), /*#__PURE__*/React.createElement(Button, {
164
174
  size: "md",
165
175
  variant: "ghost",
166
- className: "color-picker-reset color-picker"
176
+ className: "color-picker-reset color-picker edit-dropdown"
167
177
  }, "Edit")));
168
178
  };
169
179
  export default DropDownList;
@@ -47,7 +47,20 @@ var DynamicInputList = function DynamicInputList(_a) {
47
47
  });
48
48
  };
49
49
  useEffect(function () {
50
- handleAdd();
50
+ if (optionItems.length === 0) {
51
+ var nextNum_1 = 1;
52
+ setOptionItems(function (prev) {
53
+ return __spreadArray(__spreadArray([], prev, true), [{
54
+ id: createId(),
55
+ value: "Option ".concat(nextNum_1),
56
+ color: "228, 232, 237"
57
+ }, {
58
+ id: createId(),
59
+ value: "Option ".concat(nextNum_1 + 1),
60
+ color: "228, 232, 237"
61
+ }], false);
62
+ });
63
+ }
51
64
  }, []);
52
65
  var handleRemove = function handleRemove(index) {
53
66
  setOptionItems(function (prev) {
@@ -201,6 +201,15 @@
201
201
  min-width: 100px;
202
202
  }
203
203
 
204
+ .color-picker-reset-btn {
205
+ height: 30px;
206
+ border-radius: 6px;
207
+ }
208
+
209
+ .color-picker-reset-btn:hover {
210
+ background: hsl(var(--color-bg-default-hover, #F2F4F5))!important;
211
+ }
212
+
204
213
  .color-picker:hover {
205
214
  background: hsl(var(--color-bg-default-hover, #F2F4F5))!important;
206
215
  }
@@ -212,15 +221,20 @@
212
221
  }
213
222
 
214
223
  .color-picker-reset {
224
+ height: 30px !important;
225
+ padding-top: 0px !important;
226
+ padding-bottom: 0px !important;
215
227
  min-width: 0px !important;
216
228
  padding-left: 0px !important;
217
229
  margin-left: 0px !important;
218
230
  }
219
231
 
220
- .color-picker-reset:hover {
221
- background-color: white!important;
232
+ .edit-dropdown {
233
+ height: 28px!important;
234
+ border-radius: 5px;
222
235
  }
223
236
 
224
- .color-picker-icon:hover {
225
- background-color: white!important;
237
+ .edit-dropdown:hover {
238
+ height: 28px!important;
239
+ background: hsl(var(--color-bg-default-hover, #F2F4F5))!important;
226
240
  }
@@ -215,6 +215,18 @@ var DataVerification = function DataVerification() {
215
215
  }
216
216
  });
217
217
  }, []);
218
+ var rangeOnClick = function rangeOnClick() {
219
+ var _a;
220
+ (_a = document.getElementById("data-verification-button")) === null || _a === void 0 ? void 0 : _a.click();
221
+ hideDialog();
222
+ dataSelectRange("rangeTxt", context.dataVerification.dataRegulation.value1);
223
+ };
224
+ var rangeOnChange = function rangeOnChange(e) {
225
+ var value = e.target.value;
226
+ setContext(function (ctx) {
227
+ ctx.dataVerification.dataRegulation.rangeTxt = value;
228
+ });
229
+ };
218
230
  return /*#__PURE__*/React.createElement("div", {
219
231
  id: "fortune-data-verification"
220
232
  }, /*#__PURE__*/React.createElement("div", {
@@ -230,23 +242,19 @@ var DataVerification = function DataVerification() {
230
242
  }, dataVerification.cellRange), /*#__PURE__*/React.createElement(TextField, {
231
243
  rightIcon: /*#__PURE__*/React.createElement(LucideIcon, {
232
244
  name: "Grid2x2",
233
- size: "sm"
245
+ size: "sm",
246
+ onClick: rangeOnClick,
247
+ onChange: rangeOnChange,
248
+ style: {
249
+ cursor: "pointer",
250
+ color: "#363B3F"
251
+ }
234
252
  }),
235
253
  "aria-hidden": "true",
236
254
  readOnly: true,
237
255
  value: (_a = context.dataVerification.dataRegulation) === null || _a === void 0 ? void 0 : _a.rangeTxt,
238
- onChange: function onChange(e) {
239
- var value = e.target.value;
240
- setContext(function (ctx) {
241
- ctx.dataVerification.dataRegulation.rangeTxt = value;
242
- });
243
- },
244
- onClick: function onClick() {
245
- var _a;
246
- (_a = document.getElementById("data-verification-button")) === null || _a === void 0 ? void 0 : _a.click();
247
- hideDialog();
248
- dataSelectRange("rangeTxt", context.dataVerification.dataRegulation.value1);
249
- }
256
+ onChange: rangeOnChange,
257
+ onClick: rangeOnClick
250
258
  })), /*#__PURE__*/React.createElement("div", {
251
259
  className: "flex flex-col"
252
260
  }, /*#__PURE__*/React.createElement("div", {
@@ -299,9 +307,17 @@ var DataVerification = function DataVerification() {
299
307
  }, /*#__PURE__*/React.createElement("span", {
300
308
  className: "data-verification-checkbox-label"
301
309
  }, dataVerification.selected), /*#__PURE__*/React.createElement(TextField, {
310
+ onMouseDown: function onMouseDown(e) {
311
+ e.stopPropagation();
312
+ e.target.focus();
313
+ },
314
+ onKeyDown: function onKeyDown(e) {
315
+ e.stopPropagation();
316
+ },
302
317
  value: (_g = (_f = context.dataVerification) === null || _f === void 0 ? void 0 : _f.dataRegulation) === null || _g === void 0 ? void 0 : _g.value1,
303
318
  placeholder: dataVerification.placeholder2,
304
319
  onChange: function onChange(e) {
320
+ e.stopPropagation();
305
321
  var value = e.target.value;
306
322
  setContext(function (ctx) {
307
323
  ctx.dataVerification.dataRegulation.value1 = value;
@@ -195,15 +195,6 @@ var ColumnHeader = function ColumnHeader() {
195
195
  useEffect(function () {
196
196
  containerRef.current.scrollLeft = context.scrollLeft;
197
197
  }, [context.scrollLeft]);
198
- var _h = useState(0),
199
- hovered = _h[0],
200
- setHovered = _h[1];
201
- var onMouseMoveHideRight = useCallback(function () {
202
- setHovered(-21);
203
- }, []);
204
- var onMouseLeaveHideRight = useCallback(function () {
205
- setHovered(0);
206
- }, []);
207
198
  return /*#__PURE__*/React.createElement("div", {
208
199
  ref: containerRef,
209
200
  className: "fortune-col-header",
@@ -112,14 +112,14 @@ var ColorSection = exports.ColorSection = function ColorSection(_a) {
112
112
  title: color.name
113
113
  }));
114
114
  }), /*#__PURE__*/_react.default.createElement("div", {
115
- className: "w-full flex justify-center",
115
+ className: "w-full flex justify-center color-picker-reset-btn",
116
116
  onClick: function onClick() {
117
117
  onPick("228, 232, 237");
118
118
  setIsOpen(false);
119
119
  }
120
120
  }, /*#__PURE__*/_react.default.createElement(_ui.IconButton, {
121
121
  icon: "DropletOff",
122
- size: "md",
122
+ size: "sm",
123
123
  variant: "ghost",
124
124
  className: "color-picker-icon"
125
125
  }), /*#__PURE__*/_react.default.createElement(_ui.Button, {
@@ -155,8 +155,15 @@ var DropDownList = function DropDownList() {
155
155
  display: isMul && selected.indexOf(v) >= 0 ? "inline" : "none"
156
156
  }
157
157
  }), v);
158
+ }), /*#__PURE__*/_react.default.createElement("hr", {
159
+ style: {
160
+ border: "none",
161
+ height: "1px",
162
+ background: "hsl(var(--color-bg-default-hover, #F2F4F5))",
163
+ marginBottom: "4px"
164
+ }
158
165
  }), /*#__PURE__*/_react.default.createElement("div", {
159
- className: "w-full flex align-center",
166
+ className: "w-full flex align-center edit-dropdown",
160
167
  style: {
161
168
  height: "28px"
162
169
  },
@@ -168,11 +175,14 @@ var DropDownList = function DropDownList() {
168
175
  icon: "Pencil",
169
176
  size: "sm",
170
177
  variant: "ghost",
171
- className: "color-picker-icon pt-2 color-picker"
178
+ className: "color-picker-icon color-picker edit-dropdown",
179
+ style: {
180
+ paddingTop: "0px !important"
181
+ }
172
182
  }), /*#__PURE__*/_react.default.createElement(_ui.Button, {
173
183
  size: "md",
174
184
  variant: "ghost",
175
- className: "color-picker-reset color-picker"
185
+ className: "color-picker-reset color-picker edit-dropdown"
176
186
  }, "Edit")));
177
187
  };
178
188
  var _default = exports.default = DropDownList;
@@ -54,7 +54,20 @@ var DynamicInputList = function DynamicInputList(_a) {
54
54
  });
55
55
  };
56
56
  (0, _react.useEffect)(function () {
57
- handleAdd();
57
+ if (optionItems.length === 0) {
58
+ var nextNum_1 = 1;
59
+ setOptionItems(function (prev) {
60
+ return __spreadArray(__spreadArray([], prev, true), [{
61
+ id: createId(),
62
+ value: "Option ".concat(nextNum_1),
63
+ color: "228, 232, 237"
64
+ }, {
65
+ id: createId(),
66
+ value: "Option ".concat(nextNum_1 + 1),
67
+ color: "228, 232, 237"
68
+ }], false);
69
+ });
70
+ }
58
71
  }, []);
59
72
  var handleRemove = function handleRemove(index) {
60
73
  setOptionItems(function (prev) {
@@ -201,6 +201,15 @@
201
201
  min-width: 100px;
202
202
  }
203
203
 
204
+ .color-picker-reset-btn {
205
+ height: 30px;
206
+ border-radius: 6px;
207
+ }
208
+
209
+ .color-picker-reset-btn:hover {
210
+ background: hsl(var(--color-bg-default-hover, #F2F4F5))!important;
211
+ }
212
+
204
213
  .color-picker:hover {
205
214
  background: hsl(var(--color-bg-default-hover, #F2F4F5))!important;
206
215
  }
@@ -212,15 +221,20 @@
212
221
  }
213
222
 
214
223
  .color-picker-reset {
224
+ height: 30px !important;
225
+ padding-top: 0px !important;
226
+ padding-bottom: 0px !important;
215
227
  min-width: 0px !important;
216
228
  padding-left: 0px !important;
217
229
  margin-left: 0px !important;
218
230
  }
219
231
 
220
- .color-picker-reset:hover {
221
- background-color: white!important;
232
+ .edit-dropdown {
233
+ height: 28px!important;
234
+ border-radius: 5px;
222
235
  }
223
236
 
224
- .color-picker-icon:hover {
225
- background-color: white!important;
237
+ .edit-dropdown:hover {
238
+ height: 28px!important;
239
+ background: hsl(var(--color-bg-default-hover, #F2F4F5))!important;
226
240
  }
@@ -224,6 +224,18 @@ var DataVerification = function DataVerification() {
224
224
  }
225
225
  });
226
226
  }, []);
227
+ var rangeOnClick = function rangeOnClick() {
228
+ var _a;
229
+ (_a = document.getElementById("data-verification-button")) === null || _a === void 0 ? void 0 : _a.click();
230
+ hideDialog();
231
+ dataSelectRange("rangeTxt", context.dataVerification.dataRegulation.value1);
232
+ };
233
+ var rangeOnChange = function rangeOnChange(e) {
234
+ var value = e.target.value;
235
+ setContext(function (ctx) {
236
+ ctx.dataVerification.dataRegulation.rangeTxt = value;
237
+ });
238
+ };
227
239
  return /*#__PURE__*/_react.default.createElement("div", {
228
240
  id: "fortune-data-verification"
229
241
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -239,23 +251,19 @@ var DataVerification = function DataVerification() {
239
251
  }, dataVerification.cellRange), /*#__PURE__*/_react.default.createElement(_ui.TextField, {
240
252
  rightIcon: /*#__PURE__*/_react.default.createElement(_ui.LucideIcon, {
241
253
  name: "Grid2x2",
242
- size: "sm"
254
+ size: "sm",
255
+ onClick: rangeOnClick,
256
+ onChange: rangeOnChange,
257
+ style: {
258
+ cursor: "pointer",
259
+ color: "#363B3F"
260
+ }
243
261
  }),
244
262
  "aria-hidden": "true",
245
263
  readOnly: true,
246
264
  value: (_a = context.dataVerification.dataRegulation) === null || _a === void 0 ? void 0 : _a.rangeTxt,
247
- onChange: function onChange(e) {
248
- var value = e.target.value;
249
- setContext(function (ctx) {
250
- ctx.dataVerification.dataRegulation.rangeTxt = value;
251
- });
252
- },
253
- onClick: function onClick() {
254
- var _a;
255
- (_a = document.getElementById("data-verification-button")) === null || _a === void 0 ? void 0 : _a.click();
256
- hideDialog();
257
- dataSelectRange("rangeTxt", context.dataVerification.dataRegulation.value1);
258
- }
265
+ onChange: rangeOnChange,
266
+ onClick: rangeOnClick
259
267
  })), /*#__PURE__*/_react.default.createElement("div", {
260
268
  className: "flex flex-col"
261
269
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -308,9 +316,17 @@ var DataVerification = function DataVerification() {
308
316
  }, /*#__PURE__*/_react.default.createElement("span", {
309
317
  className: "data-verification-checkbox-label"
310
318
  }, dataVerification.selected), /*#__PURE__*/_react.default.createElement(_ui.TextField, {
319
+ onMouseDown: function onMouseDown(e) {
320
+ e.stopPropagation();
321
+ e.target.focus();
322
+ },
323
+ onKeyDown: function onKeyDown(e) {
324
+ e.stopPropagation();
325
+ },
311
326
  value: (_g = (_f = context.dataVerification) === null || _f === void 0 ? void 0 : _f.dataRegulation) === null || _g === void 0 ? void 0 : _g.value1,
312
327
  placeholder: dataVerification.placeholder2,
313
328
  onChange: function onChange(e) {
329
+ e.stopPropagation();
314
330
  var value = e.target.value;
315
331
  setContext(function (ctx) {
316
332
  ctx.dataVerification.dataRegulation.value1 = value;
@@ -204,15 +204,6 @@ var ColumnHeader = function ColumnHeader() {
204
204
  (0, _react.useEffect)(function () {
205
205
  containerRef.current.scrollLeft = context.scrollLeft;
206
206
  }, [context.scrollLeft]);
207
- var _h = (0, _react.useState)(0),
208
- hovered = _h[0],
209
- setHovered = _h[1];
210
- var onMouseMoveHideRight = (0, _react.useCallback)(function () {
211
- setHovered(-21);
212
- }, []);
213
- var onMouseLeaveHideRight = (0, _react.useCallback)(function () {
214
- setHovered(0);
215
- }, []);
216
207
  return /*#__PURE__*/_react.default.createElement("div", {
217
208
  ref: containerRef,
218
209
  className: "fortune-col-header",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fileverse-dev/fortune-react",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "module": "es/index.js",
@@ -16,7 +16,7 @@
16
16
  "tsc": "tsc"
17
17
  },
18
18
  "dependencies": {
19
- "@fileverse-dev/fortune-core": "1.2.3",
19
+ "@fileverse-dev/fortune-core": "1.2.5",
20
20
  "@fileverse/ui": "^4.1.7-patch-21",
21
21
  "@tippyjs/react": "^4.2.6",
22
22
  "@types/regenerator-runtime": "^0.13.6",