@enyxs/wikex-components 0.11.19 → 0.11.21

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
@@ -216,8 +216,7 @@ function CmsAddedElements({ field }) {
216
216
  value: context.content[item.field] ?? "",
217
217
  component: "p",
218
218
  sx: {
219
- font: "inherit",
220
- my: 1
219
+ font: "inherit"
221
220
  },
222
221
  editable: context.editable,
223
222
  onChange: context.onChange
@@ -232,9 +231,9 @@ function CmsTextList({ field, type, children }) {
232
231
  });
233
232
  }
234
233
  var NativeList = styled2.ul.withConfig({
235
- componentId: "sc-c7af9336-0"
234
+ componentId: "sc-4154c689-0"
236
235
  })([
237
- `margin:4px 0 8px;padding-left:2em;> li{display:list-item !important;position:relative;padding-left:0 !important;margin-bottom:8px;}> li::before{content:none !important;}`
236
+ `> li{display:list-item !important;padding-left:0 !important;}> li::before{content:none !important;}`
238
237
  ]);
239
238
  function CmsTemplateList({ cmsAs, cmsId, children }) {
240
239
  const context = useContext(ElementContext);
@@ -261,7 +260,8 @@ function CmsTemplateList({ cmsAs, cmsId, children }) {
261
260
  const text = /* @__PURE__ */ _jsx(EditableText, {
262
261
  component: "span",
263
262
  sx: {
264
- font: "inherit"
263
+ font: "inherit",
264
+ display: "block"
265
265
  },
266
266
  field: added.field,
267
267
  value: context?.content[added.field] ?? "M\u1EE5c m\u1EDBi",
@@ -278,7 +278,8 @@ function CmsTemplateList({ cmsAs, cmsId, children }) {
278
278
  if (!items.length) return null;
279
279
  return /* @__PURE__ */ createElement(stored?.type || stored?.marker ? NativeList : cmsAs, {
280
280
  ...stored?.type || stored?.marker ? {
281
- as: stored?.type ?? (stored?.marker === "decimal" || stored?.marker === "lower-alpha" || stored?.marker === "lower-roman" ? "ol" : "ul"),
281
+ as: cmsAs,
282
+ forwardedAs: stored?.type ?? (stored?.marker === "decimal" || stored?.marker === "lower-alpha" || stored?.marker === "lower-roman" ? "ol" : "ul"),
282
283
  style: {
283
284
  listStyleType: stored?.marker ?? (stored?.type === "ol" ? "decimal" : "disc")
284
285
  }
@@ -324,9 +325,10 @@ function parseCmsRichText(value4) {
324
325
  if (!mark || !Number.isInteger(mark.start) || !Number.isInteger(mark.end) || mark.start < 0 || mark.end <= mark.start || mark.end > raw.text.length) continue;
325
326
  const next = { start: mark.start, end: mark.end };
326
327
  if (typeof mark.bold === "boolean") next.bold = mark.bold;
328
+ if (typeof mark.italic === "boolean") next.italic = mark.italic;
327
329
  if (typeof mark.underline === "boolean") next.underline = mark.underline;
328
330
  if (typeof mark.href === "string") next.href = safeCmsTextHref(mark.href);
329
- if (next.bold !== void 0 || next.underline !== void 0 || next.href) marks.push(next);
331
+ if (next.bold !== void 0 || next.italic !== void 0 || next.underline !== void 0 || next.href) marks.push(next);
330
332
  }
331
333
  return { text: raw.text, marks };
332
334
  }
@@ -362,10 +364,10 @@ function patchCmsRichText(value4, text, start, end, patch) {
362
364
  const style = {};
363
365
  rich.marks.filter((m) => m.start <= a && m.end >= b).forEach((m) => Object.assign(style, m));
364
366
  if (a >= start && b <= end) Object.assign(style, patch);
365
- const next = { start: a, end: b, bold: style.bold, underline: style.underline, newTab: style.newTab, href: style.href ? safeCmsTextHref(style.href) : void 0 };
366
- if (next.bold === void 0 && next.underline === void 0 && !next.href) continue;
367
+ 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 };
368
+ if (next.bold === void 0 && next.italic === void 0 && next.underline === void 0 && !next.href) continue;
367
369
  const previous = marks[marks.length - 1];
368
- if (previous && previous.end === a && previous.bold === next.bold && previous.underline === next.underline && previous.href === next.href && previous.newTab === next.newTab) previous.end = b;
370
+ 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;
369
371
  else marks.push(next);
370
372
  }
371
373
  return { text, marks };
@@ -389,9 +391,10 @@ function renderCmsRichText(children, value4, allowLinks = true) {
389
391
  const end = points[index + 1];
390
392
  const mark = Object.assign({}, ...rich.marks.filter((m) => m.start <= start && m.end >= end));
391
393
  const part = text.slice(start - base, end - base);
392
- if (mark.bold === void 0 && mark.underline === void 0 && !mark.href) return part;
394
+ if (mark.bold === void 0 && mark.italic === void 0 && mark.underline === void 0 && !mark.href) return part;
393
395
  const style = {
394
396
  ...mark.bold !== void 0 ? { fontWeight: mark.bold ? 700 : 400 } : {},
397
+ ...mark.italic !== void 0 ? { fontStyle: mark.italic ? "italic" : "normal" } : {},
395
398
  ...mark.underline !== void 0 ? { textDecorationLine: mark.underline ? "underline" : "none" } : {}
396
399
  };
397
400
  return mark.href && links ? /* @__PURE__ */ jsx2("a", { href: mark.href, target: mark.newTab ? "_blank" : void 0, rel: mark.newTab ? "noopener noreferrer" : void 0, style: { color: "inherit", textDecoration: "underline", ...style }, children: part }, start) : /* @__PURE__ */ jsx2("span", { style, children: part }, start);
@@ -411,6 +414,7 @@ function renderCmsRichText(children, value4, allowLinks = true) {
411
414
 
412
415
  // src/shared/text-layout.ts
413
416
  var CMS_TEXT_FONTS = {
417
+ "Inter, sans-serif": "Inter",
414
418
  "Arial, sans-serif": "Arial",
415
419
  "Georgia, serif": "Georgia",
416
420
  '"Times New Roman", serif': "Times New Roman",
@@ -429,6 +433,9 @@ function parseCmsTextLayout(value4) {
429
433
  if (typeof parsed.fontFamily === "string" && Object.prototype.hasOwnProperty.call(CMS_TEXT_FONTS, parsed.fontFamily)) layout.fontFamily = parsed.fontFamily;
430
434
  if (typeof parsed.fontSize === "number" && Number.isFinite(parsed.fontSize) && parsed.fontSize >= 8 && parsed.fontSize <= 300) layout.fontSize = parsed.fontSize;
431
435
  if (["p", "h1", "h2", "h3", "ul", "ol"].includes(parsed.blockType)) layout.blockType = parsed.blockType;
436
+ if (typeof parsed.lineHeight === "number" && Number.isFinite(parsed.lineHeight) && parsed.lineHeight >= 0.5 && parsed.lineHeight <= 5) layout.lineHeight = parsed.lineHeight;
437
+ if (["left", "center", "right"].includes(parsed.textAlign)) layout.textAlign = parsed.textAlign;
438
+ if (["ul", "ol"].includes(parsed.listType)) layout.listType = parsed.listType;
432
439
  const richText = parseCmsRichText(parsed.richText);
433
440
  if (richText) layout.richText = richText;
434
441
  return layout;
@@ -437,11 +444,13 @@ function parseCmsTextLayout(value4) {
437
444
  }
438
445
  }
439
446
  function cmsTextLayoutStyle(value4, templateBlock = false) {
440
- const { width, height, fontFamily, fontSize, blockType } = parseCmsTextLayout(value4);
447
+ const { width, height, fontFamily, fontSize, blockType, lineHeight, textAlign } = parseCmsTextLayout(value4);
441
448
  return {
442
- ...blockType && !templateBlock ? { fontSize: blockType === "h1" ? "2rem" : blockType === "h2" ? "1.5rem" : blockType === "h3" ? "1.25rem" : "1rem", fontWeight: blockType.startsWith("h") ? 700 : 400, lineHeight: 1.5 } : {},
449
+ ...blockType && blockType !== "ul" && blockType !== "ol" && !templateBlock ? { fontSize: blockType === "h1" ? "2rem" : blockType === "h2" ? "1.5rem" : blockType === "h3" ? "1.25rem" : "1rem", fontWeight: blockType.startsWith("h") ? 700 : 400, lineHeight: 1.5 } : {},
443
450
  ...fontFamily ? { fontFamily } : {},
444
- ...fontSize ? { fontSize: `${fontSize}px`, lineHeight: 1.2 } : {},
451
+ ...fontSize ? { fontSize: `${fontSize}px` } : {},
452
+ ...lineHeight ? { lineHeight } : {},
453
+ ...textAlign ? { textAlign, justifyContent: textAlign === "center" ? "center" : textAlign === "right" ? "flex-end" : "flex-start" } : {},
445
454
  whiteSpace: "pre-wrap",
446
455
  overflowWrap: "anywhere",
447
456
  ...width !== void 0 || height !== void 0 ? {
@@ -455,8 +464,8 @@ function cmsTextLayoutStyle(value4, templateBlock = false) {
455
464
  function applyCmsTextLayout(element, value4) {
456
465
  const styles = cmsTextLayoutStyle(value4);
457
466
  const view = element.ownerDocument.defaultView;
458
- if ((styles.width || styles.minHeight) && view?.getComputedStyle(element).display === "inline") {
459
- styles.display = "inline-block";
467
+ if ((styles.textAlign || styles.width || styles.minHeight) && view?.getComputedStyle(element).display === "inline") {
468
+ styles.display = styles.textAlign ? "block" : "inline-block";
460
469
  }
461
470
  const previous = Object.keys(styles).map((key) => {
462
471
  const property = key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
@@ -531,10 +540,12 @@ function EditableText({
531
540
  }) {
532
541
  const colorContext = useContext3(getTextColorContext());
533
542
  const hidden = useCmsElementHidden(field);
534
- const block = parseCmsTextLayout(colorContext?.content[`${field}TextLayout`]).blockType;
543
+ const metadata = parseCmsTextLayout(colorContext?.content[`${field}TextLayout`]);
544
+ const legacyList = metadata.blockType === "ul" || metadata.blockType === "ol" ? metadata.blockType : void 0;
545
+ const listType = metadata.listType ?? legacyList;
546
+ const block = legacyList ? void 0 : metadata.blockType;
535
547
  const templateBlock = useCmsTextBlock(block);
536
548
  if (hidden) return /* @__PURE__ */ jsx3(CmsAddedElements, { field });
537
- const isList = block === "ul" || block === "ol";
538
549
  const colorValue = colorContext?.content[`${field}Color`];
539
550
  const color = validTextColor(colorValue) ? colorValue : void 0;
540
551
  const selected = editable && colorContext?.selectedTextField === field;
@@ -543,7 +554,7 @@ function EditableText({
543
554
  "data-cms-text-field": field,
544
555
  "data-cms-text-rendered": "true",
545
556
  contentEditable: editable ? "plaintext-only" : false,
546
- style: cmsTextLayoutStyle(colorContext?.content[`${field}TextLayout`], Boolean(templateBlock)),
557
+ style: { ...cmsTextLayoutStyle(colorContext?.content[`${field}TextLayout`], Boolean(templateBlock)), ...metadata.textAlign && !templateBlock ? { display: "block" } : {} },
547
558
  suppressContentEditableWarning: true,
548
559
  onBlur: (event) => onChange?.(field, readCmsEditableText(event.currentTarget)),
549
560
  onClick: (event) => {
@@ -566,15 +577,16 @@ function EditableText({
566
577
  "&:focus": { boxShadow: "0 0 0 2px #00A76F" }
567
578
  }
568
579
  },
580
+ ...listType ? [{ font: "inherit", display: "block" }] : [],
569
581
  ...!templateBlock ? Array.isArray(sx) ? sx : sx ? [sx] : [] : [],
570
582
  ...color ? [{ color }] : [],
571
583
  ...selected ? [{ outline: "2px solid #00A76F", outlineOffset: 2 }] : []
572
584
  ],
573
585
  children: renderCmsRichText(value4, parseCmsTextLayout(colorContext?.content[`${field}TextLayout`]).richText, component !== "a" && component !== "button")
574
586
  };
575
- const rendered = templateBlock ? /* @__PURE__ */ jsx3(Box, { component: templateBlock, ...textProps }, String(value4 ?? "")) : /* @__PURE__ */ jsx3(Typography, { component: isList ? "li" : block ?? component ?? "div", variant, ...textProps }, String(value4 ?? ""));
587
+ const rendered = templateBlock ? /* @__PURE__ */ jsx3(Box, { component: templateBlock, ...textProps }, String(value4 ?? "")) : /* @__PURE__ */ jsx3(Typography, { component: block ?? (listType ? "span" : component) ?? "div", variant, ...textProps }, String(value4 ?? ""));
576
588
  return /* @__PURE__ */ jsxs(Fragment, { children: [
577
- isList ? /* @__PURE__ */ jsx3(CmsTextList, { field, type: block, children: rendered }) : rendered,
589
+ listType ? /* @__PURE__ */ jsx3(CmsTextList, { field, type: listType, children: /* @__PURE__ */ jsx3("li", { children: rendered }) }) : rendered,
578
590
  /* @__PURE__ */ jsx3(CmsAddedElements, { field })
579
591
  ] });
580
592
  }
@@ -3537,16 +3549,20 @@ function ExactText({ cmsAs, children, style, cmsDefaultRichText, cmsField, ...pr
3537
3549
  const entry = explicitField ? { field: explicitField, layout: content?.[`${explicitField}TextLayout`], color: typeof content?.[`${explicitField}Color`] === "string" ? String(content[`${explicitField}Color`]) : void 0 } : entries.get(normalize(plainText(children)));
3538
3550
  if (explicitField && content?.[explicitField] !== void 0) children = String(content[explicitField]);
3539
3551
  const hidden = useCmsElementHidden(entry?.field);
3540
- const block = parseCmsTextLayout(entry?.layout).blockType;
3552
+ const metadata = parseCmsTextLayout(entry?.layout);
3553
+ const legacyList = metadata.blockType === "ul" || metadata.blockType === "ol" ? metadata.blockType : void 0;
3554
+ const listType = metadata.listType ?? legacyList;
3555
+ const block = legacyList ? void 0 : metadata.blockType;
3556
+ const listItem = cmsAs === "li" && Boolean(block);
3541
3557
  const templateBlock = useCmsTextBlock(block);
3542
3558
  if (hidden) return /* @__PURE__ */ jsx8(CmsAddedElements, { field: entry?.field });
3543
- const isList = block === "ul" || block === "ol";
3544
- const host = block ? isList ? "li" : block : cmsAs;
3559
+ const host = block ?? (listType ? "span" : cmsAs);
3545
3560
  const layout = entry ? cmsTextLayoutStyle(entry.layout, Boolean(templateBlock)) : void 0;
3546
3561
  const sized = layout?.width || layout?.minHeight;
3547
3562
  const rendered = createElement2(templateBlock ?? (typeof cmsAs === "string" ? host : cmsAs), {
3548
3563
  ...block && !templateBlock && typeof cmsAs !== "string" ? { as: host } : {},
3549
3564
  ...props,
3565
+ ...listItem ? { "data-cms-list-item": void 0 } : {},
3550
3566
  // Replace the edited host when plain text changes; browser-created text nodes
3551
3567
  // must not be reconciled against the previous annotation tree.
3552
3568
  key: plainText(children),
@@ -3555,11 +3571,11 @@ function ExactText({ cmsAs, children, style, cmsDefaultRichText, cmsField, ...pr
3555
3571
  "data-cms-text-rendered": "true",
3556
3572
  "data-cms-text-default-rich": cmsDefaultRichText ? JSON.stringify(cmsDefaultRichText) : void 0,
3557
3573
  "data-cms-text-sized": sized ? "true" : void 0,
3558
- style: { ...style, ...layout, ...entry.color ? { color: entry.color } : {} }
3574
+ style: { ...style, ...layout, ...metadata.textAlign && host === "span" ? { display: "block" } : {}, ...entry.color ? { color: entry.color } : {} }
3559
3575
  } : { style }
3560
3576
  }, entry ? renderCmsRichText(children, parseCmsTextLayout(entry.layout).richText ?? cmsDefaultRichText, cmsAs !== "a" && cmsAs !== "button" && !props.href) : children);
3561
3577
  return /* @__PURE__ */ jsxs6(Fragment5, { children: [
3562
- isList && entry ? /* @__PURE__ */ jsx8(CmsTextList, { field: entry.field, type: block, children: rendered }) : rendered,
3578
+ listType && entry ? /* @__PURE__ */ jsx8(CmsTextList, { field: entry.field, type: listType, children: /* @__PURE__ */ jsx8("li", { children: rendered }) }) : listItem ? /* @__PURE__ */ jsx8("li", { "data-cms-list-item": props["data-cms-list-item"], children: rendered }) : rendered,
3563
3579
  /* @__PURE__ */ jsx8(CmsAddedElements, { field: entry?.field })
3564
3580
  ] });
3565
3581
  }
@@ -16532,12 +16548,30 @@ var wikexCommodityRoutes = wikexCommodityPageTemplates.map(({ route, slug, key }
16532
16548
 
16533
16549
  // src/shared/text-toolbar.tsx
16534
16550
  import { useEffect as useEffect11, useRef as useRef10, useState as useState16 } from "react";
16535
- import { Box as Box7, Button as Button9, MenuItem as MenuItem3, Select as Select3, TextField as TextField3 } from "@mui/material";
16551
+ import { Box as Box7, IconButton as IconButton3, InputAdornment as InputAdornment2, MenuItem as MenuItem3, Select as Select3, SvgIcon, TextField as TextField3, ToggleButton as ToggleButton2, Tooltip } from "@mui/material";
16536
16552
  import { jsx as jsx47, jsxs as jsxs40 } from "react/jsx-runtime";
16537
- function CmsTextToolbar({ layout, color, colorPicker, inlineControls, structureControls, computedFontSize, onLayoutChange, onColorChange, onReset }) {
16553
+ function CmsTextToolbar({ layout, color, colorPicker, inlineControls, structureControls, computedFontSize, computedLineHeight, computedFontFamily, computedTextAlign, onLayoutChange, onColorChange, onReset }) {
16538
16554
  const toolbarRef = useRef10(null);
16539
16555
  const [hex, setHex] = useState16(color);
16540
16556
  const displayedSize = String(computedFontSize ?? layout.fontSize ?? 16);
16557
+ const displayedLineHeight = String(layout.lineHeight ?? computedLineHeight ?? 1.5);
16558
+ const dirtyLineHeight = useRef10(false);
16559
+ const [lineHeight, setLineHeight] = useState16(displayedLineHeight);
16560
+ useEffect11(() => {
16561
+ dirtyLineHeight.current = false;
16562
+ setLineHeight(displayedLineHeight);
16563
+ }, [displayedLineHeight]);
16564
+ const commitLineHeight = () => {
16565
+ if (!dirtyLineHeight.current) return;
16566
+ dirtyLineHeight.current = false;
16567
+ if (!lineHeight.trim()) {
16568
+ onLayoutChange({ lineHeight: void 0 });
16569
+ return;
16570
+ }
16571
+ const value4 = Number(lineHeight);
16572
+ if (Number.isFinite(value4) && value4 >= 0.5 && value4 <= 5) onLayoutChange({ lineHeight: value4 });
16573
+ else setLineHeight(displayedLineHeight);
16574
+ };
16541
16575
  const dirtySize = useRef10(false);
16542
16576
  const [size, setSize] = useState16(displayedSize);
16543
16577
  useEffect11(() => setHex(color), [color]);
@@ -16560,6 +16594,13 @@ function CmsTextToolbar({ layout, color, colorPicker, inlineControls, structureC
16560
16594
  if (Number.isFinite(value4) && value4 >= 8 && value4 <= 300) onLayoutChange({ fontSize: value4 });
16561
16595
  else setSize(displayedSize);
16562
16596
  };
16597
+ const fontName = (computedFontFamily ?? layout.fontFamily ?? "Arial").split(",")[0].trim().replace(/^["']|["']$/g, "");
16598
+ const matchedFont = Object.entries(CMS_TEXT_FONTS).find(([family]) => family.split(",")[0].replace(/^["']|["']$/g, "").toLowerCase() === fontName.toLowerCase());
16599
+ const fontLabel = matchedFont?.[1] ?? fontName;
16600
+ const selectedFont = layout.fontFamily ?? matchedFont?.[0] ?? "";
16601
+ const tooltipProps = { slotProps: { popper: { sx: { zIndex: 1800 } } } };
16602
+ const inputSx = { width: 52, flexShrink: 0, "& .MuiInputBase-root": { height: 32 }, "& input": { py: 0.5, px: 0.75, fontSize: 12 } };
16603
+ const groupSx = { display: "flex", alignItems: "center", gap: 0.5 };
16563
16604
  return /* @__PURE__ */ jsxs40(
16564
16605
  Box7,
16565
16606
  {
@@ -16567,80 +16608,103 @@ function CmsTextToolbar({ layout, color, colorPicker, inlineControls, structureC
16567
16608
  role: "toolbar",
16568
16609
  "aria-label": "\u0110\u1ECBnh d\u1EA1ng ch\u1EEF",
16569
16610
  "data-cms-text-toolbar": true,
16570
- sx: { display: "flex", alignItems: "center", flexWrap: "wrap", gap: 0.5, p: 0.75, overflowX: "auto", border: "1px solid", borderColor: "divider", borderRadius: 1, bgcolor: "background.paper", boxShadow: 4, color: "text.primary", maxWidth: "100%" },
16611
+ 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%" },
16571
16612
  children: [
16572
- structureControls,
16573
- /* @__PURE__ */ jsxs40(
16574
- Select3,
16575
- {
16576
- size: "small",
16577
- displayEmpty: true,
16578
- value: layout.fontFamily ?? "",
16579
- inputProps: { "aria-label": "Font ch\u1EEF" },
16580
- MenuProps: { disableScrollLock: true, container: () => toolbarRef.current?.ownerDocument.body ?? null, slotProps: { paper: { sx: { maxHeight: 320 } } } },
16581
- sx: { width: 106, minWidth: 80, flex: "1 1 106px", height: 32, fontSize: 12, "& .MuiSelect-select": { py: 0.5, pl: 1, pr: "24px !important" }, "& .MuiSelect-icon": { right: 3 } },
16582
- onChange: (event) => onLayoutChange({ fontFamily: event.target.value || void 0 }),
16583
- children: [
16584
- /* @__PURE__ */ jsx47(MenuItem3, { value: "", children: "Font m\u1EB7c \u0111\u1ECBnh" }),
16585
- Object.entries(CMS_TEXT_FONTS).map(([value4, label]) => /* @__PURE__ */ jsx47(MenuItem3, { value: value4, sx: { fontFamily: value4, fontSize: 13 }, children: label }, value4))
16586
- ]
16587
- }
16588
- ),
16589
- /* @__PURE__ */ jsx47(
16590
- TextField3,
16591
- {
16592
- size: "small",
16593
- type: "number",
16594
- value: size,
16595
- slotProps: { htmlInput: { "aria-label": "C\u1EE1 ch\u1EEF (px)", min: 8, max: 300, step: 1 } },
16596
- sx: { width: 56, flexShrink: 0, "& .MuiInputBase-root": { height: 32 }, "& input": { py: 0.5, px: 0.75, fontSize: 12 } },
16597
- onChange: (event) => {
16598
- dirtySize.current = true;
16599
- setSize(event.target.value);
16600
- },
16601
- onBlur: commitSize,
16602
- onKeyDown: (event) => {
16603
- if (event.key === "Enter") {
16604
- event.preventDefault();
16605
- commitSize();
16613
+ /* @__PURE__ */ jsxs40(Box7, { sx: { ...groupSx, flexWrap: "wrap", pb: 0.5, borderBottom: "1px solid", borderColor: "divider" }, children: [
16614
+ /* @__PURE__ */ jsxs40(
16615
+ Select3,
16616
+ {
16617
+ size: "small",
16618
+ displayEmpty: true,
16619
+ value: selectedFont,
16620
+ inputProps: { "aria-label": "Font ch\u1EEF" },
16621
+ renderValue: (value4) => value4 ? CMS_TEXT_FONTS[value4] : fontLabel,
16622
+ MenuProps: { disableScrollLock: true, container: () => toolbarRef.current?.ownerDocument.body ?? null, sx: { zIndex: 1600 }, slotProps: { paper: { sx: { maxHeight: 320 } } } },
16623
+ sx: { width: 128, height: 30, fontSize: 12, "& .MuiSelect-select": { py: 0.5, pl: 1, pr: "24px !important" }, "& .MuiSelect-icon": { right: 3 } },
16624
+ onChange: (event) => onLayoutChange({ fontFamily: event.target.value || void 0 }),
16625
+ children: [
16626
+ !selectedFont && /* @__PURE__ */ jsx47(MenuItem3, { value: "", sx: { fontSize: 12 }, children: fontLabel }),
16627
+ Object.entries(CMS_TEXT_FONTS).map(([value4, label]) => /* @__PURE__ */ jsx47(MenuItem3, { value: value4, sx: { fontFamily: value4, fontSize: 13 }, children: label }, value4))
16628
+ ]
16629
+ }
16630
+ ),
16631
+ structureControls
16632
+ ] }),
16633
+ /* @__PURE__ */ jsxs40(Box7, { sx: { ...groupSx, flexWrap: "wrap" }, children: [
16634
+ /* @__PURE__ */ jsx47(Tooltip, { title: "C\u1EE1 ch\u1EEF (px)", ...tooltipProps, children: /* @__PURE__ */ jsx47(
16635
+ TextField3,
16636
+ {
16637
+ size: "small",
16638
+ type: "number",
16639
+ value: size,
16640
+ slotProps: { htmlInput: { "aria-label": "C\u1EE1 ch\u1EEF (px)", min: 8, max: 300, step: 1 } },
16641
+ sx: inputSx,
16642
+ onChange: (event) => {
16643
+ dirtySize.current = true;
16644
+ setSize(event.target.value);
16645
+ },
16646
+ onBlur: commitSize,
16647
+ onKeyDown: (event) => {
16648
+ if (event.key === "Enter") {
16649
+ event.preventDefault();
16650
+ commitSize();
16651
+ }
16606
16652
  }
16607
16653
  }
16608
- }
16609
- ),
16610
- /* @__PURE__ */ jsx47(Box7, { component: "span", sx: { fontSize: 12, color: "text.secondary" }, children: "px" }),
16611
- inlineControls,
16612
- colorPicker,
16613
- /* @__PURE__ */ jsx47(
16614
- TextField3,
16615
- {
16616
- size: "small",
16617
- value: hex,
16618
- slotProps: { htmlInput: { "aria-label": "M\xE3 m\xE0u ch\u1EEF", maxLength: 7, spellCheck: false } },
16619
- sx: { width: 70, flexShrink: 0, "& .MuiInputBase-root": { height: 32 }, "& input": { py: 0.5, px: 0.75, fontSize: 12 } },
16620
- onChange: (event) => setHex(event.target.value),
16621
- onBlur: commitColor,
16622
- onKeyDown: (event) => {
16623
- if (event.key === "Enter") {
16624
- event.preventDefault();
16625
- commitColor();
16654
+ ) }),
16655
+ /* @__PURE__ */ jsx47(Tooltip, { title: "Chi\u1EC1u cao d\xF2ng (l\u1EA7n c\u1EE1 ch\u1EEF)", ...tooltipProps, children: /* @__PURE__ */ jsx47(
16656
+ TextField3,
16657
+ {
16658
+ size: "small",
16659
+ type: "number",
16660
+ value: lineHeight,
16661
+ slotProps: { input: { startAdornment: /* @__PURE__ */ jsx47(InputAdornment2, { position: "start", sx: { mr: 0 }, children: /* @__PURE__ */ jsx47(SvgIcon, { sx: { fontSize: 17 }, children: /* @__PURE__ */ jsx47("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 } },
16662
+ sx: { ...inputSx, width: 78, "& .MuiInputBase-root": { height: 32, pl: 0.75 } },
16663
+ onChange: (event) => {
16664
+ dirtyLineHeight.current = true;
16665
+ setLineHeight(event.target.value);
16666
+ },
16667
+ onBlur: commitLineHeight,
16668
+ onKeyDown: (event) => {
16669
+ if (event.key === "Enter") {
16670
+ event.preventDefault();
16671
+ commitLineHeight();
16672
+ }
16626
16673
  }
16627
16674
  }
16628
- }
16629
- ),
16630
- /* @__PURE__ */ jsx47(
16631
- Button9,
16632
- {
16633
- size: "small",
16634
- variant: "outlined",
16635
- color: "inherit",
16636
- type: "button",
16637
- "aria-label": "\u0110\u1EB7t l\u1EA1i \u0111\u1ECBnh d\u1EA1ng ch\u1EEF",
16638
- title: "B\u1ECF \u0111\u1ECBnh d\u1EA1ng ch\u1EEF v\xE0 li\xEAn k\u1EBFt, gi\u1EEF k\xEDch th\u01B0\u1EDBc",
16639
- onClick: onReset,
16640
- sx: { fontSize: 12, fontWeight: 700, height: 32, minWidth: 64, px: 1, flexShrink: 0, whiteSpace: "nowrap", color: "text.primary", bgcolor: "action.hover", borderColor: "text.secondary", "&:hover": { bgcolor: "action.selected", borderColor: "text.primary" } },
16641
- children: "\u0110\u1EB7t l\u1EA1i"
16642
- }
16643
- )
16675
+ ) }),
16676
+ /* @__PURE__ */ jsx47(Box7, { sx: groupSx, children: inlineControls }),
16677
+ /* @__PURE__ */ jsx47(Box7, { sx: { ...groupSx, borderLeft: "1px solid", borderColor: "divider", pl: 1, ml: 0.5 }, children: [["left", "C\u0103n tr\xE1i"], ["center", "C\u0103n gi\u1EEFa"], ["right", "C\u0103n ph\u1EA3i"]].map(([align, label]) => /* @__PURE__ */ jsx47(Tooltip, { title: label, ...tooltipProps, children: /* @__PURE__ */ jsx47(
16678
+ ToggleButton2,
16679
+ {
16680
+ value: align,
16681
+ selected: (layout.textAlign ?? computedTextAlign ?? "left") === align,
16682
+ "aria-label": label,
16683
+ onMouseDown: (event) => event.preventDefault(),
16684
+ onClick: () => onLayoutChange({ textAlign: align }),
16685
+ sx: { width: 30, minWidth: 30, height: 30, p: 0.5, border: 0 },
16686
+ children: /* @__PURE__ */ jsx47(SvgIcon, { sx: { fontSize: 19 }, children: /* @__PURE__ */ jsx47("path", { d: align === "left" ? "M3 4h18v2H3zm0 5h12v2H3zm0 5h18v2H3zm0 5h12v2H3z" : align === "right" ? "M3 4h18v2H3zm6 5h12v2H9zm-6 5h18v2H3zm6 5h12v2H9z" : "M3 4h18v2H3zm3 5h12v2H6zm-3 5h18v2H3zm3 5h12v2H6z" }) })
16687
+ }
16688
+ ) }, align)) }),
16689
+ colorPicker || /* @__PURE__ */ jsx47(
16690
+ TextField3,
16691
+ {
16692
+ size: "small",
16693
+ value: hex,
16694
+ slotProps: { htmlInput: { "aria-label": "M\xE3 m\xE0u ch\u1EEF", maxLength: 7, spellCheck: false } },
16695
+ sx: { ...inputSx, width: 76 },
16696
+ onChange: (event) => setHex(event.target.value),
16697
+ onBlur: commitColor,
16698
+ onKeyDown: (event) => {
16699
+ if (event.key === "Enter") {
16700
+ event.preventDefault();
16701
+ commitColor();
16702
+ }
16703
+ }
16704
+ }
16705
+ ),
16706
+ /* @__PURE__ */ jsx47(Tooltip, { title: "\u0110\u1EB7t l\u1EA1i \u0111\u1ECBnh d\u1EA1ng ch\u1EEF", ...tooltipProps, children: /* @__PURE__ */ jsx47(IconButton3, { size: "small", "aria-label": "\u0110\u1EB7t l\u1EA1i \u0111\u1ECBnh d\u1EA1ng ch\u1EEF", onClick: onReset, sx: { width: 30, height: 30, ml: "auto" }, children: /* @__PURE__ */ jsx47(SvgIcon, { sx: { fontSize: 19 }, children: /* @__PURE__ */ jsx47("path", { d: "m18 4 3 3-9 9-3-3 9-9zM8 14l3 3-3 3H4l-3-3 4-4 3 1zm4 6h10v2H10z" }) }) }) })
16707
+ ] })
16644
16708
  ]
16645
16709
  }
16646
16710
  );