@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.d.mts CHANGED
@@ -31,7 +31,7 @@ type CmsRichText = {
31
31
  declare function safeCmsTextHref(value: string): string | undefined;
32
32
  declare function parseCmsRichText(value: unknown): CmsRichText | undefined;
33
33
  declare function rebaseCmsRichText(value: unknown, text: string): CmsRichText;
34
- declare function patchCmsRichText(value: unknown, text: string, start: number, end: number, patch: Partial<Pick<CmsTextMark, 'bold' | 'italic' | 'underline' | 'href'>>): CmsRichText;
34
+ declare function patchCmsRichText(value: unknown, text: string, start: number, end: number, patch: Partial<Pick<CmsTextMark, 'bold' | 'italic' | 'underline' | 'href' | 'newTab'>>): CmsRichText;
35
35
  declare function renderCmsRichText(children: ReactNode, value: unknown, allowLinks?: boolean): ReactNode;
36
36
 
37
37
  declare const CMS_TEXT_FONTS: {
package/dist/index.d.ts CHANGED
@@ -31,7 +31,7 @@ type CmsRichText = {
31
31
  declare function safeCmsTextHref(value: string): string | undefined;
32
32
  declare function parseCmsRichText(value: unknown): CmsRichText | undefined;
33
33
  declare function rebaseCmsRichText(value: unknown, text: string): CmsRichText;
34
- declare function patchCmsRichText(value: unknown, text: string, start: number, end: number, patch: Partial<Pick<CmsTextMark, 'bold' | 'italic' | 'underline' | 'href'>>): CmsRichText;
34
+ declare function patchCmsRichText(value: unknown, text: string, start: number, end: number, patch: Partial<Pick<CmsTextMark, 'bold' | 'italic' | 'underline' | 'href' | 'newTab'>>): CmsRichText;
35
35
  declare function renderCmsRichText(children: ReactNode, value: unknown, allowLinks?: boolean): ReactNode;
36
36
 
37
37
  declare const CMS_TEXT_FONTS: {
package/dist/index.js CHANGED
@@ -425,6 +425,7 @@ function parseCmsRichText(value4) {
425
425
  if (typeof mark.italic === "boolean") next.italic = mark.italic;
426
426
  if (typeof mark.underline === "boolean") next.underline = mark.underline;
427
427
  if (typeof mark.href === "string") next.href = safeCmsTextHref(mark.href);
428
+ if (next.href && typeof mark.newTab === "boolean") next.newTab = mark.newTab;
428
429
  if (next.bold !== void 0 || next.italic !== void 0 || next.underline !== void 0 || next.href) marks.push(next);
429
430
  }
430
431
  return { text: raw.text, marks };
@@ -462,6 +463,7 @@ function patchCmsRichText(value4, text2, start, end, patch) {
462
463
  rich.marks.filter((m) => m.start <= a && m.end >= b).forEach((m) => Object.assign(style, m));
463
464
  if (a >= start && b <= end) Object.assign(style, patch);
464
465
  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 };
466
+ if (!next.href) delete next.newTab;
465
467
  if (next.bold === void 0 && next.italic === void 0 && next.underline === void 0 && !next.href) continue;
466
468
  const previous = marks[marks.length - 1];
467
469
  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;
@@ -8409,37 +8411,59 @@ var feesTheme = {
8409
8411
  ]))
8410
8412
  };
8411
8413
  var EditorActions = import_styled_components12.default.div.withConfig({
8412
- componentId: "sc-a6ff7adc-0"
8414
+ componentId: "sc-ecbebe61-0"
8413
8415
  })([
8414
8416
  `display:flex;flex-wrap:wrap;gap:8px;margin-top:16px;`
8415
8417
  ]);
8416
8418
  var EditGroup = import_styled_components12.default.div.withConfig({
8417
- componentId: "sc-a6ff7adc-1"
8419
+ componentId: "sc-ecbebe61-1"
8418
8420
  })([
8419
8421
  `display:flex;flex-direction:column;gap:6px;`
8420
8422
  ]);
8421
8423
  var HeaderGroup = (0, import_styled_components12.default)(EditGroup).withConfig({
8422
- componentId: "sc-a6ff7adc-2"
8424
+ componentId: "sc-ecbebe61-2"
8423
8425
  })([
8424
8426
  `gap:8px;`
8425
8427
  ]);
8426
8428
  var HeaderTitle = import_styled_components12.default.div.withConfig({
8427
- componentId: "sc-a6ff7adc-3"
8429
+ componentId: "sc-ecbebe61-3"
8428
8430
  })([
8429
8431
  `display:flex;align-items:flex-start;min-height:var(--fees-header-title-height,36px);`
8430
8432
  ]);
8431
8433
  var HeaderActions = import_styled_components12.default.div.withConfig({
8432
- componentId: "sc-a6ff7adc-4"
8434
+ componentId: "sc-ecbebe61-4"
8433
8435
  })([
8434
8436
  `display:flex;align-items:center;min-height:24px;`
8435
8437
  ]);
8436
8438
  var AlignedFeesTable = (0, import_styled_components12.default)(FeesAndMarginTable).withConfig({
8437
- componentId: "sc-a6ff7adc-5"
8439
+ componentId: "sc-ecbebe61-5"
8440
+ })([
8441
+ `&[data-editable] th{vertical-align:top;}--fees-row-background:`,
8442
+ `;--fees-stripe-background:`,
8443
+ `;--fees-text:`,
8444
+ `;:root[data-theme="dark"] &{--fees-row-background:#39393d;--fees-stripe-background:`,
8445
+ `;--fees-text:`,
8446
+ `;}&[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:`,
8447
+ `;}thead > tr > th{height:52px;padding:11.5px 8px;color:`,
8448
+ `;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:`,
8449
+ `px;table-layout:fixed;}`,
8450
+ ` 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:`,
8451
+ `;}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);}}}`
8452
+ ], ({ 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) => `
8453
+ th:nth-child(${index + 1}), td:nth-child(${index + 1}) {
8454
+ width: ${width}px;
8455
+ min-width: ${width}px;
8456
+ max-width: ${width}px;
8457
+ }
8458
+ `).join(""), ({ theme }) => theme.colors.accent.primary);
8459
+ var FeesCellContent = import_styled_components12.default.span.withConfig({
8460
+ componentId: "sc-ecbebe61-6"
8438
8461
  })([
8439
- `&[data-editable] th{vertical-align:top;}`
8440
- ]);
8462
+ `display:block;text-align:`,
8463
+ `;`
8464
+ ], ({ $alignRight }) => $alignRight ? "right" : "left");
8441
8465
  var EditorButton = import_styled_components12.default.button.withConfig({
8442
- componentId: "sc-a6ff7adc-6"
8466
+ componentId: "sc-ecbebe61-7"
8443
8467
  })([
8444
8468
  `padding:7px 12px;border:1px solid `,
8445
8469
  `;border-radius:6px;background:`,
@@ -8448,17 +8472,17 @@ var EditorButton = import_styled_components12.default.button.withConfig({
8448
8472
  `;}&:disabled{cursor:default;opacity:.4;}`
8449
8473
  ], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
8450
8474
  var OrderActions = import_styled_components12.default.div.withConfig({
8451
- componentId: "sc-a6ff7adc-7"
8475
+ componentId: "sc-ecbebe61-8"
8452
8476
  })([
8453
8477
  `display:flex;gap:6px;align-items:center;flex-wrap:wrap;`
8454
8478
  ]);
8455
8479
  var PositionLabel = import_styled_components12.default.label.withConfig({
8456
- componentId: "sc-a6ff7adc-8"
8480
+ componentId: "sc-ecbebe61-9"
8457
8481
  })([
8458
8482
  `display:inline-flex;align-items:center;gap:6px;font-size:12px;`
8459
8483
  ]);
8460
8484
  var PositionInput = import_styled_components12.default.input.withConfig({
8461
- componentId: "sc-a6ff7adc-9"
8485
+ componentId: "sc-ecbebe61-10"
8462
8486
  })([
8463
8487
  `width:56px;padding:5px;border:1px solid `,
8464
8488
  `;border-radius:4px;background:`,
@@ -8467,17 +8491,17 @@ var PositionInput = import_styled_components12.default.input.withConfig({
8467
8491
  `;}`
8468
8492
  ], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
8469
8493
  var ColumnRow = import_styled_components12.default.div.withConfig({
8470
- componentId: "sc-a6ff7adc-10"
8494
+ componentId: "sc-ecbebe61-11"
8471
8495
  })([
8472
8496
  `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;}`
8473
8497
  ]);
8474
8498
  var PaginationControls = (0, import_styled_components12.default)(FeesAndMarginPagination).withConfig({
8475
- componentId: "sc-a6ff7adc-11"
8499
+ componentId: "sc-ecbebe61-12"
8476
8500
  })([
8477
8501
  `align-items:center;flex-wrap:wrap;gap:16px 24px;`
8478
8502
  ]);
8479
8503
  var PageSizeLabel = import_styled_components12.default.div.withConfig({
8480
- componentId: "sc-a6ff7adc-12"
8504
+ componentId: "sc-ecbebe61-13"
8481
8505
  })([
8482
8506
  `display:inline-flex;align-items:center;gap:8px;color:`,
8483
8507
  `;font:inherit;font-size:13px;`
@@ -8505,12 +8529,12 @@ function Position({ value: value4, max, label, onMove }) {
8505
8529
  });
8506
8530
  }
8507
8531
  var DeleteButton = (0, import_styled_components12.default)(EditorButton).withConfig({
8508
- componentId: "sc-a6ff7adc-13"
8532
+ componentId: "sc-ecbebe61-14"
8509
8533
  })([
8510
8534
  `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;}`
8511
8535
  ]);
8512
8536
  var CellEditorInput = import_styled_components12.default.textarea.withConfig({
8513
- componentId: "sc-a6ff7adc-14"
8537
+ componentId: "sc-ecbebe61-15"
8514
8538
  })([
8515
8539
  `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:`,
8516
8540
  `;}&:focus{outline:1px solid `,
@@ -8623,6 +8647,31 @@ var columnWidths = {
8623
8647
  tradingHours: 160,
8624
8648
  priceRange: 112
8625
8649
  };
8650
+ var mobileColumnWidths = {
8651
+ name: 88,
8652
+ code: 60,
8653
+ exchange: 60,
8654
+ initialMargin: 90,
8655
+ tradingFee: 64,
8656
+ tickSize: 54,
8657
+ margin: 70,
8658
+ priceUnit: 88,
8659
+ contractSize: 110,
8660
+ settlement: 92,
8661
+ deliveryDay: 90,
8662
+ tradingHours: 120,
8663
+ priceRange: 70
8664
+ };
8665
+ var rightAlignedColumns = /* @__PURE__ */ new Set([
8666
+ "initialMargin",
8667
+ "tradingFee",
8668
+ "tickSize",
8669
+ "margin",
8670
+ "settlement",
8671
+ "priceRange",
8672
+ "priceUnit",
8673
+ "unit"
8674
+ ]);
8626
8675
  function FeesTable({ value: value4, editable = false, onChange, labels, size = "md", tagOrder = [], language = "vi" }) {
8627
8676
  const [search, setSearch] = (0, import_react18.useState)("");
8628
8677
  const [tag, setTag] = (0, import_react18.useState)("");
@@ -8743,7 +8792,7 @@ function FeesTable({ value: value4, editable = false, onChange, labels, size = "
8743
8792
  });
8744
8793
  const columns = value4.columns.map((column, index) => ({
8745
8794
  key: column.key,
8746
- width: columnWidths[column.key] ?? 140,
8795
+ width: canEdit ? columnWidths[column.key] ?? 140 : index === 0 ? 178 : 170,
8747
8796
  fixed: index === 0 ? "left" : void 0,
8748
8797
  title: canEdit ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(HeaderGroup, {
8749
8798
  children: [
@@ -8775,7 +8824,10 @@ function FeesTable({ value: value4, editable = false, onChange, labels, size = "
8775
8824
  })
8776
8825
  })
8777
8826
  ]
8778
- }) : column.title,
8827
+ }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FeesCellContent, {
8828
+ $alignRight: rightAlignedColumns.has(column.key),
8829
+ children: column.title
8830
+ }),
8779
8831
  render: (_unused, row) => canEdit ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CellEditor, {
8780
8832
  rows: Math.max(2, (row.cells[column.key] ?? "").split("\n").length),
8781
8833
  value: row.cells[column.key] ?? "",
@@ -8786,7 +8838,10 @@ function FeesTable({ value: value4, editable = false, onChange, labels, size = "
8786
8838
  [column.key]: event.target.value
8787
8839
  }
8788
8840
  })
8789
- }) : row.cells[column.key] ?? ""
8841
+ }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FeesCellContent, {
8842
+ $alignRight: rightAlignedColumns.has(column.key),
8843
+ children: row.cells[column.key] ?? ""
8844
+ })
8790
8845
  }));
8791
8846
  if (canEdit) columns.push({
8792
8847
  key: "__tags",
@@ -8950,6 +9005,7 @@ function FeesTable({ value: value4, editable = false, onChange, labels, size = "
8950
9005
  ]
8951
9006
  }),
8952
9007
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AlignedFeesTable, {
9008
+ $mobileColumnWidths: columns.map((column) => mobileColumnWidths[column.key] ?? 88),
8953
9009
  "data-editable": canEdit || void 0,
8954
9010
  children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Table, {
8955
9011
  ariaLabel: english ? "Fees and margin table" : "B\u1EA3ng ph\xED v\xE0 k\xFD qu\u1EF9",
@@ -8959,7 +9015,7 @@ function FeesTable({ value: value4, editable = false, onChange, labels, size = "
8959
9015
  size,
8960
9016
  empty: labels?.empty ?? "Kh\xF4ng t\xECm th\u1EA5y h\xE0ng h\xF3a",
8961
9017
  scroll: {
8962
- x: Math.max(1440, value4.columns.reduce((sum, column) => sum + (columnWidths[column.key] ?? 140), 0) + (canEdit ? 300 : 0))
9018
+ x: canEdit ? Math.max(1440, value4.columns.reduce((sum, column) => sum + (columnWidths[column.key] ?? 140), 0) + 300) : value4.columns.length * 170 + 8
8963
9019
  }
8964
9020
  })
8965
9021
  }),