soinproduction-gutenberg 0.3.44 → 0.3.46

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.
@@ -807,3 +807,8 @@
807
807
 
808
808
  /* Color setting labels match heading and other inspector field labels. */
809
809
  .site-field-color > legend .site-setting-label > span:first-child { font-size: 11px; font-weight: 500; text-transform: uppercase; }
810
+
811
+ /* Text uses the same preset tiles as Heading; its color stays in the same panel. */
812
+ .site-text-size-options{grid-template-columns:repeat(3,minmax(0,1fr))}
813
+ .site-text-size-options>.components-button{text-transform:uppercase;font-size:11px;padding:0 4px}
814
+ .site-text-color-setting>span{font-size:11px;font-weight:500;text-transform:uppercase}
@@ -1,7 +1,6 @@
1
1
  import { editorEnvironment } from './environment.js';
2
- import { SelectControl } from '../../ui/select.js';
3
2
  import { textFontSize } from '../fields/appearance.js';
4
- import { useId, useRef, useState } from 'react';
3
+ import { useId, useRef, useState, type KeyboardEvent } from 'react';
5
4
  import { OrderedInspectorControls } from './inspector.js';
6
5
  import { EditorAction } from '../ui/editor-action.js';
7
6
  import { SettingLabel } from './reset.js';
@@ -41,7 +40,7 @@ function AppearancePanel({ field, children, controls, options }: any) {
41
40
  const row = <div className="site-field-appearance"><span>{(field.label ?? 'Text') + ' color'}</span>{children}</div>;
42
41
  return controls ? row : <OrderedInspectorControls order={field.order}><div className="site-field-appearance-panel">{row}</div></OrderedInspectorControls>;
43
42
  }
