{
  "version": 3,
  "sources": ["../../../src/components/widget-settings/widget-settings-trigger.tsx"],
  "sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { drawerRight } from '@wordpress/icons';\n// Dashboard is still experimental.\n// eslint-disable-next-line @wordpress/use-recommended-components\nimport { IconButton } from '@wordpress/ui';\nimport type { WidgetType } from '@wordpress/widget-primitives';\nimport { useWidgetSettingsToggle } from './use-widget-settings-toggle';\nimport type { DashboardWidget } from '../../types';\n\nexport interface WidgetSettingsTriggerProps {\n\t/**\n\t * The instance whose settings surface this control opens.\n\t */\n\twidget: DashboardWidget< unknown >;\n\n\t/**\n\t * The instance's widget type, used for the accessible label and the\n\t * attributes guard.\n\t */\n\twidgetType: WidgetType;\n}\n\n/**\n * Per-instance control that toggles the shared settings surface; the single\n * `WidgetSettings` at the root reacts to it. Clicking the control of the\n * instance whose settings surface is already open closes it. Returns `null`\n * when no attribute needs that surface (none, or all already promoted to the\n * prominent one), so chrome can mount it unconditionally.\n *\n * @param {WidgetSettingsTriggerProps} props Component props.\n */\nexport function WidgetSettingsTrigger( {\n\twidget,\n\twidgetType,\n}: WidgetSettingsTriggerProps ): React.ReactNode {\n\tconst { toggle } = useWidgetSettingsToggle( widget );\n\n\t// Surface the settings UI only when there are attributes not already\n\t// promoted inline; if every attribute is high-relevance, a second\n\t// surface would just repeat the prominent one.\n\tconst hasNonPromotedAttributes = widgetType.attributes?.some(\n\t\t( attribute ) => attribute.relevance !== 'high'\n\t);\n\tif ( ! hasNonPromotedAttributes ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<IconButton\n\t\t\ticon={ drawerRight }\n\t\t\tlabel={ __( 'Widget settings' ) }\n\t\t\tvariant=\"minimal\"\n\t\t\ttone=\"neutral\"\n\t\t\tsize=\"compact\"\n\t\t\tonClick={ toggle }\n\t\t/>\n\t);\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmB;AACnB,mBAA4B;AAG5B,gBAA2B;AAE3B,wCAAwC;AA0CtC;AAjBK,SAAS,sBAAuB;AAAA,EACtC;AAAA,EACA;AACD,GAAiD;AAChD,QAAM,EAAE,OAAO,QAAI,2DAAyB,MAAO;AAKnD,QAAM,2BAA2B,WAAW,YAAY;AAAA,IACvD,CAAE,cAAe,UAAU,cAAc;AAAA,EAC1C;AACA,MAAK,CAAE,0BAA2B;AACjC,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,MAAO;AAAA,MACP,WAAQ,gBAAI,iBAAkB;AAAA,MAC9B,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAU;AAAA;AAAA,EACX;AAEF;",
  "names": []
}
