{"version":3,"file":"NcActionButton-lB2jlX-b.chunk.mjs","sources":["../node_modules/@nextcloud/vue/dist/chunks/NcActionButton-1gSJfFUC.mjs"],"sourcesContent":["import '../assets/NcActionButton-CG4V9b5b.css';\nimport { m as mdiChevronRight, a as mdiCheck } from \"./mdi-DkJglNiS.mjs\";\nimport { N as NcIconSvgWrapper } from \"./NcIconSvgWrapper-Bui9PhAS.mjs\";\nimport { A as ActionTextMixin } from \"./actionText-BMig9Egt.mjs\";\nimport { n as normalizeComponent } from \"./_plugin-vue2_normalizer-DU4iP6Vu.mjs\";\nconst _sfc_main = {\n  name: \"NcActionButton\",\n  components: {\n    NcIconSvgWrapper\n  },\n  mixins: [ActionTextMixin],\n  inject: {\n    isInSemanticMenu: {\n      from: \"NcActions:isSemanticMenu\",\n      default: false\n    }\n  },\n  props: {\n    /**\n     * @deprecated To be removed in @nextcloud/vue 9. Migration guide: remove ariaHidden prop from NcAction* components.\n     * @todo Add a check in @nextcloud/vue 9 that this prop is not provided,\n     * otherwise root element will inherit incorrect aria-hidden.\n     */\n    ariaHidden: {\n      type: Boolean,\n      // eslint-disable-next-line vue/no-boolean-default\n      default: null\n    },\n    /**\n     * disabled state of the action button\n     */\n    disabled: {\n      type: Boolean,\n      default: false\n    },\n    /**\n     * If this is a menu, a chevron icon will\n     * be added at the end of the line\n     */\n    isMenu: {\n      type: Boolean,\n      default: false\n    },\n    /**\n     * The button's behavior, by default the button acts like a normal button with optional toggle button behavior if `modelValue` is `true` or `false`.\n     * But you can also set to checkbox button behavior with tri-state or radio button like behavior.\n     * This extends the native HTML button type attribute.\n     */\n    type: {\n      type: String,\n      default: \"button\",\n      validator: (behavior) => [\"button\", \"checkbox\", \"radio\", \"reset\", \"submit\"].includes(behavior)\n    },\n    /**\n     * The buttons state if `type` is 'checkbox' or 'radio' (meaning if it is pressed / selected).\n     * For checkbox and toggle button behavior - boolean value.\n     * For radio button behavior - could be a boolean checked or a string with the value of the button.\n     * Note: Unlike native radio buttons, NcActionButton are not grouped by name, so you need to connect them by bind correct modelValue.\n     *\n     *  **This is not availabe for `type='submit'` or `type='reset'`**\n     *\n     * If using `type='checkbox'` a `model-value` of `true` means checked, `false` means unchecked and `null` means indeterminate (tri-state)\n     * For `type='radio'` `null` is equal to `false`\n     */\n    modelValue: {\n      type: [Boolean, String],\n      default: null\n    },\n    /**\n     * The value used for the `modelValue` when this component is used with radio behavior\n     * Similar to the `value` attribute of `<input type=\"radio\">`\n     */\n    value: {\n      type: String,\n      default: null\n    },\n    /**\n     * Small underlying text content of the entry\n     */\n    description: {\n      type: String,\n      default: \"\"\n    }\n  },\n  setup() {\n    return {\n      mdiCheck,\n      mdiChevronRight\n    };\n  },\n  computed: {\n    /**\n     * determines if the action is focusable\n     *\n     * @return {boolean} is the action focusable ?\n     */\n    isFocusable() {\n      return !this.disabled;\n    },\n    /**\n     * The current \"checked\" or \"pressed\" state for the model behavior\n     */\n    isChecked() {\n      if (this.type === \"radio\" && typeof this.modelValue !== \"boolean\") {\n        return this.modelValue === this.value;\n      }\n      return this.modelValue;\n    },\n    /**\n     * The native HTML type to set on the button\n     */\n    nativeType() {\n      if (this.type === \"submit\" || this.type === \"reset\") {\n        return this.type;\n      }\n      return \"button\";\n    },\n    /**\n     * HTML attributes to bind to the <button>\n     */\n    buttonAttributes() {\n      const attributes = {};\n      if (this.isInSemanticMenu) {\n        attributes.role = \"menuitem\";\n        if (this.type === \"radio\") {\n          attributes.role = \"menuitemradio\";\n          attributes[\"aria-checked\"] = this.isChecked ? \"true\" : \"false\";\n        } else if (this.type === \"checkbox\" || this.nativeType === \"button\" && this.modelValue !== null) {\n          attributes.role = \"menuitemcheckbox\";\n          attributes[\"aria-checked\"] = this.modelValue === null ? \"mixed\" : this.modelValue ? \"true\" : \"false\";\n        }\n      } else if (this.modelValue !== null && this.nativeType === \"button\") {\n        attributes[\"aria-pressed\"] = this.modelValue ? \"true\" : \"false\";\n      }\n      return attributes;\n    }\n  },\n  methods: {\n    /**\n     * Forward click event, let mixin handle the close-after-click and emit new modelValue if needed\n     *\n     * @param {MouseEvent} event The click event\n     */\n    handleClick(event) {\n      this.onClick(event);\n      if (this.modelValue !== null || this.type !== \"button\") {\n        if (this.type === \"radio\") {\n          if (typeof this.modelValue !== \"boolean\") {\n            if (!this.isChecked) {\n              this.$emit(\"update:modelValue\", this.value);\n            }\n          } else {\n            this.$emit(\"update:modelValue\", !this.isChecked);\n          }\n        } else {\n          this.$emit(\"update:modelValue\", !this.isChecked);\n        }\n      }\n    }\n  }\n};\nvar _sfc_render = function render() {\n  var _vm = this, _c = _vm._self._c;\n  return _c(\"li\", { staticClass: \"action\", class: { \"action--disabled\": _vm.disabled }, attrs: { \"role\": _vm.isInSemanticMenu && \"presentation\" } }, [_c(\"button\", _vm._b({ staticClass: \"action-button button-vue\", class: {\n    \"action-button--active\": _vm.isChecked,\n    focusable: _vm.isFocusable\n  }, attrs: { \"aria-label\": _vm.ariaLabel, \"disabled\": _vm.disabled, \"title\": _vm.title, \"type\": _vm.nativeType }, on: { \"click\": _vm.handleClick } }, \"button\", _vm.buttonAttributes, false), [_vm._t(\"icon\", function() {\n    return [_c(\"span\", { staticClass: \"action-button__icon\", class: [_vm.isIconUrl ? \"action-button__icon--url\" : _vm.icon], style: { backgroundImage: _vm.isIconUrl ? `url(${_vm.icon})` : null }, attrs: { \"aria-hidden\": \"true\" } })];\n  }), _c(\"span\", { staticClass: \"action-button__longtext-wrapper\" }, [_vm.name ? _c(\"strong\", { staticClass: \"action-button__name\" }, [_vm._v(\" \" + _vm._s(_vm.name) + \" \")]) : _vm._e(), _vm.isLongText ? _c(\"span\", { staticClass: \"action-button__longtext\", domProps: { \"textContent\": _vm._s(_vm.text) } }) : _c(\"span\", { staticClass: \"action-button__text\" }, [_vm._v(\" \" + _vm._s(_vm.text) + \" \")]), _vm.description ? _c(\"span\", { staticClass: \"action-button__description\", domProps: { \"textContent\": _vm._s(_vm.description) } }) : _vm._e()]), _vm.isMenu ? _c(\"NcIconSvgWrapper\", { staticClass: \"action-button__menu-icon\", attrs: { \"directional\": \"\", \"path\": _vm.mdiChevronRight } }) : _vm.isChecked ? _c(\"NcIconSvgWrapper\", { staticClass: \"action-button__pressed-icon\", attrs: { \"path\": _vm.mdiCheck } }) : _vm.isChecked === false ? _c(\"span\", { staticClass: \"action-button__pressed-icon material-design-icon\" }) : _vm._e(), _vm._e()], 2)]);\n};\nvar _sfc_staticRenderFns = [];\nvar __component__ = /* @__PURE__ */ normalizeComponent(\n  _sfc_main,\n  _sfc_render,\n  _sfc_staticRenderFns,\n  false,\n  null,\n  \"5b4c6c71\"\n);\nconst NcActionButton = __component__.exports;\nexport {\n  NcActionButton as N\n};\n//# sourceMappingURL=NcActionButton-1gSJfFUC.mjs.map\n"],"names":["_sfc_main","NcIconSvgWrapper","ActionTextMixin","behavior","mdiCheck","mdiChevronRight","attributes","event","_sfc_render","_vm","_c","_sfc_staticRenderFns","__component__","normalizeComponent","NcActionButton"],"mappings":"kQAKA,MAAMA,EAAY,CAChB,KAAM,iBACN,WAAY,CACV,iBAAAC,CACJ,EACE,OAAQ,CAACC,CAAe,EACxB,OAAQ,CACN,iBAAkB,CAChB,KAAM,2BACN,QAAS,EACf,CACA,EACE,MAAO,CAML,WAAY,CACV,KAAM,QAEN,QAAS,IACf,EAII,SAAU,CACR,KAAM,QACN,QAAS,EACf,EAKI,OAAQ,CACN,KAAM,QACN,QAAS,EACf,EAMI,KAAM,CACJ,KAAM,OACN,QAAS,SACT,UAAYC,GAAa,CAAC,SAAU,WAAY,QAAS,QAAS,QAAQ,EAAE,SAASA,CAAQ,CACnG,EAYI,WAAY,CACV,KAAM,CAAC,QAAS,MAAM,EACtB,QAAS,IACf,EAKI,MAAO,CACL,KAAM,OACN,QAAS,IACf,EAII,YAAa,CACX,KAAM,OACN,QAAS,EACf,CACA,EACE,OAAQ,CACN,MAAO,CACL,SAAAC,EACA,gBAAAC,CACN,CACE,EACA,SAAU,CAMR,aAAc,CACZ,MAAO,CAAC,KAAK,QACf,EA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