44
- function TextSizeControl({ field, value = {}, setValue }: any) {
43
+ function TextSizeControl({ value = {}, setValue }: any) {
45
44
  const [configured = []] = wp.blockEditor.useSettings('typography.fontSizes');
46
45
  const entries = (Array.isArray(configured) ? configured : Object.values(configured).flat()).filter((preset: any) => textFontSize(preset?.slug));
47
46
  const presets = [...new Map(entries.map((preset: any) => [preset.slug, preset])).values()] as any[];
@@ -51,17 +50,42 @@ function TextSizeControl({ field, value = {}, setValue }: any) {
51
50
  const choices: {value: string; label: string; disabled?: boolean}[] = allowed ? Object.entries(allowed).filter(([slug]) => slug === '' || presets.some(preset => preset.slug === slug)).map(([value, label]) => ({ value, label }))
52
51
  : [{ value: '', label: 'Section default' }, ...presets.map(preset => ({ value: preset.slug, label: preset.name ?? preset.slug }))];
53
52
  if (allowed && selected && !choices.some(choice => choice.value === selected)) choices.push({value: selected, label: 'Current: ' + (presets.find(preset => preset.slug === selected)?.name ?? selected), disabled: true});
54
- const fields = <SelectControl label={<SettingLabel onReset={() => setValue({ ...value, fontSize: undefined })}
55
- resetDisabled={!selected} resetLabel="Reset text size to section default">Text size</SettingLabel>}
56
- value={selected} onChange={fontSize => setValue({ ...value, fontSize: fontSize || undefined })}
57
- options={choices} />;
58
- return <OrderedInspectorControls order={field.order}><wp.components.PanelBody title="Text" initialOpen>{fields}</wp.components.PanelBody></OrderedInspectorControls>;
53
+ const select = (fontSize: string) => setValue({ ...value, fontSize: fontSize || undefined });
54
+ const navigate = (event: KeyboardEvent<HTMLDivElement>) => {
55
+ const current = (event.target as HTMLElement).closest<HTMLElement>('[data-text-size]');
56
+ if (!current) return;
57
+ const enabled = choices.filter(choice => !choice.disabled);
58
+ if (!enabled.length) return;
59
+ const index = enabled.findIndex(choice => choice.value === current.dataset.textSize);
60
+ const target = event.key === 'Home' ? 0 : event.key === 'End' ? enabled.length - 1 :
61
+ ['ArrowRight', 'ArrowDown'].includes(event.key) ? (index + 1) % enabled.length :
62
+ ['ArrowLeft', 'ArrowUp'].includes(event.key) ? (index + enabled.length - 1) % enabled.length : null;
63
+ if (target === null) return;
64
+ event.preventDefault();
65
+ select(enabled[target].value);
66
+ event.currentTarget.querySelectorAll<HTMLButtonElement>('[data-text-size]:not(:disabled)')[target]?.focus();
67
+ };
68
+ return <fieldset className="site-heading-setting site-text-size-setting">
69
+ <legend><SettingLabel onReset={() => select('')} resetDisabled={!selected}
70
+ resetLabel="Reset text size to section default">Text size</SettingLabel></legend>
71
+ <div className="site-heading-options site-text-size-options" role="radiogroup" aria-label="Text size" onKeyDown={navigate}>
72
+ {choices.map((choice, index) => <wp.components.Button key={choice.value} type="button" role="radio"
73
+ aria-checked={selected === choice.value} disabled={choice.disabled}
74
+ tabIndex={!choice.disabled && (selected === choice.value || (!choices.some(option => !option.disabled && option.value === selected) && index === 0)) ? 0 : -1}
75
+ data-text-size={choice.value} onClick={() => select(choice.value)}>{choice.label}</wp.components.Button>)}
76
+ </div>
77
+ </fieldset>;
59
78
  }
60
79
  export function TextAppearanceControl(props: any) {
61
80
  if (props.options?.itemPanel && !props.controls) return null;
62
81
  const { value = {}, setValue } = props;
63
- const appearance = <AppearancePanel {...props}><AppearanceColorButton label={`${props.field.label ?? 'Text'} color settings`} value={value.color} onChange={(color: string) => setValue({ ...value, color })} /></AppearancePanel>;
64
- return props.options?.fontSize && !props.controls ? <>{appearance}<TextSizeControl {...props} /></> : appearance;
82
+ const color = <AppearanceColorButton label={`${props.field.label ?? 'Text'} color settings`} value={value.color} onChange={(color: string) => setValue({ ...value, color })} />;
83
+ return props.options?.fontSize && !props.controls ? <OrderedInspectorControls order={props.field.order}>
84
+ <wp.components.PanelBody title="Text" initialOpen>
85
+ <TextSizeControl {...props} />
86
+ <div className="site-field-appearance site-text-color-setting"><span>Text color</span>{color}</div>
87
+ </wp.components.PanelBody>
88
+ </OrderedInspectorControls> : <AppearancePanel {...props}>{color}</AppearancePanel>;
65
89
  }
66
90
  export function IconAppearanceControl(props: any) {
67
91
  if (props.options?.itemPanel && !props.controls) return null;
@@ -807,3 +807,8 @@
807
807
 
808
808
  /* Color setting labels match heading and other inspector field labels. */
809
809
  .site-field-color > legend .site-setting-label > span:first-child { font-size: 11px; font-weight: 500; text-transform: uppercase; }
810
+
811
+ /* Text uses the same preset tiles as Heading; its color stays in the same panel. */
812
+ .site-text-size-options{grid-template-columns:repeat(3,minmax(0,1fr))}
813
+ .site-text-size-options>.components-button{text-transform:uppercase;font-size:11px;padding:0 4px}
814
+ .site-text-color-setting>span{font-size:11px;font-weight:500;text-transform:uppercase}
@@ -1,6 +1,5 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { editorEnvironment } from "./environment.js";
3
- import { SelectControl } from "../../ui/select.js";
4
3
  import { textFontSize } from "../fields/appearance.js";
5
4
  import { useId, useRef, useState } from "react";
6
5
  import { OrderedInspectorControls } from "./inspector.js";
@@ -52,7 +51,7 @@ function AppearancePanel({ field, children, controls, options }) {
52
51
  ] });
53
52
  return controls ? row : /* @__PURE__ */ jsx(OrderedInspectorControls, { order: field.order, children: /* @__PURE__ */ jsx("div", { className: "site-field-appearance-panel", children: row }) });
54
53
  }
