@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.mjs CHANGED
@@ -755,37 +755,59 @@ var feesTheme = {
755
755
  ]))
756
756
  };
757
757
  var EditorActions = styled6.div.withConfig({
758
- componentId: "sc-a6ff7adc-0"
758
+ componentId: "sc-ecbebe61-0"
759
759
  })([
760
760
  `display:flex;flex-wrap:wrap;gap:8px;margin-top:16px;`
761
761
  ]);
762
762
  var EditGroup = styled6.div.withConfig({
763
- componentId: "sc-a6ff7adc-1"
763
+ componentId: "sc-ecbebe61-1"
764
764
  })([
765
765
  `display:flex;flex-direction:column;gap:6px;`
766
766
  ]);
767
767
  var HeaderGroup = styled6(EditGroup).withConfig({
768
- componentId: "sc-a6ff7adc-2"
768
+ componentId: "sc-ecbebe61-2"
769
769
  })([
770
770
  `gap:8px;`
771
771
  ]);
772
772
  var HeaderTitle = styled6.div.withConfig({
773
- componentId: "sc-a6ff7adc-3"
773
+ componentId: "sc-ecbebe61-3"
774
774
  })([
775
775
  `display:flex;align-items:flex-start;min-height:var(--fees-header-title-height,36px);`
776
776
  ]);
777
777
  var HeaderActions = styled6.div.withConfig({
778
- componentId: "sc-a6ff7adc-4"
778
+ componentId: "sc-ecbebe61-4"
779
779
  })([
780
780
  `display:flex;align-items:center;min-height:24px;`
781
781
  ]);
782
782
  var AlignedFeesTable = styled6(FeesAndMarginTable).withConfig({
783
- componentId: "sc-a6ff7adc-5"
783
+ componentId: "sc-ecbebe61-5"
784
784
  })([
785
- `&[data-editable] th{vertical-align:top;}`
786
- ]);
785
+ `&[data-editable] th{vertical-align:top;}--fees-row-background:`,
786
+ `;--fees-stripe-background:`,
787
+ `;--fees-text:`,
788
+ `;:root[data-theme="dark"] &{--fees-row-background:#39393d;--fees-stripe-background:`,
789
+ `;--fees-text:`,
790
+ `;}&[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:`,
791
+ `;}thead > tr > th{height:52px;padding:11.5px 8px;color:`,
792
+ `;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:`,
793
+ `px;table-layout:fixed;}`,
794
+ ` 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:`,
795
+ `;}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);}}}`
796
+ ], ({ 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) => `
797
+ th:nth-child(${index + 1}), td:nth-child(${index + 1}) {
798
+ width: ${width}px;
799
+ min-width: ${width}px;
800
+ max-width: ${width}px;
801
+ }
802
+ `).join(""), ({ theme }) => theme.colors.accent.primary);
803
+ var FeesCellContent = styled6.span.withConfig({
804
+ componentId: "sc-ecbebe61-6"
805
+ })([
806
+ `display:block;text-align:`,
807
+ `;`
808
+ ], ({ $alignRight }) => $alignRight ? "right" : "left");
787
809
  var EditorButton = styled6.button.withConfig({
788
- componentId: "sc-a6ff7adc-6"
810
+ componentId: "sc-ecbebe61-7"
789
811
  })([
790
812
  `padding:7px 12px;border:1px solid `,
791
813
  `;border-radius:6px;background:`,
@@ -794,17 +816,17 @@ var EditorButton = styled6.button.withConfig({
794
816
  `;}&:disabled{cursor:default;opacity:.4;}`
795
817
  ], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
796
818
  var OrderActions = styled6.div.withConfig({
797
- componentId: "sc-a6ff7adc-7"
819
+ componentId: "sc-ecbebe61-8"
798
820
  })([
799
821
  `display:flex;gap:6px;align-items:center;flex-wrap:wrap;`
800
822
  ]);
801
823
  var PositionLabel = styled6.label.withConfig({
802
- componentId: "sc-a6ff7adc-8"
824
+ componentId: "sc-ecbebe61-9"
803
825
  })([
804
826
  `display:inline-flex;align-items:center;gap:6px;font-size:12px;`
805
827
  ]);
806
828
  var PositionInput = styled6.input.withConfig({
807
- componentId: "sc-a6ff7adc-9"
829
+ componentId: "sc-ecbebe61-10"
808
830
  })([
809
831
  `width:56px;padding:5px;border:1px solid `,
810
832
  `;border-radius:4px;background:`,
@@ -813,17 +835,17 @@ var PositionInput = styled6.input.withConfig({
813
835
  `;}`
814
836
  ], ({ theme }) => theme.colors.border.line, ({ theme }) => theme.colors.background.input, ({ theme }) => theme.colors.text.primary, ({ theme }) => theme.colors.accent.primary);
815
837
  var ColumnRow = styled6.div.withConfig({
816
- componentId: "sc-a6ff7adc-10"
838
+ componentId: "sc-ecbebe61-11"
817
839
  })([
818
840
  `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;}`
819
841
  ]);
820
842
  var PaginationControls = styled6(FeesAndMarginPagination).withConfig({
821
- componentId: "sc-a6ff7adc-11"
843
+ componentId: "sc-ecbebe61-12"
822
844
  })([
823
845
  `align-items:center;flex-wrap:wrap;gap:16px 24px;`
824
846
  ]);
825
847
  var PageSizeLabel = styled6.div.withConfig({
826
- componentId: "sc-a6ff7adc-12"
848
+ componentId: "sc-ecbebe61-13"
827
849
  })([
828
850
  `display:inline-flex;align-items:center;gap:8px;color:`,
829
851
  `;font:inherit;font-size:13px;`
@@ -851,12 +873,12 @@ function Position({ value, max, label, onMove }) {
851
873
  });
852
874
  }
853
875
  var DeleteButton = styled6(EditorButton).withConfig({
854
- componentId: "sc-a6ff7adc-13"
876
+ componentId: "sc-ecbebe61-14"
855
877
  })([
856
878
  `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;}`
857
879
  ]);
858
880
  var CellEditorInput = styled6.textarea.withConfig({
859
- componentId: "sc-a6ff7adc-14"
881
+ componentId: "sc-ecbebe61-15"
860
882
  })([
861
883
  `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:`,
862
884
  `;}&:focus{outline:1px solid `,
@@ -969,6 +991,31 @@ var columnWidths = {
969
991
  tradingHours: 160,
970
992
  priceRange: 112
971
993
  };
994
+ var mobileColumnWidths = {
995
+ name: 88,
996
+ code: 60,
997
+ exchange: 60,
998
+ initialMargin: 90,
999
+ tradingFee: 64,
1000
+ tickSize: 54,
1001
+ margin: 70,
1002
+ priceUnit: 88,
1003
+ contractSize: 110,
1004
+ settlement: 92,
1005
+ deliveryDay: 90,
1006
+ tradingHours: 120,
1007
+ priceRange: 70
1008
+ };
1009
+ var rightAlignedColumns = /* @__PURE__ */ new Set([
1010
+ "initialMargin",
1011
+ "tradingFee",
1012
+ "tickSize",
1013
+ "margin",
1014
+ "settlement",
1015
+ "priceRange",
1016
+ "priceUnit",
1017
+ "unit"
1018
+ ]);
972
1019
  function FeesTable({ value, editable = false, onChange, labels, size = "md", tagOrder = [], language = "vi" }) {
973
1020
  const [search, setSearch] = useState("");
974
1021
  const [tag, setTag] = useState("");
@@ -1089,7 +1136,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
1089
1136
  });
1090
1137
  const columns = value.columns.map((column, index) => ({
1091
1138
  key: column.key,
1092
- width: columnWidths[column.key] ?? 140,
1139
+ width: canEdit ? columnWidths[column.key] ?? 140 : index === 0 ? 178 : 170,
1093
1140
  fixed: index === 0 ? "left" : void 0,
1094
1141
  title: canEdit ? /* @__PURE__ */ _jsxs(HeaderGroup, {
1095
1142
  children: [
@@ -1121,7 +1168,10 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
1121
1168
  })
1122
1169
  })
1123
1170
  ]
1124
- }) : column.title,
1171
+ }) : /* @__PURE__ */ _jsx(FeesCellContent, {
1172
+ $alignRight: rightAlignedColumns.has(column.key),
1173
+ children: column.title
1174
+ }),
1125
1175
  render: (_unused, row) => canEdit ? /* @__PURE__ */ _jsx(CellEditor, {
1126
1176
  rows: Math.max(2, (row.cells[column.key] ?? "").split("\n").length),
1127
1177
  value: row.cells[column.key] ?? "",
@@ -1132,7 +1182,10 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
1132
1182
  [column.key]: event.target.value
1133
1183
  }
1134
1184
  })
1135
- }) : row.cells[column.key] ?? ""
1185
+ }) : /* @__PURE__ */ _jsx(FeesCellContent, {
1186
+ $alignRight: rightAlignedColumns.has(column.key),
1187
+ children: row.cells[column.key] ?? ""
1188
+ })
1136
1189
  }));
1137
1190
  if (canEdit) columns.push({
1138
1191
  key: "__tags",
@@ -1296,6 +1349,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
1296
1349
  ]
1297
1350
  }),
1298
1351
  /* @__PURE__ */ _jsx(AlignedFeesTable, {
1352
+ $mobileColumnWidths: columns.map((column) => mobileColumnWidths[column.key] ?? 88),
1299
1353
  "data-editable": canEdit || void 0,
1300
1354
  children: /* @__PURE__ */ _jsx(Table, {
1301
1355
  ariaLabel: english ? "Fees and margin table" : "B\u1EA3ng ph\xED v\xE0 k\xFD qu\u1EF9",
@@ -1305,7 +1359,7 @@ function FeesTable({ value, editable = false, onChange, labels, size = "md", tag
1305
1359
  size,
1306
1360
  empty: labels?.empty ?? "Kh\xF4ng t\xECm th\u1EA5y h\xE0ng h\xF3a",
1307
1361
  scroll: {
1308
- x: Math.max(1440, value.columns.reduce((sum, column) => sum + (columnWidths[column.key] ?? 140), 0) + (canEdit ? 300 : 0))
1362
+ x: canEdit ? Math.max(1440, value.columns.reduce((sum, column) => sum + (columnWidths[column.key] ?? 140), 0) + 300) : value.columns.length * 170 + 8
1309
1363
  }
1310
1364
  })
1311
1365
  }),