Measurement of the B$^0_\mathrm{S}$ $\to$ $\mu^+\mu^-$ decay properties and search for the B$^0$ $\to$ $\mu^+\mu^-$ decay in proton-proton collisions at $\sqrt{s}$ = 13 TeV