@enyxs/wikex-components 0.11.24 → 0.11.26

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.
package/dist/index.mjs CHANGED
@@ -363,6 +363,7 @@ function parseCmsRichText(value4) {
363
363
  if (typeof mark.italic === "boolean") next.italic = mark.italic;
364
364
  if (typeof mark.underline === "boolean") next.underline = mark.underline;
365
365
  if (typeof mark.href === "string") next.href = safeCmsTextHref(mark.href);
366
+ if (next.href && typeof mark.newTab === "boolean") next.newTab = mark.newTab;
366
367
  if (next.bold !== void 0 || next.italic !== void 0 || next.underline !== void 0 || next.href) marks.push(next);
367
368
  }
368
369
  return { text: raw.text, marks };
@@ -400,6 +401,7 @@ function patchCmsRichText(value4, text2, start, end, patch) {
400
401
  rich.marks.filter((m) => m.start <= a && m.end >= b).forEach((m) => Object.assign(style, m));
401
402
  if (a >= start && b <= end) Object.assign(style, patch);
402
403
  const next = { start: a, end: b, bold: style.bold, italic: style.italic, underline: style.underline, newTab: style.newTab, href: style.href ? safeCmsTextHref(style.href) : void 0 };
404
+ if (!next.href) delete next.newTab;
403
405
  if (next.bold === void 0 && next.italic === void 0 && next.underline === void 0 && !next.href) continue;
404
406
  const previous = marks[marks.length - 1];
405
407
  if (previous && previous.end === a && previous.bold === next.bold && previous.italic === next.italic && previous.underline === next.underline && previous.href === next.href && previous.newTab === next.newTab) previous.end = b;
@@ -8360,37 +8362,59 @@ var feesTheme = {
8360
8362
  ]))
8361
8363
  };
8362
8364
  var EditorActions = styled12.div.withConfig({
8363
- componentId: "sc-a6ff7adc-0"
8365
+ componentId: "sc-ecbebe61-0"
8364
8366
  })([
8365
8367
  `display:flex;flex-wrap:wrap;gap:8px;margin-top:16px;`
8366
8368
  ]);
8367
8369
  var EditGroup = styled12.div.withConfig({
8368
- componentId: "sc-a6ff7adc-1"
8370
+ componentId: "sc-ecbebe61-1"
8369
8371
  })([
8370
8372
  `display:flex;flex-direction:column;gap:6px;`
8371
8373
  ]);
8372
8374
  var HeaderGroup = styled12(EditGroup).withConfig({
8373
- componentId: "sc-a6ff7adc-2"
8375
+ componentId: "sc-ecbebe61-2"
8374
8376
  })([
8375
8377
  `gap:8px;`
8376
8378
  ]);
8377
8379
  var HeaderTitle = styled12.div.withConfig({
8378
- componentId: "sc-a6ff7adc-3"
8380
+ componentId: "sc-ecbebe61-3"
8379
8381
  })([
8380
8382
  `display:flex;align-items:flex-start;min-height:var(--fees-header-title-height,36px);`
8381
8383
  ]);
8382
8384
  var HeaderActions = styled12.div.withConfig({
8383
- componentId: "sc-a6ff7adc-4"
8385
+ componentId: "sc-ecbebe61-4"
8384
8386
  })([
8385
8387
  `display:flex;align-items:center;min-height:24px;`
8386
8388
  ]);