55
- function TextSizeControl({ field, value = {}, setValue }) {
54
+ function TextSizeControl({ value = {}, setValue }) {
56
55
  const [configured = []] = wp.blockEditor.useSettings("typography.fontSizes");
57
56
  const entries = (Array.isArray(configured) ? configured : Object.values(configured).flat()).filter((preset) => textFontSize(preset?.slug));
58
57
  const presets = [...new Map(entries.map((preset) => [preset.slug, preset])).values()];
@@ -61,33 +60,56 @@ function TextSizeControl({ field, value = {}, setValue }) {
61
60
  const allowed = editorEnvironment().textSizes;
62
61
  const choices = allowed ? Object.entries(allowed).filter(([slug]) => slug === "" || presets.some((preset) => preset.slug === slug)).map(([value2, label]) => ({ value: value2, label })) : [{ value: "", label: "Section default" }, ...presets.map((preset) => ({ value: preset.slug, label: preset.name ?? preset.slug }))];
63
62
  if (allowed && selected && !choices.some((choice) => choice.value === selected)) choices.push({ value: selected, label: "Current: " + (presets.find((preset) => preset.slug === selected)?.name ?? selected), disabled: true });
64
- const fields = /* @__PURE__ */ jsx(
65
- SelectControl,
66
- {
67
- label: /* @__PURE__ */ jsx(
68
- SettingLabel,
69
- {
70
- onReset: () => setValue({ ...value, fontSize: void 0 }),
71
- resetDisabled: !selected,
72
- resetLabel: "Reset text size to section default",
73
- children: "Text size"
74
- }
75
- ),
76
- value: selected,
77
- onChange: (fontSize) => setValue({ ...value, fontSize: fontSize || void 0 }),
78
- options: choices
79
- }
80
- );
81
- return /* @__PURE__ */ jsx(OrderedInspectorControls, { order: field.order, children: /* @__PURE__ */ jsx(wp.components.PanelBody, { title: "Text", initialOpen: true, children: fields }) });
63
+ const select = (fontSize) => setValue({ ...value, fontSize: fontSize || void 0 });
64
+ const navigate = (event) => {
65
+ const current = event.target.closest("[data-text-size]");
66
+ if (!current) return;
67
+ const enabled = choices.filter((choice) => !choice.disabled);
68
+ if (!enabled.length) return;
69
+ const index = enabled.findIndex((choice) => choice.value === current.dataset.textSize);
70
+ const target = event.key === "Home" ? 0 : event.key === "End" ? enabled.length - 1 : ["ArrowRight", "ArrowDown"].includes(event.key) ? (index + 1) % enabled.length : ["ArrowLeft", "ArrowUp"].includes(event.key) ? (index + enabled.length - 1) % enabled.length : null;
71
+ if (target === null) return;
72
+ event.preventDefault();
73
+ select(enabled[target].value);
74
+ event.currentTarget.querySelectorAll("[data-text-size]:not(:disabled)")[target]?.focus();
75
+ };
76
+ return /* @__PURE__ */ jsxs("fieldset", { className: "site-heading-setting site-text-size-setting", children: [
77
+ /* @__PURE__ */ jsx("legend", { children: /* @__PURE__ */ jsx(
78
+ SettingLabel,
79
+ {
80
+ onReset: () => select(""),
81
+ resetDisabled: !selected,
82
+ resetLabel: "Reset text size to section default",
83
+ children: "Text size"
84
+ }
85
+ ) }),
86
+ /* @__PURE__ */ jsx("div", { className: "site-heading-options site-text-size-options", role: "radiogroup", "aria-label": "Text size", onKeyDown: navigate, children: choices.map((choice, index) => /* @__PURE__ */ jsx(
87
+ wp.components.Button,
88
+ {
89
+ type: "button",
90
+ role: "radio",
91
+ "aria-checked": selected === choice.value,
92
+ disabled: choice.disabled,
93
+ tabIndex: !choice.disabled && (selected === choice.value || !choices.some((option) => !option.disabled && option.value === selected) && index === 0) ? 0 : -1,
94
+ "data-text-size": choice.value,
95
+ onClick: () => select(choice.value),
96
+ children: choice.label
97
+ },
98
+ choice.value
99
+ )) })
100
+ ] });
82
101
  }
83
102
  function TextAppearanceControl(props) {
84
103
  if (props.options?.itemPanel && !props.controls) return null;
85
104
  const { value = {}, setValue } = props;
86
- const appearance = /* @__PURE__ */ jsx(AppearancePanel, { ...props, children: /* @__PURE__ */ jsx(AppearanceColorButton, { label: `${props.field.label ?? "Text"} color settings`, value: value.color, onChange: (color) => setValue({ ...value, color }) }) });
87
- return props.options?.fontSize && !props.controls ? /* @__PURE__ */ jsxs(Fragment, { children: [
88
- appearance,
89
- /* @__PURE__ */ jsx(TextSizeControl, { ...props })
90
- ] }) : appearance;
105
+ const color = /* @__PURE__ */ jsx(AppearanceColorButton, { label: `${props.field.label ?? "Text"} color settings`, value: value.color, onChange: (color2) => setValue({ ...value, color: color2 }) });
106
+ return props.options?.fontSize && !props.controls ? /* @__PURE__ */ jsx(OrderedInspectorControls, { order: props.field.order, children: /* @__PURE__ */ jsxs(wp.components.PanelBody, { title: "Text", initialOpen: true, children: [
107
+ /* @__PURE__ */ jsx(TextSizeControl, { ...props }),
108
+ /* @__PURE__ */ jsxs("div", { className: "site-field-appearance site-text-color-setting", children: [
109
+ /* @__PURE__ */ jsx("span", { children: "Text color" }),
110
+ color
111
+ ] })
112
+ ] }) }) : /* @__PURE__ */ jsx(AppearancePanel, { ...props, children: color });
91
113
  }
92
114
  function IconAppearanceControl(props) {
93
115
  if (props.options?.itemPanel && !props.controls) return null;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../core/editor/appearance.tsx"],
4
- "sourcesContent": ["import { editorEnvironment } from './environment.js';\nimport { SelectControl } from '../../ui/select.js';\nimport { textFontSize } from '../fields/appearance.js';\nimport { useId, useRef, useState } from 'react';\nimport { OrderedInspectorControls } from './inspector.js';\nimport { EditorAction } from '../ui/editor-action.js';\nimport { SettingLabel } from './reset.js';\ndeclare const wp: any;\nexport function Palette({ label, value, onChange }: any) {\n const root = useRef<HTMLFieldSetElement>(null);\n const reset = () => {\n // Keep focus inside a popover before its Reset action becomes disabled.\n root.current?.querySelector<HTMLElement>('[role=\"option\"], [role=\"radio\"], input')?.focus({ preventScroll: true });\n onChange('');\n };\n const [colors = []] = wp.blockEditor.useSettings('color.palette');\n const selected = colors.find((color: any) => color.slug === value)?.color ?? (typeof value === 'string' && value.startsWith('#') ? value : undefined);\n return <fieldset ref={root} className=\"site-field-color\">\n <legend><SettingLabel onReset={reset} resetDisabled={!value} resetLabel={`Reset ${label.toLowerCase()} to default`}>{label}</SettingLabel></legend>\n <wp.components.ColorPalette colors={colors} value={selected} disableCustomColors clearable={false} onChange={(color: string | undefined) => onChange(colors.find((item: any) => item.color === color)?.slug ?? '')} />\n </fieldset>;\n}\n/** A field-label disclosure; the palette participates in the inspector layout. */\nexport function AppearanceColorButton({ label, paletteLabel = 'Text color', value, onChange }: any) {\n const [open, setOpen] = useState(false);\n const id = useId();\n const trigger = useRef<HTMLDivElement>(null);\n return <>\n <div ref={trigger} className=\"site-appearance-toggle\"><EditorAction action=\"style\" label={label}\n aria-expanded={open} aria-controls={id} aria-pressed={Boolean(value)} onClick={() => setOpen(current => !current)} /></div>\n <div id={id} className=\"site-appearance-disclosure\" hidden={!open} onKeyDown={event => {\n if (event.key !== 'Escape') return;\n event.preventDefault(); event.stopPropagation(); setOpen(false);\n trigger.current?.querySelector('button')?.focus({ preventScroll: true });\n }}>{open && <Palette label={paletteLabel} value={value} onChange={onChange} />}</div>\n </>;\n}\n\nfunction AppearancePanel({ field, children, controls, options }: any) {\n if (options?.labelOnly) return children;\n const row = <div className=\"site-field-appearance\"><span>{(field.label ?? 'Text') + ' color'}</span>{children}</div>;\n return controls ? row : <OrderedInspectorControls order={field.order}><div className=\"site-field-appearance-panel\">{row}</div></OrderedInspectorControls>;\n}\nfunction TextSizeControl({ field, value = {}, setValue }: any) {\n const [configured = []] = wp.blockEditor.useSettings('typography.fontSizes');\n const entries = (Array.isArray(configured) ? configured : Object.values(configured).flat()).filter((preset: any) => textFontSize(preset?.slug));\n const presets = [...new Map(entries.map((preset: any) => [preset.slug, preset])).values()] as any[];\n if (!presets.length) return null;\n const selected = textFontSize(value.fontSize) ? value.fontSize : '';\n const allowed = editorEnvironment().textSizes;\n const choices: {value: string; label: string; disabled?: boolean}[] = allowed ? Object.entries(allowed).filter(([slug]) => slug === '' || presets.some(preset => preset.slug === slug)).map(([value, label]) => ({ value, label }))\n : [{ value: '', label: 'Section default' }, ...presets.map(preset => ({ value: preset.slug, label: preset.name ?? preset.slug }))];\n if (allowed && selected && !choices.some(choice => choice.value === selected)) choices.push({value: selected, label: 'Current: ' + (presets.find(preset => preset.slug === selected)?.name ?? selected), disabled: true});\n const fields = <SelectControl label={<SettingLabel onReset={() => setValue({ ...value, fontSize: undefined })}\n resetDisabled={!selected} resetLabel=\"Reset text size to section default\">Text size</SettingLabel>}\n value={selected} onChange={fontSize => setValue({ ...value, fontSize: fontSize || undefined })}\n options={choices} />;\n return <OrderedInspectorControls order={field.order}><wp.components.PanelBody title=\"Text\" initialOpen>{fields}</wp.components.PanelBody></OrderedInspectorControls>;\n}\nexport function TextAppearanceControl(props: any) {\n if (props.options?.itemPanel && !props.controls) return null;\n const { value = {}, setValue } = props;\n const appearance = <AppearancePanel {...props}><AppearanceColorButton label={`${props.field.label ?? 'Text'} color settings`} value={value.color} onChange={(color: string) => setValue({ ...value, color })} /></AppearancePanel>;\n return props.options?.fontSize && !props.controls ? <>{appearance}<TextSizeControl {...props} /></> : appearance;\n}\nexport function IconAppearanceControl(props: any) {\n if (props.options?.itemPanel && !props.controls) return null;\n return <AppearancePanel {...props}><AppearanceColorButton label={`${props.field.label ?? 'Icon'} color settings`} paletteLabel=\"Icon color\" value={props.value} onChange={props.setValue} /></AppearancePanel>;\n}\n"],
5
- "mappings": "AAiBS,SAUA,UATG,KADH;AAjBT,SAAS,yBAAyB;AAClC,SAAS,qBAAqB;AAC9B,SAAS,oBAAoB;AAC7B,SAAS,OAAO,QAAQ,gBAAgB;AACxC,SAAS,gCAAgC;AACzC,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAEtB,SAAS,QAAQ,EAAE,OAAO,OAAO,SAAS,GAAQ;AACvD,QAAM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iB,GAAG,OAAO;AAAA,KAAE,IAAM;AACxG;AACO,SAAS,sBAAsB,OAAY;AAChD,MAAI,MAAM,SAAS,aAAa,CAAC,MAAM,SAAU,QAAO;AACxD,SAAO,oBAAC,mBAAiB,GAAG,OAAO,8BAAC,yBAAsB,OAAO,GAAG,MAAM,MAAM,SAAS,MAAM,mBAAmB,cAAa,cAAa,OAAO,MAAM,OAAO,UAAU,MAAM,UAAU,GAAE;AAC9L;",
6
- "names": ["value"]
4
+ "sourcesContent": ["import { editorEnvironment } from './environment.js';\nimport { textFontSize } from '../fields/appearance.js';\nimport { useId, useRef, useState, type KeyboardEvent } from 'react';\nimport { OrderedInspectorControls } from './inspector.js';\nimport { EditorAction } from '../ui/editor-action.js';\nimport { SettingLabel } from './reset.js';\ndeclare const wp: any;\nexport function Palette({ label, value, onChange }: any) {\n const root = useRef<HTMLFieldSetElement>(null);\n const reset = () => {\n // Keep focus inside a popover before its Reset action becomes disabled.\n root.current?.querySelector<HTMLElement>('[role=\"option\"], [role=\"radio\"], input')?.focus({ preventScroll: true });\n onChange('');\n };\n const [colors = []] = wp.blockEditor.useSettings('color.palette');\n const selected = colors.find((color: any) => color.slug === value)?.color ?? (typeof value === 'string' && value.startsWith('#') ? value : undefined);\n return <fieldset ref={root} className=\"site-field-color\">\n <legend><SettingLabel onReset={reset} resetDisabled={!value} resetLabel={`Reset ${label.toLowerCase()} to default`}>{label}</SettingLabel></legend>\n <wp.components.ColorPalette colors={colors} value={selected} disableCustomColors clearable={false} onChange={(color: string | undefined) => onChange(colors.find((item: any) => item.color === color)?.slug ?? '')} />\n </fieldset>;\n}\n/** A field-label disclosure; the palette participates in the inspector layout. */\nexport function AppearanceColorButton({ label, paletteLabel = 'Text color', value, onChange }: any) {\n const [open, setOpen] = useState(false);\n const id = useId();\n const trigger = useRef<HTMLDivElement>(null);\n return <>\n <div ref={trigger} className=\"site-appearance-toggle\"><EditorAction action=\"style\" label={label}\n aria-expanded={open} aria-controls={id} aria-pressed={Boolean(value)} onClick={() => setOpen(current => !current)} /></div>\n <div id={id} className=\"site-appearance-disclosure\" hidden={!open} onKeyDown={event => {\n if (event.key !== 'Escape') return;\n event.preventDefault(); event.stopPropagation(); setOpen(false);\n trigger.current?.querySelector('button')?.focus({ preventScroll: true });\n }}>{open && <Palette label={paletteLabel} value={value} onChange={onChange} />}</div>\n </>;\n}\n\nfunction AppearancePanel({ field, children, controls, options }: any) {\n if (options?.labelOnly) return children;\n const row = <div className=\"site-field-appearance\"><span>{(field.label ?? 'Text') + ' color'}</span>{children}</div>;\n return controls ? row : <OrderedInspectorControls order={field.order}><div className=\"site-field-appearance-panel\">{row}</div></OrderedInspectorControls>;\n}\nfunction TextSizeControl({ value = {}, setValue }: any) {\n const [configured = []] = wp.blockEditor.useSettings('typography.fontSizes');\n const entries = (Array.isArray(configured) ? configured : Object.values(configured).flat()).filter((preset: any) => textFontSize(preset?.slug));\n const presets = [...new Map(entries.map((preset: any) => [preset.slug, preset])).values()] as any[];\n if (!presets.length) return null;\n const selected = textFontSize(value.fontSize) ? value.fontSize : '';\n const allowed = editorEnvironment().textSizes;\n const choices: {value: string; label: string; disabled?: boolean}[] = allowed ? Object.entries(allowed).filter(([slug]) => slug === '' || presets.some(preset => preset.slug === slug)).map(([value, label]) => ({ value, label }))\n : [{ value: '', label: 'Section default' }, ...presets.map(preset => ({ value: preset.slug, label: preset.name ?? preset.slug }))];\n if (allowed && selected && !choices.some(choice => choice.value === selected)) choices.push({value: selected, label: 'Current: ' + (presets.find(preset => preset.slug === selected)?.name ?? selected), disabled: true});\n const select = (fontSize: string) => setValue({ ...value, fontSize: fontSize || undefined });\n const navigate = (event: KeyboardEvent<HTMLDivElement>) => {\n const current = (event.target as HTMLElement).closest<HTMLElement>('[data-text-size]');\n if (!current) return;\n const enabled = choices.filter(choice => !choice.disabled);\n if (!enabled.length) return;\n const index = enabled.findIndex(choice => choice.value === current.dataset.textSize);\n const target = event.key === 'Home' ? 0 : event.key === 'End' ? enabled.length - 1 :\n ['ArrowRight', 'ArrowDown'].includes(event.key) ? (index + 1) % enabled.length :\n ['ArrowLeft', 'ArrowUp'].includes(event.key) ? (index + enabled.length - 1) % enabled.length : null;\n if (target === null) return;\n event.preventDefault();\n select(enabled[target].value);\n event.currentTarget.querySelectorAll<HTMLButtonElement>('[data-text-size]:not(:disabled)')[target]?.focus();\n };\n return <fieldset className=\"site-heading-setting site-text-size-setting\">\n <legend><SettingLabel onReset={() => select('')} resetDisabled={!selected}\n resetLabel=\"Reset text size to section default\">Text size</SettingLabel></legend>\n <div className=\"site-heading-options site-text-size-options\" role=\"radiogroup\" aria-label=\"Text size\" onKeyDown={navigate}>\n {choices.map((choice, index) => <wp.components.Button key={choice.value} type=\"button\" role=\"radio\"\n aria-checked={selected === choice.value} disabled={choice.disabled}\n tabIndex={!choice.disabled && (selected === choice.value || (!choices.some(option => !option.disabled && option.value === selected) && index === 0)) ? 0 : -1}\n data-text-size={choice.value} onClick={() => select(choice.value)}>{choice.label}</wp.components.Button>)}\n </div>\n </fieldset>;\n}\nexport function TextAppearanceControl(props: any) {\n if (props.options?.itemPanel && !props.controls) return null;\n const { value = {}, setValue } = props;\n const color = <AppearanceColorButton label={`${props.field.label ?? 'Text'} color settings`} value={value.color} onChange={(color: string) => setValue({ ...value, color })} />;\n return props.options?.fontSize && !props.controls ? <OrderedInspectorControls order={props.field.order}>\n <wp.components.PanelBody title=\"Text\" initialOpen>\n <TextSizeControl {...props} />\n <div className=\"site-field-appearance site-text-color-setting\"><span>Text color</span>{color}</div>\n </wp.components.PanelBody>\n </OrderedInspectorControls> : <AppearancePanel {...props}>{color}</AppearancePanel>;\n}\nexport function IconAppearanceControl(props: any) {\n if (props.options?.itemPanel && !props.controls) return null;\n return <AppearancePanel {...props}><AppearanceColorButton label={`${props.field.label ?? 'Icon'} color settings`} paletteLabel=\"Icon color\" value={props.value} onChange={props.setValue} /></AppearancePanel>;\n}\n"],
5
+ "mappings": "AAgBS,SAUA,UATG,KADH;AAhBT,SAAS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AAAA,wBAAC,mBAAiB,GAAG,OAAO;AAAA,IAC5B,qBAAC,SAAI,WAAU,iDAAgD;AAAA,0BAAC,UAAK,wBAAU;AAAA,MAAQ;AAAA,OAAM;AAAA,KAC/F,GACF,IAA8B,oBAAC,mBAAiB,GAAG,OAAQ,iBAAM;AACnE;AACO,SAAS,sBAAsB,OAAY;AAChD,MAAI,MAAM,SAAS,aAAa,CAAC,MAAM,SAAU,QAAO;AACxD,SAAO,oBAAC,mBAAiB,GAAG,OAAO,8BAAC,yBAAsB,OAAO,GAAG,MAAM,MAAM,SAAS,MAAM,mBAAmB,cAAa,cAAa,OAAO,MAAM,OAAO,UAAU,MAAM,UAAU,GAAE;AAC9L;",
6
+ "names": ["value", "color"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soinproduction-gutenberg",
3
- "version": "0.3.44",
3
+ "version": "0.3.46",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {