@enyxs/wikex-components 0.11.23 → 0.11.24

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
@@ -77,6 +77,10 @@ type CmsTextToolbarProps = {
77
77
  declare function CmsTextToolbar({ layout, color, colorPicker, inlineControls, structureControls, computedFontSize, computedLineHeight, computedFontFamily, computedTextAlign, onLayoutChange, onColorChange, onReset }: CmsTextToolbarProps): react.JSX.Element;
78
78
 
79
79
  declare const CMS_ELEMENTS_FIELD = "__cmsElements";
80
+ declare const CMS_LIST_MARKERS: readonly ["disc", "circle", "square", "decimal", "lower-alpha", "lower-roman", "accent-triangle", "accent-disc", "accent-circle", "accent-square", "accent-decimal"];
81
+ type CmsListMarker = typeof CMS_LIST_MARKERS[number];
82
+ declare function cmsListMarkerType(marker: string): "ul" | "ol";
83
+ declare function cmsListAnchor(listId: string): string;
80
84
  type CmsElementState = {
81
85
  hidden: string[];
82
86
  insertions: Array<{
@@ -111,4 +115,4 @@ declare const wikexCmsBlocks: {
111
115
  definition: CmsComponentDefinition;
112
116
  }[];
113
117
 
114
- export { CMS_ELEMENTS_FIELD, CMS_TEXT_FONTS, CMS_TEXT_LAYOUT_SUFFIX, CmsBlock, CmsComponentDefinition, type CmsElementState, CmsRendererProps, type CmsRichText, type CmsTextLayout, type CmsTextMark, CmsTextTarget, CmsTextToolbar, type CmsTextToolbarProps, applyCmsTextLayout, cmsTextLayoutStyle, minimalMarketingBlocks, minimalUiBlocks, minimalUiComponents, parseCmsElements, parseCmsRichText, parseCmsTextLayout, patchCmsRichText, readCmsEditableText, rebaseCmsRichText, rebaseCmsTextLayouts, renderCmsRichText, safeCmsTextHref, siteChromeBlocks, wikexCmsBlocks, wikexCommodityBlocks, wikexComponents };
118
+ export { CMS_ELEMENTS_FIELD, CMS_LIST_MARKERS, CMS_TEXT_FONTS, CMS_TEXT_LAYOUT_SUFFIX, CmsBlock, CmsComponentDefinition, type CmsElementState, type CmsListMarker, CmsRendererProps, type CmsRichText, type CmsTextLayout, type CmsTextMark, CmsTextTarget, CmsTextToolbar, type CmsTextToolbarProps, applyCmsTextLayout, cmsListAnchor, cmsListMarkerType, cmsTextLayoutStyle, minimalMarketingBlocks, minimalUiBlocks, minimalUiComponents, parseCmsElements, parseCmsRichText, parseCmsTextLayout, patchCmsRichText, readCmsEditableText, rebaseCmsRichText, rebaseCmsTextLayouts, renderCmsRichText, safeCmsTextHref, siteChromeBlocks, wikexCmsBlocks, wikexCommodityBlocks, wikexComponents };
package/dist/index.d.ts CHANGED
@@ -77,6 +77,10 @@ type CmsTextToolbarProps = {
77
77
  declare function CmsTextToolbar({ layout, color, colorPicker, inlineControls, structureControls, computedFontSize, computedLineHeight, computedFontFamily, computedTextAlign, onLayoutChange, onColorChange, onReset }: CmsTextToolbarProps): react.JSX.Element;
78
78
 
79
79
  declare const CMS_ELEMENTS_FIELD = "__cmsElements";
80
+ declare const CMS_LIST_MARKERS: readonly ["disc", "circle", "square", "decimal", "lower-alpha", "lower-roman", "accent-triangle", "accent-disc", "accent-circle", "accent-square", "accent-decimal"];
81
+ type CmsListMarker = typeof CMS_LIST_MARKERS[number];
82
+ declare function cmsListMarkerType(marker: string): "ul" | "ol";
83
+ declare function cmsListAnchor(listId: string): string;
80
84
  type CmsElementState = {
81
85
  hidden: string[];
82
86
  insertions: Array<{
@@ -111,4 +115,4 @@ declare const wikexCmsBlocks: {
111
115
  definition: CmsComponentDefinition;
112
116
  }[];
113
117
 
114
- export { CMS_ELEMENTS_FIELD, CMS_TEXT_FONTS, CMS_TEXT_LAYOUT_SUFFIX, CmsBlock, CmsComponentDefinition, type CmsElementState, CmsRendererProps, type CmsRichText, type CmsTextLayout, type CmsTextMark, CmsTextTarget, CmsTextToolbar, type CmsTextToolbarProps, applyCmsTextLayout, cmsTextLayoutStyle, minimalMarketingBlocks, minimalUiBlocks, minimalUiComponents, parseCmsElements, parseCmsRichText, parseCmsTextLayout, patchCmsRichText, readCmsEditableText, rebaseCmsRichText, rebaseCmsTextLayouts, renderCmsRichText, safeCmsTextHref, siteChromeBlocks, wikexCmsBlocks, wikexCommodityBlocks, wikexComponents };
118
+ export { CMS_ELEMENTS_FIELD, CMS_LIST_MARKERS, CMS_TEXT_FONTS, CMS_TEXT_LAYOUT_SUFFIX, CmsBlock, CmsComponentDefinition, type CmsElementState, type CmsListMarker, CmsRendererProps, type CmsRichText, type CmsTextLayout, type CmsTextMark, CmsTextTarget, CmsTextToolbar, type CmsTextToolbarProps, applyCmsTextLayout, cmsListAnchor, cmsListMarkerType, cmsTextLayoutStyle, minimalMarketingBlocks, minimalUiBlocks, minimalUiComponents, parseCmsElements, parseCmsRichText, parseCmsTextLayout, patchCmsRichText, readCmsEditableText, rebaseCmsRichText, rebaseCmsTextLayouts, renderCmsRichText, safeCmsTextHref, siteChromeBlocks, wikexCmsBlocks, wikexCommodityBlocks, wikexComponents };
package/dist/index.js CHANGED
@@ -31,11 +31,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
33
  CMS_ELEMENTS_FIELD: () => CMS_ELEMENTS_FIELD,
34
+ CMS_LIST_MARKERS: () => CMS_LIST_MARKERS,
34
35
  CMS_TEXT_FONTS: () => CMS_TEXT_FONTS,
35
36
  CMS_TEXT_LAYOUT_SUFFIX: () => CMS_TEXT_LAYOUT_SUFFIX,
36
37
  CmsTextToolbar: () => CmsTextToolbar,
37
38
  FeesTable: () => FeesTable,
38
39
  applyCmsTextLayout: () => applyCmsTextLayout,
40
+ cmsListAnchor: () => cmsListAnchor,
41
+ cmsListMarkerType: () => cmsListMarkerType,
39
42
  cmsTextLayoutStyle: () => cmsTextLayoutStyle,
40
43
  migrateWikexChromeContent: () => migrateWikexChromeContent,
41
44
  minimalMarketingBlocks: () => minimalMarketingBlocks,
@@ -159,6 +162,32 @@ var InlineLink = import_styled_components.default.span.withConfig({
159
162
  // src/shared/elements.tsx
160
163
  var CMS_EMPTY_IMAGE = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1' height='1'/%3E";
161
164
  var CMS_ELEMENTS_FIELD = "__cmsElements";
165
+ var CMS_LIST_MARKERS = [
166
+ "disc",
167
+ "circle",
168
+ "square",
169
+ "decimal",
170
+ "lower-alpha",
171
+ "lower-roman",
172
+ "accent-triangle",
173
+ "accent-disc",
174
+ "accent-circle",
175
+ "accent-square",
176
+ "accent-decimal"
177
+ ];
178
+ function cmsListMarkerType(marker) {
179
+ return [
180
+ "decimal",
181
+ "lower-alpha",
182
+ "lower-roman",
183
+ "accent-decimal"
184
+ ].includes(marker) ? "ol" : "ul";
185
+ }
186
+ function cmsListAnchor(listId) {
187
+ return listId.startsWith("text.") ? listId.slice(5) : `list:${listId}`;
188
+ }
189
+ var LIST_ACCENT = "#f9bb3a";
190
+ var ACCENT_TRIANGLE = `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='9' viewBox='0 0 8 9' fill='none'%3E%3Cpath d='M1.84745 0.186474L6.93777 3.33107C7.46843 3.66519 7.62566 4.27445 7.42912 4.78545C7.3505 4.98199 7.23258 5.15887 7.0557 5.29645C7.01639 5.3161 6.97708 5.35541 6.93777 5.37507L1.84745 8.51967C1.45438 8.75551 1.022 8.75551 0.668228 8.57863C0.275153 8.38209 -3.12842e-08 7.98901 -5.27615e-08 7.49767L-3.27671e-07 1.20847C-3.35403e-07 1.03158 0.0393072 0.874354 0.0982684 0.717124C0.373421 0.0882044 1.17922 -0.226255 1.84745 0.186474Z' fill='%23F9BB3A'/%3E%3C/svg%3E")`;
162
191
  function parseCmsElements(value4) {
163
192
  const result = {
164
193
  hidden: [],
@@ -215,14 +244,7 @@ function parseCmsElements(value4) {
215
244
  ...list.type === "ul" || list.type === "ol" ? {
216
245
  type: list.type
217
246
  } : {},
218
- ...typeof list.marker === "string" && [
219
- "disc",
220
- "circle",
221
- "square",
222
- "decimal",
223
- "lower-alpha",
224
- "lower-roman"
225
- ].includes(list.marker) ? {
247
+ ...typeof list.marker === "string" && CMS_LIST_MARKERS.includes(list.marker) ? {
226
248
  marker: list.marker
227
249
  } : {}
228
250
  };
@@ -293,18 +315,20 @@ function CmsTextList({ field, type, children }) {
293
315
  });
294
316
  }
295
317
  var NativeList = import_styled_components2.default.ul.withConfig({
296
- componentId: "sc-b8ec35a7-0"
318
+ componentId: "sc-28cc1baf-0"
297
319
  })([
298
- `> li{display:list-item !important;padding-left:0 !important;}> li::before{content:none !important;}`
299
- ]);
320
+ `> li{display:list-item !important;padding-left:0 !important;}> li::before{content:none !important;}&[data-cms-list-marker^="accent-"] > li::marker{color:`,
321
+ `;}&[data-cms-list-marker="accent-decimal"] > li::marker{font-weight:700;}&[data-cms-list-marker="accent-triangle"] > li{position:relative;padding-left:20px !important;}&[data-cms-list-marker="accent-triangle"] > li::before{position:absolute;top:0.5em;top:calc(0.5lh - 4.5px);left:0;width:8px;height:9px;background:`,
322
+ ` no-repeat;content:"" !important;}`
323
+ ], LIST_ACCENT, ACCENT_TRIANGLE);
300
324
  function CmsTemplateList({ cmsAs, cmsId, children }) {
301
325
  const context = (0, import_react.useContext)(ElementContext);
302
326
  const templates = import_react.Children.toArray(children).filter(import_react.isValidElement);
303
327
  const stored = context?.state.lists[cmsId];
304
328
  const order = stored?.order ?? templates.map((_, index) => String(index));
305
329
  const items = order.flatMap((id) => {
306
- const added = stored?.added[id];
307
- const template = templates[added?.template ?? Number(id)];
330
+ const added2 = stored?.added[id];
331
+ const template = templates[added2?.template ?? Number(id)];
308
332
  if (!template) return [];
309
333
  const attributes = {
310
334
  key: id,
@@ -316,7 +340,7 @@ function CmsTemplateList({ cmsAs, cmsId, children }) {
316
340
  }
317
341
  } : {}
318
342
  };
319
- if (!added) return [
343
+ if (!added2) return [
320
344
  /* @__PURE__ */ (0, import_react.cloneElement)(template, attributes)
321
345
  ];
322
346
  const text2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditableText, {
@@ -325,8 +349,8 @@ function CmsTemplateList({ cmsAs, cmsId, children }) {
325
349
  font: "inherit",
326
350
  display: "block"
327
351
  },
328
- field: added.field,
329
- value: context?.content[added.field] ?? "M\u1EE5c m\u1EDBi",
352
+ field: added2.field,
353
+ value: context?.content[added2.field] ?? "M\u1EE5c m\u1EDBi",
330
354
  editable: context?.editable,
331
355
  onChange: context?.onChange
332
356
  });
@@ -337,19 +361,30 @@ function CmsTemplateList({ cmsAs, cmsId, children }) {
337
361
  }, text2)
338
362
  ];
339
363
  });
340
- if (!items.length) return null;
341
- return /* @__PURE__ */ (0, import_react.createElement)(stored?.type || stored?.marker ? NativeList : cmsAs, {
342
- ...stored?.type || stored?.marker ? {
364
+ const added = cmsId.startsWith("text.") ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CmsAddedElements, {
365
+ field: cmsListAnchor(cmsId)
366
+ });
367
+ if (!items.length) return added;
368
+ const marker = stored?.marker;
369
+ const list = /* @__PURE__ */ (0, import_react.createElement)(stored?.type || marker ? NativeList : cmsAs, {
370
+ ...stored?.type || marker ? {
343
371
  as: cmsAs,
344
- forwardedAs: stored?.type ?? (stored?.marker === "decimal" || stored?.marker === "lower-alpha" || stored?.marker === "lower-roman" ? "ol" : "ul"),
372
+ forwardedAs: stored?.type ?? cmsListMarkerType(marker ?? ""),
373
+ "data-cms-list-marker": marker,
345
374
  style: {
346
- listStyleType: stored?.marker ?? (stored?.type === "ol" ? "decimal" : "disc")
375
+ listStyleType: marker === "accent-triangle" ? "none" : marker?.replace(/^accent-/, "") ?? (stored?.type === "ol" ? "decimal" : "disc")
347
376
  }
348
377
  } : {},
349
378
  "data-cms-list-id": cmsId,
350
379
  "data-cms-list-order": JSON.stringify(order),
351
380
  "data-cms-list-template-count": templates.length
352
381
  }, items);
382
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
383
+ children: [
384
+ list,
385
+ added
386
+ ]
387
+ });
353
388
  }
354
389
 
355
390
  // src/shared/text-block.tsx
@@ -664,6 +699,7 @@ function EditableImage({
664
699
  }) {
665
700
  const normalizedSrc = src.trim();
666
701
  const hidden = useCmsElementHidden(field);
702
+ if (hidden) return null;
667
703
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
668
704
  import_Box.default,
669
705
  {
@@ -675,7 +711,7 @@ function EditableImage({
675
711
  ...sx
676
712
  },
677
713
  children: [
678
- hidden ? null : normalizedSrc ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
714
+ normalizedSrc ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
679
715
  import_Box.default,
680
716
  {
681
717
  component: "img",
@@ -699,7 +735,7 @@ function EditableImage({
699
735
  children: "Ch\u01B0a c\xF3 \u1EA3nh"
700
736
  }
701
737
  ),
702
- editable && !hidden && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
738
+ editable && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
703
739
  import_Button.default,
704
740
  {
705
741
  "data-cms-image-field": field,
@@ -10741,7 +10777,7 @@ var benefits = [
10741
10777
  ];
10742
10778
  var positionSlides = [
10743
10779
  {
10744
- image: "",
10780
+ image: "/landing-assets/mxv-certificate-wikex.webp",
10745
10781
  imageWidth: 238,
10746
10782
  imageHeight: 340,
10747
10783
  mediaType: "image",
@@ -15006,7 +15042,7 @@ function PositionSection() {
15006
15042
  /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ExactText, { cmsAs: "p", children: t(`${key}.paragraphs.1`) })
15007
15043
  ] })
15008
15044
  ] }),
15009
- slide.image === "" ? null : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
15045
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
15010
15046
  PositionMedia,
15011
15047
  {
15012
15048
  slide,
@@ -15122,7 +15158,7 @@ function PositionSection() {
15122
15158
  )
15123
15159
  ] })
15124
15160
  ] }),
15125
- slide.image === "" ? null : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
15161
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
15126
15162
  PositionMedia,
15127
15163
  {
15128
15164
  slide,
@@ -16085,6 +16121,7 @@ var heroImages = [
16085
16121
  image("heroLabelTwoMobileImage", "Nh\xE3n minh h\u1ECDa 2 mobile", "/landing-assets/key_mock_2_mobile.webp")
16086
16122
  ];
16087
16123
  var positionImages = [
16124
+ image("positionSlide1Image", "\u1EA2nh slide 1", "/landing-assets/mxv-certificate-wikex.webp"),
16088
16125
  image("positionSlide2Image", "\u1EA2nh slide 2", "/landing-assets/slide_img_2.webp"),
16089
16126
  image("positionSlide3Image", "\u1EA2nh slide 3", "/landing-assets/slide_img_3.webp"),
16090
16127
  image("positionSlide4Image", "\u1EA2nh slide 4", "/landing-assets/slide_img_4.webp")
@@ -16697,7 +16734,7 @@ function CmsTextToolbar({ layout, color, colorPicker, inlineControls, structureC
16697
16734
  const fontLabel = matchedFont?.[1] ?? fontName;
16698
16735
  const selectedFont = layout.fontFamily ?? matchedFont?.[0] ?? "";
16699
16736
  const tooltipProps = { slotProps: { popper: { sx: { zIndex: 1800 } } } };
16700
- const inputSx = { width: 52, flexShrink: 0, "& .MuiInputBase-root": { height: 32 }, "& input": { py: 0.5, px: 0.75, fontSize: 12 } };
16737
+ const inputSx = { width: 52, flexShrink: 0, "& .MuiInputBase-root": { height: 30 }, "& input": { py: 0.5, px: 0.75, fontSize: 12 } };
16701
16738
  const groupSx = { display: "flex", alignItems: "center", gap: 0.5 };
16702
16739
  return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
16703
16740
  import_material.Box,
@@ -16708,7 +16745,7 @@ function CmsTextToolbar({ layout, color, colorPicker, inlineControls, structureC
16708
16745
  "data-cms-text-toolbar": true,
16709
16746
  sx: { display: "flex", flexDirection: "column", gap: 0.5, p: 0.75, border: "1px solid", borderColor: "divider", borderRadius: 1, bgcolor: "background.paper", boxShadow: 8, color: "text.primary", maxWidth: "100%" },
16710
16747
  children: [
16711
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_material.Box, { sx: { ...groupSx, flexWrap: "wrap", "& > .MuiInputBase-root:nth-of-type(-n+2)": { flexGrow: 1 }, pb: 0.5, borderBottom: "1px solid", borderColor: "divider" }, children: [
16748
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_material.Box, { sx: { ...groupSx, flexWrap: "wrap", rowGap: 0.75, pb: 0.75, borderBottom: "1px solid", borderColor: "divider" }, children: [
16712
16749
  /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
16713
16750
  import_material.Select,
16714
16751
  {
@@ -16718,7 +16755,7 @@ function CmsTextToolbar({ layout, color, colorPicker, inlineControls, structureC
16718
16755
  inputProps: { "aria-label": "Font ch\u1EEF" },
16719
16756
  renderValue: (value4) => value4 ? CMS_TEXT_FONTS[value4] : fontLabel,
16720
16757
  MenuProps: { disableScrollLock: true, container: () => toolbarRef.current?.ownerDocument.body ?? null, sx: { zIndex: 1600 }, slotProps: { paper: { sx: { maxHeight: 320 } } } },
16721
- sx: { width: 128, height: 30, fontSize: 12, "& .MuiSelect-select": { py: 0.5, pl: 1, pr: "24px !important" }, "& .MuiSelect-icon": { right: 3 } },
16758
+ sx: { width: "auto", maxWidth: 160, height: 30, fontSize: 12, "& .MuiSelect-select": { py: 0.5, pl: 1, pr: "24px !important", overflow: "hidden", textOverflow: "ellipsis" }, "& .MuiSelect-icon": { right: 2 } },
16722
16759
  onChange: (event) => onLayoutChange({ fontFamily: event.target.value || void 0 }),
16723
16760
  children: [
16724
16761
  !selectedFont && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_material.MenuItem, { value: "", sx: { fontSize: 12 }, children: fontLabel }),
@@ -16757,7 +16794,7 @@ function CmsTextToolbar({ layout, color, colorPicker, inlineControls, structureC
16757
16794
  type: "number",
16758
16795
  value: lineHeight,
16759
16796
  slotProps: { input: { startAdornment: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_material.InputAdornment, { position: "start", sx: { mr: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_material.SvgIcon, { sx: { fontSize: 17 }, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M3 4 0 7h2v10H0l3 3 3-3H4V7h2L3 4zm5 2h16v2H8zm0 5h16v2H8zm0 5h16v2H8z" }) }) }) }, htmlInput: { "aria-label": "Chi\u1EC1u cao d\xF2ng", min: 0.5, max: 5, step: 0.1 } },
16760
- sx: { ...inputSx, width: 78, "& .MuiInputBase-root": { height: 32, pl: 0.75 } },
16797
+ sx: { ...inputSx, width: 78, "& .MuiInputBase-root": { height: 30, pl: 0.75 } },
16761
16798
  onChange: (event) => {
16762
16799
  dirtyLineHeight.current = true;
16763
16800
  setLineHeight(event.target.value);
@@ -16842,11 +16879,14 @@ var wikexCmsBlocks = sourceCmsBlocks.map((block) => {
16842
16879
  // Annotate the CommonJS export names for ESM import in node:
16843
16880
  0 && (module.exports = {
16844
16881
  CMS_ELEMENTS_FIELD,
16882
+ CMS_LIST_MARKERS,
16845
16883
  CMS_TEXT_FONTS,
16846
16884
  CMS_TEXT_LAYOUT_SUFFIX,
16847
16885
  CmsTextToolbar,
16848
16886
  FeesTable,
16849
16887
  applyCmsTextLayout,
16888
+ cmsListAnchor,
16889
+ cmsListMarkerType,
16850
16890
  cmsTextLayoutStyle,
16851
16891
  migrateWikexChromeContent,
16852
16892
  minimalMarketingBlocks,