8387
8389
  var AlignedFeesTable = styled12(FeesAndMarginTable).withConfig({
8388
- componentId: "sc-a6ff7adc-5"
8390
+ componentId: "sc-ecbebe61-5"
8391
+ })([
8392
+ `&[data-editable] th{vertical-align:top;}--fees-row-background:`,
8393
+ `;--fees-stripe-background:`,
8394
+ `;--fees-text:`,
8395
+ `;:root[data-theme="dark"] &{--fees-row-background:#39393d;--fees-stripe-background:`,
8396
+ `;--fees-text:`,
8397
+ `;}&[data-editable] table{table-layout:auto;}table{table-layout:fixed;font-family:var(--font-manrope,Manrope),Arial,Helvetica,sans-serif;}th,td{box-sizing:border-box;overflow-wrap:anywhere;}thead > tr,thead > tr > th{background:`,
8398
+ `;}thead > tr > th{height:52px;padding:11.5px 8px;color:`,
8399
+ `;font-size:10px;font-weight:600;line-height:14px;white-space:pre-line;}tbody > tr{background:var(--fees-row-background);}tbody > tr:nth-child(even){background:var(--fees-stripe-background);}tbody > tr > td{height:32px;padding:7.5px 8px;background:inherit;color:var(--fees-text);font-size:12px;font-weight:500;line-height:16px;}thead > tr > th:first-child,tbody > tr > td:first-child{padding-left:16px;}@media (max-width:767px){&&:not([data-editable]){table{min-width:100%;width:`,
8400
+ `px;table-layout:fixed;}`,
8401
+ ` thead > tr > th,tbody > tr > td{padding-left:6px;padding-right:6px;white-space:pre-line;overflow-wrap:anywhere;font-family:var(--font-inter,Inter),Arial,Helvetica,sans-serif;}thead > tr > th{height:40px;padding-top:9.5px;padding-bottom:9.5px;font-size:8px;line-height:10px;}tbody > tr > td{height:40px;padding-top:5.5px;padding-bottom:5.5px;font-size:10px;line-height:14px;}thead > tr > th:last-child,tbody > tr > td:last-child{padding-right:12px;}th > span,td > span{text-align:left;}thead > tr > th:first-child,tbody > tr > td:first-child{position:sticky;left:0;padding-left:12px;}thead > tr > th:first-child{z-index:3;background:`,
8402
+ `;}tbody > tr > td:first-child{z-index:2;background:var(--fees-row-background);}tbody > tr:nth-child(even) > td:first-child{background:var(--fees-stripe-background);}}}`
8403
+ ], ({ theme }) => theme.colors.background.deep, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.accent.foreground, ({ theme }) => theme.colors.background.card, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary, ({ theme }) => theme.colors.accent.foreground, ({ $mobileColumnWidths }) => $mobileColumnWidths.reduce((sum, width) => sum + width, 0), ({ $mobileColumnWidths }) => $mobileColumnWidths.map((width, index) => `
8404
+ th:nth-child(${index + 1}), td:nth-child(${index + 1}) {
8405
+ width: ${width}px;
8406
+ min-width: ${width}px;
8407
+ max-width: ${width}px;
8408
+ }
8409
+ `).join(""), ({ theme }) => theme.colors.accent.primary);
8410
+ var FeesCellContent = styled12.span.withConfig({
8411
+ componentId: "sc-ecbebe61-6"
8389
8412
  })([
8390
- `&[data-editable] th{vertical-align:top;}`
8391
- ]);
8413
+ `display:block;text-align:`,
8414
+ `;`
8415
+ ], ({ $alignRight }) => $alignRight ? "right" : "left");
8392
8416
  var EditorButton = styled12.button.withConfig({
8393
- componentId: "sc-a6ff7adc-6"
8417
+ componentId: "sc-ecbebe61-7"
8394
8418
  })([
8395
8419
  `padding:7px 12px;border:1px solid `,
8396
8420
  `;border-radius:6px;background:`,
@@ -8399,17 +8423,17 @@ var EditorButton = styled12.button.withConfig({
8399
8423
  `;}&:disabled{cursor:default;opacity:.4;}`
8400
8424
  ], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
8401
8425
  var OrderActions = styled12.div.withConfig({
8402
- componentId: "sc-a6ff7adc-7"
8426
+ componentId: "sc-ecbebe61-8"
8403
8427
  })([
8404
8428
  `display:flex;gap:6px;align-items:center;flex-wrap:wrap;`
8405
8429
  ]);
8406
8430
  var PositionLabel = styled12.label.withConfig({
8407
- componentId: "sc-a6ff7adc-8"
8431
+ componentId: "sc-ecbebe61-9"
8408
8432
  })([
8409
8433
  `display:inline-flex;align-items:center;gap:6px;font-size:12px;`
8410
8434
  ]);
8411
8435
  var PositionInput = styled12.input.withConfig({
8412
- componentId: "sc-a6ff7adc-9"
8436
+ componentId: "sc-ecbebe61-10"
8413
8437
  })([
8414
8438
  `width:56px;padding:5px;border:1px solid `,
8415
8439
  `;border-radius:4px;background:`,
@@ -8418,17 +8442,17 @@ var PositionInput = styled12.input.withConfig({
8418
8442
  `;}`
8419
8443
  ], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
8420
8444
  var ColumnRow = styled12.div.withConfig({
8421
- componentId: "sc-a6ff7adc-10"
8445
+ componentId: "sc-ecbebe61-11"
8422
8446
  })([
8423
8447
  `display:flex;gap:12px;align-items:center;margin:16px 0;> textarea{flex:1;min-width:120px;}@media (max-width:600px){align-items:stretch;flex-direction:column;}`
8424
8448
  ]);
8425
8449
  var PaginationControls = styled12(FeesAndMarginPagination).withConfig({
8426
- componentId: "sc-a6ff7adc-11"
8450
+ componentId: "sc-ecbebe61-12"
8427
8451
  })([
8428
8452
  `align-items:center;flex-wrap:wrap;gap:16px 24px;`
8429
8453
  ]);
8430
8454
  var PageSizeLabel = styled12.div.withConfig({
8431
- componentId: "sc-a6ff7adc-12"
8455
+ componentId: "sc-ecbebe61-13"
8432
8456
  })([
8433
8457
  `display:inline-flex;align-items:center;gap:8px;color:`,
8434
8458
  `;font:inherit;font-size:13px;`
@@ -8456,12 +8480,12 @@ function Position({ value: value4, max, label, onMove }) {
8456
8480
  });
8457
8481
  }
8458
8482
  var DeleteButton = styled12(EditorButton).withConfig({
8459
- componentId: "sc-a6ff7adc-13"
8483
+ componentId: "sc-ecbebe61-14"
8460
8484
  })([
8461
8485
  `align-self:flex-start;padding:4px 8px;border:0;border-radius:4px;background:#d32f2f;color:#fff;font-size:11px;font-weight:600;line-height:16px;white-space:nowrap;text-decoration:none;&:hover{background:#b71c1c;}&:focus-visible{outline:2px solid #d32f2f;outline-offset:2px;}`
8462
8486
  ]);
8463
8487
  var CellEditorInput = styled12.textarea.withConfig({
8464
- componentId: "sc-a6ff7adc-14"
8488
+ componentId: "sc-ecbebe61-15"
8465
8489
  })([
8466
8490
  `display:block;box-sizing:border-box;width:100%;min-width:0;padding:3px;border:1px solid transparent;border-radius:3px;color:inherit;background:transparent;font:inherit;line-height:inherit;resize:none;overflow:hidden;&:hover{border-color:`,
8467
8491
  `;}&:focus{outline:1px solid `,
@@ -8574,6 +8598,31 @@ var columnWidths = {
8574
8598
  tradingHours: 160,
8575
8599
  priceRange: 112
8576
8600
  };
8601
+ var mobileColumnWidths = {
8602
+ name: 88,
8603
+ code: 60,
8604
+ exchange: 60,
8605
+ initialMargin: 90,
8606
+ tradingFee: 64,
8607
+ tickSize: 54,
8608
+ margin: 70,
8609
+ priceUnit: 88,
8610
+ contractSize: 110,
8611
+ settlement: 92,
8612
+ deliveryDay: 90,
8613
+ tradingHours: 120,
8614
+ priceRange: 70
8615
+ };
8616
+ var rightAlignedColumns = /* @__PURE__ */ new Set([
8617
+ "initialMargin",
8618
+ "tradingFee",
8619
+ "tickSize",
8620
+ "margin",
8621
+ "settlement",
8622
+ "priceRange",
8623
+ "priceUnit",
8624
+ "unit"
8625
+ ]);
8577
8626
  function FeesTable({ value: value4, editable = false, onChange, labels, size = "md", tagOrder = [], language = "vi" }) {
8578
8627
  const [search, setSearch] = useState5("");
8579
8628
  const [tag, setTag] = useState5("");
@@ -8694,7 +8743,7 @@ function FeesTable({ value: value4, editable = false, onChange, labels, size = "
8694
8743
  });
8695
8744
  const columns = value4.columns.map((column, index) => ({
8696
8745
  key: column.key,
8697
- width: columnWidths[column.key] ?? 140,
8746
+ width: canEdit ? columnWidths[column.key] ?? 140 : index === 0 ? 178 : 170,
8698
8747
  fixed: index === 0 ? "left" : void 0,
8699
8748
  title: canEdit ? /* @__PURE__ */ _jsxs3(HeaderGroup, {
8700
8749
  children: [
@@ -8726,7 +8775,10 @@ function FeesTable({ value: value4, editable = false, onChange, labels, size = "
8726
8775
  })
8727
8776
  })
8728
8777
  ]
8729
- }) : column.title,
8778
+ }) : /* @__PURE__ */ _jsx3(FeesCellContent, {
8779
+ $alignRight: rightAlignedColumns.has(column.key),
8780
+ children: column.title
8781
+ }),
8730
8782
  render: (_unused, row) => canEdit ? /* @__PURE__ */ _jsx3(CellEditor, {
8731
8783
  rows: Math.max(2, (row.cells[column.key] ?? "").split("\n").length),
8732
8784
  value: row.cells[column.key] ?? "",
@@ -8737,7 +8789,10 @@ function FeesTable({ value: value4, editable = false, onChange, labels, size = "
8737
8789
  [column.key]: event.target.value
8738
8790
  }
8739
8791
  })
8740
- }) : row.cells[column.key] ?? ""
8792
+ }) : /* @__PURE__ */ _jsx3(FeesCellContent, {
8793
+ $alignRight: rightAlignedColumns.has(column.key),
8794
+ children: row.cells[column.key] ?? ""
8795
+ })
8741
8796
  }));
8742
8797
  if (canEdit) columns.push({
8743
8798
  key: "__tags",
@@ -8901,6 +8956,7 @@ function FeesTable({ value: value4, editable = false, onChange, labels, size = "
8901
8956
  ]
8902
8957
  }),
8903
8958
  /* @__PURE__ */ _jsx3(AlignedFeesTable, {
8959
+ $mobileColumnWidths: columns.map((column) => mobileColumnWidths[column.key] ?? 88),
8904
8960
  "data-editable": canEdit || void 0,
8905
8961
  children: /* @__PURE__ */ _jsx3(Table, {
8906
8962
  ariaLabel: english ? "Fees and margin table" : "B\u1EA3ng ph\xED v\xE0 k\xFD qu\u1EF9",
@@ -8910,7 +8966,7 @@ function FeesTable({ value: value4, editable = false, onChange, labels, size = "
8910
8966
  size,
8911
8967
  empty: labels?.empty ?? "Kh\xF4ng t\xECm th\u1EA5y h\xE0ng h\xF3a",
8912
8968
  scroll: {
8913
- x: Math.max(1440, value4.columns.reduce((sum, column) => sum + (columnWidths[column.key] ?? 140), 0) + (canEdit ? 300 : 0))
8969
+ x: canEdit ? Math.max(1440, value4.columns.reduce((sum, column) => sum + (columnWidths[column.key] ?? 140), 0) + 300) : value4.columns.length * 170 + 8
8914
8970
  }
8915
8971
  })
8916
8972
  }),