@enyxs/wikex-components 0.11.24 → 0.11.25

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/fees.js CHANGED
@@ -791,37 +791,59 @@ var feesTheme = {
791
791
  ]))
792
792
  };
793
793
  var EditorActions = import_styled_components6.default.div.withConfig({
794
- componentId: "sc-a6ff7adc-0"
794
+ componentId: "sc-ecbebe61-0"
795
795
  })([
796
796
  `display:flex;flex-wrap:wrap;gap:8px;margin-top:16px;`
797
797
  ]);
798
798
  var EditGroup = import_styled_components6.default.div.withConfig({
799
- componentId: "sc-a6ff7adc-1"
799
+ componentId: "sc-ecbebe61-1"
800
800
  })([
801
801
  `display:flex;flex-direction:column;gap:6px;`
802
802
  ]);
803
803
  var HeaderGroup = (0, import_styled_components6.default)(EditGroup).withConfig({
804
- componentId: "sc-a6ff7adc-2"
804
+ componentId: "sc-ecbebe61-2"
805
805
  })([
806
806
  `gap:8px;`
807
807
  ]);
808
808
  var HeaderTitle = import_styled_components6.default.div.withConfig({
809
- componentId: "sc-a6ff7adc-3"
809
+ componentId: "sc-ecbebe61-3"
810
810
  })([
811
811
  `display:flex;align-items:flex-start;min-height:var(--fees-header-title-height,36px);`
812
812
  ]);
813
813
  var HeaderActions = import_styled_components6.default.div.withConfig({
814
- componentId: "sc-a6ff7adc-4"
814
+ componentId: "sc-ecbebe61-4"
815
815
  })([
816
816
  `display:flex;align-items:center;min-height:24px;`
817
817
  ]);
818
818
  var AlignedFeesTable = (0, import_styled_components6.default)(FeesAndMarginTable).withConfig({
819
- componentId: "sc-a6ff7adc-5"
819
+ componentId: "sc-ecbebe61-5"
820
820
  })([
821
- `&[data-editable] th{vertical-align:top;}`
822
- ]);
821
+ `&[data-editable] th{vertical-align:top;}--fees-row-background:`,
822
+ `;--fees-stripe-background:`,
823
+ `;--fees-text:`,
824
+ `;:root[data-theme="dark"] &{--fees-row-background:#39393d;--fees-stripe-background:`,
825
+ `;--fees-text:`,
826
+ `;}&[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:`,
827
+ `;}thead > tr > th{height:52px;padding:11.5px 8px;color:`,
828
+ `;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:`,
829
+ `px;table-layout:fixed;}`,
830
+ ` 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:`,
831
+ `;}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);}}}`
832
+ ], ({ 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) => `
833
+ th:nth-child(${index + 1}), td:nth-child(${index + 1}) {
834
+ width: ${width}px;
835
+ min-width: ${width}px;
836
+ max-width: ${width}px;
837
+ }
838
+ `).join(""), ({ theme }) => theme.colors.accent.primary);
839
+ var FeesCellContent = import_styled_components6.default.span.withConfig({
840
+ componentId: "sc-ecbebe61-6"
841
+ })([
842
+ `display:block;text-align:`,
843
+ `;`
844
+ ], ({ $alignRight }) => $alignRight ? "right" : "left");
823
845
  var EditorButton = import_styled_components6.default.button.withConfig({
824
- componentId: "sc-a6ff7adc-6"
846
+ componentId: "sc-ecbebe61-7"
825
847
  })([
826
848
  `padding:7px 12px;border:1px solid `,
827
849
  `;border-radius:6px;background:`,
@@ -830,17 +852,17 @@ var EditorButton = import_styled_components6.default.button.withConfig({
830
852
  `;}&:disabled{cursor:default;opacity:.4;}`
831
853
  ], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
832
854
  var OrderActions = import_styled_components6.default.div.withConfig({
833
- componentId: "sc-a6ff7adc-7"
855
+ componentId: "sc-ecbebe61-8"
834
856
  })([
835
857
  `display:flex;gap:6px;align-items:center;flex-wrap:wrap;`
836
858
  ]);
837
859
  var PositionLabel = import_styled_components6.default.label.withConfig({
838
- componentId: "sc-a6ff7adc-8"
860
+ componentId: "sc-ecbebe61-9"
839
861
  })([
840
862
  `display:inline-flex;align-items:center;gap:6px;font-size:12px;`
841
863
  ]);
842
864
  var PositionInput = import_styled_components6.default.input.withConfig({
843
- componentId: "sc-a6ff7adc-9"
865
+ componentId: "sc-ecbebe61-10"
844
866
  })([
845
867
  `width:56px;padding:5px;border:1px solid `,
846
868
  `;border-radius:4px;background:`,
@@ -849,17 +871,17 @@ var PositionInput = import_styled_components6.default.input.withConfig({
849
871
  `;}`
850
872
  ], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
851
873
  var ColumnRow = import_styled_components6.default.div.withConfig({
852
- componentId: "sc-a6ff7adc-10"
874
+ componentId: "sc-ecbebe61-11"
853
875
  })([
854
876
  `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;}`
855
877
  ]);
856
878
  var PaginationControls = (0, import_styled_components6.default)(FeesAndMarginPagination).withConfig({
857
- componentId: "sc-a6ff7adc-11"
879
+ componentId: "sc-ecbebe61-12"
858
880
  })([
859
881
  `align-items:center;flex-wrap:wrap;gap:16px 24px;`
860
882
  ]);
861
883
  var PageSizeLabel = import_styled_components6.default.div.withConfig({
862
- componentId: "sc-a6ff7adc-12"
884
+ componentId: "sc-ecbebe61-13"
863
885
  })([
864
886
  `display:inline-flex;align-items:center;gap:8px;color:`,
865
887
  `;font:inherit;font-size:13px;`
@@ -887,12 +909,12 @@ function Position({ value, max, label, onMove }) {
887
909
  });
888
910
  }
889
911
  var DeleteButton = (0, import_styled_components6.default)(EditorButton).withConfig({
890
- componentId: "sc-a6ff7adc-13"
912
+ componentId: "sc-ecbebe61-14"
891
913
  })([
892
914
  `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;}`
893
915
  ]);
894
916
  var CellEditorInput = import_styled_components6.default.textarea.withConfig({
895
- componentId: "sc-a6ff7adc-14"
917
+ componentId: "sc-ecbebe61-15"
896
918
  })([
897
919
  `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:`,
898
920
  `;}&:focus{outline:1px solid `,
@@ -1005,6 +1027,31 @@ var columnWidths = {
1005
1027
  tradingHours: 160,
1006
1028
  priceRange: 112
1007
1029
  };
1030
+ var mobileColumnWidths = {
1031
+ name: 88,
1032
+ code: 60,
1033
+ exchange: 60,
1034
+ initialMargin: 90,
1035
+ tradingFee: 64,
1036
+ tickSize: 54,
1037
+ margin: 70,
1038
+ priceUnit: 88,
1039
+ contractSize: 110,
1040
+ settlement: 92,
1041
+ deliveryDay: 90,
1042
+ tradingHours: 120,
1043
+ priceRange: 70
1044
+ };
1045
+ var rightAlignedColumns = /* @__PURE__ */ new Set([
1046
+ "initialMargin",
1047
+ "tradingFee",
1048
+ "tickSize",
1049
+ "margin",
1050
+ "settlement",
1051
+ "priceRange",
1052
+ "priceUnit",
1053
+ "unit"
1054
+ ]);
1008
1055
  function FeesTable({ value, editable = false, onChange, labels, size = "md", tagOrder = [], language = "vi" }) {
1009
1056
  const [search, setSearch] = (0, import_react2.useState)("");
1010
1057
  const [tag, setTag] = (0, import_react2.useState)("");
@@ -1125,7 +1172,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
1125
1172
  });
1126
1173
  const columns = value.columns.map((column, index) => ({
1127
1174
  key: column.key,
1128
- width: columnWidths[column.key] ?? 140,
1175
+ width: canEdit ? columnWidths[column.key] ?? 140 : index === 0 ? 178 : 170,
1129
1176
  fixed: index === 0 ? "left" : void 0,
1130
1177
  title: canEdit ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(HeaderGroup, {
1131
1178
  children: [
@@ -1157,7 +1204,10 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
1157
1204
  })
1158
1205
  })
1159
1206
  ]
1160
- }) : column.title,
1207
+ }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FeesCellContent, {
1208
+ $alignRight: rightAlignedColumns.has(column.key),
1209
+ children: column.title
1210
+ }),
1161
1211
  render: (_unused, row) => canEdit ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CellEditor, {
1162
1212
  rows: Math.max(2, (row.cells[column.key] ?? "").split("\n").length),
1163
1213
  value: row.cells[column.key] ?? "",
@@ -1168,7 +1218,10 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
1168
1218
  [column.key]: event.target.value
1169
1219
  }
1170
1220
  })
1171
- }) : row.cells[column.key] ?? ""
1221
+ }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FeesCellContent, {
1222
+ $alignRight: rightAlignedColumns.has(column.key),
1223
+ children: row.cells[column.key] ?? ""
1224
+ })
1172
1225
  }));
1173
1226
  if (canEdit) columns.push({
1174
1227
  key: "__tags",
@@ -1332,6 +1385,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
1332
1385
  ]
1333
1386
  }),
1334
1387
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AlignedFeesTable, {
1388
+ $mobileColumnWidths: columns.map((column) => mobileColumnWidths[column.key] ?? 88),
1335
1389
  "data-editable": canEdit || void 0,
1336
1390
  children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Table, {
1337
1391
  ariaLabel: english ? "Fees and margin table" : "B\u1EA3ng ph\xED v\xE0 k\xFD qu\u1EF9",
@@ -1341,7 +1395,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
1341
1395
  size,
1342
1396
  empty: labels?.empty ?? "Kh\xF4ng t\xECm th\u1EA5y h\xE0ng h\xF3a",
1343
1397
  scroll: {
1344
- x: Math.max(1440, value.columns.reduce((sum, column) => sum + (columnWidths[column.key] ?? 140), 0) + (canEdit ? 300 : 0))
1398
+ x: canEdit ? Math.max(1440, value.columns.reduce((sum, column) => sum + (columnWidths[column.key] ?? 140), 0) + 300) : value.columns.length * 170 + 8
1345
1399
  }
1346
1400
  })
1347
1401
  }),