@fileverse-dev/fortune-react 1.0.2-mod-42 → 1.0.2-mod-44

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.
@@ -6,6 +6,7 @@ type Props = {
6
6
  disabled?: boolean;
7
7
  selected?: boolean;
8
8
  children?: React.ReactNode;
9
+ style?: React.CSSProperties;
9
10
  };
10
11
  declare const Button: React.FC<Props>;
11
12
  export default Button;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import "./index.css";
3
- export declare const getIcon: (title: string) => "AlignLeft" | "AlignCenter" | "AlignRight" | "ArrowUpFromLine" | "AlignVerticalMiddle" | "ArrowDownFromLine" | "TextOverflow" | "WrapText" | "TextClip" | "";
3
+ export declare const getIcon: (title: string) => "AlignLeft" | "AlignCenter" | "AlignRight" | "ArrowUpFromLine" | "AlignVerticalMiddle" | "ArrowDownToLine" | "TextOverflow" | "WrapText" | "TextClip" | "";
4
4
  declare const Toolbar: React.FC<{
5
5
  setMoreItems: React.Dispatch<React.SetStateAction<React.ReactNode>>;
6
6
  moreItemsOpen: boolean;
package/dist/index.css CHANGED
@@ -2254,6 +2254,7 @@ input[type="number"].condition-rules-project-input {
2254
2254
  border-bottom: 1px solid #d4d4d4;
2255
2255
  white-space: nowrap;
2256
2256
  align-items: center;
2257
+ gap: 4px;
2257
2258
  }
2258
2259
 
2259
2260
  .fortune-toolbar-divider {
@@ -2289,13 +2290,21 @@ input[type="number"].condition-rules-project-input {
2289
2290
  user-select: none;
2290
2291
  background: 0;
2291
2292
  outline: none;
2292
- padding: 0;
2293
+ padding: 2px;
2293
2294
  list-style: none;
2294
2295
  text-decoration: none;
2295
2296
  display: flex;
2297
+ justify-content: center;
2296
2298
  align-items: center;
2297
- padding: 2px;
2298
- margin: 2px 8px;
2299
+ min-width: 30px;
2300
+ height: 30px;
2301
+ margin: 0;
2302
+ }
2303
+
2304
+ .fortune-toolbar-button svg,
2305
+ .fortune-toolbar-combo svg {
2306
+ width: 16px !important;
2307
+ height: 16px !important;
2299
2308
  }
2300
2309
 
2301
2310
  .fortune-toolbar-combo-button,
@@ -2306,12 +2315,12 @@ input[type="number"].condition-rules-project-input {
2306
2315
 
2307
2316
  .fortune-toolbar-button:hover,
2308
2317
  .fortune-toolbar-combo:hover {
2309
- background-color: rgba(0, 0, 0, 0.06);
2318
+ background-color: #f2f4f5;
2310
2319
  cursor: pointer;
2311
2320
  }
2312
2321
 
2313
2322
  .fortune-toolbar-combo-arrow:hover {
2314
- background-color: rgba(0, 0, 0, 0.06);
2323
+ background-color: #f2f4f5;
2315
2324
  cursor: pointer;
2316
2325
  }
2317
2326
 
@@ -2385,6 +2394,7 @@ input[type="number"].condition-rules-project-input {
2385
2394
  margin: 0 4px;
2386
2395
  font-weight: 500;
2387
2396
  font-size: 14px;
2397
+ line-height: 20px;
2388
2398
  }
2389
2399
 
2390
2400
  .fortune-toolbar-color-picker-item {
@@ -2592,6 +2602,20 @@ input[type="number"].condition-rules-project-input {
2592
2602
  background-color: hsl(var(--color-bg-default-hover));
2593
2603
  }
2594
2604
 
2605
+ .fortune-toolbar-left {
2606
+ display: flex;
2607
+ flex-direction: row;
2608
+ align-items: center;
2609
+ gap: 4px;
2610
+ }
2611
+
2612
+ .fortune-toolbar-right {
2613
+ display: flex;
2614
+ flex-direction: row;
2615
+ align-items: center;
2616
+ gap: 4px;
2617
+ }
2618
+
2595
2619
  #fortune-split-column {
2596
2620
  /* position: absolute;
2597
2621
  padding: 30px 42px;
@@ -2791,7 +2815,7 @@ label {
2791
2815
 
2792
2816
  .input-modal {
2793
2817
  position: fixed;
2794
- top: 25%;
2818
+ top: 16%;
2795
2819
  left: 50%;
2796
2820
  transform: translateX(-50%);
2797
2821
  border-radius: 0.75rem;
@@ -2254,6 +2254,7 @@ input[type="number"].condition-rules-project-input {
2254
2254
  border-bottom: 1px solid #d4d4d4;
2255
2255
  white-space: nowrap;
2256
2256
  align-items: center;
2257
+ gap: 4px;
2257
2258
  }
2258
2259
 
2259
2260
  .fortune-toolbar-divider {
@@ -2289,13 +2290,21 @@ input[type="number"].condition-rules-project-input {
2289
2290
  user-select: none;
2290
2291
  background: 0;
2291
2292
  outline: none;
2292
- padding: 0;
2293
+ padding: 2px;
2293
2294
  list-style: none;
2294
2295
  text-decoration: none;
2295
2296
  display: flex;
2297
+ justify-content: center;
2296
2298
  align-items: center;
2297
- padding: 2px;
2298
- margin: 2px 8px;
2299
+ min-width: 30px;
2300
+ height: 30px;
2301
+ margin: 0;
2302
+ }
2303
+
2304
+ .fortune-toolbar-button svg,
2305
+ .fortune-toolbar-combo svg {
2306
+ width: 16px !important;
2307
+ height: 16px !important;
2299
2308
  }
2300
2309
 
2301
2310
  .fortune-toolbar-combo-button,
@@ -2306,12 +2315,12 @@ input[type="number"].condition-rules-project-input {
2306
2315
 
2307
2316
  .fortune-toolbar-button:hover,
2308
2317
  .fortune-toolbar-combo:hover {
2309
- background-color: rgba(0, 0, 0, 0.06);
2318
+ background-color: #f2f4f5;
2310
2319
  cursor: pointer;
2311
2320
  }
2312
2321
 
2313
2322
  .fortune-toolbar-combo-arrow:hover {
2314
- background-color: rgba(0, 0, 0, 0.06);
2323
+ background-color: #f2f4f5;
2315
2324
  cursor: pointer;
2316
2325
  }
2317
2326
 
@@ -2385,6 +2394,7 @@ input[type="number"].condition-rules-project-input {
2385
2394
  margin: 0 4px;
2386
2395
  font-weight: 500;
2387
2396
  font-size: 14px;
2397
+ line-height: 20px;
2388
2398
  }
2389
2399
 
2390
2400
  .fortune-toolbar-color-picker-item {
@@ -2592,6 +2602,20 @@ input[type="number"].condition-rules-project-input {
2592
2602
  background-color: hsl(var(--color-bg-default-hover));
2593
2603
  }
2594
2604
 
2605
+ .fortune-toolbar-left {
2606
+ display: flex;
2607
+ flex-direction: row;
2608
+ align-items: center;
2609
+ gap: 4px;
2610
+ }
2611
+
2612
+ .fortune-toolbar-right {
2613
+ display: flex;
2614
+ flex-direction: row;
2615
+ align-items: center;
2616
+ gap: 4px;
2617
+ }
2618
+
2595
2619
  #fortune-split-column {
2596
2620
  /* position: absolute;
2597
2621
  padding: 30px 42px;
@@ -2791,7 +2815,7 @@ label {
2791
2815
 
2792
2816
  .input-modal {
2793
2817
  position: fixed;
2794
- top: 25%;
2818
+ top: 16%;
2795
2819
  left: 50%;
2796
2820
  transform: translateX(-50%);
2797
2821
  border-radius: 0.75rem;
package/dist/index.esm.js CHANGED
@@ -2023,8 +2023,8 @@ var LinkEditCard = function LinkEditCard(_ref) {
2023
2023
  }, /*#__PURE__*/React.createElement(SVGIcon, {
2024
2024
  name: iconId,
2025
2025
  style: {
2026
- width: 18,
2027
- height: 18
2026
+ width: 16,
2027
+ height: 16
2028
2028
  }
2029
2029
  }));
2030
2030
  }, []);
@@ -2121,7 +2121,9 @@ var LinkEditCard = function LinkEditCard(_ref) {
2121
2121
  }, /*#__PURE__*/React.createElement("div", {
2122
2122
  className: "input-icon"
2123
2123
  }, /*#__PURE__*/React.createElement(SVGIcon, {
2124
- name: "link"
2124
+ name: "link",
2125
+ width: 16,
2126
+ height: 16
2125
2127
  })), /*#__PURE__*/React.createElement(TextField, {
2126
2128
  placeholder: "Paste URL",
2127
2129
  value: linkAddress,
@@ -2134,7 +2136,9 @@ var LinkEditCard = function LinkEditCard(_ref) {
2134
2136
  }, /*#__PURE__*/React.createElement("div", {
2135
2137
  className: "input-icon"
2136
2138
  }, /*#__PURE__*/React.createElement(SVGIcon, {
2137
- name: "link"
2139
+ name: "link",
2140
+ width: 16,
2141
+ height: 16
2138
2142
  })), /*#__PURE__*/React.createElement(Select$1, {
2139
2143
  onValueChange: function onValueChange(value) {
2140
2144
  if (!linkText) setLinkText(value);
@@ -4396,7 +4400,8 @@ var Button = function Button(_ref) {
4396
4400
  iconId = _ref.iconId,
4397
4401
  disabled = _ref.disabled,
4398
4402
  selected = _ref.selected,
4399
- children = _ref.children;
4403
+ children = _ref.children,
4404
+ style = _ref.style;
4400
4405
  return /*#__PURE__*/React.createElement("div", {
4401
4406
  className: "fortune-toolbar-button fortune-toolbar-item",
4402
4407
  onClick: onClick,
@@ -4406,9 +4411,11 @@ var Button = function Button(_ref) {
4406
4411
  "aria-label": tooltip,
4407
4412
  style: selected ? {
4408
4413
  backgroundColor: "#E7E5EB"
4409
- } : {}
4414
+ } : style
4410
4415
  }, /*#__PURE__*/React.createElement(SVGIcon, {
4411
4416
  name: iconId,
4417
+ width: 16,
4418
+ height: 16,
4412
4419
  style: disabled ? {
4413
4420
  opacity: 0.3
4414
4421
  } : {}
@@ -4497,7 +4504,9 @@ var Combo = function Combo(_ref) {
4497
4504
  "aria-label": "".concat(tooltip, ": ").concat(text !== undefined ? text : ""),
4498
4505
  style: style
4499
4506
  }, iconId ? (/*#__PURE__*/React.createElement(SVGIcon, {
4500
- name: iconId
4507
+ name: iconId,
4508
+ width: 16,
4509
+ height: 16
4501
4510
  })) : (/*#__PURE__*/React.createElement("span", {
4502
4511
  className: "fortune-toolbar-combo-text"
4503
4512
  }, text !== undefined ? text : "")))) : (/*#__PURE__*/React.createElement(IconButton, {
@@ -5213,6 +5222,8 @@ var CustomButton = function CustomButton(_ref) {
5213
5222
  backgroundColor: "#E7E5EB"
5214
5223
  } : {}
5215
5224
  }, /*#__PURE__*/React.createElement(CustomIcon, {
5225
+ width: 16,
5226
+ height: 16,
5216
5227
  iconName: iconName,
5217
5228
  content: icon
5218
5229
  }), tooltip && /*#__PURE__*/React.createElement("div", {
@@ -5515,7 +5526,7 @@ var getIcon = function getIcon(title) {
5515
5526
  case "align-middle":
5516
5527
  return "AlignVerticalMiddle";
5517
5528
  case "align-bottom":
5518
- return "ArrowDownFromLine";
5529
+ return "ArrowDownToLine";
5519
5530
  case "text-overflow":
5520
5531
  return "TextOverflow";
5521
5532
  case "text-wrap":
@@ -5638,9 +5649,11 @@ var Toolbar = function Toolbar(_ref) {
5638
5649
  var container = containerRef.current;
5639
5650
  if (!container) return;
5640
5651
  var moreButtonWidth = 50;
5652
+ var containerWidth = container.getBoundingClientRect().width;
5653
+ var availableWidth = containerWidth - 30;
5641
5654
  for (var i = itemLocations.length - 1; i >= 0; i -= 1) {
5642
5655
  var loc = itemLocations[i];
5643
- if (loc + moreButtonWidth < container.clientWidth) {
5656
+ if (loc + moreButtonWidth < availableWidth) {
5644
5657
  setToolbarWrapIndex(i - itemLocations.length + settings.toolbarItems.length);
5645
5658
  if (i === itemLocations.length - 1) {
5646
5659
  setMoreItems(null);
@@ -5744,7 +5757,8 @@ var Toolbar = function Toolbar(_ref) {
5744
5757
  className: "fortune-toolbar-menu-line"
5745
5758
  }, /*#__PURE__*/React.createElement("div", null, text), /*#__PURE__*/React.createElement(SVGIcon, {
5746
5759
  name: "rightArrow",
5747
- width: 14
5760
+ width: 16,
5761
+ height: 16
5748
5762
  })), /*#__PURE__*/React.createElement("div", {
5749
5763
  className: "more-format toolbar-item-sub-menu fortune-toolbar-select",
5750
5764
  style: {
@@ -6315,16 +6329,20 @@ var Toolbar = function Toolbar(_ref) {
6315
6329
  if (name === "merge-cell") {
6316
6330
  var itemdata = [{
6317
6331
  text: merge.mergeAll,
6318
- value: "merge-all"
6332
+ value: "merge-all",
6333
+ icon: "MergeAll"
6319
6334
  }, {
6320
6335
  text: merge.mergeV,
6321
- value: "merge-vertical"
6336
+ value: "merge-vertical",
6337
+ icon: "MergeVertical"
6322
6338
  }, {
6323
6339
  text: merge.mergeH,
6324
- value: "merge-horizontal"
6340
+ value: "merge-horizontal",
6341
+ icon: "MergeHorizontal"
6325
6342
  }, {
6326
6343
  text: merge.mergeCancel,
6327
- value: "merge-cancel"
6344
+ value: "merge-cancel",
6345
+ icon: "Unmerge"
6328
6346
  }];
6329
6347
  return /*#__PURE__*/React.createElement(Combo, {
6330
6348
  iconId: "merge-all",
@@ -6339,7 +6357,8 @@ var Toolbar = function Toolbar(_ref) {
6339
6357
  }, function (setOpen) {
6340
6358
  return /*#__PURE__*/React.createElement(Select, null, itemdata.map(function (_ref8) {
6341
6359
  var text = _ref8.text,
6342
- value = _ref8.value;
6360
+ value = _ref8.value,
6361
+ icon = _ref8.icon;
6343
6362
  return /*#__PURE__*/React.createElement(Option, {
6344
6363
  key: value,
6345
6364
  onClick: function onClick() {
@@ -6354,8 +6373,10 @@ var Toolbar = function Toolbar(_ref) {
6354
6373
  alignItems: "center",
6355
6374
  gap: 6
6356
6375
  }
6357
- }, /*#__PURE__*/React.createElement(SVGIcon, {
6358
- name: value
6376
+ }, /*#__PURE__*/React.createElement(LucideIcon, {
6377
+ name: icon,
6378
+ width: 16,
6379
+ height: 16
6359
6380
  }), text));
6360
6381
  }));
6361
6382
  });
@@ -6363,37 +6384,44 @@ var Toolbar = function Toolbar(_ref) {
6363
6384
  if (name === "border") {
6364
6385
  var _items4 = [{
6365
6386
  text: border.borderTop,
6366
- value: "border-top"
6387
+ value: "border-top",
6388
+ icon: "BorderTop"
6367
6389
  }, {
6368
6390
  text: border.borderBottom,
6369
- value: "border-bottom"
6391
+ value: "border-bottom",
6392
+ icon: "BorderBottom"
6370
6393
  }, {
6371
6394
  text: border.borderLeft,
6372
- value: "border-left"
6395
+ value: "border-left",
6396
+ icon: "BorderLeft"
6373
6397
  }, {
6374
6398
  text: border.borderRight,
6375
- value: "border-right"
6399
+ value: "border-right",
6400
+ icon: "BorderRight"
6376
6401
  }, {
6377
6402
  text: border.borderNone,
6378
- value: "border-none"
6403
+ value: "border-none",
6404
+ icon: "NoBorder"
6379
6405
  }, {
6380
6406
  text: border.borderAll,
6381
- value: "border-all"
6407
+ value: "border-all",
6408
+ icon: "Border"
6382
6409
  }, {
6383
6410
  text: border.borderOutside,
6384
- value: "border-outside"
6411
+ value: "border-outside",
6412
+ icon: "BorderOutside"
6385
6413
  }, {
6386
6414
  text: border.borderInside,
6387
- value: "border-inside"
6415
+ value: "border-inside",
6416
+ icon: "BorderInside"
6388
6417
  }, {
6389
6418
  text: border.borderHorizontal,
6390
- value: "border-horizontal"
6419
+ value: "border-horizontal",
6420
+ icon: "BorderHorizontal"
6391
6421
  }, {
6392
6422
  text: border.borderVertical,
6393
- value: "border-vertical"
6394
- }, {
6395
- text: border.borderSlash,
6396
- value: "border-slash"
6423
+ value: "border-vertical",
6424
+ icon: "BorderVertical"
6397
6425
  }];
6398
6426
  return /*#__PURE__*/React.createElement(Combo, {
6399
6427
  iconId: "border-all",
@@ -6410,7 +6438,8 @@ var Toolbar = function Toolbar(_ref) {
6410
6438
  return /*#__PURE__*/React.createElement("div", {
6411
6439
  className: "fortune-toolbar-select fortune-border-grid"
6412
6440
  }, _items4.map(function (_ref9) {
6413
- var value = _ref9.value;
6441
+ var value = _ref9.value,
6442
+ icon = _ref9.icon;
6414
6443
  return /*#__PURE__*/React.createElement("div", {
6415
6444
  key: value,
6416
6445
  className: "fortune-border-grid-item",
@@ -6420,8 +6449,10 @@ var Toolbar = function Toolbar(_ref) {
6420
6449
  });
6421
6450
  setOpen(false);
6422
6451
  }
6423
- }, /*#__PURE__*/React.createElement(SVGIcon, {
6424
- name: value
6452
+ }, /*#__PURE__*/React.createElement(LucideIcon, {
6453
+ name: icon,
6454
+ width: 16,
6455
+ height: 16
6425
6456
  }));
6426
6457
  }));
6427
6458
  });
@@ -6465,7 +6496,9 @@ var Toolbar = function Toolbar(_ref) {
6465
6496
  }, /*#__PURE__*/React.createElement("div", {
6466
6497
  className: "fortune-toolbar-menu-line"
6467
6498
  }, text, /*#__PURE__*/React.createElement(SVGIcon, {
6468
- name: value
6499
+ name: value,
6500
+ width: 16,
6501
+ height: 16
6469
6502
  })));
6470
6503
  }));
6471
6504
  });
@@ -6577,7 +6610,9 @@ var Toolbar = function Toolbar(_ref) {
6577
6610
  }, /*#__PURE__*/React.createElement("div", {
6578
6611
  className: "fortune-toolbar-menu-line"
6579
6612
  }, text, /*#__PURE__*/React.createElement(SVGIcon, {
6580
- name: iconId
6613
+ name: iconId,
6614
+ width: 16,
6615
+ height: 16
6581
6616
  })));
6582
6617
  }));
6583
6618
  });
@@ -6651,8 +6686,8 @@ var Toolbar = function Toolbar(_ref) {
6651
6686
  }
6652
6687
  }, /*#__PURE__*/React.createElement(SVGIcon, {
6653
6688
  name: iconId,
6654
- width: 24,
6655
- height: 18
6689
+ width: 16,
6690
+ height: 16
6656
6691
  }), text))) : (/*#__PURE__*/React.createElement(MenuDivider, {
6657
6692
  key: "divider-".concat(index)
6658
6693
  }));
@@ -6676,6 +6711,8 @@ var Toolbar = function Toolbar(_ref) {
6676
6711
  ref: containerRef,
6677
6712
  className: "fortune-toolbar",
6678
6713
  "aria-label": toolbar.toolbar
6714
+ }, /*#__PURE__*/React.createElement("div", {
6715
+ className: "fortune-toolbar-left"
6679
6716
  }, settings.customToolbarItems.filter(function (n) {
6680
6717
  return n.key === "import-export";
6681
6718
  }).map(function (n) {
@@ -6702,9 +6739,9 @@ var Toolbar = function Toolbar(_ref) {
6702
6739
  }));
6703
6740
  }
6704
6741
  }
6705
- })) : null, /*#__PURE__*/React.createElement(Divider, {
6706
- key: "templateDivider"
6707
- }), settings.customToolbarItems.filter(function (n) {
6742
+ })) : null), /*#__PURE__*/React.createElement("div", {
6743
+ className: "fortune-toolbar-right"
6744
+ }, settings.customToolbarItems.filter(function (n) {
6708
6745
  return n.key === "templates";
6709
6746
  }).map(function (n) {
6710
6747
  return /*#__PURE__*/React.createElement(CustomButton, {
@@ -6714,8 +6751,6 @@ var Toolbar = function Toolbar(_ref) {
6714
6751
  icon: n.icon,
6715
6752
  iconName: n.iconName
6716
6753
  }, n.children);
6717
- }), /*#__PURE__*/React.createElement(Divider, {
6718
- key: "customDivider"
6719
6754
  }), settings.customToolbarItems.filter(function (n) {
6720
6755
  return n.key !== "templates" && n.key !== "import-export";
6721
6756
  }).map(function (n) {
@@ -6733,6 +6768,10 @@ var Toolbar = function Toolbar(_ref) {
6733
6768
  onClick: function onClick() {
6734
6769
  if (context.allowEdit === false) return;
6735
6770
  setShowDuneModal(true);
6771
+ },
6772
+ style: {
6773
+ backgroundColor: "#F4603E2E",
6774
+ borderRadius: "8px"
6736
6775
  }
6737
6776
  }), showDuneModal && (/*#__PURE__*/React.createElement(DuneChartsInputModal, {
6738
6777
  isOpen: showDuneModal,
@@ -6748,7 +6787,7 @@ var Toolbar = function Toolbar(_ref) {
6748
6787
  icon: "dune-logo",
6749
6788
  placeholder: "Add Dune chart link to embed",
6750
6789
  submitText: "Embed Dune chart"
6751
- })));
6790
+ }))));
6752
6791
  };
6753
6792
 
6754
6793
  var LocationBox = function LocationBox() {
@@ -7491,8 +7530,8 @@ var ContextMenu = function ContextMenu() {
7491
7530
  className: "context-item"
7492
7531
  }, /*#__PURE__*/React.createElement(SVGIcon, {
7493
7532
  name: "freeze-flv",
7494
- width: 18,
7495
- height: 18,
7533
+ width: 16,
7534
+ height: 16,
7496
7535
  style: {
7497
7536
  marginTop: "4px",
7498
7537
  marginRight: "4px"
@@ -8163,10 +8202,12 @@ var ContextMenu = function ContextMenu() {
8163
8202
  className: "flex items-center gap-2"
8164
8203
  }, /*#__PURE__*/React.createElement(SVGIcon, {
8165
8204
  name: "conditionFormat",
8166
- width: 18
8205
+ width: 16,
8206
+ height: 16
8167
8207
  }), /*#__PURE__*/React.createElement("p", null, rightclick.conditionFormat || "Conditional Format")), /*#__PURE__*/React.createElement(SVGIcon, {
8168
8208
  name: "rightArrow",
8169
- width: 18
8209
+ width: 16,
8210
+ height: 16
8170
8211
  })))));
8171
8212
  }
8172
8213
  return null;