{"version":3,"file":"screen-text-shadows.mjs","names":[],"sources":["../src/screen-text-shadows.tsx"],"sourcesContent":["import { __, sprintf } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\nimport type { TextShadowPreset } from '@wordpress/global-styles-engine';\nimport { ScreenHeader } from './screen-header';\nimport { ScreenBody } from './screen-body';\nimport PresetGroup from './presets/preset-group';\nimport { usePresets } from './presets/use-presets';\nimport { useSetting } from './hooks';\nimport { getNewIndexFromPresets } from './utils';\n\nexport const DEFAULT_TEXT_SHADOW = '0.05em 0.05em 0.1em rgba(0, 0, 0, 0.3)';\n\nexport default function ScreenTextShadows() {\n\tconst [ defaultEnabled ] = useSetting< boolean >(\n\t\t'typography.defaultTextShadowPresets'\n\t);\n\tconst def = usePresets< TextShadowPreset >(\n\t\t'typography.textShadowPresets',\n\t\t'default'\n\t);\n\tconst theme = usePresets< TextShadowPreset >(\n\t\t'typography.textShadowPresets',\n\t\t'theme'\n\t);\n\tconst custom = usePresets< TextShadowPreset >(\n\t\t'typography.textShadowPresets',\n\t\t'custom'\n\t);\n\n\tconst addCustomTextShadow = () => {\n\t\tconst index = getNewIndexFromPresets( custom.presets, 'text-shadow-' );\n\t\tcustom.setPresets( [\n\t\t\t...custom.presets,\n\t\t\t{\n\t\t\t\t/* translators: %d: is an index for a preset */\n\t\t\t\tname: sprintf( __( 'Text Shadow %d' ), index ),\n\t\t\t\ttextShadow: DEFAULT_TEXT_SHADOW,\n\t\t\t\tslug: `text-shadow-${ index }`,\n\t\t\t},\n\t\t] );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\ttitle={ __( 'Text shadows' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Manage and create text shadow styles for use across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<ScreenBody>\n\t\t\t\t<Stack\n\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\tclassName=\"global-styles-ui__text-shadows-panel\"\n\t\t\t\t\tgap=\"xl\"\n\t\t\t\t>\n\t\t\t\t\t{ defaultEnabled && (\n\t\t\t\t\t\t<PresetGroup\n\t\t\t\t\t\t\tlabel={ __( 'Default' ) }\n\t\t\t\t\t\t\titems={ def.presets }\n\t\t\t\t\t\t\tgetEditPath={ ( slug ) =>\n\t\t\t\t\t\t\t\t`/typography/text-shadows/edit/default/${ slug }`\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ theme.presets.length > 0 && (\n\t\t\t\t\t\t<PresetGroup\n\t\t\t\t\t\t\tlabel={ __( 'Theme' ) }\n\t\t\t\t\t\t\titems={ theme.presets }\n\t\t\t\t\t\t\tgetEditPath={ ( slug ) =>\n\t\t\t\t\t\t\t\t`/typography/text-shadows/edit/theme/${ slug }`\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<PresetGroup\n\t\t\t\t\t\tlabel={ __( 'Custom' ) }\n\t\t\t\t\t\titems={ custom.presets }\n\t\t\t\t\t\tgetEditPath={ ( slug ) =>\n\t\t\t\t\t\t\t`/typography/text-shadows/edit/custom/${ slug }`\n\t\t\t\t\t\t}\n\t\t\t\t\t\taddLabel={ __( 'Add text shadow' ) }\n\t\t\t\t\t\tonAdd={ addCustomTextShadow }\n\t\t\t\t\t\tmenuAction={ {\n\t\t\t\t\t\t\tlabel: __( 'Remove all custom text shadows' ),\n\t\t\t\t\t\t\toptionsLabel: __( 'Text shadow options' ),\n\t\t\t\t\t\t\tconfirmText: __(\n\t\t\t\t\t\t\t\t'Are you sure you want to remove all custom text shadows?'\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tconfirmButtonText: __( 'Remove' ),\n\t\t\t\t\t\t\tonConfirm: () => custom.setPresets( [] ),\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</Stack>\n\t\t\t</ScreenBody>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;;;AAUA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